summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-03 19:04:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-04 08:53:37 +0200
commit53df91adab37a65d87a44aa724b28128f32e9de5 (patch)
tree1d7b31ee1eeeb9691ccb732f0cb0e06aad4ae5b6 /vcl/source
parent89c0b79911c469518c8872a4ec06b3d2c61c357c (diff)
loplugin:singlevalfields
Change-Id: Ic74b400f0b929b4c57ad70d0b0936983a3d46360 Reviewed-on: https://gerrit.libreoffice.org/80154 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/ctrl.cxx6
-rw-r--r--vcl/source/edit/textview.cxx64
-rw-r--r--vcl/source/outdev/text.cxx5
-rw-r--r--vcl/source/treelist/treelistbox.cxx3
-rw-r--r--vcl/source/window/menubarwindow.cxx5
-rw-r--r--vcl/source/window/menufloatingwindow.cxx5
-rw-r--r--vcl/source/window/window.cxx5
7 files changed, 12 insertions, 81 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 8b3237c7c9c7..522446561a79 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -436,10 +436,9 @@ tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const t
OUString rPStr = _rStr;
DrawTextFlags nPStyle = _nStyle;
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
- if (!accel || (autoacc && !mbShowAccelerator))
+ if (autoacc && !mbShowAccelerator)
{
rPStr = GetNonMnemonicString( _rStr );
nPStyle &= ~DrawTextFlags::HideMnemonic;
@@ -462,10 +461,9 @@ tools::Rectangle Control::GetControlTextRect( OutputDevice& _rTargetDevice, cons
OUString rPStr = _rStr;
DrawTextFlags nPStyle = _nStyle;
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
- if (!accel || (autoacc && !mbShowAccelerator))
+ if (autoacc && !mbShowAccelerator)
{
rPStr = GetNonMnemonicString( _rStr );
nPStyle &= ~DrawTextFlags::HideMnemonic;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index f9c612a97a36..2eaa1b2f598c 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -142,7 +142,6 @@ struct ImpTextView
bool mbHighlightSelection : 1;
bool mbCursorEnabled : 1;
bool mbClickedInSelection : 1;
- bool mbSupportProtectAttribute : 1;
bool mbCursorAtEndOfLine;
};
@@ -162,8 +161,6 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) :
mpImpl->mbAutoIndent = false;
mpImpl->mbCursorEnabled = true;
mpImpl->mbClickedInSelection = false;
- mpImpl->mbSupportProtectAttribute = false;
- mpImpl->mbCursorAtEndOfLine = false;
// mbInSelection = false;
mpImpl->mnTravelXPos = TRAVEL_X_DONTKNOW;
@@ -579,28 +576,6 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
}
mpImpl->mpTextEngine->UndoActionStart();
- if(mpImpl->mbSupportProtectAttribute)
- {
- //expand selection to include all protected content - if there is any
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(mpImpl->maSelection.GetStart().GetPara(),
- mpImpl->maSelection.GetStart().GetIndex()),
- TEXTATTR_PROTECTED );
- const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(mpImpl->maSelection.GetEnd().GetPara(),
- mpImpl->maSelection.GetEnd().GetIndex()),
- TEXTATTR_PROTECTED );
- if(pStartAttr && pStartAttr->GetStart() < mpImpl->maSelection.GetStart().GetIndex())
- {
- mpImpl->maSelection.GetStart().GetIndex() = pStartAttr->GetStart();
- aOldSel = mpImpl->maSelection; // update to deleted!
- }
- if(pEndAttr && pEndAttr->GetEnd() > mpImpl->maSelection.GetEnd().GetIndex())
- {
- mpImpl->maSelection.GetEnd().GetIndex() = pEndAttr->GetEnd();
- aOldSel = mpImpl->maSelection; // update to deleted!
- }
- }
aCurSel = ImpDelete( nDel, nMode );
mpImpl->mpTextEngine->UndoActionEnd();
bModified = true;
@@ -761,24 +736,6 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
TextSelection aNewSel( mpImpl->maSelection );
aNewSel.GetStart().GetIndex() = aBoundary.startPos;
aNewSel.GetEnd().GetIndex() = aBoundary.endPos;
- if(mpImpl->mbSupportProtectAttribute)
- {
- //expand selection to include all protected content - if there is any
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(aNewSel.GetStart().GetPara(), aBoundary.startPos),
- TEXTATTR_PROTECTED );
- const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib(
- TextPaM(aNewSel.GetEnd().GetPara(), aBoundary.endPos),
- TEXTATTR_PROTECTED );
- if(pStartAttr && pStartAttr->GetStart() < aNewSel.GetStart().GetIndex())
- {
- aNewSel.GetStart().GetIndex() = pStartAttr->GetStart();
- }
- if(pEndAttr && pEndAttr->GetEnd() > aNewSel.GetEnd().GetIndex())
- {
- aNewSel.GetEnd().GetIndex() = pEndAttr->GetEnd();
- }
- }
ImpSetSelection( aNewSel );
ShowSelection();
ShowCursor();
@@ -1911,19 +1868,10 @@ void TextView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
if ( !aText.isEmpty() && ( aText[ aText.getLength()-1 ] == LINE_SEP ) )
aText = aText.copy(0, aText.getLength()-1);
- TextPaM aTempStart = mpImpl->maSelection.GetStart();
if ( ImplCheckTextLen( aText ) )
ImpSetSelection( mpImpl->mpTextEngine->ImpInsertText( mpImpl->mpDDInfo->maDropPos, aText ) );
- if(mpImpl->mbSupportProtectAttribute)
- {
- mpImpl->mpTextEngine->SetAttrib( TextAttribProtect(),
- aTempStart.GetPara(),
- aTempStart.GetIndex(),
- mpImpl->maSelection.GetEnd().GetIndex(), false );
- }
if ( aPrevSel.HasRange() &&
- !mpImpl->mbSupportProtectAttribute && // don't remove currently selected element
(( rDTDE.DropAction & css::datatransfer::dnd::DNDConstants::ACTION_MOVE ) || !bStarterOfDD) )
{
// adjust selection if necessary
@@ -1997,18 +1945,8 @@ void TextView::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& rDTD
Point aDocPos = GetDocPos( aMousePos );
mpImpl->mpDDInfo->maDropPos = mpImpl->mpTextEngine->GetPaM( aDocPos );
- bool bProtected = false;
- if(mpImpl->mbSupportProtectAttribute)
- {
- const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib(
- mpImpl->mpDDInfo->maDropPos,
- TEXTATTR_PROTECTED );
- bProtected = pStartAttr != nullptr &&
- pStartAttr->GetStart() != mpImpl->mpDDInfo->maDropPos.GetIndex() &&
- pStartAttr->GetEnd() != mpImpl->mpDDInfo->maDropPos.GetIndex();
- }
// Don't drop in selection or in read only engine
- if ( IsReadOnly() || IsInSelection( mpImpl->mpDDInfo->maDropPos ) || bProtected)
+ if ( IsReadOnly() || IsInSelection( mpImpl->mpDDInfo->maDropPos ))
{
ImpHideDDCursor();
rDTDE.Context->rejectDrag();
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 614ee3dd19ec..ab32920fb8a4 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2128,7 +2128,6 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
}
}
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
if ( nStyle & DrawTextFlags::Disable && ! pVector )
@@ -2168,7 +2167,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
DrawText( rPos, aStr, nIndex, nLen, pVector, pDisplayText );
if (!(GetSettings().GetStyleSettings().GetOptions() & StyleSettingsOptions::NoMnemonics)
- && accel && (!autoacc || !(nStyle & DrawTextFlags::HideMnemonic)) )
+ && (!autoacc || !(nStyle & DrawTextFlags::HideMnemonic)) )
{
if ( nMnemonicPos != -1 )
ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
@@ -2181,7 +2180,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
{
DrawText( rPos, aStr, nIndex, nLen, pVector, pDisplayText, pGlyphs );
if ( !(GetSettings().GetStyleSettings().GetOptions() & StyleSettingsOptions::NoMnemonics) && !pVector
- && accel && (!autoacc || !(nStyle & DrawTextFlags::HideMnemonic)) )
+ && (!autoacc || !(nStyle & DrawTextFlags::HideMnemonic)) )
{
if ( nMnemonicPos != -1 )
ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth );
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index b455b2f8a56e..6569fc6b7c82 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -374,7 +374,6 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) :
nMinWidthInChars(0),
mbCenterAndClipText(false)
{
- nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
nImpFlags = SvTreeListBoxFlags::NONE;
pTargetEntry = nullptr;
nDragDropMode = DragDropMode::NONE;
@@ -1201,7 +1200,7 @@ void SvTreeListBox::StartDrag( sal_Int8, const Point& rPosPixel )
// (GetSourceListBox()->EnableSelectionAsDropTarget( true, true );)
EnableSelectionAsDropTarget( false );
- pContainer->StartDrag( this, nDragOptions, GetDragFinishedHdl() );
+ pContainer->StartDrag( this, DND_ACTION_COPYMOVE | DND_ACTION_LINK, GetDragFinishedHdl() );
}
void SvTreeListBox::DragFinished( sal_Int8
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 106c949fc0df..c09eadaed322 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -852,10 +852,9 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
}
}
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
- if ( !bDone && ( bFromMenu || (rKEvent.GetKeyCode().IsMod2() && accel) ) )
+ if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsMod2() ) )
{
sal_Unicode nCharCode = rKEvent.GetCharCode();
if ( nCharCode )
@@ -876,7 +875,7 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
{
SetMBWMenuKey(bShowAccels);
SetMBWHideAccel(!bShowAccels);
- if (accel && autoacc)
+ if (autoacc)
Invalidate(InvalidateFlags::Update);
}
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index f009c24dfc87..b14329f7503c 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -1033,7 +1033,6 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
{
VclPtr<vcl::Window> xWindow = this;
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
bKeyInput = true;
@@ -1161,7 +1160,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
sal_Unicode nCharCode = rKEvent.GetCharCode();
size_t nPos = 0;
size_t nDuplicates = 0;
- MenuItemData* pData = (nCharCode && pMenu && accel) ?
+ MenuItemData* pData = (nCharCode && pMenu) ?
pMenu->GetItemList()->SearchItem(nCharCode, rKEvent.GetKeyCode(), nPos, nDuplicates, nHighlightedItem) : nullptr;
if (pData)
{
@@ -1189,7 +1188,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
{
pMenuBar->getMenuBarWindow()->SetMBWMenuKey(bShowAccels);
pMenuBar->getMenuBarWindow()->SetMBWHideAccel(!bShowAccels);
- if (accel && autoacc)
+ if (autoacc)
Invalidate(InvalidateFlags::Update);
}
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7339e881b4db..236e08a1bba7 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1768,14 +1768,13 @@ void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
void Window::KeyInput( const KeyEvent& rKEvt )
{
KeyCode cod = rKEvt.GetKeyCode ();
- bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
// do not respond to accelerators unless Alt is held */
if (cod.GetCode () >= 0x200 && cod.GetCode () <= 0x219)
{
- if (!accel) return;
- if (autoacc && cod.GetModifier () != KEY_MOD2) return;
+ if (autoacc && cod.GetModifier () != KEY_MOD2)
+ return;
}
NotifyEvent aNEvt( MouseNotifyEvent::KEYINPUT, this, &rKEvt );