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