Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / items / rotmodit.cxx
blobeb559fdaeb6258828eac2561fd1e07705d648989
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/table/CellVertJustify2.hpp>
22 #include <svx/dialmgr.hxx>
23 #include <svx/rotmodit.hxx>
24 #include <rotationstrings.hrc>
26 using namespace ::com::sun::star;
29 SfxPoolItem* SvxRotateModeItem::CreateDefault() { return new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, TypedWhichId<SvxRotateModeItem>(0));}
32 // SvxRotateModeItem - orientation with turned text
35 SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, TypedWhichId<SvxRotateModeItem> _nWhich )
36 : SfxEnumItem( _nWhich, eMode )
40 SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
41 : SfxEnumItem( rItem )
45 SvxRotateModeItem::~SvxRotateModeItem()
49 OUString SvxRotateModeItem::GetValueText(SvxRotateMode nVal)
51 assert(nVal <= SVX_ROTATE_MODE_BOTTOM && "enum overflow!");
52 return SvxResId(RID_SVXITEMS_ROTATE_MODE[static_cast<size_t>(nVal)]);
55 bool SvxRotateModeItem::GetPresentation(
56 SfxItemPresentation ePres,
57 MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
58 OUString& rText, const IntlWrapper& ) const
60 rText.clear();
62 switch ( ePres )
64 case SfxItemPresentation::Complete:
65 rText += GetValueText(GetValue());
66 return true;
68 case SfxItemPresentation::Nameless:
69 rText += OUString::number( GetValue() );
70 return true;
71 default: ;//prevent warning
74 return false;
77 sal_uInt16 SvxRotateModeItem::GetValueCount() const
79 return 4; // STANDARD, TOP, CENTER, BOTTOM
82 SvxRotateModeItem* SvxRotateModeItem::Clone( SfxItemPool* ) const
84 return new SvxRotateModeItem( *this );
87 bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
89 sal_Int32 nUno = table::CellVertJustify2::STANDARD;
90 switch ( GetValue() )
92 case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
93 case SVX_ROTATE_MODE_TOP: nUno = table::CellVertJustify2::TOP; break;
94 case SVX_ROTATE_MODE_CENTER: nUno = table::CellVertJustify2::CENTER; break;
95 case SVX_ROTATE_MODE_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break;
97 rVal <<= nUno;
98 return true;
101 bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
103 sal_Int32 nUno(0);
104 if(!(rVal >>= nUno))
106 nUno = table::CellVertJustify2::STANDARD;
109 SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
110 switch (nUno)
112 case table::CellVertJustify2::STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
113 case table::CellVertJustify2::TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
114 case table::CellVertJustify2::CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
115 case table::CellVertJustify2::BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
116 default: ;//prevent warning
118 SetValue( eSvx );
119 return true;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */