Line data Source code
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 <tools/stream.hxx>
21 : #include <com/sun/star/table/BorderLine.hpp>
22 : #include <com/sun/star/table/CellVertJustify2.hpp>
23 : #include <com/sun/star/table/ShadowLocation.hpp>
24 : #include <com/sun/star/table/TableBorder.hpp>
25 : #include <com/sun/star/table/ShadowFormat.hpp>
26 : #include <com/sun/star/table/CellRangeAddress.hpp>
27 : #include <com/sun/star/table/CellContentType.hpp>
28 : #include <com/sun/star/table/TableOrientation.hpp>
29 : #include <com/sun/star/util/SortField.hpp>
30 : #include <com/sun/star/util/SortFieldType.hpp>
31 : #include <com/sun/star/table/CellOrientation.hpp>
32 : #include <com/sun/star/table/CellAddress.hpp>
33 :
34 : #include "svx/rotmodit.hxx"
35 :
36 : using namespace ::rtl;
37 : using namespace ::com::sun::star;
38 :
39 : // STATIC DATA -----------------------------------------------------------
40 :
41 0 : TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0));
42 :
43 :
44 :
45 : // SvxRotateModeItem - Ausrichtung bei gedrehtem Text
46 :
47 :
48 0 : SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich )
49 0 : : SfxEnumItem( _nWhich, (sal_uInt16)eMode )
50 : {
51 0 : }
52 :
53 0 : SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
54 0 : : SfxEnumItem( rItem )
55 : {
56 0 : }
57 :
58 0 : SvxRotateModeItem::~SvxRotateModeItem()
59 : {
60 0 : }
61 :
62 0 : SfxPoolItem* SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const
63 : {
64 : sal_uInt16 nVal;
65 0 : rStream.ReadUInt16( nVal );
66 0 : return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() );
67 : }
68 :
69 0 : SfxItemPresentation SvxRotateModeItem::GetPresentation(
70 : SfxItemPresentation ePres,
71 : SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
72 : OUString& rText, const IntlWrapper * ) const
73 : {
74 0 : rText = "";
75 :
76 0 : switch ( ePres )
77 : {
78 : case SFX_ITEM_PRESENTATION_COMPLETE:
79 0 : rText += "...: ";
80 : // break; // DURCHFALLEN!!!
81 :
82 : case SFX_ITEM_PRESENTATION_NAMELESS:
83 0 : rText += OUString( GetValue() );
84 0 : break;
85 : default: ;//prevent warning
86 : }
87 :
88 0 : return ePres;
89 : }
90 :
91 0 : OUString SvxRotateModeItem::GetValueText( sal_uInt16 nVal ) const
92 : {
93 0 : OUString aText;
94 :
95 0 : switch ( nVal )
96 : {
97 : case SVX_ROTATE_MODE_STANDARD:
98 : case SVX_ROTATE_MODE_TOP:
99 : case SVX_ROTATE_MODE_CENTER:
100 : case SVX_ROTATE_MODE_BOTTOM:
101 0 : aText = "...";
102 0 : break;
103 : default:
104 : OSL_FAIL("SvxRotateModeItem: falscher enum");
105 0 : break;
106 : }
107 0 : return aText;
108 : }
109 :
110 0 : sal_uInt16 SvxRotateModeItem::GetValueCount() const
111 : {
112 0 : return 4; // STANDARD, TOP, CENTER, BOTTOM
113 : }
114 :
115 0 : SfxPoolItem* SvxRotateModeItem::Clone( SfxItemPool* ) const
116 : {
117 0 : return new SvxRotateModeItem( *this );
118 : }
119 :
120 0 : sal_uInt16 SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
121 : {
122 0 : return 0;
123 : }
124 :
125 0 : bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
126 : {
127 0 : sal_Int32 nUno = table::CellVertJustify2::STANDARD;
128 0 : switch ( (SvxRotateMode)GetValue() )
129 : {
130 0 : case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
131 0 : case SVX_ROTATE_MODE_TOP: nUno = table::CellVertJustify2::TOP; break;
132 0 : case SVX_ROTATE_MODE_CENTER: nUno = table::CellVertJustify2::CENTER; break;
133 0 : case SVX_ROTATE_MODE_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break;
134 : }
135 0 : rVal <<= nUno;
136 0 : return true;
137 : }
138 :
139 0 : bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
140 : {
141 0 : sal_Int32 nUno(0);
142 0 : if(!(rVal >>= nUno))
143 : {
144 0 : nUno = table::CellVertJustify2::STANDARD;
145 : }
146 :
147 0 : SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
148 0 : switch (nUno)
149 : {
150 0 : case table::CellVertJustify2::STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
151 0 : case table::CellVertJustify2::TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
152 0 : case table::CellVertJustify2::CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
153 0 : case table::CellVertJustify2::BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
154 : default: ;//prevent warning
155 : }
156 0 : SetValue( (sal_uInt16)eSvx );
157 0 : return true;
158 : }
159 :
160 :
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|