diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-07-06 09:00:26 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-07-06 09:00:26 +0000 |
commit | e200eed28c83326b1639d28f4175f21e52d1cb8c (patch) | |
tree | 16b7f2ac1548e4c33801cf54a2e1a7248962618c /dbaccess | |
parent | cb1400a076d1ac1777db08fef3c011235a936258 (diff) |
CWS-TOOLING: integrate CWS dba32d
2009-06-30 08:58:13 +0200 fs r273488 : merging latest changes from CWS dba32c
2009-06-29 11:40:42 +0200 oj r273459 : #i101652# fix token handling
2009-06-26 09:27:30 +0200 oj r273394 : #i101994# wrong condition checked
2009-06-22 12:09:04 +0200 fs r273210 : merging latest changes from CWS dba32c
2009-06-18 11:01:06 +0200 fs r273108 : merge latest changes from CWS dba32c
2009-06-17 14:19:33 +0200 oj r273072 : handle images at the correct position
2009-06-17 13:37:19 +0200 oj r273067 : compile error
2009-06-17 13:35:58 +0200 oj r273066 : #i102201# handle images
2009-06-17 13:27:21 +0200 oj r273065 : #i80917# disable checkbox for internal copy
2009-06-17 13:25:38 +0200 oj r273064 : #i80917# disable checkbox for internal copy
2009-06-15 12:59:16 +0200 fs r272978 : merging latest changes from CWS dba32c
2009-06-15 10:45:58 +0200 fs r272967 : CWS-TOOLING: rebase CWS dba32d to trunk@272827 (milestone: DEV300:m50)
2009-06-15 08:41:05 +0200 fs r272960 : merging changes from CWS dba32c (resulting from rebasing dba32c to m50)
2009-06-03 12:22:32 +0200 fs r272554 : merging latest changes from CWS dba32c
2009-06-03 11:11:27 +0200 fs r272549 : #i100818# special treatment for DataAwareness not needed anymore
2009-06-03 11:07:01 +0200 fs r272548 : #i10000# removed package declaration
2009-06-03 09:21:03 +0200 oj r272537 : #i93465# save window states
2009-06-03 08:56:25 +0200 oj r272535 : solve compiler warnings
2009-06-03 08:55:02 +0200 oj r272534 : #i102295# export shapes i the first cell
2009-06-03 07:35:18 +0200 oj r272533 : #i101994# check for - and + prefix
2009-06-03 06:51:38 +0200 oj r272531 : #i101463# use uncomposed table name
2009-06-03 06:33:06 +0200 oj r272530 : #i102019# word corrected
2009-06-02 14:58:28 +0200 fs r272507 : #i102443# call initializeParser from LoadFinished
2009-06-02 14:30:10 +0200 oj r272504 : #i102019# introduce static ints
2009-06-02 13:51:02 +0200 oj r272501 : #i102439# wrong method used
2009-06-02 13:44:09 +0200 fs r272500 : #i102440# when tampering with Order/GroupBy, reset the cached columns
2009-06-02 10:53:01 +0200 fs r272487 : #i102234# preserve the original filter when using a 0=1 filter
2009-06-02 10:21:21 +0200 oj r272486 : #i100535# handle time values as float
2009-06-02 10:19:07 +0200 fs r272485 : merging latest changes from CWS dba32c
2009-05-29 16:00:15 +0200 fs r272467 : merging latest changes from dba32c
2009-05-29 15:31:25 +0200 fs r272462 : merging latest changes from dba32c
2009-05-29 10:58:03 +0200 oj r272438 : #101135# export embedded-text
2009-05-29 08:17:57 +0200 oj r272431 : #i80917# make attribute not optional
2009-05-29 08:17:32 +0200 oj r272430 : remoe unused token
2009-05-29 07:17:15 +0200 oj r272429 : #i80917# make attribute not optional
2009-05-28 12:48:14 +0200 oj r272401 : #i102201# insert images in context menu
2009-05-28 12:47:44 +0200 oj r272400 : #i80917# add new attribute to handle first line
2009-05-28 12:16:12 +0200 oj r272397 : #i96134# add / to path when it doesn't exist
2009-05-28 12:11:08 +0200 oj r272390 : #i80917# add new attribute to handle first line
2009-05-28 11:33:35 +0200 oj r272388 : #i101652# add new checkbox to handle header line as column names
2009-05-28 11:30:15 +0200 oj r272387 : #i101652# add localize
2009-05-28 11:15:53 +0200 oj r272386 : merge from dba32c
2009-05-28 09:08:25 +0200 fs r272378 : merged a build fix from CWS dba32c
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 56 | ||||
-rw-r--r-- | dbaccess/source/core/inc/SingleSelectQueryComposer.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlExport.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 41 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WCPage.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WCopyTable.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_misc.hrc | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/DExport.cxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/RtfReader.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCPage.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WizardPages.hrc | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WizardPages.src | 23 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 19 |
15 files changed, 143 insertions, 55 deletions
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 15bbed1b5936..a6ca701e0835 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -579,8 +579,13 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const // set the query setQuery_Impl(aSql.makeStringAndClear()); - // parameters may also have changed - clearParametersCollection(); + + // clear column collections which (might) have changed + clearColumns( ParameterColumns ); + if ( _ePart == Order ) + clearColumns( OrderColumns ); + if ( _ePart == Group ) + clearColumns( GroupByColumns ); // also, since the "additive filter" change, we need to rebuild our "additive" statement aSql = m_aPureSelectSQL; @@ -676,26 +681,42 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers(); aSelectColumns = m_aSqlIterator.getSelectColumns(); - ::rtl::OUString sSql = m_aPureSelectSQL; - sSql += STR_WHERE; - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" 0 = 1 ")); - ::rtl::OUString sGroupBy = getSQLPart(Group,m_aSqlIterator,sal_True); + ::rtl::OUStringBuffer aSQL; + aSQL.append( m_aPureSelectSQL ); + aSQL.append( STR_WHERE ); + + // preserve the original WHERE clause + // #i102234# / 2009-06-02 / frank.schoenheit@sun.com + ::rtl::OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, sal_False ); + if ( sOriginalWhereClause.getLength() ) + { + aSQL.appendAscii( " ( 0 = 1 ) AND ( " ); + aSQL.append( sOriginalWhereClause ); + aSQL.appendAscii( " ) " ); + } + else + { + aSQL.appendAscii( " ( 0 = 1 ) " ); + } + + ::rtl::OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, sal_True ); if ( sGroupBy.getLength() ) - sSql += sGroupBy; + aSQL.append( sGroupBy ); + ::rtl::OUString sSQL( aSQL.makeStringAndClear() ); // normalize the statement so that it doesn't contain any application-level features anymore ::rtl::OUString sError; - const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSql, false ) ); + const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) ); DBG_ASSERT( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" ); if ( pStatementTree.get() ) - if ( !pStatementTree->parseNodeToExecutableStatement( sSql, m_xConnection, m_aSqlParser, NULL ) ) + if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) ) break; Reference< XResultSetMetaData > xResultSetMeta; Reference< XResultSetMetaDataSupplier > xResMetaDataSup; try { - xPreparedStatement.set( m_xConnection->prepareStatement( sSql ), UNO_QUERY_THROW ); + xPreparedStatement.set( m_xConnection->prepareStatement( sSQL ), UNO_QUERY_THROW ); xResMetaDataSup.set( xPreparedStatement, UNO_QUERY_THROW ); xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW ); } @@ -707,7 +728,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW ); try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( sal_False ) ); } catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - xResMetaDataSup.set( xStatement->executeQuery( sSql ), UNO_QUERY_THROW ); + xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW ); xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW ); } @@ -1243,14 +1264,15 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( ) return m_aCurrentColumns[ParameterColumns]; } // ----------------------------------------------------------------------------- -void OSingleSelectQueryComposer::clearParametersCollection() +void OSingleSelectQueryComposer::clearColumns( const EColumnType _eType ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearParametersCollection" ); - if ( m_aCurrentColumns[ParameterColumns] ) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearColumns" ); + OPrivateColumns* pColumns = m_aCurrentColumns[ _eType ]; + if ( pColumns != NULL ) { - m_aCurrentColumns[ParameterColumns]->disposing(); - m_aColumnsCollection.push_back(m_aCurrentColumns[ParameterColumns]); - m_aCurrentColumns[ParameterColumns] = NULL; + pColumns->disposing(); + m_aColumnsCollection.push_back( pColumns ); + m_aCurrentColumns[ _eType ] = NULL; } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx index 946de25ca364..88be29d9240d 100644 --- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx +++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx @@ -160,8 +160,8 @@ namespace dbaccess sal_Int32 getPredicateType(::connectivity::OSQLParseNode * _pPredicate) const; // clears all Columns,Parameters and tables and insert it to their vectors void clearCurrentCollections(); - // clear only the parameter columns - void clearParametersCollection(); + // clears the columns collection given by EColumnType + void clearColumns( const EColumnType _eType ); /** retrieves a particular part of a statement @param _rIterator diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 28997c16d31f..b42d65ba1cb0 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -629,7 +629,11 @@ void ODBExport::exportConnectionData() if ( sOrigUrl == sFileName ) { ::svt::OFileNotation aTransformer( sFileName ); - AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(aTransformer.get( ::svt::OFileNotation::N_URL ))); + ::rtl::OUStringBuffer sURL( aTransformer.get( ::svt::OFileNotation::N_URL ) ); + if ( sURL.charAt(sURL.getLength()-1) != '/' ) + sURL.append(sal_Unicode('/')); + + AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(sURL.makeStringAndClear())); } // if ( sOrigUrl == sFileName ) else AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,sOrigUrl); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index fdd9e7396d83..94160b21a134 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1068,13 +1068,11 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t // the filter or the sort criterias have changed ? -> update our parser if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND)) { - initializeParser(); if (m_xParser.is()) DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" ); } else if (evt.PropertyName.equals(PROPERTY_FILTER)) { - initializeParser(); if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue)) { DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); @@ -1083,7 +1081,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t } else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE)) { - initializeParser(); if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue)) { DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); @@ -1092,7 +1089,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t } else if (evt.PropertyName.equals(PROPERTY_ORDER)) { - initializeParser(); if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue)) { DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" ); @@ -1790,7 +1786,6 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); - initializeParser(); const ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder(); const ::rtl::OUString sOldHaving = m_xParser->getHavingClause(); try @@ -2035,7 +2030,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property if (!xField.is()) break; - initializeParser(); const ::rtl::OUString sOldSort = m_xParser->getOrder(); sal_Bool bParserSuccess = sal_False; HANDLE_SQL_ERRORS( @@ -2066,7 +2060,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property sal_Bool bHaving = sal_False; ::rtl::OUString sName; xField->getPropertyValue(PROPERTY_NAME) >>= sName; - initializeParser(); Reference< XColumnsSupplier > xColumnsSupplier(m_xParser, UNO_QUERY); Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > (); if ( xCols.is() && xCols->hasByName(sName) ) @@ -2576,6 +2569,9 @@ void SbaXDataBrowserController::LoadFinished(sal_Bool /*bWasSynch*/) getBrowserView()->getGridControl()->setDesignMode(sal_False); // ------------------------------- + initializeParser(); + + // ------------------------------- InvalidateAll(); m_aAsyncGetCellFocus.Call(); @@ -2611,7 +2607,7 @@ void SbaXDataBrowserController::initializeParser() const } catch(Exception&) { - DBG_WARNING("SbaXDataBrowserController::initializeParser: something went wrong while creating the parser !"); + DBG_UNHANDLED_EXCEPTION(); m_xParser = NULL; // no further handling, we ignore the error } @@ -2717,7 +2713,6 @@ sal_Bool SbaXDataBrowserController::isValidCursor() const bIsValid = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW)); if ( !bIsValid ) { - initializeParser(); bIsValid = m_xParser.is(); } } // if ( !bIsValid ) diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index cd2bf2a4ad25..a11d39bdba04 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -56,6 +56,7 @@ #ifndef _COM_SUN_STAR_UI_XCONTEXTMENUINTERCEPTOR_HPP_ #include <com/sun/star/ui/XContextMenuInterceptor.hpp> #endif +#include <com/sun/star/frame/XFrame.hpp> #ifndef _COM_SUN_STAR_UTIL_URL_HPP_ #include <com/sun/star/util/URL.hpp> #endif @@ -80,7 +81,8 @@ #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/helper/vclunohelper.hxx> #endif - +#include <framework/imageproducer.hxx> +#include <vcl/svapp.hxx> #include <memory> // ......................................................................... @@ -88,6 +90,7 @@ namespace dbaui { // ......................................................................... +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; @@ -546,9 +549,9 @@ namespace { lcl_adjustMenuItemIDs( *pPopup, _rCommandController ); continue; - } + } // if ( pPopup ) - USHORT nCommandId = _rCommandController.registerCommandURL( aCommand ); + const USHORT nCommandId = _rCommandController.registerCommandURL( aCommand ); _rMenu.InsertItem( nCommandId, _rMenu.GetItemText( nId ), _rMenu.GetItemImage( nId ), _rMenu.GetItemBits( nId ), pos ); @@ -562,6 +565,34 @@ namespace _rMenu.RemoveItem( pos+1 ); } } + void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController ) + { + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + const BOOL bHiContrast = rSettings.GetMenuColor().IsDark(); + uno::Reference< frame::XController > xController = _rCommandController.getXController(); + uno::Reference< frame::XFrame> xFrame; + if ( xController.is() ) + xFrame = xController->getFrame(); + USHORT nCount = _rMenu.GetItemCount(); + for ( USHORT pos = 0; pos < nCount; ++pos ) + { + // do not adjust separators + if ( _rMenu.GetItemType( pos ) == MENUITEM_SEPARATOR ) + continue; + + USHORT nId = _rMenu.GetItemId(pos); + String aCommand = _rMenu.GetItemCommand( nId ); + PopupMenu* pPopup = _rMenu.GetPopupMenu( nId ); + if ( pPopup ) + { + lcl_insertMenuItemImages( *pPopup, _rCommandController ); + continue; + } // if ( pPopup ) + + if ( xFrame.is() ) + _rMenu.SetItemImage(nId,framework::GetImageFromURL(xFrame,aCommand,FALSE,bHiContrast)); + } + } // ========================================================================= // = SelectionSupplier // ========================================================================= @@ -629,6 +660,8 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void ) pContextMenu.reset( m_pContextMenuProvider->getContextMenu( *this ) ); // disable what is not available currently lcl_enableEntries( pContextMenu.get(), m_pContextMenuProvider->getCommandController() ); + // set images + lcl_insertMenuItemImages( *pContextMenu, m_pContextMenuProvider->getCommandController() ); // allow context menu interception ::cppu::OInterfaceContainerHelper* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors(); if ( !pInterceptors || !pInterceptors->getLength() ) @@ -695,7 +728,7 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void ) // the interceptors only know command URLs, but our menus primarily work // with IDs -> we need to translate the commands to IDs lcl_adjustMenuItemIDs( *pModifiedMenu, m_pContextMenuProvider->getCommandController() ); - } + } // if ( bModifiedMenu ) return pContextMenu.release(); } diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx index b367a07f5f45..09531e1990ee 100644 --- a/dbaccess/source/ui/inc/WCPage.hxx +++ b/dbaccess/source/ui/inc/WCPage.hxx @@ -66,6 +66,7 @@ namespace dbaui RadioButton m_aRB_Def; RadioButton m_aRB_View; RadioButton m_aRB_AppendData; + CheckBox m_aCB_UseHeaderLine; CheckBox m_aCB_PrimaryColumn; FixedText m_aFT_KeyName; Edit m_edKeyName; @@ -75,6 +76,7 @@ namespace dbaui OWizNormalExtend* m_pPage3; BOOL m_bPKeyAllowed; + BOOL m_bUseHeaderAllowed; DECL_LINK( AppendDataClickHdl, Button* ); @@ -99,13 +101,19 @@ namespace dbaui inline BOOL IsOptionDef() const { return m_aRB_Def.IsChecked(); } inline BOOL IsOptionAppendData() const { return m_aRB_AppendData.IsChecked(); } inline BOOL IsOptionView() const { return m_aRB_View.IsChecked(); } + inline BOOL UseHeaderLine() const { return m_aCB_UseHeaderLine.IsChecked(); } String GetKeyName() const { return m_edKeyName.GetText(); } void setCreateStyleAction(); - void disallowViews() + inline void disallowViews() { m_aRB_View.Disable(); } + inline void disallowUseHeaderLine() + { + m_bUseHeaderAllowed = FALSE; + m_aCB_UseHeaderLine.Disable(); + } void setCreatePrimaryKey( bool _bDoCreate, const ::rtl::OUString& _rSuggestedName ); }; diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index fa46608991da..37d0d870f538 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -314,6 +314,7 @@ namespace dbaui sal_Int16 m_nOperation; Wizard_Button_Style m_ePressed; sal_Bool m_bCreatePrimaryKeyColumn; + sal_Bool m_bUseHeaderLine; private: DECL_LINK( ImplPrevHdl , PushButton* ); @@ -373,6 +374,8 @@ namespace dbaui // when not the value is COLUMN_POSITION_NOT_FOUND == (sal_uInt32)-1 ODatabaseExport::TPositions GetColumnPositions() const { return m_vColumnPos; } ::std::vector<sal_Int32> GetColumnTypes() const { return m_vColumnTypes; } + sal_Bool UseHeaderLine() const { return m_bUseHeaderLine; } + void setUseHeaderLine(sal_Bool _bUseHeaderLine) { m_bUseHeaderLine = _bUseHeaderLine; } void insertColumn(sal_Int32 _nPos,OFieldDescription* _pField); diff --git a/dbaccess/source/ui/inc/dbu_misc.hrc b/dbaccess/source/ui/inc/dbu_misc.hrc index 2a1ecb8b78da..0ee803edec10 100644 --- a/dbaccess/source/ui/inc/dbu_misc.hrc +++ b/dbaccess/source/ui/inc/dbu_misc.hrc @@ -34,9 +34,8 @@ #include "dbu_resource.hrc" #endif - -#define STR_HTML_TITLE RID_STR_MISC_START -#define STR_RTF_TITLE RID_STR_MISC_START + 1 +// free +// free #define STR_WIZ_COLUMN_SELECT_TITEL RID_STR_MISC_START + 2 #define STR_WIZ_TYPE_SELECT_TITEL RID_STR_MISC_START + 3 #define STR_WIZ_PKEY_ALREADY_DEFINED RID_STR_MISC_START + 4 diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 629f431c39a5..e55508a67608 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -732,6 +732,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const m_bIsAutoIncrement = aWizard.shouldCreatePrimaryKey(); m_vColumns = aWizard.GetColumnPositions(); m_vColumnTypes = aWizard.GetColumnTypes(); + m_bAppendFirstLine = !aWizard.UseHeaderLine(); } break; default: diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 34540ad11684..5ba41d439b3e 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -163,16 +163,17 @@ void ORTFReader::NextToken( int nToken ) break; case RTF_TROWD: { - sal_uInt32 nTell = rInput.Tell(); // verndert vielleicht die Position des Streams bool bInsertRow = true; if ( !m_xTable.is() ) // erste Zeile als Header verwenden { + sal_uInt32 nTell = rInput.Tell(); // verndert vielleicht die Position des Streams + m_bError = !CreateTable(nToken); bInsertRow = m_bAppendFirstLine; if ( m_bAppendFirstLine ) { rInput.Seek(nTell); - bInsertRow = true; + rInput.ResetError(); } } if ( bInsertRow && !m_bError) @@ -333,7 +334,7 @@ sal_Bool ORTFReader::CreateTable(int nToken) break; } } - while((nTmpToken2 = GetNextToken()) != RTF_ROW && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED); + while((nTmpToken2 = GetNextToken()) != RTF_TROWD && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED); sal_Bool bOk = !m_vDestVector.empty(); if(bOk) diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index f4b71e145349..63a910929836 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -112,11 +112,13 @@ OCopyTable::OCopyTable( Window * pParent ) ,m_aRB_Def( this, ModuleRes( RB_DEF ) ) ,m_aRB_View( this, ModuleRes( RB_VIEW ) ) ,m_aRB_AppendData( this, ModuleRes( RB_APPENDDATA ) ) + ,m_aCB_UseHeaderLine( this, ModuleRes( CB_USEHEADERLINE ) ) ,m_aCB_PrimaryColumn( this, ModuleRes( CB_PRIMARY_COLUMN ) ) ,m_aFT_KeyName( this, ModuleRes( FT_KEYNAME ) ) ,m_edKeyName( this, ModuleRes( ET_KEYNAME ) ) ,m_pPage2(NULL) ,m_pPage3(NULL) + ,m_bUseHeaderAllowed(TRUE) { DBG_CTOR(OCopyTable,NULL); @@ -127,6 +129,7 @@ OCopyTable::OCopyTable( Window * pParent ) if ( !m_pParent->supportsViews() ) m_aRB_View.Disable(); + m_aCB_UseHeaderLine.Check(TRUE); m_bPKeyAllowed = m_pParent->supportsPrimaryKey(); m_aCB_PrimaryColumn.Enable(m_bPKeyAllowed); @@ -187,6 +190,7 @@ IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton ) m_aFT_KeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked()); m_edKeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked()); m_aCB_PrimaryColumn.Enable(bKey); + m_aCB_UseHeaderLine.Enable(m_bUseHeaderAllowed && IsOptionDefData()); // set typ what to do if( IsOptionDefData() ) @@ -211,7 +215,8 @@ sal_Bool OCopyTable::LeavePage() { DBG_CHKTHIS(OCopyTable,NULL); m_pParent->m_bCreatePrimaryKeyColumn = (m_bPKeyAllowed && m_aCB_PrimaryColumn.IsEnabled()) ? m_aCB_PrimaryColumn.IsChecked() : sal_False; - m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String(); + m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String(); + m_pParent->setUseHeaderLine( m_aCB_UseHeaderLine.IsChecked() ); // first check if the table already exists in the database if( m_pParent->getOperation() != CopyTableOperation::AppendData ) @@ -296,6 +301,7 @@ void OCopyTable::ActivatePage() m_pParent->GetOKButton().Enable( TRUE ); m_nOldOperation = m_pParent->getOperation(); m_edTableName.GrabFocus(); + m_aCB_UseHeaderLine.Check(m_pParent->UseHeaderLine()); } //------------------------------------------------------------------------ String OCopyTable::GetTitle() const diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 7b5181e8fe4b..1feb51cf49a9 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -633,6 +633,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD bAllowViews = false; OCopyTable* pPage1( new OCopyTable( this ) ); + pPage1->disallowUseHeaderLine(); if ( !bAllowViews ) pPage1->disallowViews(); pPage1->setCreateStyleAction(); diff --git a/dbaccess/source/ui/misc/WizardPages.hrc b/dbaccess/source/ui/misc/WizardPages.hrc index b199a8012853..9a489861acf9 100644 --- a/dbaccess/source/ui/misc/WizardPages.hrc +++ b/dbaccess/source/ui/misc/WizardPages.hrc @@ -72,6 +72,7 @@ #define RB_VIEW 3 #define RB_APPENDDATA 4 #define CB_PRIMARY_COLUMN 5 +#define CB_USEHEADERLINE 6 #define CONTROL_CONTAINER 1 // controls diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src index 4e8884d9144b..638feb92e54c 100644 --- a/dbaccess/source/ui/misc/WizardPages.src +++ b/dbaccess/source/ui/misc/WizardPages.src @@ -48,16 +48,6 @@ #define BUTTON_SIZE_X 50 #define BUTTON_SIZE_Y 14 -String STR_HTML_TITLE -{ - Text [ en-US ] = "Copy HTML table" ; -}; - -String STR_RTF_TITLE -{ - Text [ en-US ] = "Copy RTF table" ; -}; - String STR_WIZ_COLUMN_SELECT_TITEL { Text [ en-US ] = "Apply columns"; @@ -523,22 +513,29 @@ TabPage TAB_WIZ_COPYTABLE Text [ en-US ] = "Append ~data" ; }; - CheckBox CB_PRIMARY_COLUMN + CheckBox CB_USEHEADERLINE { Pos = MAP_APPFONT ( 12, 93 ) ; + Size = MAP_APPFONT ( WINDOW_SIZE_X - 18, 10 ) ; + Text [ en-US ] = "Use first ~line as column names" ; + }; + + CheckBox CB_PRIMARY_COLUMN + { + Pos = MAP_APPFONT ( 12, 107 ) ; Size = MAP_APPFONT ( 90 , 10 ) ; Text [ en-US ] = "Crea~te primary key"; }; FixedText FT_KEYNAME { - Pos = MAP_APPFONT ( 21 , 108 ) ; + Pos = MAP_APPFONT ( 21 , 122 ) ; Size = MAP_APPFONT ( 39 , 8 ) ; Text [ en-US ] = "Name"; }; Edit ET_KEYNAME { - Pos = MAP_APPFONT ( 80, 106 ) ; + Pos = MAP_APPFONT ( 80, 120 ) ; Size = MAP_APPFONT ( 65 , 12 ) ; TabStop = TRUE ; Border = TRUE ; diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 1f8fd4dc4dbc..26f859cf2045 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -171,6 +171,8 @@ namespace dbaui virtual void SAL_CALL setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException); virtual Optional< ::rtl::OUString > SAL_CALL getCreatePrimaryKey() throw (RuntimeException); virtual void SAL_CALL setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException); + virtual sal_Bool SAL_CALL getUseHeaderLineAsColumnNames() throw (RuntimeException); + virtual void SAL_CALL setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException); virtual void SAL_CALL addCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException); virtual void SAL_CALL removeCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException); @@ -331,6 +333,7 @@ private: sal_Int16 m_nOperation; ::rtl::OUString m_sDestinationTable; Optional< ::rtl::OUString > m_aPrimaryKeyName; + sal_Bool m_bUseHeaderLineAsColumnNames; // source SharedConnection m_xSourceConnection; @@ -381,6 +384,7 @@ CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxOR ,m_nOperation( CopyTableOperation::CopyDefinitionAndData ) ,m_sDestinationTable() ,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )) + ,m_bUseHeaderLineAsColumnNames( sal_True ) ,m_xSourceConnection() ,m_nCommandType( CommandType::COMMAND ) ,m_pSourceObject() @@ -522,7 +526,18 @@ void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUStr m_aPrimaryKeyName = _newPrimaryKey; } - +// ----------------------------------------------------------------------------- +sal_Bool SAL_CALL CopyTableWizard::getUseHeaderLineAsColumnNames() throw (RuntimeException) +{ + CopyTableAccessGuard aGuard( *this ); + return m_bUseHeaderLineAsColumnNames; +} +// ----------------------------------------------------------------------------- +void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException) +{ + CopyTableAccessGuard aGuard( *this ); + m_bUseHeaderLineAsColumnNames = _bUseHeaderLineAsColumnNames; +} //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) { @@ -589,6 +604,7 @@ void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialo RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_attributesToDialog_nothrow" ); // primary key column _rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value ); + _rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames); // everything else was passed at construction time already } @@ -606,6 +622,7 @@ void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _ m_sDestinationTable = _rDialog.getName(); m_nOperation = _rDialog.getOperation(); + m_bUseHeaderLineAsColumnNames = _rDialog.UseHeaderLine(); } //------------------------------------------------------------------------- |