xref: /aoo41x/main/sw/source/ui/table/tabledlg.cxx (revision 4d7c9de0)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <hintids.hxx>
33cdf0e10cSrcweir #include <tools/list.hxx>
34cdf0e10cSrcweir #include <vcl/msgbox.hxx>
35cdf0e10cSrcweir #include <svl/stritem.hxx>
36cdf0e10cSrcweir #include <svl/intitem.hxx>
37cdf0e10cSrcweir #include <svx/htmlmode.hxx>
38cdf0e10cSrcweir #include <editeng/keepitem.hxx>
39cdf0e10cSrcweir #include <editeng/brkitem.hxx>
40cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
41cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
42cdf0e10cSrcweir #include <svl/ctloptions.hxx>
43cdf0e10cSrcweir #include <swmodule.hxx>
44cdf0e10cSrcweir #include <fmtornt.hxx>
45cdf0e10cSrcweir #include <fmtpdsc.hxx>
46cdf0e10cSrcweir #include <fmtlsplt.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <svtools/htmlcfg.hxx>
49cdf0e10cSrcweir #include <fmtrowsplt.hxx>
50cdf0e10cSrcweir #include <svx/htmlmode.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #include "access.hrc"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #ifndef _DOCSH_HXX
55cdf0e10cSrcweir #include <docsh.hxx>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir #include <wrtsh.hxx>
58cdf0e10cSrcweir #ifndef _VIEW_HXX
59cdf0e10cSrcweir #include <view.hxx>
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir #include <viewopt.hxx>
62cdf0e10cSrcweir #include <uitool.hxx>
63cdf0e10cSrcweir #include <frmatr.hxx>
64cdf0e10cSrcweir #include <tabledlg.hxx>
65cdf0e10cSrcweir #ifndef _TABLEPG_HXX
66cdf0e10cSrcweir #include <tablepg.hxx>
67cdf0e10cSrcweir #endif
68cdf0e10cSrcweir #include <tablemgr.hxx>
69cdf0e10cSrcweir #include <pagedesc.hxx>
70cdf0e10cSrcweir #include <uiitems.hxx>
71cdf0e10cSrcweir #include <poolfmt.hxx>
72cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #ifndef _CMDID_H
75cdf0e10cSrcweir #include <cmdid.h>
76cdf0e10cSrcweir #endif
77cdf0e10cSrcweir #ifndef _TABLEDLG_HRC
78cdf0e10cSrcweir #include <tabledlg.hrc>
79cdf0e10cSrcweir #endif
80cdf0e10cSrcweir #ifndef _TABLE_HRC
81cdf0e10cSrcweir #include <table.hrc>
82cdf0e10cSrcweir #endif
83cdf0e10cSrcweir #include <svx/svxids.hrc>
84cdf0e10cSrcweir #include <svx/dialogs.hrc>
85cdf0e10cSrcweir #include <svx/flagsdef.hxx>
86cdf0e10cSrcweir #include <svx/svxdlg.hxx>
87cdf0e10cSrcweir 
88cdf0e10cSrcweir using namespace ::com::sun::star;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #ifdef DEBUG_TBLDLG
DbgTblRep(SwTableRep * pRep)92cdf0e10cSrcweir void DbgTblRep(SwTableRep* pRep)
93cdf0e10cSrcweir {
94cdf0e10cSrcweir 	DBG_ERROR(String(pRep->GetColCount()))
95cdf0e10cSrcweir 	DBG_ERROR(String(pRep->GetAllColCount()))
96cdf0e10cSrcweir 	SwTwips nSum = 0;
97cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < pRep->GetAllColCount(); i++)
98cdf0e10cSrcweir 	{
99cdf0e10cSrcweir 		String sMsg(i);
100cdf0e10cSrcweir 		sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h ";
101cdf0e10cSrcweir 		sMsg += pRep->GetColumns()[i].nWidth;
102cdf0e10cSrcweir 		nSum +=pRep->GetColumns()[i].nWidth;
103cdf0e10cSrcweir 		DBG_ERROR(sMsg)
104cdf0e10cSrcweir 	}
105cdf0e10cSrcweir 	String sMsg("Spaltensumme: ");
106cdf0e10cSrcweir 	sMsg += nSum;
107cdf0e10cSrcweir 	sMsg += " Tblbreite: ";
108cdf0e10cSrcweir 	sMsg += pRep->GetWidth();
109cdf0e10cSrcweir 	DBG_ERROR(sMsg)
110cdf0e10cSrcweir 	sMsg = "Gesamt/Links/Rechts: ";
111cdf0e10cSrcweir 	sMsg += pRep->GetSpace();
112cdf0e10cSrcweir 	sMsg += '/';
113cdf0e10cSrcweir 	sMsg += pRep->GetLeftSpace();
114cdf0e10cSrcweir 	sMsg += '/';
115cdf0e10cSrcweir 	sMsg += pRep->GetRightSpace();
116cdf0e10cSrcweir 	DBG_ERROR(sMsg)
117cdf0e10cSrcweir 	sMsg = "Align: ";
118cdf0e10cSrcweir 	sMsg += pRep->GetAlign();
119cdf0e10cSrcweir 	DBG_ERROR(sMsg)
120cdf0e10cSrcweir 
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir #endif
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
SwFormatTablePage(Window * pParent,const SfxItemSet & rSet)126cdf0e10cSrcweir SwFormatTablePage::SwFormatTablePage( Window* pParent, const SfxItemSet& rSet ) :
127cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES( TP_FORMAT_TABLE ), rSet ),
128cdf0e10cSrcweir     aOptionsFL(this,    SW_RES( FL_OPTIONS )),
129cdf0e10cSrcweir 	aNameFT(this,		SW_RES( FT_NAME )),
130cdf0e10cSrcweir 	aNameED(this,		SW_RES( ED_NAME )),
131cdf0e10cSrcweir 	aWidthFT(this,		SW_RES( FT_WIDTH )),
132cdf0e10cSrcweir 	aWidthMF(this,		SW_RES( ED_WIDTH )),
133cdf0e10cSrcweir 	aRelWidthCB(this, 	SW_RES( CB_REL_WIDTH )),
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     aPosFL(this,       SW_RES( FL_POS )),
136cdf0e10cSrcweir     aFullBtn(this,      SW_RES( RB_FULL )),
137cdf0e10cSrcweir     aLeftBtn(this,      SW_RES( RB_LEFT )),
138cdf0e10cSrcweir     aFromLeftBtn(this,  SW_RES( RB_FROM_LEFT )),
139cdf0e10cSrcweir     aRightBtn(this,     SW_RES( RB_RIGHT )),
140cdf0e10cSrcweir     aCenterBtn(this,    SW_RES( RB_CENTER )),
141cdf0e10cSrcweir     aFreeBtn(this,      SW_RES( RB_FREE )),
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     aDistFL(this,       SW_RES( FL_DIST )),
144cdf0e10cSrcweir     aLeftFT(this,       SW_RES( FT_LEFT_DIST )),
145cdf0e10cSrcweir 	aLeftMF(this,		SW_RES( ED_LEFT_DIST )),
146cdf0e10cSrcweir 	aRightFT(this,		SW_RES( FT_RIGHT_DIST )),
147cdf0e10cSrcweir 	aRightMF(this,		SW_RES( ED_RIGHT_DIST )),
148cdf0e10cSrcweir 	aTopFT (this,		SW_RES( FT_TOP_DIST )),
149cdf0e10cSrcweir 	aTopMF(this,		SW_RES( ED_TOP_DIST )),
150cdf0e10cSrcweir 	aBottomFT(this,		SW_RES( FT_BOTTOM_DIST )),
151cdf0e10cSrcweir 	aBottomMF(this,		SW_RES( ED_BOTTOM_DIST )),
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     aPropertiesFL(this,     SW_RES( FL_PROPERTIES    )),
154cdf0e10cSrcweir     aTextDirectionFT(this,  SW_RES( FT_TEXTDIRECTION )),
155cdf0e10cSrcweir     aTextDirectionLB(this,  SW_RES( LB_TEXTDIRECTION )),
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     pTblData(0),
158cdf0e10cSrcweir 	nSaveWidth(0),
159cdf0e10cSrcweir 	nMinTableWidth(MINLAY),
160cdf0e10cSrcweir 	bModified(sal_False),
161cdf0e10cSrcweir     bFull(0),
162cdf0e10cSrcweir     bHtmlMode(sal_False)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	FreeResource();
165cdf0e10cSrcweir 	SetExchangeSupport();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     const SfxPoolItem* pItem;
168cdf0e10cSrcweir     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem))
169cdf0e10cSrcweir         bHtmlMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     sal_Bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled();
172cdf0e10cSrcweir     if( !bHtmlMode && bCTL )
173cdf0e10cSrcweir     {
174cdf0e10cSrcweir         aPropertiesFL.Show();
175cdf0e10cSrcweir         aTextDirectionFT.Show();
176cdf0e10cSrcweir         aTextDirectionLB.Show();
177cdf0e10cSrcweir     }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     Init();
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir /*------------------------------------------------------------------------
183cdf0e10cSrcweir ------------------------------------------------------------------------*/
Init()184cdf0e10cSrcweir void  SwFormatTablePage::Init()
185cdf0e10cSrcweir {
186cdf0e10cSrcweir 	aLeftMF.MetricField::SetMin(-999999);
187cdf0e10cSrcweir 	aRightMF.MetricField::SetMin(-999999);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	// handler
190cdf0e10cSrcweir 	Link aLk = LINK( this, SwFormatTablePage, AutoClickHdl );
191cdf0e10cSrcweir 	aFullBtn.SetClickHdl( aLk );
192cdf0e10cSrcweir 	aFreeBtn.SetClickHdl( aLk );
193cdf0e10cSrcweir 	aLeftBtn.SetClickHdl( aLk );
194cdf0e10cSrcweir 	aFromLeftBtn.SetClickHdl( aLk );
195cdf0e10cSrcweir 	aRightBtn.SetClickHdl( aLk );
196cdf0e10cSrcweir 	aCenterBtn.SetClickHdl( aLk );
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     aLk = LINK( this, SwFormatTablePage, UpDownLoseFocusHdl );
199cdf0e10cSrcweir 	aTopMF.SetUpHdl( aLk );
200cdf0e10cSrcweir 	aBottomMF.SetUpHdl( aLk );
201cdf0e10cSrcweir 	aRightMF.SetUpHdl( aLk );
202cdf0e10cSrcweir 	aLeftMF.SetUpHdl( aLk );
203cdf0e10cSrcweir 	aWidthMF.SetUpHdl( aLk );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     aTopMF.SetDownHdl( aLk );
206cdf0e10cSrcweir 	aBottomMF.SetDownHdl( aLk );
207cdf0e10cSrcweir 	aRightMF.SetDownHdl( aLk );
208cdf0e10cSrcweir 	aLeftMF.SetDownHdl( aLk );
209cdf0e10cSrcweir 	aWidthMF.SetDownHdl( aLk );
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 	aTopMF.SetLoseFocusHdl( aLk );
212cdf0e10cSrcweir 	aBottomMF.SetLoseFocusHdl( aLk );
213cdf0e10cSrcweir 	aRightMF.SetLoseFocusHdl( aLk );
214cdf0e10cSrcweir 	aLeftMF.SetLoseFocusHdl( aLk );
215cdf0e10cSrcweir 	aWidthMF.SetLoseFocusHdl( aLk );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	aRelWidthCB.SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir /*------------------------------------------------------------------------*/
221cdf0e10cSrcweir 
IMPL_LINK(SwFormatTablePage,RelWidthClickHdl,CheckBox *,pBtn)222cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir 	DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
225cdf0e10cSrcweir 	sal_Bool bIsChecked = pBtn->IsChecked();
226cdf0e10cSrcweir     sal_Int64 nLeft  = aLeftMF.DenormalizePercent(aLeftMF.GetValue(FUNIT_TWIP ));
227cdf0e10cSrcweir     sal_Int64 nRight = aRightMF.DenormalizePercent(aRightMF.GetValue(FUNIT_TWIP ));
228cdf0e10cSrcweir 	aWidthMF.ShowPercent(bIsChecked);
229cdf0e10cSrcweir 	aLeftMF.ShowPercent(bIsChecked);
230cdf0e10cSrcweir 	aRightMF.ShowPercent(bIsChecked);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	if (bIsChecked)
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir 		aWidthMF.SetRefValue(pTblData->GetSpace());
235cdf0e10cSrcweir 		aLeftMF.SetRefValue(pTblData->GetSpace());
236cdf0e10cSrcweir 		aRightMF.SetRefValue(pTblData->GetSpace());
237cdf0e10cSrcweir 		aLeftMF.MetricField::SetMin(0); // wird vom Percentfield ueberschrieben
238cdf0e10cSrcweir 		aRightMF.MetricField::SetMin(0);//                 -""-
239cdf0e10cSrcweir         aLeftMF.MetricField::SetMax(99); //
240cdf0e10cSrcweir         aRightMF.MetricField::SetMax(99);//
241cdf0e10cSrcweir         aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(nLeft ), FUNIT_TWIP );
242cdf0e10cSrcweir         aRightMF.SetPrcntValue(aRightMF.NormalizePercent(nRight ), FUNIT_TWIP );
243cdf0e10cSrcweir 	}
244cdf0e10cSrcweir 	else
245cdf0e10cSrcweir 		ModifyHdl(&aLeftMF);	// Werte wieder korrigieren
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	if(aFreeBtn.IsChecked())
248cdf0e10cSrcweir 	{
249cdf0e10cSrcweir 		sal_Bool bEnable = !pBtn->IsChecked();
250cdf0e10cSrcweir 		aRightMF.Enable(bEnable);
251cdf0e10cSrcweir 		aRightFT.Enable(bEnable);
252cdf0e10cSrcweir 	}
253cdf0e10cSrcweir 	bModified = sal_True;
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 	return 0;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir /*------------------------------------------------------------------------
259cdf0e10cSrcweir ------------------------------------------------------------------------*/
IMPL_LINK(SwFormatTablePage,AutoClickHdl,CheckBox *,pBox)260cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox )
261cdf0e10cSrcweir {
262cdf0e10cSrcweir 	sal_Bool bRestore = sal_True,
263cdf0e10cSrcweir 		 bLeftEnable = sal_False,
264cdf0e10cSrcweir 		 bRightEnable= sal_False,
265cdf0e10cSrcweir 		 bWidthEnable= sal_False,
266cdf0e10cSrcweir 		 bOthers = sal_True;
267cdf0e10cSrcweir 	if( (RadioButton *) pBox == &aFullBtn )
268cdf0e10cSrcweir 	{
269cdf0e10cSrcweir         aLeftMF.SetPrcntValue(0);
270cdf0e10cSrcweir         aRightMF.SetPrcntValue(0);
271cdf0e10cSrcweir         nSaveWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )));
272cdf0e10cSrcweir         aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(pTblData->GetSpace() ), FUNIT_TWIP );
273cdf0e10cSrcweir 		bFull = sal_True;
274cdf0e10cSrcweir 		bRestore = sal_False;
275cdf0e10cSrcweir 	}
276cdf0e10cSrcweir 	else if( (RadioButton *) pBox == &aLeftBtn )
277cdf0e10cSrcweir 	{
278cdf0e10cSrcweir 		bRightEnable = bWidthEnable = sal_True;
279cdf0e10cSrcweir         aLeftMF.SetPrcntValue(0);
280cdf0e10cSrcweir 	}
281cdf0e10cSrcweir 	else if( (RadioButton *) pBox == &aFromLeftBtn )
282cdf0e10cSrcweir 	{
283cdf0e10cSrcweir 		bLeftEnable = bWidthEnable = sal_True;
284cdf0e10cSrcweir         aRightMF.SetPrcntValue(0);
285cdf0e10cSrcweir 	}
286cdf0e10cSrcweir 	else if( (RadioButton *) pBox == &aRightBtn )
287cdf0e10cSrcweir 	{
288cdf0e10cSrcweir 		bLeftEnable = bWidthEnable = sal_True;
289cdf0e10cSrcweir         aRightMF.SetPrcntValue(0);
290cdf0e10cSrcweir 	}
291cdf0e10cSrcweir 	else if( ( RadioButton * ) pBox == &aCenterBtn )
292cdf0e10cSrcweir 	{
293cdf0e10cSrcweir 		bLeftEnable = bWidthEnable = sal_True;
294cdf0e10cSrcweir 	}
295cdf0e10cSrcweir 	else if( ( RadioButton * ) pBox == &aFreeBtn )
296cdf0e10cSrcweir 	{
297cdf0e10cSrcweir 		RightModifyHdl(&aRightMF);
298cdf0e10cSrcweir 		bLeftEnable = sal_True;
299cdf0e10cSrcweir 		bWidthEnable = sal_True;
300cdf0e10cSrcweir 		bOthers = sal_False;
301cdf0e10cSrcweir 	}
302cdf0e10cSrcweir 	aLeftMF.Enable(bLeftEnable);
303cdf0e10cSrcweir 	aLeftFT.Enable(bLeftEnable);
304cdf0e10cSrcweir 	aWidthMF.Enable(bWidthEnable);
305cdf0e10cSrcweir 	aWidthFT.Enable(bWidthEnable);
306cdf0e10cSrcweir 	if ( bOthers )
307cdf0e10cSrcweir 	{
308cdf0e10cSrcweir 		aRightMF.Enable(bRightEnable);
309cdf0e10cSrcweir 		aRightFT.Enable(bRightEnable);
310cdf0e10cSrcweir 		aRelWidthCB.Enable(bWidthEnable);
311cdf0e10cSrcweir 	}
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	if(bFull && bRestore)
314cdf0e10cSrcweir 	{
315cdf0e10cSrcweir 		// nachdem auf autom. geschaltet wurde, wurde die Breite gemerkt,
316cdf0e10cSrcweir 		// um sie beim Zurueckschalten restaurieren zu koennen
317cdf0e10cSrcweir 		bFull = sal_False;
318cdf0e10cSrcweir         aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(nSaveWidth ), FUNIT_TWIP );
319cdf0e10cSrcweir 	}
320cdf0e10cSrcweir 	ModifyHdl(&aWidthMF);
321cdf0e10cSrcweir 	bModified = sal_True;
322cdf0e10cSrcweir 	return 0;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir /*----------------------------------------------------------------------*/
IMPL_LINK(SwFormatTablePage,RightModifyHdl,MetricField *,EMPTYARG)326cdf0e10cSrcweir IMPL_LINK( SwFormatTablePage, RightModifyHdl, MetricField *, EMPTYARG )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir 	if(aFreeBtn.IsChecked())
329cdf0e10cSrcweir 	{
330cdf0e10cSrcweir 		sal_Bool bEnable = aRightMF.GetValue() == 0;
331cdf0e10cSrcweir //		aWidthMF.Enable(bEnable);
332cdf0e10cSrcweir 		aRelWidthCB.Enable(bEnable);
333cdf0e10cSrcweir //		aWidthFT.Enable(bEnable);
334cdf0e10cSrcweir 		if ( !bEnable )
335cdf0e10cSrcweir 		{
336cdf0e10cSrcweir 			aRelWidthCB.Check(sal_False);
337cdf0e10cSrcweir 			RelWidthClickHdl(&aRelWidthCB);
338cdf0e10cSrcweir 		}
339cdf0e10cSrcweir 		bEnable = aRelWidthCB.IsChecked();
340cdf0e10cSrcweir 		aRightMF.Enable(!bEnable);
341cdf0e10cSrcweir 		aRightFT.Enable(!bEnable);
342cdf0e10cSrcweir 	}
343cdf0e10cSrcweir 	return 0;
344cdf0e10cSrcweir }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir /*------------------------------------------------------------------------
347cdf0e10cSrcweir ------------------------------------------------------------------------*/
IMPL_LINK_INLINE_START(SwFormatTablePage,UpDownLoseFocusHdl,MetricField *,pEdit)348cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir     if( &aRightMF == pEdit)
351cdf0e10cSrcweir         RightModifyHdl(pEdit);
352cdf0e10cSrcweir     ModifyHdl( pEdit );
353cdf0e10cSrcweir 	return 0;
354cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SwFormatTablePage,UpDownLoseFocusHdl,MetricField *,pEdit)355cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
356cdf0e10cSrcweir 
357cdf0e10cSrcweir void  SwFormatTablePage::ModifyHdl( Edit* pEdit )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     SwTwips nCurWidth  = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
361cdf0e10cSrcweir 	SwTwips nPrevWidth = nCurWidth;
362cdf0e10cSrcweir     SwTwips nRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
363cdf0e10cSrcweir     SwTwips nLeft  = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
364cdf0e10cSrcweir 	SwTwips nDiff;
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	if( pEdit == &aWidthMF )
367cdf0e10cSrcweir 	{
368cdf0e10cSrcweir 		if( nCurWidth < MINLAY )
369cdf0e10cSrcweir 			nCurWidth = MINLAY;
370cdf0e10cSrcweir 		nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
371cdf0e10cSrcweir 		//rechtsbuendig nur linken Rand veraendern
372cdf0e10cSrcweir 		if(aRightBtn.IsChecked())
373cdf0e10cSrcweir 			nLeft -= nDiff;
374cdf0e10cSrcweir 		//linksbuendig nur rechten Rand veraendern
375cdf0e10cSrcweir 		else if(aLeftBtn.IsChecked())
376cdf0e10cSrcweir 			nRight -= nDiff;
377cdf0e10cSrcweir 		//linker Rand und Breite erlaubt - erst rechts - dann links
378cdf0e10cSrcweir 		else if(aFromLeftBtn.IsChecked())
379cdf0e10cSrcweir 		{
380cdf0e10cSrcweir 			if( nRight >= nDiff )
381cdf0e10cSrcweir 				nRight -= nDiff;
382cdf0e10cSrcweir 			else
383cdf0e10cSrcweir 			{
384cdf0e10cSrcweir 				nDiff -= nRight;
385cdf0e10cSrcweir 				nRight = 0;
386cdf0e10cSrcweir 				if(nLeft >= nDiff)
387cdf0e10cSrcweir 					nLeft -= nDiff;
388cdf0e10cSrcweir 				else
389cdf0e10cSrcweir 				{
390cdf0e10cSrcweir 					nRight += nLeft - nDiff;
391cdf0e10cSrcweir 					nLeft = 0;
392cdf0e10cSrcweir 					nCurWidth = pTblData->GetSpace();
393cdf0e10cSrcweir 				}
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 			}
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 		//zentriert beide Seiten gleichmaessig veraendern
398cdf0e10cSrcweir 		else if(aCenterBtn.IsChecked())
399cdf0e10cSrcweir 		{
400cdf0e10cSrcweir 			if((nLeft != nRight))
401cdf0e10cSrcweir 			{
402cdf0e10cSrcweir 				nDiff += nLeft + nRight;
403cdf0e10cSrcweir 				nLeft = nDiff/2;
404cdf0e10cSrcweir 				nRight = nDiff/2;
405cdf0e10cSrcweir 			}
406cdf0e10cSrcweir 			else
407cdf0e10cSrcweir 			{
408cdf0e10cSrcweir 					nLeft -= nDiff/2;
409cdf0e10cSrcweir 					nRight -= nDiff/2;
410cdf0e10cSrcweir 			}
411cdf0e10cSrcweir 		}
412cdf0e10cSrcweir 		//freie Ausrichtung: beide Raender verkleinern
413cdf0e10cSrcweir 		else if(aFreeBtn.IsChecked())
414cdf0e10cSrcweir 		{
415cdf0e10cSrcweir 			nLeft -= nDiff/2;
416cdf0e10cSrcweir 			nRight -= nDiff/2;
417cdf0e10cSrcweir 		}
418cdf0e10cSrcweir 	}
419cdf0e10cSrcweir 	if( pEdit == &aRightMF	)
420cdf0e10cSrcweir 	{
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 		if( nRight + nLeft > pTblData->GetSpace() - MINLAY )
423cdf0e10cSrcweir 			nRight = pTblData->GetSpace() -nLeft - MINLAY;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 		nCurWidth = pTblData->GetSpace() - nLeft - nRight;
426cdf0e10cSrcweir 	}
427cdf0e10cSrcweir 	if( pEdit == &aLeftMF )
428cdf0e10cSrcweir 	{
429cdf0e10cSrcweir 		if(!aFromLeftBtn.IsChecked())
430cdf0e10cSrcweir 		{
431cdf0e10cSrcweir 			sal_Bool bCenter = aCenterBtn.IsChecked();
432cdf0e10cSrcweir 			if( bCenter )
433cdf0e10cSrcweir 				nRight = nLeft;
434cdf0e10cSrcweir 			if(nRight + nLeft > pTblData->GetSpace() - MINLAY )
435cdf0e10cSrcweir 			{
436cdf0e10cSrcweir 				nLeft  = bCenter ? 	(pTblData->GetSpace() - MINLAY) /2 :
437cdf0e10cSrcweir 									(pTblData->GetSpace() - MINLAY) - nRight;
438cdf0e10cSrcweir 				nRight = bCenter ? 	(pTblData->GetSpace() - MINLAY) /2 : nRight;
439cdf0e10cSrcweir 			}
440cdf0e10cSrcweir 			nCurWidth = pTblData->GetSpace() - nLeft - nRight;
441cdf0e10cSrcweir 		}
442cdf0e10cSrcweir 		else
443cdf0e10cSrcweir 		{
444cdf0e10cSrcweir 			//hier wird bei Aenderung an der linken Seite zuerst der
445cdf0e10cSrcweir 			//rechte Rand veraendert, dann die Breite
446cdf0e10cSrcweir 			nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 			nRight -= nDiff;
449cdf0e10cSrcweir 			nCurWidth = pTblData->GetSpace() - nLeft - nRight;
450cdf0e10cSrcweir 		}
451cdf0e10cSrcweir 	}
452cdf0e10cSrcweir 	if (nCurWidth != nPrevWidth )
453cdf0e10cSrcweir         aWidthMF.SetPrcntValue( aWidthMF.NormalizePercent( nCurWidth ), FUNIT_TWIP );
454cdf0e10cSrcweir     aRightMF.SetPrcntValue( aRightMF.NormalizePercent( nRight ), FUNIT_TWIP );
455cdf0e10cSrcweir     aLeftMF.SetPrcntValue( aLeftMF.NormalizePercent( nLeft ), FUNIT_TWIP );
456cdf0e10cSrcweir 	bModified = sal_True;
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir /*------------------------------------------------------------------------
460cdf0e10cSrcweir ------------------------------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rAttrSet)461cdf0e10cSrcweir SfxTabPage*  SwFormatTablePage::Create( Window* pParent,
462cdf0e10cSrcweir 								   const SfxItemSet& rAttrSet)
463cdf0e10cSrcweir {
464cdf0e10cSrcweir 	return new SwFormatTablePage( pParent, rAttrSet );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir /*------------------------------------------------------------------------
468cdf0e10cSrcweir -------------------------------------------------------------------------*/
FillItemSet(SfxItemSet & rCoreSet)469cdf0e10cSrcweir sal_Bool  SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
470cdf0e10cSrcweir {
471cdf0e10cSrcweir 	// Testen, ob eins der Control noch den Focus hat
472cdf0e10cSrcweir 	if(aWidthMF.HasFocus())
473cdf0e10cSrcweir 		ModifyHdl(&aWidthMF);
474cdf0e10cSrcweir 	else if(aLeftMF.HasFocus())
475cdf0e10cSrcweir 		ModifyHdl(&aLeftMF);
476cdf0e10cSrcweir 	else if(aRightMF.HasFocus())
477cdf0e10cSrcweir 		ModifyHdl(&aRightMF);
478cdf0e10cSrcweir 	else if(aTopMF.HasFocus())
479cdf0e10cSrcweir 		ModifyHdl(&aTopMF);
480cdf0e10cSrcweir 	else if(aBottomMF.HasFocus())
481cdf0e10cSrcweir 		ModifyHdl(&aBottomMF);
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 	if(bModified)
484cdf0e10cSrcweir 	{
485cdf0e10cSrcweir 		if( aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
486cdf0e10cSrcweir 									aTopMF.GetText() != aTopMF.GetSavedValue() )
487cdf0e10cSrcweir 		{
488cdf0e10cSrcweir 			SvxULSpaceItem aULSpace(RES_UL_SPACE);
489cdf0e10cSrcweir 			aULSpace.SetUpper( (sal_uInt16) aTopMF.Denormalize(
490cdf0e10cSrcweir 										aTopMF.GetValue( FUNIT_TWIP )));
491cdf0e10cSrcweir 			aULSpace.SetLower( (sal_uInt16) aBottomMF.Denormalize(
492cdf0e10cSrcweir 										aBottomMF.GetValue( FUNIT_TWIP )));
493cdf0e10cSrcweir 			rCoreSet.Put(aULSpace);
494cdf0e10cSrcweir 		}
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 	}
497cdf0e10cSrcweir 	if(aNameED.GetText() != aNameED.GetSavedValue())
498cdf0e10cSrcweir 	{
499cdf0e10cSrcweir 		rCoreSet.Put(SfxStringItem(	FN_PARAM_TABLE_NAME, aNameED.GetText()));
500cdf0e10cSrcweir 		bModified = sal_True;
501cdf0e10cSrcweir 	}
502cdf0e10cSrcweir 
503cdf0e10cSrcweir     sal_uInt16 nPos;
504cdf0e10cSrcweir     if( aTextDirectionLB.IsVisible() &&
505cdf0e10cSrcweir         ( nPos = aTextDirectionLB.GetSelectEntryPos() ) !=
506cdf0e10cSrcweir                                             aTextDirectionLB.GetSavedValue() )
507cdf0e10cSrcweir 	{
508cdf0e10cSrcweir         sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)aTextDirectionLB.GetEntryData( nPos );
509cdf0e10cSrcweir         rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
510cdf0e10cSrcweir 		bModified = sal_True;
511cdf0e10cSrcweir 	}
512cdf0e10cSrcweir 
513cdf0e10cSrcweir     return bModified;
514cdf0e10cSrcweir }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir /*------------------------------------------------------------------------
517cdf0e10cSrcweir ------------------------------------------------------------------------*/
Reset(const SfxItemSet &)518cdf0e10cSrcweir void  SwFormatTablePage::Reset( const SfxItemSet& )
519cdf0e10cSrcweir {
520cdf0e10cSrcweir 	const SfxItemSet& rSet = GetItemSet();
521cdf0e10cSrcweir 	const SfxPoolItem*	pItem;
522cdf0e10cSrcweir 
523cdf0e10cSrcweir     if(bHtmlMode)
524cdf0e10cSrcweir 	{
525cdf0e10cSrcweir 		aNameED	.Disable();
526cdf0e10cSrcweir 		aTopFT	.Hide();
527cdf0e10cSrcweir 		aTopMF	.Hide();
528cdf0e10cSrcweir 		aBottomFT.Hide();
529cdf0e10cSrcweir 		aBottomMF.Hide();
530cdf0e10cSrcweir 		aFreeBtn.Enable(sal_False);
531cdf0e10cSrcweir 	}
532cdf0e10cSrcweir 	FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
533cdf0e10cSrcweir 	SetMetric( aWidthMF, aMetric );
534cdf0e10cSrcweir 	SetMetric( aRightMF, aMetric );
535cdf0e10cSrcweir 	SetMetric( aLeftMF, aMetric );
536cdf0e10cSrcweir 	SetMetric( aTopMF, aMetric );
537cdf0e10cSrcweir 	SetMetric( aBottomMF, aMetric );
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 	//Name
540cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, sal_False, &pItem ))
541cdf0e10cSrcweir 	{
542cdf0e10cSrcweir 		aNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
543cdf0e10cSrcweir 		aNameED.SaveValue();
544cdf0e10cSrcweir 	}
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem ))
547cdf0e10cSrcweir 	{
548cdf0e10cSrcweir 		pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
549cdf0e10cSrcweir 		nMinTableWidth = pTblData->GetColCount() * MINLAY;
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 		if(pTblData->GetWidthPercent())
552cdf0e10cSrcweir 		{
553cdf0e10cSrcweir 			aRelWidthCB.Check(sal_True);
554cdf0e10cSrcweir 			RelWidthClickHdl(&aRelWidthCB);
555cdf0e10cSrcweir             aWidthMF.SetPrcntValue(pTblData->GetWidthPercent(), FUNIT_CUSTOM);
556cdf0e10cSrcweir 
557cdf0e10cSrcweir 			aWidthMF.SaveValue();
558cdf0e10cSrcweir             nSaveWidth = static_cast< SwTwips >(aWidthMF.GetValue(FUNIT_CUSTOM));
559cdf0e10cSrcweir 		}
560cdf0e10cSrcweir 		else
561cdf0e10cSrcweir 		{
562cdf0e10cSrcweir             aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
563cdf0e10cSrcweir 					pTblData->GetWidth()), FUNIT_TWIP);
564cdf0e10cSrcweir 			aWidthMF.SaveValue();
565cdf0e10cSrcweir 			nSaveWidth = pTblData->GetWidth();
566cdf0e10cSrcweir 			nMinTableWidth = Min( nSaveWidth, nMinTableWidth );
567cdf0e10cSrcweir 		}
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 		aWidthMF.SetRefValue(pTblData->GetSpace());
570cdf0e10cSrcweir 		aWidthMF.SetLast(aWidthMF.NormalizePercent( pTblData->GetSpace() ));
571cdf0e10cSrcweir 		aLeftMF.SetLast(aLeftMF.NormalizePercent( pTblData->GetSpace() ));
572cdf0e10cSrcweir 		aRightMF.SetLast(aRightMF.NormalizePercent( pTblData->GetSpace() ));
573cdf0e10cSrcweir 
574cdf0e10cSrcweir         aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
575cdf0e10cSrcweir 					pTblData->GetLeftSpace()), FUNIT_TWIP);
576cdf0e10cSrcweir         aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
577cdf0e10cSrcweir 					pTblData->GetRightSpace()), FUNIT_TWIP);
578cdf0e10cSrcweir 		aLeftMF.SaveValue();
579cdf0e10cSrcweir 		aRightMF.SaveValue();
580cdf0e10cSrcweir 
581cdf0e10cSrcweir 		nOldAlign = pTblData->GetAlign();
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 		sal_Bool bSetRight = sal_False, bRightEnable = sal_False,
584cdf0e10cSrcweir 			 bSetLeft  = sal_False, bLeftEnable  = sal_False;
585cdf0e10cSrcweir 		switch( nOldAlign )
586cdf0e10cSrcweir 		{
587cdf0e10cSrcweir             case text::HoriOrientation::NONE:
588cdf0e10cSrcweir 				aFreeBtn.Check();
589cdf0e10cSrcweir 				if(aRelWidthCB.IsChecked())
590cdf0e10cSrcweir 					bSetRight = sal_True;
591cdf0e10cSrcweir 			break;
592cdf0e10cSrcweir             case text::HoriOrientation::FULL:
593cdf0e10cSrcweir 			{
594cdf0e10cSrcweir 				bSetRight = bSetLeft = sal_True;
595cdf0e10cSrcweir 				aFullBtn.Check();
596cdf0e10cSrcweir 				aWidthMF.Enable(sal_False);
597cdf0e10cSrcweir 				aRelWidthCB.Enable(sal_False);
598cdf0e10cSrcweir 				aWidthFT.Enable(sal_False);
599cdf0e10cSrcweir 			}
600cdf0e10cSrcweir 			break;
601cdf0e10cSrcweir             case text::HoriOrientation::LEFT:
602cdf0e10cSrcweir 			{
603cdf0e10cSrcweir 				bSetLeft = sal_True;
604cdf0e10cSrcweir 				aLeftBtn.Check();
605cdf0e10cSrcweir 			}
606cdf0e10cSrcweir 			break;
607cdf0e10cSrcweir             case text::HoriOrientation::LEFT_AND_WIDTH :
608cdf0e10cSrcweir 			{
609cdf0e10cSrcweir 				bSetRight = sal_True;
610cdf0e10cSrcweir 				aFromLeftBtn.Check();
611cdf0e10cSrcweir 			}
612cdf0e10cSrcweir 			break;
613cdf0e10cSrcweir             case text::HoriOrientation::RIGHT:
614cdf0e10cSrcweir 			{
615cdf0e10cSrcweir 				bSetRight = sal_True;
616cdf0e10cSrcweir 				aRightBtn.Check();
617cdf0e10cSrcweir 			}
618cdf0e10cSrcweir 			break;
619cdf0e10cSrcweir             case text::HoriOrientation::CENTER:
620cdf0e10cSrcweir 			{
621cdf0e10cSrcweir 				bSetRight = sal_True;
622cdf0e10cSrcweir 				aCenterBtn.Check();
623cdf0e10cSrcweir 			}
624cdf0e10cSrcweir 			break;
625cdf0e10cSrcweir 		}
626cdf0e10cSrcweir 		if ( bSetRight )
627cdf0e10cSrcweir 		{
628cdf0e10cSrcweir 			aRightMF.Enable(bRightEnable);
629cdf0e10cSrcweir 			aRightFT.Enable(bRightEnable);
630cdf0e10cSrcweir 		}
631cdf0e10cSrcweir 		if ( bSetLeft )
632cdf0e10cSrcweir 		{
633cdf0e10cSrcweir 			aLeftMF.Enable(bLeftEnable);
634cdf0e10cSrcweir 			aLeftFT.Enable(bLeftEnable);
635cdf0e10cSrcweir 		}
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 	}
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	//Raender
640cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( RES_UL_SPACE, sal_False,&pItem ))
641cdf0e10cSrcweir 	{
642cdf0e10cSrcweir 		aTopMF.SetValue(aTopMF.Normalize(
643cdf0e10cSrcweir 						((const SvxULSpaceItem*)pItem)->GetUpper()), FUNIT_TWIP);
644cdf0e10cSrcweir 		aBottomMF.SetValue(aBottomMF.Normalize(
645cdf0e10cSrcweir 						((const SvxULSpaceItem*)pItem)->GetLower()), FUNIT_TWIP);
646cdf0e10cSrcweir 		aTopMF.SaveValue();
647cdf0e10cSrcweir 		aBottomMF.SaveValue();
648cdf0e10cSrcweir 	}
649cdf0e10cSrcweir 
650cdf0e10cSrcweir     //text direction
651cdf0e10cSrcweir     if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) )
652cdf0e10cSrcweir 	{
653cdf0e10cSrcweir         sal_uInt32 nVal  = ((SvxFrameDirectionItem*)pItem)->GetValue();
654cdf0e10cSrcweir         sal_uInt16 nPos = aTextDirectionLB.GetEntryPos( (void*) nVal );
655cdf0e10cSrcweir         aTextDirectionLB.SelectEntryPos( nPos );
656cdf0e10cSrcweir         aTextDirectionLB.SaveValue();
657cdf0e10cSrcweir 	}
658cdf0e10cSrcweir 
659cdf0e10cSrcweir     aWidthMF.SetMax( 2*aWidthMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
660cdf0e10cSrcweir 	aRightMF.SetMax( aRightMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
661cdf0e10cSrcweir 	aLeftMF.SetMax( aLeftMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
662cdf0e10cSrcweir 	aWidthMF.SetMin( aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP );
663cdf0e10cSrcweir 
664cdf0e10cSrcweir }
665cdf0e10cSrcweir 
666cdf0e10cSrcweir /*------------------------------------------------------------------------
667cdf0e10cSrcweir ------------------------------------------------------------------------*/
ActivatePage(const SfxItemSet & rSet)668cdf0e10cSrcweir void  	SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir 	DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
671cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP ))
672cdf0e10cSrcweir 	{
673cdf0e10cSrcweir         SwTwips nCurWidth = text::HoriOrientation::FULL != pTblData->GetAlign() ?
674cdf0e10cSrcweir 										pTblData->GetWidth() :
675cdf0e10cSrcweir 											pTblData->GetSpace();
676cdf0e10cSrcweir 		if(pTblData->GetWidthPercent() == 0 &&
677cdf0e10cSrcweir 				nCurWidth != aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )))
678cdf0e10cSrcweir 		{
679cdf0e10cSrcweir             aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
680cdf0e10cSrcweir 							nCurWidth), FUNIT_TWIP);
681cdf0e10cSrcweir 			aWidthMF.SaveValue();
682cdf0e10cSrcweir 			nSaveWidth = nCurWidth;
683cdf0e10cSrcweir             aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
684cdf0e10cSrcweir 							pTblData->GetLeftSpace()), FUNIT_TWIP);
685cdf0e10cSrcweir 			aLeftMF.SaveValue();
686cdf0e10cSrcweir             aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
687cdf0e10cSrcweir 							pTblData->GetRightSpace()), FUNIT_TWIP);
688cdf0e10cSrcweir 			aRightMF.SaveValue();
689cdf0e10cSrcweir 		}
690cdf0e10cSrcweir 	}
691cdf0e10cSrcweir 
692cdf0e10cSrcweir }
693cdf0e10cSrcweir /*------------------------------------------------------------------------
694cdf0e10cSrcweir ------------------------------------------------------------------------*/
DeactivatePage(SfxItemSet * _pSet)695cdf0e10cSrcweir int  SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
696cdf0e10cSrcweir {
697cdf0e10cSrcweir 	// os: VCL sorgt nicht dafuer, dass das aktive Control im
698cdf0e10cSrcweir 	// dialog bei OK den focus verliert
699cdf0e10cSrcweir 	aNameED.GrabFocus();
700cdf0e10cSrcweir 	// Test des Tabellennamens auf Leerzeichen
701cdf0e10cSrcweir 	String sTblName = aNameED.GetText();
702cdf0e10cSrcweir 	if(sTblName.Search(' ') != STRING_NOTFOUND)
703cdf0e10cSrcweir 	{
704cdf0e10cSrcweir 		InfoBox(this, SW_RES(MSG_WRONG_TABLENAME)).Execute();
705cdf0e10cSrcweir 		aNameED.GrabFocus();
706cdf0e10cSrcweir 		return KEEP_PAGE;
707cdf0e10cSrcweir 	}
708cdf0e10cSrcweir     if(_pSet)
709cdf0e10cSrcweir 	{
710cdf0e10cSrcweir         FillItemSet(*_pSet);
711cdf0e10cSrcweir 		if(bModified)
712cdf0e10cSrcweir 		{
713cdf0e10cSrcweir             SwTwips lLeft  = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
714cdf0e10cSrcweir             SwTwips lRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
715cdf0e10cSrcweir 
716cdf0e10cSrcweir 
717cdf0e10cSrcweir 			if( aLeftMF.GetText() != aLeftMF.GetSavedValue() ||
718cdf0e10cSrcweir 									aRightMF.GetText() != aRightMF.GetSavedValue() )
719cdf0e10cSrcweir 			{
720cdf0e10cSrcweir 				pTblData->SetWidthChanged();
721cdf0e10cSrcweir 				pTblData->SetLeftSpace( lLeft);
722cdf0e10cSrcweir 				pTblData->SetRightSpace( lRight);
723cdf0e10cSrcweir 			}
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 			SwTwips lWidth;
726cdf0e10cSrcweir 			if (aRelWidthCB.IsChecked() && aRelWidthCB.IsEnabled())
727cdf0e10cSrcweir 			{
728cdf0e10cSrcweir 				lWidth = pTblData->GetSpace() - lRight - lLeft;
729cdf0e10cSrcweir 				sal_uInt16 nPercentWidth = (sal_uInt16)aWidthMF.GetValue(FUNIT_CUSTOM);
730cdf0e10cSrcweir 				if(pTblData->GetWidthPercent() != nPercentWidth)
731cdf0e10cSrcweir 				{
732cdf0e10cSrcweir 					pTblData->SetWidthPercent(nPercentWidth);
733cdf0e10cSrcweir 					pTblData->SetWidthChanged();
734cdf0e10cSrcweir 				}
735cdf0e10cSrcweir 			}
736cdf0e10cSrcweir 			else
737cdf0e10cSrcweir 			{
738cdf0e10cSrcweir 				pTblData->SetWidthPercent(0);
739cdf0e10cSrcweir                 lWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
740cdf0e10cSrcweir 			}
741cdf0e10cSrcweir 			pTblData->SetWidth(lWidth);
742cdf0e10cSrcweir 
743cdf0e10cSrcweir 			SwTwips nColSum = 0;
744cdf0e10cSrcweir 			sal_uInt16 i;
745cdf0e10cSrcweir 
746cdf0e10cSrcweir 			for( i = 0; i < pTblData->GetColCount(); i++)
747cdf0e10cSrcweir 			{
748cdf0e10cSrcweir 				nColSum += pTblData->GetColumns()[i].nWidth;
749cdf0e10cSrcweir 			}
750cdf0e10cSrcweir 			if(nColSum != pTblData->GetWidth())
751cdf0e10cSrcweir 			{
752cdf0e10cSrcweir 				SwTwips nMinWidth = Min( (long)MINLAY,
753cdf0e10cSrcweir 									(long) (pTblData->GetWidth() /
754cdf0e10cSrcweir 											pTblData->GetColCount() - 1));
755cdf0e10cSrcweir 				SwTwips nDiff = nColSum - pTblData->GetWidth();
756cdf0e10cSrcweir 				while ( Abs(nDiff) > pTblData->GetColCount() + 1 )
757cdf0e10cSrcweir 				{
758cdf0e10cSrcweir 					SwTwips nSub = nDiff / pTblData->GetColCount();
759cdf0e10cSrcweir 					for( i = 0; i < pTblData->GetColCount(); i++)
760cdf0e10cSrcweir 					{
761cdf0e10cSrcweir 						if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub)
762cdf0e10cSrcweir 						{
763cdf0e10cSrcweir 							pTblData->GetColumns()[i].nWidth -= nSub;
764cdf0e10cSrcweir 							nDiff -= nSub;
765cdf0e10cSrcweir 						}
766cdf0e10cSrcweir 						else
767cdf0e10cSrcweir 						{
768cdf0e10cSrcweir 							nDiff -= pTblData->GetColumns()[i].nWidth - nMinWidth;
769cdf0e10cSrcweir 							pTblData->GetColumns()[i].nWidth = nMinWidth;
770cdf0e10cSrcweir 						}
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 					}
773cdf0e10cSrcweir 				}
774cdf0e10cSrcweir 			}
775cdf0e10cSrcweir 
776cdf0e10cSrcweir             sal_Int16 nAlign = 0;
777cdf0e10cSrcweir 			if(aRightBtn.IsChecked())
778cdf0e10cSrcweir                 nAlign = text::HoriOrientation::RIGHT;
779cdf0e10cSrcweir 			else if(aLeftBtn.IsChecked())
780cdf0e10cSrcweir                 nAlign = text::HoriOrientation::LEFT;
781cdf0e10cSrcweir 			else if(aFromLeftBtn.IsChecked())
782cdf0e10cSrcweir                 nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
783cdf0e10cSrcweir 			else if(aCenterBtn.IsChecked())
784cdf0e10cSrcweir                 nAlign = text::HoriOrientation::CENTER;
785cdf0e10cSrcweir 			else if(aFreeBtn.IsChecked())
786cdf0e10cSrcweir                 nAlign = text::HoriOrientation::NONE;
787cdf0e10cSrcweir 			else if(aFullBtn.IsChecked())
788cdf0e10cSrcweir 			{
789cdf0e10cSrcweir                 nAlign = text::HoriOrientation::FULL;
790cdf0e10cSrcweir 				lWidth = lAutoWidth;
791cdf0e10cSrcweir 			}
792cdf0e10cSrcweir 			if(nAlign != pTblData->GetAlign())
793cdf0e10cSrcweir 			{
794cdf0e10cSrcweir 				pTblData->SetWidthChanged();
795cdf0e10cSrcweir 				pTblData->SetAlign(nAlign);
796cdf0e10cSrcweir 			}
797cdf0e10cSrcweir 
798cdf0e10cSrcweir 
799cdf0e10cSrcweir     //      if(  text::HoriOrientation::CENTER && lWidth != (SwTwips)aWidthMF.GetSavedValue())
800cdf0e10cSrcweir 			if(pTblData->GetWidth() != lWidth )
801cdf0e10cSrcweir 			{
802cdf0e10cSrcweir 				pTblData->SetWidthChanged();
803cdf0e10cSrcweir 				pTblData->SetWidth(
804cdf0e10cSrcweir                     nAlign == text::HoriOrientation::FULL ? pTblData->GetSpace() : lWidth );
805cdf0e10cSrcweir 			}
806cdf0e10cSrcweir 			if(pTblData->HasWidthChanged())
807cdf0e10cSrcweir                 _pSet->Put(SwPtrItem(FN_TABLE_REP, pTblData));
808cdf0e10cSrcweir 		}
809cdf0e10cSrcweir #ifdef DEBUG_TBLDLG
810cdf0e10cSrcweir DbgTblRep(pTblData)
811cdf0e10cSrcweir #endif
812cdf0e10cSrcweir 	}
813cdf0e10cSrcweir 	return sal_True;
814cdf0e10cSrcweir }
815cdf0e10cSrcweir /*------------------------------------------------------------------------
816cdf0e10cSrcweir 	Beschreibung: Seite Spaltenkonfiguration
817cdf0e10cSrcweir ------------------------------------------------------------------------*/
SwTableColumnPage(Window * pParent,const SfxItemSet & rSet)818cdf0e10cSrcweir SwTableColumnPage::SwTableColumnPage( Window* pParent,
819cdf0e10cSrcweir 			const SfxItemSet& rSet ) :
820cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES( TP_TABLE_COLUMN ), rSet ),
821cdf0e10cSrcweir 	aModifyTableCB(this,	SW_RES(CB_MOD_TBL)),
822cdf0e10cSrcweir 	aProportionalCB(this,	SW_RES(CB_PROP)),
823cdf0e10cSrcweir 	aSpaceFT(this,			SW_RES(FT_SPACE)),
824cdf0e10cSrcweir 	aSpaceED(this,			SW_RES(ED_SPACE)),
825cdf0e10cSrcweir 
826cdf0e10cSrcweir     aColFL(this,            SW_RES(COL_FL_LAYOUT)),
827cdf0e10cSrcweir     aUpBtn(this,            SW_RES(COL_BTN_UP)),
828cdf0e10cSrcweir     aFT1(this,              SW_RES(COL_FT_1)),
829cdf0e10cSrcweir 	aMF1(this,				SW_RES(COL_MF_1)),
830cdf0e10cSrcweir 	aFT2(this,				SW_RES(COL_FT_2)),
831cdf0e10cSrcweir 	aMF2(this,				SW_RES(COL_MF_2)),
832cdf0e10cSrcweir 	aFT3(this,				SW_RES(COL_FT_3)),
833cdf0e10cSrcweir 	aMF3(this,				SW_RES(COL_MF_3)),
834cdf0e10cSrcweir 	aFT4(this,				SW_RES(COL_FT_4)),
835cdf0e10cSrcweir 	aMF4(this,				SW_RES(COL_MF_4)),
836cdf0e10cSrcweir 	aFT5(this,				SW_RES(COL_FT_5)),
837cdf0e10cSrcweir 	aMF5(this,				SW_RES(COL_MF_5)),
838cdf0e10cSrcweir 	aFT6(this,				SW_RES(COL_FT_6)),
839cdf0e10cSrcweir 	aMF6(this,				SW_RES(COL_MF_6)),
840cdf0e10cSrcweir     aDownBtn(this,          SW_RES(COL_BTN_DOWN)),
841cdf0e10cSrcweir 
842cdf0e10cSrcweir     nTableWidth(0),
843cdf0e10cSrcweir     nMinWidth( MINLAY ),
844cdf0e10cSrcweir     nNoOfCols( 0 ),
845cdf0e10cSrcweir 	nNoOfVisibleCols( 0 ),
846cdf0e10cSrcweir 	bModified(sal_False),
847cdf0e10cSrcweir 	bModifyTbl(sal_False),
848cdf0e10cSrcweir     bPercentMode(sal_False)
849cdf0e10cSrcweir {
850cdf0e10cSrcweir 	FreeResource();
851cdf0e10cSrcweir 	SetExchangeSupport();
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 	aDownBtn.SetAccessibleRelationMemberOf(&aColFL);
854cdf0e10cSrcweir 	aUpBtn.SetAccessibleRelationMemberOf(&aColFL);
855cdf0e10cSrcweir 
856cdf0e10cSrcweir 	pFieldArr[0] = &aMF1;
857cdf0e10cSrcweir 	pFieldArr[1] = &aMF2;
858cdf0e10cSrcweir 	pFieldArr[2] = &aMF3;
859cdf0e10cSrcweir 	pFieldArr[3] = &aMF4;
860cdf0e10cSrcweir 	pFieldArr[4] = &aMF5;
861cdf0e10cSrcweir 	pFieldArr[5] = &aMF6;
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 	pTextArr[0] = &aFT1;
864cdf0e10cSrcweir 	pTextArr[1] = &aFT2;
865cdf0e10cSrcweir 	pTextArr[2] = &aFT3;
866cdf0e10cSrcweir 	pTextArr[3] = &aFT4;
867cdf0e10cSrcweir 	pTextArr[4] = &aFT5;
868cdf0e10cSrcweir 	pTextArr[5] = &aFT6;
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	const SfxPoolItem* pItem;
871cdf0e10cSrcweir 	Init((SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem )
872cdf0e10cSrcweir 		&& ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON));
873cdf0e10cSrcweir 
874cdf0e10cSrcweir };
875cdf0e10cSrcweir /*------------------------------------------------------------------------
876cdf0e10cSrcweir 	Beschreibung: Seite Spaltenkonfiguration
877cdf0e10cSrcweir ------------------------------------------------------------------------*/
~SwTableColumnPage()878cdf0e10cSrcweir  SwTableColumnPage::~SwTableColumnPage()
879cdf0e10cSrcweir {
880cdf0e10cSrcweir };
881cdf0e10cSrcweir 
882cdf0e10cSrcweir /*------------------------------------------------------------------------
883cdf0e10cSrcweir ------------------------------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rAttrSet)884cdf0e10cSrcweir SfxTabPage*   SwTableColumnPage::Create( Window* pParent,
885cdf0e10cSrcweir 								const SfxItemSet& rAttrSet)
886cdf0e10cSrcweir {
887cdf0e10cSrcweir 	return new SwTableColumnPage( pParent, rAttrSet );
888cdf0e10cSrcweir };
889cdf0e10cSrcweir 
890cdf0e10cSrcweir /*------------------------------------------------------------------------
891cdf0e10cSrcweir ------------------------------------------------------------------------*/
Reset(const SfxItemSet &)892cdf0e10cSrcweir void  SwTableColumnPage::Reset( const SfxItemSet& )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir 	const SfxItemSet& rSet = GetItemSet();
895cdf0e10cSrcweir 
896cdf0e10cSrcweir 	const SfxPoolItem* pItem;
897cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, sal_False, &pItem ))
898cdf0e10cSrcweir 	{
899cdf0e10cSrcweir 		pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
900cdf0e10cSrcweir 		nNoOfVisibleCols = pTblData->GetColCount();
901cdf0e10cSrcweir 		nNoOfCols = pTblData->GetAllColCount();
902cdf0e10cSrcweir         nTableWidth = pTblData->GetAlign() != text::HoriOrientation::FULL &&
903cdf0e10cSrcweir                             pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
904cdf0e10cSrcweir 						pTblData->GetWidth() : pTblData->GetSpace();
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 		sal_uInt16 i;
907cdf0e10cSrcweir 		for( i = 0; i < nNoOfCols; i++ )
908cdf0e10cSrcweir 		{
909cdf0e10cSrcweir 			if( pTblData->GetColumns()[i].nWidth  < nMinWidth )
910cdf0e10cSrcweir 					nMinWidth = pTblData->GetColumns()[i].nWidth;
911cdf0e10cSrcweir 		}
912cdf0e10cSrcweir         sal_Int64 nMinTwips = pFieldArr[0]->NormalizePercent( nMinWidth );
913cdf0e10cSrcweir         sal_Int64 nMaxTwips = pFieldArr[0]->NormalizePercent( nTableWidth );
914cdf0e10cSrcweir 		for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
915cdf0e10cSrcweir 		{
916cdf0e10cSrcweir             pFieldArr[i]->SetPrcntValue( pFieldArr[i]->NormalizePercent(
917cdf0e10cSrcweir 												GetVisibleWidth(i) ), FUNIT_TWIP );
918cdf0e10cSrcweir 			pFieldArr[i]->SetMin( nMinTwips , FUNIT_TWIP );
919cdf0e10cSrcweir 			pFieldArr[i]->SetMax( nMaxTwips , FUNIT_TWIP );
920cdf0e10cSrcweir 			pFieldArr[i]->Enable();
921cdf0e10cSrcweir 			pTextArr[i]->Enable();
922cdf0e10cSrcweir 		}
923cdf0e10cSrcweir 
924cdf0e10cSrcweir 		if( nNoOfVisibleCols > MET_FIELDS )
925cdf0e10cSrcweir 			aUpBtn.Enable();
926cdf0e10cSrcweir 		i = nNoOfVisibleCols;
927cdf0e10cSrcweir 		while( i < MET_FIELDS )
928cdf0e10cSrcweir 		{
929cdf0e10cSrcweir 			pFieldArr[i]->SetText( aEmptyStr );
930cdf0e10cSrcweir 			pTextArr[i]->Hide();
931cdf0e10cSrcweir 			i++;
932cdf0e10cSrcweir 		}
933cdf0e10cSrcweir 	}
934cdf0e10cSrcweir 	ActivatePage(rSet);
935cdf0e10cSrcweir 
936cdf0e10cSrcweir };
937cdf0e10cSrcweir 
938cdf0e10cSrcweir /*------------------------------------------------------------------------
939cdf0e10cSrcweir ------------------------------------------------------------------------*/
Init(sal_Bool bWeb)940cdf0e10cSrcweir void  SwTableColumnPage::Init(sal_Bool bWeb)
941cdf0e10cSrcweir {
942cdf0e10cSrcweir 	FieldUnit aMetric = ::GetDfltMetric(bWeb);
943cdf0e10cSrcweir 	Link aLkUp = LINK( this, SwTableColumnPage, UpHdl );
944cdf0e10cSrcweir 	Link aLkDown = LINK( this, SwTableColumnPage, DownHdl );
945cdf0e10cSrcweir 	Link aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl );
946cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
947cdf0e10cSrcweir 	{
948cdf0e10cSrcweir 		aValueTbl[i] = i;
949cdf0e10cSrcweir 		SetMetric(*pFieldArr[i], aMetric);
950cdf0e10cSrcweir 		pFieldArr[i]->SetUpHdl( aLkUp );
951cdf0e10cSrcweir 		pFieldArr[i]->SetDownHdl( aLkDown );
952cdf0e10cSrcweir 		pFieldArr[i]->SetLoseFocusHdl( aLkLF );
953cdf0e10cSrcweir 
954cdf0e10cSrcweir 	}
955cdf0e10cSrcweir 	SetMetric(aSpaceED, aMetric);
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 	Link aLk = LINK( this, SwTableColumnPage, AutoClickHdl );
958cdf0e10cSrcweir 	aUpBtn.SetClickHdl( aLk );
959cdf0e10cSrcweir 	aDownBtn.SetClickHdl( aLk );
960cdf0e10cSrcweir 
961cdf0e10cSrcweir 	aLk = LINK( this, SwTableColumnPage, ModeHdl );
962cdf0e10cSrcweir 	aModifyTableCB .SetClickHdl( aLk );
963cdf0e10cSrcweir 	aProportionalCB.SetClickHdl( aLk );
964cdf0e10cSrcweir };
965cdf0e10cSrcweir 
966cdf0e10cSrcweir /*------------------------------------------------------------------------
967cdf0e10cSrcweir ------------------------------------------------------------------------*/
IMPL_LINK(SwTableColumnPage,AutoClickHdl,CheckBox *,pBox)968cdf0e10cSrcweir IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox )
969cdf0e10cSrcweir {
970cdf0e10cSrcweir 	//Anzeigefenster verschieben
971cdf0e10cSrcweir 	if(pBox == (CheckBox *)&aDownBtn)
972cdf0e10cSrcweir 	{
973cdf0e10cSrcweir 		if(aValueTbl[0] > 0)
974cdf0e10cSrcweir 		{
975cdf0e10cSrcweir 			for( sal_uInt16 i=0; i < MET_FIELDS; i++ )
976cdf0e10cSrcweir 				aValueTbl[i] -= 1;
977cdf0e10cSrcweir 		}
978cdf0e10cSrcweir 	}
979cdf0e10cSrcweir 	if(pBox == (CheckBox *)&aUpBtn)
980cdf0e10cSrcweir 	{
981cdf0e10cSrcweir 		if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1  )
982cdf0e10cSrcweir 		{
983cdf0e10cSrcweir 			for(sal_uInt16 i=0;i < MET_FIELDS;i++)
984cdf0e10cSrcweir 				aValueTbl[i] += 1;
985cdf0e10cSrcweir 		}
986cdf0e10cSrcweir 	}
987cdf0e10cSrcweir 	for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
988cdf0e10cSrcweir 	{
989cdf0e10cSrcweir 		String sEntry('~');
990cdf0e10cSrcweir 		String sIndex = String::CreateFromInt32( aValueTbl[i] + 1 );
991cdf0e10cSrcweir 		sEntry += sIndex;
992cdf0e10cSrcweir 		pTextArr[i]->SetText( sEntry );
993cdf0e10cSrcweir 		String sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH);
994cdf0e10cSrcweir 		sColumnWidth.SearchAndReplace( DEFINE_CONST_UNICODE("%1"), sIndex );
995cdf0e10cSrcweir 		pFieldArr[i]->SetAccessibleName( sColumnWidth );
996cdf0e10cSrcweir 	}
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 	aDownBtn.Enable(aValueTbl[0] > 0);
999cdf0e10cSrcweir 	aUpBtn.Enable(aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 );
1000cdf0e10cSrcweir 	UpdateCols(0);
1001cdf0e10cSrcweir 	return 0;
1002cdf0e10cSrcweir };
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir /*------------------------------------------------------------------------
1005cdf0e10cSrcweir ------------------------------------------------------------------------*/
IMPL_LINK_INLINE_START(SwTableColumnPage,UpHdl,PercentField *,pEdit)1006cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, UpHdl, PercentField *, pEdit )
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir 	bModified = sal_True;
1009cdf0e10cSrcweir 	ModifyHdl( pEdit );
1010cdf0e10cSrcweir 	return 0;
1011cdf0e10cSrcweir };
IMPL_LINK_INLINE_END(SwTableColumnPage,UpHdl,PercentField *,pEdit)1012cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, UpHdl, PercentField *, pEdit )
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir /*------------------------------------------------------------------------
1015cdf0e10cSrcweir ------------------------------------------------------------------------*/
1016cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, DownHdl, PercentField *, pEdit )
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir 	bModified = sal_True;
1019cdf0e10cSrcweir 	ModifyHdl( pEdit );
1020cdf0e10cSrcweir 	return 0;
1021cdf0e10cSrcweir };
IMPL_LINK_INLINE_END(SwTableColumnPage,DownHdl,PercentField *,pEdit)1022cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, DownHdl, PercentField *, pEdit )
1023cdf0e10cSrcweir 
1024cdf0e10cSrcweir /*------------------------------------------------------------------------
1025cdf0e10cSrcweir ------------------------------------------------------------------------*/
1026cdf0e10cSrcweir IMPL_LINK_INLINE_START( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir 	if(pEdit->IsModified())
1029cdf0e10cSrcweir 	{
1030cdf0e10cSrcweir 		bModified = sal_True;
1031cdf0e10cSrcweir 		ModifyHdl( pEdit );
1032cdf0e10cSrcweir 	}
1033cdf0e10cSrcweir 	return 0;
1034cdf0e10cSrcweir };
IMPL_LINK_INLINE_END(SwTableColumnPage,LoseFocusHdl,PercentField *,pEdit)1035cdf0e10cSrcweir IMPL_LINK_INLINE_END( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir /*------------------------------------------------------------------------
1038cdf0e10cSrcweir ------------------------------------------------------------------------*/
1039cdf0e10cSrcweir IMPL_LINK( SwTableColumnPage, ModeHdl, CheckBox*, pBox )
1040cdf0e10cSrcweir {
1041cdf0e10cSrcweir 	sal_Bool bCheck = pBox->IsChecked();
1042cdf0e10cSrcweir 	if(pBox == &aProportionalCB)
1043cdf0e10cSrcweir 	{
1044cdf0e10cSrcweir 		if(bCheck)
1045cdf0e10cSrcweir 			aModifyTableCB.Check();
1046cdf0e10cSrcweir 		aModifyTableCB.Enable(!bCheck && bModifyTbl);
1047cdf0e10cSrcweir 	}
1048cdf0e10cSrcweir 	return 0;
1049cdf0e10cSrcweir };
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir /*------------------------------------------------------------------------
1052cdf0e10cSrcweir ------------------------------------------------------------------------*/
FillItemSet(SfxItemSet &)1053cdf0e10cSrcweir sal_Bool  SwTableColumnPage::FillItemSet( SfxItemSet& )
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i < MET_FIELDS; i++ )
1056cdf0e10cSrcweir 	{
1057cdf0e10cSrcweir 		if(pFieldArr[i]->HasFocus())
1058cdf0e10cSrcweir 		{
1059cdf0e10cSrcweir 			LoseFocusHdl(pFieldArr[i]);
1060cdf0e10cSrcweir 			break;
1061cdf0e10cSrcweir 		}
1062cdf0e10cSrcweir 	}
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 	if(bModified)
1065cdf0e10cSrcweir 	{
1066cdf0e10cSrcweir 		pTblData->SetColsChanged();
1067cdf0e10cSrcweir 	}
1068cdf0e10cSrcweir 	return bModified;
1069cdf0e10cSrcweir };
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir /*------------------------------------------------------------------------
1072cdf0e10cSrcweir ------------------------------------------------------------------------*/
ModifyHdl(PercentField * pEdit)1073cdf0e10cSrcweir void   SwTableColumnPage::ModifyHdl( PercentField* pEdit )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir 		sal_uInt16 nAktPos;
1076cdf0e10cSrcweir 		sal_uInt16 i;
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir 		for( i = 0; i < MET_FIELDS; i++)
1079cdf0e10cSrcweir 			if(pEdit == pFieldArr[i])
1080cdf0e10cSrcweir 				break;
1081cdf0e10cSrcweir 
1082*205b6fc7SArmin Le Grand         if (MET_FIELDS <= i)
1083*205b6fc7SArmin Le Grand         {
1084*205b6fc7SArmin Le Grand             OSL_ENSURE(false, "cannot happen.");
1085*205b6fc7SArmin Le Grand             return;
1086*205b6fc7SArmin Le Grand         }
1087*205b6fc7SArmin Le Grand 
1088cdf0e10cSrcweir         SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) );
1089cdf0e10cSrcweir 		nAktPos = aValueTbl[i];
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 		UpdateCols( nAktPos );
1092cdf0e10cSrcweir };
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir /*------------------------------------------------------------------------
1095cdf0e10cSrcweir ------------------------------------------------------------------------*/
UpdateCols(sal_uInt16 nAktPos)1096cdf0e10cSrcweir void   SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
1097cdf0e10cSrcweir {
1098cdf0e10cSrcweir 	SwTwips nSum = 0;
1099cdf0e10cSrcweir 	sal_uInt16 i;
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir 	for( i = 0; i < nNoOfCols; i++ )
1102cdf0e10cSrcweir 	{
1103cdf0e10cSrcweir 		nSum += (pTblData->GetColumns())[i].nWidth;
1104cdf0e10cSrcweir 	}
1105cdf0e10cSrcweir 	SwTwips nDiff = nSum - nTableWidth;
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir     sal_Bool bModifyTable = aModifyTableCB.IsChecked();
1108cdf0e10cSrcweir 	sal_Bool bProp =    aProportionalCB.IsChecked();
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir     if(!bModifyTable && !bProp )
1111cdf0e10cSrcweir 	{
1112cdf0e10cSrcweir //		the table width is constant, the difference is balanced with the other columns
1113cdf0e10cSrcweir 		sal_uInt16 nLoopCount = 0;
1114cdf0e10cSrcweir 		while( nDiff )
1115cdf0e10cSrcweir 		{
1116cdf0e10cSrcweir 			if( ++nAktPos == nNoOfVisibleCols)
1117cdf0e10cSrcweir 			{
1118cdf0e10cSrcweir 				nAktPos = 0;
1119cdf0e10cSrcweir 				++nLoopCount;
1120cdf0e10cSrcweir 				//#i101353# in small tables it might not be possible to balance column width
1121cdf0e10cSrcweir 				if( nLoopCount > 1 )
1122cdf0e10cSrcweir 					break;
1123cdf0e10cSrcweir 			}
1124cdf0e10cSrcweir 			if( nDiff < 0 )
1125cdf0e10cSrcweir 			{
1126cdf0e10cSrcweir 				SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1127cdf0e10cSrcweir 				nDiff = 0;
1128cdf0e10cSrcweir 			}
1129cdf0e10cSrcweir 			else if( GetVisibleWidth(nAktPos) >= nDiff + nMinWidth )
1130cdf0e10cSrcweir 			{
1131cdf0e10cSrcweir 				SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1132cdf0e10cSrcweir 				nDiff = 0;
1133cdf0e10cSrcweir 			}
1134cdf0e10cSrcweir 			if( nDiff > 0 && GetVisibleWidth(nAktPos) > nMinWidth )
1135cdf0e10cSrcweir 			{
1136cdf0e10cSrcweir 				if( nDiff >= (GetVisibleWidth(nAktPos) - nMinWidth) )
1137cdf0e10cSrcweir 				{
1138cdf0e10cSrcweir 					nDiff -= (GetVisibleWidth(nAktPos) - nMinWidth);
1139cdf0e10cSrcweir 					SetVisibleWidth(nAktPos, nMinWidth);
1140cdf0e10cSrcweir 				}
1141cdf0e10cSrcweir 				else
1142cdf0e10cSrcweir 				{
1143cdf0e10cSrcweir 					nDiff = 0;
1144cdf0e10cSrcweir 					SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
1145cdf0e10cSrcweir 				}
1146cdf0e10cSrcweir 				DBG_ASSERT(nDiff >= 0, "nDiff < 0 kann hier nicht sein!");
1147cdf0e10cSrcweir 			}
1148cdf0e10cSrcweir 		}
1149cdf0e10cSrcweir 	}
1150cdf0e10cSrcweir     else if(bModifyTable && !bProp)
1151cdf0e10cSrcweir 	{
1152cdf0e10cSrcweir //		Differenz wird ueber die Tabellenbreite ausgeglichen,
1153cdf0e10cSrcweir //		andere Spalten bleiben unveraendert
1154cdf0e10cSrcweir 		DBG_ASSERT(nDiff <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
1155cdf0e10cSrcweir 		SwTwips nActSpace = pTblData->GetSpace() - nTableWidth;
1156cdf0e10cSrcweir 		if(nDiff > nActSpace)
1157cdf0e10cSrcweir 		{
1158cdf0e10cSrcweir 			nTableWidth = pTblData->GetSpace();
1159cdf0e10cSrcweir 			SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nActSpace );
1160cdf0e10cSrcweir 		}
1161cdf0e10cSrcweir 		else
1162cdf0e10cSrcweir 		{
1163cdf0e10cSrcweir 			nTableWidth += nDiff;
1164cdf0e10cSrcweir 		}
1165cdf0e10cSrcweir 	}
1166cdf0e10cSrcweir     else if(bModifyTable & bProp)
1167cdf0e10cSrcweir 	{
1168cdf0e10cSrcweir //		Alle Spalten werden proportional mitveraendert, die Tabellenbreite wird
1169cdf0e10cSrcweir //  	entsprechend angepasst
1170cdf0e10cSrcweir 		DBG_ASSERT(nDiff * nNoOfVisibleCols <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
1171cdf0e10cSrcweir 		long nAdd = nDiff;
1172cdf0e10cSrcweir 		if(nDiff * nNoOfVisibleCols > pTblData->GetSpace() - nTableWidth)
1173cdf0e10cSrcweir 		{
1174cdf0e10cSrcweir 			nAdd = (pTblData->GetSpace() - nTableWidth) / nNoOfVisibleCols;
1175cdf0e10cSrcweir 			SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nAdd );
1176cdf0e10cSrcweir 			nDiff = nAdd;
1177cdf0e10cSrcweir 		}
1178cdf0e10cSrcweir 		if(nAdd)
1179cdf0e10cSrcweir             for(i = 0; i < nNoOfVisibleCols; i++ )
1180cdf0e10cSrcweir 			{
1181cdf0e10cSrcweir 				if(i == nAktPos)
1182cdf0e10cSrcweir 					continue;
1183cdf0e10cSrcweir 				SwTwips nVisWidth;
1184cdf0e10cSrcweir 				if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1185cdf0e10cSrcweir 				{
1186cdf0e10cSrcweir 					nAdd += nVisWidth - MINLAY;
1187cdf0e10cSrcweir 					SetVisibleWidth(i, MINLAY);
1188cdf0e10cSrcweir 				}
1189cdf0e10cSrcweir 				else
1190cdf0e10cSrcweir 				{
1191cdf0e10cSrcweir 					SetVisibleWidth(i, nVisWidth + nDiff);
1192cdf0e10cSrcweir 					nAdd += nDiff;
1193cdf0e10cSrcweir 				}
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir 			}
1196cdf0e10cSrcweir 		nTableWidth += nAdd;
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 	}
1199cdf0e10cSrcweir 	else
1200cdf0e10cSrcweir 	{
1201cdf0e10cSrcweir //		Die Differenz wird gleichmaessig auf alle anderen Spalten aufgeteilt
1202cdf0e10cSrcweir // 		die Tabellenbreite bleibt konstant
1203cdf0e10cSrcweir /*
1204cdf0e10cSrcweir 		SwTwips nDiffn = nDiff/(nNoOfVisibleCols - 1);
1205cdf0e10cSrcweir 		if(nDiff < 0 && (nNoOfVisibleCols - 1) * nDiffn != nDiff)
1206cdf0e10cSrcweir 			nDiffn-- ;
1207cdf0e10cSrcweir 		sal_uInt16 nStart = nAktPos++;
1208cdf0e10cSrcweir 		if(nAktPos == nNoOfVisibleCols)
1209cdf0e10cSrcweir 			nStart = 0;
1210cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i < nNoOfVisibleCols; i++ )
1211cdf0e10cSrcweir 		{
1212cdf0e10cSrcweir 			if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1213cdf0e10cSrcweir 			{
1214cdf0e10cSrcweir 				nAdd += nVisWidth - MINLAY;
1215cdf0e10cSrcweir 				SetVisibleWidth(i, MINLAY);
1216cdf0e10cSrcweir 			}
1217cdf0e10cSrcweir 		}
1218cdf0e10cSrcweir */
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir 	}
1221cdf0e10cSrcweir 
1222cdf0e10cSrcweir #ifdef DEBUG_TBLDLG
1223cdf0e10cSrcweir DbgTblRep(pTblData)
1224cdf0e10cSrcweir #endif
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir 	if(!bPercentMode)
1227cdf0e10cSrcweir 		aSpaceED.SetValue(aSpaceED.Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir 	for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
1230cdf0e10cSrcweir 	{
1231cdf0e10cSrcweir         pFieldArr[i]->SetPrcntValue(pFieldArr[i]->NormalizePercent(
1232cdf0e10cSrcweir 						GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP);
1233cdf0e10cSrcweir 		pFieldArr[i]->ClearModifyFlag();
1234cdf0e10cSrcweir 	}
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir }
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir /*------------------------------------------------------------------------
1239cdf0e10cSrcweir ------------------------------------------------------------------------*/
ActivatePage(const SfxItemSet &)1240cdf0e10cSrcweir void    SwTableColumnPage::ActivatePage( const SfxItemSet& )
1241cdf0e10cSrcweir {
1242cdf0e10cSrcweir 	bPercentMode = pTblData->GetWidthPercent() != 0;
1243cdf0e10cSrcweir 	for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
1244cdf0e10cSrcweir 	{
1245cdf0e10cSrcweir 		pFieldArr[i]->SetRefValue(pTblData->GetWidth());
1246cdf0e10cSrcweir 		pFieldArr[i]->ShowPercent( bPercentMode );
1247cdf0e10cSrcweir 	}
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir 	sal_uInt16 nTblAlign = pTblData->GetAlign();
1250cdf0e10cSrcweir     if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) ||
1251cdf0e10cSrcweir     (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace()))
1252cdf0e10cSrcweir 	{
1253cdf0e10cSrcweir         nTableWidth = text::HoriOrientation::FULL == nTblAlign ?
1254cdf0e10cSrcweir 									pTblData->GetSpace() :
1255cdf0e10cSrcweir 										pTblData->GetWidth();
1256cdf0e10cSrcweir 		UpdateCols(0);
1257cdf0e10cSrcweir 	}
1258cdf0e10cSrcweir 	bModifyTbl = sal_True;
1259cdf0e10cSrcweir 	if(pTblData->GetWidthPercent() ||
1260cdf0e10cSrcweir                 text::HoriOrientation::FULL == nTblAlign ||
1261cdf0e10cSrcweir 						pTblData->IsLineSelected()  )
1262cdf0e10cSrcweir 		bModifyTbl = sal_False;
1263cdf0e10cSrcweir 	if(bPercentMode)
1264cdf0e10cSrcweir 	{
1265cdf0e10cSrcweir 		aModifyTableCB	.Check(sal_False);
1266cdf0e10cSrcweir 		aProportionalCB .Check(sal_False);
1267cdf0e10cSrcweir 	}
1268cdf0e10cSrcweir 	else if( !bModifyTbl )
1269cdf0e10cSrcweir 	{
1270cdf0e10cSrcweir 		aProportionalCB.Check(sal_False);
1271cdf0e10cSrcweir 		aModifyTableCB.Check(sal_False);
1272cdf0e10cSrcweir 	}
1273cdf0e10cSrcweir 	aSpaceFT.Enable(!bPercentMode);
1274cdf0e10cSrcweir 	aSpaceED.Enable(!bPercentMode);
1275cdf0e10cSrcweir 	aModifyTableCB.Enable( !bPercentMode && bModifyTbl );
1276cdf0e10cSrcweir 	aProportionalCB.Enable(!bPercentMode && bModifyTbl );
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir /*	if(pTblData->IsLineSelected() && pTblData->IsComplex())
1279cdf0e10cSrcweir 	{
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir 	}*/
1282cdf0e10cSrcweir 	aSpaceED.SetValue(aSpaceED.Normalize(
1283cdf0e10cSrcweir 				pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
1284cdf0e10cSrcweir 
1285cdf0e10cSrcweir }
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir /*------------------------------------------------------------------------
1288cdf0e10cSrcweir ------------------------------------------------------------------------*/
DeactivatePage(SfxItemSet * _pSet)1289cdf0e10cSrcweir int  SwTableColumnPage::DeactivatePage( SfxItemSet* _pSet )
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir     if(_pSet)
1292cdf0e10cSrcweir 	{
1293cdf0e10cSrcweir         FillItemSet(*_pSet);
1294cdf0e10cSrcweir         if(text::HoriOrientation::FULL != pTblData->GetAlign() && pTblData->GetWidth() != nTableWidth)
1295cdf0e10cSrcweir 		{
1296cdf0e10cSrcweir 			pTblData->SetWidth(nTableWidth);
1297cdf0e10cSrcweir 			SwTwips nDiff = pTblData->GetSpace() - pTblData->GetWidth() -
1298cdf0e10cSrcweir 							pTblData->GetLeftSpace() - pTblData->GetRightSpace();
1299cdf0e10cSrcweir 			switch( pTblData->GetAlign()  )
1300cdf0e10cSrcweir 			{
1301cdf0e10cSrcweir                 case text::HoriOrientation::RIGHT:
1302cdf0e10cSrcweir 					pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff);
1303cdf0e10cSrcweir 				break;
1304cdf0e10cSrcweir                 case text::HoriOrientation::LEFT:
1305cdf0e10cSrcweir 					pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff);
1306cdf0e10cSrcweir 				break;
1307cdf0e10cSrcweir                 case text::HoriOrientation::NONE:
1308cdf0e10cSrcweir 				{
1309cdf0e10cSrcweir 					SwTwips nDiff2 = nDiff/2;
1310cdf0e10cSrcweir 					if( nDiff > 0 ||
1311cdf0e10cSrcweir 						(-nDiff2 < pTblData->GetRightSpace() && - nDiff2 < pTblData->GetLeftSpace()))
1312cdf0e10cSrcweir 					{
1313cdf0e10cSrcweir 						pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff2);
1314cdf0e10cSrcweir 						pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff2);
1315cdf0e10cSrcweir 					}
1316cdf0e10cSrcweir 					else
1317cdf0e10cSrcweir 					{
1318cdf0e10cSrcweir 						if(pTblData->GetRightSpace() > pTblData->GetLeftSpace())
1319cdf0e10cSrcweir 						{
1320cdf0e10cSrcweir 							pTblData->SetLeftSpace(0);
1321cdf0e10cSrcweir 							pTblData->SetRightSpace(pTblData->GetSpace() - pTblData->GetWidth());
1322cdf0e10cSrcweir 						}
1323cdf0e10cSrcweir 						else
1324cdf0e10cSrcweir 						{
1325cdf0e10cSrcweir 							pTblData->SetRightSpace(0);
1326cdf0e10cSrcweir 							pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
1327cdf0e10cSrcweir 						}
1328cdf0e10cSrcweir 					}
1329cdf0e10cSrcweir 				}
1330cdf0e10cSrcweir 				break;
1331cdf0e10cSrcweir                 case text::HoriOrientation::CENTER:
1332cdf0e10cSrcweir 					pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff/2);
1333cdf0e10cSrcweir 					pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff/2);
1334cdf0e10cSrcweir 				break;
1335cdf0e10cSrcweir                 case text::HoriOrientation::LEFT_AND_WIDTH :
1336cdf0e10cSrcweir 					if(nDiff > pTblData->GetRightSpace())
1337cdf0e10cSrcweir 					{
1338cdf0e10cSrcweir 						pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
1339cdf0e10cSrcweir 					}
1340cdf0e10cSrcweir 					pTblData->SetRightSpace(
1341cdf0e10cSrcweir 						pTblData->GetSpace() - pTblData->GetWidth() - pTblData->GetLeftSpace());
1342cdf0e10cSrcweir 				break;
1343cdf0e10cSrcweir 			}
1344cdf0e10cSrcweir 			pTblData->SetWidthChanged();
1345cdf0e10cSrcweir 		}
1346cdf0e10cSrcweir #ifdef DEBUG_TBLDLG
1347cdf0e10cSrcweir DbgTblRep(pTblData)
1348cdf0e10cSrcweir #endif
1349cdf0e10cSrcweir         _pSet->Put(SwPtrItem( FN_TABLE_REP, pTblData ));
1350cdf0e10cSrcweir 	}
1351cdf0e10cSrcweir 	return sal_True;
1352cdf0e10cSrcweir }
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir /*------------------------------------------------------------------------
1355cdf0e10cSrcweir ------------------------------------------------------------------------*/
GetVisibleWidth(sal_uInt16 nPos)1356cdf0e10cSrcweir SwTwips  SwTableColumnPage::GetVisibleWidth(sal_uInt16 nPos)
1357cdf0e10cSrcweir {
1358cdf0e10cSrcweir 	sal_uInt16 i=0;
1359cdf0e10cSrcweir 
1360cdf0e10cSrcweir 	while( nPos )
1361cdf0e10cSrcweir 	{
1362cdf0e10cSrcweir 		if(pTblData->GetColumns()[i].bVisible && nPos)
1363cdf0e10cSrcweir 			nPos--;
1364cdf0e10cSrcweir 		i++;
1365cdf0e10cSrcweir 	}
1366cdf0e10cSrcweir 	SwTwips nReturn = pTblData->GetColumns()[i].nWidth;
1367cdf0e10cSrcweir 	DBG_ASSERT(i < nNoOfCols, "Array index out of range");
1368cdf0e10cSrcweir 	while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1369cdf0e10cSrcweir 		nReturn += pTblData->GetColumns()[++i].nWidth;
1370cdf0e10cSrcweir 
1371cdf0e10cSrcweir //	return (*ppTableColumns)[i].nWidth;
1372cdf0e10cSrcweir 	return nReturn;
1373cdf0e10cSrcweir }
1374cdf0e10cSrcweir 
1375cdf0e10cSrcweir /*------------------------------------------------------------------------
1376cdf0e10cSrcweir ------------------------------------------------------------------------*/
SetVisibleWidth(sal_uInt16 nPos,SwTwips nNewWidth)1377cdf0e10cSrcweir void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
1378cdf0e10cSrcweir {
1379cdf0e10cSrcweir 	sal_uInt16 i=0;
1380cdf0e10cSrcweir 	while( nPos )
1381cdf0e10cSrcweir 	{
1382cdf0e10cSrcweir 		if(pTblData->GetColumns()[i].bVisible && nPos)
1383cdf0e10cSrcweir 			nPos--;
1384cdf0e10cSrcweir 		i++;
1385cdf0e10cSrcweir 	}
1386cdf0e10cSrcweir 	DBG_ASSERT(i < nNoOfCols, "Array index out of range");
1387cdf0e10cSrcweir 	pTblData->GetColumns()[i].nWidth = nNewWidth;
1388cdf0e10cSrcweir 	while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1389cdf0e10cSrcweir 		pTblData->GetColumns()[++i].nWidth = 0;
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir }
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir /*------------------------------------------------------------------------
1394cdf0e10cSrcweir ------------------------------------------------------------------------*/
SwTableTabDlg(Window * pParent,SfxItemPool &,const SfxItemSet * pItemSet,SwWrtShell * pSh)1395cdf0e10cSrcweir SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool& ,
1396cdf0e10cSrcweir 					const SfxItemSet* pItemSet, SwWrtShell* pSh ) :
1397cdf0e10cSrcweir 		SfxTabDialog(pParent, SW_RES(DLG_FORMAT_TABLE), pItemSet,0),
1398cdf0e10cSrcweir         pShell(pSh),
1399cdf0e10cSrcweir         nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
1400cdf0e10cSrcweir {
1401cdf0e10cSrcweir 	FreeResource();
1402cdf0e10cSrcweir     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1403cdf0e10cSrcweir     DBG_ASSERT(pFact, "Dialogdiet fail!");
1404cdf0e10cSrcweir 	AddTabPage(TP_FORMAT_TABLE, &SwFormatTablePage::Create, 0 );
1405cdf0e10cSrcweir 	AddTabPage(TP_TABLE_TEXTFLOW, &SwTextFlowPage::Create, 0 );
1406cdf0e10cSrcweir 	AddTabPage(TP_TABLE_COLUMN, &SwTableColumnPage::Create, 0 );
1407cdf0e10cSrcweir     AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
1408cdf0e10cSrcweir     AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
1409cdf0e10cSrcweir }
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir 
1412cdf0e10cSrcweir /*------------------------------------------------------------------------
1413cdf0e10cSrcweir ------------------------------------------------------------------------*/
PageCreated(sal_uInt16 nId,SfxTabPage & rPage)1414cdf0e10cSrcweir void  SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1417cdf0e10cSrcweir 	if( TP_BACKGROUND == nId )
1418cdf0e10cSrcweir 	{
1419cdf0e10cSrcweir         sal_Int32 nFlagType = SVX_SHOW_TBLCTL;
1420cdf0e10cSrcweir         if(!( nHtmlMode & HTMLMODE_ON ) ||
1421cdf0e10cSrcweir 			nHtmlMode & HTMLMODE_SOME_STYLES)
1422cdf0e10cSrcweir             nFlagType |= SVX_SHOW_SELECTOR;
1423cdf0e10cSrcweir         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
1424cdf0e10cSrcweir 		rPage.PageCreated(aSet);
1425cdf0e10cSrcweir 	}
1426cdf0e10cSrcweir 	else if(TP_BORDER == nId)
1427cdf0e10cSrcweir 	{
1428cdf0e10cSrcweir 		aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_TABLE));
1429cdf0e10cSrcweir 		rPage.PageCreated(aSet);
1430cdf0e10cSrcweir 	}
1431cdf0e10cSrcweir 	else if(TP_TABLE_TEXTFLOW == nId)
1432cdf0e10cSrcweir 	{
1433cdf0e10cSrcweir 		((SwTextFlowPage&)rPage).SetShell(pShell);
1434cdf0e10cSrcweir 		const sal_uInt16 eType = pShell->GetFrmType(0,sal_True);
1435cdf0e10cSrcweir 		if( !(FRMTYPE_BODY & eType) )
1436cdf0e10cSrcweir 			((SwTextFlowPage&)rPage).DisablePageBreak();
1437cdf0e10cSrcweir 	}
1438cdf0e10cSrcweir }
1439cdf0e10cSrcweir 
1440cdf0e10cSrcweir /*-----------------12.12.96 12.22-------------------
1441cdf0e10cSrcweir --------------------------------------------------*/
SwTextFlowPage(Window * pParent,const SfxItemSet & rSet)1442cdf0e10cSrcweir SwTextFlowPage::SwTextFlowPage( Window* pParent,
1443cdf0e10cSrcweir 								const SfxItemSet& rSet ) :
1444cdf0e10cSrcweir 	SfxTabPage(pParent, SW_RES( TP_TABLE_TEXTFLOW ), rSet ),
1445cdf0e10cSrcweir     aFlowFL         (this, SW_RES(FL_FLOW            )),
1446cdf0e10cSrcweir 	aPgBrkCB        (this, SW_RES(CB_PAGEBREAK      )),
1447cdf0e10cSrcweir 	aPgBrkRB        (this, SW_RES(RB_BREAKPAGE      )),
1448cdf0e10cSrcweir 	aColBrkRB       (this, SW_RES(RB_BREAKCOLUMN    )),
1449cdf0e10cSrcweir 	aPgBrkBeforeRB  (this, SW_RES(RB_PAGEBREAKBEFORE)),
1450cdf0e10cSrcweir 	aPgBrkAfterRB   (this, SW_RES(RB_PAGEBREAKAFTER )),
1451cdf0e10cSrcweir 	aPageCollCB     (this, SW_RES(CB_PAGECOLL       )),
1452cdf0e10cSrcweir 	aPageCollLB     (this, SW_RES(LB_PAGECOLL       )),
1453cdf0e10cSrcweir 	aPageNoFT       (this, SW_RES(FT_PAGENUM        )),
1454cdf0e10cSrcweir 	aPageNoNF       (this, SW_RES(NF_PAGENUM        )),
1455cdf0e10cSrcweir     aSplitCB        (this, SW_RES(CB_SPLIT          )),
1456cdf0e10cSrcweir     aSplitRowCB     (this, SW_RES(CB_SPLIT_ROW      )),
1457cdf0e10cSrcweir 	aKeepCB			(this, SW_RES(CB_KEEP			)),
1458cdf0e10cSrcweir     aHeadLineCB     (this, SW_RES(CB_HEADLINE       )),
1459cdf0e10cSrcweir     aRepeatHeaderFT         (this, SW_RES(FT_REPEAT_HEADER  )),
1460cdf0e10cSrcweir     aRepeatHeaderBeforeFT   (this),
1461cdf0e10cSrcweir     aRepeatHeaderNF         (this, SW_RES(NF_REPEAT_HEADER  )),
1462cdf0e10cSrcweir     aRepeatHeaderAfterFT    (this),
1463cdf0e10cSrcweir     aRepeatHeaderCombo      (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
1464cdf0e10cSrcweir     aTextDirectionFT(this, SW_RES(FT_TEXTDIRECTION  )),
1465cdf0e10cSrcweir     aTextDirectionLB(this, SW_RES(LB_TEXTDIRECTION  )),
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir     aVertOrientFL   (this, SW_RES(FL_VERT_ORIENT    )),
1468cdf0e10cSrcweir     aVertOrientFT(this,  SW_RES(FT_VERTORIENT       )),
1469cdf0e10cSrcweir     aVertOrientLB(this,  SW_RES(LB_VERTORIENT       )),
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir     pShell(0),
1472cdf0e10cSrcweir 
1473cdf0e10cSrcweir 	bPageBreak(sal_True),
1474cdf0e10cSrcweir 	bHtmlMode(sal_False)
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir 	FreeResource();
1477cdf0e10cSrcweir 
1478cdf0e10cSrcweir 	aPgBrkRB.SetAccessibleRelationMemberOf(&aPgBrkCB);
1479cdf0e10cSrcweir 	aColBrkRB.SetAccessibleRelationMemberOf(&aPgBrkCB);
1480cdf0e10cSrcweir 	aPgBrkBeforeRB.SetAccessibleRelationMemberOf(&aPgBrkCB);
1481cdf0e10cSrcweir 	aPgBrkAfterRB.SetAccessibleRelationMemberOf(&aPgBrkCB);
1482cdf0e10cSrcweir 	aPageCollLB.SetAccessibleRelationLabeledBy(&aPageCollCB);
1483cdf0e10cSrcweir 	aPageCollLB.SetAccessibleName(aPageCollCB.GetText());
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir 	aPgBrkCB.SetClickHdl(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
1486cdf0e10cSrcweir 	aPgBrkBeforeRB.SetClickHdl(
1487cdf0e10cSrcweir 		LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
1488cdf0e10cSrcweir 	aPgBrkAfterRB.SetClickHdl(
1489cdf0e10cSrcweir 		LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
1490cdf0e10cSrcweir 	aPageCollCB.SetClickHdl(
1491cdf0e10cSrcweir 		LINK( this, SwTextFlowPage, ApplyCollClickHdl_Impl ) );
1492cdf0e10cSrcweir 	aColBrkRB.SetClickHdl(
1493cdf0e10cSrcweir 		LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
1494cdf0e10cSrcweir 	aPgBrkRB.SetClickHdl(
1495cdf0e10cSrcweir 		LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
1496cdf0e10cSrcweir     aSplitCB.SetClickHdl(
1497cdf0e10cSrcweir         LINK( this, SwTextFlowPage, SplitHdl_Impl));
1498cdf0e10cSrcweir     aSplitRowCB.SetClickHdl(
1499cdf0e10cSrcweir         LINK( this, SwTextFlowPage, SplitRowHdl_Impl));
1500cdf0e10cSrcweir 	aHeadLineCB.SetClickHdl( LINK( this, SwTextFlowPage, HeadLineCBClickHdl ) );
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir #ifndef SW_FILEFORMAT_40
1503cdf0e10cSrcweir 	const SfxPoolItem *pItem;
1504cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False,&pItem )
1505cdf0e10cSrcweir 		&& ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
1506cdf0e10cSrcweir #endif
1507cdf0e10cSrcweir 	{
1508cdf0e10cSrcweir 		aKeepCB.Hide();
1509cdf0e10cSrcweir 		aSplitCB.Hide();
1510cdf0e10cSrcweir         aSplitRowCB.Hide();
1511cdf0e10cSrcweir 	}
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir 	aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
1514cdf0e10cSrcweir 
1515cdf0e10cSrcweir 	HeadLineCBClickHdl();
1516cdf0e10cSrcweir }
1517cdf0e10cSrcweir 
1518cdf0e10cSrcweir /*-----------------12.12.96 12.22-------------------
1519cdf0e10cSrcweir --------------------------------------------------*/
~SwTextFlowPage()1520cdf0e10cSrcweir  SwTextFlowPage::~SwTextFlowPage()
1521cdf0e10cSrcweir {
1522cdf0e10cSrcweir }
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir /*-----------------12.12.96 12.22-------------------
1525cdf0e10cSrcweir --------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rAttrSet)1526cdf0e10cSrcweir SfxTabPage*   SwTextFlowPage::Create( Window* pParent,
1527cdf0e10cSrcweir 								const SfxItemSet& rAttrSet)
1528cdf0e10cSrcweir {
1529cdf0e10cSrcweir 	return new SwTextFlowPage(pParent, rAttrSet);
1530cdf0e10cSrcweir }
1531cdf0e10cSrcweir 
1532cdf0e10cSrcweir /*-----------------12.12.96 12.22-------------------
1533cdf0e10cSrcweir --------------------------------------------------*/
FillItemSet(SfxItemSet & rSet)1534cdf0e10cSrcweir sal_Bool  SwTextFlowPage::FillItemSet( SfxItemSet& rSet )
1535cdf0e10cSrcweir {
1536cdf0e10cSrcweir 	sal_Bool bModified = sal_False;
1537cdf0e10cSrcweir 
1538cdf0e10cSrcweir 	//Ueberschrift wiederholen
1539cdf0e10cSrcweir 	if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() ||
1540cdf0e10cSrcweir         String::CreateFromInt32( static_cast< sal_Int32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() )
1541cdf0e10cSrcweir 	{
1542cdf0e10cSrcweir 		bModified |= 0 != rSet.Put(
1543cdf0e10cSrcweir 			SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, aHeadLineCB.IsChecked()? sal_uInt16(aRepeatHeaderNF.GetValue()) : 0 ));
1544cdf0e10cSrcweir 	}
1545cdf0e10cSrcweir 	if(aKeepCB.IsChecked() != aKeepCB.GetSavedValue())
1546cdf0e10cSrcweir         bModified |= 0 != rSet.Put( SvxFmtKeepItem( aKeepCB.IsChecked(), RES_KEEP));
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir 	if(aSplitCB.IsChecked() != aSplitCB.GetSavedValue())
1549cdf0e10cSrcweir         bModified |= 0 != rSet.Put( SwFmtLayoutSplit( aSplitCB.IsChecked()));
1550cdf0e10cSrcweir 
1551cdf0e10cSrcweir     if(aSplitRowCB.IsChecked() != aSplitRowCB.GetSavedValue())
1552cdf0e10cSrcweir         bModified |= 0 != rSet.Put( SwFmtRowSplit( aSplitRowCB.IsChecked()));
1553cdf0e10cSrcweir 
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir 	const SvxFmtBreakItem* pBreak = (const SvxFmtBreakItem*)GetOldItem( rSet, RES_BREAK );
1556cdf0e10cSrcweir 	const SwFmtPageDesc* pDesc = (const SwFmtPageDesc*) GetOldItem( rSet, RES_PAGEDESC );
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir 	sal_Bool bState = aPageCollCB.IsChecked();
1560cdf0e10cSrcweir 
1561cdf0e10cSrcweir 	//Wenn Seitenvorlage, dann kein Break
1562cdf0e10cSrcweir 	sal_Bool bPageItemPut = sal_False;
1563cdf0e10cSrcweir 	if ( bState != aPageCollCB.GetSavedValue() ||
1564cdf0e10cSrcweir 		 ( bState &&
1565cdf0e10cSrcweir 		   aPageCollLB.GetSelectEntryPos() != aPageCollLB.GetSavedValue() )
1566cdf0e10cSrcweir 		   || (aPageNoNF.IsEnabled() && aPageNoNF.IsValueModified()) )
1567cdf0e10cSrcweir 	{
1568cdf0e10cSrcweir 		String sPage;
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir 		if ( bState )
1571cdf0e10cSrcweir 		{
1572cdf0e10cSrcweir 			sPage = aPageCollLB.GetSelectEntry();
1573cdf0e10cSrcweir 		}
1574cdf0e10cSrcweir         sal_uInt16 nPgNum = static_cast< sal_uInt16 >(aPageNoNF.GetValue());
1575cdf0e10cSrcweir 		if ( !pDesc || !pDesc->GetPageDesc() ||
1576cdf0e10cSrcweir 			( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) ||
1577cdf0e10cSrcweir 					aPageNoNF.GetSavedValue() != (String)nPgNum)))
1578cdf0e10cSrcweir 		{
1579cdf0e10cSrcweir 			SwFmtPageDesc aFmt( pShell->FindPageDescByName( sPage, sal_True ) );
1580cdf0e10cSrcweir 			aFmt.SetNumOffset(bState ? nPgNum : 0);
1581cdf0e10cSrcweir 			bModified |= 0 != rSet.Put( aFmt );
1582cdf0e10cSrcweir 			bPageItemPut = bState;
1583cdf0e10cSrcweir 		}
1584cdf0e10cSrcweir 	}
1585cdf0e10cSrcweir 	sal_Bool bIsChecked = aPgBrkCB.IsChecked();
1586cdf0e10cSrcweir 	if ( !bPageItemPut &&
1587cdf0e10cSrcweir 		(	bState != aPageCollCB.GetSavedValue() ||
1588cdf0e10cSrcweir 			bIsChecked != aPgBrkCB.GetSavedValue()				||
1589cdf0e10cSrcweir 			aPgBrkBeforeRB.IsChecked() != aPgBrkBeforeRB.GetSavedValue()	||
1590cdf0e10cSrcweir 			aPgBrkRB.IsChecked() != aPgBrkRB.GetSavedValue() ))
1591cdf0e10cSrcweir 	{
1592cdf0e10cSrcweir 		SvxFmtBreakItem aBreak(
1593cdf0e10cSrcweir 			(const SvxFmtBreakItem&)GetItemSet().Get( RES_BREAK ) );
1594cdf0e10cSrcweir 
1595cdf0e10cSrcweir 		if(bIsChecked)
1596cdf0e10cSrcweir 		{
1597cdf0e10cSrcweir 			sal_Bool bBefore = aPgBrkBeforeRB.IsChecked();
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir 			if ( aPgBrkRB.IsChecked() )
1600cdf0e10cSrcweir 			{
1601cdf0e10cSrcweir 				if ( bBefore )
1602cdf0e10cSrcweir 					aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
1603cdf0e10cSrcweir 				else
1604cdf0e10cSrcweir 					aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
1605cdf0e10cSrcweir 			}
1606cdf0e10cSrcweir 			else
1607cdf0e10cSrcweir 			{
1608cdf0e10cSrcweir 				if ( bBefore )
1609cdf0e10cSrcweir 					aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
1610cdf0e10cSrcweir 				else
1611cdf0e10cSrcweir 					aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
1612cdf0e10cSrcweir 			}
1613cdf0e10cSrcweir 		}
1614cdf0e10cSrcweir 		else
1615cdf0e10cSrcweir 		{
1616cdf0e10cSrcweir 				aBreak.SetValue( SVX_BREAK_NONE );
1617cdf0e10cSrcweir 		}
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir 		if ( !pBreak || !( *(const SvxFmtBreakItem*)pBreak == aBreak ) )
1620cdf0e10cSrcweir 		{
1621cdf0e10cSrcweir 			bModified |= 0 != rSet.Put( aBreak );
1622cdf0e10cSrcweir 		}
1623cdf0e10cSrcweir 	}
1624cdf0e10cSrcweir 
1625cdf0e10cSrcweir     if(aTextDirectionLB.GetSelectEntryPos() != aTextDirectionLB.GetSavedValue())
1626cdf0e10cSrcweir     {
1627cdf0e10cSrcweir           bModified |= 0 != rSet.Put(
1628cdf0e10cSrcweir                     SvxFrameDirectionItem(
1629cdf0e10cSrcweir                         (SvxFrameDirection)(sal_uLong)aTextDirectionLB.GetEntryData(aTextDirectionLB.GetSelectEntryPos())
1630cdf0e10cSrcweir                         , FN_TABLE_BOX_TEXTDIRECTION));
1631cdf0e10cSrcweir     }
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir     if(aVertOrientLB.GetSelectEntryPos() != aVertOrientLB.GetSavedValue())
1634cdf0e10cSrcweir     {
1635cdf0e10cSrcweir         sal_uInt16 nOrient = USHRT_MAX;
1636cdf0e10cSrcweir         switch(aVertOrientLB.GetSelectEntryPos())
1637cdf0e10cSrcweir         {
1638cdf0e10cSrcweir             case 0 : nOrient = text::VertOrientation::NONE; break;
1639cdf0e10cSrcweir             case 1 : nOrient = text::VertOrientation::CENTER; break;
1640cdf0e10cSrcweir             case 2 : nOrient = text::VertOrientation::BOTTOM; break;
1641cdf0e10cSrcweir         }
1642cdf0e10cSrcweir         if(nOrient != USHRT_MAX)
1643cdf0e10cSrcweir             bModified |= 0 != rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
1644cdf0e10cSrcweir     }
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir 	return bModified;
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir }
1649cdf0e10cSrcweir 
1650cdf0e10cSrcweir /*-----------------12.12.96 12.22-------------------
1651cdf0e10cSrcweir --------------------------------------------------*/
Reset(const SfxItemSet & rSet)1652cdf0e10cSrcweir void   SwTextFlowPage::Reset( const SfxItemSet& rSet )
1653cdf0e10cSrcweir {
1654cdf0e10cSrcweir 	const SfxPoolItem* pItem;
1655cdf0e10cSrcweir 	SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
1656cdf0e10cSrcweir 	sal_Bool bFlowAllowed = !bHtmlMode || pHtmlOpt->IsPrintLayoutExtension();
1657cdf0e10cSrcweir 	if(bFlowAllowed)
1658cdf0e10cSrcweir 	{
1659cdf0e10cSrcweir 		// Einfuegen der vorhandenen Seitenvorlagen in die Listbox
1660cdf0e10cSrcweir 		const sal_uInt16 nCount = pShell->GetPageDescCnt();
1661cdf0e10cSrcweir 		sal_uInt16 i;
1662cdf0e10cSrcweir 
1663cdf0e10cSrcweir 		for( i = 0; i < nCount; ++i)
1664cdf0e10cSrcweir 		{
1665cdf0e10cSrcweir 			const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
1666cdf0e10cSrcweir 			aPageCollLB.InsertEntry(rPageDesc.GetName());
1667cdf0e10cSrcweir 		}
1668cdf0e10cSrcweir 
1669cdf0e10cSrcweir 		String aFmtName;
1670cdf0e10cSrcweir 		for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
1671cdf0e10cSrcweir 			if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos(
1672cdf0e10cSrcweir 					aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) ))
1673cdf0e10cSrcweir 				aPageCollLB.InsertEntry( aFmtName );
1674cdf0e10cSrcweir 
1675cdf0e10cSrcweir 		if(SFX_ITEM_SET == rSet.GetItemState( RES_KEEP, sal_False, &pItem ))
1676cdf0e10cSrcweir 		{
1677cdf0e10cSrcweir 			aKeepCB.Check( ((const SvxFmtKeepItem*)pItem)->GetValue() );
1678cdf0e10cSrcweir 			aKeepCB.SaveValue();
1679cdf0e10cSrcweir 		}
1680cdf0e10cSrcweir 		if(SFX_ITEM_SET == rSet.GetItemState( RES_LAYOUT_SPLIT, sal_False, &pItem ))
1681cdf0e10cSrcweir 		{
1682cdf0e10cSrcweir             aSplitCB.Check( ((const SwFmtLayoutSplit*)pItem)->GetValue() );
1683cdf0e10cSrcweir 		}
1684cdf0e10cSrcweir         else
1685cdf0e10cSrcweir             aSplitCB.Check();
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir 	    aSplitCB.SaveValue();
1688cdf0e10cSrcweir         SplitHdl_Impl(&aSplitCB);
1689cdf0e10cSrcweir 
1690cdf0e10cSrcweir         if(SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, sal_False, &pItem ))
1691cdf0e10cSrcweir         {
1692cdf0e10cSrcweir             aSplitRowCB.Check( ((const SwFmtRowSplit*)pItem)->GetValue() );
1693cdf0e10cSrcweir         }
1694cdf0e10cSrcweir         else
1695cdf0e10cSrcweir             aSplitRowCB.SetState(STATE_DONTKNOW);
1696cdf0e10cSrcweir         aSplitRowCB.SaveValue();
1697cdf0e10cSrcweir 
1698cdf0e10cSrcweir         if(bPageBreak)
1699cdf0e10cSrcweir 		{
1700cdf0e10cSrcweir 			if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_False, &pItem ))
1701cdf0e10cSrcweir 			{
1702cdf0e10cSrcweir 				String sPageDesc;
1703cdf0e10cSrcweir 				const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
1704cdf0e10cSrcweir 				aPageNoNF.SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset());
1705cdf0e10cSrcweir 				if(pDesc)
1706cdf0e10cSrcweir 					sPageDesc = pDesc->GetName();
1707cdf0e10cSrcweir 				if ( sPageDesc.Len() &&
1708cdf0e10cSrcweir 						aPageCollLB.GetEntryPos( sPageDesc ) != LISTBOX_ENTRY_NOTFOUND )
1709cdf0e10cSrcweir 				{
1710cdf0e10cSrcweir 					aPageCollLB.SelectEntry( sPageDesc );
1711cdf0e10cSrcweir 					aPageCollCB.Check();
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir 					aPgBrkCB.Enable();
1714cdf0e10cSrcweir 					aPgBrkRB.Enable();
1715cdf0e10cSrcweir 					aColBrkRB.Enable();
1716cdf0e10cSrcweir 					aPgBrkBeforeRB.Enable();
1717cdf0e10cSrcweir 					aPgBrkAfterRB.Enable();
1718cdf0e10cSrcweir 					aPageCollCB.Enable();
1719cdf0e10cSrcweir 					aPgBrkCB.Check();
1720cdf0e10cSrcweir 
1721cdf0e10cSrcweir 					aPgBrkCB.Check( sal_True );
1722cdf0e10cSrcweir 					aColBrkRB.Check( sal_False );
1723cdf0e10cSrcweir 					aPgBrkBeforeRB.Check( sal_True );
1724cdf0e10cSrcweir 					aPgBrkAfterRB.Check( sal_False );
1725cdf0e10cSrcweir 				}
1726cdf0e10cSrcweir 				else
1727cdf0e10cSrcweir 				{
1728cdf0e10cSrcweir 					aPageCollLB.SetNoSelection();
1729cdf0e10cSrcweir 					aPageCollCB.Check(sal_False);
1730cdf0e10cSrcweir 				}
1731cdf0e10cSrcweir 			}
1732cdf0e10cSrcweir 
1733cdf0e10cSrcweir 			if(SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, sal_False, &pItem ))
1734cdf0e10cSrcweir 			{
1735cdf0e10cSrcweir 				const SvxFmtBreakItem* pPageBreak = (const SvxFmtBreakItem*)pItem;
1736cdf0e10cSrcweir 				SvxBreak eBreak = (SvxBreak)pPageBreak->GetValue();
1737cdf0e10cSrcweir 
1738cdf0e10cSrcweir 				if ( eBreak != SVX_BREAK_NONE )
1739cdf0e10cSrcweir 				{
1740cdf0e10cSrcweir 					aPgBrkCB.Check();
1741cdf0e10cSrcweir 					aPageCollCB.Enable(sal_False);
1742cdf0e10cSrcweir 					aPageCollLB.Enable(sal_False);
1743cdf0e10cSrcweir 					aPageNoFT.Enable(sal_False);
1744cdf0e10cSrcweir 					aPageNoNF.Enable(sal_False);
1745cdf0e10cSrcweir 				}
1746cdf0e10cSrcweir 				switch ( eBreak )
1747cdf0e10cSrcweir 				{
1748cdf0e10cSrcweir 					case SVX_BREAK_PAGE_BEFORE:
1749cdf0e10cSrcweir 						aPgBrkRB.Check( sal_True );
1750cdf0e10cSrcweir 						aColBrkRB.Check( sal_False );
1751cdf0e10cSrcweir 						aPgBrkBeforeRB.Check( sal_True );
1752cdf0e10cSrcweir 						aPgBrkAfterRB.Check( sal_False );
1753cdf0e10cSrcweir 						break;
1754cdf0e10cSrcweir 					case SVX_BREAK_PAGE_AFTER:
1755cdf0e10cSrcweir 						aPgBrkRB.Check( sal_True );
1756cdf0e10cSrcweir 						aColBrkRB.Check( sal_False );
1757cdf0e10cSrcweir 						aPgBrkBeforeRB.Check( sal_False );
1758cdf0e10cSrcweir 						aPgBrkAfterRB.Check( sal_True );
1759cdf0e10cSrcweir 						break;
1760cdf0e10cSrcweir 					case SVX_BREAK_COLUMN_BEFORE:
1761cdf0e10cSrcweir 						aPgBrkRB.Check( sal_False );
1762cdf0e10cSrcweir 						aColBrkRB.Check( sal_True );
1763cdf0e10cSrcweir 						aPgBrkBeforeRB.Check( sal_True );
1764cdf0e10cSrcweir 						aPgBrkAfterRB.Check( sal_False );
1765cdf0e10cSrcweir 						break;
1766cdf0e10cSrcweir 					case SVX_BREAK_COLUMN_AFTER:
1767cdf0e10cSrcweir 						aPgBrkRB.Check( sal_False );
1768cdf0e10cSrcweir 						aColBrkRB.Check( sal_True );
1769cdf0e10cSrcweir 						aPgBrkBeforeRB.Check( sal_False );
1770cdf0e10cSrcweir 						aPgBrkAfterRB.Check( sal_True );
1771cdf0e10cSrcweir 						break;
1772cdf0e10cSrcweir                     default:; //prevent warning
1773cdf0e10cSrcweir 				}
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir 			}
1776cdf0e10cSrcweir 			if ( aPgBrkBeforeRB.IsChecked() )
1777cdf0e10cSrcweir 				PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
1778cdf0e10cSrcweir 			else if ( aPgBrkAfterRB.IsChecked() )
1779cdf0e10cSrcweir 				PageBreakPosHdl_Impl( &aPgBrkAfterRB );
1780cdf0e10cSrcweir 			PageBreakHdl_Impl( &aPgBrkCB );
1781cdf0e10cSrcweir 		}
1782cdf0e10cSrcweir 	}
1783cdf0e10cSrcweir 	else
1784cdf0e10cSrcweir 	{
1785cdf0e10cSrcweir 		aPgBrkRB.Enable(sal_False);
1786cdf0e10cSrcweir 		aColBrkRB.Enable(sal_False);
1787cdf0e10cSrcweir 		aPgBrkBeforeRB.Enable(sal_False);
1788cdf0e10cSrcweir 		aPgBrkAfterRB.Enable(sal_False);
1789cdf0e10cSrcweir 		aKeepCB	.Enable(sal_False);
1790cdf0e10cSrcweir 		aSplitCB.Enable(sal_False);
1791cdf0e10cSrcweir 		aPgBrkCB.Enable(sal_False);
1792cdf0e10cSrcweir 		aPageCollCB.Enable(sal_False);
1793cdf0e10cSrcweir 		aPageCollLB.Enable(sal_False);
1794cdf0e10cSrcweir 	}
1795cdf0e10cSrcweir 
1796cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, sal_False, &pItem ))
1797cdf0e10cSrcweir 	{
1798cdf0e10cSrcweir 		sal_uInt16 nRep = ((const SfxUInt16Item*)pItem)->GetValue();
1799cdf0e10cSrcweir 		aHeadLineCB.Check( nRep > 0 );
1800cdf0e10cSrcweir 		aHeadLineCB.SaveValue();
1801cdf0e10cSrcweir 		aRepeatHeaderNF.SetValue( nRep );
1802cdf0e10cSrcweir 		aRepeatHeaderNF.SaveValue();
1803cdf0e10cSrcweir 	}
1804cdf0e10cSrcweir     if ( rSet.GetItemState(FN_TABLE_BOX_TEXTDIRECTION) > SFX_ITEM_AVAILABLE )
1805cdf0e10cSrcweir     {
1806cdf0e10cSrcweir         sal_uLong nDirection = ((const SvxFrameDirectionItem&)rSet.Get(FN_TABLE_BOX_TEXTDIRECTION)).GetValue();
1807cdf0e10cSrcweir         aTextDirectionLB.SelectEntryPos(aTextDirectionLB.GetEntryPos( (const void*)nDirection ));
1808cdf0e10cSrcweir     }
1809cdf0e10cSrcweir 
1810cdf0e10cSrcweir     if ( rSet.GetItemState(FN_TABLE_SET_VERT_ALIGN) > SFX_ITEM_AVAILABLE )
1811cdf0e10cSrcweir 	{
1812cdf0e10cSrcweir 		sal_uInt16 nVert = ((const SfxUInt16Item&)rSet.Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
1813cdf0e10cSrcweir         sal_uInt16 nPos = 0;
1814cdf0e10cSrcweir 		switch(nVert)
1815cdf0e10cSrcweir 		{
1816cdf0e10cSrcweir             case text::VertOrientation::NONE:     nPos = 0;   break;
1817cdf0e10cSrcweir             case text::VertOrientation::CENTER:   nPos = 1;   break;
1818cdf0e10cSrcweir             case text::VertOrientation::BOTTOM:   nPos = 2;   break;
1819cdf0e10cSrcweir 		}
1820cdf0e10cSrcweir         aVertOrientLB.SelectEntryPos(nPos);
1821cdf0e10cSrcweir 	}
1822cdf0e10cSrcweir 
1823cdf0e10cSrcweir 	aPageCollCB.SaveValue();
1824cdf0e10cSrcweir 	aPageCollLB.SaveValue();
1825cdf0e10cSrcweir 	aPgBrkCB.SaveValue();
1826cdf0e10cSrcweir 	aPgBrkRB.SaveValue();
1827cdf0e10cSrcweir 	aColBrkRB.SaveValue();
1828cdf0e10cSrcweir 	aPgBrkBeforeRB.SaveValue();
1829cdf0e10cSrcweir 	aPgBrkAfterRB.SaveValue();
1830cdf0e10cSrcweir 	aPageNoNF.SaveValue();
1831cdf0e10cSrcweir     aTextDirectionLB.SaveValue();
1832cdf0e10cSrcweir     aVertOrientLB.SaveValue();
1833cdf0e10cSrcweir 
1834cdf0e10cSrcweir 	HeadLineCBClickHdl();
1835cdf0e10cSrcweir }
1836cdf0e10cSrcweir /*-----------------16.04.98 14:48-------------------
1837cdf0e10cSrcweir 
1838cdf0e10cSrcweir --------------------------------------------------*/
1839cdf0e10cSrcweir 
SetShell(SwWrtShell * pSh)1840cdf0e10cSrcweir void SwTextFlowPage::SetShell(SwWrtShell* pSh)
1841cdf0e10cSrcweir {
1842cdf0e10cSrcweir 	pShell = pSh;
1843cdf0e10cSrcweir 	bHtmlMode = 0 != (::GetHtmlMode(pShell->GetView().GetDocShell()) & HTMLMODE_ON);
1844cdf0e10cSrcweir 	if(bHtmlMode)
1845cdf0e10cSrcweir 	{
1846cdf0e10cSrcweir 		aPageNoNF.Enable(sal_False);
1847cdf0e10cSrcweir 		aPageNoFT.Enable(sal_False);
1848cdf0e10cSrcweir 	}
1849cdf0e10cSrcweir }
1850cdf0e10cSrcweir 
1851cdf0e10cSrcweir /*-----------------12.12.96 16.18-------------------
1852cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,PageBreakHdl_Impl,CheckBox *,EMPTYARG)1853cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakHdl_Impl, CheckBox*, EMPTYARG )
1854cdf0e10cSrcweir {
1855cdf0e10cSrcweir 	if( aPgBrkCB.IsChecked() )
1856cdf0e10cSrcweir 	{
1857cdf0e10cSrcweir 			aPgBrkRB.		Enable();
1858cdf0e10cSrcweir 			aColBrkRB.		Enable();
1859cdf0e10cSrcweir 			aPgBrkBeforeRB.	Enable();
1860cdf0e10cSrcweir 			aPgBrkAfterRB.	Enable();
1861cdf0e10cSrcweir 
1862cdf0e10cSrcweir 			if ( aPgBrkRB.IsChecked() && aPgBrkBeforeRB.IsChecked() )
1863cdf0e10cSrcweir 			{
1864cdf0e10cSrcweir 				aPageCollCB.Enable();
1865cdf0e10cSrcweir 
1866cdf0e10cSrcweir 				sal_Bool bEnable = aPageCollCB.IsChecked() &&
1867cdf0e10cSrcweir 											aPageCollLB.GetEntryCount();
1868cdf0e10cSrcweir 				aPageCollLB.Enable(bEnable);
1869cdf0e10cSrcweir 				if(!bHtmlMode)
1870cdf0e10cSrcweir 				{
1871cdf0e10cSrcweir 					aPageNoFT.Enable(bEnable);
1872cdf0e10cSrcweir 					aPageNoNF.Enable(bEnable);
1873cdf0e10cSrcweir 				}
1874cdf0e10cSrcweir 			}
1875cdf0e10cSrcweir 	}
1876cdf0e10cSrcweir 	else
1877cdf0e10cSrcweir 	{
1878cdf0e10cSrcweir 			aPageCollCB.Check( sal_False );
1879cdf0e10cSrcweir 			aPageCollCB.Enable(sal_False);
1880cdf0e10cSrcweir 			aPageCollLB.Enable(sal_False);
1881cdf0e10cSrcweir 			aPageNoFT.Enable(sal_False);
1882cdf0e10cSrcweir 			aPageNoNF.Enable(sal_False);
1883cdf0e10cSrcweir 			aPgBrkRB.		Enable(sal_False);
1884cdf0e10cSrcweir 			aColBrkRB.		Enable(sal_False);
1885cdf0e10cSrcweir 			aPgBrkBeforeRB.	Enable(sal_False);
1886cdf0e10cSrcweir 			aPgBrkAfterRB.	Enable(sal_False);
1887cdf0e10cSrcweir 	}
1888cdf0e10cSrcweir 	return 0;
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir 
1891cdf0e10cSrcweir /*-----------------12.12.96 16.18-------------------
1892cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,ApplyCollClickHdl_Impl,CheckBox *,EMPTYARG)1893cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, ApplyCollClickHdl_Impl, CheckBox*, EMPTYARG )
1894cdf0e10cSrcweir {
1895cdf0e10cSrcweir 	sal_Bool bEnable = sal_False;
1896cdf0e10cSrcweir 	if ( aPageCollCB.IsChecked() &&
1897cdf0e10cSrcweir 		 aPageCollLB.GetEntryCount() )
1898cdf0e10cSrcweir 	{
1899cdf0e10cSrcweir 		bEnable = sal_True;
1900cdf0e10cSrcweir 		aPageCollLB.SelectEntryPos( 0 );
1901cdf0e10cSrcweir 	}
1902cdf0e10cSrcweir 	else
1903cdf0e10cSrcweir 	{
1904cdf0e10cSrcweir 		aPageCollLB.SetNoSelection();
1905cdf0e10cSrcweir 	}
1906cdf0e10cSrcweir 	aPageCollLB.Enable(bEnable);
1907cdf0e10cSrcweir 	if(!bHtmlMode)
1908cdf0e10cSrcweir 	{
1909cdf0e10cSrcweir 		aPageNoFT.Enable(bEnable);
1910cdf0e10cSrcweir 		aPageNoNF.Enable(bEnable);
1911cdf0e10cSrcweir 	}
1912cdf0e10cSrcweir 	return 0;
1913cdf0e10cSrcweir }
1914cdf0e10cSrcweir 
1915cdf0e10cSrcweir /*-----------------12.12.96 16.18-------------------
1916cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,PageBreakPosHdl_Impl,RadioButton *,pBtn)1917cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakPosHdl_Impl, RadioButton*, pBtn )
1918cdf0e10cSrcweir {
1919cdf0e10cSrcweir 	if ( aPgBrkCB.IsChecked() )
1920cdf0e10cSrcweir 	{
1921cdf0e10cSrcweir         if ( pBtn == &aPgBrkBeforeRB && aPgBrkRB.IsChecked() )
1922cdf0e10cSrcweir 		{
1923cdf0e10cSrcweir 			aPageCollCB.Enable();
1924cdf0e10cSrcweir 
1925cdf0e10cSrcweir 			sal_Bool bEnable = aPageCollCB.IsChecked()  &&
1926cdf0e10cSrcweir 										aPageCollLB.GetEntryCount();
1927cdf0e10cSrcweir 
1928cdf0e10cSrcweir 			aPageCollLB.Enable(bEnable);
1929cdf0e10cSrcweir 			if(!bHtmlMode)
1930cdf0e10cSrcweir 			{
1931cdf0e10cSrcweir 				aPageNoFT.Enable(bEnable);
1932cdf0e10cSrcweir 				aPageNoNF.Enable(bEnable);
1933cdf0e10cSrcweir 			}
1934cdf0e10cSrcweir 		}
1935cdf0e10cSrcweir 		else if ( pBtn == &aPgBrkAfterRB )
1936cdf0e10cSrcweir 		{
1937cdf0e10cSrcweir 			aPageCollCB	.Check( sal_False );
1938cdf0e10cSrcweir 			aPageCollCB	.Enable(sal_False);
1939cdf0e10cSrcweir 			aPageCollLB	.Enable(sal_False);
1940cdf0e10cSrcweir 			aPageNoFT 	.Enable(sal_False);
1941cdf0e10cSrcweir 			aPageNoNF	.Enable(sal_False);
1942cdf0e10cSrcweir 		}
1943cdf0e10cSrcweir 	}
1944cdf0e10cSrcweir 	return 0;
1945cdf0e10cSrcweir }
1946cdf0e10cSrcweir 
1947cdf0e10cSrcweir /*-----------------12.12.96 16.18-------------------
1948cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,PageBreakTypeHdl_Impl,RadioButton *,pBtn)1949cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, PageBreakTypeHdl_Impl, RadioButton*, pBtn )
1950cdf0e10cSrcweir {
1951cdf0e10cSrcweir 	if ( pBtn == &aColBrkRB || aPgBrkAfterRB.IsChecked() )
1952cdf0e10cSrcweir 	{
1953cdf0e10cSrcweir 		aPageCollCB	.Check(sal_False);
1954cdf0e10cSrcweir 		aPageCollCB	.Enable(sal_False);
1955cdf0e10cSrcweir 		aPageCollLB	.Enable(sal_False);
1956cdf0e10cSrcweir 		aPageNoFT	.Enable(sal_False);
1957cdf0e10cSrcweir 		aPageNoNF	.Enable(sal_False);
1958cdf0e10cSrcweir 	}
1959cdf0e10cSrcweir 	else if ( aPgBrkBeforeRB.IsChecked() )
1960cdf0e10cSrcweir 		PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
1961cdf0e10cSrcweir 	return 0;
1962cdf0e10cSrcweir }
1963cdf0e10cSrcweir /*-----------------17.11.2003 11:30-----------------
1964cdf0e10cSrcweir  *
1965cdf0e10cSrcweir  * --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,SplitHdl_Impl,CheckBox *,pBox)1966cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, SplitHdl_Impl, CheckBox*, pBox )
1967cdf0e10cSrcweir {
1968cdf0e10cSrcweir     aSplitRowCB.Enable(pBox->IsChecked());
1969cdf0e10cSrcweir     return 0;
1970cdf0e10cSrcweir }
1971cdf0e10cSrcweir /*-----------------17.11.2003 11:30-----------------
1972cdf0e10cSrcweir  *
1973cdf0e10cSrcweir  * --------------------------------------------------*/
IMPL_LINK(SwTextFlowPage,SplitRowHdl_Impl,TriStateBox *,pBox)1974cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, SplitRowHdl_Impl, TriStateBox*, pBox )
1975cdf0e10cSrcweir {
1976cdf0e10cSrcweir     pBox->EnableTriState(sal_False);
1977cdf0e10cSrcweir     return 0;
1978cdf0e10cSrcweir }
1979cdf0e10cSrcweir 
IMPL_LINK(SwTextFlowPage,HeadLineCBClickHdl,void *,EMPTYARG)1980cdf0e10cSrcweir IMPL_LINK( SwTextFlowPage, HeadLineCBClickHdl, void*, EMPTYARG )
1981cdf0e10cSrcweir {
1982cdf0e10cSrcweir 	aRepeatHeaderCombo.Enable(aHeadLineCB.IsChecked());
1983cdf0e10cSrcweir 
1984cdf0e10cSrcweir 	return 0;
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir 
1987cdf0e10cSrcweir /*-----------------30.05.97 07:37-------------------
1988cdf0e10cSrcweir 
1989cdf0e10cSrcweir --------------------------------------------------*/
DisablePageBreak()1990cdf0e10cSrcweir void SwTextFlowPage::DisablePageBreak()
1991cdf0e10cSrcweir {
1992cdf0e10cSrcweir 	bPageBreak = sal_False;
1993cdf0e10cSrcweir 	aPgBrkCB       .Disable();
1994cdf0e10cSrcweir 	aPgBrkRB       .Disable();
1995cdf0e10cSrcweir 	aColBrkRB      .Disable();
1996cdf0e10cSrcweir 	aPgBrkBeforeRB .Disable();
1997cdf0e10cSrcweir 	aPgBrkAfterRB  .Disable();
1998cdf0e10cSrcweir 	aPageCollCB    .Disable();
1999cdf0e10cSrcweir 	aPageCollLB    .Disable();
2000cdf0e10cSrcweir 	aPageNoFT      .Disable();
2001cdf0e10cSrcweir 	aPageNoNF      .Disable();
2002cdf0e10cSrcweir }
2003cdf0e10cSrcweir 
2004cdf0e10cSrcweir 
2005cdf0e10cSrcweir 
2006