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