xref: /aoo41x/main/svtools/source/graphic/grfattr.cxx (revision 5900e8ec)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/vcompat.hxx>
28cdf0e10cSrcweir #include <svtools/grfmgr.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir // ---------------
31cdf0e10cSrcweir // - GraphicAttr -
32cdf0e10cSrcweir // ---------------
33cdf0e10cSrcweir 
GraphicAttr()34cdf0e10cSrcweir GraphicAttr::GraphicAttr() :
35cdf0e10cSrcweir 	mfGamma			( 1.0 ),
36cdf0e10cSrcweir 	mnMirrFlags		( 0 ),
37cdf0e10cSrcweir 	mnLeftCrop		( 0 ),
38cdf0e10cSrcweir 	mnTopCrop		( 0 ),
39cdf0e10cSrcweir 	mnRightCrop		( 0 ),
40cdf0e10cSrcweir 	mnBottomCrop	( 0 ),
41cdf0e10cSrcweir 	mnRotate10		( 0 ),
42cdf0e10cSrcweir 	mnContPercent	( 0 ),
43cdf0e10cSrcweir 	mnLumPercent	( 0 ),
44cdf0e10cSrcweir 	mnRPercent		( 0 ),
45cdf0e10cSrcweir 	mnGPercent		( 0 ),
46cdf0e10cSrcweir 	mnBPercent		( 0 ),
47cdf0e10cSrcweir 	mbInvert		( sal_False ),
48cdf0e10cSrcweir 	mcTransparency	( 0 ),
49cdf0e10cSrcweir 	meDrawMode		( GRAPHICDRAWMODE_STANDARD )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // ------------------------------------------------------------------------
54cdf0e10cSrcweir 
~GraphicAttr()55cdf0e10cSrcweir GraphicAttr::~GraphicAttr()
56cdf0e10cSrcweir {
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir // ------------------------------------------------------------------------
60cdf0e10cSrcweir 
operator ==(const GraphicAttr & rAttr) const61cdf0e10cSrcweir sal_Bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 	return( ( mfGamma == rAttr.mfGamma ) &&
64cdf0e10cSrcweir 			( mnMirrFlags == rAttr.mnMirrFlags ) &&
65cdf0e10cSrcweir 			( mnLeftCrop == rAttr.mnLeftCrop ) &&
66cdf0e10cSrcweir 			( mnTopCrop == rAttr.mnTopCrop ) &&
67cdf0e10cSrcweir 			( mnRightCrop == rAttr.mnRightCrop ) &&
68cdf0e10cSrcweir 			( mnBottomCrop == rAttr.mnBottomCrop ) &&
69cdf0e10cSrcweir 			( mnRotate10 == rAttr.mnRotate10 ) &&
70cdf0e10cSrcweir 			( mnContPercent == rAttr.mnContPercent ) &&
71cdf0e10cSrcweir 			( mnLumPercent == rAttr.mnLumPercent ) &&
72cdf0e10cSrcweir 			( mnRPercent == rAttr.mnRPercent ) &&
73cdf0e10cSrcweir 			( mnGPercent == rAttr.mnGPercent ) &&
74cdf0e10cSrcweir 			( mnBPercent == rAttr.mnBPercent ) &&
75cdf0e10cSrcweir 			( mbInvert == rAttr.mbInvert ) &&
76cdf0e10cSrcweir 			( mcTransparency == rAttr.mcTransparency ) &&
77cdf0e10cSrcweir 			( meDrawMode == rAttr.meDrawMode ) );
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // ------------------------------------------------------------------------
81cdf0e10cSrcweir 
operator >>(SvStream & rIStm,GraphicAttr & rAttr)82cdf0e10cSrcweir SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	VersionCompat	aCompat( rIStm, STREAM_READ );
85cdf0e10cSrcweir 	sal_uInt32		nTmp32;
86cdf0e10cSrcweir 	sal_uInt16			nTmp16;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10;
89cdf0e10cSrcweir 	rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent;
90cdf0e10cSrcweir 	rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16;
91cdf0e10cSrcweir 	rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	if( aCompat.GetVersion() >= 2 )
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		rIStm >> rAttr.mnLeftCrop >> rAttr.mnTopCrop >> rAttr.mnRightCrop >> rAttr.mnBottomCrop;
96cdf0e10cSrcweir 	}
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	return rIStm;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir // ------------------------------------------------------------------------
102cdf0e10cSrcweir 
operator <<(SvStream & rOStm,const GraphicAttr & rAttr)103cdf0e10cSrcweir SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	VersionCompat		aCompat( rOStm, STREAM_WRITE, 2 );
106cdf0e10cSrcweir 	const sal_uInt32	nTmp32 = 0;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10;
109cdf0e10cSrcweir 	rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent;
110cdf0e10cSrcweir 	rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
111cdf0e10cSrcweir 	rOStm << rAttr.mnLeftCrop << rAttr.mnTopCrop << rAttr.mnRightCrop << rAttr.mnBottomCrop;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	return rOStm;
114cdf0e10cSrcweir }
115