1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 32 33 #include "hintids.hxx" 34 35 #ifndef _STATUS_HXX //autogen 36 #include <vcl/status.hxx> 37 #endif 38 #include <sfx2/app.hxx> 39 #include <svl/stritem.hxx> 40 #include <svx/zoomitem.hxx> 41 42 #include "swtypes.hxx" 43 #include "zoomctrl.hxx" 44 45 46 SFX_IMPL_STATUSBAR_CONTROL( SwZoomControl, SvxZoomItem ); 47 48 49 SwZoomControl::SwZoomControl( sal_uInt16 _nSlotId, 50 sal_uInt16 _nId, 51 StatusBar& rStb ) : 52 SvxZoomStatusBarControl( _nSlotId, _nId, rStb ) 53 { 54 } 55 56 // ----------------------------------------------------------------------- 57 58 SwZoomControl::~SwZoomControl() 59 { 60 } 61 62 // ----------------------------------------------------------------------- 63 64 void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, 65 const SfxPoolItem* pState ) 66 { 67 if(SFX_ITEM_AVAILABLE == eState && pState->ISA( SfxStringItem )) 68 { 69 sPreviewZoom = ((const SfxStringItem*)pState)->GetValue(); 70 GetStatusBar().SetItemText( GetId(), sPreviewZoom ); 71 } 72 else 73 { 74 sPreviewZoom = aEmptyStr; 75 SvxZoomStatusBarControl::StateChanged(nSID, eState, pState); 76 } 77 } 78 79 // ----------------------------------------------------------------------- 80 81 void SwZoomControl::Paint( const UserDrawEvent& rUsrEvt ) 82 { 83 if(!sPreviewZoom.Len()) 84 SvxZoomStatusBarControl::Paint(rUsrEvt); 85 else 86 GetStatusBar().SetItemText( GetId(), sPreviewZoom ); 87 } 88 89 // ----------------------------------------------------------------------- 90 91 void SwZoomControl::Command( const CommandEvent& rCEvt ) 92 { 93 if(!sPreviewZoom.Len()) 94 SvxZoomStatusBarControl::Command(rCEvt); 95 } 96 97 98 99 100