/src/libreoffice/include/editeng/shaditem.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | #ifndef INCLUDED_EDITENG_SHADITEM_HXX |
20 | | #define INCLUDED_EDITENG_SHADITEM_HXX |
21 | | |
22 | | #include <svl/poolitem.hxx> |
23 | | #include <tools/color.hxx> |
24 | | |
25 | | #include <editeng/svxenum.hxx> |
26 | | #include <editeng/editengdllapi.h> |
27 | | |
28 | | |
29 | | // class SvxShadowItem --------------------------------------------------- |
30 | | |
31 | | /* [Description] |
32 | | |
33 | | This item describes the shadow attribute (color, width and position). |
34 | | */ |
35 | | enum class SvxShadowItemSide { TOP, BOTTOM, LEFT, RIGHT }; |
36 | | |
37 | | class EDITENG_DLLPUBLIC SvxShadowItem final : public SfxPoolItem |
38 | | { |
39 | | Color aShadowColor; |
40 | | sal_uInt16 nWidth; |
41 | | SvxShadowLocation eLocation; |
42 | | public: |
43 | | static SfxPoolItem* CreateDefault(); |
44 | | |
45 | | DECLARE_ITEM_TYPE_FUNCTION(SvxShadowItem) |
46 | | explicit SvxShadowItem( const sal_uInt16 nId , |
47 | | const Color *pColor = nullptr, const sal_uInt16 nWidth = 100 /*5pt*/, |
48 | | const SvxShadowLocation eLoc = SvxShadowLocation::NONE ); |
49 | | |
50 | | // "pure virtual Methods" from SfxPoolItem |
51 | | virtual bool operator==( const SfxPoolItem& ) const override; |
52 | 417 | virtual bool supportsHashCode() const override { return true; } |
53 | | virtual size_t hashCode() const override; |
54 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
55 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
56 | | |
57 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
58 | | MapUnit eCoreMetric, |
59 | | MapUnit ePresMetric, |
60 | | OUString &rText, const IntlWrapper& ) const override; |
61 | | |
62 | | virtual SvxShadowItem* Clone( SfxItemPool *pPool = nullptr ) const override; |
63 | | virtual void ScaleMetrics(double fScale) override; |
64 | | virtual bool HasMetrics() const override; |
65 | | |
66 | 2 | const Color& GetColor() const { return aShadowColor;} |
67 | 2.64k | void SetColor( const Color &rNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; aShadowColor = rNew; } |
68 | | |
69 | 985k | sal_uInt16 GetWidth() const { return nWidth; } |
70 | 1.84M | SvxShadowLocation GetLocation() const { return eLocation; } |
71 | | |
72 | 2.64k | void SetWidth( sal_uInt16 nNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nWidth = nNew; } |
73 | 2.64k | void SetLocation( SvxShadowLocation eNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; eLocation = eNew; } |
74 | | |
75 | | // Calculate width of the shadow on the page. |
76 | | sal_uInt16 CalcShadowSpace( SvxShadowItemSide nShadow ) const; |
77 | | |
78 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
79 | | }; |
80 | | |
81 | | #endif // INCLUDED_EDITENG_SHADITEM_HXX |
82 | | |
83 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |