/src/libreoffice/svx/source/items/rotmodit.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 <com/sun/star/table/CellVertJustify2.hpp> |
21 | | |
22 | | #include <svx/dialmgr.hxx> |
23 | | #include <svx/rotmodit.hxx> |
24 | | #include <rotationstrings.hrc> |
25 | | |
26 | | using namespace ::com::sun::star; |
27 | | |
28 | | |
29 | 0 | SfxPoolItem* SvxRotateModeItem::CreateDefault() { return new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, TypedWhichId<SvxRotateModeItem>(0));} |
30 | | |
31 | | |
32 | | // SvxRotateModeItem - orientation with turned text |
33 | | |
34 | | |
35 | | SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, TypedWhichId<SvxRotateModeItem> _nWhich ) |
36 | 168k | : SfxEnumItem( _nWhich, eMode ) |
37 | 168k | { |
38 | 168k | } |
39 | | |
40 | | SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem ) |
41 | 168k | : SfxEnumItem( rItem ) |
42 | 168k | { |
43 | 168k | } |
44 | | |
45 | | SvxRotateModeItem::~SvxRotateModeItem() |
46 | 336k | { |
47 | 336k | } |
48 | | |
49 | | OUString SvxRotateModeItem::GetValueText(SvxRotateMode nVal) |
50 | 0 | { |
51 | 0 | assert(nVal <= SVX_ROTATE_MODE_BOTTOM && "enum overflow!"); |
52 | 0 | return SvxResId(RID_SVXITEMS_ROTATE_MODE[static_cast<size_t>(nVal)]); |
53 | 0 | } |
54 | | |
55 | | bool SvxRotateModeItem::GetPresentation( |
56 | | SfxItemPresentation ePres, |
57 | | MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/, |
58 | | OUString& rText, const IntlWrapper& ) const |
59 | 0 | { |
60 | 0 | rText.clear(); |
61 | |
|
62 | 0 | switch ( ePres ) |
63 | 0 | { |
64 | 0 | case SfxItemPresentation::Complete: |
65 | 0 | rText += GetValueText(GetValue()); |
66 | 0 | return true; |
67 | | |
68 | 0 | case SfxItemPresentation::Nameless: |
69 | 0 | rText += OUString::number( GetValue() ); |
70 | 0 | return true; |
71 | 0 | default: ;//prevent warning |
72 | 0 | } |
73 | | |
74 | 0 | return false; |
75 | 0 | } |
76 | | |
77 | | SvxRotateModeItem* SvxRotateModeItem::Clone( SfxItemPool* ) const |
78 | 168k | { |
79 | 168k | return new SvxRotateModeItem( *this ); |
80 | 168k | } |
81 | | |
82 | | bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const |
83 | 0 | { |
84 | 0 | sal_Int32 nUno = table::CellVertJustify2::STANDARD; |
85 | 0 | switch ( GetValue() ) |
86 | 0 | { |
87 | 0 | case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break; |
88 | 0 | case SVX_ROTATE_MODE_TOP: nUno = table::CellVertJustify2::TOP; break; |
89 | 0 | case SVX_ROTATE_MODE_CENTER: nUno = table::CellVertJustify2::CENTER; break; |
90 | 0 | case SVX_ROTATE_MODE_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break; |
91 | 0 | } |
92 | 0 | rVal <<= nUno; |
93 | 0 | return true; |
94 | 0 | } |
95 | | |
96 | | bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) |
97 | 99 | { |
98 | 99 | sal_Int32 nUno(0); |
99 | 99 | if(!(rVal >>= nUno)) |
100 | 0 | { |
101 | 0 | nUno = table::CellVertJustify2::STANDARD; |
102 | 0 | } |
103 | | |
104 | 99 | SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD; |
105 | 99 | switch (nUno) |
106 | 99 | { |
107 | 99 | case table::CellVertJustify2::STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break; |
108 | 0 | case table::CellVertJustify2::TOP: eSvx = SVX_ROTATE_MODE_TOP; break; |
109 | 0 | case table::CellVertJustify2::CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break; |
110 | 0 | case table::CellVertJustify2::BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break; |
111 | 0 | default: ;//prevent warning |
112 | 99 | } |
113 | 99 | SetValue( eSvx ); |
114 | 99 | return true; |
115 | 99 | } |
116 | | |
117 | | |
118 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |