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