sw/Library_sw.mk | 1 sw/source/ui/fldui/flddb.cxx | 2 sw/source/ui/fldui/flddb.hxx | 2 sw/source/ui/fldui/fldfunc.cxx | 6 - sw/source/ui/fldui/fldfunc.hxx | 6 - sw/source/ui/fldui/fldvar.cxx | 6 - sw/source/ui/fldui/fldvar.hxx | 2 sw/source/ui/inc/bookmark.hxx | 68 ++++++++++------ sw/source/ui/inc/condedit.hxx | 122 +++++++++++++++++++++++++++++ sw/source/ui/inc/regionsw.hxx | 146 ++++++++++++++++++----------------- sw/source/uibase/docvw/edtwin.cxx | 1 sw/source/uibase/inc/condedit.hxx | 75 ----------------- sw/source/uibase/utlui/condedit.cxx | 84 -------------------- sw/uiconfig/swriter/ui/fldvarpage.ui | 34 +++++--- 14 files changed, 277 insertions(+), 278 deletions(-)
New commits: commit 29750e249530eec0b3e00ceb75e668ad22b21cae Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Wed Apr 3 14:57:29 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Apr 4 17:24:54 2024 +0200 improve usability of variable fields The value field of the Variables page of the field dialog is changed into a scrollable field to enhance usability in combination with longer values of variable or user fields Change-Id: Ib268cf22ff54604214fb090c3c93b7d145a9c9a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165750 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 239e58ffc6a3..c8cc2e96814a 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -777,7 +777,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/utlui/AccessibilityStatusBarControl \ sw/source/uibase/utlui/attrdesc \ sw/source/uibase/utlui/bookctrl \ - sw/source/uibase/utlui/condedit \ sw/source/uibase/utlui/content \ sw/source/uibase/utlui/glbltree \ sw/source/uibase/utlui/gloslst \ diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 0c0210eedaac..d9e101a31b53 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -38,7 +38,7 @@ SwFieldDBPage::SwFieldDBPage(weld::Container* pPage, weld::DialogController* pCo , m_xDatabaseTLB(new SwDBTreeList(m_xBuilder->weld_tree_view("select"))) , m_xAddDBPB(m_xBuilder->weld_button("browse")) , m_xCondition(m_xBuilder->weld_widget("condgroup")) - , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("condition"))) + , m_xConditionED(new ConditionEdit<weld::Entry>(m_xBuilder->weld_entry("condition"))) , m_xValue(m_xBuilder->weld_widget("recgroup")) , m_xValueED(m_xBuilder->weld_entry("recnumber")) , m_xDBFormatRB(m_xBuilder->weld_radio_button("fromdatabasecb")) diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx index 9fb967b9a5ae..eefa801dab5a 100644 --- a/sw/source/ui/fldui/flddb.hxx +++ b/sw/source/ui/fldui/flddb.hxx @@ -37,7 +37,7 @@ class SwFieldDBPage : public SwFieldPage std::unique_ptr<SwDBTreeList> m_xDatabaseTLB; std::unique_ptr<weld::Button> m_xAddDBPB; std::unique_ptr<weld::Widget> m_xCondition; - std::unique_ptr<ConditionEdit> m_xConditionED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xConditionED; std::unique_ptr<weld::Widget> m_xValue; std::unique_ptr<weld::Entry> m_xValueED; std::unique_ptr<weld::RadioButton> m_xDBFormatRB; diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index 6447c375e5b4..ce29dd991d3b 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -42,14 +42,14 @@ SwFieldFuncPage::SwFieldFuncPage(weld::Container* pPage, weld::DialogController* , m_xFormat(m_xBuilder->weld_widget("formatframe")) , m_xFormatLB(m_xBuilder->weld_tree_view("format")) , m_xNameFT(m_xBuilder->weld_label("nameft")) - , m_xNameED(new ConditionEdit(m_xBuilder->weld_entry("condFunction"))) + , m_xNameED(new ConditionEdit<weld::Entry>(m_xBuilder->weld_entry("condFunction"))) , m_xValueGroup(m_xBuilder->weld_widget("valuegroup")) , m_xValueFT(m_xBuilder->weld_label("valueft")) , m_xValueED(m_xBuilder->weld_entry("value")) , m_xCond1FT(m_xBuilder->weld_label("cond1ft")) - , m_xCond1ED(new ConditionEdit(m_xBuilder->weld_entry("cond1"))) + , m_xCond1ED(new ConditionEdit<weld::Entry>(m_xBuilder->weld_entry("cond1"))) , m_xCond2FT(m_xBuilder->weld_label("cond2ft")) - , m_xCond2ED(new ConditionEdit(m_xBuilder->weld_entry("cond2"))) + , m_xCond2ED(new ConditionEdit<weld::Entry>(m_xBuilder->weld_entry("cond2"))) , m_xMacroBT(m_xBuilder->weld_button("macro")) , m_xListGroup(m_xBuilder->weld_widget("listgroup")) , m_xListItemED(m_xBuilder->weld_entry("item")) diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx index 9fef98d256af..3f2ebef355e4 100644 --- a/sw/source/ui/fldui/fldfunc.hxx +++ b/sw/source/ui/fldui/fldfunc.hxx @@ -37,14 +37,14 @@ class SwFieldFuncPage : public SwFieldPage std::unique_ptr<weld::Widget> m_xFormat; std::unique_ptr<weld::TreeView> m_xFormatLB; std::unique_ptr<weld::Label> m_xNameFT; - std::unique_ptr<ConditionEdit> m_xNameED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xNameED; std::unique_ptr<weld::Widget> m_xValueGroup; std::unique_ptr<weld::Label> m_xValueFT; std::unique_ptr<weld::Entry> m_xValueED; std::unique_ptr<weld::Label> m_xCond1FT; - std::unique_ptr<ConditionEdit> m_xCond1ED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xCond1ED; std::unique_ptr<weld::Label> m_xCond2FT; - std::unique_ptr<ConditionEdit> m_xCond2ED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xCond2ED; std::unique_ptr<weld::Button> m_xMacroBT; //controls of "Input list" diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 13265523ba17..4190aa81f29c 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -47,7 +47,7 @@ SwFieldVarPage::SwFieldVarPage(weld::Container* pPage, weld::DialogController* p , m_xNameFT(m_xBuilder->weld_label("nameft")) , m_xNameED(m_xBuilder->weld_entry("name")) , m_xValueFT(m_xBuilder->weld_label("valueft")) - , m_xValueED(new ConditionEdit(m_xBuilder->weld_entry("value"))) + , m_xValueED(new ConditionEdit<weld::TextView>(m_xBuilder->weld_text_view("value"))) , m_xFormat(m_xBuilder->weld_widget("formatframe")) , m_xNumFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("numformat"))) , m_xFormatLB(m_xBuilder->weld_tree_view("format")) @@ -71,6 +71,9 @@ SwFieldVarPage::SwFieldVarPage(weld::Container* pPage, weld::DialogController* p m_xSelectionLB->set_size_request(nWidth, nHeight); m_xFormatLB->set_size_request(nWidth, nHeight/2); + m_xValueED->get_widget().set_size_request(m_xValueED->get_widget().get_preferred_size().Width(), + m_xValueED->get_widget().get_height_rows(3)); + m_sOldValueFT = m_xValueFT->get_label(); m_sOldNameFT = m_xNameFT->get_label(); @@ -148,7 +151,6 @@ void SwFieldVarPage::Reset(const SfxItemSet* ) m_xFormatLB->connect_row_activated(LINK(this, SwFieldVarPage, TreeViewInsertHdl)); m_xNumFormatLB->connect_row_activated(LINK(this, SwFieldVarPage, TreeViewInsertHdl)); m_xNameED->connect_changed(LINK(this, SwFieldVarPage, ModifyHdl)); - m_xValueED->connect_changed(LINK(this, SwFieldVarPage, ModifyHdl)); m_xNewPB->connect_clicked(LINK(this, SwFieldVarPage, TBClickHdl)); m_xDelPB->connect_clicked(LINK(this, SwFieldVarPage, TBClickHdl)); m_xChapterLevelLB->connect_changed(LINK(this, SwFieldVarPage, ChapterHdl)); diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx index 3eedfbf2cc71..3aabb8f4e6e3 100644 --- a/sw/source/ui/fldui/fldvar.hxx +++ b/sw/source/ui/fldui/fldvar.hxx @@ -35,7 +35,7 @@ class SwFieldVarPage : public SwFieldPage std::unique_ptr<weld::Label> m_xNameFT; std::unique_ptr<weld::Entry> m_xNameED; std::unique_ptr<weld::Label> m_xValueFT; - std::unique_ptr<ConditionEdit> m_xValueED; + std::unique_ptr<ConditionEdit<weld::TextView>> m_xValueED; std::unique_ptr<weld::Widget> m_xFormat; std::unique_ptr<SwNumFormatTreeView> m_xNumFormatLB; std::unique_ptr<weld::TreeView> m_xFormatLB; diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/ui/inc/bookmark.hxx similarity index 70% rename from sw/source/uibase/inc/bookmark.hxx rename to sw/source/ui/inc/bookmark.hxx index 8017e146d756..064408e66763 100644 --- a/sw/source/uibase/inc/bookmark.hxx +++ b/sw/source/ui/inc/bookmark.hxx @@ -30,30 +30,52 @@ class BookmarkTable { std::unique_ptr<weld::TreeView> m_xControl; std::unique_ptr<weld::TreeIter> GetRowByBookmarkName(const OUString& sName); + public: BookmarkTable(std::unique_ptr<weld::TreeView> xControl); - void InsertBookmark(SwWrtShell & rSh, sw::mark::IMark* pMark); - bool SelectByName(const OUString& sName); - sw::mark::IMark* GetBookmarkByName(const OUString& sName); - OUString GetNameProposal() const; + void InsertBookmark(SwWrtShell& rSh, sw::mark::IMark* pMark); + bool SelectByName(const OUString& sName); + sw::mark::IMark* GetBookmarkByName(const OUString& sName); + OUString GetNameProposal() const; - void unselect_all() { m_xControl->unselect_all(); } - bool has_focus() const { return m_xControl->has_focus(); } + void unselect_all() { m_xControl->unselect_all(); } + bool has_focus() const { return m_xControl->has_focus(); } std::unique_ptr<weld::TreeIter> get_selected() const; - void clear() { m_xControl->clear(); } - void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); } - void remove_selection() { m_xControl->remove_selection(); } - OUString get_text(const weld::TreeIter& rIter) const { return m_xControl->get_text(rIter, 2); } - OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); } - void set_sort_indicator(TriState eState, int nColumn = -1) { m_xControl->set_sort_indicator(eState, nColumn); } - void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) { m_xControl->selected_foreach(func); } + void clear() { m_xControl->clear(); } + void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); } + void remove_selection() { m_xControl->remove_selection(); } + OUString get_text(const weld::TreeIter& rIter) const { return m_xControl->get_text(rIter, 2); } + OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); } + void set_sort_indicator(TriState eState, int nColumn = -1) + { + m_xControl->set_sort_indicator(eState, nColumn); + } + void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) + { + m_xControl->selected_foreach(func); + } - void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); } - void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); } - void connect_column_clicked(const Link<int, void>& rLink) { m_xControl->connect_column_clicked(rLink); } + void connect_changed(const Link<weld::TreeView&, void>& rLink) + { + m_xControl->connect_changed(rLink); + } + void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) + { + m_xControl->connect_row_activated(rLink); + } + void connect_column_clicked(const Link<int, void>& rLink) + { + m_xControl->connect_column_clicked(rLink); + } void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink, - const Link<const weld::TreeView::iter_string&, bool>& rEndLink) { m_xControl->connect_editing(rStartLink, rEndLink); } - void set_column_editables(::std::vector<bool> const& rEditables) { m_xControl->set_column_editables(rEditables); } + const Link<const weld::TreeView::iter_string&, bool>& rEndLink) + { + m_xControl->connect_editing(rStartLink, rEndLink); + } + void set_column_editables(::std::vector<bool> const& rEditables) + { + m_xControl->set_column_editables(rEditables); + } void start_editing(weld::TreeIter const& rIter) { m_xControl->start_editing(rIter); } void make_sorted() { m_xControl->make_sorted(); } bool get_sort_order() const { return m_xControl->get_sort_order(); } @@ -62,15 +84,15 @@ public: void set_sort_column(int nColumn) { m_xControl->set_sort_column(nColumn); } static constexpr OUString aForbiddenChars = u"/\@*?\",#"_ustr; - static const char s_cSeparator; + static const char s_cSeparator; }; class SwInsertBookmarkDlg final : public SfxDialogController { - SwWrtShell& m_rSh; + SwWrtShell& m_rSh; std::vector<std::pair<sw::mark::IMark*, OUString>> m_aTableBookmarks; - sal_Int32 m_nLastBookmarksCount; - bool m_bSorted; + sal_Int32 m_nLastBookmarksCount; + bool m_bSorted; bool m_bAreProtected; std::unique_ptr<weld::Entry> m_xEditBox; @@ -81,7 +103,7 @@ class SwInsertBookmarkDlg final : public SfxDialogController std::unique_ptr<weld::Button> m_xRenameBtn; std::unique_ptr<weld::CheckButton> m_xHideCB; std::unique_ptr<weld::Label> m_xConditionFT; - std::unique_ptr<ConditionEdit> m_xConditionED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xConditionED; std::unique_ptr<BookmarkTable> m_xBookmarksBox; std::unique_ptr<weld::Label> m_xForbiddenChars; diff --git a/sw/source/ui/inc/condedit.hxx b/sw/source/ui/inc/condedit.hxx new file mode 100644 index 000000000000..ab07c0c597dd --- /dev/null +++ b/sw/source/ui/inc/condedit.hxx @@ -0,0 +1,122 @@ +/* -*- 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 INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX + +#include <vcl/transfer.hxx> +#include <vcl/weld.hxx> +#include <svx/dbaexchange.hxx> + +template <typename X> class ConditionEdit; + +template <class T> class ConditionEditDropTarget final : public DropTargetHelper +{ +private: + ConditionEdit<T>& m_rEdit; + + virtual sal_Int8 AcceptDrop(const AcceptDropEvent&) override + { + return svx::OColumnTransferable::canExtractColumnDescriptor( + GetDataFlavorExVector(), ColumnTransferFormatFlags::COLUMN_DESCRIPTOR) + ? DND_ACTION_COPY + : DND_ACTION_NONE; + } + virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override + { + sal_Int8 nRet = DND_ACTION_NONE; + if (m_rEdit.GetDropEnable()) + { + TransferableDataHelper aData(rEvt.maDropEvent.Transferable); + + const DataFlavorExVector& rVector = aData.GetDataFlavorExVector(); + if (svx::OColumnTransferable::canExtractColumnDescriptor( + rVector, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR)) + { + svx::ODataAccessDescriptor aColDesc + = svx::OColumnTransferable::extractColumnDescriptor(aData); + OUString sDBName; + bool bBrackets = m_rEdit.GetBrackets(); + if (bBrackets) + sDBName += "["; + OUString sTmp = aColDesc.getDataSource(); + sDBName += sTmp + "."; + + aColDesc[svx::DataAccessDescriptorProperty::Command] >>= sTmp; + sDBName += sTmp + "."; + + aColDesc[svx::DataAccessDescriptorProperty::ColumnName] >>= sTmp; + sDBName += sTmp; + if (bBrackets) + sDBName += "]"; + + m_rEdit.get_widget().set_text(sDBName); + nRet = DND_ACTION_COPY; + } + } + return nRet; + } + +public: + ConditionEditDropTarget(ConditionEdit<T>& rEdit) + : DropTargetHelper(rEdit.get_widget().get_drop_target()) + , m_rEdit(rEdit) + { + } +}; + +//< weld::Entry > +template <class T> class ConditionEdit +{ + std::unique_ptr<T> m_xControl; + ConditionEditDropTarget<T> m_aDropTargetHelper; + bool m_bBrackets, m_bEnableDrop; + +public: + ConditionEdit(std::unique_ptr<T> xControl) + : m_xControl(std::move(xControl)) + , m_aDropTargetHelper(*this) + , m_bBrackets(true) + , m_bEnableDrop(true) + { + } + + OUString get_text() const { return m_xControl->get_text(); } + void set_text(const OUString& rText) { m_xControl->set_text(rText); } + void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); } + void set_accessible_name(const OUString& rName) { m_xControl->set_accessible_name(rName); } + void save_value() { m_xControl->save_value(); } + bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + void connect_changed(const Link<T&, void>& rLink) { m_xControl->connect_changed(rLink); } + void replace_selection(const OUString& rText) { m_xControl->replace_selection(rText); } + void hide() { m_xControl->hide(); } + T& get_widget() { return *m_xControl; } + + OUString get_buildable_name() const { return m_xControl->get_buildable_name(); } + void set_buildable_name(const OUString& rId) { m_xControl->set_buildable_name(rId); } + + void ShowBrackets(bool bShow) { m_bBrackets = bShow; } + bool GetBrackets() const { return m_bBrackets; } + void SetDropEnable(bool bFlag) { m_bEnableDrop = bFlag; } + bool GetDropEnable() const { return m_bEnableDrop; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx similarity index 62% rename from sw/source/uibase/inc/regionsw.hxx rename to sw/source/ui/inc/regionsw.hxx index ad425df898e5..8bf5fc6770a8 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/ui/inc/regionsw.hxx @@ -25,7 +25,7 @@ #include "condedit.hxx" #include <section.hxx> #include <fmtftntx.hxx> -#include "numberingtypelistbox.hxx" +#include <numberingtypelistbox.hxx> #include <svx/paraprev.hxx> #include <memory> @@ -35,8 +35,8 @@ class SwWrtShell; namespace sfx2 { - class DocumentInserter; - class FileDialogHelper; +class DocumentInserter; +class FileDialogHelper; } // dialog "edit regions" @@ -45,17 +45,17 @@ typedef std::map<size_t, std::unique_ptr<SectRepr>> SectReprs_t; class SwEditRegionDlg final : public SfxDialogController { - bool m_bSubRegionsFilled; + bool m_bSubRegionsFilled; - SwWrtShell& m_rSh; - SectReprs_t m_SectReprs; - const SwSection* m_pCurrSect; + SwWrtShell& m_rSh; + SectReprs_t m_SectReprs; + const SwSection* m_pCurrSect; std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; - bool m_bDontCheckPasswd :1; + bool m_bDontCheckPasswd : 1; std::unique_ptr<weld::Entry> m_xCurName; - std::unique_ptr<weld::TreeView> m_xTree; + std::unique_ptr<weld::TreeView> m_xTree; std::unique_ptr<weld::CheckButton> m_xFileCB; std::unique_ptr<weld::CheckButton> m_xDDECB; std::unique_ptr<weld::Widget> m_xDDEFrame; @@ -70,7 +70,7 @@ class SwEditRegionDlg final : public SfxDialogController std::unique_ptr<weld::Button> m_xPasswdPB; std::unique_ptr<weld::CheckButton> m_xHideCB; std::unique_ptr<weld::Label> m_xConditionFT; - std::unique_ptr<ConditionEdit> m_xConditionED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xConditionED; // #114856# edit in readonly sections std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; std::unique_ptr<weld::Button> m_xOK; @@ -79,31 +79,31 @@ class SwEditRegionDlg final : public SfxDialogController std::unique_ptr<weld::Widget> m_xHideFrame; std::unique_ptr<weld::Frame> m_xLinkFrame; - void RecurseList(const SwSectionFormat* pFormat, const weld::TreeIter* pIter); - size_t FindArrPos(const SwSectionFormat* pFormat); + void RecurseList(const SwSectionFormat* pFormat, const weld::TreeIter* pIter); + size_t FindArrPos(const SwSectionFormat* pFormat); - DECL_LINK( GetFirstEntryHdl, weld::TreeView&, void ); + DECL_LINK(GetFirstEntryHdl, weld::TreeView&, void); - DECL_LINK( OkHdl, weld::Button&, void ); - DECL_LINK( NameEditHdl, weld::Entry&, void ); - DECL_LINK( ConditionEditHdl, weld::Entry&, void ); + DECL_LINK(OkHdl, weld::Button&, void); + DECL_LINK(NameEditHdl, weld::Entry&, void); + DECL_LINK(ConditionEditHdl, weld::Entry&, void); void ChangePasswd(bool bChange); - DECL_LINK( TogglePasswdHdl, weld::Toggleable&, void ); - DECL_LINK( ChangePasswdHdl, weld::Button&, void ); - DECL_LINK( ChangeProtectHdl, weld::Toggleable&, void ); - DECL_LINK( ChangeHideHdl, weld::Toggleable&, void ); + DECL_LINK(TogglePasswdHdl, weld::Toggleable&, void); + DECL_LINK(ChangePasswdHdl, weld::Button&, void); + DECL_LINK(ChangeProtectHdl, weld::Toggleable&, void); + DECL_LINK(ChangeHideHdl, weld::Toggleable&, void); // #114856# edit in readonly sections - DECL_LINK( ChangeEditInReadonlyHdl, weld::Toggleable&, void ); - DECL_LINK( ChangeDismissHdl, weld::Button&, void); - DECL_LINK( UseFileHdl, weld::Toggleable&, void ); - DECL_LINK( FileSearchHdl, weld::Button&, void ); - DECL_LINK( OptionsHdl, weld::Button&, void ); - DECL_LINK( FileNameComboBoxHdl, weld::ComboBox&, void ); - DECL_LINK( FileNameEntryHdl, weld::Entry&, void ); - DECL_LINK( DDEHdl, weld::Toggleable&, void ); - DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper*, void ); - DECL_LINK( SubRegionEventHdl, weld::ComboBox&, void ); + DECL_LINK(ChangeEditInReadonlyHdl, weld::Toggleable&, void); + DECL_LINK(ChangeDismissHdl, weld::Button&, void); + DECL_LINK(UseFileHdl, weld::Toggleable&, void); + DECL_LINK(FileSearchHdl, weld::Button&, void); + DECL_LINK(OptionsHdl, weld::Button&, void); + DECL_LINK(FileNameComboBoxHdl, weld::ComboBox&, void); + DECL_LINK(FileNameEntryHdl, weld::Entry&, void); + DECL_LINK(DDEHdl, weld::Toggleable&, void); + DECL_LINK(DlgClosedHdl, sfx2::FileDialogHelper*, void); + DECL_LINK(SubRegionEventHdl, weld::ComboBox&, void); bool CheckPasswd(weld::Toggleable* pBox = nullptr); @@ -111,19 +111,18 @@ public: SwEditRegionDlg(weld::Window* pParent, SwWrtShell& rWrtSh); virtual ~SwEditRegionDlg() override; - void SelectSection(std::u16string_view rSectionName); - + void SelectSection(std::u16string_view rSectionName); }; // dialog "insert region" class SwInsertSectionTabPage final : public SfxTabPage { - OUString m_sFileName; - OUString m_sFilterName; - OUString m_sFilePasswd; + OUString m_sFileName; + OUString m_sFilterName; + OUString m_sFilePasswd; - css::uno::Sequence <sal_Int8 > m_aNewPasswd; - SwWrtShell* m_pWrtSh; + css::uno::Sequence<sal_Int8> m_aNewPasswd; + SwWrtShell* m_pWrtSh; std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter; std::unique_ptr<weld::EntryTreeView> m_xCurName; @@ -140,33 +139,34 @@ class SwInsertSectionTabPage final : public SfxTabPage std::unique_ptr<weld::Button> m_xPasswdPB; std::unique_ptr<weld::CheckButton> m_xHideCB; std::unique_ptr<weld::Label> m_xConditionFT; - std::unique_ptr<ConditionEdit> m_xConditionED; + std::unique_ptr<ConditionEdit<weld::Entry>> m_xConditionED; // #114856# edit in readonly sections std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; void ChangePasswd(bool bChange); - DECL_LINK( ChangeHideHdl, weld::Toggleable&, void ); - DECL_LINK( ChangeProtectHdl, weld::Toggleable&, void ); - DECL_LINK( ChangePasswdHdl, weld::Button&, void ); - DECL_LINK( TogglePasswdHdl, weld::Toggleable&, void ); - DECL_LINK( NameEditHdl, weld::ComboBox&, void ); - DECL_LINK( UseFileHdl, weld::Toggleable&, void ); - DECL_LINK( FileSearchHdl, weld::Button&, void ); - DECL_LINK( DDEHdl, weld::Toggleable&, void ); - DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper*, void ); + DECL_LINK(ChangeHideHdl, weld::Toggleable&, void); + DECL_LINK(ChangeProtectHdl, weld::Toggleable&, void); + DECL_LINK(ChangePasswdHdl, weld::Button&, void); + DECL_LINK(TogglePasswdHdl, weld::Toggleable&, void); + DECL_LINK(NameEditHdl, weld::ComboBox&, void); + DECL_LINK(UseFileHdl, weld::Toggleable&, void); + DECL_LINK(FileSearchHdl, weld::Button&, void); + DECL_LINK(DDEHdl, weld::Toggleable&, void); + DECL_LINK(DlgClosedHdl, sfx2::FileDialogHelper*, void); public: - SwInsertSectionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + SwInsertSectionTabPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rAttrSet); virtual ~SwInsertSectionTabPage() override; - void SetWrtShell(SwWrtShell& rSh); + void SetWrtShell(SwWrtShell& rSh); - virtual bool FillItemSet( SfxItemSet* ) override; - virtual void Reset( const SfxItemSet* ) override; + virtual bool FillItemSet(SfxItemSet*) override; + virtual void Reset(const SfxItemSet*) override; - static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, - const SfxItemSet* rAttrSet); + static std::unique_ptr<SfxTabPage> + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); }; class SwSectionFootnoteEndTabPage final : public SfxTabPage @@ -193,17 +193,18 @@ class SwSectionFootnoteEndTabPage final : public SfxTabPage std::unique_ptr<weld::Entry> m_xEndSuffixED; DECL_LINK(FootEndHdl, weld::Toggleable&, void); - void ResetState( bool bFootnote, const SwFormatFootnoteEndAtTextEnd& ); + void ResetState(bool bFootnote, const SwFormatFootnoteEndAtTextEnd&); public: - SwSectionFootnoteEndTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + SwSectionFootnoteEndTabPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rAttrSet); virtual ~SwSectionFootnoteEndTabPage() override; - virtual bool FillItemSet( SfxItemSet* ) override; - virtual void Reset( const SfxItemSet* ) override; + virtual bool FillItemSet(SfxItemSet*) override; + virtual void Reset(const SfxItemSet*) override; - static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, - const SfxItemSet* rAttrSet); + static std::unique_ptr<SfxTabPage> + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); }; class SwSectionIndentTabPage final : public SfxTabPage @@ -214,38 +215,43 @@ class SwSectionIndentTabPage final : public SfxTabPage std::unique_ptr<weld::CustomWeld> m_xPreviewWin; DECL_LINK(IndentModifyHdl, weld::MetricSpinButton&, void); + public: - SwSectionIndentTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet); + SwSectionIndentTabPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rAttrSet); virtual ~SwSectionIndentTabPage() override; - virtual bool FillItemSet( SfxItemSet* ) override; - virtual void Reset( const SfxItemSet* ) override; + virtual bool FillItemSet(SfxItemSet*) override; + virtual void Reset(const SfxItemSet*) override; - static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); + static std::unique_ptr<SfxTabPage> + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet); - void SetWrtShell(SwWrtShell const & rSh); + void SetWrtShell(SwWrtShell const& rSh); }; class SwInsertSectionTabDialog final : public SfxTabDialogController { - SwWrtShell& m_rWrtSh; + SwWrtShell& m_rWrtSh; std::unique_ptr<SwSectionData> m_pSectionData; - virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override; - virtual short Ok() override; + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; + virtual short Ok() override; + public: SwInsertSectionTabDialog(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); virtual ~SwInsertSectionTabDialog() override; - void SetSectionData(SwSectionData const& rSect); - SwSectionData * GetSectionData() { return m_pSectionData.get(); } + void SetSectionData(SwSectionData const& rSect); + SwSectionData* GetSectionData() { return m_pSectionData.get(); } }; class SwSectionPropertyTabDialog final : public SfxTabDialogController { SwWrtShell& m_rWrtSh; - virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override; + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; + public: SwSectionPropertyTabDialog(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); virtual ~SwSectionPropertyTabDialog() override; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 03b8e6f66a9a..6bd10d4d580f 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -71,7 +71,6 @@ #include <sfx2/lokhelper.hxx> #include <editeng/acorrcfg.hxx> -#include <bookmark.hxx> #include <SwSmartTagMgr.hxx> #include <edtdd.hxx> #include <edtwin.hxx> diff --git a/sw/source/uibase/inc/condedit.hxx b/sw/source/uibase/inc/condedit.hxx deleted file mode 100644 index fddf1f00ddde..000000000000 --- a/sw/source/uibase/inc/condedit.hxx +++ /dev/null @@ -1,75 +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 INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX - -#include <vcl/transfer.hxx> -#include <vcl/weld.hxx> -#include <swdllapi.h> - -class ConditionEdit; - -class SW_DLLPUBLIC ConditionEditDropTarget final : public DropTargetHelper -{ -private: - ConditionEdit& m_rEdit; - - SAL_DLLPRIVATE virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override; - SAL_DLLPRIVATE virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override; - -public: - ConditionEditDropTarget(ConditionEdit& rEdit); -}; - -class SW_DLLPUBLIC ConditionEdit -{ - std::unique_ptr<weld::Entry> m_xControl; - ConditionEditDropTarget m_aDropTargetHelper; - bool m_bBrackets, m_bEnableDrop; - -public: - ConditionEdit(std::unique_ptr<weld::Entry> xControl); - - OUString get_text() const { return m_xControl->get_text(); } - void set_text(const OUString& rText) { m_xControl->set_text(rText); } - void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); } - void set_accessible_name(const OUString& rName) { m_xControl->set_accessible_name(rName); } - void save_value() { m_xControl->save_value(); } - bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } - void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } - void connect_changed(const Link<weld::Entry&, void>& rLink) - { - m_xControl->connect_changed(rLink); - } - void replace_selection(const OUString& rText) { m_xControl->replace_selection(rText); } - void hide() { m_xControl->hide(); } - weld::Entry& get_widget() { return *m_xControl; } - - OUString get_buildable_name() const { return m_xControl->get_buildable_name(); } - void set_buildable_name(const OUString& rId) { m_xControl->set_buildable_name(rId); } - - void ShowBrackets(bool bShow) { m_bBrackets = bShow; } - bool GetBrackets() const { return m_bBrackets; } - void SetDropEnable(bool bFlag) { m_bEnableDrop = bFlag; } - bool GetDropEnable() const { return m_bEnableDrop; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/utlui/condedit.cxx b/sw/source/uibase/utlui/condedit.cxx deleted file mode 100644 index 1303ddfc752b..000000000000 --- a/sw/source/uibase/utlui/condedit.cxx +++ /dev/null @@ -1,84 +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 <condedit.hxx> -#include <svx/dbaexchange.hxx> - -using namespace ::svx; -using namespace ::com::sun::star::uno; - -ConditionEdit::ConditionEdit(std::unique_ptr<weld::Entry> xControl) - : m_xControl(std::move(xControl)) - , m_aDropTargetHelper(*this) - , m_bBrackets(true) - , m_bEnableDrop(true) -{ -} - -sal_Int8 ConditionEditDropTarget::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) -{ - return OColumnTransferable::canExtractColumnDescriptor - ( GetDataFlavorExVector(), - ColumnTransferFormatFlags::COLUMN_DESCRIPTOR ) - ? DND_ACTION_COPY - : DND_ACTION_NONE; -} - -ConditionEditDropTarget::ConditionEditDropTarget(ConditionEdit& rEdit) - : DropTargetHelper(rEdit.get_widget().get_drop_target()) - , m_rEdit(rEdit) -{ -} - -sal_Int8 ConditionEditDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt ) -{ - sal_Int8 nRet = DND_ACTION_NONE; - if (m_rEdit.GetDropEnable()) - { - TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); - - const DataFlavorExVector& rVector = aData.GetDataFlavorExVector(); - if (OColumnTransferable::canExtractColumnDescriptor(rVector, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR)) - { - ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor( - aData); - OUString sDBName; - bool bBrackets = m_rEdit.GetBrackets(); - if (bBrackets) - sDBName += "["; - OUString sTmp = aColDesc.getDataSource(); - sDBName += sTmp + "."; - - aColDesc[DataAccessDescriptorProperty::Command] >>= sTmp; - sDBName += sTmp + "."; - - aColDesc[DataAccessDescriptorProperty::ColumnName] >>= sTmp; - sDBName += sTmp; - if (bBrackets) - sDBName += "]"; - - m_rEdit.get_widget().set_text( sDBName ); - nRet = DND_ACTION_COPY; - } - } - return nRet; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/fldvarpage.ui b/sw/uiconfig/swriter/ui/fldvarpage.ui index 475b416e0c9b..7925bdbaaad0 100644 --- a/sw/uiconfig/swriter/ui/fldvarpage.ui +++ b/sw/uiconfig/swriter/ui/fldvarpage.ui @@ -524,7 +524,7 @@ <object class="GtkEntry" id="name"> <property name="visible">True</property> <property name="can-focus">True</property> - <property name="valign">center</property> + <property name="valign">top</property> <property name="hexpand">True</property> <property name="truncate-multiline">True</property> <child internal-child="accessible"> @@ -534,8 +534,8 @@ </child> </object> <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> @@ -548,21 +548,29 @@ <property name="xalign">0</property> </object> <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - <property name="width">2</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + <property name="width">1</property> </packing> </child> <child> - <object class="GtkEntry" id="value"> + <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="visible">True</property> <property name="can-focus">True</property> - <property name="valign">center</property> <property name="hexpand">True</property> - <property name="truncate-multiline">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="value-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="fldvarpage|extended_tip|value">Enter the contents to add to a user-defined field.</property> + <property name="vexpand">True</property> + <property name="shadow-type">in</property> + <child> + <object class="GtkTextView" id="value"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="comments-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="fldvarpage|extended_tip|value">Enter the contents to add to a user-defined field.</property> + </object> + </child> </object> </child> </object> @@ -576,7 +584,7 @@ <object class="GtkGrid" id="toolbar"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="valign">center</property> + <property name="valign">end</property> <property name="column-spacing">6</property> <child> <object class="GtkButton" id="apply">