summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2011-03-09 23:17:51 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-03-09 23:17:51 -0600
commit256f6ca67d03b875e8e6a355a6cf5130ea7404a3 (patch)
treec1916add744093d07466b54d6af832cd87891d8e /dbaccess/source/ui/browser
parentf71ad82e60bebde81ebb193dcd16305ca339cc1a (diff)
parentdee1ea70160df84946cf9040281de42945faf65a (diff)
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (76 commits) masterfix DEV300: #i10000# usage of L10N build_type removetooltypes01: Fix build problems after rebase to DEV300m99 in basctl, cui, reportdesign, sw hr75: #i116747#: remove obsolete copyright notices gnumake3: remove comphelper version; fix including extract.hxx removetooltypes01: #i112600# Replace missing tools types replacement removetooltypes01: #i112600# remove tooltypes from reportdesign removetooltypes01: #i112600# remove tooltypes from dbaccess undoapi: don't use deprecated JUnit API, this seems to fail now (but didn't before the rebase) undoapi: those two classes do not belong into JAVATESTFILES, but JAVAFILES only undoapi: (I|Sfx)UndoManager now working with size_t instead of USHORT gridsort: give the UnoControl(Model/Base) classes a ctor taking a service factory, so we have access to the factory which created us, and don't need to resort to the process'es service factory dba34b: #109956# notify column value in correct order dba34b: #i114309# set default values for bit boolean and reset when we are on the insertrow undoapi: assert unknown slots in ImplInvalidateFeature dba34b: #i110907# check if design handle event dba34b: #i109956# notify column values when row is refreshed dba34b: #i115753# add test again undoapi: renamed Undo.* to RptUndo.*, to not confuse a certain IDE with different same-named files in the source tree ... undoapi: migrated report designer to use an own, model-bound UndoManager, instead of the UndoManager formerly bound to the controller undoapi: split OSingleDocumentController into DBSubComponentController (which the report design's controller will be derived from) and the still-so-named OSingleDocumentController. Module reportdesign does not compile with this change, this is yet to come. ... Conflicts: dbaccess/inc/IEnvironment.hxx dbaccess/inc/dataview.hxx dbaccess/qa/complex/dbaccess/RowSet.java dbaccess/source/core/api/CacheSet.cxx dbaccess/source/core/api/KeySet.hxx dbaccess/source/core/api/OptimisticSet.hxx dbaccess/source/core/api/RowSet.cxx dbaccess/source/core/api/RowSetCache.cxx dbaccess/source/ext/adabas/Acomponentmodule.cxx dbaccess/source/ext/adabas/Aservices.cxx dbaccess/source/filter/migration/cfgimport.cxx dbaccess/source/filter/migration/cfgimport.hxx dbaccess/source/filter/migration/cfgservices.cxx dbaccess/source/filter/migration/makefile.mk dbaccess/source/inc/cfg_reghelper.hxx dbaccess/source/sdbtools/misc/sdbt_services.cxx dbaccess/source/shared/cfg_reghelper.cxx dbaccess/source/shared/cfgstrings.cxx dbaccess/source/shared/registrationhelper.cxx dbaccess/source/ui/app/AppController.cxx dbaccess/source/ui/app/AppDetailPageHelper.cxx dbaccess/source/ui/app/AppDetailPageHelper.hxx dbaccess/source/ui/app/AppDetailView.cxx dbaccess/source/ui/app/AppIconControl.cxx dbaccess/source/ui/app/AppSwapWindow.cxx dbaccess/source/ui/browser/brwctrlr.cxx dbaccess/source/ui/browser/dataview.cxx dbaccess/source/ui/browser/unodatbr.cxx dbaccess/source/ui/control/dbtreelistbox.cxx dbaccess/source/ui/control/opendoccontrols.cxx dbaccess/source/ui/control/tabletree.cxx dbaccess/source/ui/dlg/ConnectionHelper.cxx dbaccess/source/ui/dlg/ConnectionPage.src dbaccess/source/ui/dlg/ExtensionNotPresent.cxx dbaccess/source/ui/dlg/ExtensionNotPresent.hrc dbaccess/source/ui/dlg/ExtensionNotPresent.src dbaccess/source/ui/dlg/TablesSingleDlg.cxx dbaccess/source/ui/dlg/adodatalinks.hxx dbaccess/source/ui/dlg/dbadmin2.src dbaccess/source/ui/dlg/dbadminsetup.src dbaccess/source/ui/dlg/dlgattr.cxx dbaccess/source/ui/dlg/dlgsize.src dbaccess/source/ui/dlg/makefile.mk dbaccess/source/ui/dlg/sqlmessage.cxx dbaccess/source/ui/inc/ExtensionNotPresent.hxx dbaccess/source/ui/inc/TokenWriter.hxx dbaccess/source/ui/inc/imageprovider.hxx dbaccess/source/ui/misc/DExport.cxx dbaccess/source/ui/misc/HtmlReader.cxx dbaccess/source/ui/misc/RowSetDrop.cxx dbaccess/source/ui/misc/RtfReader.cxx dbaccess/source/ui/misc/TokenWriter.cxx dbaccess/source/ui/misc/imageprovider.cxx dbaccess/source/ui/misc/linkeddocuments.cxx dbaccess/source/ui/misc/singledoccontroller.cxx dbaccess/source/ui/querydesign/ConnectionData.hxx dbaccess/source/ui/querydesign/JoinTableView.cxx dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx dbaccess/source/ui/querydesign/TableConnectionData.cxx dbaccess/source/ui/querydesign/TableWindowListBox.cxx dbaccess/source/ui/relationdesign/RelationController.cxx dbaccess/source/ui/relationdesign/RelationTableView.cxx dbaccess/source/ui/tabledesign/table.src reportdesign/inc/RptPage.hxx reportdesign/qa/complex/reportdesign/ReportDesignerTest.java reportdesign/source/core/api/ReportDefinition.cxx reportdesign/source/core/sdr/ReportUndoFactory.cxx reportdesign/source/core/sdr/UndoEnv.cxx reportdesign/source/filter/xml/xmlservices.cxx reportdesign/source/ui/dlg/GroupsSorting.cxx reportdesign/source/ui/dlg/Navigator.cxx reportdesign/source/ui/inspection/metadata.cxx reportdesign/source/ui/misc/RptUndo.cxx reportdesign/source/ui/misc/UITools.cxx reportdesign/source/ui/misc/rptuiservices.cxx reportdesign/source/ui/report/DesignView.cxx reportdesign/source/ui/report/FixedTextColor.cxx reportdesign/source/ui/report/ReportController.cxx reportdesign/source/ui/report/ReportSection.cxx reportdesign/source/ui/report/SectionView.cxx reportdesign/source/ui/report/SectionWindow.cxx reportdesign/source/ui/report/StartMarker.cxx reportdesign/source/ui/report/ViewsWindow.cxx reportdesign/source/ui/report/dlgedfunc.cxx reportdesign/source/ui/report/report.src
Diffstat (limited to 'dbaccess/source/ui/browser')
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx81
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx4
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx37
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx2
-rw-r--r--dbaccess/source/ui/browser/dbtreemodel.hxx4
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx4
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx2
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx18
-rw-r--r--dbaccess/source/ui/browser/sbabrw.src2
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx348
11 files changed, 335 insertions, 169 deletions
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 1bdeb80ba45d..29e243823b67 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -739,6 +739,26 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
+ {
+ const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY );
+ const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY );
+ if ( xAnalyzer.is() )
+ {
+ const Reference< XIndexAccess > xOrderColumns( xAnalyzer->getOrderColumns(), UNO_SET_THROW );
+ const sal_Int32 nOrderColumns( xOrderColumns->getCount() );
+ for ( sal_Int32 c=0; c<nOrderColumns; ++c )
+ {
+ const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
+ ::rtl::OUString sColumnName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName);
+ ::rtl::OUString sTableName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName);
+ (void)sColumnName;
+ (void)sTableName;
+ }
+ }
+ }
+
Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY );
if ( xWarnings.is() )
{
@@ -809,7 +829,8 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent)
m_xColumnsSupplier.set(m_xRowSet,UNO_QUERY);
m_xLoadable.set(m_xRowSet,UNO_QUERY);
- if (!InitializeForm(m_xRowSet))
+ Reference< XPropertySet > xFormProperties( m_xRowSet, UNO_QUERY );
+ if ( !InitializeForm( xFormProperties ) )
return sal_False;
m_xGridModel = CreateGridModel();
@@ -1207,11 +1228,7 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
- // the filter or the sort criterias have changed ? -> update our parser
- if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND))
- {
- }
- else if (evt.PropertyName.equals(PROPERTY_FILTER))
+ if (evt.PropertyName.equals(PROPERTY_FILTER))
{
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
@@ -1851,25 +1868,50 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi
setCurrentColumnPosition(nPos);
}
+
//------------------------------------------------------------------------------
Reference< XSingleSelectQueryComposer > SbaXDataBrowserController::createParser_nothrow()
{
- Reference< XSingleSelectQueryComposer > xRet;
+ Reference< XSingleSelectQueryComposer > xComposer;
try
{
- Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY_THROW);
- const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY_THROW);
- xRet.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY_THROW);
- xRet->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND)));
- xRet->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER)));
- xRet->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE)));
- xRet->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER)));
+ const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
+ const Reference< XMultiServiceFactory > xFactory(
+ xRowSetProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY_THROW );
+ xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW );
+
+ ::rtl::OUString sActiveCommand;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sActiveCommand );
+ if ( sActiveCommand.getLength() > 0 )
+ {
+ xComposer->setElementaryQuery( sActiveCommand );
+ }
+ else
+ {
+ ::rtl::OUString sCommand;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand );
+ sal_Int32 nCommandType = CommandType::COMMAND;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= nCommandType );
+ xComposer->setCommand( sCommand, nCommandType );
+ }
+
+ ::rtl::OUString sFilter;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_FILTER ) >>= sFilter );
+ xComposer->setFilter( sFilter );
+
+ ::rtl::OUString sHavingClause;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_HAVING_CLAUSE ) >>= sHavingClause );
+ xComposer->setHavingClause( sHavingClause );
+
+ ::rtl::OUString sOrder;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ORDER ) >>= sOrder );
+ xComposer->setOrder( sOrder );
}
- catch(Exception&)
+ catch ( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
- return xRet;
+ return xComposer;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
@@ -1891,10 +1933,8 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
{
DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
String aFilter;
- if(!aDlg.Execute())
- {
- return; // if so we don't need to actualize the grid
- }
+ if ( !aDlg.Execute() )
+ return; // if so we don't need to update the grid
aDlg.BuildWherePart();
}
else
@@ -2683,7 +2723,6 @@ void SbaXDataBrowserController::initializeParser() const
{ // (only if the statement isn't native)
// (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
- }
}
catch(Exception&)
{
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index f7286e6a9377..337cd3b01177 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -334,8 +334,8 @@ long UnoDataBrowserView::PreNotify( NotifyEvent& rNEvt )
{
const KeyEvent* pKeyEvt = rNEvt.GetKeyEvent();
const KeyCode& rKeyCode = pKeyEvt->GetKeyCode();
- if ( ( rKeyCode == KeyCode( KEY_E, TRUE, TRUE, FALSE, FALSE ) )
- || ( rKeyCode == KeyCode( KEY_TAB, TRUE, FALSE, FALSE, FALSE ) )
+ if ( ( rKeyCode == KeyCode( KEY_E, sal_True, sal_True, sal_False, sal_False ) )
+ || ( rKeyCode == KeyCode( KEY_TAB, sal_True, sal_False, sal_False, sal_False ) )
)
{
if ( m_pTreeView && m_pVclControl && m_pTreeView->HasChildPathFocus() )
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index c0e3157bfb75..ff4817eba056 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -35,7 +35,6 @@
#include <comphelper/namedvaluecollection.hxx>
#include <sfx2/app.hxx>
#include <sfx2/imgmgr.hxx>
-#include <vcl/fixed.hxx>
#include "IController.hxx"
#include "UITools.hxx"
#include <sfx2/sfx.hrc>
@@ -84,11 +83,12 @@ namespace dbaui
:Window(pParent,nStyle)
,m_xServiceFactory(_rFactory)
,m_rController( _rController )
- ,m_pSeparator( NULL )
+ ,m_aSeparator( this )
{
DBG_CTOR(ODataView,NULL);
m_rController.acquire();
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
+ m_aSeparator.Show();
}
// -------------------------------------------------------------------------
@@ -101,30 +101,10 @@ namespace dbaui
{
DBG_DTOR(ODataView,NULL);
- enableSeparator( sal_False );
m_rController.release();
}
// -------------------------------------------------------------------------
- void ODataView::enableSeparator( const sal_Bool _bEnable )
- {
- if ( _bEnable == isSeparatorEnabled() )
- // nothing to do
- return;
-
- if ( _bEnable )
- {
- m_pSeparator = new FixedLine( this );
- m_pSeparator->Show( );
- }
- else
- {
- ::std::auto_ptr<FixedLine> aTemp(m_pSeparator);
- m_pSeparator = NULL;
- }
- Resize();
- }
- // -------------------------------------------------------------------------
void ODataView::resizeDocumentView( Rectangle& /*_rPlayground*/ )
{
}
@@ -148,15 +128,10 @@ namespace dbaui
{
Rectangle aPlayground( _rPlayground );
- // position thew separator
- if ( m_pSeparator )
- {
- Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
-
- m_pSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
-
- aPlayground.Top() += aSeparatorSize.Height() + 1;
- }
+ // position the separator
+ const Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
+ m_aSeparator.SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
+ aPlayground.Top() += aSeparatorSize.Height() + 1;
// position the controls of the document's view
resizeDocumentView( aPlayground );
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index 21b4fc2d2172..0273c7f5a746 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -180,7 +180,7 @@ namespace dbaui
// -----------------------------------------------------------------------------
sal_Bool ODataClipboard::GetData( const DataFlavor& rFlavor )
{
- const ULONG nFormat = SotExchange::GetFormat(rFlavor);
+ const sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
switch (nFormat)
{
case SOT_FORMAT_RTF:
diff --git a/dbaccess/source/ui/browser/dbtreemodel.hxx b/dbaccess/source/ui/browser/dbtreemodel.hxx
index b0afe70a5fe1..12ce3ed3925a 100644
--- a/dbaccess/source/ui/browser/dbtreemodel.hxx
+++ b/dbaccess/source/ui/browser/dbtreemodel.hxx
@@ -42,8 +42,8 @@
// tables holds the nameaccess for the tables
// table holds the table
-#define CONTAINER_QUERIES ULONG( 0 )
-#define CONTAINER_TABLES ULONG( 1 )
+#define CONTAINER_QUERIES sal_uLong( 0 )
+#define CONTAINER_TABLES sal_uLong( 1 )
namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 76fa37d62bf8..0c1212c650fc 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -243,8 +243,8 @@ void SbaTableQueryBrowser::notifyHiContrastChanged()
}
// find the proper item, and set its icons
- USHORT nCount = pEntryLoop->ItemCount();
- for (USHORT i=0;i<nCount;++i)
+ sal_uInt16 nCount = pEntryLoop->ItemCount();
+ for (sal_uInt16 i=0;i<nCount;++i)
{
SvLBoxItem* pItem = pEntryLoop->GetItem(i);
if ( !pItem || ( pItem->IsA() != SV_ITEM_ID_LBOXCONTEXTBMP ) )
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 0b3e76a54115..68053fbbc234 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -124,7 +124,7 @@ Reference< XRowSet > SbaExternalSourceBrowser::CreateForm()
}
//------------------------------------------------------------------------------
-sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XRowSet > & /*xForm*/)
+sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XPropertySet > & /*i_formProperties*/)
{
return sal_True;
}
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index eaa199d78184..9dc5609a734c 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -336,7 +336,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
throw RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unable to create a view")), *this );
if ( m_bReadOnly || m_bPreview )
- pView->EnableInput( FALSE );
+ pView->EnableInput( sal_False );
impl_initialize();
}
@@ -635,6 +635,18 @@ void OGenericUnoController::InvalidateFeature_Impl()
// -----------------------------------------------------------------------
void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Reference< XStatusListener >& _xListener, sal_Bool _bForceBroadcast )
{
+#if OSL_DEBUG_LEVEL > 0
+ if ( _nId != -1 )
+ {
+ SupportedFeatures::iterator aFeaturePos = ::std::find_if(
+ m_aSupportedFeatures.begin(),
+ m_aSupportedFeatures.end(),
+ ::std::bind2nd( CompareFeatureById(), _nId )
+ );
+ OSL_ENSURE( aFeaturePos != m_aSupportedFeatures.end(), "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" );
+ }
+#endif
+
FeatureListener aListener;
aListener.nId = _nId;
aListener.xListener = _xListener;
@@ -1318,9 +1330,9 @@ void OGenericUnoController::openHelpAgent(rtl::OUString const& _suHelpStringURL
openHelpAgent( aURL );
}
-void OGenericUnoController::openHelpAgent(sal_Int32 _nHelpId)
+void OGenericUnoController::openHelpAgent(const rtl::OString& _sHelpId)
{
- openHelpAgent( createHelpAgentURL( lcl_getModuleHelpModuleName( getFrame() ), _nHelpId ) );
+ openHelpAgent( createHelpAgentURL( lcl_getModuleHelpModuleName( getFrame() ), _sHelpId ) );
}
void OGenericUnoController::openHelpAgent( const URL& _rURL )
diff --git a/dbaccess/source/ui/browser/sbabrw.src b/dbaccess/source/ui/browser/sbabrw.src
index 59a841993472..eebcc013788d 100644
--- a/dbaccess/source/ui/browser/sbabrw.src
+++ b/dbaccess/source/ui/browser/sbabrw.src
@@ -188,14 +188,12 @@ Menu RID_MENU_REFRESH_DATA
MenuItem
{
MID_SBA_QRY_REFRESH
- HelpId = SID_FM_REFRESH ;
Command = ".uno:Refresh";
};
MenuItem
{
Identifier = ID_BROWSER_REFRESH_REBUILD;
Command = ".uno:DBRebuildData";
- HelpId = HID_BROWSER_REFRESH_REBUILDVIEW;
Text [ en-US ] = "Rebuild";
};
};
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 9e39ac173874..3e4fc21d64fe 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -811,7 +811,7 @@ SbaGridControl::SbaGridControl(Reference< XMultiServiceFactory > _rM,
:FmGridControl(_rM,pParent, _pPeer, nBits)
,m_pMasterListener(NULL)
,m_nAsyncDropEvent(0)
- ,m_nCurrentActionColId((USHORT)-1)
+ ,m_nCurrentActionColId((sal_uInt16)-1)
,m_bActivatingForDrop(sal_False)
{
DBG_CTOR(SbaGridControl ,NULL);
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 73727f4fd21b..875900b76106 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -68,6 +68,7 @@
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -420,8 +421,146 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent)
return sal_True;
}
-// -------------------------------------------------------------------------
-sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm)
+// ---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ // -----------------------------------------------------------------------------------------------------------------
+ struct SelectValueByName : public ::std::unary_function< ::rtl::OUString, Any >
+ {
+ const Any& operator()( ::rtl::OUString const& i_name ) const
+ {
+ return m_rCollection.get( i_name );
+ }
+
+ SelectValueByName( ::comphelper::NamedValueCollection const& i_collection )
+ :m_rCollection( i_collection )
+ {
+ }
+
+ ::comphelper::NamedValueCollection const& m_rCollection;
+ };
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
+{
+ try
+ {
+ Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
+ sal_Bool bEscapeProcessing = sal_False;
+ OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
+ if ( !bEscapeProcessing )
+ // don't touch or interpret anything if escape processing is disabled
+ return;
+
+ Reference< XSingleSelectQueryComposer > xComposer( createParser_nothrow() );
+ if ( !xComposer.is() )
+ // can't do anything. Already reported via assertion in createParser_nothrow.
+ return;
+
+ // the tables participating in the statement
+ const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableNames( xSuppTables->getTables(), UNO_QUERY_THROW );
+
+ // the columns participating in the statement
+ const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xColumnNames( xSuppColumns->getColumns(), UNO_QUERY_THROW );
+
+ // .............................................................................................................
+ // check if the order columns apply to tables which really exist in the statement
+ const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW );
+ const sal_Int32 nOrderColumns( xOrderColumns->getCount() );
+ bool invalidColumn = false;
+ for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c )
+ {
+ const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
+ ::rtl::OUString sTableName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName );
+ ::rtl::OUString sColumnName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName );
+
+ if ( sTableName.getLength() == 0 )
+ {
+ if ( !xColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
+ else
+ {
+ if ( !xTableNames->hasByName( sTableName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+
+ const Reference< XColumnsSupplier > xSuppTableColumns( xTableNames->getByName( sTableName ), UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableColumnNames( xSuppTableColumns->getColumns(), UNO_QUERY_THROW );
+ if ( !xTableColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
+ }
+
+ if ( invalidColumn )
+ {
+ // reset the complete order statement at both the row set and the parser
+ const ::rtl::OUString sEmptyOrder;
+ xRowSetProps->setPropertyValue( PROPERTY_ORDER, makeAny( sEmptyOrder ) );
+ xComposer->setOrder( sEmptyOrder );
+ }
+
+ // .............................................................................................................
+ // check if the columns participating in the filter refer to existing tables
+ // TODO: there's no API at all for this. The method which comes nearest to what we need is
+ // "getStructuredFilter", but it returns pure column names only. That is, for a statement like
+ // "SELECT * FROM <table> WHERE <other_table>.<column> = <value>", it will return "<column>". But
+ // there's no API at all to retrieve the information about "<other_table>" - which is what would
+ // be needed here.
+ // That'd be a chance to replace getStructuredFilter with something more reasonable. This method
+ // has at least one other problem: For a clause like "<column> != <value>", it will return "<column>"
+ // as column name, "NOT_EQUAL" as operator, and "!= <value>" as value, effectively duplicating the
+ // information about the operator, and beding all clients to manually remove the "!=" from the value
+ // string.
+ // So, what really would be handy, is some
+ // XNormalizedFilter getNormalizedFilter();
+ // with
+ // interface XDisjunctiveFilterExpression
+ // {
+ // XConjunctiveFilterTerm getTerm( int index );
+ // }
+ // interface XConjunctiveFilterTerm
+ // {
+ // ComparisonPredicate getPredicate( int index );
+ // }
+ // struct ComparisonPredicate
+ // {
+ // XComparisonOperand Lhs;
+ // SQLFilterOperator Operator;
+ // XComparisonOperand Rhs;
+ // }
+ // interface XComparisonOperand
+ // {
+ // SQLFilterOperand Type;
+ // XPropertySet getColumn();
+ // string getLiteral();
+ // ...
+ // }
+ // enum SQLFilterOperand { Column, Literal, ... }
+ //
+ // ... or something like this ....
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+sal_Bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_formProperties )
{
if(!m_pCurrentlyDisplayed)
return sal_True;
@@ -429,50 +568,46 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star:
// this method set all format settings from the orignal table or query
try
{
- // we send all properties at once, maybe the implementation is clever enough to handle one big PropertiesChanged
- // more effective than many small PropertyChanged ;)
- Sequence< ::rtl::OUString> aProperties(3);
- Sequence< Any> aValues(3);
-
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData());
- OSL_ENSURE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
- OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
+ ENSURE_OR_RETURN_FALSE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
+ ENSURE_OR_RETURN_FALSE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
+
+ Reference< XPropertySetInfo > xPSI( pData->xObjectProperties->getPropertySetInfo(), UNO_SET_THROW );
+
+ ::comphelper::NamedValueCollection aPropertyValues;
- if ( pData->xObjectProperties.is() )
+ const ::rtl::OUString aTransferProperties[] =
{
- sal_Int32 nPos = 0;
- // is the filter intially applied ?
- aProperties.getArray()[nPos] = PROPERTY_APPLYFILTER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_APPLYFILTER);
+ PROPERTY_APPLYFILTER,
+ PROPERTY_FILTER,
+ PROPERTY_HAVING_CLAUSE,
+ PROPERTY_ORDER
+ };
+ for ( size_t i=0; i < sizeof( aTransferProperties ) / sizeof( aTransferProperties[0] ); ++i )
+ {
+ if ( !xPSI->hasPropertyByName( aTransferProperties[i] ) )
+ continue;
+ aPropertyValues.put( aTransferProperties[i], pData->xObjectProperties->getPropertyValue( aTransferProperties[i] ) );
+ }
- // the initial filter
- aProperties.getArray()[nPos] = PROPERTY_FILTER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_FILTER);
+ const ::std::vector< ::rtl::OUString > aNames( aPropertyValues.getNames() );
+ Sequence< ::rtl::OUString > aPropNames( aNames.size() );
+ ::std::copy( aNames.begin(), aNames.end(), aPropNames.getArray() );
- if ( pData->xObjectProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_HAVING_CLAUSE) )
- {
- aProperties.realloc(aProperties.getLength()+1);
- aValues.realloc(aValues.getLength()+1);
- // the initial having clause
- aProperties.getArray()[nPos] = PROPERTY_HAVING_CLAUSE;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_HAVING_CLAUSE);
- }
+ Sequence< Any > aPropValues( aNames.size() );
+ ::std::transform( aNames.begin(), aNames.end(), aPropValues.getArray(), SelectValueByName( aPropertyValues ) );
- // the initial ordering
- aProperties.getArray()[nPos] = PROPERTY_ORDER;
- aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_ORDER);
+ Reference< XMultiPropertySet > xFormMultiSet( i_formProperties, UNO_QUERY_THROW );
+ xFormMultiSet->setPropertyValues( aPropNames, aPropValues );
- Reference< XMultiPropertySet > xFormMultiSet(_rxForm, UNO_QUERY);
- xFormMultiSet->setPropertyValues(aProperties, aValues);
- }
+ impl_sanitizeRowSetClauses_nothrow();
}
- catch(Exception&)
+ catch ( const Exception& )
{
- OSL_FAIL("SbaTableQueryBrowser::InitializeForm : something went wrong !");
+ DBG_UNHANDLED_EXCEPTION();
return sal_False;
}
-
return sal_True;
}
@@ -481,8 +616,8 @@ void SbaTableQueryBrowser::initializePreviewMode()
{
if ( getBrowserView() && getBrowserView()->getVclControl() )
{
- getBrowserView()->getVclControl()->AlwaysEnableInput( FALSE );
- getBrowserView()->getVclControl()->EnableInput( FALSE );
+ getBrowserView()->getVclControl()->AlwaysEnableInput( sal_False );
+ getBrowserView()->getVclControl()->EnableInput( sal_False );
getBrowserView()->getVclControl()->ForceHideScrollbars( sal_True );
}
Reference< XPropertySet > xDataSourceSet(getRowSet(), UNO_QUERY);
@@ -602,6 +737,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
::std::vector< NamedValue > aInitialValues;
::std::vector< ::rtl::OUString > aCopyProperties;
+ Any aDefault;
switch(nType)
{
@@ -618,6 +754,8 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TriState" ) ),
makeAny( sal_Bool( ColumnValue::NO_NULLS != nNullable ) )
) );
+ if ( ColumnValue::NO_NULLS == nNullable )
+ aDefault <<= (sal_Int16)STATE_NOCHECK;
}
break;
@@ -659,18 +797,17 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW );
// calculate the default
- Any aDefault;
if ( xGridColPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) )
- aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT );
-
- // default value
- if ( nType == DataType::BIT || nType == DataType::BOOLEAN )
{
- if ( aDefault.hasValue() )
- aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK;
- else
- aDefault <<= ((sal_Int16)STATE_DONTKNOW);
-
+ aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT );
+ // default value
+ if ( nType == DataType::BIT || nType == DataType::BOOLEAN )
+ {
+ if ( aDefault.hasValue() )
+ aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK;
+ else
+ aDefault <<= ((sal_Int16)STATE_DONTKNOW);
+ }
}
if ( aDefault.hasValue() )
@@ -2004,7 +2141,7 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
m_pTreeView->getListBox().InsertEntry(
_rQueryName, _rQueryImage, _rQueryImage, pDatasourceEntry,
- TRUE /*ChildsOnDemand*/, LIST_APPEND, pQueriesData );
+ sal_True /*ChildsOnDemand*/, LIST_APPEND, pQueriesData );
}
// the child for the tables container
@@ -2014,7 +2151,7 @@ void SbaTableQueryBrowser::implAddDatasource(const String& _rDbName, Image& _rDb
m_pTreeView->getListBox().InsertEntry(
_rTableName, _rTableImage, _rTableImage, pDatasourceEntry,
- TRUE /*ChildsOnDemand*/, LIST_APPEND, pTablesData );
+ sal_True /*ChildsOnDemand*/, LIST_APPEND, pTablesData );
}
}
@@ -2289,77 +2426,82 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r
sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand,
const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection)
{
- Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY);
- if(xProp.is())
+ try
{
- Reference< ::com::sun::star::form::XLoadable > xLoadable(xProp,UNO_QUERY);
- try
+ Reference<XPropertySet> xProp( getRowSet(), UNO_QUERY_THROW );
+ Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW );
+ // the values allowing the RowSet to re-execute
+ xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName));
+ if(_rxConnection.is())
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) );
+
+ // set this _before_ setting the connection, else the rowset would rebuild it ...
+ xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType));
+ xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand));
+ xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing));
+ if ( m_bPreview )
{
- // the values allowing the RowSet to re-execute
- xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName));
- if(_rxConnection.is())
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) );
-
- // set this _before_ setting the connection, else the rowset would rebuild it ...
- xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType));
- xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand));
- xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing));
- if ( m_bPreview )
- {
- xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
- }
+ xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD));
+ }
- // the formatter depends on the data source we're working on, so rebuild it here ...
- initFormatter();
+ // the formatter depends on the data source we're working on, so rebuild it here ...
+ initFormatter();
- // switch the grid to design mode while loading
- getBrowserView()->getGridControl()->setDesignMode(sal_True);
- InitializeForm(getRowSet());
+ // switch the grid to design mode while loading
+ getBrowserView()->getGridControl()->setDesignMode(sal_True);
+ InitializeForm( xProp );
- sal_Bool bSuccess = sal_True;
+ sal_Bool bSuccess = sal_True;
+ {
{
- {
- Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY);
- // first we have to clear the grid
- clearGridColumns(xColContainer);
- }
- FormErrorHelper aHelper(this);
- // load the form
- bSuccess = reloadForm(xLoadable);
-
- // initialize the model
- InitializeGridModel(getFormComponent());
-
- if ( m_bPreview )
- initializePreviewMode();
-
- LoadFinished(sal_True);
+ Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY);
+ // first we have to clear the grid
+ clearGridColumns(xColContainer);
}
+ FormErrorHelper aHelper(this);
+ // load the form
+ bSuccess = reloadForm(xLoadable);
- InvalidateAll();
- return bSuccess;
- }
- catch( const SQLException& e )
- {
- Any aException( ::cppu::getCaughtException() );
- showError( SQLExceptionInfo( aException ) );
- }
- catch( const WrappedTargetException& e )
- {
- SQLException aSql;
- if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
- showError( SQLExceptionInfo( e.TargetException ) );
- else
+ // initialize the model
+ InitializeGridModel(getFormComponent());
+
+ Any aVal = xProp->getPropertyValue(PROPERTY_ISNEW);
+ if (aVal.hasValue() && ::comphelper::getBOOL(aVal))
{
- DBG_UNHANDLED_EXCEPTION();
+ // then set the default values and the parameters given from the parent
+ Reference< XReset> xReset(xProp, UNO_QUERY);
+ xReset->reset();
}
+
+ if ( m_bPreview )
+ initializePreviewMode();
+
+ LoadFinished(sal_True);
}
- catch(Exception&)
+
+ InvalidateAll();
+ return bSuccess;
+ }
+ catch( const SQLException& e )
+ {
+ Any aException( ::cppu::getCaughtException() );
+ showError( SQLExceptionInfo( aException ) );
+ }
+ catch( const WrappedTargetException& e )
+ {
+ SQLException aSql;
+ if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
+ showError( SQLExceptionInfo( e.TargetException ) );
+ else
{
DBG_UNHANDLED_EXCEPTION();
}
}
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
InvalidateAll();
return sal_False;