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 :
35 : #define SHADOW_TOP ((sal_uInt16)0)
36 : #define SHADOW_BOTTOM ((sal_uInt16)1)
37 : #define SHADOW_LEFT ((sal_uInt16)2)
38 : #define SHADOW_RIGHT ((sal_uInt16)3)
39 :
40 54493 : class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
41 : {
42 : Color aShadowColor;
43 : sal_uInt16 nWidth;
44 : SvxShadowLocation eLocation;
45 : public:
46 : TYPEINFO_OVERRIDE();
47 :
48 : explicit SvxShadowItem( const sal_uInt16 nId ,
49 : const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
50 : const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
51 :
52 : inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
53 :
54 : // "pure virtual Methods" from SfxPoolItem
55 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
56 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
57 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
58 :
59 : virtual bool GetPresentation( SfxItemPresentation ePres,
60 : SfxMapUnit eCoreMetric,
61 : SfxMapUnit ePresMetric,
62 : OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
63 :
64 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
65 : virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
66 : virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
67 : virtual bool ScaleMetrics( long nMult, long nDiv ) SAL_OVERRIDE;
68 : virtual bool HasMetrics() const SAL_OVERRIDE;
69 :
70 1076 : const Color& GetColor() const { return aShadowColor;}
71 28 : void SetColor( const Color &rNew ) { aShadowColor = rNew; }
72 :
73 160502 : sal_uInt16 GetWidth() const { return nWidth; }
74 504048 : SvxShadowLocation GetLocation() const { return eLocation; }
75 :
76 28 : void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
77 32 : void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
78 :
79 : // Calculate width of the shadow on the page.
80 : sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const;
81 :
82 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
83 : virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE;
84 : virtual sal_uInt16 GetEnumValue() const SAL_OVERRIDE;
85 : virtual void SetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE;
86 : };
87 :
88 0 : inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
89 : {
90 0 : aShadowColor = rFmtShadow.aShadowColor;
91 0 : nWidth = rFmtShadow.GetWidth();
92 0 : eLocation = rFmtShadow.GetLocation();
93 0 : return *this;
94 : }
95 :
96 : #endif // INCLUDED_EDITENG_SHADITEM_HXX
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|