diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-13 08:40:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-13 09:02:09 +0100 |
commit | 630b5db9a10cd49d24d5e563374bd68f1fe670f5 (patch) | |
tree | 711cff6fd0fcf1c2648bcf358e976cba34c2affb | |
parent | ca0308797df86ebece19260f3ca438a0cb437208 (diff) |
loplugin:singlevalfields in svtools
Change-Id: I6bb8a875f18df3cb7054fa65285eb3cafc1648ac
Reviewed-on: https://gerrit.libreoffice.org/63316
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svtools/calendar.hxx | 8 | ||||
-rw-r--r-- | include/svtools/ruler.hxx | 2 | ||||
-rw-r--r-- | include/svtools/scrwin.hxx | 5 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/fileview.cxx | 190 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl1.cxx | 62 | ||||
-rw-r--r-- | svtools/source/control/calendar.cxx | 25 | ||||
-rw-r--r-- | svtools/source/control/ruler.cxx | 6 | ||||
-rw-r--r-- | svtools/source/control/scrwin.cxx | 46 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 26 |
12 files changed, 24 insertions, 357 deletions
diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx index ea2df0f63be0..a44fe7d2a5d3 100644 --- a/include/svtools/calendar.hxx +++ b/include/svtools/calendar.hxx @@ -167,11 +167,8 @@ class SVT_DLLPUBLIC Calendar final : public Control mbPrevIn:1, mbNextIn:1, mbTravelSelect:1, - mbAllSel:1, - mbDropPos:1; + mbAllSel:1; Link<Calendar*,void> maSelectHdl; - Timer maDragScrollTimer; - sal_uInt16 mnDragScrollHitTest; using Control::ImplInitSettings; using Window::ImplInit; @@ -201,8 +198,6 @@ class SVT_DLLPUBLIC Calendar final : public Control SVT_DLLPRIVATE void ImplEndTracking( bool bCancel ); SVT_DLLPRIVATE DayOfWeek ImplGetWeekStart() const; - DECL_LINK( ScrollHdl, Timer *, void ); - public: Calendar( vcl::Window* pParent, WinBits nWinStyle ); virtual ~Calendar() override; @@ -291,7 +286,6 @@ private: VclPtr<Calendar> mpCalendar; VclPtr<PushButton> mpTodayBtn; VclPtr<PushButton> mpNoneBtn; - Date const maDefaultDate; bool mbToday; bool mbNone; diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index e4baeb882500..5a7c463aa3b5 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -550,7 +550,6 @@ struct RulerTab struct RulerLine { long nPos; - sal_uInt16 nStyle; }; @@ -628,7 +627,6 @@ private: long mnBorderWidth; long mnStartDragPos; long mnDragPos; - ImplSVEvent * mnUpdateEvtId; std::unique_ptr<ImplRulerData> mpSaveData; ImplRulerData* mpData; std::unique_ptr<ImplRulerData> mpDragData; diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx index 1f81783a2685..10e547669516 100644 --- a/include/svtools/scrwin.hxx +++ b/include/svtools/scrwin.hxx @@ -37,10 +37,7 @@ private: VclPtr<ScrollBar> aVScroll; // the scrollbars VclPtr<ScrollBar> aHScroll; VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner - bool bScrolling:1, // user controlled scrolling - bHandleDragging:1, // scroll window while dragging - bHCenter:1, - bVCenter:1; + bool bScrolling:1; // user controlled scrolling DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar *, void ); DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar *, void ); diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index a67518f5c6e0..b085a3e9e314 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -443,7 +443,6 @@ private: bool mbBlackSel : 1; bool mbDoubleSel : 1; bool mbScroll : 1; - bool mbFullMode : 1; bool mbEdgeBlending : 1; bool mbHasVisibleItems : 1; diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 11986c86c6c8..70d49670ea7d 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -826,15 +826,11 @@ void DrawViewShell::ShowMousePosInfo(const ::tools::Rectangle& rRect, nCnt = 1; pHLines[0].nPos = rRect.Left() - nHOffs; pVLines[0].nPos = rRect.Top() - nVOffs; - pHLines[0].nStyle = 0; - pVLines[0].nStyle = 0; if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() ) { pHLines[1].nPos = rRect.Right() - nHOffs; pVLines[1].nPos = rRect.Bottom() - nVOffs; - pHLines[1].nStyle = 0; - pVLines[1].nStyle = 0; nCnt++; } diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8cc3fef8c864..d5421ca47222 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -211,97 +211,6 @@ public: virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopentry ) override; }; -// provides a list of _unique_ Entries -class NameTranslationList -{ // contains a list of substitutes of strings for a given folder (as URL) - // explanation of the circumstances see in remarks for Init(); -protected: - INetURLObject maTransFile; // URL of file with translation entries - /// for future purposes when dealing with a set of cached NameTranslationLists - OUString const m_HashedURL; -private: - std::unordered_map<OUString, OUString> m_Translation; - const OUString maTransFileName; - -public: - explicit NameTranslationList( const INetURLObject& rBaseURL ); - // rBaseURL: path to folder for which the translation of the entries - // should be done - - const OUString* Translate( const OUString& rName ) const; - // returns NULL, if rName can't be found - - inline const OUString& GetTransTableFileName() const; - OUString const& GetHashedURL() { return m_HashedURL; } - // returns the name for the file, which contains the translation strings -}; - -inline const OUString& NameTranslationList::GetTransTableFileName() const -{ - return maTransFileName; -} - -NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ): - maTransFile( rBaseURL ), - m_HashedURL(rBaseURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)), - maTransFileName( OUString(".nametranslation.table") ) -{ - maTransFile.insertName( maTransFileName ); - - // Tries to read the file ".nametranslation.table" in the base folder. Complete path/name is in maTransFile. - // Further on, the found entries in the section "TRANSLATIONNAMES" are used to replace names in the - // base folder by translated ones. The translation must be given in UTF8 - // See examples of such a files in the samples-folder of an Office installation - try - { - ::ucbhelper::Content aTestContent( maTransFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() ); - - if( aTestContent.isDocument() ) - { - // ... also tests the existence of maTransFile by throwing an Exception - OUString aFsysName( maTransFile.getFSysPath( FSysStyle::Detect ) ); - Config aConfig( aFsysName ); - - aConfig.SetGroup( OString("TRANSLATIONNAMES") ); - - sal_uInt16 nKeyCnt = aConfig.GetKeyCount(); - - for( sal_uInt16 nCnt = 0 ; nCnt < nKeyCnt ; ++nCnt ) - { - m_Translation.insert(std::make_pair( - OStringToOUString(aConfig.GetKeyName(nCnt), RTL_TEXTENCODING_ASCII_US), - OStringToOUString(aConfig.ReadKey(nCnt), RTL_TEXTENCODING_UTF8) - )); - } - } - } - catch( Exception const & ) {} -} - -const OUString* NameTranslationList::Translate( const OUString& rName ) const -{ - auto const iter(m_Translation.find(rName)); - return (iter != m_Translation.end()) ? &iter->second : nullptr; -} - -// enables the user to get string substitutions (translations for the content) for a given folder -// see more explanations above in the description for NameTranslationList -class NameTranslator_Impl : public ::svt::IContentTitleTranslation -{ -private: - std::unique_ptr<NameTranslationList> mpActFolder; -public: - explicit NameTranslator_Impl( const INetURLObject& rActualFolder ); - virtual ~NameTranslator_Impl(); - - // IContentTitleTranslation - virtual bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const override; - - void SetActualFolder( const INetURLObject& rActualFolder ); - const OUString* GetTransTableFileName() const; - // returns the name for the file, which contains the translation strings -}; - //= SvtFileView_Impl @@ -329,11 +238,9 @@ public: VclPtr<SvTreeListBox> mpCurView; VclPtr<ViewTabListBox_Impl> mpView; VclPtr<IconView> mpIconView; - std::unique_ptr<NameTranslator_Impl> mpNameTrans; sal_uInt16 mnSortColumn; bool mbAscending : 1; bool const mbOnlyFolder : 1; - bool mbReplaceNames : 1; // translate folder names or display doc-title instead of file name sal_Int16 mnSuspendSelectCallback : 1; bool mbIsFirstResort : 1; @@ -386,8 +293,6 @@ public: const OUString& rTitle, bool bWrapAround ); - void SetActualFolder( const INetURLObject& rActualFolder ); - void SetSelectHandler( const Link<SvTreeListBox*,void>& _rHdl ); void InitSelection(); @@ -408,8 +313,6 @@ protected: inline void SvtFileView_Impl::EnableDelete( bool bEnable ) { mpView->EnableDelete( bEnable ); - if( bEnable ) - mbReplaceNames = false; } inline void SvtFileView_Impl::EndEditing() @@ -1384,54 +1287,6 @@ void SvtFileView::StateChanged( StateChangedType nStateChange ) } -// class NameTranslator_Impl - - -NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder ) - : mpActFolder( new NameTranslationList( rActualFolder ) ) -{ -} - -NameTranslator_Impl::~NameTranslator_Impl() -{ -} - -void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder ) -{ - if( mpActFolder ) - { - if (mpActFolder->GetHashedURL() != rActualFolder.GetMainURL(INetURLObject::DecodeMechanism::NONE)) - { - mpActFolder.reset( new NameTranslationList( rActualFolder ) ); - } - } - else - mpActFolder.reset( new NameTranslationList( rActualFolder ) ); -} - -bool NameTranslator_Impl::GetTranslation( const OUString& rOrg, OUString& rTrans ) const -{ - bool bRet = false; - - if( mpActFolder ) - { - const OUString* pTrans = mpActFolder->Translate( rOrg ); - if( pTrans ) - { - rTrans = *pTrans; - bRet = true; - } - } - - return bRet; -} - -const OUString* NameTranslator_Impl::GetTransTableFileName() const -{ - return mpActFolder? &mpActFolder->GetTransTableFileName() : nullptr; -} - - // class SvtFileView_Impl @@ -1444,7 +1299,6 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand ,mnSortColumn ( COLUMN_TITLE ) ,mbAscending ( true ) ,mbOnlyFolder ( bOnlyFolder ) - ,mbReplaceNames ( false ) ,mnSuspendSelectCallback ( 0 ) ,mbIsFirstResort ( true ) ,aIntlWrapper ( Application::GetSettings().GetLanguageTag() ) @@ -1475,7 +1329,6 @@ void SvtFileView_Impl::Clear() ::osl::MutexGuard aGuard( maMutex ); maContent.clear(); - mpNameTrans.reset(); } @@ -1488,9 +1341,6 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( INetURLObject aFolderObj( rFolder ); DBG_ASSERT( aFolderObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL!" ); - // prepare name translation - SetActualFolder( aFolderObj ); - FolderDescriptor aFolder( aFolderObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); aGuard.clear(); @@ -1508,7 +1358,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( OSL_ENSURE( !m_xContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" ); m_xContentEnumerator.set(new ::svt::FileViewContentEnumerator( - mpView->GetCommandEnvironment(), maContent, maMutex, mbReplaceNames ? mpNameTrans.get() : nullptr)); + mpView->GetCommandEnvironment(), maContent, maMutex, nullptr)); // TODO: should we cache and re-use this thread? if ( !pAsyncDescriptor ) @@ -1600,23 +1450,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) { - bool bHideTransFile = mbReplaceNames && mpNameTrans; - - OUString sHideEntry; - if( bHideTransFile ) - { - const OUString* pTransTableFileName = mpNameTrans->GetTransTableFileName(); - if( pTransTableFileName ) - { - sHideEntry = *pTransTableFileName; - sHideEntry = sHideEntry.toAsciiUpperCase(); - } - else - bHideTransFile = false; - } - - if ( !bHideTransFile && - ( rFilter.isEmpty() || ( rFilter == ALL_FILES_FILTER ) ) ) + if ( rFilter.isEmpty() || ( rFilter == ALL_FILES_FILTER ) ) // when replacing names, there is always something to filter (no view of ".nametranslation.table") return; @@ -1652,13 +1486,8 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title! bool bDelete; - if( bHideTransFile && sCompareString == sHideEntry ) - bDelete = true; - else - { - bDelete = ::std::none_of( aFilters.begin(), aFilters.end(), - FilterMatch( sCompareString ) ); - } + bDelete = ::std::none_of( aFilters.begin(), aFilters.end(), + FilterMatch( sCompareString ) ); if( bDelete ) { @@ -2162,17 +1991,6 @@ bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTit } -void SvtFileView_Impl::SetActualFolder( const INetURLObject& rActualFolder ) -{ - if( mbReplaceNames ) - { - if( mpNameTrans ) - mpNameTrans->SetActualFolder( rActualFolder ); - else - mpNameTrans.reset(new NameTranslator_Impl( rActualFolder )); - } -} - namespace svtools { QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName) diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 07042df01dcd..c6749bc3886f 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -156,7 +156,6 @@ class SvxIconChoiceCtrl_Impl VclPtr<ScrollBarBox> aScrBarBox; tools::Rectangle aCurSelectionRect; std::vector<tools::Rectangle> aSelectedRectList; - Idle aEditIdle; // for editing in place Idle aAutoArrangeIdle; Idle aDocRectChangedIdle; Idle aVisRectChangedIdle; @@ -178,7 +177,6 @@ class SvxIconChoiceCtrl_Impl IconChoiceFlags nFlags; DrawTextFlags nCurTextDrawFlags; ImplSVEvent * nUserEventAdjustScrBars; - ImplSVEvent * nUserEventShowCursor; SvxIconChoiceCtrlEntry* pCurHighlightFrame; bool bHighlightFramePressed; SvxIconChoiceCtrlEntry* pHead; // top left entry @@ -199,7 +197,6 @@ class SvxIconChoiceCtrl_Impl SvxIconChoiceCtrlPositionMode ePositionMode; bool bBoundRectsDirty; bool bUpdateMode; - bool bEntryEditingEnabled; void ShowCursor( bool bShow ); @@ -210,7 +207,6 @@ class SvxIconChoiceCtrl_Impl DECL_LINK( ScrollUpDownHdl, ScrollBar*, void ); DECL_LINK( ScrollLeftRightHdl, ScrollBar*, void ); - DECL_LINK( EditTimeoutHdl, Timer *, void); DECL_LINK( UserEventHdl, void*, void ); DECL_LINK( AutoArrangeHdl, Timer*, void ); DECL_LINK( DocRectChangedHdl, Timer*, void ); @@ -236,8 +232,6 @@ class SvxIconChoiceCtrl_Impl void ToggleSelection( SvxIconChoiceCtrlEntry* ); void DeselectAllBut( SvxIconChoiceCtrlEntry const * ); void Center( SvxIconChoiceCtrlEntry* pEntry ) const; - void StopEditTimer() { aEditIdle.Stop(); } - void StartEditTimer() { aEditIdle.Start(); } void CallSelectHandler(); void SelectRect( SvxIconChoiceCtrlEntry* pEntry1, diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 64239976d29f..b9f5f5276e0a 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -94,7 +94,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aVerSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_VSCROLL) ), aHorSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_HSCROLL) ), aScrBarBox( VclPtr<ScrollBarBox>::Create(pCurView) ), - aEditIdle( "svtools contnr SvxIconChoiceCtrl_Impl Edit" ), aAutoArrangeIdle ( "svtools contnr SvxIconChoiceCtrl_Impl AutoArrange" ), aDocRectChangedIdle ( "svtools contnr SvxIconChoiceCtrl_Impl DocRectChanged" ), aVisRectChangedIdle ( "svtools contnr SvxIconChoiceCtrl_Impl VisRectChanged" ), @@ -111,7 +110,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( pHead = nullptr; pCursor = nullptr; bUpdateMode = true; - bEntryEditingEnabled = false; bHighlightFramePressed = false; eSelectionMode = SelectionMode::Multiple; pView = pCurView; @@ -119,7 +117,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SetStyle( nWinStyle ); nFlags = IconChoiceFlags::NONE; nUserEventAdjustScrBars = nullptr; - nUserEventShowCursor = nullptr; nMaxVirtWidth = DEFAULT_MAX_VIRT_WIDTH; nMaxVirtHeight = DEFAULT_MAX_VIRT_HEIGHT; pDDDev = nullptr; @@ -135,10 +132,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( nHorSBarHeight = aHorSBar->GetSizePixel().Height(); nVerSBarWidth = aVerSBar->GetSizePixel().Width(); - aEditIdle.SetPriority( TaskPriority::LOWEST ); - aEditIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl)); - aEditIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aEditIdle" ); - aAutoArrangeIdle.SetPriority( TaskPriority::HIGH_IDLE ); aAutoArrangeIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl)); aAutoArrangeIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" ); @@ -169,7 +162,6 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() pCurEditedEntry = nullptr; pEdit.disposeAndClear(); Clear(false); - StopEditTimer(); CancelUserEvents(); pImpCursor.reset(); pGridMap.reset(); @@ -189,7 +181,6 @@ void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor ) StopEntryEditing(); nSelectionCount = 0; pCurHighlightFrame = nullptr; - StopEditTimer(); CancelUserEvents(); ShowCursor( false ); bBoundRectsDirty = false; @@ -261,7 +252,6 @@ IMPL_LINK( SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl, ScrollBar*, pScrollBar, v void SvxIconChoiceCtrl_Impl::FontModified() { - StopEditTimer(); pDDDev.disposeAndClear(); pDDBufDev.disposeAndClear(); pDDTempDev.disposeAndClear(); @@ -273,7 +263,6 @@ void SvxIconChoiceCtrl_Impl::FontModified() void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t nPos) { - StopEditTimer(); aEntries.insert( nPos, pEntry ); if( (nFlags & IconChoiceFlags::EntryListPosValid) && nPos >= aEntries.size() - 1 ) pEntry->nPos = aEntries.size() - 1; @@ -423,7 +412,6 @@ void SvxIconChoiceCtrl_Impl::EntrySelected(SvxIconChoiceCtrlEntry* pEntry, bool void SvxIconChoiceCtrl_Impl::ResetVirtSize() { - StopEditTimer(); aVirtOutputSize.setWidth( 0 ); aVirtOutputSize.setHeight( 0 ); const size_t nCount = aEntries.size(); @@ -563,7 +551,6 @@ void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors ) bUpdateMode = false; aAutoArrangeIdle.Stop(); nFlags |= IconChoiceFlags::Arranging; - StopEditTimer(); ShowCursor( false ); ResetVirtSize(); if( !bKeepPredecessors ) @@ -711,7 +698,6 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) { bool bHandled = true; bHighlightFramePressed = false; - StopEditTimer(); bool bGotFocus = (!pView->HasFocus() && !(nWinBits & WB_NOPOINTERFOCUS)); if( !(nWinBits & WB_NOPOINTERFOCUS) ) pView->GrabFocus(); @@ -786,7 +772,6 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) } } bool bSelected = pEntry->IsSelected(); - bool bEditingEnabled = bEntryEditingEnabled; if( rMEvt.GetClicks() == 2 ) { @@ -800,21 +785,11 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) // Inplace-Editing ? if( rMEvt.IsMod2() ) // Alt? { - if( bEntryEditingEnabled && pEntry && - pEntry->IsSelected()) - { - EditEntry( pEntry ); - } } else if( eSelectionMode == SelectionMode::Single ) { DeselectAllBut( pEntry ); SetCursor( pEntry ); - if( bEditingEnabled && bSelected && !rMEvt.GetModifier() && - rMEvt.IsLeft() && IsTextHit( pEntry, aDocPos ) ) - { - nFlags |= IconChoiceFlags::StartEditTimerInMouseUp; - } } else if( eSelectionMode == SelectionMode::NONE ) { @@ -839,11 +814,6 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) { // deselect only in the Up, if the Move happened via D&D! nFlags |= IconChoiceFlags::DownDeselect; - if( bEditingEnabled && IsTextHit( pEntry, aDocPos ) && - rMEvt.IsLeft()) - { - nFlags |= IconChoiceFlags::StartEditTimerInMouseUp; - } } } else if( rMEvt.IsMod1() ) @@ -887,7 +857,6 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonUp( const MouseEvent& rMEvt ) if( nFlags & IconChoiceFlags::StartEditTimerInMouseUp ) { bHandled = true; - StartEditTimer(); nFlags &= ~IconChoiceFlags::StartEditTimerInMouseUp; } @@ -977,8 +946,6 @@ void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor, bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) { - StopEditTimer(); - bool bMod2 = rKEvt.GetKeyCode().IsMod2(); sal_Unicode cChar = rKEvt.GetCharCode(); sal_uLong nPos = sal_uLong(-1); @@ -1094,9 +1061,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) break; case KEY_F2: - if( !bMod1 && !bShift ) - EditTimeoutHdl( nullptr ); - else + if( bMod1 || bShift ) bKeyUsed = false; break; @@ -1165,12 +1130,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) break; case KEY_RETURN: - if( bMod1 ) - { - if( pCursor && bEntryEditingEnabled ) - /*pView->*/EditEntry( pCursor ); - } - else + if( !bMod1 ) bKeyUsed = false; break; @@ -1346,7 +1306,6 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars() void SvxIconChoiceCtrl_Impl::Resize() { - StopEditTimer(); InitScrollBarBox(); aOutputSize = pView->GetOutputSizePixel(); pImpCursor->Clear(); @@ -1469,7 +1428,6 @@ void SvxIconChoiceCtrl_Impl::GetFocus() void SvxIconChoiceCtrl_Impl::LoseFocus() { - StopEditTimer(); if( pCursor ) pCursor->ClearFlags( SvxIconViewFlags::FOCUSED ); ShowCursor( false ); @@ -2651,16 +2609,6 @@ bool SvxIconChoiceCtrl_Impl::IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Po return aRect.IsInside( rDocPos ); } -IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, EditTimeoutHdl, Timer *, void) -{ - SvxIconChoiceCtrlEntry* pEntry = GetCurEntry(); - if( bEntryEditingEnabled && pEntry && - pEntry->IsSelected()) - { - EditEntry( pEntry ); - } -} - #ifdef DBG_UTIL void SvxIconChoiceCtrl_Impl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry ) { @@ -2747,7 +2695,6 @@ IMPL_LINK(SvxIconChoiceCtrl_Impl, UserEventHdl, void*, nId, void ) } else if( nId == EVENTID_SHOW_CURSOR ) { - nUserEventShowCursor = nullptr; ShowCursor( true ); } } @@ -2759,11 +2706,6 @@ void SvxIconChoiceCtrl_Impl::CancelUserEvents() Application::RemoveUserEvent( nUserEventAdjustScrBars ); nUserEventAdjustScrBars = nullptr; } - if( nUserEventShowCursor ) - { - Application::RemoveUserEvent( nUserEventShowCursor ); - nUserEventShowCursor = nullptr; - } } void SvxIconChoiceCtrl_Impl::InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry ) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 60beb1ef9135..6581f26be17f 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -85,7 +85,6 @@ void Calendar::ImplInit( WinBits nWinStyle ) mbNextIn = false; mbTravelSelect = false; mbAllSel = false; - mbDropPos = false; OUString aGregorian( "gregorian"); maCalendarWrapper.loadCalendar( aGregorian, @@ -114,10 +113,6 @@ void Calendar::ImplInit( WinBits nWinStyle ) for (sal_Int32 i = 0; i < 31; ++i) maDayTexts[i] = OUString::number(i+1); - maDragScrollTimer.SetInvokeHandler( LINK( this, Calendar, ScrollHdl ) ); - maDragScrollTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() ); - mnDragScrollHitTest = 0; - ImplInitSettings(); } @@ -607,9 +602,6 @@ void Calendar::ImplDrawDate(vcl::RenderContext& rRenderContext, // if needed do FocusRect if (bFocus && HasFocus()) ShowFocus(aDateRect); - - if (mbDropPos && maDropDate == Date(nDay, nMonth, nYear)) - ImplInvertDropPos(); } void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) @@ -1032,16 +1024,6 @@ void Calendar::ImplEndTracking( bool bCancel ) mpOldSelectTable.reset(); } -IMPL_LINK_NOARG( Calendar, ScrollHdl, Timer*, void ) -{ - bool bPrevIn = (mnDragScrollHitTest & CALENDAR_HITTEST_PREV) != 0; - bool bNextIn = (mnDragScrollHitTest & CALENDAR_HITTEST_NEXT) != 0; - if( bNextIn || bPrevIn ) - { - ImplScroll( bPrevIn ); - } -} - void Calendar::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() && !mbMenuDown ) @@ -1381,7 +1363,6 @@ void Calendar::SetFirstDate( const Date& rNewFirstDate ) if ( maFirstDate != rNewFirstDate ) { maFirstDate = Date( 1, rNewFirstDate.GetMonth(), rNewFirstDate.GetYear() ); - mbDropPos = false; ImplUpdate(); } } @@ -1756,7 +1737,6 @@ CalendarField::CalendarField(vcl::Window* pParent, WinBits nWinStyle) , mpCalendar(nullptr) , mpTodayBtn(nullptr) , mpNoneBtn(nullptr) - , maDefaultDate( Date::EMPTY ) , mbToday(false) , mbNone(false) { @@ -1837,10 +1817,7 @@ bool CalendarField::ShowDropDown( bool bShow ) Date aDate = GetDate(); if ( IsEmptyDate() || !aDate.IsValidAndGregorian() ) { - if ( maDefaultDate.IsValidAndGregorian() ) - aDate = maDefaultDate; - else - aDate = Date( Date::SYSTEM ); + aDate = Date( Date::SYSTEM ); } pCalendar->SetCurDate( aDate ); Point aPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) ); diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 20a53e9e4126..fefc971c1077 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -198,7 +198,6 @@ void Ruler::ImplInit( WinBits nWinBits ) mnVirWidth = 0; // width or height from VirtualDevice mnVirHeight = 0; // height of width from VirtualDevice mnDragPos = 0; // Drag-Position (Null point) - mnUpdateEvtId = nullptr; // Update event was not sent yet mnDragAryPos = 0; // Drag-Array-Index mnDragSize = RulerDragSize::Move; // Did size change at dragging mnDragModifier = 0; // Modifier key at dragging @@ -287,8 +286,6 @@ Ruler::~Ruler() void Ruler::dispose() { - if ( mnUpdateEvtId ) - Application::RemoveUserEvent( mnUpdateEvtId ); mpSaveData.reset(); mpDragData.reset(); mxAccContext.clear(); @@ -2516,8 +2513,7 @@ void Ruler::SetLines( sal_uInt32 aLineArraySize, const RulerLine* pLineArray ) const RulerLine* pAry2 = pLineArray; while ( i ) { - if ( (aItr1->nPos != pAry2->nPos) || - (aItr1->nStyle != pAry2->nStyle) ) + if ( aItr1->nPos != pAry2->nPos ) break; ++aItr1; ++pAry2; diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index b648074ceff3..d2ed2058800d 100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -27,9 +27,6 @@ ScrollableWindow::ScrollableWindow( vcl::Window* pParent ) : aHScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL | WB_DRAG)) ), aCornerWin( VclPtr<ScrollBarBox>::Create(this) ) { - bHandleDragging = true; - bVCenter = true; - bHCenter = true; bScrolling = false; // set the handlers for the scrollbars @@ -106,24 +103,8 @@ Size ScrollableWindow::GetOutputSizePixel() const } -IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, pScroll, void ) +IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, /*pScroll*/, void ) { - // notify the start of scrolling, if not already scrolling - if ( !bScrolling ) - bScrolling = true; - - // get the delta in logic coordinates - Size aDelta( PixelToLogic( Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) ); - - // scroll the window, if this is not already done - if ( !bHandleDragging ) - { - if ( pScroll == aHScroll.get() ) - Scroll( aDelta.Width(), 0 ); - else - Scroll( 0, aDelta.Height() ); - } - // notify the end of scrolling bScrolling = false; } @@ -135,16 +116,13 @@ IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll, void ) if ( !bScrolling ) bScrolling = true; - if ( bHandleDragging ) - { - // get the delta in logic coordinates - Size aDelta( PixelToLogic( - Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) ); - if ( pScroll == aHScroll.get() ) - Scroll( aDelta.Width(), 0 ); - else - Scroll( 0, aDelta.Height() ); - } + // get the delta in logic coordinates + Size aDelta( PixelToLogic( + Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) ); + if ( pScroll == aHScroll.get() ) + Scroll( aDelta.Width(), 0 ); + else + Scroll( 0, aDelta.Height() ); } @@ -207,14 +185,10 @@ void ScrollableWindow::Resize() aPixOffset = Point( bHVisible ? aPixOffset.X() - : ( bHCenter - ? (aOutPixSz.Width()-aTotPixSz.Width()) / 2 - : 0 ), + : (aOutPixSz.Width()-aTotPixSz.Width()) / 2, bVVisible ? aPixOffset.Y() - : ( bVCenter - ? (aOutPixSz.Height()-aTotPixSz.Height()) / 2 - : 0 ) ); + : (aOutPixSz.Height()-aTotPixSz.Height()) / 2 ); } if ( bHVisible && !aHScroll->IsVisible() ) aPixOffset.setX( 0 ); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 407fcf3019f0..87f9a61993de 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2286,7 +2286,6 @@ SvtValueSet::SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow) mbBlackSel = false; mbDoubleSel = false; mbScroll = false; - mbFullMode = true; mbEdgeBlending = false; mbHasVisibleItems = false; @@ -3165,18 +3164,10 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) // calculate offsets long nStartX; long nStartY; - if (mbFullMode) - { - long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; - long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; - nStartX = (aWinSize.Width() - nAllItemWidth) / 2; - nStartY = (aWinSize.Height() - nAllItemHeight) / 2; - } - else - { - nStartX = 0; - nStartY = 0; - } + long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; + long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; + nStartX = (aWinSize.Width() - nAllItemWidth) / 2; + nStartY = (aWinSize.Height() - nAllItemHeight) / 2; // calculate and draw items maVirDev->SetLineColor(); @@ -3211,15 +3202,6 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) maItemListRect.SetRight( x + mnCols * (mnItemWidth + mnSpacing) - mnSpacing - 1 ); maItemListRect.SetBottom( y + mnVisLines * (mnItemHeight + mnSpacing) - mnSpacing - 1 ); - if (!mbFullMode) - { - // If want also draw parts of items in the last line, - // then we add one more line if parts of these line are - // visible - if (y + (mnVisLines * (mnItemHeight + mnSpacing)) < aWinSize.Height()) - nLastItem += mnCols; - maItemListRect.SetBottom( aWinSize.Height() - y ); - } for (size_t i = 0; i < nItemCount; i++) { SvtValueSetItem* pItem = mItemList[i].get(); |