xref: /AOO41X/main/sw/source/ui/frmdlg/colex.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 
32 
33 
34 #include "cmdid.h"
35 #include "hintids.hxx"
36 #include <algorithm>
37 
38 
39 #include <svl/eitem.hxx>
40 #include <editeng/lrspitem.hxx>
41 #include <editeng/ulspitem.hxx>
42 #include <editeng/sizeitem.hxx>
43 #include <svx/pageitem.hxx>
44 #include <editeng/brshitem.hxx>
45 #include <editeng/frmdiritem.hxx>
46 #include <vcl/bitmap.hxx>
47 #include <vcl/graph.hxx>
48 #include <tgrditem.hxx>
49 #include <viewopt.hxx>
50 #include "colex.hxx"
51 #include "colmgr.hxx"
52 
53 /*-----------------------------------------------------------------------
54 	Beschreibung: Uebernahme der aktualisierten Werte aus dem Set
55  -----------------------------------------------------------------------*/
56 void SwPageExample::UpdateExample( const SfxItemSet& rSet )
57 {
58 	const SvxPageItem* pPage = 0;
59 	SfxItemPool* pPool = rSet.GetPool();
60 	sal_uInt16 nWhich = pPool->GetWhich( SID_ATTR_PAGE );
61 
62 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
63 	{
64 		// Ausrichtung
65 		pPage = (const SvxPageItem*)&rSet.Get( nWhich );
66 
67 		if ( pPage )
68 			SetUsage( pPage->GetPageUsage() );
69 	}
70 
71 	nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE );
72 
73 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
74 	{
75 		// Orientation und Size aus dem PageItem
76 		const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( nWhich );
77         SetSize( rSize.GetSize() );
78 	}
79 	nWhich = RES_LR_SPACE;
80 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
81 	{
82 		// linken und rechten Rand einstellen
83 		const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( nWhich );
84 
85 		SetLeft( rLRSpace.GetLeft() );
86 		SetRight( rLRSpace.GetRight() );
87 	}
88 	else
89 	{
90 		SetLeft( 0 );
91 		SetRight( 0 );
92 	}
93 
94 	nWhich = RES_UL_SPACE;
95 
96 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
97 	{
98 		// oberen und unteren Rand einstellen
99 		const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get( nWhich );
100 
101 		SetTop( rULSpace.GetUpper() );
102 		SetBottom( rULSpace.GetLower() );
103 	}
104 	else
105 	{
106 		SetTop( 0 );
107 		SetBottom( 0 );
108 	}
109 
110 
111 	// Kopfzeilen-Attribute auswerten
112 	const SfxPoolItem* pItem;
113 	if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET),
114 			sal_False, &pItem ) )
115 	{
116 		const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
117 		const SfxBoolItem& rHeaderOn =
118 			(const SfxBoolItem&)rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) );
119 
120 		if ( rHeaderOn.GetValue() )
121 		{
122 			const SvxSizeItem& rSize =
123 				(const SvxSizeItem&)rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE));
124 
125 			const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rHeaderSet.Get(
126 										pPool->GetWhich(SID_ATTR_ULSPACE));
127 			const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rHeaderSet.Get(
128 										pPool->GetWhich(SID_ATTR_LRSPACE));
129 
130 			SetHdHeight( rSize.GetSize().Height() - rUL.GetLower());
131 			SetHdDist( rUL.GetLower() );
132 			SetHdLeft( rLR.GetLeft() );
133 			SetHdRight( rLR.GetRight() );
134 			SetHeader( sal_True );
135             if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )
136 			{
137 				const SvxBrushItem& rItem =
138                     (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND );
139                 SetHdColor( rItem.GetColor() );
140 			}
141             if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
142 			{
143 				const SvxBoxItem& rItem =
144                     (const SvxBoxItem&)rHeaderSet.Get( RES_BOX );
145                 SetHdBorder( rItem );
146 			}
147         }
148 		else
149 			SetHeader( sal_False );
150 	}
151 
152 	if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET),
153 			sal_False, &pItem ) )
154 	{
155 		const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
156 		const SfxBoolItem& rFooterOn =
157 			(const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON );
158 
159 		if ( rFooterOn.GetValue() )
160 		{
161 			const SvxSizeItem& rSize =
162 				(const SvxSizeItem&)rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) );
163 
164 			const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rFooterSet.Get(
165 										pPool->GetWhich( SID_ATTR_ULSPACE ) );
166 			const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rFooterSet.Get(
167 										pPool->GetWhich( SID_ATTR_LRSPACE ) );
168 
169 			SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper());
170 			SetFtDist( rUL.GetUpper() );
171 			SetFtLeft( rLR.GetLeft() );
172 			SetFtRight( rLR.GetRight() );
173 			SetFooter( sal_True );
174             if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )
175 			{
176 				const SvxBrushItem& rItem =
177                     (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND );
178                 SetFtColor( rItem.GetColor() );
179 			}
180             if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
181 			{
182 				const SvxBoxItem& rItem =
183                     (const SvxBoxItem&)rFooterSet.Get( RES_BOX );
184                 SetFtBorder( rItem );
185 			}
186         }
187 		else
188 			SetFooter( sal_False );
189 	}
190     if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND,
191 			sal_False, &pItem ) )
192 	{
193         SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
194 		const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();
195 
196 		if ( pGrf )
197 		{
198 			Bitmap aBitmap = pGrf->GetBitmap();
199             SetBitmap( &aBitmap );
200 		}
201 		else
202             SetBitmap( NULL );
203 	}
204 
205 	Invalidate();
206 }
207 /*-----------------------------------------------------------------------
208 	Beschreibung:
209  -----------------------------------------------------------------------*/
210 
211 
212 void SwColExample::DrawPage( const Point& rOrg,
213 							const sal_Bool bSecond,
214 							const sal_Bool bEnabled )
215 {
216     SwPageExample::DrawPage( rOrg, bSecond, bEnabled );
217     sal_uInt16 nColumnCount;
218     if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount()))
219 	{
220 		long nL = GetLeft();
221 		long nR = GetRight();
222 
223 		if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond )
224 		{
225 			// fuer gespiegelt drehen
226 			nL = GetRight();
227 			nR = GetLeft();
228 		}
229 
230         SetFillColor( Color( COL_LIGHTGRAY ) );
231         Rectangle aRect;
232         aRect.Right() = rOrg.X() + GetSize().Width() - nR;
233         aRect.Left()  = rOrg.X() + nL;
234         aRect.Top()   = rOrg.Y() + GetTop()
235                         + GetHdHeight() + GetHdDist();
236         aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom()
237                         - GetFtHeight() - GetFtDist();
238         DrawRect(aRect);
239 
240         if(GetColor() == Color(COL_TRANSPARENT))
241         {
242             const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
243             const Color& rFieldColor = rStyleSettings.GetFieldColor();
244             SetFillColor( rFieldColor );
245         }
246         else
247             SetFillColor( GetColor() );
248 
249         // #97495# make sure that the automatic column widht's are always equal
250         sal_Bool bAutoWidth = pColMgr->IsAutoWidth();
251         sal_Int32 nAutoColWidth = 0;
252         if(bAutoWidth)
253         {
254             sal_Int32 nColumnWidthSum = 0;
255             sal_uInt16 i;
256             for(i = 0; i < nColumnCount; ++i)
257                 nColumnWidthSum += pColMgr->GetColWidth( i );
258             nAutoColWidth = nColumnWidthSum / nColumnCount;
259         }
260 
261         sal_uInt16 i;
262         for( i = 0; i < nColumnCount; i++)
263         {
264             if(!bAutoWidth)
265                 nAutoColWidth = pColMgr->GetColWidth( i );
266             aRect.Right() = aRect.Left() + nAutoColWidth;
267             DrawRect(aRect);
268             if(i < nColumnCount - 1)
269                 aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i);
270         }
271         if(pColMgr->HasLine())
272         {
273             Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() );
274             Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height()
275                         - GetBottom() - GetFtHeight() - GetFtDist() );
276 
277             if( pColMgr->GetLineHeightPercent() != 100 )
278             {
279                 long nLength = aDown.Y() - aUp.Y();
280                 nLength -= nLength * pColMgr->GetLineHeightPercent() / 100;
281                 switch(pColMgr->GetAdjust())
282                 {
283                     case COLADJ_BOTTOM: aUp.Y() += nLength; break;
284                     case COLADJ_TOP: aDown.Y() -= nLength; break;
285                     case COLADJ_CENTER:
286                         aUp.Y() += nLength / 2;
287                         aDown.Y() -= nLength / 2;
288                     break;
289                     default:; // prevent warning
290                 }
291             }
292 
293             int nDist;
294             for( i = 0; i < nColumnCount -  1; i++)
295             {
296                 int nGutter = pColMgr->GetGutterWidth(i);
297                 nDist = pColMgr->GetColWidth( i ) + nGutter;
298                 nDist -= (i == 0) ?
299                     nGutter/2 :
300                         0;
301                 aUp.X() += nDist;
302                 aDown.X() += nDist;
303                 DrawLine( aUp, aDown );
304 
305             }
306         }
307 	}
308 }
309 
310 /*-----------------25.10.96 09.15-------------------
311 
312 --------------------------------------------------*/
313 
314 
315 SwColumnOnlyExample::SwColumnOnlyExample( Window* pParent, const ResId& rResId) :
316 	Window(pParent, rResId),
317     m_aFrmSize(1,1)
318 {
319 	SetMapMode( MapMode( MAP_TWIP ) );
320     m_aWinSize = GetOutputSizePixel();
321     m_aWinSize.Height() -= 4;
322     m_aWinSize.Width() -= 4;
323 
324     m_aWinSize = PixelToLogic( m_aWinSize );
325 
326     SetBorderStyle( WINDOW_BORDER_MONO );
327 
328     m_aFrmSize  = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4
329     ::FitToActualSize(m_aCols, (sal_uInt16)m_aFrmSize.Width());
330 
331     long nHeight = m_aFrmSize.Height();
332     Fraction aScale( m_aWinSize.Height(), nHeight );
333     MapMode aMapMode( GetMapMode() );
334     aMapMode.SetScaleX( aScale );
335     aMapMode.SetScaleY( aScale );
336     SetMapMode( aMapMode );
337 }
338 
339 /*-----------------25.10.96 09.16-------------------
340 
341 --------------------------------------------------*/
342 
343 
344 void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ )
345 {
346     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
347     const Color& rFieldColor = rStyleSettings.GetFieldColor();
348     const Color& rDlgColor = rStyleSettings.GetDialogColor();
349     const Color& rFieldTextColor = SwViewOption::GetFontColor();
350     Color aGrayColor(COL_LIGHTGRAY);
351     if(rFieldColor == aGrayColor)
352         aGrayColor.Invert();
353 
354     Size aLogSize(PixelToLogic(GetOutputSizePixel()));
355     Rectangle aCompleteRect(Point(0,0), aLogSize);
356     SetLineColor(rDlgColor);
357     SetFillColor(rDlgColor);
358     DrawRect(aCompleteRect);
359 
360     SetLineColor( rFieldTextColor );
361     Point aTL(  (aLogSize.Width() - m_aFrmSize.Width()) / 2,
362                 (aLogSize.Height() - m_aFrmSize.Height()) / 2);
363     Rectangle aRect(aTL, m_aFrmSize);
364 
365     //draw a shadow rectangle
366     SetFillColor( Color(COL_GRAY) );
367     Rectangle aShadowRect(aRect);
368     aShadowRect.Move(aTL.Y(), aTL.Y());
369     DrawRect(aShadowRect);
370 
371     SetFillColor( rFieldColor );
372     DrawRect(aRect);
373 
374     SetFillColor( aGrayColor );
375 
376     //Spaltentrenner?
377     long nLength = aLogSize.Height() - 2 * aTL.Y();
378     Point aUp( aTL );
379     Point aDown( aTL.X(), nLength );
380     sal_Bool bLines = sal_False;
381     if(m_aCols.GetLineAdj() != COLADJ_NONE)
382     {
383         bLines = sal_True;
384 
385         sal_uInt16 nPercent = m_aCols.GetLineHeight();
386         if( nPercent != 100 )
387         {
388             nLength -= nLength * nPercent / 100;
389             switch(m_aCols.GetLineAdj())
390             {
391                 case COLADJ_BOTTOM: aUp.Y() += nLength; break;
392                 case COLADJ_TOP: aDown.Y() -= nLength; break;
393                 case COLADJ_CENTER:
394                         aUp.Y() += nLength / 2;
395                         aDown.Y() -= nLength / 2;
396                 break;
397                 default:; //prevent warning
398             }
399         }
400 
401     }
402     const SwColumns& rCols = m_aCols.GetColumns();
403     sal_uInt16 nColCount = rCols.Count();
404     if( nColCount )
405     {
406         DrawRect(aRect);
407         SetFillColor( rFieldColor );
408         Rectangle aFrmRect(aTL, m_aFrmSize);
409         long nSum = aTL.X();
410         for(sal_uInt16 i = 0; i < nColCount; i++)
411         {
412             SwColumn* pCol = rCols[i];
413             aFrmRect.Left()    = nSum + pCol->GetLeft();//nSum + pCol->GetLeft() + aTL.X();
414             nSum              += pCol->GetWishWidth();
415             aFrmRect.Right()   = nSum - pCol->GetRight();
416             DrawRect(aFrmRect);
417         }
418         if(bLines )
419         {
420             nSum = aTL.X();
421             for(sal_uInt16 i = 0; i < nColCount - 1; i++)
422             {
423                 nSum += rCols[i]->GetWishWidth();
424                 aUp.X() = nSum;
425                 aDown.X() = nSum;
426                 DrawLine(aUp, aDown);
427             }
428         }
429     }
430 }
431 
432 /*-----------------25.10.96 12.05-------------------
433 
434 --------------------------------------------------*/
435 
436 
437 void  SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol)
438 {
439     m_aCols = rCol;
440     sal_uInt16 nWishSum = m_aCols.GetWishWidth();
441     long nFrmWidth = m_aFrmSize.Width();
442     SwColumns& rCols = m_aCols.GetColumns();
443     sal_uInt16 nColCount = rCols.Count();
444 
445     for(sal_uInt16 i = 0; i < nColCount; i++)
446     {
447         SwColumn* pCol = rCols[i];
448         long nWish = pCol->GetWishWidth();
449         nWish *= nFrmWidth;
450         nWish /= nWishSum;
451         pCol->SetWishWidth((sal_uInt16)nWish);
452         long nLeft = pCol->GetLeft();
453         nLeft *= nFrmWidth;
454         nLeft /= nWishSum;
455         pCol->SetLeft((sal_uInt16)nLeft);
456         long nRight = pCol->GetRight();
457         nRight *= nFrmWidth;
458         nRight /= nWishSum;
459         pCol->SetRight((sal_uInt16)nRight);
460     }
461     // #97495# make sure that the automatic column width's are always equal
462     if(nColCount && m_aCols.IsOrtho())
463     {
464         sal_Int32 nColumnWidthSum = 0;
465         sal_uInt16 i;
466         for(i = 0; i < nColCount; ++i)
467         {
468             SwColumn* pCol = rCols[i];
469             nColumnWidthSum += pCol->GetWishWidth();
470             nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft());
471         }
472         nColumnWidthSum /= nColCount;
473         for(i = 0; i < nColCount; ++i)
474         {
475             SwColumn* pCol = rCols[i];
476             pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft()));
477         }
478     }
479 }
480 /* -----------------------------08.02.2002 11:44------------------------------
481 
482  ---------------------------------------------------------------------------*/
483 SwPageGridExample::~SwPageGridExample()
484 {
485     delete pGridItem;
486 }
487 /* -----------------------------08.02.2002 11:48------------------------------
488 
489  ---------------------------------------------------------------------------*/
490 #define MAX_ROWS    10
491 #define MAX_LINES   15
492 void SwPageGridExample::DrawPage( const Point& rOrg,
493 						   const sal_Bool bSecond,
494                            const sal_Bool bEnabled )
495 {
496     SwPageExample::DrawPage(rOrg, bSecond, bEnabled);
497     if(pGridItem && pGridItem->GetGridType())
498     {
499         //paint the grid now
500         Color aLineColor = pGridItem->GetColor();
501         if(aLineColor.GetColor() == COL_AUTO)
502         {
503             aLineColor = GetFillColor();
504             aLineColor.Invert();
505         }
506         SetLineColor(aLineColor);
507         long nL = GetLeft();
508 		long nR = GetRight();
509 
510 		if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond )
511 		{
512 			// fuer gespiegelt drehen
513 			nL = GetRight();
514 			nR = GetLeft();
515 		}
516 
517         Rectangle aRect;
518 		aRect.Right() = rOrg.X() + GetSize().Width() - nR;
519 		aRect.Left()  = rOrg.X() + nL;
520 		aRect.Top()	  = rOrg.Y() + GetTop()
521 						+ GetHdHeight() + GetHdDist();
522 		aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom()
523 						- GetFtHeight() - GetFtDist();
524 
525         //increase the values to get a 'viewable' preview
526         sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3;
527         sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3;
528 
529         //detect height of rectangles
530         Rectangle aRubyRect(aRect.TopLeft(),
531                     m_bVertical ?
532                     Size(nRubyHeight, aRect.GetHeight()) :
533                     Size(aRect.GetWidth(), nRubyHeight));
534         Rectangle aCharRect(aRect.TopLeft(),
535                     m_bVertical ?
536                     Size(nBaseHeight, aRect.GetHeight()) :
537                     Size(aRect.GetWidth(), nBaseHeight));
538 
539         sal_Int32 nLineHeight = nBaseHeight + nRubyHeight;
540 
541         //detect count of rectangles
542         sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight;
543         if(nLines > pGridItem->GetLines())
544             nLines = pGridItem->GetLines();
545 
546         // determine start position
547         if(m_bVertical)
548         {
549             sal_Int16 nXStart = static_cast< sal_Int16 >(aRect.GetWidth() / 2 - nLineHeight * nLines /2);
550             aRubyRect.Move(nXStart, 0);
551             aCharRect.Move(nXStart, 0);
552         }
553         else
554         {
555             sal_Int16 nYStart = static_cast< sal_Int16 >(aRect.GetHeight() / 2 - nLineHeight * nLines /2);
556             aRubyRect.Move(0, nYStart);
557             aCharRect.Move(0, nYStart);
558         }
559 
560         if(pGridItem->IsRubyTextBelow())
561             m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight);
562         else
563             m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight);
564 
565         //vertical lines
566         sal_Bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS;
567         SetFillColor( Color( COL_TRANSPARENT ) );
568         sal_Int32 nXMove = m_bVertical ? nLineHeight : 0;
569 		sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight;
570 		for(sal_Int32 nLine = 0; nLine < nLines; nLine++)
571         {
572             DrawRect(aRubyRect);
573             DrawRect(aCharRect);
574             if(bBothLines)
575             {
576                 Point aStart = aCharRect.TopLeft();
577                 Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft();
578                 while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right())
579                 {
580                     DrawLine(aStart, aEnd);
581                     if(m_bVertical)
582                         aStart.Y() = aEnd.Y() += nBaseHeight;
583                     else
584                         aStart.X() = aEnd.X() += nBaseHeight;
585                 }
586             }
587             aRubyRect.Move(nXMove, nYMove);
588             aCharRect.Move(nXMove, nYMove);
589         }
590     }
591 }
592 /* -----------------------------08.02.2002 11:48------------------------------
593 
594  ---------------------------------------------------------------------------*/
595 void SwPageGridExample::UpdateExample( const SfxItemSet& rSet )
596 {
597     DELETEZ(pGridItem);
598     //get the grid information
599     if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, sal_True))
600         pGridItem = (SwTextGridItem*)((const SwTextGridItem&)rSet.Get(RES_TEXTGRID)).Clone();
601     if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR, sal_True ))
602 	{
603         const SvxFrameDirectionItem& rDirItem =
604                     (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
605         m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT||
606                     rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT;
607     }
608     SwPageExample::UpdateExample(rSet);
609 }
610 
611