From 65adf781e097b658b1b3ba1ee6999b1bbadf6592 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 11 Jul 2013 21:52:38 -0300 Subject: [PATCH] Convert Draw paragraph dialog to widget .ui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Caolán McNamara --- sd/AllLangResTarget_sd.mk | 1 - sd/UIConfig_sdraw.mk | 2 + sd/inc/helpids.h | 1 - sd/source/ui/dlg/paragr.cxx | 99 +++++++------ sd/source/ui/dlg/paragr.src | 141 ------------------ sd/source/ui/func/fuparagr.cxx | 2 +- sd/source/ui/inc/paragr.hrc | 25 ---- sd/source/ui/inc/paragr.hxx | 8 +- sd/uiconfig/sdraw/ui/drawparadialog.ui | 176 +++++++++++++++++++++++ sd/uiconfig/sdraw/ui/paranumberingtab.ui | 100 +++++++++++++ 10 files changed, 334 insertions(+), 221 deletions(-) delete mode 100644 sd/source/ui/dlg/paragr.src delete mode 100644 sd/source/ui/inc/paragr.hrc create mode 100644 sd/uiconfig/sdraw/ui/drawparadialog.ui create mode 100644 sd/uiconfig/sdraw/ui/paranumberingtab.ui diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk index 6b7b1445b92f..473a60d99319 100644 --- a/sd/AllLangResTarget_sd.mk +++ b/sd/AllLangResTarget_sd.mk @@ -59,7 +59,6 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\ sd/source/ui/dlg/morphdlg.src \ sd/source/ui/dlg/navigatr.src \ sd/source/ui/dlg/PaneDockingWindow.src \ - sd/source/ui/dlg/paragr.src \ sd/source/ui/dlg/prltempl.src \ sd/source/ui/dlg/RemoteDialog.src \ sd/source/ui/dlg/sdpreslt.src \ diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk index 04c4b354a0f6..f5a5d1f40303 100644 --- a/sd/UIConfig_sdraw.mk +++ b/sd/UIConfig_sdraw.mk @@ -68,7 +68,9 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/sdraw,\ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\ sd/uiconfig/sdraw/ui/dlgsnap \ sd/uiconfig/sdraw/ui/copydlg \ + sd/uiconfig/sdraw/ui/drawparadialog \ sd/uiconfig/sdraw/ui/insertlayer \ + sd/uiconfig/sdraw/ui/paranumberingtab \ sd/uiconfig/sdraw/ui/printeroptions \ )) diff --git a/sd/inc/helpids.h b/sd/inc/helpids.h index bbace930a10b..d0e0b21faaf2 100644 --- a/sd/inc/helpids.h +++ b/sd/inc/helpids.h @@ -183,7 +183,6 @@ #define HID_SD_ANNOTATIONS "SD_HID_SD_ANNOTATIONS" #define HID_DLG_INSERT_PAGES_OBJS "SD_HID_DLG_INSERT_PAGES_OBJS" -#define HID_TABPAGE_PARA_NUMBERING "SD_HID_TABPAGE_PARA_NUMBERING" #define HID_VECTORIZE_DLG "SD_HID_VECTORIZE_DLG" #define HID_UNDO_DELETE_WARNING "SD_HID_UNDO_DELETE_WARNING" 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 -#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: */ diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index 7a0056a5ca06..1f33834697cb 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -33,7 +33,7 @@ #include "ViewShell.hxx" #include "drawdoc.hxx" #include "sdabstdlg.hxx" -#include "paragr.hrc" +//#include "paragr.hrc" #include "sdattr.hrc" namespace sd { diff --git a/sd/source/ui/inc/paragr.hrc b/sd/source/ui/inc/paragr.hrc deleted file mode 100644 index 51bb96465565..000000000000 --- a/sd/source/ui/inc/paragr.hrc +++ /dev/null @@ -1,25 +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 . - */ -#define TAB_PARAGRAPH 20620 - -#define CB_NEW_START 1 -#define CB_NUMBER_NEW_START 2 -#define NF_NEW_START 3 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/paragr.hxx b/sd/source/ui/inc/paragr.hxx index 1f927b506aa1..625d7e038544 100644 --- a/sd/source/ui/inc/paragr.hxx +++ b/sd/source/ui/inc/paragr.hxx @@ -23,13 +23,17 @@ #include -#include "paragr.hrc" - /** * Paragraph-Tab-Dialog */ class SdParagraphDlg : public SfxTabDialog { + sal_uInt16 m_nParaStd; + sal_uInt16 m_nParaNumPara; + sal_uInt16 m_nParaAsian; + sal_uInt16 m_nParaTab; + sal_uInt16 m_nParaAlign; + private: virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); diff --git a/sd/uiconfig/sdraw/ui/drawparadialog.ui b/sd/uiconfig/sdraw/ui/drawparadialog.ui new file mode 100644 index 000000000000..fe631d46f8ed --- /dev/null +++ b/sd/uiconfig/sdraw/ui/drawparadialog.ui @@ -0,0 +1,176 @@ + + + + + False + 6 + Paragraph + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + gtk-revert-to-saved + True + True + True + True + + + False + True + 3 + + + + + False + True + end + 0 + + + + + True + False + True + True + + + + + + True + False + Indents & Spacing + + + False + + + + + + + + True + False + Asian Typography + + + 1 + False + + + + + + + + True + False + Tabs + + + 2 + False + + + + + + + + True + False + 0.4699999988079071 + Alignment + + + 3 + False + + + + + + + + True + False + Numbering + + + 4 + False + + + + + False + True + 1 + + + + + + ok + cancel + help + reset + + + diff --git a/sd/uiconfig/sdraw/ui/paranumberingtab.ui b/sd/uiconfig/sdraw/ui/paranumberingtab.ui new file mode 100644 index 000000000000..abfb5bc2d2a2 --- /dev/null +++ b/sd/uiconfig/sdraw/ui/paranumberingtab.ui @@ -0,0 +1,100 @@ + + + + + 9999 + 1 + 10 + + + True + False + 6 + 6 + 0 + none + + + True + False + 6 + 6 + + + True + False + 12 + 12 + 6 + 6 + + + R_estart at this paragraph + True + False + False + True + 0 + True + True + + + 0 + 0 + 1 + 1 + + + + + True + False + + adjustment1 + + + 1 + 1 + 1 + 1 + + + + + S_tart with + True + False + False + start + 17 + True + 0 + True + True + + + 0 + 1 + 1 + 1 + + + + + + + + + + + + True + False + Paragraph numbering + + + + + + +