diff options
author | Olivier Hallot <olivier.hallot@edx.srv.br> | 2013-07-11 21:52:38 -0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-12 09:00:00 +0000 |
commit | 65adf781e097b658b1b3ba1ee6999b1bbadf6592 (patch) | |
tree | 67463f15a32f2ff345dfc38f39716447680c9c72 /sd/source/ui/dlg | |
parent | 35a230af3f2e847983174cf65c567e04212791dc (diff) |
Convert Draw paragraph dialog to widget .ui
An undocumented feature can be enabled by environment variable
export SD_SHOW_NUMBERING_PAGE=1
so a paragraph numbering tab pages shows up.
Change-Id: I21b0c8f6dffefd09fa783f29d3280c955513ddd6
Reviewed-on: https://gerrit.libreoffice.org/4852
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/dlg')
-rw-r--r-- | sd/source/ui/dlg/paragr.cxx | 99 | ||||
-rw-r--r-- | sd/source/ui/dlg/paragr.src | 141 |
2 files changed, 49 insertions, 191 deletions
diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx index b9ebdf55e954..b55fcd503b0d 100644 --- a/sd/source/ui/dlg/paragr.cxx +++ b/sd/source/ui/dlg/paragr.cxx @@ -41,31 +41,33 @@ public: ~SdParagraphNumTabPage(); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); + static sal_uInt16* GetRanges(); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); + virtual sal_Bool FillItemSet( SfxItemSet& rSet ); virtual void Reset( const SfxItemSet& rSet ); private: - TriStateBox maNewStartCB; - TriStateBox maNewStartNumberCB; - NumericField maNewStartNF; - bool mbModified; + TriStateBox* m_pNewStartCB; + TriStateBox* m_pNewStartNumberCB; + NumericField* m_pNewStartNF; + bool mbModified; DECL_LINK( ImplNewStartHdl, void* ); }; SdParagraphNumTabPage::SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rAttr ) -: SfxTabPage(pParent, SdResId(RID_TABPAGE_PARA_NUMBERING), rAttr) -, maNewStartCB( this, SdResId( CB_NEW_START ) ) -, maNewStartNumberCB( this, SdResId( CB_NUMBER_NEW_START ) ) -, maNewStartNF( this, SdResId( NF_NEW_START ) ) -, mbModified(false) + : SfxTabPage(pParent, + "DrawParaNumbering", + "modules/sdraw/ui/paranumberingtab.ui", + rAttr), + mbModified(false) { - FreeResource(); + get(m_pNewStartCB,"checkbuttonCB_NEW_START"); + get(m_pNewStartNumberCB,"checkbuttonCB_NUMBER_NEW_START"); + get(m_pNewStartNF,"spinbuttonNF_NEW_START"); - maNewStartCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); - maNewStartNumberCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); + m_pNewStartCB->SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); + m_pNewStartNumberCB->SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl)); } SdParagraphNumTabPage::~SdParagraphNumTabPage() @@ -90,16 +92,16 @@ sal_uInt16* SdParagraphNumTabPage::GetRanges() sal_Bool SdParagraphNumTabPage::FillItemSet( SfxItemSet& rSet ) { - if(maNewStartCB.GetState() != maNewStartCB.GetSavedValue() || - maNewStartNumberCB.GetState() != maNewStartNumberCB.GetSavedValue()|| - maNewStartNF.GetText() != maNewStartNF.GetSavedValue()) + if(m_pNewStartCB->GetState() != m_pNewStartCB->GetSavedValue() || + m_pNewStartNumberCB->GetState() != m_pNewStartNumberCB->GetSavedValue()|| + m_pNewStartNF->GetText() != m_pNewStartNF->GetSavedValue()) { mbModified = true; - sal_Bool bNewStartChecked = STATE_CHECK == maNewStartCB.GetState(); - sal_Bool bNumberNewStartChecked = STATE_CHECK == maNewStartNumberCB.GetState(); + sal_Bool bNewStartChecked = STATE_CHECK == m_pNewStartCB->GetState(); + sal_Bool bNumberNewStartChecked = STATE_CHECK == m_pNewStartNumberCB->GetState(); rSet.Put(SfxBoolItem(ATTR_NUMBER_NEWSTART, bNewStartChecked)); - const sal_Int16 nStartAt = (sal_Int16)maNewStartNF.GetValue(); + const sal_Int16 nStartAt = (sal_Int16)m_pNewStartNF->GetValue(); rSet.Put(SfxInt16Item(ATTR_NUMBER_NEWSTART_AT, bNumberNewStartChecked && bNewStartChecked ? nStartAt : -1)); } @@ -112,80 +114,77 @@ void SdParagraphNumTabPage::Reset( const SfxItemSet& rSet ) if(eItemState > SFX_ITEM_AVAILABLE ) { const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(ATTR_NUMBER_NEWSTART); - maNewStartCB.SetState( rStart.GetValue() ? STATE_CHECK : STATE_NOCHECK ); - maNewStartCB.EnableTriState(sal_False); + m_pNewStartCB->SetState( rStart.GetValue() ? STATE_CHECK : STATE_NOCHECK ); + m_pNewStartCB->EnableTriState(sal_False); } else { - maNewStartCB.SetState(STATE_DONTKNOW); - maNewStartCB.Disable(); + m_pNewStartCB->SetState(STATE_DONTKNOW); + m_pNewStartCB->Disable(); } - maNewStartCB.SaveValue(); + m_pNewStartCB->SaveValue(); eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART_AT); if( eItemState > SFX_ITEM_AVAILABLE ) { sal_Int16 nNewStart = ((const SfxInt16Item&)rSet.Get(ATTR_NUMBER_NEWSTART_AT)).GetValue(); - maNewStartNumberCB.Check(-1 != nNewStart); + m_pNewStartNumberCB->Check(-1 != nNewStart); if(-1 == nNewStart) nNewStart = 1; - maNewStartNF.SetValue(nNewStart); - maNewStartNumberCB.EnableTriState(sal_False); + m_pNewStartNF->SetValue(nNewStart); + m_pNewStartNumberCB->EnableTriState(sal_False); } else { - maNewStartCB.SetState(STATE_DONTKNOW); + m_pNewStartCB->SetState(STATE_DONTKNOW); } - ImplNewStartHdl(&maNewStartCB); - maNewStartNF.SaveValue(); - maNewStartNumberCB.SaveValue(); + ImplNewStartHdl(m_pNewStartCB); + m_pNewStartNF->SaveValue(); + m_pNewStartNumberCB->SaveValue(); mbModified = sal_False; } IMPL_LINK_NOARG(SdParagraphNumTabPage, ImplNewStartHdl) { - sal_Bool bEnable = maNewStartCB.IsChecked(); - maNewStartNumberCB.Enable(bEnable); - maNewStartNF.Enable(bEnable && maNewStartNumberCB.IsChecked()); + sal_Bool bEnable = m_pNewStartCB->IsChecked(); + m_pNewStartNumberCB->Enable(bEnable); + m_pNewStartNF->Enable(bEnable && m_pNewStartNumberCB->IsChecked()); return 0; } SdParagraphDlg::SdParagraphDlg( Window* pParent, const SfxItemSet* pAttr ) -: SfxTabDialog( pParent, SdResId( TAB_PARAGRAPH ), pAttr ) + : SfxTabDialog( pParent, + "DrawParagraphPropertiesDialog", + "modules/sdraw/ui/drawparadialog.ui", + pAttr ) { - FreeResource(); - - AddTabPage( RID_SVXPAGE_STD_PARAGRAPH ); + m_nParaStd = AddTabPage( "labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH); SvtCJKOptions aCJKOptions; if( aCJKOptions.IsAsianTypographyEnabled() ) - AddTabPage( RID_SVXPAGE_PARA_ASIAN); + m_nParaAsian = AddTabPage( "labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN); else - RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); + RemoveTabPage( "labelTP_PARA_ASIAN" ); - AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH ); + m_nParaAlign = AddTabPage( "labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH); static const sal_Bool bShowParaNumbering = ( getenv( "SD_SHOW_NUMBERING_PAGE" ) != NULL ); if( bShowParaNumbering ) - AddTabPage( RID_TABPAGE_PARA_NUMBERING, SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges ); + m_nParaNumPara = AddTabPage( "labelNUMBERING", SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges ); else - RemoveTabPage( RID_TABPAGE_PARA_NUMBERING ); + RemoveTabPage( "labelNUMBERING" ); - AddTabPage( RID_SVXPAGE_TABULATOR ); + m_nParaTab = AddTabPage( "labelTP_TABULATOR", RID_SVXPAGE_TABULATOR); } void SdParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - switch( nId ) + if (m_nParaStd == nId) { - case RID_SVXPAGE_STD_PARAGRAPH: aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/2)); rPage.PageCreated(aSet); - break; - default: - break; } } diff --git a/sd/source/ui/dlg/paragr.src b/sd/source/ui/dlg/paragr.src deleted file mode 100644 index 5e6c0c86ce94..000000000000 --- a/sd/source/ui/dlg/paragr.src +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svx/dialogs.hrc> -#include "glob.hrc" -#include "helpids.h" -#include "paragr.hrc" - -TabDialog TAB_PARAGRAPH -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 289 , 176 ) ; - Text [ en-US ] = "Paragraph" ; - Moveable = TRUE ; - Closeable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , 135 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_STD_PARAGRAPH ; - Text [ en-US ] = "Indents & Spacing" ; - PageResID = RID_SVXPAGE_STD_PARAGRAPH ; - }; - PageItem - { - Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; - PageResID = RID_SVXPAGE_ALIGN_PARAGRAPH ; - Text [ en-US ] = "Alignment" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PARA_ASIAN ; - PageResID = RID_SVXPAGE_PARA_ASIAN ; - Text [ en-US ] = "Asian Typography"; - }; - PageItem - { - Identifier = RID_TABPAGE_PARA_NUMBERING; - Text = "Numbering"; - PageResID = RID_TABPAGE_PARA_NUMBERING; - }; - PageItem - { - Identifier = RID_SVXPAGE_TABULATOR ; - Text [ en-US ] = "Tabs" ; - PageResID = RID_SVXPAGE_TABULATOR ; - }; - }; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 6 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 60 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 114 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton 1 - { - Pos = MAP_APPFONT ( 169 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Return" ; - TabStop = TRUE ; - }; -}; - -TabPage RID_TABPAGE_PARA_NUMBERING -{ - HelpId = HID_TABPAGE_PARA_NUMBERING ; - Hide = TRUE ; - Text = "Numbering" ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - - TriStateBox CB_NEW_START - { - HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NEW_START"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 160 , 10 ) ; - TabStop = TRUE ; - Text = "R~estart at this paragraph" ; - }; - TriStateBox CB_NUMBER_NEW_START - { - HelpID = "sd:TriStateBox:RID_TABPAGE_PARA_NUMBERING:CB_NUMBER_NEW_START"; - Pos = MAP_APPFONT ( 15 , 21 ) ; - Size = MAP_APPFONT ( 103 , 10 ) ; - Disable = TRUE ; - Text = "S~tart with" ; - }; - NumericField NF_NEW_START - { - HelpID = "sd:NumericField:RID_TABPAGE_PARA_NUMBERING:NF_NEW_START"; - Border = TRUE ; - Pos = MAP_APPFONT ( 124 , 20 ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9999 ; - Value = 0 ; - First = 0 ; - Last = 9999 ; - Disable = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |