sc/Library_sc.mk | 1 sc/source/ui/sidebar/CellLineStyleValueSet.cxx | 175 ------------------------- sc/source/ui/sidebar/CellLineStyleValueSet.hxx | 48 ------ solenv/clang-format/excludelist | 1 4 files changed, 225 deletions(-)
New commits: commit 43c1502866b30e59008c937a55d8a2bdca9a6ebb Author: Michael Weghorn <[email protected]> AuthorDate: Fri Nov 28 14:12:46 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Nov 29 06:52:46 2025 +0100 tdf#168120 sc: Drop now unused CellLineStyleValueSet This is now unused after the last use was ported to using weld::TreeView instead in previous commit Change-Id: I05c1e5f8f3689af02b4337c65b4aaba481c67e86 Author: Michael Weghorn <[email protected]> Date: Fri Nov 28 14:12:04 2025 +0100 tdf#168120 sc: Switch to weld::TreeView in CellLineStyleControl Change-Id: I00ce95cfa9ca7dd9c9d3ea9edec586d63cfca42e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194777 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index be0b0686168c..2567f7f21735 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -532,7 +532,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/pagedlg/tphfedit \ sc/source/ui/sidebar/AlignmentPropertyPanel \ sc/source/ui/sidebar/CellLineStyleControl \ - sc/source/ui/sidebar/CellLineStyleValueSet \ sc/source/ui/sidebar/CellAppearancePropertyPanel \ sc/source/ui/sidebar/CellBorderStyleControl \ sc/source/ui/sidebar/NumberFormatControl \ diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx deleted file mode 100644 index 91992313399f..000000000000 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ /dev/null @@ -1,175 +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 "CellLineStyleValueSet.hxx" -#include <i18nlangtag/mslangid.hxx> -#include <vcl/event.hxx> -#include <vcl/settings.hxx> -#include <vcl/svapp.hxx> - -namespace sc::sidebar { - -CellLineStyleValueSet::CellLineStyleValueSet() - : ValueSet(nullptr) - , mnMaxTextWidth(0) - , nSelItem(0) -{ -} - -CellLineStyleValueSet::~CellLineStyleValueSet() -{ -} - -void CellLineStyleValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) -{ - ValueSet::SetDrawingArea(pDrawingArea); - Size aSize = pDrawingArea->get_ref_device().LogicToPixel(Size(120, 12 * CELL_LINE_STYLE_ENTRIES), - MapMode(MapUnit::MapAppFont)); - pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); - SetOutputSizePixel(aSize); - - SetColCount(); - SetLineCount(CELL_LINE_STYLE_ENTRIES); - SetColor(Application::GetSettings().GetStyleSettings().GetListBoxWindowBackgroundColor()); -} - -void CellLineStyleValueSet::SetUnit(const std::vector<OUString>& rStrings) -{ - assert(rStrings.size() == CELL_LINE_STYLE_ENTRIES); - maStrUnit = rStrings; -} - -void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel) -{ - nSelItem = nSel; - if(nSel == 0) - { - SelectItem(1); - SetNoSelection(); - } - else - { - SelectItem(nSelItem); - GrabFocus(); - } -} - -tools::Long CellLineStyleValueSet::GetMaxTextWidth(const vcl::RenderContext* pDev) -{ - if (mnMaxTextWidth > 0) - return mnMaxTextWidth; - - for (const OUString& rStr : maStrUnit) - { - mnMaxTextWidth = std::max(pDev->GetTextWidth(rStr), mnMaxTextWidth); - } - return mnMaxTextWidth; -} - -void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) -{ - tools::Rectangle aRect = rUDEvt.GetRect(); - vcl::RenderContext* pDev = rUDEvt.GetRenderContext(); - sal_uInt16 nItemId = rUDEvt.GetItemId(); - - tools::Long nRectHeight = aRect.GetHeight(); - tools::Long nRectWidth = aRect.GetWidth(); - Point aBLPos = aRect.TopLeft(); - - auto popIt = pDev->ScopedPush(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); - - vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getConfiguredSystemLanguage(), GetDefaultFontFlags::OnlyOne)); - Size aSize = aFont.GetFontSize(); - aSize.setHeight( nRectHeight*3/5 ); - aFont.SetFontSize( aSize ); - - if( nSelItem == nItemId ) - { - tools::Rectangle aBackRect = aRect; - aBackRect.AdjustTop(3 ); - aBackRect.AdjustBottom( -2 ); - pDev->SetFillColor(Color(50,107,197)); - pDev->DrawRect(aBackRect); - } - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - //draw text - if (nSelItem == nItemId ) - aFont.SetColor(COL_WHITE); - else - aFont.SetColor(rStyleSettings.GetFieldTextColor()); //high contrast - - pDev->SetFont(aFont); - tools::Long nTextWidth = GetMaxTextWidth(pDev); - tools::Long nTLX = aBLPos.X() + 5, nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2; - tools::Long nTRX = aBLPos.X() + nRectWidth - nTextWidth - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2; - Point aStart(aBLPos.X() + nRectWidth - nTextWidth - 5 , aBLPos.Y() + nRectHeight/6); - pDev->DrawText(aStart, maStrUnit.at(nItemId - 1)); //can't set DrawTextFlags::EndEllipsis here, or the text will disappear - - //draw line - if( nSelItem == nItemId ) - { - pDev->SetFillColor(COL_WHITE); - pDev->SetLineColor(COL_WHITE); - } - else - { - pDev->SetFillColor(rStyleSettings.GetFieldTextColor()); //high contrast - pDev->SetLineColor(rStyleSettings.GetFieldTextColor()); //high contrast - } - - switch( nItemId ) - { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + nItemId * 2 - 1 )); - break; - case 7: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); - pDev->DrawRect(tools::Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 4 )); - break; - case 8: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); - pDev->DrawRect(tools::Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); - break; - case 9: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); - pDev->DrawRect(tools::Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 6 )); - break; - case 10: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); - pDev->DrawRect(tools::Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); - break; - case 11: - pDev->DrawRect(tools::Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); - pDev->DrawRect(tools::Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 8 )); - break; - } - - Invalidate( aRect ); -} - -} // end of namespace sc::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx deleted file mode 100644 index eae1c1fbf457..000000000000 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx +++ /dev/null @@ -1,48 +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 . - */ -#pragma once - -#include <svtools/valueset.hxx> -#include <tools/long.hxx> - -#define CELL_LINE_STYLE_ENTRIES 11 - -namespace sc::sidebar -{ -class CellLineStyleValueSet : public ValueSet -{ -private: - tools::Long mnMaxTextWidth; - sal_uInt16 nSelItem; - std::vector<OUString> maStrUnit; - -public: - CellLineStyleValueSet(); - virtual ~CellLineStyleValueSet() override; - - void SetUnit(const std::vector<OUString>& rStrings); - void SetSelItem(sal_uInt16 nSel); - tools::Long GetMaxTextWidth(const vcl::RenderContext* pDev); - virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; - virtual void UserDraw(const UserDrawEvent& rUDEvt) override; -}; - -} // end of namespace svx::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index cb3e4262b181..1d2e18c0e165 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -8804,7 +8804,6 @@ sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx sc/source/ui/sidebar/CellBorderStyleControl.cxx sc/source/ui/sidebar/CellLineStyleControl.cxx -sc/source/ui/sidebar/CellLineStyleValueSet.cxx sc/source/ui/sidebar/NumberFormatControl.cxx sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
