Kaydet (Commit) 03552256 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert validity tabdialog to .ui

Change-Id: Ib7be4172e2d9b80869dbfa47674b13f1e03877d3
üst 4e49887b
......@@ -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:
......@@ -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
......
......@@ -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)
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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
......
......@@ -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;
......@@ -238,6 +241,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(){}
......
......@@ -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
......
......@@ -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: */
......@@ -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
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment