Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / items / postattr.cxx
blobfc7e0aa2b009290b89c7a08ddad81f91a7b6b922
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 // include ---------------------------------------------------------------
32 #define _SVX_POSTATTR_CXX
33 #include "svx/postattr.hxx"
34 #include <editeng/itemtype.hxx>
35 #include <svx/svxitems.hrc>
36 #include <svx/dialmgr.hxx>
38 // -----------------------------------------------------------------------
40 TYPEINIT1_FACTORY(SvxPostItAuthorItem, SfxStringItem, new SvxPostItAuthorItem(0));
41 TYPEINIT1_FACTORY(SvxPostItDateItem, SfxStringItem, new SvxPostItDateItem(0));
42 TYPEINIT1_FACTORY(SvxPostItTextItem, SfxStringItem, new SvxPostItTextItem(0));
44 // class SvxPostItAuthorItem ---------------------------------------------
46 SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
48 SetWhich( _nWhich );
51 // -----------------------------------------------------------------------
53 SvxPostItAuthorItem::SvxPostItAuthorItem( const XubString& rAuthor,
54 sal_uInt16 _nWhich ) :
55 SfxStringItem( _nWhich, rAuthor )
59 //------------------------------------------------------------------------
61 SfxItemPresentation SvxPostItAuthorItem::GetPresentation
63 SfxItemPresentation ePres,
64 SfxMapUnit /*eCoreUnit*/,
65 SfxMapUnit /*ePresUnit*/,
66 XubString& rText, const IntlWrapper *
67 ) const
69 switch ( ePres )
71 case SFX_ITEM_PRESENTATION_NONE:
72 rText.Erase();
73 return SFX_ITEM_PRESENTATION_NONE;
74 case SFX_ITEM_PRESENTATION_NAMELESS:
75 rText = GetValue();
76 return SFX_ITEM_PRESENTATION_NAMELESS;
77 case SFX_ITEM_PRESENTATION_COMPLETE:
78 rText = SVX_RESSTR(RID_SVXITEMS_AUTHOR_COMPLETE);
79 rText += GetValue();
80 return SFX_ITEM_PRESENTATION_COMPLETE;
81 default: ;//prevent warning
83 return SFX_ITEM_PRESENTATION_NONE;
86 // -----------------------------------------------------------------------
88 SfxPoolItem* SvxPostItAuthorItem::Clone( SfxItemPool * ) const
90 return new SvxPostItAuthorItem( *this );
93 // class SvxPostItDateItem -----------------------------------------------
95 SvxPostItDateItem::SvxPostItDateItem( sal_uInt16 _nWhich )
97 SetWhich( _nWhich );
100 // -----------------------------------------------------------------------
102 SvxPostItDateItem::SvxPostItDateItem( const XubString& rDate, sal_uInt16 _nWhich ) :
104 SfxStringItem( _nWhich, rDate )
108 //------------------------------------------------------------------------
110 SfxItemPresentation SvxPostItDateItem::GetPresentation
112 SfxItemPresentation ePres,
113 SfxMapUnit /*eCoreUnit*/,
114 SfxMapUnit /*ePresUnit*/,
115 XubString& rText, const IntlWrapper *
116 ) const
118 switch ( ePres )
120 case SFX_ITEM_PRESENTATION_NONE:
121 rText.Erase();
122 return SFX_ITEM_PRESENTATION_NONE;
123 case SFX_ITEM_PRESENTATION_NAMELESS:
124 rText = GetValue();
125 return SFX_ITEM_PRESENTATION_NAMELESS;
126 case SFX_ITEM_PRESENTATION_COMPLETE:
127 rText = SVX_RESSTR(RID_SVXITEMS_DATE_COMPLETE);
128 rText += GetValue();
129 return SFX_ITEM_PRESENTATION_COMPLETE;
130 default: ;//prevent warning
132 return SFX_ITEM_PRESENTATION_NONE;
135 // -----------------------------------------------------------------------
137 SfxPoolItem* SvxPostItDateItem::Clone( SfxItemPool * ) const
139 return new SvxPostItDateItem( *this );
142 // class SvxPostItTextItem -----------------------------------------------
144 SvxPostItTextItem::SvxPostItTextItem( sal_uInt16 _nWhich )
146 SetWhich( _nWhich );
149 // -----------------------------------------------------------------------
151 SvxPostItTextItem::SvxPostItTextItem( const XubString& rText, sal_uInt16 _nWhich ) :
153 SfxStringItem( _nWhich, rText )
157 //------------------------------------------------------------------------
159 SfxItemPresentation SvxPostItTextItem::GetPresentation
161 SfxItemPresentation ePres,
162 SfxMapUnit /*eCoreUnit*/,
163 SfxMapUnit /*ePresUnit*/,
164 XubString& rText, const IntlWrapper *
165 ) const
167 switch ( ePres )
169 case SFX_ITEM_PRESENTATION_NONE:
170 rText.Erase();
171 return SFX_ITEM_PRESENTATION_NONE;
172 case SFX_ITEM_PRESENTATION_NAMELESS:
173 rText = GetValue();
174 return SFX_ITEM_PRESENTATION_NAMELESS;
175 case SFX_ITEM_PRESENTATION_COMPLETE:
176 rText = SVX_RESSTR(RID_SVXITEMS_TEXT_COMPLETE);
177 rText += GetValue();
178 return SFX_ITEM_PRESENTATION_COMPLETE;
179 default: ;//prevent warning
181 return SFX_ITEM_PRESENTATION_NONE;
184 // -----------------------------------------------------------------------
186 SfxPoolItem* SvxPostItTextItem::Clone( SfxItemPool * ) const
188 return new SvxPostItTextItem( *this );
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */