LibreOffice Module sfx2 (master) 1
watermarkitem.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
11#include <sfx2/sfxsids.hrc>
13
15: SfxPoolItem( SID_WATERMARK )
16, m_aText( "" )
17, m_aFont( "Liberation Sans" )
18, m_nAngle( 45 )
19, m_nTransparency( 50 )
20, m_nColor( 0xc0c0c0 )
21{
22}
23
25{
26 return new SfxWatermarkItem();
27}
28
30{
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 );
37}
38
40{
41 return new SfxWatermarkItem(*this);
42}
43
44bool SfxWatermarkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
45{
47 { "Text", css::uno::Any( m_aText ) },
48 { "Font", css::uno::Any( m_aFont ) },
49 { "Angle", css::uno::Any( m_nAngle ) },
50 { "Transparency", css::uno::Any( m_nTransparency ) },
51 { "Color", css::uno::Any( m_nColor ) },
52 } );
53
54 return true;
55}
56
57bool SfxWatermarkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
58{
59 css::uno::Sequence<css::beans::PropertyValue> aSequence;
60
61 if ( rVal >>= aSequence )
62 {
63 for(const auto& aEntry : std::as_const(aSequence))
64 {
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;
75 }
76 return true;
77 }
78
79 return false;
80}
81
82/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
static SfxPoolItem * CreateDefault()
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
sal_Int16 m_nTransparency
virtual SfxWatermarkItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool operator==(const SfxPoolItem &) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Font m_aFont
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
unsigned char sal_uInt8