include/svx/compressgraphicdialog.hxx | 3 include/vcl/dockingarea.hxx | 1 include/vcl/fixed.hxx | 13 + include/vcl/lstbox.hxx | 1 include/vcl/slider.hxx | 10 + svx/source/dialog/compressgraphicdialog.cxx | 8 svx/uiconfig/ui/compressgraphicdialog.ui | 97 ++++++---- sw/inc/crsrsh.hxx | 2 sw/inc/viewsh.hxx | 6 sw/source/core/crsr/crsrsh.cxx | 4 sw/source/core/view/pagepreviewlayout.cxx | 6 sw/source/core/view/viewsh.cxx | 21 +- sw/source/core/view/vprint.cxx | 2 sw/source/uibase/docvw/edtwin2.cxx | 4 vcl/source/control/ctrl.cxx | 23 -- vcl/source/control/fixed.cxx | 249 +++++++++++++--------------- vcl/source/control/lstbox.cxx | 6 vcl/source/control/slider.cxx | 43 ++++ vcl/source/window/dockingarea.cxx | 86 ++++----- vcl/source/window/paint.cxx | 11 - 20 files changed, 333 insertions(+), 263 deletions(-)
New commits: commit a39a4c750171e77266391c419fcc0acc67028571 Author: Tomaž Vajngerl <[email protected]> Date: Sat May 23 18:53:12 2015 +0900 use sliders in CompressGraphicDialog Change-Id: I272d0f9d56a601b78cbc3e67ff1f87db964d5ccd diff --git a/include/svx/compressgraphicdialog.hxx b/include/svx/compressgraphicdialog.hxx index cf0c2ac..d933405 100644 --- a/include/svx/compressgraphicdialog.hxx +++ b/include/svx/compressgraphicdialog.hxx @@ -25,6 +25,7 @@ #include <vcl/graph.hxx> #include <vcl/lstbox.hxx> #include <vcl/field.hxx> +#include <vcl/slider.hxx> #include <sfx2/bindings.hxx> #include <svx/svxdllapi.h> @@ -46,7 +47,9 @@ private: VclPtr<RadioButton> m_pLosslessRB; VclPtr<RadioButton> m_pJpegCompRB; VclPtr<NumericField> m_pCompressionMF; + VclPtr<Slider> m_pCompressionSlider; VclPtr<NumericField> m_pQualityMF; + VclPtr<Slider> m_pQualitySlider; VclPtr<PushButton> m_pBtnCalculate; VclPtr<ListBox> m_pInterpolationCombo; diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 48f763a..43656af 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -97,8 +97,10 @@ void CompressGraphicsDialog::Initialize() get(m_pFixedText6, "label-new-capacity"); get(m_pJpegCompRB, "radio-jpeg"); get(m_pCompressionMF, "spin-compression"); + get(m_pCompressionSlider, "scale-compression"); get(m_pLosslessRB, "radio-lossless"); get(m_pQualityMF, "spin-quality"); + get(m_pQualitySlider, "scale-quality"); get(m_pReduceResolutionCB, "checkbox-reduce-resolution"); get(m_pMFNewWidth, "spin-new-width"); get(m_pMFNewHeight, "spin-new-height"); @@ -119,6 +121,9 @@ void CompressGraphicsDialog::Initialize() m_pReduceResolutionCB->SetToggleHdl( LINK( this, CompressGraphicsDialog, ToggleReduceResolutionRB ) ); + m_pQualitySlider->SetLinkedField(m_pQualityMF); + m_pCompressionSlider->SetLinkedField(m_pCompressionMF); + m_pJpegCompRB->Check(); m_pReduceResolutionCB->Check(); @@ -318,8 +323,9 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, ToggleCompressionRB ) { bool choice = m_pLosslessRB->IsChecked(); m_pCompressionMF->Enable(choice); + m_pCompressionSlider->Enable(choice); m_pQualityMF->Enable(!choice); - + m_pQualitySlider->Enable(!choice); return 0L; } diff --git a/svx/uiconfig/ui/compressgraphicdialog.ui b/svx/uiconfig/ui/compressgraphicdialog.ui index 32962b7..fc97332 100644 --- a/svx/uiconfig/ui/compressgraphicdialog.ui +++ b/svx/uiconfig/ui/compressgraphicdialog.ui @@ -179,7 +179,6 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Width:</property> <property name="use_underline">True</property> @@ -208,7 +207,6 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Height:</property> <property name="use_underline">True</property> @@ -241,7 +239,6 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Resolution:</property> <property name="use_underline">True</property> @@ -296,11 +293,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Quality:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spin-quality</property> <property name="width_chars">15</property> </object> <packing> @@ -313,11 +308,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Compression:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spin-compression</property> <property name="width_chars">15</property> </object> <packing> @@ -326,37 +319,10 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="spin-quality"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">â¢</property> - <property name="adjustment">quality-adjustment</property> - <property name="numeric">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="spin-compression"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">â¢</property> - <property name="adjustment">compression-adjustment</property> - <property name="numeric">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> - </child> - <child> <object class="GtkLabel" id="label12"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="hexpand">True</property> <property name="xalign">1</property> <property name="label" translatable="yes">Interpolation:</property> <property name="use_underline">True</property> @@ -416,10 +382,65 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkSpinButton" id="spin-compression"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">â¢</property> + <property name="adjustment">compression-adjustment</property> + <property name="numeric">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSpinButton" id="spin-quality"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">â¢</property> + <property name="adjustment">quality-adjustment</property> + <property name="numeric">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="scale-quality"> + <property name="width_request">100</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="adjustment">quality-adjustment</property> + <property name="fill_level">99</property> + <property name="round_digits">0</property> + <property name="digits">0</property> + <property name="draw_value">False</property> + <property name="value_pos">right</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="scale-compression"> + <property name="width_request">200</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">compression-adjustment</property> + <property name="fill_level">9</property> + <property name="round_digits">0</property> + <property name="digits">0</property> + <property name="draw_value">False</property> + <property name="value_pos">right</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">3</property> + </packing> </child> <child> <placeholder/> @@ -440,7 +461,7 @@ </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> @@ -628,7 +649,7 @@ </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">1</property> </packing> commit ef934abf7d222035e4261474c322de603bd001da Author: Tomaž Vajngerl <[email protected]> Date: Sat May 23 18:50:55 2015 +0900 support linking a Slider with a NumericField Change-Id: I5cfd28d278cc21884eb9bf1b0e5a619c871f6bd2 diff --git a/include/vcl/slider.hxx b/include/vcl/slider.hxx index a3d3fdbe..9a96f3a 100644 --- a/include/vcl/slider.hxx +++ b/include/vcl/slider.hxx @@ -23,6 +23,7 @@ #include <vcl/dllapi.h> #include <vcl/ctrl.hxx> #include <vcl/scrbar.hxx> +#include <vcl/field.hxx> class VCL_DLLPUBLIC Slider : public Control { @@ -51,9 +52,14 @@ private: ScrollType meScrollType; bool mbCalcSize; bool mbFullDrag; + + NumericField* mpLinkedField; + Link<> maSlideHdl; Link<> maEndSlideHdl; + DECL_LINK(LinkedFieldModifyHdl, NumericField*); + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); @@ -70,6 +76,8 @@ private: SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, bool bCallAction = true ); SAL_DLLPRIVATE long ImplDoSlide( long nNewPos ); SAL_DLLPRIVATE long ImplDoSlideAction( ScrollType eScrollType ); + SAL_DLLPRIVATE void ImplSetFieldLink(const Link<>& rLink); + SAL_DLLPRIVATE void ImplUpdateLinkedField(); public: Slider( vcl::Window* pParent, WinBits nStyle = WB_HORZ ); @@ -108,6 +116,8 @@ public: Size CalcWindowSizePixel(); + void SetLinkedField(NumericField* pField); + void SetSlideHdl( const Link<>& rLink ) { maSlideHdl = rLink; } const Link<>& GetSlideHdl() const { return maSlideHdl; } void SetEndSlideHdl( const Link<>& rLink ) { maEndSlideHdl = rLink; } diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index fb566e8..4aa94ad 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -68,6 +68,8 @@ void Slider::ImplInit( vcl::Window* pParent, WinBits nStyle ) mbCalcSize = true; mbFullDrag = true; + mpLinkedField = nullptr; + Control::ImplInit( pParent, nStyle, NULL ); ImplInitSettings(); @@ -75,7 +77,7 @@ void Slider::ImplInit( vcl::Window* pParent, WinBits nStyle ) } Slider::Slider( vcl::Window* pParent, WinBits nStyle ) : - Control( WINDOW_SLIDER ) + Control(WINDOW_SLIDER) { ImplInit( pParent, nStyle ); } @@ -211,6 +213,34 @@ void Slider::ImplUpdateRects( bool bUpdate ) } } +void Slider::ImplSetFieldLink(const Link<>& rLink) +{ + if (mpLinkedField != nullptr) + { + mpLinkedField->SetModifyHdl(rLink); + mpLinkedField->SetUpHdl(rLink); + mpLinkedField->SetDownHdl(rLink); + mpLinkedField->SetFirstHdl(rLink); + mpLinkedField->SetLastHdl(rLink); + mpLinkedField->SetLoseFocusHdl(rLink); + } +} + +void Slider::ImplUpdateLinkedField() +{ + if (mpLinkedField) + mpLinkedField->SetValue(mnThumbPos); +} + +IMPL_LINK(Slider, LinkedFieldModifyHdl, NumericField*, pField) +{ + if (pField) + { + SetThumbPos(pField->GetValue()); + } + return 0; +} + long Slider::ImplCalcThumbPos( long nPixPos ) { // calculate position @@ -762,6 +792,7 @@ void Slider::Tracking( const TrackingEvent& rTEvt ) { ImplUpdateRects(); Update(); + ImplUpdateLinkedField(); if ( mbFullDrag && (nOldPos != mnThumbPos) ) { mnDelta = mnThumbPos-nOldPos; @@ -839,6 +870,13 @@ void Slider::Resize() Invalidate(); } +void Slider::SetLinkedField(NumericField* pField) +{ + ImplSetFieldLink(Link<>()); + mpLinkedField = pField; + ImplSetFieldLink(LINK(this, Slider, LinkedFieldModifyHdl)); +} + void Slider::RequestHelp( const HelpEvent& rHEvt ) { Control::RequestHelp( rHEvt ); @@ -947,7 +985,7 @@ void Slider::SetRange( const Range& rRange ) mnThumbPos = mnMaxRange; if ( mnThumbPos < mnMinRange ) mnThumbPos = mnMinRange; - + ImplUpdateLinkedField(); StateChanged( StateChangedType::Data ); } } @@ -962,6 +1000,7 @@ void Slider::SetThumbPos( long nNewThumbPos ) if ( mnThumbPos != nNewThumbPos ) { mnThumbPos = nNewThumbPos; + ImplUpdateLinkedField(); StateChanged( StateChangedType::Data ); } } commit 60ef5920d3ad89e0839f26488481ded8157ebbe9 Author: Tomaž Vajngerl <[email protected]> Date: Sat May 23 18:49:16 2015 +0900 pass RenderContext into writer painting Change-Id: Ib2d986d05dc7db1b65ed29ea295807d6f20cea4a diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2fdcac8..073a8df 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -408,7 +408,7 @@ public: /* * virtual paint method to make selection visible again after Paint */ - void Paint( const Rectangle & rRect ) SAL_OVERRIDE; + void Paint(vcl::RenderContext& rRenderContext, const Rectangle & rRect) SAL_OVERRIDE; // Areas inline void SetMark(); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index b63eaef..4d34d5a 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -174,10 +174,10 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell> SAL_DLLPRIVATE void Reformat(); // Invalidates complete Layout (ApplyViewOption). - SAL_DLLPRIVATE void PaintDesktop( const SwRect & ); // Collect values for painting of desktop + SAL_DLLPRIVATE void PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect&); // Collect values for painting of desktop // and calling. // PaintDesktop split. This pars is also used by PreviewPage. - SAL_DLLPRIVATE void _PaintDesktop( const SwRegionRects &rRegion ); + SAL_DLLPRIVATE void _PaintDesktop(vcl::RenderContext& rRenderContext, const SwRegionRects &rRegion); SAL_DLLPRIVATE bool CheckInvalidForPaint( const SwRect & ); // Direct Paint or rather // trigger an action. @@ -246,7 +246,7 @@ public: void DLPostPaint2(bool bPaintFormLayer); const MapMode& getPrePostMapMode() const { return maPrePostMapMode; } - virtual void Paint(const Rectangle &rRect); + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect); /** Paint tile. diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 98dc7fd..428aa40 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1237,7 +1237,7 @@ bool SwCrsrShell::GoPrevCrsr() return true; } -void SwCrsrShell::Paint( const Rectangle &rRect) +void SwCrsrShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect) { comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false)); SET_CURR_SHELL( this ); @@ -1254,7 +1254,7 @@ void SwCrsrShell::Paint( const Rectangle &rRect) } // re-paint area - SwViewShell::Paint( rRect ); + SwViewShell::Paint(rRenderContext, rRect); if( m_bHasFocus && !m_bBasicHideCrsr ) { diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index bb154c6..02c2af9 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -1015,7 +1015,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan } mbInPaint = true; - OutputDevice* pOutputDev = &rRenderContext; //mrParentViewShell.GetOut(); + OutputDevice* pOutputDev = &rRenderContext; // prepare paint if ( maPreviewPages.size() > 0 ) @@ -1040,7 +1040,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan } } // paint preview background rectangles - mrParentViewShell._PaintDesktop( aPreviewBackgrdRegion ); + mrParentViewShell._PaintDesktop(rRenderContext, aPreviewBackgrdRegion); } // prepare data for paint of pages @@ -1095,7 +1095,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const Rectan mrParentViewShell.maVisArea = aPageRect; aPxPaintRect.Intersection( aPxOutRect ); Rectangle aPaintRect = pOutputDev->PixelToLogic( aPxPaintRect ); - mrParentViewShell.Paint( aPaintRect ); + mrParentViewShell.Paint(rRenderContext, aPaintRect); // --> OD 2007-08-15 #i80691# // paint page border and shadow { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 37762b4..1873a3e 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -377,7 +377,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) mpOut = pVout.get(); if ( bPaintsFromSystem ) - PaintDesktop( aRect ); + PaintDesktop(*mpOut, aRect); pCurrentLayout->Paint( aRect ); pOld->DrawOutDev( aRect.Pos(), aRect.SSize(), aRect.Pos(), aRect.SSize(), *pVout ); @@ -398,7 +398,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) DLPrePaint2(vcl::Region(aRect.SVRect())); if ( bPaintsFromSystem ) - PaintDesktop( aRect ); + PaintDesktop(*GetOut(), aRect); if (!isTiledRendering()) pCurrentLayout->Paint( aRect ); else @@ -484,7 +484,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) OutputDevice *pOld = mpOut; mpOut = pVout.get(); - Paint( VisArea().SVRect() ); + Paint(*mpOut, VisArea().SVRect()); mpOut = pOld; mpOut->DrawOutDev( VisArea().Pos(), aSize, VisArea().Pos(), aSize, *pVout ); @@ -1263,7 +1263,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect mpWin = pOldWin; // SW paint stuff - PaintDesktop( aRect ); + PaintDesktop(*GetOut(), aRect); SwViewShell::mbLstAct = true; GetLayout()->Paint( aRect ); SwViewShell::mbLstAct = false; @@ -1404,7 +1404,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect return false; } -void SwViewShell::PaintDesktop( const SwRect &rRect ) +void SwViewShell::PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect &rRect) { if ( !GetWin() && !GetOut()->GetConnectMetaFile() ) return; //for the printer we don't do anything here. @@ -1488,11 +1488,11 @@ void SwViewShell::PaintDesktop( const SwRect &rRect ) } } if ( !aRegion.empty() ) - _PaintDesktop( aRegion ); + _PaintDesktop(rRenderContext, aRegion); } // PaintDesktop is split in two, this part is also used by PreviewPage -void SwViewShell::_PaintDesktop( const SwRegionRects &rRegion ) +void SwViewShell::_PaintDesktop(vcl::RenderContext& /*rRenderContext*/, const SwRegionRects &rRegion) { // OD 2004-04-23 #116347# GetOut()->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR ); @@ -1644,8 +1644,9 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) return bRet; } -void SwViewShell::Paint(const Rectangle &rRect) +void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect) { + mpOut = &rRenderContext; if ( mnLockPaint ) { if ( Imp()->bSmoothUpdate ) @@ -1716,7 +1717,7 @@ void SwViewShell::Paint(const Rectangle &rRect) DLPrePaint2(aRepaintRegion); // <-- - PaintDesktop( aRect ); + PaintDesktop(rRenderContext, aRect); //When useful, process or destroy the old InvalidRect. if ( aRect.IsInside( maInvalidRect ) ) @@ -1826,7 +1827,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex CheckInvalidForPaint(aOutRect); // draw - works in logic coordinates - Paint(aOutRect); + Paint(rDevice, aOutRect); // Remove this device in DrawLayer if (Imp()->GetDrawView()) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 5ea6e10..b674f92 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -141,7 +141,7 @@ void SwPaintQueue::Repaint() } } else - pSh->Paint( pPt->aRect.SVRect() ); + pSh->Paint(*pSh->GetOut(), pPt->aRect.SVRect()); pPt = pPt->pNext; } while ( pPt ); diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 47ef3ef..fc38db6 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -441,7 +441,7 @@ void SwEditWin::PrePaint(vcl::RenderContext& /*rRenderContext*/) } } -void SwEditWin::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) +void SwEditWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { SwWrtShell* pWrtShell = GetView().GetWrtShellPtr(); if(!pWrtShell) @@ -467,7 +467,7 @@ void SwEditWin::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& GetView().GetVisArea().GetHeight() <= 0 ) Invalidate( rRect ); else - pWrtShell->Paint( rRect ); + pWrtShell->Paint(rRenderContext, rRect); if( bPaintShadowCrsr ) m_pShadCrsr->Paint(); commit 95ccc26ba71259be29fde8ba6b6f52ffbe5bd3c7 Author: Tomaž Vajngerl <[email protected]> Date: Fri May 22 18:07:45 2015 +0900 call ApplySettings sooner when painting Change-Id: I2ddd6a6b4ccfccc55f394d8a6851843ef2479fe3 diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index af64a31..e220a37 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -228,7 +228,6 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) m_pBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel() - m_pBuffer->mnOutOffY; m_pWindow->PushPaintHelper(this, *m_pWindow); - m_pWindow->ApplySettings(*m_pBuffer.get()); m_pWindow->Paint(*m_pBuffer.get(), m_aPaintRect); // restore the mnOutOffX/Y value @@ -239,7 +238,6 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) { // direct painting m_pWindow->PushPaintHelper(this, *m_pWindow); - m_pWindow->ApplySettings(*m_pWindow); m_pWindow->Paint(*m_pWindow, m_aPaintRect); } @@ -507,6 +505,11 @@ namespace vcl { void Window::ImplCallPaint(const VclPtr<VirtualDevice>& rBuffer, const vcl::Region* pRegion, sal_uInt16 nPaintFlags) { + if (rBuffer) + ApplySettings(*rBuffer.get()); + else + ApplySettings(*this); + // call PrePaint. PrePaint may add to the invalidate region as well as // other parameters used below. PrePaint(*this); @@ -697,7 +700,6 @@ void Window::ImplInvalidateParentFrameRegion( vcl::Region& rRegion ) void Window::ImplInvalidate( const vcl::Region* pRegion, sal_uInt16 nFlags ) { - // reset background storage if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) ImplInvalidateAllOverlapBackgrounds(); @@ -1133,7 +1135,6 @@ vcl::Region Window::GetPaintRegion() const void Window::Invalidate( sal_uInt16 nFlags ) { - if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) return; @@ -1143,7 +1144,6 @@ void Window::Invalidate( sal_uInt16 nFlags ) void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) { - if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) return; @@ -1160,7 +1160,6 @@ void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) void Window::Invalidate( const vcl::Region& rRegion, sal_uInt16 nFlags ) { - if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) return; commit 4f5fe008a3d5f0b5ddfa656299306cff9d57d802 Author: Tomaž Vajngerl <[email protected]> Date: Fri May 22 17:51:44 2015 +0900 use ApplySettings instead of ImplInitSettings is called Change-Id: I30cbfe1906d5d59db93a354ca1d1862c4b5e631a diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx index 58fcfd7..a0ce2d6 100644 --- a/include/vcl/dockingarea.hxx +++ b/include/vcl/dockingarea.hxx @@ -43,6 +43,7 @@ public: WindowAlign GetAlign() const; bool IsHorizontal() const; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 15e838b..fc455d8 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -44,7 +44,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; public: @@ -64,6 +63,8 @@ public: virtual ~FixedText(); virtual void dispose() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -89,6 +90,7 @@ public: explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 ); virtual void LoseFocus() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; }; @@ -102,7 +104,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false); protected: @@ -116,6 +117,8 @@ public: explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ ); explicit FixedLine( vcl::Window* pParent, const ResId& ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -135,13 +138,14 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ); public: explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -168,7 +172,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); protected: SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, @@ -179,6 +182,8 @@ public: explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedImage( vcl::Window* pParent, const ResId& ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index d93167e..8a5efc5 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -85,6 +85,7 @@ public: virtual ~ListBox(); virtual void dispose() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 065ed0f..ed59e5d 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -425,28 +425,9 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) rRenderContext.SetTextFillColor(); } -void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) +void Control::ImplInitSettings(const bool, const bool) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (_bFont) - { - Font aFont(GetCanonicalFont(rStyleSettings)); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(*this, aFont); - } - - if (_bForeground || _bFont) - { - Color aColor; - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = GetCanonicalTextColor(rStyleSettings); - SetTextColor(aColor); - SetTextFillColor(); - } + ApplySettings(*this); } void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr, diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 4588596..55b8b0c 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -84,7 +84,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedText::ImplInitStyle( WinBits nStyle ) @@ -104,35 +104,6 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); } -void FixedText::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - FixedText::FixedText( vcl::Window* pParent, WinBits nStyle ) : Control(WINDOW_FIXEDTEXT) , m_nMaxWidthChars(-1) @@ -232,6 +203,31 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL); } +void FixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -240,7 +236,7 @@ void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - ImplInitSettings( true, true, true ); + ApplySettings(*pDev); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -298,24 +294,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } } else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -329,7 +325,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -390,7 +386,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); - ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); + const_cast<FixedText*>(this)->Invalidate(); } void FixedText::setMaxWidthChars(sal_Int32 nWidth) @@ -476,9 +472,13 @@ SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle) // read-only SetReadOnly(); // make it transparent + SetPaintTransparent(true); SetControlBackground(); - SetBackground(); - SetPaintTransparent( true ); +} + +void SelectableFixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); } void SelectableFixedText::LoseFocus() @@ -492,7 +492,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedLine::ImplInitStyle( WinBits nStyle ) @@ -512,35 +512,6 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return _rStyle.GetGroupTextColor(); } -void FixedLine::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) { Size aOutSize = rRenderContext.GetOutputSizePixel(); @@ -633,12 +604,37 @@ FixedLine::FixedLine( vcl::Window* pParent, const ResId& rResId ) : Show(); } -void FixedLine::FillLayoutData() const +void FixedLine::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<FixedLine*>(this)->Invalidate(); } +void FixedLine::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedLine::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(rRenderContext); @@ -676,17 +672,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == StateChangedType::Style) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -700,7 +696,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -714,7 +710,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) @@ -724,29 +720,6 @@ WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedBitmap::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } -} - FixedBitmap::FixedBitmap( vcl::Window* pParent, WinBits nStyle ) : Control( WINDOW_FIXEDBITMAP ) { @@ -771,6 +744,29 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, } } +void FixedBitmap::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedBitmap::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -823,7 +819,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -835,7 +831,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -852,7 +848,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) nStyle = ImplInitStyle( nStyle ); mbInUserDraw = false; Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedImage::ImplInitStyle( WinBits nStyle ) @@ -862,29 +858,6 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedImage::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else if ( pParent ) - SetBackground( pParent->GetBackground() ); - } -} - void FixedImage::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); @@ -941,6 +914,30 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, } } +void FixedImage::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else if (pParent) + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + + void FixedImage::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -998,7 +995,7 @@ void FixedImage::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -1010,7 +1007,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 4fbc24e..60683d3 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -105,7 +105,6 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) nStyle |= WB_BORDER; Control::ImplInit( pParent, nStyle, NULL ); - SetBackground(); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this); @@ -369,6 +368,11 @@ void ListBox::ToggleDropDown() } } +void ListBox::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); +} + void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true ); diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 793ae09..25519f9 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -44,50 +44,12 @@ DockingAreaWindow::ImplData::~ImplData() { } -static void ImplInitBackground( DockingAreaWindow* pThis ) -{ - const StyleSettings rSetting = Application::GetSettings().GetStyleSettings(); - const BitmapEx& rPersonaBitmap = pThis->GetAlign() == WINDOWALIGN_TOP ? rSetting.GetPersonaHeader() :rSetting.GetPersonaFooter(); - if ( !rPersonaBitmap.IsEmpty() &&( pThis->GetAlign() == WINDOWALIGN_TOP|| pThis->GetAlign()==WINDOWALIGN_BOTTOM ) ) - { - Wallpaper aWallpaper( rPersonaBitmap ); - if(pThis->GetAlign()==WINDOWALIGN_TOP ) - aWallpaper.SetStyle( WALLPAPER_TOPRIGHT ); - else - aWallpaper.SetStyle( WALLPAPER_BOTTOMRIGHT ); - aWallpaper.SetColor( rSetting.GetWorkspaceColor() ); - - // we need to shift the bitmap vertically so that it spans over the - // menubar conveniently - long nMenubarHeight = 0; - SystemWindow *pSysWin = pThis->GetSystemWindow(); - if ( pSysWin && pSysWin->GetMenuBar() ) - { - vcl::Window *pMenubarWin = pSysWin->GetMenuBar()->GetWindow(); - if ( pMenubarWin ) - nMenubarHeight = pMenubarWin->GetOutputHeightPixel(); - } - aWallpaper.SetRect( Rectangle( Point( 0, -nMenubarHeight ), Size( pThis->GetOutputWidthPixel(), pThis->GetOutputHeightPixel() + nMenubarHeight ) ) ); - - pThis->SetBackground( aWallpaper ); - } - else if( !pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) - { - Wallpaper aWallpaper; - aWallpaper.SetStyle( WALLPAPER_APPLICATIONGRADIENT ); - pThis->SetBackground( aWallpaper ); - } - else - pThis->SetBackground( Wallpaper( pThis->GetSettings().GetStyleSettings().GetFaceColor() ) ); -} - DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) : Window( WINDOW_DOCKINGAREA ) { ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, NULL ); mpImplData = new ImplData; - ImplInitBackground( this ); } DockingAreaWindow::~DockingAreaWindow() @@ -107,7 +69,6 @@ void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitBackground( this ); Invalidate(); } } @@ -149,7 +110,6 @@ void DockingAreaWindow::SetAlign( WindowAlign eNewAlign ) if( eNewAlign != mpImplData->meAlign ) { mpImplData->meAlign = eNewAlign; - ImplInitBackground( this ); Invalidate(); } } @@ -159,13 +119,56 @@ WindowAlign DockingAreaWindow::GetAlign() const return mpImplData->meAlign; } +void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); + const BitmapEx& rPersonaBitmap = (GetAlign() == WINDOWALIGN_TOP) ? rSetting.GetPersonaHeader() : rSetting.GetPersonaFooter(); + + if (!rPersonaBitmap.IsEmpty() && (GetAlign() == WINDOWALIGN_TOP || GetAlign()==WINDOWALIGN_BOTTOM)) + { + Wallpaper aWallpaper(rPersonaBitmap); + if (GetAlign() == WINDOWALIGN_TOP) + aWallpaper.SetStyle(WALLPAPER_TOPRIGHT); + else + aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); + aWallpaper.SetColor(rSetting.GetWorkspaceColor()); + + // we need to shift the bitmap vertically so that it spans over the + // menubar conveniently + long nMenubarHeight = 0; + SystemWindow* pSysWin = GetSystemWindow(); + if (pSysWin && pSysWin->GetMenuBar()) + { + vcl::Window* pMenubarWin = pSysWin->GetMenuBar()->GetWindow(); + if (pMenubarWin) + nMenubarHeight = pMenubarWin->GetOutputHeightPixel(); + } + aWallpaper.SetRect(Rectangle(Point(0, -nMenubarHeight), + Size(rRenderContext.GetOutputWidthPixel(), + rRenderContext.GetOutputHeightPixel() + nMenubarHeight))); + + rRenderContext.SetBackground(aWallpaper); + } + else if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) + { + Wallpaper aWallpaper; + aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT); + rRenderContext.SetBackground(aWallpaper); + } + else + rRenderContext.SetBackground(Wallpaper(rSetting.GetFaceColor())); + +} + void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { + + const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); + EnableNativeWidget(true); // only required because the toolkit currently switches this flag off if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) { ToolbarValue aControlValue; - const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); if (GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG) { @@ -256,7 +259,6 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl void DockingAreaWindow::Resize() { - ImplInitBackground( this ); ImplInvalidateMenubar( this ); if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) Invalidate();
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
