diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-30 14:28:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-30 15:16:09 +0000 |
commit | f046e85cc9feb7bcb221c2a83f004c5f238235d5 (patch) | |
tree | 36b8252be82a1cf0d15ef95129245e34377a1b16 /sw/source/ui/misc/docfnote.cxx | |
parent | 41946925ee87808e31956ee2cf5a92c1e5d3613a (diff) |
convert end/footnote dialog to .ui
Change-Id: I22c7e030a77f125f70b1b532b3c07c5a405b18b0
Diffstat (limited to 'sw/source/ui/misc/docfnote.cxx')
-rw-r--r-- | sw/source/ui/misc/docfnote.cxx | 239 |
1 files changed, 108 insertions, 131 deletions
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index cb7597f0f20c..aa80d7f8a3c0 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -43,7 +43,6 @@ #include <swstyle.h> #include <helpid.h> #include <misc.hrc> -#include <docfnote.hrc> #include <frmui.hrc> #include <SwStyleNameMapper.hxx> @@ -87,58 +86,54 @@ IMPL_LINK( SwFootNoteOptionDlg, OkHdl, Button *, pBtn ) //---------------------------------------------------------------------- -SwEndNoteOptionPage::SwEndNoteOptionPage( Window *pParent, sal_Bool bEN, - const SfxItemSet &rSet ) : - SfxTabPage( pParent, SW_RES(bEN ? TP_ENDNOTEOPTION : TP_FOOTNOTEOPTION), rSet ), - aNumFL (this, SW_RES( FL_NUM )), - - aNumTypeFT (this, SW_RES( FT_NUMTYPE )), - aNumViewBox (this, SW_RES( LB_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), - aOffsetLbl (this, SW_RES( FT_OFFSET )), - aOffsetFld (this, SW_RES( FLD_OFFSET )), - aNumCountFT (this, SW_RES( FT_NUMCOUNT )), - aNumCountBox (this, SW_RES( LB_NUMCOUNT )), - aPrefixFT (this, SW_RES( FT_PREFIX )), - aPrefixED (this, SW_RES( ED_PREFIX )), - aSuffixFT (this, SW_RES( FT_SUFFIX )), - aSuffixED (this, SW_RES( ED_SUFFIX )), - aPosFT (this, SW_RES( FT_POS )), - aPosPageBox (this, SW_RES( RB_POS_PAGE )), - aPosChapterBox (this, SW_RES( RB_POS_CHAPTER)), - - aTemplFL (this, SW_RES( FL_TEMPL )), - aParaTemplLbl (this, SW_RES( FT_PARA_TEMPL)), - aParaTemplBox (this, SW_RES( LB_PARA_TEMPL)), - aPageTemplLbl (this, SW_RES( FT_PAGE_TEMPL)), - aPageTemplBox (this, SW_RES( LB_PAGE_TEMPL)), - - aCharTemplFL( this, SW_RES(FL_CHAR_TEMPL)), - aFtnCharAnchorTemplLbl( this, SW_RES( FT_ANCHR_CHARFMT)), - aFtnCharAnchorTemplBox( this, SW_RES( LB_ANCHR_CHARFMT)), - aFtnCharTextTemplLbl( this, SW_RES( FT_TEXT_CHARFMT)), - aFtnCharTextTemplBox( this, SW_RES( LB_TEXT_CHARFMT)), - - aContFL (this, SW_RES( FL_CONT )), - aContLbl (this, SW_RES( FT_CONT )), - aContEdit (this, SW_RES( ED_CONT )), - aContFromLbl (this, SW_RES( FT_CONT_FROM )), - aContFromEdit (this, SW_RES( ED_CONT_FROM )), - - aNumDoc(aNumCountBox.GetEntry(FTNNUM_DOC)), - aNumPage(aNumCountBox.GetEntry(FTNNUM_PAGE)), - aNumChapter(aNumCountBox.GetEntry(FTNNUM_CHAPTER)), - pSh( 0 ), - bPosDoc(sal_False), - bEndNote( bEN ) +SwEndNoteOptionPage::SwEndNoteOptionPage(Window *pParent, sal_Bool bEN, + const SfxItemSet &rSet) + : SfxTabPage(pParent, + bEN ? OString("EndnotePage") : OString("FootnotePage"), + bEN ? OUString("modules/swriter/ui/endnotepage.ui") : OUString("modules/swriter/ui/footnotepage.ui"), + rSet) + , pSh(0) + , bPosDoc(sal_False) + , bEndNote(bEN) { - FreeResource(); + get(m_pNumViewBox, "numberinglb"); + get(m_pOffsetLbl, "offset"); + get(m_pOffsetFld, "offsetnf"); + get(m_pPrefixED, "prefix"); + get(m_pSuffixED, "suffix"); - aPosPageBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosPageHdl)); - aPosChapterBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosChapterHdl)); - aNumCountBox.SetSelectHdl(LINK(this, SwEndNoteOptionPage, NumCountHdl)); + if (!bEndNote) + { + get(m_pNumCountBox, "countinglb"); + m_pNumCountBox->SetSelectHdl(LINK(this, SwEndNoteOptionPage, NumCountHdl)); + aNumDoc = m_pNumCountBox->GetEntry(FTNNUM_DOC); + aNumPage = m_pNumCountBox->GetEntry(FTNNUM_PAGE); + aNumChapter = m_pNumCountBox->GetEntry(FTNNUM_CHAPTER); + get(m_pPosPageBox, "pospagecb"); + m_pPosPageBox->SetClickHdl(LINK(this, SwEndNoteOptionPage, PosPageHdl)); + get(m_pPosChapterBox, "posdoccb"); + m_pPosChapterBox->SetClickHdl(LINK(this, SwEndNoteOptionPage, PosChapterHdl)); + get(m_pPosFT, "pos"); + m_pPosPageBox->SetAccessibleRelationMemberOf(m_pPosFT); + m_pPosChapterBox->SetAccessibleRelationMemberOf(m_pPosFT); + get(m_pContEdit, "conted"); + get(m_pContFromEdit, "contfromed"); + } - aPosPageBox.SetAccessibleRelationMemberOf(&aPosFT); - aPosChapterBox.SetAccessibleRelationMemberOf(&aPosFT); + get(m_pStylesContainer, "allstyles"); + get(m_pParaTemplBox, "parastylelb"); + get(m_pPageTemplLbl, "pagestyleft"); + get(m_pPageTemplBox, "pagestylelb"); + get(m_pFtnCharAnchorTemplBox, "charanchorstylelb"); + get(m_pFtnCharTextTemplBox, "charstylelb"); + + long nWidth = std::max(std::max( + m_pPrefixED->get_preferred_size().Width(), + m_pSuffixED->get_preferred_size().Width()), + m_pNumViewBox->get_preferred_size().Width()); + m_pPrefixED->set_width_request(nWidth); + m_pSuffixED->set_width_request(nWidth); + m_pNumViewBox->set_width_request(nWidth); } void SwEndNoteOptionPage::Reset( const SfxItemSet& ) @@ -148,29 +143,11 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) SfxObjectShell * pDocSh = SfxObjectShell::Current(); sal_uInt16 i; - if(PTR_CAST(SwWebDocShell, pDocSh)) - { - aParaTemplLbl .Hide(); - aParaTemplBox .Hide(); - aPageTemplLbl .Hide(); - aPageTemplBox .Hide(); - aFtnCharTextTemplLbl.Hide(); - aFtnCharTextTemplBox.Hide(); - aFtnCharAnchorTemplLbl.Hide(); - aFtnCharAnchorTemplBox.Hide(); - aCharTemplFL .Hide(); - aTemplFL .Hide(); - } + if (PTR_CAST(SwWebDocShell, pDocSh)) + m_pStylesContainer->Hide(); + if ( bEndNote ) { - aPosPageBox.Hide(); - aPosChapterBox.Hide(); - aNumCountBox.Hide(); - aContLbl.Hide(); - aContEdit.Hide(); - aContFromLbl.Hide(); - aContFromEdit.Hide(); - aContFL.Hide(); bPosDoc = sal_True; } else @@ -179,20 +156,20 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) // set position (page, chapter) if ( rInf.ePos == FTNPOS_PAGE ) { - aPosPageBox.Check(); - aPageTemplLbl.Enable(sal_False); - aPageTemplBox.Enable(sal_False); + m_pPosPageBox->Check(); + m_pPageTemplLbl->Enable(sal_False); + m_pPageTemplBox->Enable(sal_False); } else { - aPosChapterBox.Check(); - aNumCountBox.RemoveEntry(aNumPage); - aNumCountBox.RemoveEntry(aNumChapter); + m_pPosChapterBox->Check(); + m_pNumCountBox->RemoveEntry(aNumPage); + m_pNumCountBox->RemoveEntry(aNumChapter); bPosDoc = sal_True; } // reference tests - aContEdit.SetText(rInf.aQuoVadis); - aContFromEdit.SetText(rInf.aErgoSum); + m_pContEdit->SetText(rInf.aQuoVadis); + m_pContFromEdit->SetText(rInf.aErgoSum); // collected SelectNumbering(rInf.eNum); @@ -200,19 +177,19 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) // numbering // art - aNumViewBox.SelectNumberingType( pInf->aFmt.GetNumberingType()); - aOffsetFld.SetValue(pInf->nFtnOffset + 1); - aPrefixED.SetText(pInf->GetPrefix()); - aSuffixED.SetText(pInf->GetSuffix()); + m_pNumViewBox->SelectNumberingType( pInf->aFmt.GetNumberingType()); + m_pOffsetFld->SetValue(pInf->nFtnOffset + 1); + m_pPrefixED->SetText(pInf->GetPrefix()); + m_pSuffixED->SetText(pInf->GetSuffix()); const SwCharFmt* pCharFmt = pInf->GetCharFmt( *pSh->GetView().GetDocShell()->GetDoc()); - aFtnCharTextTemplBox.SelectEntry(pCharFmt->GetName()); - aFtnCharTextTemplBox.SaveValue(); + m_pFtnCharTextTemplBox->SelectEntry(pCharFmt->GetName()); + m_pFtnCharTextTemplBox->SaveValue(); pCharFmt = pInf->GetAnchorCharFmt( *pSh->GetDoc() ); - aFtnCharAnchorTemplBox.SelectEntry( pCharFmt->GetName() ); - aFtnCharAnchorTemplBox.SaveValue(); + m_pFtnCharAnchorTemplBox->SelectEntry( pCharFmt->GetName() ); + m_pFtnCharAnchorTemplBox->SaveValue(); // styles special regions // paragraph @@ -221,45 +198,45 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); while(pStyle) { - aParaTemplBox.InsertEntry(pStyle->GetName()); + m_pParaTemplBox->InsertEntry(pStyle->GetName()); pStyle = pStyleSheetPool->Next(); } String sStr; SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(bEndNote ? RES_POOLCOLL_ENDNOTE : RES_POOLCOLL_FOOTNOTE), sStr ); - if(LISTBOX_ENTRY_NOTFOUND == aParaTemplBox.GetEntryPos( sStr ) ) - aParaTemplBox.InsertEntry( sStr ); + if(LISTBOX_ENTRY_NOTFOUND == m_pParaTemplBox->GetEntryPos( sStr ) ) + m_pParaTemplBox->InsertEntry( sStr ); SwTxtFmtColl* pColl = pInf->GetFtnTxtColl(); if( !pColl ) - aParaTemplBox.SelectEntry( sStr ); // Default + m_pParaTemplBox->SelectEntry( sStr ); // Default else { OSL_ENSURE(!pColl->IsDefault(), "default style for footnotes is wrong"); - const sal_uInt16 nPos = aParaTemplBox.GetEntryPos(pColl->GetName()); + const sal_uInt16 nPos = m_pParaTemplBox->GetEntryPos(pColl->GetName()); if( LISTBOX_ENTRY_NOTFOUND != nPos ) - aParaTemplBox.SelectEntryPos( nPos ); + m_pParaTemplBox->SelectEntryPos( nPos ); else { - aParaTemplBox.InsertEntry(pColl->GetName()); - aParaTemplBox.SelectEntry(pColl->GetName()); + m_pParaTemplBox->InsertEntry(pColl->GetName()); + m_pParaTemplBox->SelectEntry(pColl->GetName()); } } // page for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i ) - aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr )); + m_pPageTemplBox->InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr )); sal_uInt16 nCount = pSh->GetPageDescCnt(); for(i = 0; i < nCount; ++i) { const SwPageDesc &rPageDesc = pSh->GetPageDesc(i); - if(LISTBOX_ENTRY_NOTFOUND == aPageTemplBox.GetEntryPos(rPageDesc.GetName())) - aPageTemplBox.InsertEntry(rPageDesc.GetName()); + if(LISTBOX_ENTRY_NOTFOUND == m_pPageTemplBox->GetEntryPos(rPageDesc.GetName())) + m_pPageTemplBox->InsertEntry(rPageDesc.GetName()); } - aPageTemplBox.SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName()); + m_pPageTemplBox->SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName()); delete pInf; } @@ -296,15 +273,15 @@ void SwEndNoteOptionPage::SelectNumbering(int eNum) OSL_FAIL("Which numbering type?"); #endif } - aNumCountBox.SelectEntry(sSelect); - NumCountHdl( &aNumCountBox ); + m_pNumCountBox->SelectEntry(sSelect); + NumCountHdl(m_pNumCountBox); } int SwEndNoteOptionPage::GetNumbering() const { - const sal_uInt16 nPos = aNumCountBox.GetSelectEntryPos(); + const sal_uInt16 nPos = m_pNumCountBox->GetSelectEntryPos(); return (int) bPosDoc? nPos + 1: nPos; } @@ -312,12 +289,12 @@ void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell ) { pSh = &rShell; // collect character templates - aFtnCharTextTemplBox.Clear(); - aFtnCharAnchorTemplBox.Clear(); - ::FillCharStyleListBox(aFtnCharTextTemplBox, + m_pFtnCharTextTemplBox->Clear(); + m_pFtnCharAnchorTemplBox->Clear(); + ::FillCharStyleListBox(*m_pFtnCharTextTemplBox, pSh->GetView().GetDocShell()); - ::FillCharStyleListBox(aFtnCharAnchorTemplBox, + ::FillCharStyleListBox(*m_pFtnCharAnchorTemplBox, pSh->GetView().GetDocShell()); } @@ -331,14 +308,14 @@ IMPL_LINK_NOARG(SwEndNoteOptionPage, PosPageHdl) { const SwFtnNum eNum = (const SwFtnNum)GetNumbering(); bPosDoc = sal_False; - if(LISTBOX_ENTRY_NOTFOUND == aNumCountBox.GetEntryPos(aNumPage)) + if(LISTBOX_ENTRY_NOTFOUND == m_pNumCountBox->GetEntryPos(aNumPage)) { - aNumCountBox.InsertEntry(aNumPage, FTNNUM_PAGE); - aNumCountBox.InsertEntry(aNumChapter, FTNNUM_CHAPTER); + m_pNumCountBox->InsertEntry(aNumPage, FTNNUM_PAGE); + m_pNumCountBox->InsertEntry(aNumChapter, FTNNUM_CHAPTER); SelectNumbering(eNum); } - aPageTemplLbl.Enable(sal_False); - aPageTemplBox.Enable(sal_False); + m_pPageTemplLbl->Enable(sal_False); + m_pPageTemplBox->Enable(sal_False); return 0; } @@ -346,13 +323,13 @@ IMPL_LINK_NOARG(SwEndNoteOptionPage, PosPageHdl) IMPL_LINK_NOARG(SwEndNoteOptionPage, NumCountHdl) { sal_Bool bEnable = sal_True; - if( aNumCountBox.GetEntryCount() - 1 != aNumCountBox.GetSelectEntryPos() ) + if( m_pNumCountBox->GetEntryCount() - 1 != m_pNumCountBox->GetSelectEntryPos() ) { bEnable = sal_False; - aOffsetFld.SetValue(1); + m_pOffsetFld->SetValue(1); } - aOffsetLbl.Enable(bEnable); - aOffsetFld.Enable(bEnable); + m_pOffsetLbl->Enable(bEnable); + m_pOffsetFld->Enable(bEnable); return 0; } @@ -369,10 +346,10 @@ IMPL_LINK_NOARG_INLINE_START(SwEndNoteOptionPage, PosChapterHdl) SelectNumbering(FTNNUM_DOC); bPosDoc = sal_True; - aNumCountBox.RemoveEntry(aNumPage); - aNumCountBox.RemoveEntry(aNumChapter); - aPageTemplLbl.Enable(); - aPageTemplBox.Enable(); + m_pNumCountBox->RemoveEntry(aNumPage); + m_pNumCountBox->RemoveEntry(aNumChapter); + m_pPageTemplLbl->Enable(); + m_pPageTemplBox->Enable(); return 0; } IMPL_LINK_NOARG_INLINE_END(SwEndNoteOptionPage, PosChapterHdl) @@ -406,21 +383,21 @@ sal_Bool SwEndNoteOptionPage::FillItemSet( SfxItemSet & ) { SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo() : new SwFtnInfo(); - pInf->nFtnOffset = static_cast< sal_uInt16 >(aOffsetFld.GetValue() -1); - pInf->aFmt.SetNumberingType(aNumViewBox.GetSelectedNumberingType() ); - pInf->SetPrefix(aPrefixED.GetText()); - pInf->SetSuffix(aSuffixED.GetText()); + pInf->nFtnOffset = static_cast< sal_uInt16 >(m_pOffsetFld->GetValue() -1); + pInf->aFmt.SetNumberingType(m_pNumViewBox->GetSelectedNumberingType() ); + pInf->SetPrefix(m_pPrefixED->GetText()); + pInf->SetSuffix(m_pSuffixED->GetText()); pInf->SetCharFmt( lcl_GetCharFormat( pSh, - aFtnCharTextTemplBox.GetSelectEntry() ) ); + m_pFtnCharTextTemplBox->GetSelectEntry() ) ); pInf->SetAnchorCharFmt( lcl_GetCharFormat( pSh, - aFtnCharAnchorTemplBox.GetSelectEntry() ) ); + m_pFtnCharAnchorTemplBox->GetSelectEntry() ) ); // paragraph template - sal_uInt16 nPos = aParaTemplBox.GetSelectEntryPos(); + sal_uInt16 nPos = m_pParaTemplBox->GetSelectEntryPos(); if(LISTBOX_ENTRY_NOTFOUND != nPos) { - const String aFmtName( aParaTemplBox.GetSelectEntry() ); + const String aFmtName( m_pParaTemplBox->GetSelectEntry() ); SwTxtFmtColl *pColl = pSh->GetParaStyle(aFmtName, SwWrtShell::GETSTYLE_CREATEANY); OSL_ENSURE(pColl, "paragraph style not found"); pInf->SetFtnTxtColl(*pColl); @@ -428,7 +405,7 @@ sal_Bool SwEndNoteOptionPage::FillItemSet( SfxItemSet & ) // page template pInf->ChgPageDesc( pSh->FindPageDescByName( - aPageTemplBox.GetSelectEntry(), sal_True ) ); + m_pPageTemplBox->GetSelectEntry(), sal_True ) ); if ( bEndNote ) { @@ -438,10 +415,10 @@ sal_Bool SwEndNoteOptionPage::FillItemSet( SfxItemSet & ) else { SwFtnInfo *pI = (SwFtnInfo*)pInf; - pI->ePos = aPosPageBox.IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER; + pI->ePos = m_pPosPageBox->IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER; pI->eNum = (SwFtnNum)GetNumbering(); - pI->aQuoVadis = aContEdit.GetText(); - pI->aErgoSum = aContFromEdit.GetText(); + pI->aQuoVadis = m_pContEdit->GetText(); + pI->aErgoSum = m_pContFromEdit->GetText(); if ( !(*pI == pSh->GetFtnInfo()) ) pSh->SetFtnInfo( *pI ); } |