[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2019-06-21 Thread Caolán McNamara (via logerrit)
 include/vcl/weld.hxx |2 
 sw/source/ui/misc/bookmark.cxx   |  134 ---
 sw/source/uibase/inc/bookmark.hxx|   23 +++--
 sw/uiconfig/swriter/ui/insertbookmark.ui |5 +
 vcl/source/app/salvtables.cxx|   13 +++
 vcl/unx/gtk3/gtk3gtkinst.cxx |   21 
 6 files changed, 146 insertions(+), 52 deletions(-)

New commits:
commit 46cd78756f784ce81f8051e211d542f53112d5a3
Author: Caolán McNamara 
AuthorDate: Thu Jun 20 20:59:00 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 21 09:55:35 2019 +0200

Resolves: tdf#126005 make bookmark treeview sortable

and use iterators into the tree

Change-Id: I38eb24d71cc089bf61baa221324a983c1eb782c9
Reviewed-on: https://gerrit.libreoffice.org/74470
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 449190f7a92c..7393131fea14 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -877,6 +877,8 @@ public:
 
 virtual void set_selection_mode(SelectionMode eMode) = 0;
 virtual int count_selected_rows() const = 0;
+// remove the selected nodes
+virtual void remove_selection() = 0;
 
 void set_toggle_columns_as_radio(const std::vector& rCols) { 
m_aRadioIndexes = rCols; }
 
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 11144f55b703..089c34c9b68d 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -94,16 +94,12 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, DeleteHdl, 
weld::Button&, void)
 {
 if (!ValidateBookmarks())
 return;
-std::vector aSelectedRows(m_xBookmarksBox->get_selected_rows());
-if (aSelectedRows.empty())
-return;
-std::sort(aSelectedRows.begin(), aSelectedRows.end());
 
-for (size_t i = aSelectedRows.size(); i; --i)
-{
-int nRow = aSelectedRows[i-1];
+int nSelectedRows(0);
+
+m_xBookmarksBox->selected_foreach([this, ](weld::TreeIter& 
rEntry){
 // remove from model
-sw::mark::IMark* pBookmark = 
reinterpret_cast(m_xBookmarksBox->get_id(nRow).toInt64());
+sw::mark::IMark* pBookmark = 
reinterpret_cast(m_xBookmarksBox->get_id(rEntry).toInt64());
 OUString sRemoved = pBookmark->GetName();
 IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
 pMarkAccess->deleteMark(pMarkAccess->findMark(sRemoved));
@@ -112,11 +108,20 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, DeleteHdl, 
weld::Button&, void)
 aReq.Done();
 aTableBookmarks.erase(std::remove(aTableBookmarks.begin(), 
aTableBookmarks.end(),
   std::make_pair(pBookmark, sRemoved)), 
aTableBookmarks.end());
-// remove from BookmarkTable
-m_xBookmarksBox->remove(nRow);
-}
-m_xBookmarksBox->unselect_all();
-m_xEditBox->set_text("");
+
+++nSelectedRows;
+
+return false;
+});
+
+if (!nSelectedRows)
+return;
+
+// remove from BookmarkTable
+m_xBookmarksBox->remove_selection();
+
+ValidateBookmarks();
+
 m_xDeleteBtn->set_sensitive(false);
 m_xGotoBtn->set_sensitive(false);
 m_xRenameBtn->set_sensitive(false);
@@ -143,23 +148,21 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, 
weld::TreeView&, void)
 return;
 
 OUStringBuffer sEditBoxText;
-
-std::vector aSelectedRows(m_xBookmarksBox->get_selected_rows());
-std::sort(aSelectedRows.begin(), aSelectedRows.end());
-for (size_t i = aSelectedRows.size(); i; --i)
-{
-int nRow = aSelectedRows[i-1];
-sw::mark::IMark* pBookmark = 
reinterpret_cast(m_xBookmarksBox->get_id(nRow).toInt64());
+int nSelectedRows = 0;
+m_xBookmarksBox->selected_foreach([this, , 
](weld::TreeIter& rEntry){
+sw::mark::IMark* pBookmark = 
reinterpret_cast(m_xBookmarksBox->get_id(rEntry).toInt64());
 const OUString& sEntryName = pBookmark->GetName();
-sEditBoxText.append(sEntryName);
-if (i > 1)
+if (!sEditBoxText.isEmpty())
 sEditBoxText.append(";");
-}
-if (!aSelectedRows.empty())
+sEditBoxText.append(sEntryName);
+++nSelectedRows;
+return false;
+});
+if (nSelectedRows)
 {
 m_xInsertBtn->set_sensitive(false);
-m_xGotoBtn->set_sensitive(aSelectedRows.size() == 1);
-m_xRenameBtn->set_sensitive(aSelectedRows.size() == 1);
+m_xGotoBtn->set_sensitive(nSelectedRows == 1);
+m_xRenameBtn->set_sensitive(nSelectedRows == 1);
 m_xDeleteBtn->set_sensitive(true);
 m_xEditBox->set_text(sEditBoxText.makeStringAndClear());
 }
@@ -176,11 +179,11 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, 
weld::Button&, void)
 {
 if (!ValidateBookmarks())
 return;
-int nSelected = m_xBookmarksBox->get_selected_index();
-if (nSelected == -1)
+ 

[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2018-12-13 Thread Libreoffice Gerrit user
 include/vcl/weld.hxx   |1 
 sw/source/ui/index/cnttab.cxx  |  642 +++--
 sw/source/uibase/inc/swuicnttab.hxx|  139 +++
 sw/uiconfig/swriter/ui/tocindexpage.ui |  140 ---
 vcl/source/app/salvtables.cxx  |6 
 vcl/unx/gtk3/gtk3gtkinst.cxx   |5 
 6 files changed, 463 insertions(+), 470 deletions(-)

New commits:
commit bbb130f8228797121d57a5e2e36ae95256bdce33
Author: Caolán McNamara 
AuthorDate: Wed Dec 12 16:09:09 2018 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 13 15:11:36 2018 +0100

weld SwTOXSelectTabPage

Change-Id: I2acd547263ab254edd609da4e928738f8b0b9d3b
Reviewed-on: https://gerrit.libreoffice.org/65091
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 98521af326c5..41ba948be3a4 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -651,6 +651,7 @@ public:
 {
 insert_item(-1, rId, rStr, nullptr, , false);
 }
+virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 
0;
 virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
 virtual void set_item_label(const OString& rIdent, const OUString& rLabel) 
= 0;
 virtual void set_item_help_id(const OString& rIdent, const OString& 
rHelpId) = 0;
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 4298a9da83de..0dd57e26b893 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -471,8 +471,7 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl, 
Button*, void )
 OUString sInfo(SwResId(STR_FILE_NOT_FOUND));
 sInfo = sInfo.replaceFirst( "%1", sTemplate );
 sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() );
-vcl::Window* pWin = GetParent();
-std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
   
VclMessageType::Info, VclButtonsType::Ok,
   sInfo));
 xInfoBox->run();
@@ -722,66 +721,57 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, 
weld::Button&, rBtn, void)
 }
 }
 
-SwTOXSelectTabPage::SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& 
rAttrSet)
-: SfxTabPage(pParent, "TocIndexPage",
-"modules/swriter/ui/tocindexpage.ui", )
+SwTOXSelectTabPage::SwTOXSelectTabPage(TabPageParent pParent, const 
SfxItemSet& rAttrSet)
+: SfxTabPage(pParent, "modules/swriter/ui/tocindexpage.ui", 
"TocIndexPage", )
 , sAutoMarkType(SwResId(STR_AUTOMARK_TYPE))
 , m_bWaitingInitialSettings(true)
-{
-get(m_pTitleED, "title");
-get(m_pTypeFT, "typeft");
-get(m_pTypeLB, "type");
-get(m_pReadOnlyCB, "readonly");
-
-get(m_pAreaFrame, "areaframe");
-get(m_pAreaLB, "scope");
-get(m_pLevelFT, "levelft");
-get(m_pLevelNF, "level");
-
-get(m_pCreateFrame, "createframe");
-get(m_pFromHeadingsCB, "fromheadings");
-get(m_pAddStylesCB, "addstylescb");
-sAddStyleUser = get("stylescb")->GetText();
-get(m_pAddStylesPB, "styles");
-get(m_pFromTablesCB, "fromtables");
-get(m_pFromFramesCB, "fromframes");
-get(m_pFromGraphicsCB, "fromgraphics");
-get(m_pFromOLECB, "fromoles");
-get(m_pLevelFromChapterCB, "uselevel");
-
-get(m_pFromCaptionsRB, "captions");
-get(m_pFromObjectNamesRB, "objnames");
-
-get(m_pCaptionSequenceFT, "categoryft");
-get(m_pCaptionSequenceLB, "category");
-get(m_pDisplayTypeFT, "displayft");
-get(m_pDisplayTypeLB, "display");
-get(m_pTOXMarksCB, "indexmarks");
-
-get(m_pIdxOptionsFrame, "optionsframe");
-get(m_pCollectSameCB, "combinesame");
-get(m_pUseFFCB, "useff");
-get(m_pUseDashCB, "usedash");
-get(m_pCaseSensitiveCB, "casesens");
-get(m_pInitialCapsCB, "initcaps");
-get(m_pKeyAsEntryCB, "keyasentry");
-get(m_pFromFileCB, "fromfile");
-get(m_pAutoMarkPB, "file");
-
-get(m_pFromObjFrame, "objectframe");
-get(m_pFromObjCLB, "objects");
-
-get(m_pAuthorityFrame, "authframe");
-get(m_pSequenceCB, "numberentries");
-get(m_pBracketLB, "brackets");
-
-get(m_pSortFrame, "sortframe");
-get(m_pLanguageLB, "lang");
-get(m_pSortAlgorithmLB, "keytype");
-
+, m_xTitleED(m_xBuilder->weld_entry("title"))
+, m_xTypeFT(m_xBuilder->weld_label("typeft"))
+, m_xTypeLB(m_xBuilder->weld_combo_box("type"))
+, m_xReadOnlyCB(m_xBuilder->weld_check_button("readonly"))
+, m_xAreaFrame(m_xBuilder->weld_widget("areaframe"))
+, m_xAreaLB(m_xBuilder->weld_combo_box("scope"))
+, m_xLevelFT(m_xBuilder->weld_label("levelft"))
+, 

[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2018-12-12 Thread Libreoffice Gerrit user
 include/vcl/svlbitm.hxx  |3 
 include/vcl/weld.hxx |   15 +
 sw/source/ui/index/cnttab.cxx|  340 +++
 sw/uiconfig/swriter/ui/assignstylesdialog.ui |  251 ++-
 vcl/source/app/salvtables.cxx|   75 +++--
 vcl/source/treelist/svlbitm.cxx  |   15 -
 vcl/unx/gtk3/gtk3gtkinst.cxx |   21 +
 7 files changed, 478 insertions(+), 242 deletions(-)

New commits:
commit 6236051a3496278fe2768b40ebf1f4e82a44bb44
Author: Caolán McNamara 
AuthorDate: Mon Dec 10 11:32:51 2018 +
Commit: Caolán McNamara 
CommitDate: Wed Dec 12 13:01:28 2018 +0100

weld SwAddStylesDlg

Change-Id: I1dfdf0cea69585991bc0fa8dc38ebdf78abe97bf
Reviewed-on: https://gerrit.libreoffice.org/64976
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/svlbitm.hxx b/include/vcl/svlbitm.hxx
index 854c4666d50e..cd8001614195 100644
--- a/include/vcl/svlbitm.hxx
+++ b/include/vcl/svlbitm.hxx
@@ -84,10 +84,11 @@ public:
 // as buttons are not derived from LinkHdl
 voidCallLink();
 
-voidStoreButtonState( SvTreeListEntry* pEntry );
+voidStoreButtonState(SvTreeListEntry* pActEntry, 
SvLBoxButton* pActBox);
 static SvButtonStateConvertToButtonState( SvItemStateFlags nItemFlags 
);
 
 SvTreeListEntry*GetActEntry() const;
+SvLBoxButton*   GetActBox() const;
 
 voidSetImage(SvBmp nIndex, const Image& aImage) { 
aBmps[static_cast(nIndex)] = aImage; }
 Image&  GetImage(SvBmp nIndex) { return 
aBmps[static_cast(nIndex)]; }
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 028419f117ab..7edfba8b7496 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -403,12 +403,20 @@ class VCL_DLLPUBLIC TreeView : virtual public Container
 protected:
 Link m_aChangeHdl;
 Link m_aRowActivatedHdl;
+Link&, void> m_aRadioToggleHdl;
 // if handler returns false, the expansion of the row is refused
 Link m_aExpandingHdl;
 
+std::vector m_aRadioIndexes;
+
 void signal_changed() { m_aChangeHdl.Call(*this); }
 void signal_row_activated() { m_aRowActivatedHdl.Call(*this); }
 bool signal_expanding(TreeIter& rIter) { return 
m_aExpandingHdl.Call(rIter); }
+// arg is pair
+void signal_radio_toggled(const std::pair& rRowCol)
+{
+m_aRadioToggleHdl.Call(rRowCol);
+}
 
 public:
 virtual void insert(weld::TreeIter* pParent, int pos, const OUString* 
pStr, const OUString* pId,
@@ -451,6 +459,10 @@ public:
 
 void connect_changed(const Link& rLink) { m_aChangeHdl = 
rLink; }
 void connect_row_activated(const Link& rLink) { 
m_aRowActivatedHdl = rLink; }
+void connect_radio_toggled(const Link&, void>& 
rLink)
+{
+m_aRadioToggleHdl = rLink;
+}
 
 //by index
 virtual int get_selected_index() const = 0;
@@ -531,9 +543,12 @@ public:
 
 virtual void set_column_fixed_widths(const std::vector& rWidths) = 0;
 virtual OUString get_column_title(int nColumn) const = 0;
+virtual void set_column_title(int nColumn, const OUString& rTitle) = 0;
 
 virtual void set_selection_mode(SelectionMode eMode) = 0;
 virtual int count_selected_rows() const = 0;
+
+void set_toggle_columns_as_radio(const std::vector& rCols) { 
m_aRadioIndexes = rCols; }
 };
 
 class VCL_DLLPUBLIC Button : virtual public Container
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 6dac9f18b8c6..2790b5bc 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -512,249 +512,213 @@ bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, 
const OUString& rName)
 ! rSh.GetTextCollFromPool(nId)->IsAssignedToListLevelOfOutlineStyle();
 }
 
-class SwIndexTreeLB : public SvSimpleTable
+class SwAddStylesDlg_Impl : public SfxDialogController
 {
-public:
-explicit SwIndexTreeLB(SvSimpleTableContainer& rParent);
-virtual void KeyInput( const KeyEvent& rKEvt ) override;
-virtual void Resize() override;
-virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* ) override;
-void setColSizes();
-};
-
-SwIndexTreeLB::SwIndexTreeLB(SvSimpleTableContainer& rParent)
-: SvSimpleTable(rParent, 0)
-{
-HeaderBar& rStylesHB = GetTheHeaderBar();
-rStylesHB.SetStyle(rStylesHB.GetStyle()|WB_BUTTONSTYLE);
-SetStyle(GetStyle() & ~(WB_AUTOHSCROLL|WB_HSCROLL));
-}
-
-sal_IntPtr SwIndexTreeLB::GetTabPos( SvTreeListEntry* pEntry, SvLBoxTab* pTab)
-{
-sal_IntPtr nData = reinterpret_cast(pEntry->GetUserData());
-if(nData != USHRT_MAX)
-{
-HeaderBar& rStylesHB = GetTheHeaderBar();
-sal_IntPtr  nPos = rStylesHB.GetItemRect( static_cast< sal_uInt16 >(2 
+ nData) ).TopLeft().X();
-nData = nPos;
-}
-else
-nData = 0;

[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2018-10-25 Thread Libreoffice Gerrit user
 include/vcl/weld.hxx|1 
 sw/source/ui/index/cnttab.cxx   |  142 ++--
 sw/source/uibase/inc/swuicnttab.hxx |   33 +++
 sw/uiconfig/swriter/ui/tocstylespage.ui |   96 ++---
 vcl/source/app/salvtables.cxx   |5 +
 vcl/unx/gtk3/gtk3gtkinst.cxx|   55 
 6 files changed, 191 insertions(+), 141 deletions(-)

New commits:
commit ce155a8943bdd8cfa8e32e38fc83160df25beee1
Author: Caolán McNamara 
AuthorDate: Thu Oct 25 10:02:34 2018 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 25 13:23:20 2018 +0200

weld SwTOXStylesTabPage

Change-Id: I1e7056ef8293ddc7072e95ee248e45b2785d1234
Reviewed-on: https://gerrit.libreoffice.org/62347
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ebf796a55cdd..7fcd7b884a52 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -429,6 +429,7 @@ public:
 void unselect_all() { select(-1); }
 
 virtual int n_children() const = 0;
+virtual void make_sorted() = 0;
 virtual void clear() = 0;
 virtual int get_height_rows(int nRows) const = 0;
 
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index ca883f1876bd..6764592ad64b 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3609,44 +3609,31 @@ sal_uInt32 SwTokenWindow::GetControlIndex(FormTokenType 
eType) const
 return nIndex;
 }
 
-SwTOXStylesTabPage::SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& 
rAttrSet )
-: SfxTabPage(pParent, "TocStylesPage",
-"modules/swriter/ui/tocstylespage.ui", )
-{
-get(m_pLevelLB, "levels");
-get(m_pAssignBT, "assign");
-get(m_pParaLayLB, "styles");
-m_pParaLayLB->SetStyle(m_pParaLayLB->GetStyle() | WB_SORT);
-get(m_pStdBT, "default");
-get(m_pEditStyleBT, "edit");
-long nHeight = m_pLevelLB->GetTextHeight() * 16;
-m_pLevelLB->set_height_request(nHeight);
-m_pParaLayLB->set_height_request(nHeight);
+SwTOXStylesTabPage::SwTOXStylesTabPage(TabPageParent pParent, const 
SfxItemSet& rAttrSet)
+: SfxTabPage(pParent, "modules/swriter/ui/tocstylespage.ui", 
"TocStylesPage", )
+, m_xLevelLB(m_xBuilder->weld_tree_view("levels"))
+, m_xAssignBT(m_xBuilder->weld_button("assign"))
+, m_xParaLayLB(m_xBuilder->weld_tree_view("styles"))
+, m_xStdBT(m_xBuilder->weld_button("default"))
+, m_xEditStyleBT(m_xBuilder->weld_button("edit"))
+{
+m_xParaLayLB->make_sorted();
+auto nHeight = m_xLevelLB->get_height_rows(16);
+m_xLevelLB->set_size_request(-1, nHeight);
+m_xParaLayLB->set_size_request(-1, nHeight);
 
 SetExchangeSupport();
 
-m_pEditStyleBT->SetClickHdl   (LINK(   this, SwTOXStylesTabPage, 
EditStyleHdl));
-m_pAssignBT->SetClickHdl  (LINK(   this, SwTOXStylesTabPage, 
AssignHdl));
-m_pStdBT->SetClickHdl (LINK(   this, SwTOXStylesTabPage, StdHdl));
-m_pParaLayLB->SetSelectHdl(LINK(   this, SwTOXStylesTabPage, 
EnableSelectHdl));
-m_pLevelLB->SetSelectHdl(LINK(this, SwTOXStylesTabPage, EnableSelectHdl));
-m_pParaLayLB->SetDoubleClickHdl(LINK(  this, SwTOXStylesTabPage, 
DoubleClickHdl));
+m_xEditStyleBT->connect_clicked(LINK(this, SwTOXStylesTabPage, 
EditStyleHdl));
+m_xAssignBT->connect_clicked(LINK(this, SwTOXStylesTabPage, AssignHdl));
+m_xStdBT->connect_clicked(LINK(this, SwTOXStylesTabPage, StdHdl));
+m_xParaLayLB->connect_changed(LINK(this, SwTOXStylesTabPage, 
EnableSelectHdl));
+m_xLevelLB->connect_changed(LINK(this, SwTOXStylesTabPage, 
EnableSelectHdl));
+m_xParaLayLB->connect_row_activated(LINK(this, SwTOXStylesTabPage, 
DoubleClickHdl));
 }
 
 SwTOXStylesTabPage::~SwTOXStylesTabPage()
 {
-disposeOnce();
-}
-
-void SwTOXStylesTabPage::dispose()
-{
-m_pCurrentForm.reset();
-m_pLevelLB.clear();
-m_pAssignBT.clear();
-m_pParaLayLB.clear();
-m_pStdBT.clear();
-m_pEditStyleBT.clear();
-SfxTabPage::dispose();
 }
 
 bool SwTOXStylesTabPage::FillItemSet( SfxItemSet* )
@@ -3662,15 +3649,14 @@ void SwTOXStylesTabPage::Reset( const SfxItemSet* rSet )
 void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
 {
 m_pCurrentForm.reset(new SwForm(GetForm()));
-m_pParaLayLB->Clear();
-m_pLevelLB->Clear();
 
 // not hyperlink for user directories
-
 const sal_uInt16 nSize = m_pCurrentForm->GetFormMax();
 
 // display form pattern without title
 
+m_xLevelLB->freeze();
+m_xLevelLB->clear();
 // display 1st TemplateEntry
 OUString aStr( SwResId( STR_TITLE ));
 if( !m_pCurrentForm->GetTemplate( 0 ).isEmpty() )
@@ -3679,7 +3665,7 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
   + m_pCurrentForm->GetTemplate( 0 )
   + OUStringLiteral1(aDeliEnd);
 }
-m_pLevelLB->InsertEntry(aStr);
+

[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2018-10-10 Thread Libreoffice Gerrit user
 include/vcl/weld.hxx  |1 
 sw/source/ui/table/tabledlg.cxx   |   43 +
 sw/source/uibase/inc/prcntfld.hxx |1 
 sw/source/uibase/table/tablepg.hxx|1 
 sw/uiconfig/swriter/ui/tablecolumnpage.ui |   44 +++---
 vcl/source/app/salvtables.cxx |5 +++
 vcl/unx/gtk3/gtk3gtkinst.cxx  |6 
 7 files changed, 69 insertions(+), 32 deletions(-)

New commits:
commit 853b84c307191c2d6fd0ac697328abb9ac8ef22a
Author: Caolán McNamara 
AuthorDate: Tue Oct 9 16:38:41 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 10 15:37:09 2018 +0200

tdf#120420 only show as much column widgets as don't distort the page width

Change-Id: Ibde6f2bcb4fed1261ebd7efa45904600855a20ef
Reviewed-on: https://gerrit.libreoffice.org/61596
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e49e3689f56d..86ecdfe01032 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -75,6 +75,7 @@ public:
 
 virtual void set_grid_left_attach(int nAttach) = 0;
 virtual int get_grid_left_attach() const = 0;
+virtual void set_grid_width(int nCols) = 0;
 virtual void set_grid_top_attach(int nAttach) = 0;
 virtual int get_grid_top_attach() const = 0;
 
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 8e61980b1dff..13423f5899ba 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -702,6 +702,7 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, 
const SfxItemSet& rS
 , pTableData(nullptr)
 , nTableWidth(0)
 , nMinWidth(MINLAY)
+, nMetFields(MET_FIELDS)
 , nNoOfCols(0)
 , nNoOfVisibleCols(0)
 , bModified(false)
@@ -728,6 +729,24 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent 
pParent, const SfxItemSet& rS
 {
 SetExchangeSupport();
 
+//tdf#120420 keeping showing column width fields unless
+//the dialog begins to grow, then stop adding them
+weld::Window* pTopLevel = pParent.GetFrameWeld();
+Size aOrigSize = pTopLevel->get_preferred_size();
+for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
+{
+m_aFieldArr[i].show();
+m_aTextArr[i]->show();
+
+if (pTopLevel->get_preferred_size().Width() > aOrigSize.Width())
+{
+nMetFields = i + 1;
+m_aTextArr[i]->set_grid_width(1);
+m_xUpBtn->set_grid_left_attach(nMetFields * 2 - 1);
+break;
+}
+}
+
 const SfxPoolItem* pItem;
 Init(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false, )
  && static_cast(pItem)->GetValue() & 
HTMLMODE_ON);
@@ -763,7 +782,7 @@ void  SwTableColumnPage::Reset( const SfxItemSet* )
 }
 sal_Int64 nMinTwips = m_aFieldArr[0].NormalizePercent( nMinWidth );
 sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( nTableWidth );
-for( sal_uInt16 i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ 
)
+for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ 
)
 {
 m_aFieldArr[i].SetPrcntValue( m_aFieldArr[i].NormalizePercent(
 GetVisibleWidth(i) ), 
FUNIT_TWIP );
@@ -773,10 +792,12 @@ void  SwTableColumnPage::Reset( const SfxItemSet* )
 m_aTextArr[i]->set_sensitive(true);
 }
 
-if( nNoOfVisibleCols > MET_FIELDS )
+if (nNoOfVisibleCols > nMetFields)
+{
 m_xUpBtn->set_sensitive(true);
+}
 
-for( sal_uInt16 i = nNoOfVisibleCols; i < MET_FIELDS; ++i )
+for( sal_uInt16 i = nNoOfVisibleCols; i < nMetFields; ++i )
 {
 m_aFieldArr[i].set_text(OUString());
 m_aTextArr[i]->set_sensitive(false);
@@ -790,7 +811,7 @@ void  SwTableColumnPage::Init(bool bWeb)
 {
 FieldUnit aMetric = ::GetDfltMetric(bWeb);
 Link aLk = LINK(this, SwTableColumnPage, 
ValueChangedHdl);
-for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
+for (sal_uInt16 i = 0; i < nMetFields; ++i)
 {
 aValueTable[i] = i;
 m_aFieldArr[i].SetMetric(aMetric);
@@ -820,13 +841,13 @@ IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, 
rControl, void)
 }
 if ( == m_xUpBtn.get())
 {
-if( aValueTable[ MET_FIELDS -1 ] < nNoOfVisibleCols -1  )
+if( aValueTable[ nMetFields -1 ] < nNoOfVisibleCols -1  )
 {
 for(sal_uInt16 & rn : aValueTable)
 rn += 1;
 }
 }
-for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
+for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < nMetFields); i++ )
 {
 OUString sEntry('~');
 OUString sIndex = OUString::number( aValueTable[i] + 1 );
@@ -835,7 +856,7 @@ IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, 

[Libreoffice-commits] core.git: include/vcl sw/source sw/uiconfig vcl/source vcl/unx

2018-05-04 Thread Caolán McNamara
 include/vcl/weld.hxx  |5 
 sw/source/ui/misc/num.cxx |  453 ++
 sw/source/uibase/inc/num.hxx  |   92 ++---
 sw/uiconfig/swriter/ui/outlinepositionpage.ui |  128 +++
 vcl/source/app/salvtables.cxx |   12 
 vcl/unx/gtk3/gtk3gtkinst.cxx  |   17 
 6 files changed, 336 insertions(+), 371 deletions(-)

New commits:
commit 2cab4acbe2aaaee6e5b9afeb68f3e555ecff2ec7
Author: Caolán McNamara 
Date:   Fri May 4 12:24:24 2018 +0100

weld SwNumPositionTabPage

Change-Id: I12171eb00d5b8354456b629d58d20b22109e24f8
Reviewed-on: https://gerrit.libreoffice.org/53845
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 9e58e585a533..6c1078a04457 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -309,6 +309,7 @@ public:
 //by index
 virtual int get_selected_index() const = 0;
 virtual void select(int pos) = 0;
+virtual void unselect(int pos) = 0;
 virtual void remove(int pos) = 0;
 virtual void set_top_entry(int pos) = 0;
 virtual std::vector get_selected_rows() const = 0;
@@ -334,6 +335,10 @@ public:
 virtual int find_id(const OUString& rId) const = 0;
 OUString get_selected_id() const { return get_id(get_selected_index()); }
 void select_id(const OUString& rId) { select(find_id(rId)); }
+
+//all of them
+void select_all() { unselect(-1); }
+void unselect_all() { select(-1); }
 };
 
 class VCL_DLLPUBLIC Button : virtual public Container
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 2f7bb7c41fcf..28b4ba9ca185 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -54,10 +54,8 @@ static bool bLastRelative = false;
 //dialog to this one, except with a different preview window impl.
 //TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be
 //merged
-SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent,
-   const SfxItemSet& rSet)
-: SfxTabPage(pParent, "OutlinePositionPage",
-"modules/swriter/ui/outlinepositionpage.ui", )
+SwNumPositionTabPage::SwNumPositionTabPage(TabPageParent pParent, const 
SfxItemSet& rSet)
+: SfxTabPage(pParent, "modules/swriter/ui/outlinepositionpage.ui", 
"OutlinePositionPage", )
 , pActNum(nullptr)
 , pSaveNum(nullptr)
 , pWrtSh(nullptr)
@@ -67,94 +65,73 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* 
pParent,
 , bPreset(false)
 , bInInintControl(false)
 , bLabelAlignmentPosAndSpaceModeActive(false)
+, m_xLevelLB(m_xBuilder->weld_tree_view("levellb"))
+, m_xPositionFrame(m_xBuilder->weld_widget("numberingframe"))
+, m_xDistBorderFT(m_xBuilder->weld_label("indent"))
+, m_xDistBorderMF(m_xBuilder->weld_metric_spin_button("indentmf", 
FUNIT_CM))
+, m_xRelativeCB(m_xBuilder->weld_check_button("relative"))
+, m_xIndentFT(m_xBuilder->weld_label("numberingwidth"))
+, m_xIndentMF(m_xBuilder->weld_metric_spin_button("numberingwidthmf", 
FUNIT_CM))
+, m_xDistNumFT(m_xBuilder->weld_label("numdist"))
+, m_xDistNumMF(m_xBuilder->weld_metric_spin_button("numdistmf", FUNIT_CM))
+, m_xAlignFT(m_xBuilder->weld_label("numalign"))
+, m_xAlignLB(m_xBuilder->weld_combo_box_text("numalignlb"))
+, m_xLabelFollowedByFT(m_xBuilder->weld_label("numfollowedby"))
+, m_xLabelFollowedByLB(m_xBuilder->weld_combo_box_text("numfollowedbylb"))
+, m_xListtabFT(m_xBuilder->weld_label("at"))
+, m_xListtabMF(m_xBuilder->weld_metric_spin_button("atmf", FUNIT_CM))
+, m_xAlign2FT(m_xBuilder->weld_label("num2align"))
+, m_xAlign2LB(m_xBuilder->weld_combo_box_text("num2alignlb"))
+, m_xAlignedAtFT(m_xBuilder->weld_label("alignedat"))
+, m_xAlignedAtMF(m_xBuilder->weld_metric_spin_button("alignedatmf", 
FUNIT_CM))
+, m_xIndentAtFT(m_xBuilder->weld_label("indentat"))
+, m_xIndentAtMF(m_xBuilder->weld_metric_spin_button("indentatmf", 
FUNIT_CM))
+, m_xStandardPB(m_xBuilder->weld_button("standard"))
+, m_xPreviewWIN(new 
SwNumberingPreview(m_xBuilder->weld_drawing_area("preview")))
 {
-get(m_pLevelLB, "levellb");
-m_pLevelLB->EnableMultiSelection(true);
-get(m_pPositionFrame, "numberingframe");
-get(m_pDistBorderFT, "indent");
-get(m_pDistBorderMF, "indentmf");
-get(m_pRelativeCB, "relative");
-get(m_pIndentFT, "numberingwidth");
-get(m_pIndentMF, "numberingwidthmf");
-get(m_pDistNumFT, "numdist");
-get(m_pDistNumMF, "numdistmf");
-get(m_pAlignFT, "numalign");
-get(m_pAlignLB, "numalignlb");
-
-get(m_pLabelFollowedByFT, "numfollowedby");
-get(m_pLabelFollowedByLB, "numfollowedbylb");
-get(m_pListtabFT, "at");
-get(m_pListtabMF, "atmf");
-get(m_pAlign2FT,