1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <sfx2/watermarkitem.hxx>
11 #include <sfx2/sfxsids.hrc>
12 #include <comphelper/propertysequence.hxx>
14 SfxWatermarkItem::SfxWatermarkItem()
15 : SfxPoolItem( SID_WATERMARK
)
17 , m_aFont( "Liberation Sans" )
19 , m_nTransparency( 50 )
20 , m_nColor( 0xc0c0c0 )
24 SfxPoolItem
* SfxWatermarkItem::CreateDefault()
26 return new SfxWatermarkItem();
29 bool SfxWatermarkItem::operator==( const SfxPoolItem
& rCmp
) const
31 return ( SfxPoolItem::operator==( rCmp
) &&
32 m_aText
== static_cast<const SfxWatermarkItem
&>(rCmp
).m_aText
&&
33 m_aFont
== static_cast<const SfxWatermarkItem
&>(rCmp
).m_aFont
&&
34 m_nAngle
== static_cast<const SfxWatermarkItem
&>(rCmp
).m_nAngle
&&
35 m_nTransparency
== static_cast<const SfxWatermarkItem
&>(rCmp
).m_nTransparency
&&
36 m_nColor
== static_cast<const SfxWatermarkItem
&>(rCmp
).m_nColor
);
39 SfxWatermarkItem
* SfxWatermarkItem::Clone( SfxItemPool
*) const
41 return new SfxWatermarkItem(*this);
44 bool SfxWatermarkItem::QueryValue( css::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ ) const
46 rVal
<<= comphelper::InitPropertySequence( {
47 { "Text", css::uno::makeAny( m_aText
) },
48 { "Font", css::uno::makeAny( m_aFont
) },
49 { "Angle", css::uno::makeAny( m_nAngle
) },
50 { "Transparency", css::uno::makeAny( m_nTransparency
) },
51 { "Color", css::uno::makeAny( m_nColor
) },
57 bool SfxWatermarkItem::PutValue( const css::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ )
59 css::uno::Sequence
<css::beans::PropertyValue
> aSequence
;
61 if ( rVal
>>= aSequence
)
63 for(const auto& aEntry
: std::as_const(aSequence
))
65 if(aEntry
.Name
== "Text")
66 aEntry
.Value
>>= m_aText
;
67 if(aEntry
.Name
== "Font")
68 aEntry
.Value
>>= m_aFont
;
69 if(aEntry
.Name
== "Angle")
70 aEntry
.Value
>>= m_nAngle
;
71 if(aEntry
.Name
== "Transparency")
72 aEntry
.Value
>>= m_nTransparency
;
73 if(aEntry
.Name
== "Color")
74 aEntry
.Value
>>= m_nColor
;
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */