1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svx.hxx" 30 #include <tools/stream.hxx> 31 #include <com/sun/star/table/BorderLine.hpp> 32 #include <com/sun/star/table/CellVertJustify.hpp> 33 #include <com/sun/star/table/ShadowLocation.hpp> 34 #include <com/sun/star/table/TableBorder.hpp> 35 #include <com/sun/star/table/ShadowFormat.hpp> 36 #include <com/sun/star/table/CellRangeAddress.hpp> 37 #include <com/sun/star/table/CellContentType.hpp> 38 #include <com/sun/star/table/TableOrientation.hpp> 39 #include <com/sun/star/table/CellHoriJustify.hpp> 40 #include <com/sun/star/util/SortField.hpp> 41 #include <com/sun/star/util/SortFieldType.hpp> 42 #include <com/sun/star/table/CellOrientation.hpp> 43 #include <com/sun/star/table/CellAddress.hpp> 44 45 #include "svx/rotmodit.hxx" 46 47 using namespace ::rtl; 48 using namespace ::com::sun::star; 49 50 // STATIC DATA ----------------------------------------------------------- 51 52 TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0)); 53 54 55 //----------------------------------------------------------------------- 56 // SvxRotateModeItem - Ausrichtung bei gedrehtem Text 57 //----------------------------------------------------------------------- 58 59 SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich ) 60 : SfxEnumItem( _nWhich, (sal_uInt16)eMode ) 61 { 62 } 63 64 SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem ) 65 : SfxEnumItem( rItem ) 66 { 67 } 68 69 __EXPORT SvxRotateModeItem::~SvxRotateModeItem() 70 { 71 } 72 73 SfxPoolItem* __EXPORT SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const 74 { 75 sal_uInt16 nVal; 76 rStream >> nVal; 77 return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() ); 78 } 79 80 SfxItemPresentation __EXPORT SvxRotateModeItem::GetPresentation( 81 SfxItemPresentation ePres, 82 SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/, 83 String& rText, const IntlWrapper * ) const 84 { 85 rText.Erase(); 86 87 switch ( ePres ) 88 { 89 case SFX_ITEM_PRESENTATION_COMPLETE: 90 rText.AppendAscii("..."); 91 rText.AppendAscii(": "); 92 // break; // DURCHFALLEN!!! 93 94 case SFX_ITEM_PRESENTATION_NAMELESS: 95 rText += UniString::CreateFromInt32( GetValue() ); 96 break; 97 default: ;//prevent warning 98 } 99 100 return ePres; 101 } 102 103 String __EXPORT SvxRotateModeItem::GetValueText( sal_uInt16 nVal ) const 104 { 105 String aText; 106 107 switch ( nVal ) 108 { 109 case SVX_ROTATE_MODE_STANDARD: 110 case SVX_ROTATE_MODE_TOP: 111 case SVX_ROTATE_MODE_CENTER: 112 case SVX_ROTATE_MODE_BOTTOM: 113 aText.AppendAscii("..."); 114 break; 115 default: 116 DBG_ERROR("SvxRotateModeItem: falscher enum"); 117 break; 118 } 119 return aText; 120 } 121 122 sal_uInt16 __EXPORT SvxRotateModeItem::GetValueCount() const 123 { 124 return 4; // STANDARD, TOP, CENTER, BOTTOM 125 } 126 127 SfxPoolItem* __EXPORT SvxRotateModeItem::Clone( SfxItemPool* ) const 128 { 129 return new SvxRotateModeItem( *this ); 130 } 131 132 sal_uInt16 __EXPORT SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const 133 { 134 return 0; 135 } 136 137 // QueryValue/PutValue: Der ::com::sun::star::table::CellVertJustify enum wird mitbenutzt... 138 139 sal_Bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 140 { 141 table::CellVertJustify eUno = table::CellVertJustify_STANDARD; 142 switch ( (SvxRotateMode)GetValue() ) 143 { 144 case SVX_ROTATE_MODE_STANDARD: eUno = table::CellVertJustify_STANDARD; break; 145 case SVX_ROTATE_MODE_TOP: eUno = table::CellVertJustify_TOP; break; 146 case SVX_ROTATE_MODE_CENTER: eUno = table::CellVertJustify_CENTER; break; 147 case SVX_ROTATE_MODE_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break; 148 } 149 rVal <<= eUno; 150 return sal_True; 151 } 152 153 sal_Bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 154 { 155 table::CellVertJustify eUno; 156 if(!(rVal >>= eUno)) 157 { 158 sal_Int32 nValue = 0; 159 if(!(rVal >>= nValue)) 160 return sal_False; 161 eUno = (table::CellVertJustify)nValue; 162 } 163 164 SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD; 165 switch (eUno) 166 { 167 case table::CellVertJustify_STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break; 168 case table::CellVertJustify_TOP: eSvx = SVX_ROTATE_MODE_TOP; break; 169 case table::CellVertJustify_CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break; 170 case table::CellVertJustify_BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break; 171 default: ;//prevent warning 172 } 173 SetValue( (sal_uInt16)eSvx ); 174 return sal_True; 175 } 176 177 178 179