diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-24 12:57:04 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-27 05:18:07 +0000 |
commit | 22864b44fd00b5a778ef597f8dfcb407d4166306 (patch) | |
tree | fbdaa2e7c1aae149dab6194f9033b9543c74b441 | |
parent | cea4c1afdf4ae0cbda8ae531f2e26d911d0fd6e1 (diff) |
loplugin:singlevalfields in dbaccess
Change-Id: I5c8990187b2b488eb75369c2a3e3dc7f855ce06a
Reviewed-on: https://gerrit.libreoffice.org/26633
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | dbaccess/source/ui/control/SqlNameEdit.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/control/VertSplitView.cxx | 81 | ||||
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbfindex.cxx | 15 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbfindex.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/SqlNameEdit.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableDesignControl.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/VertSplitView.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbtreelistbox.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableDesignControl.cxx | 3 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 25 | ||||
-rw-r--r-- | desktop/source/splash/splash.cxx | 5 |
12 files changed, 38 insertions, 107 deletions
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx index 5c025afd9655..4f89d37dd8fe 100644 --- a/dbaccess/source/ui/control/SqlNameEdit.cxx +++ b/dbaccess/source/ui/control/SqlNameEdit.cxx @@ -41,7 +41,7 @@ namespace dbaui sal_Int32 nMatch = 0; for (sal_Int32 i = nMatch; i < _sToCheck.getLength(); ++i) { - if ( !isCharOk( _sToCheck[i], i == 0, m_bOnlyUpperCase, m_sAllowedChars ) ) + if ( !isCharOk( _sToCheck[i], i == 0, false/*bOnlyUpperCase*/, m_sAllowedChars ) ) { _rsCorrected += _sToCheck.copy(nMatch, i - nMatch); bCorrected = true; diff --git a/dbaccess/source/ui/control/VertSplitView.cxx b/dbaccess/source/ui/control/VertSplitView.cxx index bf9dd114b3cf..4b79daa64ca8 100644 --- a/dbaccess/source/ui/control/VertSplitView.cxx +++ b/dbaccess/source/ui/control/VertSplitView.cxx @@ -32,7 +32,6 @@ OSplitterView::OSplitterView(vcl::Window* _pParent) : Window(_pParent,WB_DIALOGC ,m_pSplitter( nullptr ) ,m_pLeft(nullptr) ,m_pRight(nullptr) - ,m_bVertical(false) { ImplInitSettings(); } @@ -53,13 +52,7 @@ void OSplitterView::dispose() IMPL_LINK_NOARG_TYPED( OSplitterView, SplitHdl, Splitter*, void ) { OSL_ENSURE(m_pSplitter, "Splitter is NULL!"); - if ( m_bVertical ) - { - long nPosY = m_pSplitter->GetPosPixel().Y(); - m_pSplitter->SetPosPixel( Point( m_pSplitter->GetSplitPosPixel(), nPosY ) ); - } - else - m_pSplitter->SetPosPixel( Point( m_pSplitter->GetPosPixel().X(),m_pSplitter->GetSplitPosPixel() ) ); + m_pSplitter->SetPosPixel( Point( m_pSplitter->GetPosPixel().X(),m_pSplitter->GetSplitPosPixel() ) ); Resize(); } @@ -123,61 +116,31 @@ void OSplitterView::Resize() { aSplitPos = m_pSplitter->GetPosPixel(); aSplitSize = m_pSplitter->GetOutputSizePixel(); - if ( m_bVertical ) - { - // calculate the splitter pos and size - aSplitPos.Y() = aPlaygroundPos.Y(); - aSplitSize.Height() = aPlaygroundSize.Height(); - - if( ( aSplitPos.X() + aSplitSize.Width() ) > ( aPlaygroundSize.Width() )) - aSplitPos.X() = aPlaygroundSize.Width() - aSplitSize.Width(); - - if( aSplitPos.X() <= aPlaygroundPos.X() ) - aSplitPos.X() = aPlaygroundPos.X() + sal_Int32(aPlaygroundSize.Width() * 0.3); - - // the tree pos and size - Point aTreeViewPos( aPlaygroundPos ); - Size aTreeViewSize( aSplitPos.X(), aPlaygroundSize.Height() ); - - // set the size of treelistbox - m_pLeft->SetPosSizePixel( aTreeViewPos, aTreeViewSize ); - - //set the size of the splitter - m_pSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aPlaygroundSize.Height() ) ); - m_pSplitter->SetDragRectPixel( Rectangle(aPlaygroundPos,aPlaygroundSize) ); - } - else - { - aSplitPos.X() = aPlaygroundPos.X(); - aSplitSize.Width() = aPlaygroundSize.Width(); - - if( ( aSplitPos.Y() + aSplitSize.Height() ) > ( aPlaygroundSize.Height() )) - aSplitPos.Y() = aPlaygroundSize.Height() - aSplitSize.Height(); - - if( aSplitPos.Y() <= aPlaygroundPos.Y() ) - aSplitPos.Y() = aPlaygroundPos.Y() + sal_Int32(aPlaygroundSize.Height() * 0.3); - - // the tree pos and size - Point aTreeViewPos( aPlaygroundPos ); - Size aTreeViewSize( aPlaygroundSize.Width() ,aSplitPos.Y()); - - // set the size of treelistbox - m_pLeft->SetPosSizePixel( aTreeViewPos, aTreeViewSize ); - - //set the size of the splitter - m_pSplitter->SetPosSizePixel( aSplitPos, Size( aPlaygroundSize.Width(), aSplitSize.Height() ) ); - m_pSplitter->SetDragRectPixel( Rectangle(aPlaygroundPos,aPlaygroundSize) ); - } + aSplitPos.X() = aPlaygroundPos.X(); + aSplitSize.Width() = aPlaygroundSize.Width(); + + if( ( aSplitPos.Y() + aSplitSize.Height() ) > ( aPlaygroundSize.Height() )) + aSplitPos.Y() = aPlaygroundSize.Height() - aSplitSize.Height(); + + if( aSplitPos.Y() <= aPlaygroundPos.Y() ) + aSplitPos.Y() = aPlaygroundPos.Y() + sal_Int32(aPlaygroundSize.Height() * 0.3); + + // the tree pos and size + Point aTreeViewPos( aPlaygroundPos ); + Size aTreeViewSize( aPlaygroundSize.Width() ,aSplitPos.Y()); + + // set the size of treelistbox + m_pLeft->SetPosSizePixel( aTreeViewPos, aTreeViewSize ); + + //set the size of the splitter + m_pSplitter->SetPosSizePixel( aSplitPos, Size( aPlaygroundSize.Width(), aSplitSize.Height() ) ); + m_pSplitter->SetDragRectPixel( Rectangle(aPlaygroundPos,aPlaygroundSize) ); } if ( m_pRight ) { - if ( m_bVertical ) - m_pRight->setPosSizePixel( aSplitPos.X() + aSplitSize.Width(), aPlaygroundPos.Y(), - aPlaygroundSize.Width() - aSplitSize.Width() - aSplitPos.X(), aPlaygroundSize.Height()); - else - m_pRight->setPosSizePixel( aSplitPos.X(), aPlaygroundPos.Y() + aSplitPos.Y() + aSplitSize.Height(), - aPlaygroundSize.Width() , aPlaygroundSize.Height() - aSplitSize.Height() - aSplitPos.Y()); + m_pRight->setPosSizePixel( aSplitPos.X() + aSplitSize.Width(), aPlaygroundPos.Y(), + aPlaygroundSize.Width() - aSplitSize.Width() - aSplitPos.X(), aPlaygroundSize.Height()); } } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index d212bd2ce689..a2747862723a 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -59,7 +59,6 @@ DBTreeListBox::DBTreeListBox( vcl::Window* pParent, WinBits nWinStyle ) ,m_pDragedEntry(nullptr) ,m_pActionListener(nullptr) ,m_pContextMenuProvider( nullptr ) - ,m_bHandleEnterKey(false) { init(); } @@ -339,7 +338,7 @@ void DBTreeListBox::KeyInput( const KeyEvent& rKEvt ) if ( KEY_RETURN == nCode ) { - bHandled = m_bHandleEnterKey; + bHandled = false; m_aEnterKeyHdl.Call(this); // this is a HACK. If the data source browser is opened in the "beamer", while the main frame // diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx index 8a6a50d1d6a5..c9860820633e 100644 --- a/dbaccess/source/ui/dlg/dbfindex.cxx +++ b/dbaccess/source/ui/dlg/dbfindex.cxx @@ -44,7 +44,6 @@ const OString aGroupIdent("dBase III"); ODbaseIndexDialog::ODbaseIndexDialog(vcl::Window * pParent, const OUString& aDataSrcName) : ModalDialog(pParent, "DBaseIndexDialog", "dbaccess/ui/dbaseindexdialog.ui") , m_aDSN(aDataSrcName) - , m_bCaseSensitiv(true) { get(m_pPB_OK, "ok"); get(m_pCB_Tables, "table"); @@ -103,16 +102,8 @@ bool ODbaseIndexDialog::GetTable(const OUString& _rName, TableInfoList::iterator ++_rPosition ) { - if (m_bCaseSensitiv) - { - if (_rPosition->aTableName == _rName) - return true; - } - else - { - if (_rPosition->aTableName.equalsIgnoreAsciiCase(_rName)) - return true; - } + if (_rPosition->aTableName == _rName) + return true; } return false; } @@ -138,7 +129,7 @@ OTableIndex ODbaseIndexDialog::implRemoveIndex(const OUString& _rName, TableInde ++aSearch, ++nPos ) { - if ( m_bCaseSensitiv ? aSearch->GetIndexFileName() == _rName : aSearch->GetIndexFileName().equalsIgnoreAsciiCase(_rName) ) + if ( aSearch->GetIndexFileName() == _rName ) { aReturn = *aSearch; diff --git a/dbaccess/source/ui/dlg/dbfindex.hxx b/dbaccess/source/ui/dlg/dbfindex.hxx index 53358165c356..a2991475c683 100644 --- a/dbaccess/source/ui/dlg/dbfindex.hxx +++ b/dbaccess/source/ui/dlg/dbfindex.hxx @@ -93,13 +93,12 @@ protected: OUString m_aDSN; TableInfoList m_aTableInfoList; TableIndexList m_aFreeIndexList; - bool m_bCaseSensitiv; void Init(); void SetCtrls(); bool GetTable(const OUString& rName, TableInfoList::iterator& _rPosition); - OTableIndex implRemoveIndex(const OUString& _rName, TableIndexList& _rList, ListBox& _rDisplay, bool _bMustExist); + static OTableIndex implRemoveIndex(const OUString& _rName, TableIndexList& _rList, ListBox& _rDisplay, bool _bMustExist); static void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, ListBox& _rDisplay); OTableIndex RemoveFreeIndex( const OUString& _rName, bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, *m_pLB_FreeIndexes, _bMustExist); } diff --git a/dbaccess/source/ui/inc/SqlNameEdit.hxx b/dbaccess/source/ui/inc/SqlNameEdit.hxx index 9889c9815d48..253fc5432400 100644 --- a/dbaccess/source/ui/inc/SqlNameEdit.hxx +++ b/dbaccess/source/ui/inc/SqlNameEdit.hxx @@ -27,12 +27,10 @@ namespace dbaui class OSQLNameChecker { OUString m_sAllowedChars; - bool m_bOnlyUpperCase; bool m_bCheck; // true when we should check for invalid chars public: OSQLNameChecker(const OUString& _rAllowedChars) :m_sAllowedChars(_rAllowedChars) - ,m_bOnlyUpperCase(false) ,m_bCheck(true) { } diff --git a/dbaccess/source/ui/inc/TableDesignControl.hxx b/dbaccess/source/ui/inc/TableDesignControl.hxx index a4845f45e13e..46d356531a16 100644 --- a/dbaccess/source/ui/inc/TableDesignControl.hxx +++ b/dbaccess/source/ui/inc/TableDesignControl.hxx @@ -40,9 +40,6 @@ namespace dbaui private: sal_uInt16 m_nCurUndoActId; - protected: - bool m_bClipboardFilled; - public: OTableRowView(vcl::Window* pParent); diff --git a/dbaccess/source/ui/inc/VertSplitView.hxx b/dbaccess/source/ui/inc/VertSplitView.hxx index 03e40961992d..a7bf3fc886c6 100644 --- a/dbaccess/source/ui/inc/VertSplitView.hxx +++ b/dbaccess/source/ui/inc/VertSplitView.hxx @@ -30,7 +30,6 @@ namespace dbaui VclPtr<Splitter> m_pSplitter; VclPtr<vcl::Window> m_pLeft; VclPtr<vcl::Window> m_pRight; - bool m_bVertical; void ImplInitSettings(); DECL_LINK_TYPED( SplitHdl, Splitter*, void ); diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx index 9a7413a6f0f0..0e57fcf40b4a 100644 --- a/dbaccess/source/ui/inc/dbtreelistbox.hxx +++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx @@ -68,8 +68,6 @@ namespace dbaui Link<LinkParamNone*,void> m_aDeleteHandler; // called when someone press DELETE Key Link<DBTreeListBox*,void> m_aEnterKeyHdl; - bool m_bHandleEnterKey; - private: void init(); DECL_LINK_TYPED( OnTimeOut, Timer*, void ); diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx index 668edcd69958..62dc378f5aa6 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx @@ -41,7 +41,6 @@ OTableRowView::OTableRowView(vcl::Window* pParent) ,m_nDataPos(-1) ,m_nCurrentPos(-1) ,m_nCurUndoActId(0) - ,m_bClipboardFilled(false) { } @@ -111,7 +110,7 @@ void OTableRowView::Command(const CommandEvent& rEvt) long nSelectRowCount = GetSelectRowCount(); aContextMenu->EnableItem( SID_CUT, nSelectRowCount != 0); aContextMenu->EnableItem( SID_COPY, nSelectRowCount != 0); - aContextMenu->EnableItem( SID_PASTE, m_bClipboardFilled ); + aContextMenu->EnableItem( SID_PASTE, false ); aContextMenu->EnableItem( SID_DELETE, false ); switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel())) { diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index d3598f3adf04..c7f720f09708 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -123,7 +123,6 @@ class ProgressCmdEnv DialogHelper* m_pDialogHelper; OUString m_sTitle; - bool m_bAborted; bool m_bWarnUser; sal_Int32 m_nCurrentProgress; @@ -147,7 +146,6 @@ public: : m_xContext( rContext ) , m_pDialogHelper( pDialogHelper ) , m_sTitle( rTitle ) - , m_bAborted( false ) , m_bWarnUser( false ) , m_nCurrentProgress(0) {} @@ -158,7 +156,6 @@ public: void stopProgress(); void progressSection( const OUString &rText, const uno::Reference< task::XAbortChannel > &xAbortChannel = nullptr ); - inline bool isAborted() const { return m_bAborted; } inline void setWarnUser( bool bNewVal ) { m_bWarnUser = bNewVal; } // XCommandEnvironment @@ -295,26 +292,20 @@ void ProgressCmdEnv::progressSection( const OUString &rText, const uno::Reference< task::XAbortChannel > &xAbortChannel ) { m_xAbortChannel = xAbortChannel; - if (! m_bAborted) + m_nCurrentProgress = 0; + if ( m_pDialogHelper ) { - m_nCurrentProgress = 0; - if ( m_pDialogHelper ) - { - m_pDialogHelper->updateProgress( rText, xAbortChannel ); - m_pDialogHelper->updateProgress( 5 ); - } + m_pDialogHelper->updateProgress( rText, xAbortChannel ); + m_pDialogHelper->updateProgress( 5 ); } } void ProgressCmdEnv::updateProgress() { - if ( ! m_bAborted ) - { - long nProgress = ((m_nCurrentProgress*5) % 100) + 5; - if ( m_pDialogHelper ) - m_pDialogHelper->updateProgress( nProgress ); - } + long nProgress = ((m_nCurrentProgress*5) % 100) + 5; + if ( m_pDialogHelper ) + m_pDialogHelper->updateProgress( nProgress ); } @@ -730,7 +721,7 @@ void ExtensionCmdQueue::Thread::execute() // addExtension is called, which then blocks the main thread, then we deadlock. bool bStartProgress = true; - while ( !currentCmdEnv->isAborted() && --nSize >= 0 ) + while ( --nSize >= 0 ) { { osl::MutexGuard aGuard( m_mutex ); diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 091eeeb11ec4..aa33a5c16fca 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -92,7 +92,6 @@ private: sal_Int32 _iMax; sal_Int32 _iProgress; BitmapMode _eBitmapMode; - bool _bPaintBitmap; bool _bPaintProgress; bool _bVisible; bool _bShowLogo; @@ -163,7 +162,6 @@ SplashScreen::SplashScreen() , _iMax(100) , _iProgress(0) , _eBitmapMode(BM_DEFAULTMODE) - , _bPaintBitmap(true) , _bPaintProgress(false) , _bVisible(true) , _bShowLogo(true) @@ -646,8 +644,7 @@ void SplashScreenWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang // non native drawing // draw bitmap - if (pSpl->_bPaintBitmap) - _vdev->DrawBitmapEx(Point(), pSpl->_aIntroBmp); + _vdev->DrawBitmapEx(Point(), pSpl->_aIntroBmp); if (pSpl->_bPaintProgress) { // draw progress... |