Bump version to 4.3-4
[LibreOffice.git] / cui / source / tabpages / tabstpge.cxx
blob32896237893bfc1e13f29597ec3a0f9e3e966112
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/app.hxx>
21 #include <tools/shl.hxx>
22 #include <svtools/ruler.hxx>
23 #include <svx/dialogs.hrc>
24 #include <vcl/settings.hxx>
26 #include <cuires.hrc>
27 #include <editeng/lrspitem.hxx>
28 #include "tabstpge.hxx"
29 #include <dialmgr.hxx>
30 #include "svx/dlgutil.hxx"
31 #include <sfx2/module.hxx>
32 #include <svl/cjkoptions.hxx>
33 #include <unotools/localedatawrapper.hxx>
34 #include <comphelper/processfactory.hxx>
35 #include <sfx2/request.hxx>
36 #include <svl/intitem.hxx>
38 // class TabWin_Impl -----------------------------------------------------
40 class TabWin_Impl : public Window
42 SvxTabulatorTabPage* mpPage;
43 private:
44 sal_uInt16 nTabStyle;
46 public:
48 TabWin_Impl(Window* pParent, WinBits nBits)
49 : Window(pParent, nBits)
50 , mpPage(0)
51 , nTabStyle(0)
55 virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
57 void SetTabulatorTabPage(SvxTabulatorTabPage* pPage) { mpPage = pPage; }
58 void SetTabStyle(sal_uInt16 nStyle) {nTabStyle = nStyle; }
61 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeTabWin_Impl(Window *pParent, VclBuilder::stringmap &)
63 return new TabWin_Impl(pParent, 0);
65 // static ----------------------------------------------------------------
67 static const sal_uInt16 pRanges[] =
69 SID_ATTR_TABSTOP,
70 SID_ATTR_TABSTOP_OFFSET,
74 // C function ------------------------------------------------------------
76 void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs )
78 if( rTabs.Count() )
79 return;
81 SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
82 rTabs.Insert( aSwTabStop );
86 // class TabWin_Impl -----------------------------------------------------
88 void TabWin_Impl::Paint( const Rectangle& )
90 // Paint tabulators
91 Point aPnt;
92 Size aSize = GetOutputSizePixel();
93 aPnt.X() = aSize.Width() / 2;
94 aPnt.Y() = aSize.Height() / 2;
95 Ruler::DrawTab( this, GetSettings().GetStyleSettings().GetFontColor(), aPnt, nTabStyle );
98 // class SvxTabulatorTabPage ---------------------------------------------
100 SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent, const SfxItemSet& rAttr ):
102 SfxTabPage( pParent, "ParagraphTabsPage","cui/ui/paratabspage.ui", rAttr ),
104 aAktTab ( 0 ),
105 aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ),
106 nDefDist ( 0 ),
107 eDefUnit ( FUNIT_100TH_MM ),
108 bCheck ( false )
111 get(m_pTabBox,"ED_TABPOS");
112 //the tab images
113 get(m_pLeftWin,"drawingareaWIN_TABLEFT");
114 get(m_pRightWin,"drawingareaWIN_TABRIGHT");
115 get(m_pCenterWin,"drawingareaWIN_TABCENTER");
116 get(m_pDezWin,"drawingareaWIN_TABDECIMAL");
117 m_pLeftWin->SetTabulatorTabPage(this);
118 m_pRightWin->SetTabulatorTabPage(this);
119 m_pCenterWin->SetTabulatorTabPage(this);
120 m_pDezWin->SetTabulatorTabPage(this);
121 m_pLeftWin->SetTabStyle((sal_uInt16)(RULER_TAB_LEFT|WB_HORZ));
122 m_pRightWin->SetTabStyle((sal_uInt16)(RULER_TAB_RIGHT|WB_HORZ));
123 m_pCenterWin->SetTabStyle((sal_uInt16)(RULER_TAB_CENTER|WB_HORZ));
124 m_pDezWin->SetTabStyle((sal_uInt16)(RULER_TAB_DECIMAL|WB_HORZ));
125 //upper radiobuttons
126 SvtCJKOptions aCJKOptions;
127 get(m_pLeftTab, aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT");
128 get(m_pRightTab, aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT");
129 m_pLeftTab->Show(true);
130 m_pRightTab->Show(true);
131 get(m_pCenterTab,"radiobuttonBTN_TABTYPE_CENTER");
132 get(m_pDezTab,"radiobuttonBTN_TABTYPE_DECIMAL");
133 get(m_pDezChar,"entryED_TABTYPE_DECCHAR");
134 get(m_pDezCharLabel,"labelFT_TABTYPE_DECCHAR");
135 //lower radio buttons
136 get(m_pNoFillChar,"radiobuttonBTN_FILLCHAR_NO");
137 get(m_pFillPoints,"radiobuttonBTN_FILLCHAR_POINTS");
138 get(m_pFillDashLine,"radiobuttonBTN_FILLCHAR_DASHLINE");
139 get(m_pFillSolidLine,"radiobuttonBTN_FILLCHAR_UNDERSCORE");
140 get(m_pFillSpecial,"radiobuttonBTN_FILLCHAR_OTHER");
141 get(m_pFillChar,"entryED_FILLCHAR_OTHER");
142 //button bar
143 get(m_pNewBtn,"buttonBTN_NEW");
144 get(m_pDelAllBtn,"buttonBTN_DELALL");
145 get(m_pDelBtn,"buttonBTN_DEL");
147 get(m_pTypeFrame, "frameFL_TABTYPE");
148 get(m_pFillFrame, "frameFL_FILLCHAR");
150 // This page needs ExchangeSupport
151 SetExchangeSupport();
153 // Set metric
154 FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
155 SetFieldUnit( *m_pTabBox, eFUnit );
157 // Initialize buttons
158 m_pNewBtn->SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) );
159 m_pDelBtn->SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) );
160 m_pDelAllBtn->SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) );
162 Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl );
163 m_pLeftTab->SetClickHdl( aLink );
164 m_pRightTab->SetClickHdl( aLink );
165 m_pDezTab->SetClickHdl( aLink );
166 m_pCenterTab->SetClickHdl( aLink );
168 m_pDezChar->SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetDezCharHdl_Impl ) );
169 m_pDezChar->Disable();
170 m_pDezCharLabel->Disable();
172 aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl );
173 m_pNoFillChar->SetClickHdl( aLink );
174 m_pFillPoints->SetClickHdl( aLink );
175 m_pFillDashLine->SetClickHdl( aLink );
176 m_pFillSolidLine->SetClickHdl( aLink );
177 m_pFillSpecial->SetClickHdl( aLink );
178 m_pFillChar->SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetFillCharHdl_Impl ) );
179 m_pFillChar->Disable();
181 m_pTabBox->SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) );
182 m_pTabBox->SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) );
184 // Get the default decimal char from the system
185 const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
186 aAktTab.GetDecimal() = rLocaleWrapper.getNumDecimalSep()[0];
191 SvxTabulatorTabPage::~SvxTabulatorTabPage()
197 const sal_uInt16* SvxTabulatorTabPage::GetRanges()
199 return pRanges;
204 bool SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet )
206 bool bModified = false;
208 // Put the controls' values in here
209 if ( m_pNewBtn->IsEnabled() )
210 NewHdl_Impl( 0 );
212 // Call the LoseFocus-Handler first
213 GetDezCharHdl_Impl( m_pDezChar );
214 GetFillCharHdl_Impl( m_pFillChar );
216 FillUpWithDefTabs_Impl( nDefDist, aNewTabs );
217 SfxItemPool* pPool = rSet.GetPool();
218 MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
219 const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP );
221 if ( MAP_100TH_MM != eUnit )
223 // If the ItemSet contains a LRSpaceItem with negative first line indent,
224 // the TabStopItem needs to have a DefTab at position 0.
225 const SfxPoolItem* pLRSpace;
226 // If not in the new set, then maybe in the old one
227 if ( SFX_ITEM_SET != rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), true, &pLRSpace ) )
228 pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE );
230 if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 )
232 SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
233 aNewTabs.Insert( aNull );
236 SvxTabStopItem aTmp( aNewTabs );
237 aTmp.Remove( 0, aTmp.Count() );
239 for ( sal_uInt16 i = 0; i < aNewTabs.Count(); ++i )
241 SvxTabStop aTmpStop = aNewTabs[i];
242 aTmpStop.GetTabPos() =
243 LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit );
244 aTmp.Insert( aTmpStop );
247 if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) )
249 rSet.Put( aTmp );
250 bModified = true;
253 else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) )
255 rSet.Put( aNewTabs );
256 bModified = true;
258 return bModified;
263 SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent,
264 const SfxItemSet& rSet)
266 return ( new SvxTabulatorTabPage( pParent, rSet ) );
271 void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet )
273 SfxItemPool* pPool = rSet.GetPool();
274 MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
276 // Current tabs
277 const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP );
279 if ( pItem )
281 if ( MAP_100TH_MM != eUnit )
283 SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) );
284 aNewTabs.Remove( 0, aNewTabs.Count() );
286 for ( sal_uInt16 i = 0; i < aTmp.Count(); ++i )
288 SvxTabStop aTmpStop = aTmp[i];
289 aTmpStop.GetTabPos() = LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM );
290 aNewTabs.Insert( aTmpStop );
293 else
294 aNewTabs = *( (const SvxTabStopItem*)pItem );
296 else
297 aNewTabs.Remove( 0, aNewTabs.Count() );
299 // Defaul tab distance
300 nDefDist = SVX_TAB_DEFDIST;
301 pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS );
303 if ( pItem )
304 nDefDist = LogicToLogic(
305 (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM );
307 // Tab pos currently selected
308 sal_uInt16 nTabPos = 0;
309 pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS );
311 if ( pItem )
312 nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue();
314 InitTabPos_Impl( nTabPos );
319 void SvxTabulatorTabPage::DisableControls( const sal_uInt16 nFlag )
321 if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT )
323 m_pLeftTab->Disable();
324 m_pLeftWin->Disable();
326 if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT )
328 m_pRightTab->Disable();
329 m_pRightWin->Disable();
331 if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER )
333 m_pCenterTab->Disable();
334 m_pCenterWin->Disable();
336 if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL )
338 m_pDezTab->Disable();
339 m_pDezWin->Disable();
340 m_pDezCharLabel->Disable();
341 m_pDezChar->Disable();
343 if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL )
344 m_pTypeFrame->Disable();
345 if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE )
346 m_pNoFillChar->Disable();
347 if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT )
348 m_pFillPoints->Disable();
349 if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE )
350 m_pFillDashLine->Disable();
351 if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE )
352 m_pFillSolidLine->Disable();
353 if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL )
355 m_pFillSpecial->Disable();
356 m_pFillChar->Disable();
358 if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL )
359 m_pFillFrame->Disable();
364 int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
366 if ( _pSet )
367 FillItemSet( *_pSet );
368 return LEAVE_PAGE;
373 void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
375 m_pTabBox->Clear();
377 long nOffset = 0;
378 const SfxPoolItem* pItem = 0;
379 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, true, &pItem )
380 == SFX_ITEM_SET )
382 nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
383 MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
384 nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
387 // Correct current TabPos and default tabs
388 for ( sal_uInt16 i = 0; i < aNewTabs.Count(); i++ )
390 if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT )
392 m_pTabBox->InsertValue( m_pTabBox->Normalize(
393 aNewTabs[i].GetTabPos() + nOffset ), eDefUnit );
395 else
396 aNewTabs.Remove( i-- );
399 // Select current tabulator
400 const sal_uInt16 nSize = aNewTabs.Count();
402 if ( nTabPos >= nSize )
403 nTabPos = 0;
405 // Switch off all RadioButtons for a start
406 m_pLeftTab->Check( true );
407 m_pNoFillChar->Check( true );
409 if( m_pTabBox->GetEntryCount() > 0 )
411 m_pTabBox->SetText( m_pTabBox->GetEntry( nTabPos ) );
412 aAktTab = aNewTabs[nTabPos];
414 SetFillAndTabType_Impl();
415 m_pNewBtn->Disable();
416 m_pDelBtn->Enable();
418 else
419 { // If no entry, 0 is the default value
420 m_pTabBox->SetValue( 0, eDefUnit );
422 m_pNewBtn->Enable();
423 m_pDelBtn->Disable();
429 void SvxTabulatorTabPage::SetFillAndTabType_Impl()
431 RadioButton* pTypeBtn = 0;
432 RadioButton* pFillBtn = 0;
434 m_pDezChar->Disable();
435 m_pDezCharLabel->Disable();
437 if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT )
438 pTypeBtn = m_pLeftTab;
439 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
440 pTypeBtn = m_pRightTab;
441 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL )
443 pTypeBtn = m_pDezTab;
444 m_pDezChar->Enable();
445 m_pDezCharLabel->Enable();
446 m_pDezChar->SetText( OUString( (sal_Unicode)aAktTab.GetDecimal() ) );
448 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER )
449 pTypeBtn = m_pCenterTab;
451 if ( pTypeBtn )
452 pTypeBtn->Check();
454 m_pFillChar->Disable();
455 m_pFillChar->SetText( "" );
457 if ( aAktTab.GetFill() == ' ' )
458 pFillBtn = m_pNoFillChar;
459 else if ( aAktTab.GetFill() == '-' )
460 pFillBtn = m_pFillDashLine;
461 else if ( aAktTab.GetFill() == '_' )
462 pFillBtn = m_pFillSolidLine;
463 else if ( aAktTab.GetFill() == '.' )
464 pFillBtn = m_pFillPoints;
465 else
467 pFillBtn = m_pFillSpecial;
468 m_pFillChar->Enable();
469 m_pFillChar->SetText( OUString( (sal_Unicode)aAktTab.GetFill() ) );
471 pFillBtn->Check();
476 IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn )
478 // Add a new one and select it
479 // Get the value from the display
480 long nVal = static_cast<long>(m_pTabBox->Denormalize( m_pTabBox->GetValue( eDefUnit ) ));
482 // If the pBtn == 0 && the value == 0 then do not create a tab, because we create via OK
483 if ( nVal == 0 && pBtn == 0 )
484 return 0;
486 long nOffset = 0;
487 const SfxPoolItem* pItem = 0;
489 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, true, &pItem ) ==
490 SFX_ITEM_SET )
492 nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
493 MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
494 nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
496 const long nReal = nVal - nOffset;
497 sal_Int32 nSize = m_pTabBox->GetEntryCount();
499 sal_Int32 i;
500 for( i = 0; i < nSize; i++ )
502 if ( nReal < aNewTabs[i].GetTabPos() )
503 break;
506 // Make ListBox entry
507 m_pTabBox->InsertValue( m_pTabBox->Normalize( nVal ), eDefUnit, i );
508 aAktTab.GetTabPos() = nReal;
509 SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT;
511 if ( m_pRightTab->IsChecked() )
512 eAdj = SVX_TAB_ADJUST_RIGHT;
513 else if ( m_pCenterTab->IsChecked() )
514 eAdj = SVX_TAB_ADJUST_CENTER;
515 else if ( m_pDezTab->IsChecked() )
516 eAdj = SVX_TAB_ADJUST_DECIMAL;
518 aAktTab.GetAdjustment() = eAdj;
519 aNewTabs.Insert( aAktTab );
521 m_pNewBtn->Disable();
522 m_pDelBtn->Enable();
523 m_pTabBox->GrabFocus();
525 // If no RadioButton was clicked, we need to put anyway
526 bCheck = true;
527 // Set the selection into the position Edit
528 m_pTabBox->SetSelection(Selection(0, m_pTabBox->GetText().getLength()));
529 return 0;
534 IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl)
536 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue() );
538 if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
539 return 0;
541 if ( m_pTabBox->GetEntryCount() == 1 )
543 DelAllHdl_Impl( 0 );
544 return 0;
547 // Delete Tab
548 m_pTabBox->RemoveEntryAt(nPos);
549 aNewTabs.Remove( nPos );
551 // Reset aAktTab
552 const sal_uInt16 nSize = aNewTabs.Count();
554 if ( nSize > 0 )
556 // Correct Pos
557 nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
558 m_pTabBox->SetValue( m_pTabBox->GetValue( nPos ) );
559 aAktTab = aNewTabs[nPos];
562 // If no Tabs Enable Disable Controls
563 if ( m_pTabBox->GetEntryCount() == 0 )
565 m_pDelBtn->Disable();
566 m_pNewBtn->Enable();
567 m_pTabBox->GrabFocus();
570 // If no RadioButton was clicked, we need to put anyway
571 bCheck = true;
572 return 0;
577 IMPL_LINK_NOARG(SvxTabulatorTabPage, DelAllHdl_Impl)
579 if ( aNewTabs.Count() )
581 aNewTabs = SvxTabStopItem( 0 );
582 InitTabPos_Impl();
584 // So that we put in FillItemSet()
585 bCheck = true;
587 return 0;
592 IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox )
594 bCheck = true;
595 SvxTabAdjust eAdj;
596 m_pDezChar->Disable();
597 m_pDezCharLabel->Disable();
598 m_pDezChar->SetText( "" );
600 if ( pBox == m_pLeftTab )
601 eAdj = SVX_TAB_ADJUST_LEFT;
602 else if ( pBox == m_pRightTab )
603 eAdj = SVX_TAB_ADJUST_RIGHT;
604 else if ( pBox == m_pCenterTab )
605 eAdj = SVX_TAB_ADJUST_CENTER;
606 else
608 eAdj = SVX_TAB_ADJUST_DECIMAL;
609 m_pDezChar->Enable();
610 m_pDezCharLabel->Enable();
611 m_pDezChar->SetText( OUString( (sal_Unicode)aAktTab.GetDecimal() ) );
614 aAktTab.GetAdjustment() = eAdj;
615 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit );
617 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
619 aNewTabs.Remove( nPos );
620 aNewTabs.Insert( aAktTab );
622 return 0;
627 IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox )
629 bCheck = true;
630 sal_uInt8 cFill = ' ';
631 m_pFillChar->SetText( "" );
632 m_pFillChar->Disable();
634 if( pBox == m_pFillSpecial )
635 m_pFillChar->Enable();
636 else if ( pBox == m_pNoFillChar )
637 cFill = ' ';
638 else if ( pBox == m_pFillSolidLine )
639 cFill = '_';
640 else if ( pBox == m_pFillPoints )
641 cFill = '.';
642 else if ( pBox == m_pFillDashLine )
643 cFill = '-';
645 aAktTab.GetFill() = cFill;
646 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit );
648 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
650 aNewTabs.Remove( nPos );
651 aNewTabs.Insert( aAktTab );
653 return 0;
658 IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit )
660 OUString aChar( pEdit->GetText() );
662 if ( !aChar.isEmpty() )
663 aAktTab.GetFill() = aChar[0];
665 const sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit);
666 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
668 aNewTabs.Remove( nPos );
669 aNewTabs.Insert( aAktTab );
671 return 0;
676 IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit )
678 OUString aChar( pEdit->GetText() );
679 if ( !aChar.isEmpty() && ( aChar[0] >= ' '))
680 aAktTab.GetDecimal() = aChar[0];
682 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit );
683 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
685 aNewTabs.Remove( nPos );
686 aNewTabs.Insert( aAktTab );
688 return 0;
693 IMPL_LINK_NOARG(SvxTabulatorTabPage, SelectHdl_Impl)
695 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit );
696 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
698 aAktTab = aNewTabs[nPos];
699 m_pNewBtn->Disable();
700 SetFillAndTabType_Impl();
702 return 0;
707 IMPL_LINK_NOARG(SvxTabulatorTabPage, ModifyHdl_Impl)
709 sal_Int32 nPos = m_pTabBox->GetValuePos( m_pTabBox->GetValue( eDefUnit ), eDefUnit );
710 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
712 aAktTab = aNewTabs[nPos];
713 SetFillAndTabType_Impl();
715 aAktTab.GetTabPos() =
716 static_cast<long>(m_pTabBox->Denormalize( m_pTabBox->GetValue( eDefUnit ) ));
718 m_pNewBtn->Disable();
719 m_pDelBtn->Enable();
720 return 0;
722 m_pNewBtn->Enable();
723 m_pDelBtn->Disable();
724 return 0;
727 void SvxTabulatorTabPage::PageCreated(const SfxAllItemSet& aSet)
729 SFX_ITEMSET_ARG (&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,false);
730 if (pControlItem)
731 DisableControls(pControlItem->GetValue());
734 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */