26 #include <com/sun/star/awt/LineEndFormat.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/container/XIndexAccess.hpp>
29 #include <com/sun/star/io/XPersistObject.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/sdb/ErrorCondition.hpp>
32 #include <com/sun/star/sdb/ErrorMessageDialog.hpp>
33 #include <com/sun/star/sdb/SQLContext.hpp>
34 #include <com/sun/star/sdb/SQLErrorEvent.hpp>
35 #include <com/sun/star/sdb/XCompletedConnection.hpp>
36 #include <com/sun/star/sdb/XResultSetAccess.hpp>
37 #include <com/sun/star/sdbc/XRowSet.hpp>
38 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
39 #include <com/sun/star/util/Language.hpp>
66 bool lcl_shouldDisplayError(
const Any& _rError )
69 if ( !( _rError >>= aError ) )
72 if ( ! aError.Message.startsWith(
"[OOoBase]" ) )
78 if ( aError.ErrorCode + ErrorCondition::ROW_SET_OPERATION_VETOED == 0 )
86 void displayException(
const Any& _rExcept,
const css::uno::Reference<css::awt::XWindow>& rParent)
89 if ( !lcl_shouldDisplayError( _rExcept ) )
95 xErrorDialog->execute();
103 void displayException(
const css::sdbc::SQLException& _rExcept,
const css::uno::Reference<css::awt::XWindow>& rParent)
108 void displayException(
const css::sdb::SQLContext& _rExcept,
const css::uno::Reference<css::awt::XWindow>& rParent)
113 void displayException(
const css::sdb::SQLErrorEvent& _rEvent,
const css::uno::Reference<css::awt::XWindow>& rParent)
118 sal_Int32
getElementPos(
const Reference< css::container::XIndexAccess>& xCont,
const Reference< XInterface >& xElement)
125 Reference< XInterface > xNormalized( xElement, UNO_QUERY );
126 DBG_ASSERT( xNormalized.is(),
"getElementPos: invalid element!" );
127 if ( xNormalized.is() )
130 nIndex = xCont->getCount();
135 Reference< XInterface > xCurrent(xCont->getByIndex( nIndex ),UNO_QUERY);
136 DBG_ASSERT( xCurrent.get() == Reference< XInterface >( xCurrent, UNO_QUERY ).
get(),
137 "getElementPos: container element not normalized!" );
138 if ( xNormalized.get() == xCurrent.get() )
152 OUString
getLabelName(
const Reference< css::beans::XPropertySet>& xControlModel)
154 if (!xControlModel.is())
159 Reference< css::beans::XPropertySet> xLabelSet;
161 if (xLabelSet.is() && ::comphelper::hasProperty(
FM_PROP_LABEL, xLabelSet))
165 return ::comphelper::getString(
aLabel);
177 ImplConstruct(Reference< css::sdbc::XResultSet>(_rxCursor), bUseCloned);
191 Reference< css::sdb::XResultSetAccess> xAccess(_rxCursor, UNO_QUERY);
194 m_xMoveOperations = xAccess.is() ? xAccess->createResultSet() : Reference< css::sdbc::XResultSet>();
243 :m_xObject(_rxObject)
260 Reference< css::lang::XEventListener> xPreventDelete(
this);
276 Reference< css::lang::XEventListener> xPreventDelete(
this);
290 Reference< css::io::XPersistObject> xPersistence(_rxObject, UNO_QUERY);
291 DBG_ASSERT(xPersistence.is(),
"::getControlTypeByObject : argument should be a css::io::XPersistObject !");
292 if (!xPersistence.is())
295 OUString sPersistentServiceName = xPersistence->getServiceName();
345 OSL_FAIL(
"::getControlTypeByObject : suspicious persistent service name (formatted field) !");
356 OSL_FAIL(
"::getControlTypeByObject : unknown object type !");
363 bool bIsAlive =
false;
364 Reference< css::sdbcx::XColumnsSupplier> xSupplyCols(_rxRowSet, UNO_QUERY);
365 Reference< css::container::XIndexAccess> xCols;
366 if (xSupplyCols.is())
367 xCols.set(xSupplyCols->getColumns(), UNO_QUERY);
368 if (xCols.is() && (xCols->getCount() > 0))
virtual void disposing(sal_Int16 _nId)=0
css::uno::Reference< css::sdbc::XResultSet > m_xMoveOperations
virtual ~FmXDisposeListener()
#define FM_COMPONENT_GRIDCONTROL
#define FM_COMPONENT_COMMANDBUTTON
#define FM_COMPONENT_FORMATTEDFIELD
#define FM_COMPONENT_RADIOBUTTON
css::uno::Reference< css::sdbcx::XRowLocate > m_xBookmarkOperations
css::uno::Reference< css::beans::XPropertySet > m_xPropertyAccess
#define FM_COMPONENT_PATTERNFIELD
#define FM_COMPONENT_NUMERICFIELD
void ImplConstruct(const css::uno::Reference< css::sdbc::XResultSet > &_rxCursor, bool bUseCloned)
css::uno::Reference< css::uno::XInterface > m_xGeneric
#define FM_COMPONENT_TEXTFIELD
#define FM_COMPONENT_GROUPBOX
CursorWrapper(const css::uno::Reference< css::sdbc::XRowSet > &_rxCursor, bool bUseCloned=false)
#define FM_COMPONENT_IMAGEBUTTON
FmXDisposeMultiplexer(FmXDisposeListener *_pListener, const css::uno::Reference< css::lang::XComponent > &_rxObject)
#define FM_COMPONENT_GRID
rtl::Reference< FmXDisposeMultiplexer > m_pAdapter
css::uno::Reference< css::lang::XComponent > m_xObject
#define FM_COMPONENT_COMBOBOX
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_ASSERT(sCon, aError)
#define FM_COMPONENT_LISTBOX
#define FM_COMPONENT_IMAGECONTROL
#define FM_COMPONENT_FILECONTROL
void setAdapter(FmXDisposeMultiplexer *pAdapter)
#define FM_COMPONENT_CHECKBOX
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
#define FM_SUN_COMPONENT_SPINBUTTON
#define FM_COMPONENT_CURRENCYFIELD
#define FM_SUN_COMPONENT_FORMATTEDFIELD
#define FM_COMPONENT_TIMEFIELD
#define FM_COMPONENT_DATEFIELD
#define FM_SUN_COMPONENT_NAVIGATIONBAR
FmXDisposeListener * m_pListener
CursorWrapper & operator=(const css::uno::Reference< css::sdbc::XRowSet > &xCursor)
Reference< XComponentContext > getProcessComponentContext()
#define FM_COMPONENT_HIDDEN
#define FM_COMPONENT_HIDDENCONTROL
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)
#define FM_COMPONENT_EDIT
#define FM_PROP_CONTROLSOURCE
#define FM_SUN_COMPONENT_SCROLLBAR
OUString getString(const Any &_rAny)
#define FM_PROP_CONTROLLABEL
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pListener
#define FM_COMPONENT_FIXEDTEXT
css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xColumnsSupplier
virtual ~FmXDisposeMultiplexer() override
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)