Branch data 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 _SV_MAPMOD_HXX
21 : : #define _SV_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 : : sal_Bool mbSimple;
50 : :
51 : : friend SvStream& operator>>( SvStream& rIStm, ImplMapMode& rMapMode );
52 : : friend SvStream& operator<<( 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 : 1897494 : MapUnit GetMapUnit() const
83 : 1897494 : { return mpImplMapMode->meUnit; }
84 : :
85 : : void SetOrigin( const Point& rOrigin );
86 : 692404 : const Point& GetOrigin() const
87 : 692404 : { return mpImplMapMode->maOrigin; }
88 : :
89 : : void SetScaleX( const Fraction& rScaleX );
90 : 1605345 : const Fraction& GetScaleX() const
91 : 1605345 : { return mpImplMapMode->maScaleX; }
92 : : void SetScaleY( const Fraction& rScaleY );
93 : 1594751 : const Fraction& GetScaleY() const
94 : 1594751 : { return mpImplMapMode->maScaleY; }
95 : :
96 : : MapMode& operator=( const MapMode& rMapMode );
97 : : sal_Bool operator==( const MapMode& rMapMode ) const;
98 : 76948 : sal_Bool operator!=( const MapMode& rMapMode ) const
99 : 76948 : { return !(MapMode::operator==( rMapMode )); }
100 : : sal_Bool IsDefault() const;
101 : : sal_Bool IsSameInstance( const MapMode& rMapMode ) const
102 : : { return (mpImplMapMode == rMapMode.mpImplMapMode); }
103 : :
104 : : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, MapMode& rMapMode );
105 : : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode );
106 : : };
107 : :
108 : : #endif // _SV_MAPMOD_HXX
109 : :
110 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|