merge the formfield patch from ooo-build
[ooovba.git] / svx / source / items / rotmodit.cxx
blob6374cee9363ecf03640faaff937dc49ddbdc2c56
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rotmodit.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <tools/stream.hxx>
34 #include <com/sun/star/table/BorderLine.hpp>
35 #include <com/sun/star/table/CellVertJustify.hpp>
36 #include <com/sun/star/table/ShadowLocation.hpp>
37 #include <com/sun/star/table/TableBorder.hpp>
38 #include <com/sun/star/table/ShadowFormat.hpp>
39 #include <com/sun/star/table/CellRangeAddress.hpp>
40 #include <com/sun/star/table/CellContentType.hpp>
41 #include <com/sun/star/table/TableOrientation.hpp>
42 #include <com/sun/star/table/CellHoriJustify.hpp>
43 #include <com/sun/star/util/SortField.hpp>
44 #include <com/sun/star/util/SortFieldType.hpp>
45 #include <com/sun/star/table/CellOrientation.hpp>
46 #include <com/sun/star/table/CellAddress.hpp>
48 #include "rotmodit.hxx"
50 using namespace ::rtl;
51 using namespace ::com::sun::star;
53 // STATIC DATA -----------------------------------------------------------
55 TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0));
58 //-----------------------------------------------------------------------
59 // SvxRotateModeItem - Ausrichtung bei gedrehtem Text
60 //-----------------------------------------------------------------------
62 SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, USHORT _nWhich )
63 : SfxEnumItem( _nWhich, (USHORT)eMode )
67 SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
68 : SfxEnumItem( rItem )
72 __EXPORT SvxRotateModeItem::~SvxRotateModeItem()
76 SfxPoolItem* __EXPORT SvxRotateModeItem::Create( SvStream& rStream, USHORT ) const
78 USHORT nVal;
79 rStream >> nVal;
80 return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() );
83 SfxItemPresentation __EXPORT SvxRotateModeItem::GetPresentation(
84 SfxItemPresentation ePres,
85 SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
86 String& rText, const IntlWrapper * ) const
88 rText.Erase();
90 switch ( ePres )
92 case SFX_ITEM_PRESENTATION_COMPLETE:
93 rText.AppendAscii("...");
94 rText.AppendAscii(": ");
95 // break; // DURCHFALLEN!!!
97 case SFX_ITEM_PRESENTATION_NAMELESS:
98 rText += UniString::CreateFromInt32( GetValue() );
99 break;
100 default: ;//prevent warning
103 return ePres;
106 String __EXPORT SvxRotateModeItem::GetValueText( USHORT nVal ) const
108 String aText;
110 switch ( nVal )
112 case SVX_ROTATE_MODE_STANDARD:
113 case SVX_ROTATE_MODE_TOP:
114 case SVX_ROTATE_MODE_CENTER:
115 case SVX_ROTATE_MODE_BOTTOM:
116 aText.AppendAscii("...");
117 break;
118 default:
119 DBG_ERROR("SvxRotateModeItem: falscher enum");
120 break;
122 return aText;
125 USHORT __EXPORT SvxRotateModeItem::GetValueCount() const
127 return 4; // STANDARD, TOP, CENTER, BOTTOM
130 SfxPoolItem* __EXPORT SvxRotateModeItem::Clone( SfxItemPool* ) const
132 return new SvxRotateModeItem( *this );
135 USHORT __EXPORT SvxRotateModeItem::GetVersion( USHORT /*nFileVersion*/ ) const
137 return 0;
140 // QueryValue/PutValue: Der ::com::sun::star::table::CellVertJustify enum wird mitbenutzt...
142 sal_Bool SvxRotateModeItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const
144 table::CellVertJustify eUno = table::CellVertJustify_STANDARD;
145 switch ( (SvxRotateMode)GetValue() )
147 case SVX_ROTATE_MODE_STANDARD: eUno = table::CellVertJustify_STANDARD; break;
148 case SVX_ROTATE_MODE_TOP: eUno = table::CellVertJustify_TOP; break;
149 case SVX_ROTATE_MODE_CENTER: eUno = table::CellVertJustify_CENTER; break;
150 case SVX_ROTATE_MODE_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break;
152 rVal <<= eUno;
153 return sal_True;
156 sal_Bool SvxRotateModeItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ )
158 table::CellVertJustify eUno;
159 if(!(rVal >>= eUno))
161 sal_Int32 nValue = 0;
162 if(!(rVal >>= nValue))
163 return sal_False;
164 eUno = (table::CellVertJustify)nValue;
167 SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
168 switch (eUno)
170 case table::CellVertJustify_STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
171 case table::CellVertJustify_TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
172 case table::CellVertJustify_CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
173 case table::CellVertJustify_BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
174 default: ;//prevent warning
176 SetValue( (USHORT)eSvx );
177 return sal_True;