diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-07-11 07:54:04 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-07-11 07:54:04 +0000 |
commit | 05cf419401d634668dc53b1d14886e68ab6ddfb9 (patch) | |
tree | d70b7daec95c07041ec94898636d7d3f97cc43d6 /dbaccess/source/ui/dlg/adtabdlg.cxx | |
parent | 1e52b19068940dcff3daa43b05f9540e25f6c48b (diff) |
#97321# remove views out of table filter when they appear in the views too
Diffstat (limited to 'dbaccess/source/ui/dlg/adtabdlg.cxx')
-rw-r--r-- | dbaccess/source/ui/dlg/adtabdlg.cxx | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx index eac54b9064f9..89e9719244ae 100644 --- a/dbaccess/source/ui/dlg/adtabdlg.cxx +++ b/dbaccess/source/ui/dlg/adtabdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: adtabdlg.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2002-05-07 05:45:13 $ + * last change: $Author: oj $ $Date: 2002-07-11 08:54:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -252,16 +252,31 @@ void OAddTableDlg::UpdateTableList(BOOL bViewsAllowed) Sequence< ::rtl::OUString> sTables,sViews; if (xTables.is()) sTables = xTables->getElementNames(); - if(bViewsAllowed) + + xViewSupp = Reference< XViewsSupplier >(xTableSupp, UNO_QUERY); + if (xViewSupp.is()) { - xViewSupp = Reference< XViewsSupplier >(xTableSupp, UNO_QUERY); - if (xViewSupp.is()) - { - xViews = xViewSupp->getViews(); - if (xViews.is()) - sViews = xViews->getElementNames(); - } + xViews = xViewSupp->getViews(); + if (xViews.is()) + sViews = xViews->getElementNames(); + } + // if no views are allowed remove the views also out the table name filter + if ( !bViewsAllowed ) + { + const ::rtl::OUString* pTableBegin = sTables.getConstArray(); + const ::rtl::OUString* pTableEnd = pTableBegin + sTables.getLength(); + ::std::vector< ::rtl::OUString > aTables(pTableBegin,pTableEnd); + + const ::rtl::OUString* pViewBegin = sViews.getConstArray(); + const ::rtl::OUString* pViewEnd = pViewBegin + sViews.getLength(); + ::comphelper::TStringMixEqualFunctor aEqualFunctor; + for(;pViewBegin != pViewEnd;++pViewBegin) + aTables.erase(::std::remove_if(aTables.begin(),aTables.end(),::std::not1(::std::bind2nd(aEqualFunctor,*pViewBegin)))); + sTables = Sequence< ::rtl::OUString>(aTables.begin(),aTables.size()); + sViews = Sequence< ::rtl::OUString>(); } aTableList.UpdateTableList(Reference< XConnection>(xTableSupp,UNO_QUERY)->getMetaData(),sTables,sViews); } +// ----------------------------------------------------------------------------- + |