summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc2
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx1
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx6
-rw-r--r--dbaccess/source/inc/dsntypes.hxx3
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx8
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx2
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx33
-rw-r--r--dbaccess/source/ui/inc/FieldDescriptions.hxx3
-rw-r--r--dbaccess/source/ui/inc/dbu_tbl.hrc3
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx1
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx1
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx29
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx146
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx15
-rw-r--r--dbaccess/source/ui/tabledesign/TableRow.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/table.src6
-rw-r--r--dbaccess/util/hidother.src2
19 files changed, 199 insertions, 69 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index ec30ff3d3d1d..9ca34ebc9eae 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -330,7 +330,7 @@
#define HID_APP_VIEW_PREVIEW_CB (HID_DBACCESS_START + 276)
#define HID_APP_VIEW_PREVIEW_1 (HID_DBACCESS_START + 277)
#define HID_APP_VIEW_PREVIEW_2 (HID_DBACCESS_START + 278)
-// free
+#define HID_TABDESIGN_HELPTEXT (HID_DBACCESS_START + 279)
#define UID_APP_VIEW_HORZ_SPLIT (HID_DBACCESS_START + 280)
#define UID_APP_VIEW_PREVIEW_1 (HID_DBACCESS_START + 281)
#define HID_APP_VIEW_PREVIEW_3 (HID_DBACCESS_START + 282)
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 5abf774e1d92..e708be75cdba 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1167,6 +1167,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
+ AsciiPropertyValue( "ShowColumnDescription", makeAny( (sal_Bool)sal_False ) ),
// known SDB level settings
AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ),
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 9793da690a2e..de6f89c24d2c 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -281,6 +281,12 @@ sal_Bool ODsnTypeCollection::supportsTableCreation(const ::rtl::OUString& _sURL)
return aFeatures.getOrDefault("SupportsTableCreation",sal_False);
}
// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsColumnDescription(const ::rtl::OUString& _sURL) const
+{
+ const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsColumnDescription",sal_False);
+}
+// -----------------------------------------------------------------------------
sal_Bool ODsnTypeCollection::supportsBrowsing(const ::rtl::OUString& _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 4e9153a6a216..b294ef20d1a9 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -162,6 +162,9 @@ public:
/// check if the given data source allows creation of tables
sal_Bool supportsTableCreation(const ::rtl::OUString& _sURL) const;
+ /// check if the given data source allows to show column description.
+ sal_Bool supportsColumnDescription(const ::rtl::OUString& _sURL) const;
+
// check if a Browse button may be shown to insert connection url
sal_Bool supportsBrowsing(const ::rtl::OUString& _sURL) const;
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 1e10e9421047..d6b6483f4a7f 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -681,8 +681,12 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
Any aDescription;
if ( xColPSI->hasPropertyByName( PROPERTY_HELPTEXT ) )
aDescription = xColumn->getPropertyValue( PROPERTY_HELPTEXT );
- if ( !aDescription.hasValue() )
- aDescription <<= ::rtl::OUString();
+ ::rtl::OUString sTemp;
+ aDescription >>= sTemp;
+ if ( !sTemp.getLength() )
+ xColumn->getPropertyValue( PROPERTY_DESCRIPTION ) >>= sTemp;
+
+ aDescription <<= sTemp;
aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) );
// ... horizontal justify
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 9c14bfabd17a..a092109efe80 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -945,7 +945,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
{
::rtl::OUString sEmbeddedURL = m_pCollection->getEmbeddedDatabase();
::connectivity::DriversConfig aDriverConfig(getORB());
- if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() || m_pImpl->getDriver(sEmbeddedURL).is() )
+ if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() || !m_pImpl->getDriver(sEmbeddedURL).is() )
sEmbeddedURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:"));
return sEmbeddedURL;
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index c77942cd71c0..e7828590c53b 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -50,22 +50,23 @@
// die Spalten einer Feld-Beschreibung einer Tabelle
#define FIELD_NAME 1
#define FIELD_TYPE 2
-#define FIELD_DESCR 3
-
-#define FIELD_FIRST_VIRTUAL_COLUMN 4
-
-#define FIELD_PROPERTY_REQUIRED 4
-#define FIELD_PROPERTY_NUMTYPE 5
-#define FIELD_PROPERTY_AUTOINC 6
-#define FIELD_PROPERTY_DEFAULT 7
-#define FIELD_PROPERTY_TEXTLEN 8
-#define FIELD_PROPERTY_LENGTH 9
-#define FIELD_PROPERTY_SCALE 10
-#define FIELD_PROPERTY_BOOL_DEFAULT 11
-#define FIELD_PROPERTY_FORMAT 12
-#define FIELD_PRPOERTY_COLUMNNAME 13
-#define FIELD_PRPOERTY_TYPE 14
-#define FIELD_PRPOERTY_AUTOINCREMENT 15
+#define HELP_TEXT 3
+#define COLUMN_DESCRIPTION 4
+
+#define FIELD_FIRST_VIRTUAL_COLUMN 5
+
+#define FIELD_PROPERTY_REQUIRED 5
+#define FIELD_PROPERTY_NUMTYPE 6
+#define FIELD_PROPERTY_AUTOINC 7
+#define FIELD_PROPERTY_DEFAULT 8
+#define FIELD_PROPERTY_TEXTLEN 9
+#define FIELD_PROPERTY_LENGTH 10
+#define FIELD_PROPERTY_SCALE 11
+#define FIELD_PROPERTY_BOOL_DEFAULT 12
+#define FIELD_PROPERTY_FORMAT 13
+#define FIELD_PRPOERTY_COLUMNNAME 14
+#define FIELD_PRPOERTY_TYPE 15
+#define FIELD_PRPOERTY_AUTOINCREMENT 16
class FixedText;
class PushButton;
diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx
index ee473b032853..4273ea9d62ff 100644
--- a/dbaccess/source/ui/inc/FieldDescriptions.hxx
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -67,6 +67,7 @@ namespace dbaui
::rtl::OUString m_sName;
::rtl::OUString m_sTypeName;
::rtl::OUString m_sDescription;
+ ::rtl::OUString m_sHelpText;
::rtl::OUString m_sAutoIncrementValue;
sal_Int32 m_nType; // only used when m_pType is null
@@ -89,6 +90,7 @@ namespace dbaui
void SetName(const ::rtl::OUString& _rName);
void SetDescription(const ::rtl::OUString& _rDescription);
+ void SetHelpText(const ::rtl::OUString& _sHelptext);
void SetDefaultValue(const ::com::sun::star::uno::Any& _rDefaultValue);
void SetControlDefault(const ::com::sun::star::uno::Any& _rControlDefault);
void SetAutoIncrementValue(const ::rtl::OUString& _sAutoIncValue);
@@ -113,6 +115,7 @@ namespace dbaui
::rtl::OUString GetName() const;
::rtl::OUString GetDescription() const;
+ ::rtl::OUString GetHelpText() const;
::com::sun::star::uno::Any GetControlDefault() const;
::rtl::OUString GetAutoIncrementValue() const;
sal_Int32 GetType() const;
diff --git a/dbaccess/source/ui/inc/dbu_tbl.hrc b/dbaccess/source/ui/inc/dbu_tbl.hrc
index 4f8e99655d76..1f2ba31a0eb8 100644
--- a/dbaccess/source/ui/inc/dbu_tbl.hrc
+++ b/dbaccess/source/ui/inc/dbu_tbl.hrc
@@ -44,7 +44,7 @@
#define STR_TAB_FIELD_NAME RID_STR_TBL_START + 7
#define STR_TAB_FIELD_DATATYPE RID_STR_TBL_START + 8
#define STR_TAB_FIELD_LENGTH RID_STR_TBL_START + 9
-#define STR_TAB_FIELD_DESCR RID_STR_TBL_START + 10
+#define STR_TAB_HELP_TEXT RID_STR_TBL_START + 10
#define STR_TAB_FIELD_NULLABLE RID_STR_TBL_START + 11
#define STR_FIELD_AUTOINCREMENT RID_STR_TBL_START + 12
#define STR_TAB_PROPERTIES RID_STR_TBL_START + 13
@@ -89,6 +89,7 @@
#define STR_CHANGE_COLUMN_ATTRIBUTE RID_STR_TBL_START + 52
#define STR_TABLEDESIGN_SAVE_ERROR RID_STR_TBL_START + 53
#define STR_TABLEDESIGN_COULD_NOT_DROP_COL RID_STR_TBL_START + 54
+#define STR_COLUMN_DESCRIPTION RID_STR_TBL_START + 55
// please adjust checking before insert new strings
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 8d7e24e2792c..6fde27636be9 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -892,6 +892,7 @@ void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDe
_rxColumn->setPropertyValue(PROPERTY_SCALE,makeAny(_pFieldDesc->GetScale()));
_rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, makeAny(_pFieldDesc->GetIsNullable()));
_rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT,::cppu::bool2any(_pFieldDesc->IsAutoIncrement()));
+ _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_pFieldDesc->GetDescription()));
if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISCURRENCY) && _pFieldDesc->IsCurrency() )
_rxColumn->setPropertyValue(PROPERTY_ISCURRENCY,::cppu::bool2any(_pFieldDesc->IsCurrency()));
// set autoincrement value when available
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 1cdf6156a789..fefa641d3d3f 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -371,7 +371,7 @@ void NamedTableCopySource::impl_ensureColumnInfo_throw()
OFieldDescription aDesc;
aDesc.SetName( xStatementMeta->getColumnName( i ) );
- aDesc.SetDescription( xStatementMeta->getColumnLabel( i ) );
+ aDesc.SetHelpText( xStatementMeta->getColumnLabel( i ) );
aDesc.SetTypeValue( xStatementMeta->getColumnType( i ) );
aDesc.SetTypeName( xStatementMeta->getColumnTypeName( i ) );
aDesc.SetPrecision( xStatementMeta->getPrecision( i ) );
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index de062c093a46..afd5124851c4 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -3159,6 +3159,7 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pE
parse::OParseColumn* pColumn = new parse::OParseColumn( pEntry->GetField(),
::rtl::OUString(),
::rtl::OUString(),
+ ::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index 6e90ebed7e88..6e75f1e969f8 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -157,6 +157,8 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
+ SetHelpText(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
@@ -288,6 +290,21 @@ void OFieldDescription::SetName(const ::rtl::OUString& _rName)
}
}
// -----------------------------------------------------------------------------
+void OFieldDescription::SetHelpText(const ::rtl::OUString& _sHelpText)
+{
+ try
+ {
+ if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ m_xDest->setPropertyValue(PROPERTY_HELPTEXT,makeAny(_sHelpText));
+ else
+ m_sHelpText = _sHelpText;
+ }
+ catch(const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
void OFieldDescription::SetDescription(const ::rtl::OUString& _rDescription)
{
try
@@ -504,6 +521,14 @@ void OFieldDescription::SetCurrency(sal_Bool _bIsCurrency)
return m_sDescription;
}
// -----------------------------------------------------------------------------
+::rtl::OUString OFieldDescription::GetHelpText() const
+{
+ if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_HELPTEXT));
+ else
+ return m_sHelpText;
+}
+// -----------------------------------------------------------------------------
::com::sun::star::uno::Any OFieldDescription::GetControlDefault() const
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
@@ -657,8 +682,8 @@ void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _r
_rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
if ( GetHorJustify() != SVX_HOR_JUSTIFY_STANDARD && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
_rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(GetHorJustify())));
- if ( GetDescription().getLength() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetDescription()));
+ if ( GetHelpText().getLength() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
_rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 347a19ca60ad..8ddb588dd951 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -108,6 +108,7 @@
#ifndef DBAUI_TABLEFIELDCONTROL_HXX
#include "TableFieldControl.hxx"
#endif
+#include "dsntypes.hxx"
using namespace ::dbaui;
using namespace ::comphelper;
@@ -202,13 +203,21 @@ void OTableEditorCtrl::Init()
//////////////////////////////////////////////////////////////////////
// Spalten einfuegen
String aColumnName( ModuleRes(STR_TAB_FIELD_COLUMN_NAME) );
- InsertDataColumn( 1, aColumnName, FIELDNAME_WIDTH );
+ InsertDataColumn( FIELD_NAME, aColumnName, FIELDNAME_WIDTH );
aColumnName = String( ModuleRes(STR_TAB_FIELD_COLUMN_DATATYPE) );
- InsertDataColumn( 2, aColumnName, FIELDTYPE_WIDTH );
+ InsertDataColumn( FIELD_TYPE, aColumnName, FIELDTYPE_WIDTH );
- aColumnName = String( ModuleRes(STR_TAB_FIELD_DESCR) );
- InsertDataColumn( 3, aColumnName, FIELDDESCR_WIDTH );
+ ::dbaccess::ODsnTypeCollection aDsnTypes(GetView()->getController().getORB());
+ sal_Bool bShowColumnDescription = aDsnTypes.supportsColumnDescription(::comphelper::getString(GetView()->getController().getDataSource()->getPropertyValue(PROPERTY_URL)));
+ aColumnName = String( ModuleRes(STR_TAB_HELP_TEXT) );
+ InsertDataColumn( HELP_TEXT, aColumnName, bShowColumnDescription ? FIELDTYPE_WIDTH : FIELDDESCR_WIDTH );
+
+ if ( bShowColumnDescription )
+ {
+ aColumnName = String( ModuleRes(STR_COLUMN_DESCRIPTION) );
+ InsertDataColumn( COLUMN_DESCRIPTION, aColumnName, FIELDTYPE_WIDTH );
+ }
InitCellController();
@@ -232,6 +241,7 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow)
:OTableRowView(pWindow)
,pNameCell(NULL)
,pTypeCell(NULL)
+ ,pHelpTextCell(NULL)
,pDescrCell(NULL)
,pDescrWin(NULL)
,nIndexEvent(0)
@@ -345,12 +355,16 @@ void OTableEditorCtrl::InitCellController()
pDescrCell = new Edit( &GetDataWindow(), WB_LEFT );
pDescrCell->SetMaxTextLen( MAX_DESCR_LEN );
+ pHelpTextCell = new Edit( &GetDataWindow(), WB_LEFT );
+ pHelpTextCell->SetMaxTextLen( MAX_DESCR_LEN );
+
pNameCell->SetHelpId(HID_TABDESIGN_NAMECELL);
pTypeCell->SetHelpId(HID_TABDESIGN_TYPECELL);
pDescrCell->SetHelpId(HID_TABDESIGN_COMMENTCELL);
+ pHelpTextCell->SetHelpId(HID_TABDESIGN_HELPTEXT);
Size aHeight;
- const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell};
+ const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell};
for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i)
{
const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
@@ -368,6 +382,7 @@ void OTableEditorCtrl::ClearModified()
DBG_CHKTHIS(OTableEditorCtrl,NULL);
pNameCell->ClearModifyFlag();
pDescrCell->ClearModifyFlag();
+ pHelpTextCell->ClearModifyFlag();
pTypeCell->SaveValue();
}
@@ -399,6 +414,7 @@ OTableEditorCtrl::~OTableEditorCtrl()
delete pNameCell;
delete pTypeCell;
delete pDescrCell;
+ delete pHelpTextCell;
}
//------------------------------------------------------------------------------
@@ -474,10 +490,16 @@ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId)
if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
return new ListBoxCellController( pTypeCell );
else return NULL;
- case FIELD_DESCR:
+ case HELP_TEXT:
+ if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
+ return new EditCellController( pHelpTextCell );
+ else
+ return NULL;
+ case COLUMN_DESCRIPTION:
if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
return new EditCellController( pDescrCell );
- else return NULL;
+ else
+ return NULL;
default:
return NULL;
}
@@ -519,7 +541,13 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
}
break;
- case FIELD_DESCR:
+ case HELP_TEXT:
+ if( pActFieldDescr )
+ aInitString = pActFieldDescr->GetHelpText();
+ pHelpTextCell->SetText( aInitString );
+ pHelpTextCell->SaveValue();
+ break;
+ case COLUMN_DESCRIPTION:
if( pActFieldDescr )
aInitString = pActFieldDescr->GetDescription();
pDescrCell->SetText( aInitString );
@@ -579,7 +607,8 @@ void OTableEditorCtrl::DisplayData(long nRow, sal_Bool bGrabFocus)
CellControllerRef aTemp;
InitController(aTemp, nRow, FIELD_NAME);
InitController(aTemp, nRow, FIELD_TYPE);
- InitController(aTemp, nRow, FIELD_DESCR);
+ InitController(aTemp, nRow, COLUMN_DESCRIPTION);
+ InitController(aTemp, nRow, HELP_TEXT);
GoToRow(nRow);
// das Description-Window aktualisieren
@@ -604,7 +633,8 @@ void OTableEditorCtrl::CursorMoved()
CellControllerRef aTemp;
InitController(aTemp,m_nDataPos,FIELD_NAME);
InitController(aTemp,m_nDataPos,FIELD_TYPE);
- InitController(aTemp,m_nDataPos,FIELD_DESCR);
+ InitController(aTemp,m_nDataPos,COLUMN_DESCRIPTION);
+ InitController(aTemp,m_nDataPos,HELP_TEXT);
}
OTableRowView::CursorMoved();
@@ -678,7 +708,20 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
//////////////////////////////////////////////////////////////
// Speichern Inhalt DescrCell
- case FIELD_DESCR:
+ case HELP_TEXT:
+ {
+ //////////////////////////////////////////////////////////////
+ // Wenn aktuelle Feldbeschreibung NULL, Default setzen
+ if( !pActFieldDescr )
+ {
+ pHelpTextCell->SetText(String());
+ pHelpTextCell->ClearModifyFlag();
+ }
+ else
+ pActFieldDescr->SetHelpText( pHelpTextCell->GetText() );
+ break;
+ }
+ case COLUMN_DESCRIPTION:
{
//////////////////////////////////////////////////////////////
// Wenn aktuelle Feldbeschreibung NULL, Default setzen
@@ -814,7 +857,8 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
{
case FIELD_NAME: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_NAME ) ); break;
case FIELD_TYPE: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_TYPE ) ); break;
- case FIELD_DESCR: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_DESCRIPTION ) ); break;
+ case HELP_TEXT:
+ case COLUMN_DESCRIPTION: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_DESCRIPTION ) ); break;
default: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_ATTRIBUTE ) ); break;
}
@@ -1179,7 +1223,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const ::com::s
OSL_ENSURE(sal_False, "OTableEditorCtrl::SetCellData: invalid column!");
break;
- case FIELD_DESCR:
+ case COLUMN_DESCRIPTION:
pFieldDescr->SetDescription( sValue = ::comphelper::getString(_rNewData) );
break;
@@ -1268,9 +1312,12 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
sValue = pFieldDescr->getTypeInfo()->aUIName;
break;
- case FIELD_DESCR:
+ case COLUMN_DESCRIPTION:
sValue = pFieldDescr->GetDescription();
break;
+ case HELP_TEXT:
+ sValue = pFieldDescr->GetHelpText();
+ break;
case FIELD_PROPERTY_DEFAULT:
return pFieldDescr->GetControlDefault();
@@ -1350,16 +1397,24 @@ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow )
if(bIsCutAllowed)
{
- if(m_eChildFocus == DESCRIPTION)
- bIsCutAllowed = pDescrCell->GetSelected().Len() != 0;
- else if(m_eChildFocus == NAME)
- bIsCutAllowed = pNameCell->GetSelected().Len() != 0;
- else if(m_eChildFocus == ROW)
- // only rows are selected for cutting so we look if all rows are valid
- // wwe don't waant to copy empty rows here
- bIsCutAllowed = IsCopyAllowed(nRow);
- else
- bIsCutAllowed = sal_False;
+ switch(m_eChildFocus)
+ {
+ case DESCRIPTION:
+ bIsCutAllowed = pDescrCell->GetSelected().Len() != 0;
+ break;
+ case HELPTEXT:
+ bIsCutAllowed = pHelpTextCell->GetSelected().Len() != 0;
+ break;
+ case NAME:
+ bIsCutAllowed = pNameCell->GetSelected().Len() != 0;
+ break;
+ case ROW:
+ bIsCutAllowed = IsCopyAllowed(nRow);
+ break;
+ default:
+ bIsCutAllowed = sal_False;
+ break;
+ }
}
// Reference<XPropertySet> xTable = GetView()->getController().getTable();
@@ -1375,8 +1430,10 @@ sal_Bool OTableEditorCtrl::IsCopyAllowed( long /*nRow*/ )
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
sal_Bool bIsCopyAllowed = sal_False;
- if(m_eChildFocus == DESCRIPTION)
+ if(m_eChildFocus == DESCRIPTION )
bIsCopyAllowed = pDescrCell->GetSelected().Len() != 0;
+ else if(HELPTEXT == m_eChildFocus )
+ bIsCopyAllowed = pHelpTextCell->GetSelected().Len() != 0;
else if(m_eChildFocus == NAME)
bIsCopyAllowed = pNameCell->GetSelected().Len() != 0;
else if(m_eChildFocus == ROW)
@@ -1438,9 +1495,18 @@ void OTableEditorCtrl::cut()
{
if(GetView()->getController().isAlterAllowed())
{
- SaveData(-1,FIELD_DESCR);
+ SaveData(-1,COLUMN_DESCRIPTION);
pDescrCell->Cut();
- CellModified(-1,FIELD_DESCR);
+ CellModified(-1,COLUMN_DESCRIPTION);
+ }
+ }
+ else if(HELPTEXT == m_eChildFocus )
+ {
+ if(GetView()->getController().isAlterAllowed())
+ {
+ SaveData(-1,HELP_TEXT);
+ pHelpTextCell->Cut();
+ CellModified(-1,HELP_TEXT);
}
}
else if(m_eChildFocus == ROW)
@@ -1458,7 +1524,9 @@ void OTableEditorCtrl::copy()
OTableRowView::copy();
else if(m_eChildFocus == NAME)
pNameCell->Copy();
- else if(m_eChildFocus == DESCRIPTION)
+ else if(HELPTEXT == m_eChildFocus )
+ pHelpTextCell->Copy();
+ else if(m_eChildFocus == DESCRIPTION )
pDescrCell->Copy();
}
@@ -1480,6 +1548,14 @@ void OTableEditorCtrl::paste()
CellModified();
}
}
+ else if(HELPTEXT == m_eChildFocus )
+ {
+ if(GetView()->getController().isAlterAllowed())
+ {
+ pHelpTextCell->Paste();
+ CellModified();
+ }
+ }
else if(m_eChildFocus == DESCRIPTION)
{
if(GetView()->getController().isAlterAllowed())
@@ -1496,16 +1572,6 @@ sal_Bool OTableEditorCtrl::IsDeleteAllowed( long /*nRow*/ )
DBG_CHKTHIS(OTableEditorCtrl,NULL);
return GetSelectRowCount() != 0 && GetView()->getController().isDropAllowed();
-// Reference<XPropertySet> xTable = GetView()->getController().getTable();
-// if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW")))
-// return sal_False;
-//
-// // Wenn nur Felder hinzugefuegt werden duerfen, Delete nur auf neuen Feldern
-// 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.is() && xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn());
}
//------------------------------------------------------------------------------
@@ -1936,7 +2002,9 @@ long OTableEditorCtrl::PreNotify( NotifyEvent& rNEvt )
{
if (rNEvt.GetType() == EVENT_GETFOCUS)
{
- if( pDescrCell && pDescrCell->HasChildPathFocus() )
+ if( pHelpTextCell && pHelpTextCell->HasChildPathFocus() )
+ m_eChildFocus = HELPTEXT;
+ else if( pDescrCell && pDescrCell->HasChildPathFocus() )
m_eChildFocus = DESCRIPTION;
else if(pNameCell && pNameCell->HasChildPathFocus() )
m_eChildFocus = NAME;
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index c28d525d6450..120b548e8e6d 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -59,6 +59,7 @@ namespace dbaui
{
enum ChildFocusState
{
+ HELPTEXT,
DESCRIPTION,
NAME,
ROW,
@@ -70,6 +71,7 @@ namespace dbaui
OSQLNameEdit* pNameCell;
::svt::ListBoxControl* pTypeCell;
+ Edit* pHelpTextCell;
Edit* pDescrCell;
OTableFieldDescWin* pDescrWin; // properties of one column
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 1eed02543cda..df01b15dc6cf 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -871,7 +871,7 @@ void OTableController::loadData()
sal_Int32 nAlign = 0;
sal_Bool bIsAutoIncrement = false, bIsCurrency = false;
- ::rtl::OUString sName,sDescription,sTypeName;
+ ::rtl::OUString sName,sDescription,sTypeName,sHelpText;
Any aControlDefault;
// get the properties from the column
@@ -883,10 +883,11 @@ void OTableController::loadData()
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
-
+ xColumn->getPropertyValue(PROPERTY_DESCRIPTION) >>= sDescription;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
- xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sDescription;
+ xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
+
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
aControlDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT);
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
@@ -912,6 +913,7 @@ void OTableController::loadData()
pActFieldDescr->SetFormatKey(nFormatKey);
// pActFieldDescr->SetPrimaryKey(pPrimary->GetValue());
pActFieldDescr->SetDescription(sDescription);
+ pActFieldDescr->SetHelpText(sHelpText);
pActFieldDescr->SetAutoIncrement(bIsAutoIncrement);
pActFieldDescr->SetHorJustify(dbaui::mapTextJustify(nAlign));
pActFieldDescr->SetCurrency(bIsCurrency);
@@ -1120,13 +1122,14 @@ void OTableController::alterColumns()
sal_Int32 nType=0,nPrecision=0,nScale=0,nNullable=0;
sal_Bool bAutoIncrement = false;
- ::rtl::OUString sTypeName;
+ ::rtl::OUString sTypeName,sDescription;
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
xColumn->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullable;
xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAutoIncrement;
+ xColumn->getPropertyValue(PROPERTY_DESCRIPTION) >>= sDescription;
try { xColumn->getPropertyValue(PROPERTY_TYPENAME) >>= sTypeName; }
catch( const Exception& )
@@ -1145,6 +1148,7 @@ void OTableController::alterColumns()
(nPrecision != pField->GetPrecision() && nPrecision ) ||
nScale != pField->GetScale() ||
nNullable != pField->GetIsNullable() ||
+ sDescription != pField->GetDescription() ||
bAutoIncrement != pField->IsAutoIncrement())&&
xColumnFactory.is())
{
@@ -1264,7 +1268,8 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetDescription()));
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetHelpText()));
+
if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index cc7ad2c4a8bf..bf45ccda6689 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -140,6 +140,7 @@ namespace dbaui
_rStr << (sal_Int32)1;
_rStr.WriteByteString(pFieldDesc->GetName());
_rStr.WriteByteString(pFieldDesc->GetDescription());
+ _rStr.WriteByteString(pFieldDesc->GetHelpText());
double nValue = 0.0;
Any aValue = pFieldDesc->GetControlDefault();
if ( aValue >>= nValue )
@@ -184,6 +185,8 @@ namespace dbaui
_rStr.ReadByteString(sValue);
pFieldDesc->SetDescription(sValue);
+ _rStr.ReadByteString(sValue);
+ pFieldDesc->SetHelpText(sValue);
_rStr >> nValue;
Any aControlDefault;
diff --git a/dbaccess/source/ui/tabledesign/table.src b/dbaccess/source/ui/tabledesign/table.src
index 9fa0b0743ef4..5616f7f4101f 100644
--- a/dbaccess/source/ui/tabledesign/table.src
+++ b/dbaccess/source/ui/tabledesign/table.src
@@ -106,10 +106,14 @@ String STR_TAB_FIELD_LENGTH
{
Text [ en-US ] = "Field length" ;
};
-String STR_TAB_FIELD_DESCR
+String STR_TAB_HELP_TEXT
{
Text [ en-US ] = "Description" ;
};
+String STR_COLUMN_DESCRIPTION
+{
+ Text [ en-US ] = "Column Description" ;
+};
String STR_TAB_FIELD_NULLABLE
{
Text [ en-US ] = "Input required" ;
diff --git a/dbaccess/util/hidother.src b/dbaccess/util/hidother.src
index 2f97d1918fd3..e564f01ded61 100644
--- a/dbaccess/util/hidother.src
+++ b/dbaccess/util/hidother.src
@@ -149,6 +149,8 @@ hidspecial HID_CTL_TABLEEDIT { HelpId = HID_CTL_TABLE
hidspecial HID_TABDESIGN_NAMECELL { HelpId = HID_TABDESIGN_NAMECELL; };
hidspecial HID_TABDESIGN_TYPECELL { HelpId = HID_TABDESIGN_TYPECELL; };
hidspecial HID_TABDESIGN_COMMENTCELL { HelpId = HID_TABDESIGN_COMMENTCELL; };
+hidspecial HID_TABDESIGN_HELPTEXT { HelpId = HID_TABDESIGN_HELPTEXT; };
+
hidspecial SID_TABLEDESIGN_INSERTROWS { HelpId = SID_TABLEDESIGN_INSERTROWS; };
hidspecial SID_TABLEDESIGN_TABED_PRIMARYKEY { HelpId = SID_TABLEDESIGN_TABED_PRIMARYKEY; };
hidspecial HID_TLB_TABLEDESIGN { HelpId = HID_TLB_TABLEDESIGN; };