[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/vcl vcl/source
include/vcl/print.hxx |5 - vcl/source/gdi/print.cxx | 13 - vcl/source/image/Image.cxx |3 ++- 3 files changed, 2 insertions(+), 19 deletions(-) New commits: commit b63c3d9bd9e616a7d38df6f12226cc3b5fd65c2d Author: Michael StahlDate: Wed Apr 27 14:50:05 2016 +0200 tdf#89866 tdf#96504 vcl: fix printing of form controls with images Originally in 2004 commit 0339e43208cd7b98d302e420b39ac32911acaa56 added a "DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't be drawn on any mprinter" );" Recently commit f749ffbdf4c007f1a42bcafc9c2723c47bac22d1 made the mistake of trusting this assertion to be correct and added Printer::DrawImage() overrides that do a hard "assert()" now and don't do any drawing. Armin claims that the implementation of OutputDevice::DrawImage() should actually work for Printer as well due to fall-backs and thus the original DBG_ASSERT was misleading. This matters when printing documents that contain form controls such as ImageControl. Additionally, Image::Draw() should not return early when IsDeviceOutputNecessary() is false, because that is the case when printing, where instead a meta-file is recorded. The called OutputDevice::DrawBitmapEx() will check IsDeviceOutputNecessary() internally anyway. This check was actually always there, so i do not understand how this should have worked in LO 4.2, as the bug reporters claim. (cherry picked from commit ef52ce82bf55b37279e344ea5fef67b4277fb009) Change-Id: I92ba19e7036197d1dde88c361f8e1cb59fae3a60 Reviewed-on: https://gerrit.libreoffice.org/24439 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 11a4974..590e504 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -379,11 +379,6 @@ public: const Point& rSrcPt, const Size& rSrcSize, bool bWindowInvalidate = false ) override; -virtual voidDrawImage( const Point&, const Image&, DrawImageFlags ) override; -virtual voidDrawImage( const Point&, const Size&, - const Image&, DrawImageFlags ) override; - - // These 3 together are more modular PrintJob(), allowing printing more documents as one print job // by repeated calls to ExecutePrintJob(). Used by mailmerge. static bool PreparePrintJob( std::shared_ptr i_pController, diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index ebe19e9..dd9e6b3 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1820,19 +1820,6 @@ void Printer::SetFontOrientation( ImplFontEntry* const pFontEntry ) const pFontEntry->mnOrientation = pFontEntry->maMetric.mnOrientation; } -void Printer::DrawImage( const Point&, const Image&, DrawImageFlags ) -{ -SAL_WARN ("vcl.gdi", "DrawImage(): Images can't be drawn on any Printer instance"); -assert(false); -} - -void Printer::DrawImage( const Point&, const Size&, const Image&, DrawImageFlags ) -{ -SAL_WARN ("vcl.gdi", "DrawImage(): Images can't be drawn on any Printer instance"); -assert(false); -} - - Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const { SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance"); diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index bc9c944..ef132ae 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -229,7 +229,8 @@ bool Image::operator==(const Image& rImage) const void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize) { -if (mpImplData == nullptr || !mpImplData->mpBitmapEx || !pOutDev->IsDeviceOutputNecessary()) +if (mpImplData == nullptr || !mpImplData->mpBitmapEx || +(!pOutDev->IsDeviceOutputNecessary() && pOutDev->GetConnectMetaFile() == nullptr)) return; const Point aSrcPos(0, 0); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/vcl vcl/source
include/vcl/spin.h |8 ++ vcl/source/control/spinfld.cxx | 114 + vcl/source/window/toolbox.cxx |4 - 3 files changed, 71 insertions(+), 55 deletions(-) New commits: commit 63212b4614c134233f520cee95611ec5e7b3d8a0 Author: Caolán McNamaraDate: Thu Feb 18 14:16:23 2016 + Resolves: tdf#97953 spinbuttons are not suitable for reuse as up/down arrows (cherry picked from commit 4f034adcb79684bc4138e2f9708defd8a3532f74) Change-Id: Ibcd7bd4099210a26513caac6e3b16a88a4c8abad refactor ImplDrawSpinButton there is (supposed to be anyway) no logic change here, just unwind the overly complex flow Change-Id: I9c96f41b0480a60c486b476f383d856b464cd62d (cherry picked from commit 55b33456c14aa5311fb0e3d71f1cad4fbd73cbef) Reviewed-on: https://gerrit.libreoffice.org/22486 Reviewed-by: David Ostrovsky Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/vcl/spin.h b/include/vcl/spin.h index e4ce463..0f2f3eb 100644 --- a/include/vcl/spin.h +++ b/include/vcl/spin.h @@ -24,11 +24,19 @@ class Rectangle; +// Draw Spinners as found in a SpinButton. Some themes like gtk3 will draw +- elements here, +// so these are only suitable in the context of SpinButtons void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow, const Rectangle& rUpperRect, const Rectangle& rLowerRect, bool bUpperIn, bool bLowerIn, bool bUpperEnabled = true, bool bLowerEnabled = true, bool bHorz = false, bool bMirrorHorz = false); +// Draw Up/Down buttons suitable for use in any context +void ImplDrawUpDownButtons(vcl::RenderContext& rRenderContext, + const Rectangle& rUpperRect, const Rectangle& rLowerRect, + bool bUpperIn, bool bLowerIn, bool bUpperEnabled = true, bool bLowerEnabled = true, + bool bHorz = false, bool bMirrorHorz = false); + #endif // INCLUDED_VCL_SPIN_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 750900f..d4bb3a6 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -158,49 +158,7 @@ void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow bool bUpperIn, bool bLowerIn, bool bUpperEnabled, bool bLowerEnabled, bool bHorz, bool bMirrorHorz) { -DecorationView aDecoView(); - -DrawButtonFlags nStyle = DrawButtonFlags::NoLeftLightBorder; -DrawSymbolFlags nSymStyle = DrawSymbolFlags::NONE; - -SymbolType eType1, eType2; - -const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); -if ( rStyleSettings.GetOptions() & StyleSettingsOptions::SpinArrow ) -{ -// arrows are only use in OS/2 look -if ( bHorz ) -{ -eType1 = bMirrorHorz ? SymbolType::ARROW_RIGHT : SymbolType::ARROW_LEFT; -eType2 = bMirrorHorz ? SymbolType::ARROW_LEFT : SymbolType::ARROW_RIGHT; -} -else -{ -eType1 = SymbolType::ARROW_UP; -eType2 = SymbolType::ARROW_DOWN; -} -} -else -{ -if ( bHorz ) -{ -eType1 = bMirrorHorz ? SymbolType::SPIN_RIGHT : SymbolType::SPIN_LEFT; -eType2 = bMirrorHorz ? SymbolType::SPIN_LEFT : SymbolType::SPIN_RIGHT; -} -else -{ -eType1 = SymbolType::SPIN_UP; -eType2 = SymbolType::SPIN_DOWN; -} -} - -// draw upper/left Button -DrawButtonFlags nTempStyle = nStyle; -if (bUpperIn) -nTempStyle |= DrawButtonFlags::Pressed; - bool bNativeOK = false; -Rectangle aUpRect; if (pWindow) { @@ -236,15 +194,66 @@ void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow bNativeOK = ImplDrawNativeSpinbuttons(rRenderContext, aValue); } -if (!bNativeOK) -aUpRect = aDecoView.DrawButton(rUpperRect, nTempStyle); +if (bNativeOK) +return; + +ImplDrawUpDownButtons(rRenderContext, + rUpperRect, rLowerRect, + bUpperIn, bLowerIn, bUpperEnabled, bLowerEnabled, + bHorz, bMirrorHorz); +} + +void ImplDrawUpDownButtons(vcl::RenderContext& rRenderContext, + const Rectangle& rUpperRect, const Rectangle& rLowerRect, + bool bUpperIn, bool bLowerIn, bool bUpperEnabled, bool bLowerEnabled, + bool bHorz, bool bMirrorHorz) +{ +DecorationView aDecoView(); + +SymbolType eType1, eType2; +
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/vcl vcl/source
include/vcl/toolbox.hxx |3 ++- vcl/source/window/toolbox.cxx | 13 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) New commits: commit 4d7c06741967a84142bbe8fa8ae608e5e7df7b0f Author: Michael MeeksDate: Wed Feb 17 21:05:50 2016 + tdf#97922 - Mend nonsensical spin invalidation to improve rendering. Change-Id: I3a398c47c69cc292a681ebe2414d844c224f3e3e Reviewed-on: https://gerrit.libreoffice.org/22444 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 12a0b70..11958cd 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -155,7 +155,8 @@ public: using Window::ImplInit; private: SAL_DLLPRIVATE void InvalidateItem(sal_uInt16 nPosition); -SAL_DLLPRIVATE void InvalidateSpin(bool bUpperIn, bool bLowerIn); +SAL_DLLPRIVATE void InvalidateSpin(bool bInvalidateUpper = true, + bool bInvalidateLower = true); SAL_DLLPRIVATE void InvalidateMenuButton(); SAL_DLLPRIVATE voidImplInit( vcl::Window* pParent, WinBits nStyle ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index e0e8492..62140e4 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3455,8 +3455,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat ) if ( bNewIn != mbIn ) { mbIn = bNewIn; -Invalidate(); -InvalidateSpin(mbIn, false); +InvalidateSpin(true, false); } return true; } @@ -3467,7 +3466,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat ) if ( bNewIn != mbIn ) { mbIn = bNewIn; -InvalidateSpin(false, mbIn); +InvalidateSpin(false, true); } return true; } @@ -3582,7 +3581,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) mbUpper = false; mbLower = false; mbIn= false; -InvalidateSpin(false, false); +InvalidateSpin(); return true; } @@ -4484,7 +4483,7 @@ void ToolBox::Command( const CommandEvent& rCEvt ) ShowLine( false ); else if ( (mnCurLine+mnVisLines-1 < mnCurLines) && (pData->GetDelta() < 0) ) ShowLine( true ); -InvalidateSpin(false, false); +InvalidateSpin(); return; } } @@ -5193,7 +5192,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) mnCurLine = 1; mbFormat = true; ImplFormat(); -InvalidateSpin(false, false); +InvalidateSpin(); ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) ); } break; @@ -5206,7 +5205,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) mnCurLine = mnCurLines; mbFormat = true; ImplFormat(); -InvalidateSpin(false, false); +InvalidateSpin(); ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) ); } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/vcl vcl/source
include/vcl/salnativewidgets.hxx |6 ++ vcl/source/control/spinfld.cxx |3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) New commits: commit 2fb86ca5316bb5cd982ac9283fae0d9930c692c7 Author: Michael MeeksDate: Wed Feb 17 20:42:52 2016 + tdf#97922 - get control area right for spinbuttons. Also avoid caching both spin-buttons and some other complex types. The cache key needs to be able to include more state. Change-Id: I8eff6b1c5c51d27afb796cae66b45390433138b4 Reviewed-on: https://gerrit.libreoffice.org/22443 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index 8c1176a..0789270 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -288,6 +288,12 @@ public: case CTRL_RADIOBUTTON: case CTRL_LISTNODE: case CTRL_SLIDER: +// FIXME: these guys have complex state hidden in ImplControlValue +// structs which affects rendering, needs to be a and needs to be +// part of the key to our cache. +case CTRL_SPINBOX: +case CTRL_SPINBUTTONS: +case CTRL_TAB_ITEM: return false; case CTRL_MENUBAR: diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 8f4bbca..750900f 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -143,8 +143,9 @@ bool ImplDrawNativeSpinbuttons(vcl::RenderContext& rRenderContext, const Spinbut if (rRenderContext.IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL)) { +Rectangle aArea = rSpinbuttonValue.maUpperRect.GetUnion(rSpinbuttonValue.maLowerRect); // only paint the standalone spin buttons, all buttons are painted at once -bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, Rectangle(), +bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, aArea, ControlState::ENABLED, rSpinbuttonValue, OUString()); } return bNativeOK; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/vcl vcl/source
include/vcl/layout.hxx |1 - vcl/source/window/dialog.cxx | 34 +++--- 2 files changed, 27 insertions(+), 8 deletions(-) New commits: commit 2cbd9dffe76068c71c9de3f6525ce68d949085c3 Author: Katarina BehrensDate: Tue Jan 19 23:07:47 2016 +0100 tdf#95587: Make rectangle control within tab pages work again Since commit 74407aef94b6d8dfdd6, tab pages|controls are considered to be container widgets (thus, search for the nearest non-layout parent will never find a tab page parent, breaking rectangle control in many dialogs). I've no idea how many other functions' behaviour this changes in an unexpected way, so I've reverted that bit. That however means implementing slightly different approach to tdf#92630 in dialogs (for a tab dialog, find current tab page and go through its children) Change-Id: I3ff5ac13f04b1c5c799c7a1a3769108927809f31 Reviewed-on: https://gerrit.libreoffice.org/21615 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 39471da6e4d016c52c6cdf6553d7418416a160f4) Reviewed-on: https://gerrit.libreoffice.org/21668 Reviewed-by: Miklos Vajna diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index be86c75..6bdef03 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -704,7 +704,6 @@ inline bool isContainerWindow(const vcl::Window ) { WindowType eType = rWindow.GetType(); return eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW || -eType == WINDOW_TABCONTROL || eType == WINDOW_TABPAGE || (eType == WINDOW_DOCKINGWINDOW && ::isLayoutEnabled()); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1793afdf5..8b70c2e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include #include @@ -236,6 +238,16 @@ void ImplWindowAutoMnemonic( vcl::Window* pWindow ) } } +void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow ) +{ +Control *pControl = dynamic_cast (pWindow->ImplGetWindow()); +if (pControl && pControl->GetText().indexOf('~') != -1) +{ +pControl->SetShowAccelerator( bShow ); +pControl->Invalidate(InvalidateFlags::Update); +} +} + static VclButtonBox* getActionArea(Dialog *pDialog) { VclButtonBox *pButtonBox = nullptr; @@ -590,19 +602,27 @@ bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent ) if (rCEvent.GetCommand() == CommandEventId::ModKeyChange) { const CommandModKeyData *pCData = rCEvent.GetModKeyData (); +bool bShowAccel = pCData && pCData->IsMod2(); Window *pGetChild = firstLogicalChildOfParent(this); while (pGetChild) { -Control *pControl = dynamic_cast (pGetChild->ImplGetWindow()); -if (pControl && pControl->GetText().indexOf('~') != -1) +if ( pGetChild->GetType() == WINDOW_TABCONTROL ) { -if (pCData && pCData->IsMod2()) -pControl->SetShowAccelerator(true); -else -pControl->SetShowAccelerator(false); -pControl->Invalidate(InvalidateFlags::Update); + // find currently shown tab page + TabControl* pTabControl = static_cast ( pGetChild ); + TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() ); + vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage ); + + // and go through its children + while ( pTabPageChild ) + { + ImplHandleControlAccelerator(pTabPageChild, bShowAccel); + pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild); + } } + +ImplHandleControlAccelerator( pGetChild, bShowAccel ); pGetChild = nextLogicalChildOfParent(this, pGetChild); } return true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits