/src/libreoffice/sfx2/source/doc/watermarkitem.cxx
Line | Count | Source |
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 | | |
10 | | #include <sfx2/watermarkitem.hxx> |
11 | | #include <sfx2/sfxsids.hrc> |
12 | | #include <comphelper/propertysequence.hxx> |
13 | | |
14 | | SfxWatermarkItem::SfxWatermarkItem() |
15 | 0 | : SfxPoolItem( SID_WATERMARK ) |
16 | 0 | , m_aText( u""_ustr ) |
17 | 0 | , m_aFont( u"Liberation Sans"_ustr ) |
18 | 0 | , m_nAngle( 45 ) |
19 | 0 | , m_nTransparency( 50 ) |
20 | 0 | , m_nColor( 0xc0c0c0 ) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | SfxPoolItem* SfxWatermarkItem::CreateDefault() |
25 | 0 | { |
26 | 0 | return new SfxWatermarkItem(); |
27 | 0 | } |
28 | | |
29 | | bool SfxWatermarkItem::operator==( const SfxPoolItem& rCmp ) const |
30 | 0 | { |
31 | 0 | return ( SfxPoolItem::operator==( rCmp ) && |
32 | 0 | m_aText == static_cast<const SfxWatermarkItem&>(rCmp).m_aText && |
33 | 0 | m_aFont == static_cast<const SfxWatermarkItem&>(rCmp).m_aFont && |
34 | 0 | m_nAngle == static_cast<const SfxWatermarkItem&>(rCmp).m_nAngle && |
35 | 0 | m_nTransparency == static_cast<const SfxWatermarkItem&>(rCmp).m_nTransparency && |
36 | 0 | m_nColor == static_cast<const SfxWatermarkItem&>(rCmp).m_nColor ); |
37 | 0 | } |
38 | | |
39 | | SfxWatermarkItem* SfxWatermarkItem::Clone( SfxItemPool *) const |
40 | 0 | { |
41 | 0 | return new SfxWatermarkItem(*this); |
42 | 0 | } |
43 | | |
44 | | bool SfxWatermarkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const |
45 | 0 | { |
46 | 0 | rVal <<= comphelper::InitPropertySequence( { |
47 | 0 | { "Text", css::uno::Any( m_aText ) }, |
48 | 0 | { "Font", css::uno::Any( m_aFont ) }, |
49 | 0 | { "Angle", css::uno::Any( m_nAngle ) }, |
50 | 0 | { "Transparency", css::uno::Any( m_nTransparency ) }, |
51 | 0 | { "Color", css::uno::Any( m_nColor ) }, |
52 | 0 | } ); |
53 | |
|
54 | 0 | return true; |
55 | 0 | } |
56 | | |
57 | | bool SfxWatermarkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) |
58 | 0 | { |
59 | 0 | css::uno::Sequence<css::beans::PropertyValue> aSequence; |
60 | |
|
61 | 0 | if ( rVal >>= aSequence ) |
62 | 0 | { |
63 | 0 | for (const auto& aEntry : aSequence) |
64 | 0 | { |
65 | 0 | if(aEntry.Name == "Text") |
66 | 0 | aEntry.Value >>= m_aText; |
67 | 0 | if(aEntry.Name == "Font") |
68 | 0 | aEntry.Value >>= m_aFont; |
69 | 0 | if(aEntry.Name == "Angle") |
70 | 0 | aEntry.Value >>= m_nAngle; |
71 | 0 | if(aEntry.Name == "Transparency") |
72 | 0 | aEntry.Value >>= m_nTransparency; |
73 | 0 | if(aEntry.Name == "Color") |
74 | 0 | aEntry.Value >>= m_nColor; |
75 | 0 | } |
76 | 0 | return true; |
77 | 0 | } |
78 | | |
79 | 0 | return false; |
80 | 0 | } |
81 | | |
82 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |