xref: /trunk/main/sw/source/ui/misc/pggrid.cxx (revision cdf0e10c)
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 #ifdef SW_DLLIMPLEMENTATION
32 #undef SW_DLLIMPLEMENTATION
33 #endif
34 
35 
36 
37 #include <sfx2/app.hxx>
38 
39 #ifndef _CMDID_H
40 #include <cmdid.h>
41 #endif
42 #include <hintids.hxx>
43 #include <swtypes.hxx>
44 #ifndef _GLOBALS_HRC
45 #include <globals.hrc>
46 #endif
47 #include <svx/xtable.hxx>
48 #include <uitool.hxx>
49 #include <editeng/sizeitem.hxx>
50 #include <editeng/lrspitem.hxx>
51 #include <editeng/ulspitem.hxx>
52 #include <editeng/boxitem.hxx>
53 #include <editeng/frmdiritem.hxx>
54 #include <pggrid.hxx>
55 #include <tgrditem.hxx>
56 #include <pggrid.hrc>
57 
58 #include "wrtsh.hxx"
59 #include "doc.hxx"
60 #include "uiitems.hxx"
61 #include "swmodule.hxx"
62 #include "view.hxx"
63 /*-- 06.02.2002 15:25:39---------------------------------------------------
64 
65   -----------------------------------------------------------------------*/
66 SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
67     SfxTabPage(pParent, SW_RES(TP_TEXTGRID_PAGE), rSet),
68     aGridTypeFL             (this, SW_RES(FL_GRID_TYPE       )),
69     aNoGridRB               (this, SW_RES(RB_NOGRID          )),
70     aLinesGridRB            (this, SW_RES(RB_LINESGRID       )),
71     aCharsGridRB            (this, SW_RES(RB_CHARSGRID       )),
72 	aSnapToCharsCB          (this, SW_RES(CB_SNAPTOCHARS      )),
73     aExampleWN              (this, SW_RES(WN_EXAMPLE         )),
74     aLayoutFL               (this, SW_RES(FL_LAYOUT          )),
75     aLinesPerPageFT         (this, SW_RES(FT_LINESPERPAGE    )),
76     aLinesPerPageNF         (this, SW_RES(NF_LINESPERPAGE    )),
77     aTextSizeFT             (this, SW_RES(FT_TEXTSIZE        )),
78     aTextSizeMF             (this, SW_RES(MF_TEXTSIZE        )),
79     aCharsPerLineFT         (this, SW_RES(FT_CHARSPERLINE    )),
80     aCharsPerLineNF         (this, SW_RES(NF_CHARSPERLINE    )),
81 	aCharWidthFT            (this, SW_RES(FT_CHARWIDTH        )),
82 	aCharWidthMF            (this, SW_RES(MF_CHARWIDTH        )),
83     aRubySizeFT             (this, SW_RES(FT_RUBYSIZE        )),
84     aRubySizeMF             (this, SW_RES(MF_RUBYSIZE        )),
85     aRubyBelowCB            (this, SW_RES(CB_RUBYBELOW       )),
86     aDisplayFL              (this, SW_RES(FL_DISPLAY         )),
87     aDisplayCB              (this, SW_RES(CB_DISPLAY         )),
88     aPrintCB                (this, SW_RES(CB_PRINT           )),
89     aColorFT                (this, SW_RES(FT_COLOR           )),
90     aColorLB                (this, SW_RES(LB_COLOR           )),
91     m_nRubyUserValue(0),
92     m_bRubyUserValue(sal_False),
93     m_aPageSize(MM50, MM50),
94     m_bVertical(sal_False),
95 	m_bSquaredMode(sal_False)
96 {
97     FreeResource();
98 
99     aControls[0] =&aLayoutFL;
100     aControls[1] =&aLinesPerPageFT;
101     aControls[2] =&aLinesPerPageNF;
102     aControls[3] =&aTextSizeFT;
103     aControls[4] =&aTextSizeMF;
104     aControls[5] =&aCharsPerLineFT;
105     aControls[6] =&aCharsPerLineNF;
106     aControls[7] =&aCharWidthFT;
107     aControls[8] =&aCharWidthMF;
108     aControls[9] =&aRubySizeFT;
109     aControls[10] =&aRubySizeMF;
110     aControls[11] =&aRubyBelowCB;
111     aControls[12] =&aDisplayFL;
112     aControls[13] =&aDisplayCB;
113     aControls[14] =&aPrintCB;
114     aControls[15] =&aColorFT;
115     aControls[16] =&aColorLB;
116     aControls[17] =0;
117 
118     Link aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl);
119     aCharsPerLineNF.SetUpHdl(aLink);
120     aCharsPerLineNF.SetDownHdl(aLink);
121     aCharsPerLineNF.SetLoseFocusHdl(aLink);
122     aLinesPerPageNF.SetUpHdl(aLink);
123     aLinesPerPageNF.SetDownHdl(aLink);
124     aLinesPerPageNF.SetLoseFocusHdl(aLink);
125 
126     Link aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl);
127     aTextSizeMF.SetUpHdl(aSizeLink);
128     aTextSizeMF.SetDownHdl(aSizeLink);
129     aTextSizeMF.SetLoseFocusHdl(aSizeLink);
130     aRubySizeMF.SetUpHdl(aSizeLink);
131     aRubySizeMF.SetDownHdl(aSizeLink);
132     aRubySizeMF.SetLoseFocusHdl(aSizeLink);
133     aCharWidthMF.SetUpHdl(aSizeLink);
134     aCharWidthMF.SetDownHdl(aSizeLink);
135     aCharWidthMF.SetLoseFocusHdl(aSizeLink);
136 
137     Link aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl);
138     aNoGridRB   .SetClickHdl(aGridTypeHdl);
139     aLinesGridRB.SetClickHdl(aGridTypeHdl);
140     aCharsGridRB.SetClickHdl(aGridTypeHdl);
141 
142     Link aModifyLk = LINK(this, SwTextGridPage, GridModifyHdl);
143     aColorLB.SetSelectHdl(aModifyLk);
144     aPrintCB.SetClickHdl(aModifyLk);
145     aRubyBelowCB.SetClickHdl(aModifyLk);
146 
147 
148     aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
149 
150     XColorTable* pColorTbl = XColorTable::GetStdColorTable();
151     aColorLB.InsertAutomaticEntry();
152 	for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i )
153 	{
154 		XColorEntry* pEntry = pColorTbl->GetColor( i );
155 		Color aColor = pEntry->GetColor();
156 		String sName = pEntry->GetName();
157 		aColorLB.InsertEntry( aColor, sName );
158 	}
159 	aColorLB.SetUpdateMode( sal_True );
160 	//Get the default paper mode
161 	SwView *pView   = ::GetActiveView();
162 	if( pView )
163 	{
164 		SwWrtShell* pSh = pView->GetWrtShellPtr();
165 		if( pSh )
166 		{
167 			m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode();
168 		}
169 	}
170 	if( m_bSquaredMode )
171 	{
172 		aRubySizeFT.Show();
173 		aRubySizeMF.Show();
174 		aRubyBelowCB.Show();
175 		aSnapToCharsCB.Hide();
176 		aCharWidthFT.Hide();
177 		aCharWidthMF.Hide();
178 	}
179 	else
180 	{
181 		aRubySizeFT.Hide();
182 		aRubySizeMF.Hide();
183 		aRubyBelowCB.Hide();
184 		aSnapToCharsCB.Show();
185 		aCharWidthFT.Show();
186 		aCharWidthMF.Show();
187 	}
188 }
189 /*-- 06.02.2002 15:25:40---------------------------------------------------
190 
191   -----------------------------------------------------------------------*/
192 SwTextGridPage::~SwTextGridPage()
193 {
194 }
195 /*-- 06.02.2002 15:25:40---------------------------------------------------
196 
197   -----------------------------------------------------------------------*/
198 SfxTabPage *SwTextGridPage::Create(Window *pParent, const SfxItemSet &rSet)
199 {
200     return new SwTextGridPage(pParent, rSet);
201 }
202 /*-- 06.02.2002 15:25:40---------------------------------------------------
203 
204   -----------------------------------------------------------------------*/
205 sal_Bool    SwTextGridPage::FillItemSet(SfxItemSet &rSet)
206 {
207     sal_Bool bRet = sal_False;
208     if(aNoGridRB.GetSavedValue() != aNoGridRB.IsChecked()||
209         aLinesGridRB.GetSavedValue() != aLinesGridRB.IsChecked()||
210         aLinesPerPageNF.GetSavedValue().ToInt32()
211            != aLinesPerPageNF.GetValue()||
212         aTextSizeMF.GetSavedValue().ToInt32() != aTextSizeMF.GetValue()||
213         aCharsPerLineNF.GetSavedValue().ToInt32()
214            != aCharsPerLineNF.GetValue()||
215         aSnapToCharsCB.GetSavedValue() != aSnapToCharsCB.IsChecked() ||
216         aRubySizeMF.GetSavedValue().ToInt32() != aRubySizeMF.GetValue()||
217         aCharWidthMF.GetSavedValue().ToInt32() != aCharWidthMF.GetValue()||
218         aRubyBelowCB.GetSavedValue() != aRubyBelowCB.IsChecked()||
219         aDisplayCB.GetSavedValue() != aDisplayCB.IsChecked()||
220         aPrintCB.GetSavedValue() != aPrintCB.IsChecked()||
221         aColorLB.GetSavedValue() != aColorLB.GetSelectEntryPos())
222     {
223         PutGridItem(rSet);
224         bRet = sal_True;
225     }
226 
227     return bRet;
228 }
229 /*-- 06.02.2002 15:25:40---------------------------------------------------
230 
231   -----------------------------------------------------------------------*/
232 void    SwTextGridPage::Reset(const SfxItemSet &rSet)
233 {
234     if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, sal_True))
235     {
236         const SwTextGridItem& rGridItem = (const SwTextGridItem&)rSet.Get(RES_TEXTGRID);
237         RadioButton* pButton = 0;
238         switch(rGridItem.GetGridType())
239         {
240             case GRID_NONE :        pButton = &aNoGridRB;    break;
241             case GRID_LINES_ONLY  : pButton = &aLinesGridRB; break;
242             default:                pButton = &aCharsGridRB;
243         }
244         pButton->Check();
245         aDisplayCB.Check(rGridItem.IsDisplayGrid());
246         GridTypeHdl(pButton);
247         aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
248         aLinesPerPageNF.SetValue(rGridItem.GetLines());
249         m_nRubyUserValue = rGridItem.GetBaseHeight();
250         m_bRubyUserValue = sal_True;
251         aTextSizeMF.SetValue(aTextSizeMF.Normalize(m_nRubyUserValue), FUNIT_TWIP);
252         aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP);
253         aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP);
254         aRubyBelowCB.Check(rGridItem.IsRubyTextBelow());
255         aPrintCB.Check(rGridItem.IsPrintGrid());
256         aColorLB.SelectEntry(rGridItem.GetColor());
257     }
258     UpdatePageSize(rSet);
259 
260     aNoGridRB.SaveValue();
261     aLinesGridRB.SaveValue();
262     aSnapToCharsCB.SaveValue();
263     aLinesPerPageNF.SaveValue();
264     aTextSizeMF.SaveValue();
265     aCharsPerLineNF.SaveValue();
266     aRubySizeMF.SaveValue();
267     aCharWidthMF.SaveValue();
268     aRubyBelowCB.SaveValue();
269     aDisplayCB.SaveValue();
270     aPrintCB.SaveValue();
271     aColorLB.SaveValue();
272 }
273 /*-- 06.02.2002 15:25:41---------------------------------------------------
274 
275   -----------------------------------------------------------------------*/
276 void    SwTextGridPage::ActivatePage( const SfxItemSet& rSet )
277 {
278     aExampleWN.Hide();
279     aExampleWN.UpdateExample( rSet );
280     UpdatePageSize(rSet);
281     aExampleWN.Show();
282     aExampleWN.Invalidate();
283 }
284 /*-- 06.02.2002 15:25:41---------------------------------------------------
285 
286   -----------------------------------------------------------------------*/
287 int SwTextGridPage::DeactivatePage( SfxItemSet* )
288 {
289     return LEAVE_PAGE;
290 }
291 /* -----------------------------08.02.2002 11:57------------------------------
292 
293  ---------------------------------------------------------------------------*/
294 void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
295 {
296         SwTextGridItem aGridItem;
297         aGridItem.SetGridType(aNoGridRB.IsChecked() ? GRID_NONE :
298             aLinesGridRB.IsChecked() ? GRID_LINES_ONLY : GRID_LINES_CHARS );
299         aGridItem.SetSnapToChars(aSnapToCharsCB.IsChecked());
300         aGridItem.SetLines( static_cast< sal_uInt16 >(aLinesPerPageNF.GetValue()) );
301         aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
302             m_bRubyUserValue ? m_nRubyUserValue :
303                 aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))) );
304         aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))) );
305         aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))) );
306         aGridItem.SetRubyTextBelow(aRubyBelowCB.IsChecked());
307         aGridItem.SetSquaredMode(m_bSquaredMode);
308         aGridItem.SetDisplayGrid(aDisplayCB.IsChecked());
309         aGridItem.SetPrintGrid(aPrintCB.IsChecked());
310         aGridItem.SetColor(aColorLB.GetSelectEntryColor());
311         rSet.Put(aGridItem);
312 }
313 /* -----------------------------08.02.2002 10:54------------------------------
314 
315  ---------------------------------------------------------------------------*/
316 void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
317 {
318     if( SFX_ITEM_UNKNOWN !=  rSet.GetItemState( RES_FRAMEDIR, sal_True ))
319     {
320         const SvxFrameDirectionItem& rDirItem =
321                     (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
322         m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT||
323                     rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT;
324     }
325 
326     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
327     {
328         const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(
329                                             SID_ATTR_PAGE_SIZE);
330         const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get(
331                                                             RES_LR_SPACE );
332         const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get(
333                                                             RES_UL_SPACE );
334         const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
335         sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
336         sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
337 
338         sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
339                 rBox.GetDistance(BOX_LINE_TOP) -
340                                     rBox.GetDistance(BOX_LINE_BOTTOM);
341         sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
342                 rBox.GetDistance(BOX_LINE_LEFT) -
343                                     rBox.GetDistance(BOX_LINE_RIGHT);
344         if(m_bVertical)
345         {
346             m_aPageSize.Width() = nValue1;
347             m_aPageSize.Height() = nValue2;
348         }
349         else
350         {
351             m_aPageSize.Width() = nValue2;
352             m_aPageSize.Height() = nValue1;
353         }
354 
355         sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
356                     m_nRubyUserValue :
357                         aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
358 
359         if ( m_bSquaredMode )
360         {
361             aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
362         }
363         else
364         {
365             sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
366             aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
367             if (nTextWidth)
368                 aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
369             else
370                 aCharsPerLineNF.SetValue( 45 );
371         }
372     }
373 }
374 /* -----------------------------06.02.2002 15:24------------------------------
375 
376  ---------------------------------------------------------------------------*/
377 sal_uInt16* SwTextGridPage::GetRanges()
378 {
379     static sal_uInt16 __FAR_DATA aPageRg[] = {
380         RES_TEXTGRID, RES_TEXTGRID,
381         0};
382     return aPageRg;
383 }
384 /* -----------------------------08.02.2002 10:56------------------------------
385 
386  ---------------------------------------------------------------------------*/
387 IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
388 {
389     //if in squared mode
390     if ( m_bSquaredMode )
391     {
392         if(&aCharsPerLineNF == pField)
393         {
394             long nWidth = (long)(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
395             aTextSizeMF.SetValue(aTextSizeMF.Normalize(nWidth), FUNIT_TWIP);
396             //prevent rounding errors in the MetricField by saving the used value
397             m_nRubyUserValue = nWidth;
398             m_bRubyUserValue = sal_True;
399 
400         }
401 		//set maximum line per page
402         {
403             sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
404                 (   aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
405                     aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
406             aLinesPerPageNF.SetMax(nMaxLines);
407         }
408 	}
409     else//in normal mode
410     {
411         if(&aLinesPerPageNF == pField)
412         {
413             long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue());
414             aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP);
415             aRubySizeMF.SetValue(0, FUNIT_TWIP);
416 
417             m_nRubyUserValue = nHeight;
418             m_bRubyUserValue = sal_True;
419         }
420         else if (&aCharsPerLineNF == pField)
421         {
422             long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
423             aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP);
424         }
425     }
426     GridModifyHdl(0);
427     return 0;
428 }
429 /* -----------------------------04.09.2006 15:46------------------------------
430  ---------------------------------------------------------------------------*/
431 IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
432 {
433     //if in squared mode
434     if( m_bSquaredMode )
435     {
436         if (&aTextSizeMF == pField)
437         {
438             sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
439             aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
440             m_bRubyUserValue = sal_False;
441         }
442 		//set maximum line per page
443         {
444             sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
445                 (   aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
446                     aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
447             aLinesPerPageNF.SetMax(nMaxLines);
448         }
449     }
450     else
451     {
452         if (&aTextSizeMF == pField)
453         {
454             sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
455             aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
456             m_bRubyUserValue = sal_False;
457         }
458         else if (&aCharWidthMF == pField)
459         {
460             sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
461             if (nTextWidth)
462                 aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
463             else
464                 aCharsPerLineNF.SetValue( 45 );
465         }
466         //rubySize is disabled
467     }
468     GridModifyHdl(0);
469     return 0;
470 }
471 /* -----------------------------22.04.2002 14:53------------------------------
472 
473  ---------------------------------------------------------------------------*/
474 IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton)
475 {
476     sal_Bool bEnable = &aNoGridRB != pButton;
477     sal_Int32 nIndex = 0;
478     while(aControls[nIndex])
479         aControls[nIndex++]->Enable(bEnable);
480     //one special case
481     if(bEnable)
482         DisplayGridHdl(&aDisplayCB);
483 
484 	bEnable = &aCharsGridRB == pButton;
485 	aSnapToCharsCB.Enable(bEnable);
486 
487 	bEnable = &aLinesGridRB == pButton;
488 	if(bEnable && !m_bSquaredMode )
489 	{
490 		aCharsPerLineFT.Enable(sal_False);
491 		aCharsPerLineNF.Enable(sal_False);
492 		aCharWidthFT.Enable(sal_False);
493 		aCharWidthMF.Enable(sal_False);
494 	}
495 
496     GridModifyHdl(0);
497     return 0;
498 }
499 /* -----------------------------22.04.2002 15:46------------------------------
500 
501  ---------------------------------------------------------------------------*/
502 IMPL_LINK(SwTextGridPage, DisplayGridHdl, CheckBox*, EMPTYARG)
503 {
504     aPrintCB.Enable(aDisplayCB.IsChecked());
505     return 0;
506 }
507 /* -----------------------------08.02.2002 11:54------------------------------
508 
509  ---------------------------------------------------------------------------*/
510 IMPL_LINK(SwTextGridPage, GridModifyHdl, void*, EMPTYARG)
511 {
512     const SfxItemSet& rOldSet = GetItemSet();
513     SfxItemSet aSet(rOldSet);
514     const SfxItemSet* pExSet = GetTabDialog()->GetExampleSet();
515     if(pExSet)
516         aSet.Put(*pExSet);
517     PutGridItem(aSet);
518     aExampleWN.UpdateExample(aSet);
519     return 0;
520 }
521 
522