1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cption.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
46 #include <numrule.hxx>
47 #include <poolfmt.hxx>
54 #include <swmodule.hxx>
55 #include <com/sun/star/frame/XStorable.hpp>
56 #include <com/sun/star/text/GraphicCrop.hpp>
57 #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
58 #include <com/sun/star/text/XTextTableCursor.hpp>
59 #include <com/sun/star/text/XTextTablesSupplier.hpp>
60 #include <com/sun/star/text/TableColumnSeparator.hpp>
61 #include <com/sun/star/text/XTextTable.hpp>
62 #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
63 #include <com/sun/star/text/XTextEmbeddedObject.hpp>
64 #include <com/sun/star/text/XTextFramesSupplier.hpp>
65 #include <com/sun/star/text/XTextFrame.hpp>
73 #include <SwStyleNameMapper.hxx>
74 using namespace ::com::sun::star
;
76 extern String
* GetOldGrfCat();
77 extern String
* GetOldTabCat();
78 extern String
* GetOldFrmCat();
79 extern String
* GetOldDrwCat();
81 class SwSequenceOptionDialog
: public SvxStandardDialog
89 FixedLine aFlCatAndFrame
;
90 FixedText aFtCharStyle
;
92 CheckBox aApplyBorderAndShadowCB
;
94 //#i61007# order of captions
95 FixedLine aFlCaptionOrder
;
96 FixedText aFtCaptionOrder
;
97 ListBox aLbCaptionOrder
;
100 CancelButton aCancelButton
;
101 HelpButton aHelpButton
;
107 SwSequenceOptionDialog( Window
*pParent
, SwView
&rV
,
108 const String
& rSeqFldType
);
109 virtual ~SwSequenceOptionDialog();
110 virtual void Apply();
112 bool IsApplyBorderAndShadow( void ) { return aApplyBorderAndShadowCB
.IsChecked(); }
113 void SetApplyBorderAndShadow( bool bSet
) { aApplyBorderAndShadowCB
.Check(bSet
); }
115 //#i61007# order of captions
116 bool IsOrderNumberingFirst() const {return aLbCaptionOrder
.GetSelectEntryPos() == 1;}
117 void SetOrderNumberingFirst(bool bSet
) { aLbCaptionOrder
.SelectEntryPos( bSet
? 1 : 0 ); }
119 void SetCharacterStyle(const String
& rStyle
);
120 String
GetCharacterStyle() const;
123 SwCaptionDialog::SwCaptionDialog( Window
*pParent
, SwView
&rV
) :
125 SvxStandardDialog( pParent
, SW_RES(DLG_CAPTION
) ),
127 aTextText (this, SW_RES(TXT_TEXT
)),
128 aTextEdit (this, SW_RES(EDT_TEXT
)),
129 aSettingsFL (this, SW_RES(FL_SETTINGS
)),
130 aCategoryText (this, SW_RES(TXT_CATEGORY
)),
131 aCategoryBox (this, SW_RES(BOX_CATEGORY
)),
132 aFormatText (this, SW_RES(TXT_FORMAT
)),
133 aFormatBox (this, SW_RES(BOX_FORMAT
)),
134 aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP
)),
135 aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP
)),
136 aSepText (this, SW_RES(TXT_SEP
)),
137 aSepEdit (this, SW_RES(EDT_SEP
)),
138 aPosText (this, SW_RES(TXT_POS
)),
139 aPosBox (this, SW_RES(BOX_POS
)),
140 aOKButton (this, SW_RES(BTN_OK
)),
141 aCancelButton (this, SW_RES(BTN_CANCEL
)),
142 aHelpButton (this, SW_RES(BTN_HELP
)),
143 aAutoCaptionButton(this, SW_RES(BTN_AUTOCAPTION
)),
144 aOptionButton (this, SW_RES(BTN_OPTION
)),
145 sNone( SW_RES( STR_CATEGORY_NONE
)),
146 aPrevWin (this, SW_RES(WIN_SAMPLE
)),
148 pMgr( new SwFldMgr(rView
.GetWrtShellPtr()) ),
149 bCopyAttributes( FALSE
),
150 bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() )
152 //#i61007# order of captions
153 if( bOrderNumberingFirst
)
155 SwWrtShell
&rSh
= rView
.GetWrtShell();
156 uno::Reference
< frame::XModel
> xModel
= rView
.GetDocShell()->GetBaseModel();
158 eType
= rSh
.GetSelectionType();
159 if ( eType
& nsSelectionType::SEL_OLE
)
161 eType
= nsSelectionType::SEL_GRF
;
162 uno::Reference
< text::XTextEmbeddedObjectsSupplier
> xObjs(xModel
, uno::UNO_QUERY
);
163 xNameAccess
= xObjs
->getEmbeddedObjects();
166 Link aLk
= LINK( this, SwCaptionDialog
, ModifyHdl
);
167 aCategoryBox
.SetModifyHdl( aLk
);
168 aTextEdit
.SetModifyHdl( aLk
);
169 aNumberingSeparatorED
.SetModifyHdl ( aLk
);
170 aSepEdit
.SetModifyHdl( aLk
);
172 aLk
= LINK(this, SwCaptionDialog
, SelectHdl
);
173 aCategoryBox
.SetSelectHdl( aLk
);
174 aFormatBox
.SetSelectHdl( aLk
);
175 aOptionButton
.SetClickHdl( LINK( this, SwCaptionDialog
, OptionHdl
) );
176 aAutoCaptionButton
.SetClickHdl(LINK(this, SwCaptionDialog
, CaptionHdl
));
178 aCategoryBox
.InsertEntry( sNone
);
179 sal_uInt16 i
, nCount
= pMgr
->GetFldTypeCount();
180 for (i
= 0; i
< nCount
; i
++)
182 SwFieldType
*pType
= pMgr
->GetFldType( USHRT_MAX
, i
);
183 if( pType
->Which() == RES_SETEXPFLD
&&
184 ((SwSetExpFieldType
*) pType
)->GetType() & nsSwGetSetExpType::GSE_SEQ
)
185 aCategoryBox
.InsertEntry(pType
->GetName());
189 sal_uInt16 nPoolId
= 0;
190 if (eType
& nsSelectionType::SEL_GRF
)
192 nPoolId
= RES_POOLCOLL_LABEL_ABB
;
193 pString
= ::GetOldGrfCat();
194 bCopyAttributes
= TRUE
;
195 sObjectName
= rSh
.GetFlyName();
197 if(!xNameAccess
.is())
199 uno::Reference
< text::XTextGraphicObjectsSupplier
> xGraphics(xModel
, uno::UNO_QUERY
);
200 xNameAccess
= xGraphics
->getGraphicObjects();
204 else if( eType
& nsSelectionType::SEL_TBL
)
206 nPoolId
= RES_POOLCOLL_LABEL_TABLE
;
207 pString
= ::GetOldTabCat();
208 uno::Reference
< text::XTextTablesSupplier
> xTables(xModel
, uno::UNO_QUERY
);
209 xNameAccess
= xTables
->getTextTables();
210 sObjectName
= rSh
.GetTableFmt()->GetName();
212 else if( eType
& nsSelectionType::SEL_FRM
)
214 nPoolId
= RES_POOLCOLL_LABEL_FRAME
;
215 pString
= ::GetOldFrmCat();
216 uno::Reference
< text::XTextFramesSupplier
> xFrms(xModel
, uno::UNO_QUERY
);
217 xNameAccess
= xFrms
->getTextFrames();
218 sObjectName
= rSh
.GetFlyName();
220 else if( eType
== nsSelectionType::SEL_TXT
)
222 nPoolId
= RES_POOLCOLL_LABEL_FRAME
;
223 pString
= ::GetOldFrmCat();
225 else if( eType
& nsSelectionType::SEL_DRW
)
227 nPoolId
= RES_POOLCOLL_LABEL_DRAWING
;
228 pString
= ::GetOldDrwCat();
232 if( pString
&& pString
->Len())
233 aCategoryBox
.SetText( *pString
);
235 aCategoryBox
.SetText(
236 SwStyleNameMapper::GetUIName( nPoolId
, aEmptyStr
));
240 sal_uInt16 nSelFmt
= SVX_NUM_ARABIC
;
241 nCount
= pMgr
->GetFldTypeCount();
242 SwFieldType
* pFldType
;
243 for ( i
= nCount
; i
; )
244 if( ( pFldType
= pMgr
->GetFldType(USHRT_MAX
, --i
))->GetName() ==
245 aCategoryBox
.GetText() )
247 nSelFmt
= (sal_uInt16
)((SwSetExpFieldType
*)pFldType
)->GetSeqFormat();
252 nCount
= pMgr
->GetFormatCount(TYP_SEQFLD
, sal_False
);
253 for ( i
= 0; i
< nCount
; ++i
)
255 aFormatBox
.InsertEntry( pMgr
->GetFormatStr(TYP_SEQFLD
, i
) );
256 sal_uInt16 nFmtId
= pMgr
->GetFormatId(TYP_SEQFLD
, i
);
257 aFormatBox
.SetEntryData( i
, reinterpret_cast<void*>( nFmtId
) );
258 if( nFmtId
== nSelFmt
)
259 aFormatBox
.SelectEntryPos( i
);
265 case nsSelectionType::SEL_GRF
:
266 case nsSelectionType::SEL_TBL
:
267 case nsSelectionType::SEL_TBL
| nsSelectionType::SEL_NUM
:
268 case nsSelectionType::SEL_TBL
| nsSelectionType::SEL_TXT
:
269 case nsSelectionType::SEL_TBL
| nsSelectionType::SEL_NUM
| nsSelectionType::SEL_TXT
:
270 case nsSelectionType::SEL_DRW
:
271 case nsSelectionType::SEL_DRW
| nsSelectionType::SEL_BEZ
:
272 aPosBox
.InsertEntry(SW_RESSTR(STR_ABOVE
));
273 aPosBox
.InsertEntry(SW_RESSTR(STR_CP_BELOW
));
275 case nsSelectionType::SEL_FRM
:
276 case nsSelectionType::SEL_TXT
:
277 aPosBox
.InsertEntry(SW_RESSTR(STR_BEGINNING
));
278 aPosBox
.InsertEntry(SW_RESSTR(STR_END
));
281 aPosBox
.SelectEntryPos(1);
282 if (eType
& (nsSelectionType::SEL_GRF
|nsSelectionType::SEL_DRW
))
284 aPosText
.Enable( sal_False
);
285 aPosBox
.Enable( sal_False
);
288 aCategoryBox
.GetModifyHdl().Call(&aCategoryBox
);
293 aTextEdit
.GrabFocus();
297 void SwCaptionDialog::Apply()
300 aOpt
.UseCaption() = sal_True
;
301 String
aName( aCategoryBox
.GetText() );
302 if ( aName
== sNone
)
303 aOpt
.SetCategory( aEmptyStr
);
306 aName
.EraseLeadingChars( ' ' );
307 aName
.EraseTrailingChars( ' ' );
308 aOpt
.SetCategory( aName
);
310 aOpt
.SetNumType( (sal_uInt16
)(sal_uIntPtr
)aFormatBox
.GetEntryData( aFormatBox
.GetSelectEntryPos() ) );
311 aOpt
.SetSeparator( aSepEdit
.IsEnabled() ? aSepEdit
.GetText() : String() );
312 aOpt
.SetNumSeparator( aNumberingSeparatorED
.GetText() );
313 aOpt
.SetCaption( aTextEdit
.GetText() );
314 aOpt
.SetPos( aPosBox
.GetSelectEntryPos() );
315 aOpt
.IgnoreSeqOpts() = sal_True
;
316 aOpt
.CopyAttributes() = bCopyAttributes
;
317 aOpt
.SetCharacterStyle( sCharacterStyle
);
318 rView
.InsertCaption( &aOpt
);
321 IMPL_LINK_INLINE_START( SwCaptionDialog
, OptionHdl
, Button
*, pButton
)
323 String sFldTypeName
= aCategoryBox
.GetText();
324 if(sFldTypeName
== sNone
)
325 sFldTypeName
= aEmptyStr
;
326 SwSequenceOptionDialog
aDlg( pButton
, rView
, sFldTypeName
);
327 aDlg
.SetApplyBorderAndShadow(bCopyAttributes
);
328 aDlg
.SetCharacterStyle( sCharacterStyle
);
329 aDlg
.SetOrderNumberingFirst( bOrderNumberingFirst
);
331 bCopyAttributes
= aDlg
.IsApplyBorderAndShadow();
332 sCharacterStyle
= aDlg
.GetCharacterStyle();
333 //#i61007# order of captions
334 if( bOrderNumberingFirst
!= aDlg
.IsOrderNumberingFirst() )
336 bOrderNumberingFirst
= aDlg
.IsOrderNumberingFirst();
337 SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst
);
343 IMPL_LINK_INLINE_END( SwCaptionDialog
, OptionHdl
, Button
*, EMPTYARG
)
345 IMPL_LINK_INLINE_START( SwCaptionDialog
, SelectHdl
, ListBox
*, EMPTYARG
)
350 IMPL_LINK_INLINE_END( SwCaptionDialog
, SelectHdl
, ListBox
*, EMPTYARG
)
354 IMPL_LINK( SwCaptionDialog
, ModifyHdl
, Edit
*, EMPTYARG
)
356 SwWrtShell
&rSh
= rView
.GetWrtShell();
357 String sFldTypeName
= aCategoryBox
.GetText();
358 sal_Bool bCorrectFldName
= sFldTypeName
.Len() > 0;
359 sal_Bool bNone
= sFldTypeName
== sNone
;
360 SwFieldType
* pType
= (bCorrectFldName
&& !bNone
)
361 ? rSh
.GetFldType( RES_SETEXPFLD
, sFldTypeName
)
363 aOKButton
.Enable( bCorrectFldName
&&
365 ((SwSetExpFieldType
*)pType
)->GetType() == nsSwGetSetExpType::GSE_SEQ
)
366 && 0 != sFldTypeName
.Len() );
367 aOptionButton
.Enable( aOKButton
.IsEnabled() && !bNone
);
368 aFormatText
.Enable( !bNone
);
369 aFormatBox
.Enable( !bNone
);
370 aSepText
.Enable( !bNone
);
371 aSepEdit
.Enable( !bNone
);
376 IMPL_LINK(SwCaptionDialog
, CaptionHdl
, PushButton
*, EMPTYARG
)
378 SfxItemSet
aSet( rView
.GetDocShell()->GetDoc()->GetAttrPool() );
379 SwCaptionOptDlg
aDlg( this, aSet
);
385 void SwCaptionDialog::DrawSample()
390 String sFldTypeName
= aCategoryBox
.GetText();
391 sal_Bool bNone
= sFldTypeName
== sNone
;
394 sal_uInt16 nNumFmt
= (sal_uInt16
)(sal_uIntPtr
)aFormatBox
.GetEntryData(
395 aFormatBox
.GetSelectEntryPos() );
396 if( SVX_NUM_NUMBER_NONE
!= nNumFmt
)
399 //#i61007# order of captions
400 if( !bOrderNumberingFirst
)
402 aStr
+= sFldTypeName
;
403 if ( aStr
.Len() > 0 )
407 SwWrtShell
&rSh
= rView
.GetWrtShell();
408 SwSetExpFieldType
* pFldType
= (SwSetExpFieldType
*)rSh
.GetFldType(
409 RES_SETEXPFLD
, sFldTypeName
);
410 if( pFldType
&& pFldType
->GetOutlineLvl() < MAXLEVEL
)
412 sal_Int8 nLvl
= pFldType
->GetOutlineLvl();
413 SwNumberTree::tNumberVector aNumVector
;
414 for( sal_Int8 i
= 0; i
<= nLvl
; ++i
)
415 aNumVector
.push_back(1);
417 String
sNumber( rSh
.GetOutlineNumRule()->
418 MakeNumString(aNumVector
, sal_False
));
420 (aStr
+= sNumber
) += pFldType
->GetDelimiter();
425 case SVX_NUM_CHARS_UPPER_LETTER
: aStr
+= 'A'; break;
426 case SVX_NUM_CHARS_UPPER_LETTER_N
: aStr
+= 'A'; break;
427 case SVX_NUM_CHARS_LOWER_LETTER
: aStr
+= 'a'; break;
428 case SVX_NUM_CHARS_LOWER_LETTER_N
: aStr
+= 'a'; break;
429 case SVX_NUM_ROMAN_UPPER
: aStr
+= 'I'; break;
430 case SVX_NUM_ROMAN_LOWER
: aStr
+= 'i'; break;
432 default: aStr
+= '1'; break;
434 //#i61007# order of captions
435 if( bOrderNumberingFirst
)
437 aStr
+= aNumberingSeparatorED
.GetText();
438 aStr
+= sFldTypeName
;
442 aStr
+= aSepEdit
.GetText();
444 aStr
+= aTextEdit
.GetText();
446 aPrevWin
.SetPreviewText( aStr
);
449 void SwCaptionDialog::CheckButtonWidth()
451 // check if the text of the AutoCaption button is to wide
452 const long nOffset
= 10;
453 String sText
= aAutoCaptionButton
.GetText();
454 long nTxtW
= aAutoCaptionButton
.GetTextWidth( sText
);
455 if ( sText
.Search( '~' ) == STRING_NOTFOUND
)
457 long nBtnW
= aAutoCaptionButton
.GetSizePixel().Width();
460 // then broaden all buttons
462 long nDelta
= Max( ( nTxtW
- nBtnW
), nOffset
);
465 &aOKButton
, &aCancelButton
, &aHelpButton
, &aAutoCaptionButton
, &aOptionButton
467 Button
** pCurrent
= pBtns
;
468 for ( sal_uInt32 i
= 0; i
< sizeof( pBtns
) / sizeof( pBtns
[ 0 ] ); ++i
, ++pCurrent
)
470 aNewSize
= (*pCurrent
)->GetSizePixel();
471 aNewSize
.Width() += nDelta
;
472 (*pCurrent
)->SetSizePixel( aNewSize
);
475 aNewSize
= GetOutputSizePixel();
476 aNewSize
.Width() += nDelta
;
477 SetOutputSizePixel( aNewSize
);
481 SwCaptionDialog::~SwCaptionDialog()
488 SwSequenceOptionDialog::SwSequenceOptionDialog( Window
*pParent
, SwView
&rV
,
489 const String
& rSeqFldType
)
490 : SvxStandardDialog( pParent
, SW_RES(DLG_SEQUENCE_OPTION
) ),
491 aFlHeader (this, SW_RES(FL_HEADER
)),
492 aFtLevel (this, SW_RES(FT_LEVEL
)),
493 aLbLevel (this, SW_RES(LB_LEVEL
)),
494 aFtDelim (this, SW_RES(FT_SEPARATOR
)),
495 aEdDelim (this, SW_RES(ED_SEPARATOR
)),
496 aFlCatAndFrame (this, SW_RES(FL_CATANDFRAME
)),
497 aFtCharStyle (this, SW_RES(FT_CHARSTYLE
)),
498 aLbCharStyle (this, SW_RES(LB_CHARSTYLE
)),
499 aApplyBorderAndShadowCB(this, SW_RES(CB_APPLYBAS
)),
500 aFlCaptionOrder(this, SW_RES( FL_ORDER
)), //#i61007# order of captions
501 aFtCaptionOrder(this, SW_RES( FT_ORDER
)),
502 aLbCaptionOrder(this, SW_RES( LB_ORDER
)),
503 aOKButton (this, SW_RES(BTN_OK
)),
504 aCancelButton (this, SW_RES(BTN_CANCEL
)),
505 aHelpButton (this, SW_RES(BTN_HELP
)),
508 aFldTypeName( rSeqFldType
)
511 SwWrtShell
&rSh
= rView
.GetWrtShell();
513 for( sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
)
514 aLbLevel
.InsertEntry( String::CreateFromInt32(n
+1) );
516 SwSetExpFieldType
* pFldType
= (SwSetExpFieldType
*)rSh
.GetFldType(
517 RES_SETEXPFLD
, aFldTypeName
);
519 sal_Unicode nLvl
= MAXLEVEL
;
520 String
sDelim( String::CreateFromAscii( ": " ) );
523 sDelim
= pFldType
->GetDelimiter();
524 nLvl
= pFldType
->GetOutlineLvl();
527 aLbLevel
.SelectEntryPos( nLvl
< MAXLEVEL
? nLvl
+ 1 : 0 );
528 aEdDelim
.SetText( sDelim
);
530 ::FillCharStyleListBox( aLbCharStyle
, rView
.GetDocShell(), TRUE
, TRUE
);
531 aLbCharStyle
.SelectEntryPos( 0 );
534 SwSequenceOptionDialog::~SwSequenceOptionDialog()
538 void SwSequenceOptionDialog::Apply()
540 SwWrtShell
&rSh
= rView
.GetWrtShell();
541 SwSetExpFieldType
* pFldType
= (SwSetExpFieldType
*)rSh
.GetFldType(
542 RES_SETEXPFLD
, aFldTypeName
);
544 sal_Int8 nLvl
= (sal_Int8
)( aLbLevel
.GetSelectEntryPos() - 1);
545 sal_Unicode cDelim
= aEdDelim
.GetText().GetChar(0);
547 sal_Bool bUpdate
= sal_True
;
550 pFldType
->SetDelimiter( cDelim
);
551 pFldType
->SetOutlineLvl( nLvl
);
553 else if( aFldTypeName
.Len() && nLvl
< MAXLEVEL
)
555 // dann muessen wir das mal einfuegen
556 SwSetExpFieldType
aFldType( rSh
.GetDoc(), aFldTypeName
, nsSwGetSetExpType::GSE_SEQ
);
557 aFldType
.SetDelimiter( cDelim
);
558 aFldType
.SetOutlineLvl( nLvl
);
559 rSh
.InsertFldType( aFldType
);
568 /*-- 24.08.2004 16:13:53---------------------------------------------------
570 -----------------------------------------------------------------------*/
571 String
SwSequenceOptionDialog::GetCharacterStyle() const
574 if(aLbCharStyle
.GetSelectEntryPos())
575 sRet
= aLbCharStyle
.GetSelectEntry();
579 /*-- 24.08.2004 16:14:00---------------------------------------------------
581 -----------------------------------------------------------------------*/
582 void SwSequenceOptionDialog::SetCharacterStyle(const String
& rStyle
)
584 aLbCharStyle
.SelectEntryPos(0);
585 aLbCharStyle
.SelectEntry(rStyle
);
588 long SwCaptionDialog::CategoryBox::PreNotify( NotifyEvent
& rNEvt
)
591 if( rNEvt
.GetType() == EVENT_KEYINPUT
&&
592 rNEvt
.GetKeyEvent()->GetCharCode() )
594 const KeyEvent
* pEvent
= rNEvt
.GetKeyEvent();
595 const KeyCode
& rKeyCode
= pEvent
->GetKeyCode();
596 USHORT nTmpCode
= rKeyCode
.GetFullCode() & ~KEY_ALLMODTYPE
;
598 if(nTmpCode
!= KEY_BACKSPACE
&& nTmpCode
!= KEY_RETURN
599 && nTmpCode
!= KEY_TAB
&& nTmpCode
!= KEY_ESCAPE
)
601 String
sKey( pEvent
->GetCharCode() ), sName( GetText() );
602 Selection
aSel( GetSelection() );
605 sName
.Erase( (xub_StrLen
)aSel
.Min(), (xub_StrLen
)aSel
.Len() );
606 sName
.Insert( sKey
, (xub_StrLen
)aSel
.Min() );
607 if( !SwCalc::IsValidVarName( sName
))
612 nHandled
= ComboBox::PreNotify( rNEvt
);
615 /*-- 01.11.2007 10:45:51---------------------------------------------------
616 //#i61007# order of captions
617 -----------------------------------------------------------------------*/
618 void lcl_MoveH( Window
& rWin
, sal_Int32 nMove
)
620 Point
aPos( rWin
.GetPosPixel() );
622 rWin
.SetPosPixel(aPos
);
624 void SwCaptionDialog::ApplyCaptionOrder()
626 //have the settings changed?
627 bool bVisible
= aNumberingSeparatorED
.IsVisible() != 0;
628 if( bOrderNumberingFirst
!= bVisible
)
630 sal_Int32 nDiff
= aPosBox
.GetPosPixel().Y() - aSepEdit
.GetPosPixel().Y();
632 aNumberingSeparatorFT
.Show( bOrderNumberingFirst
);
633 aNumberingSeparatorED
.Show( bOrderNumberingFirst
);
634 if( !bOrderNumberingFirst
)
638 lcl_MoveH( aCategoryText
, 2 * nDiff
);
639 lcl_MoveH( aFormatText
, -nDiff
);
640 lcl_MoveH( aFormatBox
, -nDiff
);
641 lcl_MoveH( aCategoryBox
, 2 * nDiff
);
642 lcl_MoveH( aSepText
, nDiff
);
643 lcl_MoveH( aSepEdit
, nDiff
);
644 lcl_MoveH( aPosText
, nDiff
);
645 lcl_MoveH( aPosBox
, nDiff
);
646 lcl_MoveH( aPrevWin
, nDiff
);
647 Size
aDlgSize( GetSizePixel() );
648 aDlgSize
.Height() += nDiff
;
649 SetSizePixel( aDlgSize
);