diff options
35 files changed, 606 insertions, 601 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index eeca6aafb2c3..32c9280ddffd 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -107,34 +107,29 @@ public: LibLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rTxt ) : SvLBoxString( pEntry, nFlags, rTxt ) {} - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void LibLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void LibLBoxString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { // Change text color if library is read only: bool bReadOnly = false; if (pEntry && pEntry->GetUserData()) { - ScriptDocument aDocument( - static_cast<LibUserData*>(pEntry->GetUserData())-> - GetDocument() ); + ScriptDocument aDocument(static_cast<LibUserData*>(pEntry->GetUserData())->GetDocument()); OUString aLibName = static_cast<const SvLBoxString*>(pEntry->GetItem(1))->GetText(); - Reference< script::XLibraryContainer2 > xModLibContainer( - aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY); - Reference< script::XLibraryContainer2 > xDlgLibContainer( - aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY); - bReadOnly - = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) - && xModLibContainer->isLibraryReadOnly(aLibName)) - || (xDlgLibContainer.is() && xDlgLibContainer->hasByName(aLibName) - && xDlgLibContainer->isLibraryReadOnly(aLibName)); + Reference<script::XLibraryContainer2> xModLibContainer(aDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY); + Reference<script::XLibraryContainer2 > xDlgLibContainer(aDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY); + bReadOnly = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryReadOnly(aLibName)) + || (xDlgLibContainer.is() && xDlgLibContainer->hasByName(aLibName) && xDlgLibContainer->isLibraryReadOnly(aLibName)); } if (bReadOnly) - rDev.DrawCtrlText(rPos, GetText(), 0, -1, TEXT_DRAW_DISABLE); + rRenderContext.DrawCtrlText(rPos, GetText(), 0, -1, TEXT_DRAW_DISABLE); else - rDev.DrawText(rPos, GetText()); + rRenderContext.DrawText(rPos, GetText()); } } // namespace diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index e4d803dce9f8..42e2f98090df 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -624,8 +624,8 @@ public: virtual ~SfxAccCfgLBoxString_Impl(); - virtual void Paint( - const Point& aPos, SvTreeListBox& rDevice, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& aPos, SvTreeListBox& rDevice, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; @@ -636,8 +636,8 @@ SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl(SvTreeListEntry* pEntry, sal_ SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() {} -void SfxAccCfgLBoxString_Impl::Paint( - const Point& aPos, SvTreeListBox& rDevice, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { if (!pEntry) return; @@ -647,9 +647,9 @@ void SfxAccCfgLBoxString_Impl::Paint( return; if (pUserData->m_bIsConfigurable) - rDevice.DrawText(aPos, GetText()); + rRenderContext.DrawText(aPos, GetText()); else - rDevice.DrawCtrlText(aPos, GetText(), 0, -1, TEXT_DRAW_DISABLE); + rRenderContext.DrawCtrlText(aPos, GetText(), 0, -1, TEXT_DRAW_DISABLE); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index f902a15c10f0..435bc82555d1 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1327,18 +1327,18 @@ public: virtual ~PopupPainter() { } - virtual void Paint( const Point& rPos, SvTreeListBox& rOutDev, - const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE { - SvLBoxString::Paint(rPos, rOutDev, pView, pEntry); + SvLBoxString::Paint(rPos, rOutDev, rRenderContext, pView, pEntry); - Color aOldFillColor = rOutDev.GetFillColor(); + rRenderContext.Push(PushFlags::FILLCOLOR); - SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >( &rOutDev ); + SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >(&rOutDev); long nX = pTreeBox->GetSizePixel().Width(); ScrollBar* pVScroll = pTreeBox->GetVScroll(); - if ( pVScroll->IsVisible() ) + if (pVScroll->IsVisible()) { nX -= pVScroll->GetSizePixel().Width(); } @@ -1350,23 +1350,23 @@ public: long nHalfSize = nSize / 2; long nY = rPos.Y() + nHalfSize; - if ( aOldFillColor == COL_WHITE ) + if (rRenderContext.GetFillColor() == COL_WHITE) { - rOutDev.SetFillColor( Color( COL_BLACK ) ); + rRenderContext.SetFillColor(Color(COL_BLACK)); } else { - rOutDev.SetFillColor( Color( COL_WHITE ) ); + rRenderContext.SetFillColor(Color(COL_WHITE)); } long n = 0; - while ( n <= nHalfSize ) + while (n <= nHalfSize) { - rOutDev.DrawRect( Rectangle( nX+n, nY+n, nX+n, nY+nSize-n ) ); + rRenderContext.DrawRect(Rectangle(nX + n, nY + n, nX + n, nY + nSize - n)); ++n; } - rOutDev.SetFillColor( aOldFillColor ); + rRenderContext.Pop(); } }; diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index c675ef137ab3..b0b964c6f794 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -67,10 +67,10 @@ _SvxMacroTabPage_Impl::_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ) // attention, this array is indexed directly (0, 1, ...) in the code static long nTabs[] = - { - 2, // Number of Tabs - 0, 90 - }; +{ + 2, // Number of Tabs + 0, 90 +}; #define TAB_WIDTH_MIN 10 @@ -450,8 +450,8 @@ class IconLBoxString : public SvLBoxString public: IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& sText, Image* pMacroImg, Image* pComponentImg ); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; @@ -465,34 +465,33 @@ IconLBoxString::IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, cons } -void IconLBoxString::Paint( - const Point& aPos, SvTreeListBox& aDevice, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* /*pEntry*/) +void IconLBoxString::Paint(const Point& aPos, SvTreeListBox& /*aDevice*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { - OUString aTxt( GetText() ); - if( !aTxt.isEmpty() ) + OUString aTxt(GetText()); + if (!aTxt.isEmpty()) { - OUString aURL( aTxt ); - sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO ); + OUString aURL(aTxt); + sal_Int32 nIndex = aURL.indexOf(aVndSunStarUNO); bool bUNO = nIndex == 0; const Image* pImg = bUNO ? m_pComponentImg : m_pMacroImg; - aDevice.DrawImage( aPos, *pImg ); + rRenderContext.DrawImage(aPos, *pImg); OUString aPureMethod; - if( bUNO ) + if (bUNO) { - aPureMethod = aURL.copy( strlen(aVndSunStarUNO) ); + aPureMethod = aURL.copy(strlen(aVndSunStarUNO)); } else { - aPureMethod = aURL.copy( strlen(aVndSunStarScript) ); + aPureMethod = aURL.copy(strlen(aVndSunStarScript)); aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) ); } Point aPnt(aPos); aPnt.X() += m_nxImageOffset; - aDevice.DrawText( aPnt, aPureMethod ); + rRenderContext.DrawText(aPnt, aPureMethod); } } diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index a8566ea5e015..781cb1542396 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -146,24 +146,23 @@ AlternativesString::AlternativesString( { } -void AlternativesString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* pEntry) +void AlternativesString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); - Point aPos( rPos ); - vcl::Font aOldFont( rDev.GetFont()); + AlternativesExtraData* pData = m_rControlImpl.GetExtraData(pEntry); + Point aPos(rPos); + rRenderContext.Push(PushFlags::FONT); if (pData && pData->IsHeader()) { - vcl::Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - rDev.SetFont( aFont ); + vcl::Font aFont(rRenderContext.GetFont()); + aFont.SetWeight(WEIGHT_BOLD); + rRenderContext.SetFont(aFont); aPos.X() = 0; } else aPos.X() += 5; - rDev.DrawText( aPos, GetText() ); - rDev.SetFont( aOldFont ); + rRenderContext.DrawText(aPos, GetText()); + rRenderContext.Pop(); } ThesaurusAlternativesCtrl::ThesaurusAlternativesCtrl(vcl::Window* pParent) diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx index 8211897ef711..25b09f51d754 100644 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -53,8 +53,8 @@ public: AlternativesString( ThesaurusAlternativesCtrl &rControl, SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; #endif diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx index 56f46dbc0ada..2162707f839a 100644 --- a/cui/source/options/optHeaderTabListbox.cxx +++ b/cui/source/options/optHeaderTabListbox.cxx @@ -34,23 +34,23 @@ public: OptLBoxString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rTxt ) : SvLBoxString( pEntry, nFlags, rTxt ) {} - virtual void Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void OptLBoxString_Impl::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void OptLBoxString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - vcl::Font aOldFont( rDev.GetFont() ); - vcl::Font aFont( aOldFont ); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aFont(rRenderContext.GetFont()); //detect readonly state by asking for a valid Image - if(pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry))) - aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); + if (pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry))) + aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDeactiveTextColor()); + rRenderContext.SetFont(aFont); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.Pop(); } diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 12ef87645a1b..3c535f85e544 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -263,28 +263,27 @@ public: BrwStringDic_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void BrwStringDic_Impl::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* pEntry) +void BrwStringDic_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { ModuleUserData_Impl* pData = static_cast<ModuleUserData_Impl*>(pEntry->GetUserData()); Point aPos(rPos); - vcl::Font aOldFont( rDev.GetFont()); - if(pData->IsParent()) + rRenderContext.Push(PushFlags::FONT); + if (pData->IsParent()) { - vcl::Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - rDev.SetFont( aFont ); + vcl::Font aFont(rRenderContext.GetFont()); + aFont.SetWeight(WEIGHT_BOLD); + rRenderContext.SetFont(aFont); aPos.X() = 0; } else aPos.X() += 5; - rDev.DrawText( aPos, GetText() ); - rDev.SetFont( aOldFont ); + rRenderContext.DrawText(aPos, GetText()); + rRenderContext.Pop(); } /*-------------------------------------------------- @@ -441,36 +440,35 @@ public: BrwString_Impl( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void BrwString_Impl::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* pEntry) +void BrwString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { Point aPos(rPos); aPos.X() += 20; - rDev.DrawText( aPos, GetText() ); - if(pEntry->GetUserData()) + rRenderContext.DrawText(aPos, GetText()); + if (pEntry->GetUserData()) { Point aNewPos(aPos); - aNewPos.X() += rDev.GetTextWidth(GetText()); - vcl::Font aOldFont( rDev.GetFont()); - vcl::Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); + aNewPos.X() += rRenderContext.GetTextWidth(GetText()); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aFont(rRenderContext.GetFont()); + aFont.SetWeight(WEIGHT_BOLD); //??? convert the lower byte from the user date into a string - OptionsUserData aData( reinterpret_cast<sal_uLong>( pEntry->GetUserData() ) ); - if(aData.HasNumericValue()) + OptionsUserData aData(reinterpret_cast<sal_uLong>(pEntry->GetUserData())); + if (aData.HasNumericValue()) { OUStringBuffer sTxt; sTxt.append(' ').append(static_cast<sal_Int32>(aData.GetNumericValue())); - rDev.SetFont( aFont ); - rDev.DrawText( aNewPos, sTxt.makeStringAndClear() ); + rRenderContext.SetFont(aFont); + rRenderContext.DrawText(aNewPos, sTxt.makeStringAndClear()); } - rDev.SetFont( aOldFont ); + rRenderContext.Pop(); } } diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 35276a456461..259a28f05fb3 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -334,49 +334,47 @@ public: OfaImpBrwString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} - virtual void Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void OfaImpBrwString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* pEntry) +void OfaImpBrwString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - rDev.DrawText( rPos, GetText() ); - if(pEntry->GetUserData()) + rRenderContext.DrawText(rPos, GetText()); + if (pEntry->GetUserData()) { ImpUserData* pUserData = static_cast<ImpUserData*>(pEntry->GetUserData()); Point aNewPos(rPos); - aNewPos.X() += rDev.GetTextWidth(GetText()); - vcl::Font aOldFont( rDev.GetFont()); - vcl::Font aFont( aOldFont ); - if(pUserData->pFont) + aNewPos.X() += rRenderContext.GetTextWidth(GetText()); + vcl::Font aOldFont(rRenderContext.GetFont()); + vcl::Font aFont(aOldFont); + if (pUserData->pFont) { aFont = *pUserData->pFont; aFont.SetColor(aOldFont.GetColor()); aFont.SetSize(aOldFont.GetSize()); } - aFont.SetWeight( WEIGHT_BOLD ); + aFont.SetWeight(WEIGHT_BOLD); bool bFett = true; sal_Int32 nPos = 0; do { - OUString sTxt( pUserData->pString->getToken( 0, 1, nPos )); + OUString sTxt(pUserData->pString->getToken(0, 1, nPos)); - if( bFett ) - rDev.SetFont( aFont ); + if (bFett) + rRenderContext.SetFont(aFont); - rDev.DrawText( aNewPos, sTxt ); + rRenderContext.DrawText(aNewPos, sTxt); - if( -1 != nPos ) - aNewPos.X() += rDev.GetTextWidth( sTxt ); + if (-1 != nPos) + aNewPos.X() += rRenderContext.GetTextWidth(sTxt); - if( bFett ) - rDev.SetFont( aOldFont ); + if (bFett) + rRenderContext.SetFont(aOldFont); bFett = !bFett; - } while( -1 != nPos ); + } while(-1 != nPos); } } diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index 9e55993df84f..8fa399e363d2 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -85,7 +85,7 @@ OCreationList::OCreationList( OTasksWindow& _rParent ) EnableEntryMnemonics(); } -void OCreationList::Paint( vcl::RenderContext& rRenderContext, const Rectangle& _rRect ) +void OCreationList::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _rRect ) { if ( m_pMouseDownEntry ) m_aOriginalFont = GetFont(); diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx index c81018cb0720..3120d08d89e9 100644 --- a/dbaccess/source/ui/control/listviewitems.cxx +++ b/dbaccess/source/ui/control/listviewitems.cxx @@ -44,22 +44,23 @@ namespace dbaui return SV_ITEM_ID_BOLDLBSTRING; } - void OBoldListboxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) + void OBoldListboxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { if (m_bEmphasized) { - rDev.Push(PushFlags::ALL); - vcl::Font aFont( rDev.GetFont()); + rRenderContext.Push(PushFlags::ALL); + vcl::Font aFont(rRenderContext.GetFont()); aFont.SetWeight(WEIGHT_BOLD); - rDev.SetFont( aFont ); + rRenderContext.SetFont(aFont); Point aPos(rPos); - rDev.DrawText( aPos, GetText() ); - rDev.Pop(); + rRenderContext.DrawText(aPos, GetText()); + rRenderContext.Pop(); } else - SvLBoxString::Paint(rPos, rDev, pView, pEntry); + { + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); + } } } // namespace dbaui diff --git a/dbaccess/source/ui/inc/listviewitems.hxx b/dbaccess/source/ui/inc/listviewitems.hxx index 240e12f479e7..8703e34c85de 100644 --- a/dbaccess/source/ui/inc/listviewitems.hxx +++ b/dbaccess/source/ui/inc/listviewitems.hxx @@ -41,8 +41,8 @@ namespace dbaui virtual sal_uInt16 GetType() const SAL_OVERRIDE; - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* _pViewData) SAL_OVERRIDE; bool isEmphasized() const { return m_bEmphasized; } diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index b1763b47356f..cf2c49f7b5c1 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -349,18 +349,22 @@ public: { } - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void OColumnString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) +void OColumnString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { + rRenderContext.Push(PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR); if(m_bReadOnly) { - const StyleSettings& rStyleSettings = rDev.GetSettings().GetStyleSettings(); - rDev.SetTextColor( rStyleSettings.GetDisableColor() ); - rDev.SetTextFillColor( rStyleSettings.GetFieldColor() ); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); + rRenderContext.SetTextFillColor(rStyleSettings.GetFieldColor()); } - rDev.DrawText( rPos, GetText() ); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.Pop(); } OColumnTreeBox::OColumnTreeBox( vcl::Window* pParent, WinBits nBits ) diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx index a5e2ee29d855..479d5c02c6a4 100644 --- a/include/svtools/svlbitm.hxx +++ b/include/svtools/svlbitm.hxx @@ -128,8 +128,8 @@ public: maText = rText; } - virtual void Paint(const Point& rPos, - SvTreeListBox& rOutDev, + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; @@ -141,14 +141,14 @@ class SvLBoxBmp : public SvLBoxItem { Image aBmp; public: - SvLBoxBmp(); - virtual ~SvLBoxBmp(); + SvLBoxBmp(); + virtual ~SvLBoxBmp(); virtual sal_uInt16 GetType() const SAL_OVERRIDE; - virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual SvLBoxItem* Create() const SAL_OVERRIDE; - virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; + virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; }; @@ -159,7 +159,7 @@ class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem SvLBoxButtonKind eKind; SvItemStateFlags nItemFlags; - static void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::Window* pParent ); + static void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::RenderContext& pRenderContext); public: // An SvLBoxButton can be of three different kinds: an // enabled checkbox (the normal kind), a disabled checkbox @@ -180,6 +180,7 @@ public: virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; @@ -266,6 +267,7 @@ public: SvViewDataItem* pViewData) SAL_OVERRIDE; virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 619b5cb8e2f4..9e5333619d5b 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -167,16 +167,15 @@ public: const Size& GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const; static const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) = 0; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) = 0; - virtual void InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, + virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry, // If != 0: this Pointer must be used! // If == 0: it needs to be retrieved via the View SvViewDataItem* pViewData = 0) = 0; virtual SvLBoxItem* Create() const = 0; // View-dependent data is not cloned - virtual void Clone( SvLBoxItem* pSource ) = 0; + virtual void Clone(SvLBoxItem* pSource) = 0; }; inline SvLBoxItem* new_clone(const SvLBoxItem& rSrc) @@ -577,7 +576,7 @@ protected: SVT_DLLPRIVATE void AdjustEntryHeight( const vcl::Font& rFont ); SVT_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry ); - SVT_DLLPRIVATE long PaintEntry1( SvTreeListEntry*, long nLine, + SVT_DLLPRIVATE long PaintEntry1( SvTreeListEntry*, long nLine, vcl::RenderContext& rRenderContext, SvLBoxTabFlags nTabFlagMask = SvLBoxTabFlags::ALL, bool bHasClipRegion=false ); @@ -754,9 +753,9 @@ public: SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const; - void PaintEntry( SvTreeListEntry* ); - long PaintEntry( SvTreeListEntry*, long nLine, - SvLBoxTabFlags nTabFlagMask=SvLBoxTabFlags::ALL ); + void PaintEntry(SvTreeListEntry* pEntry, vcl::RenderContext& rRenderContext); + long PaintEntry(SvTreeListEntry* pEntry, long nLine, vcl::RenderContext& rRenderContext, + SvLBoxTabFlags nTabFlagMask = SvLBoxTabFlags::ALL); virtual Rectangle GetFocusRect( SvTreeListEntry*, long nLine ); // Respects indentation virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* ); diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index 43e71813cb50..a5831d473de8 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -77,8 +77,8 @@ public: The relevant text with the selected color is drawn in the output device. */ - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; SvLBoxItem* Create() const SAL_OVERRIDE; }; diff --git a/include/svx/fontlb.hxx b/include/svx/fontlb.hxx index dcd6cee74a2e..c609d9f61bb3 100644 --- a/include/svx/fontlb.hxx +++ b/include/svx/fontlb.hxx @@ -51,8 +51,8 @@ public: void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; /** Paints this entry to the specified position, using the own font settings. */ - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; @@ -82,7 +82,7 @@ public: /** Removes a selection. */ void SetNoSelection(); - /** Returns the position of the entry currently selected or TREELIST_APPEND. + /** Returns the position of the entry currently selected or TREELIST_APPEND. */ sal_uLong GetSelectEntryPos() const; diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index d14d6ab08d7d..13c4e5a9066c 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -713,11 +713,10 @@ void NavigatorTree::_elementRemoved( const container::ContainerEvent& _rEvent ) SvTreeListEntry* pEntry = find(xProp); OSL_ENSURE(pEntry,"NavigatorTree::_elementRemoved: No Entry found!"); - if ( pEntry ) + if (pEntry) { - SvTreeListEntry* pParent = GetParent(pEntry); removeEntry(pEntry); - PaintEntry(pParent); + Invalidate(); } } diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 447c6a0bd887..0ccd11a05daa 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -72,33 +72,35 @@ public: void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; } void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; } - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; -void ScSolverOptionsString::Paint( const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) +void ScSolverOptionsString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { //! move position? (SvxLinguTabPage: aPos.X() += 20) - OUString aNormalStr( GetText() ); + OUString aNormalStr(GetText()); aNormalStr += ":"; - rDev.DrawText( rPos, aNormalStr ); + rRenderContext.DrawText(rPos, aNormalStr); - Point aNewPos( rPos ); - aNewPos.X() += rDev.GetTextWidth( aNormalStr ); - vcl::Font aOldFont( rDev.GetFont() ); - vcl::Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); + Point aNewPos(rPos); + aNewPos.X() += rRenderContext.GetTextWidth(aNormalStr); + vcl::Font aOldFont(rRenderContext.GetFont()); + vcl::Font aFont(aOldFont); + aFont.SetWeight(WEIGHT_BOLD); - OUString sTxt( ' ' ); - if ( mbIsDouble ) - sTxt += rtl::math::doubleToUString( mfDoubleValue, + OUString sTxt(' '); + if (mbIsDouble) + sTxt += rtl::math::doubleToUString(mfDoubleValue, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ); else sTxt += OUString::number(mnIntValue); - rDev.SetFont( aFont ); - rDev.DrawText( aNewPos, sTxt ); + rRenderContext.SetFont(aFont); + rRenderContext.DrawText(aNewPos, sTxt); - rDev.SetFont( aOldFont ); + rRenderContext.SetFont(aOldFont); } ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 9e23ca6f307e..3ba29ee9f48d 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -251,7 +251,7 @@ public: return; pView->SetHighlighted(false); - mrTree.PaintEntry(p); + mrTree.Invalidate(); } }; @@ -395,7 +395,7 @@ void ScXMLSourceDlg::RepeatElementSelected(SvTreeListEntry& rEntry) // Highlight the entry if not highlighted already. This can happen // when the current entry is a child entry of a repeat element entry. p->SetHighlighted(true); - mpLbTree->PaintEntry(&rEntry); + mpLbTree->Invalidate(); maHighlightedEntries.push_back(&rEntry); } @@ -455,7 +455,7 @@ void ScXMLSourceDlg::SelectAllChildEntries(SvTreeListEntry& rEntry) SelectAllChildEntries(r); // select recursively. SvViewDataEntry* p = mpLbTree->GetViewDataEntry(&r); p->SetHighlighted(true); - mpLbTree->PaintEntry(&r); + mpLbTree->Invalidate(); maHighlightedEntries.push_back(&r); } } diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 4d7adafce1f3..27cabc952321 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -207,8 +207,8 @@ public: SvLBoxItem* Create() const SAL_OVERRIDE; void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; - virtual void Paint( - const Point&, SvTreeListBox& rDev, const SvViewDataEntry* pView,const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point&, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView,const SvTreeListEntry* pEntry) SAL_OVERRIDE; private: VclPtr<CustomAnimationList> mpParent; OUString maDescription; @@ -238,59 +238,68 @@ void CustomAnimationListEntryItem::InitViewData( SvTreeListBox* pView, SvTreeLis pViewData->maSize = aSize; } -void CustomAnimationListEntryItem::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void CustomAnimationListEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - const SvViewDataItem* pViewData = mpParent->GetViewDataItem( pEntry, this ); + const SvViewDataItem* pViewData = mpParent->GetViewDataItem(pEntry, this); - Point aPos( rPos ); - Size aSize( pViewData->maSize ); + Point aPos(rPos); + Size aSize(pViewData->maSize); sal_Int16 nNodeType = mpEffect->getNodeType(); - if( nNodeType == EffectNodeType::ON_CLICK ) + if (nNodeType == EffectNodeType::ON_CLICK ) { - rDev.DrawImage( aPos, mpParent->getImage( IMG_CUSTOMANIMATION_ON_CLICK ) ); + rRenderContext.DrawImage( aPos, mpParent->getImage(IMG_CUSTOMANIMATION_ON_CLICK)); } - else if( nNodeType == EffectNodeType::AFTER_PREVIOUS ) + else if (nNodeType == EffectNodeType::AFTER_PREVIOUS) { - rDev.DrawImage( aPos, mpParent->getImage( IMG_CUSTOMANIMATION_AFTER_PREVIOUS ) ); + rRenderContext.DrawImage(aPos, mpParent->getImage(IMG_CUSTOMANIMATION_AFTER_PREVIOUS)); } aPos.X() += 19; sal_uInt16 nImage; - switch( mpEffect->getPresetClass() ) + switch (mpEffect->getPresetClass()) { - case EffectPresetClass::ENTRANCE: nImage = IMG_CUSTOMANIMATION_ENTRANCE_EFFECT; break; - case EffectPresetClass::EXIT: nImage = IMG_CUSTOMANIMATION_EXIT_EFFECT; break; - case EffectPresetClass::EMPHASIS: nImage = IMG_CUSTOMANIMATION_EMPHASIS_EFFECT; break; - case EffectPresetClass::MOTIONPATH: nImage = IMG_CUSTOMANIMATION_MOTION_PATH; break; - case EffectPresetClass::OLEACTION: nImage = IMG_CUSTOMANIMATION_OLE; break; + case EffectPresetClass::ENTRANCE: + nImage = IMG_CUSTOMANIMATION_ENTRANCE_EFFECT; break; + case EffectPresetClass::EXIT: + nImage = IMG_CUSTOMANIMATION_EXIT_EFFECT; break; + case EffectPresetClass::EMPHASIS: + nImage = IMG_CUSTOMANIMATION_EMPHASIS_EFFECT; break; + case EffectPresetClass::MOTIONPATH: + nImage = IMG_CUSTOMANIMATION_MOTION_PATH; break; + case EffectPresetClass::OLEACTION: + nImage = IMG_CUSTOMANIMATION_OLE; break; case EffectPresetClass::MEDIACALL: - switch( mpEffect->getCommand() ) + switch (mpEffect->getCommand()) { - case EffectCommands::TOGGLEPAUSE: nImage = IMG_CUSTOMANIMATION_MEDIA_PAUSE; break; - case EffectCommands::STOP: nImage = IMG_CUSTOMANIMATION_MEDIA_STOP; break; + case EffectCommands::TOGGLEPAUSE: + nImage = IMG_CUSTOMANIMATION_MEDIA_PAUSE; break; + case EffectCommands::STOP: + nImage = IMG_CUSTOMANIMATION_MEDIA_STOP; break; case EffectCommands::PLAY: - default: nImage = IMG_CUSTOMANIMATION_MEDIA_PLAY; break; + default: + nImage = IMG_CUSTOMANIMATION_MEDIA_PLAY; break; } break; - default: nImage = 0xffff; + default: + nImage = 0xffff; } - if( nImage != 0xffff ) + if (nImage != 0xffff) { - const Image& rImage = mpParent->getImage( nImage ); - Point aImagePos( aPos ); - aImagePos.Y() += ( aSize.Height() - rImage.GetSizePixel().Height() ) >> 1; - rDev.DrawImage( aImagePos, rImage ); + const Image& rImage = mpParent->getImage(nImage); + Point aImagePos(aPos); + aImagePos.Y() += (aSize.Height() - rImage.GetSizePixel().Height()) >> 1; + rRenderContext.DrawImage(aImagePos, rImage); } aPos.X() += 19; - aPos.Y() += ( aSize.Height() - rDev.GetTextHeight()) >> 1; + aPos.Y() += (aSize.Height() - rDev.GetTextHeight()) >> 1; - rDev.DrawText( aPos, rDev.GetEllipsisString( maDescription, rDev.GetOutputSizePixel().Width() - aPos.X() ) ); + rRenderContext.DrawText(aPos, rRenderContext.GetEllipsisString(maDescription, rDev.GetOutputSizePixel().Width() - aPos.X())); } SvLBoxItem* CustomAnimationListEntryItem::Create() const @@ -336,8 +345,8 @@ public: void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; SvLBoxItem* Create() const SAL_OVERRIDE; void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; private: OUString maDescription; @@ -363,42 +372,42 @@ void CustomAnimationTriggerEntryItem::InitViewData( SvTreeListBox* pView, SvTree pViewData->maSize = aSize; } -void CustomAnimationTriggerEntryItem::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) +void CustomAnimationTriggerEntryItem::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { - Size aSize( rDev.GetOutputSizePixel().Width(), static_cast< SvTreeListBox* >(&rDev)->GetEntryHeight() ); + Size aSize(rRenderContext.GetOutputSizePixel().Width(), static_cast<SvTreeListBox*>(&rDev)->GetEntryHeight()); - Point aPos( 0, rPos.Y() ); + Point aPos(0, rPos.Y()); - Rectangle aOutRect( aPos, aSize ); + Rectangle aOutRect(aPos, aSize); // fill the background - Color aColor (rDev.GetSettings().GetStyleSettings().GetDialogColor()); + Color aColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor()); - rDev.Push(); - rDev.SetFillColor (aColor); - rDev.SetLineColor (); - rDev.DrawRect(aOutRect); + rRenderContext.Push(); + rRenderContext.SetFillColor(aColor); + rRenderContext.SetLineColor(); + rRenderContext.DrawRect(aOutRect); // Erase the four corner pixels to make the rectangle appear rounded. - rDev.SetLineColor( rDev.GetSettings().GetStyleSettings().GetWindowColor()); - rDev.DrawPixel( aOutRect.TopLeft()); - rDev.DrawPixel( Point(aOutRect.Right(), aOutRect.Top())); - rDev.DrawPixel( Point(aOutRect.Left(), aOutRect.Bottom())); - rDev.DrawPixel( Point(aOutRect.Right(), aOutRect.Bottom())); + rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); + rRenderContext.DrawPixel(aOutRect.TopLeft()); + rRenderContext.DrawPixel(Point(aOutRect.Right(), aOutRect.Top())); + rRenderContext.DrawPixel(Point(aOutRect.Left(), aOutRect.Bottom())); + rRenderContext.DrawPixel(Point(aOutRect.Right(), aOutRect.Bottom())); // draw the category title - int nVertBorder = (( aSize.Height() - rDev.GetTextHeight()) >> 1); - int nHorzBorder = rDev.LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width(); + int nVertBorder = ((aSize.Height() - rDev.GetTextHeight()) >> 1); + int nHorzBorder = rRenderContext.LogicToPixel(Size(3, 3), MAP_APPFONT).Width(); aOutRect.Left() += nHorzBorder; aOutRect.Right() -= nHorzBorder; aOutRect.Top() += nVertBorder; aOutRect.Bottom() -= nVertBorder; - rDev.DrawText (aOutRect, rDev.GetEllipsisString( maDescription, aOutRect.GetWidth() ) ); - rDev.Pop(); + rRenderContext.DrawText(aOutRect, rRenderContext.GetEllipsisString(maDescription, aOutRect.GetWidth())); + rRenderContext.Pop(); } SvLBoxItem* CustomAnimationTriggerEntryItem::Create() const diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index c75b6fa9aa08..373c2935dd27 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -91,6 +91,7 @@ public: virtual void Paint(const Point& aPos, SvTreeListBox& rDevice, + vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; @@ -143,7 +144,7 @@ void StyleLBoxString::InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry } void StyleLBoxString::Paint( - const Point& aPos, SvTreeListBox& rDevice, + const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { if (!pEntry) @@ -159,7 +160,7 @@ void StyleLBoxString::Paint( if (!bResult) { - rDevice.DrawText(aPos, GetText()); + rRenderContext.DrawText(aPos, GetText()); } } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index c53906f4f2d1..b412b7189d62 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -885,80 +885,79 @@ Rectangle SvImpLBox::GetClipRegionRect() const } -void SvImpLBox::Paint( const Rectangle& rRect ) +void SvImpLBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { - if( !pView->GetVisibleCount() ) + if (!pView->GetVisibleCount()) return; nFlags |= F_IN_PAINT; - if( nFlags & F_FILLING ) + if (nFlags & F_FILLING) { SvTreeListEntry* pFirst = pView->First(); - if( pFirst != pStartEntry ) + if (pFirst != pStartEntry) { - ShowCursor( false ); + ShowCursor(false); pStartEntry = pView->First(); aVerSBar->SetThumbPos( 0 ); StopUserEvent(); - ShowCursor( true ); - nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent), reinterpret_cast<void*>(1)); + ShowCursor(true); + nCurUserEvent = Application::PostUserEvent(LINK(this, SvImpLBox, MyUserEvent), reinterpret_cast<void*>(1)); return; } } - if( !pStartEntry ) + if (!pStartEntry) { pStartEntry = pView->First(); } - if( nNodeBmpTabDistance == NODE_BMP_TABDIST_NOTVALID ) + if (nNodeBmpTabDistance == NODE_BMP_TABDIST_NOTVALID) SetNodeBmpTabDistance(); long nRectHeight = rRect.GetHeight(); long nEntryHeight = pView->GetEntryHeight(); // calculate area for the entries we want to draw - sal_uInt16 nStartLine = (sal_uInt16)( rRect.Top() / nEntryHeight ); - sal_uInt16 nCount = (sal_uInt16)( nRectHeight / nEntryHeight ); - nCount += 2; // don't miss a row + sal_uInt16 nStartLine = static_cast<sal_uInt16>(rRect.Top() / nEntryHeight); + sal_uInt16 nCount = static_cast<sal_uInt16>(nRectHeight / nEntryHeight); + nCount += 2; // don't miss a row long nY = nStartLine * nEntryHeight; SvTreeListEntry* pEntry = pStartEntry; - while( nStartLine && pEntry ) + while (nStartLine && pEntry) { pEntry = pView->NextVisible(pEntry); nStartLine--; } - vcl::Region aClipRegion( GetClipRegionRect() ); + vcl::Region aClipRegion(GetClipRegionRect()); // first draw the lines, then clip them! - pView->SetClipRegion(); - if( m_nStyle & ( WB_HASLINES | WB_HASLINESATROOT ) ) - DrawNet(); + rRenderContext.SetClipRegion(); + if (m_nStyle & (WB_HASLINES | WB_HASLINESATROOT)) + DrawNet(rRenderContext); - pView->SetClipRegion( aClipRegion ); + rRenderContext.SetClipRegion(aClipRegion); - for( sal_uInt16 n=0; n< nCount && pEntry; n++ ) + for(sal_uInt16 n=0; n< nCount && pEntry; n++) { /*long nMaxRight=*/ - pView->PaintEntry1( pEntry, nY, SvLBoxTabFlags::ALL, true ); + pView->PaintEntry1(pEntry, nY, rRenderContext, SvLBoxTabFlags::ALL, true ); nY += nEntryHeight; pEntry = pView->NextVisible(pEntry); } - if ( !pCursor && ( ( nExtendedWinBits & EWB_NO_AUTO_CURENTRY ) == 0 ) ) + if (!pCursor && ((nExtendedWinBits & EWB_NO_AUTO_CURENTRY) == 0)) { // do not select if multiselection or explicit set - bool bNotSelect = ( aSelEng.GetSelectionMode() == MULTIPLE_SELECTION ) - || ( ( m_nStyle & WB_NOINITIALSELECTION ) == WB_NOINITIALSELECTION ); - SetCursor( pStartEntry, bNotSelect ); + bool bNotSelect = (aSelEng.GetSelectionMode() == MULTIPLE_SELECTION ) || ((m_nStyle & WB_NOINITIALSELECTION) == WB_NOINITIALSELECTION); + SetCursor(pStartEntry, bNotSelect); } nFlags &= (~F_DESEL_ALL); - pView->SetClipRegion(); - if( !(nFlags & F_PAINTED) ) + rRenderContext.SetClipRegion(); + if (!(nFlags & F_PAINTED)) { nFlags |= F_PAINTED; } @@ -1037,21 +1036,22 @@ void SvImpLBox::ScrollToAbsPos( long nPos ) } } -void SvImpLBox::DrawNet() +void SvImpLBox::DrawNet(vcl::RenderContext& rRenderContext) { - if( pView->GetVisibleCount() < 2 && !pStartEntry->HasChildrenOnDemand() && - !pStartEntry->HasChildren() ) + if (pView->GetVisibleCount() < 2 && !pStartEntry->HasChildrenOnDemand() && + !pStartEntry->HasChildren()) + { return; + } // for platforms that don't have nets, DrawNativeControl does nothing and returns true // so that SvImpLBox::DrawNet() doesn't draw anything either - if(pView->IsNativeControlSupported( CTRL_LISTNET, PART_ENTIRE_CONTROL)) { - ImplControlValue aControlValue; - Point aTemp(0,0); // temporary needed for g++ 3.3.5 - Rectangle aCtrlRegion( aTemp, Size( 0, 0 ) ); - ControlState nState = ControlState::ENABLED; - if( pView->DrawNativeControl( CTRL_LISTNET, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, OUString() ) ) + if (rRenderContext.IsNativeControlSupported(CTRL_LISTNET, PART_ENTIRE_CONTROL)) + { + ImplControlValue aControlValue; + ControlState nState = ControlState::ENABLED; + if (rRenderContext.DrawNativeControl(CTRL_LISTNET, PART_ENTIRE_CONTROL, + Rectangle(), nState, aControlValue, OUString())) { return; } @@ -1067,36 +1067,38 @@ void SvImpLBox::DrawNet() SvTreeListEntry* pEntry = pStartEntry; SvLBoxTab* pFirstDynamicTab = pView->GetFirstDynamicTab(); - while( pTree->GetDepth( pEntry ) > 0 ) - pEntry = pView->GetParent( pEntry ); - sal_uInt16 nOffs = (sal_uInt16)(pView->GetVisiblePos( pStartEntry ) - - pView->GetVisiblePos( pEntry )); + while (pTree->GetDepth( pEntry ) > 0) + { + pEntry = pView->GetParent(pEntry); + } + sal_uInt16 nOffs = static_cast<sal_uInt16>(pView->GetVisiblePos(pStartEntry) - pView->GetVisiblePos(pEntry)); long nY = 0; - nY -= ( nOffs * nEntryHeight ); + nY -= (nOffs * nEntryHeight); DBG_ASSERT(pFirstDynamicTab,"No Tree!"); - Color aOldLineColor = pView->GetLineColor(); - const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings(); - Color aCol= rStyleSettings.GetFaceColor(); + rRenderContext.Push(PushFlags::LINECOLOR); + + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + Color aCol = rStyleSettings.GetFaceColor(); - if( aCol.IsRGBEqual( pView->GetBackground().GetColor()) ) + if (aCol.IsRGBEqual(rRenderContext.GetBackground().GetColor())) aCol = rStyleSettings.GetShadowColor(); - pView->SetLineColor( aCol ); + rRenderContext.SetLineColor(aCol); Point aPos1, aPos2; sal_uInt16 nDistance; sal_uLong nMax = nVisibleCount + nOffs + 1; const Image& rExpandedNodeBitmap = GetExpandedNodeBmp(); - for( sal_uLong n=0; n< nMax && pEntry; n++ ) + for (sal_uLong n=0; n< nMax && pEntry; n++) { - if( pView->IsExpanded(pEntry) ) + if (pView->IsExpanded(pEntry)) { aPos1.X() = pView->GetTabPos(pEntry, pFirstDynamicTab); // if it is not a context bitmap, go a little to the right below the // first text (node bitmap, too) - if( !pView->nContextBmpWidthMax ) + if (!pView->nContextBmpWidthMax) aPos1.X() += rExpandedNodeBitmap.GetSizePixel().Width() / 2; aPos1.Y() = nY; @@ -1105,23 +1107,22 @@ void SvImpLBox::DrawNet() pChild = pView->FirstChild( pEntry ); DBG_ASSERT(pChild,"Child?"); pChild = SvTreeList::LastSibling( pChild ); - nDistance = (sal_uInt16)(pView->GetVisiblePos(pChild) - - pView->GetVisiblePos(pEntry)); + nDistance = static_cast<sal_uInt16>(pView->GetVisiblePos(pChild) - pView->GetVisiblePos(pEntry)); aPos2 = aPos1; aPos2.Y() += nDistance * nEntryHeight; - pView->DrawLine( aPos1, aPos2 ); + rRenderContext.DrawLine(aPos1, aPos2); } // visible in control? - if( n>= nOffs && ((m_nStyle & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry))) + if (n >= nOffs && ((m_nStyle & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry))) { // can we recycle aPos1? - if( !pView->IsExpanded(pEntry) ) + if (!pView->IsExpanded(pEntry)) { // nope aPos1.X() = pView->GetTabPos(pEntry, pFirstDynamicTab); // if it is not a context bitmap, go a little to the right below // the first text (node bitmap, too) - if( !pView->nContextBmpWidthMax ) + if (!pView->nContextBmpWidthMax) aPos1.X() += rExpandedNodeBitmap.GetSizePixel().Width() / 2; aPos1.Y() = nY; aPos1.Y() += nEntryHeightDIV2; @@ -1129,18 +1130,18 @@ void SvImpLBox::DrawNet() } aPos2.Y() = aPos1.Y(); aPos2.X() -= pView->GetIndent(); - pView->DrawLine( aPos1, aPos2 ); + rRenderContext.DrawLine(aPos1, aPos2); } nY += nEntryHeight; pEntry = pView->NextVisible(pEntry); } - if( m_nStyle & WB_HASLINESATROOT ) + if (m_nStyle & WB_HASLINESATROOT) { pEntry = pView->First(); - aPos1.X() = pView->GetTabPos( pEntry, pFirstDynamicTab); + aPos1.X() = pView->GetTabPos(pEntry, pFirstDynamicTab); // if it is not a context bitmap, go a little to the right below the // first text (node bitmap, too) - if( !pView->nContextBmpWidthMax ) + if (!pView->nContextBmpWidthMax) aPos1.X() += rExpandedNodeBitmap.GetSizePixel().Width() / 2; aPos1.X() -= pView->GetIndent(); aPos1.Y() = GetEntryLine( pEntry ); @@ -1149,9 +1150,9 @@ void SvImpLBox::DrawNet() aPos2.X() = aPos1.X(); aPos2.Y() = GetEntryLine( pChild ); aPos2.Y() += nEntryHeightDIV2; - pView->DrawLine( aPos1, aPos2 ); + rRenderContext.DrawLine(aPos1, aPos2); } - pView->SetLineColor( aOldLineColor ); + rRenderContext.Pop(); } void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask ) @@ -1638,9 +1639,10 @@ void SvImpLBox::EntrySelected( SvTreeListEntry* pEntry, bool bSelect ) long nY = GetEntryLine( pEntry ); if( IsLineVisible( nY ) ) { - ShowCursor( false ); - pView->PaintEntry1( pEntry, nY, SvLBoxTabFlags::ALL ); // because of ItemsetBrowser SvLBoxTabFlags::SHOW_SELECTION ); - ShowCursor( true ); + ShowCursor(false); + pView->Invalidate(); + //pView->PaintEntry1(pEntry, nY, SvLBoxTabFlags::ALL); // because of ItemsetBrowser SvLBoxTabFlags::SHOW_SELECTION ); + ShowCursor(true); } } } @@ -1894,8 +1896,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry ) // ****** Control the control animation -bool SvImpLBox::ButtonDownCheckCtrl( - const MouseEvent& rMEvt, SvTreeListEntry* pEntry, long nY) +bool SvImpLBox::ButtonDownCheckCtrl(const MouseEvent& rMEvt, SvTreeListEntry* pEntry, long /*nY*/) { SvLBoxItem* pItem = pView->GetItem(pEntry,rMEvt.GetPosPixel().X(),&pActiveTab); if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON) @@ -1906,9 +1907,10 @@ bool SvImpLBox::ButtonDownCheckCtrl( pView->HideFocus(); pView->CaptureMouse(); pActiveButton->SetStateHilighted( true ); - pView->PaintEntry1( pActiveEntry, nY, - SvLBoxTabFlags::PUSHABLE | SvLBoxTabFlags::ADJUST_CENTER | - SvLBoxTabFlags::ADJUST_RIGHT ); + //pView->PaintEntry1( pActiveEntry, nY, + // SvLBoxTabFlags::PUSHABLE | SvLBoxTabFlags::ADJUST_CENTER | + // SvLBoxTabFlags::ADJUST_RIGHT ); + pView->Invalidate(); return true; } else @@ -1920,7 +1922,6 @@ bool SvImpLBox::MouseMoveCheckCtrl(const MouseEvent& rMEvt, SvTreeListEntry* pEn { if( pActiveButton ) { - long nY; long nMouseX = rMEvt.GetPosPixel().X(); if( pEntry == pActiveEntry && pView->GetItem(pActiveEntry, nMouseX) == pActiveButton ) @@ -1928,10 +1929,7 @@ bool SvImpLBox::MouseMoveCheckCtrl(const MouseEvent& rMEvt, SvTreeListEntry* pEn if( !pActiveButton->IsStateHilighted() ) { pActiveButton->SetStateHilighted(true ); - nY = GetEntryLine( pActiveEntry ); - pView->PaintEntry1( pActiveEntry, nY, - SvLBoxTabFlags::PUSHABLE | SvLBoxTabFlags::ADJUST_CENTER | - SvLBoxTabFlags::ADJUST_RIGHT ); + pView->Invalidate(); } } else @@ -1939,8 +1937,7 @@ bool SvImpLBox::MouseMoveCheckCtrl(const MouseEvent& rMEvt, SvTreeListEntry* pEn if( pActiveButton->IsStateHilighted() ) { pActiveButton->SetStateHilighted(false ); - nY = GetEntryLine( pActiveEntry ); - pView->PaintEntry1( pActiveEntry, nY, SvLBoxTabFlags::PUSHABLE ); + pView->Invalidate(); } } return true; @@ -1954,17 +1951,13 @@ bool SvImpLBox::ButtonUpCheckCtrl( const MouseEvent& rMEvt ) { pView->ReleaseMouse(); SvTreeListEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() ); - long nY = GetEntryLine( pActiveEntry ); pActiveButton->SetStateHilighted( false ); long nMouseX = rMEvt.GetPosPixel().X(); - if( pEntry == pActiveEntry && - pView->GetItem( pActiveEntry, nMouseX ) == pActiveButton ) - pActiveButton->ClickHdl( pView, pActiveEntry ); - pView->PaintEntry1( pActiveEntry, nY, - SvLBoxTabFlags::PUSHABLE | SvLBoxTabFlags::ADJUST_CENTER | - SvLBoxTabFlags::ADJUST_RIGHT ); - if( pCursor == pActiveEntry ) - ShowCursor( true ); + if (pEntry == pActiveEntry && pView->GetItem(pActiveEntry, nMouseX) == pActiveButton) + pActiveButton->ClickHdl(pView, pActiveEntry); + pView->Invalidate(); + if (pCursor == pActiveEntry) + ShowCursor(true); pActiveButton = 0; pActiveEntry = 0; pActiveTab = 0; @@ -2872,7 +2865,8 @@ void SvImpLBox::SelAllDestrAnch( { long nY = GetEntryLine( pEntry ); if( IsLineVisible( nY ) ) - pView->PaintEntry1( pEntry, nY ); // because of ItemsetBrowser SvLBoxTabFlags::SHOW_SELECTION ); + pView->Invalidate(); + //pView->PaintEntry1( pEntry, nY ); // because of ItemsetBrowser SvLBoxTabFlags::SHOW_SELECTION ); } } pEntry = pTree->Next( pEntry ); @@ -3355,7 +3349,7 @@ bool SvImpLBox::IsNowExpandable() const return IsExpandable() && !pView->IsExpanded( pCursor ); } -IMPL_LINK(SvImpLBox,MyUserEvent,void*, pArg ) +IMPL_LINK(SvImpLBox, MyUserEvent, void*, pArg ) { nCurUserEvent = 0; if( !pArg ) diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 9aa97f00ed79..63a58d5a57b8 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -193,18 +193,18 @@ sal_uInt16 SvLBoxString::GetType() const } void SvLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* pEntry) + const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { if (pEntry) { sal_uInt16 nStyle = rDev.IsEnabled() ? 0 : TEXT_DRAW_DISABLE; - if ( rDev.IsEntryMnemonicsEnabled() ) + if (rDev.IsEntryMnemonicsEnabled()) nStyle |= TEXT_DRAW_MNEMONIC; - rDev.DrawText(Rectangle(rPos, GetSize(&rDev, pEntry)), maText, nStyle); + rRenderContext.DrawText(Rectangle(rPos, GetSize(&rDev, pEntry)), maText, nStyle); } else - rDev.DrawText(rPos, maText); + rRenderContext.DrawText(rPos, maText); } @@ -270,12 +270,11 @@ void SvLBoxBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, pViewData->maSize = aBmp.GetSizePixel(); } -void SvLBoxBmp::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* /*pEntry*/) +void SvLBoxBmp::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { sal_uInt16 nStyle = rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE; - rDev.DrawImage( rPos, aBmp ,nStyle); + rRenderContext.DrawImage(rPos, aBmp ,nStyle); } SvLBoxItem* SvLBoxBmp::Create() const @@ -338,44 +337,43 @@ bool SvLBoxButton::ClickHdl( SvTreeListBox*, SvTreeListEntry* pEntry ) } void SvLBoxButton::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, - const SvTreeListEntry* /*pEntry*/) + const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { - SvBmp nIndex = eKind == SvLBoxButtonKind_staticImage - ? SvBmp::STATICIMAGE : SvLBoxButtonData::GetIndex( nItemFlags ); - sal_uInt16 nStyle = eKind != SvLBoxButtonKind_disabledCheckbox && - rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE; + SvBmp nIndex = eKind == SvLBoxButtonKind_staticImage ? SvBmp::STATICIMAGE : SvLBoxButtonData::GetIndex(nItemFlags); + sal_uInt16 nStyle = eKind != SvLBoxButtonKind_disabledCheckbox && rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE; //Native drawing bool bNativeOK = false; ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX; - if ( nIndex != SvBmp::STATICIMAGE && rDev.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) ) + if ( nIndex != SvBmp::STATICIMAGE && rRenderContext.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) ) { Size aSize(pData->Width(), pData->Height()); - ImplAdjustBoxSize( aSize, eCtrlType, &rDev ); - ImplControlValue aControlValue; - Rectangle aCtrlRegion( rPos, aSize ); - ControlState nState = ControlState::NONE; + ImplAdjustBoxSize(aSize, eCtrlType, rRenderContext); + ImplControlValue aControlValue; + Rectangle aCtrlRegion( rPos, aSize ); + ControlState nState = ControlState::NONE; //states ControlState::DEFAULT, ControlState::PRESSED and ControlState::ROLLOVER are not implemented - if ( IsStateHilighted() ) nState |= ControlState::FOCUSED; - if ( nStyle != IMAGE_DRAW_DISABLE ) nState |= ControlState::ENABLED; - - if ( IsStateChecked() ) - aControlValue.setTristateVal( BUTTONVALUE_ON ); - else if ( IsStateUnchecked() ) - aControlValue.setTristateVal( BUTTONVALUE_OFF ); - else if ( IsStateTristate() ) + if (IsStateHilighted()) + nState |= ControlState::FOCUSED; + if (nStyle != IMAGE_DRAW_DISABLE) + nState |= ControlState::ENABLED; + if (IsStateChecked()) + aControlValue.setTristateVal(BUTTONVALUE_ON); + else if (IsStateUnchecked()) + aControlValue.setTristateVal(BUTTONVALUE_OFF); + else if (IsStateTristate()) aControlValue.setTristateVal( BUTTONVALUE_MIXED ); - if( isVis) - bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, OUString() ); + if (isVis) + bNativeOK = rRenderContext.DrawNativeControl(eCtrlType, PART_ENTIRE_CONTROL, + aCtrlRegion, nState, aControlValue, OUString()); } - if( !bNativeOK && isVis ) - rDev.DrawImage( rPos, pData->GetImage(nIndex), nStyle); + if (!bNativeOK && isVis) + rRenderContext.DrawImage(rPos, pData->GetImage(nIndex), nStyle); } SvLBoxItem* SvLBoxButton::Create() const @@ -388,9 +386,9 @@ void SvLBoxButton::Clone( SvLBoxItem* pSource ) pData = static_cast<SvLBoxButton*>(pSource)->pData; } -void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, vcl::Window* i_pParent ) +void SvLBoxButton::ImplAdjustBoxSize(Size& io_rSize, ControlType i_eType, vcl::RenderContext& rRenderContext) { - if ( i_pParent->IsNativeControlSupported( i_eType, PART_ENTIRE_CONTROL) ) + if (rRenderContext.IsNativeControlSupported( i_eType, PART_ENTIRE_CONTROL) ) { ImplControlValue aControlValue; Rectangle aCtrlRegion( Point( 0, 0 ), io_rSize ); @@ -399,7 +397,7 @@ void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, vcl:: aControlValue.setTristateVal( BUTTONVALUE_ON ); Rectangle aNativeBounds, aNativeContent; - bool bNativeOK = i_pParent->GetNativeControlRegion( i_eType, + bool bNativeOK = rRenderContext.GetNativeControlRegion( i_eType, PART_ENTIRE_CONTROL, aCtrlRegion, nState, @@ -419,8 +417,7 @@ void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, vcl:: } } -void SvLBoxButton::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, - SvViewDataItem* pViewData ) +void SvLBoxButton::InitViewData(SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) { if( !pViewData ) pViewData = pView->GetViewDataItem( pEntry, this ); @@ -428,7 +425,7 @@ void SvLBoxButton::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX; if ( eKind != SvLBoxButtonKind_staticImage && pView ) - ImplAdjustBoxSize( aSize, eCtrlType, pView ); + ImplAdjustBoxSize(aSize, eCtrlType, *pView); pViewData->maSize = aSize; } @@ -508,7 +505,7 @@ void SvLBoxContextBmp::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntr } void SvLBoxContextBmp::Paint( - const Point& _rPos, SvTreeListBox& _rDev, + const Point& _rPos, SvTreeListBox& _rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { @@ -518,9 +515,9 @@ void SvLBoxContextBmp::Paint( bool _bSemiTransparent = pEntry && bool( SvTLEntryFlags::SEMITRANSPARENT & pEntry->GetFlags( ) ); // draw sal_uInt16 nStyle = _rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE; - if ( _bSemiTransparent ) + if (_bSemiTransparent) nStyle |= IMAGE_DRAW_SEMITRANSPARENT; - _rDev.DrawImage( _rPos, rImage, nStyle); + rRenderContext.DrawImage(_rPos, rImage, nStyle); } SvLBoxItem* SvLBoxContextBmp::Create() const diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 616d96b55679..55b9c9715bd0 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -45,7 +45,7 @@ #include <string.h> #include <vector> -using namespace ::com::sun::star::accessibility; +using namespace css::accessibility; // Drag&Drop static SvTreeListBox* pDDSource = NULL; @@ -2567,20 +2567,21 @@ void SvTreeListBox::AdjustEntryHeightAndRecalc( const vcl::Font& rFont ) RecalcViewData(); } -void SvTreeListBox::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) +void SvTreeListBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { Control::Paint(rRenderContext, rRect); - if( nTreeFlags & SvTreeFlags::RECALCTABS ) + if(nTreeFlags & SvTreeFlags::RECALCTABS) SetTabs(); - pImp->Paint( rRect ); + pImp->Paint(rRenderContext, rRect); + //Add visual focus draw - if( !First() ) + if (!First()) { - if( HasFocus() ) + if (HasFocus()) { - long tempHeight = GetTextHeight(); - Rectangle tempRect(Point(0, 0), Size(GetSizePixel().Width(), tempHeight)); - ShowFocus(tempRect); + long nHeight = rRenderContext.GetTextHeight(); + Rectangle aRect(Point(0, 0), Size(GetSizePixel().Width(), nHeight)); + ShowFocus(aRect); } else { @@ -2672,15 +2673,14 @@ void SvTreeListBox::ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) pImp->InvalidateEntry( (SvTreeListEntry*)pEntry ); } -void SvTreeListBox::EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem, - const Selection& rSelection ) +void SvTreeListBox::EditItemText(SvTreeListEntry* pEntry, SvLBoxString* pItem, const Selection& rSelection) { DBG_ASSERT(pEntry&&pItem,"EditItemText: Bad params"); if( IsSelected( pEntry )) { pImp->ShowCursor( false ); SelectListEntry( pEntry, false ); - PaintEntry( pEntry ); + Invalidate(); SelectListEntry( pEntry, true ); pImp->ShowCursor( true ); } @@ -2861,39 +2861,39 @@ void SvTreeListBox::ImplInitStyle() Invalidate(); } -void SvTreeListBox::PaintEntry( SvTreeListEntry* pEntry ) +void SvTreeListBox::PaintEntry(SvTreeListEntry* pEntry, vcl::RenderContext& rRenderContext) { DBG_ASSERT(pEntry,"PaintEntry:No Entry"); - if( pEntry ) - pImp->PaintEntry( pEntry ); + if (pEntry) + pImp->PaintEntry(pEntry, rRenderContext); } -void SvTreeListBox::InvalidateEntry( SvTreeListEntry* pEntry ) +void SvTreeListBox::InvalidateEntry(SvTreeListEntry* pEntry) { DBG_ASSERT(pEntry,"InvalidateEntry:No Entry"); - if( pEntry ) + if (pEntry) { - GetModel()->InvalidateEntry( pEntry ); + GetModel()->InvalidateEntry(pEntry); } } -long SvTreeListBox::PaintEntry(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFlags nTabFlags) +long SvTreeListBox::PaintEntry(SvTreeListEntry* pEntry, long nLine, vcl::RenderContext& rRenderContext, SvLBoxTabFlags nTabFlags) { - return PaintEntry1(pEntry,nLine,nTabFlags); + return PaintEntry1(pEntry, nLine, rRenderContext, nTabFlags); } -long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFlags nTabFlags, - bool bHasClipRegion ) +long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::RenderContext& rRenderContext, + SvLBoxTabFlags nTabFlags, bool bHasClipRegion) { Rectangle aRect; // multi purpose bool bHorSBar = pImp->HasHorScrollBar(); - PreparePaint( pEntry ); + PreparePaint(pEntry); - pImp->UpdateContextBmpWidthMax( pEntry ); + pImp->UpdateContextBmpWidthMax(pEntry); - if( nTreeFlags & SvTreeFlags::RECALCTABS ) + if (nTreeFlags & SvTreeFlags::RECALCTABS) SetTabs(); short nTempEntryHeight = GetEntryHeight(); @@ -2901,16 +2901,16 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl // Did we turn on the scrollbar within PreparePaints? If yes, we have to set // the ClipRegion anew. - if( !bHorSBar && pImp->HasHorScrollBar() ) - SetClipRegion( vcl::Region(pImp->GetClipRegionRect()) ); + if (!bHorSBar && pImp->HasHorScrollBar()) + rRenderContext.SetClipRegion(vcl::Region(pImp->GetClipRegionRect())); - Point aEntryPos( GetMapMode().GetOrigin() ); + Point aEntryPos(rRenderContext.GetMapMode().GetOrigin()); aEntryPos.X() *= -1; // conversion document coordinates long nMaxRight = nWidth + aEntryPos.X() - 1; - Color aBackupTextColor( GetTextColor() ); - vcl::Font aBackupFont( GetFont() ); - Color aBackupColor = GetFillColor(); + Color aBackupTextColor(rRenderContext.GetTextColor()); + vcl::Font aBackupFont(rRenderContext.GetFont()); + Color aBackupColor = rRenderContext.GetFillColor(); bool bCurFontIsSel = false; bool bInUse = pEntry->HasInUseEmphasis(); @@ -2918,17 +2918,17 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl const WinBits nWindowStyle = GetStyle(); const bool bResetClipRegion = !bHasClipRegion; const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) !=0 && !HasFocus(); - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); - vcl::Font aHighlightFont( GetFont() ); - const Color aHighlightTextColor( rSettings.GetHighlightTextColor() ); - aHighlightFont.SetColor( aHighlightTextColor ); + vcl::Font aHighlightFont(rRenderContext.GetFont()); + const Color aHighlightTextColor(rSettings.GetHighlightTextColor()); + aHighlightFont.SetColor(aHighlightTextColor); - Size aRectSize( 0, nTempEntryHeight ); + Size aRectSize(0, nTempEntryHeight); - if( !bHasClipRegion && nWindowStyle & WB_HSCROLL ) + if (!bHasClipRegion && nWindowStyle & WB_HSCROLL) { - SetClipRegion( vcl::Region(pImp->GetClipRegionRect()) ); + rRenderContext.SetClipRegion(vcl::Region(pImp->GetClipRegionRect())); bHasClipRegion = true; } @@ -2939,39 +2939,39 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl sal_uInt16 nCurTab = 0; sal_uInt16 nCurItem = 0; - while( nCurTab < nTabCount && nCurItem < nItemCount ) + while (nCurTab < nTabCount && nCurItem < nItemCount) { - SvLBoxTab* pTab = aTabs[ nCurTab ]; + SvLBoxTab* pTab = aTabs[nCurTab]; sal_uInt16 nNextTab = nCurTab + 1; SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab] : 0; SvLBoxItem* pItem = nCurItem < nItemCount ? pEntry->GetItem(nCurItem) : 0; SvLBoxTabFlags nFlags = pTab->nFlags; - Size aSize( SvLBoxItem::GetSize( pViewDataEntry, nCurItem )); - long nTabPos = GetTabPos( pEntry, pTab ); + Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nCurItem)); + long nTabPos = GetTabPos(pEntry, pTab); long nNextTabPos; - if( pNextTab ) - nNextTabPos = GetTabPos( pEntry, pNextTab ); + if (pNextTab) + nNextTabPos = GetTabPos(pEntry, pNextTab); else { nNextTabPos = nMaxRight; - if( nTabPos > nMaxRight ) + if (nTabPos > nMaxRight) nNextTabPos += 50; } long nX; if( pTab->nFlags & SvLBoxTabFlags::ADJUST_RIGHT ) // avoid cutting the right edge off the tab separation - nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos-SV_TAB_BORDER-1) -nTabPos); + nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos - SV_TAB_BORDER - 1) - nTabPos); else - nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos-nTabPos); + nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos); - if( nFlags & nTabFlags ) + if (nFlags & nTabFlags) { - if( !bHasClipRegion && nX + aSize.Width() >= nMaxRight ) + if (!bHasClipRegion && nX + aSize.Width() >= nMaxRight) { - SetClipRegion( vcl::Region(pImp->GetClipRegionRect()) ); + rRenderContext.SetClipRegion(vcl::Region(pImp->GetClipRegionRect())); bHasClipRegion = true; } aEntryPos.X() = nX; @@ -2979,7 +2979,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl // set background pattern/color - Wallpaper aWallpaper = GetBackground(); + Wallpaper aWallpaper = rRenderContext.GetBackground(); bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION); sal_uInt16 nItemType = pItem->GetType(); @@ -2987,49 +2987,55 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl if (pViewDataEntry->IsHighlighted() && bSelTab && !pViewDataEntry->IsCursored()) { Color aNewWallColor = rSettings.GetHighlightColor(); - if ( !bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP ) + if (!bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP) { // if the face color is bright then the deactive color is also bright // -> so you can't see any deactive selection - if ( bHideSelection && !rSettings.GetFaceColor().IsBright() && - aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright() ) + if ( bHideSelection && !rSettings.GetFaceColor().IsBright() + && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright()) + { aNewWallColor = rSettings.GetDeactiveColor(); + } // set font color to highlight - if ( !bCurFontIsSel ) + if (!bCurFontIsSel) { - SetTextColor( aHighlightTextColor ); - Control::SetFont( aHighlightFont ); + rRenderContext.SetTextColor(aHighlightTextColor); + rRenderContext.SetFont(aHighlightFont); bCurFontIsSel = true; } } - aWallpaper.SetColor( aNewWallColor ); + aWallpaper.SetColor(aNewWallColor); } else // no selection { - if( bInUse && nItemType == SV_ITEM_ID_LBOXCONTEXTBMP ) - aWallpaper.SetColor( rSettings.GetFieldColor() ); - else if( bCurFontIsSel ) + if (bInUse && nItemType == SV_ITEM_ID_LBOXCONTEXTBMP) + { + aWallpaper.SetColor(rSettings.GetFieldColor()); + } + else if (bCurFontIsSel) { bCurFontIsSel = false; - SetTextColor( aBackupTextColor ); - Control::SetFont( aBackupFont ); + rRenderContext.SetTextColor(aBackupTextColor); + rRenderContext.SetFont(aBackupFont); } else - aWallpaper.SetColor( pEntry->GetBackColor() ); + { + aWallpaper.SetColor(pEntry->GetBackColor()); + } } // draw background - if( !(nTreeFlags & SvTreeFlags::USESEL)) + if (!(nTreeFlags & SvTreeFlags::USESEL)) { // only draw the area that is used by the item aRectSize.Width() = aSize.Width(); - aRect.SetPos( aEntryPos ); - aRect.SetSize( aRectSize ); + aRect.SetPos(aEntryPos); + aRect.SetSize(aRectSize); } else { // draw from the current to the next tab - if( nCurTab != 0 ) + if (nCurTab != 0) aRect.Left() = nTabPos; else // if we're in the 0th tab, always draw from column 0 -- @@ -3037,33 +3043,35 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl aRect.Left() = 0; aRect.Top() = nLine; aRect.Bottom() = nLine + nTempEntryHeight - 1; - if( pNextTab ) + if (pNextTab) { long nRight; - nRight = GetTabPos(pEntry,pNextTab)-1; - if( nRight > nMaxRight ) + nRight = GetTabPos(pEntry, pNextTab) - 1; + if (nRight > nMaxRight) nRight = nMaxRight; aRect.Right() = nRight; } else + { aRect.Right() = nMaxRight; + } } // A custom selection that starts at a tab position > 0, do not fill // the background of the 0th item, else e.g. we might not be able to // realize tab listboxes with lines. - if( !(nCurTab==0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab) ) + if (!(nCurTab==0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab)) { - SetFillColor( aWallpaper.GetColor() ); + rRenderContext.SetFillColor(aWallpaper.GetColor()); // this case may occur for smaller horizontal resizes - if( aRect.Left() < aRect.Right() ) - DrawRect( aRect ); + if (aRect.Left() < aRect.Right()) + rRenderContext.DrawRect(aRect); } // draw item // center vertically - aEntryPos.Y() += ( nTempEntryHeight - aSize.Height() ) / 2; + aEntryPos.Y() += (nTempEntryHeight - aSize.Height()) / 2; pViewDataEntry->SetPaintRectangle(aRect); - pItem->Paint(aEntryPos, *this, pViewDataEntry, pEntry); + pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, pEntry); // division line between tabs if (pNextTab && pItem->GetType() == SV_ITEM_ID_LBOXSTRING && @@ -3071,37 +3079,37 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl aRect.Right() < nMaxRight) { aRect.Left() = aRect.Right() - SV_TAB_BORDER; - DrawRect( aRect ); + rRenderContext.DrawRect(aRect); } - SetFillColor( aBackupColor ); + rRenderContext.SetFillColor(aBackupColor); } nCurItem++; nCurTab++; } - if( pViewDataEntry->IsCursored() && !HasFocus() ) + if (pViewDataEntry->IsCursored() && !HasFocus()) { // cursor emphasis - SetFillColor(); - Color aOldLineColor = GetLineColor(); - SetLineColor( Color( COL_BLACK ) ); - aRect = GetFocusRect( pEntry, nLine ); + rRenderContext.SetFillColor(); + Color aOldLineColor = rRenderContext.GetLineColor(); + SetLineColor(Color(COL_BLACK)); + aRect = GetFocusRect(pEntry, nLine); aRect.Top()++; aRect.Bottom()--; - DrawRect( aRect ); - SetLineColor( aOldLineColor ); - SetFillColor( aBackupColor ); + rRenderContext.DrawRect(aRect); + rRenderContext.SetLineColor(aOldLineColor); + rRenderContext.SetFillColor(aBackupColor); } - if( bCurFontIsSel ) + if (bCurFontIsSel) { - SetTextColor( aBackupTextColor ); - Control::SetFont( aBackupFont ); + rRenderContext.SetTextColor(aBackupTextColor); + rRenderContext.SetFont(aBackupFont); } sal_uInt16 nFirstDynTabPos; - SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab( nFirstDynTabPos ); - long nDynTabPos = GetTabPos( pEntry, pFirstDynamicTab ); + SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab(nFirstDynTabPos); + long nDynTabPos = GetTabPos(pEntry, pFirstDynamicTab); nDynTabPos += pImp->nNodeBmpTabDistance; nDynTabPos += pImp->nNodeBmpWidth / 2; nDynTabPos += 4; // 4 pixels of buffer, so the node bitmap is not too close @@ -3109,7 +3117,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl if( (!(pEntry->GetFlags() & SvTLEntryFlags::NO_NODEBMP)) && (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab && - ( pEntry->HasChildren() || pEntry->HasChildrenOnDemand() ) ) + (pEntry->HasChildren() || pEntry->HasChildrenOnDemand())) { // find first tab and check if the node bitmap extends into it sal_uInt16 nNextTab = nFirstDynTabPos; @@ -3118,72 +3126,79 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl { nNextTab++; pNextTab = nNextTab < nTabCount ? aTabs[nNextTab] : 0; - } while( pNextTab && pNextTab->IsDynamic() ); + } while (pNextTab && pNextTab->IsDynamic()); - if( !pNextTab || (GetTabPos( pEntry, pNextTab ) > nDynTabPos) ) + if (!pNextTab || (GetTabPos( pEntry, pNextTab ) > nDynTabPos)) { - if((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(pEntry) > 0) + if ((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(pEntry) > 0) { - Point aPos( GetTabPos(pEntry,pFirstDynamicTab), nLine ); + Point aPos(GetTabPos(pEntry, pFirstDynamicTab), nLine); aPos.X() += pImp->nNodeBmpTabDistance; const Image* pImg = 0; - if( IsExpanded(pEntry) ) - pImg = &pImp->GetExpandedNodeBmp( ); + if (IsExpanded(pEntry)) + pImg = &pImp->GetExpandedNodeBmp(); else { - if( (!pEntry->HasChildren()) && pEntry->HasChildrenOnDemand() && + if ((!pEntry->HasChildren()) && pEntry->HasChildrenOnDemand() && (!(pEntry->GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) && - pImp->GetDontKnowNodeBmp().GetSizePixel().Width() ) + pImp->GetDontKnowNodeBmp().GetSizePixel().Width()) + { pImg = &pImp->GetDontKnowNodeBmp( ); + } else + { pImg = &pImp->GetCollapsedNodeBmp( ); + } } aPos.Y() += (nTempEntryHeight - pImg->GetSizePixel().Height()) / 2; sal_uInt16 nStyle = 0; - if ( !IsEnabled() ) + if (!IsEnabled()) nStyle |= IMAGE_DRAW_DISABLE; //native bool bNativeOK = false; - if ( IsNativeControlSupported( CTRL_LISTNODE, PART_ENTIRE_CONTROL) ) + if (rRenderContext.IsNativeControlSupported(CTRL_LISTNODE, PART_ENTIRE_CONTROL)) { - ImplControlValue aControlValue; - Rectangle aCtrlRegion( aPos, pImg->GetSizePixel() ); - ControlState nState = ControlState::NONE; + ImplControlValue aControlValue; + Rectangle aCtrlRegion(aPos, pImg->GetSizePixel()); + ControlState nState = ControlState::NONE; - if ( IsEnabled() ) nState |= ControlState::ENABLED; + if (IsEnabled()) + nState |= ControlState::ENABLED; - if ( IsExpanded(pEntry) ) - aControlValue.setTristateVal( BUTTONVALUE_ON );//expanded node + if (IsExpanded(pEntry)) + aControlValue.setTristateVal(BUTTONVALUE_ON); //expanded node else { - if( (!pEntry->HasChildren() ) && - pEntry->HasChildrenOnDemand() && - (!(pEntry->GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) && - pImp->GetDontKnowNodeBmp().GetSizePixel().Width() - ) + if ((!pEntry->HasChildren()) && pEntry->HasChildrenOnDemand() && + (!(pEntry->GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) && + pImp->GetDontKnowNodeBmp().GetSizePixel().Width()) + { aControlValue.setTristateVal( BUTTONVALUE_DONTKNOW ); //dont know + } else + { aControlValue.setTristateVal( BUTTONVALUE_OFF ); //collapsed node + } } - bNativeOK = DrawNativeControl( CTRL_LISTNODE, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, OUString() ); + bNativeOK = rRenderContext.DrawNativeControl(CTRL_LISTNODE, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, OUString()); } - if( !bNativeOK) { - DrawImage( aPos, *pImg ,nStyle); + if (!bNativeOK) + { + rRenderContext.DrawImage(aPos, *pImg ,nStyle); } } } } + if (bHasClipRegion && bResetClipRegion) + rRenderContext.SetClipRegion(); - if( bHasClipRegion && bResetClipRegion ) - SetClipRegion(); return 0; // nRowLen; } diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index 3abde0e2b5a0..caf45482bb2f 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -183,7 +183,7 @@ private: void SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect = false ); - void DrawNet(); + void DrawNet(vcl::RenderContext& rRenderContext); // ScrollBar-Handler DECL_LINK( ScrollUpDownHdl, ScrollBar * ); @@ -263,7 +263,7 @@ public: void CollapsingEntry( SvTreeListEntry* pEntry ); void EntrySelected( SvTreeListEntry* pEntry, bool bSelect ); - void Paint( const Rectangle& rRect ); + void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect); void MouseButtonDown( const MouseEvent& ); void MouseButtonUp( const MouseEvent& ); void MouseMove( const MouseEvent&); @@ -273,7 +273,7 @@ public: void LoseFocus(); void UpdateAll( bool bInvalidateCompleteView= true, bool bUpdateVerSBar = true ); void SetEntryHeight( short nHeight ); - void PaintEntry( SvTreeListEntry* pEntry ); + void PaintEntry(SvTreeListEntry* pEntry, vcl::RenderContext& rRenderContext); void InvalidateEntry( SvTreeListEntry* ); void RecalcFocusRect(); @@ -403,10 +403,10 @@ inline Point SvImpLBox::GetEntryPosition( SvTreeListEntry* pEntry ) const return Point( 0, GetEntryLine( pEntry ) ); } -inline void SvImpLBox::PaintEntry( SvTreeListEntry* pEntry ) +inline void SvImpLBox::PaintEntry(SvTreeListEntry* pEntry, vcl::RenderContext& rRenderContext) { - long nY = GetEntryLine( pEntry ); - pView->PaintEntry( pEntry, nY ); + long nY = GetEntryLine(pEntry); + pView->PaintEntry(pEntry, nY, rRenderContext); } inline bool SvImpLBox::IsLineVisible( long nY ) const diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index e1d132694a13..d76c05e45920 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -115,8 +115,8 @@ public: void SetImage( const Image& rImage ); OUString GetGraphicURL() const { return maGraphicURL;} void SetGraphicURL( const OUString& rGraphicURL ); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; SvLBoxItem* Create() const SAL_OVERRIDE; void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; @@ -1593,29 +1593,29 @@ UnoTreeListItem::~UnoTreeListItem() void UnoTreeListItem::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - Point aPos( rPos ); + Point aPos(rPos); if (pEntry) { - Size aSize( GetSize(&rDev, pEntry) ); - if( !!maImage ) + Size aSize(GetSize(&rDev, pEntry)); + if (!!maImage) { - rDev.DrawImage( aPos, maImage, rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE ); + rRenderContext.DrawImage(aPos, maImage, rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE); int nWidth = maImage.GetSizePixel().Width() + 6; aPos.X() += nWidth; aSize.Width() -= nWidth; } - rDev.DrawText( Rectangle(aPos,aSize),maText, rDev.IsEnabled() ? 0 : TEXT_DRAW_DISABLE ); + rRenderContext.DrawText(Rectangle(aPos,aSize),maText, rDev.IsEnabled() ? 0 : TEXT_DRAW_DISABLE); } else { - if( !!maImage ) + if (!!maImage) { - rDev.DrawImage( aPos, maImage, rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE); + rRenderContext.DrawImage(aPos, maImage, rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE); aPos.X() += maImage.GetSizePixel().Width() + 6; } - rDev.DrawText( aPos, maText); + rRenderContext.DrawText(aPos, maText); } } diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 27d580a2000c..457bfddedb6d 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -79,18 +79,16 @@ SvLBoxItem* SvLBoxColorString::Create() const return new SvLBoxColorString; } -void SvLBoxColorString::Paint( - const Point& rPos, SvTreeListBox& rDev, - const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) +void SvLBoxColorString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { - Color aColor=rDev.GetTextColor(); - Color a2Color=aColor; + Color aColor = rRenderContext.GetTextColor(); if (!pView->IsSelected()) { - rDev.SetTextColor(aPrivColor); + rRenderContext.SetTextColor(aPrivColor); } - SvLBoxString::Paint(rPos, rDev, pView, pEntry); - rDev.SetTextColor(a2Color); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); + rRenderContext.SetTextColor(aColor); } SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits) diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index b7b32b35f6cf..f431a55334b0 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -767,45 +767,45 @@ RecovDocListEntry::RecovDocListEntry( SvTreeListEntry* pEntry, } -void RecovDocListEntry::Paint( - const Point& aPos, SvTreeListBox& aDevice, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void RecovDocListEntry::Paint(const Point& aPos, SvTreeListBox& aDevice, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { - const Image* pImg = 0; - const OUString* pTxt = 0; - RecovDocList* pList = static_cast< RecovDocList* >(&aDevice); + const Image* pImg = 0; + const OUString* pTxt = 0; + RecovDocList* pList = static_cast<RecovDocList*>(&aDevice); - TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData()); - switch(pInfo->RecoveryState) + TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData()); + switch (pInfo->RecoveryState) { - case E_SUCCESSFULLY_RECOVERED : + case E_SUCCESSFULLY_RECOVERED: { pImg = &pList->m_aGreenCheckImg; pTxt = &pList->m_aSuccessRecovStr; } break; - case E_ORIGINAL_DOCUMENT_RECOVERED : // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow + case E_ORIGINAL_DOCUMENT_RECOVERED: // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow { pImg = &pList->m_aYellowCheckImg; pTxt = &pList->m_aOrigDocRecovStr; } break; - case E_RECOVERY_FAILED : + case E_RECOVERY_FAILED: { pImg = &pList->m_aRedCrossImg; pTxt = &pList->m_aRecovFailedStr; } break; - case E_RECOVERY_IS_IN_PROGRESS : + case E_RECOVERY_IS_IN_PROGRESS: { pImg = 0; pTxt = &pList->m_aRecovInProgrStr; } break; - case E_NOT_RECOVERED_YET : + case E_NOT_RECOVERED_YET: { pImg = 0; pTxt = &pList->m_aNotRecovYetStr; @@ -814,14 +814,14 @@ void RecovDocListEntry::Paint( } if (pImg) - aDevice.DrawImage(aPos, *pImg); + rRenderContext.DrawImage(aPos, *pImg); if (pTxt) { Point aPnt(aPos); aPnt.X() += pList->m_aGreenCheckImg.GetSizePixel().Width(); aPnt.X() += 10; - aDevice.DrawText(aPnt, *pTxt); + rRenderContext.DrawText(aPnt, *pTxt); } } diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx index d36bc4291d44..6b7d1ada0859 100644 --- a/svx/source/dialog/fontlb.cxx +++ b/svx/source/dialog/fontlb.cxx @@ -37,36 +37,35 @@ SvLBoxFontString::SvLBoxFontString( maFont( rFont ), mbUseColor( pColor != NULL ) { - SetText( rString ); - if( pColor ) - maFont.SetColor( *pColor ); + SetText(rString); + if(pColor) + maFont.SetColor(*pColor); } SvLBoxFontString::~SvLBoxFontString() { } - SvLBoxItem* SvLBoxFontString::Create() const { return new SvLBoxFontString; } -void SvLBoxFontString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) +void SvLBoxFontString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { - vcl::Font aOldFont( rDev.GetFont() ); - vcl::Font aNewFont( maFont ); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aNewFont(maFont); bool bSel = pView->IsSelected(); - if( !mbUseColor || bSel ) // selection always gets highlight color + if (!mbUseColor || bSel) // selection always gets highlight color { - const StyleSettings& rSett = Application::GetSettings().GetStyleSettings(); - aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() ); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + aNewFont.SetColor(bSel ? rStyleSettings.GetHighlightTextColor() : rStyleSettings.GetFieldTextColor()); } - rDev.SetFont( aNewFont ); - SvLBoxString::Paint(rPos, rDev, pView, pEntry); - rDev.SetFont( aOldFont ); + rRenderContext.SetFont(aNewFont); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); + rRenderContext.Pop(); } void SvLBoxFontString::InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData ) diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index b255e72a84d9..906a6ffec33c 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -1014,43 +1014,42 @@ public: FmFilterItemsString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ) :SvLBoxString(pEntry,nFlags,rStr){} - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) SAL_OVERRIDE; }; const int nxDBmp = 12; -void FmFilterItemsString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) +void FmFilterItemsString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) { FmFilterItems* pRow = static_cast<FmFilterItems*>(pEntry->GetUserData()); FmFormItem* pForm = static_cast<FmFormItem*>(pRow->GetParent()); // current filter is significant painted const bool bIsCurrentFilter = pForm->GetChildren()[ pForm->GetFilterController()->getActiveTerm() ] == pRow; - if ( bIsCurrentFilter ) + if (bIsCurrentFilter) { - rDev.Push( PushFlags::LINECOLOR ); + rRenderContext.Push(PushFlags::LINECOLOR); + rRenderContext.SetLineColor(rRenderContext.GetTextColor()); - rDev.SetLineColor( rDev.GetTextColor() ); + Rectangle aRect(rPos, GetSize(&rDev, pEntry)); + Point aFirst(rPos.X(), aRect.Bottom() - 6); + Point aSecond(aFirst .X() + 2, aFirst.Y() + 3); - Rectangle aRect( rPos, GetSize( &rDev, pEntry ) ); - Point aFirst( rPos.X(), aRect.Bottom() - 6 ); - Point aSecond(aFirst .X() + 2, aFirst.Y() + 3 ); - - rDev.DrawLine( aFirst, aSecond ); + rRenderContext.DrawLine(aFirst, aSecond); aFirst = aSecond; aFirst.X() += 1; aSecond.X() += 6; aSecond.Y() -= 5; - rDev.DrawLine( aFirst, aSecond ); - - rDev.Pop(); + rRenderContext.DrawLine(aFirst, aSecond); + rRenderContext.Pop(); } - rDev.DrawText( Point(rPos.X() + nxDBmp, rPos.Y()), GetText() ); + rRenderContext.DrawText(Point(rPos.X() + nxDBmp, rPos.Y()), GetText()); } @@ -1070,13 +1069,14 @@ class FmFilterString : public SvLBoxString public: FmFilterString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr, const OUString& aName) - :SvLBoxString(pEntry,nFlags,rStr) - ,m_aName(aName) + : SvLBoxString(pEntry,nFlags,rStr) + , m_aName(aName) { m_aName += ": "; } - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) SAL_OVERRIDE; }; @@ -1100,21 +1100,21 @@ void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, } -void FmFilterString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) +void FmFilterString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) { - vcl::Font aOldFont( rDev.GetFont()); - vcl::Font aFont( aOldFont ); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aFont(rRenderContext.GetFont()); aFont.SetWeight(WEIGHT_BOLD); - rDev.SetFont( aFont ); + rRenderContext.SetFont(aFont); Point aPos(rPos); - rDev.DrawText( aPos, m_aName ); + rRenderContext.DrawText(aPos, m_aName); // position for the second text aPos.X() += rDev.GetTextWidth(m_aName) + nxD; - rDev.SetFont( aOldFont ); - rDev.DrawText( aPos, GetText() ); + rRenderContext.Pop(); + rDev.DrawText(aPos, GetText()); } FmFilterNavigator::FmFilterNavigator( vcl::Window* pParent ) diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index 326260e42f52..207295015903 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -454,8 +454,8 @@ public: /** @short TODO */ - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index faf669d7136a..9421f16c1926 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -216,9 +216,8 @@ public: { } - virtual void Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; namespace sfx2 { class DocumentInserter; } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 1a08cde77132..5d2d3a412a89 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3463,9 +3463,8 @@ public: SwContentLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} - virtual void Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; }; void SwContentTree::InitEntry(SvTreeListEntry* pEntry, @@ -3479,20 +3478,18 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry, pEntry->ReplaceItem( pStr, nColToHilite ); } -void SwContentLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) +void SwContentLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { - if(lcl_IsContent(pEntry) && - static_cast<SwContent *>(pEntry->GetUserData())->IsInvisible()) + if (lcl_IsContent(pEntry) && static_cast<SwContent *>(pEntry->GetUserData())->IsInvisible()) { - vcl::Font aOldFont( rDev.GetFont()); + vcl::Font aOldFont(rRenderContext.GetFont()); vcl::Font aFont(aOldFont); - Color aCol( COL_LIGHTGRAY ); - aFont.SetColor( aCol ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); + Color aCol(COL_LIGHTGRAY); + aFont.SetColor(aCol); + rRenderContext.SetFont(aFont ); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.SetFont(aOldFont); } // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this /* @@ -3513,10 +3510,10 @@ void SwContentLBoxString::Paint( } */ else - SvLBoxString::Paint( rPos, rDev, pView, pEntry); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); } -void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) +void SwContentTree::DataChanged(const DataChangedEvent& rDCEvt) { if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 38505c695eab..bf2b8fe79c55 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -1238,24 +1238,24 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry, pEntry->ReplaceItem( pStr, nColToHilite ); } -void SwLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, - const SvTreeListEntry* pEntry) +void SwLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) { SwGlblDocContent* pCont = static_cast<SwGlblDocContent*>(pEntry->GetUserData()); - if(pCont->GetType() == GLBLDOC_SECTION && - !(pCont->GetSection())->IsConnectFlag() ) + if (pCont->GetType() == GLBLDOC_SECTION && + !(pCont->GetSection())->IsConnectFlag()) { - vcl::Font aOldFont( rDev.GetFont()); - vcl::Font aFont(aOldFont); - Color aCol( COL_LIGHTRED ); - aFont.SetColor( aCol ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); + rRenderContext.Push(PushFlags::FONT); + vcl::Font aOldFont(rRenderContext.GetFont()); + vcl::Font aFont(rRenderContext.GetFont()); + Color aCol(COL_LIGHTRED); + aFont.SetColor(aCol); + rRenderContext.SetFont(aFont); + rRenderContext.DrawText(rPos, GetText()); + rRenderContext.Pop(); } else - SvLBoxString::Paint( rPos, rDev, pView, pEntry); + SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry); } void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt ) |