xref: /trunk/main/svx/inc/svx/zoomitem.hxx (revision 033ed79537b07af43f0f091b11f5dc308cb4c9ad)
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 _SVX_ZOOMITEM_HXX
25 #define _SVX_ZOOMITEM_HXX
26 
27 #include <svl/intitem.hxx>
28 #ifndef _SVX_SVXIDS_HRC
29 #include <svx/svxids.hrc>
30 #endif
31 #include "svx/svxdllapi.h"
32 
33 //-------------------------------------------------------------------------
34 
35 enum SvxZoomType
36 {
37     SVX_ZOOM_PERCENT, // GetValue() ist kein besonderer prozentualer Wert
38     SVX_ZOOM_OPTIMAL, // GetValue() entspricht der optimalen Gr"o\se
39     SVX_ZOOM_WHOLEPAGE, // GetValue() entspricht der ganzen Seite
40     SVX_ZOOM_PAGEWIDTH, // GetValue() entspricht der Seitenbreite
41     SVX_ZOOM_PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
42 };
43 
44 //-------------------------------------------------------------------------
45 
46 class SVX_DLLPUBLIC SvxZoomItem: public SfxUInt16Item
47 {
48     sal_uInt16                  nValueSet; // erlaubte Werte (siehe #defines unten)
49     SvxZoomType             eType;
50 
51 public:
52     TYPEINFO();
53 
54     SvxZoomItem( SvxZoomType eZoomType = SVX_ZOOM_PERCENT,
55                  sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM );
56     SvxZoomItem( const SvxZoomItem& );
57     ~SvxZoomItem();
58 
59     void                    SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; }
60     sal_uInt16                  GetValueSet() const { return nValueSet; }
61     FASTBOOL                IsValueAllowed( sal_uInt16 nValue ) const
62                             { return nValue == ( nValue & nValueSet ); }
63 
64     SvxZoomType             GetType() const { return eType; }
65     void                    SetType( SvxZoomType eNewType )
66                             { eType = eNewType; }
67 
68     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
69     virtual SfxPoolItem*    Create( SvStream& rStrm, sal_uInt16 nVersion ) const;
70     virtual SvStream&       Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const;
71     virtual int             operator==( const SfxPoolItem& ) const;
72     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
73     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
74 };
75 
76 //------------------------------------------------------------------------
77 
78 #define SVX_ZOOM_ENABLE_50          0x0001
79 #define SVX_ZOOM_ENABLE_75          0x0002
80 #define SVX_ZOOM_ENABLE_100         0x0004
81 #define SVX_ZOOM_ENABLE_150         0x0008
82 #define SVX_ZOOM_ENABLE_200         0x0010
83 #define SVX_ZOOM_ENABLE_OPTIMAL     0x1000
84 #define SVX_ZOOM_ENABLE_WHOLEPAGE   0x2000
85 #define SVX_ZOOM_ENABLE_PAGEWIDTH   0x4000
86 #define SVX_ZOOM_ENABLE_ALL         0x701F
87 
88 #endif
89 
90 /* vim: set noet sw=4 ts=4: */
91