diff options
author | Jack Leigh <leighman@gmx.se> | 2012-12-07 18:22:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-10 13:35:36 +0000 |
commit | 6bf7198ebd12d4ac60f9039a30339867e8a3ce8e (patch) | |
tree | 6fee94b955fb8432a0f8dc2af3ff786cc91029ed | |
parent | 20778d72fe4c785ebe9039767afa07f35b045541 (diff) |
migrate 'Insert Caption' dialog to .ui file
Change-Id: I490c8057f1263f12f50b59c97ca9807138daab5d
Reviewed-on: https://gerrit.libreoffice.org/1266
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/UI_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/globals.hrc | 6 | ||||
-rw-r--r-- | sw/source/ui/app/app.src | 21 | ||||
-rw-r--r-- | sw/source/ui/config/optload.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.cxx | 221 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.hrc | 21 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.src | 180 | ||||
-rw-r--r-- | sw/source/ui/inc/cption.hxx | 57 | ||||
-rw-r--r-- | sw/source/ui/inc/optload.hxx | 12 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/insertcaption.ui | 401 |
10 files changed, 560 insertions, 376 deletions
diff --git a/sw/UI_swriter.mk b/sw/UI_swriter.mk index fc4a2596086e..f39bb2f123c7 100644 --- a/sw/UI_swriter.mk +++ b/sw/UI_swriter.mk @@ -20,6 +20,7 @@ $(eval $(call gb_UI_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/indexentry \ sw/uiconfig/swriter/ui/insertbookmark \ sw/uiconfig/swriter/ui/insertbreak \ + sw/uiconfig/swriter/ui/insertcaption \ sw/uiconfig/swriter/ui/insertfootnote \ sw/uiconfig/swriter/ui/insertscript \ sw/uiconfig/swriter/ui/inserttable \ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index 73c73aeb85c9..ec4c02ef3f78 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -69,6 +69,12 @@ #define SW_STR_NONE (RC_GLOBALS_BEGIN + 41) +#define STR_CAPTION_BEGINNING (RC_GLOBALS_BEGIN + 42) +#define STR_CAPTION_END (RC_GLOBALS_BEGIN + 43) +#define STR_CAPTION_ABOVE (RC_GLOBALS_BEGIN + 44) +#define STR_CAPTION_BELOW (RC_GLOBALS_BEGIN + 45) +#define STR_CAPTION_CATEGORY_NONE (RC_GLOBALS_BEGIN + 46) + // DIALOGS ----------------------------------------------------------- #define DLG_THESAURUS (RC_GLOBALS_BEGIN + 2) diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index dbfd44b26be6..695257116a11 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -240,6 +240,27 @@ String SW_STR_NONE Text [ en-US ] = "[None]" ; }; +String STR_CAPTION_BEGINNING +{ + Text [ en-US ] = "Above" ; +}; +String STR_CAPTION_END +{ + Text [ en-US ] = "Below" ; +}; +String STR_CAPTION_ABOVE +{ + Text [ en-US ] = "Above" ; +}; +String STR_CAPTION_BELOW +{ + Text [ en-US ] = "Below" ; +}; +String STR_CAPTION_CATEGORY_NONE +{ + Text [ en-US ] = "<None>" ; +}; + InfoBox MSG_ERROR_SEND_MAIL { BUTTONS = WB_OK ; diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 045e8972bd6d..f3fd60478482 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -345,9 +345,20 @@ SwCaptionOptDlg::~SwCaptionOptDlg() { } +SwCaptionPreview::SwCaptionPreview( Window* pParent ) + : Window( pParent ) +{ + Init(); +} + SwCaptionPreview::SwCaptionPreview( Window* pParent, const ResId& rResId ) : Window( pParent, rResId ) { + Init(); +} + +void SwCaptionPreview::Init() +{ maDrawPos = Point( 4, 6 ); Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() ); @@ -377,6 +388,11 @@ void SwCaptionPreview::Paint( const Rectangle& rRect ) DrawText( Point( 4, 6 ), maText ); } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwCaptionPreview(Window* pParent) +{ + return new SwCaptionPreview(pParent); +} + SwCaptionOptPage::SwCaptionOptPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, SW_RES(TP_OPTCAPTION_PAGE), rSet), aCheckFT (this, SW_RES(FT_OBJECTS )), diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 5d7f6ebd19b4..84bbbe670b88 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -43,8 +43,10 @@ #include <com/sun/star/text/XTextFrame.hpp> #include <comphelper/string.hxx> #include <frmui.hrc> +#include <globals.hrc> #include <cption.hrc> #include <SwStyleNameMapper.hxx> + using namespace ::com::sun::star; extern String* GetOldGrfCat(); @@ -97,37 +99,30 @@ public: String SwCaptionDialog::our_aSepTextSave = rtl::OUString(": "); // Caption separator text SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : - - SvxStandardDialog( pParent, SW_RES(DLG_CAPTION) ), - - aTextText (this, SW_RES(TXT_TEXT )), - aTextEdit (this, SW_RES(EDT_TEXT )), - aSettingsFL (this, SW_RES(FL_SETTINGS)), - aCategoryText (this, SW_RES(TXT_CATEGORY)), - aCategoryBox (this, SW_RES(BOX_CATEGORY)), - aFormatText (this, SW_RES(TXT_FORMAT )), - aFormatBox (this, SW_RES(BOX_FORMAT )), - aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP )), - aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP )), - aSepText (this, SW_RES(TXT_SEP )), - aSepEdit (this, SW_RES(EDT_SEP )), - aPosText (this, SW_RES(TXT_POS )), - aPosBox (this, SW_RES(BOX_POS )), - aOKButton (this, SW_RES(BTN_OK )), - aCancelButton (this, SW_RES(BTN_CANCEL )), - aHelpButton (this, SW_RES(BTN_HELP )), - aAutoCaptionButton(this, SW_RES(BTN_AUTOCAPTION)), - aOptionButton (this, SW_RES(BTN_OPTION )), - sNone( SW_RES( STR_CATEGORY_NONE )), - aPrevWin (this, SW_RES(WIN_SAMPLE )), + SvxStandardDialog( pParent, "InsertCaptionDialog", "modules/swriter/ui/insertcaption.ui" ), + sNone( SW_RES( STR_CAPTION_CATEGORY_NONE )), rView( rV ), pMgr( new SwFldMgr(rView.GetWrtShellPtr()) ), bCopyAttributes( sal_False ), bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ) { + get(m_pTextEdit, "caption_edit"); + get(m_pCategoryBox, "category"); + get(m_pFormatText, "numbering_label"); + get(m_pFormatBox, "numbering"); + get(m_pNumberingSeparatorFT, "num_separator"); + get(m_pNumberingSeparatorED, "num_seperator_edit"); + get(m_pSepText, "separator_label"); + get(m_pSepEdit, "separator_edit"); + get(m_pPosText, "position_label"); + get(m_pPosBox, "position"); + get(m_pPreview, "preview"); + get(m_pOKButton, "ok"); + get(m_pAutoCaptionButton, "auto"); + get(m_pOptionButton, "options"); + //#i61007# order of captions - if( bOrderNumberingFirst ) - ApplyCaptionOrder(); + ApplyCaptionOrder(); SwWrtShell &rSh = rView.GetWrtShell(); uno::Reference< frame::XModel > xModel = rView.GetDocShell()->GetBaseModel(); @@ -140,25 +135,25 @@ SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : } Link aLk = LINK( this, SwCaptionDialog, ModifyHdl ); - aCategoryBox.SetModifyHdl( aLk ); - aTextEdit .SetModifyHdl( aLk ); - aNumberingSeparatorED.SetModifyHdl ( aLk ); - aSepEdit .SetModifyHdl( aLk ); + m_pCategoryBox->SetModifyHdl( aLk ); + m_pTextEdit->SetModifyHdl( aLk ); + m_pNumberingSeparatorED->SetModifyHdl ( aLk ); + m_pSepEdit->SetModifyHdl( aLk ); aLk = LINK(this, SwCaptionDialog, SelectHdl); - aCategoryBox.SetSelectHdl( aLk ); - aFormatBox .SetSelectHdl( aLk ); - aOptionButton.SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) ); - aAutoCaptionButton.SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl)); + m_pCategoryBox->SetSelectHdl( aLk ); + m_pFormatBox->SetSelectHdl( aLk ); + m_pOptionButton->SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) ); + m_pAutoCaptionButton->SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl)); - aCategoryBox.InsertEntry( sNone ); + m_pCategoryBox->InsertEntry( sNone ); sal_uInt16 i, nCount = pMgr->GetFldTypeCount(); for (i = 0; i < nCount; i++) { SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i ); if( pType->Which() == RES_SETEXPFLD && ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) - aCategoryBox.InsertEntry(pType->GetName()); + m_pCategoryBox->InsertEntry(pType->GetName()); } String* pString = 0; @@ -206,9 +201,9 @@ SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : if( nPoolId ) { if( pString && pString->Len()) - aCategoryBox.SetText( *pString ); + m_pCategoryBox->SetText( *pString ); else - aCategoryBox.SetText( + m_pCategoryBox->SetText( SwStyleNameMapper::GetUIName( nPoolId, aEmptyStr )); } @@ -219,7 +214,7 @@ SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : for ( i = nCount; i; ) { pFldType = pMgr->GetFldType(USHRT_MAX, --i); - if( pFldType->GetName().equals(aCategoryBox.GetText()) ) + if( pFldType->GetName().equals(m_pCategoryBox->GetText()) ) { nSelFmt = (sal_uInt16)((SwSetExpFieldType*)pFldType)->GetSeqFormat(); break; @@ -229,11 +224,11 @@ SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : nCount = pMgr->GetFormatCount(TYP_SEQFLD, sal_False); for ( i = 0; i < nCount; ++i ) { - aFormatBox.InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) ); + m_pFormatBox->InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) ); sal_uInt16 nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i); - aFormatBox.SetEntryData( i, reinterpret_cast<void*>( nFmtId ) ); + m_pFormatBox->SetEntryData( i, reinterpret_cast<void*>( nFmtId ) ); if( nFmtId == nSelFmt ) - aFormatBox.SelectEntryPos( i ); + m_pFormatBox->SelectEntryPos( i ); } // aPosBox @@ -246,29 +241,26 @@ SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM | nsSelectionType::SEL_TXT: case nsSelectionType::SEL_DRW: case nsSelectionType::SEL_DRW | nsSelectionType::SEL_BEZ: - aPosBox.InsertEntry(SW_RESSTR(STR_ABOVE)); - aPosBox.InsertEntry(SW_RESSTR(STR_CP_BELOW)); + m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_ABOVE)); + m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_BELOW)); break; case nsSelectionType::SEL_FRM: case nsSelectionType::SEL_TXT: - aPosBox.InsertEntry(SW_RESSTR(STR_BEGINNING)); - aPosBox.InsertEntry(SW_RESSTR(STR_END )); + m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_BEGINNING)); + m_pPosBox->InsertEntry(SW_RESSTR(STR_CAPTION_END )); break; } - aPosBox.SelectEntryPos(1); + m_pPosBox->SelectEntryPos(1); if (eType & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_DRW)) { - aPosText.Enable( sal_False ); - aPosBox.Enable( sal_False ); + m_pPosText->Enable( sal_False ); + m_pPosBox->Enable( sal_False ); } - aCategoryBox.GetModifyHdl().Call(&aCategoryBox); + m_pCategoryBox->GetModifyHdl().Call(m_pCategoryBox); - FreeResource(); - - CheckButtonWidth(); - aSepEdit.SetText(our_aSepTextSave); - aTextEdit.GrabFocus(); + m_pSepEdit->SetText(our_aSepTextSave); + m_pTextEdit->GrabFocus(); DrawSample(); } @@ -276,7 +268,7 @@ void SwCaptionDialog::Apply() { InsCaptionOpt aOpt; aOpt.UseCaption() = sal_True; - String aName( aCategoryBox.GetText() ); + String aName( m_pCategoryBox->GetText() ); if ( aName == sNone ) { aOpt.SetCategory( aEmptyStr ); @@ -285,22 +277,22 @@ void SwCaptionDialog::Apply() else { aOpt.SetCategory(comphelper::string::strip(aName, ' ')); - aOpt.SetNumSeparator( aNumberingSeparatorED.GetText() ); + aOpt.SetNumSeparator( m_pNumberingSeparatorED->GetText() ); } - aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( aFormatBox.GetSelectEntryPos() ) ); - aOpt.SetSeparator( aSepEdit.IsEnabled() ? aSepEdit.GetText() : String() ); - aOpt.SetCaption( aTextEdit.GetText() ); - aOpt.SetPos( aPosBox.GetSelectEntryPos() ); + aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)m_pFormatBox->GetEntryData( m_pFormatBox->GetSelectEntryPos() ) ); + aOpt.SetSeparator( m_pSepEdit->IsEnabled() ? m_pSepEdit->GetText() : String() ); + aOpt.SetCaption( m_pTextEdit->GetText() ); + aOpt.SetPos( m_pPosBox->GetSelectEntryPos() ); aOpt.IgnoreSeqOpts() = sal_True; aOpt.CopyAttributes() = bCopyAttributes; aOpt.SetCharacterStyle( sCharacterStyle ); rView.InsertCaption( &aOpt ); - our_aSepTextSave = aSepEdit.GetText(); + our_aSepTextSave = m_pSepEdit->GetText(); } IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton ) { - String sFldTypeName = aCategoryBox.GetText(); + String sFldTypeName = m_pCategoryBox->GetText(); if(sFldTypeName == sNone) sFldTypeName = aEmptyStr; SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName ); @@ -332,21 +324,23 @@ IMPL_LINK_NOARG_INLINE_END(SwCaptionDialog, SelectHdl) IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl) { SwWrtShell &rSh = rView.GetWrtShell(); - String sFldTypeName = aCategoryBox.GetText(); + String sFldTypeName = m_pCategoryBox->GetText(); sal_Bool bCorrectFldName = sFldTypeName.Len() > 0; sal_Bool bNone = sFldTypeName == sNone; SwFieldType* pType = (bCorrectFldName && !bNone) ? rSh.GetFldType( RES_SETEXPFLD, sFldTypeName ) : 0; - aOKButton.Enable( bCorrectFldName && + m_pOKButton->Enable( bCorrectFldName && (!pType || ((SwSetExpFieldType*)pType)->GetType() == nsSwGetSetExpType::GSE_SEQ) && 0 != sFldTypeName.Len() ); - aOptionButton.Enable( aOKButton.IsEnabled() && !bNone ); - aFormatText.Enable( !bNone ); - aFormatBox.Enable( !bNone ); - aSepText.Enable( !bNone ); - aSepEdit.Enable( !bNone ); + m_pOptionButton->Enable( m_pOKButton->IsEnabled() && !bNone ); + m_pNumberingSeparatorFT->Enable( bOrderNumberingFirst && !bNone ); + m_pNumberingSeparatorED->Enable( bOrderNumberingFirst && !bNone ); + m_pFormatText->Enable( !bNone ); + m_pFormatBox->Enable( !bNone ); + m_pSepText->Enable( !bNone ); + m_pSepEdit->Enable( !bNone ); DrawSample(); return 0; } @@ -363,15 +357,15 @@ IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl) void SwCaptionDialog::DrawSample() { String aStr; - String sCaption = aTextEdit.GetText(); + String sCaption = m_pTextEdit->GetText(); // number - String sFldTypeName = aCategoryBox.GetText(); + String sFldTypeName = m_pCategoryBox->GetText(); sal_Bool bNone = sFldTypeName == sNone; if( !bNone ) { - sal_uInt16 nNumFmt = (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( - aFormatBox.GetSelectEntryPos() ); + sal_uInt16 nNumFmt = (sal_uInt16)(sal_uIntPtr)m_pFormatBox->GetEntryData( + m_pFormatBox->GetSelectEntryPos() ); if( SVX_NUM_NUMBER_NONE != nNumFmt ) { // category @@ -412,51 +406,19 @@ void SwCaptionDialog::DrawSample() //#i61007# order of captions if( bOrderNumberingFirst ) { - aStr += aNumberingSeparatorED.GetText(); + aStr += m_pNumberingSeparatorED->GetText(); aStr += sFldTypeName; } } if( sCaption.Len() > 0 ) { - aStr += aSepEdit.GetText(); + aStr += m_pSepEdit->GetText(); } } aStr += sCaption; // do preview! - aPrevWin.SetPreviewText( aStr ); -} - -void SwCaptionDialog::CheckButtonWidth() -{ - // check if the text of the AutoCaption button is to wide - const long nOffset = 10; - String sText = aAutoCaptionButton.GetText(); - long nTxtW = aAutoCaptionButton.GetTextWidth( sText ); - if ( sText.Search( '~' ) == STRING_NOTFOUND ) - nTxtW += nOffset; - long nBtnW = aAutoCaptionButton.GetSizePixel().Width(); - if ( nTxtW > nBtnW ) - { - // then broaden all buttons - Size aNewSize; - long nDelta = Max( ( nTxtW - nBtnW ), nOffset ); - Button* pBtns[] = - { - &aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton - }; - Button** pCurrent = pBtns; - for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent ) - { - aNewSize = (*pCurrent)->GetSizePixel(); - aNewSize.Width() += nDelta; - (*pCurrent)->SetSizePixel( aNewSize ); - } - // and the dialog - aNewSize = GetOutputSizePixel(); - aNewSize.Width() += nDelta; - SetOutputSizePixel( aNewSize ); - } + m_pPreview->SetPreviewText( aStr ); } SwCaptionDialog::~SwCaptionDialog() @@ -558,7 +520,7 @@ void SwSequenceOptionDialog::SetCharacterStyle(const String& rStyle) aLbCharStyle.SelectEntry(rStyle); } -long SwCaptionDialog::CategoryBox::PreNotify( NotifyEvent& rNEvt ) +long CategoryBox::PreNotify( NotifyEvent& rNEvt ) { long nHandled = 0; if( rNEvt.GetType() == EVENT_KEYINPUT && @@ -587,43 +549,20 @@ long SwCaptionDialog::CategoryBox::PreNotify( NotifyEvent& rNEvt ) return nHandled; } -/*------------------------------------------------------------------------- - //#i61007# order of captions - -----------------------------------------------------------------------*/ -static void lcl_MoveH( Window& rWin, sal_Int32 nMove ) +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeCategoryBox(Window* pParent) { - Point aPos( rWin.GetPosPixel() ); - aPos.Y() += nMove; - rWin.SetPosPixel(aPos); + CategoryBox* pCategoryBox = new CategoryBox(pParent, WB_LEFT | WB_DROPDOWN | WB_VCENTER | WB_3DLOOK); + pCategoryBox->EnableAutoSize(true); + return pCategoryBox; } +/*------------------------------------------------------------------------- + //#i61007# order of captions + -----------------------------------------------------------------------*/ void SwCaptionDialog::ApplyCaptionOrder() { - //have the settings changed? - bool bVisible = aNumberingSeparatorED.IsVisible() != 0; - if( bOrderNumberingFirst != bVisible ) - { - sal_Int32 nDiff = aPosBox.GetPosPixel().Y() - aSepEdit.GetPosPixel().Y(); - - aNumberingSeparatorFT.Show( bOrderNumberingFirst ); - aNumberingSeparatorED.Show( bOrderNumberingFirst ); - if( !bOrderNumberingFirst ) - { - nDiff = -nDiff; - } - lcl_MoveH( aCategoryText, 2 * nDiff); - lcl_MoveH( aFormatText, -nDiff ); - lcl_MoveH( aFormatBox, -nDiff ); - lcl_MoveH( aCategoryBox, 2 * nDiff); - lcl_MoveH( aSepText, nDiff ); - lcl_MoveH( aSepEdit, nDiff ); - lcl_MoveH( aPosText, nDiff ); - lcl_MoveH( aPosBox, nDiff ); - lcl_MoveH( aPrevWin, nDiff ); - Size aDlgSize( GetSizePixel() ); - aDlgSize.Height() += nDiff; - SetSizePixel( aDlgSize ); - } + m_pNumberingSeparatorFT->Enable(bOrderNumberingFirst); + m_pNumberingSeparatorED->Enable(bOrderNumberingFirst); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/frmdlg/cption.hrc b/sw/source/ui/frmdlg/cption.hrc index fac440c76077..242599c20482 100644 --- a/sw/source/ui/frmdlg/cption.hrc +++ b/sw/source/ui/frmdlg/cption.hrc @@ -21,26 +21,12 @@ #define BTN_OK 1 #define BTN_CANCEL 2 -#define TXT_CATEGORY 4 -#define BOX_CATEGORY 5 -#define TXT_FORMAT 6 -#define BOX_FORMAT 7 -#define TXT_TEXT 8 -#define EDT_TEXT 9 -#define TXT_POS 10 -#define BOX_POS 11 -#define FL_SETTINGS 12 -#define BTN_HELP 13 -#define BTN_OPTION 14 -#define FL_HEADER 15 +#define BTN_HELP 13 +#define FL_HEADER 15 #define FT_LEVEL 16 #define LB_LEVEL 17 #define FT_SEPARATOR 18 #define ED_SEPARATOR 19 -#define BTN_AUTOCAPTION 23 -#define TXT_SEP 24 -#define EDT_SEP 25 -#define WIN_SAMPLE 26 #define FL_CATANDFRAME 27 #define FT_CHARSTYLE 28 @@ -50,9 +36,6 @@ #define FT_ORDER 32 #define LB_ORDER 33 -#define FT_NUM_SEP 34 -#define ED_NUM_SEP 35 - #define STR_BEGINNING 1 #define STR_END 2 #define STR_ABOVE 3 diff --git a/sw/source/ui/frmdlg/cption.src b/sw/source/ui/frmdlg/cption.src index 95613b8d4130..2587ba8b5a34 100644 --- a/sw/source/ui/frmdlg/cption.src +++ b/sw/source/ui/frmdlg/cption.src @@ -21,186 +21,6 @@ #include "cption.hrc" #include "cmdid.h" - // ModalDialog ************************************************************** -ModalDialog DLG_CAPTION -{ - HelpID = HID_DLG_CAPTION ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250 , 143 ) ; - Text [ en-US ] = "Caption" ; - Moveable = TRUE ; - OKButton BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 194 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_AUTOCAPTION - { - HelpID = "sw:PushButton:DLG_CAPTION:BTN_AUTOCAPTION"; - Pos = MAP_APPFONT ( 194 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "AutoCaption..." ; - }; - PushButton BTN_OPTION - { - HelpID = "sw:PushButton:DLG_CAPTION:BTN_OPTION"; - Pos = MAP_APPFONT ( 194 , 80 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Options..." ; - }; - - FixedText TXT_TEXT - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 182 , 8 ) ; - Text [ en-US ] = "Caption" ; - Left = TRUE ; - }; - Edit EDT_TEXT - { - HelpID = "sw:Edit:DLG_CAPTION:EDT_TEXT"; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 182 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - }; - FixedLine FL_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 35 ) ; - Size = MAP_APPFONT ( 182 , 8 ) ; - Text [ en-US ] = "Properties"; - }; - FixedText TXT_CATEGORY - { - Pos = MAP_APPFONT ( 12 , 49 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "Category" ; - Left = TRUE ; - }; - ComboBox BOX_CATEGORY - { - HelpID = "sw:ComboBox:DLG_CAPTION:BOX_CATEGORY"; - Pos = MAP_APPFONT ( 82 , 46 ) ; - Size = MAP_APPFONT ( 106 , 61 ) ; - DropDown = TRUE ; - TabStop = TRUE ; - Sort = TRUE ; - }; - FixedText TXT_FORMAT - { - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "Numbering" ; - Left = TRUE ; - }; - ListBox BOX_FORMAT - { - HelpID = "sw:ListBox:DLG_CAPTION:BOX_FORMAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 63 ) ; - Size = MAP_APPFONT ( 106 , 83 ) ; - DropDown = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_NUM_SEP - { - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "Numbering separator" ; - Left = TRUE ; - Hide = TRUE; - }; - Edit ED_NUM_SEP - { - HelpID = "sw:Edit:DLG_CAPTION:ED_NUM_SEP"; - Pos = MAP_APPFONT ( 82 , 63 ) ; - Size = MAP_APPFONT ( 106 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Text = ". " ; - Hide = TRUE; - }; - FixedText TXT_SEP - { - Pos = MAP_APPFONT ( 12 , 82 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "Separator" ; - Left = TRUE ; - }; - Edit EDT_SEP - { - HelpID = "sw:Edit:DLG_CAPTION:EDT_SEP"; - Pos = MAP_APPFONT ( 82 , 80 ) ; - Size = MAP_APPFONT ( 106 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Text [ en-US ] = ": " ; - }; - FixedText TXT_POS - { - Pos = MAP_APPFONT ( 12 , 100 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Position" ; - }; - ListBox BOX_POS - { - HelpID = "sw:ListBox:DLG_CAPTION:BOX_POS"; - Pos = MAP_APPFONT ( 82 , 97 ) ; - Size = MAP_APPFONT ( 106 , 61 ) ; - DropDown = TRUE ; - TabStop = TRUE ; - Border = TRUE ; - }; - Window WIN_SAMPLE - { - Pos = MAP_APPFONT ( 6 , 117 ) ; - Size = MAP_APPFONT ( 182 , 20 ) ; - Border = TRUE ; - }; - - String STR_BEGINNING - { - Text [ en-US ] = "Above" ; - }; - String STR_END - { - Text [ en-US ] = "Below" ; - }; - String STR_ABOVE - { - Text [ en-US ] = "Above" ; - }; - String STR_CP_BELOW - { - Text [ en-US ] = "Below" ; - }; - String STR_CATEGORY_NONE - { - Text [ en-US ] = "<None>" ; - }; -}; - ModalDialog DLG_SEQUENCE_OPTION { HelpID = HID_DLG_SEQUENCE_OPTION ; diff --git a/sw/source/ui/inc/cption.hxx b/sw/source/ui/inc/cption.hxx index ef6d9bd20130..ca73685ab337 100644 --- a/sw/source/ui/inc/cption.hxx +++ b/sw/source/ui/inc/cption.hxx @@ -49,43 +49,38 @@ class SwView; #include "optload.hxx" #include "swlbox.hxx" +class CategoryBox : public ComboBox +{ +public: + CategoryBox( Window* pParent, WinBits nStyle = 0 ) + : ComboBox( pParent, nStyle ) + {} + + virtual long PreNotify( NotifyEvent& rNEvt ); +}; + class SwCaptionDialog : public SvxStandardDialog { - class CategoryBox : public ComboBox - { - public: - CategoryBox( Window* pParent, const ResId& rResId ) - : ComboBox( pParent, rResId ) - {} - - virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - FixedText aTextText; - Edit aTextEdit; - FixedLine aSettingsFL; - FixedText aCategoryText; - CategoryBox aCategoryBox; - FixedText aFormatText; - ListBox aFormatBox; + Edit* m_pTextEdit; + CategoryBox* m_pCategoryBox; + FixedText* m_pFormatText; + ListBox* m_pFormatBox; //#i61007# order of captions - FixedText aNumberingSeparatorFT; - Edit aNumberingSeparatorED; - FixedText aSepText; - Edit aSepEdit; - FixedText aPosText; - ListBox aPosBox; - OKButton aOKButton; - CancelButton aCancelButton; - HelpButton aHelpButton; - PushButton aAutoCaptionButton; - PushButton aOptionButton; + FixedText* m_pNumberingSeparatorFT; + Edit* m_pNumberingSeparatorED; + FixedText* m_pSepText; + Edit* m_pSepEdit; + FixedText* m_pPosText; + ListBox* m_pPosBox; + OKButton* m_pOKButton; + PushButton* m_pAutoCaptionButton; + PushButton* m_pOptionButton; + + SwCaptionPreview* m_pPreview; String sNone; - SwCaptionPreview aPrevWin; - SwView &rView; // search per active, avoid ::com::sun::star::sdbcx::View SwFldMgr *pMgr; // pointer to save the include SelectionType eType; @@ -100,7 +95,7 @@ class SwCaptionDialog : public SvxStandardDialog DECL_LINK(SelectHdl, void *); DECL_LINK(ModifyHdl, void *); - DECL_LINK( OptionHdl, Button * ); + DECL_LINK(OptionHdl, Button *); DECL_LINK(CaptionHdl, void *); virtual void Apply(); diff --git a/sw/source/ui/inc/optload.hxx b/sw/source/ui/inc/optload.hxx index 162bf6e95457..6a709fbe4c49 100644 --- a/sw/source/ui/inc/optload.hxx +++ b/sw/source/ui/inc/optload.hxx @@ -98,12 +98,14 @@ public: class SwCaptionPreview : public Window { private: - String maText; - Point maDrawPos; + String maText; + Point maDrawPos; public: - SwCaptionPreview( Window* pParent, const ResId& rResId ); - void SetPreviewText( const String& rText ); - virtual void Paint( const Rectangle& rRect ); + SwCaptionPreview( Window* pParent ); + SwCaptionPreview( Window* pParent, const ResId& rResId ); + void Init(); + void SetPreviewText( const String& rText ); + virtual void Paint( const Rectangle& rRect ); }; class SwCaptionOptPage : public SfxTabPage diff --git a/sw/uiconfig/swriter/ui/insertcaption.ui b/sw/uiconfig/swriter/ui/insertcaption.ui new file mode 100644 index 000000000000..7a95855fa3d3 --- /dev/null +++ b/sw/uiconfig/swriter/ui/insertcaption.ui @@ -0,0 +1,401 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="InsertCaptionDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Insert Caption</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkEntry" id="caption_edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <property name="invisible_char_set">True</property> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Caption</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="numbering_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Numbering</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="separator_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_right">12</property> + <property name="label" translatable="yes">Separator</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="position_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_right">12</property> + <property name="label" translatable="yes">Position</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="numbering"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="separator_edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="text" translatable="yes">: </property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="num_separator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_right">12</property> + <property name="label" translatable="yes">Numbering separator</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="num_seperator_edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="text" translatable="yes">. </property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="position"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_right">12</property> + <property name="label" translatable="yes">Category</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="swuilo:CategoryBox" id="category"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Properties</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="swuilo:SwCaptionPreview" id="preview"> + <property name="width_request">200</property> + <property name="height_request">50</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Preview</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="auto"> + <property name="label" translatable="yes">Auto...</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="options"> + <property name="label" translatable="yes">Options...</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + <action-widget response="0">auto</action-widget> + <action-widget response="0">options</action-widget> + </action-widgets> + </object> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">1</property> + <property name="upper">9999</property> + <property name="value">1</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkListStore" id="liststore1"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">[None]</col> + </row> + </data> + </object> +</interface> |