1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f6e50924SAndrew Rist * distributed with this work for additional information
6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10*f6e50924SAndrew Rist *
11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist *
13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17*f6e50924SAndrew Rist * specific language governing permissions and limitations
18*f6e50924SAndrew Rist * under the License.
19*f6e50924SAndrew Rist *
20*f6e50924SAndrew Rist *************************************************************/
21*f6e50924SAndrew Rist
22*f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <tools/stream.hxx>
27cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
28cdf0e10cSrcweir #include <com/sun/star/table/CellVertJustify.hpp>
29cdf0e10cSrcweir #include <com/sun/star/table/ShadowLocation.hpp>
30cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp>
31cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp>
32cdf0e10cSrcweir #include <com/sun/star/table/CellRangeAddress.hpp>
33cdf0e10cSrcweir #include <com/sun/star/table/CellContentType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/table/TableOrientation.hpp>
35cdf0e10cSrcweir #include <com/sun/star/table/CellHoriJustify.hpp>
36cdf0e10cSrcweir #include <com/sun/star/util/SortField.hpp>
37cdf0e10cSrcweir #include <com/sun/star/util/SortFieldType.hpp>
38cdf0e10cSrcweir #include <com/sun/star/table/CellOrientation.hpp>
39cdf0e10cSrcweir #include <com/sun/star/table/CellAddress.hpp>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include "svx/rotmodit.hxx"
42cdf0e10cSrcweir
43cdf0e10cSrcweir using namespace ::rtl;
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir
46cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
47cdf0e10cSrcweir
48cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0));
49cdf0e10cSrcweir
50cdf0e10cSrcweir
51cdf0e10cSrcweir //-----------------------------------------------------------------------
52cdf0e10cSrcweir // SvxRotateModeItem - Ausrichtung bei gedrehtem Text
53cdf0e10cSrcweir //-----------------------------------------------------------------------
54cdf0e10cSrcweir
SvxRotateModeItem(SvxRotateMode eMode,sal_uInt16 _nWhich)55cdf0e10cSrcweir SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich )
56cdf0e10cSrcweir : SfxEnumItem( _nWhich, (sal_uInt16)eMode )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir }
59cdf0e10cSrcweir
SvxRotateModeItem(const SvxRotateModeItem & rItem)60cdf0e10cSrcweir SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
61cdf0e10cSrcweir : SfxEnumItem( rItem )
62cdf0e10cSrcweir {
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
~SvxRotateModeItem()65cdf0e10cSrcweir __EXPORT SvxRotateModeItem::~SvxRotateModeItem()
66cdf0e10cSrcweir {
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
Create(SvStream & rStream,sal_uInt16) const69cdf0e10cSrcweir SfxPoolItem* __EXPORT SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const
70cdf0e10cSrcweir {
71cdf0e10cSrcweir sal_uInt16 nVal;
72cdf0e10cSrcweir rStream >> nVal;
73cdf0e10cSrcweir return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() );
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const76cdf0e10cSrcweir SfxItemPresentation __EXPORT SvxRotateModeItem::GetPresentation(
77cdf0e10cSrcweir SfxItemPresentation ePres,
78cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
79cdf0e10cSrcweir String& rText, const IntlWrapper * ) const
80cdf0e10cSrcweir {
81cdf0e10cSrcweir rText.Erase();
82cdf0e10cSrcweir
83cdf0e10cSrcweir switch ( ePres )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE:
86cdf0e10cSrcweir rText.AppendAscii("...");
87cdf0e10cSrcweir rText.AppendAscii(": ");
88cdf0e10cSrcweir // break; // DURCHFALLEN!!!
89cdf0e10cSrcweir
90cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS:
91cdf0e10cSrcweir rText += UniString::CreateFromInt32( GetValue() );
92cdf0e10cSrcweir break;
93cdf0e10cSrcweir default: ;//prevent warning
94cdf0e10cSrcweir }
95cdf0e10cSrcweir
96cdf0e10cSrcweir return ePres;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
GetValueText(sal_uInt16 nVal) const99cdf0e10cSrcweir String __EXPORT SvxRotateModeItem::GetValueText( sal_uInt16 nVal ) const
100cdf0e10cSrcweir {
101cdf0e10cSrcweir String aText;
102cdf0e10cSrcweir
103cdf0e10cSrcweir switch ( nVal )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir case SVX_ROTATE_MODE_STANDARD:
106cdf0e10cSrcweir case SVX_ROTATE_MODE_TOP:
107cdf0e10cSrcweir case SVX_ROTATE_MODE_CENTER:
108cdf0e10cSrcweir case SVX_ROTATE_MODE_BOTTOM:
109cdf0e10cSrcweir aText.AppendAscii("...");
110cdf0e10cSrcweir break;
111cdf0e10cSrcweir default:
112cdf0e10cSrcweir DBG_ERROR("SvxRotateModeItem: falscher enum");
113cdf0e10cSrcweir break;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir return aText;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
GetValueCount() const118cdf0e10cSrcweir sal_uInt16 __EXPORT SvxRotateModeItem::GetValueCount() const
119cdf0e10cSrcweir {
120cdf0e10cSrcweir return 4; // STANDARD, TOP, CENTER, BOTTOM
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
Clone(SfxItemPool *) const123cdf0e10cSrcweir SfxPoolItem* __EXPORT SvxRotateModeItem::Clone( SfxItemPool* ) const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir return new SvxRotateModeItem( *this );
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
GetVersion(sal_uInt16) const128cdf0e10cSrcweir sal_uInt16 __EXPORT SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
129cdf0e10cSrcweir {
130cdf0e10cSrcweir return 0;
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir // QueryValue/PutValue: Der ::com::sun::star::table::CellVertJustify enum wird mitbenutzt...
134cdf0e10cSrcweir
QueryValue(uno::Any & rVal,sal_uInt8) const135cdf0e10cSrcweir sal_Bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
136cdf0e10cSrcweir {
137cdf0e10cSrcweir table::CellVertJustify eUno = table::CellVertJustify_STANDARD;
138cdf0e10cSrcweir switch ( (SvxRotateMode)GetValue() )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir case SVX_ROTATE_MODE_STANDARD: eUno = table::CellVertJustify_STANDARD; break;
141cdf0e10cSrcweir case SVX_ROTATE_MODE_TOP: eUno = table::CellVertJustify_TOP; break;
142cdf0e10cSrcweir case SVX_ROTATE_MODE_CENTER: eUno = table::CellVertJustify_CENTER; break;
143cdf0e10cSrcweir case SVX_ROTATE_MODE_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break;
144cdf0e10cSrcweir }
145cdf0e10cSrcweir rVal <<= eUno;
146cdf0e10cSrcweir return sal_True;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
PutValue(const uno::Any & rVal,sal_uInt8)149cdf0e10cSrcweir sal_Bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir table::CellVertJustify eUno;
152cdf0e10cSrcweir if(!(rVal >>= eUno))
153cdf0e10cSrcweir {
154cdf0e10cSrcweir sal_Int32 nValue = 0;
155cdf0e10cSrcweir if(!(rVal >>= nValue))
156cdf0e10cSrcweir return sal_False;
157cdf0e10cSrcweir eUno = (table::CellVertJustify)nValue;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
161cdf0e10cSrcweir switch (eUno)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir case table::CellVertJustify_STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
164cdf0e10cSrcweir case table::CellVertJustify_TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
165cdf0e10cSrcweir case table::CellVertJustify_CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
166cdf0e10cSrcweir case table::CellVertJustify_BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
167cdf0e10cSrcweir default: ;//prevent warning
168cdf0e10cSrcweir }
169cdf0e10cSrcweir SetValue( (sal_uInt16)eSvx );
170cdf0e10cSrcweir return sal_True;
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir
174cdf0e10cSrcweir
175