[Libreoffice-commits] core.git: 4 commits - include/tools include/vcl jvmfwk/plugins sd/source svx/source vcl/inc vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Feb 15 11:53:45 UTC 2018
include/tools/gen.hxx | 8 ++
include/vcl/toolbox.hxx | 1
jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 64 +++++++++++-------
sd/source/ui/animations/CustomAnimationPane.cxx | 4 +
svx/source/tbxctrls/tbxcolorupdate.cxx | 82 +++---------------------
vcl/inc/toolbox.h | 1
vcl/source/window/toolbox.cxx | 3
vcl/source/window/toolbox2.cxx | 22 ++++++
8 files changed, 90 insertions(+), 95 deletions(-)
New commits:
commit dd4fc3b1e3f8a7c69a44c26715b2e3cdb22aede9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Feb 15 10:48:53 2018 +0200
introduce Move/Adjust methods to Point,Rect,Size
to make my following changes with the changetoolsgen plugin easier to
read
Change-Id: I514bbea00b8907cc94c4218ca6ab1473bd9efd61
Reviewed-on: https://gerrit.libreoffice.org/49793
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 87e1e54b3eed..0e5289b0765c 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -82,6 +82,8 @@ public:
long& Y() { return nB; }
void Move( long nHorzMove, long nVertMove );
+ void MoveX( long nHorzMove ) { nA += nHorzMove; }
+ void MoveY( long nVertMove ) { nB += nVertMove; }
void RotateAround( long& rX, long& rY, short nOrientation ) const;
@@ -191,6 +193,8 @@ public:
long& Width() { return nA; }
long& Height() { return nB; }
+ void AdjustWidth( long n ) { nA += n; }
+ void AdjustHeight( long n ) { nB += n; }
long getWidth() const { return Width(); }
long getHeight() const { return Height(); }
@@ -400,6 +404,10 @@ public:
/// Move the top and left edges by a delta, preserving width and height
inline void Move( long nHorzMoveDelta, long nVertMoveDelta );
+ void MoveLeft( long nHorzMoveDelta ) { nLeft += nHorzMoveDelta; }
+ void MoveRight( long nHorzMoveDelta ) { nRight += nHorzMoveDelta; }
+ void MoveTop( long nVertMoveDelta ) { nTop += nVertMoveDelta; }
+ void MoveBottom( long nVertMoveDelta ) { nBottom += nVertMoveDelta; }
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
inline Size GetSize() const;
commit cc8e8215c8d7583f36feca20f0a1235edc05a6d7
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Feb 15 08:31:49 2018 +0100
Find Java 9 with the new registry keys on Windows
See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-
4D12-AB10-49F82F720027> section "Windows Registry Key Changes".
Change-Id: Ic30ce430663cc1608c6268fa937142f73c55f138
Reviewed-on: https://gerrit.libreoffice.org/49792
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index fb6ec2ba6eb4..187a2789b4cc 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -569,31 +569,6 @@ bool decodeOutput(const OString& s, OUString* out)
#if defined(_WIN32)
-void addJavaInfoFromWinReg(
- std::vector<rtl::Reference<VendorBase> > & allInfos,
- std::vector<rtl::Reference<VendorBase> > & addedInfos)
-{
- // Get Java s from registry
- std::vector<OUString> vecJavaHome;
- if(getSDKInfoFromRegistry(vecJavaHome))
- {
- // create impl objects
- for (auto const& javaHome : vecJavaHome)
- {
- getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
- }
- }
-
- vecJavaHome.clear();
- if(getJREInfoFromRegistry(vecJavaHome))
- {
- for (auto const& javaHome : vecJavaHome)
- {
- getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
- }
- }
-}
-
bool getJavaInfoFromRegistry(const wchar_t* szRegKey,
vector<OUString>& vecJavaHome)
@@ -678,6 +653,45 @@ bool getJREInfoFromRegistry(vector<OUString>& vecJavaHome)
return getJavaInfoFromRegistry(HKEY_SUN_JRE, vecJavaHome);
}
+void addJavaInfoFromWinReg(
+ std::vector<rtl::Reference<VendorBase> > & allInfos,
+ std::vector<rtl::Reference<VendorBase> > & addedInfos)
+{
+ // Get Java s from registry
+ std::vector<OUString> vecJavaHome;
+ if(getSDKInfoFromRegistry(vecJavaHome))
+ {
+ // create impl objects
+ for (auto const& javaHome : vecJavaHome)
+ {
+ getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
+ }
+ }
+
+ vecJavaHome.clear();
+ if(getJREInfoFromRegistry(vecJavaHome))
+ {
+ for (auto const& javaHome : vecJavaHome)
+ {
+ getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
+ }
+ }
+
+ vecJavaHome.clear();
+ if (getJavaInfoFromRegistry(L"Software\\JavaSoft\\JDK", vecJavaHome)) {
+ for (auto const & javaHome: vecJavaHome) {
+ getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
+ }
+ }
+
+ vecJavaHome.clear();
+ if (getJavaInfoFromRegistry(L"Software\\JavaSoft\\JRE", vecJavaHome)) {
+ for (auto const & javaHome: vecJavaHome) {
+ getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
+ }
+ }
+}
+
#endif // WNT
void bubbleSortVersion(vector<rtl::Reference<VendorBase> >& vec)
commit bf10acd917dab972b461960720cd044527e22f16
Author: Jim Raykowski <raykowj at gmail.com>
Date: Tue Feb 13 12:30:56 2018 -0900
tdf#115691 restore focus to sidebar animation panel after automatic...
preview
Change-Id: If4af785a20ce0d36e2db4cefba80745e9f40dd35
Reviewed-on: https://gerrit.libreoffice.org/49744
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 8ebd2f1ee3e6..c0c5cf887d2c 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2116,6 +2116,8 @@ IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
if ( !pPreset && ( ePathKind == PathKind::NONE ) )
return;
+ VclPtr<vcl::Window> xSaveFocusId = Window::SaveFocus();
+
EffectSequence::iterator aIter( maListSelection.begin() );
const EffectSequence::iterator aEnd( maListSelection.end() );
@@ -2140,6 +2142,7 @@ IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
createPath( ePathKind, aTargets, 0.0 );
updateMotionPathTags();
+ Window::EndSaveFocus(xSaveFocusId);
return;
}
@@ -2160,6 +2163,7 @@ IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
}
onPreview(false);
+ Window::EndSaveFocus(xSaveFocusId);
}
}
commit 88ca1a6f75b1e94136e04e8dc65b98955d0e8aaf
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Feb 14 15:30:50 2018 +0200
move ToolboxButtonColorUpdater bitmap update to VirtualDevice
to avoid doing a read-modify-write cycle on the item images on the
toolbar, add an overlay image member to Toolbox items.
part of the process of making Bitmap an internal detail of vcl/
Change-Id: Ie4a886c48484a06694fc4c066ee0845b39d27f0b
Reviewed-on: https://gerrit.libreoffice.org/49649
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index eeab33c30104..700da27363fb 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -373,6 +373,7 @@ public:
void SetItemData( sal_uInt16 nItemId, void* pNewData );
void* GetItemData( sal_uInt16 nItemId ) const;
void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ void SetItemOverlayImage( sal_uInt16 nItemId, const Image& rImage );
Image GetItemImage( sal_uInt16 nItemId ) const;
void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 974834034de3..4b8048059a3f 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -23,7 +23,7 @@
#include <svx/xdef.hxx>
#include <vcl/toolbox.hxx>
-#include <vcl/bitmapaccess.hxx>
+#include <vcl/virdev.hxx>
#include <vcl/settings.hxx>
#include <tools/debug.hxx>
@@ -82,54 +82,21 @@ namespace svx
if ((maCurColor == aColor) && !bSizeChanged && !bDisplayModeChanged && !bForceUpdate)
return;
-
- // create an empty bitmap, and copy the original bitmap inside
- // (so that it grows in case the original bitmap was smaller)
- sal_uInt8 nAlpha = 255;
- BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
-
- BitmapEx aSource(aImage.GetBitmapEx());
- long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
- long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
-
- tools::Rectangle aRect(Point(0, 0), Size(nWidth, nHeight));
-
- aBmpEx.CopyPixel( aRect, aRect, &aSource );
-
- Bitmap aBmp( aBmpEx.GetBitmap() );
- BitmapWriteAccess* pBmpAcc = aBmp.IsEmpty() ? nullptr : aBmp.AcquireWriteAccess();
-
- maBmpSize = aBmp.GetSizePixel();
-
- if (!pBmpAcc)
+ if (!aItemSize.Width() || !aItemSize.Height())
return;
- Bitmap aMsk;
- BitmapWriteAccess* pMskAcc;
-
- if (aBmpEx.IsAlpha())
- {
- aMsk = aBmpEx.GetAlpha().GetBitmap();
- pMskAcc = aMsk.AcquireWriteAccess();
- }
- else if (aBmpEx.IsTransparent())
- {
- aMsk = aBmpEx.GetMask();
- pMskAcc = aMsk.AcquireWriteAccess();
- }
- else
- {
- pMskAcc = nullptr;
- }
+ ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create());
+ pVirDev->SetOutputSizePixel(aItemSize);
+ maBmpSize = aItemSize;
mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
if ((COL_TRANSPARENT != aColor.GetColor()) && (maBmpSize.Width() == maBmpSize.Height()))
- pBmpAcc->SetLineColor(aColor);
+ pVirDev->SetLineColor(aColor);
else if( mpTbx->GetBackground().GetColor().IsDark() )
- pBmpAcc->SetLineColor(Color(COL_WHITE));
+ pVirDev->SetLineColor(Color(COL_WHITE));
else
- pBmpAcc->SetLineColor(Color(COL_BLACK));
+ pVirDev->SetLineColor(Color(COL_BLACK));
// use not only COL_TRANSPARENT for detection of transparence,
// but the method/way which is designed to do that
@@ -138,11 +105,11 @@ namespace svx
if (bIsTransparent)
{
- pBmpAcc->SetFillColor();
+ pVirDev->SetFillColor(Color(255, 0, 0, 0));
}
else
{
- pBmpAcc->SetFillColor(maCurColor);
+ pVirDev->SetFillColor(maCurColor);
}
if (maBmpSize.Width() == maBmpSize.Height())
@@ -151,34 +118,9 @@ namespace svx
else
maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
- pBmpAcc->DrawRect(maUpdRect);
-
- if (pMskAcc)
- {
- if (bIsTransparent)
- {
- pMskAcc->SetLineColor(COL_BLACK);
- pMskAcc->SetFillColor(COL_WHITE);
- }
- else
- pMskAcc->SetFillColor(COL_BLACK);
-
- pMskAcc->DrawRect(maUpdRect);
- }
-
- Bitmap::ReleaseAccess(pBmpAcc);
-
- if (pMskAcc)
- Bitmap::ReleaseAccess(pMskAcc);
-
- if (aBmpEx.IsAlpha())
- aBmpEx = BitmapEx(aBmp, AlphaMask(aMsk));
- else if (aBmpEx.IsTransparent())
- aBmpEx = BitmapEx(aBmp, aMsk);
- else
- aBmpEx = aBmp;
+ pVirDev->DrawRect(maUpdRect);
- mpTbx->SetItemImage(mnBtnId, Image(aBmpEx));
+ mpTbx->SetItemOverlayImage(mnBtnId, Image(pVirDev->GetBitmapEx(Point(0,0), aItemSize)));
}
}
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index f908cc5bdf52..9d928ce6a1ba 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -37,6 +37,7 @@ struct ImplToolItem
VclPtr<vcl::Window> mpWindow; //don't dispose mpWindow - we get copied around
void* mpUserData;
Image maImage;
+ Image maOverlayImage;
long mnImageAngle;
bool mbMirrorMode;
OUString maText;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index a2b1400507ce..e8031248714f 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2793,6 +2793,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
if ( bImage )
{
const Image* pImage = &(pItem->maImage);
+ const Image& rOverlayImage = pItem->maOverlayImage;
aImageSize = pImage->GetSizePixel();
// determine drawing flags
@@ -2837,6 +2838,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
}
}
rRenderContext.DrawImage(Point( nImageOffX, nImageOffY ), *pImage, nImageStyle);
+ if (!!rOverlayImage)
+ rRenderContext.DrawImage(Point( nImageOffX, nImageOffY ), rOverlayImage, nImageStyle);
}
// draw the text
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 23d5971518d2..6cdd0edc7fce 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -965,6 +965,28 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
}
}
+void ToolBox::SetItemOverlayImage( sal_uInt16 nItemId, const Image& rImage )
+{
+ ImplToolItems::size_type nPos = GetItemPos( nItemId );
+
+ if ( nPos != ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ Size aOldSize = pItem->maOverlayImage.GetSizePixel();
+
+ pItem->maOverlayImage = rImage;
+
+ // only once all is calculated, do extra work
+ if (!mbCalc)
+ {
+ if (aOldSize != pItem->maOverlayImage.GetSizePixel())
+ ImplInvalidate( true );
+ else
+ ImplUpdateItem( nPos );
+ }
+ }
+}
+
static Image ImplRotImage( const Image& rImage, long nAngle10 )
{
BitmapEx aRotBitmapEx( rImage.GetBitmapEx() );
More information about the Libreoffice-commits
mailing list