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 : :
30 : : #include <tools/stream.hxx>
31 : : #include <tools/vcompat.hxx>
32 : : #include <tools/debug.hxx>
33 : :
34 : : #include <vcl/bitmapex.hxx>
35 : : #include <vcl/gradient.hxx>
36 : : #include <vcl/wall.hxx>
37 : : #include <vcl/svapp.hxx>
38 : :
39 : : #include <wall2.hxx>
40 : :
41 : :
42 : : DBG_NAME( Wallpaper )
43 : :
44 : : // -----------------------------------------------------------------------
45 : :
46 : 312273 : ImplWallpaper::ImplWallpaper() :
47 : 312273 : maColor( COL_TRANSPARENT )
48 : : {
49 : 312273 : mnRefCount = 1;
50 : 312273 : mpBitmap = NULL;
51 : 312273 : mpCache = NULL;
52 : 312273 : mpGradient = NULL;
53 : 312273 : mpRect = NULL;
54 : 312273 : meStyle = WALLPAPER_NULL;
55 : 312273 : }
56 : :
57 : : // -----------------------------------------------------------------------
58 : :
59 : 16080 : ImplWallpaper::ImplWallpaper( const ImplWallpaper& rImplWallpaper ) :
60 : 16080 : maColor( rImplWallpaper.maColor )
61 : : {
62 : 16080 : mnRefCount = 1;
63 : 16080 : meStyle = rImplWallpaper.meStyle;
64 : :
65 [ - + ]: 16080 : if ( rImplWallpaper.mpBitmap )
66 [ # # ]: 0 : mpBitmap = new BitmapEx( *rImplWallpaper.mpBitmap );
67 : : else
68 : 16080 : mpBitmap = NULL;
69 [ - + ]: 16080 : if( rImplWallpaper.mpCache )
70 [ # # ]: 0 : mpCache = new BitmapEx( *rImplWallpaper.mpCache );
71 : : else
72 : 16080 : mpCache = NULL;
73 [ - + ]: 16080 : if ( rImplWallpaper.mpGradient )
74 [ # # ]: 0 : mpGradient = new Gradient( *rImplWallpaper.mpGradient );
75 : : else
76 : 16080 : mpGradient = NULL;
77 [ - + ]: 16080 : if ( rImplWallpaper.mpRect )
78 : 0 : mpRect = new Rectangle( *rImplWallpaper.mpRect );
79 : : else
80 : 16080 : mpRect = NULL;
81 : 16080 : }
82 : :
83 : : // -----------------------------------------------------------------------
84 : :
85 : 325300 : ImplWallpaper::~ImplWallpaper()
86 : : {
87 [ - + ]: 325300 : delete mpBitmap;
88 [ - + ]: 325300 : delete mpCache;
89 [ + + ]: 325300 : delete mpGradient;
90 : 325300 : delete mpRect;
91 : 325300 : }
92 : :
93 : : // -----------------------------------------------------------------------
94 : :
95 : 0 : void ImplWallpaper::ImplSetCachedBitmap( BitmapEx& rBmp )
96 : : {
97 [ # # ]: 0 : if( !mpCache )
98 [ # # ]: 0 : mpCache = new BitmapEx( rBmp );
99 : : else
100 : 0 : *mpCache = rBmp;
101 : 0 : }
102 : :
103 : : // -----------------------------------------------------------------------
104 : :
105 : 16080 : void ImplWallpaper::ImplReleaseCachedBitmap()
106 : : {
107 [ - + ]: 16080 : delete mpCache;
108 : 16080 : mpCache = NULL;
109 : 16080 : }
110 : :
111 : : // -----------------------------------------------------------------------
112 : :
113 : 0 : SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper )
114 : : {
115 [ # # ]: 0 : VersionCompat aCompat( rIStm, STREAM_READ );
116 : : sal_uInt16 nTmp16;
117 : :
118 : 0 : delete rImplWallpaper.mpRect;
119 : 0 : rImplWallpaper.mpRect = NULL;
120 : :
121 [ # # ][ # # ]: 0 : delete rImplWallpaper.mpGradient;
122 : 0 : rImplWallpaper.mpGradient = NULL;
123 : :
124 [ # # ][ # # ]: 0 : delete rImplWallpaper.mpBitmap;
125 : 0 : rImplWallpaper.mpBitmap = NULL;
126 : :
127 : : // version 1
128 [ # # ]: 0 : rIStm >> rImplWallpaper.maColor;
129 [ # # ]: 0 : rIStm >> nTmp16; rImplWallpaper.meStyle = (WallpaperStyle) nTmp16;
130 : :
131 : : // version 2
132 [ # # ]: 0 : if( aCompat.GetVersion() >= 2 )
133 : : {
134 : : sal_Bool bRect, bGrad, bBmp, bDummy;
135 : :
136 [ # # ][ # # ]: 0 : rIStm >> bRect >> bGrad >> bBmp >> bDummy >> bDummy >> bDummy;
[ # # ][ # # ]
[ # # ][ # # ]
137 : :
138 [ # # ]: 0 : if( bRect )
139 : : {
140 [ # # ][ # # ]: 0 : rImplWallpaper.mpRect = new Rectangle;
141 [ # # ]: 0 : rIStm >> *rImplWallpaper.mpRect;
142 : : }
143 : :
144 [ # # ]: 0 : if( bGrad )
145 : : {
146 [ # # ][ # # ]: 0 : rImplWallpaper.mpGradient = new Gradient;
147 [ # # ]: 0 : rIStm >> *rImplWallpaper.mpGradient;
148 : : }
149 : :
150 [ # # ]: 0 : if( bBmp )
151 : : {
152 [ # # ][ # # ]: 0 : rImplWallpaper.mpBitmap = new BitmapEx;
153 [ # # ]: 0 : rIStm >> *rImplWallpaper.mpBitmap;
154 : : }
155 : :
156 : : // version 3 (new color format)
157 [ # # ]: 0 : if( aCompat.GetVersion() >= 3 )
158 : : {
159 [ # # ]: 0 : rImplWallpaper.maColor.Read( rIStm, sal_True );
160 : : }
161 : : }
162 : :
163 [ # # ]: 0 : return rIStm;
164 : : }
165 : :
166 : : // -----------------------------------------------------------------------
167 : :
168 : 0 : SvStream& operator<<( SvStream& rOStm, const ImplWallpaper& rImplWallpaper )
169 : : {
170 [ # # ]: 0 : VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
171 : 0 : sal_Bool bRect = ( rImplWallpaper.mpRect != NULL );
172 : 0 : sal_Bool bGrad = ( rImplWallpaper.mpGradient != NULL );
173 : 0 : sal_Bool bBmp = ( rImplWallpaper.mpBitmap != NULL );
174 : 0 : sal_Bool bDummy = sal_False;
175 : :
176 : : // version 1
177 [ # # ][ # # ]: 0 : rOStm << rImplWallpaper.maColor << (sal_uInt16) rImplWallpaper.meStyle;
178 : :
179 : : // version 2
180 [ # # ][ # # ]: 0 : rOStm << bRect << bGrad << bBmp << bDummy << bDummy << bDummy;
[ # # ][ # # ]
[ # # ][ # # ]
181 : :
182 [ # # ]: 0 : if( bRect )
183 [ # # ]: 0 : rOStm << *rImplWallpaper.mpRect;
184 : :
185 [ # # ]: 0 : if( bGrad )
186 [ # # ]: 0 : rOStm << *rImplWallpaper.mpGradient;
187 : :
188 [ # # ]: 0 : if( bBmp )
189 [ # # ]: 0 : rOStm << *rImplWallpaper.mpBitmap;
190 : :
191 : : // version 3 (new color format)
192 [ # # ]: 0 : ( (Color&) rImplWallpaper.maColor ).Write( rOStm, sal_True );
193 : :
194 [ # # ]: 0 : return rOStm;
195 : : }
196 : :
197 : : // -----------------------------------------------------------------------
198 : :
199 : 31871 : inline void Wallpaper::ImplMakeUnique( sal_Bool bReleaseCache )
200 : : {
201 : : // Falls noch andere Referenzen bestehen, dann kopieren
202 [ + + ]: 31871 : if ( mpImplWallpaper->mnRefCount != 1 )
203 : : {
204 [ + + ]: 16080 : if ( mpImplWallpaper->mnRefCount )
205 : 289 : mpImplWallpaper->mnRefCount--;
206 [ + - ]: 16080 : mpImplWallpaper = new ImplWallpaper( *(mpImplWallpaper) );
207 : : }
208 : :
209 [ + + ]: 31871 : if( bReleaseCache )
210 : 16080 : mpImplWallpaper->ImplReleaseCachedBitmap();
211 : 31871 : }
212 : :
213 : : // -----------------------------------------------------------------------
214 : :
215 : 293542 : Wallpaper::Wallpaper()
216 : : {
217 : : DBG_CTOR( Wallpaper, NULL );
218 : :
219 [ + + ][ + - ]: 293542 : static ImplWallpaper aStaticImplWallpaper;
220 : :
221 : 293542 : aStaticImplWallpaper.mnRefCount = 0;
222 : 293542 : mpImplWallpaper = &aStaticImplWallpaper;
223 : 293542 : }
224 : :
225 : : // -----------------------------------------------------------------------
226 : :
227 : 47674 : Wallpaper::Wallpaper( const Wallpaper& rWallpaper )
228 : : {
229 : : DBG_CTOR( Wallpaper, NULL );
230 : : DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
231 : : DBG_ASSERT( rWallpaper.mpImplWallpaper->mnRefCount < 0xFFFFFFFE, "Wallpaper: RefCount overflow" );
232 : :
233 : : // Instance Daten uebernehmen und Referenzcounter erhoehen
234 : 47674 : mpImplWallpaper = rWallpaper.mpImplWallpaper;
235 : : // RefCount == 0 fuer statische Objekte
236 [ + + ]: 47674 : if ( mpImplWallpaper->mnRefCount )
237 : 47635 : mpImplWallpaper->mnRefCount++;
238 : 47674 : }
239 : :
240 : : // -----------------------------------------------------------------------
241 : :
242 : 311246 : Wallpaper::Wallpaper( const Color& rColor )
243 : : {
244 : : DBG_CTOR( Wallpaper, NULL );
245 : :
246 : 311246 : mpImplWallpaper = new ImplWallpaper;
247 : 311246 : mpImplWallpaper->maColor = rColor;
248 : 311246 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
249 : 311246 : }
250 : :
251 : : // -----------------------------------------------------------------------
252 : :
253 : 0 : Wallpaper::Wallpaper( const BitmapEx& rBmpEx )
254 : : {
255 : : DBG_CTOR( Wallpaper, NULL );
256 : :
257 : 0 : mpImplWallpaper = new ImplWallpaper;
258 [ # # ]: 0 : mpImplWallpaper->mpBitmap = new BitmapEx( rBmpEx );
259 : 0 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
260 : 0 : }
261 : :
262 : : // -----------------------------------------------------------------------
263 : :
264 : 776 : Wallpaper::Wallpaper( const Gradient& rGradient )
265 : : {
266 : : DBG_CTOR( Wallpaper, NULL );
267 : :
268 : 776 : mpImplWallpaper = new ImplWallpaper;
269 [ + - ]: 776 : mpImplWallpaper->mpGradient = new Gradient( rGradient );
270 : 776 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
271 : 776 : }
272 : :
273 : : // -----------------------------------------------------------------------
274 : :
275 : 648365 : Wallpaper::~Wallpaper()
276 : : {
277 : : DBG_DTOR( Wallpaper, NULL );
278 : :
279 : : // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
280 : : // die letzte Referenz ist, sonst Referenzcounter decrementieren
281 [ + + ]: 648365 : if ( mpImplWallpaper->mnRefCount )
282 : : {
283 [ + + ]: 541842 : if ( mpImplWallpaper->mnRefCount == 1 )
284 [ + - ]: 160571 : delete mpImplWallpaper;
285 : : else
286 : 381271 : mpImplWallpaper->mnRefCount--;
287 : : }
288 : 648365 : }
289 : :
290 : : // -----------------------------------------------------------------------
291 : :
292 : 289 : void Wallpaper::SetColor( const Color& rColor )
293 : : {
294 : : DBG_CHKTHIS( Wallpaper, NULL );
295 : :
296 : 289 : ImplMakeUnique();
297 : 289 : mpImplWallpaper->maColor = rColor;
298 : :
299 [ - + ][ + - ]: 289 : if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle )
300 : 0 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
301 : 289 : }
302 : :
303 : : // -----------------------------------------------------------------------
304 : :
305 : 320615 : const Color& Wallpaper::GetColor() const
306 : : {
307 : : DBG_CHKTHIS( Wallpaper, NULL );
308 : :
309 : 320615 : return mpImplWallpaper->maColor;
310 : : }
311 : :
312 : : // -----------------------------------------------------------------------
313 : :
314 : 15791 : void Wallpaper::SetStyle( WallpaperStyle eStyle )
315 : : {
316 : : DBG_CHKTHIS( Wallpaper, NULL );
317 : :
318 : 15791 : ImplMakeUnique( sal_False );
319 : :
320 [ + - ]: 15791 : if( eStyle == WALLPAPER_APPLICATIONGRADIENT )
321 : : // set a dummy gradient, the correct gradient
322 : : // will be created dynamically in GetGradient()
323 [ + - ]: 15791 : SetGradient( ImplGetApplicationGradient() );
324 : :
325 : 15791 : mpImplWallpaper->meStyle = eStyle;
326 : 15791 : }
327 : :
328 : : // -----------------------------------------------------------------------
329 : :
330 : 370220 : WallpaperStyle Wallpaper::GetStyle() const
331 : : {
332 : : DBG_CHKTHIS( Wallpaper, NULL );
333 : :
334 : 370220 : return mpImplWallpaper->meStyle;
335 : : }
336 : :
337 : : // -----------------------------------------------------------------------
338 : :
339 : 0 : void Wallpaper::SetBitmap( const BitmapEx& rBitmap )
340 : : {
341 : : DBG_CHKTHIS( Wallpaper, NULL );
342 : :
343 [ # # ]: 0 : if ( !rBitmap )
344 : : {
345 [ # # ]: 0 : if ( mpImplWallpaper->mpBitmap )
346 : : {
347 : 0 : ImplMakeUnique();
348 [ # # ]: 0 : delete mpImplWallpaper->mpBitmap;
349 : 0 : mpImplWallpaper->mpBitmap = NULL;
350 : : }
351 : : }
352 : : else
353 : : {
354 : 0 : ImplMakeUnique();
355 [ # # ]: 0 : if ( mpImplWallpaper->mpBitmap )
356 : 0 : *(mpImplWallpaper->mpBitmap) = rBitmap;
357 : : else
358 [ # # ]: 0 : mpImplWallpaper->mpBitmap = new BitmapEx( rBitmap );
359 : : }
360 : :
361 [ # # ][ # # ]: 0 : if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle)
362 : 0 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
363 : 0 : }
364 : :
365 : : // -----------------------------------------------------------------------
366 : :
367 : 0 : BitmapEx Wallpaper::GetBitmap() const
368 : : {
369 : : DBG_CHKTHIS( Wallpaper, NULL );
370 : :
371 [ # # ]: 0 : if ( mpImplWallpaper->mpBitmap )
372 : 0 : return *(mpImplWallpaper->mpBitmap);
373 : : else
374 : : {
375 [ # # ]: 0 : BitmapEx aBmp;
376 [ # # ][ # # ]: 0 : return aBmp;
377 : : }
378 : : }
379 : :
380 : : // -----------------------------------------------------------------------
381 : :
382 : 214163 : sal_Bool Wallpaper::IsBitmap() const
383 : : {
384 : : DBG_CHKTHIS( Wallpaper, NULL );
385 : :
386 : 214163 : return (mpImplWallpaper->mpBitmap != 0);
387 : : }
388 : :
389 : :
390 : : // -----------------------------------------------------------------------
391 : :
392 : 15791 : void Wallpaper::SetGradient( const Gradient& rGradient )
393 : : {
394 : : DBG_CHKTHIS( Wallpaper, NULL );
395 : :
396 : 15791 : ImplMakeUnique();
397 : :
398 [ - + ]: 15791 : if ( mpImplWallpaper->mpGradient )
399 : 0 : *(mpImplWallpaper->mpGradient) = rGradient;
400 : : else
401 [ + - ]: 15791 : mpImplWallpaper->mpGradient = new Gradient( rGradient );
402 : :
403 [ - + ][ # # ]: 15791 : if( WALLPAPER_NULL == mpImplWallpaper->meStyle || WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle )
404 : 15791 : mpImplWallpaper->meStyle = WALLPAPER_TILE;
405 : 15791 : }
406 : :
407 : : // -----------------------------------------------------------------------
408 : :
409 : 4458 : Gradient Wallpaper::GetGradient() const
410 : : {
411 : : DBG_CHKTHIS( Wallpaper, NULL );
412 : :
413 [ + - ]: 4458 : if( WALLPAPER_APPLICATIONGRADIENT == mpImplWallpaper->meStyle )
414 : 4458 : return ImplGetApplicationGradient();
415 [ # # ]: 0 : else if ( mpImplWallpaper->mpGradient )
416 : 0 : return *(mpImplWallpaper->mpGradient);
417 : : else
418 : : {
419 [ # # ]: 0 : Gradient aGradient;
420 [ # # ][ # # ]: 4458 : return aGradient;
421 : : }
422 : : }
423 : :
424 : : // -----------------------------------------------------------------------
425 : :
426 : 362109 : sal_Bool Wallpaper::IsGradient() const
427 : : {
428 : : DBG_CHKTHIS( Wallpaper, NULL );
429 : :
430 : 362109 : return (mpImplWallpaper->mpGradient != 0);
431 : : }
432 : :
433 : :
434 : : // -----------------------------------------------------------------------
435 : :
436 : 20249 : Gradient Wallpaper::ImplGetApplicationGradient() const
437 : : {
438 : 20249 : Gradient g;
439 [ + - ]: 20249 : g.SetAngle( 900 );
440 [ + - ]: 20249 : g.SetStyle( GradientStyle_LINEAR );
441 [ + - ][ + - ]: 20249 : g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
442 : : // no 'extreme' gradient when high contrast
443 [ + - ][ - + ]: 20249 : if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
444 [ # # ][ # # ]: 0 : g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
445 : : else
446 [ + - ][ + - ]: 20249 : g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceGradientColor() );
[ + - ]
447 : 20249 : return g;
448 : : }
449 : :
450 : : // -----------------------------------------------------------------------
451 : :
452 : 0 : void Wallpaper::SetRect( const Rectangle& rRect )
453 : : {
454 : : DBG_CHKTHIS( Wallpaper, NULL );
455 : :
456 : 0 : ImplMakeUnique( sal_False );
457 : :
458 [ # # ]: 0 : if ( rRect.IsEmpty() )
459 : : {
460 [ # # ]: 0 : if ( mpImplWallpaper->mpRect )
461 : : {
462 : 0 : delete mpImplWallpaper->mpRect;
463 : 0 : mpImplWallpaper->mpRect = NULL;
464 : : }
465 : : }
466 : : else
467 : : {
468 [ # # ]: 0 : if ( mpImplWallpaper->mpRect )
469 : 0 : *(mpImplWallpaper->mpRect) = rRect;
470 : : else
471 : 0 : mpImplWallpaper->mpRect = new Rectangle( rRect );
472 : : }
473 : 0 : }
474 : :
475 : : // -----------------------------------------------------------------------
476 : :
477 : 0 : Rectangle Wallpaper::GetRect() const
478 : : {
479 : : DBG_CHKTHIS( Wallpaper, NULL );
480 : :
481 [ # # ]: 0 : if ( mpImplWallpaper->mpRect )
482 : 0 : return *(mpImplWallpaper->mpRect);
483 : : else
484 : : {
485 [ # # ]: 0 : Rectangle aRect;
486 : 0 : return aRect;
487 : : }
488 : : }
489 : :
490 : : // -----------------------------------------------------------------------
491 : :
492 : 0 : sal_Bool Wallpaper::IsRect() const
493 : : {
494 : : DBG_CHKTHIS( Wallpaper, NULL );
495 : :
496 : 0 : return (mpImplWallpaper->mpRect != 0);
497 : : }
498 : :
499 : :
500 : : // -----------------------------------------------------------------------
501 : :
502 : 0 : sal_Bool Wallpaper::IsFixed() const
503 : : {
504 [ # # ]: 0 : if ( mpImplWallpaper->meStyle == WALLPAPER_NULL )
505 : 0 : return sal_False;
506 : : else
507 [ # # ][ # # ]: 0 : return (!mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient);
508 : : }
509 : :
510 : : // -----------------------------------------------------------------------
511 : :
512 : 0 : sal_Bool Wallpaper::IsScrollable() const
513 : : {
514 [ # # ]: 0 : if ( mpImplWallpaper->meStyle == WALLPAPER_NULL )
515 : 0 : return sal_False;
516 [ # # ][ # # ]: 0 : else if ( !mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient )
517 : 0 : return sal_True;
518 [ # # ]: 0 : else if ( mpImplWallpaper->mpBitmap )
519 : 0 : return (mpImplWallpaper->meStyle == WALLPAPER_TILE);
520 : : else
521 : 0 : return sal_False;
522 : : }
523 : :
524 : : // -----------------------------------------------------------------------
525 : :
526 : 388246 : Wallpaper& Wallpaper::operator=( const Wallpaper& rWallpaper )
527 : : {
528 : : DBG_CHKTHIS( Wallpaper, NULL );
529 : : DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
530 : : DBG_ASSERT( rWallpaper.mpImplWallpaper->mnRefCount < 0xFFFFFFFE, "Wallpaper: RefCount overflow" );
531 : :
532 : : // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
533 [ + + ]: 388246 : if ( rWallpaper.mpImplWallpaper->mnRefCount )
534 : 336106 : rWallpaper.mpImplWallpaper->mnRefCount++;
535 : :
536 : : // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
537 : : // die letzte Referenz ist, sonst Referenzcounter decrementieren
538 [ + + ]: 388246 : if ( mpImplWallpaper->mnRefCount )
539 : : {
540 [ + + ]: 166279 : if ( mpImplWallpaper->mnRefCount == 1 )
541 [ + - ]: 164478 : delete mpImplWallpaper;
542 : : else
543 : 1801 : mpImplWallpaper->mnRefCount--;
544 : : }
545 : :
546 : 388246 : mpImplWallpaper = rWallpaper.mpImplWallpaper;
547 : :
548 : 388246 : return *this;
549 : : }
550 : :
551 : : // -----------------------------------------------------------------------
552 : :
553 : 0 : sal_Bool Wallpaper::operator==( const Wallpaper& rWallpaper ) const
554 : : {
555 : : DBG_CHKTHIS( Wallpaper, NULL );
556 : : DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
557 : :
558 [ # # ]: 0 : if ( mpImplWallpaper == rWallpaper.mpImplWallpaper )
559 : 0 : return sal_True;
560 : :
561 [ # # # # ]: 0 : if ( ( mpImplWallpaper->meStyle != rWallpaper.mpImplWallpaper->meStyle ) ||
[ # # ]
562 : 0 : ( mpImplWallpaper->maColor != rWallpaper.mpImplWallpaper->maColor ) )
563 : 0 : return sal_False;
564 : :
565 [ # # ][ # # ]: 0 : if ( mpImplWallpaper->mpRect != rWallpaper.mpImplWallpaper->mpRect
[ # # # # ]
[ # # ]
566 : 0 : && ( !mpImplWallpaper->mpRect
567 : 0 : || !rWallpaper.mpImplWallpaper->mpRect
568 : 0 : || *(mpImplWallpaper->mpRect) != *(rWallpaper.mpImplWallpaper->mpRect) ) )
569 : 0 : return sal_False;
570 : :
571 [ # # ][ # # ]: 0 : if ( mpImplWallpaper->mpBitmap != rWallpaper.mpImplWallpaper->mpBitmap
[ # # # # ]
[ # # ]
572 : 0 : && ( !mpImplWallpaper->mpBitmap
573 : 0 : || !rWallpaper.mpImplWallpaper->mpBitmap
574 : 0 : || *(mpImplWallpaper->mpBitmap) != *(rWallpaper.mpImplWallpaper->mpBitmap) ) )
575 : 0 : return sal_False;
576 : :
577 [ # # ][ # # ]: 0 : if ( mpImplWallpaper->mpGradient != rWallpaper.mpImplWallpaper->mpGradient
[ # # # # ]
[ # # ]
578 : 0 : && ( !mpImplWallpaper->mpGradient
579 : 0 : || !rWallpaper.mpImplWallpaper->mpGradient
580 : 0 : || *(mpImplWallpaper->mpGradient) != *(rWallpaper.mpImplWallpaper->mpGradient) ) )
581 : 0 : return sal_False;
582 : :
583 : 0 : return sal_True;
584 : : }
585 : :
586 : : // -----------------------------------------------------------------------
587 : :
588 : 0 : SvStream& operator>>( SvStream& rIStm, Wallpaper& rWallpaper )
589 : : {
590 : 0 : rWallpaper.ImplMakeUnique();
591 : 0 : return( rIStm >> *rWallpaper.mpImplWallpaper );
592 : : }
593 : :
594 : : // -----------------------------------------------------------------------
595 : :
596 : 0 : SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper )
597 : : {
598 : 0 : return( rOStm << *rWallpaper.mpImplWallpaper );
599 : : }
600 : :
601 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|