xref: /aoo42x/main/sw/source/ui/utlui/zoomctrl.cxx (revision a22b373e)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_sw.hxx"
24 
25 #include "hintids.hxx"
26 
27 #ifndef _STATUS_HXX //autogen
28 #include <vcl/status.hxx>
29 #endif
30 #include <sfx2/app.hxx>
31 #include <svl/stritem.hxx>
32 #include <svx/zoomitem.hxx>
33 
34 #include "swtypes.hxx"
35 #include "zoomctrl.hxx"
36 
37 
38 SFX_IMPL_STATUSBAR_CONTROL( SwZoomControl, SvxZoomItem );
39 
40 
SwZoomControl(sal_uInt16 _nSlotId,sal_uInt16 _nId,StatusBar & rStb)41 SwZoomControl::SwZoomControl( sal_uInt16 _nSlotId,
42 							  sal_uInt16 _nId,
43 							  StatusBar& rStb ) :
44 	SvxZoomStatusBarControl( _nSlotId, _nId, rStb )
45 {
46 }
47 
48 // -----------------------------------------------------------------------
49 
~SwZoomControl()50 SwZoomControl::~SwZoomControl()
51 {
52 }
53 
54 // -----------------------------------------------------------------------
55 
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)56 void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
57 								  const SfxPoolItem* pState )
58 {
59 	if(SFX_ITEM_AVAILABLE == eState && pState->ISA( SfxStringItem ))
60 	{
61 		sPreviewZoom = ((const SfxStringItem*)pState)->GetValue();
62 		GetStatusBar().SetItemText( GetId(), sPreviewZoom );
63 	}
64 	else
65 	{
66 		sPreviewZoom = aEmptyStr;
67 		SvxZoomStatusBarControl::StateChanged(nSID, eState, pState);
68 	}
69 }
70 
71 // -----------------------------------------------------------------------
72 
Paint(const UserDrawEvent & rUsrEvt)73 void SwZoomControl::Paint( const UserDrawEvent& rUsrEvt )
74 {
75 	if(!sPreviewZoom.Len())
76 		SvxZoomStatusBarControl::Paint(rUsrEvt);
77 	else
78 		GetStatusBar().SetItemText( GetId(), sPreviewZoom );
79 }
80 
81 // -----------------------------------------------------------------------
82 
Command(const CommandEvent & rCEvt)83 void SwZoomControl::Command( const CommandEvent& rCEvt )
84 {
85 	if(!sPreviewZoom.Len())
86 		SvxZoomStatusBarControl::Command(rCEvt);
87 }
88 
89 /* vim: set noet sw=4 ts=4: */
90