merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / table / tabledlg.cxx
blobc7296b1e964fa0165b0f0585aad1b19afdfbc612
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabledlg.cxx,v $
10 * $Revision: 1.35.136.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
36 #endif
39 #include <hintids.hxx>
40 #include <tools/list.hxx>
41 #include <vcl/msgbox.hxx>
42 #include <svtools/stritem.hxx>
43 #include <svtools/intitem.hxx>
44 #include <svx/htmlmode.hxx>
45 #include <svx/keepitem.hxx>
46 #include <svx/brkitem.hxx>
47 #include <svx/ulspitem.hxx>
48 #include <svx/frmdiritem.hxx>
49 #include <svtools/ctloptions.hxx>
50 #include <swmodule.hxx>
51 #include <fmtornt.hxx>
52 #include <fmtpdsc.hxx>
53 #include <fmtlsplt.hxx>
55 #include <svx/htmlcfg.hxx>
56 #include <fmtrowsplt.hxx>
57 #include <svx/htmlmode.hxx>
59 #ifndef _DOCSH_HXX
60 #include <docsh.hxx>
61 #endif
62 #include <wrtsh.hxx>
63 #ifndef _VIEW_HXX
64 #include <view.hxx>
65 #endif
66 #include <viewopt.hxx>
67 #include <uitool.hxx>
68 #include <frmatr.hxx>
69 #include <tabledlg.hxx>
70 #ifndef _TABLEPG_HXX
71 #include <tablepg.hxx>
72 #endif
73 #include <tablemgr.hxx>
74 #include <pagedesc.hxx>
75 #include <uiitems.hxx>
76 #include <poolfmt.hxx>
77 #include <SwStyleNameMapper.hxx>
79 #ifndef _CMDID_H
80 #include <cmdid.h>
81 #endif
82 #ifndef _TABLEDLG_HRC
83 #include <tabledlg.hrc>
84 #endif
85 #ifndef _TABLE_HRC
86 #include <table.hrc>
87 #endif
88 #include <svx/svxids.hrc>
89 #include <svx/dialogs.hrc>
90 #include <svx/flagsdef.hxx>
91 #include <svx/svxdlg.hxx>
93 using namespace ::com::sun::star;
96 #ifdef DEBUG_TBLDLG
97 void DbgTblRep(SwTableRep* pRep)
99 DBG_ERROR(String(pRep->GetColCount()))
100 DBG_ERROR(String(pRep->GetAllColCount()))
101 SwTwips nSum = 0;
102 for(USHORT i = 0; i < pRep->GetAllColCount(); i++)
104 String sMsg(i);
105 sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h ";
106 sMsg += pRep->GetColumns()[i].nWidth;
107 nSum +=pRep->GetColumns()[i].nWidth;
108 DBG_ERROR(sMsg)
110 String sMsg("Spaltensumme: ");
111 sMsg += nSum;
112 sMsg += " Tblbreite: ";
113 sMsg += pRep->GetWidth();
114 DBG_ERROR(sMsg)
115 sMsg = "Gesamt/Links/Rechts: ";
116 sMsg += pRep->GetSpace();
117 sMsg += '/';
118 sMsg += pRep->GetLeftSpace();
119 sMsg += '/';
120 sMsg += pRep->GetRightSpace();
121 DBG_ERROR(sMsg)
122 sMsg = "Align: ";
123 sMsg += pRep->GetAlign();
124 DBG_ERROR(sMsg)
128 #endif
131 SwFormatTablePage::SwFormatTablePage( Window* pParent, const SfxItemSet& rSet ) :
132 SfxTabPage(pParent, SW_RES( TP_FORMAT_TABLE ), rSet ),
133 aOptionsFL(this, SW_RES( FL_OPTIONS )),
134 aNameFT(this, SW_RES( FT_NAME )),
135 aNameED(this, SW_RES( ED_NAME )),
136 aWidthFT(this, SW_RES( FT_WIDTH )),
137 aWidthMF(this, SW_RES( ED_WIDTH )),
138 aRelWidthCB(this, SW_RES( CB_REL_WIDTH )),
140 aPosFL(this, SW_RES( FL_POS )),
141 aFullBtn(this, SW_RES( RB_FULL )),
142 aLeftBtn(this, SW_RES( RB_LEFT )),
143 aFromLeftBtn(this, SW_RES( RB_FROM_LEFT )),
144 aRightBtn(this, SW_RES( RB_RIGHT )),
145 aCenterBtn(this, SW_RES( RB_CENTER )),
146 aFreeBtn(this, SW_RES( RB_FREE )),
148 aDistFL(this, SW_RES( FL_DIST )),
149 aLeftFT(this, SW_RES( FT_LEFT_DIST )),
150 aLeftMF(this, SW_RES( ED_LEFT_DIST )),
151 aRightFT(this, SW_RES( FT_RIGHT_DIST )),
152 aRightMF(this, SW_RES( ED_RIGHT_DIST )),
153 aTopFT (this, SW_RES( FT_TOP_DIST )),
154 aTopMF(this, SW_RES( ED_TOP_DIST )),
155 aBottomFT(this, SW_RES( FT_BOTTOM_DIST )),
156 aBottomMF(this, SW_RES( ED_BOTTOM_DIST )),
158 aPropertiesFL(this, SW_RES( FL_PROPERTIES )),
159 aTextDirectionFT(this, SW_RES( FT_TEXTDIRECTION )),
160 aTextDirectionLB(this, SW_RES( LB_TEXTDIRECTION )),
162 pTblData(0),
163 nSaveWidth(0),
164 nMinTableWidth(MINLAY),
165 bModified(FALSE),
166 bFull(0),
167 bHtmlMode(sal_False)
169 FreeResource();
170 SetExchangeSupport();
172 const SfxPoolItem* pItem;
173 if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem))
174 bHtmlMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
176 sal_Bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled();
177 if( !bHtmlMode && bCTL )
179 aPropertiesFL.Show();
180 aTextDirectionFT.Show();
181 aTextDirectionLB.Show();
184 Init();
187 /*------------------------------------------------------------------------
188 ------------------------------------------------------------------------*/
189 void SwFormatTablePage::Init()
191 aLeftMF.MetricField::SetMin(-999999);
192 aRightMF.MetricField::SetMin(-999999);
194 // handler
195 Link aLk = LINK( this, SwFormatTablePage, AutoClickHdl );
196 aFullBtn.SetClickHdl( aLk );
197 aFreeBtn.SetClickHdl( aLk );
198 aLeftBtn.SetClickHdl( aLk );
199 aFromLeftBtn.SetClickHdl( aLk );
200 aRightBtn.SetClickHdl( aLk );
201 aCenterBtn.SetClickHdl( aLk );
203 aLk = LINK( this, SwFormatTablePage, UpDownLoseFocusHdl );
204 aTopMF.SetUpHdl( aLk );
205 aBottomMF.SetUpHdl( aLk );
206 aRightMF.SetUpHdl( aLk );
207 aLeftMF.SetUpHdl( aLk );
208 aWidthMF.SetUpHdl( aLk );
210 aTopMF.SetDownHdl( aLk );
211 aBottomMF.SetDownHdl( aLk );
212 aRightMF.SetDownHdl( aLk );
213 aLeftMF.SetDownHdl( aLk );
214 aWidthMF.SetDownHdl( aLk );
216 aTopMF.SetLoseFocusHdl( aLk );
217 aBottomMF.SetLoseFocusHdl( aLk );
218 aRightMF.SetLoseFocusHdl( aLk );
219 aLeftMF.SetLoseFocusHdl( aLk );
220 aWidthMF.SetLoseFocusHdl( aLk );
222 aRelWidthCB.SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
225 /*------------------------------------------------------------------------*/
227 IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn )
229 DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
230 BOOL bIsChecked = pBtn->IsChecked();
231 sal_Int64 nLeft = aLeftMF.DenormalizePercent(aLeftMF.GetValue(FUNIT_TWIP ));
232 sal_Int64 nRight = aRightMF.DenormalizePercent(aRightMF.GetValue(FUNIT_TWIP ));
233 aWidthMF.ShowPercent(bIsChecked);
234 aLeftMF.ShowPercent(bIsChecked);
235 aRightMF.ShowPercent(bIsChecked);
237 if (bIsChecked)
239 aWidthMF.SetRefValue(pTblData->GetSpace());
240 aLeftMF.SetRefValue(pTblData->GetSpace());
241 aRightMF.SetRefValue(pTblData->GetSpace());
242 aLeftMF.MetricField::SetMin(0); // wird vom Percentfield ueberschrieben
243 aRightMF.MetricField::SetMin(0);// -""-
244 aLeftMF.MetricField::SetMax(99); //
245 aRightMF.MetricField::SetMax(99);//
246 aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(nLeft ), FUNIT_TWIP );
247 aRightMF.SetPrcntValue(aRightMF.NormalizePercent(nRight ), FUNIT_TWIP );
249 else
250 ModifyHdl(&aLeftMF); // Werte wieder korrigieren
252 if(aFreeBtn.IsChecked())
254 BOOL bEnable = !pBtn->IsChecked();
255 aRightMF.Enable(bEnable);
256 aRightFT.Enable(bEnable);
258 bModified = TRUE;
260 return 0;
263 /*------------------------------------------------------------------------
264 ------------------------------------------------------------------------*/
265 IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox )
267 BOOL bRestore = TRUE,
268 bLeftEnable = FALSE,
269 bRightEnable= FALSE,
270 bWidthEnable= FALSE,
271 bOthers = TRUE;
272 if( (RadioButton *) pBox == &aFullBtn )
274 aLeftMF.SetPrcntValue(0);
275 aRightMF.SetPrcntValue(0);
276 nSaveWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )));
277 aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(pTblData->GetSpace() ), FUNIT_TWIP );
278 bFull = TRUE;
279 bRestore = FALSE;
281 else if( (RadioButton *) pBox == &aLeftBtn )
283 bRightEnable = bWidthEnable = TRUE;
284 aLeftMF.SetPrcntValue(0);
286 else if( (RadioButton *) pBox == &aFromLeftBtn )
288 bLeftEnable = bWidthEnable = TRUE;
289 aRightMF.SetPrcntValue(0);
291 else if( (RadioButton *) pBox == &aRightBtn )
293 bLeftEnable = bWidthEnable = TRUE;
294 aRightMF.SetPrcntValue(0);
296 else if( ( RadioButton * ) pBox == &aCenterBtn )
298 bLeftEnable = bWidthEnable = TRUE;
300 else if( ( RadioButton * ) pBox == &aFreeBtn )
302 RightModifyHdl(&aRightMF);
303 bLeftEnable = TRUE;
304 bWidthEnable = TRUE;
305 bOthers = FALSE;
307 aLeftMF.Enable(bLeftEnable);
308 aLeftFT.Enable(bLeftEnable);
309 aWidthMF.Enable(bWidthEnable);
310 aWidthFT.Enable(bWidthEnable);
311 if ( bOthers )
313 aRightMF.Enable(bRightEnable);
314 aRightFT.Enable(bRightEnable);
315 aRelWidthCB.Enable(bWidthEnable);
318 if(bFull && bRestore)
320 // nachdem auf autom. geschaltet wurde, wurde die Breite gemerkt,
321 // um sie beim Zurueckschalten restaurieren zu koennen
322 bFull = FALSE;
323 aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(nSaveWidth ), FUNIT_TWIP );
325 ModifyHdl(&aWidthMF);
326 bModified = TRUE;
327 return 0;
330 /*----------------------------------------------------------------------*/
331 IMPL_LINK( SwFormatTablePage, RightModifyHdl, MetricField *, EMPTYARG )
333 if(aFreeBtn.IsChecked())
335 BOOL bEnable = aRightMF.GetValue() == 0;
336 // aWidthMF.Enable(bEnable);
337 aRelWidthCB.Enable(bEnable);
338 // aWidthFT.Enable(bEnable);
339 if ( !bEnable )
341 aRelWidthCB.Check(FALSE);
342 RelWidthClickHdl(&aRelWidthCB);
344 bEnable = aRelWidthCB.IsChecked();
345 aRightMF.Enable(!bEnable);
346 aRightFT.Enable(!bEnable);
348 return 0;
351 /*------------------------------------------------------------------------
352 ------------------------------------------------------------------------*/
353 IMPL_LINK_INLINE_START( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
355 if( &aRightMF == pEdit)
356 RightModifyHdl(pEdit);
357 ModifyHdl( pEdit );
358 return 0;
360 IMPL_LINK_INLINE_END( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
362 void SwFormatTablePage::ModifyHdl( Edit* pEdit )
365 SwTwips nCurWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
366 SwTwips nPrevWidth = nCurWidth;
367 SwTwips nRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
368 SwTwips nLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
369 SwTwips nDiff;
371 if( pEdit == &aWidthMF )
373 if( nCurWidth < MINLAY )
374 nCurWidth = MINLAY;
375 nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
376 //rechtsbuendig nur linken Rand veraendern
377 if(aRightBtn.IsChecked())
378 nLeft -= nDiff;
379 //linksbuendig nur rechten Rand veraendern
380 else if(aLeftBtn.IsChecked())
381 nRight -= nDiff;
382 //linker Rand und Breite erlaubt - erst rechts - dann links
383 else if(aFromLeftBtn.IsChecked())
385 if( nRight >= nDiff )
386 nRight -= nDiff;
387 else
389 nDiff -= nRight;
390 nRight = 0;
391 if(nLeft >= nDiff)
392 nLeft -= nDiff;
393 else
395 nRight += nLeft - nDiff;
396 nLeft = 0;
397 nCurWidth = pTblData->GetSpace();
402 //zentriert beide Seiten gleichmaessig veraendern
403 else if(aCenterBtn.IsChecked())
405 if((nLeft != nRight))
407 nDiff += nLeft + nRight;
408 nLeft = nDiff/2;
409 nRight = nDiff/2;
411 else
413 nLeft -= nDiff/2;
414 nRight -= nDiff/2;
417 //freie Ausrichtung: beide Raender verkleinern
418 else if(aFreeBtn.IsChecked())
420 nLeft -= nDiff/2;
421 nRight -= nDiff/2;
424 if( pEdit == &aRightMF )
427 if( nRight + nLeft > pTblData->GetSpace() - MINLAY )
428 nRight = pTblData->GetSpace() -nLeft - MINLAY;
430 nCurWidth = pTblData->GetSpace() - nLeft - nRight;
432 if( pEdit == &aLeftMF )
434 if(!aFromLeftBtn.IsChecked())
436 BOOL bCenter = aCenterBtn.IsChecked();
437 if( bCenter )
438 nRight = nLeft;
439 if(nRight + nLeft > pTblData->GetSpace() - MINLAY )
441 nLeft = bCenter ? (pTblData->GetSpace() - MINLAY) /2 :
442 (pTblData->GetSpace() - MINLAY) - nRight;
443 nRight = bCenter ? (pTblData->GetSpace() - MINLAY) /2 : nRight;
445 nCurWidth = pTblData->GetSpace() - nLeft - nRight;
447 else
449 //hier wird bei Aenderung an der linken Seite zuerst der
450 //rechte Rand veraendert, dann die Breite
451 nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
453 nRight -= nDiff;
454 nCurWidth = pTblData->GetSpace() - nLeft - nRight;
457 if (nCurWidth != nPrevWidth )
458 aWidthMF.SetPrcntValue( aWidthMF.NormalizePercent( nCurWidth ), FUNIT_TWIP );
459 aRightMF.SetPrcntValue( aRightMF.NormalizePercent( nRight ), FUNIT_TWIP );
460 aLeftMF.SetPrcntValue( aLeftMF.NormalizePercent( nLeft ), FUNIT_TWIP );
461 bModified = TRUE;
464 /*------------------------------------------------------------------------
465 ------------------------------------------------------------------------*/
466 SfxTabPage* SwFormatTablePage::Create( Window* pParent,
467 const SfxItemSet& rAttrSet)
469 return new SwFormatTablePage( pParent, rAttrSet );
472 /*------------------------------------------------------------------------
473 -------------------------------------------------------------------------*/
474 BOOL SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
476 // Testen, ob eins der Control noch den Focus hat
477 if(aWidthMF.HasFocus())
478 ModifyHdl(&aWidthMF);
479 else if(aLeftMF.HasFocus())
480 ModifyHdl(&aLeftMF);
481 else if(aRightMF.HasFocus())
482 ModifyHdl(&aRightMF);
483 else if(aTopMF.HasFocus())
484 ModifyHdl(&aTopMF);
485 else if(aBottomMF.HasFocus())
486 ModifyHdl(&aBottomMF);
488 if(bModified)
490 if( aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
491 aTopMF.GetText() != aTopMF.GetSavedValue() )
493 SvxULSpaceItem aULSpace(RES_UL_SPACE);
494 aULSpace.SetUpper( (USHORT) aTopMF.Denormalize(
495 aTopMF.GetValue( FUNIT_TWIP )));
496 aULSpace.SetLower( (USHORT) aBottomMF.Denormalize(
497 aBottomMF.GetValue( FUNIT_TWIP )));
498 rCoreSet.Put(aULSpace);
502 if(aNameED.GetText() != aNameED.GetSavedValue())
504 rCoreSet.Put(SfxStringItem( FN_PARAM_TABLE_NAME, aNameED.GetText()));
505 bModified = TRUE;
508 USHORT nPos;
509 if( aTextDirectionLB.IsVisible() &&
510 ( nPos = aTextDirectionLB.GetSelectEntryPos() ) !=
511 aTextDirectionLB.GetSavedValue() )
513 sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)aTextDirectionLB.GetEntryData( nPos );
514 rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
515 bModified = TRUE;
518 return bModified;
521 /*------------------------------------------------------------------------
522 ------------------------------------------------------------------------*/
523 void SwFormatTablePage::Reset( const SfxItemSet& )
525 const SfxItemSet& rSet = GetItemSet();
526 const SfxPoolItem* pItem;
528 if(bHtmlMode)
530 aNameED .Disable();
531 aTopFT .Hide();
532 aTopMF .Hide();
533 aBottomFT.Hide();
534 aBottomMF.Hide();
535 aFreeBtn.Enable(FALSE);
537 FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
538 SetMetric( aWidthMF, aMetric );
539 SetMetric( aRightMF, aMetric );
540 SetMetric( aLeftMF, aMetric );
541 SetMetric( aTopMF, aMetric );
542 SetMetric( aBottomMF, aMetric );
544 //Name
545 if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, FALSE, &pItem ))
547 aNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
548 aNameED.SaveValue();
551 if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, FALSE, &pItem ))
553 pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
554 nMinTableWidth = pTblData->GetColCount() * MINLAY;
556 if(pTblData->GetWidthPercent())
558 aRelWidthCB.Check(TRUE);
559 RelWidthClickHdl(&aRelWidthCB);
560 aWidthMF.SetPrcntValue(pTblData->GetWidthPercent(), FUNIT_CUSTOM);
562 aWidthMF.SaveValue();
563 nSaveWidth = static_cast< SwTwips >(aWidthMF.GetValue(FUNIT_CUSTOM));
565 else
567 aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
568 pTblData->GetWidth()), FUNIT_TWIP);
569 aWidthMF.SaveValue();
570 nSaveWidth = pTblData->GetWidth();
571 nMinTableWidth = Min( nSaveWidth, nMinTableWidth );
574 aWidthMF.SetRefValue(pTblData->GetSpace());
575 aWidthMF.SetLast(aWidthMF.NormalizePercent( pTblData->GetSpace() ));
576 aLeftMF.SetLast(aLeftMF.NormalizePercent( pTblData->GetSpace() ));
577 aRightMF.SetLast(aRightMF.NormalizePercent( pTblData->GetSpace() ));
579 aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
580 pTblData->GetLeftSpace()), FUNIT_TWIP);
581 aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
582 pTblData->GetRightSpace()), FUNIT_TWIP);
583 aLeftMF.SaveValue();
584 aRightMF.SaveValue();
586 nOldAlign = pTblData->GetAlign();
588 BOOL bSetRight = FALSE, bRightEnable = FALSE,
589 bSetLeft = FALSE, bLeftEnable = FALSE;
590 switch( nOldAlign )
592 case text::HoriOrientation::NONE:
593 aFreeBtn.Check();
594 if(aRelWidthCB.IsChecked())
595 bSetRight = TRUE;
596 break;
597 case text::HoriOrientation::FULL:
599 bSetRight = bSetLeft = TRUE;
600 aFullBtn.Check();
601 aWidthMF.Enable(FALSE);
602 aRelWidthCB.Enable(FALSE);
603 aWidthFT.Enable(FALSE);
605 break;
606 case text::HoriOrientation::LEFT:
608 bSetLeft = TRUE;
609 aLeftBtn.Check();
611 break;
612 case text::HoriOrientation::LEFT_AND_WIDTH :
614 bSetRight = TRUE;
615 aFromLeftBtn.Check();
617 break;
618 case text::HoriOrientation::RIGHT:
620 bSetRight = TRUE;
621 aRightBtn.Check();
623 break;
624 case text::HoriOrientation::CENTER:
626 bSetRight = TRUE;
627 aCenterBtn.Check();
629 break;
631 if ( bSetRight )
633 aRightMF.Enable(bRightEnable);
634 aRightFT.Enable(bRightEnable);
636 if ( bSetLeft )
638 aLeftMF.Enable(bLeftEnable);
639 aLeftFT.Enable(bLeftEnable);
644 //Raender
645 if(SFX_ITEM_SET == rSet.GetItemState( RES_UL_SPACE, FALSE,&pItem ))
647 aTopMF.SetValue(aTopMF.Normalize(
648 ((const SvxULSpaceItem*)pItem)->GetUpper()), FUNIT_TWIP);
649 aBottomMF.SetValue(aBottomMF.Normalize(
650 ((const SvxULSpaceItem*)pItem)->GetLower()), FUNIT_TWIP);
651 aTopMF.SaveValue();
652 aBottomMF.SaveValue();
655 //text direction
656 if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem ) )
658 sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
659 USHORT nPos = aTextDirectionLB.GetEntryPos( (void*) nVal );
660 aTextDirectionLB.SelectEntryPos( nPos );
661 aTextDirectionLB.SaveValue();
664 aWidthMF.SetMax( 2*aWidthMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
665 aRightMF.SetMax( aRightMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
666 aLeftMF.SetMax( aLeftMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
667 aWidthMF.SetMin( aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP );
671 /*------------------------------------------------------------------------
672 ------------------------------------------------------------------------*/
673 void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
675 DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
676 if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP ))
678 SwTwips nCurWidth = text::HoriOrientation::FULL != pTblData->GetAlign() ?
679 pTblData->GetWidth() :
680 pTblData->GetSpace();
681 if(pTblData->GetWidthPercent() == 0 &&
682 nCurWidth != aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )))
684 aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
685 nCurWidth), FUNIT_TWIP);
686 aWidthMF.SaveValue();
687 nSaveWidth = nCurWidth;
688 aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
689 pTblData->GetLeftSpace()), FUNIT_TWIP);
690 aLeftMF.SaveValue();
691 aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
692 pTblData->GetRightSpace()), FUNIT_TWIP);
693 aRightMF.SaveValue();
698 /*------------------------------------------------------------------------
699 ------------------------------------------------------------------------*/
700 int SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
702 // os: VCL sorgt nicht dafuer, dass das aktive Control im
703 // dialog bei OK den focus verliert
704 aNameED.GrabFocus();
705 // Test des Tabellennamens auf Leerzeichen
706 String sTblName = aNameED.GetText();
707 if(sTblName.Search(' ') != STRING_NOTFOUND)
709 InfoBox(this, SW_RES(MSG_WRONG_TABLENAME)).Execute();
710 aNameED.GrabFocus();
711 return KEEP_PAGE;
713 if(_pSet)
715 FillItemSet(*_pSet);
716 if(bModified)
718 SwTwips lLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
719 SwTwips lRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
722 if( aLeftMF.GetText() != aLeftMF.GetSavedValue() ||
723 aRightMF.GetText() != aRightMF.GetSavedValue() )
725 pTblData->SetWidthChanged();
726 pTblData->SetLeftSpace( lLeft);
727 pTblData->SetRightSpace( lRight);
730 SwTwips lWidth;
731 if (aRelWidthCB.IsChecked() && aRelWidthCB.IsEnabled())
733 lWidth = pTblData->GetSpace() - lRight - lLeft;
734 USHORT nPercentWidth = (USHORT)aWidthMF.GetValue(FUNIT_CUSTOM);
735 if(pTblData->GetWidthPercent() != nPercentWidth)
737 pTblData->SetWidthPercent(nPercentWidth);
738 pTblData->SetWidthChanged();
741 else
743 pTblData->SetWidthPercent(0);
744 lWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
746 pTblData->SetWidth(lWidth);
748 SwTwips nColSum = 0;
749 USHORT i;
751 for( i = 0; i < pTblData->GetColCount(); i++)
753 nColSum += pTblData->GetColumns()[i].nWidth;
755 if(nColSum != pTblData->GetWidth())
757 SwTwips nMinWidth = Min( (long)MINLAY,
758 (long) (pTblData->GetWidth() /
759 pTblData->GetColCount() - 1));
760 SwTwips nDiff = nColSum - pTblData->GetWidth();
761 while ( Abs(nDiff) > pTblData->GetColCount() + 1 )
763 SwTwips nSub = nDiff / pTblData->GetColCount();
764 for( i = 0; i < pTblData->GetColCount(); i++)
766 if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub)
768 pTblData->GetColumns()[i].nWidth -= nSub;
769 nDiff -= nSub;
771 else
773 nDiff -= pTblData->GetColumns()[i].nWidth - nMinWidth;
774 pTblData->GetColumns()[i].nWidth = nMinWidth;
781 sal_Int16 nAlign = 0;
782 if(aRightBtn.IsChecked())
783 nAlign = text::HoriOrientation::RIGHT;
784 else if(aLeftBtn.IsChecked())
785 nAlign = text::HoriOrientation::LEFT;
786 else if(aFromLeftBtn.IsChecked())
787 nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
788 else if(aCenterBtn.IsChecked())
789 nAlign = text::HoriOrientation::CENTER;
790 else if(aFreeBtn.IsChecked())
791 nAlign = text::HoriOrientation::NONE;
792 else if(aFullBtn.IsChecked())
794 nAlign = text::HoriOrientation::FULL;
795 lWidth = lAutoWidth;
797 if(nAlign != pTblData->GetAlign())
799 pTblData->SetWidthChanged();
800 pTblData->SetAlign(nAlign);
804 // if( text::HoriOrientation::CENTER && lWidth != (SwTwips)aWidthMF.GetSavedValue())
805 if(pTblData->GetWidth() != lWidth )
807 pTblData->SetWidthChanged();
808 pTblData->SetWidth(
809 nAlign == text::HoriOrientation::FULL ? pTblData->GetSpace() : lWidth );
811 if(pTblData->HasWidthChanged())
812 _pSet->Put(SwPtrItem(FN_TABLE_REP, pTblData));
814 #ifdef DEBUG_TBLDLG
815 DbgTblRep(pTblData)
816 #endif
818 return TRUE;
820 /*------------------------------------------------------------------------
821 Beschreibung: Seite Spaltenkonfiguration
822 ------------------------------------------------------------------------*/
823 SwTableColumnPage::SwTableColumnPage( Window* pParent,
824 const SfxItemSet& rSet ) :
825 SfxTabPage(pParent, SW_RES( TP_TABLE_COLUMN ), rSet ),
826 aModifyTableCB(this, SW_RES(CB_MOD_TBL)),
827 aProportionalCB(this, SW_RES(CB_PROP)),
828 aSpaceFT(this, SW_RES(FT_SPACE)),
829 aSpaceED(this, SW_RES(ED_SPACE)),
831 aUpBtn(this, SW_RES(COL_BTN_UP)),
832 aFT1(this, SW_RES(COL_FT_1)),
833 aMF1(this, SW_RES(COL_MF_1)),
834 aFT2(this, SW_RES(COL_FT_2)),
835 aMF2(this, SW_RES(COL_MF_2)),
836 aFT3(this, SW_RES(COL_FT_3)),
837 aMF3(this, SW_RES(COL_MF_3)),
838 aFT4(this, SW_RES(COL_FT_4)),
839 aMF4(this, SW_RES(COL_MF_4)),
840 aFT5(this, SW_RES(COL_FT_5)),
841 aMF5(this, SW_RES(COL_MF_5)),
842 aFT6(this, SW_RES(COL_FT_6)),
843 aMF6(this, SW_RES(COL_MF_6)),
844 aDownBtn(this, SW_RES(COL_BTN_DOWN)),
845 aColFL(this, SW_RES(COL_FL_LAYOUT)),
847 nTableWidth(0),
848 nMinWidth( MINLAY ),
849 nNoOfCols( 0 ),
850 nNoOfVisibleCols( 0 ),
851 bModified(FALSE),
852 bModifyTbl(FALSE),
853 bPercentMode(FALSE)
855 FreeResource();
856 SetExchangeSupport();
858 pFieldArr[0] = &aMF1;
859 pFieldArr[1] = &aMF2;
860 pFieldArr[2] = &aMF3;
861 pFieldArr[3] = &aMF4;
862 pFieldArr[4] = &aMF5;
863 pFieldArr[5] = &aMF6;
865 pTextArr[0] = &aFT1;
866 pTextArr[1] = &aFT2;
867 pTextArr[2] = &aFT3;
868 pTextArr[3] = &aFT4;
869 pTextArr[4] = &aFT5;
870 pTextArr[5] = &aFT6;
872 const SfxPoolItem* pItem;
873 Init((SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE,&pItem )
874 && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON));
877 /*------------------------------------------------------------------------
878 Beschreibung: Seite Spaltenkonfiguration
879 ------------------------------------------------------------------------*/
880 SwTableColumnPage::~SwTableColumnPage()
884 /*------------------------------------------------------------------------
885 ------------------------------------------------------------------------*/
886 SfxTabPage* SwTableColumnPage::Create( Window* pParent,
887 const SfxItemSet& rAttrSet)
889 return new SwTableColumnPage( pParent, rAttrSet );
892 /*------------------------------------------------------------------------
893 ------------------------------------------------------------------------*/
894 void SwTableColumnPage::Reset( const SfxItemSet& )
896 const SfxItemSet& rSet = GetItemSet();
898 const SfxPoolItem* pItem;
899 if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, FALSE, &pItem ))
901 pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
902 nNoOfVisibleCols = pTblData->GetColCount();
903 nNoOfCols = pTblData->GetAllColCount();
904 nTableWidth = pTblData->GetAlign() != text::HoriOrientation::FULL &&
905 pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
906 pTblData->GetWidth() : pTblData->GetSpace();
908 USHORT i;
909 for( i = 0; i < nNoOfCols; i++ )
911 if( pTblData->GetColumns()[i].nWidth < nMinWidth )
912 nMinWidth = pTblData->GetColumns()[i].nWidth;
914 sal_Int64 nMinTwips = pFieldArr[0]->NormalizePercent( nMinWidth );
915 sal_Int64 nMaxTwips = pFieldArr[0]->NormalizePercent( nTableWidth );
916 for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
918 pFieldArr[i]->SetPrcntValue( pFieldArr[i]->NormalizePercent(
919 GetVisibleWidth(i) ), FUNIT_TWIP );
920 pFieldArr[i]->SetMin( nMinTwips , FUNIT_TWIP );
921 pFieldArr[i]->SetMax( nMaxTwips , FUNIT_TWIP );
922 pFieldArr[i]->Enable();
923 pTextArr[i]->Enable();
926 if( nNoOfVisibleCols > MET_FIELDS )
927 aUpBtn.Enable();
928 i = nNoOfVisibleCols;
929 while( i < MET_FIELDS )
931 pFieldArr[i]->SetText( aEmptyStr );
932 pTextArr[i]->Hide();
933 i++;
936 ActivatePage(rSet);
940 /*------------------------------------------------------------------------
941 ------------------------------------------------------------------------*/
942 void SwTableColumnPage::Init(BOOL bWeb)
944 FieldUnit aMetric = ::GetDfltMetric(bWeb);
945 Link aLkUp = LINK( this, SwTableColumnPage, UpHdl );
946 Link aLkDown = LINK( this, SwTableColumnPage, DownHdl );
947 Link aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl );
948 for( USHORT i = 0; i < MET_FIELDS; i++ )
950 aValueTbl[i] = i;
951 SetMetric(*pFieldArr[i], aMetric);
952 pFieldArr[i]->SetUpHdl( aLkUp );
953 pFieldArr[i]->SetDownHdl( aLkDown );
954 pFieldArr[i]->SetLoseFocusHdl( aLkLF );
957 SetMetric(aSpaceED, aMetric);
959 Link aLk = LINK( this, SwTableColumnPage, AutoClickHdl );
960 aUpBtn.SetClickHdl( aLk );
961 aDownBtn.SetClickHdl( aLk );
963 aLk = LINK( this, SwTableColumnPage, ModeHdl );
964 aModifyTableCB .SetClickHdl( aLk );
965 aProportionalCB.SetClickHdl( aLk );
968 /*------------------------------------------------------------------------
969 ------------------------------------------------------------------------*/
970 IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox )
972 //Anzeigefenster verschieben
973 if(pBox == (CheckBox *)&aDownBtn)
975 if(aValueTbl[0] > 0)
977 for( USHORT i=0; i < MET_FIELDS; i++ )
978 aValueTbl[i] -= 1;
981 if(pBox == (CheckBox *)&aUpBtn)
983 if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
985 for(USHORT i=0;i < MET_FIELDS;i++)
986 aValueTbl[i] += 1;
989 for( USHORT i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
991 String sEntry('~');
992 sEntry += String::CreateFromInt32( aValueTbl[i] + 1 );
993 pTextArr[i]->SetText( sEntry );
996 aDownBtn.Enable(aValueTbl[0] > 0);
997 aUpBtn.Enable(aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 );
998 UpdateCols(0);
999 return 0;
1002 /*------------------------------------------------------------------------
1003 ------------------------------------------------------------------------*/
1004 IMPL_LINK_INLINE_START( SwTableColumnPage, UpHdl, PercentField *, pEdit )
1006 bModified = TRUE;
1007 ModifyHdl( pEdit );
1008 return 0;
1010 IMPL_LINK_INLINE_END( SwTableColumnPage, UpHdl, PercentField *, pEdit )
1012 /*------------------------------------------------------------------------
1013 ------------------------------------------------------------------------*/
1014 IMPL_LINK_INLINE_START( SwTableColumnPage, DownHdl, PercentField *, pEdit )
1016 bModified = TRUE;
1017 ModifyHdl( pEdit );
1018 return 0;
1020 IMPL_LINK_INLINE_END( SwTableColumnPage, DownHdl, PercentField *, pEdit )
1022 /*------------------------------------------------------------------------
1023 ------------------------------------------------------------------------*/
1024 IMPL_LINK_INLINE_START( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
1026 if(pEdit->IsModified())
1028 bModified = TRUE;
1029 ModifyHdl( pEdit );
1031 return 0;
1033 IMPL_LINK_INLINE_END( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
1035 /*------------------------------------------------------------------------
1036 ------------------------------------------------------------------------*/
1037 IMPL_LINK( SwTableColumnPage, ModeHdl, CheckBox*, pBox )
1039 BOOL bCheck = pBox->IsChecked();
1040 if(pBox == &aProportionalCB)
1042 if(bCheck)
1043 aModifyTableCB.Check();
1044 aModifyTableCB.Enable(!bCheck && bModifyTbl);
1046 return 0;
1049 /*------------------------------------------------------------------------
1050 ------------------------------------------------------------------------*/
1051 BOOL SwTableColumnPage::FillItemSet( SfxItemSet& )
1053 for( USHORT i = 0; i < MET_FIELDS; i++ )
1055 if(pFieldArr[i]->HasFocus())
1057 LoseFocusHdl(pFieldArr[i]);
1058 break;
1062 if(bModified)
1064 pTblData->SetColsChanged();
1066 return bModified;
1069 /*------------------------------------------------------------------------
1070 ------------------------------------------------------------------------*/
1071 void SwTableColumnPage::ModifyHdl( PercentField* pEdit )
1073 USHORT nAktPos;
1074 USHORT i;
1076 for( i = 0; i < MET_FIELDS; i++)
1077 if(pEdit == pFieldArr[i])
1078 break;
1080 SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) );
1081 nAktPos = aValueTbl[i];
1083 UpdateCols( nAktPos );
1086 /*------------------------------------------------------------------------
1087 ------------------------------------------------------------------------*/
1088 void SwTableColumnPage::UpdateCols( USHORT nAktPos )
1090 SwTwips nSum = 0;
1091 USHORT i;
1093 for( i = 0; i < nNoOfCols; i++ )
1095 nSum += (pTblData->GetColumns())[i].nWidth;
1097 SwTwips nDiff = nSum - nTableWidth;
1099 BOOL bModifyTable = aModifyTableCB.IsChecked();
1100 BOOL bProp = aProportionalCB.IsChecked();
1102 if(!bModifyTable && !bProp )
1104 // Tabellenbreite bleibt, Differenz wird mit der/den
1105 // naechsten Zellen ausgeglichen
1106 while( nDiff )
1108 if( ++nAktPos == nNoOfVisibleCols)
1109 nAktPos = 0;
1110 if( nDiff < 0 )
1112 SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1113 nDiff = 0;
1115 else if( GetVisibleWidth(nAktPos) >= nDiff + nMinWidth )
1117 SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1118 nDiff = 0;
1120 if( nDiff > 0 && GetVisibleWidth(nAktPos) > nMinWidth )
1122 if( nDiff >= (GetVisibleWidth(nAktPos) - nMinWidth) )
1124 nDiff -= (GetVisibleWidth(nAktPos) - nMinWidth);
1125 SetVisibleWidth(nAktPos, nMinWidth);
1127 else
1129 nDiff = 0;
1130 SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1132 DBG_ASSERT(nDiff >= 0, "nDiff < 0 kann hier nicht sein!");
1136 else if(bModifyTable && !bProp)
1138 // Differenz wird ueber die Tabellenbreite ausgeglichen,
1139 // andere Spalten bleiben unveraendert
1140 DBG_ASSERT(nDiff <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
1141 SwTwips nActSpace = pTblData->GetSpace() - nTableWidth;
1142 if(nDiff > nActSpace)
1144 nTableWidth = pTblData->GetSpace();
1145 SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nActSpace );
1147 else
1149 nTableWidth += nDiff;
1152 else if(bModifyTable & bProp)
1154 // Alle Spalten werden proportional mitveraendert, die Tabellenbreite wird
1155 // entsprechend angepasst
1156 DBG_ASSERT(nDiff * nNoOfVisibleCols <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
1157 long nAdd = nDiff;
1158 if(nDiff * nNoOfVisibleCols > pTblData->GetSpace() - nTableWidth)
1160 nAdd = (pTblData->GetSpace() - nTableWidth) / nNoOfVisibleCols;
1161 SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nAdd );
1162 nDiff = nAdd;
1164 if(nAdd)
1165 for(i = 0; i < nNoOfVisibleCols; i++ )
1167 if(i == nAktPos)
1168 continue;
1169 SwTwips nVisWidth;
1170 if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1172 nAdd += nVisWidth - MINLAY;
1173 SetVisibleWidth(i, MINLAY);
1175 else
1177 SetVisibleWidth(i, nVisWidth + nDiff);
1178 nAdd += nDiff;
1182 nTableWidth += nAdd;
1185 else
1187 // Die Differenz wird gleichmaessig auf alle anderen Spalten aufgeteilt
1188 // die Tabellenbreite bleibt konstant
1190 SwTwips nDiffn = nDiff/(nNoOfVisibleCols - 1);
1191 if(nDiff < 0 && (nNoOfVisibleCols - 1) * nDiffn != nDiff)
1192 nDiffn-- ;
1193 USHORT nStart = nAktPos++;
1194 if(nAktPos == nNoOfVisibleCols)
1195 nStart = 0;
1196 for(USHORT i = 0; i < nNoOfVisibleCols; i++ )
1198 if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1200 nAdd += nVisWidth - MINLAY;
1201 SetVisibleWidth(i, MINLAY);
1208 #ifdef DEBUG_TBLDLG
1209 DbgTblRep(pTblData)
1210 #endif
1212 if(!bPercentMode)
1213 aSpaceED.SetValue(aSpaceED.Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
1215 for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
1217 pFieldArr[i]->SetPrcntValue(pFieldArr[i]->NormalizePercent(
1218 GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP);
1219 pFieldArr[i]->ClearModifyFlag();
1224 /*------------------------------------------------------------------------
1225 ------------------------------------------------------------------------*/
1226 void SwTableColumnPage::ActivatePage( const SfxItemSet& )
1228 bPercentMode = pTblData->GetWidthPercent() != 0;
1229 for( USHORT i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
1231 pFieldArr[i]->SetRefValue(pTblData->GetWidth());
1232 pFieldArr[i]->ShowPercent( bPercentMode );
1235 USHORT nTblAlign = pTblData->GetAlign();
1236 if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) ||
1237 (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace()))
1239 nTableWidth = text::HoriOrientation::FULL == nTblAlign ?
1240 pTblData->GetSpace() :
1241 pTblData->GetWidth();
1242 UpdateCols(0);
1244 bModifyTbl = TRUE;
1245 if(pTblData->GetWidthPercent() ||
1246 text::HoriOrientation::FULL == nTblAlign ||
1247 pTblData->IsLineSelected() )
1248 bModifyTbl = FALSE;
1249 if(bPercentMode)
1251 aModifyTableCB .Check(FALSE);
1252 aProportionalCB .Check(FALSE);
1254 else if( !bModifyTbl )
1256 aProportionalCB.Check(FALSE);
1257 aModifyTableCB.Check(FALSE);
1259 aSpaceFT.Enable(!bPercentMode);
1260 aSpaceED.Enable(!bPercentMode);
1261 aModifyTableCB.Enable( !bPercentMode && bModifyTbl );
1262 aProportionalCB.Enable(!bPercentMode && bModifyTbl );
1264 /* if(pTblData->IsLineSelected() && pTblData->IsComplex())
1268 aSpaceED.SetValue(aSpaceED.Normalize(
1269 pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
1273 /*------------------------------------------------------------------------
1274 ------------------------------------------------------------------------*/
1275 int SwTableColumnPage::DeactivatePage( SfxItemSet* _pSet )
1277 if(_pSet)
1279 FillItemSet(*_pSet);
1280 if(text::HoriOrientation::FULL != pTblData->GetAlign() && pTblData->GetWidth() != nTableWidth)
1282 pTblData->SetWidth(nTableWidth);
1283 SwTwips nDiff = pTblData->GetSpace() - pTblData->GetWidth() -
1284 pTblData->GetLeftSpace() - pTblData->GetRightSpace();
1285 switch( pTblData->GetAlign() )
1287 case text::HoriOrientation::RIGHT:
1288 pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff);
1289 break;
1290 case text::HoriOrientation::LEFT:
1291 pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff);
1292 break;
1293 case text::HoriOrientation::NONE:
1295 SwTwips nDiff2 = nDiff/2;
1296 if( nDiff > 0 ||
1297 (-nDiff2 < pTblData->GetRightSpace() && - nDiff2 < pTblData->GetLeftSpace()))
1299 pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff2);
1300 pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff2);
1302 else
1304 if(pTblData->GetRightSpace() > pTblData->GetLeftSpace())
1306 pTblData->SetLeftSpace(0);
1307 pTblData->SetRightSpace(pTblData->GetSpace() - pTblData->GetWidth());
1309 else
1311 pTblData->SetRightSpace(0);
1312 pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
1316 break;
1317 case text::HoriOrientation::CENTER:
1318 pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff/2);
1319 pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff/2);
1320 break;
1321 case text::HoriOrientation::LEFT_AND_WIDTH :
1322 if(nDiff > pTblData->GetRightSpace())
1324 pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
1326 pTblData->SetRightSpace(
1327 pTblData->GetSpace() - pTblData->GetWidth() - pTblData->GetLeftSpace());
1328 break;
1330 pTblData->SetWidthChanged();
1332 #ifdef DEBUG_TBLDLG
1333 DbgTblRep(pTblData)
1334 #endif
1335 _pSet->Put(SwPtrItem( FN_TABLE_REP, pTblData ));
1337 return TRUE;
1340 /*------------------------------------------------------------------------
1341 ------------------------------------------------------------------------*/
1342 SwTwips SwTableColumnPage::GetVisibleWidth(USHORT nPos)
1344 USHORT i=0;
1346 while( nPos )
1348 if(pTblData->GetColumns()[i].bVisible && nPos)
1349 nPos--;
1350 i++;
1352 SwTwips nReturn = pTblData->GetColumns()[i].nWidth;
1353 DBG_ASSERT(i < nNoOfCols, "Array index out of range");
1354 while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1355 nReturn += pTblData->GetColumns()[++i].nWidth;
1357 // return (*ppTableColumns)[i].nWidth;
1358 return nReturn;
1361 /*------------------------------------------------------------------------
1362 ------------------------------------------------------------------------*/
1363 void SwTableColumnPage::SetVisibleWidth(USHORT nPos, SwTwips nNewWidth)
1365 USHORT i=0;
1366 while( nPos )
1368 if(pTblData->GetColumns()[i].bVisible && nPos)
1369 nPos--;
1370 i++;
1372 DBG_ASSERT(i < nNoOfCols, "Array index out of range");
1373 pTblData->GetColumns()[i].nWidth = nNewWidth;
1374 while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1375 pTblData->GetColumns()[++i].nWidth = 0;
1379 /*------------------------------------------------------------------------
1380 ------------------------------------------------------------------------*/
1381 SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool& ,
1382 const SfxItemSet* pItemSet, SwWrtShell* pSh ) :
1383 SfxTabDialog(pParent, SW_RES(DLG_FORMAT_TABLE), pItemSet,0),
1384 pShell(pSh),
1385 nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
1387 FreeResource();
1388 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1389 DBG_ASSERT(pFact, "Dialogdiet fail!");
1390 AddTabPage(TP_FORMAT_TABLE, &SwFormatTablePage::Create, 0 );
1391 AddTabPage(TP_TABLE_TEXTFLOW, &SwTextFlowPage::Create, 0 );
1392 AddTabPage(TP_TABLE_COLUMN, &SwTableColumnPage::Create, 0 );
1393 AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
1394 AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
1398 /*------------------------------------------------------------------------
1399 ------------------------------------------------------------------------*/
1400 void SwTableTabDlg::PageCreated(USHORT nId, SfxTabPage& rPage)
1402 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1403 if( TP_BACKGROUND == nId )
1405 sal_Int32 nFlagType = SVX_SHOW_TBLCTL;
1406 if(!( nHtmlMode & HTMLMODE_ON ) ||
1407 nHtmlMode & HTMLMODE_SOME_STYLES)
1408 nFlagType |= SVX_SHOW_SELECTOR;
1409 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
1410 rPage.PageCreated(aSet);
1412 else if(TP_BORDER == nId)
1414 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_TABLE));
1415 rPage.PageCreated(aSet);
1417 else if(TP_TABLE_TEXTFLOW == nId)
1419 ((SwTextFlowPage&)rPage).SetShell(pShell);
1420 const USHORT eType = pShell->GetFrmType(0,TRUE);
1421 if( !(FRMTYPE_BODY & eType) )
1422 ((SwTextFlowPage&)rPage).DisablePageBreak();
1426 /*-----------------12.12.96 12.22-------------------
1427 --------------------------------------------------*/
1428 SwTextFlowPage::SwTextFlowPage( Window* pParent,
1429 const SfxItemSet& rSet ) :
1430 SfxTabPage(pParent, SW_RES( TP_TABLE_TEXTFLOW ), rSet ),
1431 aFlowFL (this, SW_RES(FL_FLOW )),
1432 aPgBrkCB (this, SW_RES(CB_PAGEBREAK )),
1433 aPgBrkRB (this, SW_RES(RB_BREAKPAGE )),
1434 aColBrkRB (this, SW_RES(RB_BREAKCOLUMN )),
1435 aPgBrkBeforeRB (this, SW_RES(RB_PAGEBREAKBEFORE)),
1436 aPgBrkAfterRB (this, SW_RES(RB_PAGEBREAKAFTER )),
1437 aPageCollCB (this, SW_RES(CB_PAGECOLL )),
1438 aPageCollLB (this, SW_RES(LB_PAGECOLL )),
1439 aPageNoFT (this, SW_RES(FT_PAGENUM )),
1440 aPageNoNF (this, SW_RES(NF_PAGENUM )),
1441 aSplitCB (this, SW_RES(CB_SPLIT )),
1442 aSplitRowCB (this, SW_RES(CB_SPLIT_ROW )),
1443 aKeepCB (this, SW_RES(CB_KEEP )),
1444 aHeadLineCB (this, SW_RES(CB_HEADLINE )),
1445 aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER )),
1446 aRepeatHeaderBeforeFT (this),
1447 aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER )),
1448 aRepeatHeaderAfterFT (this),
1449 aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
1450 aTextDirectionFT(this, SW_RES(FT_TEXTDIRECTION )),
1451 aTextDirectionLB(this, SW_RES(LB_TEXTDIRECTION )),
1453 aVertOrientFL (this, SW_RES(FL_VERT_ORIENT )),
1454 aVertOrientFT(this, SW_RES(FT_VERTORIENT )),
1455 aVertOrientLB(this, SW_RES(LB_VERTORIENT )),
1457 pShell(0),
1459 bPageBreak(TRUE),
1460 bHtmlMode(FALSE)
1462 FreeResource();
1464 aPgBrkCB.SetClickHdl(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
1465 aPgBrkBeforeRB.SetClickHdl(
1466 LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
1467 aPgBrkAfterRB.SetClickHdl(
1468 LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
1469 aPageCollCB.SetClickHdl(
1470 LINK( this, SwTextFlowPage, ApplyCollClickHdl_Impl ) );
1471 aColBrkRB.SetClickHdl(
1472 LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
1473 aPgBrkRB.SetClickHdl(
1474 LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
1475 aSplitCB.SetClickHdl(
1476 LINK( this, SwTextFlowPage, SplitHdl_Impl));
1477 aSplitRowCB.SetClickHdl(
1478 LINK( this, SwTextFlowPage, SplitRowHdl_Impl));
1479 aHeadLineCB.SetClickHdl( LINK( this, SwTextFlowPage, HeadLineCBClickHdl ) );
1481 #ifndef SW_FILEFORMAT_40
1482 const SfxPoolItem *pItem;
1483 if(SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE,&pItem )
1484 && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
1485 #endif
1487 aKeepCB.Hide();
1488 aSplitCB.Hide();
1489 aSplitRowCB.Hide();
1492 aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
1494 HeadLineCBClickHdl();
1497 /*-----------------12.12.96 12.22-------------------
1498 --------------------------------------------------*/
1499 SwTextFlowPage::~SwTextFlowPage()
1503 /*-----------------12.12.96 12.22-------------------
1504 --------------------------------------------------*/
1505 SfxTabPage* SwTextFlowPage::Create( Window* pParent,
1506 const SfxItemSet& rAttrSet)
1508 return new SwTextFlowPage(pParent, rAttrSet);
1511 /*-----------------12.12.96 12.22-------------------
1512 --------------------------------------------------*/
1513 BOOL SwTextFlowPage::FillItemSet( SfxItemSet& rSet )
1515 BOOL bModified = FALSE;
1517 //Ueberschrift wiederholen
1518 if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() ||
1519 String::CreateFromInt32( static_cast< INT32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() )
1521 bModified |= 0 != rSet.Put(
1522 SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, aHeadLineCB.IsChecked()? USHORT(aRepeatHeaderNF.GetValue()) : 0 ));
1524 if(aKeepCB.IsChecked() != aKeepCB.GetSavedValue())
1525 bModified |= 0 != rSet.Put( SvxFmtKeepItem( aKeepCB.IsChecked(), RES_KEEP));
1527 if(aSplitCB.IsChecked() != aSplitCB.GetSavedValue())
1528 bModified |= 0 != rSet.Put( SwFmtLayoutSplit( aSplitCB.IsChecked()));
1530 if(aSplitRowCB.IsChecked() != aSplitRowCB.GetSavedValue())
1531 bModified |= 0 != rSet.Put( SwFmtRowSplit( aSplitRowCB.IsChecked()));
1534 const SvxFmtBreakItem* pBreak = (const SvxFmtBreakItem*)GetOldItem( rSet, RES_BREAK );
1535 const SwFmtPageDesc* pDesc = (const SwFmtPageDesc*) GetOldItem( rSet, RES_PAGEDESC );
1538 BOOL bState = aPageCollCB.IsChecked();
1540 //Wenn Seitenvorlage, dann kein Break
1541 BOOL bPageItemPut = FALSE;
1542 if ( bState != aPageCollCB.GetSavedValue() ||
1543 ( bState &&
1544 aPageCollLB.GetSelectEntryPos() != aPageCollLB.GetSavedValue() )
1545 || aPageNoNF.IsEnabled() && aPageNoNF.IsValueModified())
1547 String sPage;
1549 if ( bState )
1551 sPage = aPageCollLB.GetSelectEntry();
1553 USHORT nPgNum = static_cast< USHORT >(aPageNoNF.GetValue());
1554 if ( !pDesc || !pDesc->GetPageDesc() ||
1555 ( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) ||
1556 aPageNoNF.GetSavedValue() != (String)nPgNum)))
1558 SwFmtPageDesc aFmt( pShell->FindPageDescByName( sPage, TRUE ) );
1559 aFmt.SetNumOffset(bState ? nPgNum : 0);
1560 bModified |= 0 != rSet.Put( aFmt );
1561 bPageItemPut = bState;
1564 BOOL bIsChecked = aPgBrkCB.IsChecked();
1565 if ( !bPageItemPut &&
1566 ( bState != aPageCollCB.GetSavedValue() ||
1567 bIsChecked != aPgBrkCB.GetSavedValue() ||
1568 aPgBrkBeforeRB.IsChecked() != aPgBrkBeforeRB.GetSavedValue() ||
1569 aPgBrkRB.IsChecked() != aPgBrkRB.GetSavedValue() ))
1571 SvxFmtBreakItem aBreak(
1572 (const SvxFmtBreakItem&)GetItemSet().Get( RES_BREAK ) );
1574 if(bIsChecked)
1576 BOOL bBefore = aPgBrkBeforeRB.IsChecked();
1578 if ( aPgBrkRB.IsChecked() )
1580 if ( bBefore )
1581 aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
1582 else
1583 aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
1585 else
1587 if ( bBefore )
1588 aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
1589 else
1590 aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
1593 else
1595 aBreak.SetValue( SVX_BREAK_NONE );
1598 if ( !pBreak || !( *(const SvxFmtBreakItem*)pBreak == aBreak ) )
1600 bModified |= 0 != rSet.Put( aBreak );
1604 if(aTextDirectionLB.GetSelectEntryPos() != aTextDirectionLB.GetSavedValue())
1606 bModified |= 0 != rSet.Put(
1607 SvxFrameDirectionItem(
1608 (SvxFrameDirection)(ULONG)aTextDirectionLB.GetEntryData(aTextDirectionLB.GetSelectEntryPos())
1609 , FN_TABLE_BOX_TEXTDIRECTION));
1612 if(aVertOrientLB.GetSelectEntryPos() != aVertOrientLB.GetSavedValue())
1614 USHORT nOrient = USHRT_MAX;
1615 switch(aVertOrientLB.GetSelectEntryPos())
1617 case 0 : nOrient = text::VertOrientation::NONE; break;
1618 case 1 : nOrient = text::VertOrientation::CENTER; break;
1619 case 2 : nOrient = text::VertOrientation::BOTTOM; break;
1621 if(nOrient != USHRT_MAX)
1622 bModified |= 0 != rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
1625 return bModified;
1629 /*-----------------12.12.96 12.22-------------------
1630 --------------------------------------------------*/
1631 void SwTextFlowPage::Reset( const SfxItemSet& rSet )
1633 const SfxPoolItem* pItem;
1634 SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
1635 BOOL bFlowAllowed = !bHtmlMode || pHtmlOpt->IsPrintLayoutExtension();
1636 if(bFlowAllowed)
1638 // Einfuegen der vorhandenen Seitenvorlagen in die Listbox
1639 const USHORT nCount = pShell->GetPageDescCnt();
1640 USHORT i;
1642 for( i = 0; i < nCount; ++i)
1644 const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
1645 aPageCollLB.InsertEntry(rPageDesc.GetName());
1648 String aFmtName;
1649 for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i)
1650 if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos(
1651 aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) ))
1652 aPageCollLB.InsertEntry( aFmtName );
1654 if(SFX_ITEM_SET == rSet.GetItemState( RES_KEEP, FALSE, &pItem ))
1656 aKeepCB.Check( ((const SvxFmtKeepItem*)pItem)->GetValue() );
1657 aKeepCB.SaveValue();
1659 if(SFX_ITEM_SET == rSet.GetItemState( RES_LAYOUT_SPLIT, FALSE, &pItem ))
1661 aSplitCB.Check( ((const SwFmtLayoutSplit*)pItem)->GetValue() );
1663 else
1664 aSplitCB.Check();
1666 aSplitCB.SaveValue();
1667 SplitHdl_Impl(&aSplitCB);
1669 if(SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, FALSE, &pItem ))
1671 aSplitRowCB.Check( ((const SwFmtRowSplit*)pItem)->GetValue() );
1673 else
1674 aSplitRowCB.SetState(STATE_DONTKNOW);
1675 aSplitRowCB.SaveValue();
1677 if(bPageBreak)
1679 if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, FALSE, &pItem ))
1681 String sPageDesc;
1682 const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
1683 aPageNoNF.SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset());
1684 if(pDesc)
1685 sPageDesc = pDesc->GetName();
1686 if ( sPageDesc.Len() &&
1687 aPageCollLB.GetEntryPos( sPageDesc ) != LISTBOX_ENTRY_NOTFOUND )
1689 aPageCollLB.SelectEntry( sPageDesc );
1690 aPageCollCB.Check();
1692 aPgBrkCB.Enable();
1693 aPgBrkRB.Enable();
1694 aColBrkRB.Enable();
1695 aPgBrkBeforeRB.Enable();
1696 aPgBrkAfterRB.Enable();
1697 aPageCollCB.Enable();
1698 aPgBrkCB.Check();
1700 aPgBrkCB.Check( TRUE );
1701 aColBrkRB.Check( FALSE );
1702 aPgBrkBeforeRB.Check( TRUE );
1703 aPgBrkAfterRB.Check( FALSE );
1705 else
1707 aPageCollLB.SetNoSelection();
1708 aPageCollCB.Check(FALSE);
1712 if(SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, FALSE, &pItem ))
1714 const SvxFmtBreakItem* pPageBreak = (const SvxFmtBreakItem*)pItem;
1715 SvxBreak eBreak = (SvxBreak)pPageBreak->GetValue();
1717 if ( eBreak != SVX_BREAK_NONE )
1719 aPgBrkCB.Check();
1720 aPageCollCB.Enable(FALSE);
1721 aPageCollLB.Enable(FALSE);
1722 aPageNoFT.Enable(FALSE);
1723 aPageNoNF.Enable(FALSE);
1725 switch ( eBreak )
1727 case SVX_BREAK_PAGE_BEFORE:
1728 aPgBrkRB.Check( TRUE );
1729 aColBrkRB.Check( FALSE );
1730 aPgBrkBeforeRB.Check( TRUE );
1731 aPgBrkAfterRB.Check( FALSE );
1732 break;
1733 case SVX_BREAK_PAGE_AFTER:
1734 aPgBrkRB.Check( TRUE );
1735 aColBrkRB.Check( FALSE );
1736 aPgBrkBeforeRB.Check( FALSE );
1737 aPgBrkAfterRB.Check( TRUE );
1738 break;
1739 case SVX_BREAK_COLUMN_BEFORE:
1740 aPgBrkRB.Check( FALSE );
1741 aColBrkRB.Check( TRUE );
1742 aPgBrkBeforeRB.Check( TRUE );
1743 aPgBrkAfterRB.Check( FALSE );
1744 break;
1745 case SVX_BREAK_COLUMN_AFTER:
1746 aPgBrkRB.Check( FALSE );
1747 aColBrkRB.Check( TRUE );
1748 aPgBrkBeforeRB.Check( FALSE );
1749 aPgBrkAfterRB.Check( TRUE );
1750 break;
1751 default:; //prevent warning
1755 if ( aPgBrkBeforeRB.IsChecked() )
1756 PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
1757 else if ( aPgBrkAfterRB.IsChecked() )
1758 PageBreakPosHdl_Impl( &aPgBrkAfterRB );
1759 PageBreakHdl_Impl( &aPgBrkCB );
1762 else
1764 aPgBrkRB.Enable(FALSE);
1765 aColBrkRB.Enable(FALSE);
1766 aPgBrkBeforeRB.Enable(FALSE);
1767 aPgBrkAfterRB.Enable(FALSE);
1768 aKeepCB .Enable(FALSE);
1769 aSplitCB.Enable(FALSE);
1770 aPgBrkCB.Enable(FALSE);
1771 aPageCollCB.Enable(FALSE);
1772 aPageCollLB.Enable(FALSE);
1775 if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, FALSE, &pItem ))
1777 USHORT nRep = ((const SfxUInt16Item*)pItem)->GetValue();
1778 aHeadLineCB.Check( nRep > 0 );
1779 aHeadLineCB.SaveValue();
1780 aRepeatHeaderNF.SetValue( nRep );
1781 aRepeatHeaderNF.SaveValue();
1783 if ( rSet.GetItemState(FN_TABLE_BOX_TEXTDIRECTION) > SFX_ITEM_AVAILABLE )
1785 ULONG nDirection = ((const SvxFrameDirectionItem&)rSet.Get(FN_TABLE_BOX_TEXTDIRECTION)).GetValue();
1786 aTextDirectionLB.SelectEntryPos(aTextDirectionLB.GetEntryPos( (const void*)nDirection ));
1789 if ( rSet.GetItemState(FN_TABLE_SET_VERT_ALIGN) > SFX_ITEM_AVAILABLE )
1791 USHORT nVert = ((const SfxUInt16Item&)rSet.Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
1792 USHORT nPos = 0;
1793 switch(nVert)
1795 case text::VertOrientation::NONE: nPos = 0; break;
1796 case text::VertOrientation::CENTER: nPos = 1; break;
1797 case text::VertOrientation::BOTTOM: nPos = 2; break;
1799 aVertOrientLB.SelectEntryPos(nPos);
1802 aPageCollCB.SaveValue();
1803 aPageCollLB.SaveValue();
1804 aPgBrkCB.SaveValue();
1805 aPgBrkRB.SaveValue();
1806 aColBrkRB.SaveValue();
1807 aPgBrkBeforeRB.SaveValue();
1808 aPgBrkAfterRB.SaveValue();
1809 aPageNoNF.SaveValue();
1810 aTextDirectionLB.SaveValue();
1811 aVertOrientLB.SaveValue();
1813 HeadLineCBClickHdl();
1815 /*-----------------16.04.98 14:48-------------------
1817 --------------------------------------------------*/
1819 void SwTextFlowPage::SetShell(SwWrtShell* pSh)
1821 pShell = pSh;
1822 bHtmlMode = 0 != (::GetHtmlMode(pShell->GetView().GetDocShell()) & HTMLMODE_ON);
1823 if(bHtmlMode)
1825 aPageNoNF.Enable(FALSE);
1826 aPageNoFT.Enable(FALSE);
1830 /*-----------------12.12.96 16.18-------------------
1831 --------------------------------------------------*/
1832 IMPL_LINK( SwTextFlowPage, PageBreakHdl_Impl, CheckBox*, EMPTYARG )
1834 if( aPgBrkCB.IsChecked() )
1836 aPgBrkRB. Enable();
1837 aColBrkRB. Enable();
1838 aPgBrkBeforeRB. Enable();
1839 aPgBrkAfterRB. Enable();
1841 if ( aPgBrkRB.IsChecked() && aPgBrkBeforeRB.IsChecked() )
1843 aPageCollCB.Enable();
1845 BOOL bEnable = aPageCollCB.IsChecked() &&
1846 aPageCollLB.GetEntryCount();
1847 aPageCollLB.Enable(bEnable);
1848 if(!bHtmlMode)
1850 aPageNoFT.Enable(bEnable);
1851 aPageNoNF.Enable(bEnable);
1855 else
1857 aPageCollCB.Check( FALSE );
1858 aPageCollCB.Enable(FALSE);
1859 aPageCollLB.Enable(FALSE);
1860 aPageNoFT.Enable(FALSE);
1861 aPageNoNF.Enable(FALSE);
1862 aPgBrkRB. Enable(FALSE);
1863 aColBrkRB. Enable(FALSE);
1864 aPgBrkBeforeRB. Enable(FALSE);
1865 aPgBrkAfterRB. Enable(FALSE);
1867 return 0;
1870 /*-----------------12.12.96 16.18-------------------
1871 --------------------------------------------------*/
1872 IMPL_LINK( SwTextFlowPage, ApplyCollClickHdl_Impl, CheckBox*, EMPTYARG )
1874 BOOL bEnable = FALSE;
1875 if ( aPageCollCB.IsChecked() &&
1876 aPageCollLB.GetEntryCount() )
1878 bEnable = TRUE;
1879 aPageCollLB.SelectEntryPos( 0 );
1881 else
1883 aPageCollLB.SetNoSelection();
1885 aPageCollLB.Enable(bEnable);
1886 if(!bHtmlMode)
1888 aPageNoFT.Enable(bEnable);
1889 aPageNoNF.Enable(bEnable);
1891 return 0;
1894 /*-----------------12.12.96 16.18-------------------
1895 --------------------------------------------------*/
1896 IMPL_LINK( SwTextFlowPage, PageBreakPosHdl_Impl, RadioButton*, pBtn )
1898 if ( aPgBrkCB.IsChecked() )
1900 if ( pBtn == &aPgBrkBeforeRB && aPgBrkRB.IsChecked() )
1902 aPageCollCB.Enable();
1904 BOOL bEnable = aPageCollCB.IsChecked() &&
1905 aPageCollLB.GetEntryCount();
1907 aPageCollLB.Enable(bEnable);
1908 if(!bHtmlMode)
1910 aPageNoFT.Enable(bEnable);
1911 aPageNoNF.Enable(bEnable);
1914 else if ( pBtn == &aPgBrkAfterRB )
1916 aPageCollCB .Check( FALSE );
1917 aPageCollCB .Enable(FALSE);
1918 aPageCollLB .Enable(FALSE);
1919 aPageNoFT .Enable(FALSE);
1920 aPageNoNF .Enable(FALSE);
1923 return 0;
1926 /*-----------------12.12.96 16.18-------------------
1927 --------------------------------------------------*/
1928 IMPL_LINK( SwTextFlowPage, PageBreakTypeHdl_Impl, RadioButton*, pBtn )
1930 if ( pBtn == &aColBrkRB || aPgBrkAfterRB.IsChecked() )
1932 aPageCollCB .Check(FALSE);
1933 aPageCollCB .Enable(FALSE);
1934 aPageCollLB .Enable(FALSE);
1935 aPageNoFT .Enable(FALSE);
1936 aPageNoNF .Enable(FALSE);
1938 else if ( aPgBrkBeforeRB.IsChecked() )
1939 PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
1940 return 0;
1942 /*-----------------17.11.2003 11:30-----------------
1944 * --------------------------------------------------*/
1945 IMPL_LINK( SwTextFlowPage, SplitHdl_Impl, CheckBox*, pBox )
1947 aSplitRowCB.Enable(pBox->IsChecked());
1948 return 0;
1950 /*-----------------17.11.2003 11:30-----------------
1952 * --------------------------------------------------*/
1953 IMPL_LINK( SwTextFlowPage, SplitRowHdl_Impl, TriStateBox*, pBox )
1955 pBox->EnableTriState(FALSE);
1956 return 0;
1959 IMPL_LINK( SwTextFlowPage, HeadLineCBClickHdl, void*, EMPTYARG )
1961 aRepeatHeaderCombo.Enable(aHeadLineCB.IsChecked());
1963 return 0;
1966 /*-----------------30.05.97 07:37-------------------
1968 --------------------------------------------------*/
1969 void SwTextFlowPage::DisablePageBreak()
1971 bPageBreak = FALSE;
1972 aPgBrkCB .Disable();
1973 aPgBrkRB .Disable();
1974 aColBrkRB .Disable();
1975 aPgBrkBeforeRB .Disable();
1976 aPgBrkAfterRB .Disable();
1977 aPageCollCB .Disable();
1978 aPageCollLB .Disable();
1979 aPageNoFT .Disable();
1980 aPageNoNF .Disable();