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