/* -*- 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_FRMSEL_HXX #define INCLUDED_SVX_FRMSEL_HXX #include #include #include #include #include #include #include class Color; namespace editeng { class SvxBorderLine; } enum class FrameSelFlags { NONE = 0x0000, /** If set, the left frame border is enabled. */ Left = 0x0001, /** If set, the right frame border is enabled. */ Right = 0x0002, /** If set, the top frame border is enabled. */ Top = 0x0004, /** If set, the bottom frame border is enabled. */ Bottom = 0x0008, /** If set, the inner horizontal frame border is enabled. */ InnerHorizontal = 0x0010, /** If set, the inner vertical frame border is enabled. */ InnerVertical = 0x0020, /** If set, the top-left to bottom-right diagonal frame border is enabled. */ DiagonalTLBR = 0x0040, /** If set, the bottom-left to top-right diagonal frame border is enabled. */ DiagonalBLTR = 0x0080, /** If set, all four outer frame borders are enabled. */ Outer = Left | Right | Top | Bottom, /** If set, all frame borders will support the don't care state. */ DontCare = 0x0100 }; namespace o3tl { template<> struct typed_flags : is_typed_flags {}; } namespace svx { struct FrameSelectorImpl; /** All possible states of a frame border. */ enum class FrameBorderState { Show, /// Frame border has a visible style. Hide, /// Frame border is hidden (off). DontCare /// Frame border is in don't care state (if enabled). }; class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameSelector : public Control { public: FrameSelector(vcl::Window* pParent); virtual ~FrameSelector() override; /** Initializes the control, enables/disables frame borders according to flags. */ void Initialize( FrameSelFlags nFlags ); // enabled frame borders /** Returns true, if the specified frame border is enabled. */ bool IsBorderEnabled( FrameBorderType eBorder ) const; /** Returns the number of enabled frame borders. */ sal_Int32 GetEnabledBorderCount() const; /** Returns the border type from the passed index (counts only enabled frame borders). */ FrameBorderType GetEnabledBorderType( sal_Int32 nIndex ) const; /** Returns the index of a frame border (counts only enabled borders) from passed type. */ sal_Int32 GetEnabledBorderIndex( FrameBorderType eBorder ) const; // frame border state and style /** Returns true, if the control supports the "don't care" frame border state. */ bool SupportsDontCareState() const; /** Returns the state (visible/hidden/don't care) of the specified frame border. */ FrameBorderState GetFrameBorderState( FrameBorderType eBorder ) const; /** Returns the style of the specified frame border, if it is visible. */ const editeng::SvxBorderLine* GetFrameBorderStyle( FrameBorderType eBorder ) const; /** Shows the specified frame border using the passed style, or hides it, if pStyle is 0. */ void ShowBorder( FrameBorderType eBorder, const editeng::SvxBorderLine* pStyle ); /** Sets the specified frame border to "don't care" state. */ void SetBorderDontCare( FrameBorderType eBorder ); /** Returns true, if any enabled frame border has a visible style (not "don't care"). */ bool IsAnyBorderVisible() const; /** Hides all enabled frame borders. */ void HideAllBorders(); /** Returns true, if all visible frame borders have equal widths. @descr Ignores hidden and "don't care" frame borders. On success, returns the width in the passed parameter. */ bool GetVisibleWidth( long& rnWidth, SvxBorderLineStyle& rnStyle ) const; /** Returns true, if all visible frame borders have equal color. @descr Ignores hidden and "don't care" frame borders. On success, returns the color in the passed parameter. */ bool GetVisibleColor( Color& rColor ) const; // frame border selection /** Returns the current selection handler. */ const Link& GetSelectHdl() const; /** Sets the passed handler that is called if the selection of the control changes. */ void SetSelectHdl( const Link& rHdl ); /** Returns true, if the specified frame border is selected. */ bool IsBorderSelected( FrameBorderType eBorder ) const; /** Selects or deselects the specified frame border. */ void SelectBorder( FrameBorderType eBorder ); /** Returns true, if any of the enabled frame borders is selected. */ bool IsAnyBorderSelected() const; /** Selects or deselects all frame borders. */ void SelectAllBorders( bool bSelect ); /** Deselects all frame borders. */ void DeselectAllBorders() { SelectAllBorders( false ); } /** Selects or deselects all visible frame borders (ignores hidden and "don't care" borders). */ void SelectAllVisibleBorders(); /** Sets the passed line widths to all selected frame borders (in twips). */ void SetStyleToSelection( long nWidth, SvxBorderLineStyle nStyle ); /** Sets the passed color to all selected frame borders. */ void SetColorToSelection( const Color& rColor ); // accessibility virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; /** Returns the accessibility child object of the specified frame border (if enabled). */ css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( FrameBorderType eBorder ); /** Returns the accessibility child object with specified index (counts enabled frame borders only). */ css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( sal_Int32 nIndex ); /** Returns the accessibility child object at the specified position (relative to control). */ css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const Point& rPos ); /** Returns true, if the passed point is inside the click area of any enabled frame border. */ bool ContainsClickPoint( const Point& rPos ) const; /** Returns the bounding rectangle of the specified frame border (if enabled). */ tools::Rectangle GetClickBoundRect( FrameBorderType eBorder ) const; protected: virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; virtual void KeyInput( const KeyEvent& rKEvt ) override; virtual void GetFocus() override; virtual void LoseFocus() override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void Resize() override; virtual Size GetOptimalSize() const override; private: std::unique_ptr< FrameSelectorImpl > mxImpl; }; } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ector-5.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-03-31tdf#120703 PVS: Silence V575 warningsMike Kaganski
V575 The potential null pointer is passed into 'foo' function Add asserts to those cases that are related to OOM cases. There's nothing to be done if the assertions fail anyway. Change-Id: I92ac95d44f512aa1948b1552b0e1f6da695a9f92 Reviewed-on: https://gerrit.libreoffice.org/70008 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-09-24loplugin:external (clang-cl)Stephan Bergmann
Including: * expanding STDAPI to its definition (as per <https://msdn.microsoft.com/library/ms686631(vs.85).aspx> "STDAPI"), to add __declspec(dllexport) into its middle, in extensions/source/activex/so_activex.cxx; as discussed in the comments at <https://gerrit.libreoffice.org/#/c/60691/> "Get rid of Windows .def files in setup_native, use __declspec(dllexport)", having a function both listed in a .def file EXPORTS and marking it dllexport is OK, and the latter helps the heuristics of loplugin:external; however, the relevant functions in extensions/source/activex/so_activex.cxx probably don't even need to be exported in the first place? * follow-up loplugin:salcall in sal/osl/w32/file-impl.hxx Change-Id: Ida6e17eba19cfa3d7e5c72dda57409005c0a0191 Reviewed-on: https://gerrit.libreoffice.org/60938 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17New loplugin:externalStephan Bergmann
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-02-01odk: MSVC: pragma warning: make more specific, remove obsoleteMike Kaganski
Change-Id: Ie5957edb3954507505a7df9fad9f8da6b87b09d0 Reviewed-on: https://gerrit.libreoffice.org/49038 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-27loplugin:includeform: odk (Windows)Stephan Bergmann
Change-Id: I654aa2cf1175f91619b70c9257e88f7006b0c04c
2017-10-23loplugin:includeform: odkStephan Bergmann
Change-Id: Ic8ede7a0377d9ec4f360b63889e0ccf3c5dda93f
2017-09-27cppuhelper_detail_findSofficePath: use Unicode on WindowsMike Kaganski
On Windows, UTF-8 is never current locale encoding; so using 8-bit strings will always fail for paths containing characters outside of current codepage. Also fix leaks caused by failing to release its result: previously it could return either result of getenv (that shouldn't get freed), or an allocated string, but never got freed; now the result is always allocated and properly freed. Change-Id: I8b255dea20040eec0572de2b34280749fe8f071c Reviewed-on: https://gerrit.libreoffice.org/42743 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-18Some more WIN32_LEAN_AND_MEANMike Kaganski
Change-Id: Iadb0ebb66809c192fb817b8c7cf2f8cdb4d0b874 Reviewed-on: https://gerrit.libreoffice.org/42419 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-08-31loplugin:constparams: odk (clang-cl)Stephan Bergmann
Change-Id: I2daf0b0868d4bdfb412575b25dbe644e76607342
2017-01-09New loplugin:externvar: odkStephan Bergmann
Change-Id: I1f60c6b606a1ac96acbfa0777797acdaaea38c3c
2016-12-16-Werror,-Wstrict-prototypes (clang-cl)Stephan Bergmann
(sal/inc/rtllifecycle.h only hits on Windows as that is the only platform that happens to actually include it in a C compilation unit, sal/osl/w32/dllentry.c) Change-Id: I2878b52daf713ea45eaa2968cc5d2686b86abfe6
2015-11-28-Werror,-Wstring-plus-intStephan Bergmann
Change-Id: Ie16ca73ac3d622d00583ef454780f9a01b32d436