xref: /trunk/main/editeng/inc/editeng/paperinf.hxx (revision 4c5491ea)
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 #ifndef _SVX_PAPERINF_HXX
24 #define _SVX_PAPERINF_HXX
25 
26 // INCLUDE ---------------------------------------------------------------
27 
28 #include <vcl/print.hxx>
29 #include <vcl/mapmod.hxx>
30 #include <editeng/svxenum.hxx>
31 #include "editeng/editengdllapi.h"
32 
33 // forward ---------------------------------------------------------------
34 
35 class Printer;
36 class Size;
37 class String;
38 
39 // class SvxPaperInfo -----------------------------------------------------
40 
41 class EDITENG_DLLPUBLIC SvxPaperInfo
42 {
43 public:
44     static Size     GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP );
45     static Size     GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP );
46     static Size     GetPaperSize( const Printer* pPrinter );
47     static Paper    GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False );
48     static long     GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP );
49     static String   GetName( Paper ePaper );
50 };
51 
52 // INLINE -----------------------------------------------------------------
53 
Swap(Size & rSize)54 inline Size &Swap(Size &rSize)
55 {
56 	const long lVal = rSize.Width();
57 	rSize.Width() = rSize.Height();
58 	rSize.Height() = lVal;
59 	return rSize;
60 }
61 
LandscapeSwap(Size & rSize)62 inline Size &LandscapeSwap(Size &rSize)
63 {
64 	if ( rSize.Height() > rSize.Width() )
65 		Swap( rSize );
66 	return rSize;
67 }
68 
69 #endif
70