xref: /AOO41X/main/vcl/inc/vcl/hatch.hxx (revision 0d63794c5b3715d9f8da2f4b7b451b7426ee7897)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_HATCH_HXX
25 #define _SV_HATCH_HXX
26 
27 #include <tools/color.hxx>
28 #include <vcl/dllapi.h>
29 
30 #include <vcl/vclenum.hxx>
31 
32 // --------------
33 // - Impl_Hatch -
34 // --------------
35 
36 class SvStream;
37 
38 struct ImplHatch
39 {
40     sal_uLong               mnRefCount;
41     Color               maColor;
42     HatchStyle          meStyle;
43     long                mnDistance;
44     sal_uInt16              mnAngle;
45 
46                         ImplHatch();
47                         ImplHatch( const ImplHatch& rImplHatch );
48 
49     friend SvStream&    operator>>( SvStream& rIStm, ImplHatch& rImplHatch );
50     friend SvStream&    operator<<( SvStream& rOStm, const ImplHatch& rImplHatch );
51 };
52 
53 // ---------
54 // - Hatch -
55 // ---------
56 
57 class VCL_DLLPUBLIC Hatch
58 {
59 private:
60 
61     ImplHatch*          mpImplHatch;
62     SAL_DLLPRIVATE void ImplMakeUnique();
63 
64 public:
65 
66                     Hatch();
67                     Hatch( const Hatch& rHatch );
68                     Hatch( HatchStyle eStyle, const Color& rHatchColor, long nDistance, sal_uInt16 nAngle10 = 0 );
69                     ~Hatch();
70 
71     Hatch&          operator=( const Hatch& rHatch );
72     sal_Bool            operator==( const Hatch& rHatch ) const;
operator !=(const Hatch & rHatch) const73     sal_Bool            operator!=( const Hatch& rHatch ) const { return !(Hatch::operator==( rHatch ) ); }
IsSameInstance(const Hatch & rHatch) const74     sal_Bool            IsSameInstance( const Hatch& rHatch ) const { return( mpImplHatch == rHatch.mpImplHatch ); }
75 
76     void            SetStyle( HatchStyle eStyle );
GetStyle() const77     HatchStyle      GetStyle() const { return mpImplHatch->meStyle; }
78 
79     void            SetColor( const Color& rColor  );
GetColor() const80     const Color&    GetColor() const { return mpImplHatch->maColor; }
81 
82     void            SetDistance( long nDistance  );
GetDistance() const83     long            GetDistance() const { return mpImplHatch->mnDistance; }
84 
85     void            SetAngle( sal_uInt16 nAngle10 );
GetAngle() const86     sal_uInt16          GetAngle() const { return mpImplHatch->mnAngle; }
87 
88     friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Hatch& rHatch );
89     friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch );
90 };
91 
92 #endif  // _SV_HATCH_HXX
93