diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-07-02 12:22:11 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-07-02 12:22:11 +0000 |
commit | 2f4b72b96d74bef57c6dc14cbfa3e13e55d1cf5c (patch) | |
tree | 80d1eae4e8bc4eb7c21b306c9ba3ed08457746c2 /dbaccess/source/ui | |
parent | 9b2cd1d9ab27a02ea04344d916686f40a75a0443 (diff) |
#88476# save name of object before recursive call
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/browser/dsbrowserDnD.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/DExport.hxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/HtmlReader.hxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/RtfReader.hxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WColumnSelect.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WCopyTable.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WExtendPages.hxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WTypeSelect.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/DExport.cxx | 111 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/HtmlReader.cxx | 18 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/RtfReader.cxx | 18 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCPage.cxx | 85 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WColumnSelect.cxx | 54 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 48 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WExtendPages.cxx | 49 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WTypeSelect.cxx | 76 |
16 files changed, 304 insertions, 255 deletions
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx index 74008082e..64dec32f3 100644 --- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx +++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2001-06-22 10:53:59 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -449,7 +449,7 @@ namespace dbaui if (aWizard.Execute()) { Reference<XPropertySet> xTable; - switch(aWizard.GetCreateStyle()) + switch(aWizard.getCreateStyle()) { case OCopyTableWizard::WIZARD_DEF: case OCopyTableWizard::WIZARD_DEF_DATA: @@ -457,7 +457,7 @@ namespace dbaui xTable = aWizard.createTable(); if(!xTable.is()) break; - if(OCopyTableWizard::WIZARD_DEF == aWizard.GetCreateStyle()) + if(OCopyTableWizard::WIZARD_DEF == aWizard.getCreateStyle()) break; } case OCopyTableWizard::WIZARD_APPEND_DATA: @@ -916,6 +916,9 @@ namespace dbaui /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.16 2001/06/22 10:53:59 oj + * #88455# serveral fixes for parameters + * * Revision 1.15 2001/06/12 13:19:24 fs * #65293# linux ambiguity * diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx index 64ca69561..9e7d3b074 100644 --- a/dbaccess/source/ui/inc/DExport.hxx +++ b/dbaccess/source/ui/inc/DExport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DExport.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:02:06 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -161,14 +161,18 @@ namespace dbaui public: ODatabaseExport(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); // wird f"ur auto. Typ-Erkennung gebraucht ODatabaseExport(sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); - virtual void SetColumnTypes(const TColumnVector* rList,const OTypeInfoMap* _pInfoMap); + void SetColumnTypes(const TColumnVector* rList,const OTypeInfoMap* _pInfoMap); String ShortenFieldName( const String& rName, xub_StrLen nNewLength, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& rDestList ); }; } diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx index 341f5722d..b5fb872ef 100644 --- a/dbaccess/source/ui/inc/HtmlReader.hxx +++ b/dbaccess/source/ui/inc/HtmlReader.hxx @@ -2,9 +2,9 @@ * * $RCSfile: HtmlReader.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:02:06 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,18 +104,20 @@ namespace dbaui OHTMLReader(SvStream& rIn, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); // wird f"ur auto. Typ-Erkennung gebraucht OHTMLReader(SvStream& rIn, sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); virtual SvParserState CallParser();// Basisklasse // birgt nur korrekte Daten, wenn der 2. CTOR benutzt wurde - // ansonsten wird die SbaColumnList ohne "Anderung zur"uckgegeben - // virtual void SetColumnTypes(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& rList); }; SV_DECL_IMPL_REF( OHTMLReader ); diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx index 8c7334c64..059ead75b 100644 --- a/dbaccess/source/ui/inc/RtfReader.hxx +++ b/dbaccess/source/ui/inc/RtfReader.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RtfReader.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:02:06 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,13 +90,17 @@ namespace dbaui ORTFReader( SvStream& rIn, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); // wird f"ur auto. Typ-Erkennung gebraucht ORTFReader( SvStream& rIn, sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* rList = 0, + const OTypeInfoMap* _pInfoMap = 0); virtual SvParserState CallParser();// Basisklasse // birgt nur korrekte Daten, wenn der 2. CTOR benutzt wurde diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx index 6656181c0..3e6b0a2a7 100644 --- a/dbaccess/source/ui/inc/WColumnSelect.hxx +++ b/dbaccess/source/ui/inc/WColumnSelect.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WColumnSelect.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:21:14 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ namespace dbaui DECL_LINK( ListDoubleClickHdl, MultiListBox * ); + void clearListBox(MultiListBox& _rListBox); public: virtual void Reset ( ); virtual void ActivatePage(); diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index efc66c7b1..37077df2f 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WCopyTable.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-07-02 10:31:49 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -216,7 +216,6 @@ namespace dbaui void AddWizardPage(OWizardPage* pPage); // Page wird von OCopyTableWizard gelöscht void RemoveWizardPage(OWizardPage* pPage); // Page goes again to user void CheckButtons(); // checks which button can be disabled, enabled - Wizard_Create_Style GetCreateStyle() const { return m_eCreateStyle; } // returns a vector where the position of a column and if the column is in the selection // when not the value is CONTAINER_ENTRY_NOTFOUND == (sal_uInt32)-1 ::std::vector<sal_Int32> GetColumnPositions() const { return m_vColumnPos; } @@ -245,6 +244,12 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createTable(); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createView(); + // return true when the conenction supports primary keys + sal_Bool supportsPrimaryKey() const; + sal_Int32 getMaxColumnNameLength() const; + + void setCreateStyle(const Wizard_Create_Style& _eStyle); + Wizard_Create_Style getCreateStyle() const; }; } diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx index 784a4fc57..3a4756ca8 100644 --- a/dbaccess/source/ui/inc/WExtendPages.hxx +++ b/dbaccess/source/ui/inc/WExtendPages.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WExtendPages.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-23 14:59:14 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,14 +73,14 @@ namespace dbaui // ======================================================== class OWizHTMLExtend : public OWizTypeSelect { - SvStream* m_pParserStream; // HTML Stream protected: - virtual void fillColumnList(sal_uInt32 nRows); + virtual SvParser* createReader(sal_Int32 _nRows); public: OWizHTMLExtend(Window* pParent,SvStream& rRtfStream) : OWizTypeSelect( pParent) - ,m_pParserStream(&rRtfStream) - {} + { + m_pParserStream = &rRtfStream; + } virtual ~OWizHTMLExtend(){} }; @@ -89,14 +89,14 @@ namespace dbaui // ======================================================== class OWizRTFExtend : public OWizTypeSelect { - SvStream* m_pParserStream; // RTF Stream protected: - virtual void fillColumnList(sal_uInt32 nRows); + virtual SvParser* createReader(sal_Int32 _nRows); public: OWizRTFExtend(Window* pParent,SvStream& rRtfStream) : OWizTypeSelect( pParent) - ,m_pParserStream(&rRtfStream) - {} + { + m_pParserStream = &rRtfStream; + } virtual ~OWizRTFExtend(){} }; @@ -107,7 +107,7 @@ namespace dbaui class OWizNormalExtend : public OWizTypeSelect { protected: - virtual void fillColumnList(sal_uInt32 nRows) { } + virtual SvParser* createReader(sal_Int32 _nRows); public: OWizNormalExtend(Window* pParent); }; diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx index beb6e68ca..0512546b0 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:21:14 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:22:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,8 @@ #include <vcl/button.hxx> #endif +class SvStream; +class SvParser; namespace dbaui { class OTableDesignHelpBar; @@ -152,8 +154,11 @@ namespace dbaui PushButton m_pbAuto; Image m_imgPKey; + SvStream* m_pParserStream; // stream to read the tokens from or NULL + + void fillColumnList(sal_uInt32 nRows); + virtual SvParser* createReader(sal_Int32 _nRows) = 0; - virtual void fillColumnList(sal_uInt32 nRows) = 0; void EnableAuto(sal_Bool bEnable); public: virtual void Reset ( ); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 9bb18b3fe..9d1003fe6 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DExport.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fs $ $Date: 2001-03-15 09:09:46 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -152,7 +152,9 @@ using namespace ::com::sun::star::lang; ODatabaseExport::ODatabaseExport(sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const Reference< XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) :m_nColumnPos(0) ,m_nRows(1) ,m_nRowCount(0) @@ -194,11 +196,14 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, { } + SetColumnTypes(pList,_pInfoMap); } //--------------------------------------------------------------------------- ODatabaseExport::ODatabaseExport(const Reference< XConnection >& _rxConnection, const Reference< XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) :m_xConnection(_rxConnection) ,m_nColumnPos(0) ,m_nRows(1) @@ -256,6 +261,7 @@ ODatabaseExport::ODatabaseExport(const Reference< XConnection >& _rxConnection, } } } + SetColumnTypes(pList,_pInfoMap); } //--------------------------------------------------------------------------- ODatabaseExport::~ODatabaseExport() @@ -480,56 +486,59 @@ sal_Int32 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int32 _nOl // ----------------------------------------------------------------------------- void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfoMap* _pInfoMap) { - TColumnVector::const_iterator aIter = _pList->begin(); - for(sal_Int32 i=0;aIter != _pList->end();++aIter,++i) + if(_pList && _pInfoMap) { - sal_Int32 nDataType; - sal_Int32 nLength(0),nScale(0); - switch(m_vFormatKey[i]) + TColumnVector::const_iterator aIter = _pList->begin(); + for(sal_Int32 i=0;aIter != _pList->end();++aIter,++i) { - case NumberFormat::ALL: - nDataType = DataType::DOUBLE; - break; - case NumberFormat::DEFINED: - nDataType = DataType::VARCHAR; - nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10; - break; - case NumberFormat::DATE: - nDataType = DataType::DATE; - break; - case NumberFormat::TIME: - nDataType = DataType::TIME; - break; - case NumberFormat::DATETIME: - nDataType = DataType::TIMESTAMP; - break; - case NumberFormat::CURRENCY: - nDataType = DataType::NUMERIC; - nScale = 4; - nLength = 19; - break; - case NumberFormat::NUMBER: - case NumberFormat::SCIENTIFIC: - case NumberFormat::FRACTION: - case NumberFormat::PERCENT: - nDataType = DataType::DOUBLE; - break; - case NumberFormat::TEXT: - case NumberFormat::UNDEFINED: - case NumberFormat::LOGICAL: - default: - nDataType = DataType::VARCHAR; - nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10; - break; - } - OTypeInfoMap::const_iterator aFind = _pInfoMap->find(nDataType); - if(aFind != _pInfoMap->end()) - { - (*aIter)->second->SetType(aFind->second); - (*aIter)->second->SetPrecision(::std::min<sal_Int32>(aFind->second->nPrecision,nLength)); - (*aIter)->second->SetScale(::std::min<sal_Int32>(aFind->second->nMaximumScale,nScale)); + sal_Int32 nDataType; + sal_Int32 nLength(0),nScale(0); + switch(m_vFormatKey[i]) + { + case NumberFormat::ALL: + nDataType = DataType::DOUBLE; + break; + case NumberFormat::DEFINED: + nDataType = DataType::VARCHAR; + nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10; + break; + case NumberFormat::DATE: + nDataType = DataType::DATE; + break; + case NumberFormat::TIME: + nDataType = DataType::TIME; + break; + case NumberFormat::DATETIME: + nDataType = DataType::TIMESTAMP; + break; + case NumberFormat::CURRENCY: + nDataType = DataType::NUMERIC; + nScale = 4; + nLength = 19; + break; + case NumberFormat::NUMBER: + case NumberFormat::SCIENTIFIC: + case NumberFormat::FRACTION: + case NumberFormat::PERCENT: + nDataType = DataType::DOUBLE; + break; + case NumberFormat::TEXT: + case NumberFormat::UNDEFINED: + case NumberFormat::LOGICAL: + default: + nDataType = DataType::VARCHAR; + nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10; + break; + } + OTypeInfoMap::const_iterator aFind = _pInfoMap->find(nDataType); + if(aFind != _pInfoMap->end()) + { + (*aIter)->second->SetType(aFind->second); + (*aIter)->second->SetPrecision(::std::min<sal_Int32>(aFind->second->nPrecision,nLength)); + (*aIter)->second->SetScale(::std::min<sal_Int32>(aFind->second->nMaximumScale,nScale)); + } + (*aIter)->second->SetFormatKey(m_vFormatKey[i]); } - (*aIter)->second->SetFormatKey(m_vFormatKey[i]); } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 0dedfb25e..8543a44a3 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -2,9 +2,9 @@ * * $RCSfile: HtmlReader.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-11 10:27:05 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -214,9 +214,11 @@ DBG_NAME(OHTMLReader); // ========================================================================== OHTMLReader::OHTMLReader(SvStream& rIn,const Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) : HTMLParser(rIn) - ,ODatabaseExport(_rxConnection,_rxNumberF,_rM) + ,ODatabaseExport(_rxConnection,_rxNumberF,_rM,pList,_pInfoMap) ,m_nTableCount(0) ,m_nColumnWidth(87) ,m_bMetaOptions(sal_False) @@ -234,9 +236,11 @@ OHTMLReader::OHTMLReader(SvStream& rIn, sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) : HTMLParser(rIn) - ,ODatabaseExport(nRows,_rColumnPositions,_rxNumberF,_rM) + ,ODatabaseExport(nRows,_rColumnPositions,_rxNumberF,_rM,pList,_pInfoMap) ,m_nTableCount(0) ,m_nColumnWidth(87) ,m_bMetaOptions(sal_False) @@ -663,7 +667,7 @@ sal_Bool OHTMLReader::CreateTable(int nToken) if (aWizard.Execute()) { - switch(aWizard.GetCreateStyle()) + switch(aWizard.getCreateStyle()) { case OCopyTableWizard::WIZARD_DEF_DATA: case OCopyTableWizard::WIZARD_APPEND_DATA: diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 811c92831..35937e8a7 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RtfReader.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-03-15 08:23:44 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -166,9 +166,11 @@ DBG_NAME(ORTFReader); ORTFReader::ORTFReader( SvStream& rIn, const Reference< XConnection >& _rxConnection, const Reference< XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) : SvRTFParser(rIn) - ,ODatabaseExport(_rxConnection,_rxNumberF,_rM) + ,ODatabaseExport(_rxConnection,_rxNumberF,_rM,pList,_pInfoMap) { DBG_CTOR(ORTFReader,NULL); } @@ -177,9 +179,11 @@ ORTFReader::ORTFReader(SvStream& rIn, sal_Int32 nRows, const ::std::vector<sal_Int32> &_rColumnPositions, const Reference< XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM) + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const TColumnVector* pList, + const OTypeInfoMap* _pInfoMap) :SvRTFParser(rIn) - ,ODatabaseExport(nRows,_rColumnPositions,_rxNumberF,_rM) + ,ODatabaseExport(nRows,_rColumnPositions,_rxNumberF,_rM,pList,_pInfoMap) { DBG_CTOR(ORTFReader,NULL); } @@ -439,7 +443,7 @@ sal_Bool ORTFReader::CreateTable(int nToken) if (aWizard.Execute()) { - switch(aWizard.GetCreateStyle()) + switch(aWizard.getCreateStyle()) { case OCopyTableWizard::WIZARD_DEF_DATA: case OCopyTableWizard::WIZARD_APPEND_DATA: diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index f3ef7cddd..9c95fa967 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WCPage.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-07-02 10:31:49 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,11 +86,21 @@ #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XViewsSupplier.hpp> +#endif #ifndef _SV_MSGBOX_HXX #include <vcl/msgbox.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif +#ifndef DBAUI_TOOLS_HXX +#include "UITools.hxx" +#endif using namespace ::dbaui; +using namespace ::dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; @@ -122,38 +132,45 @@ OCopyTable::OCopyTable( Window * pParent, EImportMode atWhat, sal_Bool bIsQuery, if(m_pParent->m_xConnection.is()) { + // first we have to determine if we support views Reference< XDatabaseMetaData > xMetaData(m_pParent->m_xConnection->getMetaData()); - try + Reference< XViewsSupplier > xViewSups(m_pParent->m_xConnection,UNO_QUERY); + if(!(m_bIsViewAllowed = xViewSups.is())) { - static ::rtl::OUString sVIEW = ::rtl::OUString::createFromAscii("VIEW"); - Reference<XResultSet> xRs = xMetaData->getTableTypes(); - if(xRs.is()) + try { - Reference<XRow> xRow(xRs,UNO_QUERY); - while(xRs->next()) + static ::rtl::OUString sVIEW = ::rtl::OUString::createFromAscii("VIEW"); + Reference<XResultSet> xRs = xMetaData->getTableTypes(); + if(xRs.is()) { - ::rtl::OUString sValue = xRow->getString(1); - if(!xRow->wasNull() && sValue.equalsIgnoreAsciiCase(sVIEW)) + Reference<XRow> xRow(xRs,UNO_QUERY); + while(xRs->next()) { - m_bIsViewAllowed = m_bIsViewAllowed || sal_True; - break; + ::rtl::OUString sValue = xRow->getString(1); + if(!xRow->wasNull() && sValue.equalsIgnoreAsciiCase(sVIEW)) + { + m_bIsViewAllowed = m_bIsViewAllowed || sal_True; + break; + } } } } - } - catch(SQLException&) - { + catch(const SQLException& e) + { + ::dbaui::showError(SQLExceptionInfo(e),pParent,m_pParent->m_xFactory); + } } if(!m_bIsViewAllowed) m_aRB_View.Disable(); ////////////////////////////////////////////////////////////////////// - // Wenn Datenbank PrimaryKeys verarbeiten kann, PrimaryKey anlegen + // do we support pkeys m_bPKeyAllowed = xMetaData->supportsCoreSQLGrammar(); m_aCB_PrimaryColumn.Enable(m_bPKeyAllowed); + // reselect the last action before switch(nLastAction) { case OCopyTableWizard::WIZARD_DEF_DATA: @@ -186,7 +203,7 @@ OCopyTable::OCopyTable( Window * pParent, EImportMode atWhat, sal_Bool bIsQuery, m_aFT_KeyName.Enable(sal_False); m_edKeyName.Enable(sal_False); m_edKeyName.SetText(String::CreateFromAscii("ID")); - sal_Int32 nMaxLen = xMetaData->getMaxColumnNameLength(); + sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength(); m_edKeyName.SetMaxTextLen(nMaxLen ? (xub_StrLen)nMaxLen : EDIT_NOLIMIT); } @@ -210,12 +227,12 @@ OCopyTable::~OCopyTable() //------------------------------------------------------------------------ IMPL_LINK( OCopyTable, AppendDataClickHdl, Button*, pButton ) { - sal_Bool bChecked = m_aRB_AppendData.IsChecked(); m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,sal_True); m_aFT_KeyName.Enable(sal_False); m_aCB_PrimaryColumn.Enable(sal_False); m_edKeyName.Enable(sal_False); - m_pParent->m_eCreateStyle = OCopyTableWizard::WIZARD_APPEND_DATA; + m_pParent->setCreateStyle(OCopyTableWizard::WIZARD_APPEND_DATA); + return 0; } //------------------------------------------------------------------------ @@ -229,11 +246,11 @@ IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton ) // set typ what to do if( IsOptionDefData() ) - m_pParent->m_eCreateStyle = OCopyTableWizard::WIZARD_DEF_DATA; + m_pParent->setCreateStyle(OCopyTableWizard::WIZARD_DEF_DATA); else if( IsOptionDef() ) - m_pParent->m_eCreateStyle = OCopyTableWizard::WIZARD_DEF; + m_pParent->setCreateStyle(OCopyTableWizard::WIZARD_DEF); else if( IsOptionView() ) - m_pParent->m_eCreateStyle = OCopyTableWizard::WIZARD_DEF_VIEW; + m_pParent->setCreateStyle(OCopyTableWizard::WIZARD_DEF_VIEW); return 0; } @@ -251,7 +268,7 @@ sal_Bool OCopyTable::LeavePage() m_pParent->m_aKeyName = m_edKeyName.GetText(); // a table that comes from a html or rtf import already has a name that is valid in the db - if( m_pParent->m_eCreateStyle != OCopyTableWizard::WIZARD_APPEND_DATA ) + if( m_pParent->getCreateStyle() != OCopyTableWizard::WIZARD_APPEND_DATA ) { Reference<XTablesSupplier > xSup(m_pParent->m_xConnection,UNO_QUERY); Reference<XNameAccess> xTables; @@ -269,7 +286,7 @@ sal_Bool OCopyTable::LeavePage() if(!m_edTableName.GetSavedValue().Equals(m_edTableName.GetText())) { // table exist and name has changed - if(m_pParent->m_eCreateStyle == OCopyTableWizard::WIZARD_APPEND_DATA) + if(m_pParent->getCreateStyle() == OCopyTableWizard::WIZARD_APPEND_DATA) { m_pParent->clearDestColumns(); m_pParent->m_xSourceObject = NULL; @@ -290,14 +307,14 @@ sal_Bool OCopyTable::LeavePage() } else if(m_eOldStyle == OCopyTableWizard::WIZARD_APPEND_DATA) { - OSL_ENSURE(sal_False, "OCopyTable::LeavePage: how this?"); m_pParent->m_xSourceObject = NULL; + m_edTableName.SaveValue(); return LeavePage(); } } else { // table exist and is not new or doesn't exist and so on - switch(m_pParent->m_eCreateStyle) + switch(m_pParent->getCreateStyle()) { case OCopyTableWizard::WIZARD_APPEND_DATA: { @@ -344,18 +361,14 @@ sal_Bool OCopyTable::LeavePage() //------------------------------------------------------------------------ void OCopyTable::ActivatePage() { - m_eOldStyle = m_pParent->m_eCreateStyle; + m_eOldStyle = m_pParent->getCreateStyle(); ////////////////////////////////////////////////////////////////////////// - // Ist der Name zu lang? - sal_Int32 nLen = m_pParent->m_xConnection->getMetaData()->getMaxTableNameLength(); + // set max name length + sal_Int32 nLen = 0; + if(m_pParent->m_xConnection.is()) + nLen = m_pParent->m_xConnection->getMetaData()->getMaxTableNameLength(); m_edTableName.SetMaxTextLen(nLen ? (xub_StrLen)nLen : EDIT_NOLIMIT); - //m_pParent->EnableButton(OCopyTableWizard::WIZARD_FINISH,FALSE); - - // if (m_pParent->m_xSourceDef.Is() && (m_pParent->m_xSourceDef->GetDatabase() == m_pParent->m_xDatabase)) - // copying within the same database -> assume that the name should be modified at first - m_edTableName.GrabFocus(); - // else - // m_pParent->GetOKButton().GrabFocus(); + m_edTableName.GrabFocus(); } //------------------------------------------------------------------------ String OCopyTable::GetTitle() const { return String(ModuleRes(STR_WIZ_TABLE_COPY)); } diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index 1352c5091..e46f83006 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WColumnSelect.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:26:43 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -159,13 +159,8 @@ void OWizColumnSelect::Reset() // urspr"unglichen zustand wiederherstellen DBG_CHKTHIS(OWizColumnSelect,NULL); - while(m_lbOrgColumnNames.GetEntryCount()) - m_lbOrgColumnNames.RemoveEntry(0); - m_lbOrgColumnNames.Clear(); - - while(m_lbNewColumnNames.GetEntryCount()) - m_lbNewColumnNames.RemoveEntry(0); - m_lbNewColumnNames.Clear(); + clearListBox(m_lbOrgColumnNames); + clearListBox(m_lbNewColumnNames); // insert the source columns in the left listbox const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector(); @@ -192,14 +187,7 @@ void OWizColumnSelect::ActivatePage( ) if(m_pParent->getDestColumns()->size() == 0) Reset(); - while(m_lbNewColumnNames.GetEntryCount()) - m_lbNewColumnNames.RemoveEntry(0); - m_lbNewColumnNames.Clear(); - - ////////////////////////////////////////////////////////////////////// - // Wenn Datenbank PrimaryKeys verarbeiten kann, PrimaryKey anlegen - Reference< XDatabaseMetaData > xMetaData(m_pParent->m_xConnection->getMetaData()); - sal_Bool bPKeyAllowed = xMetaData->supportsCoreSQLGrammar(); + clearListBox(m_lbNewColumnNames); const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); @@ -211,7 +199,7 @@ void OWizColumnSelect::ActivatePage( ) m_lbOrgColumnNames.RemoveEntry((*aIter)->first); } m_pParent->GetOKButton().Enable(m_lbNewColumnNames.GetEntryCount() != 0); - m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->m_eCreateStyle != OCopyTableWizard::WIZARD_APPEND_DATA); + m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->getCreateStyle() != OCopyTableWizard::WIZARD_APPEND_DATA); m_ibColumns_RH.GrabFocus(); } // ----------------------------------------------------------------------- @@ -220,6 +208,7 @@ sal_Bool OWizColumnSelect::LeavePage() DBG_CHKTHIS(OWizColumnSelect,NULL); // m_pParent->getColumns()->clear(); + m_pParent->clearDestColumns(); for(sal_uInt16 i=0 ; i< m_lbNewColumnNames.GetEntryCount();++i) { @@ -228,6 +217,7 @@ sal_Bool OWizColumnSelect::LeavePage() m_pParent->insertColumn(i,pField); } + if(m_pParent->WasButtonPressed() == OCopyTableWizard::WIZARD_NEXT || m_pParent->WasButtonPressed() == OCopyTableWizard::WIZARD_FINISH) return m_pParent->getDestColumns()->size(); else @@ -261,12 +251,7 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton ) bAll = sal_True; } - ////////////////////////////////////////////////////////////////////// - // Wenn Datenbank PrimaryKeys verarbeiten kann, PrimaryKey anlegen - Reference< XDatabaseMetaData > xMetaData(m_pParent->m_xConnection->getMetaData()); - - sal_Bool bPKeyAllowed = xMetaData->supportsCoreSQLGrammar(); - sal_Int32 nLen = xMetaData->getMaxColumnNameLength(); + sal_Int32 nLen = m_pParent->getMaxColumnNameLength(); // DlgFieldMatch dlgMissingFields(GetpApp()->GetDefDialogParent()); // ListBox* pInfoBox = dlgMissingFields.GetInfoBox(); @@ -281,8 +266,6 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton ) if(pRight == &m_lbNewColumnNames) { OFieldDescription* pSrcField = static_cast<OFieldDescription*>(pLeft->GetEntryData(pLeft->GetEntryPos(aColumnName))); -// if(!bPKeyAllowed) -// pColumn->Put(SfxBoolItem(SBA_DEF_FLTPRIMARY, sal_False)); if(nLen && nLen < aColumnName.Len()) { String aNewName( aColumnName.Copy( 0, (xub_StrLen)nLen )); @@ -334,8 +317,6 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton ) if(pRight == &m_lbNewColumnNames) { OFieldDescription* pSrcField = static_cast<OFieldDescription*>(pLeft->GetEntryData(i-1)); -// if(!bPKeyAllowed) -// pColumn->Put(SfxBoolItem(SBA_DEF_FLTPRIMARY, sal_False)); if(nLen && nLen < aColumnName.Len()) { String aNewName( aColumnName.Copy( 0, (xub_StrLen)nLen )); @@ -384,7 +365,7 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton ) // dlgMissingFields.Execute(); m_pParent->GetOKButton().Enable(m_lbNewColumnNames.GetEntryCount() != 0); - m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->m_eCreateStyle != OCopyTableWizard::WIZARD_APPEND_DATA); + m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->getCreateStyle() != OCopyTableWizard::WIZARD_APPEND_DATA); if(m_lbOrgColumnNames.GetEntryCount()) m_lbOrgColumnNames.SelectEntryPos(0); @@ -408,9 +389,7 @@ IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, MultiListBox *, pListBox ) ////////////////////////////////////////////////////////////////////// // Wenn Datenbank PrimaryKeys verarbeiten kann, PrimaryKey anlegen - Reference< XDatabaseMetaData > xMetaData(m_pParent->m_xConnection->getMetaData()); - sal_Bool bPKeyAllowed = xMetaData->supportsCoreSQLGrammar(); - sal_Int32 nLen = xMetaData->getMaxColumnNameLength(); + sal_Int32 nLen = m_pParent->getMaxColumnNameLength(); String aColumnName; for(sal_uInt16 i=0; i < pLeft->GetSelectEntryCount(); ++i) @@ -421,8 +400,6 @@ IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, MultiListBox *, pListBox ) if(pRight == &m_lbNewColumnNames) { OFieldDescription* pSrcField = static_cast<OFieldDescription*>(pLeft->GetEntryData(pLeft->GetEntryPos(aColumnName))); -// if(!bPKeyAllowed) -// pColumn->Put(SfxBoolItem(SBA_DEF_FLTPRIMARY, sal_False)); if(nLen && nLen < aColumnName.Len()) { String aNewName( aColumnName.Copy( 0, (xub_StrLen)nLen )); @@ -467,10 +444,17 @@ IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, MultiListBox *, pListBox ) pLeft->RemoveEntry(pLeft->GetSelectEntry(j-1)); m_pParent->GetOKButton().Enable(m_lbNewColumnNames.GetEntryCount() != 0); - m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->m_eCreateStyle != OCopyTableWizard::WIZARD_APPEND_DATA); + m_pParent->EnableButton(OCopyTableWizard::WIZARD_NEXT,m_lbNewColumnNames.GetEntryCount() && m_pParent->getCreateStyle() != OCopyTableWizard::WIZARD_APPEND_DATA); return 0; } // ----------------------------------------------------------------------------- +void OWizColumnSelect::clearListBox(MultiListBox& _rListBox) +{ + while(_rListBox.GetEntryCount()) + _rListBox.RemoveEntry(0); + _rListBox.Clear(); +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index d71f76829..3c8f90cf1 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WCopyTable.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-07-02 10:31:49 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -271,7 +271,7 @@ IMPL_LINK( OCopyTableWizard, ImplPrevHdl, PushButton*, EMPTYARG ) m_ePressed = WIZARD_PREV; if ( GetCurLevel() ) { - if(m_eCreateStyle != WIZARD_APPEND_DATA) + if(getCreateStyle() != WIZARD_APPEND_DATA) { if(GetCurLevel() == 2) ShowPage(GetCurLevel()-2); @@ -291,7 +291,7 @@ IMPL_LINK( OCopyTableWizard, ImplNextHdl, PushButton*, EMPTYARG ) m_ePressed = WIZARD_NEXT; if ( GetCurLevel() < MAX_PAGES ) { - if(m_eCreateStyle != WIZARD_APPEND_DATA) + if(getCreateStyle() != WIZARD_APPEND_DATA) { if(GetCurLevel() == 0) ShowPage(GetCurLevel()+2); @@ -342,7 +342,7 @@ void OCopyTableWizard::CheckColumns() // DlgFieldMatch dlgMissingFields(this); // ListBox* pInfoBox = dlgMissingFields.GetInfoBox(); ::rtl::OUString aColumnName,aOldColName; - sal_Int32 nMaxNameLen = xMetaData->getMaxColumnNameLength(); + sal_Int32 nMaxNameLen = getMaxColumnNameLength(); ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin(); for(;aSrcIter != m_vSourceVec.end();++aSrcIter) { @@ -389,10 +389,10 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG ) if(bFinish) { sal_Bool bWasEmpty = !m_vDestColumns.size(); - if(m_eCreateStyle != WIZARD_DEF_VIEW && m_eCreateStyle != WIZARD_APPEND_DATA ) + if(getCreateStyle() != WIZARD_DEF_VIEW && getCreateStyle() != WIZARD_APPEND_DATA ) CheckColumns(); - switch(m_eCreateStyle) + switch(getCreateStyle()) { case WIZARD_APPEND_DATA: { @@ -829,5 +829,35 @@ Reference< XPropertySet > OCopyTableWizard::createTable() return m_xDestObject; } // ----------------------------------------------------------------------------- - - +sal_Bool OCopyTableWizard::supportsPrimaryKey() const +{ + sal_Bool bAllowed = sal_False; + if(m_xConnection.is()) + { + Reference< XDatabaseMetaData > xMetaData(m_xConnection->getMetaData()); + bAllowed = xMetaData.is() && xMetaData->supportsCoreSQLGrammar(); + } + return bAllowed; +} +// ----------------------------------------------------------------------------- +sal_Int32 OCopyTableWizard::getMaxColumnNameLength() const +{ + sal_Int32 nLen = 0; + if(m_xConnection.is()) + { + Reference< XDatabaseMetaData > xMetaData(m_xConnection->getMetaData()); + nLen = xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0; + } + return nLen; +} +// ----------------------------------------------------------------------------- +void OCopyTableWizard::setCreateStyle(const OCopyTableWizard::Wizard_Create_Style& _eStyle) +{ + m_eCreateStyle = _eStyle; +} +// ----------------------------------------------------------------------------- +OCopyTableWizard::Wizard_Create_Style OCopyTableWizard::getCreateStyle() const +{ + return m_eCreateStyle; +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx index c29fbfef3..493b74b77 100644 --- a/dbaccess/source/ui/misc/WExtendPages.cxx +++ b/dbaccess/source/ui/misc/WExtendPages.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WExtendPages.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:26:43 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,34 +73,26 @@ using namespace dbaui; //======================================================================== -void OWizHTMLExtend::fillColumnList(sal_uInt32 nRows) +SvParser* OWizHTMLExtend::createReader(sal_Int32 _nRows) { - sal_uInt32 nTell = m_pParserStream->Tell(); // verändert vielleicht die Position des Streams - OHTMLReader *pReader = new OHTMLReader(*m_pParserStream, - nRows, - m_pParent->GetColumnPositions(), - m_pParent->GetFormatter(), - m_pParent->GetFactory()); - pReader->AddRef(); - pReader->CallParser(); - pReader->SetColumnTypes(m_pParent->getDestVector(),m_pParent->getTypeInfo()); - pReader->ReleaseRef(); - m_pParserStream->Seek(nTell); + return new OHTMLReader(*m_pParserStream, + _nRows, + m_pParent->GetColumnPositions(), + m_pParent->GetFormatter(), + m_pParent->GetFactory(), + m_pParent->getDestVector(), + m_pParent->getTypeInfo()); } //======================================================================== -void OWizRTFExtend::fillColumnList(sal_uInt32 nRows) +SvParser* OWizRTFExtend::createReader(sal_Int32 _nRows) { - sal_uInt32 nTell = m_pParserStream->Tell(); // verändert vielleicht die Position des Streams - ORTFReader *pReader = new ORTFReader(*m_pParserStream, - nRows, - m_pParent->GetColumnPositions(), - m_pParent->GetFormatter(), - m_pParent->GetFactory()); - pReader->AddRef(); - pReader->CallParser(); - pReader->SetColumnTypes(m_pParent->getDestVector(),m_pParent->getTypeInfo()); - pReader->ReleaseRef(); - m_pParserStream->Seek(nTell); + return new ORTFReader(*m_pParserStream, + _nRows, + m_pParent->GetColumnPositions(), + m_pParent->GetFormatter(), + m_pParent->GetFactory(), + m_pParent->getDestVector(), + m_pParent->getTypeInfo()); } //======================================================================== OWizNormalExtend::OWizNormalExtend(Window* pParent) : OWizTypeSelect( pParent) @@ -119,6 +111,11 @@ OWizNormalExtend::OWizNormalExtend(Window* pParent) : OWizTypeSelect( pParent) m_aTypeControl.SetPosSizePixel(aPos,aNewSize); } // ----------------------------------------------------------------------------- +SvParser* OWizNormalExtend::createReader(sal_Int32 _nRows) +{ + return NULL; +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 24b67722e..39aa55abb 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:26:43 $ + * last change: $Author: oj $ $Date: 2001-07-02 13:21:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,12 @@ #ifndef _DBU_RESOURCE_HRC_ #include "dbu_resource.hrc" #endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif +#ifndef _SVPARSER_HXX +#include <svtools/svparser.hxx> +#endif using namespace ::dbaui; using namespace ::com::sun::star::uno; @@ -165,22 +171,22 @@ void OWizTypeSelectControl::SetModified(sal_Bool bModified) {} // ----------------------------------------------------------------------------- ::com::sun::star::lang::Locale OWizTypeSelectControl::GetLocale() const { - return ((OWizTypeSelect*)GetParent())->m_pParent->GetLocale(); + return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetLocale(); } // ----------------------------------------------------------------------------- Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() { - return ((OWizTypeSelect*)GetParent())->m_pParent->GetFormatter(); + return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->GetFormatter(); } // ----------------------------------------------------------------------------- const OTypeInfo* OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos) { - return ((OWizTypeSelect*)GetParent())->m_pParent->getTypeInfo(_nPos); + return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->getTypeInfo(_nPos); } // ----------------------------------------------------------------------------- const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const { - return ((OWizTypeSelect*)GetParent())->m_pParent->getTypeInfo(); + return static_cast<OWizTypeSelect*>(GetParent())->m_pParent->getTypeInfo(); } // ----------------------------------------------------------------------------- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData() @@ -200,6 +206,7 @@ OWizTypeSelect::OWizTypeSelect( Window* pParent) ,m_ftAuto( this, ModuleRes( FT_AUTO ) ) ,m_etAuto( this, ModuleRes( ET_AUTO ) ) ,m_pbAuto( this, ModuleRes( PB_AUTO ) ) + ,m_pParserStream(NULL) { DBG_CTOR(OWizTypeSelect,NULL); m_lbColumnNames.SetSelectHdl(LINK(this,OWizTypeSelect,ColumnSelectHdl)); @@ -325,46 +332,6 @@ IMPL_LINK( OWizTypeSelect, ButtonClickHdl, Button *, pButton ) m_pParent->CheckColumns(); fillColumnList(m_etAuto.GetText().ToInt32()); -// OColumnList &aList = FillColumnList(m_pParent->m_xTableDef->GetColumns(),m_etAuto.GetText().ToInt32()); -// -// for(sal_uInt32 i=0;i<aList.Count();++i) -// { -// sal_uInt32 nPos = m_pColumnList.GetPos(aList.GetObject(i)); -// OColumn *pSrcColumn = aList.GetObject(i); -// SFX_ITEMSET_GET( *pSrcColumn, pName, ONameItem, SBA_DEF_FLTNAME, sal_True ); -// OColumn *pDestColumn = m_pParent->m_lColumnList.Lookup(m_pParent->m_mNameMapping[pName->GetValue()],String()); -// if(pDestColumn) -// { -// OColumn* pNewColumn = pDestColumn; -// OColumn* pColumn = aList.GetObject(i); -// -// SFX_ITEMSET_GET(*pColumn, pType, ODataFieldTypeItem, SBA_DEF_FLTTYPE, sal_True); -// SFX_ITEMSET_GET(*pColumn, pLength, SfxUInt32Item, SBA_DEF_FLTLENGTH, sal_True); -// SFX_ITEMSET_GET(*pColumn, pScale, SfxUInt16Item, SBA_DEF_FLTSCALE, sal_True); -// SFX_ITEMSET_GET(*pColumn, pFormat, SfxUInt32Item, SBA_DEF_FMTVALUE, sal_True ); -// -// SdbTypeInfo* pInfo = m_pParent->m_xTableDef->GetDatabase()->IsTypeAvailable(pType->GetType(), pLength->GetValue()); -// -// pNewColumn->Put(ODataFieldTypeItem(SBA_DEF_FLTTYPE,(OFieldType) pType->GetValue())); -// pNewColumn->Put(SfxUInt32Item(SBA_DEF_FLTLENGTH,pLength->GetValue())); -// pNewColumn->Put(SfxUInt16Item(SBA_DEF_FLTSCALE,pScale->GetValue())); -// pNewColumn->Put(SfxUInt32Item(SBA_DEF_FMTVALUE, pFormat->GetValue())); -// -// if(!pInfo) -// m_pParent->m_xTableDef->AdjustType(pColumn,pNewColumn); -// -// SFX_ITEMSET_GET(*pNewColumn, pType2, ODataFieldTypeItem, SBA_DEF_FLTTYPE, sal_True); -// -// switch(pType2->GetType()) -// { -// case dbChar: -// case dbText: -// if(pInfo && pInfo->nPrecision && pInfo->nPrecision < pLength->GetValue()) // this type is to small for my data -// m_pParent->m_xTableDef->ConvertTypeTo(dbMemo, pNewColumn); -// break; -// } -// } -// } ActivatePage(); return 0; @@ -455,4 +422,21 @@ long OWizTypeSelectList::PreNotify( NotifyEvent& rEvt ) return nDone ? nDone : MultiListBox::PreNotify(rEvt); } // ----------------------------------------------------------------------------- +void OWizTypeSelect::fillColumnList(sal_uInt32 nRows) +{ + if(m_pParserStream) + { + sal_uInt32 nTell = m_pParserStream->Tell(); // verändert vielleicht die Position des Streams + + SvParser *pReader = createReader(nRows); + if(pReader) + { + pReader->AddRef(); + pReader->CallParser(); + pReader->ReleaseRef(); + } + m_pParserStream->Seek(nTell); + } +} +// ----------------------------------------------------------------------------- |