summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-21 15:54:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-22 13:17:30 +0200
commitc200aa27ee4a0f5a89af6e970c2c22580029eded (patch)
tree3988c0c756df2d1eb182c50ad1dc0e226d2ecf14 /sw/source
parentaf6561532832615f39b5ea82aa5d9b3e240784e8 (diff)
remove Size arg from Window::Draw and depend on GetSizePixel
90% of cases pass GetSizePixel as the Size arg already and this aligns Window::Draw with how Window::PaintToDevice works Change-Id: If5b024179a4b7a3b099177c2f6d4b1fb006b95ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94644 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx25
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx3
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx3
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.hxx2
4 files changed, 16 insertions, 17 deletions
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 335cee087d0e..2801159850ad 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -257,52 +257,52 @@ void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint
mpSidebarTextControl->Pop();
}
-void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, DrawFlags nInFlags)
+void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFlags)
{
+ Size aSz = pDev->PixelToLogic(GetSizePixel());
+
if (mpMetadataAuthor->IsVisible() )
{
pDev->SetFillColor(mColorDark);
pDev->SetLineColor();
- pDev->DrawRect( tools::Rectangle( rPt, rSz ) );
+ pDev->DrawRect( tools::Rectangle( rPt, aSz ) );
}
if (mpMetadataAuthor->IsVisible())
{
vcl::Font aOrigFont(mpMetadataAuthor->GetControlFont());
- Size aSize(PixelToLogic(mpMetadataAuthor->GetSizePixel()));
Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel()));
aPos += rPt;
vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
mpMetadataAuthor->SetControlFont( aFont );
- mpMetadataAuthor->Draw(pDev, aPos, aSize, nInFlags);
+ mpMetadataAuthor->Draw(pDev, aPos, nInFlags);
mpMetadataAuthor->SetControlFont( aOrigFont );
}
if (mpMetadataDate->IsVisible())
{
vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
- Size aSize(PixelToLogic(mpMetadataDate->GetSizePixel()));
Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel()));
aPos += rPt;
vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
mpMetadataDate->SetControlFont( aFont );
- mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
mpMetadataDate->SetControlFont( aOrigFont );
}
if (mpMetadataResolved->IsVisible())
{
vcl::Font aOrigFont(mpMetadataResolved->GetControlFont());
- Size aSize(PixelToLogic(mpMetadataResolved->GetSizePixel()));
Point aPos(PixelToLogic(mpMetadataResolved->GetPosPixel()));
aPos += rPt;
vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() );
mpMetadataResolved->SetControlFont( aFont );
- mpMetadataResolved->Draw(pDev, aPos, aSize, nInFlags);
mpMetadataResolved->SetControlFont( aOrigFont );
}
- mpSidebarTextControl->Draw(pDev, rPt, rSz, nInFlags);
+ Size aOrigSize(mpSidebarTextControl->GetSizePixel());
+ mpSidebarTextControl->SetSizePixel(aSz);
+ mpSidebarTextControl->Draw(pDev, rPt, nInFlags);
+ mpSidebarTextControl->SetSizePixel(aOrigSize);
const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
@@ -322,7 +322,6 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz
Color aOrigBg( mpMetadataDate->GetControlBackground() );
OUString sOrigText(mpMetadataDate->GetText());
- Size aSize(PixelToLogic(mpMenuButton->GetSizePixel()));
Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
aPos += rPt;
@@ -330,12 +329,14 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz
mpMetadataDate->SetControlFont( aFont );
mpMetadataDate->SetControlBackground( Color(0xFFFFFF) );
mpMetadataDate->SetText("...");
- mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
+ aOrigSize = mpMetadataDate->GetSizePixel();
+ mpMetadataDate->SetSizePixel(mpMenuButton->GetSizePixel());
+ mpMetadataDate->Draw(pDev, aPos, nInFlags);
+ mpMetadataDate->SetSizePixel(aOrigSize);
mpMetadataDate->SetText(sOrigText);
mpMetadataDate->SetControlFont( aOrigFont );
mpMetadataDate->SetControlBackground( aOrigBg );
-
}
void SwAnnotationWin::KeyInput(const KeyEvent& rKeyEvent)
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 2c96a0498f7b..1d68a7c9465f 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -963,8 +963,7 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
if (!pPostIt)
continue;
Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
- Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
- pPostIt->Draw(pOutDev, aPoint, aSize, DrawFlags::NONE);
+ pPostIt->Draw(pOutDev, aPoint, DrawFlags::NONE);
}
}
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 544b3c6fc403..65c67d0983a5 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -129,11 +129,10 @@ void SidebarTextControl::RequestHelp(const HelpEvent &rEvt)
}
}
-void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, DrawFlags)
+void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags)
{
//Take the control's height, but overwrite the scrollbar area if there was one
Size aSize(PixelToLogic(GetSizePixel()));
- aSize.setWidth( rSz.Width() );
if ( GetTextView() )
{
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index af2d2ff6747e..ab9c7604ee60 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -67,7 +67,7 @@ class SidebarTextControl : public Control
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
- virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
+ virtual void Draw(OutputDevice* pDev, const Point&, DrawFlags) override;
};
} // end of namespace sw::sidebarwindows