summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-04-22 13:03:06 +0300
committerTor Lillqvist <tml@collabora.com>2014-04-22 13:04:19 +0300
commitf12237c4c6239428b00dd4885a25bbc3b4f14368 (patch)
treec63ec38956f8abc92dc288739943a0cc083a879b /forms
parente139290ca19b5cf00d1408925d918dbfddebe330 (diff)
More hacking on --disable-database-connectivity
Change-Id: Iefa6b104c60464e5a0d793bd676d8ea7ff2727c1
Diffstat (limited to 'forms')
-rw-r--r--forms/Library_frm.mk11
-rw-r--r--forms/source/component/Filter.cxx17
-rw-r--r--forms/source/component/Filter.hxx4
-rw-r--r--forms/source/component/Grid.cxx6
-rw-r--r--forms/source/component/ListBox.cxx16
-rw-r--r--forms/source/misc/services.cxx6
-rw-r--r--forms/source/runtime/formoperations.cxx3
7 files changed, 57 insertions, 6 deletions
diff --git a/forms/Library_frm.mk b/forms/Library_frm.mk
index d13043118e3c..93acb2df1e0f 100644
--- a/forms/Library_frm.mk
+++ b/forms/Library_frm.mk
@@ -62,12 +62,10 @@ $(eval $(call gb_Library_add_exception_objects,frm,\
forms/source/component/Columns \
forms/source/component/ComboBox \
forms/source/component/Currency \
- forms/source/component/DatabaseForm \
forms/source/component/Date \
forms/source/component/EditBase \
forms/source/component/Edit \
forms/source/component/entrylisthelper \
- forms/source/component/errorbroadcaster \
forms/source/component/EventThread \
forms/source/component/File \
forms/source/component/Filter \
@@ -123,7 +121,6 @@ $(eval $(call gb_Library_add_exception_objects,frm,\
forms/source/richtext/richtextviewport \
forms/source/richtext/rtattributehandler \
forms/source/richtext/specialdispatchers \
- forms/source/runtime/formoperations \
forms/source/solar/component/navbarcontrol \
forms/source/solar/control/navtoolbar \
forms/source/xforms/binding \
@@ -154,4 +151,12 @@ $(eval $(call gb_Library_add_exception_objects,frm,\
forms/source/xforms/xpathlib/xpathlib \
))
+$(eval $(call gb_Library_add_exception_objects,frm,\
+ $(call gb_Helper_optional,DBCONNECTIVITY, \
+ forms/source/component/DatabaseForm \
+ forms/source/component/errorbroadcaster \
+ forms/source/runtime/formoperations \
+ ) \
+))
+
# vim: set noet sw=4 ts=4:
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index 976c82ff22ea..603178f8bd53 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -98,7 +98,9 @@ namespace frm
:UnoControl()
,m_aTextListeners( *this )
,m_xContext( _rxORB )
+#if HAVE_FEATURE_DBCONNECTIVITY
,m_aParser( _rxORB )
+#endif
,m_nControlClass( FormComponentType::TEXTFIELD )
,m_bFilterList( sal_False )
,m_bMultiLine( sal_False )
@@ -109,6 +111,7 @@ namespace frm
sal_Bool OFilterControl::ensureInitialized( )
{
+#if HAVE_FEATURE_DBCONNECTIVITY
if ( !m_xField.is() )
{
OSL_FAIL( "OFilterControl::ensureInitialized: improperly initialized: no field!" );
@@ -139,7 +142,7 @@ namespace frm
// no fallback anymore
return sal_False;
}
-
+#endif
return sal_True;
}
@@ -291,6 +294,9 @@ namespace frm
void SAL_CALL OFilterControl::itemStateChanged( const ItemEvent& rEvent ) throw(RuntimeException, std::exception)
{
+#if !HAVE_FEATURE_DBCONNECTIVITY
+ (void) rEvent;
+#else
OUStringBuffer aText;
switch (m_nControlClass)
{
@@ -377,11 +383,13 @@ namespace frm
while( aIt.hasMoreElements() )
((XTextListener *)aIt.next())->textChanged( aEvt );
}
+#endif
}
void OFilterControl::implInitFilterList()
{
+#if HAVE_FEATURE_DBCONNECTIVITY
if ( !ensureInitialized( ) )
// already asserted in ensureInitialized
return;
@@ -487,6 +495,7 @@ namespace frm
{
DBG_UNHANDLED_EXCEPTION();
}
+#endif
}
// XFocusListener
@@ -506,6 +515,7 @@ namespace frm
sal_Bool SAL_CALL OFilterControl::commit() throw(RuntimeException, std::exception)
{
+#if HAVE_FEATURE_DBCONNECTIVITY
if ( !ensureInitialized( ) )
// already asserted in ensureInitialized
return sal_True;
@@ -550,6 +560,7 @@ namespace frm
while( aIt.hasMoreElements() )
static_cast< XTextListener* >( aIt.next() )->textChanged( aEvt );
}
+#endif
return sal_True;
}
@@ -820,6 +831,9 @@ namespace frm
void OFilterControl::initControlModel(Reference< XPropertySet >& xControlModel)
{
+#if !HAVE_FEATURE_DBCONNECTIVITY
+ (void) xControlModel;
+#else
if ( !xControlModel.is() )
{
OSL_FAIL( "OFilterControl::initialize: invalid control model argument!" );
@@ -873,6 +887,7 @@ namespace frm
xForm = xForm.query( xModel->getParent() );
m_xConnection = ::dbtools::getConnection( xForm );
OSL_ENSURE( m_xConnection.is(), "OFilterControl::initialize: unable to determine the form's connection!" );
+#endif
}
OUString SAL_CALL OFilterControl::getImplementationName( ) throw (RuntimeException, std::exception)
diff --git a/forms/source/component/Filter.hxx b/forms/source/component/Filter.hxx
index f61b7ab40820..51cfd651b470 100644
--- a/forms/source/component/Filter.hxx
+++ b/forms/source/component/Filter.hxx
@@ -20,6 +20,8 @@
#ifndef INCLUDED_FORMS_SOURCE_COMPONENT_FILTER_HXX
#define INCLUDED_FORMS_SOURCE_COMPONENT_FILTER_HXX
+#include <config_features.h>
+
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -70,7 +72,9 @@ namespace frm
MapString2String m_aDisplayItemToValueItem;
OUString m_aText;
+#if HAVE_FEATURE_DBCONNECTIVITY
::connectivity::OSQLParser m_aParser;
+#endif
sal_Int16 m_nControlClass; // which kind of control do we use?
sal_Bool m_bFilterList : 1;
sal_Bool m_bMultiLine : 1;
diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx
index 7d4abec36133..f6a17b10497e 100644
--- a/forms/source/component/Grid.cxx
+++ b/forms/source/component/Grid.cxx
@@ -16,6 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+
+#include <config_features.h>
+
#include "Columns.hxx"
#include "findpos.hxx"
#include "Grid.hxx"
@@ -188,12 +191,15 @@ Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) throw (Ru
return aReturn;
}
+#if HAVE_FEATURE_DBCONNECTIVITY
+
// XSQLErrorListener
void SAL_CALL OGridControlModel::errorOccured( const SQLErrorEvent& _rEvent ) throw (RuntimeException, std::exception)
{
// forward the errors which happened to my columns to my own listeners
onError( _rEvent );
}
+#endif
// XRowSetSupplier
Reference< XRowSet > SAL_CALL OGridControlModel::getRowSet( ) throw (RuntimeException, std::exception)
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index f812dc987c59..ea2d688603b6 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include "ListBox.hxx"
#include "property.hxx"
@@ -352,6 +353,7 @@ namespace frm
}
break;
+#if HAVE_FEATURE_DBCONNECTIVITY
case PROPERTY_ID_SELECT_VALUE :
{
ORowSetValue v;
@@ -360,7 +362,7 @@ namespace frm
setControlValue( newSelectSeq, eOther );
}
break;
-
+#endif
case PROPERTY_ID_DEFAULT_SELECT_SEQ :
DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(static_cast< Sequence<sal_Int16>*>(0))),
"OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
@@ -859,6 +861,7 @@ namespace frm
switch (m_eListSourceType)
{
+#if HAVE_FEATURE_DBCONNECTIVITY
case ListSourceType_SQL:
case ListSourceType_SQLPASSTHROUGH:
case ListSourceType_TABLE:
@@ -928,7 +931,7 @@ namespace frm
}
}
break;
-
+#endif
case ListSourceType_TABLEFIELDS:
{
Reference<XNameAccess> xFieldNames = getTableFields(xConnection, sListSource);
@@ -1173,8 +1176,10 @@ namespace frm
const ValueList aValues( impl_getValues() );
assert( m_nConvertedBoundValuesType == getValueType());
Sequence< sal_Int16 > aSelectionIndicies(i_aValues.getLength());
+
sal_Int32 nCount(0);
+#if HAVE_FEATURE_DBCONNECTIVITY
sal_Int16 *pIndex = aSelectionIndicies.getArray();
const Any *pValue = i_aValues.getConstArray();
const Any * const pValueEnd = i_aValues.getConstArray() + i_aValues.getLength();
@@ -1204,12 +1209,14 @@ namespace frm
}
}
assert(aSelectionIndicies.getArray() + nCount == pIndex);
+#endif
aSelectionIndicies.realloc(nCount);
return aSelectionIndicies;
}
Any OListBoxModel::translateDbColumnToControlValue()
{
+#if HAVE_FEATURE_DBCONNECTIVITY
Reference< XPropertySet > xBoundField( getField() );
if ( !xBoundField.is() )
{
@@ -1223,6 +1230,9 @@ namespace frm
m_aSaveValue = aCurrentValue;
return makeAny( translateDbValueToControlValue(aCurrentValue) );
+#else
+ return Any();
+#endif
}
// XReset
@@ -1325,11 +1335,13 @@ namespace frm
break;
case eValue:
+#if HAVE_FEATURE_DBCONNECTIVITY
{
ORowSetValue v;
v.fill(_rExternalValue);
aSelectIndexes = translateDbValueToControlValue(v);
}
+#endif
break;
case eIndexList:
diff --git a/forms/source/misc/services.cxx b/forms/source/misc/services.cxx
index 02e0548d1d0b..c520e3c93572 100644
--- a/forms/source/misc/services.cxx
+++ b/forms/source/misc/services.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
+
#include "services.hxx"
#include "frm_module.hxx"
#include <cppuhelper/factory.hxx>
@@ -220,7 +222,9 @@ void SAL_CALL createRegistryInfo_FORMS()
static sal_Bool bInit = sal_False;
if (!bInit)
{
+#if HAVE_FEATURE_DBCONNECTIVITY
createRegistryInfo_ODatabaseForm();
+#endif
createRegistryInfo_OFilterControl();
createRegistryInfo_OScrollBarModel();
createRegistryInfo_OSpinButtonModel();
@@ -229,7 +233,9 @@ void SAL_CALL createRegistryInfo_FORMS()
createRegistryInfo_ORichTextModel();
createRegistryInfo_ORichTextControl();
createRegistryInfo_CLibxml2XFormsExtension();
+#if HAVE_FEATURE_DBCONNECTIVITY
createRegistryInfo_FormOperations();
+#endif
bInit = sal_True;
}
}
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 0ca37a5ff244..2e06b5280853 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include "formoperations.hxx"
#include "frm_strings.hxx"
@@ -1741,6 +1742,7 @@ namespace frm
{
f();
}
+#if HAVE_FEATURE_DBCONNECTIVITY
catch( const SQLException& e )
{
(void)e;
@@ -1753,6 +1755,7 @@ namespace frm
aInfo.prepend( sAdditionalError );
aInfo.doThrow();
}
+#endif
catch( const RuntimeException& ) { throw; }
catch( const Exception& )
{