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