/* -*- 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_VCL_SCRBAR_HXX #define INCLUDED_VCL_SCRBAR_HXX #include #include #include class AutoTimer; enum ScrollType { SCROLL_DONTKNOW, SCROLL_LINEUP, SCROLL_LINEDOWN, SCROLL_PAGEUP, SCROLL_PAGEDOWN, SCROLL_DRAG, SCROLL_SET }; struct ImplScrollBarData; class VCL_DLLPUBLIC ScrollBar : public Control { private: Rectangle maBtn1Rect; Rectangle maBtn2Rect; Rectangle maPage1Rect; Rectangle maPage2Rect; Rectangle maThumbRect; ImplScrollBarData* mpData; long mnStartPos; long mnMouseOff; long mnThumbPixRange; long mnThumbPixPos; long mnThumbPixSize; long mnMinRange; long mnMaxRange; long mnThumbPos; long mnVisibleSize; long mnLineSize; long mnPageSize; long mnDelta; sal_uInt16 mnDragDraw; sal_uInt16 mnStateFlags; ScrollType meScrollType; bool mbCalcSize; bool mbFullDrag; Link maScrollHdl; Link maEndScrollHdl; SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE void ImplUpdateRects( bool bUpdate = true ); SAL_DLLPRIVATE long ImplCalcThumbPos( long nPixPos ); SAL_DLLPRIVATE long ImplCalcThumbPosPix( long nPos ); SAL_DLLPRIVATE void ImplCalc( bool bUpdate = true ); SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags); using Window::ImplScroll; SAL_DLLPRIVATE long ImplScroll( long nNewPos, bool bCallEndScroll ); SAL_DLLPRIVATE long ImplDoAction( bool bCallEndScroll ); SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, bool bCallAction = true ); SAL_DLLPRIVATE void ImplInvert(); SAL_DLLPRIVATE bool ImplDrawNative(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags); SAL_DLLPRIVATE void ImplDragThumb( const Point& rMousePos ); SAL_DLLPRIVATE Size getCurrentCalcSize() const; DECL_DLLPRIVATE_LINK_TYPED( ImplAutoTimerHdl, Timer*, void ); public: explicit ScrollBar( vcl::Window* pParent, WinBits nStyle = WB_VERT ); virtual ~ScrollBar(); virtual void dispose() override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void Tracking(const TrackingEvent& rTEvt) override; virtual void KeyInput(const KeyEvent& rKEvt) override; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override; virtual void Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags) override; virtual void Resize() override; virtual void StateChanged(StateChangedType nType) override; virtual void DataChanged(const DataChangedEvent& rDCEvt) override; virtual bool PreNotify(NotifyEvent& rNEvt) override; virtual void GetFocus() override; virtual void LoseFocus() override; virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; using Window::Scroll; void Scroll(); virtual void EndScroll(); long DoScroll( long nNewPos ); long DoScrollAction( ScrollType eScrollType ); void EnableDrag() { mbFullDrag = true; } void SetRangeMin( long nNewRange ); long GetRangeMin() const { return mnMinRange; } void SetRangeMax( long nNewRange ); long GetRangeMax() const { return mnMaxRange; } void SetRange( const Range& rRange ); Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); } void SetThumbPos( long nThumbPos ); long GetThumbPos() const { return mnThumbPos; } void SetLineSize( long nNewSize ) { mnLineSize = nNewSize; } long GetLineSize() const { return mnLineSize; } void SetPageSize( long nNewSize ) { mnPageSize = nNewSize; } long GetPageSize() const { return mnPageSize; } void SetVisibleSize( long nNewSize ); long GetVisibleSize() const { return mnVisibleSize; } long GetDelta() const { return mnDelta; } ScrollType GetType() const { return meScrollType; } void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } void SetEndScrollHdl( const Link& rLink ) { maEndScrollHdl = rLink; } const Link& GetEndScrollHdl() const { return maEndScrollHdl; } virtual Size GetOptimalSize() const override; }; class VCL_DLLPUBLIC ScrollBarBox : public vcl::Window { private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; public: explicit ScrollBarBox( vcl::Window* pParent, WinBits nStyle = 0 ); virtual void StateChanged( StateChangedType nType ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; }; #endif // INCLUDED_VCL_SCRBAR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -7-0+backports'>distro/lhm/libreoffice-7-0+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-12-10add explainer for the reasoning of fMaxPassStrengthEntropyBitsSarper Akdemir
also fixes the typo in the fMaxPassStrengthEntropyBits variable name. Change-Id: I7c9cfcea7253a3e07428c83008b0c072033f33c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160425 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
2023-11-15tdf#157518: add password strength meter to setmasterpassworddlgSarper Akdemir
Moves PasswordStrength bits that provide utility functions from cui to svl, merging them with PasswordHelper there. Adds password strength bar for the set master password dialog. (accessible via Tools -> Options -> LibreOffice -> Security -> Passwords for Web Connections) Change-Id: I8dc1090a041f8388c2e139beb1d0d9a0beb8acb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159370 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
2022-04-11use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic41cd4e3026d93b70a76fe1279c6de3abbe6b4a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132820 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-23sal_Char->char in svtools..svlNoel Grandin
Change-Id: Ideb61209e8795865bce6e0b1d667b34f8a8db4d9 Reviewed-on: https://gerrit.libreoffice.org/85713 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-14svl: clear temporary copies of passwords in SvlPasswordHelperMichael Stahl
This is an obvious place to start, but there might be more copies elsewhere. Change-Id: I3c3ea6cb54f40fe5c21c3128b55aeaad1ff74b42 Reviewed-on: https://gerrit.libreoffice.org/49669 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-02-07tdf#115483 svl xmloff sc sw: verify all ODF 1.2 protection-key hashesMichael Stahl
ODF 1.2 has added some mandatory requirements for protection-key hashes which did not exist in ODF 1.1. This affects sections and indexes in ODT documents, as well as spreadsheets and sheets in ODS documents. 1. Accept the following hashed passwords: * UTF16 LE/BE encoded StarOffice-SHA1, OOo legacy and allowed by ODF 1.1 * UTF8 encoded proper SHA1, as required by ODF 1.2 * UTF8 encoded SHA256, as required by ODF 1.2 - specified either with the wrong URL used in the ODF 1.2 spec or the correct URL from the W3C spec, see OFFICE-3702 * Excel+SHA1 double-hash, only in Calc, see OFFICE-2112 2. Round-trip any of the above as-is * for SHA256 only write the URL from the ODF 1.2 spec 3. Generate only UTF16 LE encoded SHA1 for now, so that older LO releases can still verify the password * some time in the future, switch to generating some valid ODF 1.2 hash More changes are necessary in Calc, which can actually preserve different hashes for the same passwords in its runtime data model, whereas Writer just has a single buffer without even any metadata. For the Calc unit tests we need one document per hash because the protection-key attribute can be set on the entire spreadsheet, which is an unique element in the document. There are further uses of SvlPasswordHelper for change-tracking passwords, but apparently those are stored in settings.xml, so ODF has no requirements for them, so let's leave that as it is. Change-Id: Icb720b14ae9c0d9c04d2e082769ae2b74e3af8aa Reviewed-on: https://gerrit.libreoffice.org/49352 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2015-06-17Replace boost::scoped_array<T> with std::unique_ptr<T[]>Takeshi Abe
This may reduce some degree of dependency on boost. Done by running a script like: git grep -l '#include *.boost/scoped_array.hpp.' \ | xargs sed -i -e 's@#include *.boost/scoped_array.hpp.@#include <memory>@' git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \ | xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/' ... and then killing duplicate or unnecessary includes, while changing manually m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx, extensions/source/ole/unoconversionutilities.hxx, and extensions/source/ole/oleobjw.cxx. Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd Reviewed-on: https://gerrit.libreoffice.org/16289 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>