LibreOffice Module svx (master)  1
postattr.cxx
Go to the documentation of this file.
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/strings.hrc>
23 #include <svx/svxitems.hrc>
24 #include <svx/dialmgr.hxx>
25 
30 
32 {
33  SetWhich( _nWhich );
34 }
35 
36 
38  sal_uInt16 _nWhich ) :
39  SfxStringItem( _nWhich, rAuthor )
40 {
41 }
42 
43 
45 (
46  SfxItemPresentation ePres,
47  MapUnit /*eCoreUnit*/,
48  MapUnit /*ePresUnit*/,
49  OUString& rText, const IntlWrapper&
50 ) const
51 {
52  switch ( ePres )
53  {
54  case SfxItemPresentation::Nameless:
55  rText = GetValue();
56  return true;
57  case SfxItemPresentation::Complete:
58  rText = SvxResId(RID_SVXITEMS_AUTHOR_COMPLETE) + GetValue();
59  return true;
60  default: ;//prevent warning
61  }
62  return false;
63 }
64 
66 {
67  return new SvxPostItAuthorItem( *this );
68 }
69 
71 {
72  SetWhich( _nWhich );
73 }
74 
75 
76 SvxPostItDateItem::SvxPostItDateItem( const OUString& rDate, sal_uInt16 _nWhich ) :
77 
78  SfxStringItem( _nWhich, rDate )
79 {
80 }
81 
82 
84 (
85  SfxItemPresentation ePres,
86  MapUnit /*eCoreUnit*/,
87  MapUnit /*ePresUnit*/,
88  OUString& rText, const IntlWrapper&
89 ) const
90 {
91  switch ( ePres )
92  {
93  case SfxItemPresentation::Nameless:
94  rText = GetValue();
95  return true;
96  case SfxItemPresentation::Complete:
97  rText = SvxResId(RID_SVXITEMS_DATE_COMPLETE) + GetValue();
98  return true;
99  default: ;//prevent warning
100  }
101  return false;
102 }
103 
104 
106 {
107  return new SvxPostItDateItem( *this );
108 }
109 
111 {
112  SetWhich( _nWhich );
113 }
114 
115 SvxPostItTextItem::SvxPostItTextItem( const OUString& rText, sal_uInt16 _nWhich ) :
116 
117  SfxStringItem( _nWhich, rText )
118 {
119 }
120 
122 (
123  SfxItemPresentation ePres,
124  MapUnit /*eCoreUnit*/,
125  MapUnit /*ePresUnit*/,
126  OUString& rText, const IntlWrapper&
127 ) const
128 {
129  switch ( ePres )
130  {
131  case SfxItemPresentation::Nameless:
132  rText = GetValue();
133  return true;
134  case SfxItemPresentation::Complete:
135  rText = SvxResId(RID_SVXITEMS_TEXT_COMPLETE) + GetValue();
136  return true;
137  default: ;//prevent warning
138  }
139  return false;
140 }
141 
143 {
144  return new SvxPostItTextItem( *this );
145 }
146 
147 SvxPostItIdItem::SvxPostItIdItem( sal_uInt16 _nWhich )
148 {
149  SetWhich( _nWhich );
150 }
151 
153 {
154  return new SvxPostItIdItem( *this );
155 }
156 
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SfxPoolItem * CreateDefault()
Definition: postattr.cxx:27
static SfxPoolItem * CreateDefault()
Definition: postattr.cxx:28
The date of a note.
Definition: postattr.hxx:48
std::string GetValue
SvxPostItDateItem(sal_uInt16 nWhich)
Definition: postattr.cxx:70
virtual SvxPostItAuthorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: postattr.cxx:65
SvxPostItAuthorItem(sal_uInt16 nWhich)
Definition: postattr.cxx:31
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
virtual SvxPostItIdItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: postattr.cxx:152
virtual SvxPostItDateItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: postattr.cxx:105
SfxItemPresentation
virtual SvxPostItTextItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: postattr.cxx:142
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: postattr.cxx:122
SvxPostItTextItem(sal_uInt16 nWhich)
Definition: postattr.cxx:110
SvxPostItIdItem(sal_uInt16 nWhich)
Definition: postattr.cxx:147
The text of a note.
Definition: postattr.hxx:67
void SetWhich(sal_uInt16 nId)
The author shorthand symbol of a note.
Definition: postattr.hxx:28
MapUnit
static SfxPoolItem * CreateDefault()
Definition: postattr.cxx:29
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: postattr.cxx:45
The internal id of a note.
Definition: postattr.hxx:88
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: postattr.cxx:84
static SfxPoolItem * CreateDefault()
Definition: postattr.cxx:26