Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "svx/postattr.hxx"
21 : #include <editeng/itemtype.hxx>
22 : #include <svx/svxitems.hrc>
23 : #include <svx/dialmgr.hxx>
24 :
25 : // -----------------------------------------------------------------------
26 :
27 18 : TYPEINIT1_FACTORY(SvxPostItAuthorItem, SfxStringItem, new SvxPostItAuthorItem(0));
28 18 : TYPEINIT1_FACTORY(SvxPostItDateItem, SfxStringItem, new SvxPostItDateItem(0));
29 18 : TYPEINIT1_FACTORY(SvxPostItTextItem, SfxStringItem, new SvxPostItTextItem(0));
30 :
31 : // class SvxPostItAuthorItem ---------------------------------------------
32 :
33 0 : SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
34 : {
35 0 : SetWhich( _nWhich );
36 0 : }
37 :
38 : // -----------------------------------------------------------------------
39 :
40 0 : SvxPostItAuthorItem::SvxPostItAuthorItem( const XubString& rAuthor,
41 : sal_uInt16 _nWhich ) :
42 0 : SfxStringItem( _nWhich, rAuthor )
43 : {
44 0 : }
45 :
46 : //------------------------------------------------------------------------
47 :
48 0 : SfxItemPresentation SvxPostItAuthorItem::GetPresentation
49 : (
50 : SfxItemPresentation ePres,
51 : SfxMapUnit /*eCoreUnit*/,
52 : SfxMapUnit /*ePresUnit*/,
53 : XubString& rText, const IntlWrapper *
54 : ) const
55 : {
56 0 : switch ( ePres )
57 : {
58 : case SFX_ITEM_PRESENTATION_NONE:
59 0 : rText.Erase();
60 0 : return SFX_ITEM_PRESENTATION_NONE;
61 : case SFX_ITEM_PRESENTATION_NAMELESS:
62 0 : rText = GetValue();
63 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
64 : case SFX_ITEM_PRESENTATION_COMPLETE:
65 0 : rText = SVX_RESSTR(RID_SVXITEMS_AUTHOR_COMPLETE);
66 0 : rText += GetValue();
67 0 : return SFX_ITEM_PRESENTATION_COMPLETE;
68 : default: ;//prevent warning
69 : }
70 0 : return SFX_ITEM_PRESENTATION_NONE;
71 : }
72 :
73 : // -----------------------------------------------------------------------
74 :
75 0 : SfxPoolItem* SvxPostItAuthorItem::Clone( SfxItemPool * ) const
76 : {
77 0 : return new SvxPostItAuthorItem( *this );
78 : }
79 :
80 : // class SvxPostItDateItem -----------------------------------------------
81 :
82 0 : SvxPostItDateItem::SvxPostItDateItem( sal_uInt16 _nWhich )
83 : {
84 0 : SetWhich( _nWhich );
85 0 : }
86 :
87 : // -----------------------------------------------------------------------
88 :
89 0 : SvxPostItDateItem::SvxPostItDateItem( const XubString& rDate, sal_uInt16 _nWhich ) :
90 :
91 0 : SfxStringItem( _nWhich, rDate )
92 : {
93 0 : }
94 :
95 : //------------------------------------------------------------------------
96 :
97 0 : SfxItemPresentation SvxPostItDateItem::GetPresentation
98 : (
99 : SfxItemPresentation ePres,
100 : SfxMapUnit /*eCoreUnit*/,
101 : SfxMapUnit /*ePresUnit*/,
102 : XubString& rText, const IntlWrapper *
103 : ) const
104 : {
105 0 : switch ( ePres )
106 : {
107 : case SFX_ITEM_PRESENTATION_NONE:
108 0 : rText.Erase();
109 0 : return SFX_ITEM_PRESENTATION_NONE;
110 : case SFX_ITEM_PRESENTATION_NAMELESS:
111 0 : rText = GetValue();
112 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
113 : case SFX_ITEM_PRESENTATION_COMPLETE:
114 0 : rText = SVX_RESSTR(RID_SVXITEMS_DATE_COMPLETE);
115 0 : rText += GetValue();
116 0 : return SFX_ITEM_PRESENTATION_COMPLETE;
117 : default: ;//prevent warning
118 : }
119 0 : return SFX_ITEM_PRESENTATION_NONE;
120 : }
121 :
122 : // -----------------------------------------------------------------------
123 :
124 0 : SfxPoolItem* SvxPostItDateItem::Clone( SfxItemPool * ) const
125 : {
126 0 : return new SvxPostItDateItem( *this );
127 : }
128 :
129 : // class SvxPostItTextItem -----------------------------------------------
130 :
131 0 : SvxPostItTextItem::SvxPostItTextItem( sal_uInt16 _nWhich )
132 : {
133 0 : SetWhich( _nWhich );
134 0 : }
135 :
136 : // -----------------------------------------------------------------------
137 :
138 0 : SvxPostItTextItem::SvxPostItTextItem( const XubString& rText, sal_uInt16 _nWhich ) :
139 :
140 0 : SfxStringItem( _nWhich, rText )
141 : {
142 0 : }
143 :
144 : //------------------------------------------------------------------------
145 :
146 0 : SfxItemPresentation SvxPostItTextItem::GetPresentation
147 : (
148 : SfxItemPresentation ePres,
149 : SfxMapUnit /*eCoreUnit*/,
150 : SfxMapUnit /*ePresUnit*/,
151 : XubString& rText, const IntlWrapper *
152 : ) const
153 : {
154 0 : switch ( ePres )
155 : {
156 : case SFX_ITEM_PRESENTATION_NONE:
157 0 : rText.Erase();
158 0 : return SFX_ITEM_PRESENTATION_NONE;
159 : case SFX_ITEM_PRESENTATION_NAMELESS:
160 0 : rText = GetValue();
161 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
162 : case SFX_ITEM_PRESENTATION_COMPLETE:
163 0 : rText = SVX_RESSTR(RID_SVXITEMS_TEXT_COMPLETE);
164 0 : rText += GetValue();
165 0 : return SFX_ITEM_PRESENTATION_COMPLETE;
166 : default: ;//prevent warning
167 : }
168 0 : return SFX_ITEM_PRESENTATION_NONE;
169 : }
170 :
171 : // -----------------------------------------------------------------------
172 :
173 0 : SfxPoolItem* SvxPostItTextItem::Clone( SfxItemPool * ) const
174 : {
175 0 : return new SvxPostItTextItem( *this );
176 : }
177 :
178 :
179 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|