summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2002-09-24 08:19:07 +0000
committerOcke Janssen <oj@openoffice.org>2002-09-24 08:19:07 +0000
commitee45f581566eac2b3665c5f2466b3945607f63ae (patch)
tree12be3bd0fbcb59a31270c3d73bfe221af0720480
parent0932f390f175de79b1e496a1ea903567119d4d7c (diff)
#103049# change handling of controlDefault, allow string and doubles
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx171
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx9
-rw-r--r--dbaccess/source/ui/inc/FieldDescriptions.hxx46
-rw-r--r--dbaccess/source/ui/inc/TableDesignControl.hxx8
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx6
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx14
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx8
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx6
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx19
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx100
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx8
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx20
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.cxx8
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.hxx8
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx6
-rw-r--r--dbaccess/source/ui/tabledesign/TableRow.cxx45
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.cxx10
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.hxx13
18 files changed, 325 insertions, 180 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 29b2163db..f79e09557 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.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2002-08-19 07:41:25 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -194,6 +194,7 @@ using namespace ::com::sun::star::sdbc;
#define HSCROLL_STEP 20
+
//==================================================================
// class OFieldDescControl
//==================================================================
@@ -784,7 +785,7 @@ IMPL_LINK( OFieldDescControl, ChangeHdl, ListBox *, pListBox )
if(pListBox == pRequired && pBoolDefault )
{
// wenn pRequired auf sal_True gesetzt ist, dann darf das sal_Bool Feld nicht den Eintrag <<keiner>> besitzen
- String sDef = BoolStringUI((pActFieldDescr->GetDefaultValue()));
+ String sDef = BoolStringUI(::comphelper::getString(pActFieldDescr->GetControlDefault()));
if(pRequired->GetSelectEntryPos() == 0) // JA
{
@@ -1655,14 +1656,14 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
if( pDefault )
{
- pDefault->SetText( pFieldDescr->GetDefaultValue() );
+ pDefault->SetText( getControlDefault(pFieldDescr) );
pDefault->ClearModifyFlag();
}
if( pBoolDefault )
{
// wenn pRequired auf sal_True gesetzt ist, dann darf das sal_Bool Feld nicht den Eintrag <<keiner>> besitzen
- String sDef = BoolStringUI(pFieldDescr->GetDefaultValue());
+ String sDef = BoolStringUI(::comphelper::getString(pFieldDescr->GetControlDefault()));
// sicher stellen das <<keiner>> nur vorhanden ist, wenn das Feld NULL sein darf
if(pFieldType && !pFieldType->bNullable || !pFieldDescr->IsNullable() )
@@ -1675,7 +1676,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
else
pBoolDefault->SelectEntry(sDef);
- pFieldDescr->SetDefaultValue(BoolStringPersistent(pBoolDefault->GetSelectEntry()));
+ pFieldDescr->SetControlDefault(makeAny(::rtl::OUString(BoolStringPersistent(pBoolDefault->GetSelectEntry()))));
}
else if(pBoolDefault->GetEntryCount() < 3)
{
@@ -1869,13 +1870,39 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
//////////////////////////////////////////////////////////////////////
// Controls auslesen
- String sDefault;
+ ::rtl::OUString sDefault;
if (pDefault)
sDefault = pDefault->GetText();
else if (pBoolDefault)
sDefault = BoolStringPersistent(pBoolDefault->GetSelectEntry());
- pFieldDescr->SetDefaultValue(sDefault);
+ sal_uInt32 nFormatKey;
+ try
+ {
+ if ( isTextFormat(pFieldDescr,nFormatKey) )
+ {
+ pFieldDescr->SetControlDefault(makeAny(sDefault));
+ }
+ else
+ {
+ try
+ {
+ double nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault);
+ pFieldDescr->SetControlDefault(makeAny(nValue));
+ }
+ catch(const Exception&)
+ {
+ if ( sDefault.getLength() )
+ pFieldDescr->SetControlDefault(makeAny(sDefault));
+ else
+ pFieldDescr->SetControlDefault(Any());
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+
if((pRequired && pRequired->GetSelectEntryPos() == 0) || pFieldDescr->IsPrimaryKey() || (pBoolDefault && pBoolDefault->GetEntryCount() == 2)) // yes
pFieldDescr->SetIsNullable( ColumnValue::NO_NULLS );
else
@@ -1907,49 +1934,8 @@ void OFieldDescControl::UpdateFormatSample(OFieldDescription* pFieldDescr)
return;
if(!pFormatSample)
return;
- sal_uInt32 nFormatKey = pFieldDescr->GetFormatKey();
- try
- {
- Reference< XNumberFormatTypes> xNumberTypes(GetFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY);
- OSL_ENSURE(xNumberTypes.is(),"XNumberFormatTypes is null!");
-
-
- if (!nFormatKey)
- {
- nFormatKey = ::dbtools::getDefaultNumberFormat( pFieldDescr->GetType(),
- pFieldDescr->GetScale(),
- pFieldDescr->IsCurrency(),
- xNumberTypes,
- GetLocale());
- }
-
- String sDefault = pFieldDescr->GetDefaultValue();
- sal_Int32 nNumberFormat = ::comphelper::getNumberFormatType(GetFormatter(),nFormatKey);
- if(nNumberFormat == NumberFormat::TEXT)
- pFormatSample->SetText(sDefault);
- else
- {
- Reference<XNumberFormatPreviewer> xPreViewer(GetFormatter(),UNO_QUERY);
- OSL_ENSURE(xPreViewer.is(),"XNumberFormatPreviewer is null!");
-
- double nValue = 0;
- if(sDefault.Len())
- nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault);
- Reference<XPropertySet> xFormSet = GetFormatter()->getNumberFormatsSupplier()->getNumberFormats()->getByKey(nFormatKey);
- OSL_ENSURE(xFormSet.is(),"XPropertySet is null!");
-
- ::rtl::OUString sFormat;
- xFormSet->getPropertyValue(::rtl::OUString::createFromAscii("FormatString")) >>= sFormat;
-
- sDefault = xPreViewer->convertNumberToPreviewString(sFormat,nValue,GetLocale(),sal_True);
- }
- pFormatSample->SetText(sDefault);
- }
- catch(Exception&)
- {
-
- }
+ pFormatSample->SetText(getControlDefault(pFieldDescr));
}
//------------------------------------------------------------------------------
@@ -2034,6 +2020,91 @@ void OFieldDescControl::paste()
reinterpret_cast<Edit*>(m_pActFocusWindow)->Paste();
}
// -----------------------------------------------------------------------------
+sal_Bool OFieldDescControl::isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const
+{
+ _nFormatKey = _pFieldDescr->GetFormatKey();
+ sal_Bool bTextFormat = sal_True;
+
+ try
+ {
+ if (!_nFormatKey)
+ {
+ Reference< XNumberFormatTypes> xNumberTypes(GetFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY);
+ OSL_ENSURE(xNumberTypes.is(),"XNumberFormatTypes is null!");
+
+ _nFormatKey = ::dbtools::getDefaultNumberFormat( _pFieldDescr->GetType(),
+ _pFieldDescr->GetScale(),
+ _pFieldDescr->IsCurrency(),
+ xNumberTypes,
+ GetLocale());
+ }
+ sal_Int32 nNumberFormat = ::comphelper::getNumberFormatType(GetFormatter(),_nFormatKey);
+ bTextFormat = (nNumberFormat == NumberFormat::TEXT);
+ }
+ catch(const Exception&)
+ {
+
+ }
+
+ return bTextFormat;
+}
+// -----------------------------------------------------------------------------
+String OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldDescr ) const
+{
+ ::rtl::OUString sDefault;
+ if ( _pFieldDescr->GetControlDefault().hasValue() )
+ {
+ sal_uInt32 nFormatKey;
+ sal_Bool bTextFormat = sal_False;
+ double nValue = 0.0;
+
+ try
+ {
+ bTextFormat = isTextFormat(_pFieldDescr,nFormatKey);
+ if ( _pFieldDescr->GetControlDefault() >>= sDefault )
+ {
+ if ( !bTextFormat )
+ {
+ if ( sDefault.getLength() )
+ {
+ try
+ {
+ nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault);
+ }
+ catch(const Exception&)
+ {
+ return ::rtl::OUString(); // return empty string for format example
+ }
+ }
+ }
+ }
+ else
+ _pFieldDescr->GetControlDefault() >>= nValue;
+
+ if ( !bTextFormat )
+ {
+ Reference<XNumberFormatPreviewer> xPreViewer(GetFormatter(),UNO_QUERY);
+ OSL_ENSURE(xPreViewer.is(),"XNumberFormatPreviewer is null!");
+
+ Reference<XPropertySet> xFormSet = GetFormatter()->getNumberFormatsSupplier()->getNumberFormats()->getByKey(nFormatKey);
+ OSL_ENSURE(xFormSet.is(),"XPropertySet is null!");
+
+ ::rtl::OUString sFormat;
+ xFormSet->getPropertyValue(::rtl::OUString::createFromAscii("FormatString")) >>= sFormat;
+
+ sDefault = xPreViewer->convertNumberToPreviewString(sFormat,nValue,GetLocale(),sal_True);
+ }
+ }
+ catch(const Exception&)
+ {
+
+ }
+ }
+
+ return sDefault;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index 9bf26a1b5..daa3e4751 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.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2002-07-26 09:34:01 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -186,6 +186,7 @@ namespace dbaui
void ScrollAggregate(Control* pText, Control* pInput, Control* pButton, long nDeltaX, long nDeltaY);
void ScrollAllAggregates();
+ sal_Bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
protected:
OFieldDescription* pActFieldDescr; // falls geloescht werden soll
@@ -196,7 +197,7 @@ namespace dbaui
virtual BOOL IsReadOnly() { return FALSE; };
// Sind von den abgeleiteten Klassen zu impl.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const = 0;
virtual ::com::sun::star::lang::Locale GetLocale() const = 0;
@@ -246,6 +247,8 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() = 0;
+
+ String getControlDefault( const OFieldDescription* _pFieldDescr ) const;
protected:
void implFocusLost(Window* _pWhich);
};
diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx
index 46e5b00fb..a22c7f6dc 100644
--- a/dbaccess/source/ui/inc/FieldDescriptions.hxx
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FieldDescriptions.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2002-07-22 12:11:17 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,12 +83,15 @@ namespace dbaui
{
private:
+ ::com::sun::star::uno::Any m_aDefaultValue; // the default value from the database
+ ::com::sun::star::uno::Any m_aControlDefault; // the value which the control inserts as default
+
const OTypeInfo* m_pType;
::rtl::OUString m_sName;
::rtl::OUString m_sTypeName;
::rtl::OUString m_sDescription;
- ::rtl::OUString m_sDefaultValue;
+
::rtl::OUString m_sAutoIncrementValue;
sal_Int32 m_nType; // only used when m_pType is null
sal_Int32 m_nPrecision;
@@ -106,7 +109,8 @@ namespace dbaui
OFieldDescription( const ::rtl::OUString& _sName,
const ::rtl::OUString& _sTypeName,
const ::rtl::OUString& _sDescription,
- const ::rtl::OUString& _sDefaultValue,
+ const ::com::sun::star::uno::Any& _aDefaultValue,
+ const ::com::sun::star::uno::Any& _aControlDefault,
const ::rtl::OUString& _sAutoIncrementValue,
const OTypeInfo* _pType,
sal_Int32 _nPrecision,
@@ -123,7 +127,8 @@ namespace dbaui
void SetName(const ::rtl::OUString& _rName) { m_sName = _rName; }
// void SetTypeName(const ::rtl::OUString& _rTypeName) { m_sTypeName = _rTypeName; }
void SetDescription(const ::rtl::OUString& _rDescription) { m_sDescription = _rDescription; }
- void SetDefaultValue(const ::rtl::OUString& _rDefaultValue) { m_sDefaultValue = _rDefaultValue; }
+ void SetDefaultValue(const ::com::sun::star::uno::Any& _rDefaultValue) { m_aDefaultValue = _rDefaultValue; }
+ void SetControlDefault(const ::com::sun::star::uno::Any& _rControlDefault) { m_aControlDefault = _rControlDefault; }
void SetAutoIncrementValue(const ::rtl::OUString& _sAutoIncValue) { m_sAutoIncrementValue = _sAutoIncValue; }
void SetType(const OTypeInfo* _pType) { m_pType = _pType; if (m_pType) m_nType = m_pType->nType; }
void SetTypeValue(sal_Int32 _nType) { m_nType = _nType; OSL_ENSURE(!m_pType,"Invalid call here!");}
@@ -136,21 +141,22 @@ namespace dbaui
void SetPrimaryKey(sal_Bool _bPKey) { m_bIsPrimaryKey = _bPKey; }
void SetCurrency(sal_Bool _bIsCurrency) { m_bIsCurrency = _bIsCurrency; }
- ::rtl::OUString GetName() const { return m_sName; }
- ::rtl::OUString GetDescription() const { return m_sDescription; }
- ::rtl::OUString GetDefaultValue() const { return m_sDefaultValue; }
- ::rtl::OUString GetAutoIncrementValue() const { return m_sAutoIncrementValue; }
- sal_Int32 GetType() const { return m_pType ? m_pType->nType : m_nType; }
- sal_Int32 GetPrecision() const { return m_nPrecision; }
- sal_Int32 GetScale() const { return m_nScale; }
- sal_Int32 GetIsNullable() const { return m_nIsNullable; }
- sal_Int32 GetFormatKey() const { return m_nFormatKey; }
- SvxCellHorJustify GetHorJustify() const { return m_eHorJustify; }
- const OTypeInfo* getTypeInfo() const { return m_pType; }
- sal_Bool IsAutoIncrement() const { return m_bIsAutoIncrement; }
- sal_Bool IsPrimaryKey() const { return m_bIsPrimaryKey; }
- sal_Bool IsCurrency() const { return m_bIsCurrency; }
- sal_Bool IsNullable() const { return m_nIsNullable == ::com::sun::star::sdbc::ColumnValue::NULLABLE; }
+ ::rtl::OUString GetName() const { return m_sName; }
+ ::rtl::OUString GetDescription() const { return m_sDescription; }
+ ::com::sun::star::uno::Any GetDefaultValue() const { return m_aDefaultValue; }
+ ::com::sun::star::uno::Any GetControlDefault() const { return m_aControlDefault; }
+ ::rtl::OUString GetAutoIncrementValue() const { return m_sAutoIncrementValue; }
+ sal_Int32 GetType() const { return m_pType ? m_pType->nType : m_nType; }
+ sal_Int32 GetPrecision() const { return m_nPrecision; }
+ sal_Int32 GetScale() const { return m_nScale; }
+ sal_Int32 GetIsNullable() const { return m_nIsNullable; }
+ sal_Int32 GetFormatKey() const { return m_nFormatKey; }
+ SvxCellHorJustify GetHorJustify() const { return m_eHorJustify; }
+ const OTypeInfo* getTypeInfo() const { return m_pType; }
+ sal_Bool IsAutoIncrement() const { return m_bIsAutoIncrement; }
+ sal_Bool IsPrimaryKey() const { return m_bIsPrimaryKey; }
+ sal_Bool IsCurrency() const { return m_bIsCurrency; }
+ sal_Bool IsNullable() const { return m_nIsNullable == ::com::sun::star::sdbc::ColumnValue::NULLABLE; }
};
}
#endif // DBAUI_FIELDDESCRIPTIONS_HXX
diff --git a/dbaccess/source/ui/inc/TableDesignControl.hxx b/dbaccess/source/ui/inc/TableDesignControl.hxx
index b75993091..3aded91a7 100644
--- a/dbaccess/source/ui/inc/TableDesignControl.hxx
+++ b/dbaccess/source/ui/inc/TableDesignControl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableDesignControl.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-08-14 07:56:01 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,8 +97,8 @@ namespace dbaui
virtual ~OTableRowView();
virtual void SetData( long nRow, USHORT nColId, const OTypeInfo* _pTypeInfo ) = 0;
- virtual void SetData( long nRow, USHORT nColId, const String& _rNewData ) = 0;
- virtual String GetData( long nRow, USHORT nColId ) = 0;
+ virtual void SetData( long nRow, USHORT nColId, const ::com::sun::star::uno::Any& _rNewData ) = 0;
+ virtual ::com::sun::star::uno::Any GetData( long nRow, USHORT nColId ) = 0;
virtual void SetControlText( long nRow, USHORT nColId, const String& rText ) = 0;
virtual String GetControlText( long nRow, USHORT nColId ) = 0;
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index d70ac99ac..356747c68 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WTypeSelect.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2002-07-26 09:34:02 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -101,7 +101,7 @@ namespace dbaui
virtual void SetModified(sal_Bool bModified);
virtual ::com::sun::star::lang::Locale GetLocale() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const;
virtual const OTypeInfo* getTypeInfo(sal_Int32 _nPos);
virtual const OTypeInfoMap* getTypeInfo() const;
virtual sal_Bool isAutoIncrementValueEnabled() const;
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index efb9cd248..e97db7929 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: UITools.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: oj $ $Date: 2002-08-26 07:50:21 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -726,14 +726,14 @@ sal_Int32 mapTextAllign(const SvxCellHorJustify& _eAlignment)
// -----------------------------------------------------------------------------
void setColumnUiProperties( const Reference< XPropertySet>& _rxColumn,const OFieldDescription* _pFieldDesc)
{
- if(_pFieldDesc->GetFormatKey() != NumberFormat::UNDEFINED && _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
+ if ( _pFieldDesc->GetFormatKey() != NumberFormat::UNDEFINED && _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY) )
_rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(_pFieldDesc->GetFormatKey()));
- if(_rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
+ if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN) )
_rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(_pFieldDesc->GetHorJustify())));
- if(_rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
+ if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT) )
_rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(_pFieldDesc->GetDescription()));
- if(_rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,makeAny(_pFieldDesc->GetDefaultValue()));
+ if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
+ _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,_pFieldDesc->GetControlDefault());
}
// -----------------------------------------------------------------------------
float ConvertFontWeight( ::FontWeight eWeight )
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 4edad3d27..7395db490 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WTypeSelect.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: oj $ $Date: 2002-08-19 07:51:09 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:18:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -176,7 +176,7 @@ void OWizTypeSelectControl::SetModified(sal_Bool bModified) {}
return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetLocale();
}
// -----------------------------------------------------------------------------
-Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter()
+Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() const
{
return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetFormatter();
}
@@ -363,7 +363,7 @@ void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr,sal_uInt1
InsertEntry(sColumnName,((OWizTypeSelect*)GetParent())->m_imgPKey,_nPos);
else if( _pFieldDescr->getTypeInfo()->bNullable )
{
- _pFieldDescr->SetDefaultValue(String());
+ _pFieldDescr->SetControlDefault(Any());
InsertEntry(sColumnName,_nPos);
}
SetEntryData(_nPos,_pFieldDescr);
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
index 293fbdc60..a9ee3196e 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FieldDescGenWin.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,6 +109,8 @@ namespace dbaui
void cut();
void copy();
void paste();
+
+ inline OTableFieldControl* getFieldControl() const { m_pFieldControl; }
};
}
#endif // DBAUI_TABLEFIELDDESCGENPAGE_HXX
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index cfaccb562..e3f1fbe8f 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FieldDescriptions.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2002-08-19 07:45:22 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -114,7 +114,8 @@ OFieldDescription::OFieldDescription( const OFieldDescription& rDescr ) :
m_sName(rDescr.m_sName)
,m_sTypeName(rDescr.m_sTypeName)
,m_sDescription(rDescr.m_sDescription)
- ,m_sDefaultValue(rDescr.m_sDefaultValue)
+ ,m_aDefaultValue(rDescr.m_aDefaultValue)
+ ,m_aControlDefault(rDescr.m_aControlDefault)
,m_sAutoIncrementValue(rDescr.m_sAutoIncrementValue)
,m_pType(rDescr.m_pType)
,m_nPrecision(rDescr.m_nPrecision)
@@ -132,7 +133,8 @@ OFieldDescription::OFieldDescription( const OFieldDescription& rDescr ) :
OFieldDescription::OFieldDescription( const ::rtl::OUString& _sName,
const ::rtl::OUString& _sTypeName,
const ::rtl::OUString& _sDescription,
- const ::rtl::OUString& _sDefaultValue,
+ const ::com::sun::star::uno::Any& _aDefaultValue,
+ const ::com::sun::star::uno::Any& _aControlDefault,
const ::rtl::OUString& _sAutoIncrementValue,
const OTypeInfo* _pType,
sal_Int32 _nPrecision,
@@ -146,7 +148,8 @@ OFieldDescription::OFieldDescription( const ::rtl::OUString& _sName,
m_sName(_sName)
,m_sTypeName(_sTypeName)
,m_sDescription(_sDescription)
-,m_sDefaultValue(_sDefaultValue)
+,m_aDefaultValue(_aDefaultValue)
+,m_aControlDefault(_aControlDefault)
,m_sAutoIncrementValue(_sAutoIncrementValue)
,m_pType(_pType)
,m_nPrecision(_nPrecision)
@@ -189,7 +192,11 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
- SetDefaultValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE)));
+ SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
+
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
+ SetControlDefault( xAffectedCol->getPropertyValue(PROPERTY_CONTROLDEFAULT) );
+
if(xPropSetInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION))
SetAutoIncrementValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_TYPE))
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 19413000e..27f075cac 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.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: oj $ $Date: 2002-08-21 06:28:00 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -133,6 +133,12 @@
#ifndef DBAUI_TOOLS_HXX
#include "UITools.hxx"
#endif
+#ifndef DBAUI_FIELDDESCRIPTIONCONTROL_HXX
+#include "FieldDescControl.hxx"
+#endif
+#ifndef DBAUI_TABLEFIELDCONTROL_HXX
+#include "TableFieldControl.hxx"
+#endif
using namespace ::dbaui;
using namespace ::comphelper;
@@ -1131,7 +1137,7 @@ void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const OTypeInfo* _
SetControlText(nRow,nColId,_pTypeInfo ? _pTypeInfo->aUIName : ::rtl::OUString());
}
//------------------------------------------------------------------------------
-void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const String& _rNewData )
+void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rNewData )
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
//////////////////////////////////////////////////////////////////////
@@ -1141,23 +1147,15 @@ void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const String& _rNe
OFieldDescription* pFieldDescr = GetFieldDescr( nRow );
if( !pFieldDescr && nColId != FIELD_TYPE)
return;
-// {
-// OTypeInfoMap::const_iterator aTypeIter = GetView()->getController()->getTypeInfo()->find(DataType::VARCHAR);
-// if(aTypeIter == GetView()->getController()->getTypeInfo()->end())
-// aTypeIter = GetView()->getController()->getTypeInfo()->begin();
-//
-// OTableRow* pRow = (*m_pRowList)[nRow];
-// pRow->SetFieldType( aTypeIter->second );
-// pFieldDescr = pRow->GetActFieldDescr();
-// }
-
+ String sValue;
//////////////////////////////////////////////////////////////////////
// Einzelne Felder setzen
switch( nColId )
{
case FIELD_NAME:
- pFieldDescr->SetName( _rNewData );
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetName( sValue );
break;
case FIELD_TYPE:
@@ -1165,20 +1163,27 @@ void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const String& _rNe
break;
case FIELD_DESCR:
- pFieldDescr->SetDescription( _rNewData );
+ pFieldDescr->SetDescription( sValue = ::comphelper::getString(_rNewData) );
break;
case FIELD_PROPERTY_DEFAULT:
- pFieldDescr->SetDefaultValue( _rNewData );
+ pFieldDescr->SetControlDefault( _rNewData );
+ sValue = GetView()->GetDescWin()->getGenPage()->getFieldControl()->getControlDefault(pFieldDescr);
break;
case FIELD_PROPERTY_REQUIRED:
- pFieldDescr->SetIsNullable( _rNewData.ToInt32() );
+ {
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetIsNullable( sValue.ToInt32() );
+ }
break;
case FIELD_PROPERTY_TEXTLEN:
case FIELD_PROPERTY_LENGTH:
- pFieldDescr->SetPrecision( _rNewData.ToInt32() );
+ {
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetPrecision( sValue.ToInt32() );
+ }
break;
case FIELD_PROPERTY_NUMTYPE:
@@ -1189,33 +1194,40 @@ void OTableEditorCtrl::SetData( long nRow, sal_uInt16 nColId, const String& _rNe
case FIELD_PROPERTY_AUTOINC:
{
String strYes(ModuleRes(STR_VALUE_YES));
- // String strNo(ModuleRes(STR_VALUE_NO));
- pFieldDescr->SetAutoIncrement(_rNewData.Equals(strYes));
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetAutoIncrement(sValue.Equals(strYes));
}
break;
case FIELD_PROPERTY_SCALE:
- pFieldDescr->SetScale(_rNewData.ToInt32());
+ {
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetScale(sValue.ToInt32());
+ }
break;
case FIELD_PROPERTY_BOOL_DEFAULT:
- pFieldDescr->SetDefaultValue(GetView()->GetDescWin()->BoolStringPersistent(_rNewData));
+ sValue = GetView()->GetDescWin()->BoolStringPersistent(::comphelper::getString(_rNewData));
+ pFieldDescr->SetControlDefault(makeAny(::rtl::OUString(sValue)));
break;
case FIELD_PROPERTY_FORMAT:
- pFieldDescr->SetFormatKey(_rNewData.ToInt32());
+ {
+ sValue = ::comphelper::getString(_rNewData);
+ pFieldDescr->SetFormatKey(sValue.ToInt32());
+ }
break;
}
- SetControlText(nRow,nColId,_rNewData);
+ SetControlText(nRow,nColId,sValue);
}
//------------------------------------------------------------------------------
-String OTableEditorCtrl::GetData( long nRow, sal_uInt16 nColId )
+Any OTableEditorCtrl::GetData( long nRow, sal_uInt16 nColId )
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
OFieldDescription* pFieldDescr = GetFieldDescr( nRow );
if( !pFieldDescr )
- return String();
+ return Any();
//////////////////////////////////////////////////////////////////////
// Aktuellen Datenzeiger umsetzen
@@ -1225,47 +1237,57 @@ String OTableEditorCtrl::GetData( long nRow, sal_uInt16 nColId )
static const String strYes(ModuleRes(STR_VALUE_YES));
static const String strNo(ModuleRes(STR_VALUE_NO));
+ ::rtl::OUString sValue;
//////////////////////////////////////////////////////////////////////
// Einzelne Felder auslesen
switch( nColId )
{
case FIELD_NAME:
- return pFieldDescr->GetName();
+ sValue = pFieldDescr->GetName();
+ break;
case FIELD_TYPE:
- return pFieldDescr->getTypeInfo()->aUIName;
+ sValue = pFieldDescr->getTypeInfo()->aUIName;
+ break;
case FIELD_DESCR:
- return pFieldDescr->GetDescription();
+ sValue = pFieldDescr->GetDescription();
+ break;
case FIELD_PROPERTY_DEFAULT:
- return pFieldDescr->GetDefaultValue();
+ return pFieldDescr->GetControlDefault();
case FIELD_PROPERTY_REQUIRED:
- return pFieldDescr->GetIsNullable() == ColumnValue::NULLABLE ? strYes : strNo;
+ sValue = pFieldDescr->GetIsNullable() == ColumnValue::NULLABLE ? strYes : strNo;
+ break;
case FIELD_PROPERTY_TEXTLEN:
case FIELD_PROPERTY_LENGTH:
- return String::CreateFromInt32(pFieldDescr->GetPrecision());
+ sValue = String::CreateFromInt32(pFieldDescr->GetPrecision());
+ break;
case FIELD_PROPERTY_NUMTYPE:
OSL_ENSURE(sal_False, "OTableEditorCtrl::GetData: invalid column!");
// return pFieldDescr->GetNumType();
case FIELD_PROPERTY_AUTOINC:
- return pFieldDescr->IsAutoIncrement() ? strYes : strNo;
+ sValue = pFieldDescr->IsAutoIncrement() ? strYes : strNo;
+ break;
case FIELD_PROPERTY_SCALE:
- return String::CreateFromInt32(pFieldDescr->GetScale());
+ sValue = String::CreateFromInt32(pFieldDescr->GetScale());
+ break;
case FIELD_PROPERTY_BOOL_DEFAULT:
- return GetView()->GetDescWin()->BoolStringUI(pFieldDescr->GetDefaultValue());
+ sValue = GetView()->GetDescWin()->BoolStringUI(::comphelper::getString(pFieldDescr->GetControlDefault()));
+ break;
case FIELD_PROPERTY_FORMAT:
- return String::CreateFromInt32(pFieldDescr->GetFormatKey());
+ sValue = String::CreateFromInt32(pFieldDescr->GetFormatKey());
+ break;
}
- return String();
+ return makeAny(sValue);
}
//------------------------------------------------------------------------------
@@ -1274,7 +1296,7 @@ String OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const
DBG_CHKTHIS(OTableEditorCtrl,NULL);
//////////////////////////////////////////////////////////////////////
// Text aus Dokumentdaten holen
- return const_cast<OTableEditorCtrl*>(this)->GetData( nRow, nColId );
+ return ::comphelper::getString(const_cast<OTableEditorCtrl*>(this)->GetData( nRow, nColId ));
}
//------------------------------------------------------------------------------
@@ -1712,7 +1734,7 @@ void OTableEditorCtrl::AdjustFieldDescription(OFieldDescription* _pFieldDesc,
if(!_bSet && _pFieldDesc->getTypeInfo()->bNullable)
{
_pFieldDesc->SetIsNullable(ColumnValue::NO_NULLS);
- _pFieldDesc->SetDefaultValue(String());
+ _pFieldDesc->SetControlDefault(Any());
}
//////////////////////////////////////////////////////////////////////
// update field description
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index 108f40004..9d8014fc3 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TEditControl.hxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: oj $ $Date: 2002-07-09 12:38:20 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -191,8 +191,8 @@ namespace dbaui
// erzwingt das Anzeigen der genannten Zeile (selbst wenn es eigentlich schon die aktuelle ist)
virtual void SetData( long nRow, USHORT nColId, const OTypeInfo* _pTypeInfo );
- virtual void SetData( long nRow, USHORT nColId, const String& _rSaveData );
- virtual String GetData( long nRow, USHORT nColId );
+ virtual void SetData( long nRow, USHORT nColId, const ::com::sun::star::uno::Any& _rSaveData );
+ virtual ::com::sun::star::uno::Any GetData( long nRow, USHORT nColId );
virtual void SetControlText( long nRow, USHORT nColId, const String& rText );
virtual String GetControlText( long nRow, USHORT nColId );
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 1486a89e9..3be3b5f36 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableController.cxx,v $
*
- * $Revision: 1.80 $
+ * $Revision: 1.81 $
*
- * last change: $Author: oj $ $Date: 2002-09-20 11:05:39 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1027,7 +1027,8 @@ void OTableController::loadData()
sal_Int32 nAlign = 0;
sal_Bool bIsAutoIncrement,bIsCurrency;
- ::rtl::OUString sName,sControlDefault,sDescription,sTypeName;
+ ::rtl::OUString sName,sDescription,sTypeName;
+ Any aControlDefault;
// get the properties from the column
xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
@@ -1043,7 +1044,7 @@ void OTableController::loadData()
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sDescription;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT)>>= sControlDefault;
+ aControlDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT);
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
xColumn->getPropertyValue(PROPERTY_FORMATKEY) >>= nFormatKey;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
@@ -1073,7 +1074,7 @@ void OTableController::loadData()
//////////////////////////////////////////////////////////////////////
// Spezielle Daten
pActFieldDescr->SetIsNullable(nNullable);
- pActFieldDescr->SetDefaultValue(sControlDefault);
+ pActFieldDescr->SetControlDefault(aControlDefault);
pActFieldDescr->SetPrecision(nPrecision);
pActFieldDescr->SetScale(nScale);
}
@@ -1299,7 +1300,8 @@ void OTableController::alterColumns()
sal_Int32 nType,nPrecision,nScale,nNullable,nFormatKey=0,nAlignment=0;
sal_Bool bAutoIncrement;
- ::rtl::OUString sDescription,sControlDefault;
+ ::rtl::OUString sDescription;
+ Any aControlDefault;
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
@@ -1310,7 +1312,7 @@ void OTableController::alterColumns()
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sDescription;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT) >>= sControlDefault;
+ aControlDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT);
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
xColumn->getPropertyValue(PROPERTY_FORMATKEY) >>= nFormatKey;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
@@ -1385,10 +1387,10 @@ void OTableController::alterColumns()
if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetDescription()));
}
- if(sControlDefault != pField->GetDefaultValue())
+ if ( aControlDefault != pField->GetControlDefault())
{
if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,makeAny(pField->GetDefaultValue()));
+ xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
}
}
else if(xColumnFactory.is() && xAlter.is() && nPos < nColumnCount)
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
index 61f7235ed..11e3f2df2 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableFieldControl.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2002-07-26 09:35:15 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,7 +99,7 @@ void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
GetCtrl()->CellModified(nRow,nColId);
}
//------------------------------------------------------------------
-OTableEditorCtrl* OTableFieldControl::GetCtrl()
+OTableEditorCtrl* OTableFieldControl::GetCtrl() const
{
OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent());
OSL_ENSURE(pDesignWin,"no view!");
@@ -167,7 +167,7 @@ void OTableFieldControl::SetModified(BOOL bModified)
return xCon->getMetaData();
}
// -----------------------------------------------------------------------------
-Reference< XNumberFormatter > OTableFieldControl::GetFormatter()
+Reference< XNumberFormatter > OTableFieldControl::GetFormatter() const
{
return GetCtrl()->GetView()->getController()->getNumberFormatter();
}
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
index f79602502..18886f915 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableFieldControl.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2002-07-26 09:35:15 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,7 +74,7 @@ namespace dbaui
//==================================================================
class OTableFieldControl : public OFieldDescControl
{
- OTableEditorCtrl* GetCtrl();
+ OTableEditorCtrl* GetCtrl() const;
protected:
virtual void ActivateAggregate( EControlType eType );
virtual void DeactivateAggregate( EControlType eType );
@@ -82,7 +82,7 @@ namespace dbaui
virtual void CellModified(long nRow, USHORT nColId );
virtual BOOL IsReadOnly();
virtual void SetModified(BOOL bModified);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const;
virtual ::com::sun::star::lang::Locale GetLocale() const;
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
index 8bcf3b8fa..2999ea510 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableFieldDescWin.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2002-07-05 13:22:55 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,6 +120,8 @@ namespace dbaui
void copy();
void paste();
+ inline OFieldDescGenWin* getGenPage() const { return m_pGenPage; }
+
};
}
#endif // DBAUI_TABLEFIELDDESCRIPTION_HXX
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index a67b7b0ff..2e3aa2e0b 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableRow.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: oj $ $Date: 2002-07-11 06:57:45 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,7 @@
#include "FieldDescriptions.hxx"
#endif
#include <algorithm>
+#include <comphelper/types.hxx>
using namespace dbaui;
using namespace ::com::sun::star::sdbc;
@@ -156,7 +157,7 @@ void OTableRow::SetFieldType( const OTypeInfo* _pType, sal_Bool _bForce )
{
// reset type depending information
m_pActFieldDescr->SetFormatKey(0);
- m_pActFieldDescr->SetDefaultValue(::rtl::OUString());
+ m_pActFieldDescr->SetControlDefault(Any());
sal_Bool bForce = _bForce || pOldType == NULL || pOldType->nType != _pType->nType;
switch(_pType->nType)
@@ -209,7 +210,18 @@ namespace dbaui
{
_rStr.WriteByteString(pFieldDesc->GetName());
_rStr.WriteByteString(pFieldDesc->GetDescription());
- _rStr.WriteByteString(pFieldDesc->GetDefaultValue());
+ double nValue = 0.0;
+ Any aValue = pFieldDesc->GetControlDefault();
+ if ( aValue >>= nValue )
+ {
+ _rStr << sal_Int32(1);
+ _rStr << nValue;
+ }
+ else
+ {
+ _rStr << sal_Int32(2);
+ _rStr.WriteByteString(::comphelper::getString(aValue));
+ }
_rStr << pFieldDesc->GetType();
@@ -240,11 +252,28 @@ namespace dbaui
_rStr.ReadByteString(sValue);
pFieldDesc->SetDescription(sValue);
- _rStr.ReadByteString(sValue);
- pFieldDesc->SetDefaultValue(sValue);
-
sal_Int32 nValue;
_rStr >> nValue;
+ Any aControlDefault;
+ switch ( nValue )
+ {
+ case 1:
+ {
+ double nControlDefault;
+ _rStr >> nControlDefault;
+ aControlDefault <<= nControlDefault;
+ break;
+ }
+ case 2:
+ _rStr.ReadByteString(sValue);
+ aControlDefault <<= ::rtl::OUString(sValue);
+ break;
+ }
+
+ pFieldDesc->SetControlDefault(aControlDefault);
+
+
+ _rStr >> nValue;
pFieldDesc->SetTypeValue(nValue);
_rStr >> nValue;
@@ -264,6 +293,8 @@ namespace dbaui
pFieldDesc->SetPrimaryKey(nValue != 0);
_rStr >> nValue;
pFieldDesc->SetCurrency(nValue != 0);
+
+
}
return _rStr;
}
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx
index 1d97baebf..a8180af59 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableUndo.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2002-08-19 07:45:25 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,12 +171,8 @@ void OTableDesignCellUndoAct::Undo()
// Wenn erstes Undo zurueckgenommen wurde, ist Zelle nicht mehr modifiziert
if (m_pTabDgnCtrl->GetCurUndoActId() == 1)
{
-#if SUPD > 636
CellControllerRef xController = m_pTabDgnCtrl->Controller();
-#else
- DbCellControllerRef xController = m_pTabDgnCtrl->Controller();
-#endif
- if(xController.Is())
+ if ( xController.Is() )
xController->ClearModified();
m_pTabDgnCtrl->GetView()->getController()->setModified(sal_False);
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx
index a9d7da67e..416abc06a 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.hxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableUndo.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-22 07:56:56 $
+ * last change: $Author: oj $ $Date: 2002-09-24 09:19:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,8 +67,11 @@
#ifndef _SV_MULTISEL_HXX
#include <tools/multisel.hxx>
#endif
-#ifndef _VECTOR_
+
#include <vector>
+
+#ifndef _COM_SUN_STAR_UNO_ANY_H_
+#include <com/sun/star/uno/Any.h>
#endif
namespace dbaui
@@ -107,8 +110,8 @@ namespace dbaui
protected:
USHORT m_nCol;
long m_nRow;
- ::rtl::OUString m_sOldText;
- ::rtl::OUString m_sNewText;
+ ::com::sun::star::uno::Any m_sOldText;
+ ::com::sun::star::uno::Any m_sNewText;
virtual void Undo();
virtual void Redo();