1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f6e50924SAndrew Rist * distributed with this work for additional information
6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10*f6e50924SAndrew Rist *
11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist *
13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17*f6e50924SAndrew Rist * specific language governing permissions and limitations
18*f6e50924SAndrew Rist * under the License.
19*f6e50924SAndrew Rist *
20*f6e50924SAndrew Rist *************************************************************/
21*f6e50924SAndrew Rist
22*f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #include <sfx2/app.hxx>
30cdf0e10cSrcweir #include <sfx2/module.hxx>
31cdf0e10cSrcweir #include <svl/intitem.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #define _SVX_OPTGRID_CXX
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include <svx/svxids.hrc>
36cdf0e10cSrcweir #include <svx/dialmgr.hxx>
37cdf0e10cSrcweir #include "svx/optgrid.hxx"
38cdf0e10cSrcweir #include <svx/dialogs.hrc>
39cdf0e10cSrcweir #include "optgrid.hrc"
40cdf0e10cSrcweir #include "svx/dlgutil.hxx"
41cdf0e10cSrcweir
42cdf0e10cSrcweir /* -----------------18.08.98 17:41-------------------
43cdf0e10cSrcweir * local functions
44cdf0e10cSrcweir * --------------------------------------------------*/
lcl_GetMinMax(MetricField & rField,long & nFirst,long & nLast,long & nMin,long & nMax)45cdf0e10cSrcweir void lcl_GetMinMax(MetricField& rField, long& nFirst, long& nLast, long& nMin, long& nMax)
46cdf0e10cSrcweir {
47cdf0e10cSrcweir nFirst = static_cast<long>(rField.Denormalize( rField.GetFirst( FUNIT_TWIP ) ));
48cdf0e10cSrcweir nLast = static_cast<long>(rField.Denormalize( rField.GetLast( FUNIT_TWIP ) ));
49cdf0e10cSrcweir nMin = static_cast<long>(rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ));
50cdf0e10cSrcweir nMax = static_cast<long>(rField.Denormalize( rField.GetMax( FUNIT_TWIP ) ));
51cdf0e10cSrcweir }
52cdf0e10cSrcweir
lcl_SetMinMax(MetricField & rField,long nFirst,long nLast,long nMin,long nMax)53cdf0e10cSrcweir void lcl_SetMinMax(MetricField& rField, long nFirst, long nLast, long nMin, long nMax)
54cdf0e10cSrcweir {
55cdf0e10cSrcweir rField.SetFirst( rField.Normalize( nFirst ), FUNIT_TWIP );
56cdf0e10cSrcweir rField.SetLast( rField.Normalize( nLast ), FUNIT_TWIP );
57cdf0e10cSrcweir rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP );
58cdf0e10cSrcweir rField.SetMax( rField.Normalize( nMax ), FUNIT_TWIP );
59cdf0e10cSrcweir }
60cdf0e10cSrcweir
61cdf0e10cSrcweir /*--------------------------------------------------------------------
62cdf0e10cSrcweir Beschreibung: Rastereinstellungen Ctor
63cdf0e10cSrcweir --------------------------------------------------------------------*/
64cdf0e10cSrcweir
SvxOptionsGrid()65cdf0e10cSrcweir SvxOptionsGrid::SvxOptionsGrid() :
66cdf0e10cSrcweir nFldDrawX ( 100 ),
67cdf0e10cSrcweir nFldDivisionX ( 0 ),
68cdf0e10cSrcweir nFldDrawY ( 100 ),
69cdf0e10cSrcweir nFldDivisionY ( 0 ),
70cdf0e10cSrcweir nFldSnapX ( 100 ),
71cdf0e10cSrcweir nFldSnapY ( 100 ),
72cdf0e10cSrcweir bUseGridsnap ( 0 ),
73cdf0e10cSrcweir bSynchronize ( 1 ),
74cdf0e10cSrcweir bGridVisible ( 0 ),
75cdf0e10cSrcweir bEqualGrid ( 1 )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
79cdf0e10cSrcweir /*--------------------------------------------------------------------
80cdf0e10cSrcweir Beschreibung: Rastereinstellungen Dtor
81cdf0e10cSrcweir --------------------------------------------------------------------*/
82cdf0e10cSrcweir
~SvxOptionsGrid()83cdf0e10cSrcweir SvxOptionsGrid::~SvxOptionsGrid()
84cdf0e10cSrcweir {
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir /*--------------------------------------------------------------------
88cdf0e10cSrcweir Beschreibung: Item fuer Rastereinstellungen
89cdf0e10cSrcweir --------------------------------------------------------------------*/
90cdf0e10cSrcweir
SvxGridItem(const SvxGridItem & rItem)91cdf0e10cSrcweir SvxGridItem::SvxGridItem( const SvxGridItem& rItem )
92cdf0e10cSrcweir : SvxOptionsGrid()
93cdf0e10cSrcweir , SfxPoolItem(rItem)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir bUseGridsnap = rItem.bUseGridsnap ;
96cdf0e10cSrcweir bSynchronize = rItem.bSynchronize ;
97cdf0e10cSrcweir bGridVisible = rItem.bGridVisible ;
98cdf0e10cSrcweir bEqualGrid = rItem.bEqualGrid ;
99cdf0e10cSrcweir nFldDrawX = rItem.nFldDrawX ;
100cdf0e10cSrcweir nFldDivisionX= rItem.nFldDivisionX;
101cdf0e10cSrcweir nFldDrawY = rItem.nFldDrawY ;
102cdf0e10cSrcweir nFldDivisionY= rItem.nFldDivisionY;
103cdf0e10cSrcweir nFldSnapX = rItem.nFldSnapX ;
104cdf0e10cSrcweir nFldSnapY = rItem.nFldSnapY ;
105cdf0e10cSrcweir
106cdf0e10cSrcweir };
107cdf0e10cSrcweir
108cdf0e10cSrcweir /*--------------------------------------------------------------------
109cdf0e10cSrcweir Beschreibung:
110cdf0e10cSrcweir --------------------------------------------------------------------*/
111cdf0e10cSrcweir
Clone(SfxItemPool *) const112cdf0e10cSrcweir SfxPoolItem* SvxGridItem::Clone( SfxItemPool* ) const
113cdf0e10cSrcweir {
114cdf0e10cSrcweir return new SvxGridItem( *this );
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
117cdf0e10cSrcweir /*--------------------------------------------------------------------
118cdf0e10cSrcweir Beschreibung:
119cdf0e10cSrcweir --------------------------------------------------------------------*/
120cdf0e10cSrcweir
operator ==(const SfxPoolItem & rAttr) const121cdf0e10cSrcweir int SvxGridItem::operator==( const SfxPoolItem& rAttr ) const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
124cdf0e10cSrcweir
125cdf0e10cSrcweir const SvxGridItem& rItem = (const SvxGridItem&) rAttr;
126cdf0e10cSrcweir
127cdf0e10cSrcweir return ( bUseGridsnap == rItem.bUseGridsnap &&
128cdf0e10cSrcweir bSynchronize == rItem.bSynchronize &&
129cdf0e10cSrcweir bGridVisible == rItem.bGridVisible &&
130cdf0e10cSrcweir bEqualGrid == rItem.bEqualGrid &&
131cdf0e10cSrcweir nFldDrawX == rItem.nFldDrawX &&
132cdf0e10cSrcweir nFldDivisionX== rItem.nFldDivisionX&&
133cdf0e10cSrcweir nFldDrawY == rItem.nFldDrawY &&
134cdf0e10cSrcweir nFldDivisionY== rItem.nFldDivisionY&&
135cdf0e10cSrcweir nFldSnapX == rItem.nFldSnapX &&
136cdf0e10cSrcweir nFldSnapY == rItem.nFldSnapY );
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
139cdf0e10cSrcweir /*--------------------------------------------------------------------
140cdf0e10cSrcweir Beschreibung:
141cdf0e10cSrcweir --------------------------------------------------------------------*/
142cdf0e10cSrcweir
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const143cdf0e10cSrcweir SfxItemPresentation SvxGridItem::GetPresentation
144cdf0e10cSrcweir (
145cdf0e10cSrcweir SfxItemPresentation ePres,
146cdf0e10cSrcweir SfxMapUnit /*eCoreUnit*/,
147cdf0e10cSrcweir SfxMapUnit /*ePresUnit*/,
148cdf0e10cSrcweir String& rText, const IntlWrapper *
149cdf0e10cSrcweir ) const
150cdf0e10cSrcweir {
151cdf0e10cSrcweir switch ( ePres )
152cdf0e10cSrcweir {
153cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NONE:
154cdf0e10cSrcweir rText.Erase();
155cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE;
156cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_NAMELESS:
157cdf0e10cSrcweir case SFX_ITEM_PRESENTATION_COMPLETE:
158cdf0e10cSrcweir rText = String::CreateFromAscii("SvxGridItem");
159cdf0e10cSrcweir return ePres;
160cdf0e10cSrcweir default:
161cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NONE;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165cdf0e10cSrcweir
166cdf0e10cSrcweir /*----------------- OS 23.02.95 -----------------------
167cdf0e10cSrcweir TabPage Rastereinstellungen
168cdf0e10cSrcweir -------------------------------------------------------*/
169cdf0e10cSrcweir
SvxGridTabPage(Window * pParent,const SfxItemSet & rCoreSet)170cdf0e10cSrcweir SvxGridTabPage::SvxGridTabPage( Window* pParent, const SfxItemSet& rCoreSet) :
171cdf0e10cSrcweir
172cdf0e10cSrcweir SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRID ), rCoreSet ),
173cdf0e10cSrcweir
174cdf0e10cSrcweir aCbxUseGridsnap ( this, SVX_RES( CBX_USE_GRIDSNAP ) ),
175cdf0e10cSrcweir aCbxGridVisible ( this, SVX_RES( CBX_GRID_VISIBLE ) ),
176cdf0e10cSrcweir
177cdf0e10cSrcweir aFlResolution ( this, SVX_RES( FL_RESOLUTION ) ),
178cdf0e10cSrcweir aFtDrawX ( this, SVX_RES( FT_DRAW_X ) ),
179cdf0e10cSrcweir aMtrFldDrawX ( this, SVX_RES( MTR_FLD_DRAW_X ) ),
180cdf0e10cSrcweir aFtDrawY ( this, SVX_RES( FT_DRAW_Y ) ),
181cdf0e10cSrcweir aMtrFldDrawY ( this, SVX_RES( MTR_FLD_DRAW_Y ) ),
182cdf0e10cSrcweir
183cdf0e10cSrcweir aFlDivision ( this, SVX_RES( FL_DIVISION ) ),
184cdf0e10cSrcweir aFtDivisionX( this, SVX_RES( FT_DIVISION_X) ),
185cdf0e10cSrcweir aNumFldDivisionX( this, SVX_RES( NUM_FLD_DIVISION_X ) ),
186cdf0e10cSrcweir aDivisionPointX( this, SVX_RES( FT_HORZ_POINTS) ),
187cdf0e10cSrcweir
188cdf0e10cSrcweir aFtDivisionY( this, SVX_RES( FT_DIVISION_Y) ),
189cdf0e10cSrcweir aNumFldDivisionY( this, SVX_RES( NUM_FLD_DIVISION_Y ) ),
190cdf0e10cSrcweir aDivisionPointY( this, SVX_RES( FT_VERT_POINTS) ),
191cdf0e10cSrcweir
192cdf0e10cSrcweir aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
193cdf0e10cSrcweir aGrpDrawGrid ( this, SVX_RES( GRP_DRAWGRID ) ),
194cdf0e10cSrcweir
195cdf0e10cSrcweir aGrpSnap ( this, SVX_RES( GRP_SNAP ) ),
196cdf0e10cSrcweir aCbxSnapHelplines ( this, SVX_RES( CBX_SNAP_HELPLINES ) ),
197cdf0e10cSrcweir aCbxSnapBorder ( this, SVX_RES( CBX_SNAP_BORDER ) ),
198cdf0e10cSrcweir aCbxSnapFrame ( this, SVX_RES( CBX_SNAP_FRAME ) ),
199cdf0e10cSrcweir aCbxSnapPoints ( this, SVX_RES( CBX_SNAP_POINTS ) ),
200cdf0e10cSrcweir aFtSnapArea ( this, SVX_RES( FT_SNAP_AREA ) ),
201cdf0e10cSrcweir aMtrFldSnapArea ( this, SVX_RES( MTR_FLD_SNAP_AREA ) ),
202cdf0e10cSrcweir
203cdf0e10cSrcweir aSeparatorFL ( this, SVX_RES( FL_SEPARATOR ) ),
204cdf0e10cSrcweir
205cdf0e10cSrcweir aGrpOrtho ( this, SVX_RES( GRP_ORTHO ) ),
206cdf0e10cSrcweir aCbxOrtho ( this, SVX_RES( CBX_ORTHO ) ),
207cdf0e10cSrcweir aCbxBigOrtho ( this, SVX_RES( CBX_BIGORTHO ) ),
208cdf0e10cSrcweir aCbxRotate ( this, SVX_RES( CBX_ROTATE ) ),
209cdf0e10cSrcweir aMtrFldAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
210cdf0e10cSrcweir aFtBezAngle ( this, SVX_RES( FT_BEZ_ANGLE ) ),
211cdf0e10cSrcweir aMtrFldBezAngle ( this, SVX_RES( MTR_FLD_BEZ_ANGLE ) ),
212cdf0e10cSrcweir
213cdf0e10cSrcweir bAttrModified( sal_False )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir // diese Page braucht ExchangeSupport
216cdf0e10cSrcweir SetExchangeSupport();
217cdf0e10cSrcweir
218cdf0e10cSrcweir FreeResource();
219cdf0e10cSrcweir
220cdf0e10cSrcweir aDivisionPointY.SetText(aDivisionPointX.GetText());
221cdf0e10cSrcweir // Metrik einstellen
222cdf0e10cSrcweir FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet );
223cdf0e10cSrcweir long nFirst, nLast, nMin, nMax;
224cdf0e10cSrcweir
225cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
226cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
227cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
228cdf0e10cSrcweir
229cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
230cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
231cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
232cdf0e10cSrcweir
233cdf0e10cSrcweir
234cdf0e10cSrcweir aCbxRotate.SetClickHdl( LINK( this, SvxGridTabPage, ClickRotateHdl_Impl ) );
235cdf0e10cSrcweir Link aLink = LINK( this, SvxGridTabPage, ChangeGridsnapHdl_Impl );
236cdf0e10cSrcweir aCbxUseGridsnap.SetClickHdl( aLink );
237cdf0e10cSrcweir aCbxSynchronize.SetClickHdl( aLink );
238cdf0e10cSrcweir aCbxGridVisible.SetClickHdl( aLink );
239cdf0e10cSrcweir aMtrFldDrawX.SetModifyHdl(
240cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
241cdf0e10cSrcweir aMtrFldDrawY.SetModifyHdl(
242cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
243cdf0e10cSrcweir aNumFldDivisionX.SetModifyHdl(
244cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
245cdf0e10cSrcweir aNumFldDivisionY.SetModifyHdl(
246cdf0e10cSrcweir LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
247cdf0e10cSrcweir
248cdf0e10cSrcweir ::rtl::OUString sFlResolution( aFlResolution.GetDisplayText() );
249cdf0e10cSrcweir ::rtl::OUString sFtDrawX(aFtDrawX.GetDisplayText());
250cdf0e10cSrcweir ::rtl::OUString sFtDrawY(aFtDrawY.GetDisplayText());
251cdf0e10cSrcweir aMtrFldDrawX.SetAccessibleName( sFtDrawX + sFlResolution );
252cdf0e10cSrcweir aMtrFldDrawY.SetAccessibleName( sFtDrawY + sFlResolution );
253cdf0e10cSrcweir ::rtl::OUString sFlDivision( aFlDivision.GetDisplayText() );
254cdf0e10cSrcweir ::rtl::OUString sFtDivisionX(aFtDivisionX.GetDisplayText());
255cdf0e10cSrcweir ::rtl::OUString sFtDivisionY(aFtDivisionY.GetDisplayText());
256cdf0e10cSrcweir aNumFldDivisionX.SetAccessibleName( sFtDivisionX + sFlDivision );
257cdf0e10cSrcweir aNumFldDivisionY.SetAccessibleName( sFtDivisionY + sFlDivision );
258cdf0e10cSrcweir }
259cdf0e10cSrcweir
260cdf0e10cSrcweir //------------------------------------------------------------------------
261cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rAttrSet)262cdf0e10cSrcweir SfxTabPage* SvxGridTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir return ( new SvxGridTabPage( pParent, rAttrSet ) );
265cdf0e10cSrcweir }
266cdf0e10cSrcweir
267cdf0e10cSrcweir //------------------------------------------------------------------------
268cdf0e10cSrcweir
FillItemSet(SfxItemSet & rCoreSet)269cdf0e10cSrcweir sal_Bool SvxGridTabPage::FillItemSet( SfxItemSet& rCoreSet )
270cdf0e10cSrcweir {
271cdf0e10cSrcweir if ( bAttrModified )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS );
274cdf0e10cSrcweir
275cdf0e10cSrcweir aGridItem.bUseGridsnap = aCbxUseGridsnap.IsChecked();
276cdf0e10cSrcweir aGridItem.bSynchronize = aCbxSynchronize.IsChecked();
277cdf0e10cSrcweir aGridItem.bGridVisible = aCbxGridVisible.IsChecked();
278cdf0e10cSrcweir
279cdf0e10cSrcweir SfxMapUnit eUnit =
280cdf0e10cSrcweir rCoreSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
281cdf0e10cSrcweir long nX =GetCoreValue( aMtrFldDrawX, eUnit );
282cdf0e10cSrcweir long nY = GetCoreValue( aMtrFldDrawY, eUnit );
283cdf0e10cSrcweir
284cdf0e10cSrcweir aGridItem.nFldDrawX = (sal_uInt32) nX;
285cdf0e10cSrcweir aGridItem.nFldDrawY = (sal_uInt32) nY;
286cdf0e10cSrcweir aGridItem.nFldDivisionX = static_cast<long>(aNumFldDivisionX.GetValue()-1);
287cdf0e10cSrcweir aGridItem.nFldDivisionY = static_cast<long>(aNumFldDivisionY.GetValue()-1);
288cdf0e10cSrcweir
289cdf0e10cSrcweir rCoreSet.Put( aGridItem );
290cdf0e10cSrcweir }
291cdf0e10cSrcweir return bAttrModified;
292cdf0e10cSrcweir }
293cdf0e10cSrcweir
294cdf0e10cSrcweir //------------------------------------------------------------------------
295cdf0e10cSrcweir
Reset(const SfxItemSet & rSet)296cdf0e10cSrcweir void SvxGridTabPage::Reset( const SfxItemSet& rSet )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir const SfxPoolItem* pAttr = 0;
299cdf0e10cSrcweir
300cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
301cdf0e10cSrcweir (const SfxPoolItem**)&pAttr ))
302cdf0e10cSrcweir {
303cdf0e10cSrcweir const SvxGridItem* pGridAttr = (SvxGridItem*)pAttr;
304cdf0e10cSrcweir aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
305cdf0e10cSrcweir aCbxSynchronize.Check( pGridAttr->bSynchronize == 1 );
306cdf0e10cSrcweir aCbxGridVisible.Check( pGridAttr->bGridVisible == 1 );
307cdf0e10cSrcweir
308cdf0e10cSrcweir SfxMapUnit eUnit =
309cdf0e10cSrcweir rSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
310cdf0e10cSrcweir SetMetricValue( aMtrFldDrawX , pGridAttr->nFldDrawX, eUnit );
311cdf0e10cSrcweir SetMetricValue( aMtrFldDrawY , pGridAttr->nFldDrawY, eUnit );
312cdf0e10cSrcweir
313cdf0e10cSrcweir aNumFldDivisionX.SetValue( pGridAttr->nFldDivisionX+1 );
314cdf0e10cSrcweir aNumFldDivisionY.SetValue( pGridAttr->nFldDivisionY+1 );
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
317cdf0e10cSrcweir ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
318cdf0e10cSrcweir bAttrModified = sal_False;
319cdf0e10cSrcweir }
320cdf0e10cSrcweir
321cdf0e10cSrcweir // -----------------------------------------------------------------------
322cdf0e10cSrcweir
ActivatePage(const SfxItemSet & rSet)323cdf0e10cSrcweir void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet )
324cdf0e10cSrcweir {
325cdf0e10cSrcweir const SfxPoolItem* pAttr = NULL;
326cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
327cdf0e10cSrcweir (const SfxPoolItem**)&pAttr ))
328cdf0e10cSrcweir {
329cdf0e10cSrcweir const SvxGridItem* pGridAttr = (SvxGridItem*) pAttr;
330cdf0e10cSrcweir aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
331cdf0e10cSrcweir
332cdf0e10cSrcweir ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir // Metrik ggfs. aendern (da TabPage im Dialog liegt,
336cdf0e10cSrcweir // wo die Metrik eingestellt werden kann
337cdf0e10cSrcweir //sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
338cdf0e10cSrcweir //if( rSet.GetItemState( GetWhich( SID_ATTR_METRIC ) ) >= SFX_ITEM_AVAILABLE )
339cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False,
340cdf0e10cSrcweir (const SfxPoolItem**)&pAttr ))
341cdf0e10cSrcweir {
342cdf0e10cSrcweir const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr;
343cdf0e10cSrcweir
344cdf0e10cSrcweir FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue();
345cdf0e10cSrcweir
346cdf0e10cSrcweir if( eFUnit != aMtrFldDrawX.GetUnit() )
347cdf0e10cSrcweir {
348cdf0e10cSrcweir // Metriken einstellen
349cdf0e10cSrcweir long nFirst, nLast, nMin, nMax;
350cdf0e10cSrcweir long nVal = static_cast<long>(aMtrFldDrawX.Denormalize( aMtrFldDrawX.GetValue( FUNIT_TWIP ) ));
351cdf0e10cSrcweir
352cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
353cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
354cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
355cdf0e10cSrcweir
356cdf0e10cSrcweir aMtrFldDrawX.SetValue( aMtrFldDrawX.Normalize( nVal ), FUNIT_TWIP );
357cdf0e10cSrcweir
358cdf0e10cSrcweir nVal = static_cast<long>(aMtrFldDrawY.Denormalize( aMtrFldDrawY.GetValue( FUNIT_TWIP ) ));
359cdf0e10cSrcweir lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
360cdf0e10cSrcweir SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
361cdf0e10cSrcweir lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
362cdf0e10cSrcweir aMtrFldDrawY.SetValue( aMtrFldDrawY.Normalize( nVal ), FUNIT_TWIP );
363cdf0e10cSrcweir
364cdf0e10cSrcweir }
365cdf0e10cSrcweir }
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
368cdf0e10cSrcweir // -----------------------------------------------------------------------
DeactivatePage(SfxItemSet * _pSet)369cdf0e10cSrcweir int SvxGridTabPage::DeactivatePage( SfxItemSet* _pSet )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir if ( _pSet )
372cdf0e10cSrcweir FillItemSet( *_pSet );
373cdf0e10cSrcweir return( LEAVE_PAGE );
374cdf0e10cSrcweir }
375cdf0e10cSrcweir //------------------------------------------------------------------------
IMPL_LINK(SvxGridTabPage,ChangeDrawHdl_Impl,MetricField *,pField)376cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeDrawHdl_Impl, MetricField *, pField )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir bAttrModified = sal_True;
379cdf0e10cSrcweir if( aCbxSynchronize.IsChecked() )
380cdf0e10cSrcweir {
381cdf0e10cSrcweir if(pField == &aMtrFldDrawX)
382cdf0e10cSrcweir aMtrFldDrawY.SetValue( aMtrFldDrawX.GetValue() );
383cdf0e10cSrcweir else
384cdf0e10cSrcweir aMtrFldDrawX.SetValue( aMtrFldDrawY.GetValue() );
385cdf0e10cSrcweir }
386cdf0e10cSrcweir return 0;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir //------------------------------------------------------------------------
389cdf0e10cSrcweir
IMPL_LINK(SvxGridTabPage,ClickRotateHdl_Impl,void *,EMPTYARG)390cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ClickRotateHdl_Impl, void *, EMPTYARG )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir if( aCbxRotate.IsChecked() )
393cdf0e10cSrcweir aMtrFldAngle.Enable();
394cdf0e10cSrcweir else
395cdf0e10cSrcweir aMtrFldAngle.Disable();
396cdf0e10cSrcweir
397cdf0e10cSrcweir return( 0L );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir
400cdf0e10cSrcweir //------------------------------------------------------------------------
401cdf0e10cSrcweir
IMPL_LINK(SvxGridTabPage,ChangeDivisionHdl_Impl,NumericField *,pField)402cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeDivisionHdl_Impl, NumericField *, pField )
403cdf0e10cSrcweir {
404cdf0e10cSrcweir bAttrModified = sal_True;
405cdf0e10cSrcweir if( aCbxSynchronize.IsChecked() )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir if(&aNumFldDivisionX == pField)
408cdf0e10cSrcweir aNumFldDivisionY.SetValue( aNumFldDivisionX.GetValue() );
409cdf0e10cSrcweir else
410cdf0e10cSrcweir aNumFldDivisionX.SetValue( aNumFldDivisionY.GetValue() );
411cdf0e10cSrcweir }
412cdf0e10cSrcweir return 0;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir //------------------------------------------------------------------------
415cdf0e10cSrcweir
IMPL_LINK(SvxGridTabPage,ChangeGridsnapHdl_Impl,void *,EMPTYARG)416cdf0e10cSrcweir IMPL_LINK( SvxGridTabPage, ChangeGridsnapHdl_Impl, void *, EMPTYARG )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir bAttrModified = sal_True;
419cdf0e10cSrcweir return 0;
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422cdf0e10cSrcweir
423