xref: /trunk/main/cui/source/inc/grfpage.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c4eee24dSAndrew Rist  * distributed with this work for additional information
6*c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9*c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15*c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18*c4eee24dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*c4eee24dSAndrew Rist  *************************************************************/
21*c4eee24dSAndrew Rist 
22*c4eee24dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVX_GRFPAGE_HXX
25cdf0e10cSrcweir #define _SVX_GRFPAGE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen
28cdf0e10cSrcweir #include <vcl/fixed.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen
31cdf0e10cSrcweir #include <vcl/button.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _FIELD_HXX //autogen
34cdf0e10cSrcweir #include <vcl/field.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <vcl/graph.hxx>
37cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SvxGrfCropPage : public SfxTabPage
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     using Window::CalcZoom;
43cdf0e10cSrcweir     using TabPage::ActivatePage;
44cdf0e10cSrcweir     using TabPage::DeactivatePage;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     class SvxCropExample : public Window
47cdf0e10cSrcweir     {
48cdf0e10cSrcweir         Size        aFrameSize;
49cdf0e10cSrcweir         Point       aTopLeft, aBottomRight;
50cdf0e10cSrcweir         Graphic     aGrf;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     public:
53cdf0e10cSrcweir         SvxCropExample( Window* pPar, const ResId& rResId );
54cdf0e10cSrcweir 
55cdf0e10cSrcweir         virtual void Paint( const Rectangle& rRect );
56cdf0e10cSrcweir 
SetTopLeft(const Point & rNew)57cdf0e10cSrcweir         void SetTopLeft( const Point& rNew )    { aTopLeft = rNew; }
SetTop(long nVal)58cdf0e10cSrcweir         void SetTop( long nVal )                { aTopLeft.X() = nVal; }
SetBottom(long nVal)59cdf0e10cSrcweir         void SetBottom( long nVal )             { aBottomRight.X() = nVal; }
SetLeft(long nVal)60cdf0e10cSrcweir         void SetLeft( long nVal )               { aTopLeft.Y() = nVal; }
SetRight(long nVal)61cdf0e10cSrcweir         void SetRight( long nVal)               { aBottomRight.Y() = nVal; }
SetBottomRight(const Point & rNew)62cdf0e10cSrcweir         void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
63cdf0e10cSrcweir         void SetFrameSize( const Size& rSz );
SetGraphic(const Graphic & rGrf)64cdf0e10cSrcweir         void SetGraphic( const Graphic& rGrf )  { aGrf = rGrf; }
GetGraphic() const65cdf0e10cSrcweir         const Graphic& GetGraphic() const       { return aGrf; }
66cdf0e10cSrcweir     };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     FixedLine       aCropFL;
69cdf0e10cSrcweir     RadioButton     aZoomConstRB;
70cdf0e10cSrcweir     RadioButton     aSizeConstRB;
71cdf0e10cSrcweir     FixedText       aLeftFT;
72cdf0e10cSrcweir     MetricField     aLeftMF;
73cdf0e10cSrcweir     FixedText       aRightFT;
74cdf0e10cSrcweir     MetricField     aRightMF;
75cdf0e10cSrcweir     FixedText       aTopFT;
76cdf0e10cSrcweir     MetricField     aTopMF;
77cdf0e10cSrcweir     FixedText       aBottomFT;
78cdf0e10cSrcweir     MetricField     aBottomMF;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     FixedLine       aZoomFL;
81cdf0e10cSrcweir     FixedText       aWidthZoomFT;
82cdf0e10cSrcweir     MetricField     aWidthZoomMF;
83cdf0e10cSrcweir     FixedText       aHeightZoomFT;
84cdf0e10cSrcweir     MetricField     aHeightZoomMF;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     FixedLine       aSizeFL;
87cdf0e10cSrcweir     FixedText       aWidthFT;
88cdf0e10cSrcweir     MetricField     aWidthMF;
89cdf0e10cSrcweir     FixedText       aHeightFT;
90cdf0e10cSrcweir     MetricField     aHeightMF;
91cdf0e10cSrcweir     FixedText       aOrigSizeFT;
92cdf0e10cSrcweir     PushButton      aOrigSizePB;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     // Example
95cdf0e10cSrcweir     SvxCropExample  aExampleWN;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     Timer           aTimer;
99cdf0e10cSrcweir     String          aGraphicName;
100cdf0e10cSrcweir     Size            aOrigSize;
101cdf0e10cSrcweir     Size            aPageSize;
102cdf0e10cSrcweir     const MetricField*  pLastCropField;
103cdf0e10cSrcweir     long            nOldWidth;
104cdf0e10cSrcweir     long            nOldHeight;
105cdf0e10cSrcweir     sal_Bool            bReset;
106cdf0e10cSrcweir     sal_Bool            bInitialized;
107cdf0e10cSrcweir     sal_Bool            bSetOrigSize;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
111cdf0e10cSrcweir     virtual ~SvxGrfCropPage();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     DECL_LINK( ZoomHdl, MetricField * );
114cdf0e10cSrcweir     DECL_LINK( SizeHdl, MetricField * );
115cdf0e10cSrcweir     DECL_LINK( CropHdl, const MetricField * );
116cdf0e10cSrcweir     DECL_LINK( CropLoseFocusHdl, MetricField * );
117cdf0e10cSrcweir     DECL_LINK( CropModifyHdl, MetricField * );
118cdf0e10cSrcweir     DECL_LINK( OrigSizeHdl, PushButton * );
119cdf0e10cSrcweir     DECL_LINK( Timeout, Timer * );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     void            CalcZoom();
122cdf0e10cSrcweir     void            CalcMinMaxBorder();
123cdf0e10cSrcweir     void            GraphicHasChanged(sal_Bool bFound);
124cdf0e10cSrcweir     virtual void    ActivatePage(const SfxItemSet& rSet);
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     Size            GetGrfOrigSize( const Graphic& ) const;
127cdf0e10cSrcweir public:
128cdf0e10cSrcweir     static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual sal_Bool FillItemSet( SfxItemSet &rSet );
131cdf0e10cSrcweir     virtual void Reset( const SfxItemSet &rSet );
132cdf0e10cSrcweir     virtual int DeactivatePage( SfxItemSet *pSet );
133cdf0e10cSrcweir };
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 
136cdf0e10cSrcweir #endif
137