Line data Source code
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 <tools/color.hxx>
23 : #include <svl/eitem.hxx>
24 : #include <editeng/svxenum.hxx>
25 : #include <editeng/editengdllapi.h>
26 :
27 :
28 : // class SvxShadowItem ---------------------------------------------------
29 :
30 : /* [Description]
31 :
32 : This item describes the shadow attribute (color, width and position).
33 : */
34 : enum class SvxShadowItemSide { TOP, BOTTOM, LEFT, RIGHT };
35 :
36 26965 : class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
37 : {
38 : Color aShadowColor;
39 : sal_uInt16 nWidth;
40 : SvxShadowLocation eLocation;
41 : public:
42 : TYPEINFO_OVERRIDE();
43 :
44 : explicit SvxShadowItem( const sal_uInt16 nId ,
45 : const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
46 : const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
47 :
48 : inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
49 :
50 : // "pure virtual Methods" from SfxPoolItem
51 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
52 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
53 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
54 :
55 : virtual bool GetPresentation( SfxItemPresentation ePres,
56 : SfxMapUnit eCoreMetric,
57 : SfxMapUnit ePresMetric,
58 : OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
59 :
60 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
61 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
62 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
63 : virtual bool ScaleMetrics( long nMult, long nDiv ) SAL_OVERRIDE;
64 : virtual bool HasMetrics() const SAL_OVERRIDE;
65 :
66 566 : const Color& GetColor() const { return aShadowColor;}
67 14 : void SetColor( const Color &rNew ) { aShadowColor = rNew; }
68 :
69 96198 : sal_uInt16 GetWidth() const { return nWidth; }
70 270429 : SvxShadowLocation GetLocation() const { return eLocation; }
71 :
72 14 : void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
73 16 : void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
74 :
75 : // Calculate width of the shadow on the page.
76 : sal_uInt16 CalcShadowSpace( SvxShadowItemSide nShadow ) const;
77 :
78 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
79 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE;
80 : virtual sal_uInt16 GetEnumValue() const SAL_OVERRIDE;
81 : virtual void SetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE;
82 : void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
83 : };
84 :
85 0 : inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
86 : {
87 0 : aShadowColor = rFmtShadow.aShadowColor;
88 0 : nWidth = rFmtShadow.GetWidth();
89 0 : eLocation = rFmtShadow.GetLocation();
90 0 : return *this;
91 : }
92 :
93 : #endif // INCLUDED_EDITENG_SHADITEM_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|