diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-03-14 06:39:15 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-03-14 06:39:15 +0000 |
commit | e49952dd381522878e5e6fb3be2af96af92b3ab7 (patch) | |
tree | 1f29c8e7231578887894a15752ac56bdbf39bff7 /dbaccess/source | |
parent | 8a11103a336e0cf27b449e27320646a10b79cdd9 (diff) |
#84622# use of special edit
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/control/FieldDescControl.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/control/makefile.mk | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/FieldDescControl.hxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 44 |
4 files changed, 49 insertions, 29 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 360c7a38c8b1..590e5763bbbf 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FieldDescControl.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-03-02 15:42:26 $ + * last change: $Author: oj $ $Date: 2001-03-14 07:37:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1023,7 +1023,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) return; Reference< XDatabaseMetaData> xMetaData = getMetaData(); - if(xMetaData->supportsNonNullableColumns()) + if(xMetaData.is() && xMetaData->supportsNonNullableColumns()) { nPos++; pRequiredText = new FixedText( this ); @@ -1126,14 +1126,18 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) if( m_pColumnName ) return; nPos++; - m_pColumnNameText = new FixedText( this ); - m_pColumnNameText->SetText( ModuleRes(STR_TAB_FIELD_NAME) ); - m_pColumnName = new OPropEditCtrl( this, STR_HELP_DEFAULT_VALUE, FIELD_PRPOERTY_COLUMNNAME, WB_BORDER ); - m_pColumnName->SetHelpId(HID_TAB_ENT_COLUMNNAME); { Reference< XDatabaseMetaData> xMetaData = getMetaData(); - sal_uInt32 nMax = xMetaData->getMaxColumnNameLength(); - m_pColumnName->SetMaxTextLen( nMax ? nMax : EDIT_NOLIMIT); + sal_uInt32 nMax = xMetaData.is() ? xMetaData->getMaxColumnNameLength() : EDIT_NOLIMIT; + m_pColumnNameText = new FixedText( this ); + m_pColumnNameText->SetText( ModuleRes(STR_TAB_FIELD_NAME) ); + m_pColumnName = new OPropColumnEditCtrl( this, + xMetaData.is() ? xMetaData->getExtraNameCharacters() : ::rtl::OUString(), + STR_HELP_DEFAULT_VALUE, + FIELD_PRPOERTY_COLUMNNAME, + WB_BORDER ); + m_pColumnName->SetHelpId(HID_TAB_ENT_COLUMNNAME); + m_pColumnName->SetMaxTextLen(xub_StrLen( nMax ? nMax : EDIT_NOLIMIT)); } SetPosSize( (Control**)&m_pColumnNameText, nPos, 0 ); diff --git a/dbaccess/source/ui/control/makefile.mk b/dbaccess/source/ui/control/makefile.mk index 05c7195e7c51..ddae97da50d2 100644 --- a/dbaccess/source/ui/control/makefile.mk +++ b/dbaccess/source/ui/control/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: oj $ $Date: 2001-02-14 14:34:43 $ +# last change: $Author: oj $ $Date: 2001-03-14 07:37:39 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -83,6 +83,7 @@ SRCFILES = \ # ... object files ............................ SLOFILES= \ + $(SLO)$/SqlNameEdit.obj \ $(SLO)$/FieldDescControl.obj \ $(SLO)$/listviewitems.obj \ $(SLO)$/undosqledit.obj \ diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx index b98314a44ea7..ee8d11b55a6b 100644 --- a/dbaccess/source/ui/inc/FieldDescControl.hxx +++ b/dbaccess/source/ui/inc/FieldDescControl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FieldDescControl.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-14 14:37:14 $ + * last change: $Author: oj $ $Date: 2001-03-14 07:38:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,6 +115,7 @@ namespace dbaui class OPropNumericEditCtrl; class OFieldDescription; class OTypeInfo; + class OPropColumnEditCtrl; //================================================================== class OFieldDescControl : public TabPage { @@ -143,7 +144,7 @@ namespace dbaui OPropNumericEditCtrl* pScale; OPropEditCtrl* pFormatSample; OPropListBoxCtrl* pBoolDefault; - OPropEditCtrl* m_pColumnName; + OPropColumnEditCtrl* m_pColumnName; OPropListBoxCtrl* m_pType; PushButton* pFormat; diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 988bd5fd490b..5c781b61091f 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TEditControl.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-03-02 15:42:27 $ + * last change: $Author: oj $ $Date: 2001-03-14 07:39:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,6 +109,9 @@ #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif +#ifndef DBAUI_SQLNAMEEDIT_HXX +#include "SqlNameEdit.hxx" +#endif using namespace dbaui; using namespace comphelper; @@ -154,6 +157,7 @@ DBG_NAME(OTableEditorCtrl); #define CONTROL_WIDTH_3 250 #define CONTROL_WIDTH_4 (CONTROL_WIDTH_3 - CONTROL_HEIGHT - 5) + //================================================================== //------------------------------------------------------------------ OTableEditorCtrl::ClipboardInvalidator::ClipboardInvalidator(sal_uInt32 nTimeout,OTableEditorCtrl* _pOwner) @@ -309,13 +313,15 @@ void OTableEditorCtrl::InitCellController() DBG_CHKTHIS(OTableEditorCtrl,NULL); ////////////////////////////////////////////////////////////////////// // Zelle Feldname - pNameCell = new Edit( &GetDataWindow(), WB_LEFT ); - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; - xub_StrLen nMaxTextLen((xub_StrLen)xMetaData->getMaxColumnNameLength()); + xub_StrLen nMaxTextLen((xub_StrLen)xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0); if( nMaxTextLen == 0 ) - nMaxTextLen = USHRT_MAX; // TODO : need xub_MaxStrLen or something like that + nMaxTextLen = EDIT_NOLIMIT; + + pNameCell = new OSQLNameEdit( &GetDataWindow(), xMetaData.is() ? xMetaData->getExtraNameCharacters() : ::rtl::OUString(),WB_LEFT ); pNameCell->SetMaxTextLen( nMaxTextLen ); ////////////////////////////////////////////////////////////////////// @@ -587,9 +593,10 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const String& rFieldName ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; - ::comphelper::UStringMixEqual bCase(xMetaData->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->storesMixedCaseQuotedIdentifiers() : sal_True); ::std::vector<OTableRow*>::iterator aIter = m_pRowList->begin(); OFieldDescription* pFieldDescr; @@ -868,8 +875,10 @@ String OTableEditorCtrl::GenerateName( const String& rName ) ////////////////////////////////////////////////////////////////////// // Basisnamen zum Anhaengen einer Numerierung erstellen String aBaseName; - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); - xub_StrLen nMaxTextLen((xub_StrLen)xMetaData->getMaxColumnNameLength()); + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; + + xub_StrLen nMaxTextLen((xub_StrLen)( xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0)); if( (rName.Len()+2) >nMaxTextLen ) aBaseName = rName.Copy( 0, nMaxTextLen-2 ); @@ -1304,10 +1313,11 @@ sal_Bool OTableEditorCtrl::IsDeleteAllowed( long nRow ) return sal_False; // Wenn nur Felder hinzugefuegt werden duerfen, Delete nur auf neuen Feldern - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; return !(xTable.is() && xTable->getPropertySetInfo()->getPropertyByName(PROPERTY_NAME).Attributes & PropertyAttribute::READONLY) || - ( xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn()); + ( xMetaData.is() && xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn()); } //------------------------------------------------------------------------------ @@ -1321,7 +1331,10 @@ sal_Bool OTableEditorCtrl::IsInsertNewAllowed( long nRow ) if(!(xTable.is() && xTable->getPropertySetInfo()->getPropertyByName(PROPERTY_NAME).Attributes & PropertyAttribute::READONLY)) return sal_True; - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; + if(!xMetaData.is()) + return sal_False; ////////////////////////////////////////////////////////////// // Wenn nur Felder geloescht werden duerfen, Paste disablen @@ -1349,8 +1362,9 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long nRow ) ////////////////////////////////////////////////////////////// // Datenbank kann keine PrimKeys verarbeiten oder keine Zeilenselektion - Reference< XDatabaseMetaData> xMetaData = GetView()->getController()->getConnection()->getMetaData(); - if(!xMetaData->supportsCoreSQLGrammar()) + Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; + if(!xMetaData.is() || !xMetaData->supportsCoreSQLGrammar()) return sal_False; ////////////////////////////////////////////////////////////// |