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

weld SwFrameDlg

and now can remove...

commit 5d84af7e
Date:   Tue Dec 4 22:43:46 2012 +0100

    fdo#57553: Picture dialog Macro tab page: lazily init

    ... because JVM startup is annoying, so delay it until really activating
    Macro tab.  This patch is sort of lame but with the change in
    bd2c14ec what can you do...

and description is revealed to be a text_view not an entry

Change-Id: Ibc92cf11870d4349ddc728ec17c846e4158e82ac
Reviewed-on: https://gerrit.libreoffice.org/63916
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 260002b1
......@@ -369,6 +369,7 @@ CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeVie
: m_xTreeView(std::move(xTreeView))
{
m_xTreeView->make_sorted();
m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 20, m_xTreeView->get_height_rows(9));
}
CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
......@@ -1271,6 +1272,7 @@ CuiConfigGroupListBox::CuiConfigGroupListBox(std::unique_ptr<weld::TreeView> xTr
{
m_xTreeView->connect_row_activated(LINK(this, CuiConfigGroupListBox, OpenCurrentHdl));
m_xTreeView->connect_expanding(LINK(this, CuiConfigGroupListBox, ExpandingHdl));
m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 20, m_xTreeView->get_height_rows(9));
}
IMPL_LINK_NOARG(CuiConfigGroupListBox, OpenCurrentHdl, weld::TreeView&, void)
......@@ -1541,8 +1543,8 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
m_xTreeView->insert(nullptr, -1, sStyle, &sId, nullptr, nullptr, nullptr, true);
}
m_xTreeView->scroll_to_row(0);
m_xTreeView->thaw();
m_xTreeView->scroll_to_row(0);
m_xTreeView->select(0);
}
......
......@@ -55,12 +55,10 @@ public:
Idle m_aFillGroupIdle;
bool m_bGotEvents;
bool m_bDummyActivated; ///< has this tab page already been activated
};
SfxMacroTabPage_Impl::SfxMacroTabPage_Impl()
: m_bGotEvents(false)
, m_bDummyActivated(false)
{
}
......@@ -189,13 +187,6 @@ void SfxMacroTabPage::LaunchFillGroup()
void SfxMacroTabPage::ActivatePage( const SfxItemSet& )
{
// fdo#57553 lazily init script providers, because it is annoying if done
// on dialog open (SfxTabDialog::Start_Impl activates all tab pages once!)
if (!mpImpl->m_bDummyActivated)
{
mpImpl->m_bDummyActivated = true;
return;
}
LaunchFillGroup();
}
......@@ -396,15 +387,15 @@ void SfxMacroTabPage::FillEvents()
namespace
{
VclPtr<SfxMacroTabPage> CreateSfxMacroTabPage( vcl::Window* pParent, const SfxItemSet& rAttrSet )
VclPtr<SfxMacroTabPage> CreateSfxMacroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet)
{
return VclPtr<SfxMacroTabPage>::Create( pParent, nullptr, rAttrSet );
}
}
VclPtr<SfxTabPage> SfxMacroTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet )
VclPtr<SfxTabPage> SfxMacroTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)
{
return CreateSfxMacroTabPage(pParent.pParent, *rAttrSet);
return CreateSfxMacroTabPage(pParent, *rAttrSet);
}
SfxMacroAssignDlg::SfxMacroAssignDlg(vcl::Window* pParent,
......
......@@ -14,6 +14,8 @@
</object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
......@@ -37,6 +39,7 @@
<property name="vexpand">True</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkFrame" id="macroframe">
<property name="visible">True</property>
......@@ -76,10 +79,16 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext5"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
......@@ -315,18 +324,4 @@
</packing>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="macroframe"/>
<widget name="groupframe"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup2">
<property name="mode">vertical</property>
<widgets>
<widget name="macros"/>
<widget name="libraries"/>
<widget name="assignments"/>
</widgets>
</object>
</interface>
......@@ -428,7 +428,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateFrameTabDialog(const OUString &rDialogType,
SfxViewFrame *pFrame, vcl::Window *pParent,
SfxViewFrame *pFrame, weld::Window *pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame = true,
const OString& sDefPage = OString()) = 0;
......
......@@ -991,13 +991,12 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateTableMergeDialog(w
}
VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateFrameTabDialog(const OUString &rDialogType,
SfxViewFrame *pFrame, vcl::Window *pParent,
SfxViewFrame *pFrame, weld::Window *pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame,
const OString& sDefPage )
{
VclPtr<SfxTabDialog> pDlg = VclPtr<SwFrameDlg>::Create(pFrame, pParent, rCoreSet, bNewFrame, rDialogType, false/*bFormat*/, sDefPage, nullptr);
return VclPtr<AbstractTabDialog_Impl>::Create(pDlg);
return VclPtr<AbstractTabController_Impl>::Create(o3tl::make_unique<SwFrameDlg>(pFrame, pParent, rCoreSet, bNewFrame, rDialogType, false/*bFormat*/, sDefPage, nullptr));
}
VclPtr<SfxAbstractApplyTabDialog> SwAbstractDialogFactory_Impl::CreateTemplateDialog(
......
......@@ -673,7 +673,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) override;
virtual VclPtr<SfxAbstractTabDialog> CreateFrameTabDialog( const OUString &rDialogType,
SfxViewFrame *pFrame, vcl::Window *pParent,
SfxViewFrame *pFrame, weld::Window *pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame = true,
const OString& sDefPage = OString()) override;
......
......@@ -44,46 +44,36 @@
#include <svx/xflgrit.hxx>
// the dialog's carrier
SwFrameDlg::SwFrameDlg( SfxViewFrame const * pViewFrame,
vcl::Window* pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame,
const OUString& sResType,
bool bFormat,
const OString& sDefPage,
const OUString* pStr)
: SfxTabDialog(pParent, sResType,
"modules/swriter/ui/" + sResType.toAsciiLowerCase() + ".ui",
&rCoreSet, pStr != nullptr)
SwFrameDlg::SwFrameDlg(SfxViewFrame const * pViewFrame,
weld::Window* pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame,
const OUString& sResType,
bool bFormat,
const OString& sDefPage,
const OUString* pStr)
: SfxTabDialogController(pParent, "modules/swriter/ui/" + sResType.toAsciiLowerCase() + ".ui",
sResType.toUtf8(), &rCoreSet, pStr != nullptr)
, m_bFormat(bFormat)
, m_bNew(bNewFrame)
, m_rSet(rCoreSet)
, m_sDlgType(sResType)
, m_pWrtShell(static_cast<SwView*>(pViewFrame->GetViewShell())->GetWrtShellPtr())
, m_nStdId(0)
, m_nAddId(0)
, m_nWrapId(0)
, m_nColumnId(0)
//, m_nBackgroundId(0)
, m_nAreaId(0)
, m_nTransparenceId(0)
, m_nMacroId(0)
, m_nBorderId(0)
{
sal_uInt16 nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell());
bool bHTMLMode = (nHtmlMode & HTMLMODE_ON) != 0;
// example font for both example TabPages
if(pStr)
if (pStr)
{
SetText(GetText() + SwResId(STR_FRMUI_COLL_HEADER) + *pStr + ")");
m_xDialog->set_title(m_xDialog->get_title() + SwResId(STR_FRMUI_COLL_HEADER) + *pStr + ")");
}
m_nStdId = AddTabPage("type", SwFramePage::Create, nullptr);
m_nAddId = AddTabPage("options", SwFrameAddPage::Create, nullptr);
m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create, nullptr);
AddTabPage("type", SwFramePage::Create, nullptr);
AddTabPage("options", SwFrameAddPage::Create, nullptr);
AddTabPage("wrap", SwWrapTabPage::Create, nullptr);
AddTabPage("hyperlink", SwFrameURLPage::Create, nullptr);
if (m_sDlgType == "PictureDialog")
{
......@@ -92,19 +82,16 @@ SwFrameDlg::SwFrameDlg( SfxViewFrame const * pViewFrame,
}
if (m_sDlgType == "FrameDialog")
{
m_nColumnId = AddTabPage("columns", SwColumnPage::Create, nullptr);
AddTabPage("columns", SwColumnPage::Create, nullptr);
}
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
// remove?
// m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0);
// add Area and Transparence TabPages
m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
m_nMacroId = AddTabPage("macro", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr);
AddTabPage("macro", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), nullptr);
AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr);
if(bHTMLMode)
{
......@@ -136,29 +123,29 @@ SwFrameDlg::~SwFrameDlg()
{
}
void SwFrameDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
void SwFrameDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if (nId == m_nStdId)
if (rId == "type")
{
static_cast<SwFramePage&>(rPage).SetNewFrame(m_bNew);
static_cast<SwFramePage&>(rPage).SetFormatUsed(m_bFormat);
static_cast<SwFramePage&>(rPage).SetFrameType(m_sDlgType);
}
else if (nId == m_nAddId)
else if (rId == "options")
{
static_cast<SwFrameAddPage&>(rPage).SetFormatUsed(m_bFormat);
static_cast<SwFrameAddPage&>(rPage).SetFrameType(m_sDlgType);
static_cast<SwFrameAddPage&>(rPage).SetNewFrame(m_bNew);
static_cast<SwFrameAddPage&>(rPage).SetShell(m_pWrtShell);
}
else if (nId == m_nWrapId)
else if (rId == "wrap")
{
static_cast<SwWrapTabPage&>(rPage).SetNewFrame(m_bNew);
static_cast<SwWrapTabPage&>(rPage).SetFormatUsed(m_bFormat, false);
static_cast<SwWrapTabPage&>(rPage).SetShell(m_pWrtShell);
}
else if (nId == m_nColumnId)
else if (rId == "columns")
{
static_cast<SwColumnPage&>(rPage).SetFrameMode(true);
static_cast<SwColumnPage&>(rPage).SetFormatUsed(m_bFormat);
......@@ -166,7 +153,7 @@ void SwFrameDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
const SwFormatFrameSize& rSize = m_rSet.Get( RES_FRM_SIZE );
static_cast<SwColumnPage&>(rPage).SetPageWidth( rSize.GetWidth() );
}
else if (nId == m_nMacroId)
else if (rId == "macro")
{
SfxAllItemSet aNewSet(*aSet.GetPool());
aNewSet.Put( SwMacroAssignDlg::AddEvents(
......@@ -175,7 +162,7 @@ void SwFrameDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
rPage.PageCreated(aNewSet);
}
else if (nId == m_nBorderId)
else if (rId == "borders")
{
aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,static_cast<sal_uInt16>(SwBorderModes::FRAME)));
rPage.PageCreated(aSet);
......@@ -186,7 +173,7 @@ void SwFrameDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
// these pages find the needed attributes for fill style suggestions.
// These are set in preparation to trigger this dialog (FN_FORMAT_FRAME_DLG and
// FN_DRAW_WRAP_DLG), but could also be directly added from the DrawModel.
else if (nId == m_nAreaId)
else if (rId == "area")
{
SfxItemSet aNew(*GetInputSetImpl()->GetPool(),
svl::Items<SID_COLOR_TABLE, SID_PATTERN_LIST,
......@@ -199,7 +186,7 @@ void SwFrameDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
rPage.PageCreated(aNew);
}
else if (nId == m_nTransparenceId)
else if (rId == "transparence")
{
rPage.PageCreated(m_rSet);
}
......
......@@ -834,7 +834,7 @@ void SwFramePage::EnableGraficMode()
SwWrtShell *SwFramePage::getFrameDlgParentShell()
{
return static_cast<SwFrameDlg*>(GetParentDialog())->GetWrtShell();
return static_cast<SwFrameDlg*>(GetDialogController())->GetWrtShell();
}
void SwFramePage::Reset( const SfxItemSet *rSet )
......@@ -2785,7 +2785,7 @@ SwFrameAddPage::SwFrameAddPage(TabPageParent pParent, const SfxItemSet &rSet)
, m_xAltNameFT(m_xBuilder->weld_label("altname_label"))
, m_xAltNameED(m_xBuilder->weld_entry("altname"))
, m_xDescriptionFT(m_xBuilder->weld_label("description_label"))
, m_xDescriptionED(m_xBuilder->weld_entry("description"))
, m_xDescriptionED(m_xBuilder->weld_text_view("description"))
, m_xPrevFT(m_xBuilder->weld_label("prev_label"))
, m_xPrevLB(m_xBuilder->weld_combo_box("prev"))
, m_xNextFT(m_xBuilder->weld_label("next_label"))
......
......@@ -22,10 +22,11 @@
#include <globals.hrc>
#include <sfx2/tabdlg.hxx>
class SwWrtShell;
// frame dialog
class SwFrameDlg : public SfxTabDialog
class SwFrameDlg : public SfxTabDialogController
{
bool const m_bFormat;
bool const m_bNew;
......@@ -33,26 +34,16 @@ class SwFrameDlg : public SfxTabDialog
OUString const m_sDlgType;
SwWrtShell* m_pWrtShell;
sal_uInt16 m_nStdId;
sal_uInt16 m_nAddId;
sal_uInt16 m_nWrapId;
sal_uInt16 m_nColumnId;
//sal_uInt16 m_nBackgroundId;
sal_uInt16 m_nAreaId;
sal_uInt16 m_nTransparenceId;
sal_uInt16 m_nMacroId;
sal_uInt16 m_nBorderId;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
public:
SwFrameDlg( SfxViewFrame const *pFrame, vcl::Window *pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame,
const OUString& sResType,
bool bFormat,
const OString& sDefPage = OString(),
const OUString* pFormatStr = nullptr);
SwFrameDlg(SfxViewFrame const *pFrame, weld::Window* pParent,
const SfxItemSet& rCoreSet,
bool bNewFrame,
const OUString& sResType,
bool bFormat,
const OString& sDefPage = OString(),
const OUString* pFormatStr = nullptr);
virtual ~SwFrameDlg() override;
......
......@@ -294,7 +294,7 @@ class SwFrameAddPage : public SfxTabPage
std::unique_ptr<weld::Label> m_xAltNameFT;
std::unique_ptr<weld::Entry> m_xAltNameED;
std::unique_ptr<weld::Label> m_xDescriptionFT;
std::unique_ptr<weld::Entry> m_xDescriptionED;
std::unique_ptr<weld::TextView> m_xDescriptionED;
std::unique_ptr<weld::Label> m_xPrevFT;
std::unique_ptr<weld::ComboBox> m_xPrevLB;
std::unique_ptr<weld::Label> m_xNextFT;
......
......@@ -480,7 +480,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
nSel & SelectionType::Ole ? OUString("ObjectDialog"):
OUString("FrameDialog"),
GetView().GetViewFrame(),
GetView().GetWindow(),
GetView().GetFrameWeld(),
aSet,
false,
sDefPage));
......
......@@ -412,7 +412,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateFrameTabDialog("PictureDialog",
GetView().GetViewFrame(),
GetView().GetWindow(),
GetView().GetFrameWeld(),
aSet, false));
if (nSlot == FN_DRAW_WRAP_DLG)
pDlg->SetCurPageId("wrap");
......
......@@ -474,7 +474,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateFrameTabDialog("FrameDialog",
GetView().GetViewFrame(),
&GetView().GetViewFrame()->GetWindow(),
GetView().GetFrameWeld(),
aSet));
if(pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet())
{
......
......@@ -12,6 +12,9 @@
<object class="GtkBox" id="FrameAddPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
......@@ -41,7 +44,7 @@
<object class="GtkEntry" id="name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">50</property>
</object>
......@@ -54,7 +57,7 @@
<object class="GtkEntry" id="altname">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">50</property>
</object>
......@@ -165,11 +168,13 @@
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="description">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="wrap_mode">word</property>
<property name="buffer">textbuffer1</property>
</object>
......
......@@ -2,7 +2,6 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">0.050000000000000003</property>
<property name="upper">99.989999999999995</property>
......@@ -30,6 +29,7 @@
<object class="GtkGrid" id="FrameTypePage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="border_width">6</property>
<property name="row_spacing">18</property>
......
......@@ -5,6 +5,8 @@
<object class="GtkBox" id="FrameURLPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
......
......@@ -1918,6 +1918,7 @@ public:
virtual void scroll_to_row(int pos) override
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
m_xTreeView->MakeVisible(pEntry);
......@@ -2109,6 +2110,7 @@ public:
virtual void scroll_to_row(const weld::TreeIter& rIter) override
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
m_xTreeView->MakeVisible(rVclIter.iter);
......
......@@ -4058,13 +4058,19 @@ namespace
comphelper::string::NaturalStringSorter* pSorter = static_cast<comphelper::string::NaturalStringSorter*>(data);
gchar* pName1;
gchar* pName2;
gtk_tree_model_get(pModel, a, 0, &pName1, -1);
gtk_tree_model_get(pModel, b, 0, &pName2, -1);
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(pModel);
gint sort_column_id(0);
GtkSortType order(GTK_SORT_ASCENDING);
gtk_tree_sortable_get_sort_column_id(pSortable, &sort_column_id, &order);
gtk_tree_model_get(pModel, a, sort_column_id, &pName1, -1);
gtk_tree_model_get(pModel, b, sort_column_id, &pName2, -1);
gint ret = pSorter->compare(OUString(pName1, strlen(pName1), RTL_TEXTENCODING_UTF8),
OUString(pName2, strlen(pName2), RTL_TEXTENCODING_UTF8));
g_free(pName1);
g_free(pName2);
return ret;
if (ret == 0)
return ret;
return order == GTK_SORT_ASCENDING ? ret : -ret;
}
}
......@@ -4359,8 +4365,8 @@ public:
::comphelper::getProcessComponentContext(),
Application::GetSettings().GetUILanguageTag().getLocale()));
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
gtk_tree_sortable_set_sort_func(pSortable, m_nTextCol, sort_func, m_xSorter.get(), nullptr);
gtk_tree_sortable_set_sort_column_id(pSortable, m_nTextCol, GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_func(pSortable, m_nTextCol, sort_func, m_xSorter.get(), nullptr);
}
virtual int n_children() const override
......@@ -4388,6 +4394,7 @@ public:
virtual void scroll_to_row(int pos) override
{
assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen");
disable_notify_events();
GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
......@@ -4583,6 +4590,7 @@ public:
virtual void scroll_to_row(const weld::TreeIter& rIter) override
{
assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen");
disable_notify_events();
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
......@@ -6080,8 +6088,8 @@ public:
::comphelper::getProcessComponentContext(),
Application::GetSettings().GetUILanguageTag().getLocale()));
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeModel);
gtk_tree_sortable_set_sort_func(pSortable, 0, sort_func, m_xSorter.get(), nullptr);
gtk_tree_sortable_set_sort_column_id(pSortable, 0, GTK_SORT_ASCENDING);
gtk_tree_sortable_set_sort_func(pSortable, 0, sort_func, m_xSorter.get(), nullptr);
}
virtual bool has_entry() const override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment