/* -*- 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 #include #include #include #include using namespace css; using namespace css::uno; namespace sfx2 { namespace sidebar { TabItem::TabItem (vcl::Window* pParentWindow) : ImageRadioButton(pParentWindow), mbIsLeftButtonDown(false) { SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS); SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); #ifdef DEBUG SetText(OUString("TabItem")); #endif } void TabItem::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*UpdateArea*/) { const bool bIsSelected (IsChecked()); const bool bIsHighlighted (IsMouseOver() || HasFocus()); DrawHelper::DrawRoundedRectangle( rRenderContext, tools::Rectangle(Point(0,0), GetSizePixel()), Theme::GetInteger(Theme::Int_ButtonCornerRadius), bIsHighlighted||bIsSelected ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff), bIsHighlighted ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight) : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal)); const Image aIcon(Button::GetModeImage()); const Size aIconSize (aIcon.GetSizePixel()); const Point aIconLocation((GetSizePixel().Width() - aIconSize.Width()) / 2, (GetSizePixel().Height() - aIconSize.Height()) / 2); rRenderContext.DrawImage(aIconLocation, aIcon, IsEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable); } void TabItem::MouseMove(const MouseEvent& rEvent) { if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow()) Invalidate(); ImageRadioButton::MouseMove(rEvent); } void TabItem::MouseButtonDown(const MouseEvent& rMouseEvent) { if (rMouseEvent.IsLeft()) { mbIsLeftButtonDown = true; CaptureMouse(); Invalidate(); } } void TabItem::MouseButtonUp(const MouseEvent& rMouseEvent) { if (IsMouseCaptured()) ReleaseMouse(); if (rMouseEvent.IsLeft()) { if (mbIsLeftButtonDown) { Check(); Click(); vcl::Window* pParent = GetParent(); if (pParent) pParent->Invalidate(); } } if (mbIsLeftButtonDown) { mbIsLeftButtonDown = false; Invalidate(); } } } } // end of namespace sfx2::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ value='distro/collabora/cp-4.1'>distro/collabora/cp-4.1 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-04-10tdf#146619 Drop unused 'using namespace' in: sc/Gabor Kelemen
Change-Id: I03478dd4c8e3c2ac88c0fe5e51efd53b09888475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165695 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-11Use weak reference to SfxObjectShell in SfxEventHint to avoid use-after-freeMike Kaganski
The events may be processed after the shell has been destroyed. This is happening reliably after commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11) when controlling LibreOffice from external Java scripts; but obviously, it could happen before as well. Now SotObject inherits from cppu::OWeakObject, instead of SvRefBase. Change-Id: I73a3531499a3068c801c98f40de39bdf8ad90b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164458 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-06use more string_view in scNoel Grandin
Change-Id: Ic7126ac57f8cc06b37f3098603f0710602f0ab28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140998 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-11Drop ScGlobal::GetEmptyOUString() and EMPTY_OUSTRINGMike Kaganski
OUString default ctor already uses a static instance (through rtl_uString_new), no need to have another module-specific static. Commit d8037ae18a297229d1b79f8f76331abfd548350d had removed its sw counterpart some time ago. Change-Id: I140fe13bc1f6b0cbe188e83e602fdebe995e467a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125061 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-13split SvNumberFormatter into it's own headerNoel Grandin
so I can make changes without running into cyclic dependencies between header files Change-Id: I98a91c7cc66002ba745cdb8239e5cc267922a45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120412 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-05Pass context and resource string down to boost::locale separatelyNoel Grandin
because this is often on a hot path, and we can avoid the splitting and joining of strings like this. Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-04loplugin:stringviewparam: operator +=Stephan Bergmann
Change-Id: I30ce1b5bd8fb168da7067c1967c5af2569df2653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108512 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-20use tools::Long in scNoel
Change-Id: I8f37a8d1174ed816df971b8cee036d4e88d4a7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>