xref: /aoo41x/main/editeng/source/rtf/rtfgrf.cxx (revision 190118d0)
1*190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*190118d0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*190118d0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*190118d0SAndrew Rist  * distributed with this work for additional information
6*190118d0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*190118d0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*190118d0SAndrew Rist  * "License"); you may not use this file except in compliance
9*190118d0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*190118d0SAndrew Rist  *
11*190118d0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*190118d0SAndrew Rist  *
13*190118d0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*190118d0SAndrew Rist  * software distributed under the License is distributed on an
15*190118d0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*190118d0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*190118d0SAndrew Rist  * specific language governing permissions and limitations
18*190118d0SAndrew Rist  * under the License.
19*190118d0SAndrew Rist  *
20*190118d0SAndrew Rist  *************************************************************/
21*190118d0SAndrew Rist 
22*190118d0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_editeng.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
28cdf0e10cSrcweir #include <osl/endian.h>
29cdf0e10cSrcweir #include <tools/cachestr.hxx>
30cdf0e10cSrcweir #include <vcl/graph.hxx>
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir #include <svtools/rtfkeywd.hxx>
33cdf0e10cSrcweir #include <svtools/rtftoken.h>
34cdf0e10cSrcweir #include <svtools/filter.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <editeng/svxrtf.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir using namespace ::rtl;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #ifndef DBG_UTIL
41cdf0e10cSrcweir #undef DEBUG_JP
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #ifdef DEBUG_JP
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include <tools/fsys.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class GrfWindow : public WorkWindow
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	Graphic aGrf;
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir 	GrfWindow( const Graphic& rGrf );
53cdf0e10cSrcweir 	virtual void    Paint( const Rectangle& rRect );
54cdf0e10cSrcweir };
55cdf0e10cSrcweir 
GrfWindow(const Graphic & rGrf)56cdf0e10cSrcweir GrfWindow::GrfWindow( const Graphic& rGrf )
57cdf0e10cSrcweir 	: WorkWindow( NULL ),
58cdf0e10cSrcweir 	aGrf( rGrf )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	SetPosSizePixel( Point( 100, 0 ), Size( 300, 300 ));
61cdf0e10cSrcweir 	Show();
62cdf0e10cSrcweir 	Invalidate();
63cdf0e10cSrcweir 	Update();
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
Paint(const Rectangle &)66cdf0e10cSrcweir void GrfWindow::Paint( const Rectangle& )
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	aGrf.Draw( this, Point(0,0), GetSizePixel() );
69cdf0e10cSrcweir }
70cdf0e10cSrcweir #endif
71cdf0e10cSrcweir 
72cdf0e10cSrcweir static sal_uInt8 __FAR_DATA aPal1[ 2 * 4 ] = {
73cdf0e10cSrcweir 		0x00, 0x00, 0x00, 0x00,				// Schwarz
74cdf0e10cSrcweir 		0xFF, 0xFF, 0xFF, 0x00				// Weiss
75cdf0e10cSrcweir };
76cdf0e10cSrcweir 
77cdf0e10cSrcweir static sal_uInt8 __FAR_DATA aPal4[ 16 * 4 ] = {
78cdf0e10cSrcweir 		0x00, 0x00, 0x00, 0x00,
79cdf0e10cSrcweir 		0x80, 0x00, 0x00, 0x00,
80cdf0e10cSrcweir 		0x00, 0x80, 0x00, 0x00,
81cdf0e10cSrcweir 		0x80, 0x80, 0x00, 0x00,
82cdf0e10cSrcweir 		0x00, 0x00, 0x80, 0x00,
83cdf0e10cSrcweir 		0x80, 0x00, 0x80, 0x00,
84cdf0e10cSrcweir 		0x00, 0x80, 0x80, 0x00,
85cdf0e10cSrcweir 		0x80, 0x80, 0x80, 0x00,
86cdf0e10cSrcweir 		0xC0, 0xC0, 0xC0, 0x00,
87cdf0e10cSrcweir 		0xFF, 0x00, 0x00, 0x00,
88cdf0e10cSrcweir 		0x00, 0xFF, 0x00, 0x00,
89cdf0e10cSrcweir 		0xFF, 0xFF, 0x00, 0x00,
90cdf0e10cSrcweir 		0x00, 0x00, 0xFF, 0x00,
91cdf0e10cSrcweir 		0xFF, 0x00, 0xFF, 0x00,
92cdf0e10cSrcweir 		0x00, 0xFF, 0xFF, 0x00,
93cdf0e10cSrcweir 		0xFF, 0xFF, 0xFF, 0x00
94cdf0e10cSrcweir };
95cdf0e10cSrcweir 
96cdf0e10cSrcweir static sal_uInt8 __FAR_DATA aPal8[ 256 * 4 ] =
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 0x00, 0x00, 0x00, 0x00,   0x80, 0x00, 0x00, 0x00,   0x00, 0x92, 0x00, 0x00,
99cdf0e10cSrcweir 0x80, 0x92, 0x00, 0x00,   0x00, 0x00, 0xAA, 0x00,   0x80, 0x00, 0xAA, 0x00,
100cdf0e10cSrcweir 0x00, 0x92, 0xAA, 0x00,   0xC1, 0xC1, 0xC1, 0x00,   0xC9, 0xC9, 0xC9, 0x00,
101cdf0e10cSrcweir 0xAA, 0xDB, 0xFF, 0x00,   0x00, 0x49, 0xAA, 0x00,   0x00, 0x49, 0xFF, 0x00,
102cdf0e10cSrcweir 0x00, 0x6D, 0x00, 0x00,   0x00, 0x6D, 0x55, 0x00,   0x00, 0x6D, 0xAA, 0x00,
103cdf0e10cSrcweir 0x00, 0x6D, 0xFF, 0x00,   0x00, 0x24, 0x00, 0x00,   0x00, 0x92, 0x55, 0x00,
104cdf0e10cSrcweir 0x00, 0x24, 0xAA, 0x00,   0x00, 0x92, 0xFF, 0x00,   0x00, 0xB6, 0x00, 0x00,
105cdf0e10cSrcweir 0x00, 0xB6, 0x55, 0x00,   0x00, 0xB6, 0xAA, 0x00,   0x00, 0xB6, 0xFF, 0x00,
106cdf0e10cSrcweir 0x00, 0xDB, 0x00, 0x00,   0x00, 0xDB, 0x55, 0x00,   0x00, 0xDB, 0xAA, 0x00,
107cdf0e10cSrcweir 0x00, 0xDB, 0xFF, 0x00,   0xFF, 0xDB, 0xAA, 0x00,   0x00, 0xFF, 0x55, 0x00,
108cdf0e10cSrcweir 0x00, 0xFF, 0xAA, 0x00,   0xFF, 0xFF, 0xAA, 0x00,   0x2B, 0x00, 0x00, 0x00,
109cdf0e10cSrcweir 0x2B, 0x00, 0x55, 0x00,   0x2B, 0x00, 0xAA, 0x00,   0x2B, 0x00, 0xFF, 0x00,
110cdf0e10cSrcweir 0x2B, 0x24, 0x00, 0x00,   0x2B, 0x24, 0x55, 0x00,   0x2B, 0x24, 0xAA, 0x00,
111cdf0e10cSrcweir 0x2B, 0x24, 0xFF, 0x00,   0x2B, 0x49, 0x00, 0x00,   0x2B, 0x49, 0x55, 0x00,
112cdf0e10cSrcweir 0x2B, 0x49, 0xAA, 0x00,   0x2B, 0x49, 0xFF, 0x00,   0x2B, 0x6D, 0x00, 0x00,
113cdf0e10cSrcweir 0x2B, 0x6D, 0x55, 0x00,   0x2B, 0x6D, 0xAA, 0x00,   0x2B, 0x6D, 0xFF, 0x00,
114cdf0e10cSrcweir 0x2B, 0x92, 0x00, 0x00,   0x2B, 0x92, 0x55, 0x00,   0x2B, 0x92, 0xAA, 0x00,
115cdf0e10cSrcweir 0x2B, 0x92, 0xFF, 0x00,   0x2B, 0xB6, 0x00, 0x00,   0x2B, 0xB6, 0x55, 0x00,
116cdf0e10cSrcweir 0x2B, 0xB6, 0xAA, 0x00,   0x2B, 0xB6, 0xFF, 0x00,   0x2B, 0xDB, 0x00, 0x00,
117cdf0e10cSrcweir 0x2B, 0xDB, 0x55, 0x00,   0x2B, 0xDB, 0xAA, 0x00,   0x2B, 0xDB, 0xFF, 0x00,
118cdf0e10cSrcweir 0x2B, 0xFF, 0x00, 0x00,   0x2B, 0xFF, 0x55, 0x00,   0x2B, 0xFF, 0xAA, 0x00,
119cdf0e10cSrcweir 0x2B, 0xFF, 0xFF, 0x00,   0x55, 0x00, 0x00, 0x00,   0x55, 0x00, 0x55, 0x00,
120cdf0e10cSrcweir 0x55, 0x00, 0xAA, 0x00,   0x55, 0x00, 0xFF, 0x00,   0x55, 0x24, 0x00, 0x00,
121cdf0e10cSrcweir 0x55, 0x24, 0x55, 0x00,   0x55, 0x24, 0xAA, 0x00,   0x55, 0x24, 0xFF, 0x00,
122cdf0e10cSrcweir 0x55, 0x49, 0x00, 0x00,   0x55, 0x49, 0x55, 0x00,   0x55, 0x49, 0xAA, 0x00,
123cdf0e10cSrcweir 0x55, 0x49, 0xFF, 0x00,   0x55, 0x6D, 0x00, 0x00,   0x55, 0x6D, 0x55, 0x00,
124cdf0e10cSrcweir 0x55, 0x6D, 0xAA, 0x00,   0x55, 0x6D, 0xFF, 0x00,   0x55, 0x92, 0x00, 0x00,
125cdf0e10cSrcweir 0x55, 0x92, 0x55, 0x00,   0x55, 0x92, 0xAA, 0x00,   0x55, 0x92, 0xFF, 0x00,
126cdf0e10cSrcweir 0x55, 0xB6, 0x00, 0x00,   0x55, 0xB6, 0x55, 0x00,   0x55, 0xB6, 0xAA, 0x00,
127cdf0e10cSrcweir 0x55, 0xB6, 0xFF, 0x00,   0x55, 0xDB, 0x00, 0x00,   0x55, 0xDB, 0x55, 0x00,
128cdf0e10cSrcweir 0x55, 0xDB, 0xAA, 0x00,   0x55, 0xDB, 0xFF, 0x00,   0x55, 0xFF, 0x00, 0x00,
129cdf0e10cSrcweir 0x55, 0xFF, 0x55, 0x00,   0x55, 0xFF, 0xAA, 0x00,   0x55, 0xFF, 0xFF, 0x00,
130cdf0e10cSrcweir 0x00, 0x00, 0x55, 0x00,   0x80, 0x00, 0x55, 0x00,   0x00, 0x24, 0x55, 0x00,
131cdf0e10cSrcweir 0x80, 0x00, 0xFF, 0x00,   0x80, 0x24, 0x00, 0x00,   0x80, 0x24, 0x55, 0x00,
132cdf0e10cSrcweir 0x80, 0x24, 0xAA, 0x00,   0x80, 0x24, 0xFF, 0x00,   0x80, 0x49, 0x00, 0x00,
133cdf0e10cSrcweir 0x80, 0x49, 0x55, 0x00,   0x80, 0x49, 0xAA, 0x00,   0x80, 0x49, 0xFF, 0x00,
134cdf0e10cSrcweir 0x80, 0x6D, 0x00, 0x00,   0x80, 0x6D, 0x55, 0x00,   0x80, 0x6D, 0xAA, 0x00,
135cdf0e10cSrcweir 0x80, 0x6D, 0xFF, 0x00,   0x08, 0x08, 0x08, 0x00,   0x0F, 0x0F, 0x0F, 0x00,
136cdf0e10cSrcweir 0x17, 0x17, 0x17, 0x00,   0x1F, 0x1F, 0x1F, 0x00,   0x27, 0x27, 0x27, 0x00,
137cdf0e10cSrcweir 0x2E, 0x2E, 0x2E, 0x00,   0x36, 0x36, 0x36, 0x00,   0x3E, 0x3E, 0x3E, 0x00,
138cdf0e10cSrcweir 0x46, 0x46, 0x46, 0x00,   0x4D, 0x4D, 0x4D, 0x00,   0x55, 0x55, 0x55, 0x00,
139cdf0e10cSrcweir 0x5D, 0x5D, 0x5D, 0x00,   0x64, 0x64, 0x64, 0x00,   0x6C, 0x6C, 0x6C, 0x00,
140cdf0e10cSrcweir 0x74, 0x74, 0x74, 0x00,   0x7C, 0x7C, 0x7C, 0x00,   0xFF, 0xDB, 0x00, 0x00,
141cdf0e10cSrcweir 0x8B, 0x8B, 0x8B, 0x00,   0x93, 0x93, 0x93, 0x00,   0x9B, 0x9B, 0x9B, 0x00,
142cdf0e10cSrcweir 0xFF, 0xB6, 0xFF, 0x00,   0xAA, 0xAA, 0xAA, 0x00,   0xB2, 0xB2, 0xB2, 0x00,
143cdf0e10cSrcweir 0xB9, 0xB9, 0xB9, 0x00,   0x00, 0x24, 0xFF, 0x00,   0x00, 0x49, 0x00, 0x00,
144cdf0e10cSrcweir 0xD1, 0xD1, 0xD1, 0x00,   0xD8, 0xD8, 0xD8, 0x00,   0xE0, 0xE0, 0xE0, 0x00,
145cdf0e10cSrcweir 0xE8, 0xE8, 0xE8, 0x00,   0xF0, 0xF0, 0xF0, 0x00,   0xFF, 0xB6, 0xAA, 0x00,
146cdf0e10cSrcweir 0xFF, 0xDB, 0xFF, 0x00,   0x80, 0x92, 0x55, 0x00,   0x80, 0x92, 0xAA, 0x00,
147cdf0e10cSrcweir 0x80, 0x92, 0xFF, 0x00,   0x80, 0xB6, 0x00, 0x00,   0x80, 0xB6, 0x55, 0x00,
148cdf0e10cSrcweir 0x80, 0xB6, 0xAA, 0x00,   0x80, 0xB6, 0xFF, 0x00,   0x80, 0xDB, 0x00, 0x00,
149cdf0e10cSrcweir 0x80, 0xDB, 0x55, 0x00,   0x80, 0xDB, 0xAA, 0x00,   0x80, 0xDB, 0xFF, 0x00,
150cdf0e10cSrcweir 0x80, 0xFF, 0x00, 0x00,   0x80, 0xFF, 0x55, 0x00,   0x80, 0xFF, 0xAA, 0x00,
151cdf0e10cSrcweir 0x80, 0xFF, 0xFF, 0x00,   0xAA, 0x00, 0x00, 0x00,   0xAA, 0x00, 0x55, 0x00,
152cdf0e10cSrcweir 0xAA, 0x00, 0xAA, 0x00,   0xAA, 0x00, 0xFF, 0x00,   0xAA, 0x24, 0x00, 0x00,
153cdf0e10cSrcweir 0xAA, 0x24, 0x55, 0x00,   0xAA, 0x24, 0xAA, 0x00,   0xAA, 0x24, 0xFF, 0x00,
154cdf0e10cSrcweir 0xAA, 0x49, 0x00, 0x00,   0xAA, 0x49, 0x55, 0x00,   0xAA, 0x49, 0xAA, 0x00,
155cdf0e10cSrcweir 0xAA, 0x49, 0xFF, 0x00,   0xAA, 0x6D, 0x00, 0x00,   0xAA, 0x6D, 0x55, 0x00,
156cdf0e10cSrcweir 0xAA, 0x6D, 0xAA, 0x00,   0xAA, 0x6D, 0xFF, 0x00,   0xAA, 0x92, 0x00, 0x00,
157cdf0e10cSrcweir 0xAA, 0x92, 0x55, 0x00,   0xAA, 0x92, 0xAA, 0x00,   0xAA, 0x92, 0xFF, 0x00,
158cdf0e10cSrcweir 0xAA, 0xB6, 0x00, 0x00,   0xAA, 0xB6, 0x55, 0x00,   0xAA, 0xB6, 0xAA, 0x00,
159cdf0e10cSrcweir 0xAA, 0xB6, 0xFF, 0x00,   0xAA, 0xDB, 0x00, 0x00,   0xAA, 0xDB, 0x55, 0x00,
160cdf0e10cSrcweir 0xAA, 0xDB, 0xAA, 0x00,   0x00, 0x49, 0x55, 0x00,   0xAA, 0xFF, 0x00, 0x00,
161cdf0e10cSrcweir 0xAA, 0xFF, 0x55, 0x00,   0xAA, 0xFF, 0xAA, 0x00,   0xAA, 0xFF, 0xFF, 0x00,
162cdf0e10cSrcweir 0xD5, 0x00, 0x00, 0x00,   0xD5, 0x00, 0x55, 0x00,   0xD5, 0x00, 0xAA, 0x00,
163cdf0e10cSrcweir 0xD5, 0x00, 0xFF, 0x00,   0xD5, 0x24, 0x00, 0x00,   0xD5, 0x24, 0x55, 0x00,
164cdf0e10cSrcweir 0xD5, 0x24, 0xAA, 0x00,   0xD5, 0x24, 0xFF, 0x00,   0xD5, 0x49, 0x00, 0x00,
165cdf0e10cSrcweir 0xD5, 0x49, 0x55, 0x00,   0xD5, 0x49, 0xAA, 0x00,   0xD5, 0x49, 0xFF, 0x00,
166cdf0e10cSrcweir 0xD5, 0x6D, 0x00, 0x00,   0xD5, 0x6D, 0x55, 0x00,   0xD5, 0x6D, 0xAA, 0x00,
167cdf0e10cSrcweir 0xD5, 0x6D, 0xFF, 0x00,   0xD5, 0x92, 0x00, 0x00,   0xD5, 0x92, 0x55, 0x00,
168cdf0e10cSrcweir 0xD5, 0x92, 0xAA, 0x00,   0xD5, 0x92, 0xFF, 0x00,   0xD5, 0xB6, 0x00, 0x00,
169cdf0e10cSrcweir 0xD5, 0xB6, 0x55, 0x00,   0xD5, 0xB6, 0xAA, 0x00,   0xD5, 0xB6, 0xFF, 0x00,
170cdf0e10cSrcweir 0xD5, 0xDB, 0x00, 0x00,   0xD5, 0xDB, 0x55, 0x00,   0xD5, 0xDB, 0xAA, 0x00,
171cdf0e10cSrcweir 0xD5, 0xDB, 0xFF, 0x00,   0xD5, 0xFF, 0x00, 0x00,   0xD5, 0xFF, 0x55, 0x00,
172cdf0e10cSrcweir 0xD5, 0xFF, 0xAA, 0x00,   0xD5, 0xFF, 0xFF, 0x00,   0xFF, 0xDB, 0x55, 0x00,
173cdf0e10cSrcweir 0xFF, 0x00, 0x55, 0x00,   0xFF, 0x00, 0xAA, 0x00,   0xFF, 0xFF, 0x55, 0x00,
174cdf0e10cSrcweir 0xFF, 0x24, 0x00, 0x00,   0xFF, 0x24, 0x55, 0x00,   0xFF, 0x24, 0xAA, 0x00,
175cdf0e10cSrcweir 0xFF, 0x24, 0xFF, 0x00,   0xFF, 0x49, 0x00, 0x00,   0xFF, 0x49, 0x55, 0x00,
176cdf0e10cSrcweir 0xFF, 0x49, 0xAA, 0x00,   0xFF, 0x49, 0xFF, 0x00,   0xFF, 0x6D, 0x00, 0x00,
177cdf0e10cSrcweir 0xFF, 0x6D, 0x55, 0x00,   0xFF, 0x6D, 0xAA, 0x00,   0xFF, 0x6D, 0xFF, 0x00,
178cdf0e10cSrcweir 0xFF, 0x92, 0x00, 0x00,   0xFF, 0x92, 0x55, 0x00,   0xFF, 0x92, 0xAA, 0x00,
179cdf0e10cSrcweir 0xFF, 0x92, 0xFF, 0x00,   0xFF, 0xB6, 0x00, 0x00,   0xFF, 0xB6, 0x55, 0x00,
180cdf0e10cSrcweir 0xF7, 0xF7, 0xF7, 0x00,   0xA2, 0xA2, 0xA2, 0x00,   0x83, 0x83, 0x83, 0x00,
181cdf0e10cSrcweir 0xFF, 0x00, 0x00, 0x00,   0x00, 0xFF, 0x00, 0x00,   0xFF, 0xFF, 0x00, 0x00,
182cdf0e10cSrcweir 0x00, 0x00, 0xFF, 0x00,   0xFF, 0x00, 0xFF, 0x00,   0x00, 0xFF, 0xFF, 0x00,
183cdf0e10cSrcweir 0xFF, 0xFF, 0xFF, 0x00
184cdf0e10cSrcweir };
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 
187cdf0e10cSrcweir /*  */
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 
SwapLong(long n)190cdf0e10cSrcweir inline long SwapLong( long n )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir #ifndef OSL_LITENDIAN
193cdf0e10cSrcweir 	return SWAPLONG( n );
194cdf0e10cSrcweir #else
195cdf0e10cSrcweir 	return n;
196cdf0e10cSrcweir #endif
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
SwapShort(short n)199cdf0e10cSrcweir inline short SwapShort( short n )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir #ifndef OSL_LITENDIAN
202cdf0e10cSrcweir 	return SWAPSHORT( n );
203cdf0e10cSrcweir #else
204cdf0e10cSrcweir 	return n;
205cdf0e10cSrcweir #endif
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 
WriteBMPHeader(SvStream & rStream,const SvxRTFPictureType & rPicType)209cdf0e10cSrcweir static void WriteBMPHeader( SvStream& rStream,
210cdf0e10cSrcweir 							const SvxRTFPictureType& rPicType )
211cdf0e10cSrcweir {
212cdf0e10cSrcweir 	sal_uInt32 n4Width = rPicType.nWidth;
213cdf0e10cSrcweir 	sal_uInt32 n4Height = rPicType.nHeight;
214cdf0e10cSrcweir 	sal_uInt16 n4ColBits = rPicType.nBitsPerPixel;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	sal_uInt16 nColors = (1 << n4ColBits);	// Anzahl der Farben ( 1, 16, 256 )
217cdf0e10cSrcweir 	sal_uInt16 nWdtOut = rPicType.nWidthBytes;
218cdf0e10cSrcweir 	if( !nWdtOut )
219cdf0e10cSrcweir 		nWdtOut = (sal_uInt16)((( n4Width * n4ColBits + 31 ) / 32 ) * 4 );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	long nOffset = 14 + 40; 	// BMP_FILE_HD_SIZ + sizeof(*pBmpInfo);
222cdf0e10cSrcweir 	if( 256 >= nColors )
223cdf0e10cSrcweir 		nOffset += nColors * 4;
224cdf0e10cSrcweir 	long nSize = nOffset + nWdtOut * n4Height;
225cdf0e10cSrcweir 	rStream << "BM"						// = "BM"
226cdf0e10cSrcweir 			<< SwapLong(nSize)          // Filesize in Bytes
227cdf0e10cSrcweir 			<< SwapShort(0)             // Reserviert
228cdf0e10cSrcweir 			<< SwapShort(0)             // Reserviert
229cdf0e10cSrcweir 			<< SwapLong(nOffset);       // Offset?
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	rStream	<< SwapLong(40)				// sizeof( BmpInfo )
232cdf0e10cSrcweir 			<< SwapLong(n4Width)
233cdf0e10cSrcweir 			<< SwapLong(n4Height)
234cdf0e10cSrcweir 			<< (sal_uInt16)1
235cdf0e10cSrcweir 			<< n4ColBits
236cdf0e10cSrcweir 			<< SwapLong(0)
237cdf0e10cSrcweir 			<< SwapLong(0)
238cdf0e10cSrcweir 			<< SwapLong( rPicType.nGoalWidth
239cdf0e10cSrcweir 						? rPicType.nGoalWidth * 1000L / 254L
240cdf0e10cSrcweir 						: 0 )	      // DPI in Pixel per Meter
241cdf0e10cSrcweir 			<< SwapLong( rPicType.nGoalHeight
242cdf0e10cSrcweir 						? rPicType.nGoalHeight * 1000L / 254L      // dito
243cdf0e10cSrcweir 						: 0 )
244cdf0e10cSrcweir 			<< SwapLong(0)
245cdf0e10cSrcweir 			<< SwapLong(0);
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	switch( rPicType.nBitsPerPixel )
249cdf0e10cSrcweir 	{
250cdf0e10cSrcweir 	case 1:		rStream.Write( aPal1, sizeof( aPal1 ));	break;
251cdf0e10cSrcweir 	case 4:		rStream.Write( aPal4, sizeof( aPal4 ));	break;
252cdf0e10cSrcweir 	case 8:		rStream.Write( aPal8, sizeof( aPal8 ));	break;
253cdf0e10cSrcweir 	}
254cdf0e10cSrcweir }
255cdf0e10cSrcweir 
256cdf0e10cSrcweir /*  */
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 		// wandel die ASCII-HexCodes in binaere Zeichen um. Werden
259cdf0e10cSrcweir 		// ungueltige Daten gefunden (Zeichen ausser 0-9|a-f|A-F, so
260cdf0e10cSrcweir 		// wird USHRT_MAX returnt, ansonsten die Anzahl der umgewandelten Ze.
HexToBin(String & rToken)261cdf0e10cSrcweir xub_StrLen SvxRTFParser::HexToBin( String& rToken )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir 	// dann mache aus den Hex-Werten mal "Binare Daten"
264cdf0e10cSrcweir 	// (missbrauche den String als temp Buffer)
265cdf0e10cSrcweir 	if( rToken.Len() & 1 )		// ungerade Anzahl, mit 0 auffuellen
266cdf0e10cSrcweir 		rToken += '0';
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	xub_StrLen n, nLen;
269cdf0e10cSrcweir 	sal_Unicode nVal;
270cdf0e10cSrcweir 	sal_Bool bValidData = sal_True;
271cdf0e10cSrcweir 	const sal_Unicode* pStr = rToken.GetBufferAccess();
272cdf0e10cSrcweir 	sal_Char* pData = (sal_Char*)pStr;
273cdf0e10cSrcweir 	for( n = 0, nLen = rToken.Len(); n < nLen; ++n, ++pStr )
274cdf0e10cSrcweir 	{
275cdf0e10cSrcweir 		if( ((nVal = *pStr) >= '0') && ( nVal <= '9') )
276cdf0e10cSrcweir 			nVal -= '0';
277cdf0e10cSrcweir 		else if( (nVal >= 'A') && (nVal <= 'F') )
278cdf0e10cSrcweir 			nVal -= 'A' - 10;
279cdf0e10cSrcweir 		else if( (nVal >= 'a') && (nVal <= 'f') )
280cdf0e10cSrcweir 			nVal -= 'a' - 10;
281cdf0e10cSrcweir 		else
282cdf0e10cSrcweir 		{
283cdf0e10cSrcweir 			DBG_ASSERT( !this, "ungueltiger Hex-Wert" );
284cdf0e10cSrcweir 			bValidData = sal_False;
285cdf0e10cSrcweir 			break;
286cdf0e10cSrcweir 		}
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 		if( n & 1 )
289cdf0e10cSrcweir 			*(pData++) |= nVal & 0x0f;
290cdf0e10cSrcweir 		else
291cdf0e10cSrcweir 			*(pData) = sal::static_int_cast< char >( ( nVal << 4 ) & 0xf0 );
292cdf0e10cSrcweir 	}
293cdf0e10cSrcweir 	// the len div 2, because 2 character are one byte
294cdf0e10cSrcweir 	return bValidData ? nLen / 2  : STRING_NOTFOUND;
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
ReadBmpData(Graphic & rGrf,SvxRTFPictureType & rPicType)297cdf0e10cSrcweir sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir 	// die alten Daten loeschen
300cdf0e10cSrcweir 	rGrf.Clear();
301cdf0e10cSrcweir //	sal_uInt32 nBmpSize = 0;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 	rtl_TextEncoding eOldEnc = GetSrcEncoding();
304cdf0e10cSrcweir 	SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 	const sal_Char* pFilterNm = 0;
307cdf0e10cSrcweir 	SvCacheStream* pTmpFile = 0;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	int nToken = 0;
310cdf0e10cSrcweir     bool bValidBmp = true, bFirstTextToken = true;
311cdf0e10cSrcweir 	int _nOpenBrakets = 1,		// die erste wurde schon vorher erkannt !!
312cdf0e10cSrcweir 		nValidDataBraket = 1;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	if( RTF_SHPPICT == GetStackPtr(0)->nTokenId )
315cdf0e10cSrcweir 		++nValidDataBraket;
316cdf0e10cSrcweir     OUString sShapePropertyName, sShapePropertyValue;
317cdf0e10cSrcweir     int nShapePropertyBracket = -1;
318cdf0e10cSrcweir 	while( _nOpenBrakets && IsParserWorking() && bValidBmp )
319cdf0e10cSrcweir 	{
320cdf0e10cSrcweir 		nToken = GetNextToken();
321cdf0e10cSrcweir 		sal_uInt16 nVal = sal_uInt16( nTokenValue );
322cdf0e10cSrcweir 		switch( nToken )
323cdf0e10cSrcweir 		{
324cdf0e10cSrcweir         case '}':
325cdf0e10cSrcweir             --_nOpenBrakets;
326cdf0e10cSrcweir             if( nShapePropertyBracket > 0 && nShapePropertyBracket > _nOpenBrakets )
327cdf0e10cSrcweir             {
328cdf0e10cSrcweir                 nShapePropertyBracket = -1;
329cdf0e10cSrcweir                 if( sShapePropertyName.getLength() )
330cdf0e10cSrcweir                 {
331cdf0e10cSrcweir                     rPicType.aPropertyPairs.push_back( ::std::pair< OUString, OUString >( sShapePropertyName, sShapePropertyValue ) );
332cdf0e10cSrcweir                     sShapePropertyName = sShapePropertyValue = ::rtl::OUString();
333cdf0e10cSrcweir                 }
334cdf0e10cSrcweir             }
335cdf0e10cSrcweir         break;
336cdf0e10cSrcweir 		case '{':
337cdf0e10cSrcweir 			{
338cdf0e10cSrcweir 				if( RTF_IGNOREFLAG != GetNextToken() )
339cdf0e10cSrcweir 					nToken = SkipToken( -1 );
340cdf0e10cSrcweir 				else if( RTF_UNKNOWNCONTROL != GetNextToken() )
341cdf0e10cSrcweir 					nToken = SkipToken( -2 );
342cdf0e10cSrcweir 				else
343cdf0e10cSrcweir 				{
344cdf0e10cSrcweir 					// gleich herausfiltern
345cdf0e10cSrcweir 					ReadUnknownData();
346cdf0e10cSrcweir 					nToken = GetNextToken();
347cdf0e10cSrcweir 					if( '}' != nToken )
348cdf0e10cSrcweir 						eState = SVPAR_ERROR;
349cdf0e10cSrcweir 					break;
350cdf0e10cSrcweir 				}
351cdf0e10cSrcweir 				++_nOpenBrakets;
352cdf0e10cSrcweir 			}
353cdf0e10cSrcweir 			break;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 		case RTF_MACPICT:
356cdf0e10cSrcweir 			{
357cdf0e10cSrcweir 				rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW;
358cdf0e10cSrcweir 				// Mac-Pict bekommt einen leeren Header voran
359cdf0e10cSrcweir 				pTmpFile = new SvCacheStream;
360cdf0e10cSrcweir 				ByteString aStr;
361cdf0e10cSrcweir 				aStr.Fill( 512, '\0' );
362cdf0e10cSrcweir 				pTmpFile->Write( aStr.GetBuffer(), aStr.Len() );
363cdf0e10cSrcweir 				pFilterNm = "PCT";
364cdf0e10cSrcweir 			}
365cdf0e10cSrcweir 			break;
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 		case RTF_EMFBLIP:
368cdf0e10cSrcweir 		case RTF_WMETAFILE:
369cdf0e10cSrcweir 		case RTF_PNGBLIP:
370cdf0e10cSrcweir 		case RTF_JPEGBLIP:
371cdf0e10cSrcweir 		case RTF_WBITMAP:
372cdf0e10cSrcweir 		case RTF_OSMETAFILE:
373cdf0e10cSrcweir 		case RTF_DIBITMAP:
374cdf0e10cSrcweir 			{
375cdf0e10cSrcweir 				switch( nToken )
376cdf0e10cSrcweir 				{
377cdf0e10cSrcweir 				case RTF_EMFBLIP:
378cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::ENHANCED_MF;
379cdf0e10cSrcweir 					pFilterNm = "EMF";
380cdf0e10cSrcweir 					break;
381cdf0e10cSrcweir 				case RTF_WMETAFILE:
382cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::WIN_METAFILE;
383cdf0e10cSrcweir 					pFilterNm = "WMF";
384cdf0e10cSrcweir 					break;
385cdf0e10cSrcweir 				case RTF_PNGBLIP:
386cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::RTF_PNG;
387cdf0e10cSrcweir 					pFilterNm = "PNG";
388cdf0e10cSrcweir 					break;
389cdf0e10cSrcweir 				case RTF_JPEGBLIP:
390cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::RTF_JPG;
391cdf0e10cSrcweir 					pFilterNm = "JPG";
392cdf0e10cSrcweir 					break;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 				case RTF_WBITMAP:
395cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::RTF_BITMAP;
396cdf0e10cSrcweir 					break;
397cdf0e10cSrcweir 				case RTF_OSMETAFILE:
398cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::OS2_METAFILE;
399cdf0e10cSrcweir 					break;
400cdf0e10cSrcweir 				case RTF_DIBITMAP:
401cdf0e10cSrcweir 					rPicType.eStyle = SvxRTFPictureType::RTF_DI_BMP;
402cdf0e10cSrcweir 					break;
403cdf0e10cSrcweir 				}
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 				rPicType.nType = nVal;
406cdf0e10cSrcweir 				pTmpFile = new SvCacheStream;
407cdf0e10cSrcweir 			}
408cdf0e10cSrcweir 			break;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 		case RTF_PICW:				rPicType.nWidth = nVal; break;
411cdf0e10cSrcweir 		case RTF_PICH:				rPicType.nHeight = nVal; break;
412cdf0e10cSrcweir 		case RTF_WBMBITSPIXEL:		rPicType.nBitsPerPixel = nVal; break;
413cdf0e10cSrcweir 		case RTF_WBMPLANES: 		rPicType.nPlanes = nVal; break;
414cdf0e10cSrcweir 		case RTF_WBMWIDTHBYTES:		rPicType.nWidthBytes = nVal; break;
415cdf0e10cSrcweir 		case RTF_PICWGOAL:			rPicType.nGoalWidth = nVal; break;
416cdf0e10cSrcweir 		case RTF_PICHGOAL:			rPicType.nGoalHeight = nVal; break;
417cdf0e10cSrcweir 		case RTF_BIN:
418cdf0e10cSrcweir             rPicType.nMode = SvxRTFPictureType::BINARY_MODE;
419cdf0e10cSrcweir 			rPicType.uPicLen = nTokenValue;
420cdf0e10cSrcweir             if (rPicType.uPicLen)
421cdf0e10cSrcweir             {
422cdf0e10cSrcweir                 sal_uInt32 nPos = rStrm.Tell();
423cdf0e10cSrcweir                 nPos = nPos;
424cdf0e10cSrcweir                 rStrm.SeekRel(-1);
425cdf0e10cSrcweir                 sal_uInt8 aData[4096];
426cdf0e10cSrcweir                 sal_uInt32 nSize = sizeof(aData);
427cdf0e10cSrcweir 
428cdf0e10cSrcweir                 while (rPicType.uPicLen > 0)
429cdf0e10cSrcweir                 {
430cdf0e10cSrcweir                     if (rPicType.uPicLen < nSize)
431cdf0e10cSrcweir                         nSize = rPicType.uPicLen;
432cdf0e10cSrcweir 
433cdf0e10cSrcweir                     rStrm.Read(aData, nSize);
434cdf0e10cSrcweir                     pTmpFile->Write(aData, nSize);
435cdf0e10cSrcweir                     rPicType.uPicLen -= nSize;
436cdf0e10cSrcweir                 }
437cdf0e10cSrcweir                 nNextCh = GetNextChar();
438cdf0e10cSrcweir                 bValidBmp = !pTmpFile->GetError();
439cdf0e10cSrcweir                 nPos = rStrm.Tell();
440cdf0e10cSrcweir                 nPos = nPos;
441cdf0e10cSrcweir             }
442cdf0e10cSrcweir             break;
443cdf0e10cSrcweir 		case RTF_PICSCALEX:			rPicType.nScalX = nVal; break;
444cdf0e10cSrcweir 		case RTF_PICSCALEY:			rPicType.nScalY = nVal; break;
445cdf0e10cSrcweir 		case RTF_PICSCALED: 		break;
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 		case RTF_PICCROPT:			rPicType.nCropT = (short)nTokenValue; break;
448cdf0e10cSrcweir 		case RTF_PICCROPB:			rPicType.nCropB = (short)nTokenValue; break;
449cdf0e10cSrcweir 		case RTF_PICCROPL:			rPicType.nCropL = (short)nTokenValue; break;
450cdf0e10cSrcweir 		case RTF_PICCROPR:			rPicType.nCropR = (short)nTokenValue; break;
451cdf0e10cSrcweir         case RTF_SP:
452cdf0e10cSrcweir             //read pairs of {\sn Name}{\sv Value}
453cdf0e10cSrcweir             nShapePropertyBracket = _nOpenBrakets;
454cdf0e10cSrcweir         break;
455cdf0e10cSrcweir         case RTF_SN:
456cdf0e10cSrcweir             nToken = GetNextToken();
457cdf0e10cSrcweir             if( nToken != '}' )
458cdf0e10cSrcweir                 sShapePropertyName = aToken;
459cdf0e10cSrcweir             else
460cdf0e10cSrcweir                 nToken = SkipToken( -1 );
461cdf0e10cSrcweir         break;
462cdf0e10cSrcweir         case RTF_SV:
463cdf0e10cSrcweir             nToken = GetNextToken();
464cdf0e10cSrcweir             if( nToken != '}' )
465cdf0e10cSrcweir                 sShapePropertyValue = aToken;
466cdf0e10cSrcweir             else
467cdf0e10cSrcweir                 nToken = SkipToken( -1 );
468cdf0e10cSrcweir         break;
469cdf0e10cSrcweir 		case RTF_TEXTTOKEN:
470cdf0e10cSrcweir 			// JP 26.06.98: Bug #51719# - nur TextToken auf 1. Ebene
471cdf0e10cSrcweir 			//				auswerten. Alle anderen sind irgendwelche
472cdf0e10cSrcweir 			//				nicht auszuwertende Daten
473cdf0e10cSrcweir 			if( nValidDataBraket != _nOpenBrakets )
474cdf0e10cSrcweir 				break;
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 			if( bFirstTextToken )
477cdf0e10cSrcweir 			{
478cdf0e10cSrcweir 				switch( rPicType.eStyle )
479cdf0e10cSrcweir 				{
480cdf0e10cSrcweir 				case SvxRTFPictureType::RTF_BITMAP:
481cdf0e10cSrcweir 					// erstmal die Header und Info-Struktur schreiben
482cdf0e10cSrcweir 					if( pTmpFile )
483cdf0e10cSrcweir 						::WriteBMPHeader( *pTmpFile, rPicType );
484cdf0e10cSrcweir 					break;
485cdf0e10cSrcweir 				default:
486cdf0e10cSrcweir 					break;
487cdf0e10cSrcweir 				}
488cdf0e10cSrcweir 				bFirstTextToken = sal_False;
489cdf0e10cSrcweir 			}
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 			if( pTmpFile && SvxRTFPictureType::HEX_MODE == rPicType.nMode )
492cdf0e10cSrcweir 			{
493cdf0e10cSrcweir 				xub_StrLen nTokenLen = HexToBin( aToken );
494cdf0e10cSrcweir 				if( STRING_NOTFOUND == nTokenLen )
495cdf0e10cSrcweir 					bValidBmp = sal_False;
496cdf0e10cSrcweir 				else
497cdf0e10cSrcweir 				{
498cdf0e10cSrcweir 					pTmpFile->Write( (sal_Char*)aToken.GetBuffer(),
499cdf0e10cSrcweir 										nTokenLen );
500cdf0e10cSrcweir 					bValidBmp = 0 == pTmpFile->GetError();
501cdf0e10cSrcweir 				}
502cdf0e10cSrcweir 			}
503cdf0e10cSrcweir 			break;
504cdf0e10cSrcweir 		}
505cdf0e10cSrcweir 	}
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 	if (pTmpFile)
508cdf0e10cSrcweir 	{
509cdf0e10cSrcweir         //#i20775#
510cdf0e10cSrcweir         if (pTmpFile->Tell() == 0)
511cdf0e10cSrcweir             bValidBmp = false;
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 		if( bValidBmp )
514cdf0e10cSrcweir 		{
515cdf0e10cSrcweir 			GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
516cdf0e10cSrcweir 			sal_uInt16 nImportFilter = GRFILTER_FORMAT_DONTKNOW;
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 			if( pFilterNm )
519cdf0e10cSrcweir 			{
520cdf0e10cSrcweir 				String sTmp;
521cdf0e10cSrcweir 				for( sal_uInt16 n = pGF->GetImportFormatCount(); n; )
522cdf0e10cSrcweir 				{
523cdf0e10cSrcweir 					sTmp = pGF->GetImportFormatShortName( --n );
524cdf0e10cSrcweir 					if( sTmp.EqualsAscii( pFilterNm ))
525cdf0e10cSrcweir 					{
526cdf0e10cSrcweir 						nImportFilter = n;
527cdf0e10cSrcweir 						break;
528cdf0e10cSrcweir 					}
529cdf0e10cSrcweir 				}
530cdf0e10cSrcweir 			}
531cdf0e10cSrcweir 
532cdf0e10cSrcweir 			String sTmpStr;
533cdf0e10cSrcweir 			pTmpFile->Seek( STREAM_SEEK_TO_BEGIN );
534cdf0e10cSrcweir 			bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile,
535cdf0e10cSrcweir 												nImportFilter );
536cdf0e10cSrcweir 		}
537cdf0e10cSrcweir 		delete pTmpFile;
538cdf0e10cSrcweir 	}
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 	if( !bValidBmp )
541cdf0e10cSrcweir 	{
542cdf0e10cSrcweir 		rGrf.Clear();
543cdf0e10cSrcweir         //TODO  If nToken were not initialized to 0 above, it would potentially
544cdf0e10cSrcweir         // be used uninitialized here (if IsParserWorking() is false at the
545cdf0e10cSrcweir         // start of the while loop above):
546cdf0e10cSrcweir 		if( '}' != nToken )
547cdf0e10cSrcweir 			SkipGroup();
548cdf0e10cSrcweir 	}
549cdf0e10cSrcweir 	else
550cdf0e10cSrcweir 	{
551cdf0e10cSrcweir 		switch( rPicType.eStyle )
552cdf0e10cSrcweir 		{
553cdf0e10cSrcweir //??		ENHANCED_MF,		// in den Pict.Daten steht ein Enhanced-Metafile
554cdf0e10cSrcweir 		case SvxRTFPictureType::RTF_PNG:
555cdf0e10cSrcweir 		case SvxRTFPictureType::RTF_JPG:
556cdf0e10cSrcweir 			{
557cdf0e10cSrcweir 				const MapMode aMap( MAP_100TH_MM );
558cdf0e10cSrcweir 			 	Size aSize( rGrf.GetPrefSize() );
559cdf0e10cSrcweir 				if( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() )
560cdf0e10cSrcweir 					aSize = Application::GetDefaultDevice()->PixelToLogic(
561cdf0e10cSrcweir 										aSize, aMap );
562cdf0e10cSrcweir 				else
563cdf0e10cSrcweir 					aSize = OutputDevice::LogicToLogic( aSize,
564cdf0e10cSrcweir 										rGrf.GetPrefMapMode(), aMap );
565cdf0e10cSrcweir 				rPicType.nWidth = sal::static_int_cast< sal_uInt16 >(aSize.Width());
566cdf0e10cSrcweir 				rPicType.nHeight = sal::static_int_cast< sal_uInt16 >(
567cdf0e10cSrcweir                     aSize.Height());
568cdf0e10cSrcweir 			}
569cdf0e10cSrcweir 			break;
570cdf0e10cSrcweir 		default:
571cdf0e10cSrcweir 			break;
572cdf0e10cSrcweir 		}
573cdf0e10cSrcweir 
574cdf0e10cSrcweir #ifdef DEBUG_JP
575cdf0e10cSrcweir 		new GrfWindow( rGrf );
576cdf0e10cSrcweir #endif
577cdf0e10cSrcweir 	}
578cdf0e10cSrcweir 	SetSrcEncoding( eOldEnc );
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 	SkipToken( -1 );		// die schliesende Klammer wird "oben" ausgewertet
581cdf0e10cSrcweir 	return bValidBmp;
582cdf0e10cSrcweir }
583cdf0e10cSrcweir 
584cdf0e10cSrcweir /* vi:set tabstop=4 shiftwidth=4 expandtab: */
585