Tag: cws_src680_dba201b User: oj Date: 05/07/14 23:07:01 Modified: /dba/dbaccess/source/ui/browser/ brwctrlr.cxx, unodatbr.cxx /dba/dbaccess/source/ui/inc/ brwctrlr.hxx, unodatbr.hxx
Log: #i51888# allow the remove of a filter if the statement contains an error File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: brwctrlr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/brwctrlr.cxx?r1=1.87.2.1&r2=1.87.2.2 Delta lines: +53 -35 --------------------- --- brwctrlr.cxx 11 Jul 2005 13:37:13 -0000 1.87.2.1 +++ brwctrlr.cxx 15 Jul 2005 06:06:56 -0000 1.87.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: brwctrlr.cxx,v $ * - * $Revision: 1.87.2.1 $ + * $Revision: 1.87.2.2 $ * - * last change: $Author: fs $ $Date: 2005/07/11 13:37:13 $ + * last change: $Author: oj $ $Date: 2005/07/15 06:06:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -801,16 +801,7 @@ void SbaXDataBrowserController::addModelListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) { // ... all the grid columns - Reference< ::com::sun::star::container::XIndexContainer > xColumns(getControlModel(), UNO_QUERY); - if (xColumns.is()) - { - sal_Int32 nCount = xColumns->getCount(); - for (sal_uInt16 i=0; i < nCount; ++i) - { - Reference< XPropertySet > xCol(xColumns->getByIndex(i),UNO_QUERY); - AddColumnListener(xCol); - } - } + addColumnListeners(_xGridControlModel); // (we are interested in all columns the grid has (and only in these) so we have to listen to the container, too) Reference< ::com::sun::star::container::XContainer > xColContainer(_xGridControlModel, UNO_QUERY); @@ -1462,12 +1453,23 @@ // no chance without a view if (!getBrowserView() || !getBrowserView()->getVclControl()) return aReturn; - // no chance without valid models - if (isValid() && !isValidCursor()) + + switch (nId) + { + case ID_BROWSER_REMOVEFILTER: + if (!m_xParser.is()) + break; + // any filter or sort order set ? + aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); return aReturn; + break; + } // no chance while loading the form if (PendingLoad()) return aReturn; + // no chance without valid models + if (isValid() && !isValidCursor()) + return aReturn; switch (nId) { @@ -1545,13 +1547,6 @@ } break; - case ID_BROWSER_REMOVEFILTER: - if (!m_xParser.is()) - break; - // any filter or sort order set ? - aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); - break; - case ID_BROWSER_REFRESH: // aReturn.bEnabled = isValidCursor(); aReturn.bEnabled = sal_True; @@ -1862,7 +1857,7 @@ Reference< XPropertySet > xActiveSet(getRowSet(), UNO_QUERY); sal_Bool bApplied = ::comphelper::getBOOL(xActiveSet->getPropertyValue(PROPERTY_APPLYFILTER)); xActiveSet->setPropertyValue(PROPERTY_APPLYFILTER, ::comphelper::makeBoolAny(sal_Bool(!bApplied))); - reloadForm(Reference< XLoadable >(xActiveSet, UNO_QUERY)); + reloadForm(m_xLoadable); } InvalidateFeature(ID_BROWSER_FILTERED); break; @@ -2042,22 +2037,25 @@ if (!SaveModified()) break; + sal_Bool bNeedPostReload = preReloadForm(); // reset the filter and the sort property simutaneously so only _one_ new statement has to be // sent Reference< XPropertySet > xSet(getRowSet(), UNO_QUERY); + if ( xSet.is() ) + { xSet->setPropertyValue(PROPERTY_FILTER,makeAny(::rtl::OUString())); xSet->setPropertyValue(PROPERTY_HAVING_CLAUSE,makeAny(::rtl::OUString())); xSet->setPropertyValue(PROPERTY_ORDER,makeAny(::rtl::OUString())); - { - WaitObject aWO(getBrowserView()); + } try { - reloadForm(Reference< XLoadable >(getRowSet(), UNO_QUERY)); + reloadForm(m_xLoadable); + if ( bNeedPostReload ) + postReloadForm(); } catch(Exception&) { } - } InvalidateFeature(ID_BROWSER_REMOVEFILTER); InvalidateFeature(ID_BROWSER_FILTERED); } @@ -2066,7 +2064,7 @@ case ID_BROWSER_REFRESH: if ( SaveModified( ) ) { - if (!reloadForm(Reference< XLoadable >(getRowSet(), UNO_QUERY))) + if (!reloadForm(m_xLoadable)) criticalFail(); } break; @@ -2983,6 +2981,26 @@ _xLayoutManager->doLayout(); } } +} +// ----------------------------------------------------------------------------- +void SbaXDataBrowserController::addColumnListeners(const Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel) +{ +// ... all the grid columns + Reference< ::com::sun::star::container::XIndexContainer > xColumns(_xGridControlModel, UNO_QUERY); + if (xColumns.is()) + { + sal_Int32 nCount = xColumns->getCount(); + for (sal_uInt16 i=0; i < nCount; ++i) + { + Reference< XPropertySet > xCol(xColumns->getByIndex(i),UNO_QUERY); + AddColumnListener(xCol); + } + } +} +// ----------------------------------------------------------------------------- +sal_Bool SbaXDataBrowserController::InitializeGridModel(const Reference< ::com::sun::star::form::XFormComponent > & xGrid) +{ + return sal_True; } //.................................................................. } // namespace dbaui File [changed]: unodatbr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.170.20.1&r2=1.170.20.2 Delta lines: +39 -2 -------------------- --- unodatbr.cxx 11 Jul 2005 13:37:14 -0000 1.170.20.1 +++ unodatbr.cxx 15 Jul 2005 06:06:56 -0000 1.170.20.2 @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.170.20.1 $ + * $Revision: 1.170.20.2 $ * - * last change: $Author: fs $ $Date: 2005/07/11 13:37:14 $ + * last change: $Author: oj $ $Date: 2005/07/15 06:06:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1689,6 +1689,9 @@ aReturn.aState = ::cppu::bool2any(haveExplorer()); return aReturn; } + case ID_BROWSER_REMOVEFILTER: + aReturn = SbaXDataBrowserController::GetState(nId); + return aReturn; } if (!isLoaded()) @@ -3823,6 +3826,40 @@ } setTitle(sTitle); } +} +// ----------------------------------------------------------------------------- +sal_Bool SbaTableQueryBrowser::preReloadForm() +{ + sal_Bool bIni = sal_False; + if ( !m_pCurrentlyDisplayed ) + { + // switch the grid to design mode while loading + getBrowserView()->getGridControl()->setDesignMode(sal_True); + // we had an invalid statement so we need to connect the column models + Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY); + ::svx::ODataAccessDescriptor aDesc(xProp); + // extract the props + ::rtl::OUString sDataSource; + ::rtl::OUString sCommand; + sal_Int32 nCommandType = CommandType::COMMAND; + sal_Bool bEscapeProcessing = sal_True; + extractDescriptorProps(aDesc, sDataSource, sCommand, nCommandType, bEscapeProcessing); + if ( sDataSource.getLength() && sCommand.getLength() && (-1 != nCommandType) ) + { + SvLBoxEntry* pDataSource = NULL; + SvLBoxEntry* pCommandType = NULL; + m_pCurrentlyDisplayed = getObjectEntry(sDataSource, sCommand, nCommandType, &pDataSource, &pCommandType, sal_True,NULL); + bIni = sal_True; + } + } + return bIni; +} +// ----------------------------------------------------------------------------- +void SbaTableQueryBrowser::postReloadForm() +{ + InitializeGridModel(getFormComponent()); + LoadFinished(sal_True); + updateTitle(); } // ......................................................................... } // namespace dbaui Directory: /dba/dbaccess/source/ui/inc/ ======================================= File [changed]: brwctrlr.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/brwctrlr.hxx?r1=1.31&r2=1.31.52.1 Delta lines: +10 -4 -------------------- --- brwctrlr.hxx 1 Mar 2005 19:16:37 -0000 1.31 +++ brwctrlr.hxx 15 Jul 2005 06:06:57 -0000 1.31.52.1 @@ -2,9 +2,9 @@ * * $RCSfile: brwctrlr.hxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.31.52.1 $ * - * last change: $Author: kz $ $Date: 2005/03/01 19:16:37 $ + * last change: $Author: oj $ $Date: 2005/07/15 06:06:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -320,6 +320,8 @@ // do any initialization (data source etc.) here. the form should be fully functional after that. // return sal_False if you didn't succeed (don't throw exceptions, they won't be catched) + virtual sal_Bool InitializeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > CreateGridModel(); // our default implementation simply instantiates a stardiv.one.form.component.Grid service @@ -390,7 +392,10 @@ void initFormatter(); /// loads or reloads the form - sal_Bool reloadForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable); + virtual sal_Bool reloadForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable); + + virtual sal_Bool preReloadForm(){ return sal_False; } + virtual void postReloadForm(){} private: void setCurrentModified( sal_Bool _bSet ); @@ -407,6 +412,7 @@ sal_uInt16 getCurrentColumnPosition(); void setCurrentColumnPosition(sal_uInt16 _nPos); void deleteView(); + void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel); // time to check the CUT/COPY/PASTE-slot-states DECL_LINK( OnInvalidateClipboard, void* ); File [changed]: unodatbr.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/unodatbr.hxx?r1=1.60&r2=1.60.2.1 Delta lines: +6 -3 ------------------- --- unodatbr.hxx 8 Jul 2005 10:39:36 -0000 1.60 +++ unodatbr.hxx 15 Jul 2005 06:06:58 -0000 1.60.2.1 @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.hxx,v $ * - * $Revision: 1.60 $ + * $Revision: 1.60.2.1 $ * - * last change: $Author: obo $ $Date: 2005/07/08 10:39:36 $ + * last change: $Author: oj $ $Date: 2005/07/15 06:06:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -260,6 +260,9 @@ // SbaXDataBrowserController overridables virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm); virtual sal_Bool InitializeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid); + + virtual sal_Bool preReloadForm(); + virtual void postReloadForm(); #if defined(_MSC_VER) && (_MSC_VER >= 1310 ) typedef ::com::sun::star::frame::XStatusListener xstlist_type; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
