Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_MAPMOD_HXX
21 : #define INCLUDED_VCL_MAPMOD_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <tools/fract.hxx>
25 : #include <tools/solar.h>
26 : #include <vcl/dllapi.h>
27 : #include <tools/resid.hxx>
28 : #include <tools/mapunit.hxx>
29 :
30 : class SvStream;
31 :
32 :
33 : // - ImplMapMode -
34 :
35 :
36 : class OutputDevice;
37 :
38 : class ImplMapMode
39 : {
40 : friend class MapMode;
41 : friend class OutputDevice;
42 :
43 : private:
44 : sal_uLong mnRefCount;
45 : MapUnit meUnit;
46 : Point maOrigin;
47 : Fraction maScaleX;
48 : Fraction maScaleY;
49 : bool mbSimple;
50 :
51 : friend SvStream& ReadImplMapMode( SvStream& rIStm, ImplMapMode& rMapMode );
52 : friend SvStream& WriteImplMapMode( SvStream& rOStm, const ImplMapMode& rMapMode );
53 :
54 : static ImplMapMode* ImplGetStaticMapMode( MapUnit eUnit );
55 : public:
56 : ImplMapMode();
57 : ImplMapMode( const ImplMapMode& rImpMapMode );
58 : };
59 :
60 :
61 : // - MapMode -
62 :
63 :
64 : class VCL_DLLPUBLIC MapMode
65 : {
66 : friend class OutputDevice;
67 :
68 : private:
69 : ImplMapMode* mpImplMapMode;
70 :
71 : SAL_DLLPRIVATE void ImplMakeUnique();
72 :
73 : public:
74 : MapMode();
75 : MapMode( const MapMode& rMapMode );
76 : MapMode( MapUnit eUnit );
77 : MapMode( MapUnit eUnit, const Point& rLogicOrg,
78 : const Fraction& rScaleX, const Fraction& rScaleY );
79 : ~MapMode();
80 :
81 : void SetMapUnit( MapUnit eUnit );
82 0 : MapUnit GetMapUnit() const
83 0 : { return mpImplMapMode->meUnit; }
84 :
85 : void SetOrigin( const Point& rOrigin );
86 0 : const Point& GetOrigin() const
87 0 : { return mpImplMapMode->maOrigin; }
88 :
89 : void SetScaleX( const Fraction& rScaleX );
90 0 : const Fraction& GetScaleX() const
91 0 : { return mpImplMapMode->maScaleX; }
92 : void SetScaleY( const Fraction& rScaleY );
93 0 : const Fraction& GetScaleY() const
94 0 : { return mpImplMapMode->maScaleY; }
95 :
96 : MapMode& operator=( const MapMode& rMapMode );
97 : bool operator==( const MapMode& rMapMode ) const;
98 0 : bool operator!=( const MapMode& rMapMode ) const
99 0 : { return !(MapMode::operator==( rMapMode )); }
100 : bool IsDefault() const;
101 : bool IsSameInstance( const MapMode& rMapMode ) const
102 : { return (mpImplMapMode == rMapMode.mpImplMapMode); }
103 :
104 : friend VCL_DLLPUBLIC SvStream& ReadMapMode( SvStream& rIStm, MapMode& rMapMode );
105 : friend VCL_DLLPUBLIC SvStream& WriteMapMode( SvStream& rOStm, const MapMode& rMapMode );
106 : };
107 :
108 : #endif // INCLUDED_VCL_MAPMOD_HXX
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|