include/sfx2/sidebar/SidebarChildWindow.hxx | 12 include/sfx2/sidebar/SidebarPanelBase.hxx | 53 +--- include/sfx2/sidebar/SidebarToolBox.hxx | 29 +- include/svtools/tabbar.hxx | 1 include/vcl/edit.hxx | 43 +-- include/vcl/scrbar.hxx | 26 +- sfx2/source/sidebar/Deck.cxx | 37 +- sfx2/source/sidebar/Deck.hxx | 8 sfx2/source/sidebar/DeckTitleBar.cxx | 31 +- sfx2/source/sidebar/DeckTitleBar.hxx | 6 sfx2/source/sidebar/FocusManager.cxx | 31 -- sfx2/source/sidebar/FocusManager.hxx | 58 ++-- sfx2/source/sidebar/Panel.cxx | 39 +-- sfx2/source/sidebar/Panel.hxx | 26 -- sfx2/source/sidebar/SidebarChildWindow.cxx | 16 - sfx2/source/sidebar/SidebarDockingWindow.cxx | 11 sfx2/source/sidebar/SidebarDockingWindow.hxx | 10 sfx2/source/sidebar/TitleBar.cxx | 23 + sfx2/source/sidebar/TitleBar.hxx | 2 svtools/source/control/tabbar.cxx | 4 vcl/source/control/button.cxx | 263 ++++++++++----------- vcl/source/control/edit.cxx | 186 +++++--------- vcl/source/control/scrbar.cxx | 33 +- vcl/source/control/spinbtn.cxx | 74 ++--- vcl/source/control/spinfld.cxx | 337 +++++++++++++-------------- 25 files changed, 638 insertions(+), 721 deletions(-)
New commits: commit 87d5859b1615fb165d6160baa50c5c5da3ca82c6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 18:29:48 2015 +0900 mbHasInsertTab is not needed anymore Change-Id: Icc7eb914a16d6492146879967a6dc8b634d50b6e diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index bd90be6..9d0ee92 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -347,7 +347,6 @@ private: bool mbSelColor : 1; bool mbSelTextColor : 1; bool mbMirrored : 1; - bool mbHasInsertTab : 1; // if true, the tab bar has an extra tab at the end. bool mbScrollAlwaysEnabled : 1; Link<> maSelectHdl; diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index ef1cb288..7df57d1 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -820,7 +820,7 @@ void TabBar::ImplInitControls() mpImpl->mpSizer.disposeAndClear(); } - if (mbHasInsertTab && !mpImpl->mpAddButton) + if ((mnWinStyle & WB_INSERTTAB) && !mpImpl->mpAddButton) { Link<> aLink = LINK(this, TabBar, ImplAddClickHandler); mpImpl->mpAddButton.reset(VclPtr<ImplTabButton>::Create(this, WB_REPEAT)); @@ -878,8 +878,6 @@ void TabBar::ImplInitControls() mpImpl->mpFirstButton.disposeAndClear(); mpImpl->mpLastButton.disposeAndClear(); } - - mbHasInsertTab = (mnWinStyle & WB_INSERTTAB); } void TabBar::ImplEnableControls() commit 5ccf67186d032be4e0200ff9e1771672c8566e44 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 18:29:22 2015 +0900 cleanup code Change-Id: I0fdcb3d179d87ae202199d2eb904e701bad45ab1 diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 2f86bab..fa49f99 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -207,60 +207,61 @@ void Button::ImplSetSeparatorX( long nX ) mpButtonData->mnSeparatorX = nX; } -DrawTextFlags Button::ImplGetTextStyle( OUString& rText, WinBits nWinStyle, - sal_uLong nDrawFlags ) +DrawTextFlags Button::ImplGetTextStyle(OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle( nWinStyle & ~WB_DEFBUTTON ); + DrawTextFlags nTextStyle = FixedText::ImplGetTextStyle(nWinStyle & ~WB_DEFBUTTON); - if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) + if (nDrawFlags & WINDOW_DRAW_NOMNEMONIC) { - if ( nTextStyle & DrawTextFlags::Mnemonic ) + if (nTextStyle & DrawTextFlags::Mnemonic) { rText = GetNonMnemonicString( rText ); nTextStyle &= ~DrawTextFlags::Mnemonic; } } - if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) + if (!(nDrawFlags & WINDOW_DRAW_NODISABLE)) { - if ( !IsEnabled() ) + if (!IsEnabled()) nTextStyle |= DrawTextFlags::Disable; } - if ( (nDrawFlags & WINDOW_DRAW_MONO) || - (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) + if ((nDrawFlags & WINDOW_DRAW_MONO) || + (rStyleSettings.GetOptions() & STYLE_OPTION_MONO)) + { nTextStyle |= DrawTextFlags::Mono; + } return nTextStyle; } -void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, - Size& rSize, bool bLayout, - sal_uLong nImageSep, sal_uLong nDrawFlags, - DrawTextFlags nTextStyle, Rectangle *pSymbolRect, - bool bAddImageSep ) +void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos, + Size& rSize, bool bLayout, + sal_uLong nImageSep, sal_uLong nDrawFlags, + DrawTextFlags nTextStyle, Rectangle *pSymbolRect, + bool bAddImageSep) { - OUString aText( GetText() ); - bool bDrawImage = HasImage() && ! ( ImplGetButtonState() & DrawButtonFlags::NoImage ); - bool bDrawText = !aText.isEmpty() && ! ( ImplGetButtonState() & DrawButtonFlags::NoText ); - bool bHasSymbol = pSymbolRect != nullptr; + OUString aText(GetText()); + bool bDrawImage = HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage); + bool bDrawText = !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText); + bool bHasSymbol = pSymbolRect != nullptr; // No text and no image => nothing to do => return - if ( !bDrawImage && !bDrawText && !bHasSymbol ) + if (!bDrawImage && !bDrawText && !bHasSymbol) return; - WinBits nWinStyle = GetStyle(); - Rectangle aOutRect( rPos, rSize ); - MetricVector *pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; - OUString *pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; - ImageAlign eImageAlign = mpButtonData->meImageAlign; - Size aImageSize = mpButtonData->maImage.GetSizePixel(); + WinBits nWinStyle = GetStyle(); + Rectangle aOutRect( rPos, rSize ); + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; + ImageAlign eImageAlign = mpButtonData->meImageAlign; + Size aImageSize = mpButtonData->maImage.GetSizePixel(); - if ( ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) && - ( nTextStyle & DrawTextFlags::Mnemonic ) ) + if ((nDrawFlags & WINDOW_DRAW_NOMNEMONIC) && + (nTextStyle & DrawTextFlags::Mnemonic)) { - aText = GetNonMnemonicString( aText ); + aText = GetNonMnemonicString(aText); nTextStyle &= ~DrawTextFlags::Mnemonic; } @@ -268,16 +269,16 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, aImageSize.Height() = CalcZoom( aImageSize.Height() ); // Drawing text or symbol only is simple, use style and output rectangle - if ( bHasSymbol && !bDrawImage && !bDrawText ) + if (bHasSymbol && !bDrawImage && !bDrawText) { *pSymbolRect = aOutRect; return; } - else if ( bDrawText && !bDrawImage && !bHasSymbol ) + else if (bDrawText && !bDrawImage && !bHasSymbol) { - DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); + DrawControlText(*pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText); - ImplSetFocusRect( aOutRect ); + ImplSetFocusRect(aOutRect); rSize = aOutRect.GetSize(); rPos = aOutRect.TopLeft(); @@ -285,81 +286,81 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } // check for HC mode ( image only! ) - Image *pImage = &(mpButtonData->maImage); + Image* pImage = &(mpButtonData->maImage); Size aTextSize; Size aSymbolSize; Size aMax; Point aImagePos = rPos; Point aTextPos = rPos; - Rectangle aUnion = Rectangle( aImagePos, aImageSize ); + Rectangle aUnion = Rectangle(aImagePos, aImageSize); Rectangle aSymbol; long nSymbolHeight = 0; - if ( bDrawText || bHasSymbol ) + if (bDrawText || bHasSymbol) { // Get the size of the text output area ( the symbol will be drawn in // this area as well, so the symbol rectangle will be calculated here, too ) - Rectangle aRect = Rectangle( Point(), rSize ); - Size aTSSize; + Rectangle aRect = Rectangle(Point(), rSize); + Size aTSSize; - if ( bHasSymbol ) + if (bHasSymbol) { - if ( bDrawText ) + if (bDrawText) { nSymbolHeight = pDev->GetTextHeight(); - if ( mpButtonData->mbSmallSymbol ) + if (mpButtonData->mbSmallSymbol) nSymbolHeight = nSymbolHeight * 3 / 4; - aSymbol = Rectangle( Point(), Size( nSymbolHeight, nSymbolHeight ) ); - ImplCalcSymbolRect( aSymbol ); + aSymbol = Rectangle(Point(), Size(nSymbolHeight, nSymbolHeight)); + ImplCalcSymbolRect(aSymbol); aRect.Left() += 3 * nSymbolHeight / 2; aTSSize.Width() = 3 * nSymbolHeight / 2; } else { - aSymbol = Rectangle( Point(), rSize ); - ImplCalcSymbolRect( aSymbol ); + aSymbol = Rectangle(Point(), rSize); + ImplCalcSymbolRect(aSymbol); aTSSize.Width() = aSymbol.GetWidth(); } aTSSize.Height() = aSymbol.GetHeight(); aSymbolSize = aSymbol.GetSize(); } - if ( bDrawText ) + if (bDrawText) { - if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) || - ( eImageAlign == IMAGEALIGN_LEFT ) || - ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) || - ( eImageAlign == IMAGEALIGN_RIGHT ) || - ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) ) + if ((eImageAlign == IMAGEALIGN_LEFT_TOP) || + (eImageAlign == IMAGEALIGN_LEFT ) || + (eImageAlign == IMAGEALIGN_LEFT_BOTTOM) || + (eImageAlign == IMAGEALIGN_RIGHT_TOP) || + (eImageAlign == IMAGEALIGN_RIGHT) || + (eImageAlign == IMAGEALIGN_RIGHT_BOTTOM)) { - aRect.Right() -= ( aImageSize.Width() + nImageSep ); + aRect.Right() -= (aImageSize.Width() + nImageSep); } - else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) || - ( eImageAlign == IMAGEALIGN_TOP ) || - ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) ) + else if ((eImageAlign == IMAGEALIGN_TOP_LEFT) || + (eImageAlign == IMAGEALIGN_TOP) || + (eImageAlign == IMAGEALIGN_TOP_RIGHT) || + (eImageAlign == IMAGEALIGN_BOTTOM_LEFT) || + (eImageAlign == IMAGEALIGN_BOTTOM) || + (eImageAlign == IMAGEALIGN_BOTTOM_RIGHT)) { - aRect.Bottom() -= ( aImageSize.Height() + nImageSep ); + aRect.Bottom() -= (aImageSize.Height() + nImageSep); } - aRect = pDev->GetTextRect( aRect, aText, nTextStyle ); + aRect = pDev->GetTextRect(aRect, aText, nTextStyle); aTextSize = aRect.GetSize(); aTSSize.Width() += aTextSize.Width(); - if ( aTSSize.Height() < aTextSize.Height() ) + if (aTSSize.Height() < aTextSize.Height()) aTSSize.Height() = aTextSize.Height(); - if( bAddImageSep && bDrawImage ) + if (bAddImageSep && bDrawImage) { long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3; - if( nDiff > 0 ) + if (nDiff > 0) nImageSep += nDiff; } } @@ -369,64 +370,64 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, // Now calculate the output area for the image and the text according to the image align flags - if ( ( eImageAlign == IMAGEALIGN_LEFT ) || - ( eImageAlign == IMAGEALIGN_RIGHT ) ) + if ((eImageAlign == IMAGEALIGN_LEFT) || + (eImageAlign == IMAGEALIGN_RIGHT)) { - aImagePos.Y() = rPos.Y() + ( aMax.Height() - aImageSize.Height() ) / 2; - aTextPos.Y() = rPos.Y() + ( aMax.Height() - aTSSize.Height() ) / 2; + aImagePos.Y() = rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2; + aTextPos.Y() = rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2; } - else if ( ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) ) + else if ((eImageAlign == IMAGEALIGN_LEFT_BOTTOM) || + (eImageAlign == IMAGEALIGN_RIGHT_BOTTOM)) { aImagePos.Y() = rPos.Y() + aMax.Height() - aImageSize.Height(); aTextPos.Y() = rPos.Y() + aMax.Height() - aTSSize.Height(); } - else if ( ( eImageAlign == IMAGEALIGN_TOP ) || - ( eImageAlign == IMAGEALIGN_BOTTOM ) ) + else if ((eImageAlign == IMAGEALIGN_TOP) || + (eImageAlign == IMAGEALIGN_BOTTOM)) { - aImagePos.X() = rPos.X() + ( aMax.Width() - aImageSize.Width() ) / 2; - aTextPos.X() = rPos.X() + ( aMax.Width() - aTSSize.Width() ) / 2; + aImagePos.X() = rPos.X() + (aMax.Width() - aImageSize.Width()) / 2; + aTextPos.X() = rPos.X() + (aMax.Width() - aTSSize.Width()) / 2; } - else if ( ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) ) + else if ((eImageAlign == IMAGEALIGN_TOP_RIGHT) || + (eImageAlign == IMAGEALIGN_BOTTOM_RIGHT)) { aImagePos.X() = rPos.X() + aMax.Width() - aImageSize.Width(); aTextPos.X() = rPos.X() + aMax.Width() - aTSSize.Width(); } - if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) || - ( eImageAlign == IMAGEALIGN_LEFT ) || - ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) ) + if ((eImageAlign == IMAGEALIGN_LEFT_TOP) || + (eImageAlign == IMAGEALIGN_LEFT) || + (eImageAlign == IMAGEALIGN_LEFT_BOTTOM)) { aTextPos.X() = rPos.X() + aImageSize.Width() + nImageSep; } - else if ( ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) || - ( eImageAlign == IMAGEALIGN_RIGHT ) || - ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) ) + else if ((eImageAlign == IMAGEALIGN_RIGHT_TOP) || + (eImageAlign == IMAGEALIGN_RIGHT) || + (eImageAlign == IMAGEALIGN_RIGHT_BOTTOM)) { aImagePos.X() = rPos.X() + aTSSize.Width() + nImageSep; } - else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) || - ( eImageAlign == IMAGEALIGN_TOP ) || - ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) ) + else if ((eImageAlign == IMAGEALIGN_TOP_LEFT) || + (eImageAlign == IMAGEALIGN_TOP) || + (eImageAlign == IMAGEALIGN_TOP_RIGHT)) { aTextPos.Y() = rPos.Y() + aImageSize.Height() + nImageSep; } - else if ( ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) || - ( eImageAlign == IMAGEALIGN_BOTTOM ) || - ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) ) + else if ((eImageAlign == IMAGEALIGN_BOTTOM_LEFT) || + (eImageAlign == IMAGEALIGN_BOTTOM) || + (eImageAlign == IMAGEALIGN_BOTTOM_RIGHT)) { aImagePos.Y() = rPos.Y() + aTSSize.Height() + nImageSep; } - else if ( eImageAlign == IMAGEALIGN_CENTER ) + else if (eImageAlign == IMAGEALIGN_CENTER) { - aImagePos.X() = rPos.X() + ( aMax.Width() - aImageSize.Width() ) / 2; - aImagePos.Y() = rPos.Y() + ( aMax.Height() - aImageSize.Height() ) / 2; - aTextPos.X() = rPos.X() + ( aMax.Width() - aTSSize.Width() ) / 2; - aTextPos.Y() = rPos.Y() + ( aMax.Height() - aTSSize.Height() ) / 2; + aImagePos.X() = rPos.X() + (aMax.Width() - aImageSize.Width()) / 2; + aImagePos.Y() = rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2; + aTextPos.X() = rPos.X() + (aMax.Width() - aTSSize.Width()) / 2; + aTextPos.Y() = rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2; } - aUnion = Rectangle( aImagePos, aImageSize ); - aUnion.Union( Rectangle( aTextPos, aTSSize ) ); + aUnion = Rectangle(aImagePos, aImageSize); + aUnion.Union(Rectangle(aTextPos, aTSSize)); } // Now place the combination of text and image in the output area of the button @@ -434,27 +435,27 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, long nXOffset = 0; long nYOffset = 0; - if ( nWinStyle & WB_CENTER ) + if (nWinStyle & WB_CENTER) { - nXOffset = ( rSize.Width() - aUnion.GetWidth() ) / 2; + nXOffset = (rSize.Width() - aUnion.GetWidth()) / 2; } - else if ( nWinStyle & WB_RIGHT ) + else if (nWinStyle & WB_RIGHT) { nXOffset = rSize.Width() - aUnion.GetWidth(); } - if ( nWinStyle & WB_VCENTER ) + if (nWinStyle & WB_VCENTER) { - nYOffset = ( rSize.Height() - aUnion.GetHeight() ) / 2; + nYOffset = (rSize.Height() - aUnion.GetHeight()) / 2; } - else if ( nWinStyle & WB_BOTTOM ) + else if (nWinStyle & WB_BOTTOM) { nYOffset = rSize.Height() - aUnion.GetHeight(); } // the top left corner should always be visible, so we don't allow negative offsets - if ( nXOffset < 0 ) nXOffset = 0; - if ( nYOffset < 0 ) nYOffset = 0; + if (nXOffset < 0) nXOffset = 0; + if (nYOffset < 0) nYOffset = 0; aImagePos.X() += nXOffset; aImagePos.Y() += nYOffset; @@ -466,53 +467,55 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, rPos.X() += nXOffset; rPos.Y() += nYOffset; - if ( bHasSymbol ) + if (bHasSymbol) { - if ( mpButtonData->meSymbolAlign == SymbolAlign::RIGHT ) + if (mpButtonData->meSymbolAlign == SymbolAlign::RIGHT) { - Point aRightPos = Point( aTextPos.X() + aTextSize.Width() + aSymbolSize.Width()/2, aTextPos.Y() ); - *pSymbolRect = Rectangle( aRightPos, aSymbolSize ); + Point aRightPos = Point(aTextPos.X() + aTextSize.Width() + aSymbolSize.Width() / 2, aTextPos.Y()); + *pSymbolRect = Rectangle(aRightPos, aSymbolSize); } else { - *pSymbolRect = Rectangle( aTextPos, aSymbolSize ); - aTextPos.X() += ( 3 * nSymbolHeight / 2 ); + *pSymbolRect = Rectangle(aTextPos, aSymbolSize); + aTextPos.X() += 3 * nSymbolHeight / 2; } - if ( mpButtonData->mbSmallSymbol ) + if (mpButtonData->mbSmallSymbol) { - nYOffset = (aUnion.GetHeight() - aSymbolSize.Height())/2; - pSymbolRect->setY( aTextPos.Y() + nYOffset ); + nYOffset = (aUnion.GetHeight() - aSymbolSize.Height()) / 2; + pSymbolRect->setY(aTextPos.Y() + nYOffset); } } DrawImageFlags nStyle = DrawImageFlags::NONE; - if ( ! ( nDrawFlags & WINDOW_DRAW_NODISABLE ) && - ! IsEnabled() ) + if (!(nDrawFlags & WINDOW_DRAW_NODISABLE) && + !IsEnabled()) + { nStyle |= DrawImageFlags::Disable; + } - if ( IsZoom() ) - pDev->DrawImage( aImagePos, aImageSize, *pImage, nStyle ); + if (IsZoom()) + pDev->DrawImage(aImagePos, aImageSize, *pImage, nStyle); else - pDev->DrawImage( aImagePos, *pImage, nStyle ); + pDev->DrawImage(aImagePos, *pImage, nStyle); - if ( bDrawText ) + if (bDrawText) { - ImplSetFocusRect( Rectangle( aTextPos, aTextSize ) ); - pDev->DrawText( Rectangle( aTextPos, aTextSize ), aText, nTextStyle, pVector, pDisplayText ); + ImplSetFocusRect(Rectangle(aTextPos, aTextSize)); + pDev->DrawText(Rectangle(aTextPos, aTextSize), aText, nTextStyle, pVector, pDisplayText); } else { - ImplSetFocusRect( Rectangle( aImagePos, aImageSize ) ); + ImplSetFocusRect(Rectangle(aImagePos, aImageSize)); } } -void Button::ImplSetFocusRect( const Rectangle &rFocusRect ) +void Button::ImplSetFocusRect(const Rectangle &rFocusRect) { Rectangle aFocusRect = rFocusRect; - Rectangle aOutputRect = Rectangle( Point(), GetOutputSizePixel() ); + Rectangle aOutputRect = Rectangle(Point(), GetOutputSizePixel()); - if ( ! aFocusRect.IsEmpty() ) + if (!aFocusRect.IsEmpty()) { aFocusRect.Left()--; aFocusRect.Top()--; @@ -520,10 +523,14 @@ void Button::ImplSetFocusRect( const Rectangle &rFocusRect ) aFocusRect.Bottom()++; } - if ( aFocusRect.Left() < aOutputRect.Left() ) aFocusRect.Left() = aOutputRect.Left(); - if ( aFocusRect.Top() < aOutputRect.Top() ) aFocusRect.Top() = aOutputRect.Top(); - if ( aFocusRect.Right() > aOutputRect.Right() ) aFocusRect.Right() = aOutputRect.Right(); - if ( aFocusRect.Bottom() > aOutputRect.Bottom() ) aFocusRect.Bottom() = aOutputRect.Bottom(); + if (aFocusRect.Left() < aOutputRect.Left()) + aFocusRect.Left() = aOutputRect.Left(); + if (aFocusRect.Top() < aOutputRect.Top()) + aFocusRect.Top() = aOutputRect.Top(); + if (aFocusRect.Right() > aOutputRect.Right()) + aFocusRect.Right() = aOutputRect.Right(); + if (aFocusRect.Bottom() > aOutputRect.Bottom()) + aFocusRect.Bottom() = aOutputRect.Bottom(); mpButtonData->maFocusRect = aFocusRect; } diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index a3f4aa8..2f196d6 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -35,12 +35,12 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) mnValue = 0; mnValueStep = 1; - maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); - maRepeatTimer.SetTimeoutHdl( LINK( this, SpinButton, ImplTimeout ) ); + maRepeatTimer.SetTimeout(GetSettings().GetMouseSettings().GetButtonStartRepeat()); + maRepeatTimer.SetTimeoutHdl(LINK(this, SpinButton, ImplTimeout)); - mbRepeat = 0 != ( nStyle & WB_REPEAT ); + mbRepeat = 0 != (nStyle & WB_REPEAT); - if ( nStyle & WB_HSCROLL ) + if (nStyle & WB_HSCROLL) mbHorz = true; else mbHorz = false; @@ -49,22 +49,22 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) } SpinButton::SpinButton( vcl::Window* pParent, WinBits nStyle ) - :Control( WINDOW_SPINBUTTON ) - ,mbUpperIsFocused( false ) + : Control(WINDOW_SPINBUTTON) + , mbUpperIsFocused(false) { - ImplInit( pParent, nStyle ); + ImplInit(pParent, nStyle); } -IMPL_LINK_TYPED( SpinButton, ImplTimeout, Timer*, pTimer, void ) +IMPL_LINK_TYPED(SpinButton, ImplTimeout, Timer*, pTimer, void) { - if ( pTimer->GetTimeout() == GetSettings().GetMouseSettings().GetButtonStartRepeat() ) + if (pTimer->GetTimeout() == GetSettings().GetMouseSettings().GetButtonStartRepeat()) { pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() ); pTimer->Start(); } else { - if ( mbInitialUp ) + if (mbInitialUp) Up(); else Down(); @@ -73,57 +73,57 @@ IMPL_LINK_TYPED( SpinButton, ImplTimeout, Timer*, pTimer, void ) void SpinButton::Up() { - if ( ImplIsUpperEnabled() ) + if (ImplIsUpperEnabled()) { mnValue += mnValueStep; - StateChanged( StateChangedType::Data ); + StateChanged(StateChangedType::Data); - ImplMoveFocus( true ); + ImplMoveFocus(true); } - ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this ); + ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this); } void SpinButton::Down() { - if ( ImplIsLowerEnabled() ) + if (ImplIsLowerEnabled()) { mnValue -= mnValueStep; - StateChanged( StateChangedType::Data ); + StateChanged(StateChangedType::Data); - ImplMoveFocus( false ); + ImplMoveFocus(false); } - ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this ); + ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this); } void SpinButton::Resize() { Control::Resize(); - Size aSize( GetOutputSizePixel() ); + Size aSize(GetOutputSizePixel()); Point aTmpPoint; - Rectangle aRect( aTmpPoint, aSize ); - if ( mbHorz ) + Rectangle aRect(aTmpPoint, aSize); + if (mbHorz) { - maLowerRect = Rectangle( 0, 0, aSize.Width()/2, aSize.Height()-1 ); - maUpperRect = Rectangle( maLowerRect.TopRight(), aRect.BottomRight() ); + maLowerRect = Rectangle(0, 0, aSize.Width() / 2, aSize.Height() - 1); + maUpperRect = Rectangle(maLowerRect.TopRight(), aRect.BottomRight()); } else { - maUpperRect = Rectangle( 0, 0, aSize.Width()-1, aSize.Height()/2 ); - maLowerRect = Rectangle( maUpperRect.BottomLeft(), aRect.BottomRight() ); + maUpperRect = Rectangle(0, 0, aSize.Width() - 1, aSize.Height() / 2); + maLowerRect = Rectangle(maUpperRect.BottomLeft(), aRect.BottomRight()); } - ImplCalcFocusRect( ImplIsUpperEnabled() || !ImplIsLowerEnabled() ); + ImplCalcFocusRect(ImplIsUpperEnabled() || !ImplIsLowerEnabled()); Invalidate(); } -void SpinButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) +void SpinButton::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags) { - Point aPos = pDev->LogicToPixel( rPos ); - Size aSize = pDev->LogicToPixel( rSize ); + Point aPos = pDev->LogicToPixel(rPos); + Size aSize = pDev->LogicToPixel(rSize); pDev->Push(); pDev->SetMapMode(); @@ -440,30 +440,30 @@ bool SpinButton::PreNotify( NotifyEvent& rNEvt ) { const MouseEvent* pMouseEvt = NULL; - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL ) + if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + if (!pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) { // trigger redraw if mouse over state has changed - if( IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) || + if (IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) || IsNativeControlSupported(CTRL_SPINBOX, PART_ALL_BUTTONS) ) { Rectangle* pRect = ImplFindPartRect( GetPointerPosPixel() ); Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); - if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) ) + if (pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow())) { - vcl::Region aRgn( GetActiveClipRegion() ); - if( pLastRect ) + vcl::Region aRgn(GetActiveClipRegion()); + if (pLastRect) { SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); SetClipRegion( aRgn ); } - if( pRect ) + if (pRect) { SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); - SetClipRegion( aRgn ); + SetClipRegion(aRgn); } } } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 82559d5..28cf70f 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -90,14 +90,14 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window* pW vcl::Window* pBorder = pWin->GetWindow(WINDOW_BORDER); // to not overwrite everything, set the button region as clipregion to the border window - Rectangle aClipRect( rSpinbuttonValue.maLowerRect ); - aClipRect.Union( rSpinbuttonValue.maUpperRect ); + Rectangle aClipRect(rSpinbuttonValue.maLowerRect); + aClipRect.Union(rSpinbuttonValue.maUpperRect); // convert from screen space to borderwin space aClipRect.SetPos(pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft()))); vcl::Region oldRgn(pBorder->GetClipRegion()); - pBorder->SetClipRegion( vcl::Region( aClipRect ) ); + pBorder->SetClipRegion(vcl::Region(aClipRect)); Point aPt; Size aSize(pBorder->GetOutputSizePixel()); // the size of the border window, i.e., the whole control @@ -179,7 +179,7 @@ void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow // draw upper/left Button DrawButtonFlags nTempStyle = nStyle; - if ( bUpperIn ) + if (bUpperIn) nTempStyle |= DrawButtonFlags::Pressed; bool bNativeOK = false; @@ -293,11 +293,11 @@ void SpinField::ImplInitSpinFieldData() mbInDropDown = false; } -void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle ) +void SpinField::ImplInit(vcl::Window* pParent, WinBits nWinStyle) { Edit::ImplInit( pParent, nWinStyle ); - if ( nWinStyle & (WB_SPIN|WB_DROPDOWN) ) + if (nWinStyle & (WB_SPIN | WB_DROPDOWN)) { mbSpin = true; @@ -307,49 +307,50 @@ void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle ) if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*this, nWinStyle)) { SetBackground(); - mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) ); + mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER)); mpEdit->SetBackground(); } else - mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) ); + mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER)); - mpEdit->EnableRTL( false ); - mpEdit->SetPosPixel( Point() ); + mpEdit->EnableRTL(false); + mpEdit->SetPosPixel(Point()); mpEdit->Show(); - SetSubEdit( mpEdit ); - maRepeatTimer.SetTimeoutHdl( LINK( this, SpinField, ImplTimeout ) ); - maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); - if ( nWinStyle & WB_REPEAT ) + SetSubEdit(mpEdit); + + maRepeatTimer.SetTimeoutHdl(LINK( this, SpinField, ImplTimeout)); + maRepeatTimer.SetTimeout(GetSettings().GetMouseSettings().GetButtonStartRepeat()); + if (nWinStyle & WB_REPEAT) mbRepeat = true; - SetCompoundControl( true ); + SetCompoundControl(true); } } -SpinField::SpinField( WindowType nTyp ) : - Edit( nTyp ) +SpinField::SpinField(WindowType nTyp) : + Edit(nTyp) { ImplInitSpinFieldData(); } -SpinField::SpinField( vcl::Window* pParent, WinBits nWinStyle ) : - Edit( WINDOW_SPINFIELD ) +SpinField::SpinField(vcl::Window* pParent, WinBits nWinStyle) : + Edit(WINDOW_SPINFIELD) { ImplInitSpinFieldData(); - ImplInit( pParent, nWinStyle ); + ImplInit(pParent, nWinStyle); } -SpinField::SpinField( vcl::Window* pParent, const ResId& rResId ) : - Edit( WINDOW_SPINFIELD ) +SpinField::SpinField(vcl::Window* pParent, const ResId& rResId) : + Edit(WINDOW_SPINFIELD) { ImplInitSpinFieldData(); - rResId.SetRT( RSC_SPINFIELD ); - WinBits nStyle = ImplInitRes( rResId ); - ImplInit( pParent, nStyle ); - ImplLoadRes( rResId ); + rResId.SetRT(RSC_SPINFIELD); + WinBits nStyle = ImplInitRes(rResId); + ImplInit(pParent, nStyle); + ImplLoadRes(rResId); - if ( !(nStyle & WB_HIDE) ) + if (!(nStyle & WB_HIDE)) Show(); } @@ -387,130 +388,130 @@ void SpinField::Last() void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) { - if ( !HasFocus() && ( !mpEdit || !mpEdit->HasFocus() ) ) + if (!HasFocus() && (!mpEdit || !mpEdit->HasFocus())) { mbNoSelect = true; GrabFocus(); } - if ( !IsReadOnly() ) + if (!IsReadOnly()) { - if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) ) + if (maUpperRect.IsInside(rMEvt.GetPosPixel())) { mbUpperIn = true; mbInitialUp = true; - Invalidate( maUpperRect ); + Invalidate(maUpperRect); } - else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) ) + else if (maLowerRect.IsInside(rMEvt.GetPosPixel())) { mbLowerIn = true; mbInitialDown = true; - Invalidate( maLowerRect ); + Invalidate(maLowerRect); } - else if ( maDropDownRect.IsInside( rMEvt.GetPosPixel() ) ) + else if (maDropDownRect.IsInside(rMEvt.GetPosPixel())) { // put DropDownButton to the right mbInDropDown = ShowDropDown( !mbInDropDown ); Invalidate(Rectangle(Point(), GetOutputSizePixel())); } - if ( mbUpperIn || mbLowerIn ) + if (mbUpperIn || mbLowerIn) { Update(); CaptureMouse(); - if ( mbRepeat ) + if (mbRepeat) maRepeatTimer.Start(); return; } } - Edit::MouseButtonDown( rMEvt ); + Edit::MouseButtonDown(rMEvt); } -void SpinField::MouseButtonUp( const MouseEvent& rMEvt ) +void SpinField::MouseButtonUp(const MouseEvent& rMEvt) { ReleaseMouse(); mbInitialUp = mbInitialDown = false; maRepeatTimer.Stop(); - maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); + maRepeatTimer.SetTimeout(GetSettings().GetMouseSettings().GetButtonStartRepeat()); - if ( mbUpperIn ) + if (mbUpperIn) { mbUpperIn = false; - Invalidate( maUpperRect ); + Invalidate(maUpperRect); Update(); Up(); } - else if ( mbLowerIn ) + else if (mbLowerIn) { mbLowerIn = false; - Invalidate( maLowerRect ); + Invalidate(maLowerRect); Update(); Down(); } - Edit::MouseButtonUp( rMEvt ); + Edit::MouseButtonUp(rMEvt); } -void SpinField::MouseMove( const MouseEvent& rMEvt ) +void SpinField::MouseMove(const MouseEvent& rMEvt) { - if ( rMEvt.IsLeft() ) + if (rMEvt.IsLeft()) { - if ( mbInitialUp ) + if (mbInitialUp) { - bool bNewUpperIn = maUpperRect.IsInside( rMEvt.GetPosPixel() ); - if ( bNewUpperIn != mbUpperIn ) + bool bNewUpperIn = maUpperRect.IsInside(rMEvt.GetPosPixel()); + if (bNewUpperIn != mbUpperIn) { - if ( bNewUpperIn ) + if (bNewUpperIn) { - if ( mbRepeat ) + if (mbRepeat) maRepeatTimer.Start(); } else maRepeatTimer.Stop(); mbUpperIn = bNewUpperIn; - Invalidate( maUpperRect ); + Invalidate(maUpperRect); Update(); } } - else if ( mbInitialDown ) + else if (mbInitialDown) { - bool bNewLowerIn = maLowerRect.IsInside( rMEvt.GetPosPixel() ); - if ( bNewLowerIn != mbLowerIn ) + bool bNewLowerIn = maLowerRect.IsInside(rMEvt.GetPosPixel()); + if (bNewLowerIn != mbLowerIn) { - if ( bNewLowerIn ) + if (bNewLowerIn) { - if ( mbRepeat ) + if (mbRepeat) maRepeatTimer.Start(); } else maRepeatTimer.Stop(); mbLowerIn = bNewLowerIn; - Invalidate( maLowerRect ); + Invalidate(maLowerRect); Update(); } } } - Edit::MouseMove( rMEvt ); + Edit::MouseMove(rMEvt); } -bool SpinField::Notify( NotifyEvent& rNEvt ) +bool SpinField::Notify(NotifyEvent& rNEvt) { bool nDone = false; - if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) { const KeyEvent& rKEvt = *rNEvt.GetKeyEvent(); - if ( !IsReadOnly() ) + if (!IsReadOnly()) { sal_uInt16 nMod = rKEvt.GetKeyCode().GetModifier(); - switch ( rKEvt.GetKeyCode().GetCode() ) + switch (rKEvt.GetKeyCode().GetCode()) { case KEY_UP: { - if ( !nMod ) + if (!nMod) { Up(); nDone = true; @@ -519,14 +520,14 @@ bool SpinField::Notify( NotifyEvent& rNEvt ) break; case KEY_DOWN: { - if ( !nMod ) + if (!nMod) { Down(); nDone = true; } - else if ( ( nMod == KEY_MOD2 ) && !mbInDropDown && ( GetStyle() & WB_DROPDOWN ) ) + else if ((nMod == KEY_MOD2) && !mbInDropDown && (GetStyle() & WB_DROPDOWN)) { - mbInDropDown = ShowDropDown( true ); + mbInDropDown = ShowDropDown(true); Invalidate(Rectangle(Point(), GetOutputSizePixel())); nDone = true; } @@ -534,7 +535,7 @@ bool SpinField::Notify( NotifyEvent& rNEvt ) break; case KEY_PAGEUP: { - if ( !nMod ) + if (!nMod) { Last(); nDone = true; @@ -543,7 +544,7 @@ bool SpinField::Notify( NotifyEvent& rNEvt ) break; case KEY_PAGEDOWN: { - if ( !nMod ) + if (!nMod) { First(); nDone = true; @@ -554,21 +555,18 @@ bool SpinField::Notify( NotifyEvent& rNEvt ) } } - if ( rNEvt.GetType() == MouseNotifyEvent::COMMAND ) + if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) { - if ( ( rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel ) && !IsReadOnly() ) + if ((rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel) && !IsReadOnly()) { - sal_uInt16 nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); - if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS ) - || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY ) - && HasChildPathFocus() - ) - ) + sal_uInt16 nWheelBehavior(GetSettings().GetMouseSettings().GetWheelBehavior()); + if (nWheelBehavior == MOUSE_WHEEL_ALWAYS + || (nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY && HasChildPathFocus())) { const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); - if ( pData->GetMode() == CommandWheelMode::SCROLL ) + if (pData->GetMode() == CommandWheelMode::SCROLL) { - if ( pData->GetDelta() < 0L ) + if (pData->GetDelta() < 0L) Down(); else Up(); @@ -580,27 +578,27 @@ bool SpinField::Notify( NotifyEvent& rNEvt ) } } - return nDone || Edit::Notify( rNEvt ); + return nDone || Edit::Notify(rNEvt); } -void SpinField::Command( const CommandEvent& rCEvt ) +void SpinField::Command(const CommandEvent& rCEvt) { - Edit::Command( rCEvt ); + Edit::Command(rCEvt); } void SpinField::FillLayoutData() const { - if( mbSpin ) + if (mbSpin) { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); - AppendLayoutData( *GetSubEdit() ); - GetSubEdit()->SetLayoutDataParent( this ); + AppendLayoutData(*GetSubEdit()); + GetSubEdit()->SetLayoutDataParent(this); } else Edit::FillLayoutData(); } -void SpinField::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) +void SpinField::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { if (mbSpin) { @@ -629,14 +627,15 @@ void SpinField::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRec Edit::Paint(rRenderContext, rRect); } -void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rectangle& rDDArea, Rectangle& rSpinUpArea, Rectangle& rSpinDownArea ) +void SpinField::ImplCalcButtonAreas(OutputDevice* pDev, const Size& rOutSz, Rectangle& rDDArea, + Rectangle& rSpinUpArea, Rectangle& rSpinDownArea) { const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); Size aSize = rOutSz; Size aDropDownSize; - if ( GetStyle() & WB_DROPDOWN ) + if (GetStyle() & WB_DROPDOWN) { long nW = rStyleSettings.GetScrollBarSize(); nW = GetDrawPixel( pDev, nW ); @@ -649,7 +648,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec rDDArea.SetEmpty(); // calcuate sizes according to the height - if ( GetStyle() & WB_SPIN ) + if (GetStyle() & WB_SPIN) { long nBottom1 = aSize.Height()/2; long nBottom2 = aSize.Height()-1; @@ -661,10 +660,10 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec bool bNativeRegionOK = false; Rectangle aContentUp, aContentDown; - if ( (pDev->GetOutDevType() == OUTDEV_WINDOW) && + if ((pDev->GetOutDevType() == OUTDEV_WINDOW) && // there is just no useful native support for spinfields with dropdown ! (GetStyle() & WB_DROPDOWN) && - IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) ) + IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL)) { vcl::Window *pWin = static_cast<vcl::Window*>(pDev); vcl::Window *pBorder = pWin->GetWindow( WINDOW_BORDER ); @@ -683,7 +682,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec pWin->GetNativeControlRegion(CTRL_SPINBOX, PART_BUTTON_DOWN, aArea, ControlState::NONE, aControlValue, OUString(), aBound, aContentDown); - if( bNativeRegionOK ) + if (bNativeRegionOK) { // convert back from border space to local coordinates aPoint = pBorder->ScreenToOutputPixel( pWin->OutputToScreenPixel( aPoint ) ); @@ -692,7 +691,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec } } - if( bNativeRegionOK ) + if (bNativeRegionOK) { rSpinUpArea = aContentUp; rSpinDownArea = aContentDown; @@ -714,13 +713,13 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec void SpinField::Resize() { - if ( mbSpin ) + if (mbSpin) { Control::Resize(); Size aSize = GetOutputSizePixel(); bool bSubEditPositioned = false; - if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) ) + if (GetStyle() & (WB_SPIN | WB_DROPDOWN)) { ImplCalcButtonAreas( this, aSize, maDropDownRect, maUpperRect, maLowerRect ); @@ -733,11 +732,11 @@ void SpinField::Resize() Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() ); // adjust position and size of the edit field - if ( GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT, - aArea, ControlState::NONE, aControlValue, OUString(), aBound, aContent) ) + if (GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT, aArea, ControlState::NONE, + aControlValue, OUString(), aBound, aContent)) { // convert back from border space to local coordinates - aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aPoint ) ); + aPoint = pBorder->ScreenToOutputPixel(OutputToScreenPixel(aPoint)); aContent.Move(-aPoint.X(), -aPoint.Y()); // use the themes drop down size @@ -747,7 +746,7 @@ void SpinField::Resize() } else { - if ( maUpperRect.IsEmpty() ) + if (maUpperRect.IsEmpty()) { DBG_ASSERT( !maDropDownRect.IsEmpty(), "SpinField::Resize: SPIN && DROPDOWN, but all empty rects?" ); aSize.Width() = maDropDownRect.Left(); @@ -757,108 +756,108 @@ void SpinField::Resize() } } - if( ! bSubEditPositioned ) + if (!bSubEditPositioned) { // this moves our sub edit if RTL gets switched - mpEdit->SetPosPixel( Point() ); + mpEdit->SetPosPixel(Point()); } - mpEdit->SetSizePixel( aSize ); + mpEdit->SetSizePixel(aSize); - if ( GetStyle() & WB_SPIN ) - Invalidate( Rectangle( maUpperRect.TopLeft(), maLowerRect.BottomRight() ) ); - if ( GetStyle() & WB_DROPDOWN ) - Invalidate( maDropDownRect ); + if (GetStyle() & WB_SPIN) + Invalidate(Rectangle(maUpperRect.TopLeft(), maLowerRect.BottomRight())); + if (GetStyle() & WB_DROPDOWN) + Invalidate(maDropDownRect); } } -void SpinField::StateChanged( StateChangedType nType ) +void SpinField::StateChanged(StateChangedType nType) { - Edit::StateChanged( nType ); + Edit::StateChanged(nType); - if ( nType == StateChangedType::Enable ) + if (nType == StateChangedType::Enable) { - if ( mbSpin || ( GetStyle() & WB_DROPDOWN ) ) + if (mbSpin || (GetStyle() & WB_DROPDOWN)) { - mpEdit->Enable( IsEnabled() ); + mpEdit->Enable(IsEnabled()); - if ( mbSpin ) + if (mbSpin) { - Invalidate( maLowerRect ); - Invalidate( maUpperRect ); + Invalidate(maLowerRect); + Invalidate(maUpperRect); } - if ( GetStyle() & WB_DROPDOWN ) - Invalidate( maDropDownRect ); + if (GetStyle() & WB_DROPDOWN) + Invalidate(maDropDownRect); } } - else if ( nType == StateChangedType::Style ) + else if (nType == StateChangedType::Style) { - if ( GetStyle() & WB_REPEAT ) + if (GetStyle() & WB_REPEAT) mbRepeat = true; else mbRepeat = false; } - else if ( nType == StateChangedType::Zoom ) + else if (nType == StateChangedType::Zoom) { Resize(); - if ( mpEdit ) - mpEdit->SetZoom( GetZoom() ); + if (mpEdit) + mpEdit->SetZoom(GetZoom()); Invalidate(); } - else if ( nType == StateChangedType::ControlFont ) + else if (nType == StateChangedType::ControlFont) { - if ( mpEdit ) - mpEdit->SetControlFont( GetControlFont() ); + if (mpEdit) + mpEdit->SetControlFont(GetControlFont()); Invalidate(); } - else if ( nType == StateChangedType::ControlForeground ) + else if (nType == StateChangedType::ControlForeground) { - if ( mpEdit ) - mpEdit->SetControlForeground( GetControlForeground() ); + if (mpEdit) + mpEdit->SetControlForeground(GetControlForeground()); Invalidate(); } - else if ( nType == StateChangedType::ControlBackground ) + else if (nType == StateChangedType::ControlBackground) { - if ( mpEdit ) - mpEdit->SetControlBackground( GetControlBackground() ); + if (mpEdit) + mpEdit->SetControlBackground(GetControlBackground()); Invalidate(); } else if( nType == StateChangedType::Mirroring ) { - if( mpEdit ) - mpEdit->StateChanged( StateChangedType::Mirroring ); + if (mpEdit) + mpEdit->StateChanged(StateChangedType::Mirroring); Resize(); } } void SpinField::DataChanged( const DataChangedEvent& rDCEvt ) { - Edit::DataChanged( rDCEvt ); + Edit::DataChanged(rDCEvt); - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) + if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) { Resize(); Invalidate(); } } -Rectangle* SpinField::ImplFindPartRect( const Point& rPt ) +Rectangle* SpinField::ImplFindPartRect(const Point& rPt) { - if( maUpperRect.IsInside( rPt ) ) + if (maUpperRect.IsInside(rPt)) return &maUpperRect; - else if( maLowerRect.IsInside( rPt ) ) + else if (maLowerRect.IsInside(rPt)) return &maLowerRect; else return NULL; } -bool SpinField::PreNotify( NotifyEvent& rNEvt ) +bool SpinField::PreNotify(NotifyEvent& rNEvt) { const MouseEvent* pMouseEvt = NULL; - if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL ) + if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL) { - if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) + if (!pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()) { // trigger redraw if mouse over state has changed if( IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) || @@ -870,23 +869,22 @@ bool SpinField::PreNotify( NotifyEvent& rNEvt ) { // FIXME: this is currently only on OS X // check for other platforms that need similar handling - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - IsNativeControlSupported( CTRL_EDITBOX, PART_ENTIRE_CONTROL ) ) + if (ImplGetSVData()->maNWFData.mbNoFocusRects && IsNativeWidgetEnabled() && + IsNativeControlSupported(CTRL_EDITBOX, PART_ENTIRE_CONTROL)) { - ImplInvalidateOutermostBorder( this ); + ImplInvalidateOutermostBorder(this); } else { // paint directly vcl::Region aRgn( GetActiveClipRegion() ); - if( pLastRect ) + if (pLastRect) { SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); SetClipRegion( aRgn ); } - if( pRect ) + if (pRect) { SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); @@ -979,9 +977,9 @@ IMPL_LINK_TYPED( SpinField, ImplTimeout, Timer*, pTimer, void ) } } -void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) +void SpinField::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags) { - Edit::Draw( pDev, rPos, rSize, nFlags ); + Edit::Draw(pDev, rPos, rSize, nFlags); WinBits nFieldStyle = GetStyle(); if ( !(nFlags & WINDOW_DRAW_NOCONTROLS ) && ( nFieldStyle & (WB_SPIN|WB_DROPDOWN) ) ) @@ -994,49 +992,49 @@ void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->Push(); pDev->SetMapMode(); - if ( eOutDevType == OUTDEV_PRINTER ) + if (eOutDevType == OUTDEV_PRINTER) { StyleSettings aStyleSettings = aOldSettings.GetStyleSettings(); - aStyleSettings.SetFaceColor( COL_LIGHTGRAY ); - aStyleSettings.SetButtonTextColor( COL_BLACK ); - AllSettings aSettings( aOldSettings ); - aSettings.SetStyleSettings( aStyleSettings ); - pDev->SetSettings( aSettings ); + aStyleSettings.SetFaceColor(COL_LIGHTGRAY); + aStyleSettings.SetButtonTextColor(COL_BLACK); + AllSettings aSettings(aOldSettings); + aSettings.SetStyleSettings(aStyleSettings); + pDev->SetSettings(aSettings); } Rectangle aDD, aUp, aDown; - ImplCalcButtonAreas( pDev, aSize, aDD, aUp, aDown ); - aDD.Move( aPos.X(), aPos.Y() ); - aUp.Move( aPos.X(), aPos.Y() ); + ImplCalcButtonAreas(pDev, aSize, aDD, aUp, aDown); + aDD.Move(aPos.X(), aPos.Y()); + aUp.Move(aPos.X(), aPos.Y()); aUp.Top()++; - aDown.Move( aPos.X(), aPos.Y() ); + aDown.Move(aPos.X(), aPos.Y()); Color aButtonTextColor; - if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) ) + if ((nFlags & WINDOW_DRAW_MONO) || (eOutDevType == OUTDEV_PRINTER)) aButtonTextColor = Color( COL_BLACK ); else aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor(); - if ( GetStyle() & WB_DROPDOWN ) + if (GetStyle() & WB_DROPDOWN) { DecorationView aView( pDev ); DrawButtonFlags nStyle = DrawButtonFlags::NoLightBorder; Rectangle aInnerRect = aView.DrawButton( aDD, nStyle ); SymbolType eSymbol = SymbolType::SPIN_DOWN; - if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN ) + if (GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN) eSymbol = SymbolType::SPIN_UPDOWN; - DrawSymbolFlags nSymbolStyle = ( IsEnabled() || ( nFlags & WINDOW_DRAW_NODISABLE ) ) ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable; - aView.DrawSymbol( aInnerRect, eSymbol, aButtonTextColor, nSymbolStyle ); + DrawSymbolFlags nSymbolStyle = (IsEnabled() || (nFlags & WINDOW_DRAW_NODISABLE)) ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable; + aView.DrawSymbol(aInnerRect, eSymbol, aButtonTextColor, nSymbolStyle); } - if ( GetStyle() & WB_SPIN ) + if (GetStyle() & WB_SPIN) { - ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false, true, true ); + ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false, true, true); } pDev->Pop(); - pDev->SetSettings( aOldSettings ); + pDev->SetSettings(aOldSettings); } } commit 9c869aecc83dc3899a0941058acfcac791fca519 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 18:25:49 2015 +0900 fixes for changes in "edit" Change-Id: Ied0f44e38ac52f13c9c229366342849aa29ec754 diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 7714c24..2f86bab 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -961,7 +961,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLa if (aCtrlType == CTRL_COMBOBOX) { Edit* pEdit = static_cast<Edit*>(GetParent()); - if (pEdit->ImplUseNativeBorder(pEdit->GetStyle())) + if (pEdit->ImplUseNativeBorder(rRenderContext, pEdit->GetStyle())) bNativeOK = true; } else if (GetParent()->IsNativeControlSupported(aCtrlType, HAS_BACKGROUND_TEXTURE)) diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index aeef55b..82559d5 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -304,7 +304,7 @@ void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle ) // Some themes want external spin buttons, therefore the main // spinfield should not overdraw the border between its encapsulated // edit field and the spin buttons - if ( (nWinStyle & WB_SPIN) && ImplUseNativeBorder( nWinStyle ) ) + if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*this, nWinStyle)) { SetBackground(); mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) ); @@ -808,21 +808,18 @@ void SpinField::StateChanged( StateChangedType nType ) { if ( mpEdit ) mpEdit->SetControlFont( GetControlFont() ); - ImplInitSettings( true, false, false ); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { if ( mpEdit ) mpEdit->SetControlForeground( GetControlForeground() ); - ImplInitSettings( false, true, false ); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { if ( mpEdit ) mpEdit->SetControlBackground( GetControlBackground() ); - ImplInitSettings( false, false, true ); Invalidate(); } else if( nType == StateChangedType::Mirroring ) commit 00920bf83688f185bf05070599e7083af01ac665 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 18:14:08 2015 +0900 scrollbar - setup painting settings in ApplySettings Change-Id: I5eeaa1ee9c63f1a1d624022857a80cbebc079627 diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index 946bcd9..bbe334b 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -93,17 +93,18 @@ public: virtual ~ScrollBar(); virtual void dispose() SAL_OVERRIDE; - virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; - virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; - virtual void KeyInput( const KeyEvent& rKEvt ) 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; - virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - virtual void GetFocus() SAL_OVERRIDE; - virtual void LoseFocus() SAL_OVERRIDE; + virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; + virtual void Tracking(const TrackingEvent& rTEvt) SAL_OVERRIDE; + virtual void KeyInput(const KeyEvent& rKEvt) 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; + virtual void StateChanged(StateChangedType nType) SAL_OVERRIDE; + virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE; + virtual bool PreNotify(NotifyEvent& rNEvt) SAL_OVERRIDE; + virtual void GetFocus() SAL_OVERRIDE; + virtual void LoseFocus() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; using Window::Scroll; void Scroll(); @@ -151,7 +152,8 @@ class VCL_DLLPUBLIC ScrollBarBox : public vcl::Window private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext); public: explicit ScrollBarBox( vcl::Window* pParent, WinBits nStyle = 0 ); diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 696cae7..8e9f4b7 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -106,7 +106,6 @@ void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) long nScrollSize = GetSettings().GetStyleSettings().GetScrollBarSize(); SetSizePixel( Size( nScrollSize, nScrollSize ) ); - SetBackground(); } void ScrollBar::ImplInitStyle( WinBits nStyle ) @@ -1121,6 +1120,11 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt ) Control::KeyInput( rKEvt ); } +void ScrollBar::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); +} + void ScrollBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(rRenderContext, SCRBAR_DRAW_ALL); @@ -1448,14 +1452,13 @@ Size ScrollBar::getCurrentCalcSize() const return aCtrlRegion.GetSize(); } -void ScrollBarBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) +void ScrollBarBox::ImplInit(vcl::Window* pParent, WinBits nStyle) { Window::ImplInit( pParent, nStyle, NULL ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); long nScrollSize = rStyleSettings.GetScrollBarSize(); - SetSizePixel( Size( nScrollSize, nScrollSize ) ); - ImplInitSettings(); + SetSizePixel(Size(nScrollSize, nScrollSize)); } ScrollBarBox::ScrollBarBox( vcl::Window* pParent, WinBits nStyle ) : @@ -1464,18 +1467,12 @@ ScrollBarBox::ScrollBarBox( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -void ScrollBarBox::ImplInitSettings() +void ScrollBarBox::ApplySettings(vcl::RenderContext& rRenderContext) { - // FIXME: Hack so that we can build DockingWindows even without background - // and not everything has been switched over yet - if ( IsBackground() ) + if (rRenderContext.IsBackground()) { - Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else - aColor = GetSettings().GetStyleSettings().GetFaceColor(); - SetBackground( aColor ); + Color aColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor(); + ApplyControlBackground(rRenderContext, aColor); } } @@ -1483,9 +1480,8 @@ void ScrollBarBox::StateChanged( StateChangedType nType ) { Window::StateChanged( nType ); - if ( nType == StateChangedType::ControlBackground ) + if (nType == StateChangedType::ControlBackground) { - ImplInitSettings(); Invalidate(); } } @@ -1494,10 +1490,9 @@ void ScrollBarBox::DataChanged( const DataChangedEvent& rDCEvt ) { Window::DataChanged( rDCEvt ); - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) + if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) { - ImplInitSettings(); Invalidate(); } } commit 7e34c092d3d0f085eee3097b1d4ad038da39f9de Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 18:03:33 2015 +0900 edit - setup painting settings in ApplySettings Change-Id: I583caa0bbec9e4998bcc78e5edc4e29ab9d3b4b2 diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index 8a9e2d5..634722e 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -97,9 +97,9 @@ private: Link<> maModifyHdl; Link<> maUpdateDataHdl; - css::uno::Reference < css::i18n::XExtendedInputSequenceChecker > mxISC; + css::uno::Reference<css::i18n::XExtendedInputSequenceChecker> mxISC; - DECL_DLLPRIVATE_LINK_TYPED( ImplUpdateDataHdl, Timer*, void ); + DECL_DLLPRIVATE_LINK_TYPED(ImplUpdateDataHdl, Timer*, void); SAL_DLLPRIVATE bool ImplTruncateToMaxLen( OUString&, sal_Int32 nSelectionLen ) const; SAL_DLLPRIVATE void ImplInitEditData(); @@ -122,11 +122,11 @@ private: SAL_DLLPRIVATE void ImplHideDDCursor(); SAL_DLLPRIVATE bool ImplHandleKeyEvent( const KeyEvent& rKEvt ); SAL_DLLPRIVATE void ImplCopyToSelectionClipboard(); - SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); - SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); + SAL_DLLPRIVATE void ImplCopy(css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rxClipboard); + SAL_DLLPRIVATE void ImplPaste(css::uno::Reference<css::datatransfer::clipboard::XClipboard>& rxClipboard); SAL_DLLPRIVATE long ImplGetTextYPosition() const; - SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker(); - SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const; + SAL_DLLPRIVATE css::uno::Reference<css::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker(); + SAL_DLLPRIVATE css::uno::Reference<css::i18n::XBreakIterator > ImplGetBreakIterator() const; SAL_DLLPRIVATE void filterText(); protected: @@ -134,7 +134,6 @@ protected: 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 ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE void ImplSetSelection( const Selection& rSelection, bool bPaint = true ); SAL_DLLPRIVATE int ImplGetNativeControlType() const; @@ -142,18 +141,24 @@ protected: SAL_DLLPRIVATE long ImplGetExtraYOffset() const; static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder( vcl::Window* pWin ); - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > mxDnDListener; + css::uno::Reference<css::datatransfer::dnd::XDragSourceListener > mxDnDListener; // DragAndDropClient using vcl::unohelper::DragAndDropClient::dragEnter; using vcl::unohelper::DragAndDropClient::dragExit; using vcl::unohelper::DragAndDropClient::dragOver; - virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent& dge) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent& dsde) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void dragExit(const css::datatransfer::dnd::DropTargetEvent& dte) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void dragOver(const css::datatransfer::dnd::DropTargetDragEvent& dtde) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; protected: Edit(WindowType nType); @@ -161,12 +166,12 @@ protected: virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; public: // public because needed in button.cxx - SAL_DLLPRIVATE bool ImplUseNativeBorder( WinBits nStyle ); + SAL_DLLPRIVATE bool ImplUseNativeBorder(vcl::RenderContext& rRenderContext, WinBits nStyle); - Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER ); - Edit( vcl::Window* pParent, const ResId& rResId ); - virtual ~Edit(); - virtual void dispose() SAL_OVERRIDE; + Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER ); + Edit( vcl::Window* pParent, const ResId& rResId ); + virtual ~Edit(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index f69b268..1cc602b 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -315,28 +315,30 @@ void Edit::ImplInitEditData() mxDnDListener = pDnDWrapper; } -bool Edit::ImplUseNativeBorder( WinBits nStyle ) +bool Edit::ImplUseNativeBorder(vcl::RenderContext& rRenderContext, WinBits nStyle) { - bool bRet = - IsNativeControlSupported(ImplGetNativeControlType(), HAS_BACKGROUND_TEXTURE) - && ((nStyle&WB_BORDER) && !(nStyle&WB_NOBORDER)); - if( ! bRet && mbIsSubEdit ) + bool bRet = rRenderContext.IsNativeControlSupported(ImplGetNativeControlType(), + HAS_BACKGROUND_TEXTURE) + && ((nStyle & WB_BORDER) && !(nStyle & WB_NOBORDER)); + if (!bRet && mbIsSubEdit) { vcl::Window* pWindow = GetParent(); nStyle = pWindow->GetStyle(); - bRet = pWindow->IsNativeControlSupported(ImplGetNativeControlType(), HAS_BACKGROUND_TEXTURE) - && ((nStyle&WB_BORDER) && !(nStyle&WB_NOBORDER)); + bRet = pWindow->IsNativeControlSupported(ImplGetNativeControlType(), + HAS_BACKGROUND_TEXTURE) + && ((nStyle & WB_BORDER) && !(nStyle & WB_NOBORDER)); } return bRet; } -void Edit::ImplInit( vcl::Window* pParent, WinBits nStyle ) +void Edit::ImplInit(vcl::Window* pParent, WinBits nStyle) { - nStyle = ImplInitStyle( nStyle ); - if ( !(nStyle & (WB_CENTER | WB_RIGHT)) ) + nStyle = ImplInitStyle(nStyle); + + if (!(nStyle & (WB_CENTER | WB_RIGHT))) nStyle |= WB_LEFT; - Control::ImplInit( pParent, nStyle, NULL ); + Control::ImplInit(pParent, nStyle, NULL); mbReadOnly = (nStyle & WB_READONLY) != 0; @@ -354,7 +356,6 @@ void Edit::ImplInit( vcl::Window* pParent, WinBits nStyle ) SetCursor( new vcl::Cursor ); SetPointer( Pointer( POINTER_TEXT ) ); - ImplInitSettings( true, true, true ); uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY ); uno::Reference< datatransfer::dnd::XDragGestureRecognizer > xDGR = GetDragGestureRecognizer(); @@ -396,6 +397,8 @@ void Edit::ImplModified() void Edit::ApplySettings(vcl::RenderContext& rRenderContext) { + Control::ApplySettings(rRenderContext); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); vcl::Font aFont = rStyleSettings.GetFieldFont(); @@ -406,7 +409,7 @@ void Edit::ApplySettings(vcl::RenderContext& rRenderContext) Color aTextColor = rStyleSettings.GetFieldTextColor(); ApplyControlForeground(rRenderContext, aTextColor); - if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) + if (ImplUseNativeBorder(rRenderContext, GetStyle()) || IsPaintTransparent()) { // Transparent background rRenderContext.SetBackground(); @@ -424,44 +427,6 @@ void Edit::ApplySettings(vcl::RenderContext& rRenderContext) } } -void Edit::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (bFont) - { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - ApplyControlFont(*this, aFont); - ImplClearLayoutData(); - } - - if (bFont || bForeground) - { - Color aTextColor = rStyleSettings.GetFieldTextColor(); - ApplyControlForeground(*this, aTextColor); - } - - if (bBackground) - { - if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) - { - // Transparent background - SetBackground(); - SetFillColor(); - } - else if (IsControlBackground()) - { - SetBackground(GetControlBackground()); - SetFillColor(GetControlBackground()); - } - else - { - SetBackground(rStyleSettings.GetFieldColor()); - SetFillColor(rStyleSettings.GetFieldColor()); - } - } -} - long Edit::ImplGetExtraXOffset() const { // MT 09/2002: nExtraOffsetX should become a member, instead of checking every time, @@ -572,8 +537,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) bool bPaintPlaceholderText = aText.isEmpty() && !maPlaceholderText.isEmpty(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - if (IsEnabled()) - ImplInitSettings(false, true, false); + if (!IsEnabled() || bPaintPlaceholderText) rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); @@ -589,7 +553,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) SetTextFillColor(GetControlBackground()); } - else if (IsPaintTransparent() || ImplUseNativeBorder(GetStyle())) + else if (IsPaintTransparent() || ImplUseNativeBorder(rRenderContext, GetStyle())) rRenderContext.SetTextFillColor(); else rRenderContext.SetTextFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor()); @@ -649,7 +613,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) else { // Set background color when part of the text is selected - if (ImplUseNativeBorder(GetStyle())) + if (ImplUseNativeBorder(rRenderContext, GetStyle())) { if( (GetStyle() & WB_FORCECTRLBACKGROUND) != 0 && IsControlBackground() ) rRenderContext.SetTextFillColor(GetControlBackground()); @@ -999,9 +963,9 @@ void Edit::ImplSetText( const OUString& rText, const Selection* pNewSelection ) int Edit::ImplGetNativeControlType() const { int nCtrl = 0; - const vcl::Window *pControl = mbIsSubEdit ? GetParent() : this; + const vcl::Window* pControl = mbIsSubEdit ? GetParent() : this; - switch( pControl->GetType() ) + switch (pControl->GetType()) { case WINDOW_COMBOBOX: case WINDOW_PATTERNBOX: @@ -1030,11 +994,11 @@ int Edit::ImplGetNativeControlType() const case WINDOW_LONGCURRENCYFIELD: case WINDOW_NUMERICFIELD: case WINDOW_SPINFIELD: - if( pControl->GetStyle() & WB_SPIN ) + if (pControl->GetStyle() & WB_SPIN) nCtrl = CTRL_SPINBOX; else { - if ( GetWindow( WINDOW_BORDER ) != this ) + if (GetWindow(WINDOW_BORDER) != this) nCtrl = CTRL_EDITBOX; else nCtrl = CTRL_EDITBOX_NOBORDER; @@ -1057,7 +1021,7 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, aRect.Left() = nXStart; aRect.Right() = nXEnd; - if( !(ImplUseNativeBorder(GetStyle() ) || IsPaintTransparent())) + if( !(ImplUseNativeBorder(rRenderContext, GetStyle()) || IsPaintTransparent())) rRenderContext.Erase(aRect); } @@ -1068,7 +1032,7 @@ void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, lon aRect.Left() = nXStart; aRect.Right() = nXEnd; - if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) + if (ImplUseNativeBorder(rRenderContext, GetStyle()) || IsPaintTransparent()) { // draw the inner part by painting the whole control using its border window vcl::Window* pBorder = GetWindow(WINDOW_BORDER); @@ -1827,8 +1791,6 @@ void Edit::Resize() void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - ImplInitSettings( true, true, true ); - Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); vcl::Font aFont = GetDrawPixelFont( pDev ); @@ -2131,13 +2093,11 @@ void Edit::Command( const CommandEvent& rCEvt ) delete mpIMEInfos; mpIMEInfos = NULL; - // set font without attributes, because it will not be re-initialised in Repaint anymore - ImplInitSettings( true, false, false ); - - SetInsertMode( bInsertMode ); - + SetInsertMode(bInsertMode); ImplModified(); + Invalidate(); + // #i25161# call auto complete handler for ext text commit also if ( autocompleteSignal.empty() ) { @@ -2252,33 +2212,32 @@ void Edit::Command( const CommandEvent& rCEvt ) void Edit::StateChanged( StateChangedType nType ) { - if ( nType == StateChangedType::InitShow ) + if (nType == StateChangedType::InitShow) { - if ( !mpSubEdit ) + if (!mpSubEdit) { mnXOffset = 0; // if GrabFocus before while size was still wrong ImplAlign(); - if ( !mpSubEdit ) - ImplShowCursor( false ); + if (!mpSubEdit) + ImplShowCursor(false); + Invalidate(); } - // update background (eventual SetPaintTransparent) - ImplInitSettings( false, false, true ); } - else if ( nType == StateChangedType::Enable ) + else if (nType == StateChangedType::Enable) { - if ( !mpSubEdit ) + if (!mpSubEdit) { // change text color only ImplInvalidateOrRepaint(); } } - else if ( nType == StateChangedType::Style || nType == StateChangedType::Mirroring ) + else if (nType == StateChangedType::Style || nType == StateChangedType::Mirroring) { WinBits nStyle = GetStyle(); - if( nType == StateChangedType::Style ) + if (nType == StateChangedType::Style) { - nStyle = ImplInitStyle( GetStyle() ); - SetStyle( nStyle ); + nStyle = ImplInitStyle(GetStyle()); + SetStyle(nStyle); } sal_uInt16 nOldAlign = mnAlign; @@ -2287,66 +2246,62 @@ void Edit::StateChanged( StateChangedType nType ) // --- RTL --- hack: right align until keyinput and cursor travelling works // edits are always RTL disabled // however the parent edits contain the correct setting - if( mbIsSubEdit && GetParent()->IsRTLEnabled() ) + if (mbIsSubEdit && GetParent()->IsRTLEnabled()) { - if( GetParent()->GetStyle() & WB_LEFT ) + if (GetParent()->GetStyle() & WB_LEFT) mnAlign = EDIT_ALIGN_RIGHT; - if ( nType == StateChangedType::Mirroring ) - SetLayoutMode( TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + if (nType == StateChangedType::Mirroring) + SetLayoutMode(TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT); } - else if( mbIsSubEdit && !GetParent()->IsRTLEnabled() ) + else if (mbIsSubEdit && !GetParent()->IsRTLEnabled()) { - if ( nType == StateChangedType::Mirroring ) - SetLayoutMode( TEXT_LAYOUT_TEXTORIGIN_LEFT ); + if (nType == StateChangedType::Mirroring) + SetLayoutMode(TEXT_LAYOUT_TEXTORIGIN_LEFT); } - if ( nStyle & WB_RIGHT ) + if (nStyle & WB_RIGHT) mnAlign = EDIT_ALIGN_RIGHT; - else if ( nStyle & WB_CENTER ) + else if (nStyle & WB_CENTER) mnAlign = EDIT_ALIGN_CENTER; - if ( !maText.isEmpty() && ( mnAlign != nOldAlign ) ) + if (!maText.isEmpty() && (mnAlign != nOldAlign)) { ImplAlign(); Invalidate(); } } - else if ( nType == StateChangedType::Zoom ) + else if (nType == StateChangedType::Zoom) { - if ( !mpSubEdit ) + if (!mpSubEdit) { - ImplInitSettings( true, false, false ); - ImplShowCursor( true ); + ImplShowCursor(true); Invalidate(); } } - else if ( nType == StateChangedType::ControlFont ) + else if (nType == StateChangedType::ControlFont) { - if ( !mpSubEdit ) + if (!mpSubEdit) { - ImplInitSettings( true, false, false ); ImplShowCursor(); Invalidate(); } } - else if ( nType == StateChangedType::ControlForeground ) + else if (nType == StateChangedType::ControlForeground) { - if ( !mpSubEdit ) + if (!mpSubEdit) { - ImplInitSettings( false, true, false ); Invalidate(); } } - else if ( nType == StateChangedType::ControlBackground ) + else if (nType == StateChangedType::ControlBackground) { - if ( !mpSubEdit ) + if (!mpSubEdit) { - ImplInitSettings( false, false, true ); Invalidate(); } } - Control::StateChanged( nType ); + Control::StateChanged(nType); } void Edit::DataChanged( const DataChangedEvent& rDCEvt ) @@ -2358,7 +2313,6 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt ) { if ( !mpSubEdit ) { - ImplInitSettings( true, true, true ); ImplShowCursor( true ); Invalidate(); } @@ -2369,7 +2323,7 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt ) void Edit::ImplShowDDCursor() { - if ( !mpDDInfo->bVisCursor ) + if (!mpDDInfo->bVisCursor) { long nTextWidth = GetTextWidth( maText.toString(), 0, mpDDInfo->nDropPos ); long nTextHeight = GetTextHeight(); @@ -2751,17 +2705,18 @@ void Edit::ClearModifyFlag() mbModified = false; } -void Edit::SetSubEdit( Edit* pEdit ) +void Edit::SetSubEdit(Edit* pEdit) { mpSubEdit.disposeAndClear(); - mpSubEdit.set( pEdit ); - if ( mpSubEdit ) + mpSubEdit.set(pEdit); + + if (mpSubEdit) { - SetPointer( POINTER_ARROW ); // Nur das SubEdit hat den BEAM... + SetPointer(POINTER_ARROW); // Nur das SubEdit hat den BEAM... mpSubEdit->mbIsSubEdit = true; - mpSubEdit->SetReadOnly( mbReadOnly ); - mpSubEdit->autocompleteSignal.connect( autocompleteSignal ); + mpSubEdit->SetReadOnly(mbReadOnly); + mpSubEdit->autocompleteSignal.connect(autocompleteSignal); } } @@ -2806,11 +2761,10 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const ImplControlValue aControlValue; Rectangle aRect( Point( 0, 0 ), aSize ); Rectangle aContent, aBound; - if( GetNativeControlRegion( - eCtrlType, PART_ENTIRE_CONTROL, - aRect, ControlState::NONE, aControlValue, OUString(), aBound, aContent) ) + if (GetNativeControlRegion(eCtrlType, PART_ENTIRE_CONTROL, aRect, ControlState::NONE, + aControlValue, OUString(), aBound, aContent)) { - if( aBound.GetHeight() > aSize.Height() ) + if (aBound.GetHeight() > aSize.Height()) aSize.Height() = aBound.GetHeight(); } return aSize; commit ee616b050c82b138ee06117890b0381a0b5d750c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 17:43:17 2015 +0900 cleanup sidebar Change-Id: If4964adcc693ccf32e815d6cf8aad8e1c196ada8 diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx index 50caeb6..d55d01d 100644 --- a/include/sfx2/sidebar/SidebarChildWindow.hxx +++ b/include/sfx2/sidebar/SidebarChildWindow.hxx @@ -30,19 +30,15 @@ namespace sfx2 { namespace sidebar { RegisterChildWindow() method from the RegisterControllers() method of the applications DLL. */ -class SFX2_DLLPUBLIC SidebarChildWindow - : public SfxChildWindow +class SFX2_DLLPUBLIC SidebarChildWindow : public SfxChildWindow { public: - SidebarChildWindow( - vcl::Window* pParent, - sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo* pInfo); + SidebarChildWindow(vcl::Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo); SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow); - static sal_Int32 GetDefaultWidth (vcl::Window* pWindow); + static sal_Int32 GetDefaultWidth(vcl::Window* pWindow); }; diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx index a60f951..e08f3c3 100644 --- a/include/sfx2/sidebar/SidebarPanelBase.hxx +++ b/include/sfx2/sidebar/SidebarPanelBase.hxx @@ -42,43 +42,39 @@ namespace sfx2 { namespace sidebar { namespace { - typedef ::cppu::WeakComponentImplHelper4 < - css::ui::XContextChangeEventListener, - css::ui::XUIElement, - css::ui::XToolPanel, - css::ui::XSidebarPanel - > SidebarPanelBaseInterfaceBase; + +typedef cppu::WeakComponentImplHelper4<css::ui::XContextChangeEventListener, + css::ui::XUIElement, + css::ui::XToolPanel, + css::ui::XSidebarPanel> + SidebarPanelBaseInterfaceBase; } /** Base class for sidebar panels that provides some convenience functionality. */ -class SFX2_DLLPUBLIC SidebarPanelBase - : private ::boost::noncopyable, - private ::cppu::BaseMutex, - public SidebarPanelBaseInterfaceBase +class SFX2_DLLPUBLIC SidebarPanelBase : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SidebarPanelBaseInterfaceBase { public: - static css::uno::Reference<css::ui::XUIElement> Create ( - const ::rtl::OUString& rsResourceURL, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - vcl::Window* pControl, - const css::ui::LayoutSize& rLayoutSize); + static css::uno::Reference<css::ui::XUIElement> Create(const OUString& rsResourceURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + vcl::Window* pControl, + const css::ui::LayoutSize& rLayoutSize); // XContextChangeEventListener - virtual void SAL_CALL notifyContextChangeEvent ( - const css::ui::ContextChangeEventObject& rEvent) + virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; // XEventListener - virtual void SAL_CALL disposing ( - const css::lang::EventObject& rEvent) + virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; // XUIElement virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual ::rtl::OUString SAL_CALL getResourceURL() + virtual OUString SAL_CALL getResourceURL() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int16 SAL_CALL getType() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -86,26 +82,23 @@ public: throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; // XToolPanel - virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible ( - const css::uno::Reference<css::accessibility::XAccessible>& rxParentAccessible) + virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible( + const css::uno::Reference<css::accessibility::XAccessible>& rxParentAccessible) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; // XSidebarPanel - virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth) + virtual css::ui::LayoutSize SAL_CALL getHeightForWidth(sal_Int32 nWidth) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual sal_Int32 SAL_CALL getMinimalWidth () + virtual sal_Int32 SAL_CALL getMinimalWidth() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; protected: css::uno::Reference<css::frame::XFrame> mxFrame; - SidebarPanelBase ( - const ::rtl::OUString& rsResourceURL, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - vcl::Window* pWindow, - const css::ui::LayoutSize& rLayoutSize); + SidebarPanelBase(const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, + vcl::Window* pWindow, const css::ui::LayoutSize& rLayoutSize); virtual ~SidebarPanelBase(); virtual void SAL_CALL disposing() @@ -113,7 +106,7 @@ protected: private: VclPtr<vcl::Window> mpControl; - const ::rtl::OUString msResourceURL; + const OUString msResourceURL; const css::ui::LayoutSize maLayoutSize; }; diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx index bf1663f..21a9a7f 100644 --- a/include/sfx2/sidebar/SidebarToolBox.hxx +++ b/include/sfx2/sidebar/SidebarToolBox.hxx @@ -36,8 +36,7 @@ namespace sfx2 { namespace sidebar { background window. 2. Create and handle tool bar controller for its items. */ -class SFX2_DLLPUBLIC SidebarToolBox - : public ToolBox +class SFX2_DLLPUBLIC SidebarToolBox : public ToolBox { public: SidebarToolBox(vcl::Window* pParentWindow); @@ -46,7 +45,7 @@ public: using ToolBox::InsertItem; virtual void InsertItem(const OUString& rCommand, - const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame, + const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits = ToolBoxItemBits::NONE, const Size& rRequestedSize = Size(), sal_uInt16 nPos = TOOLBOX_APPEND) SAL_OVERRIDE; @@ -55,18 +54,16 @@ public: virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE; - css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId ( - const sal_uInt16 nItemId) const; - sal_uInt16 GetItemIdForSubToolbarName ( - const ::rtl::OUString& rsCOmmandName) const; + css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const sal_uInt16 nItemId) const; + sal_uInt16 GetItemIdForSubToolbarName (const OUString& rsCOmmandName) const; - void SetController ( - const sal_uInt16 nItemId, - const css::uno::Reference<css::frame::XToolbarController>& rxController, - const ::rtl::OUString& rsCommandName); + void SetController(const sal_uInt16 nItemId, + const css::uno::Reference<css::frame::XToolbarController>& rxController, + const OUString& rsCommandName); private: Image maItemSeparator; + class ItemDescriptor { public: @@ -74,7 +71,8 @@ private: css::util::URL maURL; rtl::OUString msCurrentCommand; }; - typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer; + + typedef std::map<sal_uInt16, ItemDescriptor> ControllerContainer; ControllerContainer maControllers; bool mbAreHandlersRegistered; @@ -85,10 +83,9 @@ private: DECL_STATIC_LINK_TYPED(SidebarToolBox, ActivateToolBox, ToolBox*, void); DECL_STATIC_LINK_TYPED(SidebarToolBox, DeactivateToolBox, ToolBox*, void); - void CreateController ( - const sal_uInt16 nItemId, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - const sal_Int32 nItemWidth = 0); + void CreateController(const sal_uInt16 nItemId, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const sal_Int32 nItemWidth = 0); void RegisterHandlers(); }; diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx index 8587c29..0925bf8 100644 --- a/sfx2/source/sidebar/SidebarChildWindow.cxx +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -30,18 +30,14 @@ namespace sfx2 { namespace sidebar { SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR); -SidebarChildWindow::SidebarChildWindow ( - vcl::Window* pParentWindow, - sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo* pInfo) +SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow(pParentWindow, nId) { - pWindow.reset(VclPtr<SidebarDockingWindow>::Create( - pBindings, - *this, - pParentWindow, - WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE)); + pWindow.reset(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, pParentWindow, + WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | + WB_CLIPCHILDREN | WB_SIZEABLE | + WB_3DLOOK | WB_ROLLABLE)); eChildAlignment = SfxChildAlignment::RIGHT; pWindow->SetHelpId(HID_SIDEBAR_WINDOW); commit 61719b1781b6147dcfa7278f44c9b910d9ab1286 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 17:35:21 2015 +0900 SidebarDockingWindow - cleanup Change-Id: Ief8fb3aa0a39082598c3d488a758416604a3991a diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 7c9a150..2cc2ae7 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -29,13 +29,10 @@ using namespace css::uno; namespace sfx2 { namespace sidebar { -SidebarDockingWindow::SidebarDockingWindow( - SfxBindings* pSfxBindings, - SidebarChildWindow& rChildWindow, - vcl::Window* pParentWindow, - WinBits nBits) - : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits), - mpSidebarController() +SidebarDockingWindow::SidebarDockingWindow(SfxBindings* pSfxBindings, SidebarChildWindow& rChildWindow, + vcl::Window* pParentWindow, WinBits nBits) + : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits) + , mpSidebarController() { // Get the XFrame from the bindings. if (pSfxBindings==NULL || pSfxBindings->GetDispatcher()==NULL) diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx index fd45c69..defbb17 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.hxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx @@ -29,15 +29,11 @@ class SidebarChildWindow; class SidebarController; -class SidebarDockingWindow - : public SfxDockingWindow +class SidebarDockingWindow : public SfxDockingWindow { public: - SidebarDockingWindow( - SfxBindings* pBindings, - SidebarChildWindow& rChildWindow, - vcl::Window* pParent, - WinBits nBits); + SidebarDockingWindow(SfxBindings* pBindings, SidebarChildWindow& rChildWindow, + vcl::Window* pParent, WinBits nBits); virtual ~SidebarDockingWindow(); virtual void dispose() SAL_OVERRIDE; commit d0f20c37747e9eaaae7642ce017a53b1f3e4b5a6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed May 20 17:30:18 2015 +0900 Deck, TitleBar - setup background in ApplySettings Change-Id: I3468176b8605094887f1d81ce37ef2c47719e3e7 diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 2e27717..d5dc5d3 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -50,8 +50,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, , mpFiller(VclPtr<vcl::Window>::Create(this)) , mpVerticalScrollBar(VclPtr<ScrollBar>::Create(this)) { - SetBackground(Wallpaper()); - mpScrollClipWindow->SetBackground(Wallpaper()); mpScrollClipWindow->Show(); @@ -111,10 +109,13 @@ Rectangle Deck::GetContentArea() const aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize); } -void Deck::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) +void Deck::ApplySettings(vcl::RenderContext& rRenderContext) { - (void) rUpdateArea; + rRenderContext.SetBackground(Wallpaper()); +} +void Deck::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rUpdateArea*/) +{ const Size aWindowSize (GetSizePixel()); const SvBorder aPadding(Theme::GetInteger(Theme::Int_DeckLeftPadding), Theme::GetInteger(Theme::Int_DeckTopPadding), diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx index 4e6f4bc..9efaadc 100644 --- a/sfx2/source/sidebar/Deck.hxx +++ b/sfx2/source/sidebar/Deck.hxx @@ -64,9 +64,10 @@ public: */ void ShowPanel (const Panel& rPanel); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits