xref: /aoo42x/main/svx/source/items/postattr.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 
31 // include ---------------------------------------------------------------
32 
33 #define _SVX_POSTATTR_CXX
34 #include "svx/postattr.hxx"
35 #include <editeng/itemtype.hxx>
36 #include <svx/svxitems.hrc>
37 #include <svx/dialmgr.hxx>
38 
39 // -----------------------------------------------------------------------
40 
41 TYPEINIT1_FACTORY(SvxPostItAuthorItem, SfxStringItem, new SvxPostItAuthorItem(0));
42 TYPEINIT1_FACTORY(SvxPostItDateItem, SfxStringItem, new SvxPostItDateItem(0));
43 TYPEINIT1_FACTORY(SvxPostItTextItem, SfxStringItem, new SvxPostItTextItem(0));
44 
45 // class SvxPostItAuthorItem ---------------------------------------------
46 
47 SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
48 {
49     SetWhich( _nWhich );
50 }
51 
52 // -----------------------------------------------------------------------
53 
54 SvxPostItAuthorItem::SvxPostItAuthorItem( const XubString& rAuthor,
55                                           sal_uInt16 _nWhich ) :
56     SfxStringItem( _nWhich, rAuthor )
57 {
58 }
59 
60 //------------------------------------------------------------------------
61 
62 SfxItemPresentation SvxPostItAuthorItem::GetPresentation
63 (
64 	SfxItemPresentation ePres,
65     SfxMapUnit          /*eCoreUnit*/,
66     SfxMapUnit          /*ePresUnit*/,
67     XubString&          rText, const IntlWrapper *
68 )	const
69 {
70 	switch ( ePres )
71 	{
72 		case SFX_ITEM_PRESENTATION_NONE:
73 			rText.Erase();
74 			return SFX_ITEM_PRESENTATION_NONE;
75 		case SFX_ITEM_PRESENTATION_NAMELESS:
76 			rText = GetValue();
77 			return SFX_ITEM_PRESENTATION_NAMELESS;
78 		case SFX_ITEM_PRESENTATION_COMPLETE:
79 			rText = SVX_RESSTR(RID_SVXITEMS_AUTHOR_COMPLETE);
80 			rText += GetValue();
81 			return SFX_ITEM_PRESENTATION_COMPLETE;
82         default: ;//prevent warning
83     }
84 	return SFX_ITEM_PRESENTATION_NONE;
85 }
86 
87 // -----------------------------------------------------------------------
88 
89 SfxPoolItem* __EXPORT SvxPostItAuthorItem::Clone( SfxItemPool * ) const
90 {
91 	return new SvxPostItAuthorItem( *this );
92 }
93 
94 // class SvxPostItDateItem -----------------------------------------------
95 
96 SvxPostItDateItem::SvxPostItDateItem( sal_uInt16 _nWhich )
97 {
98     SetWhich( _nWhich );
99 }
100 
101 // -----------------------------------------------------------------------
102 
103 SvxPostItDateItem::SvxPostItDateItem( const XubString& rDate, sal_uInt16 _nWhich ) :
104 
105     SfxStringItem( _nWhich, rDate )
106 {
107 }
108 
109 //------------------------------------------------------------------------
110 
111 SfxItemPresentation SvxPostItDateItem::GetPresentation
112 (
113 	SfxItemPresentation ePres,
114     SfxMapUnit          /*eCoreUnit*/,
115     SfxMapUnit          /*ePresUnit*/,
116     XubString&          rText, const IntlWrapper *
117 )	const
118 {
119 	switch ( ePres )
120 	{
121 		case SFX_ITEM_PRESENTATION_NONE:
122 			rText.Erase();
123 			return SFX_ITEM_PRESENTATION_NONE;
124 		case SFX_ITEM_PRESENTATION_NAMELESS:
125 			rText = GetValue();
126 			return SFX_ITEM_PRESENTATION_NAMELESS;
127 		case SFX_ITEM_PRESENTATION_COMPLETE:
128 			rText = SVX_RESSTR(RID_SVXITEMS_DATE_COMPLETE);
129 			rText += GetValue();
130 			return SFX_ITEM_PRESENTATION_COMPLETE;
131         default: ;//prevent warning
132     }
133 	return SFX_ITEM_PRESENTATION_NONE;
134 }
135 
136 // -----------------------------------------------------------------------
137 
138 SfxPoolItem* __EXPORT SvxPostItDateItem::Clone( SfxItemPool * ) const
139 {
140 	return new SvxPostItDateItem( *this );
141 }
142 
143 // class SvxPostItTextItem -----------------------------------------------
144 
145 SvxPostItTextItem::SvxPostItTextItem( sal_uInt16 _nWhich )
146 {
147     SetWhich( _nWhich );
148 }
149 
150 // -----------------------------------------------------------------------
151 
152 SvxPostItTextItem::SvxPostItTextItem( const XubString& rText, sal_uInt16 _nWhich ) :
153 
154     SfxStringItem( _nWhich, rText )
155 {
156 }
157 
158 //------------------------------------------------------------------------
159 
160 SfxItemPresentation SvxPostItTextItem::GetPresentation
161 (
162 	SfxItemPresentation ePres,
163     SfxMapUnit          /*eCoreUnit*/,
164     SfxMapUnit          /*ePresUnit*/,
165     XubString&          rText, const IntlWrapper *
166 )	const
167 {
168 	switch ( ePres )
169 	{
170 		case SFX_ITEM_PRESENTATION_NONE:
171 			rText.Erase();
172 			return SFX_ITEM_PRESENTATION_NONE;
173 		case SFX_ITEM_PRESENTATION_NAMELESS:
174 			rText = GetValue();
175 			return SFX_ITEM_PRESENTATION_NAMELESS;
176 		case SFX_ITEM_PRESENTATION_COMPLETE:
177 			rText = SVX_RESSTR(RID_SVXITEMS_TEXT_COMPLETE);
178 			rText += GetValue();
179 			return SFX_ITEM_PRESENTATION_COMPLETE;
180         default: ;//prevent warning
181     }
182 	return SFX_ITEM_PRESENTATION_NONE;
183 }
184 
185 // -----------------------------------------------------------------------
186 
187 SfxPoolItem* __EXPORT SvxPostItTextItem::Clone( SfxItemPool * ) const
188 {
189 	return new SvxPostItTextItem( *this );
190 }
191 
192 
193