[Libreoffice-commits] core.git: extensions/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 14 18:39:20 UTC 2020
extensions/source/bibliography/bibbeam.cxx | 60 +-
extensions/source/bibliography/bibview.cxx | 44 -
extensions/source/bibliography/datman.cxx | 170 +++----
extensions/source/bibliography/framectr.cxx | 378 ++++++++--------
extensions/source/bibliography/general.cxx | 28 -
extensions/source/bibliography/loadlisteneradapter.cxx | 18
extensions/source/bibliography/toolbar.cxx | 223 ++++-----
extensions/source/config/ldap/ldapaccess.cxx | 52 +-
extensions/source/dbpilots/controlwizard.cxx | 32 -
extensions/source/propctrlr/browserlistbox.cxx | 226 ++++-----
extensions/source/propctrlr/eformshelper.cxx | 30 -
extensions/source/propctrlr/formcomponenthandler.cxx | 30 -
extensions/source/propctrlr/formlinkdialog.cxx | 22
extensions/source/propctrlr/genericpropertyhandler.cxx | 100 ++--
extensions/source/propctrlr/propertycontrolextender.cxx | 40 -
extensions/source/propctrlr/sqlcommanddesign.cxx | 36 -
extensions/source/propctrlr/stringrepresentation.cxx | 50 +-
extensions/source/scanner/grid.cxx | 30 -
extensions/source/scanner/sanedlg.cxx | 260 +++++------
19 files changed, 914 insertions(+), 915 deletions(-)
New commits:
commit 9693b491295336955f7ce8359284b67a82ecf28f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 14 15:44:22 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 14 20:38:31 2020 +0200
loplugin:flatten in extensions
Change-Id: I58b5a2c12e464e568c4f66d398bbf0b1d8afc154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92195
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
index 2b085f6a3de8..e31c21ee9d7f 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -122,39 +122,39 @@ namespace bib
{
m_xGridModel = xGModel;
- if( m_xControlContainer.is())
+ if( !m_xControlContainer.is())
+ return;
+
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+
+ if ( !m_xGridModel.is())
+ return;
+
+ uno::Reference< XPropertySet > xPropSet( m_xGridModel, UNO_QUERY );
+
+ if ( xPropSet.is() && m_xGridModel.is() )
{
- uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ uno::Any aAny = xPropSet->getPropertyValue( "DefaultControl" );
+ OUString aControlName;
+ aAny >>= aControlName;
- if ( m_xGridModel.is())
- {
- uno::Reference< XPropertySet > xPropSet( m_xGridModel, UNO_QUERY );
-
- if ( xPropSet.is() && m_xGridModel.is() )
- {
- uno::Any aAny = xPropSet->getPropertyValue( "DefaultControl" );
- OUString aControlName;
- aAny >>= aControlName;
-
- m_xControl.set( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY_THROW );
- m_xControl->setModel( m_xGridModel );
- }
-
- if ( m_xControl.is() )
- {
- // Peer as Child to the FrameWindow
- m_xControlContainer->addControl("GridControl", m_xControl);
- m_xGridWin.set(m_xControl, UNO_QUERY );
- m_xDispatchProviderInterception.set(m_xControl, UNO_QUERY );
- m_xGridWin->setVisible( true );
- m_xControl->setDesignMode( true );
- // initially switch on the design mode - switch it off _after_ loading the form
-
- ::Size aSize = GetOutputSizePixel();
- m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::POSSIZE);
- }
- }
+ m_xControl.set( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY_THROW );
+ m_xControl->setModel( m_xGridModel );
}
+
+ if ( !m_xControl.is() )
+ return;
+
+ // Peer as Child to the FrameWindow
+ m_xControlContainer->addControl("GridControl", m_xControl);
+ m_xGridWin.set(m_xControl, UNO_QUERY );
+ m_xDispatchProviderInterception.set(m_xControl, UNO_QUERY );
+ m_xGridWin->setVisible( true );
+ m_xControl->setDesignMode( true );
+ // initially switch on the design mode - switch it off _after_ loading the form
+
+ ::Size aSize = GetOutputSizePixel();
+ m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::POSSIZE);
}
void BibGridwin::disposeGridWin()
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index fbc0f4d2d4ab..e4eca459631e 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -134,35 +134,35 @@ namespace bib
m_pGeneralPage->GrabFocus();
OUString sErrorString( m_pGeneralPage->GetErrorString() );
- if ( !sErrorString.isEmpty() )
+ if ( sErrorString.isEmpty() )
+ return;
+
+ bool bExecute = BibModul::GetConfig()->IsShowColumnAssignmentWarning();
+ if(!m_pDatMan->HasActiveConnection())
{
- bool bExecute = BibModul::GetConfig()->IsShowColumnAssignmentWarning();
- if(!m_pDatMan->HasActiveConnection())
- {
- //no connection is available -> the data base has to be assigned
- m_pDatMan->DispatchDBChangeDialog();
- bExecute = false;
- }
- else if(bExecute)
- {
- sErrorString += "\n" + BibResId(RID_MAP_QUESTION);
+ //no connection is available -> the data base has to be assigned
+ m_pDatMan->DispatchDBChangeDialog();
+ bExecute = false;
+ }
+ else if(bExecute)
+ {
+ sErrorString += "\n" + BibResId(RID_MAP_QUESTION);
- MessageWithCheck aQueryBox(GetFrameWeld());
- aQueryBox.set_primary_text(sErrorString);
+ MessageWithCheck aQueryBox(GetFrameWeld());
+ aQueryBox.set_primary_text(sErrorString);
- short nResult = aQueryBox.run();
- BibModul::GetConfig()->SetShowColumnAssignmentWarning(!aQueryBox.get_active());
+ short nResult = aQueryBox.run();
+ BibModul::GetConfig()->SetShowColumnAssignmentWarning(!aQueryBox.get_active());
- if( RET_YES != nResult )
- {
- bExecute = false;
- }
- }
- if(bExecute)
+ if( RET_YES != nResult )
{
- Application::PostUserEvent( LINK( this, BibView, CallMappingHdl ), nullptr, true );
+ bExecute = false;
}
}
+ if(bExecute)
+ {
+ Application::PostUserEvent( LINK( this, BibView, CallMappingHdl ), nullptr, true );
+ }
}
BibViewFormControlContainer::BibViewFormControlContainer(BibView *pBibView) : mpBibView(pBibView) {}
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index bc50ad0fc7af..0b16d3fa05c0 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -864,77 +864,77 @@ void BibDataManager::setActiveDataSource(const OUString& rURL)
aDataSourceURL = rURL;
Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY );
- if(aPropertySet.is())
- {
- unload();
+ if(!aPropertySet.is())
+ return;
- Reference< XComponent > xOldConnection;
- aPropertySet->getPropertyValue("ActiveConnection") >>= xOldConnection;
+ unload();
- Reference< XConnection > xConnection = getConnection(rURL);
- if(!xConnection.is())
- {
- aDataSourceURL = sTmp;
- return;
- }
- Any aVal; aVal <<= xConnection;
- aPropertySet->setPropertyValue("ActiveConnection", aVal);
- Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
- if ( xFactory.is() )
- m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
-
- if(xOldConnection.is())
- xOldConnection->dispose();
-
- Sequence< OUString > aTableNameSeq;
- Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
- if(xSupplyTables.is())
- {
- Reference< XNameAccess > xAccess = xSupplyTables->getTables();
- aTableNameSeq = xAccess->getElementNames();
- }
- if(aTableNameSeq.hasElements())
- {
- aActiveDataTable = aTableNameSeq[0];
- aVal <<= aActiveDataTable;
- aPropertySet->setPropertyValue("Command", aVal);
- aPropertySet->setPropertyValue("CommandType", makeAny(CommandType::TABLE));
- //Caching for Performance
- aVal <<= sal_Int32(50);
- aPropertySet->setPropertyValue("FetchSize", aVal);
- OUString aString("SELECT * FROM ");
- // quote the table name which may contain catalog.schema.table
- Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData();
- aQuoteChar = xMetaData->getIdentifierQuoteString();
-
- OUString sCatalog, sSchema, sName;
- ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
- aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
-
- m_xParser->setElementaryQuery(aString);
- BibConfig* pConfig = BibModul::GetConfig();
- pConfig->setQueryField(getQueryField());
- startQueryWith(pConfig->getQueryText());
- setActiveDataTable(aActiveDataTable);
- }
- FeatureStateEvent aEvent;
- util::URL aURL;
- aEvent.IsEnabled = true;
- aEvent.Requery = false;
- aEvent.FeatureDescriptor = getActiveDataTable();
+ Reference< XComponent > xOldConnection;
+ aPropertySet->getPropertyValue("ActiveConnection") >>= xOldConnection;
+
+ Reference< XConnection > xConnection = getConnection(rURL);
+ if(!xConnection.is())
+ {
+ aDataSourceURL = sTmp;
+ return;
+ }
+ Any aVal; aVal <<= xConnection;
+ aPropertySet->setPropertyValue("ActiveConnection", aVal);
+ Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
+ if ( xFactory.is() )
+ m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
- aEvent.State <<= getDataSources();
+ if(xOldConnection.is())
+ xOldConnection->dispose();
- if(pToolbar)
- {
- aURL.Complete =".uno:Bib/source";
- aEvent.FeatureURL = aURL;
- pToolbar->statusChanged( aEvent );
- }
+ Sequence< OUString > aTableNameSeq;
+ Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
+ if(xSupplyTables.is())
+ {
+ Reference< XNameAccess > xAccess = xSupplyTables->getTables();
+ aTableNameSeq = xAccess->getElementNames();
+ }
+ if(aTableNameSeq.hasElements())
+ {
+ aActiveDataTable = aTableNameSeq[0];
+ aVal <<= aActiveDataTable;
+ aPropertySet->setPropertyValue("Command", aVal);
+ aPropertySet->setPropertyValue("CommandType", makeAny(CommandType::TABLE));
+ //Caching for Performance
+ aVal <<= sal_Int32(50);
+ aPropertySet->setPropertyValue("FetchSize", aVal);
+ OUString aString("SELECT * FROM ");
+ // quote the table name which may contain catalog.schema.table
+ Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData();
+ aQuoteChar = xMetaData->getIdentifierQuoteString();
+
+ OUString sCatalog, sSchema, sName;
+ ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation );
+ aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
+
+ m_xParser->setElementaryQuery(aString);
+ BibConfig* pConfig = BibModul::GetConfig();
+ pConfig->setQueryField(getQueryField());
+ startQueryWith(pConfig->getQueryText());
+ setActiveDataTable(aActiveDataTable);
+ }
+ FeatureStateEvent aEvent;
+ util::URL aURL;
+ aEvent.IsEnabled = true;
+ aEvent.Requery = false;
+ aEvent.FeatureDescriptor = getActiveDataTable();
+
+ aEvent.State <<= getDataSources();
- updateGridModel();
- load();
+ if(pToolbar)
+ {
+ aURL.Complete =".uno:Bib/source";
+ aEvent.FeatureURL = aURL;
+ pToolbar->statusChanged( aEvent );
}
+
+ updateGridModel();
+ load();
}
@@ -1028,19 +1028,19 @@ void SAL_CALL BibDataManager::unload( )
Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY );
DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!");
- if ( xFormAsLoadable.is() )
- {
- EventObject aEvt( static_cast< XWeak* >( this ) );
+ if ( !xFormAsLoadable.is() )
+ return;
- {
- m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt );
- }
+ EventObject aEvt( static_cast< XWeak* >( this ) );
+
+ {
+ m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt );
+ }
- xFormAsLoadable->unload();
+ xFormAsLoadable->unload();
- {
- m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt );
- }
+ {
+ m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt );
}
}
@@ -1053,19 +1053,19 @@ void SAL_CALL BibDataManager::reload( )
Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY );
DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!");
- if ( xFormAsLoadable.is() )
- {
- EventObject aEvt( static_cast< XWeak* >( this ) );
+ if ( !xFormAsLoadable.is() )
+ return;
- {
- m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt );
- }
+ EventObject aEvt( static_cast< XWeak* >( this ) );
- xFormAsLoadable->reload();
+ {
+ m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt );
+ }
- {
- m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt );
- }
+ xFormAsLoadable->reload();
+
+ {
+ m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt );
}
}
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index c3c6d06f8f42..9aa912a93b08 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -365,224 +365,224 @@ static vcl::Window* lcl_GetFocusChild( vcl::Window const * pParent )
//class XDispatch
void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequence< beans::PropertyValue >& aArgs)
{
- if ( !bDisposing )
- {
- ::SolarMutexGuard aGuard;
- weld::Window* pParent = Application::GetFrameWeld(xWindow);
- weld::WaitObject aWaitObject(pParent);
+ if ( bDisposing )
+ return;
+
+ ::SolarMutexGuard aGuard;
+ weld::Window* pParent = Application::GetFrameWeld(xWindow);
+ weld::WaitObject aWaitObject(pParent);
- OUString aCommand( _rURL.Path);
- if(aCommand == "Bib/Mapping")
+ OUString aCommand( _rURL.Path);
+ if(aCommand == "Bib/Mapping")
+ {
+ m_xDatMan->CreateMappingDialog(pParent);
+ }
+ else if(aCommand == "Bib/source")
+ {
+ ChangeDataSource(aArgs);
+ }
+ else if(aCommand == "Bib/sdbsource")
+ {
+ OUString aURL = m_xDatMan->CreateDBChangeDialog(pParent);
+ if(!aURL.isEmpty())
{
- m_xDatMan->CreateMappingDialog(pParent);
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aNewDataSource(2);
+ beans::PropertyValue* pProps = aNewDataSource.getArray();
+ pProps[0].Value <<= OUString();
+ pProps[1].Value <<= aURL;
+ ChangeDataSource(aNewDataSource);
+ }
+ catch(const Exception&)
+ {
+ OSL_FAIL("Exception caught while changing the data source");
+ }
}
- else if(aCommand == "Bib/source")
+ }
+ else if(aCommand == "Bib/autoFilter")
+ {
+ sal_uInt16 nCount = aStatusListeners.size();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
{
- ChangeDataSource(aArgs);
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
+ if ( pObj->aURL.Path == "Bib/removeFilter" )
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = true;
+ aEvent.Requery = false;
+ aEvent.Source = static_cast<XDispatch *>(this);
+ pObj->xListener->statusChanged( aEvent );
+ //break; because there are more than one
+ }
}
- else if(aCommand == "Bib/sdbsource")
+
+ const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
+ uno::Any aValue=pPropertyValue[0].Value;
+ OUString aQuery;
+ aValue >>= aQuery;
+
+ aValue=pPropertyValue[1].Value;
+ OUString aQueryField;
+ aValue >>= aQueryField;
+ BibConfig* pConfig = BibModul::GetConfig();
+ pConfig->setQueryField(aQueryField);
+ m_xDatMan->startQueryWith(aQuery);
+ }
+ else if(aCommand == "Bib/standardFilter")
+ {
+ try
{
- OUString aURL = m_xDatMan->CreateDBChangeDialog(pParent);
- if(!aURL.isEmpty())
+ uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+
+ // create the dialog object
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(xContext, m_xDatMan->getParser(),
+ Reference<sdbc::XRowSet>(m_xDatMan->getForm(), uno::UNO_QUERY_THROW), xWindow);
+ // execute it
+ if ( xDialog->execute( ) )
{
- try
- {
- uno::Sequence< beans::PropertyValue > aNewDataSource(2);
- beans::PropertyValue* pProps = aNewDataSource.getArray();
- pProps[0].Value <<= OUString();
- pProps[1].Value <<= aURL;
- ChangeDataSource(aNewDataSource);
- }
- catch(const Exception&)
- {
- OSL_FAIL("Exception caught while changing the data source");
- }
+ // the dialog has been executed successfully, and the filter on the query composer
+ // has been changed
+ OUString sNewFilter = m_xDatMan->getParser()->getFilter();
+ m_xDatMan->setFilter( sNewFilter );
}
}
- else if(aCommand == "Bib/autoFilter")
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION( "extensions.biblio", "BibFrameController_Impl::dispatch" );
+ }
+
+ sal_uInt16 nCount = aStatusListeners.size();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
{
- sal_uInt16 nCount = aStatusListeners.size();
- for ( sal_uInt16 n=0; n<nCount; n++ )
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
+ if ( pObj->aURL.Path == "Bib/removeFilter" && m_xDatMan->getParser().is())
{
- BibStatusDispatch *pObj = aStatusListeners[n].get();
- if ( pObj->aURL.Path == "Bib/removeFilter" )
- {
- FeatureStateEvent aEvent;
- aEvent.FeatureURL = pObj->aURL;
- aEvent.IsEnabled = true;
- aEvent.Requery = false;
- aEvent.Source = static_cast<XDispatch *>(this);
- pObj->xListener->statusChanged( aEvent );
- //break; because there are more than one
- }
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = !m_xDatMan->getParser()->getFilter().isEmpty();
+ aEvent.Requery = false;
+ aEvent.Source = static_cast<XDispatch *>(this);
+ pObj->xListener->statusChanged( aEvent );
}
-
- const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
- uno::Any aValue=pPropertyValue[0].Value;
- OUString aQuery;
- aValue >>= aQuery;
-
- aValue=pPropertyValue[1].Value;
- OUString aQueryField;
- aValue >>= aQueryField;
- BibConfig* pConfig = BibModul::GetConfig();
- pConfig->setQueryField(aQueryField);
- m_xDatMan->startQueryWith(aQuery);
}
- else if(aCommand == "Bib/standardFilter")
+ }
+ else if(aCommand == "Bib/removeFilter")
+ {
+ RemoveFilter();
+ }
+ else if( _rURL.Complete == "slot:5503" || aCommand == "CloseDoc" )
+ {
+ Application::PostUserEvent( LINK( this, BibFrameController_Impl,
+ DisposeHdl ) );
+
+ }
+ else if(aCommand == "Bib/InsertRecord")
+ {
+ Reference<form::runtime::XFormController > xFormCtrl = m_xDatMan->GetFormController();
+ if(SaveModified(xFormCtrl))
{
try
{
- uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< sdbc::XResultSet > xCursor( m_xDatMan->getForm(), UNO_QUERY );
+ xCursor->last();
- // create the dialog object
- uno::Reference< ui::dialogs::XExecutableDialog > xDialog = sdb::FilterDialog::createWithQuery(xContext, m_xDatMan->getParser(),
- Reference<sdbc::XRowSet>(m_xDatMan->getForm(), uno::UNO_QUERY_THROW), xWindow);
- // execute it
- if ( xDialog->execute( ) )
- {
- // the dialog has been executed successfully, and the filter on the query composer
- // has been changed
- OUString sNewFilter = m_xDatMan->getParser()->getFilter();
- m_xDatMan->setFilter( sNewFilter );
- }
- }
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION( "extensions.biblio", "BibFrameController_Impl::dispatch" );
+ Reference< XResultSetUpdate > xUpdateCursor( m_xDatMan->getForm(), UNO_QUERY );
+ xUpdateCursor->moveToInsertRow();
}
-
- sal_uInt16 nCount = aStatusListeners.size();
- for ( sal_uInt16 n=0; n<nCount; n++ )
+ catch(const Exception&)
{
- BibStatusDispatch *pObj = aStatusListeners[n].get();
- if ( pObj->aURL.Path == "Bib/removeFilter" && m_xDatMan->getParser().is())
- {
- FeatureStateEvent aEvent;
- aEvent.FeatureURL = pObj->aURL;
- aEvent.IsEnabled = !m_xDatMan->getParser()->getFilter().isEmpty();
- aEvent.Requery = false;
- aEvent.Source = static_cast<XDispatch *>(this);
- pObj->xListener->statusChanged( aEvent );
- }
+ OSL_FAIL("Exception in last() or moveToInsertRow()");
}
}
- else if(aCommand == "Bib/removeFilter")
- {
- RemoveFilter();
- }
- else if( _rURL.Complete == "slot:5503" || aCommand == "CloseDoc" )
- {
- Application::PostUserEvent( LINK( this, BibFrameController_Impl,
- DisposeHdl ) );
-
- }
- else if(aCommand == "Bib/InsertRecord")
+ }
+ else if(aCommand == "Bib/DeleteRecord")
+ {
+ Reference< css::sdbc::XResultSet > xCursor(m_xDatMan->getForm(), UNO_QUERY);
+ Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY);
+ Reference< beans::XPropertySet > xSet(m_xDatMan->getForm(), UNO_QUERY);
+ bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue("IsNew"));
+ if(!bIsNew)
{
- Reference<form::runtime::XFormController > xFormCtrl = m_xDatMan->GetFormController();
- if(SaveModified(xFormCtrl))
+ sal_uInt32 nCount = 0;
+ xSet->getPropertyValue("RowCount") >>= nCount;
+ // determine next position
+ bool bSuccess = false;
+ bool bLeft = false;
+ bool bRight = false;
+ try
{
- try
+ bLeft = xCursor->isLast() && nCount > 1;
+ bRight= !xCursor->isLast();
+ // ask for confirmation
+ Reference< form::XConfirmDeleteListener > xConfirm(m_xDatMan->GetFormController(),UNO_QUERY);
+ if (xConfirm.is())
{
- Reference< sdbc::XResultSet > xCursor( m_xDatMan->getForm(), UNO_QUERY );
- xCursor->last();
-
- Reference< XResultSetUpdate > xUpdateCursor( m_xDatMan->getForm(), UNO_QUERY );
- xUpdateCursor->moveToInsertRow();
- }
- catch(const Exception&)
- {
- OSL_FAIL("Exception in last() or moveToInsertRow()");
+ sdb::RowChangeEvent aEvent;
+ aEvent.Source.set(xCursor, UNO_QUERY);
+ aEvent.Action = sdb::RowChangeAction::DELETE;
+ aEvent.Rows = 1;
+ bSuccess = xConfirm->confirmDelete(aEvent);
}
+
+ // delete it
+ if (bSuccess)
+ xUpdateCursor->deleteRow();
}
- }
- else if(aCommand == "Bib/DeleteRecord")
- {
- Reference< css::sdbc::XResultSet > xCursor(m_xDatMan->getForm(), UNO_QUERY);
- Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY);
- Reference< beans::XPropertySet > xSet(m_xDatMan->getForm(), UNO_QUERY);
- bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue("IsNew"));
- if(!bIsNew)
+ catch(const Exception&)
{
- sal_uInt32 nCount = 0;
- xSet->getPropertyValue("RowCount") >>= nCount;
- // determine next position
- bool bSuccess = false;
- bool bLeft = false;
- bool bRight = false;
- try
+ bSuccess = false;
+ }
+ if (bSuccess)
+ {
+ if (bLeft || bRight)
+ xCursor->relative(bRight ? 1 : -1);
+ else
{
- bLeft = xCursor->isLast() && nCount > 1;
- bRight= !xCursor->isLast();
- // ask for confirmation
- Reference< form::XConfirmDeleteListener > xConfirm(m_xDatMan->GetFormController(),UNO_QUERY);
- if (xConfirm.is())
+ bool bCanInsert = canInsertRecords(xSet);
+ // can another entry be inserted?
+ try
{
- sdb::RowChangeEvent aEvent;
- aEvent.Source.set(xCursor, UNO_QUERY);
- aEvent.Action = sdb::RowChangeAction::DELETE;
- aEvent.Rows = 1;
- bSuccess = xConfirm->confirmDelete(aEvent);
+ if (bCanInsert)
+ xUpdateCursor->moveToInsertRow();
+ else
+ // move data entry to reset state
+ xCursor->first();
}
-
- // delete it
- if (bSuccess)
- xUpdateCursor->deleteRow();
- }
- catch(const Exception&)
- {
- bSuccess = false;
- }
- if (bSuccess)
- {
- if (bLeft || bRight)
- xCursor->relative(bRight ? 1 : -1);
- else
+ catch(const Exception&)
{
- bool bCanInsert = canInsertRecords(xSet);
- // can another entry be inserted?
- try
- {
- if (bCanInsert)
- xUpdateCursor->moveToInsertRow();
- else
- // move data entry to reset state
- xCursor->first();
- }
- catch(const Exception&)
- {
- OSL_FAIL("DeleteRecord: exception caught!");
- }
+ OSL_FAIL("DeleteRecord: exception caught!");
}
}
}
}
- else if(aCommand == "Cut")
+ }
+ else if(aCommand == "Cut")
+ {
+ vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
+ if(pChild)
{
- vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
- if(pChild)
- {
- KeyEvent aEvent( 0, KeyFuncType::CUT );
- pChild->KeyInput( aEvent );
- }
+ KeyEvent aEvent( 0, KeyFuncType::CUT );
+ pChild->KeyInput( aEvent );
}
- else if(aCommand == "Copy")
+ }
+ else if(aCommand == "Copy")
+ {
+ vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
+ if(pChild)
{
- vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
- if(pChild)
- {
- KeyEvent aEvent( 0, KeyFuncType::COPY );
- pChild->KeyInput( aEvent );
- }
+ KeyEvent aEvent( 0, KeyFuncType::COPY );
+ pChild->KeyInput( aEvent );
}
- else if(aCommand == "Paste")
+ }
+ else if(aCommand == "Paste")
+ {
+ vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
+ if(pChild)
{
- vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) );
- if(pChild)
- {
- KeyEvent aEvent( 0, KeyFuncType::PASTE );
- pChild->KeyInput( aEvent );
- }
+ KeyEvent aEvent( 0, KeyFuncType::PASTE );
+ pChild->KeyInput( aEvent );
}
}
}
@@ -722,19 +722,19 @@ void BibFrameController_Impl::removeStatusListener(
{
// search listener array for given listener
// for checking equality always "cast" to XInterface
- if ( !bDisposing )
+ if ( bDisposing )
+ return;
+
+ sal_uInt16 nCount = aStatusListeners.size();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
{
- sal_uInt16 nCount = aStatusListeners.size();
- for ( sal_uInt16 n=0; n<nCount; n++ )
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
+ bool bFlag=pObj->xListener.is();
+ if (!bFlag || (pObj->xListener == aObject &&
+ ( aURL.Complete.isEmpty() || pObj->aURL.Path == aURL.Path )))
{
- BibStatusDispatch *pObj = aStatusListeners[n].get();
- bool bFlag=pObj->xListener.is();
- if (!bFlag || (pObj->xListener == aObject &&
- ( aURL.Complete.isEmpty() || pObj->aURL.Path == aURL.Path )))
- {
- aStatusListeners.erase( aStatusListeners.begin() + n );
- break;
- }
+ aStatusListeners.erase( aStatusListeners.begin() + n );
+ break;
}
}
}
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 6ca1ca09b647..d1141afe76a6 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -584,22 +584,22 @@ void BibGeneralPage::InitFixedTexts()
void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent)
{
Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY );
- if(xCtrWin.is())
+ if(!xCtrWin.is())
+ return;
+
+ ::Size aOutSize = pScrolledWindow->getVisibleChildSize();
+ awt::Rectangle aRect = xCtrWin->getPosSize();
+ Point aOffset(pGrid->GetPosPixel());
+ long nX = aRect.X + aOffset.X();
+ if (nX < 0 || nX > aOutSize.Width())
{
- ::Size aOutSize = pScrolledWindow->getVisibleChildSize();
- awt::Rectangle aRect = xCtrWin->getPosSize();
- Point aOffset(pGrid->GetPosPixel());
- long nX = aRect.X + aOffset.X();
- if (nX < 0 || nX > aOutSize.Width())
- {
- pScrolledWindow->getHorzScrollBar().DoScroll(aRect.X);
- }
+ pScrolledWindow->getHorzScrollBar().DoScroll(aRect.X);
+ }
- long nY = aRect.Y + aOffset.Y();
- if (nY < 0 || nY > aOutSize.Height())
- {
- pScrolledWindow->getVertScrollBar().DoScroll(aRect.Y);
- }
+ long nY = aRect.Y + aOffset.Y();
+ if (nY < 0 || nY > aOutSize.Height())
+ {
+ pScrolledWindow->getVertScrollBar().DoScroll(aRect.Y);
}
}
diff --git a/extensions/source/bibliography/loadlisteneradapter.cxx b/extensions/source/bibliography/loadlisteneradapter.cxx
index dd9a7774db0b..fecce24ae7b7 100644
--- a/extensions/source/bibliography/loadlisteneradapter.cxx
+++ b/extensions/source/bibliography/loadlisteneradapter.cxx
@@ -74,19 +74,19 @@ namespace bib
void OComponentAdapterBase::dispose()
{
- if ( m_bListening )
- {
- ::rtl::Reference< OComponentAdapterBase > xPreventDelete(this);
+ if ( !m_bListening )
+ return;
- disposing();
+ ::rtl::Reference< OComponentAdapterBase > xPreventDelete(this);
- m_pListener->setAdapter(nullptr);
+ disposing();
- m_pListener = nullptr;
- m_bListening = false;
+ m_pListener->setAdapter(nullptr);
- m_xComponent = nullptr;
- }
+ m_pListener = nullptr;
+ m_bListening = false;
+
+ m_xComponent = nullptr;
}
// XEventListener
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 8530f1697316..740b6984ec88 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -83,31 +83,31 @@ BibTBListBoxListener::~BibTBListBoxListener()
void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rEvt)
{
- if(rEvt.FeatureURL.Complete == GetCommand())
+ if(rEvt.FeatureURL.Complete != GetCommand())
+ return;
+
+ SolarMutexGuard aGuard;
+ pToolBar->EnableSourceList(rEvt.IsEnabled);
+
+ Any aState = rEvt.State;
+ if(auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState))
{
- SolarMutexGuard aGuard;
- pToolBar->EnableSourceList(rEvt.IsEnabled);
+ pToolBar->UpdateSourceList(false);
+ pToolBar->ClearSourceList();
- Any aState = rEvt.State;
- if(auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState))
+ const OUString* pStringArray = pStringSeq->getConstArray();
+
+ sal_uInt32 nCount = pStringSeq->getLength();
+ OUString aEntry;
+ for( sal_uInt32 i=0; i<nCount; i++ )
{
- pToolBar->UpdateSourceList(false);
- pToolBar->ClearSourceList();
-
- const OUString* pStringArray = pStringSeq->getConstArray();
-
- sal_uInt32 nCount = pStringSeq->getLength();
- OUString aEntry;
- for( sal_uInt32 i=0; i<nCount; i++ )
- {
- aEntry = pStringArray[i];
- pToolBar->InsertSourceEntry(aEntry);
- }
- pToolBar->UpdateSourceList(true);
+ aEntry = pStringArray[i];
+ pToolBar->InsertSourceEntry(aEntry);
}
-
- pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor);
+ pToolBar->UpdateSourceList(true);
}
+
+ pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor);
};
BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB, const OUString& aStr, sal_uInt16 nId):
@@ -121,27 +121,28 @@ BibTBQueryMenuListener::~BibTBQueryMenuListener()
void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)
{
- if(rEvt.FeatureURL.Complete == GetCommand())
- {
- SolarMutexGuard aGuard;
- pToolBar->EnableSourceList(rEvt.IsEnabled);
+ if(rEvt.FeatureURL.Complete != GetCommand())
+ return;
- uno::Any aState=rEvt.State;
- if(auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState))
+ SolarMutexGuard aGuard;
+ pToolBar->EnableSourceList(rEvt.IsEnabled);
+
+ uno::Any aState=rEvt.State;
+ auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState);
+ if(!pStringSeq)
+ return;
+
+ pToolBar->ClearFilterMenu();
+
+ const OUString* pStringArray = pStringSeq->getConstArray();
+
+ sal_uInt32 nCount = pStringSeq->getLength();
+ for( sal_uInt32 i=0; i<nCount; i++ )
+ {
+ sal_uInt16 nID = pToolBar->InsertFilterItem(pStringArray[i]);
+ if(pStringArray[i]==rEvt.FeatureDescriptor)
{
- pToolBar->ClearFilterMenu();
-
- const OUString* pStringArray = pStringSeq->getConstArray();
-
- sal_uInt32 nCount = pStringSeq->getLength();
- for( sal_uInt32 i=0; i<nCount; i++ )
- {
- sal_uInt16 nID = pToolBar->InsertFilterItem(pStringArray[i]);
- if(pStringArray[i]==rEvt.FeatureDescriptor)
- {
- pToolBar->SelectFilterItem(nID);
- }
- }
+ pToolBar->SelectFilterItem(nID);
}
}
};
@@ -259,44 +260,44 @@ void BibToolBar::InitListener()
uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY);
uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) );
- if( xTrans.is() )
+ if( !xTrans.is() )
+ return;
+
+ util::URL aQueryURL;
+ aQueryURL.Complete = ".uno:Bib/MenuFilter";
+ xTrans->parseStrict( aQueryURL);
+ BibToolBarListener* pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER);
+ xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
+
+ for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++)
{
- util::URL aQueryURL;
- aQueryURL.Complete = ".uno:Bib/MenuFilter";
- xTrans->parseStrict( aQueryURL);
- BibToolBarListener* pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER);
- xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
+ sal_uInt16 nId=GetItemId(nPos);
+ if(!nId || nId== nTBC_FT_SOURCE || nId == nTBC_FT_QUERY)
+ continue;
- for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++)
+ util::URL aURL;
+ aURL.Complete = GetItemCommand(nId);
+ if(aURL.Complete.isEmpty())
+ continue;
+
+ xTrans->parseStrict( aURL );
+
+ css::uno::Reference< css::frame::XStatusListener> xListener;
+ if (nId == nTBC_LB_SOURCE)
{
- sal_uInt16 nId=GetItemId(nPos);
- if(!nId || nId== nTBC_FT_SOURCE || nId == nTBC_FT_QUERY)
- continue;
-
- util::URL aURL;
- aURL.Complete = GetItemCommand(nId);
- if(aURL.Complete.isEmpty())
- continue;
-
- xTrans->parseStrict( aURL );
-
- css::uno::Reference< css::frame::XStatusListener> xListener;
- if (nId == nTBC_LB_SOURCE)
- {
- xListener=new BibTBListBoxListener(this,aURL.Complete,nId);
- }
- else if (nId == nTBC_ED_QUERY)
- {
- xListener=new BibTBEditListener(this,aURL.Complete,nId);
- }
- else
- {
- xListener=new BibToolBarListener(this,aURL.Complete,nId);
- }
-
- aListenerArr.push_back( xListener );
- xDisp->addStatusListener(xListener,aURL);
+ xListener=new BibTBListBoxListener(this,aURL.Complete,nId);
}
+ else if (nId == nTBC_ED_QUERY)
+ {
+ xListener=new BibTBEditListener(this,aURL.Complete,nId);
+ }
+ else
+ {
+ xListener=new BibToolBarListener(this,aURL.Complete,nId);
+ }
+
+ aListenerArr.push_back( xListener );
+ xDisp->addStatusListener(xListener,aURL);
}
}
@@ -335,23 +336,23 @@ void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& r
uno::Reference< frame::XDispatchProvider > xDSP( xController, UNO_QUERY );
- if( xDSP.is() && !aCommand.isEmpty())
- {
- uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) );
- if( xTrans.is() )
- {
- // load the file
- util::URL aURL;
- aURL.Complete = aCommand;
+ if( !(xDSP.is() && !aCommand.isEmpty()))
+ return;
- xTrans->parseStrict( aURL );
+ uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) );
+ if( !xTrans.is() )
+ return;
- uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, OUString(), frame::FrameSearchFlag::SELF );
+ // load the file
+ util::URL aURL;
+ aURL.Complete = aCommand;
- if ( xDisp.is() )
- xDisp->dispatch( aURL, rArgs);
- }
- }
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, OUString(), frame::FrameSearchFlag::SELF );
+
+ if ( xDisp.is() )
+ xDisp->dispatch( aURL, rArgs);
}
@@ -483,36 +484,34 @@ IMPL_LINK_NOARG( BibToolBar, SendSelHdl, Timer*, void )
IMPL_LINK_NOARG( BibToolBar, MenuHdl, ToolBox*, void)
{
sal_uInt16 nId=GetCurItemId();
- if (nId == nTBC_BT_AUTOFILTER)
- {
- EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage)
-
- SetItemDown(nTBC_BT_AUTOFILTER, true);
- nId = pPopupMenu->Execute(this, GetItemRect(nTBC_BT_AUTOFILTER));
-
+ if (nId != nTBC_BT_AUTOFILTER)
+ return;
- if(nId>0)
- {
- pPopupMenu->CheckItem(nSelMenuItem,false);
- pPopupMenu->CheckItem(nId);
- nSelMenuItem=nId;
- aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) );
- Sequence<PropertyValue> aPropVal(2);
- PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
- pPropertyVal[0].Name = "QueryText";
- OUString aSelection = aEdQuery->GetText();
- pPropertyVal[0].Value <<= aSelection;
- pPropertyVal[1].Name="QueryField";
- pPropertyVal[1].Value <<= aQueryField;
- SendDispatch(nTBC_BT_AUTOFILTER, aPropVal);
- }
+ EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage)
- MouseEvent aLeave( Point(), 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC );
- MouseMove( aLeave );
- SetItemDown(nTBC_BT_AUTOFILTER, false);
+ SetItemDown(nTBC_BT_AUTOFILTER, true);
+ nId = pPopupMenu->Execute(this, GetItemRect(nTBC_BT_AUTOFILTER));
+ if(nId>0)
+ {
+ pPopupMenu->CheckItem(nSelMenuItem,false);
+ pPopupMenu->CheckItem(nId);
+ nSelMenuItem=nId;
+ aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) );
+ Sequence<PropertyValue> aPropVal(2);
+ PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
+ pPropertyVal[0].Name = "QueryText";
+ OUString aSelection = aEdQuery->GetText();
+ pPropertyVal[0].Value <<= aSelection;
+ pPropertyVal[1].Name="QueryField";
+ pPropertyVal[1].Value <<= aQueryField;
+ SendDispatch(nTBC_BT_AUTOFILTER, aPropVal);
}
+
+ MouseEvent aLeave( Point(), 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC );
+ MouseMove( aLeave );
+ SetItemDown(nTBC_BT_AUTOFILTER, false);
}
void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent)
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index 3e275e898443..7e35408b3b9e 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -106,43 +106,43 @@ void LdapConnection::connectSimple(const LdapDefinition& aDefinition)
void LdapConnection::connectSimple()
{
- if (!isValid())
- {
- // Connect to the server
- initConnection() ;
- // Set Protocol V3
- int version = LDAP_VERSION3;
- ldap_set_option(mConnection,
- LDAP_OPT_PROTOCOL_VERSION,
- &version);
+ if (isValid())
+ return;
+
+ // Connect to the server
+ initConnection() ;
+ // Set Protocol V3
+ int version = LDAP_VERSION3;
+ ldap_set_option(mConnection,
+ LDAP_OPT_PROTOCOL_VERSION,
+ &version);
#ifdef LDAP_X_OPT_CONNECT_TIMEOUT // OpenLDAP doesn't support this and the func
- /* timeout is specified in milliseconds -> 4 seconds*/
- int timeout = 4000;
+ /* timeout is specified in milliseconds -> 4 seconds*/
+ int timeout = 4000;
#ifdef _WIN32
- ldap_set_optionW( mConnection,
- LDAP_X_OPT_CONNECT_TIMEOUT,
- &timeout );
+ ldap_set_optionW( mConnection,
+ LDAP_X_OPT_CONNECT_TIMEOUT,
+ &timeout );
#else
- ldap_set_option( mConnection,
- LDAP_X_OPT_CONNECT_TIMEOUT,
- &timeout );
+ ldap_set_option( mConnection,
+ LDAP_X_OPT_CONNECT_TIMEOUT,
+ &timeout );
#endif
#endif
- // Do the bind
+ // Do the bind
#ifdef _WIN32
- LdapErrCode retCode = ldap_simple_bind_sW(mConnection,
- const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mAnonUser.getStr())),
- const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mAnonCredentials.getStr())) );
+ LdapErrCode retCode = ldap_simple_bind_sW(mConnection,
+ const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mAnonUser.getStr())),
+ const_cast<PWSTR>(o3tl::toW(mLdapDefinition.mAnonCredentials.getStr())) );
#else
- LdapErrCode retCode = ldap_simple_bind_s(mConnection,
- OUStringToOString( mLdapDefinition.mAnonUser, RTL_TEXTENCODING_UTF8 ).getStr(),
- OUStringToOString( mLdapDefinition.mAnonCredentials, RTL_TEXTENCODING_UTF8 ).getStr()) ;
+ LdapErrCode retCode = ldap_simple_bind_s(mConnection,
+ OUStringToOString( mLdapDefinition.mAnonUser, RTL_TEXTENCODING_UTF8 ).getStr(),
+ OUStringToOString( mLdapDefinition.mAnonCredentials, RTL_TEXTENCODING_UTF8 ).getStr()) ;
#endif
- checkLdapReturnCode("SimpleBind", retCode) ;
- }
+ checkLdapReturnCode("SimpleBind", retCode) ;
}
void LdapConnection::initConnection()
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index aae97ab5a8d7..18b3c9489f99 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -256,23 +256,23 @@ namespace dbp
// for comparing the model
Reference< XControlModel > xModelCompare(m_aContext.xObjectModel, UNO_QUERY);
- if (xPageObjects.is())
+ if (!xPageObjects.is())
+ return;
+
+ // loop through all objects of the page
+ sal_Int32 nObjects = xPageObjects->getCount();
+ Reference< XControlShape > xControlShape;
+ Reference< XControlModel > xControlModel;
+ for (sal_Int32 i=0; i<nObjects; ++i)
{
- // loop through all objects of the page
- sal_Int32 nObjects = xPageObjects->getCount();
- Reference< XControlShape > xControlShape;
- Reference< XControlModel > xControlModel;
- for (sal_Int32 i=0; i<nObjects; ++i)
- {
- if (xPageObjects->getByIndex(i) >>= xControlShape)
- { // it _is_ a control shape
- xControlModel = xControlShape->getControl();
- DBG_ASSERT(xControlModel.is(), "OControlWizard::implDetermineShape: control shape without model!");
- if (xModelCompare.get() == xControlModel.get())
- {
- m_aContext.xObjectShape = xControlShape;
- break;
- }
+ if (xPageObjects->getByIndex(i) >>= xControlShape)
+ { // it _is_ a control shape
+ xControlModel = xControlShape->getControl();
+ DBG_ASSERT(xControlModel.is(), "OControlWizard::implDetermineShape: control shape without model!");
+ if (xModelCompare.get() == xControlModel.get())
+ {
+ m_aContext.xObjectShape = xControlShape;
+ break;
}
}
}
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 17d9c2081de6..ca62420b4d2d 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -336,21 +336,21 @@ namespace pcr
void OBrowserListBox::CommitModified( )
{
- if ( IsModified() && m_xActiveControl.is() )
+ if ( !(IsModified() && m_xActiveControl.is()) )
+ return;
+
+ // for the time of this commit, notify all events synchronously
+ // #i63814#
+ m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eSynchronously );
+ try
{
- // for the time of this commit, notify all events synchronously
- // #i63814#
- m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eSynchronously );
- try
- {
- m_xActiveControl->notifyModifiedValue();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
- }
- m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eAsynchronously );
+ m_xActiveControl->notifyModifiedValue();
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+ }
+ m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eAsynchronously );
}
void OBrowserListBox::SetListener( IPropertyLineListener* _pListener )
@@ -497,39 +497,39 @@ namespace pcr
return;
}
- if (nPos < m_aLines.size())
- {
- unsigned const nWinHeight = m_xScrolledWindow->vadjustment_get_page_size();
+ if (nPos >= m_aLines.size())
+ return;
- auto nThumbPos = m_xScrolledWindow->vadjustment_get_value();
- int const nWinTop = nThumbPos;
- int const nWinBottom = nWinTop + nWinHeight;
+ unsigned const nWinHeight = m_xScrolledWindow->vadjustment_get_page_size();
- auto nCtrlPosY = nPos * m_nRowHeight;
+ auto nThumbPos = m_xScrolledWindow->vadjustment_get_value();
+ int const nWinTop = nThumbPos;
+ int const nWinBottom = nWinTop + nWinHeight;
- int const nSelectedItemTop = nCtrlPosY;
- int const nSelectedItemBottom = nCtrlPosY + m_nRowHeight;
- bool const shouldScrollDown = nSelectedItemBottom >= nWinBottom;
- bool const shouldScrollUp = nSelectedItemTop <= nWinTop;
- bool const isNeedToScroll = shouldScrollDown || shouldScrollUp;
+ auto nCtrlPosY = nPos * m_nRowHeight;
- if (isNeedToScroll)
- {
- if (shouldScrollDown)
- {
- int nOffset = nSelectedItemBottom - nWinBottom;
- nThumbPos += nOffset;
- }
- else
- {
- int nOffset = nWinTop - nSelectedItemTop;
- nThumbPos -= nOffset;
- if(nThumbPos < 0)
- nThumbPos = 0;
- }
- m_xScrolledWindow->vadjustment_set_value(nThumbPos);
- }
+ int const nSelectedItemTop = nCtrlPosY;
+ int const nSelectedItemBottom = nCtrlPosY + m_nRowHeight;
+ bool const shouldScrollDown = nSelectedItemBottom >= nWinBottom;
+ bool const shouldScrollUp = nSelectedItemTop <= nWinTop;
+ bool const isNeedToScroll = shouldScrollDown || shouldScrollUp;
+
+ if (!isNeedToScroll)
+ return;
+
+ if (shouldScrollDown)
+ {
+ int nOffset = nSelectedItemBottom - nWinBottom;
+ nThumbPos += nOffset;
+ }
+ else
+ {
+ int nOffset = nWinTop - nSelectedItemTop;
+ nThumbPos -= nOffset;
+ if(nThumbPos < 0)
+ nThumbPos = 0;
}
+ m_xScrolledWindow->vadjustment_set_value(nThumbPos);
}
void OBrowserListBox::buttonClicked( OBrowserLine* _pLine, bool _bPrimary )
@@ -719,97 +719,97 @@ namespace pcr
if ( nPos == EDITOR_LIST_REPLACE_EXISTING )
nPos = GetPropertyPos( rPropertyData.sName );
- if ( nPos < m_aLines.size() )
- {
- // the current line and control
- ListBoxLine& rLine = m_aLines[nPos];
+ if ( nPos >= m_aLines.size() )
+ return;
- // the old control and some data about it
- Reference< XPropertyControl > xControl = rLine.pLine->getControl();
+ // the current line and control
+ ListBoxLine& rLine = m_aLines[nPos];
- // clean up the old control
- lcl_implDisposeControl_nothrow( xControl );
+ // the old control and some data about it
+ Reference< XPropertyControl > xControl = rLine.pLine->getControl();
- // set the new control at the line
- rLine.pLine->setControl( rPropertyData.Control );
- xControl = rLine.pLine->getControl();
+ // clean up the old control
+ lcl_implDisposeControl_nothrow( xControl );
- if ( xControl.is() )
- xControl->setControlContext( m_pControlContextImpl.get() );
+ // set the new control at the line
+ rLine.pLine->setControl( rPropertyData.Control );
+ xControl = rLine.pLine->getControl();
- // the initial property value
- if ( rPropertyData.bUnknownValue )
- xControl->setValue( Any() );
- else
- impl_setControlAsPropertyValue( rLine, rPropertyData.aValue );
+ if ( xControl.is() )
+ xControl->setControlContext( m_pControlContextImpl.get() );
- rLine.pLine->SetTitle(rPropertyData.DisplayName);
- rLine.xHandler = rPropertyData.xPropertyHandler;
+ // the initial property value
+ if ( rPropertyData.bUnknownValue )
+ xControl->setValue( Any() );
+ else
+ impl_setControlAsPropertyValue( rLine, rPropertyData.aValue );
- if ( rPropertyData.HasPrimaryButton )
- {
- if ( !rPropertyData.PrimaryButtonImageURL.isEmpty() )
- rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImageURL, true );
- else if ( rPropertyData.PrimaryButtonImage.is() )
- rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImage, true );
- else
- rLine.pLine->ShowBrowseButton( true );
+ rLine.pLine->SetTitle(rPropertyData.DisplayName);
+ rLine.xHandler = rPropertyData.xPropertyHandler;
- if ( rPropertyData.HasSecondaryButton )
- {
- if ( !rPropertyData.SecondaryButtonImageURL.isEmpty() )
- rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImageURL, false );
- else if ( rPropertyData.SecondaryButtonImage.is() )
- rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImage, false );
- else
- rLine.pLine->ShowBrowseButton( false );
- }
- else
- rLine.pLine->HideBrowseButton( false );
+ if ( rPropertyData.HasPrimaryButton )
+ {
+ if ( !rPropertyData.PrimaryButtonImageURL.isEmpty() )
+ rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImageURL, true );
+ else if ( rPropertyData.PrimaryButtonImage.is() )
+ rLine.pLine->ShowBrowseButton( rPropertyData.PrimaryButtonImage, true );
+ else
+ rLine.pLine->ShowBrowseButton( true );
- rLine.pLine->SetClickListener( this );
+ if ( rPropertyData.HasSecondaryButton )
+ {
+ if ( !rPropertyData.SecondaryButtonImageURL.isEmpty() )
+ rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImageURL, false );
+ else if ( rPropertyData.SecondaryButtonImage.is() )
+ rLine.pLine->ShowBrowseButton( rPropertyData.SecondaryButtonImage, false );
+ else
+ rLine.pLine->ShowBrowseButton( false );
}
else
- {
- rLine.pLine->HideBrowseButton( true );
rLine.pLine->HideBrowseButton( false );
- }
- DBG_ASSERT( ( rPropertyData.IndentLevel == 0 ) || ( rPropertyData.IndentLevel == 1 ),
- "OBrowserListBox::ChangeEntry: unsupported indent level!" );
- rLine.pLine->IndentTitle( rPropertyData.IndentLevel > 0 );
+ rLine.pLine->SetClickListener( this );
+ }
+ else
+ {
+ rLine.pLine->HideBrowseButton( true );
+ rLine.pLine->HideBrowseButton( false );
+ }
- rLine.pLine->SetComponentHelpIds(
- HelpIdUrl::getHelpId( rPropertyData.HelpURL )
- );
+ DBG_ASSERT( ( rPropertyData.IndentLevel == 0 ) || ( rPropertyData.IndentLevel == 1 ),
+ "OBrowserListBox::ChangeEntry: unsupported indent level!" );
+ rLine.pLine->IndentTitle( rPropertyData.IndentLevel > 0 );
- if ( rPropertyData.bReadOnly )
- {
- rLine.pLine->SetReadOnly( true );
-
- // user controls (i.e. the ones not provided by the usual
- // XPropertyControlFactory) have no chance to know that they should be read-only,
- // since XPropertyHandler::describePropertyLine does not transport this
- // information.
- // So, we manually switch this to read-only.
- if ( xControl.is() && ( xControl->getControlType() == PropertyControlType::Unknown ) )
- {
- weld::Widget* pWindow = rLine.pLine->getControlWindow();
- weld::Entry* pControlWindowAsEdit = dynamic_cast<weld::Entry*>(pWindow);
- if (pControlWindowAsEdit)
- pControlWindowAsEdit->set_editable(false);
- else
- pWindow->set_sensitive(false);
- }
- }
+ rLine.pLine->SetComponentHelpIds(
+ HelpIdUrl::getHelpId( rPropertyData.HelpURL )
+ );
- sal_uInt16 nTextWidth = m_xLinesPlayground->get_pixel_size(rPropertyData.DisplayName).Width();
- if (m_nTheNameSize< nTextWidth)
+ if ( rPropertyData.bReadOnly )
+ {
+ rLine.pLine->SetReadOnly( true );
+
+ // user controls (i.e. the ones not provided by the usual
+ // XPropertyControlFactory) have no chance to know that they should be read-only,
+ // since XPropertyHandler::describePropertyLine does not transport this
+ // information.
+ // So, we manually switch this to read-only.
+ if ( xControl.is() && ( xControl->getControlType() == PropertyControlType::Unknown ) )
{
- m_nTheNameSize = nTextWidth;
- UpdatePlayGround();
+ weld::Widget* pWindow = rLine.pLine->getControlWindow();
+ weld::Entry* pControlWindowAsEdit = dynamic_cast<weld::Entry*>(pWindow);
+ if (pControlWindowAsEdit)
+ pControlWindowAsEdit->set_editable(false);
+ else
+ pWindow->set_sensitive(false);
}
}
+
+ sal_uInt16 nTextWidth = m_xLinesPlayground->get_pixel_size(rPropertyData.DisplayName).Width();
+ if (m_nTheNameSize< nTextWidth)
+ {
+ m_nTheNameSize = nTextWidth;
+ UpdatePlayGround();
+ }
}
} // namespace pcr
diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx
index 81c7b77d9a63..196bce45ddf7 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -292,26 +292,26 @@ namespace pcr
void EFormsHelper::getFormModelNames( std::vector< OUString >& /* [out] */ _rModelNames ) const
{
- if ( m_xDocument.is() )
+ if ( !m_xDocument.is() )
+ return;
+
+ try
{
- try
- {
- _rModelNames.resize( 0 );
+ _rModelNames.resize( 0 );
- Reference< XNameContainer > xForms( m_xDocument->getXForms() );
- OSL_ENSURE( xForms.is(), "EFormsHelper::getFormModelNames: invalid forms container!" );
- if ( xForms.is() )
- {
- Sequence< OUString > aModelNames = xForms->getElementNames();
- _rModelNames.resize( aModelNames.getLength() );
- std::copy( aModelNames.begin(), aModelNames.end(), _rModelNames.begin() );
- }
- }
- catch( const Exception& )
+ Reference< XNameContainer > xForms( m_xDocument->getXForms() );
+ OSL_ENSURE( xForms.is(), "EFormsHelper::getFormModelNames: invalid forms container!" );
+ if ( xForms.is() )
{
- TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EFormsHelper::getFormModelNames" );
+ Sequence< OUString > aModelNames = xForms->getElementNames();
+ _rModelNames.resize( aModelNames.getLength() );
+ std::copy( aModelNames.begin(), aModelNames.end(), _rModelNames.begin() );
}
}
+ catch( const Exception& )
+ {
+ TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EFormsHelper::getFormModelNames" );
+ }
}
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 70aaff29210d..383bb51ed585 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -3214,26 +3214,26 @@ namespace pcr
IMPL_LINK_NOARG( FormComponentPropertyHandler, OnDesignerClosed, SQLCommandDesigner&, void )
{
OSL_ENSURE( m_xBrowserUI.is() && m_xCommandDesigner.is(), "FormComponentPropertyHandler::OnDesignerClosed: too many NULLs!" );
- if ( m_xBrowserUI.is() && m_xCommandDesigner.is() )
+ if ( !(m_xBrowserUI.is() && m_xCommandDesigner.is()) )
+ return;
+
+ try
{
- try
- {
- ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI(
- dynamic_cast< ISQLCommandPropertyUI* >( m_xCommandDesigner->getPropertyAdapter().get() ) );
- if ( !xCommandUI.is() )
- throw NullPointerException();
+ ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI(
+ dynamic_cast< ISQLCommandPropertyUI* >( m_xCommandDesigner->getPropertyAdapter().get() ) );
+ if ( !xCommandUI.is() )
+ throw NullPointerException();
- const OUString* pToEnable = xCommandUI->getPropertiesToDisable();
- while ( !pToEnable->isEmpty() )
- {
- m_xBrowserUI->enablePropertyUIElements( *pToEnable++, PropertyLineElement::All, true );
- }
- }
- catch( const Exception& )
+ const OUString* pToEnable = xCommandUI->getPropertiesToDisable();
+ while ( !pToEnable->isEmpty() )
{
- DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+ m_xBrowserUI->enablePropertyUIElements( *pToEnable++, PropertyLineElement::All, true );
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+ }
}
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index 2ff5ce0c20e4..72a0e2e2dd32 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -403,19 +403,19 @@ namespace pcr
TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "FormLinkDialog::getFormFields: caught a non-SQL exception!" );
}
- if ( aErrorInfo.isValid() )
- {
- OUString sErrorMessage;
- {
- sErrorMessage = PcrRes(STR_ERROR_RETRIEVING_COLUMNS);
- sErrorMessage = sErrorMessage.replaceFirst("#", sCommand);
- }
+ if ( !aErrorInfo.isValid() )
+ return;
- SQLContext aContext;
- aContext.Message = sErrorMessage;
- aContext.NextException = aErrorInfo.get();
- ::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext);
+ OUString sErrorMessage;
+ {
+ sErrorMessage = PcrRes(STR_ERROR_RETRIEVING_COLUMNS);
+ sErrorMessage = sErrorMessage.replaceFirst("#", sCommand);
}
+
+ SQLContext aContext;
+ aContext.Message = sErrorMessage;
+ aContext.NextException = aErrorInfo.get();
+ ::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext);
}
void FormLinkDialog::ensureFormConnection( const Reference< XPropertySet >& _rxFormProps, Reference< XConnection >& /* [out] */ _rxConnection ) const
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 2f6bee221ed6..6a7d67eae5a5 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -467,65 +467,65 @@ namespace pcr
void GenericPropertyHandler::impl_ensurePropertyMap()
{
- if ( !m_bPropertyMapInitialized )
+ if ( m_bPropertyMapInitialized )
+ return;
+
+ m_bPropertyMapInitialized = true;
+ try
{
- m_bPropertyMapInitialized = true;
- try
+ Reference< XPropertySetInfo > xPSI;
+ if ( m_xComponent.is() )
+ xPSI = m_xComponent->getPropertySetInfo();
+ Sequence< Property > aProperties;
+ if ( xPSI.is() )
+ aProperties = xPSI->getProperties();
+ DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" );
+
+ for ( auto const & property : std::as_const(aProperties) )
{
- Reference< XPropertySetInfo > xPSI;
- if ( m_xComponent.is() )
- xPSI = m_xComponent->getPropertySetInfo();
- Sequence< Property > aProperties;
- if ( xPSI.is() )
- aProperties = xPSI->getProperties();
- DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" );
-
- for ( auto const & property : std::as_const(aProperties) )
+ switch ( property.Type.getTypeClass() )
{
- switch ( property.Type.getTypeClass() )
- {
- case TypeClass_BOOLEAN:
- case TypeClass_BYTE:
- case TypeClass_SHORT:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_LONG:
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_HYPER:
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_FLOAT:
- case TypeClass_DOUBLE:
- case TypeClass_ENUM:
- case TypeClass_STRING:
- // allowed, we can handle this type
- break;
-
- case TypeClass_SEQUENCE:
- {
- TypeClass eElementTypeClass = ::comphelper::getSequenceElementType( property.Type ).getTypeClass();
- if ( ( eElementTypeClass != TypeClass_STRING )
- && ( eElementTypeClass != TypeClass_BYTE )
- && ( eElementTypeClass != TypeClass_SHORT )
- && ( eElementTypeClass != TypeClass_UNSIGNED_SHORT )
- && ( eElementTypeClass != TypeClass_LONG )
- && ( eElementTypeClass != TypeClass_UNSIGNED_LONG )
- )
- // can only handle the above
- continue;
- }
+ case TypeClass_BOOLEAN:
+ case TypeClass_BYTE:
+ case TypeClass_SHORT:
+ case TypeClass_UNSIGNED_SHORT:
+ case TypeClass_LONG:
+ case TypeClass_UNSIGNED_LONG:
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_HYPER:
+ case TypeClass_FLOAT:
+ case TypeClass_DOUBLE:
+ case TypeClass_ENUM:
+ case TypeClass_STRING:
+ // allowed, we can handle this type
break;
- default:
- // next property, we don't support this type
+ case TypeClass_SEQUENCE:
+ {
+ TypeClass eElementTypeClass = ::comphelper::getSequenceElementType( property.Type ).getTypeClass();
+ if ( ( eElementTypeClass != TypeClass_STRING )
+ && ( eElementTypeClass != TypeClass_BYTE )
+ && ( eElementTypeClass != TypeClass_SHORT )
+ && ( eElementTypeClass != TypeClass_UNSIGNED_SHORT )
+ && ( eElementTypeClass != TypeClass_LONG )
+ && ( eElementTypeClass != TypeClass_UNSIGNED_LONG )
+ )
+ // can only handle the above
continue;
- }
+ }
+ break;
- m_aProperties.emplace( property.Name, property );
+ default:
+ // next property, we don't support this type
+ continue;
}
+
+ m_aProperties.emplace( property.Name, property );
}
- catch( const Exception& )
- {
- TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "GenericPropertyHandler::impl_ensurePropertyMap" );
- }
+ }
+ catch( const Exception& )
+ {
+ TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "GenericPropertyHandler::impl_ensurePropertyMap" );
}
}
diff --git a/extensions/source/propctrlr/propertycontrolextender.cxx b/extensions/source/propctrlr/propertycontrolextender.cxx
index 8f3d5e0380e2..443a166820e6 100644
--- a/extensions/source/propctrlr/propertycontrolextender.cxx
+++ b/extensions/source/propctrlr/propertycontrolextender.cxx
@@ -78,28 +78,28 @@ namespace pcr
void SAL_CALL PropertyControlExtender::keyPressed( const KeyEvent& _event )
{
OSL_ENSURE( _event.Source == m_pData->xControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" );
- if ( ( _event.KeyFunc == KeyFunction::DELETE )
- && ( _event.Modifiers == 0 )
+ if ( !(( _event.KeyFunc == KeyFunction::DELETE )
+ && ( _event.Modifiers == 0 ))
)
+ return;
+
+ try
+ {
+ Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW );
+
+ // reset the value
+ xControl->setValue( Any() );
+
+ // and notify the change
+ // don't use XPropertyControl::notifyModifiedValue. It only notifies when the control content
+ // is recognized as being modified by the user, which is not the case, since we just modified
+ // it programmatically.
+ Reference< XPropertyControlContext > xControlContext( xControl->getControlContext(), UNO_SET_THROW );
+ xControlContext->valueChanged( xControl );
+ }
+ catch( const Exception& )
{
- try
- {
- Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW );
-
- // reset the value
- xControl->setValue( Any() );
-
- // and notify the change
- // don't use XPropertyControl::notifyModifiedValue. It only notifies when the control content
- // is recognized as being modified by the user, which is not the case, since we just modified
- // it programmatically.
- Reference< XPropertyControlContext > xControlContext( xControl->getControlContext(), UNO_SET_THROW );
- xControlContext->valueChanged( xControl );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
- }
+ DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
}
}
diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx
index 2e54bb642819..c5bd8a34c749 100644
--- a/extensions/source/propctrlr/sqlcommanddesign.cxx
+++ b/extensions/source/propctrlr/sqlcommanddesign.cxx
@@ -113,30 +113,30 @@ namespace pcr
{
OSL_ENSURE( m_xDesigner.is() && ( Event.Source == m_xDesigner ), "SQLCommandDesigner::propertyChange: where did this come from?" );
- if ( m_xDesigner.is() && ( Event.Source == m_xDesigner ) )
+ if ( !(m_xDesigner.is() && ( Event.Source == m_xDesigner )) )
+ return;
+
+ try
{
- try
+ if ( PROPERTY_ACTIVECOMMAND == Event.PropertyName )
{
- if ( PROPERTY_ACTIVECOMMAND == Event.PropertyName )
- {
- OUString sCommand;
- OSL_VERIFY( Event.NewValue >>= sCommand );
- m_xObjectAdapter->setSQLCommand( sCommand );
- }
- else if ( PROPERTY_ESCAPE_PROCESSING == Event.PropertyName )
- {
- bool bEscapeProcessing( false );
- OSL_VERIFY( Event.NewValue >>= bEscapeProcessing );
- m_xObjectAdapter->setEscapeProcessing( bEscapeProcessing );
- }
+ OUString sCommand;
+ OSL_VERIFY( Event.NewValue >>= sCommand );
+ m_xObjectAdapter->setSQLCommand( sCommand );
}
- catch( const RuntimeException& ) { throw; }
- catch( const Exception& )
+ else if ( PROPERTY_ESCAPE_PROCESSING == Event.PropertyName )
{
- // not allowed to leave, so silence it
- DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+ bool bEscapeProcessing( false );
+ OSL_VERIFY( Event.NewValue >>= bEscapeProcessing );
+ m_xObjectAdapter->setEscapeProcessing( bEscapeProcessing );
}
}
+ catch( const RuntimeException& ) { throw; }
+ catch( const Exception& )
+ {
+ // not allowed to leave, so silence it
+ DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
+ }
}
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index 69a0f6e59fec..bc37cd8f2ef6 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -246,31 +246,31 @@ struct CompareConstants {
void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > & aArguments)
{
sal_Int32 nLength = aArguments.getLength();
- if ( nLength )
- {
- const uno::Any* pIter = aArguments.getConstArray();
- m_xTypeConverter.set(*pIter++,uno::UNO_QUERY);
- if ( nLength == 3 )
- {
- OUString sConstantName;
- *pIter++ >>= sConstantName;
- *pIter >>= m_aValues;
-
- if ( m_xContext.is() )
- {
- uno::Reference< container::XHierarchicalNameAccess > xTypeDescProv(
- m_xContext->getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager"),
- uno::UNO_QUERY_THROW );
-
- m_xTypeDescription.set( xTypeDescProv->getByHierarchicalName( sConstantName ), uno::UNO_QUERY_THROW );
- uno::Sequence<
- uno::Reference< reflection::XConstantTypeDescription > >
- cs(m_xTypeDescription->getConstants());
- std::sort(cs.begin(), cs.end(), CompareConstants());
- m_aConstants = cs;
- }
- }
- }
+ if ( !nLength )
+ return;
+
+ const uno::Any* pIter = aArguments.getConstArray();
+ m_xTypeConverter.set(*pIter++,uno::UNO_QUERY);
+ if ( nLength != 3 )
+ return;
+
+ OUString sConstantName;
+ *pIter++ >>= sConstantName;
+ *pIter >>= m_aValues;
+
+ if ( !m_xContext.is() )
+ return;
+
+ uno::Reference< container::XHierarchicalNameAccess > xTypeDescProv(
+ m_xContext->getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager"),
+ uno::UNO_QUERY_THROW );
+
+ m_xTypeDescription.set( xTypeDescProv->getByHierarchicalName( sConstantName ), uno::UNO_QUERY_THROW );
+ uno::Sequence<
+ uno::Reference< reflection::XConstantTypeDescription > >
+ cs(m_xTypeDescription->getConstants());
+ std::sort(cs.begin(), cs.end(), CompareConstants());
+ m_aConstants = cs;
}
OUString StringRepresentation::convertSimpleToString( const uno::Any& _rValue )
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 89ea65898d01..4560d8f2baf7 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -277,23 +277,23 @@ double GridWindow::findMaxY()
void GridWindow::computeExtremes()
{
- if( m_nValues && m_pXValues && m_pOrigYValues )
+ if( !(m_nValues && m_pXValues && m_pOrigYValues) )
+ return;
+
+ m_fMaxX = m_fMinX = m_pXValues[0];
+ m_fMaxY = m_fMinY = m_pOrigYValues[0];
+ for( int i = 1; i < m_nValues; i++ )
{
- m_fMaxX = m_fMinX = m_pXValues[0];
- m_fMaxY = m_fMinY = m_pOrigYValues[0];
- for( int i = 1; i < m_nValues; i++ )
- {
- if( m_pXValues[ i ] > m_fMaxX )
- m_fMaxX = m_pXValues[ i ];
- else if( m_pXValues[ i ] < m_fMinX )
- m_fMinX = m_pXValues[ i ];
- if( m_pOrigYValues[ i ] > m_fMaxY )
- m_fMaxY = m_pOrigYValues[ i ];
- else if( m_pOrigYValues[ i ] < m_fMinY )
- m_fMinY = m_pOrigYValues[ i ];
- }
- setBoundings( m_fMinX, m_fMinY, m_fMaxX, m_fMaxY );
+ if( m_pXValues[ i ] > m_fMaxX )
+ m_fMaxX = m_pXValues[ i ];
+ else if( m_pXValues[ i ] < m_fMinX )
+ m_fMinX = m_pXValues[ i ];
+ if( m_pOrigYValues[ i ] > m_fMaxY )
+ m_fMaxY = m_pOrigYValues[ i ];
+ else if( m_pOrigYValues[ i ] < m_fMinY )
+ m_fMinY = m_pOrigYValues[ i ];
}
+ setBoundings( m_fMinX, m_fMinY, m_fMaxX, m_fMaxY );
}
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 5b94119b5484..7e94b17c4875 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -656,168 +656,168 @@ IMPL_LINK( SaneDlg, SelectHdl, weld::ComboBox&, rListBox, void )
IMPL_LINK_NOARG(SaneDlg, OptionsBoxSelectHdl, weld::TreeView&, void)
{
- if (Sane::IsSane())
+ if (!Sane::IsSane())
+ return;
+
+ OUString aOption = mxOptionBox->get_selected_text();
+ int nOption = mrSane.GetOptionByName(OUStringToOString(aOption,
+ osl_getThreadTextEncoding()).getStr());
+ if( nOption == -1 || nOption == mnCurrentOption )
+ return;
+
+ DisableOption();
+ mnCurrentOption = nOption;
+ mxOptionTitle->set_label(mrSane.GetOptionTitle(mnCurrentOption));
+ SANE_Value_Type nType = mrSane.GetOptionType( mnCurrentOption );
+ SANE_Constraint_Type nConstraint;
+ switch( nType )
{
- OUString aOption = mxOptionBox->get_selected_text();
- int nOption = mrSane.GetOptionByName(OUStringToOString(aOption,
- osl_getThreadTextEncoding()).getStr());
- if( nOption != -1 && nOption != mnCurrentOption )
+ case SANE_TYPE_BOOL: EstablishBoolOption();break;
+ case SANE_TYPE_STRING:
+ nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
+ if( nConstraint == SANE_CONSTRAINT_STRING_LIST )
+ EstablishStringRange();
+ else
+ EstablishStringOption();
+ break;
+ case SANE_TYPE_FIXED:
+ case SANE_TYPE_INT:
{
- DisableOption();
- mnCurrentOption = nOption;
- mxOptionTitle->set_label(mrSane.GetOptionTitle(mnCurrentOption));
- SANE_Value_Type nType = mrSane.GetOptionType( mnCurrentOption );
- SANE_Constraint_Type nConstraint;
- switch( nType )
+ nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
+ int nElements = mrSane.GetOptionElements( mnCurrentOption );
+ mnCurrentElement = 0;
+ if( nConstraint == SANE_CONSTRAINT_RANGE ||
+ nConstraint == SANE_CONSTRAINT_WORD_LIST )
+ EstablishQuantumRange();
+ else
{
- case SANE_TYPE_BOOL: EstablishBoolOption();break;
- case SANE_TYPE_STRING:
- nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
- if( nConstraint == SANE_CONSTRAINT_STRING_LIST )
- EstablishStringRange();
- else
- EstablishStringOption();
- break;
- case SANE_TYPE_FIXED:
- case SANE_TYPE_INT:
+ mfMin = mfMax = 0.0;
+ EstablishNumericOption();
+ }
+ if( nElements > 1 )
+ {
+ if( nElements <= 10 )
{
- nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
- int nElements = mrSane.GetOptionElements( mnCurrentOption );
- mnCurrentElement = 0;
- if( nConstraint == SANE_CONSTRAINT_RANGE ||
- nConstraint == SANE_CONSTRAINT_WORD_LIST )
- EstablishQuantumRange();
- else
- {
- mfMin = mfMax = 0.0;
- EstablishNumericOption();
- }
- if( nElements > 1 )
- {
- if( nElements <= 10 )
- {
- mxVectorBox->set_range(1, mrSane.GetOptionElements(mnCurrentOption));
- mxVectorBox->set_value(1);
- mxVectorBox->show();
- mxVectorTxt->show();
- }
- else
- {
- DisableOption();
- // bring up dialog only on button click
- EstablishButtonOption();
- }
- }
+ mxVectorBox->set_range(1, mrSane.GetOptionElements(mnCurrentOption));
+ mxVectorBox->set_value(1);
+ mxVectorBox->show();
+ mxVectorTxt->show();
}
- break;
- case SANE_TYPE_BUTTON:
+ else
+ {
+ DisableOption();
+ // bring up dialog only on button click
EstablishButtonOption();
- break;
- default: break;
+ }
}
}
+ break;
+ case SANE_TYPE_BUTTON:
+ EstablishButtonOption();
+ break;
+ default: break;
}
}
IMPL_LINK(SaneDlg, ModifyHdl, weld::Entry&, rEdit, void)
{
- if( mrSane.IsOpen() )
+ if( !mrSane.IsOpen() )
+ return;
+
+ if (&rEdit == mxStringEdit.get())
{
- if (&rEdit == mxStringEdit.get())
- {
- mrSane.SetOptionValue( mnCurrentOption, mxStringEdit->get_text() );
- }
- else if (&rEdit == mxNumericEdit.get())
+ mrSane.SetOptionValue( mnCurrentOption, mxStringEdit->get_text() );
+ }
+ else if (&rEdit == mxNumericEdit.get())
+ {
+ double fValue = mxNumericEdit->get_text().toDouble();
+ if( mfMin != mfMax && ( fValue < mfMin || fValue > mfMax ) )
{
- double fValue = mxNumericEdit->get_text().toDouble();
- if( mfMin != mfMax && ( fValue < mfMin || fValue > mfMax ) )
- {
- char pBuf[256];
- if( fValue < mfMin )
- fValue = mfMin;
- else if( fValue > mfMax )
- fValue = mfMax;
- sprintf( pBuf, "%g", fValue );
- mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) );
- }
- mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
+ char pBuf[256];
+ if( fValue < mfMin )
+ fValue = mfMin;
+ else if( fValue > mfMax )
+ fValue = mfMax;
+ sprintf( pBuf, "%g", fValue );
+ mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) );
}
- else if (&rEdit == mxVectorBox.get())
+ mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
+ }
+ else if (&rEdit == mxVectorBox.get())
+ {
+ mnCurrentElement = mxVectorBox->get_value() - 1;
+ double fValue;
+ if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ))
{
- mnCurrentElement = mxVectorBox->get_value() - 1;
- double fValue;
- if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ))
- {
- char pBuf[256];
- sprintf( pBuf, "%g", fValue );
- OUString aValue( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
- mxNumericEdit->set_text( aValue );
- mxQuantumRangeBox->set_active_text( aValue );
- }
+ char pBuf[256];
+ sprintf( pBuf, "%g", fValue );
+ OUString aValue( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
+ mxNumericEdit->set_text( aValue );
+ mxQuantumRangeBox->set_active_text( aValue );
}
}
}
IMPL_LINK(SaneDlg, ValueModifyHdl, weld::ComboBox&, rEdit, void)
{
- if( mrSane.IsOpen() )
+ if( !mrSane.IsOpen() )
+ return;
+
+ if (&rEdit != mxReslBox.get())
+ return;
+
+ double fRes = static_cast<double>(mxReslBox->get_active_text().toUInt32());
+ int nOption = mrSane.GetOptionByName( "resolution" );
+ if( nOption == -1 )
+ return;
+
+ std::unique_ptr<double[]> pDouble;
+ int nValues = mrSane.GetRange( nOption, pDouble );
+ if( nValues > 0 )
{
- if (&rEdit == mxReslBox.get())
+ int i;
+ for( i = 0; i < nValues; i++ )
{
- double fRes = static_cast<double>(mxReslBox->get_active_text().toUInt32());
- int nOption = mrSane.GetOptionByName( "resolution" );
- if( nOption != -1 )
- {
- std::unique_ptr<double[]> pDouble;
- int nValues = mrSane.GetRange( nOption, pDouble );
- if( nValues > 0 )
- {
- int i;
- for( i = 0; i < nValues; i++ )
- {
- if( fRes == pDouble[i] )
- break;
- }
- if( i >= nValues )
- fRes = pDouble[0];
- }
- else if( nValues == 0 )
- {
- if( fRes < pDouble[ 0 ] )
- fRes = pDouble[ 0 ];
- if( fRes > pDouble[ 1 ] )
- fRes = pDouble[ 1 ];
- }
- mxReslBox->set_entry_text(OUString::number(static_cast<sal_uInt32>(fRes)));
- }
+ if( fRes == pDouble[i] )
+ break;
}
+ if( i >= nValues )
+ fRes = pDouble[0];
+ }
+ else if( nValues == 0 )
+ {
+ if( fRes < pDouble[ 0 ] )
+ fRes = pDouble[ 0 ];
+ if( fRes > pDouble[ 1 ] )
+ fRes = pDouble[ 1 ];
}
+ mxReslBox->set_entry_text(OUString::number(static_cast<sal_uInt32>(fRes)));
}
IMPL_LINK(SaneDlg, MetricValueModifyHdl, weld::MetricSpinButton&, rEdit, void)
{
- if( mrSane.IsOpen() )
+ if( !mrSane.IsOpen() )
+ return;
+
+ if (&rEdit == mxTopField.get())
{
- if (&rEdit == mxTopField.get())
- {
- mxPreview->ChangePreviewLogicTopLeftY(mxTopField->get_value(FieldUnit::NONE));
- mxPreview->Invalidate();
- }
- else if (&rEdit == mxLeftField.get())
- {
- mxPreview->ChangePreviewLogicTopLeftX(mxLeftField->get_value(FieldUnit::NONE));
- mxPreview->Invalidate();
- }
- else if (&rEdit == mxBottomField.get())
- {
- mxPreview->ChangePreviewLogicBottomRightY(mxBottomField->get_value(FieldUnit::NONE));
- mxPreview->Invalidate();
- }
- else if (&rEdit == mxRightField.get())
- {
- mxPreview->ChangePreviewLogicBottomRightX(mxRightField->get_value(FieldUnit::NONE));
- mxPreview->Invalidate();
- }
+ mxPreview->ChangePreviewLogicTopLeftY(mxTopField->get_value(FieldUnit::NONE));
+ mxPreview->Invalidate();
+ }
+ else if (&rEdit == mxLeftField.get())
+ {
+ mxPreview->ChangePreviewLogicTopLeftX(mxLeftField->get_value(FieldUnit::NONE));
+ mxPreview->Invalidate();
+ }
+ else if (&rEdit == mxBottomField.get())
+ {
+ mxPreview->ChangePreviewLogicBottomRightY(mxBottomField->get_value(FieldUnit::NONE));
+ mxPreview->Invalidate();
+ }
+ else if (&rEdit == mxRightField.get())
+ {
+ mxPreview->ChangePreviewLogicBottomRightX(mxRightField->get_value(FieldUnit::NONE));
+ mxPreview->Invalidate();
}
}
More information about the Libreoffice-commits
mailing list