Tag: cws_src680_hsqlcsv User: fs Date: 2006/09/19 00:37:02 Modified: dba/connectivity/source/drivers/hsqldb/HConnection.cxx dba/connectivity/source/drivers/hsqldb/makefile.mk
Log: #i69526# load text table icons from the global image repository File Changes: Directory: /dba/connectivity/source/drivers/hsqldb/ =================================================== File [changed]: HConnection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HConnection.cxx?r1=1.5.66.2&r2=1.5.66.3 Delta lines: +60 -11 --------------------- --- HConnection.cxx 18 Sep 2006 13:51:19 -0000 1.5.66.2 +++ HConnection.cxx 19 Sep 2006 07:36:59 -0000 1.5.66.3 @@ -4,9 +4,9 @@ * * $RCSfile: HConnection.cxx,v $ * - * $Revision: 1.5.66.2 $ + * $Revision: 1.5.66.3 $ * - * last change: $Author: fs $ $Date: 2006/09/18 13:51:19 $ + * last change: $Author: fs $ $Date: 2006/09/19 07:36:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -32,7 +32,13 @@ * MA 02111-1307 USA * ************************************************************************/ + +#ifndef CONNECTIVITY_HSQLDB_CONNECTION_HXX #include "hsqldb/HConnection.hxx" +#endif +#ifndef CONNECTIVITY_HSQLUI_HRC +#include "hsqlui.hrc" +#endif /** === begin UNO includes === **/ #ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ @@ -50,6 +56,12 @@ #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> #endif +#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHICPROVIDER_HPP_ +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif /** === end UNO includes === **/ #ifndef _CONNECTIVITY_DBTOOLS_HXX_ @@ -94,6 +106,7 @@ using ::com::sun::star::sdbc::XDriver; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::graphic::XGraphic; +using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::uno::XInterface; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::ui::dialogs::XExecutableDialog; @@ -103,6 +116,7 @@ using ::com::sun::star::sdbc::XDatabaseMetaData; using ::com::sun::star::sdbc::XRow; using ::com::sun::star::sdb::application::XDatabaseDocumentUI; +using ::com::sun::star::beans::PropertyValue; /** === end UNO using === **/ namespace connectivity { namespace hsqldb @@ -232,8 +246,7 @@ if ( !impl_isTextTable_nothrow( _TableName ) ) return NULL; - // TODO - return NULL; + return impl_getTextTableIcon_nothrow(); } // ------------------------------------------------------------------- @@ -336,6 +349,7 @@ if ( !bDoesExist ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no table named " ) ) + _rTableName, *this, 0 ); + // TODO: resource } // ------------------------------------------------------------------- @@ -374,20 +388,55 @@ Reference< XStatement > xStatement( xMe->createStatement(), UNO_QUERY_THROW ); Reference< XResultSet > xTableHsqlType( xStatement->executeQuery( sSQL.makeStringAndClear() ), UNO_QUERY_THROW ); - OSL_VERIFY( xTableHsqlType->next() ); - // this should succeeed, as our precondition is that _rTableName denotes an - // existing table. + if ( xTableHsqlType->next() ) // might not succeed in case of VIEWs + { Reference< XRow > xValueAccess( xTableHsqlType, UNO_QUERY_THROW ); ::rtl::OUString sTableType = xValueAccess->getString( 1 ); bIsTextTable = sTableType.equalsAscii( "TEXT" ); } + } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } return bIsTextTable; + } + + // ------------------------------------------------------------------- + Reference< XGraphic > OHsqlConnection::impl_getTextTableIcon_nothrow() + { + Reference< XGraphic > xGraphic; + try + { + // create a graphic provider + Reference< XGraphicProvider > xProvider; + if ( m_xORB.is() ) + xProvider.set( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW ); + + // assemble the image URL + ::rtl::OUStringBuffer aImageURL; + aImageURL.appendAscii( "private:imagerepository/" ); // load the image from the global image repository + aImageURL.appendAscii( "/res/" ); // the relative path within the images.zip + aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE ); + // the name of the image to use + ::rtl::OUString sImageURL( aImageURL.makeStringAndClear() ); + + // TODO: high-contrast mode? + + // ask the provider to obtain a graphic + Sequence< PropertyValue > aMediaProperties( 1 ); + aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); + aMediaProperties[0].Value <<= sImageURL; + xGraphic = xProvider->queryGraphic( aMediaProperties ); + OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xGraphic; } } } // namespace connectivity::hsqldb File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/makefile.mk?r1=1.8&r2=1.8.172.1 Delta lines: +19 -3 -------------------- --- makefile.mk 8 Sep 2005 06:07:25 -0000 1.8 +++ makefile.mk 19 Sep 2006 07:37:00 -0000 1.8.172.1 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.8.172.1 $ # -# last change: $Author: rt $ $Date: 2005/09/08 06:07:25 $ +# last change: $Author: fs $ $Date: 2006/09/19 07:37:00 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -49,6 +49,22 @@ nojava: @echo "Not building jurt because Java is disabled" .ENDIF + +# --- Resources --------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = \ + hsqlui.src + +RES1FILELIST=\ + $(SRS)$/$(TARGET).srs + +RESLIB1NAME=$(TARGET) +RESLIB1SRSFILES=$(RES1FILELIST) + +# Note that the resource file built here is currently *not* included +# in installation sets. See hsqlui.src for an explanation + # --- Files ------------------------------------- SLOFILES=\ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
