Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / vcl / mapmod.hxx
blob10e06d2e9ca39855c4d6fca32fb9d2ee050e9006
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_MAPMOD_HXX
21 #define INCLUDED_VCL_MAPMOD_HXX
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>
30 class SvStream;
33 // - ImplMapMode -
36 class OutputDevice;
38 class ImplMapMode
40 friend class MapMode;
41 friend class OutputDevice;
43 private:
44 sal_uLong mnRefCount;
45 MapUnit meUnit;
46 Point maOrigin;
47 Fraction maScaleX;
48 Fraction maScaleY;
49 bool mbSimple;
51 friend SvStream& ReadImplMapMode( SvStream& rIStm, ImplMapMode& rMapMode );
52 friend SvStream& WriteImplMapMode( SvStream& rOStm, const ImplMapMode& rMapMode );
54 static ImplMapMode* ImplGetStaticMapMode( MapUnit eUnit );
55 public:
56 ImplMapMode();
57 ImplMapMode( const ImplMapMode& rImpMapMode );
61 // - MapMode -
64 class VCL_DLLPUBLIC MapMode
66 friend class OutputDevice;
68 private:
69 ImplMapMode* mpImplMapMode;
71 SAL_DLLPRIVATE void ImplMakeUnique();
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();
81 void SetMapUnit( MapUnit eUnit );
82 MapUnit GetMapUnit() const
83 { return mpImplMapMode->meUnit; }
85 void SetOrigin( const Point& rOrigin );
86 const Point& GetOrigin() const
87 { return mpImplMapMode->maOrigin; }
89 void SetScaleX( const Fraction& rScaleX );
90 const Fraction& GetScaleX() const
91 { return mpImplMapMode->maScaleX; }
92 void SetScaleY( const Fraction& rScaleY );
93 const Fraction& GetScaleY() const
94 { return mpImplMapMode->maScaleY; }
96 MapMode& operator=( const MapMode& rMapMode );
97 bool operator==( const MapMode& rMapMode ) const;
98 bool operator!=( const MapMode& rMapMode ) const
99 { return !(MapMode::operator==( rMapMode )); }
100 bool IsDefault() const;
101 bool IsSameInstance( const MapMode& rMapMode ) const
102 { return (mpImplMapMode == rMapMode.mpImplMapMode); }
104 friend VCL_DLLPUBLIC SvStream& ReadMapMode( SvStream& rIStm, MapMode& rMapMode );
105 friend VCL_DLLPUBLIC SvStream& WriteMapMode( SvStream& rOStm, const MapMode& rMapMode );
108 #endif // INCLUDED_VCL_MAPMOD_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */