1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "lotfntbf.hxx"
22 #include "scitems.hxx"
23 #include <editeng/contouritem.hxx>
24 #include <editeng/crossedoutitem.hxx>
25 #include <editeng/eeitem.hxx>
26 #include <editeng/postitem.hxx>
27 #include <editeng/shdditem.hxx>
28 #include <editeng/escapementitem.hxx>
29 #include <editeng/udlnitem.hxx>
30 #include <editeng/wghtitem.hxx>
31 #include <sfx2/printer.hxx>
34 #include "document.hxx"
36 #include "docpool.hxx"
37 #include "patattr.hxx"
40 void LotusFontBuffer::Fill( const sal_uInt8 nIndex
, SfxItemSet
& rItemSet
)
42 sal_uInt8 nIntIndex
= nIndex
& 0x07;
44 ENTRY
* pAkt
= pData
+ nIntIndex
;
47 rItemSet
.Put( *pAkt
->pFont
);
50 rItemSet
.Put( *pAkt
->pHeight
);
53 rItemSet
.Put( *pAkt
->pColor
);
57 SvxWeightItem
aWeightItem( WEIGHT_BOLD
, ATTR_FONT_WEIGHT
);
58 rItemSet
.Put( aWeightItem
);
63 SvxPostureItem
aAttr( ITALIC_NORMAL
, ATTR_FONT_POSTURE
);
64 rItemSet
.Put( aAttr
);
67 FontUnderline eUnderline
;
68 switch( nIndex
& 0x60 ) // Bit 5+6
71 case 0x20: eUnderline
= UNDERLINE_SINGLE
; break;
72 case 0x40: eUnderline
= UNDERLINE_DOUBLE
; break;
73 default: eUnderline
= UNDERLINE_NONE
;
75 if( eUnderline
!= UNDERLINE_NONE
)
77 SvxUnderlineItem
aUndItem( eUnderline
, ATTR_FONT_UNDERLINE
);
78 rItemSet
.Put( aUndItem
);
82 void LotusFontBuffer::SetName( const sal_uInt16 nIndex
, const OUString
& rName
)
84 OSL_ENSURE( nIndex
< nSize
, "*LotusFontBuffer::SetName(): Array too small!" );
87 ENTRY
* pEntry
= pData
+ nIndex
;
88 pEntry
->TmpName( rName
);
90 if( pEntry
->nType
>= 0 )
95 void LotusFontBuffer::SetHeight( const sal_uInt16 nIndex
, const sal_uInt16 nHeight
)
97 OSL_ENSURE( nIndex
< nSize
, "*LotusFontBuffer::SetHeight(): Array too small!" );
99 pData
[ nIndex
].Height( *( new SvxFontHeightItem( ( sal_uLong
) nHeight
* 20, 100, ATTR_FONT_HEIGHT
) ) );
102 void LotusFontBuffer::SetType( const sal_uInt16 nIndex
, const sal_uInt16 nType
)
104 OSL_ENSURE( nIndex
< nSize
, "*LotusFontBuffer::SetType(): Array too small!" );
107 ENTRY
* pEntry
= pData
+ nIndex
;
108 pEntry
->Type( nType
);
110 if( pEntry
->pTmpName
)
115 void LotusFontBuffer::MakeFont( ENTRY
* pEntry
)
117 FontFamily eFamily
= FAMILY_DONTKNOW
;
118 FontPitch ePitch
= PITCH_DONTKNOW
;
119 rtl_TextEncoding eCharSet
= RTL_TEXTENCODING_DONTKNOW
;
121 switch( pEntry
->nType
)
123 case 0x00: // Helvetica
124 eFamily
= FAMILY_SWISS
;
125 ePitch
= PITCH_VARIABLE
;
127 case 0x01: // Times Roman
128 eFamily
= FAMILY_ROMAN
;
129 ePitch
= PITCH_VARIABLE
;
131 case 0x02: // Courier
132 ePitch
= PITCH_FIXED
;
135 eCharSet
= RTL_TEXTENCODING_SYMBOL
;
139 pEntry
->pFont
= new SvxFontItem( eFamily
, *pEntry
->pTmpName
, EMPTY_OUSTRING
, ePitch
, eCharSet
, ATTR_FONT
);
141 delete pEntry
->pTmpName
;
142 pEntry
->pTmpName
= NULL
;
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */