tdf#79877 revert to old behavior when clicking on input fields.
doubleclick on input field brings up old input fields dialog
that dialog now starts at current field and has previous/next navigation
Change-Id: Ie3eec38d62cbf8a8248acb4fd84731c078ebadd4
Reviewed-on: https://gerrit.libreoffice.org/42333
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index ba60787..c582500 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -111,9 +111,11 @@ protected:
virtual ~AbstractFieldInputDlg() override = default;
public:
//from class SalFrame
virtual void SetWindowState( const OString & rStr ) = 0;
virtual OString GetWindowState() const = 0;
virtual void EndDialog(sal_Int32 nResult) override = 0;
virtual void SetWindowState( const OString & rStr ) = 0;
virtual OString GetWindowState() const = 0;
virtual void EndDialog(sal_Int32 nResult) override = 0;
virtual bool PrevButtonPressed() const = 0;
virtual bool NextButtonPressed() const = 0;
};
class AbstractInsFootNoteDlg : public VclAbstractDialog
@@ -282,8 +284,10 @@ class AbstractDropDownFieldDialog : public VclAbstractDialog
protected:
virtual ~AbstractDropDownFieldDialog() override = default;
public:
virtual OString GetWindowState() const = 0; //this method inherit from SystemWindow
virtual void SetWindowState( const OString & rStr ) = 0; //this method inherit from SystemWindow
virtual OString GetWindowState() const = 0; //this method inherit from SystemWindow
virtual void SetWindowState( const OString & rStr ) = 0; //this method inherit from SystemWindow
virtual bool PrevButtonPressed() const = 0;
virtual bool NextButtonPressed() const = 0;
};
class AbstractSwLabDlg : public SfxAbstractTabDialog
@@ -404,7 +408,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(SwWrtShell &rSh,
SwField* pField, bool bNextButton) = 0;
SwField* pField, bool bPrevButton, bool bNextButton) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) = 0;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(const SfxItemSet& rSet,
@@ -463,7 +467,7 @@ public:
SwGlossaryHdl* pGlosHdl,
SwWrtShell *pWrtShell) = 0;
virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent,
SwWrtShell &rSh, SwField* pField, bool bNextButton) = 0;
SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0;
virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(vcl::Window * pParent,
SwWrtShell &rSh, bool bEd = false) = 0;
virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 9d6f17d..12f2ce4 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -239,6 +239,16 @@ void AbstractDropDownFieldDialog_Impl::SetWindowState( const OString& rStr )
pDlg->SetWindowState(rStr);
}
bool AbstractDropDownFieldDialog_Impl::PrevButtonPressed() const
{
return pDlg->PrevButtonPressed();
}
bool AbstractDropDownFieldDialog_Impl::NextButtonPressed() const
{
return pDlg->NextButtonPressed();
}
void AbstractSwLabDlg_Impl::SetCurPageId( sal_uInt16 nId )
{
pDlg->SetCurPageId( nId );
@@ -411,6 +421,16 @@ void AbstractFieldInputDlg_Impl::EndDialog(sal_Int32 n)
pDlg->EndDialog(n);
}
bool AbstractFieldInputDlg_Impl::PrevButtonPressed() const
{
return pDlg->PrevButtonPressed();
}
bool AbstractFieldInputDlg_Impl::NextButtonPressed() const
{
return pDlg->NextButtonPressed();
}
OUString AbstractInsFootNoteDlg_Impl::GetFontName()
{
return pDlg->GetFontName();
@@ -723,9 +743,9 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwFootNoteOptio
}
VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(
SwWrtShell &rSh, SwField* pField, bool bNextButton)
SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton)
{
VclPtr<sw::DropDownFieldDialog> pDlg = VclPtr<sw::DropDownFieldDialog>::Create(nullptr, rSh, pField, bNextButton);
VclPtr<sw::DropDownFieldDialog> pDlg = VclPtr<sw::DropDownFieldDialog>::Create(nullptr, rSh, pField, bPrevButton, bNextButton);
return VclPtr<AbstractDropDownFieldDialog_Impl>::Create( pDlg );
}
@@ -888,9 +908,9 @@ VclPtr<AbstractGlossaryDlg> SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxV
}
VclPtr<AbstractFieldInputDlg> SwAbstractDialogFactory_Impl::CreateFieldInputDlg(vcl::Window *pParent,
SwWrtShell &rSh, SwField* pField, bool bNextButton)
SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton)
{
VclPtr<SwFieldInputDlg> pDlg = VclPtr<SwFieldInputDlg>::Create( pParent, rSh, pField, bNextButton );
VclPtr<SwFieldInputDlg> pDlg = VclPtr<SwFieldInputDlg>::Create( pParent, rSh, pField, bPrevButton, bNextButton );
return VclPtr<AbstractFieldInputDlg_Impl>::Create( pDlg );
}
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index d6375e9..0f94db1 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -156,8 +156,10 @@ class AbstractSwInsertDBColAutoPilot_Impl : public AbstractSwInsertDBColAutoPil
class AbstractDropDownFieldDialog_Impl : public AbstractDropDownFieldDialog
{
DECL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl, sw::DropDownFieldDialog)
virtual OString GetWindowState() const override; //this method inherit from SystemWindow
virtual void SetWindowState( const OString& rStr ) override; //this method inherit from SystemWindow
virtual OString GetWindowState() const override; //this method inherit from SystemWindow
virtual void SetWindowState( const OString& rStr ) override; //this method inherit from SystemWindow
virtual bool PrevButtonPressed() const override;
virtual bool NextButtonPressed() const override;
};
class AbstractSwLabDlg_Impl : public AbstractSwLabDlg
@@ -236,9 +238,11 @@ class AbstractFieldInputDlg_Impl : public AbstractFieldInputDlg
{
DECL_ABSTDLG_BASE(AbstractFieldInputDlg_Impl,SwFieldInputDlg)
//from class SalFrame
virtual void SetWindowState( const OString & rStr ) override;
virtual OString GetWindowState() const override;
virtual void EndDialog(sal_Int32) override;
virtual void SetWindowState( const OString & rStr ) override;
virtual OString GetWindowState() const override;
virtual void EndDialog(sal_Int32) override;
virtual bool PrevButtonPressed() const override;
virtual bool NextButtonPressed() const override;
};
class SwInsFootNoteDlg;
@@ -393,7 +397,7 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(SwWrtShell &rSh,
SwField* pField, bool bNextButton) override;
SwField* pField, bool bPrevButton, bool bNextButton) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) override;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel) override;
@@ -445,7 +449,7 @@ public:
SwGlossaryHdl* pGlosHdl,
SwWrtShell *pWrtShell) override;
virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent,
SwWrtShell &rSh, SwField* pField, bool bNextButton) override;
SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) override;
virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(
vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false) override;
virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) override;
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index f0fa95c..9d624e8 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -30,27 +30,36 @@ using namespace ::com::sun::star;
// edit insert-field
sw::DropDownFieldDialog::DropDownFieldDialog(vcl::Window *pParent, SwWrtShell &rS,
SwField* pField, bool bNextButton)
SwField* pField, bool bPrevButton, bool bNextButton)
: SvxStandardDialog(pParent, "DropdownFieldDialog",
"modules/swriter/ui/dropdownfielddialog.ui")
, rSh( rS )
, pDropField(nullptr)
, m_pPressedButton(nullptr)
{
get(m_pListItemsLB, "list");
m_pListItemsLB->SetDropDownLineCount(12);
m_pListItemsLB->set_width_request(m_pListItemsLB->approximate_char_width()*32);
get(m_pOKPB, "ok");
get(m_pPrevPB, "prev");
get(m_pNextPB, "next");
get(m_pEditPB, "edit");
Link<ListBox&, void> aDoubleLk = LINK(this, DropDownFieldDialog, DoubleClickHdl);
m_pListItemsLB->SetDoubleClickHdl( aDoubleLk );
Link<Button*,void> aButtonLk = LINK(this, DropDownFieldDialog, ButtonHdl);
m_pEditPB->SetClickHdl(aButtonLk);
if( bNextButton )
Link<Button*, void> aEditButtonLk = LINK(this, DropDownFieldDialog, EditHdl);
Link<Button*,void> aPrevButtonLk = LINK(this, DropDownFieldDialog, PrevHdl);
Link<Button*, void> aNextButtonLk = LINK(this, DropDownFieldDialog, NextHdl);
m_pEditPB->SetClickHdl(aEditButtonLk);
if( bPrevButton || bNextButton )
{
m_pPrevPB->Show();
m_pPrevPB->SetClickHdl(aPrevButtonLk);
m_pPrevPB->Enable(bPrevButton);
m_pNextPB->Show();
m_pNextPB->SetClickHdl(aButtonLk);
m_pNextPB->SetClickHdl(aNextButtonLk);
m_pNextPB->Enable(bNextButton);
}
if( SwFieldIds::Dropdown == pField->GetTyp()->Which() )
{
@@ -81,8 +90,10 @@ void sw::DropDownFieldDialog::dispose()
{
m_pListItemsLB.clear();
m_pOKPB.clear();
m_pPrevPB.clear();
m_pNextPB.clear();
m_pEditPB.clear();
m_pPressedButton.clear();
SvxStandardDialog::dispose();
}
@@ -107,9 +118,32 @@ void sw::DropDownFieldDialog::Apply()
}
}
IMPL_LINK(sw::DropDownFieldDialog, ButtonHdl, Button*, pButton, void)
bool sw::DropDownFieldDialog::PrevButtonPressed() const
{
EndDialog(m_pNextPB == pButton ? RET_OK : RET_YES );
return m_pPressedButton == m_pPrevPB;
}
bool sw::DropDownFieldDialog::NextButtonPressed() const
{
return m_pPressedButton == m_pNextPB;
}
IMPL_LINK_NOARG(sw::DropDownFieldDialog, EditHdl, Button*, void)
{
m_pPressedButton = m_pEditPB;
EndDialog(RET_OK);
}
IMPL_LINK_NOARG(sw::DropDownFieldDialog, PrevHdl, Button*, void)
{
m_pPressedButton = m_pPrevPB;
EndDialog(RET_OK);
}
IMPL_LINK_NOARG(sw::DropDownFieldDialog, NextHdl, Button*, void)
{
m_pPressedButton = m_pNextPB;
EndDialog(RET_OK);
}
IMPL_LINK_NOARG(sw::DropDownFieldDialog, DoubleClickHdl, ListBox&, void)
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
index 751cba3..c11adb5 100644
--- a/sw/source/ui/fldui/inpdlg.cxx
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -30,17 +30,19 @@
// edit field-insert
SwFieldInputDlg::SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rS,
SwField* pField, bool bNextButton )
SwField* pField, bool bPrevButton, bool bNextButton )
: SvxStandardDialog( pParent, "InputFieldDialog",
"modules/swriter/ui/inputfielddialog.ui")
, rSh( rS )
, pInpField(nullptr)
, pSetField(nullptr)
, pUsrType(nullptr)
, m_pPressedButton(nullptr)
{
get(m_pLabelED, "name");
get(m_pEditED, "text");
m_pEditED->set_height_request(m_pEditED->GetTextHeight() * 9);
get(m_pPrevBT, "prev");
get(m_pNextBT, "next");
get(m_pOKBT, "ok");
// switch font for Edit
@@ -48,10 +50,15 @@ SwFieldInputDlg::SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rS,
aFont.SetWeight(WEIGHT_LIGHT);
m_pEditED->SetFont(aFont);
if( bNextButton )
if( bPrevButton || bNextButton )
{
m_pPrevBT->Show();
m_pPrevBT->SetClickHdl(LINK(this, SwFieldInputDlg, PrevHdl));
m_pPrevBT->Enable(bPrevButton);
m_pNextBT->Show();
m_pNextBT->SetClickHdl(LINK(this, SwFieldInputDlg, NextHdl));
m_pNextBT->Enable(bNextButton);
}
// evaluation here
@@ -114,7 +121,9 @@ void SwFieldInputDlg::dispose()
m_pLabelED.clear();
m_pEditED.clear();
m_pOKBT.clear();
m_pPrevBT.clear();
m_pNextBT.clear();
m_pPressedButton.clear();
SvxStandardDialog::dispose();
}
@@ -162,9 +171,27 @@ void SwFieldInputDlg::Apply()
rSh.EndAllAction();
}
IMPL_LINK_NOARG(SwFieldInputDlg, NextHdl, Button*, void)
bool SwFieldInputDlg::PrevButtonPressed() const
{
return m_pPressedButton == m_pPrevBT;
}
bool SwFieldInputDlg::NextButtonPressed() const
{
return m_pPressedButton == m_pNextBT;
}
IMPL_LINK_NOARG(SwFieldInputDlg, PrevHdl, Button*, void)
{
m_pPressedButton = m_pPrevBT;
EndDialog(RET_OK);
}
IMPL_LINK_NOARG(SwFieldInputDlg, NextHdl, Button*, void)
{
m_pPressedButton = m_pNextBT;
EndDialog(RET_OK);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 41c8b84..5d87ea7 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3370,7 +3370,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
pVFrame->GetBindings().Execute(FN_EDIT_AUTH_ENTRY_DLG);
break;
default:
pVFrame->GetBindings().Execute(FN_EDIT_FIELD);
pVFrame->GetBindings().Execute(FN_UPDATE_INPUTFIELDS);
}
}
return;
diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx
index d670afb..b2dbffa 100644
--- a/sw/source/uibase/inc/DropDownFieldDialog.hxx
+++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx
@@ -36,21 +36,28 @@ class DropDownFieldDialog : public SvxStandardDialog
VclPtr<ListBox> m_pListItemsLB;
VclPtr<OKButton> m_pOKPB;
VclPtr<PushButton> m_pPrevPB;
VclPtr<PushButton> m_pNextPB;
VclPtr<PushButton> m_pEditPB;
SwWrtShell &rSh;
SwDropDownField* pDropField;
SwWrtShell &rSh;
SwDropDownField* pDropField;
DECL_LINK(ButtonHdl, Button*, void);
VclPtr<PushButton> m_pPressedButton;
DECL_LINK(EditHdl, Button*, void);
DECL_LINK(PrevHdl, Button*, void);
DECL_LINK(NextHdl, Button*, void);
virtual void Apply() override;
DECL_LINK(DoubleClickHdl, ListBox&, void);
public:
DropDownFieldDialog( vcl::Window *pParent, SwWrtShell &rSh,
SwField* pField, bool bNextButton );
SwField* pField, bool bPrevButton, bool bNextButton );
virtual ~DropDownFieldDialog() override;
virtual void dispose() override;
bool PrevButtonPressed() const;
bool NextButtonPressed() const;
};
} //namespace sw
diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx
index 505ed6d..9307f5d 100644
--- a/sw/source/uibase/inc/inpdlg.hxx
+++ b/sw/source/uibase/inc/inpdlg.hxx
@@ -30,6 +30,7 @@ class SwSetExpField;
class SwUserFieldType;
class SwField;
class SwWrtShell;
class SwFieldMgr;
// insert fields
class SwFieldInputDlg: public SvxStandardDialog
@@ -48,13 +49,20 @@ class SwFieldInputDlg: public SvxStandardDialog
VclPtr<OKButton> m_pOKBT;
VclPtr<PushButton> m_pNextBT;
VclPtr<PushButton> m_pPrevBT;
VclPtr<PushButton> m_pPressedButton;
DECL_LINK(NextHdl, Button*, void);
DECL_LINK(PrevHdl, Button*, void);
public:
SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rSh,
SwField* pField, bool bNextButton );
SwField* pField, bool bPrevButton, bool bNextButton );
virtual ~SwFieldInputDlg() override;
virtual void dispose() override;
bool PrevButtonPressed() const;
bool NextButtonPressed() const;
};
#endif
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 95d0564..d95ede2 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -359,6 +359,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
enum DoType { UNDO, REDO, REPEAT };
enum FieldDialogPressedButton { BTN_NONE, BTN_EDIT, BTN_PREV, BTN_NEXT };
void Do( DoType eDoType, sal_uInt16 nCnt = 1 );
OUString GetDoString( DoType eDoType ) const;
OUString GetRepeatString() const;
@@ -390,9 +392,9 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
void MoveCursor( bool bWithSelect = false );
// update input fields
bool StartInputFieldDlg(SwField*, bool bNextButton, vcl::Window* pParentWin = nullptr, OString* pWindowState = nullptr);
bool StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, vcl::Window* pParentWin = nullptr, OString* pWindowState = nullptr, FieldDialogPressedButton* pPressedButton = nullptr);
// update DropDown fields
bool StartDropDownFieldDlg(SwField*, bool bNextButton, OString* pWindowState = nullptr);
bool StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, OString* pWindowState = nullptr, FieldDialogPressedButton* pPressedButton = nullptr);
//"Handler" for changes at DrawView - for controls.
virtual void DrawSelChanged( ) override;
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 74263ba..9eeddb8 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -198,7 +198,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
}
else
{
rSh.StartInputFieldDlg( rSh.GetCurField( true ), false );
rSh.StartInputFieldDlg( rSh.GetCurField( true ), false, false );
}
bRet = true;
}
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index fb93854..126d599 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -144,21 +144,50 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
bool bCancel = false;
OString aDlgPos;
for( size_t i = 0; i < nCnt && !bCancel; ++i )
size_t nIndex = 0;
FieldDialogPressedButton ePressedButton = BTN_NONE;
SwField* pField = GetCurField();
if (pField)
{
pTmp->GotoFieldPos( i );
SwField* pField = pTmp->GetField( i );
if(pField->GetTyp()->Which() == SwFieldIds::Dropdown)
bCancel = StartDropDownFieldDlg( pField, true, &aDlgPos );
for (size_t i = 0; i < nCnt; i++)
{
if (pField == pTmp->GetField(i))
{
nIndex = i;
break;
}
}
}
while (!bCancel)
{
bool bPrev = nIndex > 0;
bool bNext = nIndex < nCnt - 1;
pTmp->GotoFieldPos(nIndex);
pField = pTmp->GetField(nIndex);
if (pField->GetTyp()->Which() == SwFieldIds::Dropdown)
{
bCancel = StartDropDownFieldDlg(pField, bPrev, bNext, &aDlgPos, &ePressedButton);
}
else
bCancel = StartInputFieldDlg( pField, true, nullptr, &aDlgPos);
bCancel = StartInputFieldDlg(pField, bPrev, bNext, nullptr, &aDlgPos, &ePressedButton);
if (!bCancel)
{
// Otherwise update error at multi-selection:
pTmp->GetField( i )->GetTyp()->UpdateFields();
pTmp->GetField(nIndex)->GetTyp()->UpdateFields();
if (ePressedButton == BTN_PREV && nIndex > 0)
nIndex--;
else if (ePressedButton == BTN_NEXT && nIndex < nCnt - 1)
nIndex++;
else
bCancel = true;
}
}
pTmp->PopCursor();
}
@@ -225,13 +254,13 @@ class FieldDeletionModify : public SwModify
};
// Start input dialog for a specific field
bool SwWrtShell::StartInputFieldDlg( SwField* pField, bool bNextButton,
vcl::Window* pParentWin, OString* pWindowState )
bool SwWrtShell::StartInputFieldDlg( SwField* pField, bool bPrevButton, bool bNextButton,
vcl::Window* pParentWin, OString* pWindowState, SwWrtShell::FieldDialogPressedButton* pPressedButton )
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
ScopedVclPtr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bNextButton));
ScopedVclPtr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bPrevButton, bNextButton));
OSL_ENSURE(pDlg, "Dialog creation failed!");
if(pWindowState && !pWindowState->isEmpty())
pDlg->SetWindowState(*pWindowState);
@@ -246,23 +275,40 @@ bool SwWrtShell::StartInputFieldDlg( SwField* pField, bool bNextButton,
if(pWindowState)
*pWindowState = pDlg->GetWindowState();
if (pPressedButton)
{
if (pDlg->PrevButtonPressed())
*pPressedButton = BTN_PREV;
else if (pDlg->NextButtonPressed())
*pPressedButton = BTN_NEXT;
}
pDlg.disposeAndClear();
GetWin()->Update();
return bRet;
}
bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bNextButton, OString* pWindowState)
bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton, OString* pWindowState, SwWrtShell::FieldDialogPressedButton* pPressedButton)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(*this, pField, bNextButton));
ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(*this, pField, bPrevButton, bNextButton));
OSL_ENSURE(pDlg, "Dialog creation failed!");
if(pWindowState && !pWindowState->isEmpty())
pDlg->SetWindowState(*pWindowState);
const short nRet = pDlg->Execute();
if(pWindowState)
*pWindowState = pDlg->GetWindowState();
if (pPressedButton)
{
if (pDlg->PrevButtonPressed())
*pPressedButton = BTN_PREV;
else if (pDlg->NextButtonPressed())
*pPressedButton = BTN_NEXT;
}
pDlg.disposeAndClear();
bool bRet = RET_CANCEL == nRet;
GetWin()->Update();
@@ -387,17 +433,17 @@ void SwWrtShell::ClickToField( const SwField& rField )
const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField);
if ( pInputField == nullptr )
{
StartInputFieldDlg( const_cast<SwField*>(&rField), false );
StartInputFieldDlg( const_cast<SwField*>(&rField), false, false );
}
}
break;
case SwFieldIds::SetExp:
if( static_cast<const SwSetExpField&>(rField).GetInputFlag() )
StartInputFieldDlg( const_cast<SwField*>(&rField), false );
StartInputFieldDlg( const_cast<SwField*>(&rField), false, false );
break;
case SwFieldIds::Dropdown :
StartDropDownFieldDlg( const_cast<SwField*>(&rField), false );
StartDropDownFieldDlg( const_cast<SwField*>(&rField), false, false );
break;
default:
SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
diff --git a/sw/uiconfig/swriter/ui/dropdownfielddialog.ui b/sw/uiconfig/swriter/ui/dropdownfielddialog.ui
index 5feb934..c329ae6 100644
--- a/sw/uiconfig/swriter/ui/dropdownfielddialog.ui
+++ b/sw/uiconfig/swriter/ui/dropdownfielddialog.ui
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface domain="sw">
<requires lib="gtk+" version="3.0"/>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="DropdownFieldDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -26,6 +25,7 @@
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="margin_top">3</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -49,8 +49,8 @@
</packing>
</child>
<child>
<object class="GtkButton" id="next">
<property name="label">gtk-media-next</property>
<object class="GtkButton" id="prev">
<property name="label">gtk-media-previous</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
@@ -92,6 +92,20 @@
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="next">
<property name="label">gtk-media-next</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">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>
@@ -145,6 +159,8 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
@@ -173,9 +189,10 @@
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">next</action-widget>
<action-widget response="0">prev</action-widget>
<action-widget response="0">help</action-widget>
<action-widget response="0">edit</action-widget>
<action-widget response="0">next</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/sw/uiconfig/swriter/ui/inputfielddialog.ui b/sw/uiconfig/swriter/ui/inputfielddialog.ui
index c1901ae..6ccd909 100644
--- a/sw/uiconfig/swriter/ui/inputfielddialog.ui
+++ b/sw/uiconfig/swriter/ui/inputfielddialog.ui
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface domain="sw">
<requires lib="gtk+" version="3.0"/>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="InputFieldDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -47,6 +46,20 @@
</packing>
</child>
<child>
<object class="GtkButton" id="prev">
<property name="label">gtk-media-previous</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">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="next">
<property name="label">gtk-media-next</property>
<property name="can_focus">True</property>
@@ -57,7 +70,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@@ -71,7 +84,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
<property name="secondary">True</property>
</packing>
</child>
@@ -102,6 +115,8 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
@@ -117,6 +132,8 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
@@ -140,6 +157,7 @@
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
</object>
@@ -154,6 +172,7 @@
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">prev</action-widget>
<action-widget response="0">next</action-widget>
<action-widget response="0">help</action-widget>
</action-widgets>