[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk
Caolán McNamara
caolanm at redhat.com
Mon Dec 23 11:15:05 PST 2013
sc/UIConfig_scalc.mk | 5
sc/inc/scabstdlg.hxx | 4
sc/source/ui/attrdlg/scdlgfact.cxx | 19 ---
sc/source/ui/attrdlg/scdlgfact.hxx | 4
sc/source/ui/dbgui/validate.cxx | 35 +++---
sc/source/ui/dbgui/validate.src | 35 ------
sc/source/ui/inc/anyrefdg.hxx | 12 ++
sc/source/ui/inc/validate.hrc | 3
sc/source/ui/inc/validate.hxx | 33 +++---
sc/source/ui/view/cellsh2.cxx | 4
sc/uiconfig/scalc/ui/validationdialog.ui | 161 +++++++++++++++++++++++++++++++
11 files changed, 218 insertions(+), 97 deletions(-)
New commits:
commit 03552256018e90edfd825b0d4c0a5d855abaef24
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 23 17:33:24 2013 +0000
convert validity tabdialog to .ui
Change-Id: Ib7be4172e2d9b80869dbfa47674b13f1e03877d3
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index f55823e..8508fe7 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -99,6 +99,8 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/leftheaderdialog \
sc/uiconfig/scalc/ui/namerangesdialog \
sc/uiconfig/scalc/ui/managenamesdialog \
+ sc/uiconfig/scalc/ui/movecopysheet \
+ sc/uiconfig/scalc/ui/movingaveragedialog \
sc/uiconfig/scalc/ui/nosolutiondialog \
sc/uiconfig/scalc/ui/optcalculatepage \
sc/uiconfig/scalc/ui/optchangespage \
@@ -148,9 +150,8 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/tpviewpage \
sc/uiconfig/scalc/ui/ttestdialog \
sc/uiconfig/scalc/ui/ungroupdialog \
+ sc/uiconfig/scalc/ui/validationdialog \
sc/uiconfig/scalc/ui/validationhelptabpage \
- sc/uiconfig/scalc/ui/movecopysheet \
- sc/uiconfig/scalc/ui/movingaveragedialog \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index eba169d..b5ecda2 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -499,8 +499,8 @@ public:
virtual SfxAbstractTabDialog * CreateScParagraphDlg( Window* pParent, const SfxItemSet* pAttr ,
int nId ) = 0;
- virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent,
- const SfxItemSet* pArgSet,int nId, ScTabViewShell *pTabVwSh ) = 0;
+ virtual SfxAbstractTabDialog * CreateScValidationDlg(Window* pParent,
+ const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh) = 0;
virtual SfxAbstractTabDialog * CreateScSortDlg(Window* pParent, const SfxItemSet* pArgSet) = 0;
// for tabpage
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 003d96b..aa1a9bf 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1173,22 +1173,11 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScParagraphDlg( Windo
return 0;
}
-SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg( Window* pParent,
- const SfxItemSet* pArgSet,int nId, ScTabViewShell *pTabVwSh )
+SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg(Window* pParent,
+ const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh)
{
- SfxTabDialog* pDlg=NULL;
- switch ( nId )
- {
- case TAB_DLG_VALIDATION :
- pDlg = new ScValidationDlg( pParent, pArgSet, pTabVwSh );
- break;
- default:
- break;
- }
-
- if ( pDlg )
- return new ScAbstractTabDialog_Impl( pDlg );
- return 0;
+ SfxTabDialog* pDlg = new ScValidationDlg(pParent, pArgSet, pTabVwSh);
+ return new ScAbstractTabDialog_Impl(pDlg);
}
SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg(Window* pParent, const SfxItemSet* pArgSet)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index e00a5bb..1cdf525 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -566,8 +566,8 @@ public:
virtual SfxAbstractTabDialog * CreateScParagraphDlg( Window* pParent, const SfxItemSet* pAttr ,
int nId );
- virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent,
- const SfxItemSet* pArgSet,int nId, ScTabViewShell *pTabVwSh );
+ virtual SfxAbstractTabDialog * CreateScValidationDlg(Window* pParent,
+ const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh);
virtual SfxAbstractTabDialog * CreateScSortDlg(Window* pParent, const SfxItemSet* pArgSet);
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index f40981c..1d309c3 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -61,22 +61,19 @@ static sal_uInt16 pValueRanges[] =
// ============================================================================
-ScValidationDlg::ScValidationDlg( Window* pParent,
- const SfxItemSet* pArgSet,
- ScTabViewShell *pTabViewSh,
- SfxBindings *pB /*= NULL*/
- ) :
- ScValidationDlgBase( pParent ? pParent : SFX_APP()->GetTopWindow(), TAB_DLG_VALIDATION, pArgSet, pB ),
- m_bOwnRefHdlr( false ),
- m_pTabVwSh( pTabViewSh ),
- m_bRefInputting( false )
-{
- AddTabPage( TP_VALIDATION_VALUES, ScTPValidationValue::Create, 0 );
- AddTabPage( TP_VALIDATION_INPUTHELP, ScTPValidationHelp::Create, 0 );
- AddTabPage( TP_VALIDATION_ERROR, ScTPValidationError::Create, 0 );
- FreeResource();
- //temp hack until converted to .ui
- mpHBox = new VclHBox(get_content_area());
+ScValidationDlg::ScValidationDlg(Window* pParent, const SfxItemSet* pArgSet,
+ ScTabViewShell *pTabViewSh, SfxBindings *pB /*= NULL*/)
+ : ScValidationDlgBase(pParent ? pParent : SFX_APP()->GetTopWindow(),
+ "ValidationDialog", "modules/scalc/ui/validationdialog.ui", pArgSet, pB)
+ , m_pTabVwSh(pTabViewSh)
+ , m_nValuePageId(0)
+ , m_bOwnRefHdlr(false)
+ , m_bRefInputting(false)
+{
+ m_nValuePageId = AddTabPage("criteria", ScTPValidationValue::Create, 0);
+ AddTabPage("inputhelp", ScTPValidationHelp::Create, 0);
+ AddTabPage("erroralert", ScTPValidationError::Create, 0);
+ get(m_pHBox, "refinputbox");
}
void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pDoc )
@@ -155,8 +152,10 @@ void ScTPValidationValue::RefInputDonePostHdl()
sal_Bool ScValidationDlg::Close()
{
if( m_bOwnRefHdlr )
- if( SfxTabPage* pPage = GetTabPage( TP_VALIDATION_VALUES ) )
+ {
+ if (SfxTabPage* pPage = GetTabPage(m_nValuePageId))
static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg();
+ }
return ScValidationDlgBase::Close();
}
@@ -165,10 +164,8 @@ ScValidationDlg::~ScValidationDlg()
{
if( m_bOwnRefHdlr )
RemoveRefDlg( false );
- delete mpHBox;
}
-
// ============================================================================
namespace {
diff --git a/sc/source/ui/dbgui/validate.src b/sc/source/ui/dbgui/validate.src
index 01cfb91..b832d30 100644
--- a/sc/source/ui/dbgui/validate.src
+++ b/sc/source/ui/dbgui/validate.src
@@ -21,41 +21,6 @@
#include "validate.hrc"
-TabDialog TAB_DLG_VALIDATION
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 289 , 176 ) ;
- Moveable = TRUE ;
- TabControl 1
- {
- OutputSize = TRUE ;
- Size = MAP_APPFONT ( 260 , 135 ) ;
- PageList =
- {
- PageItem
- {
- Identifier = TP_VALIDATION_VALUES ;
- PageResID = TP_VALIDATION_VALUES ;
- Text [ en-US ] = "Criteria";
- };
- PageItem
- {
- Identifier = TP_VALIDATION_INPUTHELP ;
- PageResID = TP_VALIDATION_INPUTHELP ;
- Text [ en-US ] = "Input Help" ;
- };
- PageItem
- {
- Identifier = TP_VALIDATION_ERROR ;
- PageResID = TP_VALIDATION_ERROR ;
- Text [ en-US ] = "Error Alert" ;
- };
- };
- };
- Text [ en-US ] = "Validity" ;
-};
-
#define OFFSET_X 30
TabPage TP_VALIDATION_VALUES
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index cfc0b5c..468b95a 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -207,6 +207,9 @@ private:
template<class TParentWindow, class TResId, class TArg>
ScRefHdlrImplBase( TParentWindow* pParent, TResId nResId, const TArg &rArg, SfxBindings *pB = NULL );
+ template<class TParentWindow, class TArg>
+ ScRefHdlrImplBase( TParentWindow* pParent, const OString& rID, const OUString& rUIXMLDescription, const TArg &rArg, SfxBindings *pB = NULL );
+
~ScRefHdlrImplBase();
template<class, class, bool> friend struct ScRefHdlrImpl;
@@ -239,6 +242,15 @@ ScRefHdlrImplBase<TWindow,bBindRef>::ScRefHdlrImplBase( TParentWindow* pParent,
}
template<class TWindow, bool bBindRef >
+template<class TParentWindow, class TArg>
+ScRefHdlrImplBase<TWindow,bBindRef>::ScRefHdlrImplBase( TParentWindow* pParent, const OString& rID, const OUString& rUIXMLDescription, const TArg &rArg, SfxBindings *pB )
+ : TWindow( pParent, rID, rUIXMLDescription, rArg ),
+ ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef )
+{
+}
+
+
+template<class TWindow, bool bBindRef >
ScRefHdlrImplBase<TWindow,bBindRef>::~ScRefHdlrImplBase(){}
template<class TWindow, bool bBindRef>
diff --git a/sc/source/ui/inc/validate.hrc b/sc/source/ui/inc/validate.hrc
index 0113fd2..38362d1 100644
--- a/sc/source/ui/inc/validate.hrc
+++ b/sc/source/ui/inc/validate.hrc
@@ -17,9 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define TP_VALIDATION_VALUES 696
-#define TP_VALIDATION_INPUTHELP 697
-#define TP_VALIDATION_ERROR 698
-#define TAB_DLG_VALIDATION 699
#define FT_ALLOW 1
#define LB_ALLOW 2
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 5cac401..ecf03bc 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -80,26 +80,35 @@ public:
};
/** The "Validity" tab dialog. */
-class ScValidationDlg :public ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>, public ScRefHandlerHelper
+class ScValidationDlg
+ : public ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>
+ , public ScRefHandlerHelper
{
typedef ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false> ScValidationDlgBase;
DECL_LINK( OkHdl, Button * );
- bool m_bOwnRefHdlr:1;
-
ScTabViewShell *m_pTabVwSh;
- VclHBox* mpHBox;
+ VclHBox* m_pHBox;
+ sal_uInt16 m_nValuePageId;
+ bool m_bOwnRefHdlr:1;
bool m_bRefInputting:1;
+
bool EnterRefStatus();
bool LeaveRefStatus();
public:
explicit ScValidationDlg( Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell * pTabViewSh, SfxBindings *pB = NULL );
virtual ~ScValidationDlg();
- inline static ScValidationDlg * Find1AliveObject( Window *pAncestor );
+ static ScValidationDlg * Find1AliveObject( Window *pAncestor )
+ {
+ return static_cast<ScValidationDlg *>( SC_MOD()->Find1RefWindow( SLOTID, pAncestor ) );
+ }
bool IsAlive();
- inline ScTabViewShell * GetTabViewShell();
+ ScTabViewShell *GetTabViewShell()
+ {
+ return m_pTabVwSh;
+ }
bool SetupRefDlg();
bool RemoveRefDlg( sal_Bool bRestoreModal = sal_True );
@@ -129,7 +138,7 @@ public:
}
bool IsRefInputting(){ return m_bRefInputting; }
- Window* get_refinput_shrink_parent() { return mpHBox; }
+ Window* get_refinput_shrink_parent() { return m_pHBox; }
virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL )
{
@@ -302,16 +311,6 @@ public:
virtual void Reset ( const SfxItemSet& rArgSet );
};
-inline ScTabViewShell *ScValidationDlg::GetTabViewShell()
-{
- return m_pTabVwSh;
-}
-
-inline ScValidationDlg * ScValidationDlg::Find1AliveObject( Window *pAncestor )
-{
- return static_cast<ScValidationDlg *>( SC_MOD()->Find1RefWindow( SLOTID, pAncestor ) );
-}
-
#endif // SC_VALIDATE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index f7d0605..d4170f6 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -848,8 +848,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
}
// cell range picker
- SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg( NULL, &aArgSet, TAB_DLG_VALIDATION, pTabViewShell );
- OSL_ENSURE(pDlg, "Dialog create fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg(NULL, &aArgSet, pTabViewShell);
+ assert(pDlg); //Dialog create fail!
short nResult = pDlg->Execute();
//When picking Cell Range, other Tab may be switched. Need restore the correct tab
diff --git a/sc/uiconfig/scalc/ui/validationdialog.ui b/sc/uiconfig/scalc/ui/validationdialog.ui
new file mode 100644
index 0000000..93a9e91
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/validationdialog.ui
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="ValidationDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Validity</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <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">0</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">1</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">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="reset">
+ <property name="label">gtk-revert-to-saved</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">3</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="GtkNotebook" id="tabcontrol">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="criteria">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Criteria</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="inputhelp">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Input Help</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="erroralert">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Error Alert</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="refinputbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
+ <action-widget response="0">reset</action-widget>
+ </action-widgets>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list