diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-15 20:39:06 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-16 21:57:15 +0900 |
commit | 264fb9f16336e2cfd8f937b630fc167faab0aae3 (patch) | |
tree | 95e716df471a385572d6a52570aa82cfc6d646c6 /dbaccess | |
parent | a76dcdfaa6c6d2b1d73fb1c96fe38dd7e452f48a (diff) |
refactor dbacess classes to use RenderContext
Change-Id: I60e436ec1e6974e5fb8c6525552c6e172ceca0ca
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailView.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dataview.cxx | 28 | ||||
-rw-r--r-- | dbaccess/source/ui/control/marktree.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/ConnectionLine.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/JoinTableView.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableConnection.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableWindow.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinTableView.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableConnection.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindow.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RTableConnection.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RTableConnection.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx | 14 |
14 files changed, 67 insertions, 84 deletions
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4e95d77abfe3..44284fbb8f0b 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1298,15 +1298,15 @@ void OPreviewWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& { Window::Paint(rRenderContext, rRect); - if( ImplGetGraphicCenterRect( m_aGraphicObj.GetGraphic(), m_aPreviewRect ) ) + if (ImplGetGraphicCenterRect(m_aGraphicObj.GetGraphic(), m_aPreviewRect)) { - const Point aPos( m_aPreviewRect.TopLeft() ); - const Size aSize( m_aPreviewRect.GetSize() ); + const Point aPos(m_aPreviewRect.TopLeft()); + const Size aSize(m_aPreviewRect.GetSize()); - if( m_aGraphicObj.IsAnimated() ) - m_aGraphicObj.StartAnimation( this, aPos, aSize ); + if (m_aGraphicObj.IsAnimated()) + m_aGraphicObj.StartAnimation(&rRenderContext, aPos, aSize); else - m_aGraphicObj.Draw( this, aPos, aSize ); + m_aGraphicObj.Draw(&rRenderContext, aPos, aSize); } } diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index 325cc9b4c521..c547945aee5b 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -87,15 +87,15 @@ OCreationList::OCreationList( OTasksWindow& _rParent ) void OCreationList::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _rRect ) { - if ( m_pMouseDownEntry ) - m_aOriginalFont = GetFont(); + if (m_pMouseDownEntry) + m_aOriginalFont = rRenderContext.GetFont(); - m_aOriginalBackgroundColor = GetBackground().GetColor(); + m_aOriginalBackgroundColor = rRenderContext.GetBackground().GetColor(); SvTreeListBox::Paint(rRenderContext, _rRect); - SetBackground( m_aOriginalBackgroundColor ); + rRenderContext.SetBackground(m_aOriginalBackgroundColor); - if ( m_pMouseDownEntry ) - Control::SetFont( m_aOriginalFont ); + if (m_pMouseDownEntry) + rRenderContext.SetFont(m_aOriginalFont); } void OCreationList::PreparePaint( SvTreeListEntry* _pEntry ) diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index ee1e5e128e8e..00002a84a6e5 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -38,27 +38,6 @@ namespace dbaui using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; - // ColorChanger - class ColorChanger - { - protected: - VclPtr<OutputDevice> m_pDev; - - public: - ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor ) - :m_pDev( _pDev ) - { - m_pDev->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - m_pDev->SetLineColor( _rNewLineColor ); - m_pDev->SetFillColor( _rNewFillColor ); - } - - ~ColorChanger() - { - m_pDev->Pop(); - } - }; - ODataView::ODataView( vcl::Window* pParent, IController& _rController, const Reference< XComponentContext >& _rxContext, @@ -97,8 +76,11 @@ namespace dbaui { // draw the background { - ColorChanger aColors( this, COL_TRANSPARENT, GetSettings().GetStyleSettings().GetFaceColor() ); - DrawRect( _rRect ); + rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR); + rRenderContext.SetLineColor(COL_TRANSPARENT); + rRenderContext.SetFillColor(GetSettings().GetStyleSettings().GetFaceColor()); + rRenderContext.DrawRect(_rRect); + rRenderContext.Pop(); } // let the base class do anything it needs diff --git a/dbaccess/source/ui/control/marktree.cxx b/dbaccess/source/ui/control/marktree.cxx index 54634ed7d393..0291f06e9c25 100644 --- a/dbaccess/source/ui/control/marktree.cxx +++ b/dbaccess/source/ui/control/marktree.cxx @@ -50,15 +50,15 @@ void OMarkableTreeListBox::Paint(vcl::RenderContext& rRenderContext, const Recta { if (!IsEnabled()) { - vcl::Font aOldFont = GetFont(); + vcl::Font aOldFont = rRenderContext.GetFont(); vcl::Font aNewFont(aOldFont); StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); aNewFont.SetColor(aSystemStyle.GetDisableColor()); - SetFont(aNewFont); + rRenderContext.SetFont(aNewFont); DBTreeListBox::Paint(rRenderContext, _rRect); - SetFont(aOldFont); + rRenderContext.SetFont(aOldFont); } else DBTreeListBox::Paint(rRenderContext, _rRect); diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx index f5bef2a5d5d9..3918b6b80539 100644 --- a/dbaccess/source/ui/inc/ConnectionLine.hxx +++ b/dbaccess/source/ui/inc/ConnectionLine.hxx @@ -71,7 +71,7 @@ namespace dbaui }; /// unary_function Functor object for class OConnectionLine returntype is void /// draws a connectionline object on outputdevice - struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void> + struct TConnectionLineDrawFunctor : std::unary_function<OConnectionLine*, void> { VclPtr<OutputDevice> pDevice; TConnectionLineDrawFunctor(OutputDevice* _pDevice) diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx index f9686d3324a3..2cdfdbab4792 100644 --- a/dbaccess/source/ui/inc/JoinTableView.hxx +++ b/dbaccess/source/ui/inc/JoinTableView.hxx @@ -129,7 +129,7 @@ namespace dbaui ScrollBar& GetVScrollBar() { return static_cast<OScrollWindowHelper*>(GetParent())->GetVScrollBar(); } DECL_LINK( ScrollHdl, ScrollBar* ); - void DrawConnections( const Rectangle& rRect ); + void DrawConnections(vcl::RenderContext& rRenderContext, const Rectangle& rRect); void InvalidateConnections(); void BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos ); diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx index 00cdf213e745..8d63648e8943 100644 --- a/dbaccess/source/ui/inc/TableConnection.hxx +++ b/dbaccess/source/ui/inc/TableConnection.hxx @@ -95,7 +95,7 @@ namespace dbaui inline TTableConnectionData::value_type GetData() const { return m_pData; } const ::std::vector<OConnectionLine*>& GetConnLineList() const { return m_vConnLine; } inline OJoinTableView* GetParent() const { return m_pParent; } - virtual void Draw( const Rectangle& rRect ); + virtual void Draw(vcl::RenderContext& rRenderContext, const Rectangle& rRect); using Window::Draw; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; }; diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx index 0cfa1917b32e..4565d7719806 100644 --- a/dbaccess/source/ui/inc/TableWindow.hxx +++ b/dbaccess/source/ui/inc/TableWindow.hxx @@ -69,7 +69,7 @@ namespace dbaui sal_uInt16 m_nSizingFlags; bool m_bActive; - void Draw3DBorder( const Rectangle& rRect ); + void Draw3DBorder(vcl::RenderContext& rRenderContext,const Rectangle& rRect); // OContainerListener virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index f3ef5af16ff7..16879ed1b1d9 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -935,26 +935,26 @@ void OJoinTableView::SelectConn(OTableConnection* pConn) } } -void OJoinTableView::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) +void OJoinTableView::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { - DrawConnections( rRect ); + DrawConnections(rRenderContext, rRect); } void OJoinTableView::InvalidateConnections() { // draw Joins - for(auto & conn : m_vTableConnection) + for (auto & conn : m_vTableConnection) conn->InvalidateConnection(); } -void OJoinTableView::DrawConnections( const Rectangle& rRect ) +void OJoinTableView::DrawConnections(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { // draw Joins - for(auto conn : m_vTableConnection) - conn->Draw(rRect); + for(auto connection : m_vTableConnection) + connection->Draw(rRenderContext, rRect); // finally redraw the selected one above all others if (GetSelectedConn()) - GetSelectedConn()->Draw( rRect ); + GetSelectedConn()->Draw(rRenderContext, rRect); } ::std::vector<VclPtr<OTableConnection> >::const_iterator OJoinTableView::getTableConnections(const OTableWindow* _pFromWin) const diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx index b0967c4cfbaa..ec91c07646fd 100644 --- a/dbaccess/source/ui/querydesign/TableConnection.cxx +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -193,10 +193,10 @@ namespace dbaui return aBoundingRect; } - void OTableConnection::Draw( const Rectangle& /*rRect*/ ) + void OTableConnection::Draw(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/) { // Draw line - ::std::for_each(m_vConnLine.begin(),m_vConnLine.end(),TConnectionLineDrawFunctor(m_pParent)); + std::for_each(m_vConnLine.begin(), m_vConnLine.end(), TConnectionLineDrawFunctor(&rRenderContext)); } } diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index 52dcde3d589a..3b960ade7047 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -312,33 +312,33 @@ void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt) } } -void OTableWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) +void OTableWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { Rectangle aRect(Point(0,0), GetOutputSizePixel()); Window::Paint(rRenderContext, rRect); - Draw3DBorder( aRect ); + Draw3DBorder(rRenderContext, aRect); } -void OTableWindow::Draw3DBorder(const Rectangle& rRect) +void OTableWindow::Draw3DBorder(vcl::RenderContext& rRenderContext, const Rectangle& rRect) { // Use the System Style-Settings for my colours const StyleSettings& aSystemStyle = Application::GetSettings().GetStyleSettings(); // Black lines for bottom and right - SetLineColor(aSystemStyle.GetDarkShadowColor()); - DrawLine( rRect.BottomLeft(), rRect.BottomRight() ); - DrawLine( rRect.BottomRight(), rRect.TopRight() ); + rRenderContext.SetLineColor(aSystemStyle.GetDarkShadowColor()); + rRenderContext.DrawLine(rRect.BottomLeft(), rRect.BottomRight()); + rRenderContext.DrawLine(rRect.BottomRight(), rRect.TopRight()); // Dark grey lines over the black lines - SetLineColor(aSystemStyle.GetShadowColor()); - Point aEHvector(1,1); - DrawLine( rRect.BottomLeft()+Point(1,-1), rRect.BottomRight() - aEHvector ); - DrawLine( rRect.BottomRight() - aEHvector, rRect.TopRight()+Point(-1,1) ); + rRenderContext.SetLineColor(aSystemStyle.GetShadowColor()); + Point aEHvector(1, 1); + rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -1), rRect.BottomRight() - aEHvector); + rRenderContext.DrawLine(rRect.BottomRight() - aEHvector, rRect.TopRight() + Point(-1, 1)); // Light grey lines for top and left - SetLineColor(aSystemStyle.GetLightColor()); - DrawLine( rRect.BottomLeft()+Point(1,-2), rRect.TopLeft() + aEHvector ); - DrawLine( rRect.TopLeft() + aEHvector, rRect.TopRight()+Point(-2,1) ); + rRenderContext.SetLineColor(aSystemStyle.GetLightColor()); + rRenderContext.DrawLine(rRect.BottomLeft() + Point(1, -2), rRect.TopLeft() + aEHvector); + rRenderContext.DrawLine(rRect.TopLeft() + aEHvector, rRect.TopRight() + Point(-2, 1)); } Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& _rOutputSize) const diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx index 1f18d83af39a..b4f05c24fbd1 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx @@ -48,11 +48,11 @@ ORelationTableConnection& ORelationTableConnection::operator=( const ORelationTa return *this; } -void ORelationTableConnection::Draw( const Rectangle& rRect ) +void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const Rectangle& rRect ) { - OTableConnection::Draw( rRect ); + OTableConnection::Draw(rRenderContext, rRect); ORelationTableConnectionData* pData = static_cast< ORelationTableConnectionData* >(GetData().get()); - if ( pData && (pData->GetCardinality() == CARDINAL_UNDEFINED) ) + if (pData && (pData->GetCardinality() == CARDINAL_UNDEFINED)) return; // search lines for top line @@ -62,15 +62,16 @@ void ORelationTableConnection::Draw( const Rectangle& rRect ) const OConnectionLine* pTopLine = NULL; const ::std::vector<OConnectionLine*>& rConnLineList = GetConnLineList(); - ::std::vector<OConnectionLine*>::const_iterator aIter = rConnLineList.begin(); - ::std::vector<OConnectionLine*>::const_iterator aEnd = rConnLineList.end(); + std::vector<OConnectionLine*>::const_iterator aIter = rConnLineList.begin(); + std::vector<OConnectionLine*>::const_iterator aEnd = rConnLineList.end(); + for(;aIter != aEnd;++aIter) { if( (*aIter)->IsValid() ) { aBoundingRect = (*aIter)->GetBoundingRect(); nTemp = aBoundingRect.Top(); - if( nTemp<nTop ) + if(nTemp < nTop) { nTop = nTemp; pTopLine = (*aIter); @@ -79,7 +80,7 @@ void ORelationTableConnection::Draw( const Rectangle& rRect ) } // cardinality - if( !pTopLine ) + if (!pTopLine) return; Rectangle aSourcePos = pTopLine->GetSourceTextPos(); @@ -88,7 +89,7 @@ void ORelationTableConnection::Draw( const Rectangle& rRect ) OUString aSourceText; OUString aDestText; - switch( pData->GetCardinality() ) + switch (pData->GetCardinality()) { case CARDINAL_ONE_MANY: aSourceText = "1"; @@ -107,12 +108,12 @@ void ORelationTableConnection::Draw( const Rectangle& rRect ) } if (IsSelected()) - GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()); + rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()); else - GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor()); + rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor()); - GetParent()->DrawText( aSourcePos, aSourceText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM); - GetParent()->DrawText( aDestPos, aDestText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM); + rRenderContext.DrawText(aSourcePos, aSourceText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM); + rRenderContext.DrawText(aDestPos, aDestText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.hxx b/dbaccess/source/ui/relationdesign/RTableConnection.hxx index 3ebea9b873f3..5739cf4ee683 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnection.hxx +++ b/dbaccess/source/ui/relationdesign/RTableConnection.hxx @@ -34,7 +34,7 @@ namespace dbaui ORelationTableConnection& operator=( const ORelationTableConnection& rConn ); - virtual void Draw( const Rectangle& rRect ) SAL_OVERRIDE; + virtual void Draw(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; using OTableConnection::Draw; }; } diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx index 5f069b9efec3..0c38e1e88b80 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx @@ -103,18 +103,18 @@ void OTableFieldDescWin::SaveData( OFieldDescription* pFieldDescr ) getGenPage()->SaveData( pFieldDescr ); } -void OTableFieldDescWin::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& /*rRect*/ ) +void OTableFieldDescWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/) { // 3D-line at the top window border - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - SetLineColor( rStyleSettings.GetLightColor() ); - DrawLine( Point(0,0), Point(GetSizePixel().Width(),0) ); + rRenderContext.SetLineColor(rStyleSettings.GetLightColor()); + rRenderContext.DrawLine(Point(0,0), Point(GetSizePixel().Width(), 0)); // 3D-line for the separation of the header - DrawLine( Point(3, DETAILS_HEADER_HEIGHT), Point(GetSizePixel().Width()-6, DETAILS_HEADER_HEIGHT) ); - SetLineColor( rStyleSettings.GetShadowColor() ); - DrawLine( Point(3, DETAILS_HEADER_HEIGHT-1), Point(GetSizePixel().Width()-6, DETAILS_HEADER_HEIGHT-1) ); + rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT)); + rRenderContext.SetLineColor(rStyleSettings.GetShadowColor()); + rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT - 1), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT - 1)); } void OTableFieldDescWin::Resize() |