sw/inc/swabstdlg.hxx | 18 +++--- sw/source/ui/dialog/swdlgfact.cxx | 28 ++++++++- sw/source/ui/dialog/swdlgfact.hxx | 12 ++-- sw/source/ui/fldui/DropDownFieldDialog.cxx | 48 ++++++++++++++-- sw/source/ui/fldui/inpdlg.cxx | 31 +++++++++- sw/source/uibase/docvw/edtwin.cxx | 2 sw/source/uibase/inc/DropDownFieldDialog.hxx | 17 ++++- sw/source/uibase/inc/inpdlg.hxx | 9 ++- sw/source/uibase/inc/wrtsh.hxx | 6 +- sw/source/uibase/shells/textfld.cxx | 2 sw/source/uibase/wrtsh/wrtsh2.cxx | 76 ++++++++++++++++++++------ sw/uiconfig/swriter/ui/dropdownfielddialog.ui | 26 ++++++-- sw/uiconfig/swriter/ui/inputfielddialog.ui | 24 ++++++-- vcl/inc/svids.hrc | 1 vcl/source/src/btntext.src | 5 + vcl/source/window/builder.cxx | 2 16 files changed, 247 insertions(+), 60 deletions(-)
New commits: commit 98f135e3c7a078d88ec89c3ee7ffbabf872da724 Author: Bernhard Widl <bernhard.w...@cib.de> Date: Fri Sep 15 17:39:48 2017 +0200 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.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 87b375207f28..f31b78f3eb76 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -107,9 +107,11 @@ class AbstractFieldInputDlg : public VclAbstractTerminatedDialog { public: //from class SalFrame - virtual void SetWindowState( const OString & rStr ) = 0; - virtual OString GetWindowState() const = 0; - virtual void EndDialog(long ) override = 0; + virtual void SetWindowState( const OString & rStr ) = 0; + virtual OString GetWindowState() const = 0; + virtual void EndDialog(long ) override = 0; + virtual bool PrevButtonPressed() const = 0; + virtual bool NextButtonPressed() const = 0; }; class AbstractInsFootNoteDlg : public VclAbstractDialog @@ -244,8 +246,10 @@ public: class AbstractDropDownFieldDialog : public VclAbstractDialog { 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 @@ -349,7 +353,7 @@ public: virtual SfxAbstractTabDialog * CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) = 0; virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog(SwWrtShell &rSh, - SwField* pField, bool bNextButton = false) = 0; + SwField* pField, bool bPrevButton = false, bool bNextButton = false) = 0; virtual SfxAbstractTabDialog* CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) = 0; virtual AbstractSwLabDlg* CreateSwLabDlg(const SfxItemSet& rSet, @@ -406,7 +410,7 @@ public: SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) = 0; virtual AbstractFieldInputDlg* CreateFieldInputDlg(vcl::Window *pParent, - SwWrtShell &rSh, SwField* pField, bool bNextButton = false) = 0; + SwWrtShell &rSh, SwField* pField, bool bPrevButton = false, bool bNextButton = false) = 0; virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false) = 0; virtual VclAbstractDialog* CreateTitlePageDlg ( vcl::Window * pParent ) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 760333cc657e..fdd7dd4d7bdf 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -248,6 +248,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 ); @@ -420,6 +430,16 @@ void AbstractFieldInputDlg_Impl::EndDialog(long 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(); @@ -753,9 +773,9 @@ SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg( } 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 new AbstractDropDownFieldDialog_Impl( pDlg ); } @@ -955,9 +975,9 @@ AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFram } 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 new AbstractFieldInputDlg_Impl( pDlg ); } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index b74968e715c6..217315b4e9c7 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 @@ -239,6 +241,8 @@ class AbstractFieldInputDlg_Impl : public AbstractFieldInputDlg virtual void SetWindowState( const OString & rStr ) override; virtual OString GetWindowState() const override; virtual void EndDialog(long) override; + virtual bool PrevButtonPressed() const override; + virtual bool NextButtonPressed() const override; }; class SwInsFootNoteDlg; @@ -393,7 +397,7 @@ public: virtual SfxAbstractTabDialog * CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) override; virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog(SwWrtShell &rSh, - SwField* pField, bool bNextButton = false) override; + SwField* pField, bool bPrevButton = false, bool bNextButton = false) override; virtual SfxAbstractTabDialog* CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) override; virtual AbstractSwLabDlg* CreateSwLabDlg(const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel) override; @@ -444,7 +448,7 @@ public: SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) override; virtual AbstractFieldInputDlg* CreateFieldInputDlg(vcl::Window *pParent, - SwWrtShell &rSh, SwField* pField, bool bNextButton = false) override; + SwWrtShell &rSh, SwField* pField, bool bPrevButton = false, bool bNextButton = false) override; virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false) override; virtual VclAbstractDialog * CreateTitlePageDlg ( vcl::Window * pParent ) override; diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx index 7423d169f2b1..8f5c676d2b19 100644 --- a/sw/source/ui/fldui/DropDownFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx @@ -31,27 +31,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( RES_DROPDOWN == pField->GetTyp()->Which() ) { @@ -82,8 +91,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(); } @@ -108,9 +119,32 @@ void sw::DropDownFieldDialog::Apply() } } -IMPL_LINK_TYPED(sw::DropDownFieldDialog, ButtonHdl, Button*, pButton, void) +bool sw::DropDownFieldDialog::PrevButtonPressed() const +{ + return m_pPressedButton == m_pPrevPB; +} + +bool sw::DropDownFieldDialog::NextButtonPressed() const +{ + return m_pPressedButton == m_pNextPB; +} + +IMPL_LINK_NOARG_TYPED(sw::DropDownFieldDialog, EditHdl, Button*, void) +{ + m_pPressedButton = m_pEditPB; + EndDialog(RET_OK); +} + +IMPL_LINK_NOARG_TYPED(sw::DropDownFieldDialog, PrevHdl, Button*, void) +{ + m_pPressedButton = m_pPrevPB; + EndDialog(RET_OK); +} + +IMPL_LINK_NOARG_TYPED(sw::DropDownFieldDialog, NextHdl, Button*, void) { - EndDialog(m_pNextPB == pButton ? RET_OK : RET_YES ); + m_pPressedButton = m_pNextPB; + EndDialog(RET_OK); } IMPL_LINK_NOARG_TYPED(sw::DropDownFieldDialog, DoubleClickHdl, ListBox&, void) diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 5052e3d0303b..8c042d8781f1 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -32,17 +32,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 @@ -50,10 +52,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 @@ -116,7 +123,9 @@ void SwFieldInputDlg::dispose() m_pLabelED.clear(); m_pEditED.clear(); m_pOKBT.clear(); + m_pPrevBT.clear(); m_pNextBT.clear(); + m_pPressedButton.clear(); SvxStandardDialog::dispose(); } @@ -164,9 +173,27 @@ void SwFieldInputDlg::Apply() rSh.EndAllAction(); } +bool SwFieldInputDlg::PrevButtonPressed() const +{ + return m_pPressedButton == m_pPrevBT; +} + +bool SwFieldInputDlg::NextButtonPressed() const +{ + return m_pPressedButton == m_pNextBT; +} + +IMPL_LINK_NOARG_TYPED(SwFieldInputDlg, PrevHdl, Button*, void) +{ + m_pPressedButton = m_pPrevBT; + EndDialog(RET_OK); +} + IMPL_LINK_NOARG_TYPED(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 2d8f285b2ea5..a44e657baf38 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -3423,7 +3423,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 0a801d3da9c7..29b39da8a431 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_TYPED(ButtonHdl, Button*, void); - virtual void Apply() override; + VclPtr<PushButton> m_pPressedButton; + + DECL_LINK_TYPED(EditHdl, Button*, void); + DECL_LINK_TYPED(PrevHdl, Button*, void); + DECL_LINK_TYPED(NextHdl, Button*, void); DECL_LINK_TYPED(DoubleClickHdl, ListBox&, void); + virtual void Apply() override; public: DropDownFieldDialog( vcl::Window *pParent, SwWrtShell &rSh, - SwField* pField, bool bNextButton = false ); + SwField* pField, bool bPrevButton = false, bool bNextButton = false ); virtual ~DropDownFieldDialog(); 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 fec27ec571f7..59cab550f2eb 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,19 @@ class SwFieldInputDlg: public SvxStandardDialog VclPtr<OKButton> m_pOKBT; VclPtr<PushButton> m_pNextBT; + VclPtr<PushButton> m_pPrevBT; + + VclPtr<PushButton> m_pPressedButton; DECL_LINK_TYPED(NextHdl, Button*, void); + DECL_LINK_TYPED(PrevHdl, Button*, void); public: SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rSh, - SwField* pField, bool bNextButton = false ); + SwField* pField, bool bPrevButton = false, bool bNextButton = false ); virtual ~SwFieldInputDlg(); 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 0f8ccdaf1d47..c212c3ef9c2d 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -355,6 +355,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; @@ -386,9 +388,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 e9db87ffe399..028ba8589327 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -199,7 +199,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 700c30284071..0bb22aa093d9 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -146,21 +146,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() == RES_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() == RES_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(); } @@ -227,13 +256,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!"); - std::unique_ptr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bNextButton)); + std::unique_ptr<AbstractFieldInputDlg> pDlg(pFact->CreateFieldInputDlg(pParentWin, *this, pField, bPrevButton, bNextButton)); OSL_ENSURE(pDlg, "Dialog creation failed!"); if(pWindowState && !pWindowState->isEmpty()) pDlg->SetWindowState(*pWindowState); @@ -248,23 +277,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.reset(); 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!"); - std::unique_ptr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(*this, pField, bNextButton)); + std::unique_ptr<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.reset(); bool bRet = RET_CANCEL == nRet; GetWin()->Update(); @@ -389,17 +435,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 RES_SETEXPFLD: if( static_cast<const SwSetExpField&>(rField).GetInputFlag() ) - StartInputFieldDlg( const_cast<SwField*>(&rField), false ); + StartInputFieldDlg( const_cast<SwField*>(&rField), false, false ); break; case RES_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 e92303f47f6d..b022a3c7594e 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> - <requires lib="gtk+" version="3.0"/> +<interface domain="sw"> + <!-- interface-requires gtk+ 3.0 --> <object class="GtkDialog" id="DropdownFieldDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> @@ -49,8 +48,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 +91,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> @@ -173,9 +186,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 a46bbb9dffe4..2e17444c1c21 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.18.3 --> -<interface> - <requires lib="gtk+" version="3.0"/> +<interface domain="sw"> + <!-- 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> @@ -169,6 +182,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> commit 277ba2935490b20f1295fa10f68f30303c17a66f Author: Bernhard Widl <bernhard.w...@cib.de> Date: Fri Sep 15 17:16:29 2017 +0200 tdf#79877 add button text for 'previous' button (gtk-media-previous) Change-Id: I605849cd753ed3f33b8dec5921488730dc9682dd Reviewed-on: https://gerrit.libreoffice.org/42332 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc index 7174966bfbf1..dcbd8dd6ce61 100644 --- a/vcl/inc/svids.hrc +++ b/vcl/inc/svids.hrc @@ -121,6 +121,7 @@ #define SV_BUTTONTEXT_FIND 10129 #define SV_BUTTONTEXT_STOP 10130 #define SV_BUTTONTEXT_CONNECT 10131 +#define SV_BUTTONTEXT_PREV 10132 #define SV_STDTEXT_FIRST SV_STDTEXT_SERVICENOTAVAILABLE #define SV_STDTEXT_SERVICENOTAVAILABLE 10210 diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src index b3a6b6b6236b..be0251a7456c 100644 --- a/vcl/source/src/btntext.src +++ b/vcl/source/src/btntext.src @@ -186,4 +186,9 @@ String SV_BUTTONTEXT_CONNECT Text [ en-US ] = "C~onnect" ; }; +String SV_BUTTONTEXT_PREV +{ + Text [ en-US ] = "~Previous" ; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index f7cb3d0a6a10..15f3a711def0 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -754,6 +754,8 @@ namespace return (VclResId(SV_BUTTONTEXT_PASTE).toString()); else if (rType == "gtk-media-next") return (VclResId(SV_BUTTONTEXT_NEXT).toString()); + else if (rType == "gtk-media-previous") + return (VclResId(SV_BUTTONTEXT_PREV).toString()); else if (rType == "gtk-go-up") return (VclResId(SV_BUTTONTEXT_GO_UP).toString()); else if (rType == "gtk-go-down")
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits