include/vcl/listctrl.hxx | 61 ------------- sc/source/ui/inc/tabvwsh.hxx | 1 sc/source/ui/view/tabvwshd.cxx | 16 --- solenv/clang-format/blacklist | 2 vcl/Library_vcl.mk | 1 vcl/source/control/listctrl.cxx | 178 ---------------------------------------- vcl/source/window/builder.cxx | 6 - 7 files changed, 265 deletions(-)
New commits: commit fbe12462aaa98d9ea820908af1e7436d4590e698 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 18 13:23:52 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Oct 19 17:32:43 2019 +0200 drop unused ListControl Change-Id: I19dd8907c36d016b939ed346a4308e5df2ebf93c Reviewed-on: https://gerrit.libreoffice.org/81060 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/listctrl.hxx b/include/vcl/listctrl.hxx deleted file mode 100644 index aa825f205b47..000000000000 --- a/include/vcl/listctrl.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SVX_LISTCTRL_HXX -#define INCLUDED_SVX_LISTCTRL_HXX - -#include <vcl/ctrl.hxx> -#include <vcl/scrbar.hxx> - -#include <vector> -#include <limits> - -#include <vcl/dllapi.h> - -class VCL_DLLPUBLIC ListControl : public Control -{ -private: - std::vector<VclPtr<vcl::Window>> maEntries; - bool mbHasScrollBar; - VclPtr<ScrollBar> mpScrollBar; - - void DoScroll(long nDiff); - void RecalcAll(); -public: - - ListControl(vcl::Window* pParent, WinBits nStyle); - virtual ~ListControl() override; - virtual void dispose() override; - - void addEntry(const VclPtr<vcl::Window>& xEntry, - sal_uInt32 nPos = std::numeric_limits<sal_uInt16>::max()); - std::vector<VclPtr<vcl::Window>> const & getEntries() const; - void deleteEntry(sal_uInt32 nPos); - - virtual Size GetOptimalSize() const override; - virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; - virtual void Resize() override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - - DECL_LINK( ScrollHdl, ScrollBar*, void ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 81d8a233b674..0db65dd1969b 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -7834,7 +7834,6 @@ include/vcl/keycodes.hxx include/vcl/layout.hxx include/vcl/lazydelete.hxx include/vcl/lineinfo.hxx -include/vcl/listctrl.hxx include/vcl/longcurr.hxx include/vcl/lstbox.hxx include/vcl/mapmod.hxx @@ -17725,7 +17724,6 @@ vcl/source/control/imivctl2.cxx vcl/source/control/imp_listbox.cxx vcl/source/control/ivctrl.cxx vcl/source/control/listbox.cxx -vcl/source/control/listctrl.cxx vcl/source/control/longcurr.cxx vcl/source/control/menubtn.cxx vcl/source/control/notebookbar.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a4cf8282d7f4..7cb6c270fd59 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -195,7 +195,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/imivctl1 \ vcl/source/control/imivctl2 \ vcl/source/control/ivctrl \ - vcl/source/control/listctrl \ vcl/source/control/longcurr \ vcl/source/control/imp_listbox \ vcl/source/control/listbox \ diff --git a/vcl/source/control/listctrl.cxx b/vcl/source/control/listctrl.cxx deleted file mode 100644 index 7ac9ee0f6773..000000000000 --- a/vcl/source/control/listctrl.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vcl/commandevent.hxx> -#include <vcl/event.hxx> -#include <vcl/listctrl.hxx> -#include <vcl/settings.hxx> - -ListControl::ListControl(vcl::Window* pParent, WinBits nBits): - Control(pParent, nBits), - mbHasScrollBar(false), - mpScrollBar(VclPtr<ScrollBar>::Create(this, WB_VERT)) -{ - mpScrollBar->SetScrollHdl( LINK( this, ListControl, ScrollHdl ) ); - mpScrollBar->EnableDrag(); -} - -ListControl::~ListControl() -{ - disposeOnce(); -} - -void ListControl::dispose() -{ - mpScrollBar.disposeAndClear(); - for (auto& aEntry : maEntries) - aEntry.disposeAndClear(); - maEntries.clear(); - - Control::dispose(); -} - -void ListControl::RecalcAll() -{ - // avoid recalculating while we are disposing - // children. This just leads to complex invalid memory - // access patterns that are not fixable. - if (isDisposed()) - return; - - sal_Int32 nTotalHeight = 0; - for (const auto& item : maEntries) - { - if (!item) - continue; - nTotalHeight += item->GetSizePixel().Height(); - } - - Size aCtrlSize = GetOutputSize(); - long nSrcBarSize = GetSettings().GetStyleSettings().GetScrollBarSize(); - if(nTotalHeight > GetSizePixel().Height()) - { - mbHasScrollBar = true; - mpScrollBar->SetPosSizePixel(Point(aCtrlSize.Width() -nSrcBarSize, 0), - Size(nSrcBarSize, aCtrlSize.Height()) ); - mpScrollBar->SetRangeMax(nTotalHeight); - mpScrollBar->SetVisibleSize(aCtrlSize.Height()); - mpScrollBar->Show(); - } - else - { - mbHasScrollBar = false; - mpScrollBar->Hide(); - } - - Point aPoint(0,-1*mpScrollBar->GetThumbPos()); - for (const auto& item : maEntries) - { - if (!item) - continue; - item->SetPosPixel(aPoint); - Size aSize = item->GetSizePixel(); - if(mbHasScrollBar) - aSize.setWidth( aCtrlSize.Width() - nSrcBarSize ); - else - aSize.setWidth( aCtrlSize.Width() ); - item->SetSizePixel(aSize); - - aPoint.AdjustY(item->GetSizePixel().Height() ); - } -} - -Size ListControl::GetOptimalSize() const -{ - return LogicToPixel(Size(300, 185), MapMode(MapUnit::MapAppFont)); -} - -void ListControl::Resize() -{ - Control::Resize(); - RecalcAll(); -} - -void ListControl::queue_resize(StateChangedType eReason) -{ - Control::queue_resize(eReason); - RecalcAll(); -} - -void ListControl::DoScroll(long nDelta) -{ - Point aNewPoint = mpScrollBar->GetPosPixel(); - tools::Rectangle aRect(Point(), GetOutputSize()); - aRect.AdjustRight( -(mpScrollBar->GetSizePixel().Width()) ); - Scroll( 0, -nDelta, aRect ); - mpScrollBar->SetPosPixel(aNewPoint); -} - -IMPL_LINK_NOARG( ListControl, ScrollHdl, ScrollBar*, void ) -{ - DoScroll(mpScrollBar->GetDelta()); -} - -void ListControl::addEntry(const VclPtr<Window>& xEntry, sal_uInt32 nPos) -{ - xEntry->Show(); - if (nPos < maEntries.size()) - { - maEntries.insert(maEntries.begin() + nPos, xEntry); - } - else - { - maEntries.push_back(xEntry); - } - RecalcAll(); -} - -void ListControl::deleteEntry(sal_uInt32 nPos) -{ - if (nPos >= maEntries.size()) - return; - - maEntries[nPos].disposeAndClear(); - maEntries.erase(maEntries.begin() + nPos); - RecalcAll(); -} - -std::vector<VclPtr<vcl::Window>> const & ListControl::getEntries() const -{ - return maEntries; -} - -bool ListControl::EventNotify( NotifyEvent& rNEvt ) -{ - if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) - { - const CommandEvent* pEvent = rNEvt.GetCommandEvent(); - if (pEvent) - { - CommandEventId nCommand = pEvent->GetCommand(); - - if (nCommand == CommandEventId::Wheel || - nCommand == CommandEventId::Gesture) - { - HandleScrollCommand(*pEvent, nullptr, mpScrollBar.get()); - } - } - } - return true; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 34ab3d7610ab..30e5a06ed31a 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -46,7 +46,6 @@ #include <vcl/vclmedit.hxx> #include <vcl/settings.hxx> #include <vcl/slider.hxx> -#include <vcl/listctrl.hxx> #include <vcl/weld.hxx> #include <vcl/commandinfoprovider.hxx> #include <svdata.hxx> @@ -2325,11 +2324,6 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & WinBits nBits = extractDeferredBits(rMap); xWindow = VclPtr<DockingWindow>::Create(pParent, nBits|WB_DOCKABLE|WB_MOVEABLE); } - else if (name == "GtkListBox") - { - WinBits nBits = extractDeferredBits(rMap); - xWindow = VclPtr<ListControl>::Create(pParent, nBits); - } else if (name == "GtkCalendar") { WinBits nBits = extractDeferredBits(rMap); commit e75b57ce6e5130a7223ded6cf9d40b300850aef9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Oct 17 14:17:02 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Oct 19 17:32:22 2019 +0200 GetLegacyDialogParent is now unused Change-Id: I1619d3a5ccc2f97d1e22dadab6ce719c6daf3c56 Reviewed-on: https://gerrit.libreoffice.org/80995 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 9470e1697b0b..210cf689d2c1 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -226,7 +226,6 @@ public: virtual ~ScTabViewShell() override; weld::Window* GetDialogParent(); - vcl::Window* GetLegacyDialogParent(); bool IsRefInputMode() const; void ExecuteInputDirect(); diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index 15f35672c641..b86663900273 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -64,20 +64,4 @@ weld::Window* ScTabViewShell::GetDialogParent() return pWin ? pWin->GetFrameWeld() : nullptr; } -vcl::Window* ScTabViewShell::GetLegacyDialogParent() -{ - ScDocShell* pDocSh = GetViewData().GetDocShell(); - if ( pDocSh->IsOle() ) - { - // TODO/LATER: how to GetEditWindow in embedded document?! - // It should be OK to return the ViewShell Window! - return GetWindow(); - // SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv(); - // if (pEnv) - // return pEnv->GetEditWin(); - } - - return GetActiveWin(); // for normal views, too -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits