svx: prefix members of SvxPageWindow
See tdf#94879 for motivation. Change-Id: I69c2ae8e1792d0823a562936ef1458cab5634b6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197060 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
+56
-56
@@ -29,39 +29,39 @@ enum class SvxFrameDirection;
|
||||
class SVX_DLLPUBLIC SvxPageWindow : public weld::CustomWidgetController
|
||||
{
|
||||
private:
|
||||
Size aWinSize;
|
||||
Size aSize;
|
||||
Size m_aWinSize;
|
||||
Size m_aSize;
|
||||
|
||||
tools::Long nTop;
|
||||
tools::Long nBottom;
|
||||
tools::Long nLeft;
|
||||
tools::Long nRight;
|
||||
tools::Long m_nTop;
|
||||
tools::Long m_nBottom;
|
||||
tools::Long m_nLeft;
|
||||
tools::Long m_nRight;
|
||||
|
||||
bool bResetBackground;
|
||||
bool bFrameDirection;
|
||||
SvxFrameDirection nFrameDirection;
|
||||
bool m_bResetBackground;
|
||||
bool m_bFrameDirection;
|
||||
SvxFrameDirection m_nFrameDirection;
|
||||
|
||||
tools::Long nHdLeft;
|
||||
tools::Long nHdRight;
|
||||
tools::Long nHdDist;
|
||||
tools::Long nHdHeight;
|
||||
tools::Long m_nHdLeft;
|
||||
tools::Long m_nHdRight;
|
||||
tools::Long m_nHdDist;
|
||||
tools::Long m_nHdHeight;
|
||||
|
||||
tools::Long nFtLeft;
|
||||
tools::Long nFtRight;
|
||||
tools::Long nFtDist;
|
||||
tools::Long nFtHeight;
|
||||
tools::Long m_nFtLeft;
|
||||
tools::Long m_nFtRight;
|
||||
tools::Long m_nFtDist;
|
||||
tools::Long m_nFtHeight;
|
||||
|
||||
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes;
|
||||
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes;
|
||||
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes;
|
||||
|
||||
bool bFooter : 1;
|
||||
bool bHeader : 1;
|
||||
bool bTable : 1;
|
||||
bool bHorz : 1;
|
||||
bool bVert : 1;
|
||||
bool m_bFooter : 1;
|
||||
bool m_bHeader : 1;
|
||||
bool m_bTable : 1;
|
||||
bool m_bHorz : 1;
|
||||
bool m_bVert : 1;
|
||||
|
||||
SvxPageUsage eUsage;
|
||||
SvxPageUsage m_eUsage;
|
||||
|
||||
protected:
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
@@ -96,51 +96,51 @@ public:
|
||||
}
|
||||
void SetSize(const Size& rSize)
|
||||
{
|
||||
aSize = rSize;
|
||||
m_aSize = rSize;
|
||||
}
|
||||
const Size& GetSize() const
|
||||
{
|
||||
return aSize;
|
||||
return m_aSize;
|
||||
}
|
||||
|
||||
void SetTop(tools::Long nNew) { nTop = nNew; }
|
||||
void SetBottom(tools::Long nNew) { nBottom = nNew; }
|
||||
void SetLeft(tools::Long nNew) { nLeft = nNew; }
|
||||
void SetRight(tools::Long nNew) { nRight = nNew; }
|
||||
void SetTop(tools::Long nNew) { m_nTop = nNew; }
|
||||
void SetBottom(tools::Long nNew) { m_nBottom = nNew; }
|
||||
void SetLeft(tools::Long nNew) { m_nLeft = nNew; }
|
||||
void SetRight(tools::Long nNew) { m_nRight = nNew; }
|
||||
|
||||
tools::Long GetTop() const { return nTop; }
|
||||
tools::Long GetBottom() const { return nBottom; }
|
||||
tools::Long GetLeft() const { return nLeft; }
|
||||
tools::Long GetRight() const { return nRight; }
|
||||
tools::Long GetTop() const { return m_nTop; }
|
||||
tools::Long GetBottom() const { return m_nBottom; }
|
||||
tools::Long GetLeft() const { return m_nLeft; }
|
||||
tools::Long GetRight() const { return m_nRight; }
|
||||
|
||||
void SetHdLeft(tools::Long nNew) { nHdLeft = nNew; }
|
||||
void SetHdRight(tools::Long nNew) { nHdRight = nNew; }
|
||||
void SetHdDist(tools::Long nNew) { nHdDist = nNew; }
|
||||
void SetHdHeight(tools::Long nNew) { nHdHeight = nNew; }
|
||||
void SetHdLeft(tools::Long nNew) { m_nHdLeft = nNew; }
|
||||
void SetHdRight(tools::Long nNew) { m_nHdRight = nNew; }
|
||||
void SetHdDist(tools::Long nNew) { m_nHdDist = nNew; }
|
||||
void SetHdHeight(tools::Long nNew) { m_nHdHeight = nNew; }
|
||||
|
||||
tools::Long GetHdLeft() const { return nHdLeft; }
|
||||
tools::Long GetHdRight() const { return nHdRight; }
|
||||
tools::Long GetHdDist() const { return nHdDist; }
|
||||
tools::Long GetHdHeight() const { return nHdHeight; }
|
||||
tools::Long GetHdLeft() const { return m_nHdLeft; }
|
||||
tools::Long GetHdRight() const { return m_nHdRight; }
|
||||
tools::Long GetHdDist() const { return m_nHdDist; }
|
||||
tools::Long GetHdHeight() const { return m_nHdHeight; }
|
||||
|
||||
void SetFtLeft(tools::Long nNew) { nFtLeft = nNew; }
|
||||
void SetFtRight(tools::Long nNew) { nFtRight = nNew; }
|
||||
void SetFtDist(tools::Long nNew) { nFtDist = nNew; }
|
||||
void SetFtHeight(tools::Long nNew) { nFtHeight = nNew; }
|
||||
void SetFtLeft(tools::Long nNew) { m_nFtLeft = nNew; }
|
||||
void SetFtRight(tools::Long nNew) { m_nFtRight = nNew; }
|
||||
void SetFtDist(tools::Long nNew) { m_nFtDist = nNew; }
|
||||
void SetFtHeight(tools::Long nNew) { m_nFtHeight = nNew; }
|
||||
|
||||
tools::Long GetFtLeft() const { return nFtLeft; }
|
||||
tools::Long GetFtRight() const { return nFtRight; }
|
||||
tools::Long GetFtDist() const { return nFtDist; }
|
||||
tools::Long GetFtHeight() const { return nFtHeight; }
|
||||
tools::Long GetFtLeft() const { return m_nFtLeft; }
|
||||
tools::Long GetFtRight() const { return m_nFtRight; }
|
||||
tools::Long GetFtDist() const { return m_nFtDist; }
|
||||
tools::Long GetFtHeight() const { return m_nFtHeight; }
|
||||
|
||||
void SetUsage(SvxPageUsage eU) { eUsage = eU; }
|
||||
SvxPageUsage GetUsage() const { return eUsage; }
|
||||
void SetUsage(SvxPageUsage eU) { m_eUsage = eU; }
|
||||
SvxPageUsage GetUsage() const { return m_eUsage; }
|
||||
|
||||
void SetHeader( bool bNew ) { bHeader = bNew; }
|
||||
void SetFooter( bool bNew ) { bFooter = bNew; }
|
||||
void SetTable( bool bNew ) { bTable = bNew; }
|
||||
void SetHorz( bool bNew ) { bHorz = bNew; }
|
||||
void SetVert( bool bNew ) { bVert = bNew; }
|
||||
void SetHeader( bool bNew ) { m_bHeader = bNew; }
|
||||
void SetFooter( bool bNew ) { m_bFooter = bNew; }
|
||||
void SetTable( bool bNew ) { m_bTable = bNew; }
|
||||
void SetHorz( bool bNew ) { m_bHorz = bNew; }
|
||||
void SetVert( bool bNew ) { m_bVert = bNew; }
|
||||
|
||||
void EnableFrameDirection(bool bEnable);
|
||||
void SetFrameDirection(SvxFrameDirection nDirection);
|
||||
|
||||
@@ -37,27 +37,27 @@
|
||||
#define CELL_HEIGHT 800L
|
||||
|
||||
SvxPageWindow::SvxPageWindow() :
|
||||
nTop(0),
|
||||
nBottom(0),
|
||||
nLeft(0),
|
||||
nRight(0),
|
||||
bResetBackground(false),
|
||||
bFrameDirection(false),
|
||||
nFrameDirection(SvxFrameDirection::Horizontal_LR_TB),
|
||||
nHdLeft(0),
|
||||
nHdRight(0),
|
||||
nHdDist(0),
|
||||
nHdHeight(0),
|
||||
nFtLeft(0),
|
||||
nFtRight(0),
|
||||
nFtDist(0),
|
||||
nFtHeight(0),
|
||||
bFooter(false),
|
||||
bHeader(false),
|
||||
bTable(false),
|
||||
bHorz(false),
|
||||
bVert(false),
|
||||
eUsage(SvxPageUsage::All)
|
||||
m_nTop(0),
|
||||
m_nBottom(0),
|
||||
m_nLeft(0),
|
||||
m_nRight(0),
|
||||
m_bResetBackground(false),
|
||||
m_bFrameDirection(false),
|
||||
m_nFrameDirection(SvxFrameDirection::Horizontal_LR_TB),
|
||||
m_nHdLeft(0),
|
||||
m_nHdRight(0),
|
||||
m_nHdDist(0),
|
||||
m_nHdHeight(0),
|
||||
m_nFtLeft(0),
|
||||
m_nFtRight(0),
|
||||
m_nFtDist(0),
|
||||
m_nFtHeight(0),
|
||||
m_bFooter(false),
|
||||
m_bHeader(false),
|
||||
m_bTable(false),
|
||||
m_bHorz(false),
|
||||
m_bVert(false),
|
||||
m_eUsage(SvxPageUsage::All)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
|
||||
auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::MAPMODE);
|
||||
rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
|
||||
|
||||
Fraction aXScale(aWinSize.Width(), std::max(aSize.Width() * 2 + aSize.Width() / 8, tools::Long(1)));
|
||||
Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), tools::Long(1)));
|
||||
Fraction aXScale(m_aWinSize.Width(), std::max(m_aSize.Width() * 2 + m_aSize.Width() / 8, tools::Long(1)));
|
||||
Fraction aYScale(m_aWinSize.Height(), std::max(m_aSize.Height(), tools::Long(1)));
|
||||
MapMode aMapMode(rRenderContext.GetMapMode());
|
||||
|
||||
if(aYScale < aXScale)
|
||||
@@ -86,12 +86,12 @@ void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
|
||||
}
|
||||
rRenderContext.SetMapMode(aMapMode);
|
||||
Size aSz(rRenderContext.PixelToLogic(GetOutputSizePixel()));
|
||||
tools::Long nYPos = (aSz.Height() - aSize.Height()) / 2;
|
||||
tools::Long nYPos = (aSz.Height() - m_aSize.Height()) / 2;
|
||||
|
||||
if (eUsage == SvxPageUsage::All)
|
||||
if (m_eUsage == SvxPageUsage::All)
|
||||
{
|
||||
// all pages are equal -> draw one page
|
||||
if (aSize.Width() > aSize.Height())
|
||||
if (m_aSize.Width() > m_aSize.Height())
|
||||
{
|
||||
// Draw Landscape page of the same size
|
||||
Fraction aX = aMapMode.GetScaleX();
|
||||
@@ -103,21 +103,21 @@ void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
|
||||
aMapMode.SetScaleY(aY);
|
||||
rRenderContext.SetMapMode(aMapMode);
|
||||
aSz = rRenderContext.PixelToLogic(GetOutputSizePixel());
|
||||
nYPos = (aSz.Height() - aSize.Height()) / 2;
|
||||
tools::Long nXPos = (aSz.Width() - aSize.Width()) / 2;
|
||||
nYPos = (aSz.Height() - m_aSize.Height()) / 2;
|
||||
tools::Long nXPos = (aSz.Width() - m_aSize.Width()) / 2;
|
||||
DrawPage(rRenderContext, Point(nXPos,nYPos),false,true);
|
||||
}
|
||||
else
|
||||
// Portrait
|
||||
DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 2,nYPos),false,true);
|
||||
DrawPage(rRenderContext, Point((aSz.Width() - m_aSize.Width()) / 2,nYPos),false,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Left and right page are different -> draw two pages if possible
|
||||
DrawPage(rRenderContext, Point(0, nYPos), false,
|
||||
eUsage == SvxPageUsage::Left || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror);
|
||||
DrawPage(rRenderContext, Point(aSize.Width() + aSize.Width() / 8, nYPos), true,
|
||||
eUsage == SvxPageUsage::Right || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror);
|
||||
m_eUsage == SvxPageUsage::Left || m_eUsage == SvxPageUsage::All || m_eUsage == SvxPageUsage::Mirror);
|
||||
DrawPage(rRenderContext, Point(m_aSize.Width() + m_aSize.Width() / 8, nYPos), true,
|
||||
m_eUsage == SvxPageUsage::Right || m_eUsage == SvxPageUsage::All || m_eUsage == SvxPageUsage::Mirror);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,21 +130,21 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
const Color& rDlgColor = rStyleSettings.GetDialogColor();
|
||||
|
||||
// background
|
||||
if (!bSecond || bResetBackground)
|
||||
if (!bSecond || m_bResetBackground)
|
||||
{
|
||||
rRenderContext.SetLineColor();
|
||||
rRenderContext.SetFillColor(rDlgColor);
|
||||
Size winSize(rRenderContext.GetOutputSize());
|
||||
rRenderContext.DrawRect(tools::Rectangle(Point(0,0), winSize));
|
||||
|
||||
if (bResetBackground)
|
||||
bResetBackground = false;
|
||||
if (m_bResetBackground)
|
||||
m_bResetBackground = false;
|
||||
}
|
||||
rRenderContext.SetLineColor(rFieldTextColor);
|
||||
rRenderContext.SetTextColor(COL_GRAY);
|
||||
|
||||
// Shadow
|
||||
Size aTempSize = aSize;
|
||||
Size aTempSize = m_aSize;
|
||||
|
||||
// Page
|
||||
if (!bEnabled)
|
||||
@@ -156,52 +156,52 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
rRenderContext.SetFillColor(rFieldColor);
|
||||
rRenderContext.DrawRect(tools::Rectangle(rOrg, aTempSize));
|
||||
|
||||
tools::Long nL = nLeft;
|
||||
tools::Long nR = nRight;
|
||||
tools::Long nL = m_nLeft;
|
||||
tools::Long nR = m_nRight;
|
||||
|
||||
if (eUsage == SvxPageUsage::Mirror && !bSecond)
|
||||
if (m_eUsage == SvxPageUsage::Mirror && !bSecond)
|
||||
{
|
||||
// turn for mirrored
|
||||
nL = nRight;
|
||||
nR = nLeft;
|
||||
nL = m_nRight;
|
||||
nR = m_nLeft;
|
||||
}
|
||||
|
||||
tools::Rectangle aRect;
|
||||
|
||||
aRect.SetLeft( rOrg.X() + nL );
|
||||
aRect.SetRight( rOrg.X() + aTempSize.Width() - nR );
|
||||
aRect.SetTop( rOrg.Y() + nTop );
|
||||
aRect.SetBottom( rOrg.Y() + aTempSize.Height() - nBottom );
|
||||
aRect.SetTop( rOrg.Y() + m_nTop );
|
||||
aRect.SetBottom( rOrg.Y() + aTempSize.Height() - m_nBottom );
|
||||
|
||||
tools::Rectangle aHdRect(aRect);
|
||||
tools::Rectangle aFtRect(aRect);
|
||||
|
||||
if (bHeader || bFooter)
|
||||
if (m_bHeader || m_bFooter)
|
||||
{
|
||||
// draw PageFill first and on the whole page, no outline
|
||||
rRenderContext.SetLineColor();
|
||||
drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect);
|
||||
rRenderContext.SetLineColor(COL_GRAY);
|
||||
|
||||
if (bHeader)
|
||||
if (m_bHeader)
|
||||
{
|
||||
// show headers if possible
|
||||
aHdRect.AdjustLeft(nHdLeft );
|
||||
aHdRect.AdjustRight( -nHdRight );
|
||||
aHdRect.SetBottom( aRect.Top() + nHdHeight );
|
||||
aRect.AdjustTop(nHdHeight + nHdDist );
|
||||
aHdRect.AdjustLeft(m_nHdLeft );
|
||||
aHdRect.AdjustRight( -m_nHdRight );
|
||||
aHdRect.SetBottom( aRect.Top() + m_nHdHeight );
|
||||
aRect.AdjustTop(m_nHdHeight + m_nHdDist );
|
||||
|
||||
// draw header over PageFill, plus outline
|
||||
drawFillAttributes(rRenderContext, maHeaderFillAttributes, aHdRect, aHdRect);
|
||||
}
|
||||
|
||||
if (bFooter)
|
||||
if (m_bFooter)
|
||||
{
|
||||
// show footer if possible
|
||||
aFtRect.AdjustLeft(nFtLeft );
|
||||
aFtRect.AdjustRight( -nFtRight );
|
||||
aFtRect.SetTop( aRect.Bottom() - nFtHeight );
|
||||
aRect.AdjustBottom( -(nFtHeight + nFtDist) );
|
||||
aFtRect.AdjustLeft(m_nFtLeft );
|
||||
aFtRect.AdjustRight( -m_nFtRight );
|
||||
aFtRect.SetTop( aRect.Bottom() - m_nFtHeight );
|
||||
aRect.AdjustBottom( -(m_nFtHeight + m_nFtDist) );
|
||||
|
||||
// draw footer over PageFill, plus outline
|
||||
drawFillAttributes(rRenderContext, maFooterFillAttributes, aFtRect, aFtRect);
|
||||
@@ -216,7 +216,7 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect);
|
||||
}
|
||||
|
||||
if (bFrameDirection && !bTable)
|
||||
if (m_bFrameDirection && !m_bTable)
|
||||
{
|
||||
Point aPos;
|
||||
vcl::Font aFont(rRenderContext.GetFont());
|
||||
@@ -228,7 +228,7 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
Point aMove(1, rRenderContext.GetTextHeight());
|
||||
sal_Unicode cArrow = 0x2193;
|
||||
tools::Long nAWidth = rRenderContext.GetTextWidth(sText.copy(0,1));
|
||||
switch (nFrameDirection)
|
||||
switch (m_nFrameDirection)
|
||||
{
|
||||
case SvxFrameDirection::Horizontal_LR_TB:
|
||||
aPos = aRect.TopLeft();
|
||||
@@ -282,7 +282,7 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
rRenderContext.SetFont(aFont);
|
||||
|
||||
}
|
||||
if (!bTable)
|
||||
if (!m_bTable)
|
||||
return;
|
||||
|
||||
// Paint Table, if necessary center it
|
||||
@@ -292,8 +292,8 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO
|
||||
tools::Long nH = aRect.GetHeight();
|
||||
tools::Long const nTW = CELL_WIDTH * 3;
|
||||
tools::Long const nTH = CELL_HEIGHT * 3;
|
||||
tools::Long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
|
||||
tools::Long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
|
||||
tools::Long _nLeft = m_bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
|
||||
tools::Long _nTop = m_bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
|
||||
tools::Rectangle aCellRect(Point(_nLeft, _nTop),Size(CELL_WIDTH, CELL_HEIGHT));
|
||||
|
||||
for (sal_uInt16 i = 0; i < 3; ++i)
|
||||
@@ -360,17 +360,17 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
|
||||
|
||||
void SvxPageWindow::EnableFrameDirection(bool bEnable)
|
||||
{
|
||||
bFrameDirection = bEnable;
|
||||
m_bFrameDirection = bEnable;
|
||||
}
|
||||
|
||||
void SvxPageWindow::SetFrameDirection(SvxFrameDirection nDirection)
|
||||
{
|
||||
nFrameDirection = nDirection;
|
||||
m_nFrameDirection = nDirection;
|
||||
}
|
||||
|
||||
void SvxPageWindow::ResetBackground()
|
||||
{
|
||||
bResetBackground = true;
|
||||
m_bResetBackground = true;
|
||||
}
|
||||
|
||||
void SvxPageWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
|
||||
@@ -381,13 +381,13 @@ void SvxPageWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
|
||||
// Count in Twips by default
|
||||
auto popIt = rRefDevice.ScopedPush(vcl::PushFlags::MAPMODE);
|
||||
rRefDevice.SetMapMode(MapMode(MapUnit::MapTwip));
|
||||
aWinSize = rRefDevice.LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont));
|
||||
pDrawingArea->set_size_request(aWinSize.Width(), aWinSize.Height());
|
||||
m_aWinSize = rRefDevice.LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont));
|
||||
pDrawingArea->set_size_request(m_aWinSize.Width(), m_aWinSize.Height());
|
||||
|
||||
aWinSize.AdjustHeight( -4 );
|
||||
aWinSize.AdjustWidth( -4 );
|
||||
m_aWinSize.AdjustHeight( -4 );
|
||||
m_aWinSize.AdjustWidth( -4 );
|
||||
|
||||
aWinSize = rRefDevice.PixelToLogic(aWinSize);
|
||||
m_aWinSize = rRefDevice.PixelToLogic(m_aWinSize);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user