diff options
author | Manal Alhassoun <malhassoun@kacst.edu.sa> | 2013-09-17 08:46:10 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-17 11:42:29 +0000 |
commit | 2f7f7e7717075867080433ba09188a09830584ab (patch) | |
tree | 893e64b2790124d33a34bee8944b174a017ecfa9 /extensions | |
parent | eae6c400109c91237ea5e7890f8d950ee0e52cbb (diff) |
Convert tab order dialog to widget UI
Change-Id: I2aebcf6486b80af31f1a06e9ae38e5610bee0cb4
Reviewed-on: https://gerrit.libreoffice.org/5970
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/AllLangResTarget_pcr.mk | 1 | ||||
-rw-r--r-- | extensions/Module_extensions.mk | 1 | ||||
-rw-r--r-- | extensions/UIConfig_spropctrlr.mk | 16 | ||||
-rw-r--r-- | extensions/source/propctrlr/taborder.cxx | 75 | ||||
-rw-r--r-- | extensions/source/propctrlr/taborder.hrc | 36 | ||||
-rw-r--r-- | extensions/source/propctrlr/taborder.hxx | 15 | ||||
-rw-r--r-- | extensions/source/propctrlr/taborder.src | 96 | ||||
-rw-r--r-- | extensions/source/propctrlr/uiconfig/spropctrlr/ui/taborder.ui | 170 |
8 files changed, 234 insertions, 176 deletions
diff --git a/extensions/AllLangResTarget_pcr.mk b/extensions/AllLangResTarget_pcr.mk index ad32eb54059a..415cb5538e38 100644 --- a/extensions/AllLangResTarget_pcr.mk +++ b/extensions/AllLangResTarget_pcr.mk @@ -28,7 +28,6 @@ $(eval $(call gb_SrsTarget_add_files,pcr/res,\ extensions/source/propctrlr/propres.src \ extensions/source/propctrlr/formres.src \ extensions/source/propctrlr/pcrmiscres.src \ - extensions/source/propctrlr/taborder.src \ extensions/source/propctrlr/fontdialog.src \ extensions/source/propctrlr/selectlabeldialog.src \ extensions/source/propctrlr/formlinkdialog.src \ diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index 0f7857e4a7b8..20fc58ceefa1 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Module_add_targets,extensions,\ Library_dbp \ Library_pcr \ UIConfig_sbibliography \ + UIConfig_spropctrlr \ )) endif diff --git a/extensions/UIConfig_spropctrlr.mk b/extensions/UIConfig_spropctrlr.mk new file mode 100644 index 000000000000..4a4becc27bd4 --- /dev/null +++ b/extensions/UIConfig_spropctrlr.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_UIConfig_UIConfig,modules/spropctrlr)) + +$(eval $(call gb_UIConfig_add_uifiles,modules/spropctrlr,\ + extensions/source/propctrlr/uiconfig/spropctrlr/ui/taborder \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index bbb0f6fcde8b..285aedc75617 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -18,7 +18,6 @@ */ #include "taborder.hxx" -#include "taborder.hrc" #include "modulepcr.hxx" #include "formresid.hrc" @@ -29,7 +28,8 @@ #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/form/runtime/FormController.hpp> #include <vcl/scrbar.hxx> -#include "svtools/treelistentry.hxx" +#include <svtools/treelistentry.hxx> +#include <vcl/builder.hxx> //............................................................................ namespace pcr @@ -74,27 +74,25 @@ namespace pcr //------------------------------------------------------------------------ TabOrderDialog::TabOrderDialog( Window* _pParent, const Reference< XTabControllerModel >& _rxTabModel, const Reference< XControlContainer >& _rxControlCont, const Reference< XComponentContext >& _rxORB ) - :ModalDialog( _pParent, PcrRes( RID_DLG_TABORDER ) ) + :ModalDialog( _pParent, "TabOrderDialog", "modules/spropctrlr/ui/taborder.ui") ,m_xModel( _rxTabModel ) ,m_xControlContainer( _rxControlCont ) ,m_xORB( _rxORB ) - ,aFT_Controls( this, PcrRes( FT_CONTROLS ) ) - ,aLB_Controls( this, PcrRes( CTRL_TREE ) ) - ,aPB_OK( this, PcrRes( PB_OK ) ) - ,aPB_CANCEL( this, PcrRes( PB_CANCEL ) ) - ,aPB_HELP( this, PcrRes( PB_HELP ) ) - ,aPB_MoveUp( this, PcrRes( PB_MOVE_UP ) ) - ,aPB_MoveDown( this, PcrRes( PB_MOVE_DOWN ) ) - ,aPB_AutoOrder( this, PcrRes( PB_AUTO_ORDER ) ) ,pImageList( NULL ) { + get(m_pLB_Controls, "CTRLtree"); + get(m_pPB_OK, "ok"); + get(m_pPB_MoveUp, "upB"); + get(m_pPB_MoveDown, "downB"); + get(m_pPB_AutoOrder, "autoB"); + DBG_CTOR(TabOrderDialog,NULL); - aPB_MoveUp.SetClickHdl( LINK( this, TabOrderDialog, MoveUpClickHdl ) ); - aPB_MoveDown.SetClickHdl( LINK( this, TabOrderDialog, MoveDownClickHdl ) ); - aPB_AutoOrder.SetClickHdl( LINK( this, TabOrderDialog, AutoOrderClickHdl ) ); - aPB_OK.SetClickHdl( LINK( this, TabOrderDialog, OKClickHdl ) ); - aPB_OK.Disable(); + m_pPB_MoveUp->SetClickHdl( LINK( this, TabOrderDialog, MoveUpClickHdl ) ); + m_pPB_MoveDown->SetClickHdl( LINK( this, TabOrderDialog, MoveDownClickHdl ) ); + m_pPB_AutoOrder->SetClickHdl( LINK( this, TabOrderDialog, AutoOrderClickHdl ) ); + m_pPB_OK->SetClickHdl( LINK( this, TabOrderDialog, OKClickHdl ) ); + m_pPB_OK->Disable(); pImageList = new ImageList( PcrRes( RID_IL_FORMEXPLORER ) ); @@ -104,26 +102,25 @@ namespace pcr if ( m_xTempModel.is() && m_xControlContainer.is() ) FillList(); - if ( aLB_Controls.GetEntryCount() < 2 ) + if ( m_pLB_Controls->GetEntryCount() < 2 ) { - aPB_MoveUp.Disable(); - aPB_MoveDown.Disable(); - aPB_AutoOrder.Disable(); + m_pPB_MoveUp->Disable(); + m_pPB_MoveDown->Disable(); + m_pPB_AutoOrder->Disable(); } - FreeResource(); } //------------------------------------------------------------------------ void TabOrderDialog::SetModified() { - aPB_OK.Enable(); + m_pPB_OK->Enable(); } //------------------------------------------------------------------------ TabOrderDialog::~TabOrderDialog() { - aLB_Controls.Hide(); + m_pLB_Controls->Hide(); // delete pLB_Controls; delete pImageList; @@ -175,7 +172,7 @@ namespace pcr if ( !m_xTempModel.is() || !m_xControlContainer.is() ) return; - aLB_Controls.Clear(); + m_pLB_Controls->Clear(); try { @@ -199,14 +196,14 @@ namespace pcr aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) ); // TODO: do Basic controls have a name? aImage = GetImage( xControl ); - aLB_Controls.InsertEntry( aName, aImage, aImage, 0, sal_False, LIST_APPEND, xControl.get() ); + m_pLB_Controls->InsertEntry( aName, aImage, aImage, 0, sal_False, LIST_APPEND, xControl.get() ); } } else { // no property set -> no tab order OSL_FAIL( "TabOrderDialog::FillList: invalid control encountered!" ); - aLB_Controls.Clear(); + m_pLB_Controls->Clear(); break; } } @@ -217,22 +214,22 @@ namespace pcr } // select first entry - SvTreeListEntry* pFirstEntry = aLB_Controls.GetEntry( 0 ); + SvTreeListEntry* pFirstEntry = m_pLB_Controls->GetEntry( 0 ); if ( pFirstEntry ) - aLB_Controls.Select( pFirstEntry ); + m_pLB_Controls->Select( pFirstEntry ); } //------------------------------------------------------------------------ IMPL_LINK( TabOrderDialog, MoveUpClickHdl, Button*, /*pButton*/ ) { - aLB_Controls.MoveSelection( -1 ); + m_pLB_Controls->MoveSelection( -1 ); return 0; } //------------------------------------------------------------------------ IMPL_LINK( TabOrderDialog, MoveDownClickHdl, Button*, /*pButton*/ ) { - aLB_Controls.MoveSelection( 1 ); + m_pLB_Controls->MoveSelection( 1 ); return 0; } @@ -263,7 +260,7 @@ namespace pcr //------------------------------------------------------------------------ IMPL_LINK( TabOrderDialog, OKClickHdl, Button*, /*pButton*/ ) { - sal_uLong nEntryCount = aLB_Controls.GetEntryCount(); + sal_uLong nEntryCount = m_pLB_Controls->GetEntryCount(); Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount ); Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels()); Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray(); @@ -271,7 +268,7 @@ namespace pcr for (sal_uLong i=0; i < nEntryCount; i++) { - SvTreeListEntry* pEntry = aLB_Controls.GetEntry(i); + SvTreeListEntry* pEntry = m_pLB_Controls->GetEntry(i); for( sal_Int32 j=0; j<aControlModels.getLength(); j++ ) { @@ -296,8 +293,8 @@ namespace pcr //======================================================================== DBG_NAME(TabOrderListBox); //------------------------------------------------------------------------ - TabOrderListBox::TabOrderListBox( Window* pParent, const ResId& rResId ) - :SvTreeListBox( pParent, rResId ) + TabOrderListBox::TabOrderListBox( Window* pParent, WinBits nBits ) + :SvTreeListBox( pParent, nBits ) { DBG_CTOR(TabOrderListBox,NULL); SetDragDropMode(0xFFFF/*SV_DRAGDROP_CTRL_MOVE*/); @@ -306,6 +303,16 @@ namespace pcr SetSelectionMode( MULTIPLE_SELECTION ); } + extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeTabOrderListBox(Window *pParent, + VclBuilder::stringmap &rMap) + { + WinBits nWinStyle = WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new TabOrderListBox(pParent, nWinStyle); + } + //------------------------------------------------------------------------ TabOrderListBox::~TabOrderListBox() { diff --git a/extensions/source/propctrlr/taborder.hrc b/extensions/source/propctrlr/taborder.hrc index 3a1fab538d3a..e69de29bb2d1 100644 --- a/extensions/source/propctrlr/taborder.hrc +++ b/extensions/source/propctrlr/taborder.hrc @@ -1,36 +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 . - */ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC -#define EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC - -#define FT_CONTROLS 1 - -#define PB_MOVE_UP 1 -#define PB_MOVE_DOWN 2 -#define PB_AUTO_ORDER 3 - -#define PB_OK 4 -#define PB_CANCEL 5 -#define PB_HELP 6 - -#define CTRL_TREE 1 - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx index 771e1ab33b7a..d36249cb36de 100644 --- a/extensions/source/propctrlr/taborder.hxx +++ b/extensions/source/propctrlr/taborder.hxx @@ -45,7 +45,7 @@ namespace pcr class TabOrderListBox : public SvTreeListBox { public: - TabOrderListBox( Window* pParent, const ResId& rResId ); + TabOrderListBox( Window* pParent, WinBits nBits ); virtual ~TabOrderListBox(); void MoveSelection( long nRelPos ); @@ -72,16 +72,13 @@ namespace pcr ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB; - FixedText aFT_Controls; - TabOrderListBox aLB_Controls; + TabOrderListBox* m_pLB_Controls; - OKButton aPB_OK; - CancelButton aPB_CANCEL; - HelpButton aPB_HELP; + OKButton* m_pPB_OK; - PushButton aPB_MoveUp; - PushButton aPB_MoveDown; - PushButton aPB_AutoOrder; + PushButton* m_pPB_MoveUp; + PushButton* m_pPB_MoveDown; + PushButton* m_pPB_AutoOrder; ImageList* pImageList; diff --git a/extensions/source/propctrlr/taborder.src b/extensions/source/propctrlr/taborder.src index 9560f253a1f5..e69de29bb2d1 100644 --- a/extensions/source/propctrlr/taborder.src +++ b/extensions/source/propctrlr/taborder.src @@ -1,96 +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 "formresid.hrc" -#include "taborder.hrc" -#include "propctrlr.hrc" - -ModalDialog RID_DLG_TABORDER -{ - HelpID = "extensions:ModalDialog:RID_DLG_TABORDER"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 158 ) ; - Text [ en-US ] = "Tab Order" ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedText FT_CONTROLS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Controls" ; - }; - - Control CTRL_TREE - { - Border = TRUE; - Pos = MAP_APPFONT ( 6, 14) ; - Size = MAP_APPFONT ( 90, 136 ) ; - TabStop = TRUE; - HelpId = HID_PROP_TABORDER_CONTROLS; - }; - - PushButton PB_MOVE_UP - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_MOVE_UP"; - Pos = MAP_APPFONT ( 102 , 14 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Move Up" ; - }; - - PushButton PB_MOVE_DOWN - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_MOVE_DOWN"; - Pos = MAP_APPFONT ( 102 , 32 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Move Down" ; - }; - - PushButton PB_AUTO_ORDER - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_AUTO_ORDER"; - Pos = MAP_APPFONT ( 102 , 50 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Automatic Sort" ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 102 , 100 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 102 , 118 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 102 , 136 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/uiconfig/spropctrlr/ui/taborder.ui b/extensions/source/propctrlr/uiconfig/spropctrlr/ui/taborder.ui new file mode 100644 index 000000000000..d87b7e99d798 --- /dev/null +++ b/extensions/source/propctrlr/uiconfig/spropctrlr/ui/taborder.ui @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="TabOrderDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Tab Order</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox3"> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area3"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="upB"> + <property name="label" translatable="yes">_Move Up</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">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="downB"> + <property name="label" translatable="yes">Move _Down</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">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="autoB"> + <property name="label" translatable="yes">_Automatic Sort</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="margin_bottom">30</property> + <property name="use_underline">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="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</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="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</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="hexpand">True</property> + <property name="vexpand">True</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="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="pcrlo-TabOrderListBox" id="CTRLtree:border"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="min_width_chars">30</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="TabOrderListBox-selection1"/> + </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">Controls</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> + </object> + </child> + <action-widgets> + <action-widget response="0">upB</action-widget> + <action-widget response="0">downB</action-widget> + <action-widget response="0">autoB</action-widget> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> +</interface> |