[Libreoffice-commits] core.git: 2 commits - cui/source cui/uiconfig include/vcl vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 4 08:54:39 UTC 2018
cui/source/inc/autocdlg.hxx | 9 +--
cui/source/tabpages/autocdlg.cxx | 94 +++++++++++++++++++------------------
cui/uiconfig/ui/acoroptionspage.ui | 58 ++++++++++++++++++++--
include/vcl/floatwin.hxx | 10 ---
vcl/source/window/floatwin.cxx | 8 +--
vcl/source/window/winproc.cxx | 14 ++---
6 files changed, 120 insertions(+), 73 deletions(-)
New commits:
commit a89e8c54e8aa95e7f59f204cc3396e2acbdd860a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Dec 3 21:13:14 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 4 09:54:24 2018 +0100
remove enum HitTest
since we only care about one of the values, we can just use a bool
Change-Id: Id4fd0c60cd7421861b2e605604b7d3ecbf8bf915
Reviewed-on: https://gerrit.libreoffice.org/64485
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index aa6c6c0b3130..10b45c8e5fb4 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -72,14 +72,6 @@ enum class FloatWinTitleType
NONE = 4,
};
-enum HitTest
-{
- HITTEST_OUTSIDE,
- HITTEST_WINDOW,
- HITTEST_RECT
-};
-
-
class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
{
class ImplData;
@@ -116,7 +108,7 @@ protected:
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
public:
- SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest );
+ SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, bool& rbHitTestInsideRect );
SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const vcl::Window* pWindow );
SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; }
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 91482016b557..e632f97696b3 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -507,9 +507,10 @@ tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co
return aFloatRect;
}
-FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest )
+FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, bool& rbHitTestInsideRect )
{
FloatingWindow* pWin = this;
+ rbHitTestInsideRect = false;
Point aAbsolute(FloatingWindow::ImplConvertToAbsPos(pReference, rPos));
@@ -524,7 +525,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const
tools::Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( tools::Rectangle( Point(), pBorderWin->GetSizePixel()) ) ) ;
if ( devRect.IsInside( aAbsolute ) )
{
- rHitTest = HITTEST_WINDOW;
+ // inside the window
return pWin;
}
@@ -534,7 +535,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const
// is already in absolute device coordinates
if ( pWin->maFloatRect.IsInside( aAbsolute ) )
{
- rHitTest = HITTEST_RECT;
+ rbHitTestInsideRect = true;
return pWin;
}
@@ -542,7 +543,6 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const
}
while ( pWin );
- rHitTest = HITTEST_OUTSIDE;
return nullptr;
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index add5c3b45957..a4cce43051c7 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -75,8 +75,8 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
* #93895# since floats are system windows, coordinates have
* to be converted to float relative for the hittest
*/
- HitTest nHitTest = HITTEST_OUTSIDE;
- FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, nHitTest );
+ bool bHitTestInsideRect = false;
+ FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, bHitTestInsideRect );
FloatingWindow* pLastLevelFloat;
FloatWinPopupFlags nPopupFlags;
if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
@@ -84,7 +84,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
if ( bMouseLeave )
return true;
- if ( !pFloat || (nHitTest == HITTEST_RECT) )
+ if ( !pFloat || bHitTestInsideRect )
{
if ( pSVData->maHelpData.mpHelpWin && !pSVData->maHelpData.mbKeyboardHelp )
ImplDestroyHelpWindow( true );
@@ -104,7 +104,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
pLastLevelFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
return true;
}
- else if ( nHitTest == HITTEST_RECT )
+ else if ( bHitTestInsideRect )
{
pFloat->ImplSetMouseDown();
return true;
@@ -114,7 +114,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
{
if ( pFloat )
{
- if ( nHitTest == HITTEST_RECT )
+ if ( bHitTestInsideRect )
{
if ( pFloat->ImplIsMouseDown() )
pFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel );
@@ -1348,8 +1348,8 @@ vcl::Window* HandleGestureEventBase::FindTarget()
if (m_pSVData->maWinData.mpFirstFloat && !m_pSVData->maWinData.mpCaptureWin &&
!m_pSVData->maWinData.mpFirstFloat->ImplIsFloatPopupModeWindow( m_pWindow ) )
{
- HitTest nHitTest = HITTEST_OUTSIDE;
- pMouseWindow = m_pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( m_pWindow, m_aMousePos, nHitTest );
+ bool bHitTestInsideRect = false;
+ pMouseWindow = m_pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( m_pWindow, m_aMousePos, bHitTestInsideRect );
if (!pMouseWindow)
pMouseWindow = m_pSVData->maWinData.mpFirstFloat;
}
commit bf1932fe2133e5954441be6299e6788c17e1d1b9
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 3 15:31:02 2018 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 4 09:54:13 2018 +0100
weld OfaAutocorrOptionsPage
Change-Id: I4bf626f61c0d1eb404f99bae4d1e3bf521e4878f
Reviewed-on: https://gerrit.libreoffice.org/64473
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 21ef480794ef..cc8b5383b7af 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -95,8 +95,6 @@ class OfaAutocorrOptionsPage : public SfxTabPage
using TabPage::ActivatePage;
private:
- VclPtr<SvxCheckListBox> m_pCheckLB;
-
OUString m_sInput;
OUString m_sDoubleCaps;
OUString m_sStartCap;
@@ -106,10 +104,13 @@ private:
OUString m_sDash;
OUString m_sAccidentalCaps;
+ std::unique_ptr<weld::TreeView> m_xCheckLB;
+
+ void InsertEntry(const OUString& rTxt);
+
public:
- OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ OfaAutocorrOptionsPage(TabPageParent pParent, const SfxItemSet& rSet);
virtual ~OfaAutocorrOptionsPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent pParent,
const SfxItemSet* rAttrSet);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 1af32103593a..fa8825bd3f5a 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -188,8 +188,8 @@ IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox&, rBox, void)
}
}
-OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage(pParent, "AutocorrectOptionsPage", "cui/ui/acoroptionspage.ui", &rSet)
+OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(TabPageParent pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "cui/ui/acoroptionspage.ui", "AutocorrectOptionsPage", &rSet)
, m_sInput(CuiResId(RID_SVXSTR_USE_REPLACE))
, m_sDoubleCaps(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
, m_sStartCap(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
@@ -198,8 +198,11 @@ OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxIt
, m_sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
, m_sDash(CuiResId(RID_SVXSTR_DASH))
, m_sAccidentalCaps(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
+ , m_xCheckLB(m_xBuilder->weld_tree_view("checklist"))
{
- get(m_pCheckLB, "checklist");
+ std::vector<int> aWidths;
+ aWidths.push_back(m_xCheckLB->get_approximate_digit_width() * 3 + 6);
+ m_xCheckLB->set_column_fixed_widths(aWidths);
}
OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
@@ -207,16 +210,10 @@ OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
disposeOnce();
}
-void OfaAutocorrOptionsPage::dispose()
-{
- m_pCheckLB.clear();
- SfxTabPage::dispose();
-}
-
-VclPtr<SfxTabPage> OfaAutocorrOptionsPage::Create( TabPageParent pParent,
- const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaAutocorrOptionsPage::Create(TabPageParent pParent,
+ const SfxItemSet* rSet)
{
- return VclPtr<OfaAutocorrOptionsPage>::Create(pParent.pParent, *rSet);
+ return VclPtr<OfaAutocorrOptionsPage>::Create(pParent, *rSet);
}
bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
@@ -224,15 +221,15 @@ bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
ACFlags nFlags = pAutoCorrect->GetFlags();
- sal_uLong nPos = 0;
- pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_pCheckLB->IsChecked(nPos++));
+ int nPos = 0;
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++));
bool bReturn = nFlags != pAutoCorrect->GetFlags();
if(bReturn )
@@ -249,34 +246,43 @@ void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& )
static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(false);
}
+void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt)
+{
+ m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
+ nullptr, nullptr, false);
+ const int nRow = m_xCheckLB->n_children() - 1;
+ m_xCheckLB->set_toggle(nRow, false, 0);
+ m_xCheckLB->set_text(nRow, rTxt, 1);
+}
+
void OfaAutocorrOptionsPage::Reset( const SfxItemSet* )
{
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const ACFlags nFlags = pAutoCorrect->GetFlags();
- m_pCheckLB->SetUpdateMode(false);
- m_pCheckLB->Clear();
-
- m_pCheckLB->InsertEntry(m_sInput);
- m_pCheckLB->InsertEntry(m_sDoubleCaps);
- m_pCheckLB->InsertEntry(m_sStartCap);
- m_pCheckLB->InsertEntry(m_sBoldUnderline);
- m_pCheckLB->InsertEntry(m_sURL);
- m_pCheckLB->InsertEntry(m_sDash);
- m_pCheckLB->InsertEntry(m_sNoDblSpaces);
- m_pCheckLB->InsertEntry(m_sAccidentalCaps);
-
- sal_uLong nPos = 0;
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::Autocorrect) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CapitalStartWord) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::SetINetAttr) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) );
-
- m_pCheckLB->SetUpdateMode(true);
+ m_xCheckLB->freeze();
+ m_xCheckLB->clear();
+
+ InsertEntry(m_sInput);
+ InsertEntry(m_sDoubleCaps);
+ InsertEntry(m_sStartCap);
+ InsertEntry(m_sBoldUnderline);
+ InsertEntry(m_sURL);
+ InsertEntry(m_sDash);
+ InsertEntry(m_sNoDblSpaces);
+ InsertEntry(m_sAccidentalCaps);
+
+ int nPos = 0;
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::Autocorrect) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartWord) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) );
+
+ m_xCheckLB->thaw();
}
/*********************************************************************/
diff --git a/cui/uiconfig/ui/acoroptionspage.ui b/cui/uiconfig/ui/acoroptionspage.ui
index c939941a02e3..f1da95498d94 100644
--- a/cui/uiconfig/ui/acoroptionspage.ui
+++ b/cui/uiconfig/ui/acoroptionspage.ui
@@ -1,7 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name check1 -->
+ <column type="gboolean"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkBox" id="AutocorrectOptionsPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10,13 +19,52 @@
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
- <object class="svxcorelo-SvxCheckListBox" id="checklist:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Check List Box-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="checklist">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="alignment">0.5</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer5"/>
+ <attributes>
+ <attribute name="active">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
More information about the Libreoffice-commits
mailing list