[Libreoffice-commits] core.git: 3 commits - include/svx sd/source svx/source
Caolán McNamara
caolanm at redhat.com
Wed Nov 11 02:54:23 PST 2015
include/svx/gridctrl.hxx | 4 -
sd/source/ui/inc/ViewShellBase.hxx | 1
svx/source/fmcomp/fmgridif.cxx | 2
svx/source/fmcomp/gridctrl.cxx | 82 ++++++++++++++++++++++++++++++++-----
4 files changed, 74 insertions(+), 15 deletions(-)
New commits:
commit 44daaebf835bb60fb7e442e928cd30191f15af52
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 11 10:43:45 2015 +0000
Resolves: tdf#95723 arrange GridControl buttons to be always visible
as long as there's space for them
Change-Id: Id96069b5c50483309611381afdf62bb0d30e9c38
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index b795a8e..5046f63 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -161,7 +161,6 @@ public:
VclPtr<ImageButton> m_aNextBtn; // ImageButton for 'go to the next record'
VclPtr<ImageButton> m_aLastBtn; // ImageButton for 'go to the last record'
VclPtr<ImageButton> m_aNewBtn; // ImageButton for 'go to a new record'
- sal_uInt16 m_nDefaultWidth;
sal_Int32 m_nCurrentPos;
bool m_bPositioning; // protect PositionDataSource against recursion
@@ -191,7 +190,7 @@ public:
void InvalidateState(sal_uInt16 nWhich) {SetState(nWhich);}
void SetState(sal_uInt16 nWhich);
bool GetState(sal_uInt16 nWhich) const;
- sal_uInt16 GetDefaultWidth() const {return m_nDefaultWidth;}
+ sal_uInt16 ArrangeControls();
protected:
virtual void Resize() override;
@@ -200,7 +199,6 @@ public:
private:
DECL_LINK_TYPED(OnClick, Button*, void);
- sal_uInt16 ArrangeControls();
void PositionDataSource(sal_Int32 nRecord);
};
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index aaba9fd..5348090 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -343,7 +343,6 @@ DbGridControl::NavigationBar::NavigationBar(vcl::Window* pParent, WinBits nStyle
,m_aNextBtn(VclPtr<ImageButton>::Create(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS))
,m_aLastBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS))
,m_aNewBtn(VclPtr<ImageButton>::Create(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS))
- ,m_nDefaultWidth(0)
,m_nCurrentPos(-1)
,m_bPositioning(false)
{
@@ -372,8 +371,6 @@ DbGridControl::NavigationBar::NavigationBar(vcl::Window* pParent, WinBits nStyle
m_aRecordOf->SetText(SVX_RESSTR(RID_STR_REC_FROM_TEXT));
m_aRecordCount->SetText(OUString('?'));
- m_nDefaultWidth = ArrangeControls();
-
m_aFirstBtn->Disable();
m_aPrevBtn->Disable();
m_aNextBtn->Disable();
@@ -437,8 +434,9 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
// positioning of the controls
// calculate base size
Rectangle aRect(static_cast<DbGridControl*>(GetParent())->GetControlArea());
- const long nH = aRect.GetSize().Height();
- Size aBorder = LogicToPixel(Size(2, 2),MAP_APPFONT);
+ long nH = aRect.GetSize().Height();
+ long nW = GetParent()->GetOutputSizePixel().Width();
+ Size aBorder = LogicToPixel(Size(2, 2),MAP_APPFONT);
aBorder = Size(CalcZoom(aBorder.Width()), CalcZoom(aBorder.Height()));
sal_uInt16 nX = 1;
sal_uInt16 nY = 0;
@@ -470,7 +468,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
OUString textPattern(hairSpace);
textPattern += sevenDigits;
textPattern += hairSpace;
- nTextWidth = m_aAbsolute->GetTextWidth( textPattern );
+ nTextWidth = m_aAbsolute->GetTextWidth(textPattern);
m_aAbsolute->SetPosPixel(Point(nX,nY));
m_aAbsolute->SetSizePixel(Size(nTextWidth, nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
@@ -482,7 +480,7 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
textPattern = sevenDigits + " * (" + sevenDigits + ")";
- nTextWidth = m_aRecordCount->GetTextWidth( textPattern );
+ nTextWidth = m_aRecordCount->GetTextWidth(textPattern);
m_aRecordCount->SetPosPixel(Point(nX,nY));
m_aRecordCount->SetSizePixel(Size(nTextWidth,nH));
nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
@@ -497,6 +495,68 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
nX = sal::static_int_cast< sal_uInt16 >(aButtonPos.X() + 1);
+ nW -= GetSettings().GetStyleSettings().GetScrollBarSize();
+
+ if (nX > nW)
+ {
+ aButtonPos.X() = nW-nH;
+ m_aNewBtn->SetPosPixel(aButtonPos);
+ aButtonPos.X() -= nH;
+ m_aLastBtn->SetPosPixel(aButtonPos);
+ aButtonPos.X() -= nH;
+ m_aNextBtn->SetPosPixel(aButtonPos);
+ aButtonPos.X() -= nH;
+ m_aPrevBtn->SetPosPixel(aButtonPos);
+ aButtonPos.X() -= nH;
+ m_aFirstBtn->SetPosPixel(aButtonPos);
+
+ auto nDiff = nX - nW;
+
+ Size aSize = m_aAbsolute->GetSizePixel();
+ aSize.Width() -= nDiff/3.0;
+ m_aAbsolute->SetSizePixel(aSize);
+
+ aSize = m_aRecordCount->GetSizePixel();
+ aSize.Width() -= nDiff/3.0*2;
+ m_aRecordCount->SetSizePixel(aSize);
+
+ Point aPos = m_aRecordOf->GetPosPixel();
+ aPos.X() -= nDiff/3.0;
+ m_aRecordOf->SetPosPixel(aPos);
+
+ aPos = m_aRecordCount->GetPosPixel();
+ aPos.X() -= nDiff/3.0;
+ m_aRecordCount->SetPosPixel(aPos);
+
+ vcl::Window* pWindows[] =
+ {
+ m_aRecordText.get(),
+ m_aAbsolute.get(),
+ m_aRecordOf.get(),
+ m_aRecordCount.get(),
+ m_aFirstBtn.get(),
+ m_aPrevBtn.get(),
+ m_aNextBtn.get(),
+ m_aLastBtn.get(),
+ m_aNewBtn.get()
+ };
+
+ for (size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i)
+ {
+ if (pWindows[i]->GetPosPixel().X() < 0)
+ pWindows[i]->SetSizePixel(Size(0, nH));
+ aSize = pWindows[i]->GetSizePixel();
+ auto nExcess = (pWindows[i]->GetPosPixel().X() + aSize.Width()) - nW;
+ if (nExcess > 0)
+ {
+ aSize.Width() -= nExcess;
+ pWindows[i]->SetSizePixel(aSize);
+ }
+ }
+
+ nX = nW;
+ }
+
return nX;
}
@@ -775,7 +835,7 @@ void DbGridControl::NavigationBar::StateChanged(StateChangedType nType)
SetZoomedPointFont(*this, aFont);
// rearrange the controls
- m_nDefaultWidth = ArrangeControls();
+ ArrangeControls();
}
break;
default:;
@@ -1150,9 +1210,9 @@ void DbGridControl::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
// positioning of the controls
if (m_bNavigationBar)
{
- nX = m_aBar->GetDefaultWidth();
- Rectangle aRect(GetControlArea());
- m_aBar->SetPosSizePixel(Point(0,nY + 1), Size(nX, aRect.GetSize().Height() - 1));
+ Rectangle aRect(GetControlArea());
+ m_aBar->SetPosSizePixel(Point(0, nY + 1), Size(aRect.GetSize().Width(), aRect.GetSize().Height() - 1));
+ nX = m_aBar->ArrangeControls();
}
}
commit a7816853bad55ada597092c16ba9a0a761e067d0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Nov 10 20:37:00 2015 +0000
Resolves: tdf#94069 call setVisible when setDesignMode is called
void UnoControl::setDesignMode calls setVisible on the XWindow
so it seems sensible that FmXGridPeer::setDesignMode should
also do so. The desirable side effect is that moving the window
in design mode then is moving a un-shown window so nothing
is invalidated so the paint loop doesn't happen.
Change-Id: Ic5a4ba62590372bec15a29b993b73d6dfb94a8a9
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 6136657..e91d2f3 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1693,6 +1693,8 @@ void FmXGridPeer::setDesignMode(sal_Bool bOn) throw( RuntimeException, std::exce
static_cast<FmGridControl*>(pWin)->SetDesignMode(bOn);
}
+ setVisible(!bOn);
+
if (bOn)
DisConnectFromDispatcher();
else
commit 14c2b509928b7c7a437464c10bd0f57ff307ad54
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Nov 10 12:22:40 2015 +0000
unused header
Change-Id: I422d8f50e6dfb0d2ad2fb2ec49639a5f822d014d
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index d0271d5..74c7e2e 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -27,7 +27,6 @@
#include "glob.hxx"
#include <sfx2/viewsh.hxx>
#include <sfx2/viewfac.hxx>
-#include <boost/scoped_ptr.hpp>
#include <memory>
class SdDrawDocument;
More information about the Libreoffice-commits
mailing list