From 4a584bcc982922eb3127132a6109fc3250e91cca Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 16 Nov 2009 16:29:18 +0100 Subject: dba33d: #i106737# set the databasedataprovider when doc is loaded --- reportdesign/source/core/api/ReportDefinition.cxx | 3 +-- .../source/filter/xml/xmlImportDocumentHandler.cxx | 29 ++++++++++++++-------- .../source/filter/xml/xmlImportDocumentHandler.hxx | 1 - 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index c26207960..051a0d50b 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -563,8 +563,7 @@ namespace } catch(uno::Exception& ex) { - (void)ex; - OSL_ASSERT(0); + DBG_UNHANDLED_EXCEPTION(); } } void SAL_CALL FactoryLoader::onTerminated() diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index da720d049..93ac98bb4 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,6 @@ using namespace ::xmloff::token; ImportDocumentHandler::ImportDocumentHandler(uno::Reference< uno::XComponentContext > const & context) : m_xContext(context) - ,m_bOnlyOnce(true) { } // ----------------------------------------------------------------------------- @@ -124,7 +124,24 @@ void SAL_CALL ImportDocumentHandler::endDocument() throw (uno::RuntimeException, m_xDelegatee->endDocument(); uno::Reference< chart2::data::XDataReceiver > xReceiver(m_xModel,uno::UNO_QUERY_THROW); if ( xReceiver.is() ) + { xReceiver->attachDataProvider(m_xDatabaseDataProvider.get()); + // this fills the chart again + uno::Sequence< beans::PropertyValue > aArgs( 4 ); + aArgs[0] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1, + uno::makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("all")) ), beans::PropertyState_DIRECT_VALUE ); + aArgs[1] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("HasCategories"), -1, + uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE ); + aArgs[2] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1, + uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE ); + aArgs[3] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("DataRowSource"), -1, + uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE ); + xReceiver->setArguments( aArgs ); + } } void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName, const uno::Reference< xml::sax::XAttributeList > & _xAttrList) throw (uno::RuntimeException, xml::sax::SAXException) @@ -257,16 +274,6 @@ void SAL_CALL ImportDocumentHandler::startElement(const ::rtl::OUString & _sName } } // for(;pArgIter != pArgEnd;++pArgIter) - if ( m_bOnlyOnce ) - { - try - { - m_xDatabaseDataProvider->createDataSource(m_aArguments); - m_bOnlyOnce = false; - } - catch(uno::Exception) - {} - } // if ( m_bOnlyOnce ) SvXMLAttributeList* pList = new SvXMLAttributeList(); xNewAttribs = pList; diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx index c27b3681e..38b0e374b 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx @@ -100,7 +100,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; ::std::auto_ptr m_pReportElemTokenMap; - bool m_bOnlyOnce; }; // ----------------------------------------------------------------------------- } // namespace rptxml -- cgit v1.2.3 From ac6c6564153ae7eee78d430cdb68bd9d0e2b466d Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 16 Nov 2009 17:05:37 +0100 Subject: dba33d: #i105554# apply patch from cmc --- reportdesign/inc/RptObject.hxx | 1 - reportdesign/inc/reportformula.hxx | 3 - .../source/core/api/ReportControlModel.cxx | 8 --- .../source/core/inc/ReportControlModel.hxx | 2 - reportdesign/source/core/misc/reportformula.cxx | 6 -- reportdesign/source/core/sdr/RptObject.cxx | 16 ----- reportdesign/source/filter/xml/xmlExport.cxx | 73 ---------------------- reportdesign/source/filter/xml/xmlExport.hxx | 2 - reportdesign/source/ui/inc/DesignView.hxx | 2 + reportdesign/source/ui/inc/ReportWindow.hxx | 1 - reportdesign/source/ui/inc/ScrollHelper.hxx | 1 - reportdesign/source/ui/inc/StartMarker.hxx | 4 -- reportdesign/source/ui/inc/ViewsWindow.hxx | 5 -- reportdesign/source/ui/report/DesignView.cxx | 2 + reportdesign/source/ui/report/ReportWindow.cxx | 5 -- reportdesign/source/ui/report/ScrollHelper.cxx | 5 -- reportdesign/source/ui/report/StartMarker.cxx | 6 -- reportdesign/source/ui/report/ViewsWindow.cxx | 27 -------- 18 files changed, 4 insertions(+), 165 deletions(-) diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 076f152fb..197e84422 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -109,7 +109,6 @@ protected: virtual void SetSnapRectImpl(const Rectangle& _rRect) = 0; virtual SdrPage* GetImplPage() const = 0; virtual void SetObjectItemHelper(const SfxPoolItem& rItem); - sal_Bool IsInside(const Rectangle& _rRect,const Point& rPnt,USHORT nTol) const; /** called by instances of derived classes to implement their overloading of getUnoShape */ diff --git a/reportdesign/inc/reportformula.hxx b/reportdesign/inc/reportformula.hxx index 2f73fd7e4..55880c751 100644 --- a/reportdesign/inc/reportformula.hxx +++ b/reportdesign/inc/reportformula.hxx @@ -64,9 +64,6 @@ namespace rptui ::rtl::OUString m_sUndecoratedContent; public: - // constructs a ReportFormula instance which is initially invalid. - ReportFormula(); - /// constructs a ReportFormula object from a string ReportFormula( const ::rtl::OUString& _rFormula ); diff --git a/reportdesign/source/core/api/ReportControlModel.cxx b/reportdesign/source/core/api/ReportControlModel.cxx index 1d1e92375..677a4cda0 100644 --- a/reportdesign/source/core/api/ReportControlModel.cxx +++ b/reportdesign/source/core/api/ReportControlModel.cxx @@ -152,14 +152,6 @@ void OReportControlModel::checkIndex(sal_Int32 _nIndex) throw lang::IndexOutOfBoundsException(); } // ----------------------------------------------------------------------------- -void OReportControlModel::dispose() -{ - m_aFormatConditions.clear(); - lang::EventObject aDisposeEvent( m_pOwner ); - aContainerListeners.disposeAndClear( aDisposeEvent ); - m_aFormatConditions.clear(); -} -// ----------------------------------------------------------------------------- bool OReportControlModel::isInterfaceForbidden(const uno::Type& _rType) { return (_rType == ::getCppuType((const uno::Reference< beans::XPropertyState>* )0) || _rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet>* )0)); diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx index 95fb3eb18..7f822349e 100644 --- a/reportdesign/source/core/inc/ReportControlModel.hxx +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -115,8 +115,6 @@ namespace reportdesign ,bPrintWhenGroupChange(sal_False) {} - void dispose(); - // XContainer void addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); void removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx index 6997e0da7..d0935d1a9 100644 --- a/reportdesign/source/core/misc/reportformula.cxx +++ b/reportdesign/source/core/misc/reportformula.cxx @@ -68,12 +68,6 @@ namespace rptui //==================================================================== //= ReportFormula //==================================================================== - //-------------------------------------------------------------------- - ReportFormula::ReportFormula() - :m_eType( Invalid ) - { - } - //-------------------------------------------------------------------- ReportFormula::ReportFormula( const ::rtl::OUString& _rFormula ) :m_eType( Invalid ) diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index eba35f6bf..7140bcdea 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -363,22 +363,6 @@ uno::Reference< beans::XPropertySet> OObjectBase::getAwtComponent() { return uno::Reference< beans::XPropertySet>(); } -// ----------------------------------------------------------------------------- -sal_Bool OObjectBase::IsInside(const Rectangle& _rRect,const Point& rPnt,USHORT nTol) const -{ - sal_Bool bRet = sal_False; - Rectangle aRect( _rRect ); - if ( !aRect.IsEmpty() ) - { - aRect.Left() -= nTol; - aRect.Top() -= nTol; - aRect.Right() = ( aRect.Right() == RECT_EMPTY ? _rRect.Left() + nTol : aRect.Right() + nTol ); - aRect.Bottom() = ( aRect.Bottom() == RECT_EMPTY ? _rRect.Top() + nTol : aRect.Bottom() + nTol ); - - bRet = aRect.IsInside( rPnt ); - } - return bRet; -} //---------------------------------------------------------------------------- void OObjectBase::StartListening() { diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 51daf4023..cad93ae72 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -172,40 +172,6 @@ namespace rptxml } //--------------------------------------------------------------------- - ::rtl::OUString lcl_implGetPropertyXMLType(const Type& _rType) - { - // possible types we can write (either because we recognize them directly or because we convert _rValue - // into one of these types) - static const ::rtl::OUString s_sTypeBoolean (RTL_CONSTASCII_USTRINGPARAM("boolean")); - static const ::rtl::OUString s_sTypeShort (RTL_CONSTASCII_USTRINGPARAM("short")); - static const ::rtl::OUString s_sTypeInteger (RTL_CONSTASCII_USTRINGPARAM("int")); - static const ::rtl::OUString s_sTypeLong (RTL_CONSTASCII_USTRINGPARAM("long")); - static const ::rtl::OUString s_sTypeDouble (RTL_CONSTASCII_USTRINGPARAM("double")); - static const ::rtl::OUString s_sTypeString (RTL_CONSTASCII_USTRINGPARAM("string")); - - // handle the type description - switch (_rType.getTypeClass()) - { - case TypeClass_STRING: - return s_sTypeString; - case TypeClass_DOUBLE: - return s_sTypeDouble; - case TypeClass_BOOLEAN: - return s_sTypeBoolean; - case TypeClass_BYTE: - case TypeClass_SHORT: - return s_sTypeShort; - case TypeClass_LONG: - return s_sTypeInteger; - case TypeClass_HYPER: - return s_sTypeLong; - case TypeClass_ENUM: - return s_sTypeInteger; - - default: - return s_sTypeDouble; - } - } class OSpecialHanldeXMLExportPropertyMapper : public SvXMLExportPropertyMapper { @@ -1486,45 +1452,6 @@ sal_uInt32 ORptExport::exportDoc(enum ::xmloff::token::XMLTokenEnum eClass) return aBuffer.makeStringAndClear(); } // ----------------------------------------------------------------------------- -::rtl::OUString ORptExport::implConvertMeasure(sal_Int32 _nValue) -{ - ::rtl::OUStringBuffer aBuffer; - GetMM100UnitConverter().convertMeasure(aBuffer, _nValue); - return aBuffer.makeStringAndClear(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString ORptExport::implConvertAny(const Any& _rValue) -{ - ::rtl::OUStringBuffer aBuffer; - switch (_rValue.getValueTypeClass()) - { - case TypeClass_STRING: - { // extract the string - ::rtl::OUString sCurrentValue; - _rValue >>= sCurrentValue; - aBuffer.append(sCurrentValue); - } - break; - case TypeClass_DOUBLE: - // let the unit converter format is as string - GetMM100UnitConverter().convertDouble(aBuffer, getDouble(_rValue)); - break; - case TypeClass_BOOLEAN: - aBuffer = getBOOL(_rValue) ? ::xmloff::token::GetXMLToken(XML_TRUE) : ::xmloff::token::GetXMLToken(XML_FALSE); - break; - case TypeClass_BYTE: - case TypeClass_SHORT: - case TypeClass_LONG: - // let the unit converter format is as string - GetMM100UnitConverter().convertNumber(aBuffer, getINT32(_rValue)); - break; - default: - OSL_ENSURE(0,"ORptExport::implConvertAny: Invalid type"); - } - - return aBuffer.makeStringAndClear(); -} -// ----------------------------------------------------------------------------- UniReference < XMLPropertySetMapper > ORptExport::GetCellStylePropertyMapper() const { return m_xCellStylesPropertySetMapper; diff --git a/reportdesign/source/filter/xml/xmlExport.hxx b/reportdesign/source/filter/xml/xmlExport.hxx index 0054f9d7f..048f9c9c3 100644 --- a/reportdesign/source/filter/xml/xmlExport.hxx +++ b/reportdesign/source/filter/xml/xmlExport.hxx @@ -177,9 +177,7 @@ private: void exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups); ::rtl::OUString convertFormula(const ::rtl::OUString& _sFormula); - ::rtl::OUString implConvertAny(const Any& _rValue); ::rtl::OUString implConvertNumber(sal_Int32 _nValue); - ::rtl::OUString implConvertMeasure(sal_Int32 _nValue); private: ORptExport(); diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index f733f2036..b36df8702 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -160,9 +160,11 @@ namespace rptui */ void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); +#if 0 /** checks if alignment is possible in the current section */ sal_Bool isAlignPossible() const; +#endif /** All objects will be marked. */ diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx index b35cc04bb..95f8c4827 100644 --- a/reportdesign/source/ui/inc/ReportWindow.hxx +++ b/reportdesign/source/ui/inc/ReportWindow.hxx @@ -93,7 +93,6 @@ namespace rptui rtl::OUString GetInsertObjString() const; void setGridSnap(BOOL bOn); void setDragStripes(BOOL bOn); - BOOL isDragStripes() const; /** copies the current selection in this section */ diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx index 7cd79d67e..bab09947f 100644 --- a/reportdesign/source/ui/inc/ScrollHelper.hxx +++ b/reportdesign/source/ui/inc/ScrollHelper.hxx @@ -106,7 +106,6 @@ namespace rptui rtl::OUString GetInsertObjString() const; void setGridSnap(BOOL bOn); void setDragStripes(BOOL bOn); - BOOL isDragStripes() const; /** copies the current selection in this section */ void Copy(); diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx index 65e1f560b..f48af8e93 100644 --- a/reportdesign/source/ui/inc/StartMarker.hxx +++ b/reportdesign/source/ui/inc/StartMarker.hxx @@ -76,10 +76,6 @@ namespace rptui void setTitle(const String& _sTitle); sal_Int32 getMinHeight() const; - /** returns the offset where the horizontal ruler must start - */ - sal_Int32 getRulerOffset() const; - /** shows or hides the ruler. */ void showRuler(sal_Bool _bShow); diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx index 156ed2ad4..72c904265 100644 --- a/reportdesign/source/ui/inc/ViewsWindow.hxx +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -203,8 +203,6 @@ namespace rptui */ ::boost::shared_ptr getSectionWindow(const USHORT _nPos) const; - void showView(USHORT _nPos,BOOL _bShow); - /** turns the grid on or off * * \param _bVisible @@ -212,7 +210,6 @@ namespace rptui void toggleGrid(sal_Bool _bVisible); void setGridSnap(BOOL bOn); void setDragStripes(BOOL bOn); - BOOL isDragStripes() const; /** returns the total accumulated height of all sections until _pSection is reached */ @@ -249,8 +246,6 @@ namespace rptui */ BOOL HasSelection(); - void SectionHasFocus(OReportSection* _pSection,BOOL _bHasFocus); - /** unmark all objects on the views without the given one. * * @param _pSectionView The view where the objects should not be unmarked. diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 548c01128..aceb5eeb8 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -680,12 +680,14 @@ void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlig { m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); } +#if 0 // ----------------------------------------------------------------------------- sal_Bool ODesignView::isAlignPossible() const { ::boost::shared_ptr pMarkedSection = getMarkedSection(); return pMarkedSection.get() && pMarkedSection->getReportSection().getSectionView().IsAlignPossible(); } +#endif //------------------------------------------------------------------------------ sal_Bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) { diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 6cd1b418e..93843c589 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -378,11 +378,6 @@ void OReportWindow::setDragStripes(BOOL bOn) m_aViewsWindow.setDragStripes(bOn); } // ----------------------------------------------------------------------------- -BOOL OReportWindow::isDragStripes() const -{ - return m_aViewsWindow.isDragStripes(); -} -// ----------------------------------------------------------------------------- sal_uInt32 OReportWindow::getMarkedObjectCount() const { return m_aViewsWindow.getMarkedObjectCount(); diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index 292f7d182..832fcc009 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -393,11 +393,6 @@ void OScrollWindowHelper::setDragStripes(BOOL bOn) m_aReportWindow.setDragStripes(bOn); } // ----------------------------------------------------------------------------- -BOOL OScrollWindowHelper::isDragStripes() const -{ - return m_aReportWindow.isDragStripes(); -} -// ----------------------------------------------------------------------------- sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const { return m_aReportWindow.getMarkedObjectCount(); diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index de583cf0c..3f0adcf04 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -285,12 +285,6 @@ void OStartMarker::showRuler(sal_Bool _bShow) m_bShowRuler = _bShow; m_aVRuler.Show(!m_bCollapsed && m_bShowRuler); } -//------------------------------------------------------------------------------ -sal_Int32 OStartMarker::getRulerOffset() const -{ - return m_aVRuler.GetSizePixel().Width(); -} - //------------------------------------------------------------------------------ void OStartMarker::RequestHelp( const HelpEvent& rHEvt ) { diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 2369dc472..5bb3f333e 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -337,12 +337,6 @@ void OViewsWindow::removeSection(USHORT _nPosition) Resize(); } // if ( _nPosition < m_aSections.size() ) } -//---------------------------------------------------------------------------- -void OViewsWindow::showView(USHORT _nPos,BOOL _bShow) -{ - if ( _nPos < m_aSections.size() ) - m_aSections[_nPos]->setCollapsed(_bShow); -} //------------------------------------------------------------------------------ void OViewsWindow::toggleGrid(BOOL _bVisible) { @@ -534,21 +528,6 @@ void OViewsWindow::SelectAll(const sal_uInt16 _nObjectType) ::std::compose1(::boost::bind(::boost::mem_fn(&OReportSection::SelectAll),_1,_nObjectType),TReportPairHelper())); m_bInUnmark = sal_False; } -//---------------------------------------------------------------------------- -void OViewsWindow::SectionHasFocus(OReportSection* /*_pSection*/,BOOL /*_bHasFocus*/) -{ -/* LLA!: this function does nothing! -TSectionsMap::iterator aIter = m_aSections.begin(); - TSectionsMap::iterator aEnd = m_aSections.end(); - for (USHORT i = 0 ; aIter != aEnd ; ++aIter,++i) - { - if ( (*aIter).first.get() == _pSection ) - { - - } - } -*/ -} //----------------------------------------------------------------------------- void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView) { @@ -987,12 +966,6 @@ void OViewsWindow::setDragStripes(BOOL bOn) (*aIter)->getReportSection().getSectionView().SetDragStripes(bOn); } // ----------------------------------------------------------------------------- -BOOL OViewsWindow::isDragStripes() const -{ - return !m_aSections.empty() && (*m_aSections.begin())->getReportSection().getSectionView().IsDragStripes(); -} -// ----------------------------------------------------------------------------- - USHORT OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) const { TSectionsMap::const_iterator aIter = m_aSections.begin(); -- cgit v1.2.3 From d2c74fd936038195b387b21a5abb35d2e44f970d Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 18 Nov 2009 13:06:25 +0100 Subject: dba33d: #i97096# use column label when given --- dbaccess/source/core/api/RowSet.cxx | 18 ++++++++------- .../source/core/api/SingleSelectQueryComposer.cxx | 27 +++++++++++----------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index b13f65be5..55d6cd7ac 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1986,15 +1986,17 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi for(sal_Int32 i=1; i <= nCount ;++i) { ::rtl::OUString sName = xMeta->getColumnName(i); + ::rtl::OUString sColumnLabel = xMeta->getColumnLabel(i); // retrieve the column number |i| Reference xColumn; { sal_Bool bReFetchName = sal_False; - if (m_xColumns->hasByName(sName)) + if (m_xColumns->hasByName(sColumnLabel)) + m_xColumns->getByName(sColumnLabel) >>= xColumn; + if (!xColumn.is() && m_xColumns->hasByName(sName)) m_xColumns->getByName(sName) >>= xColumn; - if (!xColumn.is() && m_xColumns->hasByName(xMeta->getColumnLabel(i))) - m_xColumns->getByName(xMeta->getColumnLabel(i)) >>= xColumn; + // check if column already in the list we need another if ( aAllColumns.find( xColumn ) != aAllColumns.end() ) { @@ -2035,16 +2037,16 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi aDescription, m_aCurrentRow); aColumns->get().push_back(pColumn); - if(!sName.getLength()) + if(!sColumnLabel.getLength()) { if(xColumn.is()) - xColumn->getPropertyValue(PROPERTY_NAME) >>= sName; + xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel; else - sName = ::rtl::OUString::createFromAscii("Expression1"); + sColumnLabel = ::rtl::OUString::createFromAscii("Expression1"); // TODO: resource } - pColumn->setName(sName); - aNames.push_back(sName); + pColumn->setName(sColumnLabel); + aNames.push_back(sColumnLabel); m_aDataColumns.push_back(pColumn); if ( xColumn.is() ) diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 2fa2684e6..79c82b211 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -750,9 +750,10 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr OSL_ENSURE( (size_t) nCount == aSelectColumns->get().size(), "OSingleSelectQueryComposer::getColumns: inconsistent column counts, this might result in wrong columns!" ); for(sal_Int32 i=1;i<=nCount;++i) { - ::rtl::OUString sName = xResultSetMeta->getColumnName(i); + ::rtl::OUString sColumnName = xResultSetMeta->getColumnName(i); + ::rtl::OUString sColumnLabel = xResultSetMeta->getColumnLabel(i); sal_Bool bFound = sal_False; - OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),sName,aCaseCompare); + OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),sColumnLabel,aCaseCompare); size_t nFoundSelectColumnPos = aFind - aSelectColumns->get().begin(); if ( aFind != aSelectColumns->get().end() ) { @@ -761,7 +762,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr // so we start after the first found do { - aFind = ::connectivity::findRealName(++aFind,aSelectColumns->get().end(),sName,aCaseCompare); + aFind = ::connectivity::findRealName(++aFind,aSelectColumns->get().end(),sColumnName,aCaseCompare); nFoundSelectColumnPos = aFind - aSelectColumns->get().begin(); } while ( ( aUsedSelectColumns.find( nFoundSelectColumnPos ) != aUsedSelectColumns.end() ) @@ -770,9 +771,9 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr } if ( aFind != aSelectColumns->get().end() ) { - (*aFind)->getPropertyValue(PROPERTY_NAME) >>= sName; + (*aFind)->getPropertyValue(PROPERTY_NAME) >>= sColumnName; aUsedSelectColumns.insert( nFoundSelectColumnPos ); - aNames.push_back(sName); + aNames.push_back(sColumnName); bFound = sal_True; } } @@ -781,7 +782,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr continue; OSQLColumns::Vector::const_iterator aRealFind = ::connectivity::findRealName( - aSelectColumns->get().begin(), aSelectColumns->get().end(), sName, aCaseCompare ); + aSelectColumns->get().begin(), aSelectColumns->get().end(), sColumnName, aCaseCompare ); if ( i > static_cast< sal_Int32>( aSelectColumns->get().size() ) ) { @@ -806,19 +807,19 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr ::rtl::OUString sRealName; xProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName; ::std::vector< ::rtl::OUString>::iterator aFindName; - if ( !sName.getLength() ) - xProp->getPropertyValue(PROPERTY_NAME) >>= sName; + if ( !sColumnName.getLength() ) + xProp->getPropertyValue(PROPERTY_NAME) >>= sColumnName; - aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sName)); + aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName)); sal_Int32 j = 0; while ( aFindName != aNames.end() ) { - sName += ::rtl::OUString::valueOf(++j); - aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sName)); + sColumnName += ::rtl::OUString::valueOf(++j); + aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName)); } - pColumn->setName(sName); + pColumn->setName(sColumnName); pColumn->setRealName(sRealName); pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME))); @@ -828,7 +829,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr continue; aUsedSelectColumns.insert( (size_t)(i - 1) ); - aNames.push_back( sName ); + aNames.push_back( sColumnName ); } } catch(const Exception&) -- cgit v1.2.3 From 0dc46ce4f50995df65c065a063cdbdcd8163808f Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 18 Nov 2009 13:15:51 +0100 Subject: dba33d: #i106998# check if entzry is null --- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 848ea0aaf..4d625b21f 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -658,6 +658,8 @@ void OAppDetailPageHelper::paste() // ----------------------------------------------------------------------------- bool OAppDetailPageHelper::isLeaf(SvLBoxEntry* _pEntry) const { + if ( !_pEntry ) + return false; sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() ); if ( ( nEntryType == DatabaseObjectContainer::TABLES ) || ( nEntryType == DatabaseObjectContainer::CATALOG ) -- cgit v1.2.3 From 1bdd86b60f85462bd20aeff90664ec923048be8b Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 18 Nov 2009 15:49:50 +0100 Subject: dba33d: #i105101# get table filter and type filter from ds when it is needed --- dbaccess/source/core/dataaccess/connection.cxx | 13 +++++++++++++ dbaccess/source/core/dataaccess/connection.hxx | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 4eded6a82..50fbb2a4f 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -600,6 +600,17 @@ Reference< XSQLQueryComposer > OConnection::createQueryComposer(void) throw( Ru m_aComposers.push_back(WeakReferenceHelper(xComposer)); return xComposer; } +// ----------------------------------------------------------------------------- +void OConnection::impl_fillTableFilter() +{ + Reference xProp(getParent(),UNO_QUERY); + if ( xProp.is() ) + { + xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= m_aTableFilter; + xProp->getPropertyValue(PROPERTY_TABLETYPEFILTER) >>= m_aTableTypeFilter; + } +} + // ----------------------------------------------------------------------------- void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { @@ -608,6 +619,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { if (!m_pTables->isInitialized()) { + impl_fillTableFilter(); // check if our "master connection" can supply tables getMasterTables(); @@ -625,6 +637,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { if (!m_pViews->isInitialized()) { + impl_fillTableFilter(); // check if our "master connection" can supply tables Reference< XViewsSupplier > xMaster(getMasterTables(),UNO_QUERY); diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx index e31674bee..66225cf5a 100644 --- a/dbaccess/source/core/dataaccess/connection.hxx +++ b/dbaccess/source/core/dataaccess/connection.hxx @@ -276,6 +276,10 @@ private: m_xConnectionTools is nol */ void impl_loadConnectionTools_throw(); + + /** reads the table filter and table type filter from the datasourfce + */ + void impl_fillTableFilter(); }; //........................................................................ -- cgit v1.2.3 From 6599108defdcce5d4633f28e6edc7a9a2ca131e1 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 19 Nov 2009 13:25:39 +0100 Subject: dba33d: #i104844# check name and do not close when name is wrong --- .../source/core/dataaccess/documentcontainer.cxx | 28 ++++++++++++++++------ dbaccess/source/core/inc/core_resource.hrc | 1 + dbaccess/source/core/resource/strings.src | 5 +++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 2aaddb3b4..aec3be2c9 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -380,9 +380,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments ::rtl::OUString sServiceName; if ( Reference< XNameAccess >( xObjectToCopy, UNO_QUERY ).is() ) + { if ( m_bFormsContainer ) sServiceName = SERVICE_NAME_FORM_COLLECTION; - else sServiceName = SERVICE_NAME_REPORT_COLLECTION; + else + sServiceName = SERVICE_NAME_REPORT_COLLECTION; + } else sServiceName = SERVICE_SDB_DOCUMENTDEFINITION; @@ -503,7 +506,7 @@ namespace if ( bRet ) { _rRet = _xNameContainer->getByName(_sSimpleName = sName); - while ( nIndex != -1 ) + while ( nIndex != -1 && bRet ) { sName = _sName.getToken(0,'/',nIndex); _xNameContainer.set(_rRet,UNO_QUERY); @@ -517,8 +520,10 @@ namespace } } } - else if ( nIndex == -1 ) - _sSimpleName = sName; // a content on the root content + if ( nIndex == -1 ) + _sSimpleName = sName; // a content + else + _xNameContainer.clear(); // a sub folder doesn't exist return bRet; } } @@ -610,15 +615,24 @@ sal_Bool SAL_CALL ODocumentContainer::hasByHierarchicalName( const ::rtl::OUStri // XHierarchicalNameContainer void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUString& _sName, const Any& _aElement ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) { + Reference< XContent > xContent(_aElement,UNO_QUERY); + if ( !xContent.is() ) + throw IllegalArgumentException(); + ClearableMutexGuard aGuard(m_aMutex); Any aContent; Reference< XNameContainer > xNameContainer(this); ::rtl::OUString sName; if ( lcl_queryContent(_sName,xNameContainer,aContent,sName) ) throw ElementExistException(_sName,*this); - Reference< XContent > xContent(_aElement,UNO_QUERY); - if ( !xContent.is() ) - throw IllegalArgumentException(); + + if ( !xNameContainer.is() ) + { + ::rtl::OUString sMessage( DBA_RES( RID_STR_NO_SUB_FOLDER ) ); + sal_Int32 index = sName.getLength(); + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$folder$", _sName.getToken(0,'/',index) ); + throw IllegalArgumentException( sMessage, *this, 1 ); + } xNameContainer->insertByName(sName,_aElement); } diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 39814c63b..0cb9727e0 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -89,6 +89,7 @@ #define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 ) #define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 ) #define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) +#define RID_STR_NO_SUB_FOLDER ( RID_CORE_STRINGS_START + 48 ) #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index 2d14b2784..9ee86de3c 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -245,5 +245,8 @@ String RID_STR_ERROR_WHILE_SAVING { Text [ en-US ] = "Could not save the document:\n\n$except$:\n$message$"; }; - +String RID_STR_NO_SUB_FOLDER +{ + Text [ en-US ] = "There exists no folder named \"$folder$\"."; +}; //------------------------------------------------------------------------- -- cgit v1.2.3 From 12df8633596a00e856e21d22dc1bcae49ed5c47c Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 23 Nov 2009 10:33:17 +0100 Subject: dba33d: #i107104# error in where <> having --- .../source/ui/querydesign/SelectionBrowseBox.cxx | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 3d59903e3..7e2f34c95 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1807,25 +1807,23 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt pEntry->GetFunctionType() == rInfo->GetFunctionType() && pEntry->GetFunction() == rInfo->GetFunction()) { - /*sal_uInt32 nPos = aIter - rFields.begin(); - bAppend = _nCurrentPos > nPos && (rInfo->IsGroupBy() != pEntry->IsGroupBy()); - if ( bAppend ) + if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) + { + pEntry->SetGroupBy(sal_False); aIter = rFields.end(); - else*/ + break; + } + else { - if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) - { - pEntry->SetGroupBy(sal_False); - aIter = rFields.end(); - } - else + if ( !pEntry->IsGroupBy() && !pEntry->HasCriteria() ) // here we have a where condition which is no having clause { pEntry->SetGroupBy(rInfo->IsGroupBy()); if(!m_bGroupByUnRelated && pEntry->IsGroupBy()) pEntry->SetVisible(sal_True); + break; } } - break; + } } @@ -1887,13 +1885,14 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S if (bCase(aField,rInfo->GetField()) && bCase(aAlias,rInfo->GetAlias()) && pEntry->GetFunctionType() == rInfo->GetFunctionType() && - pEntry->GetFunction() == rInfo->GetFunction()) + pEntry->GetFunction() == rInfo->GetFunction() && + pEntry->IsGroupBy() == rInfo->IsGroupBy() ) { if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) pEntry->SetGroupBy(sal_False); else { - pEntry->SetGroupBy(rInfo->IsGroupBy()); +// pEntry->SetGroupBy(rInfo->IsGroupBy()); if(!m_bGroupByUnRelated && pEntry->IsGroupBy()) pEntry->SetVisible(sal_True); } -- cgit v1.2.3 From e7a3bdd533277761077e07734adb225a19c7b62e Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 25 Nov 2009 10:12:45 +0100 Subject: dba33d: #i104712# qurtal expression fixed --- reportdesign/source/filter/xml/xmlExport.cxx | 16 ++++++++++++---- reportdesign/source/filter/xml/xmlGroup.cxx | 10 ++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index cad93ae72..c92c1c20a 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1587,6 +1587,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG uno::Reference< XFunction> xFunction = xFunctions->createFunction(); ::rtl::OUString sFunction,sPrefix,sPostfix; ::rtl::OUString sExpression = xGroup->getExpression(); + ::rtl::OUString sFunctionName; switch(nGroupOn) { case report::GroupOn::PREFIX_CHARACTERS: @@ -1597,8 +1598,9 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YEAR")); break; case report::GroupOn::QUARTAL: - sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MONTH")); - sPostfix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/4")); + sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT((MONTH")); + sPostfix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-1)/3)+1")); + sFunctionName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUARTAL_")) + sExpression; break; case report::GroupOn::MONTH: sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MONTH")); @@ -1626,15 +1628,21 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG exportFunction(xCountFunction); sExpression = sCountName; sPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" / ")) + ::rtl::OUString::valueOf(xGroup->getGroupInterval()); + sFunctionName = sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression; } break; default: ; } + if ( !sFunctionName.getLength() ) + sFunctionName = sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression; if ( sFunction.getLength() ) { - - xFunction->setName(sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression); + sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'}; + for(sal_Int32 i= 0; i < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++i) + sFunctionName = sFunctionName.replace(pReplaceChars[i],'_'); + + xFunction->setName(sFunctionName); sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFunction; sFunction += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("([")); sFunction += sExpression; diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index c14c689b3..d394b65e5 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -140,10 +140,12 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport nGroupOn = report::GroupOn::YEAR; else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH"))) { - if ( sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("\4",2) ) - nGroupOn = report::GroupOn::QUARTAL; - else - nGroupOn = report::GroupOn::MONTH; + nGroupOn = report::GroupOn::MONTH; + } + else if ( sCompleteFormula.matchAsciiL("rpt:INT((MONTH",sizeof("rpt:INT((MONTH"),0) + && sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("-1)/3)+1",sizeof("-1)/3)+1")) ) + { + nGroupOn = report::GroupOn::QUARTAL; } else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:WEEK"))) nGroupOn = report::GroupOn::WEEK; -- cgit v1.2.3 From 23912d182b137e119350f735801f087819301af9 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 25 Nov 2009 13:48:21 +0100 Subject: dba33d: #i104869# use the interaction handler to delegate UI --- dbaccess/qa/complex/dbaccess/dbaccess.sce | 2 +- dbaccess/source/ui/inc/WCopyTable.hxx | 40 ++---------- dbaccess/source/ui/inc/dbu_misc.hrc | 4 +- dbaccess/source/ui/inc/dbu_resource.hrc | 4 +- dbaccess/source/ui/misc/WCPage.cxx | 17 ++--- dbaccess/source/ui/misc/WColumnSelect.cxx | 1 + dbaccess/source/ui/misc/WCopyTable.cxx | 101 +++++++++++++++++++++-------- dbaccess/source/ui/misc/WTypeSelect.cxx | 2 +- dbaccess/source/ui/misc/WizardPages.src | 10 ++- dbaccess/source/ui/uno/copytablewizard.cxx | 3 +- 10 files changed, 104 insertions(+), 80 deletions(-) diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce index 47387e459..c5fa408ff 100644 --- a/dbaccess/qa/complex/dbaccess/dbaccess.sce +++ b/dbaccess/qa/complex/dbaccess/dbaccess.sce @@ -7,6 +7,6 @@ -o complex.dbaccess.DataSource -o complex.dbaccess.Parser -o complex.dbaccess.ApplicationController -#-o complex.dbaccess.CopyTableWizard +-o complex.dbaccess.CopyTableWizard -o complex.dbaccess.UISettings -o complex.dbaccess.Beamer diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index c8ede1184..bdf989bb2 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -31,55 +31,23 @@ #ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX #define DBAUI_WIZ_COPYTABLEDIALOG_HXX -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include -#endif -#ifndef _COMPHELPER_STLTYPES_HXX_ #include -#endif -#ifndef DBAUI_TYPEINFO_HXX #include "TypeInfo.hxx" -#endif -#ifndef _SV_BUTTON_HXX #include -#endif -#ifndef _SVT_WIZDLG_HXX #include -#endif -#ifndef DBAUI_DATABASEEXPORT_HXX #include "DExport.hxx" -#endif -#ifndef DBAUI_WIZ_TABBPAGE_HXX #include "WTabPage.hxx" -#endif -#ifndef DBAUI_FIELDDESCRIPTIONS_HXX #include "FieldDescriptions.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include -#endif -#ifndef _SV_LSTBOX_HXX +#include #include -#endif - #include namespace dbaui @@ -299,6 +267,7 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_xInteractionHandler; String m_sTypeNames; // these type names are the ones out of the resource file sal_uInt32 m_nPageCount; @@ -343,7 +312,8 @@ namespace dbaui const ICopyTableSourceObject& _rSourceObject, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xSourceConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler>& _xInteractionHandler ); // used for importing rtf/html sources @@ -445,6 +415,8 @@ namespace dbaui void showColumnTypeNotSupported(const ::rtl::OUString& _rColumnName); void removeColumnNameFromNameMap(const ::rtl::OUString& _sName); + void showError(const ::rtl::OUString& _sErrorMesage); + void showError(const ::com::sun::star::uno::Any& _aError); }; } diff --git a/dbaccess/source/ui/inc/dbu_misc.hrc b/dbaccess/source/ui/inc/dbu_misc.hrc index 8cd9b5a74..db07e041f 100644 --- a/dbaccess/source/ui/inc/dbu_misc.hrc +++ b/dbaccess/source/ui/inc/dbu_misc.hrc @@ -50,10 +50,12 @@ #define STR_FILE_DOES_NOT_EXIST RID_STR_MISC_START + 13 #define STR_WARNINGS_DURING_CONNECT RID_STR_MISC_START + 14 #define STR_NAMED_OBJECT_ALREADY_EXISTS RID_STR_MISC_START + 15 +#define STR_INVALID_TABLE_NAME RID_STR_MISC_START + 16 +#define STR_INVALID_TABLE_NAME_LENGTH RID_STR_MISC_START + 17 // please adjust checking before insert new strings -#if STR_NAMED_OBJECT_ALREADY_EXISTS > RID_STR_MISC_END +#if STR_INVALID_TABLE_NAME_LENGTH > RID_STR_MISC_END #error Resource-Id Ueberlauf in #file, #line #endif diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index de4492e9f..dfb1a11a6 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -182,13 +182,13 @@ // error boxes #define ERR_NOREGISTEREDDATASOURCES RID_ERRORBOX_START + 0 -#define ERROR_INVALID_TABLE_NAME_LENGTH RID_ERRORBOX_START + 1 +// free #define ERR_QRY_CRITERIA_ON_ASTERISK RID_ERRORBOX_START + 2 #define ERR_QRY_ORDERBY_ON_ASTERISK RID_ERRORBOX_START + 3 #define ERR_QRY_AMB_FIELD RID_ERRORBOX_START + 4 // FREE #define ERR_INVALID_LISTBOX_ENTRY RID_ERRORBOX_START + 6 -#define ERROR_INVALID_TABLE_NAME RID_ERRORBOX_START + 7 +// FREE #define ERR_NEED_INDEX_FIELDS RID_ERRORBOX_START + 8 #define ERR_QRY_NOSTATEMENT RID_ERRORBOX_START + 9 #define ERR_QRY_NOCRITERIA RID_ERRORBOX_START + 10 diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index a907c331a..4f82e90bf 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -227,7 +227,8 @@ sal_Bool OCopyTable::LeavePage() if ( !aNameCheck.isNameValid( m_edTableName.GetText(), aErrorInfo ) ) { aErrorInfo.append( SQLExceptionInfo::SQL_CONTEXT, String( ModuleRes( STR_SUGGEST_APPEND_TABLE_DATA ) ) ); - ::dbaui::showError( aErrorInfo, m_pParent, m_pParent->m_xFactory ); + m_pParent->showError(aErrorInfo.get()); + return sal_False; } @@ -245,7 +246,8 @@ sal_Bool OCopyTable::LeavePage() sal_Int32 nMaxLength = xMeta->getMaxTableNameLength(); if ( nMaxLength && sTable.getLength() > nMaxLength ) { - ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME_LENGTH)).Execute(); + String sError(ModuleRes(STR_INVALID_TABLE_NAME_LENGTH)); + m_pParent->showError(sError); return sal_False; } @@ -256,8 +258,7 @@ sal_Bool OCopyTable::LeavePage() String aInfoString( ModuleRes(STR_WIZ_PKEY_ALREADY_DEFINED) ); aInfoString += String(' '); aInfoString += String(m_pParent->m_aKeyName); - InfoBox aNameInfoBox( this, aInfoString ); - aNameInfoBox.Execute(); + m_pParent->showError(aInfoString); return sal_False; } } @@ -288,7 +289,8 @@ sal_Bool OCopyTable::LeavePage() if(!m_pParent->m_sName.getLength()) { - ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME)).Execute(); + String sError(ModuleRes(STR_INVALID_TABLE_NAME)); + m_pParent->showError(sError); return sal_False; } @@ -367,9 +369,8 @@ sal_Bool OCopyTable::checkAppendData() if ( !xTable.is() ) { - ErrorBox( this, ModuleRes( ERROR_INVALID_TABLE_NAME ) ).Execute(); - // TODO: shouldn't this be some kind of showError? In case of the UNO service for this wizard, - // shouldn't this even be a usage of the service's interaction handler? + String sError(ModuleRes(STR_INVALID_TABLE_NAME)); + m_pParent->showError(sError); return sal_False; } return sal_True; diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index c1c15328b..7fb212687 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -140,6 +140,7 @@ void OWizColumnSelect::Reset() clearListBox(m_lbOrgColumnNames); clearListBox(m_lbNewColumnNames); + m_pParent->m_mNameMapping.clear(); // insert the source columns in the left listbox const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector(); diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 9196fc9f0..8348c4520 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -46,6 +46,7 @@ /** === begin UNO includes === **/ #include +#include #include #include #include @@ -62,8 +63,10 @@ #include #include +#include #include #include +#include #include #include @@ -80,9 +83,12 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::task; +using namespace dbtools; namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation; @@ -566,7 +572,8 @@ namespace //------------------------------------------------------------------------ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rDefaultName, sal_Int16 _nOperation, const ICopyTableSourceObject& _rSourceObject, const Reference< XConnection >& _xSourceConnection, - const Reference< XConnection >& _xConnection, const Reference< XMultiServiceFactory >& _rxORB ) + const Reference< XConnection >& _xConnection, const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XInteractionHandler>& _xInteractionHandler) : WizardDialog( pParent, ModuleRes(WIZ_RTFCOPYTABLE)) ,m_pbHelp( this , ModuleRes(PB_HELP)) ,m_pbCancel( this , ModuleRes(PB_CANCEL)) @@ -578,6 +585,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD ,m_rSourceObject( _rSourceObject ) ,m_xFormatter( getNumberFormatter( _xConnection, _rxORB ) ) ,m_xFactory(_rxORB) + ,m_xInteractionHandler(_xInteractionHandler) ,m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES)) ,m_nPageCount(0) ,m_bDeleteSourceColumns(sal_True) @@ -924,6 +932,7 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG ) OWizTypeSelect* pPage = static_cast(GetPage(3)); if ( pPage ) { + m_mNameMapping.clear(); pPage->setDisplayRow(nBreakPos); ShowPage(3); return 0; @@ -935,33 +944,37 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG ) { ODatabaseExport::TColumns::iterator aFind = ::std::find_if(m_vDestColumns.begin(),m_vDestColumns.end() ,::std::compose1(::std::mem_fun(&OFieldDescription::IsPrimaryKey),::std::select2nd())); - if ( aFind == m_vDestColumns.end() ) + if ( aFind == m_vDestColumns.end() && m_xInteractionHandler.is() ) { + String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD)); String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY)); - OSQLMessageBox aBox(this, sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES); - - INT16 nReturn = aBox.Execute(); - - switch(nReturn ) + SQLContext aError; + aError.Message = sMsg; + ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) ); + ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove; + xRequest->addContinuation( xYes.get() ); + xRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); + ::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort; + xRequest->addContinuation( xAbort.get() ); + + m_xInteractionHandler->handle( xRequest.get() ); + + if ( xYes->wasSelected() ) { - case RET_YES: - { - OCopyTable* pPage = static_cast(GetPage(0)); - m_bCreatePrimaryKeyColumn = sal_True; - m_aKeyName = pPage->GetKeyName(); - if ( !m_aKeyName.getLength() ) - m_aKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) ); - m_aKeyName = createUniqueName( m_aKeyName ); - sal_Int32 nBreakPos2 = 0; - CheckColumns(nBreakPos2); - break; - } - case RET_CANCEL: - ShowPage(3); - return 0; - default: - ; + OCopyTable* pPage = static_cast(GetPage(0)); + m_bCreatePrimaryKeyColumn = sal_True; + m_aKeyName = pPage->GetKeyName(); + if ( !m_aKeyName.getLength() ) + m_aKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) ); + m_aKeyName = createUniqueName( m_aKeyName ); + sal_Int32 nBreakPos2 = 0; + CheckColumns(nBreakPos2); + } + else if ( xAbort->wasSelected() ) + { + ShowPage(3); + return 0; } } } @@ -1601,6 +1614,22 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& if ( supportsType(DataType::CLOB,nDefaultType) ) break; break; + case DataType::BINARY: + if ( supportsType(DataType::VARBINARY,nDefaultType) ) + break; + break; + case DataType::VARBINARY: + if ( supportsType(DataType::LONGVARBINARY,nDefaultType) ) + break; + break; + case DataType::LONGVARBINARY: + if ( supportsType(DataType::BLOB,nDefaultType) ) + break; + if ( supportsType(DataType::LONGVARCHAR,nDefaultType) ) + break; + if ( supportsType(DataType::CLOB,nDefaultType) ) + break; + break; default: nDefaultType = DataType::VARCHAR; } @@ -1646,7 +1675,27 @@ void OCopyTableWizard::showColumnTypeNotSupported(const ::rtl::OUString& _rColum RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::showColumnTypeNotSupported" ); String sMessage( ModuleRes( STR_UNKNOWN_TYPE_FOUND ) ); sMessage.SearchAndReplaceAscii("#1",_rColumnName); - - OSQLWarningBox( this, sMessage ).Execute(); + showError(sMessage); } //------------------------------------------------------------------------------- +void OCopyTableWizard::showError(const ::rtl::OUString& _sErrorMesage) +{ + SQLExceptionInfo aInfo(_sErrorMesage); + showError(aInfo.get()); +} +//------------------------------------------------------------------------------- +void OCopyTableWizard::showError(const Any& _aError) +{ + if ( _aError.hasValue() && m_xInteractionHandler.is() ) + { + try + { + ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( _aError ) ); + m_xInteractionHandler->handle( xRequest.get() ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } +} \ No newline at end of file diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 45cf651ac..a31438519 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -178,7 +178,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) { String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME)); strMessage.SearchAndReplaceAscii("$column$", sNewName); - OSQLWarningBox( this, strMessage ).Execute(); + pWiz->showError(strMessage); pCurFieldDescr->SetName(sName); DisplayData(pCurFieldDescr); static_cast(GetParent())->setDuplicateName(sal_True); diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src index dbcfeee92..0e35954c1 100644 --- a/dbaccess/source/ui/misc/WizardPages.src +++ b/dbaccess/source/ui/misc/WizardPages.src @@ -552,20 +552,18 @@ String STR_COPYTABLE_TITLE_COPY Text [ en-US ] = "Copy table" ; }; -ErrorBox ERROR_INVALID_TABLE_NAME +String STR_INVALID_TABLE_NAME { - Buttons = WB_OK; - Message [ en-US ] = "This table name is not valid in the current database."; + Text [ en-US ] = "This table name is not valid in the current database."; }; String STR_SUGGEST_APPEND_TABLE_DATA { Text [ en-US ] = "Choose the option 'Append data' on the first page to append data to an existing table."; }; -ErrorBox ERROR_INVALID_TABLE_NAME_LENGTH +String STR_INVALID_TABLE_NAME_LENGTH { - Buttons = WB_OK; - Message [ en-US ] = "Please change the table name. It is too long."; + Text [ en-US ] = "Please change the table name. It is too long."; }; Image IMG_SORTUP_H diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index e391f2394..73e5a9c5a 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1578,7 +1578,8 @@ Dialog* CopyTableWizard::createDialog( Window* _pParent ) *m_pSourceObject, m_xSourceConnection.getTyped(), m_xDestConnection.getTyped(), - m_aContext.getLegacyServiceFactory() + m_aContext.getLegacyServiceFactory(), + m_xInteractionHandler ); impl_attributesToDialog_nothrow( *pWizard ); -- cgit v1.2.3 From b1cd271a62c9b04a1b090bcb6544c17eaea3b881 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 26 Nov 2009 12:56:23 +0100 Subject: dba33d: #i69262# allow functions to be grouped --- dbaccess/source/ui/inc/QueryDesignView.hxx | 4 + dbaccess/source/ui/inc/TableFieldDescription.hxx | 1 + dbaccess/source/ui/querydesign/QueryDesignView.cxx | 75 +++++++-------- .../source/ui/querydesign/SelectionBrowseBox.cxx | 102 ++++++++------------- .../ui/querydesign/TableFieldDescription.cxx | 44 +++++---- 5 files changed, 105 insertions(+), 121 deletions(-) diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 7f85b879a..4d2984b71 100644 --- a/dbaccess/source/ui/inc/QueryDesignView.hxx +++ b/dbaccess/source/ui/inc/QueryDesignView.hxx @@ -171,6 +171,10 @@ namespace dbaui const String& _sCriteria, ::rtl::OUString& _rsErrorMessage, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn) const; + + void fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode + ,const ::rtl::OUString& sFunctionTerm + ,OTableFieldDescRef& aInfo); protected: // return the Rectangle where I can paint myself virtual void resizeDocumentView(Rectangle& rRect); diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx index de7b16000..a23d6ac88 100644 --- a/dbaccess/source/ui/inc/TableFieldDescription.hxx +++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx @@ -83,6 +83,7 @@ namespace dbaui inline sal_Bool IsEmpty() const; + OTableFieldDesc& operator=( const OTableFieldDesc& _aField ); sal_Bool operator==( const OTableFieldDesc& rDesc ); sal_Bool IsVisible() const { return m_bVisible;} diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 9838c3298..57da1e2f6 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -186,11 +186,6 @@ namespace sal_Bool bHaving, bool _bAddOrOnOneLine); - void fillFunctionInfo( OQueryDesignView* _pView - ,const ::connectivity::OSQLParseNode* pNode - ,const ::rtl::OUString& sFunctionTerm - ,OTableFieldDescRef& aInfo); - //------------------------------------------------------------------------------ ::rtl::OUString quoteTableAlias(sal_Bool _bQuote, const ::rtl::OUString& _sAliasName, const ::rtl::OUString& _sQuote) { @@ -2262,35 +2257,6 @@ namespace return eErrorCode; } //------------------------------------------------------------------------------ - void fillFunctionInfo( OQueryDesignView* _pView - ,const ::connectivity::OSQLParseNode* pNode - ,const ::rtl::OUString& sFunctionTerm - ,OTableFieldDescRef& aInfo) - { - // get the type out of the funtion name - OQueryController& rController = static_cast(_pView->getController()); - sal_Int32 nDataType = DataType::DOUBLE; - ::rtl::OUString sFieldName = sFunctionTerm; - OSQLParseNode* pFunctionName = pNode->getChild(0); - if ( !SQL_ISPUNCTUATION(pFunctionName,"{") ) - { - if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) ) - pFunctionName = pFunctionName->getChild(0); - - ::rtl::OUString sFunctionName = pFunctionName->getTokenValue(); - if ( !sFunctionName.getLength() ) - sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8); - - nDataType = OSQLParser::getFunctionReturnType( - sFunctionName - ,&rController.getParser().getContext()); - } - aInfo->SetDataType(nDataType); - aInfo->SetFieldType(TAB_NORMAL_FIELD); - aInfo->SetField(sFieldName); - aInfo->SetTabWindow(NULL); - } - //------------------------------------------------------------------------------ SqlParseError InstallFields(OQueryDesignView* _pView, const ::connectivity::OSQLParseNode* pNode, OJoinTableView::OTableWindowMap* pTabList ) @@ -2298,7 +2264,7 @@ namespace if( pNode==0 || !SQL_ISRULE(pNode,select_statement)) return eNoSelectStatement; - ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2); + ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2); // selection sal_Bool bFirstField = sal_True; // bei der Initialisierung muß auf alle Faelle das erste Feld neu aktiviert werden SqlParseError eErrorCode = eOk; @@ -2329,9 +2295,6 @@ namespace if ( SQL_ISRULE(pColumnRef,derived_column) ) { - if ( !xConnection.is() ) - break; - ::rtl::OUString aColumnAlias(rController.getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein pColumnRef = pColumnRef->getChild(0); OTableFieldDescRef aInfo = new OTableFieldDesc(); @@ -2412,7 +2375,7 @@ namespace } else { - fillFunctionInfo(_pView,pColumnRef,aColumns,aInfo); + _pView->fillFunctionInfo(pColumnRef,aColumns,aInfo); aInfo->SetFieldAlias(aColumnAlias); } @@ -2533,7 +2496,7 @@ namespace _pView->getLocale(), static_cast(_pView->getDecimalSeparator().toChar()), &rController.getParser().getContext()); - fillFunctionInfo(_pView,pArgument,sCondition,aDragLeft); + _pView->fillFunctionInfo(pArgument,sCondition,aDragLeft); aDragLeft->SetFunctionType(FKT_OTHER); aDragLeft->SetOrderDir(eOrderDir); aDragLeft->SetVisible(sal_False); @@ -2565,7 +2528,7 @@ namespace const ::connectivity::OSQLParseNode* pSelectRoot ) { SqlParseError eErrorCode = eOk; - if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf()) + if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf()) // opt_group_by_clause { OQueryController& rController = static_cast(_pView->getController()); ::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2); @@ -2600,7 +2563,7 @@ namespace &rController.getParser().getContext(), sal_True, sal_True); // quote is to true because we need quoted elements inside the function - fillFunctionInfo(_pView,pArgument,sGroupByExpression,aDragInfo); + _pView->fillFunctionInfo(pArgument,sGroupByExpression,aDragInfo); aDragInfo->SetFunctionType(FKT_OTHER); aDragInfo->SetGroupBy(sal_True); aDragInfo->SetVisible(sal_False); @@ -3324,4 +3287,32 @@ bool OQueryDesignView::initByParseIterator( ::dbtools::SQLExceptionInfo* _pError } return eErrorCode == eOk; } +//------------------------------------------------------------------------------ +void OQueryDesignView::fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode + ,const ::rtl::OUString& sFunctionTerm + ,OTableFieldDescRef& aInfo) +{ + // get the type out of the funtion name + OQueryController& rController = static_cast(getController()); + sal_Int32 nDataType = DataType::DOUBLE; + ::rtl::OUString sFieldName = sFunctionTerm; + OSQLParseNode* pFunctionName = pNode->getChild(0); + if ( !SQL_ISPUNCTUATION(pFunctionName,"{") ) + { + if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) ) + pFunctionName = pFunctionName->getChild(0); + + ::rtl::OUString sFunctionName = pFunctionName->getTokenValue(); + if ( !sFunctionName.getLength() ) + sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8); + + nDataType = OSQLParser::getFunctionReturnType( + sFunctionName + ,&rController.getParser().getContext()); + } + aInfo->SetDataType(nDataType); + aInfo->SetFieldType(TAB_NORMAL_FIELD); + aInfo->SetField(sFieldName); + aInfo->SetTabWindow(NULL); +} // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 7e2f34c95..cc76e2aeb 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -890,78 +890,56 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes OSL_ENSURE(0,"Unsupported function inserted!"); } - else if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) || - SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) || - SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) ) - // a calculation has been found ( can be calc and function ) + else { - // append the whole text as field name // so we first clear the function field clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId); - sal_Bool bQuote = sal_True; - sal_Int32 nDataType = DataType::DOUBLE; - OSQLParseNode* pFunctionName = pColumnRef->getChild(0); - if ( !SQL_ISPUNCTUATION(pFunctionName,"{") ) + ::rtl::OUString sFunction; + pColumnRef->parseNodeToStr( sFunction, + xConnection, + &rController.getParser().getContext(), + sal_True, + sal_True); // quote is to true because we need quoted elements inside the function + + getDesignView()->fillFunctionInfo(pColumnRef,sFunction,aSelEntry); + + if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) || + SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) || + SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) ) + // a calculation has been found ( can be calc and function ) { - if ( SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) ) - pFunctionName = pFunctionName->getChild(0); + // now parse the whole statement + sal_uInt32 nFunCount = pColumnRef->count(); + ::rtl::OUString sParameters; + for(sal_uInt32 function = 0; function < nFunCount; ++function) + pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, sal_True ); - if ( pFunctionName ) + sOldAlias = aSelEntry->GetAlias(); + sal_Int32 nNewFunctionType = aSelEntry->GetFunctionType() | FKT_NUMERIC | FKT_OTHER; + aSelEntry->SetFunctionType(nNewFunctionType); + aSelEntry->SetField(sParameters); + } + else + { + aSelEntry->SetFieldAlias(sColumnAlias); + if ( SQL_ISRULE(pColumnRef,set_fct_spec) ) + aSelEntry->SetFunctionType(/*FKT_NUMERIC | */FKT_OTHER); + else { - ::rtl::OUString sFunctionName = pFunctionName->getTokenValue(); - if ( !sFunctionName.getLength() ) - sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_MS_1252); - - nDataType = OSQLParser::getFunctionReturnType( - sFunctionName - ,&rController.getParser().getContext()); - aSelEntry->SetDataType(nDataType); + if ( SQL_ISRULEOR2(pColumnRef,num_value_exp,term) || SQL_ISRULE(pColumnRef,factor) ) + aSelEntry->SetDataType(DataType::DOUBLE); + else if ( SQL_ISRULE(pColumnRef,value_exp) ) + aSelEntry->SetDataType(DataType::TIMESTAMP); + else + aSelEntry->SetDataType(DataType::VARCHAR); + aSelEntry->SetFunctionType(FKT_NUMERIC | FKT_OTHER); } } - - - // now parse the whole statement - sal_uInt32 nFunCount = pColumnRef->count(); - ::rtl::OUString sParameters; - for(sal_uInt32 function = 0; function < nFunCount; ++function) - pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, bQuote ); - - ::rtl::OUString aSelectionAlias = aSelEntry->GetAlias(); - aSelEntry->SetAlias(::rtl::OUString()); - - sal_Int32 nNewFunctionType = aSelEntry->GetFunctionType() | FKT_NUMERIC | FKT_OTHER; - aSelEntry->SetFunctionType(nNewFunctionType); - - - aSelEntry->SetFieldType(TAB_NORMAL_FIELD); - - aSelEntry->SetTabWindow(NULL); - - aSelEntry->SetField(sParameters); - notifyTableFieldChanged(aSelectionAlias,aSelEntry->GetAlias(),_bListAction, nColumnId); - } - else - { - clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId); - - ::rtl::OUString aColumns; - pColumnRef->parseNodeToStr( aColumns, - xConnection, - &rController.getParser().getContext(), - sal_True, - sal_True); - // get the type out of the funtion name - sal_Int32 nDataType = DataType::DOUBLE; - aSelEntry->SetDataType(nDataType); - aSelEntry->SetField(aColumns); - aSelEntry->SetFieldType(TAB_NORMAL_FIELD); - aSelEntry->SetTabWindow(NULL); + aSelEntry->SetAlias(::rtl::OUString()); - aSelEntry->SetFieldAlias(sColumnAlias); - aSelEntry->SetFunctionType(FKT_NUMERIC | FKT_OTHER); - notifyTableFieldChanged(sOldAlias,aSelEntry->GetAlias(),_bListAction, nColumnId); } + } if ( i > 0 && InsertField(aSelEntry,BROWSER_INVALIDID,sal_True,sal_False).isEmpty() ) // may we have to append more than one field { // the field could not be isnerted @@ -2889,7 +2867,7 @@ bool OSelectionBrowseBox::HasFieldByAliasName(const ::rtl::OUString& rFieldName, { if ( (*aIter)->GetFieldAlias() == rFieldName ) { - rInfo = *aIter; + rInfo.getBody() = (*aIter).getBody(); break; } } diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index 76f20386e..531e5e06f 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -69,24 +69,10 @@ OTableFieldDesc::OTableFieldDesc() //------------------------------------------------------------------------------ OTableFieldDesc::OTableFieldDesc(const OTableFieldDesc& rRS) : ::vos::OReference() - ,m_vecCriteria( rRS.m_vecCriteria) - ,m_aTableName(rRS.GetTable()) - ,m_aAliasName(rRS.GetAlias()) // table range - ,m_aFieldName(rRS.GetField()) // column - ,m_aFieldAlias(rRS.GetFieldAlias()) // column alias - ,m_aFunctionName(rRS.GetFunction()) // Funktionsname - ,m_pTabWindow(rRS.GetTabWindow()) - ,m_eDataType(rRS.GetDataType()) - ,m_eFunctionType( rRS.GetFunctionType() ) - ,m_eFieldType(rRS.GetFieldType()) - ,m_eOrderDir(rRS.GetOrderDir()) - ,m_nIndex(rRS.GetFieldIndex()) - ,m_nColWidth(rRS.GetColWidth()) - ,m_nColumnId( rRS.m_nColumnId) - ,m_bGroupBy(rRS.IsGroupBy()) - ,m_bVisible(rRS.IsVisible()) + { DBG_CTOR(OTableFieldDesc,NULL); + *this = rRS; } //------------------------------------------------------------------------------ @@ -107,7 +93,31 @@ OTableFieldDesc::~OTableFieldDesc() { DBG_DTOR(OTableFieldDesc,NULL); } - +//------------------------------------------------------------------------------ +OTableFieldDesc& OTableFieldDesc::operator=( const OTableFieldDesc& rRS ) +{ + if (&rRS == this) + return *this; + + m_vecCriteria = rRS.m_vecCriteria; + m_aTableName = rRS.GetTable(); + m_aAliasName = rRS.GetAlias(); // table range + m_aFieldName = rRS.GetField(); // column + m_aFieldAlias = rRS.GetFieldAlias(); // column alias + m_aFunctionName = rRS.GetFunction(); // Funktionsname + m_pTabWindow = rRS.GetTabWindow(); + m_eDataType = rRS.GetDataType(); + m_eFunctionType = rRS.GetFunctionType(); + m_eFieldType = rRS.GetFieldType(); + m_eOrderDir = rRS.GetOrderDir(); + m_nIndex = rRS.GetFieldIndex(); + m_nColWidth = rRS.GetColWidth(); + m_nColumnId = rRS.m_nColumnId; + m_bGroupBy = rRS.IsGroupBy(); + m_bVisible = rRS.IsVisible(); + + return *this; +} //------------------------------------------------------------------------------ sal_Bool OTableFieldDesc::operator==( const OTableFieldDesc& rDesc ) { -- cgit v1.2.3 From ef1e644386cab9f56cea761a6ff0711d5af6ea0a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 27 Nov 2009 10:17:16 +0100 Subject: dba33d: #i106772# check if update and refetching works otherwise set iter to end and some resource handling for error messages --- dbaccess/source/core/api/KeySet.cxx | 7 +- dbaccess/source/core/api/RowSet.cxx | 79 ++++------ dbaccess/source/core/api/RowSetBase.cxx | 48 +----- dbaccess/source/core/api/RowSetCache.cxx | 6 +- .../source/core/dataaccess/databasedocument.cxx | 3 +- dbaccess/source/core/dataaccess/datasource.cxx | 8 +- .../source/core/dataaccess/documentcontainer.cxx | 1 - .../source/core/dataaccess/documentdefinition.cxx | 3 +- dbaccess/source/core/inc/core_resource.hrc | 21 +++ dbaccess/source/core/resource/strings.src | 72 +++++++++ dbaccess/source/ext/macromigration/dbmm_global.hrc | 3 + .../source/ext/macromigration/macromigration.src | 13 ++ .../ext/macromigration/macromigrationwizard.cxx | 10 +- dbaccess/source/ui/app/AppController.cxx | 173 +++++---------------- dbaccess/source/ui/app/app.src | 8 + dbaccess/source/ui/app/dbu_app.hrc | 5 +- dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 2 +- dbaccess/source/ui/inc/dbu_uno.hrc | 5 +- dbaccess/source/ui/uno/copytablewizard.cxx | 12 +- dbaccess/source/ui/uno/copytablewizard.src | 12 ++ 20 files changed, 237 insertions(+), 254 deletions(-) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 02829d842..69def7275 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -618,8 +618,6 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow } m_bUpdated = xPrep->executeUpdate() > 0; - - if(m_bUpdated) { m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32((_rInsertRow->get())[0].getAny())); @@ -1168,8 +1166,9 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) m_xSet = m_xStatement->executeQuery(); OSL_ENSURE(m_xSet.is(),"No resultset form statement!"); - sal_Bool bOK = m_xSet->next(); (void)bOK; - OSL_ENSURE(bOK,"No rows!"); + sal_Bool bOK = m_xSet->next(); + if ( !bOK ) + m_aKeyIter = m_aKeyMap.end(); m_xRow.set(m_xSet,UNO_QUERY); OSL_ENSURE(m_xRow.is(),"No row form statement!"); } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 55d6cd7ac..6347fed94 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1078,19 +1078,26 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) m_pCache->updateRow(m_aCurrentRow.operator ->()); m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; - m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); + if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() ) + { + m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); - // notification order - // - column values - ORowSetBase::firePropertyChange(aOldValues); + // notification order + // - column values + ORowSetBase::firePropertyChange(aOldValues); - // - rowChanged - notifyAllListenersRowChanged(aGuard,aEvt); + // - rowChanged + notifyAllListenersRowChanged(aGuard,aEvt); - // - IsModified - if(!m_bModified) - fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); - OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" ); + // - IsModified + if(!m_bModified) + fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" ); + } + else // the update went rong + { + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this ); + } } } // ------------------------------------------------------------------------- @@ -1102,20 +1109,15 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - throwSQLException( "Cannot delete the before-first or after-last row.", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), SQL_INVALID_CURSOR_POSITION, *this ); if ( m_bNew ) - throwSQLException( "Cannot delete the insert-row.", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), SQL_INVALID_CURSOR_POSITION, *this ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) - throwSQLException( "Result set is read only.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE ) - throwSQLException( "DELETE privilege not available.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( rowDeleted() ) - throwSQLException( "Current row already deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); // this call position the cache indirect Any aBookmarkToDelete( m_aBookmark ); @@ -1279,8 +1281,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT ) - throwSQLException( "No insert privileges", SQL_GENERAL_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), SQL_GENERAL_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1346,8 +1347,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException // m_bModified should be true. Also, as soon as somebody calls moveToInsertRow, // our current row should not be deleted anymore. So, we should not have survived the above // check "if ( !m_pCache->m_bNew && !m_bModified )" - throwSQLException( "The current row is deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1711,12 +1711,7 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() m_xStatement = m_xActiveConnection->prepareStatement( sCommandToExecute ); if ( !m_xStatement.is() ) { - SQLException aError; - aError.Context = *this; - aError.SQLState = getStandardSQLState( SQL_GENERAL_ERROR ); - aError.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error: no statement object provided by the database driver." ) ); - // TODO: resource - throw aError; + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), SQL_GENERAL_ERROR, *this ); } Reference< XPropertySet > xStatementProps( m_xStatement, UNO_QUERY_THROW ); @@ -2042,8 +2037,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(xColumn.is()) xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel; else - sColumnLabel = ::rtl::OUString::createFromAscii("Expression1"); - // TODO: resource + sColumnLabel = DBACORE_RESSTRING( RID_STR_EXPRESSION1 ); } pColumn->setName(sColumnLabel); aNames.push_back(sColumnLabel); @@ -2457,8 +2451,7 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() m_aActiveCommand = sCommand; if ( !m_aActiveCommand.getLength() ) - throwSQLException( "No SQL command was provided.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); return bDoEscapeProcessing; } @@ -2760,21 +2753,17 @@ void ORowSet::checkUpdateIterator() void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { checkCache(); - if ( columnIndex <= 0 ) - throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); - // TODO: resource + if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); + if ( rowDeleted() ) - throwSQLException( "Current row is deleted", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this ); + if ( m_aCurrentRow.isNull() ) - throwSQLException( "Invalid cursor state", SQL_INVALID_CURSOR_STATE, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this ); - if ( sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) - throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); - // TODO: resource if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) - throwSQLException( "Result set is not writeable", SQL_GENERAL_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this ); } // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 6e202b8da..759b63faa 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -30,57 +30,25 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX + #include "RowSetBase.hxx" -#endif -#ifndef DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX #include "CRowSetDataColumn.hxx" -#endif -#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include -#endif -#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX #include "RowSetCache.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include "core_resource.hrc" #include -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include -#endif -#ifndef _COMPHELPER_SEQSTREAM_HXX #include -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include -#endif -#ifndef _OSL_THREAD_H_ #include -#endif -#ifndef _TOOLS_DEBUG_HXX #include -#endif #include using namespace dbaccess; @@ -278,8 +246,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); - throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -421,8 +388,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); - throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -498,12 +464,10 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - throwSQLException( "The rows before the first and after the last row don't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); if ( impl_rowDeleted() ) - throwSQLException( "The current row is deleted, and thus doesn't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_DELETED ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" ); return m_aBookmark; diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 355b4afdd..71d4e2969 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -912,7 +912,7 @@ sal_Bool ORowSetCache::moveWindow() { *m_aMatrixIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition); - // we have to read one row forward to enshure that we know when we are on last row + // we have to read one row forward to ensure that we know when we are on last row // but only when we don't know it already if ( !m_bRowCountFinal ) { @@ -1283,7 +1283,9 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow ) // *(*m_aMatrixIter) = *(*_rUpdateRow); // refetch the whole row (*m_aMatrixIter) = NULL; - moveToBookmark(aBookmark); + + if ( !moveToBookmark(aBookmark) ) + m_aMatrixIter = m_pMatrix->end(); // moveToBookmark((*(*m_aInsertRow))[0].makeAny()); // if(m_pCacheSet->rowUpdated()) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 5a85fe65e..7399ca886 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1615,8 +1615,7 @@ void SAL_CALL ODatabaseDocument::loadFromStorage( const Reference< XStorage >& / DocumentGuard aGuard( *this ); throw Exception( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Embedding of database documents is not supported." ) ), - // TODO: resource + DBACORE_RESSTRING( RID_STR_NO_EMBEDDING ), *this ); } diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 53a4b777f..701c97c37 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -68,9 +68,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -78,6 +78,7 @@ #include #include #include +#include #include using namespace ::com::sun::star::sdbc; @@ -832,9 +833,8 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O ::rtl::OUString sMessage = DBACORE_RESSTRING( nExceptionMessageId ); SQLContext aContext; - aContext.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "A connection for the following URL was requested: " ) ); - // TODO: resource - aContext.Message += m_pImpl->m_sConnectURL; + aContext.Message = DBACORE_RESSTRING( RID_STR_CONNECTION_REQUEST ); + ::comphelper::string::searchAndReplaceAsciiI( aContext.Message, "$name$", m_pImpl->m_sConnectURL ); throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) ); } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index aec3be2c9..2967306c1 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -545,7 +545,6 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) ) { ::rtl::OUString sMessage( DBA_RES( RID_STR_NAME_NOT_FOUND ) ); - // TODO: resource ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", _sURL ); throw IllegalArgumentException( sMessage, *this, 1 ); } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 984bc2e18..969a8ad0b 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1694,8 +1694,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) { com::sun::star::io::WrongFormatException aWFE; - aWFE.Message = ::rtl::OUString::createFromAscii("Extension not present."); - // TODO: resource + aWFE.Message = DBACORE_RESSTRING( RID_STR_MISSING_EXTENSION ); throw aWFE; } } diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 0cb9727e0..84c25218b 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -91,5 +91,26 @@ #define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) #define RID_STR_NO_SUB_FOLDER ( RID_CORE_STRINGS_START + 48 ) +#define RID_STR_NO_DELETE_BEFORE_AFTER ( RID_CORE_STRINGS_START + 49 ) +#define RID_STR_NO_DELETE_INSERT_ROW ( RID_CORE_STRINGS_START + 50 ) +#define RID_STR_RESULT_IS_READONLY ( RID_CORE_STRINGS_START + 51 ) +#define RID_STR_NO_DELETE_PRIVILEGE ( RID_CORE_STRINGS_START + 52 ) +#define RID_STR_ROW_ALREADY_DELETED ( RID_CORE_STRINGS_START + 53 ) +#define RID_STR_UPDATE_FAILED ( RID_CORE_STRINGS_START + 54 ) + +#define RID_STR_INVALID_INDEX ( RID_CORE_STRINGS_START + 55 ) +#define RID_STR_NO_INSERT_PRIVILEGE ( RID_CORE_STRINGS_START + 56 ) +#define RID_STR_INTERNAL_ERROR ( RID_CORE_STRINGS_START + 57 ) +#define RID_STR_EXPRESSION1 ( RID_CORE_STRINGS_START + 58 ) +#define RID_STR_NO_SQL_COMMAND ( RID_CORE_STRINGS_START + 59 ) +#define RID_STR_INVALID_CURSOR_STATE ( RID_CORE_STRINGS_START + 60 ) +#define RID_STR_CURSOR_BEFORE_OR_AFTER ( RID_CORE_STRINGS_START + 61 ) +#define RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ( RID_CORE_STRINGS_START + 62 ) +#define RID_STR_NO_BOOKMARK_DELETED ( RID_CORE_STRINGS_START + 63 ) +#define RID_STR_NO_EMBEDDING ( RID_CORE_STRINGS_START + 64 ) +#define RID_STR_CONNECTION_REQUEST ( RID_CORE_STRINGS_START + 65 ) +#define RID_STR_MISSING_EXTENSION ( RID_CORE_STRINGS_START + 66 ) + + #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index 9ee86de3c..ae2ec02dd 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -249,4 +249,76 @@ String RID_STR_NO_SUB_FOLDER { Text [ en-US ] = "There exists no folder named \"$folder$\"."; }; +String RID_STR_NO_DELETE_BEFORE_AFTER +{ + Text [ en-US ] = "Cannot delete the before-first or after-last row."; +}; +String RID_STR_NO_DELETE_INSERT_ROW +{ + Text [ en-US ] = "Cannot delete the insert-row."; +}; +String RID_STR_RESULT_IS_READONLY +{ + Text [ en-US ] = "Result set is read only."; +}; +String RID_STR_NO_DELETE_PRIVILEGE +{ + Text [ en-US ] = "DELETE privilege not available."; +}; +String RID_STR_ROW_ALREADY_DELETED +{ + Text [ en-US ] = "Current row is already deleted."; +}; +String RID_STR_UPDATE_FAILED +{ + Text [ en-US ] = "Current row could be updated."; +}; //------------------------------------------------------------------------- +String RID_STR_NO_INSERT_PRIVILEGE +{ + Text [ en-US ] = "INSERT privilege not available."; +}; +String RID_STR_INTERNAL_ERROR +{ + Text [ en-US ] = "Internal error: no statement object provided by the database driver."; +}; +String RID_STR_EXPRESSION1 +{ + Text [ en-US ] = "Expression1"; +}; +String RID_STR_NO_SQL_COMMAND +{ + Text [ en-US ] = "No SQL command was provided."; +}; +String RID_STR_INVALID_INDEX +{ + Text [ en-US ] = "Invalid column index."; +}; +String RID_STR_INVALID_CURSOR_STATE +{ + Text [ en-US ] = "Invalid cursor state."; +}; +String RID_STR_CURSOR_BEFORE_OR_AFTER +{ + Text [ en-US ] = "The cursor points to before the first or after the last row."; +}; +String RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER +{ + Text [ en-US ] = "The rows before the first and after the last row don't have a bookmark."; +}; +String RID_STR_NO_BOOKMARK_DELETED +{ + Text [ en-US ] = "The current row is deleted, and thus doesn't have a bookmark."; +}; +String RID_STR_NO_EMBEDDING +{ + Text [ en-US ] = "Embedding of database documents is not supported."; +}; +String RID_STR_CONNECTION_REQUEST +{ + Text [ en-US ] = "A connection for the following URL was requested \"$name$\"."; +}; +String RID_STR_MISSING_EXTENSION +{ + Text [ en-US ] = "The extension is not installed."; +}; diff --git a/dbaccess/source/ext/macromigration/dbmm_global.hrc b/dbaccess/source/ext/macromigration/dbmm_global.hrc index 7bc71199c..67d5fa6ee 100644 --- a/dbaccess/source/ext/macromigration/dbmm_global.hrc +++ b/dbaccess/source/ext/macromigration/dbmm_global.hrc @@ -82,5 +82,8 @@ #define STR_WARNINGS ( RID_DBMM_STRING_START + 14 ) #define STR_EXCEPTION ( RID_DBMM_STRING_START + 15 ) #define STR_LIBRARY_TYPE_AND_NAME ( RID_DBMM_STRING_START + 16 ) +#define STR_INVALID_NUMBER_ARGS ( RID_DBMM_STRING_START + 17 ) +#define STR_NO_DATABASE ( RID_DBMM_STRING_START + 18 ) +#define STR_NOT_READONLY ( RID_DBMM_STRING_START + 19 ) #endif // DBACCESS_DBMM_GLOBAL_HRC diff --git a/dbaccess/source/ext/macromigration/macromigration.src b/dbaccess/source/ext/macromigration/macromigration.src index fd5a5c56f..db4a38167 100644 --- a/dbaccess/source/ext/macromigration/macromigration.src +++ b/dbaccess/source/ext/macromigration/macromigration.src @@ -441,3 +441,16 @@ ErrorBox ERR_INVALID_BACKUP_LOCATION Buttons = WB_OK; Message [ en-US ] = "You need to choose a backup location other than the document location itself."; }; + +String STR_INVALID_NUMBER_ARGS +{ + Text [ en-US ] = "Invalid number of initialization arguments. Expected 1."; +}; +String STR_NO_DATABASE +{ + Text [ en-US ] = "No database document found in the initializatin arguments."; +}; +String STR_NOT_READONLY +{ + Text [ en-US ] = "Not applicable to read-only documents."; +}; diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx index 77643b8c1..151786c1e 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx @@ -32,6 +32,7 @@ #include "precompiled_dbaccess.hxx" #include "dbmm_module.hxx" +#include "dbmm_global.hrc" #include "macromigrationdialog.hxx" /** === begin UNO includes === **/ @@ -210,8 +211,7 @@ namespace dbmm if ( _rArguments.getLength() != 1 ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid number of initialization arguments. Expected 1." ) ), - // TODO: resource + String(MacroMigrationResId(STR_INVALID_NUMBER_ARGS)), *this, 1 ); @@ -219,8 +219,7 @@ namespace dbmm m_xDocument.set( _rArguments[0], UNO_QUERY ); if ( !m_xDocument.is() ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No database document found in the initializatin arguments." ) ), - // TODO: resource + String(MacroMigrationResId(STR_NO_DATABASE)), *this, 1 ); @@ -228,8 +227,7 @@ namespace dbmm Reference< XStorable > xDocStor( m_xDocument, UNO_QUERY_THROW ); if ( xDocStor->isReadonly() ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Not applicable to read-only documents." ) ), - // TODO: resource + String(MacroMigrationResId(STR_NOT_READONLY)), *this, 1 ); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 2af08e0d0..b451552ff 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -79,160 +79,68 @@ #include #include /** === end UNO includes === **/ - -#ifndef _TOOLS_DEBUG_HXX #include -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include -#endif -#ifndef SVTOOLS_URIHELPER_HXX +#include + #include -#endif -#ifndef _COMPHELPER_TYPES_HXX_ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include #include -#endif -#ifndef _COMPHELPER_INTERACTION_HXX_ #include -#endif -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX #include -#endif -#ifndef _SV_MSGBOX_HXX + #include -#endif -#ifndef _VCL_STDTEXT_HXX #include -#endif -#ifndef _FILEDLGHELPER_HXX +#include +#include +#include + +#include #include -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include +#include + #include -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ + #include -#endif -#ifndef DBAUI_APPVIEW_HXX +#include + +#include +#include +#include + #include "AppView.hxx" -#endif -#ifndef DBACCESS_UI_BROWSER_ID_HXX #include "browserids.hxx" -#endif -#ifndef _DBAU_REGHELPER_HXX_ #include "dbu_reghelper.hxx" -#endif -#ifndef _DBU_APP_HRC_ #include "dbu_app.hrc" -#endif -#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX #include "defaultobjectnamecheck.hxx" -#endif -#ifndef _SV_MENU_HXX -#include -#endif -#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX -#include -#endif -#ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX -#include -#endif -#ifndef _COMPHELPER_UNO3_HXX_ -#include -#endif -#ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX #include "databaseobjectview.hxx" -#endif -#ifndef _SV_SVAPP_HXX //autogen -#include -#endif -#ifndef _SVLBOXITM_HXX -#include -#endif -#ifndef _DBAUI_LISTVIEWITEMS_HXX_ #include "listviewitems.hxx" -#endif - -#ifndef DBAUI_APPDETAILVIEW_HXX #include "AppDetailView.hxx" -#endif -#ifndef _DBAUI_LINKEDDOCUMENTS_HXX_ #include "linkeddocuments.hxx" -#endif -#ifndef _SV_LSTBOX_HXX -#include -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include -#endif -#ifndef _DBAUI_SQLMESSAGE_HXX_ #include "sqlmessage.hxx" -#endif -#ifndef _STRING_HXX -#include -#endif -#ifndef INCLUDED_SFX_MAILMODELAPI_HXX -#include -#endif -#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX -#include -#endif -#ifndef _SVTREEBOX_HXX -#include -#endif -#ifndef _TRANSFER_HXX -#include -#endif -#ifndef _CLIPLISTENER_HXX -#include -#endif -#ifndef _SVX_DBAEXCHANGE_HXX_ -#include -#endif -#ifndef SVX_DBAOBJECTEX_HXX -#include -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _DBAUI_DSNTYPES_HXX_ #include "dsntypes.hxx" -#endif -#include -#include -#ifndef _UNOTOOLS_TEMPFILE_HXX -#include -#endif -#ifndef _DBA_DBACCESS_HELPID_HRC_ #include "dbaccess_helpid.hrc" -#endif -#ifndef DBAUI_DLGSAVE_HXX #include "dlgsave.hxx" -#endif -#ifndef _SFX_DOCFILT_HACK_HXX -#include -#endif -#ifndef SFX_QUERYSAVEDOCUMENT_HXX -#include -#endif -#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX -#include -#endif -#ifndef SVTOOLS_FILENOTATION_HXX_ -#include -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include -#endif -#ifndef _VOS_MUTEX_HXX_ #include -#endif -#ifndef _DBACCESS_SLOTID_HRC_ #include "dbaccess_slotid.hrc" -#endif #include #include @@ -2955,8 +2863,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer case DatabaseObjectContainer::REPORTS: if ( eSelectedCategory != E_NONE ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "You cannot select different categories." ) ), - // TODO: resource + String(ModuleRes(RID_STR_NO_DIFF_CAT)), *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) ); eSelectedCategory = ( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE @@ -2969,13 +2876,9 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer default: case DatabaseObjectContainer::DATA_SOURCE: { - ::rtl::OUStringBuffer aMessage; - aMessage.appendAscii( "Unsupported object type found (" ); - aMessage.append ( sal_Int32( pObject->Type ) ); - aMessage.appendAscii( ")." ); - // TODO: resource - throw IllegalArgumentException( - aMessage.makeStringAndClear(), *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) ); + ::rtl::OUString sMessage = String(ModuleRes( RID_STR_UNSUPPORTED_OBJECT_TYPE )); + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$type$", ::rtl::OUString::valueOf(sal_Int32( pObject->Type )) ); + throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() )); } } } diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src index 3f9ff4e74..7ed782fb5 100644 --- a/dbaccess/source/ui/app/app.src +++ b/dbaccess/source/ui/app/app.src @@ -469,3 +469,11 @@ String RID_STR_EMBEDDED_DATABASE { Text [ en-US ] = "Embedded database"; }; +String RID_STR_NO_DIFF_CAT +{ + Text [ en-US ] = "You cannot select different categories."; +}; +String RID_STR_UNSUPPORTED_OBJECT_TYPE +{ + Text [ en-US ] = "Unsupported object type found ($type$)."; +}; diff --git a/dbaccess/source/ui/app/dbu_app.hrc b/dbaccess/source/ui/app/dbu_app.hrc index aac5ff5f4..b50c38c58 100644 --- a/dbaccess/source/ui/app/dbu_app.hrc +++ b/dbaccess/source/ui/app/dbu_app.hrc @@ -68,11 +68,12 @@ #define RID_STR_FORMS_HELP_TEXT_WIZARD RID_STR_APP_START + 29 #define RID_STR_REPORT_HELP_TEXT RID_STR_APP_START + 30 #define RID_STR_EMBEDDED_DATABASE RID_STR_APP_START + 31 - +#define RID_STR_NO_DIFF_CAT RID_STR_APP_START + 32 +#define RID_STR_UNSUPPORTED_OBJECT_TYPE RID_STR_APP_START + 33 // please adjust checking before insert new strings -#if RID_STR_EMBEDDED_DATABASE > RID_STR_APP_END +#if RID_STR_UNSUPPORTED_OBJECT_TYPE > RID_STR_APP_END #error Resource-Id Ueberlauf in #file, #line #endif diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index c108a66c0..a07f2bdb7 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -166,7 +166,7 @@ void SbaTableQueryBrowser::SelectionChanged() InvalidateFeature(ID_BROWSER_INSERTCONTENT); InvalidateFeature(ID_BROWSER_FORMLETTER); } // if ( !m_bShowMenu ) - InvalidateFeature(ID_BROWSER_COPY); + InvalidateFeature(ID_BROWSER_COPY); InvalidateFeature(ID_BROWSER_CUT); } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/inc/dbu_uno.hrc b/dbaccess/source/ui/inc/dbu_uno.hrc index 6f76e0833..27ddaa7a7 100644 --- a/dbaccess/source/ui/inc/dbu_uno.hrc +++ b/dbaccess/source/ui/inc/dbu_uno.hrc @@ -43,9 +43,12 @@ #define STR_CTW_UNSUPPORTED_COLUMN_TYPE ( RID_STR_UNO_START + 6 ) #define STR_CTW_ILLEGAL_PARAMETER_COUNT ( RID_STR_UNO_START + 7 ) #define STR_CTW_ERROR_DURING_INITIALIZATION ( RID_STR_UNO_START + 8 ) +#define STR_CTW_ERROR_UNSUPPORTED_SETTING ( RID_STR_UNO_START + 9 ) +#define STR_CTW_ERROR_NO_QUERY ( RID_STR_UNO_START + 10 ) +#define STR_CTW_ERROR_INVALID_INTERACTIONHANDLER ( RID_STR_UNO_START + 11 ) // please adjust when inserting new strings: -#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_DURING_INITIALIZATION +#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_INVALID_INTERACTIONHANDLER #if RID_STR_UNO_LAST_USED >= RID_STR_UNO_END #error too many resources in uno .... diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 73e5a9c5a..f77181176 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -775,9 +776,8 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X if ( sUnsupportedSetting.getLength() != 0 ) { - ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported setting in the copy source descriptor: $name$." ) ) ); - // TODO: resource - sMessage = sMessage.replaceAt( sMessage.indexOfAsciiL( "$name$", 6 ), 6, sUnsupportedSetting ); + ::rtl::OUString sMessage( String(ModuleRes( STR_CTW_ERROR_UNSUPPORTED_SETTING )) ); + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", sUnsupportedSetting ); throw IllegalArgumentException( sMessage, *const_cast< CopyTableWizard* >( this ), @@ -849,8 +849,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X if ( _out_rCommandType == CommandType::QUERY ) // we cannot copy a query if the connection cannot provide it ... throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "To copy a query, your connection must be able to provide queries." ) ), - // TODO: resource + String(ModuleRes( STR_CTW_ERROR_NO_QUERY )), *const_cast< CopyTableWizard* >( this ), 1 ); @@ -1516,8 +1515,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) { // ->createWithInteractionHandler if ( !( _rArguments[2] >>= m_xInteractionHandler ) ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given interaction handler is invalid." ) ), - // TODO: resource + String(ModuleRes( STR_CTW_ERROR_INVALID_INTERACTIONHANDLER )), *this, 3 ); diff --git a/dbaccess/source/ui/uno/copytablewizard.src b/dbaccess/source/ui/uno/copytablewizard.src index 4ce98e8b6..94632a318 100644 --- a/dbaccess/source/ui/uno/copytablewizard.src +++ b/dbaccess/source/ui/uno/copytablewizard.src @@ -69,3 +69,15 @@ String STR_CTW_ERROR_DURING_INITIALIZATION { Text [ en-US ] = "An error occurred during initialization."; }; +String STR_CTW_ERROR_UNSUPPORTED_SETTING +{ + Text [ en-US ] = "Unsupported setting in the copy source descriptor: $name$."; +}; +String STR_CTW_ERROR_NO_QUERY +{ + Text [ en-US ] = "To copy a query, your connection must be able to provide queries."; +}; +String STR_CTW_ERROR_INVALID_INTERACTIONHANDLER +{ + Text [ en-US ] = "The given interaction handler is invalid."; +}; -- cgit v1.2.3 From 8cc3f69cafcd124dde3f1cd3db309976522920ef Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 30 Nov 2009 09:11:46 +0100 Subject: dba33d: #i107279# set numberformat with old one --- dbaccess/source/core/misc/dsntypes.cxx | 1 - dbaccess/source/ui/misc/DExport.cxx | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index f97527ae0..a11a231f3 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -444,7 +444,6 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const return aKnowPrefixes[i].eType; } - DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !"); return DST_UNKNOWN; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 8f559e2a4..390511d99 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -479,6 +479,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl case NumberFormat::DATETIME: case NumberFormat::TEXT: case NumberFormat::DATE: + nNumberFormat = _nOldNumberFormat; break; case NumberFormat::ALL: nNumberFormat = NumberFormat::DATE; @@ -494,6 +495,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl case NumberFormat::DATETIME: case NumberFormat::TEXT: case NumberFormat::TIME: + nNumberFormat = _nOldNumberFormat; break; case NumberFormat::ALL: nNumberFormat = NumberFormat::TIME; @@ -510,6 +512,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl nNumberFormat = NumberFormat::CURRENCY; break; case NumberFormat::CURRENCY: + nNumberFormat = _nOldNumberFormat; break; case NumberFormat::ALL: nNumberFormat = NumberFormat::CURRENCY; @@ -526,6 +529,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl switch(_nOldNumberFormat) { case NumberFormat::NUMBER: + nNumberFormat = _nOldNumberFormat; break; case NumberFormat::CURRENCY: nNumberFormat = NumberFormat::CURRENCY; @@ -549,6 +553,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl case NumberFormat::DATETIME: case NumberFormat::TEXT: case NumberFormat::TIME: + nNumberFormat = _nOldNumberFormat; break; case NumberFormat::ALL: nNumberFormat = NumberFormat::DATETIME; -- cgit v1.2.3 From 3b118c2a05182479ec269fa7aa4eaaf52d579b82 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 1 Dec 2009 07:14:41 +0100 Subject: add new line at end --- dbaccess/source/ui/misc/WCopyTable.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 8348c4520..205935bfd 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1698,4 +1698,5 @@ void OCopyTableWizard::showError(const Any& _aError) DBG_UNHANDLED_EXCEPTION(); } } -} \ No newline at end of file +} + -- cgit v1.2.3 From 72e6c32b288266c40dde9faaeb329e7a638bf647 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 1 Dec 2009 07:17:18 +0100 Subject: comparison between signed and unsigned integer expressions --- reportdesign/source/filter/xml/xmlExport.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index c92c1c20a..8b34b8559 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1639,8 +1639,8 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG if ( sFunction.getLength() ) { sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'}; - for(sal_Int32 i= 0; i < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++i) - sFunctionName = sFunctionName.replace(pReplaceChars[i],'_'); + for(sal_uInt32 j= 0; j < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++j) + sFunctionName = sFunctionName.replace(pReplaceChars[j],'_'); xFunction->setName(sFunctionName); sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFunction; -- cgit v1.2.3 From a03e699a37db06412900f8bced75cac5abb8869a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 10 Dec 2009 11:35:53 +0100 Subject: dba33d: merge --- dbaccess/source/core/api/RowSet.cxx | 34 +-------- .../source/core/dataaccess/databasecontext.cxx | 19 ----- dbaccess/source/core/inc/core_resource.hrc | 5 +- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 89 ---------------------- 4 files changed, 2 insertions(+), 145 deletions(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 990396edc..ecbc7a719 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -77,6 +77,7 @@ #include #include #include +#include #include #include #include @@ -84,39 +85,6 @@ #include #include #include -<<<<<<< local -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include -#endif -#include -#ifndef _DBA_CORE_TABLECONTAINER_HXX_ -#include "tablecontainer.hxx" -#endif -#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ -#include -#endif -#ifndef _COMPHELPER_INTERACTION_HXX_ -#include -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ -#include -#endif -#ifndef _UTL_CONFIGMGR_HXX_ -======= ->>>>>>> other #include using namespace utl; diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 8e992d691..d390cadb7 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -546,18 +546,6 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio ClearableMutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed); - ::rtl::OUString sURL; - if ( !getURLForRegisteredObject( _rName, sURL ) ) - throw NoSuchElementException( _rName, *this ); - - if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() ) - { - OSL_ENSURE( false, "ODatabaseContext::revokeObject: a database document register by name? This shouldn't happen anymore!" ); - // all the code should have been changed so that registration is by URL only - m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ]; - } - -<<<<<<< local ::rtl::OUString sURL = getDatabaseLocation( _rName ); revokeDatabaseLocation( _rName ); @@ -572,13 +560,6 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL); if ( aExistent != m_aDatabaseObjects.end() ) m_aDatabaseObjects.erase(aExistent); -======= - OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE ); - if ( !aDbRegisteredNamesRoot.removeNode( _rName ) ) - throw Exception( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An unexpected und unknown error occured." ) ), *this ); - aDbRegisteredNamesRoot.commit(); ->>>>>>> other // notify our container listeners ContainerEvent aEvent( *this, makeAny( _rName ), Any(), Any() ); diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 6d4d8fc0c..a0f37483d 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -88,7 +88,6 @@ #define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 ) #define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 ) #define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) -<<<<<<< local #define RID_STR_NO_SUB_FOLDER ( RID_CORE_STRINGS_START + 48 ) #define RID_STR_NO_DELETE_BEFORE_AFTER ( RID_CORE_STRINGS_START + 49 ) @@ -111,9 +110,7 @@ #define RID_STR_CONNECTION_REQUEST ( RID_CORE_STRINGS_START + 65 ) #define RID_STR_MISSING_EXTENSION ( RID_CORE_STRINGS_START + 66 ) -======= -#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 48 ) ->>>>>>> other +#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 67 ) #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 03c3fc3a3..cbfc5bc27 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -325,91 +325,6 @@ namespace return eErrorCode; } -<<<<<<< local - //------------------------------------------------------------------------------ - ::rtl::OUString QuoteField( const OQueryDesignView* _pView,const ::rtl::OUString& rValue, sal_Int32 aType ) - { - ::rtl::OUString rNewValue; - switch (rValue.toChar()) - { - case '?': - if (rValue.getLength() != 1) - break; - case '\'': // ::rtl::OUString Quotierung oder Datum - //case '#': // Datumsquotierung // jetengine - case ':': // Parameter - case '[': // Parameter - return rValue; - } - - Reference< XConnection> xConnection = static_cast(_pView->getController()).getConnection(); - Reference< XDatabaseMetaData > xMetaData; - if(xConnection.is()) - xMetaData = xConnection->getMetaData(); - ::rtl::OUString aQuote; - try - { - if(xMetaData.is()) - aQuote = xMetaData->getIdentifierQuoteString(); - - switch( aType ) - { - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - if (rValue.toChar() != '{') // nur quoten, wenn kein Access Datum - rNewValue = ::dbtools::quoteName(aQuote,rValue); - else - rNewValue = rValue; - break; - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - case DataType::CLOB: - rNewValue = ::dbtools::quoteName(aQuote,rValue); - break; - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::BIGINT: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - case DataType::BLOB: - rNewValue = rValue; - break; - case DataType::BIT: - case DataType::BOOLEAN: - { - if(xMetaData.is()) - { - ::comphelper::UStringMixEqual bCase(xMetaData->supportsMixedCaseQuotedIdentifiers()); - if (bCase(rValue, String(ModuleRes(STR_QUERY_TRUE)))) - rNewValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRUE")); - else if (bCase(rValue, String(ModuleRes(STR_QUERY_FALSE)))) - rNewValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FALSE")); - else - rNewValue = rValue; - } - } - break; - default: - DBG_ERROR( "QuoteField: illegal type" ); - break; - } - } - catch(SQLException&) - { - DBG_ERROR( "QuoteField: Exception" ); - } - return rNewValue; - } -======= ->>>>>>> other // ----------------------------------------------------------------------------- /** FillDragInfo fills the field description out of the table @@ -1387,11 +1302,7 @@ namespace GetInnerJoinCriteria(_pView,pNodeTmp); // now simplify again, join are checked in ComparisonPredicate ::connectivity::OSQLParseNode::absorptions(pNodeTmp); -<<<<<<< local pNodeTmp = pNode->getChild(1); -======= - pNodeTmp = pNode->getChild(1); ->>>>>>> other // it could happen that pCondition is not more valid eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pNodeTmp, rLevel); -- cgit v1.2.3 From 2e3bf95e3466b0ec10fdd4c116f4befb62a4cc6a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 13 Jan 2010 13:52:52 +0100 Subject: dba33d: set control as string --- dbaccess/source/filter/xml/xmlColumn.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx b/dbaccess/source/filter/xml/xmlColumn.cxx index 18daf6579..4e6e8796f 100644 --- a/dbaccess/source/filter/xml/xmlColumn.cxx +++ b/dbaccess/source/filter/xml/xmlColumn.cxx @@ -130,7 +130,8 @@ OXMLColumn::OXMLColumn( ODBFilter& rImport break; case XML_TOK_COLUMN_DEFAULT_VALUE: if ( sValue.getLength() && sType.getLength() ) - SvXMLUnitConverter::convertAny(m_aDefaultValue,sType,sValue); + m_aDefaultValue <<= sValue; + // SvXMLUnitConverter::convertAny(m_aDefaultValue,sType,sValue); break; case XML_TOK_COLUMN_VISIBLE: m_bHidden = sValue.equalsAscii("false"); -- cgit v1.2.3 From 1c0cbdf8dc26574cb0c534adcac39ffe648417eb Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 15 Jan 2010 08:06:07 +0100 Subject: dba33d: #i106772# slice decimal value to scale --- dbaccess/source/core/api/KeySet.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 69def7275..2576afc03 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -802,7 +802,24 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow) SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); for(;aPosIter != aPosEnd;++aPosIter,++aIter) { - *aIter = (_rInsertRow->get())[aPosIter->second.nPosition]; + ORowSetValue aValue((_rInsertRow->get())[aPosIter->second.nPosition]); + switch(aPosIter->second.nType) + { + case DataType::DECIMAL: + case DataType::NUMERIC: + { + ::rtl::OUString sValue = aValue.getString(); + sal_Int32 nIndex = sValue.indexOf('.'); + if ( nIndex != -1 ) + { + aValue = sValue.copy(0,nIndex + (aPosIter->second.nScale > 0 ? aPosIter->second.nScale + 1 : 0)); + } + } + break; + default: + break; + } + *aIter = aValue; aIter->setTypeKind(aPosIter->second.nType); } } -- cgit v1.2.3 From fd292dd7abff82ef3c301d99cf54aef4a3cd4060 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 15 Jan 2010 10:59:38 +0100 Subject: dba33d: create sdb interaction --- dbaccess/source/ui/misc/WCopyTable.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 205935bfd..10d91fe99 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -709,6 +709,8 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex ); ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex ); + m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY); + OCopyTable* pPage1( new OCopyTable( this ) ); pPage1->disallowViews(); pPage1->setCreateStyleAction(); -- cgit v1.2.3 From 6aa33be5e6ba29cc641b4b0641db1a394763dc14 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 20 Jan 2010 14:49:00 +0100 Subject: dba33d: #i106772# cut decimal and numeric when greater than scale allows to be --- dbaccess/source/core/api/KeySet.cxx | 43 +++++++++++++++++++++---------------- dbaccess/source/core/api/KeySet.hxx | 2 ++ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 2576afc03..242f83b21 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -594,6 +594,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow sal_Int32 nPos = aIter->second.nPosition; if((_rInsertRow->get())[nPos].isModified()) { + impl_convertValue_throw(_rInsertRow,aIter->second); (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned()); setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale); } @@ -676,6 +677,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind()); else { + impl_convertValue_throw(_rInsertRow,aIter->second); (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]); setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale); } @@ -802,24 +804,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow) SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); for(;aPosIter != aPosEnd;++aPosIter,++aIter) { - ORowSetValue aValue((_rInsertRow->get())[aPosIter->second.nPosition]); - switch(aPosIter->second.nType) - { - case DataType::DECIMAL: - case DataType::NUMERIC: - { - ::rtl::OUString sValue = aValue.getString(); - sal_Int32 nIndex = sValue.indexOf('.'); - if ( nIndex != -1 ) - { - aValue = sValue.copy(0,nIndex + (aPosIter->second.nScale > 0 ? aPosIter->second.nScale + 1 : 0)); - } - } - break; - default: - break; - } - *aIter = aValue; + *aIter = (_rInsertRow->get())[aPosIter->second.nPosition]; aIter->setTypeKind(aPosIter->second.nType); } } @@ -1477,3 +1462,25 @@ namespace dbaccess } } } +// ----------------------------------------------------------------------------- +void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData) +{ + ORowSetValue& aValue((_rInsertRow->get())[i_aMetaData.nPosition]); + switch(i_aMetaData.nType) + { + case DataType::DECIMAL: + case DataType::NUMERIC: + { + ::rtl::OUString sValue = aValue.getString(); + sal_Int32 nIndex = sValue.indexOf('.'); + if ( nIndex != -1 ) + { + aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0)); + } + } + break; + default: + break; + } +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index c7b2e71d5..3437279a8 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -134,6 +134,8 @@ namespace dbaccess ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getKeyColumns() const; void fillAllRows(); sal_Bool fetchRow(); + + void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData); protected: virtual ~OKeySet(); public: -- cgit v1.2.3 From 941f6a51d88889370c893ed795c112a639d3ba6d Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 21 Jan 2010 08:32:46 +0100 Subject: dba33d: #i108517# order of checks changed --- dbaccess/source/core/api/RowSet.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 71bcc7d0e..dcde3e392 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2652,8 +2652,8 @@ void ORowSet::checkUpdateIterator() void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { checkCache(); - if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); + if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this ); if ( rowDeleted() ) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this ); @@ -2661,8 +2661,8 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) if ( m_aCurrentRow.isNull() ) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this ); - if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this ); + if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); } // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) -- cgit v1.2.3