diff options
author | Ocke Janssen <oj@openoffice.org> | 2000-11-15 13:55:12 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2000-11-15 13:55:12 +0000 |
commit | 5a423d53448edd451a2c1adae386a3ca6a38d47e (patch) | |
tree | 401e9985433cf323008730f2c90429c974c31279 | |
parent | aa7e43d64acc727c4de30fa4381e396f33a1045c (diff) |
enable drag&drop
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 347 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/fmpgeimp.cxx | 178 | ||||
-rw-r--r-- | svx/source/form/fmtools.cxx | 7 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 223 | ||||
-rw-r--r-- | svx/source/inc/fmpgeimp.hxx | 22 | ||||
-rw-r--r-- | svx/source/inc/fmvwimp.hxx | 6 |
7 files changed, 374 insertions, 417 deletions
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 115b6c78eea7..4628d659fb76 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmgridcl.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:53:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:54:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,13 +114,6 @@ #ifndef _COM_SUN_STAR_SDDB_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDB_XDATABASEACCESS_HPP_ -#include <com/sun/star/sdb/XDatabaseAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XDATABASEENVIRONMENT_HPP_ -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#endif - #ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_ #include <com/sun/star/view/XSelectionSupplier.hpp> #endif @@ -242,12 +235,18 @@ #endif #ifdef ENABLEUNICODE -#define XUB2ANY(c) ::com::sun::star::uno::makeAny(::rtl::OUString(c)) +#define XUB2ANY(c) makeAny(::rtl::OUString(c)) #endif #ifndef _TRACE_HXX_ #include "trace.hxx" #endif +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdb; +using namespace cppu; + static sal_uInt32 nFormat = 0; //============================================================================== @@ -304,12 +303,12 @@ void FmGridHeader::Select() { sal_uInt16 nPos = GetModelColumnPos(GetCurItemId()); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xColumn; + Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); + Reference< ::com::sun::star::beans::XPropertySet> xColumn; ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos)); - ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY); if (xSelSupplier.is()) - xSelSupplier->select(::com::sun::star::uno::makeAny(xColumn)); + xSelSupplier->select(makeAny(xColumn)); } } @@ -330,10 +329,10 @@ void FmGridHeader::RequestHelp( const HelpEvent& rHEvt ) aItemRect.Bottom() = aPt.Y(); sal_uInt16 nPos = GetModelColumnPos(nItemId); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); + Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); try { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xColumn; + Reference< ::com::sun::star::beans::XPropertySet > xColumn; ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos)); ::rtl::OUString aHelpText; xColumn->getPropertyValue(FM_PROP_HELPTEXT) >>= aHelpText; @@ -386,83 +385,64 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) // SBA_FIELDEXCHANGE_FORMAT // "Datenbankname";"Tabellen/QueryName";1/0(fuer Tabelle/Abfrage);"Feldname" - String aDatabaseName = aDataExchStr.GetToken(0,char(11)); - String aObjectName = aDataExchStr.GetToken(1,char(11)); - sal_uInt16 nObjectType = aDataExchStr.GetToken(2,char(11)).ToInt32(); - String aFieldName = aDataExchStr.GetToken(3,char(11)); + String aDatabaseName = aDataExchStr.GetToken(0,sal_Unicode(11)); + String aObjectName = aDataExchStr.GetToken(1,sal_Unicode(11)); + sal_uInt16 nObjectType = aDataExchStr.GetToken(2,sal_Unicode(11)).ToInt32(); + String aFieldName = aDataExchStr.GetToken(3,sal_Unicode(11)); if (!aFieldName.Len() || !aObjectName.Len() || !aDatabaseName.Len()) return sal_False; - // Datenbank, Tabelle/Abfrage und Feld bestimmen - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseEnvironment > xEnvironment( - static_cast<FmGridControl*>(GetParent())->getServiceManager()->createInstance(SRV_SDB_DATABASE_ENVIRONMENT), ::com::sun::star::uno::UNO_QUERY); - if (!xEnvironment.is()) - return sal_False; + // database, table/query and field + + Reference< XConnection > xConnection; + // Reference< XDataSource > xDataSource; + Reference< XPreparedStatement > xStatement; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > xConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > xDatabaseAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > xStatement; + ::rtl::OUString sDatabaseName = aDatabaseName; + try + { + // xDataSource = dbtools::getDataSource(sDatabaseName,static_cast<FmGridControl*>(GetParent())->getServiceManager()); + xConnection = dbtools::getConnection(sDatabaseName,::rtl::OUString(),::rtl::OUString(),static_cast<FmGridControl*>(GetParent())->getServiceManager()); + } + catch(::com::sun::star::container::NoSuchElementException&) + { // allowed, means aDatabaseName isn't a valid favorite name .... + } + catch(SQLException&) + { // allowed ... the env may throw an exception if it didn't find the object + } + if (!xConnection.is()) + { + DBG_ERROR("FmGridHeader::Drop : could not retrieve the database access object !"); + return sal_False; + } try { - ::rtl::OUString sDatabaseName = aDatabaseName; - try - { - xDatabaseAccess = xEnvironment->getDatabaseAccess(sDatabaseName); - } - catch(::com::sun::star::sdbc::SQLException& e) - { // allowed ... the env may throw an exception if it didn't find the object - e; // make the compiler happy - } - if (!xDatabaseAccess.is()) - { // aDatabaseName isn't a database path. maybe a favorite name ? - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService > xDatabaseAccesses( - static_cast<FmGridControl*>(GetParent())->getServiceManager()->createInstance(SRV_SDB_DATABASE_CONTEXT), ::com::sun::star::uno::UNO_QUERY); - if (xDatabaseAccesses.is()) - { - try - { - xDatabaseAccess = ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > (xDatabaseAccesses->getRegisteredObject(sDatabaseName), ::com::sun::star::uno::UNO_QUERY); - } - catch(::com::sun::star::container::NoSuchElementException&) - { // allowed, means aDatabaseName isn't a valid favorite name .... - } - } - } - - if (!xDatabaseAccess.is()) - { - DBG_ERROR("FmGridHeader::Drop : could not retrieve the database access object !"); - return sal_False; - } - xConnection = xDatabaseAccess->getConnection(rtl::OUString(), rtl::OUString()); - if (!xConnection.is()) - return sal_False; #if DBG_UTIL - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > xServiceInfo(xConnection, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::lang::XServiceInfo > xServiceInfo(xConnection, UNO_QUERY); DBG_ASSERT(xServiceInfo.is() && xServiceInfo->supportsService(SRV_SDB_CONNECTION), "FmGridHeader::Drop : invalid connection (no database access connection !)"); #endif // Festellen des Feldes - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFields; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; + Reference< ::com::sun::star::container::XNameAccess > xFields; + Reference< ::com::sun::star::beans::XPropertySet > xField; switch (nObjectType) { case 0: // old : DataSelectionType_TABLE: { - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > xSupplyTables(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; - ::cppu::extractInterface(xSupplyColumns, xSupplyTables->getTables()->getByName(aObjectName)); + Reference< ::com::sun::star::sdbcx::XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + xSupplyTables->getTables()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } break; case 1: // old : DataSelectionType_QUERY: { - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XQueriesSupplier > xSupplyQueries(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; - ::cppu::extractInterface(xSupplyColumns, xSupplyQueries->getQueries()->getByName(aObjectName)); + Reference< ::com::sun::star::sdb::XQueriesSupplier > xSupplyQueries(xConnection, UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + xSupplyQueries->getQueries()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } break; @@ -471,27 +451,27 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) xStatement = xConnection->prepareStatement(aObjectName); // not interested in any results - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStatProps(xStatement,::com::sun::star::uno::UNO_QUERY); - xStatProps->setPropertyValue(rtl::OUString::createFromAscii("MaxRows"), ::com::sun::star::uno::makeAny(sal_Int32(0))); + Reference< ::com::sun::star::beans::XPropertySet > xStatProps(xStatement,UNO_QUERY); + xStatProps->setPropertyValue(rtl::OUString::createFromAscii("MaxRows"), makeAny(sal_Int32(0))); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), UNO_QUERY); if (xSupplyCols.is()) xFields = xSupplyCols->getColumns(); } } if (xFields.is() && xFields->hasByName(aFieldName)) - ::cppu::extractInterface(xField, xFields->getByName(aFieldName)); + xFields->getByName(aFieldName) >>= xField; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(xConnection, sal_True); + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(xConnection, sal_True); - if (!xSupplier.is()) + if (!xSupplier.is() || !xField.is()) { ::comphelper::disposeComponent(xStatement); return sal_False; } - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats(xSupplier->getNumberFormats()); + Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats(xSupplier->getNumberFormats()); if (!xNumberFormats.is()) { ::comphelper::disposeComponent(xStatement); @@ -506,10 +486,10 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) // diese Datentypen koennen im Gridcontrol nicht verarbeitet werden switch (nDataType) { - case ::com::sun::star::sdbc::DataType::LONGVARBINARY: - case ::com::sun::star::sdbc::DataType::BINARY: - case ::com::sun::star::sdbc::DataType::VARBINARY: - case ::com::sun::star::sdbc::DataType::OTHER: + case DataType::LONGVARBINARY: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::OTHER: ::comphelper::disposeComponent(xStatement); return sal_False; } @@ -518,52 +498,52 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) xField->getPropertyValue(FM_PROP_FORMATKEY) >>= nFormatKey; // Erstellen der Column - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); - ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory > xFactory(xCols, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); + Reference< ::com::sun::star::form::XGridColumnFactory > xFactory(xCols, UNO_QUERY); Point aPos = OutputToScreenPixel(rEvt.GetPosPixel()); sal_uInt16 nColId = GetItemId(rEvt.GetPosPixel()); // EinfuegePosition, immer vor der aktuellen Spalte sal_uInt16 nPos = GetModelColumnPos(nColId); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol, xSecondCol; + Reference< ::com::sun::star::beans::XPropertySet > xCol, xSecondCol; // erzeugen der Column in abhaengigkeit vom type, default textfeld SvULongs aPossibleTypes; switch (nDataType) { - case ::com::sun::star::sdbc::DataType::BIT: + case DataType::BIT: aPossibleTypes.Insert(SID_FM_CHECKBOX, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::TINYINT: - case ::com::sun::star::sdbc::DataType::SMALLINT: - case ::com::sun::star::sdbc::DataType::INTEGER: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: aPossibleTypes.Insert(SID_FM_NUMERICFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::REAL: - case ::com::sun::star::sdbc::DataType::DOUBLE: - case ::com::sun::star::sdbc::DataType::NUMERIC: - case ::com::sun::star::sdbc::DataType::DECIMAL: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::NUMERIC: + case DataType::DECIMAL: aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_NUMERICFIELD, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::TIMESTAMP: + case DataType::TIMESTAMP: aPossibleTypes.Insert(SID_FM_TWOFIELDS_DATE_N_TIME, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_DATEFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_TIMEFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::DATE: + case DataType::DATE: aPossibleTypes.Insert(SID_FM_DATEFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::TIME: + case DataType::TIME: aPossibleTypes.Insert(SID_FM_TIMEFIELD, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); break; - case ::com::sun::star::sdbc::DataType::CHAR: - case ::com::sun::star::sdbc::DataType::VARCHAR: - case ::com::sun::star::sdbc::DataType::LONGVARCHAR: + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: default: aPossibleTypes.Insert(SID_FM_EDIT, aPossibleTypes.Count()); aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count()); @@ -576,8 +556,9 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) && ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_ISCURRENCY))) aPossibleTypes.Insert(SID_FM_CURRENCYFIELD, 0); } - catch(...) + catch(Exception&) { + DBG_ERROR("FmGridHeader::Drop Exception occured!"); } sal_Int32 nPreferedType = -1; @@ -606,12 +587,12 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) nPreferedType = nColCount ? SID_FM_DATEFIELD : SID_FM_TIMEFIELD; sFieldService = FieldServiceFromId(nPreferedType); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xThisRoundCol; + Reference< ::com::sun::star::beans::XPropertySet > xThisRoundCol; if (sFieldService.len()) { xThisRoundCol = xFactory->createColumn(sFieldService); if (xThisRoundCol.is() && ::comphelper::hasProperty(FM_PROP_STRICTFORMAT, xThisRoundCol)) - xThisRoundCol->setPropertyValue(FM_PROP_STRICTFORMAT, ::com::sun::star::uno::makeAny(sal_Bool(sal_False))); + xThisRoundCol->setPropertyValue(FM_PROP_STRICTFORMAT, makeAny(sal_Bool(sal_False))); } if (nColCount) xSecondCol = xThisRoundCol; @@ -638,29 +619,27 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) if (nPreferedType == SID_FM_NUMERICFIELD) { + // set properties for numerix field { - ::com::sun::star::uno::Any aScaleVal(::comphelper::getNumberFormatDecimals(xNumberFormats, nFormatKey)); + Any aScaleVal(::comphelper::getNumberFormatDecimals(xNumberFormats, nFormatKey)); xCol->setPropertyValue(FM_PROP_DECIMAL_ACCURACY,aScaleVal); } - ::com::sun::star::uno::Any aVal; - // die minimale/maximale Zahl in diesem Feld + // set the max and min value for this field sal_Int32 nMinValue = 0, nMaxValue = 1000000000; switch (nDataType) { - case ::com::sun::star::sdbc::DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break; - case ::com::sun::star::sdbc::DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break; - case ::com::sun::star::sdbc::DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break; + case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break; + case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break; + case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break; // um die doubles/singles kuemmere ich mich nicht, da es ein wenig sinnlos ist + // double and singles are ignored } - aVal <<= (double)nMinValue; - xCol->setPropertyValue(FM_PROP_VALUEMIN,aVal); - aVal <<= (double)nMaxValue; - xCol->setPropertyValue(FM_PROP_VALUEMAX,aVal); - - // Formatueberpruefung fue numeric fields standardmaessig sal_True - aVal <<= (sal_Bool)sal_True; - xCol->setPropertyValue(FM_PROP_STRICTFORMAT, aVal); + xCol->setPropertyValue(FM_PROP_VALUEMIN,makeAny((double)nMinValue)); + xCol->setPropertyValue(FM_PROP_VALUEMAX,makeAny((double)nMaxValue)); + + // format checking for numeric fields is default sal_True + xCol->setPropertyValue(FM_PROP_STRICTFORMAT, bool2any(sal_True)); } xCol->setPropertyValue(FM_PROP_CONTROLSOURCE, XUB2ANY(aFieldName)); @@ -691,7 +670,7 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) xCol->setPropertyValue(FM_PROP_NAME, XUB2ANY(aFieldName)); // jetzt einfuegen - ::com::sun::star::uno::Any aElement; + Any aElement; aElement <<= xCol; xCols->insertByIndex(nPos, aElement); @@ -702,8 +681,8 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) } // ist die ::com::sun::star::form::component::Form an die Datenbankangebunden? - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xFormCp(xCols, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xForm(xFormCp->getParent(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::form::XFormComponent > xFormCp(xCols, UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xForm(xFormCp->getParent(), UNO_QUERY); if (xForm.is()) { if (!::comphelper::getString(xForm->getPropertyValue(FM_PROP_DATASOURCE)).getLength()) @@ -712,7 +691,7 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) if (!::comphelper::getString(xForm->getPropertyValue(FM_PROP_COMMAND)).getLength()) { xForm->setPropertyValue(FM_PROP_COMMAND, XUB2ANY(aObjectName)); - ::com::sun::star::uno::Any aCommandType; + Any aCommandType; switch (nObjectType) { case 0: // old : DataSelectionType_TABLE @@ -723,7 +702,7 @@ sal_Bool FmGridHeader::Drop( const DropEvent& rEvt ) break; default: aCommandType <<= (sal_Int32)::com::sun::star::sdb::CommandType::COMMAND; - xForm->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, ::com::sun::star::uno::makeAny((sal_Bool)(2 == nObjectType))); + xForm->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, bool2any((sal_Bool)(2 == nObjectType))); // 2 -> old: DataSelectionType_SQL break; } @@ -745,7 +724,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe { sal_Bool bDesignMode = static_cast<FmGridControl*>(GetParent())->IsDesignMode(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); + Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); // Aufbau des Insert Menues // EinfuegePosition, immer vor der aktuellen Spalte @@ -772,21 +751,21 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe if (pMenu && xCols.is() && nColId) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet; + Reference< ::com::sun::star::beans::XPropertySet > xSet; ::cppu::extractInterface(xSet, xCols->getByIndex(nPos)); sal_Int16 nClassId; xSet->getPropertyValue(FM_PROP_CLASSID) >>= nClassId; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xServiceQuestion(xSet, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XPersistObject > xServiceQuestion(xSet, UNO_QUERY); sal_Int32 nColType = xServiceQuestion.is() ? getColumnTypeByModelName(xServiceQuestion->getServiceName()) : 0; if (nColType == TYPE_TEXTFIELD) { // edit fields and formatted fields have the same service name, thus getColumnTypeByModelName returns TYPE_TEXTFIELD // in both cases. And as columns don't have an ::com::sun::star::lang::XServiceInfo interface, we have to distinguish both // types via the existence of special properties - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xProps(xSet, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xProps(xSet, UNO_QUERY); if (xProps.is()) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo(); + Reference< ::com::sun::star::beans::XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo(); if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER)) nColType = TYPE_FORMATTEDFIELD; } @@ -817,14 +796,14 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe if (xCols.is()) { // check for hidden cols - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCurCol; - ::com::sun::star::uno::Any aHidden,aName; + Reference< ::com::sun::star::beans::XPropertySet > xCurCol; + Any aHidden,aName; for (sal_uInt16 i=0; i<xCols->getCount(); ++i) { ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); DBG_ASSERT(xCurCol.is(), "FmGridHeader::PreExecuteColumnContextMenu : the Peer has invalid columns !"); aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN); - DBG_ASSERT(aHidden.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN, + DBG_ASSERT(aHidden.getValueType().getTypeClass() == TypeClass_BOOLEAN, "FmGridHeader::PreExecuteColumnContextMenu : the property 'hidden' should be boolean !"); if (::comphelper::getBOOL(aHidden)) { @@ -878,7 +857,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe //------------------------------------------------------------------------------ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult) { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); + Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); sal_uInt16 nPos = GetModelColumnPos(nColId); // remove and delet the menu we inserted in PreExecuteColumnContextMenu @@ -891,14 +870,14 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe { case SID_FM_DELETECOL: { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCol; + Reference< XInterface > xCol; ::cppu::extractInterface(xCol, xCols->getByIndex(nPos)); xCols->removeByIndex(nPos); ::comphelper::disposeComponent(xCol); } break; case SID_FM_SHOW_PROPERTY_BROWSER: { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCol; + Reference< XInterface > xCol; ::cppu::extractInterface(xCol, xCols->getByIndex(nPos)); FmInterfaceItem aIFaceItem(SID_FM_SHOW_PROPERTY_BROWSER, xCol); SfxBoolItem aShowItem(SID_FM_SHOW_PROPERTIES, !rMenu.IsItemChecked(SID_FM_SHOW_PROPERTY_BROWSER)); @@ -963,9 +942,9 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe break; case SID_FM_HIDECOL: { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCurCol; + Reference< ::com::sun::star::beans::XPropertySet > xCurCol; ::cppu::extractInterface(xCurCol, xCols->getByIndex(nPos)); - xCurCol->setPropertyValue(FM_PROP_HIDDEN, ::com::sun::star::uno::makeAny((sal_Bool)sal_True)); + xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_True)); } break; case SID_FM_SHOWCOLS_MORE: @@ -978,11 +957,11 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe case SID_FM_SHOWALLCOLS: { // just iterate through all the cols ... - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCurCol; + Reference< ::com::sun::star::beans::XPropertySet > xCurCol; for (sal_uInt16 i=0; i<xCols->getCount(); ++i) { ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); - xCurCol->setPropertyValue(FM_PROP_HIDDEN, ::com::sun::star::uno::makeAny((sal_Bool)sal_False)); + xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_False)); } // TODO : there must be a more clever way to do this .... // with the above the view is updated after every single model update ... @@ -992,15 +971,15 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe if (nExecutionResult>0 && nExecutionResult<=16) { // it was a "show column/<colname>" command (there are at most 16 such items) // search the nExecutionResult'th hidden col - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCurCol; + Reference< ::com::sun::star::beans::XPropertySet > xCurCol; for (sal_uInt16 i=0; i<xCols->getCount() && nExecutionResult; ++i) { ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); - ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN); + Any aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden)) if (!--nExecutionResult) { - xCurCol->setPropertyValue(FM_PROP_HIDDEN, ::com::sun::star::uno::makeAny((sal_Bool)sal_False)); + xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_False)); break; } } @@ -1010,16 +989,16 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe if (aFieldType.len()) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory > xFactory(xCols, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol = xFactory->createColumn(aFieldType); + Reference< ::com::sun::star::form::XGridColumnFactory > xFactory(xCols, UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xCol = xFactory->createColumn(aFieldType); if (xCol.is()) { - ::com::sun::star::uno::Any aNew; + Any aNew; aNew <<= xCol; if (bReplace) { // ein paar Properties hinueberretten - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReplaced; + Reference< ::com::sun::star::beans::XPropertySet > xReplaced; ::cppu::extractInterface(xReplaced, xCols->getByIndex(nPos)); // the application locale @@ -1071,7 +1050,7 @@ void FmGridHeader::Command(const CommandEvent& rEvt) //------------------------------------------------------------------------------ FmGridControl::FmGridControl( - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxFactory, + Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxFactory, Window* pParent, FmXGridPeer* _pPeer, WinBits nBits) @@ -1123,15 +1102,15 @@ void FmGridControl::SetDesignMode(sal_Bool bMode) } else { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); - ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); + Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY); if (xSelSupplier.is()) { - ::com::sun::star::uno::Any aSelection = xSelSupplier->getSelection(); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xColumn; - if (aSelection.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE) + Any aSelection = xSelSupplier->getSelection(); + Reference< ::com::sun::star::beans::XPropertySet > xColumn; + if (aSelection.getValueType().getTypeClass() == TypeClass_INTERFACE) ::cppu::extractInterface(xColumn, aSelection); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCurrent; + Reference< XInterface > xCurrent; for (sal_uInt16 i=0; i<xColumns->getCount(); ++i) { ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i)); @@ -1162,17 +1141,17 @@ void FmGridControl::DeleteSelectedRows() return; // try to confirm the delete - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xDispatcher = (::com::sun::star::frame::XDispatchProvider*)GetPeer(); + Reference< ::com::sun::star::frame::XDispatchProvider > xDispatcher = (::com::sun::star::frame::XDispatchProvider*)GetPeer(); if (xDispatcher.is()) { ::com::sun::star::util::URL aUrl; aUrl.Complete = FMURL_CONFIRM_DELETION; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch = xDispatcher->queryDispatch(aUrl, rtl::OUString(), 0); - ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener > xConfirm(xDispatch, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::frame::XDispatch > xDispatch = xDispatcher->queryDispatch(aUrl, rtl::OUString(), 0); + Reference< ::com::sun::star::form::XConfirmDeleteListener > xConfirm(xDispatch, UNO_QUERY); if (xConfirm.is()) { ::com::sun::star::sdb::RowChangeEvent aEvent; - aEvent.Source = (::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > )(*getDataSource()); + aEvent.Source = (Reference< XInterface > )(*getDataSource()); aEvent.Rows = nSelectedRows; aEvent.Action = ::com::sun::star::sdb::RowChangeAction::DELETE; if (!xConfirm->confirmDelete(aEvent)) @@ -1180,13 +1159,13 @@ void FmGridControl::DeleteSelectedRows() } } - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XDeleteRows > xDeleteThem((::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >)*getDataSource(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XDeleteRows > xDeleteThem((Reference< XInterface >)*getDataSource(), UNO_QUERY); // colect the bookmarks of the selected rows - ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any> aBookmarks = getSelectionBookmarks(); + Sequence < Any> aBookmarks = getSelectionBookmarks(); // determine the next row to position after deletion - ::com::sun::star::uno::Any aBookmark; + Any aBookmark; sal_Bool bNewPos = sal_False; // if the current row isn't selected we take the row as row after deletion if (!IsRowSelected(GetCurrentPos()) && !IsCurrentAppending()) @@ -1232,7 +1211,7 @@ void FmGridControl::DeleteSelectedRows() BeginCursorAction(); // now delete the row - ::com::sun::star::uno::Sequence <sal_Int32> aDeletedRows = xDeleteThem->deleteRows(aBookmarks); + Sequence <sal_Int32> aDeletedRows = xDeleteThem->deleteRows(aBookmarks); // how many rows are deleted? sal_Int32 nDeletedRows = 0; @@ -1261,19 +1240,19 @@ void FmGridControl::DeleteSelectedRows() // no valid bookmark so move to the insert row else { - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > xUpdateCursor((::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >)*getDataSource(), ::com::sun::star::uno::UNO_QUERY); + Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*getDataSource(), UNO_QUERY); xUpdateCursor->moveToInsertRow(); } } else { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet((::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >)*m_pDataCursor, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xSet((Reference< XInterface >)*m_pDataCursor, UNO_QUERY); sal_Int32 nRecordCount; xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount; // there are no rows left and we have an insert row if (!nRecordCount && GetEmptyRow().Is()) { - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > xUpdateCursor((::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >)*getDataSource(), ::com::sun::star::uno::UNO_QUERY); + Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*getDataSource(), UNO_QUERY); xUpdateCursor->moveToInsertRow(); } else if (nRecordCount) @@ -1467,10 +1446,10 @@ void FmGridControl::ColumnResized(sal_uInt16 nId) // Wert ans model uebergeben DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId)); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xColModel(pCol->getModel()); + Reference< ::com::sun::star::beans::XPropertySet > xColModel(pCol->getModel()); if (xColModel.is()) { - ::com::sun::star::uno::Any aWidth; + Any aWidth; sal_Int32 nColumnWidth = GetColumnWidth(nId); nColumnWidth = CalcReverseZoom(nColumnWidth); // Umrechnen in 10THMM @@ -1506,18 +1485,18 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId) m_bInColumnMove = sal_True; DbGridControl::ColumnMoved(nId); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); + Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); if (xColumns.is()) { // suchen der Spalte und verschieben im Model // ColumnPos holen DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId)); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; + Reference< ::com::sun::star::beans::XPropertySet > xCol; // Einfuegen mu sich an den Column Positionen orientieren sal_uInt32 i; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCurrent; + Reference< XInterface > xCurrent; for (i = 0; !xCol.is() && i < xColumns->getCount(); i++) { ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i)); @@ -1530,7 +1509,7 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId) DBG_ASSERT(i < xColumns->getCount(), "Falscher ::com::sun::star::sdbcx::Index"); xColumns->removeByIndex(i); - ::com::sun::star::uno::Any aElement; + Any aElement; aElement <<= xCol; xColumns->insertByIndex(GetModelColumnPos(nId), aElement); pCol->setModel(xCol); @@ -1540,7 +1519,7 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId) } //------------------------------------------------------------------------------ -void FmGridControl::InitColumnsByModels(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xColumns) +void FmGridControl::InitColumnsByModels(const Reference< ::com::sun::star::container::XIndexContainer >& xColumns) { // Spalten wieder neu setzen // wenn es nur eine HandleColumn gibt, dann nicht @@ -1558,10 +1537,10 @@ void FmGridControl::InitColumnsByModels(const ::com::sun::star::uno::Reference< // Einfuegen mu sich an den Column Positionen orientieren sal_uInt32 i; XubString aName; - ::com::sun::star::uno::Any aWidth; + Any aWidth; for (i = 0; i < xColumns->getCount(); ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; + Reference< ::com::sun::star::beans::XPropertySet > xCol; ::cppu::extractInterface(xCol, xColumns->getByIndex(i)); aName = (const sal_Unicode*)::comphelper::getString(xCol->getPropertyValue(FM_PROP_LABEL)); @@ -1579,10 +1558,10 @@ void FmGridControl::InitColumnsByModels(const ::com::sun::star::uno::Reference< // (wir haben das nicht gleich in der oberen Schleife gemacht, da wir dann Probleme mit den // IDs der Spalten bekommen haetten : AppendColumn vergibt die automatisch, die Spalte _nach_ // einer versteckten braucht aber eine um eine erhoehte ID .... - ::com::sun::star::uno::Any aHidden; + Any aHidden; for (i = 0; i < xColumns->getCount(); ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; + Reference< ::com::sun::star::beans::XPropertySet > xCol; ::cppu::extractInterface(xCol, xColumns->getByIndex(i)); aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden)) @@ -1593,14 +1572,14 @@ void FmGridControl::InitColumnsByModels(const ::com::sun::star::uno::Reference< } //------------------------------------------------------------------------------ -void FmGridControl::InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) +void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::container::XIndexAccess >& xFields) { if (!xFields.is()) return; // Spalten initialisieren - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFieldsAsNames(xFields, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns()); + Reference< ::com::sun::star::container::XNameAccess > xFieldsAsNames(xFields, UNO_QUERY); sal_Int32 nFieldCount = xFields->getCount(); // Einfuegen mu sich an den Column Positionen orientieren @@ -1608,13 +1587,13 @@ void FmGridControl::InitColumnsByFields(const ::com::sun::star::uno::Reference< for (sal_Int32 i = 0; i < xColumns->getCount(); i++) { DbGridColumn* pCol = GetColumns().GetObject(i); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; + Reference< ::com::sun::star::beans::XPropertySet > xCol; ::cppu::extractInterface(xCol, xColumns->getByIndex(i)); DbCellControl* pCellControl = NULL; // suchen des Feldes, das zur Controlsource gehoert xCol->getPropertyValue(FM_PROP_CONTROLSOURCE) >>= aFieldName; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; + Reference< ::com::sun::star::beans::XPropertySet > xField; if (aFieldName.len() && xFieldsAsNames->hasByName(aFieldName)) { @@ -1625,7 +1604,7 @@ void FmGridControl::InitColumnsByFields(const ::com::sun::star::uno::Reference< sal_Int32 nFieldPos = -1; if (xField.is()) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCheck; + Reference< ::com::sun::star::beans::XPropertySet > xCheck; for (sal_Int32 i = 0; i < nFieldCount; i++) { ::cppu::extractInterface(xCheck, xFields->getByIndex(i)); @@ -1645,10 +1624,10 @@ void FmGridControl::InitColumnsByFields(const ::com::sun::star::uno::Reference< sal_Bool bIllegalType(sal_False); switch (nDataType) { - case ::com::sun::star::sdbc::DataType::LONGVARBINARY: - case ::com::sun::star::sdbc::DataType::BINARY: - case ::com::sun::star::sdbc::DataType::VARBINARY: - case ::com::sun::star::sdbc::DataType::OTHER: + case DataType::LONGVARBINARY: + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::OTHER: bIllegalType = sal_True; } @@ -1706,11 +1685,11 @@ void FmGridControl::ShowColumn(sal_uInt16 nId) } //------------------------------------------------------------------------------ -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> FmGridControl::getSelectionBookmarks() +Sequence< Any> FmGridControl::getSelectionBookmarks() { sal_Int32 nSelectedRows = GetSelectRowCount(), i = 0; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aBookmarks(nSelectedRows); - ::com::sun::star::uno::Any* pBookmarks = (::com::sun::star::uno::Any*)aBookmarks.getArray(); + Sequence< Any> aBookmarks(nSelectedRows); + Any* pBookmarks = (Any*)aBookmarks.getArray(); // lock our update so no paint-triggered seeks interfere ... SetUpdateMode(sal_False); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 85b66bd0c1ba..825dcef6359a 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: gridctrl.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:53:20 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:54:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2356,7 +2356,7 @@ sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute) } } } - catch(...) + catch(Exception&) { DBG_ERROR("DbGridControl::SeekCursor : failed ..."); } @@ -2376,7 +2376,7 @@ sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute) else m_nSeekPos = -1; } - catch(...) + catch(Exception&) { DBG_ERROR("DbGridControl::SeekCursor : failed ..."); m_nSeekPos = -1; // kein Datensatz mehr vorhanden diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 6b43a5a3448b..f79cb539a5fe 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmpgeimp.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:53:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,6 +162,11 @@ #include <connectivity/dbtools.hxx> #endif +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdb; + DBG_NAME(FmFormPageImpl); //------------------------------------------------------------------------------ FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage) @@ -180,24 +185,24 @@ FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage, const FmFormPageImpl& rImpl) // copy it by streaming // creating a pipe - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutPipe(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInPipe(xOutPipe, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XOutputStream > xOutPipe(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), UNO_QUERY); + Reference< ::com::sun::star::io::XInputStream > xInPipe(xOutPipe, UNO_QUERY); // creating the mark streams - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xMarkIn(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSink > xMarkSink(xMarkIn, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XInputStream > xMarkIn(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSink > xMarkSink(xMarkIn, UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xMarkOut(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > xMarkSource(xMarkOut, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XOutputStream > xMarkOut(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSource > xMarkSource(xMarkOut, UNO_QUERY); // connect pipe and sink - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSink > xSink(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSink > xSink(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), UNO_QUERY); // connect pipe and source - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > xSource(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSource > xSource(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > xOutStrm(xSource, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > xInStrm(xSink, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XObjectOutputStream > xOutStrm(xSource, UNO_QUERY); + Reference< ::com::sun::star::io::XObjectInputStream > xInStrm(xSink, UNO_QUERY); if (xMarkSink.is() && xMarkSource.is() && xSink.is() && xSource.is() && xOutStrm.is() && xInStrm.is()) { @@ -231,12 +236,12 @@ void FmFormPageImpl::Init() m_sPageId = pDrawModel->GetUniquePageId(); } - xForms = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > ( + xForms = Reference< ::com::sun::star::container::XNameContainer > ( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.form.FormsCollection")), ::com::sun::star::uno::UNO_QUERY); + ::rtl::OUString::createFromAscii("com.sun.star.form.FormsCollection")), UNO_QUERY); DBG_ASSERT(xForms.is(), "FmFormPageImpl::Init : could not create a forms collection !"); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xAsChild(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XChild > xAsChild(xForms, UNO_QUERY); if (xAsChild.is()) xAsChild->setParent( xModel ); } @@ -251,15 +256,15 @@ FmFormPageImpl::~FmFormPageImpl() } //------------------------------------------------------------------------------ -void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm) +void FmFormPageImpl::setCurForm(Reference< ::com::sun::star::form::XForm > xForm) { xCurrentForm = xForm; } //------------------------------------------------------------------------------ -::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > FmFormPageImpl::getDefaultForm() +Reference< ::com::sun::star::form::XForm > FmFormPageImpl::getDefaultForm() { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm; + Reference< ::com::sun::star::form::XForm > xForm; // wenn noch kein TargetForm gefunden, dann aktuelle oder Default if (!xCurrentForm.is()) @@ -289,7 +294,7 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st // gibt es denn ueberhaupt eine if (!xForm.is()) { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xGetFirst(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xGetFirst(xForms, UNO_QUERY); DBG_ASSERT(xGetFirst.is(), "FmFormPageImpl::getDefaultForm : no IndexAccess on my form container !"); // wenn das anspringt, muesste man sich die Namen des NameContainers geben lassen und dann das Objekt fuer den // ersten Namen erfragen ... aber normalerweise sollte die FOrms-Sammlung auch einen IndexAccess haben @@ -310,28 +315,28 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st aUndoStr.SearchAndReplace('#', aStr); pModel->BegUndo(aUndoStr); - xForm = ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), ::com::sun::star::uno::UNO_QUERY); + xForm = Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY); // a form should always have the command type table as default - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(xForm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xSet(xForm, UNO_QUERY); try { - xSet->setPropertyValue(FM_PROP_COMMANDTYPE, ::com::sun::star::uno::makeAny(sal_Int32(::com::sun::star::sdb::CommandType::TABLE))); + xSet->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE))); } catch(...) { } ::rtl::OUString aName = ::rtl::OUString(SVX_RES(RID_STR_STDFORMNAME)); - xSet->setPropertyValue(FM_PROP_NAME, ::com::sun::star::uno::makeAny(aName)); + xSet->setPropertyValue(FM_PROP_NAME, makeAny(aName)); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForms, UNO_QUERY); pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel, FmUndoContainerAction::Inserted, xContainer, xForm, xContainer->getCount())); - xForms->insertByName(aName, ::com::sun::star::uno::makeAny(xForm)); + xForms->insertByName(aName, makeAny(xForm)); xCurrentForm = xForm; pModel->EndUndo(); } @@ -339,8 +344,8 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st } //------------------------------------------------------------------------------ -::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > FmFormPageImpl::SetDefaults(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & rContent, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > & rDatabase, +Reference< ::com::sun::star::form::XForm > FmFormPageImpl::SetDefaults(const Reference< ::com::sun::star::form::XFormComponent > & rContent, + const Reference< XDataSource > & rDatabase, const ::rtl::OUString& rDBTitle, const ::rtl::OUString& rCursorSource, sal_Int32 nCommandType) @@ -349,8 +354,8 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st if (!rContent.is() || rContent->getParent().is()) return NULL; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet; + Reference< ::com::sun::star::form::XForm > xForm; + Reference< ::com::sun::star::beans::XPropertySet > xSet; // Wenn Datenbank und CursorSource gesetzt sind, dann wird // die ::com::sun::star::form anhand dieser Kriterien gesucht, ansonsten nur aktuelle @@ -360,12 +365,12 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st // erst in der aktuellen form suchen xForm = FindForm(xCurrentForm, rDatabase, rCursorSource, nCommandType); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xFormsByIndex(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xFormsByIndex(xForms, UNO_QUERY); DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::SetDefaults : no index access for my forms collection !"); sal_Int32 nCount = xFormsByIndex->getCount(); for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xToSearch; + Reference< ::com::sun::star::form::XForm > xToSearch; xFormsByIndex->getByIndex(i) >>= xToSearch; xForm = FindForm(xToSearch, rDatabase, rCursorSource, nCommandType); } @@ -378,28 +383,28 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT)); aUndoStr.SearchAndReplace('#', aStr); pModel->BegUndo(aUndoStr); - xForm = ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), ::com::sun::star::uno::UNO_QUERY); + xForm = Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY); // a form should always have the command type table as default - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(xForm, ::com::sun::star::uno::UNO_QUERY); - try { xSet->setPropertyValue(FM_PROP_COMMANDTYPE, ::com::sun::star::uno::makeAny(sal_Int32(::com::sun::star::sdb::CommandType::TABLE))); } + Reference< ::com::sun::star::beans::XPropertySet > xSet(xForm, UNO_QUERY); + try { xSet->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE))); } catch(...) { } if (rDBTitle.len()) - xSet->setPropertyValue(FM_PROP_DATASOURCE,::com::sun::star::uno::makeAny(rDBTitle)); + xSet->setPropertyValue(FM_PROP_DATASOURCE,makeAny(rDBTitle)); else { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xDatabaseProps(rDatabase, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Any aDatabaseUrl = xDatabaseProps->getPropertyValue(FM_PROP_URL); + Reference< ::com::sun::star::beans::XPropertySet > xDatabaseProps(rDatabase, UNO_QUERY); + Any aDatabaseUrl = xDatabaseProps->getPropertyValue(FM_PROP_URL); xSet->setPropertyValue(FM_PROP_DATASOURCE, aDatabaseUrl); } - xSet->setPropertyValue(FM_PROP_COMMAND,::com::sun::star::uno::makeAny(rCursorSource)); - xSet->setPropertyValue(FM_PROP_COMMANDTYPE, ::com::sun::star::uno::makeAny(nCommandType)); + xSet->setPropertyValue(FM_PROP_COMMAND,makeAny(rCursorSource)); + xSet->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType)); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xNamedSet(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XNameAccess > xNamedSet(xForms, UNO_QUERY); ::rtl::OUString aName; - if ((::com::sun::star::sdb::CommandType::TABLE == nCommandType) || (::com::sun::star::sdb::CommandType::QUERY == nCommandType)) + if ((CommandType::TABLE == nCommandType) || (CommandType::QUERY == nCommandType)) { // Namen der ::com::sun::star::form ueber den Titel der CursorSource setzen aName = getUniqueName(rCursorSource, xNamedSet); @@ -408,9 +413,9 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st // ansonsten StandardformName verwenden aName = getUniqueName(::rtl::OUString(SVX_RES(RID_STR_STDFORMNAME)), xNamedSet); - xSet->setPropertyValue(FM_PROP_NAME, ::com::sun::star::uno::makeAny(aName)); + xSet->setPropertyValue(FM_PROP_NAME, makeAny(aName)); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForms, UNO_QUERY); pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel, FmUndoContainerAction::Inserted, xContainer, @@ -418,7 +423,7 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st xContainer->getCount())); - xForms->insertByName(aName, ::com::sun::star::uno::makeAny(xForm)); + xForms->insertByName(aName, makeAny(xForm)); pModel->EndUndo(); } xCurrentForm = xForm; @@ -431,32 +436,33 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st } //------------------------------------------------------------------------------ -::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > FmFormPageImpl::FindForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & rForm, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > & rDatabase, +Reference< ::com::sun::star::form::XForm > FmFormPageImpl::FindForm(const Reference< ::com::sun::star::form::XForm > & rForm, + const Reference< XDataSource > & rDatabase, const ::rtl::OUString& rCursorSource, sal_Int32 nCommandType) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xResultForm; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > xDBForm(rForm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::form::XForm > xResultForm; + Reference< XRowSet > xDBForm(rForm, UNO_QUERY); if (!xDBForm.is()) return NULL; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xConnAsChild; + Reference< ::com::sun::star::container::XChild > xConnAsChild; try { - xConnAsChild = ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > (::dbtools::calcConnection(xDBForm,::comphelper::getProcessServiceFactory()), ::com::sun::star::uno::UNO_QUERY); + xConnAsChild = Reference< ::com::sun::star::container::XChild > (::dbtools::calcConnection(xDBForm,::comphelper::getProcessServiceFactory()), UNO_QUERY); } - catch(...) + catch(Exception&) { + OSL_ENSHURE(0,"Exception occured!"); } - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > xDB; + Reference< XDataSource > xDB; if (xConnAsChild.is()) - xDB = ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > (xConnAsChild->getParent(), ::com::sun::star::uno::UNO_QUERY); + xDB = Reference< XDataSource > (xConnAsChild->getParent(), UNO_QUERY); if (xDB.is() && xDB == rDatabase) { // jetzt noch ueberpruefen ob CursorSource und Type uebereinstimmen - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(rForm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xSet(rForm, UNO_QUERY); ::rtl::OUString aCursorSource = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_COMMAND)); sal_Int32 nType = ::comphelper::getINT32(xSet->getPropertyValue(FM_PROP_COMMANDTYPE)); if (!aCursorSource.len() || ((nType == nCommandType) && (aCursorSource == rCursorSource))) // found the form @@ -465,17 +471,17 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st // Ist noch keine Datenquelle gesetzt, wird dieses hier nachgeholt if (!aCursorSource.len()) { - xSet->setPropertyValue(FM_PROP_COMMAND, ::com::sun::star::uno::makeAny(rCursorSource)); - xSet->setPropertyValue(FM_PROP_COMMANDTYPE, ::com::sun::star::uno::makeAny((sal_Int32)nCommandType)); + xSet->setPropertyValue(FM_PROP_COMMAND, makeAny(rCursorSource)); + xSet->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny((sal_Int32)nCommandType)); } } } - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xComponents(rForm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xComponents(rForm, UNO_QUERY); sal_Int32 nCount = xComponents->getCount(); for (sal_Int32 i = 0; !xResultForm.is() && i < nCount; ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xSearchForm; + Reference< ::com::sun::star::form::XForm > xSearchForm; xComponents->getByIndex(i) >>= xSearchForm; // jetzt innerhalb der ::com::sun::star::form weitersuchen if (xSearchForm.is()) @@ -485,20 +491,20 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st } //------------------------------------------------------------------------------ -::rtl::OUString FmFormPageImpl::setUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xFormComponent, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xControls) +::rtl::OUString FmFormPageImpl::setUniqueName(const Reference< ::com::sun::star::form::XFormComponent > & xFormComponent, const Reference< ::com::sun::star::form::XForm > & xControls) { ::rtl::OUString sName; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(xFormComponent, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xSet(xFormComponent, UNO_QUERY); if (xSet.is()) { - ::com::sun::star::uno::Any aValue = xSet->getPropertyValue(FM_PROP_NAME); + Any aValue = xSet->getPropertyValue(FM_PROP_NAME); sName = ::comphelper::getString(aValue); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xNameAcc(xControls, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XNameAccess > xNameAcc(xControls, UNO_QUERY); if (!sName.len() || xNameAcc->hasByName(sName)) { // setzen eines default Namens ueber die ClassId - ::com::sun::star::uno::Any aValue = xSet->getPropertyValue(FM_PROP_CLASSID); + Any aValue = xSet->getPropertyValue(FM_PROP_CLASSID); sal_Int16 nClassId(::com::sun::star::form::FormComponentType::CONTROL); aValue >>= nClassId; @@ -506,7 +512,7 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st // bei Radiobuttons, die einen Namen haben, diesen nicht ueberschreiben! if (!sName.len() || nClassId != ::com::sun::star::form::FormComponentType::RADIOBUTTON) { - xSet->setPropertyValue(FM_PROP_NAME, ::com::sun::star::uno::makeAny(sDefaultName)); + xSet->setPropertyValue(FM_PROP_NAME, makeAny(sDefaultName)); } ////////////////////////////////////////////////////////////// @@ -531,7 +537,7 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st if (!aText.len()) { aLabel.SearchAndReplace( getDefaultName(nClassId), ::rtl::OUString(SVX_RES(nResId)) ); - xSet->setPropertyValue( FM_PROP_LABEL, ::com::sun::star::uno::makeAny(::rtl::OUString(aLabel)) ); + xSet->setPropertyValue( FM_PROP_LABEL, makeAny(::rtl::OUString(aLabel)) ); } } @@ -577,18 +583,18 @@ UniString FmFormPageImpl::getDefaultName(sal_Int16 nClassId) } //------------------------------------------------------------------------------ -::rtl::OUString FmFormPageImpl::getDefaultName(sal_Int16 nClassId, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xControls) const +::rtl::OUString FmFormPageImpl::getDefaultName(sal_Int16 nClassId, const Reference< ::com::sun::star::form::XForm > & xControls) const { ::rtl::OUString aClassName=getDefaultName(nClassId); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xNamedSet(xControls, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XNameAccess > xNamedSet(xControls, UNO_QUERY); return getUniqueName(aClassName, xNamedSet); } //------------------------------------------------------------------ -::rtl::OUString FmFormPageImpl::getUniqueName(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNamedSet) const +::rtl::OUString FmFormPageImpl::getUniqueName(const ::rtl::OUString& rName, const Reference< ::com::sun::star::container::XNameAccess > & xNamedSet) const { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexSet(xNamedSet, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xIndexSet(xNamedSet, UNO_QUERY); ::rtl::OUString sName; if ( !xIndexSet.is() ) @@ -607,16 +613,16 @@ UniString FmFormPageImpl::getDefaultName(sal_Int16 nClassId) void FmFormPageImpl::WriteData(SvStream& rOut) const { // anlegen eines output streams fuer UNO - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > xSource(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xMarkOut(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > xMarkSource(xMarkOut, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSource > xSource(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), UNO_QUERY); + Reference< ::com::sun::star::io::XOutputStream > xMarkOut(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSource > xMarkSource(xMarkOut, UNO_QUERY); if (xSource.is()) { xMarkSource->setOutputStream(new ::utl::OOutputStreamWrapper(rOut)); xSource->setOutputStream(xMarkOut); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > xOutStrm(xSource, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XObjectOutputStream > xOutStrm(xSource, UNO_QUERY); try { write(xOutStrm); @@ -647,16 +653,16 @@ void FmFormPageImpl::WriteData(SvStream& rOut) const void FmFormPageImpl::ReadData(const SdrIOHeader& rHead, SvStream& rIn) { // Abholen des InputStreams ueber uno - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSink > xSink(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSink > xSink(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), UNO_QUERY); // creating the mark streams - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xMarkIn(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSink > xMarkSink(xMarkIn, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XInputStream > xMarkIn(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), UNO_QUERY); + Reference< ::com::sun::star::io::XActiveDataSink > xMarkSink(xMarkIn, UNO_QUERY); if (xSink.is()) { ::utl::OInputStreamWrapper* pUnoStream = new ::utl::OInputStreamWrapper(rIn); - xMarkSink->setInputStream(::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > (pUnoStream)); + xMarkSink->setInputStream(Reference< ::com::sun::star::io::XInputStream > (pUnoStream)); xSink->setInputStream(xMarkIn); // freigeben aller forms @@ -668,7 +674,7 @@ void FmFormPageImpl::ReadData(const SdrIOHeader& rHead, SvStream& rIn) Init(); } - ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > xInStrm(xSink,::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XObjectInputStream > xInStrm(xSink,UNO_QUERY); try { read(xInStrm); @@ -686,9 +692,9 @@ void FmFormPageImpl::ReadData(const SdrIOHeader& rHead, SvStream& rIn) } //------------------------------------------------------------------------------ -void FmFormPageImpl::write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & xOutStrm) const +void FmFormPageImpl::write(const Reference< ::com::sun::star::io::XObjectOutputStream > & xOutStrm) const { - ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMarkStrm(xOutStrm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XMarkableStream > xMarkStrm(xOutStrm, UNO_QUERY); if (!xMarkStrm.is()) return; // exception @@ -697,7 +703,7 @@ void FmFormPageImpl::write(const ::com::sun::star::uno::Reference< ::com::sun::s fillList(aList, *pPage, sal_True); // schreiben aller forms - ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xAsPersist(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XPersistObject > xAsPersist(xForms, UNO_QUERY); if (xAsPersist.is()) xAsPersist->write(xOutStrm); // don't use the writeObject of the stream, as this wouldn't be compatible with older documents @@ -712,7 +718,7 @@ void FmFormPageImpl::write(const ::com::sun::star::uno::Reference< ::com::sun::s { // schreiben des Objects mit Marke // Marke um an den Anfang zu springen - ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xObj(aList.GetObject(i)->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XPersistObject > xObj(aList.GetObject(i)->GetUnoControlModel(), UNO_QUERY); if (xObj.is()) { xOutStrm->writeObject(xObj); @@ -723,9 +729,9 @@ void FmFormPageImpl::write(const ::com::sun::star::uno::Reference< ::com::sun::s } //------------------------------------------------------------------------------ -void FmFormPageImpl::read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & xInStrm) +void FmFormPageImpl::read(const Reference< ::com::sun::star::io::XObjectInputStream > & xInStrm) { - ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMarkStrm(xInStrm, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XMarkableStream > xMarkStrm(xInStrm, UNO_QUERY); if (!xMarkStrm.is()) return; // exception @@ -734,7 +740,7 @@ void FmFormPageImpl::read(const ::com::sun::star::uno::Reference< ::com::sun::st fillList(aList, *pPage, sal_False); // lesen aller forms - ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xAsPersist(xForms, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::io::XPersistObject > xAsPersist(xForms, UNO_QUERY); if (xAsPersist.is()) xAsPersist->read(xInStrm); // don't use the readObject of the stream, as this wouldn't be compatible with older documents @@ -744,7 +750,7 @@ void FmFormPageImpl::read(const ::com::sun::star::uno::Reference< ::com::sun::st DBG_ASSERT(nLength == (sal_Int32) aList.Count(), "Fehler beim Lesen der UnoModels"); for (sal_Int32 i = 0; i < nLength; i++) { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xRef(xInStrm->readObject(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::awt::XControlModel > xRef(xInStrm->readObject(), UNO_QUERY); if (i < (sal_Int32)aList.Count()) aList.GetObject(i)->SetUnoControlModel(xRef); } diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index b3288a4b3bd5..352006e0cce5 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmtools.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: fs $ $Date: 2000-11-09 10:03:55 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:53:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,9 +98,6 @@ #ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include <com/sun/star/sdb/XQueriesSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDB_XDATABASEENVIRONMENT_HPP_ -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#endif #ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ #include <com/sun/star/sdb/SQLContext.hpp> #endif diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index a6aaf826f740..f2a9c1dee836 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmview.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:53:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,15 +92,9 @@ #ifndef _COM_SUN_STAR_SDDB_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_SDB_XDATABASEACCESS_HPP_ -#include <com/sun/star/sdb/XDatabaseAccess.hpp> -#endif #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> #endif -#ifndef _COM_SUN_STAR_SDB_XDATABASEENVIRONMENT_HPP_ -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#endif #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif @@ -229,14 +223,19 @@ #include <tools/urlobj.hxx> #endif -void getConnectionSpecs(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, ::rtl::OUString& rURL, ::rtl::OUString& _rRegisteredTitle) +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdb; + +void getConnectionSpecs(const Reference< XConnection >& _rxConn, ::rtl::OUString& rURL, ::rtl::OUString& _rRegisteredTitle) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xURLSupplier(_rxConn, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xURLSupplier(_rxConn, UNO_QUERY); if (!::comphelper::hasProperty(FM_PROP_URL, xURLSupplier)) { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xChild(_rxConn, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XChild > xChild(_rxConn, UNO_QUERY); if (xChild.is()) - xURLSupplier = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >(xChild->getParent(), ::com::sun::star::uno::UNO_QUERY); + xURLSupplier = Reference< ::com::sun::star::beans::XPropertySet >(xChild->getParent(), UNO_QUERY); } if (::comphelper::hasProperty(FM_PROP_URL, xURLSupplier)) { @@ -370,17 +369,17 @@ void FmFormView::ChangeDesignMode(sal_Bool bDesign) if (pPage) { // Un/Load all forms - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xForms(((FmFormPage*)pPage)->GetForms(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xForms(((FmFormPage*)pPage)->GetForms(), UNO_QUERY); // during load the environment covers the error handling if (!bDesign) ActivateControls(pCurPageView); - ::com::sun::star::uno::Reference< ::com::sun::star::form::XReset > xReset; + Reference< ::com::sun::star::form::XReset > xReset; for (sal_Int32 i = 0, nCount = xForms->getCount(); i < nCount; i++) { xForms->getByIndex(i) >>= xReset; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > xLoad(xReset, ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::form::XLoadable > xLoad(xReset, UNO_QUERY); if (bDesign) { @@ -452,7 +451,7 @@ SdrPageView* FmFormView::ShowPage(SdrPage* pPage, const Point& rOffs) else if (pFormShell && pFormShell->IsDesignMode()) { FmXFormShell* pFormShellImpl = pFormShell->GetImpl(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xForms(((FmFormPage*)pPage)->GetForms(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xForms(((FmFormPage*)pPage)->GetForms(), UNO_QUERY); pFormShellImpl->ResetForms(xForms, sal_True); // damit der Formular-Navigator auf den Seitenwechsel reagieren kann @@ -519,7 +518,7 @@ void FmFormView::DeactivateControls(SdrPageView* pPageView) //------------------------------------------------------------------------ void FmFormView::ObjectCreated(FmFormObj* pObj) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(pObj->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xSet(pObj->GetUnoControlModel(), UNO_QUERY); if (!xSet.is()) return; @@ -531,16 +530,16 @@ void FmFormView::ObjectCreated(FmFormObj* pObj) // no wizards at the moment. The wizards need a complete rewriting, that's why this feature is disable at the // moment - ::com::sun::star::uno::Any aValue = xSet->getPropertyValue(FM_PROP_CLASSID); + Any aValue = xSet->getPropertyValue(FM_PROP_CLASSID); sal_Int16 nClassId; if(!(aValue >>= nClassId)) nClassId = ::com::sun::star::form::FormComponentType::CONTROL; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xChild(xSet, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > xForm(xChild->getParent(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::container::XChild > xChild(xSet, UNO_QUERY); + Reference< XRowSet > xForm(xChild->getParent(), UNO_QUERY); String aWizardName; - ::com::sun::star::uno::Any aObj; + Any aObj; switch (nClassId) { @@ -615,21 +614,21 @@ void FmFormView::ObjectCreated(FmFormObj* pObj) } //------------------------------------------------------------------------ -void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffsetMM, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField, - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats, sal_uInt16 nObjID, const ::rtl::OUString& rFieldPostfix, +void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffsetMM, Reference< ::com::sun::star::beans::XPropertySet > xField, + Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats, sal_uInt16 nObjID, const ::rtl::OUString& rFieldPostfix, FmFormObj*& pLabel, FmFormObj*& pControl) const { sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE)); sal_Int32 nFormatKey = ::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FORMATKEY)); - ::com::sun::star::uno::Any aFieldName(xField->getPropertyValue(FM_PROP_NAME)); + Any aFieldName(xField->getPropertyValue(FM_PROP_NAME)); ::rtl::OUString sFieldName; aFieldName >>= sFieldName; // das Label pLabel = (FmFormObj*)SdrObjFactory::MakeNewObject( FmFormInventor, OBJ_FM_FIXEDTEXT, NULL, NULL ); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xLabelSet(pLabel->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); - xLabelSet->setPropertyValue(FM_PROP_LABEL, ::com::sun::star::uno::makeAny(sFieldName + rFieldPostfix)); + Reference< ::com::sun::star::beans::XPropertySet > xLabelSet(pLabel->GetUnoControlModel(), UNO_QUERY); + xLabelSet->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName + rFieldPostfix)); // positionieren unter Beachtung der Einstellungen des Ziel-Output-Devices Size aTextSize(pOutDev->GetTextWidth(sFieldName + rFieldPostfix), pOutDev->GetTextHeight()); @@ -663,9 +662,9 @@ void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffse // positionieren Size szControlSize; - if (::com::sun::star::sdbc::DataType::BIT == nDataType) + if (DataType::BIT == nDataType) szControlSize = aDefSize; - else if (OBJ_FM_IMAGECONTROL == nObjID || ::com::sun::star::sdbc::DataType::LONGVARCHAR == nDataType) + else if (OBJ_FM_IMAGECONTROL == nObjID || DataType::LONGVARCHAR == nDataType) szControlSize = aDefImageSize; else szControlSize = aDefSize; @@ -679,14 +678,14 @@ void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffse )); // ein paar initiale Einstellungen am ControlModel - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xControlSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > (pControl->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > xControlSet = Reference< ::com::sun::star::beans::XPropertySet > (pControl->GetUnoControlModel(), UNO_QUERY); if (xControlSet.is()) { // ein paar numersiche Eigenschaften durchschleifen if (::comphelper::hasProperty(FM_PROP_DECIMAL_ACCURACY, xControlSet)) { // Number braucht eine Scale - ::com::sun::star::uno::Any aScaleVal(::comphelper::getNumberFormatDecimals(xNumberFormats, nFormatKey)); + Any aScaleVal(::comphelper::getNumberFormatDecimals(xNumberFormats, nFormatKey)); xControlSet->setPropertyValue(FM_PROP_DECIMAL_ACCURACY, aScaleVal); } if (::comphelper::hasProperty(FM_PROP_VALUEMIN, xControlSet) && ::comphelper::hasProperty(FM_PROP_VALUEMAX, xControlSet)) @@ -695,12 +694,12 @@ void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffse sal_Int32 nMinValue = -1000000000, nMaxValue = 1000000000; switch (nDataType) { - case ::com::sun::star::sdbc::DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break; - case ::com::sun::star::sdbc::DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break; - case ::com::sun::star::sdbc::DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break; + case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break; + case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break; + case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break; // um die doubles/singles kuemmere ich mich nicht, da es ein wenig sinnlos ist } - ::com::sun::star::uno::Any aVal; + Any aVal; aVal <<= nMinValue; xControlSet->setPropertyValue(FM_PROP_VALUEMIN,aVal); aVal <<= nMaxValue; @@ -710,22 +709,22 @@ void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffse if (::comphelper::hasProperty(FM_PROP_STRICTFORMAT, xControlSet)) { // Formatueberpruefung fue numeric fields standardmaessig sal_True sal_Bool bB(sal_True); - ::com::sun::star::uno::Any aVal(&bB,getBooleanCppuType()); + Any aVal(&bB,getBooleanCppuType()); xControlSet->setPropertyValue(FM_PROP_STRICTFORMAT, aVal); } xControlSet->setPropertyValue(FM_PROP_CONTROLSOURCE, aFieldName); xControlSet->setPropertyValue(FM_PROP_NAME, aFieldName); - if (nDataType == ::com::sun::star::sdbc::DataType::LONGVARCHAR) + if (nDataType == DataType::LONGVARCHAR) { sal_Bool bB(sal_True); - xControlSet->setPropertyValue(FM_PROP_MULTILINE,::com::sun::star::uno::Any(&bB,getBooleanCppuType())); + xControlSet->setPropertyValue(FM_PROP_MULTILINE,Any(&bB,getBooleanCppuType())); } if (nObjID == OBJ_FM_CHECKBOX) xControlSet->setPropertyValue(FM_PROP_TRISTATE, - ::com::sun::star::uno::makeAny(xField->getPropertyValue(FM_PROP_ISNULLABLE)) + makeAny(xField->getPropertyValue(FM_PROP_ISNULLABLE)) ); } @@ -736,9 +735,9 @@ void FmFormView::CreateControlWithLabel(OutputDevice* pOutDev, sal_Int32 nYOffse // usually a fixed text we use as label should be accepted, but to be sure ....) try { - xControlSet->setPropertyValue(FM_PROP_CONTROLLABEL, ::com::sun::star::uno::makeAny(xLabelSet)); + xControlSet->setPropertyValue(FM_PROP_CONTROLLABEL, makeAny(xLabelSet)); } - catch(...) + catch(Exception&) { DBG_ERROR("FmFormView::CreateControlWithLabel : could not marry the control and the label !"); } @@ -756,62 +755,39 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const // SBA_FIELDEXCHANGE_FORMAT // "Datenbankname";"Tabellen/QueryName";1/0(fuer Tabelle/Abfrage);"Feldname" - ::rtl::OUString aDatabaseName = rFieldDesc.GetToken(0,char(11)); - ::rtl::OUString aObjectName = rFieldDesc.GetToken(1,char(11)); - sal_uInt16 nObjectType = rFieldDesc.GetToken(2,char(11)).ToInt32(); - ::rtl::OUString aFieldName = rFieldDesc.GetToken(3,char(11)); + ::rtl::OUString aDatabaseName = rFieldDesc.GetToken(0,sal_Unicode(11)); + ::rtl::OUString aObjectName = rFieldDesc.GetToken(1,sal_Unicode(11)); + sal_uInt16 nObjectType = rFieldDesc.GetToken(2,sal_Unicode(11)).ToInt32(); + ::rtl::OUString aFieldName = rFieldDesc.GetToken(3,sal_Unicode(11)); if (!aFieldName.getLength() || !aObjectName.getLength() || !aDatabaseName.getLength()) return NULL; - // Datenbank, Tabelle/Abfrage und Feld bestimmen - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseEnvironment > xEnv(::comphelper::getProcessServiceFactory()->createInstance(SRV_SDB_DATABASE_ENVIRONMENT), ::com::sun::star::uno::UNO_QUERY); - if (!xEnv.is()) - return NULL; - // Einlesen des default workspace - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > xConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > xDatabase; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > xStatement; + Reference< XConnection > xConnection; + Reference< XDataSource > xDataSource; + Reference< XPreparedStatement > xStatement; + + ::rtl::OUString sDatabaseName = aDatabaseName; + try + { + xDataSource = dbtools::getDataSource(sDatabaseName,pImpl->getORB()); + xConnection = dbtools::getConnection(sDatabaseName,::rtl::OUString(),::rtl::OUString(),pImpl->getORB()); + } + catch(SQLException&) + { // allowed, the env may throw an exception in case of an invalid name + } + if (!xDataSource.is() || !xConnection.is()) + { + DBG_ERROR("FmGridHeader::FmFormView::CreateFieldControl : could not retrieve the database access object !"); + return NULL; + } try { - ::rtl::OUString sDatabaseName = aDatabaseName; - try - { - xDatabase = xEnv->getDatabaseAccess(sDatabaseName); - } - catch(::com::sun::star::sdbc::SQLException e) - { // allowed, the env may throw an exception in case of an invalid name - e; // make compiler happy - } - - if (!xDatabase.is()) - { // aDatabaseName isn't a database path. maybe a favorite name ? - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService > xDatabaseAccesses(::comphelper::getProcessServiceFactory()->createInstance(SRV_SDB_DATABASE_CONTEXT), ::com::sun::star::uno::UNO_QUERY); - if (xDatabaseAccesses.is()) - { - try - { - xDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess > (xDatabaseAccesses->getRegisteredObject(sDatabaseName), ::com::sun::star::uno::UNO_QUERY); - } - catch( ::com::sun::star::container::NoSuchElementException&) - { // allowed, means aDatabaseName isn't a valid favorite name .... - } - } - } - if (!xDatabase.is()) - { - DBG_ERROR("FmGridHeader::FmFormView::CreateFieldControl : could not retrieve the database access object !"); - return NULL; - } - xConnection = xDatabase->getConnection(::rtl::OUString(), ::rtl::OUString()); - if (!xConnection.is()) - return NULL; - // check if the document is able to handle forms with the given data source - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > xDocParentConn = findConnection(rPage.GetForms()); + Reference< XConnection > xDocParentConn = findConnection(rPage.GetForms()); if (xDocParentConn.is()) { // there is a connection which restricts the allowed data sources for the forms @@ -856,22 +832,22 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const } // Festellen des Feldes - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFields; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; + Reference< ::com::sun::star::container::XNameAccess > xFields; + Reference< ::com::sun::star::beans::XPropertySet > xField; switch (nObjectType) { case 0: // old : DataSelectionType_TABLE: { - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > xSupplyTables(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + Reference< ::com::sun::star::sdbcx::XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; xSupplyTables->getTables()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } break; case 1: // old : DataSelectionType_QUERY: { - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XQueriesSupplier > xSupplyQueries(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + Reference< ::com::sun::star::sdb::XQueriesSupplier > xSupplyQueries(xConnection, UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; xSupplyQueries->getQueries()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } @@ -880,8 +856,8 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const { xStatement = xConnection->prepareStatement(aObjectName); // not interested in any results - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > (xStatement,::com::sun::star::uno::UNO_QUERY)->setPropertyValue(::rtl::OUString::createFromAscii("MaxRows"),::com::sun::star::uno::makeAny(sal_Int32(0))); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet > (xStatement,UNO_QUERY)->setPropertyValue(::rtl::OUString::createFromAscii("MaxRows"),makeAny(sal_Int32(0))); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), UNO_QUERY); if (xSupplyCols.is()) xFields = xSupplyCols->getColumns(); } @@ -890,11 +866,11 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const if (xFields.is() && xFields->hasByName(aFieldName)) xFields->getByName(aFieldName) >>= xField; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(xConnection, sal_False); - if (!xSupplier.is()) + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(xConnection, sal_False); + if (!xSupplier.is() || !xField.is()) return NULL; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats(xSupplier->getNumberFormats()); + Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats(xSupplier->getNumberFormats()); if (!xNumberFormats.is()) return NULL; @@ -931,7 +907,7 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const if (!pOutDev) return NULL; - if ((::com::sun::star::sdbc::DataType::BINARY == nDataType) || (::com::sun::star::sdbc::DataType::VARBINARY == nDataType)) + if ((DataType::BINARY == nDataType) || (DataType::VARBINARY == nDataType)) return NULL; ////////////////////////////////////////////////////////////////////// // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird @@ -947,41 +923,41 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const else switch (nDataType) { - case ::com::sun::star::sdbc::DataType::LONGVARBINARY: + case DataType::LONGVARBINARY: nOBJID = OBJ_FM_IMAGECONTROL; break; - case ::com::sun::star::sdbc::DataType::LONGVARCHAR: + case DataType::LONGVARCHAR: nOBJID = OBJ_FM_EDIT; break; - case ::com::sun::star::sdbc::DataType::BINARY: - case ::com::sun::star::sdbc::DataType::VARBINARY: + case DataType::BINARY: + case DataType::VARBINARY: return NULL; - case ::com::sun::star::sdbc::DataType::BIT: + case DataType::BIT: nOBJID = OBJ_FM_CHECKBOX; break; - case ::com::sun::star::sdbc::DataType::TINYINT: - case ::com::sun::star::sdbc::DataType::SMALLINT: - case ::com::sun::star::sdbc::DataType::INTEGER: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: nOBJID = OBJ_FM_NUMERICFIELD; break; - case ::com::sun::star::sdbc::DataType::REAL: - case ::com::sun::star::sdbc::DataType::DOUBLE: - case ::com::sun::star::sdbc::DataType::NUMERIC: - case ::com::sun::star::sdbc::DataType::DECIMAL: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::NUMERIC: + case DataType::DECIMAL: nOBJID = OBJ_FM_FORMATTEDFIELD; break; - case ::com::sun::star::sdbc::DataType::TIMESTAMP: + case DataType::TIMESTAMP: bDateNTimeField = sal_True; sLabelPostfix = UniString(SVX_RES(RID_STR_DATETIME_LABELPOSTFIX)).GetToken(0, ';'); // DON'T break ! - case ::com::sun::star::sdbc::DataType::DATE: + case DataType::DATE: nOBJID = OBJ_FM_DATEFIELD; break; - case ::com::sun::star::sdbc::DataType::TIME: + case DataType::TIME: nOBJID = OBJ_FM_TIMEFIELD; break; - case ::com::sun::star::sdbc::DataType::CHAR: - case ::com::sun::star::sdbc::DataType::VARCHAR: + case DataType::CHAR: + case DataType::VARCHAR: default: nOBJID = OBJ_FM_EDIT; break; @@ -1002,15 +978,16 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const ////////////////////////////////////////////////////////////////////// // Feststellen ob eine ::com::sun::star::form erzeugt werden muss // Dieses erledigt die Page fuer uns bzw. die PageImpl - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xContent(pLabel->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xContainer(rPage.GetImpl()->SetDefaults(xContent, xDatabase, aDatabaseName, aObjectName, nObjectType), ::com::sun::star::uno::UNO_QUERY); + Reference< ::com::sun::star::form::XFormComponent > xContent(pLabel->GetUnoControlModel(), UNO_QUERY); + Reference< ::com::sun::star::container::XIndexContainer > xContainer(rPage.GetImpl()->SetDefaults(xContent, xDataSource, aDatabaseName, aObjectName, nObjectType), UNO_QUERY); if (xContainer.is()) - xContainer->insertByIndex(xContainer->getCount(), ::com::sun::star::uno::makeAny(xContent)); + xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent)); - xContent = ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > (pControl->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); - xContainer = ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > (rPage.GetImpl()->SetDefaults(xContent, xDatabase, aDatabaseName, aObjectName, nObjectType), ::com::sun::star::uno::UNO_QUERY); + xContent = Reference< ::com::sun::star::form::XFormComponent > (pControl->GetUnoControlModel(), UNO_QUERY); + xContainer = Reference< ::com::sun::star::container::XIndexContainer > (rPage.GetImpl()->SetDefaults(xContent, xDataSource, + aDatabaseName, aObjectName, nObjectType), UNO_QUERY); if (xContainer.is()) - xContainer->insertByIndex(xContainer->getCount(), ::com::sun::star::uno::makeAny(xContent)); + xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent)); ////////////////////////////////////////////////////////////////////// // Objekte gruppieren @@ -1053,7 +1030,7 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const } //------------------------------------------------------------------------ -void FmFormView::InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > & xCC) +void FmFormView::InsertControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC) { if( !IsDesignMode() ) { @@ -1074,7 +1051,7 @@ void FmFormView::InsertControlContainer(const ::com::sun::star::uno::Reference< } //------------------------------------------------------------------------ -void FmFormView::RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > & xCC) +void FmFormView::RemoveControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC) { if( !IsDesignMode() ) { diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx index e792488d9931..c9d7ed343616 100644 --- a/svx/source/inc/fmpgeimp.hxx +++ b/svx/source/inc/fmpgeimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fmpgeimp.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-20 14:12:06 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:55:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,10 +61,9 @@ #ifndef _SVX_FMUNOPGE_HXX #define _SVX_FMUNOPGE_HXX -#ifndef _COM_SUN_STAR_SDB_XDATABASEACCESS_HPP_ -#include <com/sun/star/sdb/XDatabaseAccess.hpp> +#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ +#include <com/sun/star/sdbc/XDataSource.hpp> #endif - #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> #endif @@ -116,13 +115,10 @@ class FmFormPageImpl friend class FmFormObj; friend class FmXFormShell; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xCurrentForm; // aktuelles Formular - + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xCurrentForm; // aktuelles Formular ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> xForms; // Liste aller Forms - - FmFormPage* pPage; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> xModel; - + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> xModel; + FmFormPage* pPage; UniString m_sPageId; protected: @@ -141,7 +137,7 @@ public: // Defaults fuer ein Object setzen // Eindeutigen Namen, Zuordnen zu einer Form falls noch nicht erfolgt ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> SetDefaults(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess>(), + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(), const ::rtl::OUString& rDBTitle = ::rtl::OUString(), const ::rtl::OUString& rCursorSource = ::rtl::OUString(), sal_Int32 nCommandType = 0); @@ -161,7 +157,7 @@ protected: void fillList(FmObjectList& rList, const SdrObjList& rObjList, sal_Bool bConnected) const; ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> FindForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& rForm, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseAccess>& rDatabase, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase, const ::rtl::OUString& rCursorSource, sal_Int32 nCommandType); diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index 04d13e8e6a23..1d25ec1c3874 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fmvwimp.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:19:53 $ + * last change: $Author: oj $ $Date: 2000-11-15 14:55:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -218,6 +218,8 @@ public: FmWinRecList::const_iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& rCC ) const; const FmWinRecList& getWindowList() const {return m_aWinList;} + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xORB; } protected: FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& rCC ); void addWindow(const SdrPageViewWinRec*); |