diff -cNr old/sc/inc/sc.hrc new/sc/inc/sc.hrc *** old/sc/inc/sc.hrc Tue Mar 11 18:43:02 2008 --- new/sc/inc/sc.hrc Wed May 7 13:26:20 2008 *************** *** 920,925 **** --- 920,926 ---- #define SID_PREVIEW_ZOOMOUT (SID_PREVIEW_START+6) #define SID_PREVIEW_CLOSE (SID_PREVIEW_START+7) #define SID_PREVIEW_MARGIN (SID_PREVIEW_START+8) + #define SID_PREVIEW_ZOOMSLIDER (SID_PREVIEW_START+9) #define SID_PREVIEW_END (SID_PREVIEW_START+20) //aus sfx: #define SID_KEYFUNC_START (SID_PREVIEW_END+5) diff -cNr old/sc/sdi/prevwsh.sdi new/sc/sdi/prevwsh.sdi *** old/sc/sdi/prevwsh.sdi Thu Feb 14 18:18:00 2008 --- new/sc/sdi/prevwsh.sdi Wed May 7 13:26:42 2008 *************** *** 47,52 **** --- 47,53 ---- SID_PREVIEW_FIRST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_PREVIEW_LAST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_PREVIEW_MARGIN [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_PREVIEW_ZOOMSLIDER [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SfxVoidItem GoUpBlock SID_CURSORPAGEUP ( diff -cNr old/sc/sdi/scalc.sdi new/sc/sdi/scalc.sdi *** old/sc/sdi/scalc.sdi Fri Mar 7 23:10:24 2008 --- new/sc/sdi/scalc.sdi Wed May 7 13:27:12 2008 *************** *** 7630,7635 **** --- 7630,7659 ---- ] //-------------------------------------------------------------------------- + SvxZoomSliderItem ZoomSlider SID_PREVIEW_ZOOMSLIDER + [ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; + ] + + //-------------------------------------------------------------------------- SfxVoidItem SelectTables SID_SELECT_TABLES (SfxIntegerListItem Tables SID_SELECT_TABLES) [ diff -cNr old/sc/source/ui/app/scdll.cxx new/sc/source/ui/app/scdll.cxx *** old/sc/source/ui/app/scdll.cxx Wed Feb 6 02:41:52 2008 --- new/sc/source/ui/app/scdll.cxx Wed May 7 13:43:22 2008 *************** *** 126,132 **** #endif #include #include "tbinsert.hxx" ! #include // Child-Windows #include "reffact.hxx" --- 126,132 ---- #endif #include #include "tbinsert.hxx" ! #include "tbzoomsliderctrl.hxx" #include // Child-Windows #include "reffact.hxx" *************** *** 234,239 **** --- 234,240 ---- ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSERT, pMod); ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSCELLS, pMod); ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSOBJ, pMod); + ScZoomSliderControl ::RegisterControl(SID_PREVIEW_ZOOMSLIDER, pMod); // Svx-Toolbox-Controller SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod); diff -cNr old/sc/source/ui/app/typemap.cxx new/sc/source/ui/app/typemap.cxx *** old/sc/source/ui/app/typemap.cxx Sun May 13 16:26:58 2007 --- new/sc/source/ui/app/typemap.cxx Wed May 7 13:33:54 2008 *************** *** 40,45 **** --- 40,46 ---- #include #include "sc.hrc" #include "scitems.hxx" + #ifndef _SVX_ZOOMSLIDERITEM_HXX #include #endif diff -cNr old/sc/source/ui/cctrl/makefile.mk new/sc/source/ui/cctrl/makefile.mk *** old/sc/source/ui/cctrl/makefile.mk Fri Mar 7 23:10:50 2008 --- new/sc/source/ui/cctrl/makefile.mk Wed May 7 13:35:44 2008 *************** *** 52,64 **** $(SLO)$/popmenu.obj \ $(SLO)$/tbinsert.obj \ $(SLO)$/cbuttonw.obj \ ! $(SLO)$/editfield.obj LIB1TARGET=$(SLB)$/$(TARGET).lib LIB1OBJFILES= \ $(SLO)$/popmenu.obj \ $(SLO)$/tbinsert.obj \ ! $(SLO)$/cbuttonw.obj # --- Tagets ------------------------------------------------------- --- 52,66 ---- $(SLO)$/popmenu.obj \ $(SLO)$/tbinsert.obj \ $(SLO)$/cbuttonw.obj \ ! $(SLO)$/editfield.obj \ ! $(SLO)$/tbzoomsliderctrl.obj LIB1TARGET=$(SLB)$/$(TARGET).lib LIB1OBJFILES= \ $(SLO)$/popmenu.obj \ $(SLO)$/tbinsert.obj \ ! $(SLO)$/cbuttonw.obj \ ! $(SLO)$/tbzoomsliderctrl.obj # --- Tagets ------------------------------------------------------- diff -cNr old/sc/source/ui/cctrl/tbzoomsliderctrl.cxx new/sc/source/ui/cctrl/tbzoomsliderctrl.cxx *** old/sc/source/ui/cctrl/tbzoomsliderctrl.cxx Thu Jan 1 08:00:00 1970 --- new/sc/source/ui/cctrl/tbzoomsliderctrl.cxx Wed May 7 13:52:32 2008 *************** *** 0 **** --- 1,379 ---- + /************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tbzoomsliderctrl.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: maoyg $ $Date: 2008/04/25 10:08:08 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + #include "precompiled_sc.hxx" + #ifndef _SC_ZOOMSLIDERTBCONTRL_HXX + #include "tbzoomsliderctrl.hxx" + #endif + #ifndef _SV_IMAGE_HXX + #include + #endif + #ifndef _SV_TOOLBOX_HXX + #include + #endif + #include + #include + #include + #include + + //======================================================================== + // class ScZoomSliderControl --------------------------------------- + //======================================================================== + + // ----------------------------------------------------------------------- + + SFX_IMPL_TOOLBOX_CONTROL( ScZoomSliderControl, SvxZoomSliderItem ); + + // ----------------------------------------------------------------------- + + ScZoomSliderControl::ScZoomSliderControl( + USHORT nSlotId, + USHORT nId, + ToolBox& rTbx ) + :SfxToolBoxControl( nSlotId, nId, rTbx ) + { + } + + // ----------------------------------------------------------------------- + + __EXPORT ScZoomSliderControl::~ScZoomSliderControl() + { + + } + + // ----------------------------------------------------------------------- + + void ScZoomSliderControl::StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ) + { + USHORT nId = GetId(); + ToolBox& rTbx = GetToolBox(); + ::Rectangle aRect( rTbx.GetItemRect( nId ) ); + ScZoomSliderWnd* pBox = (ScZoomSliderWnd*)(rTbx.GetItemWindow( nId )); + pBox->SetWndControlRect( aRect ); + DBG_ASSERT( pBox ,"Control not found!" ); + + if ( SFX_ITEM_AVAILABLE != eState || pState->ISA( SfxVoidItem ) ) + { + pBox->Disable(); + pBox->Update( ( SvxZoomSliderItem* )NULL ); + } + else + { + pBox->Enable(); + DBG_ASSERT( pState->ISA( SvxZoomSliderItem ), "invalid item type" ); + const SvxZoomSliderItem* pZoomSliderItem = dynamic_cast< const SvxZoomSliderItem* >( pState ); + + DBG_ASSERT( pZoomSliderItem, "Sc::ScZoomSliderControl::StateChanged(), wrong item type!" ); + if( pZoomSliderItem ) + pBox->Update( pZoomSliderItem ); + } + + //SfxToolBoxControl::StateChanged(nSID, eState, pState ); + } + + // ----------------------------------------------------------------------- + + Window* ScZoomSliderControl::CreateItemWindow( Window *pParent ) + { + ScZoomSliderWnd* pSlider = new ScZoomSliderWnd( pParent, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(), ::com::sun::star::uno::UNO_QUERY ), m_xFrame ); + pSlider->Show(); + return pSlider; + } + + // ----------------------------------------------------------------------- + + struct ScZoomSliderWnd::ScZoomSliderWnd_Impl + { + USHORT mnCurrentZoom; + USHORT mnMinZoom; + USHORT mnMaxZoom; + USHORT mnSliderCenter; + std::vector< long > maSnappingPointOffsets; + std::vector< USHORT > maSnappingPointZooms; + Image maSliderButton; + Image maIncreaseButton; + Image maDecreaseButton; + bool mbValuesSet; + bool mbOmitPaint; + + ScZoomSliderWnd_Impl() : + mnCurrentZoom( 100 ), + mnMinZoom( 10 ), + mnMaxZoom( 400 ), + mnSliderCenter( 100 ), + maSnappingPointOffsets(), + maSnappingPointZooms(), + maSliderButton(), + maIncreaseButton(), + maDecreaseButton(), + mbValuesSet( true ), + mbOmitPaint( false ) {} + }; + + // ----------------------------------------------------------------------- + + const long nButtonWidth = 10; //中间滑动条的按钮宽度是10个像素 + const long nButtonHeight = 10; //中间滑动条的按钮高度是10个像素 + const long nIncDecWidth = 11; //增加减小按钮的宽度是11个像素 + const long nIncDecHeight = 11; //增加减小按钮的高度是11个像素 + const long nSliderHeight = 2; + const long nSliderWidth = 4; + const long nSnappingHeight = 4; + const long nSliderXOffset = 20; //滑动条向X轴坐标移动的距离是20个Offset + const long nSnappingEpsilon = 5; // snapping epsilon in pixels + const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points + + + // ----------------------------------------------------------------------- + + //USHORT ScZoomSliderWnd::Offset2Zoom( long nOffset ) const + //{ + // + //} + + // ----------------------------------------------------------------------- + + long ScZoomSliderWnd::Zoom2Offset( USHORT nCurrentZoom ) const + { + //Size aSliderWindowSize = GetOutputSizePixel(); + const long nControlWidth = GetWndControlRect().GetWidth(); + long nRect = nSliderXOffset; + + const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset; + if( nCurrentZoom <= mpImpl->mnSliderCenter ) + { + nCurrentZoom = nCurrentZoom - mpImpl->mnMinZoom; + const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom; + const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nFirstHalfRange; + const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000; + nRect += nOffset; + } + else + { + nCurrentZoom = nCurrentZoom - mpImpl->mnSliderCenter; + const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter; + const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nSecondHalfRange; + const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000; + nRect += nHalfSliderWidth + nOffset; + } + return nRect; + } + + // ----------------------------------------------------------------------- + + + ScZoomSliderWnd::ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame ): + Window( pParent ), + mpImpl( new ScZoomSliderWnd_Impl ), + m_xDispatchProvider( rDispatchProvider ), + m_xFrame( _xFrame ) + { + BOOL bIsDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + mpImpl->maSliderButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERBUTTON_HC : RID_SVXBMP_SLIDERBUTTON ) ); + mpImpl->maIncreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERINCREASE_HC : RID_SVXBMP_SLIDERINCREASE ) ); + mpImpl->maDecreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERDECREASE_HC : RID_SVXBMP_SLIDERDECREASE ) ); + SetBackground(); + Size aSliderSize = LogicToPixel( Size( 115, 40 ), MapMode( MAP_10TH_MM ) ); + SetOutputSizePixel( Size( aSliderSize.Width() * nSliderWidth-1, aSliderSize.Height() + nSliderHeight ) ); + } + + // ----------------------------------------------------------------------- + + ScZoomSliderWnd::~ScZoomSliderWnd() + { + delete mpImpl; + } + + // ----------------------------------------------------------------------- + + void ScZoomSliderWnd::MouseButtonDown( const MouseEvent& rMEvt ) + { + if ( !mpImpl->mbValuesSet ) + return ; + const Rectangle aControlRect = GetWndControlRect(); + const Point aPoint = rMEvt.GetPosPixel(); + + const long nButtonLeftOffset = ( nSliderXOffset - nIncDecWidth )/2; + const long nButtonRightOffset = ( nSliderXOffset + nIncDecWidth )/2; + + const long nOldZoom = mpImpl->mnCurrentZoom; + + // click to - button + if ( aPoint.X() >= nButtonLeftOffset && aPoint.X() <= nButtonRightOffset ) + mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5; + // click to + button + else if ( aPoint.X() >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset && + aPoint.X() <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset ) + mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5; + + if( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom ) + mpImpl->mnCurrentZoom = mpImpl->mnMinZoom; + else if( mpImpl->mnCurrentZoom > mpImpl->mnMaxZoom ) + mpImpl->mnCurrentZoom = mpImpl->mnMaxZoom; + + if( nOldZoom == mpImpl->mnCurrentZoom ) + return ; + + SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom ); + + ::com::sun::star::uno::Any a; + aZoomSliderItem.QueryValue( a ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 ); + aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZoomSlider" )); + aArgs[0].Value = a; + + SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:ZoomSlider"), aArgs ); + } + + // ----------------------------------------------------------------------- + + void ScZoomSliderWnd::MouseMove( const MouseEvent& rMEvt ) + { + + } + + // ----------------------------------------------------------------------- + + void ScZoomSliderWnd::Update( const SvxZoomSliderItem* pZoomSliderItem ) + { + if( pZoomSliderItem ) + { + mpImpl->mnCurrentZoom = pZoomSliderItem->GetValue(); + //mpImpl->mnMinZoom = pZoomSliderItem->GetMinZoom(); + //mpImpl->mnMaxZoom = pZoomSliderItem->GetMaxZoom(); + //mpImpl->mnSliderCenter= 100; + //mpImpl->mbValuesSet = true; + + DBG_ASSERT( mpImpl->mnMinZoom <= mpImpl->mnCurrentZoom && + mpImpl->mnMinZoom < mpImpl->mnSliderCenter && + mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom && + mpImpl->mnMaxZoom > mpImpl->mnSliderCenter, + "Looks like the zoom slider item is corrupted" ) + const com::sun::star::uno::Sequence < sal_Int32 > rSnappingPoints = pZoomSliderItem->GetSnappingPoints(); + } + /*const Size& rSize = GetOutputSizePixel();*/ + /* if ( !mpImpl->mbOmitPaint ) + Paint(Rectangle( Point( 0, 0), rSize ));*/ + //Update(); + } + + // -------------------------------------------------------s---------------- + + void ScZoomSliderWnd::Paint( const Rectangle& rRect ) + { + /*if( !mpImpl->mbValuesSet || mpImpl->mbOmitPaint ) + return;*/ + + Size aSliderWindowSize = GetOutputSizePixel(); //得到设置窗口的像素值 + const Rectangle aControlRect = GetWndControlRect(); + Rectangle aSlider = rRect; /* aSlider是一个矩形 */ + + aSlider.Top() += ( aControlRect.GetHeight() - nSliderHeight )/2 - 1; //初始化矩形的大小 + aSlider.Bottom() = aSlider.Top() + nSliderHeight; + aSlider.Left() += nSliderXOffset; + aSlider.Right() -= nSliderXOffset; + + Color aOldLineColor = GetLineColor(); //得到线条的颜色 + Color aOldFillColor = GetFillColor(); //得到填充的颜色 + + SetLineColor( Color( COL_GRAY ) ); //设置线条的颜色为灰色 + SetFillColor( Color( COL_GRAY ) ); //设置填充的颜色为灰色 + + //// draw snapping points: + //std::vector< long >::iterator aSnappingPointIter; + //for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin(); + // aSnappingPointIter != mpImpl->maSnappingPointOffsets.end(); + // ++aSnappingPointIter ) + //{ + // Rectangle aSnapping( aSlider ); + // aSnapping.Bottom() = aSlider.Top(); + // aSnapping.Top() = aSnapping.Bottom() - nSnappingHeight; + // aSnapping.Left() += *aSnappingPointIter; + // aSnapping.Right() = aSnapping.Left(); + // DrawRect( aSnapping ); + + // aSnapping.Top() += nSnappingHeight + nSliderHeight; + // aSnapping.Bottom() += nSnappingHeight + nSliderHeight; + // DrawRect( aSnapping ); + //} + + Rectangle aFirstLine( aSlider ); //画滑动条的第一条线 + aFirstLine.Bottom() = aFirstLine.Top(); //用矩形的Top值初始化Bottom值,相当于画一条直线 + + Rectangle aSecondLine( aSlider ); //画滑动条的第二条线 + aSecondLine.Top() = aSecondLine.Bottom(); //用矩形的Bottom值初始化Top值,相当于画一条直线 + + Rectangle aLeft( aSlider ); //画滑动条的左边线条 + aLeft.Right() = aLeft.Left(); //用矩形的Left值初始化Right值 + + Rectangle aRight( aSlider ); //画滑动条的右边线条 + aRight.Left() = aRight.Right(); //用矩形的Right值初始化Left值 + + SetLineColor( Color ( COL_WHITE ) ); //设置线条为白色 + SetFillColor( Color ( COL_WHITE ) ); //设置填充色为白色 + DrawRect( aSecondLine ); //画滑动条的第二条线 + DrawRect( aRight ); //画滑动条的右线条 + + SetLineColor( Color( COL_GRAY ) ); //设置线条为灰色 + SetFillColor( Color( COL_GRAY ) ); //设置填充色为灰色 + DrawRect( aFirstLine ); //画滑动条的第一条线 + DrawRect( aLeft ); //画滑动条的左线条 + + // draw slider button + Point aImagePoint = rRect.TopLeft(); //将矩形的左left上top转化为Point(Left, Top). + aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom ); //根据当前的缩放比例得到屏幕上的地址的X坐标 + aImagePoint.X() -= nButtonWidth/2; + aImagePoint.Y() += ( aControlRect.GetHeight() - nButtonHeight)/2; + DrawImage( aImagePoint, mpImpl->maSliderButton ); + + // draw decrease button + aImagePoint = rRect.TopLeft(); //将矩形的左left上top转化为Point(Left, Top). + aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2; + aImagePoint.Y() += ( aControlRect.GetHeight() - nIncDecHeight)/2; + DrawImage( aImagePoint, mpImpl->maDecreaseButton ); + + // draw increase button + aImagePoint.X() = rRect.TopLeft().X() + aControlRect.GetWidth() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2; + DrawImage( aImagePoint, mpImpl->maIncreaseButton ); + + SetLineColor( aOldLineColor ); + SetFillColor( aOldFillColor ); + + } + + // ----------------------------------------------------------------------- diff -cNr old/sc/source/ui/inc/tbzoomsliderctrl.hxx new/sc/source/ui/inc/tbzoomsliderctrl.hxx *** old/sc/source/ui/inc/tbzoomsliderctrl.hxx Thu Jan 1 08:00:00 1970 --- new/sc/source/ui/inc/tbzoomsliderctrl.hxx Wed May 7 13:42:02 2008 *************** *** 0 **** --- 1,96 ---- + /************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tbzoomsliderctrl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: maoyg $ $Date: 2008/04/25 10:08:08 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + #ifndef _SC_ZOOMSLIDERTBCONTRL_HXX + #define _SC_ZOOMSLIDERTBCONTRL_HXX + + #ifndef _WINDOW_HXX //autogen + #include + #endif + #ifndef _SFXPOOLITEM_HXX //autogen + #include + #endif + #ifndef _SFXTBXCTRL_HXX //autogen + #include + #endif + #ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ + #include + #endif + #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ + #include + #endif + #include + + + //class ScZoomSliderControl define + class ScZoomSliderControl: public SfxToolBoxControl + { + public: + SFX_DECL_TOOLBOX_CONTROL(); + ScZoomSliderControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~ScZoomSliderControl(); + + virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual Window* CreateItemWindow( Window *pParent ); + }; + + //======================================================================== + // class ScZoomSliderWnd define--------------------------------------- + //======================================================================== + class ScZoomSliderWnd: public Window + { + private: + struct ScZoomSliderWnd_Impl; + ScZoomSliderWnd_Impl* mpImpl; + Rectangle aRect; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + + //USHORT Offset2Zoom( long nOffset ) const; + long Zoom2Offset( USHORT nZoom ) const; + + public: + ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame ); + ~ScZoomSliderWnd(); + void Update( const SvxZoomSliderItem* pZoomSliderItem ); + void SetWndControlRect( const Rectangle& rRect ) { aRect = rRect; } + Rectangle GetWndControlRect() const{ return aRect; } + + protected: + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + }; + #endif \ No newline at end of file diff -cNr old/sc/source/ui/view/prevwsh.cxx new/sc/source/ui/view/prevwsh.cxx *** old/sc/source/ui/view/prevwsh.cxx Fri Mar 7 23:11:14 2008 --- new/sc/source/ui/view/prevwsh.cxx Wed May 7 13:32:32 2008 *************** *** 60,67 **** --- 60,69 ---- #include #include + #ifndef _SVX_ZOOMSLIDERITEM_HXX #include #endif #include "prevwsh.hxx" #include "preview.hxx" + #include "printfun.hxx" #include "scmod.hxx" #include "inputhdl.hxx" #include "docsh.hxx" *************** *** 95,100 **** --- 97,104 ---- #include "scabstdlg.hxx" //CHINA001 // fuer Rad-Maus #define SC_DELTA_ZOOM 10 + #define MINZOOM_SLIDER 10 + #define MAXZOOM_SLIDER 400 #define SC_USERDATA_SEP ';' *************** *** 718,723 **** --- 722,745 ---- rReq.Done(); } break; + case SID_PREVIEW_ZOOMSLIDER: + { + const SfxItemSet *pArgs = rReq.GetArgs(); + const SfxPoolItem* pItem; + String aOldName = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() ); + ScStyleSheetPool* pStylePool = pDocShell->GetDocument()->GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE ); + DBG_ASSERT( pStyleSheet, "PageStyle not found! :-/" ); + + if ( pArgs && pStyleSheet && SFX_ITEM_SET == pArgs->GetItemState( SID_PREVIEW_ZOOMSLIDER, TRUE, &pItem ) ) + { + pDocShell->GetDocument()->ModifyStyleSheet( *pStyleSheet, *pArgs ); + } + rReq.Done(); + GetViewFrame()->GetBindings().Invalidate( nSlot ); + GetViewFrame()->GetBindings().Update( nSlot ); + } + break; case SID_PRINTPREVIEW: case SID_PREVIEW_CLOSE: // print preview is now always in the same frame as the tab view *************** *** 793,798 **** --- 815,833 ---- rSet.Put( aZoom ); } break; + case SID_PREVIEW_ZOOMSLIDER: + { + if( pDocShell->IsReadOnly() ) + rSet.DisableItem( nWhich ); + else + { + const USHORT nCurrentZoom = ScPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab ).GetZoom(); + SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_ZOOMSLIDER ); + aZoomSliderItem.AddSnappingPoint( 100 ); + rSet.Put( aZoomSliderItem ); + } + } + break; case SID_STATUS_DOCPOS: rSet.Put( SfxStringItem( nWhich, pPreview->GetPosString() ) ); break; diff -cNr old/sc/uiconfig/scalc/toolbar/previewbar.xml new/sc/uiconfig/scalc/toolbar/previewbar.xml *** old/sc/uiconfig/scalc/toolbar/previewbar.xml Thu Feb 14 18:18:34 2008 --- new/sc/uiconfig/scalc/toolbar/previewbar.xml Wed May 7 13:28:00 2008 *************** *** 16,20 **** --- 16,22 ---- + + \ No newline at end of file