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