/src/libreoffice/svl/source/items/stritem.cxx
Line | Count | Source |
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 <svl/stritem.hxx> |
21 | | #include <libxml/xmlwriter.h> |
22 | | #include <tools/XmlWriter.hxx> |
23 | | #include <com/sun/star/uno/Any.hxx> |
24 | | #include <osl/diagnose.h> |
25 | | #include <unotools/intlwrapper.hxx> |
26 | | |
27 | | // virtual |
28 | | bool SfxStringItem::GetPresentation(SfxItemPresentation, MapUnit, |
29 | | MapUnit, OUString & rText, |
30 | | const IntlWrapper&) const |
31 | 0 | { |
32 | 0 | rText = m_aValue; |
33 | 0 | return true; |
34 | 0 | } |
35 | | |
36 | | // virtual |
37 | | bool SfxStringItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const |
38 | 27.3k | { |
39 | 27.3k | rVal <<= m_aValue; |
40 | 27.3k | return true; |
41 | 27.3k | } |
42 | | |
43 | | // virtual |
44 | | bool SfxStringItem::PutValue(const css::uno::Any& rVal, |
45 | | sal_uInt8) |
46 | 43.8k | { |
47 | 43.8k | OUString aTheValue; |
48 | 43.8k | if (rVal >>= aTheValue) |
49 | 43.8k | { |
50 | 43.8k | m_aValue = aTheValue; |
51 | 43.8k | return true; |
52 | 43.8k | } |
53 | 0 | OSL_FAIL("SfxStringItem::PutValue(): Wrong type"); |
54 | 0 | return false; |
55 | 43.8k | } |
56 | | |
57 | | // virtual |
58 | | bool SfxStringItem::operator ==(const SfxPoolItem & rItem) const |
59 | 74.3M | { |
60 | 74.3M | assert(SfxPoolItem::operator==(rItem)); |
61 | 74.3M | return m_aValue |
62 | 74.3M | == static_cast< const SfxStringItem * >(&rItem)-> |
63 | 74.3M | m_aValue; |
64 | 74.3M | } |
65 | | |
66 | | // virtual |
67 | | SfxStringItem* SfxStringItem::Clone(SfxItemPool *) const |
68 | 12.8M | { |
69 | 12.8M | return new SfxStringItem(*this); |
70 | 12.8M | } |
71 | | |
72 | | void SfxStringItem::dumpAsXml(xmlTextWriterPtr pWriter) const |
73 | 0 | { |
74 | 0 | tools::XmlWriter aWriter(pWriter); |
75 | 0 | aWriter.startElement("SfxStringItem"); |
76 | 0 | aWriter.attribute("whichId", Which()); |
77 | 0 | aWriter.attribute("value", GetValue()); |
78 | 0 | aWriter.endElement(); |
79 | 0 | } |
80 | | |
81 | | SfxPoolItem* SfxStringItem::CreateDefault() |
82 | 2.37M | { |
83 | 2.37M | return new SfxStringItem(); |
84 | 2.37M | }; |
85 | | |
86 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |