1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _SVX_GRFPAGE_HXX 29*cdf0e10cSrcweir #define _SVX_GRFPAGE_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen 32*cdf0e10cSrcweir #include <vcl/fixed.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen 35*cdf0e10cSrcweir #include <vcl/button.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _FIELD_HXX //autogen 38*cdf0e10cSrcweir #include <vcl/field.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #include <vcl/graph.hxx> 41*cdf0e10cSrcweir #include <sfx2/tabdlg.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir class SvxGrfCropPage : public SfxTabPage 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir using Window::CalcZoom; 47*cdf0e10cSrcweir using TabPage::ActivatePage; 48*cdf0e10cSrcweir using TabPage::DeactivatePage; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir class SvxCropExample : public Window 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir Size aFrameSize; 53*cdf0e10cSrcweir Point aTopLeft, aBottomRight; 54*cdf0e10cSrcweir Graphic aGrf; 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir public: 57*cdf0e10cSrcweir SvxCropExample( Window* pPar, const ResId& rResId ); 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; } 62*cdf0e10cSrcweir void SetTop( long nVal ) { aTopLeft.X() = nVal; } 63*cdf0e10cSrcweir void SetBottom( long nVal ) { aBottomRight.X() = nVal; } 64*cdf0e10cSrcweir void SetLeft( long nVal ) { aTopLeft.Y() = nVal; } 65*cdf0e10cSrcweir void SetRight( long nVal) { aBottomRight.Y() = nVal; } 66*cdf0e10cSrcweir void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; } 67*cdf0e10cSrcweir void SetFrameSize( const Size& rSz ); 68*cdf0e10cSrcweir void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; } 69*cdf0e10cSrcweir const Graphic& GetGraphic() const { return aGrf; } 70*cdf0e10cSrcweir }; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir FixedLine aCropFL; 73*cdf0e10cSrcweir RadioButton aZoomConstRB; 74*cdf0e10cSrcweir RadioButton aSizeConstRB; 75*cdf0e10cSrcweir FixedText aLeftFT; 76*cdf0e10cSrcweir MetricField aLeftMF; 77*cdf0e10cSrcweir FixedText aRightFT; 78*cdf0e10cSrcweir MetricField aRightMF; 79*cdf0e10cSrcweir FixedText aTopFT; 80*cdf0e10cSrcweir MetricField aTopMF; 81*cdf0e10cSrcweir FixedText aBottomFT; 82*cdf0e10cSrcweir MetricField aBottomMF; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir FixedLine aZoomFL; 85*cdf0e10cSrcweir FixedText aWidthZoomFT; 86*cdf0e10cSrcweir MetricField aWidthZoomMF; 87*cdf0e10cSrcweir FixedText aHeightZoomFT; 88*cdf0e10cSrcweir MetricField aHeightZoomMF; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir FixedLine aSizeFL; 91*cdf0e10cSrcweir FixedText aWidthFT; 92*cdf0e10cSrcweir MetricField aWidthMF; 93*cdf0e10cSrcweir FixedText aHeightFT; 94*cdf0e10cSrcweir MetricField aHeightMF; 95*cdf0e10cSrcweir FixedText aOrigSizeFT; 96*cdf0e10cSrcweir PushButton aOrigSizePB; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir // Example 99*cdf0e10cSrcweir SvxCropExample aExampleWN; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir Timer aTimer; 103*cdf0e10cSrcweir String aGraphicName; 104*cdf0e10cSrcweir Size aOrigSize; 105*cdf0e10cSrcweir Size aPageSize; 106*cdf0e10cSrcweir const MetricField* pLastCropField; 107*cdf0e10cSrcweir long nOldWidth; 108*cdf0e10cSrcweir long nOldHeight; 109*cdf0e10cSrcweir sal_Bool bReset; 110*cdf0e10cSrcweir sal_Bool bInitialized; 111*cdf0e10cSrcweir sal_Bool bSetOrigSize; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet ); 115*cdf0e10cSrcweir virtual ~SvxGrfCropPage(); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir DECL_LINK( ZoomHdl, MetricField * ); 118*cdf0e10cSrcweir DECL_LINK( SizeHdl, MetricField * ); 119*cdf0e10cSrcweir DECL_LINK( CropHdl, const MetricField * ); 120*cdf0e10cSrcweir DECL_LINK( CropLoseFocusHdl, MetricField * ); 121*cdf0e10cSrcweir DECL_LINK( CropModifyHdl, MetricField * ); 122*cdf0e10cSrcweir DECL_LINK( OrigSizeHdl, PushButton * ); 123*cdf0e10cSrcweir DECL_LINK( Timeout, Timer * ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir void CalcZoom(); 126*cdf0e10cSrcweir void CalcMinMaxBorder(); 127*cdf0e10cSrcweir void GraphicHasChanged(sal_Bool bFound); 128*cdf0e10cSrcweir virtual void ActivatePage(const SfxItemSet& rSet); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir Size GetGrfOrigSize( const Graphic& ) const; 131*cdf0e10cSrcweir public: 132*cdf0e10cSrcweir static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir virtual sal_Bool FillItemSet( SfxItemSet &rSet ); 135*cdf0e10cSrcweir virtual void Reset( const SfxItemSet &rSet ); 136*cdf0e10cSrcweir virtual int DeactivatePage( SfxItemSet *pSet ); 137*cdf0e10cSrcweir }; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir #endif 141