From 6a5eeaee0853c87e498ebd0546d97e9177dc4190 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 12 Aug 2013 14:49:14 +0100 Subject: convert visiting cards page to .ui Change-Id: Id541e1749572701827ab5a49df5197f77554c789 --- sw/UIConfig_swriter.mk | 1 + sw/inc/helpid.h | 2 - sw/source/ui/envelp/label.hrc | 8 -- sw/source/ui/envelp/label.src | 44 ----------- sw/source/ui/envelp/label1.cxx | 73 ++++++++--------- sw/source/ui/envelp/labelexp.cxx | 32 ++++---- sw/source/ui/envelp/swuilabimp.hxx | 10 +-- sw/uiconfig/swriter/ui/cardformatpage.ui | 129 +++++++++++++++++++++++++++++++ 8 files changed, 183 insertions(+), 116 deletions(-) create mode 100644 sw/uiconfig/swriter/ui/cardformatpage.ui diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 311364ce8cb6..8cb55b4c7ab1 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -68,6 +68,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/bulletsandnumbering \ sw/uiconfig/swriter/ui/cannotsavelabeldialog \ sw/uiconfig/swriter/ui/captionoptions \ + sw/uiconfig/swriter/ui/cardformatpage \ sw/uiconfig/swriter/ui/cardmediumpage \ sw/uiconfig/swriter/ui/characterproperties \ sw/uiconfig/swriter/ui/charurlpage \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 3c54ef4f33fb..0766a2b6c898 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -166,7 +166,6 @@ #define HID_OPTCAPTION_PAGE "SW_HID_OPTCAPTION_PAGE" #define HID_TP_TOX_SELECT "SW_HID_TP_TOX_SELECT" #define HID_TP_TOX_ENTRY "SW_HID_TP_TOX_ENTRY" -#define HID_TP_VISITING_CARDS "SW_HID_TP_VISITING_CARDS" #define HID_DLG_ADD_IDX_STYLES "SW_HID_DLG_ADD_IDX_STYLES" #define HID_ADD_STYLES_TLB "SW_HID_ADD_STYLES_TLB" #define HID_OLE_CHECKLB "SW_HID_OLE_CHECKLB" @@ -394,7 +393,6 @@ #define HID_AUTH_FIELD_ISBN "SW_HID_AUTH_FIELD_ISBN" #define HID_INSERT_INDEX_ENTRY_LEVEL_LB "SW_HID_INSERT_INDEX_ENTRY_LEVEL_LB" -#define HID_BUSINESS_CARD_CONTENT "SW_HID_BUSINESS_CARD_CONTENT" #define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE" #define HID_BUSINESS_FMT_PAGE_CONT "SW_HID_BUSINESS_FMT_PAGE_CONT" #define HID_BUSINESS_FMT_PAGE_SHEET "SW_HID_BUSINESS_FMT_PAGE_SHEET" diff --git a/sw/source/ui/envelp/label.hrc b/sw/source/ui/envelp/label.hrc index b7bfaefc735a..4130face98d2 100644 --- a/sw/source/ui/envelp/label.hrc +++ b/sw/source/ui/envelp/label.hrc @@ -26,14 +26,6 @@ #define BTN_SYNC 20 -#define LB_AUTO_TEXT 3 -#define FT_AUTO_TEXT_GROUP 4 -#define LB_AUTO_TEXT_GROUP 5 -#define ED_TEXT 6 -#define FL_CONTENT 7 -#define WIN_EXAMPLE 8 -#define ST_VISCARD_GROUP 10 - #define FL_DATA 30 #define FT_NAME 31 #define ED_FIRSTNAME 32 diff --git a/sw/source/ui/envelp/label.src b/sw/source/ui/envelp/label.src index 4008642045fe..d19939c850a8 100644 --- a/sw/source/ui/envelp/label.src +++ b/sw/source/ui/envelp/label.src @@ -116,50 +116,6 @@ String STR_CUSTOM Text [ en-US ] = "[User]"; }; /********************************************************************/ -TabPage TP_VISITING_CARDS -{ - HelpID = HID_TP_VISITING_CARDS ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - Hide = TRUE ; - - Control LB_AUTO_TEXT - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 109 , 135 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_AUTO_TEXT_GROUP - { - Pos = MAP_APPFONT ( 12 , 153) ; - Size = MAP_APPFONT ( 109 , 8 ) ; - Text [ en-US ] = "AutoText - Section"; - }; - ListBox LB_AUTO_TEXT_GROUP - { - HelpID = "sw:ListBox:TP_VISITING_CARDS:LB_AUTO_TEXT_GROUP"; - Pos = MAP_APPFONT ( 12 , 164) ; - Size = MAP_APPFONT ( 109 , 50 ) ; - Border = TRUE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedLine FL_CONTENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Content"; - }; - Window WIN_EXAMPLE - { - Pos = MAP_APPFONT ( 139, 14 ) ; - Size = MAP_APPFONT ( 109 , 162 ) ; - }; - String ST_VISCARD_GROUP - { - Text = "Cards"; - }; -}; TabPage TP_PRIVATE_DATA { HelpID = HID_TP_PRIVATE_DATA ; diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index d9383708f9c1..188ef9f197e9 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -548,11 +548,11 @@ void SwLabPage::Reset(const SfxItemSet& rSet) void SwVisitingCardPage::ClearUserData() { - SvTreeListEntry* pEntry = aAutoTextLB.First(); + SvTreeListEntry* pEntry = m_pAutoTextLB->First(); while(pEntry) { delete (String*)pEntry->GetUserData(); - pEntry = aAutoTextLB.Next(pEntry); + pEntry = m_pAutoTextLB->Next(pEntry); } } @@ -561,43 +561,38 @@ void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt, { for( sal_uInt32 i = 0; i < nCnt; ++i ) { - SvTreeListEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] ); + SvTreeListEntry* pEntry = m_pAutoTextLB->InsertEntry( pNames[ i ] ); pEntry->SetUserData( new String( pValues[ i ] )); } } -SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) : - SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet), - aContentFL(this, SW_RES( FL_CONTENT )), - aAutoTextLB(this, SW_RES( LB_AUTO_TEXT )), - aAutoTextGroupFT(this, SW_RES( FT_AUTO_TEXT_GROUP )), - aAutoTextGroupLB(this, SW_RES( LB_AUTO_TEXT_GROUP )), - aExampleWIN(this, SW_RES( WIN_EXAMPLE )), - sVisCardGroup(SW_RES(ST_VISCARD_GROUP)), - pExampleFrame(0) +SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "CardFormatPage", + "modules/swriter/ui/cardformatpage.ui", rSet) + , pExampleFrame(0) { - FreeResource(); - aAutoTextLB.SetStyle( aAutoTextLB.GetStyle() | WB_HSCROLL ); - aAutoTextLB.SetSpaceBetweenEntries(0); - aAutoTextLB.SetSelectionMode( SINGLE_SELECTION ); - aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT); + get(m_pAutoTextLB, "treeview"); + m_pAutoTextLB->set_height_request(m_pAutoTextLB->GetTextHeight() * 16); + get(m_pAutoTextGroupLB, "autotext"); + get(m_pExampleWIN, "preview"); + + m_pAutoTextLB->SetStyle( m_pAutoTextLB->GetStyle() | WB_HSCROLL ); + m_pAutoTextLB->SetSpaceBetweenEntries(0); + m_pAutoTextLB->SetSelectionMode( SINGLE_SELECTION ); SetExchangeSupport(); - aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); - aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); + m_pAutoTextLB->SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); + m_pAutoTextGroupLB->SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl)); - aExampleWIN.Hide(); + m_pExampleWIN->Hide(); - aAutoTextLB.Show(); - aAutoTextGroupFT.Show(); - aAutoTextGroupLB.Show(); InitFrameControl(); } SwVisitingCardPage::~SwVisitingCardPage() { - for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++) - delete (String*)aAutoTextGroupLB.GetEntryData( i ); + for(sal_uInt16 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); i++) + delete (String*)m_pAutoTextGroupLB->GetEntryData( i ); m_xAutoText = 0; ClearUserData(); @@ -624,14 +619,14 @@ int SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet) sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet) { - String* pGroup = (String*)aAutoTextGroupLB.GetEntryData( - aAutoTextGroupLB.GetSelectEntryPos()); + String* pGroup = (String*)m_pAutoTextGroupLB->GetEntryData( + m_pAutoTextGroupLB->GetSelectEntryPos()); OSL_ENSURE(pGroup, "no group selected?"); if(pGroup) aLabItem.sGlossaryGroup = *pGroup; - SvTreeListEntry* pSelEntry = aAutoTextLB.FirstSelected(); + SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); if(pSelEntry) aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData(); rSet.Put(aLabItem); @@ -674,9 +669,9 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) bool bFound = false; sal_uInt16 i; - for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++) + for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount() && !bFound; i++) if( String(aLabItem.sGlossaryGroup) == - *(String*)aAutoTextGroupLB.GetEntryData( i )) + *(String*)m_pAutoTextGroupLB->GetEntryData( i )) { bFound = true; break; @@ -686,8 +681,8 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) { // initially search for a group starting with "crd" which is the name of the // business card AutoTexts - for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++) - if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") ) + for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount() && !bFound; i++) + if(0 == (*(String*)m_pAutoTextGroupLB->GetEntryData( i )).SearchAscii( "crd") ) { bFound = true; break; @@ -695,19 +690,19 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) } if(bFound) { - if(aAutoTextGroupLB.GetSelectEntryPos() != i) + if(m_pAutoTextGroupLB->GetSelectEntryPos() != i) { - aAutoTextGroupLB.SelectEntryPos(i); - AutoTextSelectHdl(&aAutoTextGroupLB); + m_pAutoTextGroupLB->SelectEntryPos(i); + AutoTextSelectHdl(m_pAutoTextGroupLB); } - if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName)) + if(lcl_FindBlock(*m_pAutoTextLB, aLabItem.sGlossaryBlockName)) { - SvTreeListEntry* pSelEntry = aAutoTextLB.FirstSelected(); + SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); if( pSelEntry && *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName)) { - lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName); - AutoTextSelectHdl(&aAutoTextLB); + lcl_SelectBlock(*m_pAutoTextLB, aLabItem.sGlossaryBlockName); + AutoTextSelectHdl(m_pAutoTextLB); } } } diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx index 7104b8829fb3..b8ae603439a2 100644 --- a/sw/source/ui/envelp/labelexp.cxx +++ b/sw/source/ui/envelp/labelexp.cxx @@ -45,8 +45,8 @@ using namespace ::comphelper; void SwVisitingCardPage::InitFrameControl() { Link aLink(LINK(this, SwVisitingCardPage, FrameControlInitializedHdl)); - aExampleWIN.Show(); - pExampleFrame = new SwOneExampleFrame( aExampleWIN, + m_pExampleWIN->Show(); + pExampleFrame = new SwOneExampleFrame( *m_pExampleWIN, EX_SHOW_BUSINESS_CARDS, &aLink ); Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -74,20 +74,20 @@ void SwVisitingCardPage::InitFrameControl() OUString uTitle; aTitle >>= uTitle; String sGroup(pGroups[i]); - sal_uInt16 nEntry = aAutoTextGroupLB.InsertEntry(uTitle); - aAutoTextGroupLB.SetEntryData(nEntry, new String(sGroup)); + sal_uInt16 nEntry = m_pAutoTextGroupLB->InsertEntry(uTitle); + m_pAutoTextGroupLB->SetEntryData(nEntry, new String(sGroup)); } } catch (const Exception&) { } } - if(aAutoTextGroupLB.GetEntryCount()) + if(m_pAutoTextGroupLB->GetEntryCount()) { - if(LISTBOX_ENTRY_NOTFOUND == aAutoTextGroupLB.GetSelectEntryPos()) - aAutoTextGroupLB.SelectEntryPos(0); + if(LISTBOX_ENTRY_NOTFOUND == m_pAutoTextGroupLB->GetSelectEntryPos()) + m_pAutoTextGroupLB->SelectEntryPos(0); String sCurGroupName( - *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos())); + *(String*)m_pAutoTextGroupLB->GetEntryData(m_pAutoTextGroupLB->GetSelectEntryPos())); if(m_xAutoText->hasByName(sCurGroupName)) { uno::Any aGroup = m_xAutoText->getByName(sCurGroupName); @@ -111,17 +111,17 @@ void SwVisitingCardPage::InitFrameControl() IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) { - SvTreeListEntry* pSel = aAutoTextLB.FirstSelected(); + SvTreeListEntry* pSel = m_pAutoTextLB->FirstSelected(); String sEntry; if( pSel ) sEntry = *(String*)pSel->GetUserData(); uno::Reference< text::XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); OUString uEntry(sEntry); - if(LISTBOX_ENTRY_NOTFOUND != aAutoTextGroupLB.GetSelectEntryPos()) + if(LISTBOX_ENTRY_NOTFOUND != m_pAutoTextGroupLB->GetSelectEntryPos()) { - String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( - aAutoTextGroupLB.GetSelectEntryPos() ) ); + String sGroup( *(String*)m_pAutoTextGroupLB->GetEntryData( + m_pAutoTextGroupLB->GetSelectEntryPos() ) ); uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; @@ -146,16 +146,16 @@ IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) { if(m_xAutoText.is()) { - if( &aAutoTextGroupLB == pBox ) + if (m_pAutoTextGroupLB == pBox) { - String sGroup( *(String*)aAutoTextGroupLB.GetEntryData( - aAutoTextGroupLB.GetSelectEntryPos())); + String sGroup( *(String*)m_pAutoTextGroupLB->GetEntryData( + m_pAutoTextGroupLB->GetSelectEntryPos())); uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; ClearUserData(); - aAutoTextLB.Clear(); + m_pAutoTextLB->Clear(); uno::Sequence aBlockNames = xGroup->getElementNames(); uno::Sequence< OUString > aTitles = xGroup->getTitles() ; diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index 52e0f9033920..977e2f97b7ce 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -83,14 +83,10 @@ public: class SwOneExampleFrame; class SwVisitingCardPage : public SfxTabPage { - FixedLine aContentFL; - SvTreeListBox aAutoTextLB; - FixedText aAutoTextGroupFT; - ListBox aAutoTextGroupLB; + SvTreeListBox* m_pAutoTextLB; + ListBox* m_pAutoTextGroupLB; + Window* m_pExampleWIN; - Window aExampleWIN; - - String sVisCardGroup; String sTempURL; SwLabItem aLabItem; diff --git a/sw/uiconfig/swriter/ui/cardformatpage.ui b/sw/uiconfig/swriter/ui/cardformatpage.ui new file mode 100644 index 000000000000..2f5752f40ee0 --- /dev/null +++ b/sw/uiconfig/swriter/ui/cardformatpage.ui @@ -0,0 +1,129 @@ + + + + + + True + False + 6 + 0 + none + + + True + False + 6 + 12 + + + True + False + 12 + True + + + True + False + 12 + + + True + False + 6 + + + True + False + 0 + AutoText - Section + True + autotext + + + 0 + 0 + 1 + 1 + + + + + True + False + 0 + 1 + + + 0 + 1 + 1 + 1 + + + + + 0 + 1 + 1 + 1 + + + + + True + True + True + True + + + + + + 0 + 0 + 1 + 1 + + + + + 0 + 0 + 1 + 1 + + + + + True + False + True + True + vertical + + + + + + 1 + 0 + 1 + 1 + + + + + + + + + True + False + Content + + + + + + + -- cgit