Simplify using designated initializers
[LibreOffice.git] / svx / source / items / postattr.cxx
blob09c3f606c03bc5830141f984ed4cd0a638f338a6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/postattr.hxx>
21 #include <svx/strings.hrc>
22 #include <svx/dialmgr.hxx>
24 SfxPoolItem* SvxPostItAuthorItem::CreateDefault() { return new SvxPostItAuthorItem(TypedWhichId<SvxPostItAuthorItem>(0)); }
25 SfxPoolItem* SvxPostItDateItem::CreateDefault() { return new SvxPostItDateItem(TypedWhichId<SvxPostItDateItem>(0)); }
26 SfxPoolItem* SvxPostItTextItem::CreateDefault() { return new SvxPostItTextItem(TypedWhichId<SvxPostItTextItem>(0)); }
27 SfxPoolItem* SvxPostItIdItem::CreateDefault() { return new SvxPostItIdItem(TypedWhichId<SvxPostItIdItem>(0)); }
29 SvxPostItAuthorItem::SvxPostItAuthorItem( TypedWhichId<SvxPostItAuthorItem> _nWhich )
31 SetWhich( _nWhich );
35 SvxPostItAuthorItem::SvxPostItAuthorItem( const OUString& rAuthor,
36 TypedWhichId<SvxPostItAuthorItem> _nWhich ) :
37 SfxStringItem( _nWhich, rAuthor )
42 bool SvxPostItAuthorItem::GetPresentation
44 SfxItemPresentation ePres,
45 MapUnit /*eCoreUnit*/,
46 MapUnit /*ePresUnit*/,
47 OUString& rText, const IntlWrapper&
48 ) const
50 switch ( ePres )
52 case SfxItemPresentation::Nameless:
53 rText = GetValue();
54 return true;
55 case SfxItemPresentation::Complete:
56 rText = SvxResId(RID_SVXITEMS_AUTHOR_COMPLETE) + GetValue();
57 return true;
58 default: ;//prevent warning
60 return false;
63 SvxPostItAuthorItem* SvxPostItAuthorItem::Clone( SfxItemPool * ) const
65 return new SvxPostItAuthorItem( *this );
68 SvxPostItDateItem::SvxPostItDateItem( TypedWhichId<SvxPostItDateItem> _nWhich )
69 : SfxStringItem(_nWhich, SfxItemType::SvxPostItDateItemType)
74 SvxPostItDateItem::SvxPostItDateItem( const OUString& rDate, TypedWhichId<SvxPostItDateItem> _nWhich ) :
75 SfxStringItem( _nWhich, rDate, SfxItemType::SvxPostItDateItemType )
80 bool SvxPostItDateItem::GetPresentation
82 SfxItemPresentation ePres,
83 MapUnit /*eCoreUnit*/,
84 MapUnit /*ePresUnit*/,
85 OUString& rText, const IntlWrapper&
86 ) const
88 switch ( ePres )
90 case SfxItemPresentation::Nameless:
91 rText = GetValue();
92 return true;
93 case SfxItemPresentation::Complete:
94 rText = SvxResId(RID_SVXITEMS_DATE_COMPLETE) + GetValue();
95 return true;
96 default: ;//prevent warning
98 return false;
102 SvxPostItDateItem* SvxPostItDateItem::Clone( SfxItemPool * ) const
104 return new SvxPostItDateItem( *this );
107 SvxPostItTextItem::SvxPostItTextItem( TypedWhichId<SvxPostItTextItem> _nWhich )
109 SetWhich( _nWhich );
112 SvxPostItTextItem::SvxPostItTextItem( const OUString& rText, TypedWhichId<SvxPostItTextItem> _nWhich ) :
114 SfxStringItem( _nWhich, rText )
118 bool SvxPostItTextItem::GetPresentation
120 SfxItemPresentation ePres,
121 MapUnit /*eCoreUnit*/,
122 MapUnit /*ePresUnit*/,
123 OUString& rText, const IntlWrapper&
124 ) const
126 switch ( ePres )
128 case SfxItemPresentation::Nameless:
129 rText = GetValue();
130 return true;
131 case SfxItemPresentation::Complete:
132 rText = SvxResId(RID_SVXITEMS_TEXT_COMPLETE) + GetValue();
133 return true;
134 default: ;//prevent warning
136 return false;
139 SvxPostItTextItem* SvxPostItTextItem::Clone( SfxItemPool * ) const
141 return new SvxPostItTextItem( *this );
144 SvxPostItIdItem::SvxPostItIdItem( TypedWhichId<SvxPostItIdItem> _nWhich )
146 SetWhich( _nWhich );
149 SvxPostItIdItem* SvxPostItIdItem::Clone( SfxItemPool * ) const
151 return new SvxPostItIdItem( *this );
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */