xref: /trunk/main/svx/source/items/postattr.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 // include ---------------------------------------------------------------
28 
29 #define _SVX_POSTATTR_CXX
30 #include "svx/postattr.hxx"
31 #include <editeng/itemtype.hxx>
32 #include <svx/svxitems.hrc>
33 #include <svx/dialmgr.hxx>
34 
35 // -----------------------------------------------------------------------
36 
37 TYPEINIT1_FACTORY(SvxPostItAuthorItem, SfxStringItem, new SvxPostItAuthorItem(0));
38 TYPEINIT1_FACTORY(SvxPostItDateItem, SfxStringItem, new SvxPostItDateItem(0));
39 TYPEINIT1_FACTORY(SvxPostItTextItem, SfxStringItem, new SvxPostItTextItem(0));
40 
41 // class SvxPostItAuthorItem ---------------------------------------------
42 
SvxPostItAuthorItem(sal_uInt16 _nWhich)43 SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
44 {
45     SetWhich( _nWhich );
46 }
47 
48 // -----------------------------------------------------------------------
49 
SvxPostItAuthorItem(const XubString & rAuthor,sal_uInt16 _nWhich)50 SvxPostItAuthorItem::SvxPostItAuthorItem( const XubString& rAuthor,
51                                           sal_uInt16 _nWhich ) :
52     SfxStringItem( _nWhich, rAuthor )
53 {
54 }
55 
56 //------------------------------------------------------------------------
57 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const58 SfxItemPresentation SvxPostItAuthorItem::GetPresentation
59 (
60 	SfxItemPresentation ePres,
61     SfxMapUnit          /*eCoreUnit*/,
62     SfxMapUnit          /*ePresUnit*/,
63     XubString&          rText, const IntlWrapper *
64 )	const
65 {
66 	switch ( ePres )
67 	{
68 		case SFX_ITEM_PRESENTATION_NONE:
69 			rText.Erase();
70 			return SFX_ITEM_PRESENTATION_NONE;
71 		case SFX_ITEM_PRESENTATION_NAMELESS:
72 			rText = GetValue();
73 			return SFX_ITEM_PRESENTATION_NAMELESS;
74 		case SFX_ITEM_PRESENTATION_COMPLETE:
75 			rText = SVX_RESSTR(RID_SVXITEMS_AUTHOR_COMPLETE);
76 			rText += GetValue();
77 			return SFX_ITEM_PRESENTATION_COMPLETE;
78         default: ;//prevent warning
79     }
80 	return SFX_ITEM_PRESENTATION_NONE;
81 }
82 
83 // -----------------------------------------------------------------------
84 
Clone(SfxItemPool *) const85 SfxPoolItem* __EXPORT SvxPostItAuthorItem::Clone( SfxItemPool * ) const
86 {
87 	return new SvxPostItAuthorItem( *this );
88 }
89 
90 // class SvxPostItDateItem -----------------------------------------------
91 
SvxPostItDateItem(sal_uInt16 _nWhich)92 SvxPostItDateItem::SvxPostItDateItem( sal_uInt16 _nWhich )
93 {
94     SetWhich( _nWhich );
95 }
96 
97 // -----------------------------------------------------------------------
98 
SvxPostItDateItem(const XubString & rDate,sal_uInt16 _nWhich)99 SvxPostItDateItem::SvxPostItDateItem( const XubString& rDate, sal_uInt16 _nWhich ) :
100 
101     SfxStringItem( _nWhich, rDate )
102 {
103 }
104 
105 //------------------------------------------------------------------------
106 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const107 SfxItemPresentation SvxPostItDateItem::GetPresentation
108 (
109 	SfxItemPresentation ePres,
110     SfxMapUnit          /*eCoreUnit*/,
111     SfxMapUnit          /*ePresUnit*/,
112     XubString&          rText, const IntlWrapper *
113 )	const
114 {
115 	switch ( ePres )
116 	{
117 		case SFX_ITEM_PRESENTATION_NONE:
118 			rText.Erase();
119 			return SFX_ITEM_PRESENTATION_NONE;
120 		case SFX_ITEM_PRESENTATION_NAMELESS:
121 			rText = GetValue();
122 			return SFX_ITEM_PRESENTATION_NAMELESS;
123 		case SFX_ITEM_PRESENTATION_COMPLETE:
124 			rText = SVX_RESSTR(RID_SVXITEMS_DATE_COMPLETE);
125 			rText += GetValue();
126 			return SFX_ITEM_PRESENTATION_COMPLETE;
127         default: ;//prevent warning
128     }
129 	return SFX_ITEM_PRESENTATION_NONE;
130 }
131 
132 // -----------------------------------------------------------------------
133 
Clone(SfxItemPool *) const134 SfxPoolItem* __EXPORT SvxPostItDateItem::Clone( SfxItemPool * ) const
135 {
136 	return new SvxPostItDateItem( *this );
137 }
138 
139 // class SvxPostItTextItem -----------------------------------------------
140 
SvxPostItTextItem(sal_uInt16 _nWhich)141 SvxPostItTextItem::SvxPostItTextItem( sal_uInt16 _nWhich )
142 {
143     SetWhich( _nWhich );
144 }
145 
146 // -----------------------------------------------------------------------
147 
SvxPostItTextItem(const XubString & rText,sal_uInt16 _nWhich)148 SvxPostItTextItem::SvxPostItTextItem( const XubString& rText, sal_uInt16 _nWhich ) :
149 
150     SfxStringItem( _nWhich, rText )
151 {
152 }
153 
154 //------------------------------------------------------------------------
155 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const156 SfxItemPresentation SvxPostItTextItem::GetPresentation
157 (
158 	SfxItemPresentation ePres,
159     SfxMapUnit          /*eCoreUnit*/,
160     SfxMapUnit          /*ePresUnit*/,
161     XubString&          rText, const IntlWrapper *
162 )	const
163 {
164 	switch ( ePres )
165 	{
166 		case SFX_ITEM_PRESENTATION_NONE:
167 			rText.Erase();
168 			return SFX_ITEM_PRESENTATION_NONE;
169 		case SFX_ITEM_PRESENTATION_NAMELESS:
170 			rText = GetValue();
171 			return SFX_ITEM_PRESENTATION_NAMELESS;
172 		case SFX_ITEM_PRESENTATION_COMPLETE:
173 			rText = SVX_RESSTR(RID_SVXITEMS_TEXT_COMPLETE);
174 			rText += GetValue();
175 			return SFX_ITEM_PRESENTATION_COMPLETE;
176         default: ;//prevent warning
177     }
178 	return SFX_ITEM_PRESENTATION_NONE;
179 }
180 
181 // -----------------------------------------------------------------------
182 
Clone(SfxItemPool *) const183 SfxPoolItem* __EXPORT SvxPostItTextItem::Clone( SfxItemPool * ) const
184 {
185 	return new SvxPostItTextItem( *this );
186 }
187 
188 
189