Kaydet (Commit) 059f65b2 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of SwLabPreview

Change-Id: Ic4c9b6309aee6be51aa0b20a26e6dc28930a9879
üst 7038c15e
...@@ -100,17 +100,17 @@ void DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point ...@@ -100,17 +100,17 @@ void DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point
SwLabPreview::SwLabPreview(vcl::Window* pParent) SwLabPreview::SwLabPreview(vcl::Window* pParent)
: Window(pParent, 0) : Window(pParent, 0)
, aGrayColor(COL_LIGHTGRAY) , m_aGrayColor(COL_LIGHTGRAY)
, aHDistStr(SW_RESSTR(STR_HDIST)) , m_aHDistStr(SW_RESSTR(STR_HDIST))
, aVDistStr(SW_RESSTR(STR_VDIST)) , m_aVDistStr(SW_RESSTR(STR_VDIST))
, aWidthStr(SW_RESSTR(STR_WIDTH)) , m_aWidthStr(SW_RESSTR(STR_WIDTH))
, aHeightStr(SW_RESSTR(STR_HEIGHT)) , m_aHeightStr(SW_RESSTR(STR_HEIGHT))
, aLeftStr(SW_RESSTR(STR_LEFT)) , m_aLeftStr(SW_RESSTR(STR_LEFT))
, aUpperStr(SW_RESSTR(STR_UPPER)) , m_aUpperStr(SW_RESSTR(STR_UPPER))
, aColsStr(SW_RESSTR(STR_COLS)) , m_aColsStr(SW_RESSTR(STR_COLS))
, aRowsStr(SW_RESSTR(STR_ROWS)) , m_aRowsStr(SW_RESSTR(STR_ROWS))
, aPWidthStr(SW_RESSTR(STR_PWIDTH)) , m_aPWidthStr(SW_RESSTR(STR_PWIDTH))
, aPHeightStr(SW_RESSTR(STR_PHEIGHT)) , m_aPHeightStr(SW_RESSTR(STR_PHEIGHT))
{ {
SetMapMode(MAP_PIXEL); SetMapMode(MAP_PIXEL);
...@@ -125,16 +125,16 @@ SwLabPreview::SwLabPreview(vcl::Window* pParent) ...@@ -125,16 +125,16 @@ SwLabPreview::SwLabPreview(vcl::Window* pParent)
aFont.SetWeight(WEIGHT_NORMAL); aFont.SetWeight(WEIGHT_NORMAL);
SetFont(aFont); SetFont(aFont);
lHDistWidth = GetTextWidth(aHDistStr ); m_lHDistWidth = GetTextWidth(m_aHDistStr );
lVDistWidth = GetTextWidth(aVDistStr ); m_lVDistWidth = GetTextWidth(m_aVDistStr );
lHeightWidth = GetTextWidth(aHeightStr); m_lHeightWidth = GetTextWidth(m_aHeightStr);
lLeftWidth = GetTextWidth(aLeftStr ); m_lLeftWidth = GetTextWidth(m_aLeftStr );
lUpperWidth = GetTextWidth(aUpperStr ); m_lUpperWidth = GetTextWidth(m_aUpperStr );
lColsWidth = GetTextWidth(aColsStr ); m_lColsWidth = GetTextWidth(m_aColsStr );
lPWidthWidth = GetTextWidth(aPWidthStr); m_lPWidthWidth = GetTextWidth(m_aPWidthStr);
lPHeightWidth = GetTextWidth(aPHeightStr); m_lPHeightWidth = GetTextWidth(m_aPHeightStr);
lXHeight = GetTextHeight(); m_lXHeight = GetTextHeight();
lXWidth = GetTextWidth(OUString('X')); m_lXWidth = GetTextWidth(OUString('X'));
} }
Size SwLabPreview::GetOptimalSize() const Size SwLabPreview::GetOptimalSize() const
...@@ -152,7 +152,7 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -152,7 +152,7 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
const long lOutHPix = aSz.Height(); const long lOutHPix = aSz.Height();
// Scale factor // Scale factor
const double fxpix = double(lOutWPix - (2 * (lLeftWidth + 15))) / double(lOutWPix); const double fxpix = double(lOutWPix - (2 * (m_lLeftWidth + 15))) / double(lOutWPix);
const long lOutWPix23 = long(double(lOutWPix) * fxpix); const long lOutWPix23 = long(double(lOutWPix) * fxpix);
const long lOutHPix23 = long(double(lOutHPix) * fxpix); const long lOutHPix23 = long(double(lOutHPix) * fxpix);
...@@ -169,19 +169,19 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -169,19 +169,19 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
rRenderContext.SetBackground(Wallpaper(rWinColor)); rRenderContext.SetBackground(Wallpaper(rWinColor));
rRenderContext.SetLineColor(rWinColor); rRenderContext.SetLineColor(rWinColor);
rRenderContext.SetFillColor(aGrayColor); rRenderContext.SetFillColor(m_aGrayColor);
vcl::Font aPaintFont(rRenderContext.GetFont()); vcl::Font aPaintFont(rRenderContext.GetFont());
aPaintFont.SetTransparent(false); aPaintFont.SetTransparent(false);
rRenderContext.SetFont(aPaintFont); rRenderContext.SetFont(aPaintFont);
// size of region to be displayed // size of region to be displayed
const long lDispW = aItem.m_lLeft + aItem.m_lHDist + ((aItem.m_nCols == 1) const long lDispW = m_aItem.m_lLeft + m_aItem.m_lHDist + ((m_aItem.m_nCols == 1)
? aItem.m_lLeft ? m_aItem.m_lLeft
: ROUND(aItem.m_lHDist / 10.0)); : ROUND(m_aItem.m_lHDist / 10.0));
const long lDispH = aItem.m_lUpper + aItem.m_lVDist + ((aItem.m_nRows == 1) const long lDispH = m_aItem.m_lUpper + m_aItem.m_lVDist + ((m_aItem.m_nRows == 1)
? aItem.m_lUpper ? m_aItem.m_lUpper
: ROUND(aItem.m_lVDist / 10.0)); : ROUND(m_aItem.m_lVDist / 10.0));
// Scale factor // Scale factor
const float fx = float(lOutWPix23) / std::max(1L, lDispW); const float fx = float(lOutWPix23) / std::max(1L, lDispW);
...@@ -194,12 +194,12 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -194,12 +194,12 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
const long lX0 = (lOutWPix - lOutlineW) / 2; const long lX0 = (lOutWPix - lOutlineW) / 2;
const long lY0 = (lOutHPix - lOutlineH) / 2; const long lY0 = (lOutHPix - lOutlineH) / 2;
const long lX1 = lX0 + ROUND(f * aItem.m_lLeft ); const long lX1 = lX0 + ROUND(f * m_aItem.m_lLeft );
const long lY1 = lY0 + ROUND(f * aItem.m_lUpper); const long lY1 = lY0 + ROUND(f * m_aItem.m_lUpper);
const long lX2 = lX0 + ROUND(f * (aItem.m_lLeft + aItem.m_lWidth )); const long lX2 = lX0 + ROUND(f * (m_aItem.m_lLeft + m_aItem.m_lWidth ));
const long lY2 = lY0 + ROUND(f * (aItem.m_lUpper + aItem.m_lHeight)); const long lY2 = lY0 + ROUND(f * (m_aItem.m_lUpper + m_aItem.m_lHeight));
const long lX3 = lX0 + ROUND(f * (aItem.m_lLeft + aItem.m_lHDist )); const long lX3 = lX0 + ROUND(f * (m_aItem.m_lLeft + m_aItem.m_lHDist ));
const long lY3 = lY0 + ROUND(f * (aItem.m_lUpper + aItem.m_lVDist )); const long lY3 = lY0 + ROUND(f * (m_aItem.m_lUpper + m_aItem.m_lVDist ));
// draw outline (area) // draw outline (area)
rRenderContext.DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH))); rRenderContext.DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));
...@@ -208,86 +208,86 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -208,86 +208,86 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
rRenderContext.SetLineColor(rFieldTextColor); rRenderContext.SetLineColor(rFieldTextColor);
rRenderContext.DrawLine(Point(lX0, lY0), Point(lX0 + lOutlineW - 1, lY0)); // Up rRenderContext.DrawLine(Point(lX0, lY0), Point(lX0 + lOutlineW - 1, lY0)); // Up
rRenderContext.DrawLine(Point(lX0, lY0), Point(lX0, lY0 + lOutlineH - 1)); // Left rRenderContext.DrawLine(Point(lX0, lY0), Point(lX0, lY0 + lOutlineH - 1)); // Left
if (aItem.m_nCols == 1) if (m_aItem.m_nCols == 1)
rRenderContext.DrawLine(Point(lX0 + lOutlineW - 1, lY0), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Right rRenderContext.DrawLine(Point(lX0 + lOutlineW - 1, lY0), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Right
if (aItem.m_nRows == 1) if (m_aItem.m_nRows == 1)
rRenderContext.DrawLine(Point(lX0, lY0 + lOutlineH - 1), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Down rRenderContext.DrawLine(Point(lX0, lY0 + lOutlineH - 1), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Down
// Labels // Labels
rRenderContext.SetClipRegion(vcl::Region(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)))); rRenderContext.SetClipRegion(vcl::Region(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH))));
rRenderContext.SetFillColor(COL_LIGHTGRAYBLUE); rRenderContext.SetFillColor(COL_LIGHTGRAYBLUE);
const sal_Int32 nRows = std::min<sal_Int32>(2, aItem.m_nRows); const sal_Int32 nRows = std::min<sal_Int32>(2, m_aItem.m_nRows);
const sal_Int32 nCols = std::min<sal_Int32>(2, aItem.m_nCols); const sal_Int32 nCols = std::min<sal_Int32>(2, m_aItem.m_nCols);
for (sal_Int32 nRow = 0; nRow < nRows; ++nRow) for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
for (sal_Int32 nCol = 0; nCol < nCols; ++nCol) for (sal_Int32 nCol = 0; nCol < nCols; ++nCol)
rRenderContext.DrawRect(Rectangle(Point(lX0 + ROUND(f * (aItem.m_lLeft + nCol * aItem.m_lHDist)), rRenderContext.DrawRect(Rectangle(Point(lX0 + ROUND(f * (m_aItem.m_lLeft + nCol * m_aItem.m_lHDist)),
lY0 + ROUND(f * (aItem.m_lUpper + nRow * aItem.m_lVDist))), lY0 + ROUND(f * (m_aItem.m_lUpper + nRow * m_aItem.m_lVDist))),
Size(ROUND(f * aItem.m_lWidth), Size(ROUND(f * m_aItem.m_lWidth),
ROUND(f * aItem.m_lHeight)))); ROUND(f * m_aItem.m_lHeight))));
rRenderContext.SetClipRegion(); rRenderContext.SetClipRegion();
// annotation: left border // annotation: left border
if (aItem.m_lLeft) if (m_aItem.m_lLeft)
{ {
long lX = (lX0 + lX1) / 2; long lX = (lX0 + lX1) / 2;
DrawArrow(rRenderContext, Point(lX0, lY0 - 5), Point(lX1, lY0 - 5), false); DrawArrow(rRenderContext, Point(lX0, lY0 - 5), Point(lX1, lY0 - 5), false);
DrawArrow(rRenderContext, Point(lX, lY0 - 10), Point(lX, lY0 - 5), true); DrawArrow(rRenderContext, Point(lX, lY0 - 10), Point(lX, lY0 - 5), true);
rRenderContext.DrawText(Point(lX1 - lLeftWidth, lY0 - 10 - lXHeight), aLeftStr); rRenderContext.DrawText(Point(lX1 - m_lLeftWidth, lY0 - 10 - m_lXHeight), m_aLeftStr);
} }
// annotation: upper border // annotation: upper border
if (aItem.m_lUpper) if (m_aItem.m_lUpper)
{ {
DrawArrow(rRenderContext, Point(lX0 - 5, lY0), Point(lX0 - 5, lY1), false); DrawArrow(rRenderContext, Point(lX0 - 5, lY0), Point(lX0 - 5, lY1), false);
rRenderContext.DrawText(Point(lX0 - 10 - lUpperWidth, lY0 + ROUND(f*aItem.m_lUpper/2.0 - lXHeight/2.0)), aUpperStr); rRenderContext.DrawText(Point(lX0 - 10 - m_lUpperWidth, lY0 + ROUND(f*m_aItem.m_lUpper/2.0 - m_lXHeight/2.0)), m_aUpperStr);
} }
// annotation: width and height // annotation: width and height
{ {
long lX = lX2 - lXWidth / 2 - lHeightWidth / 2; long lX = lX2 - m_lXWidth / 2 - m_lHeightWidth / 2;
long lY = lY1 + lXHeight; long lY = lY1 + m_lXHeight;
rRenderContext.DrawLine(Point(lX1, lY), Point(lX2 - 1, lY)); rRenderContext.DrawLine(Point(lX1, lY), Point(lX2 - 1, lY));
rRenderContext.DrawLine(Point(lX, lY1), Point(lX, lY2 - 1)); rRenderContext.DrawLine(Point(lX, lY1), Point(lX, lY2 - 1));
rRenderContext.DrawText(Point(lX1 + lXWidth / 2, lY - lXHeight / 2), aWidthStr); rRenderContext.DrawText(Point(lX1 + m_lXWidth / 2, lY - m_lXHeight / 2), m_aWidthStr);
rRenderContext.DrawText(Point(lX - lHeightWidth / 2, lY2 - lXHeight - lXHeight / 2), aHeightStr); rRenderContext.DrawText(Point(lX - m_lHeightWidth / 2, lY2 - m_lXHeight - m_lXHeight / 2), m_aHeightStr);
} }
// annotation: horizontal gap // annotation: horizontal gap
if (aItem.m_nCols > 1) if (m_aItem.m_nCols > 1)
{ {
long lX = (lX1 + lX3) / 2; long lX = (lX1 + lX3) / 2;
DrawArrow(rRenderContext, Point(lX1, lY0 - 5), Point(lX3, lY0 - 5), false); DrawArrow(rRenderContext, Point(lX1, lY0 - 5), Point(lX3, lY0 - 5), false);
DrawArrow(rRenderContext, Point(lX, lY0 - 10), Point(lX, lY0 - 5), true); DrawArrow(rRenderContext, Point(lX, lY0 - 10), Point(lX, lY0 - 5), true);
rRenderContext.DrawText(Point(lX - lHDistWidth / 2, lY0 - 10 - lXHeight), aHDistStr); rRenderContext.DrawText(Point(lX - m_lHDistWidth / 2, lY0 - 10 - m_lXHeight), m_aHDistStr);
} }
// annotation: vertical gap // annotation: vertical gap
if (aItem.m_nRows > 1) if (m_aItem.m_nRows > 1)
{ {
DrawArrow(rRenderContext, Point(lX0 - 5, lY1), Point(lX0 - 5, lY3), false); DrawArrow(rRenderContext, Point(lX0 - 5, lY1), Point(lX0 - 5, lY3), false);
rRenderContext.DrawText(Point(lX0 - 10 - lVDistWidth, lY1 + ROUND(f*aItem.m_lVDist/2.0 - lXHeight/2.0)), aVDistStr); rRenderContext.DrawText(Point(lX0 - 10 - m_lVDistWidth, lY1 + ROUND(f*m_aItem.m_lVDist/2.0 - m_lXHeight/2.0)), m_aVDistStr);
} }
// annotation: columns // annotation: columns
{ {
long lY = lY0 + lOutlineH + 4; long lY = lY0 + lOutlineH + 4;
DrawArrow(rRenderContext, Point(lX0, lY), Point(lX0 + lOutlineW - 1, lY), true); DrawArrow(rRenderContext, Point(lX0, lY), Point(lX0 + lOutlineW - 1, lY), true);
rRenderContext.DrawText(Point((lX0 + lX0 + lOutlineW - 1) / 2 - lColsWidth / 2, lY + 5), aColsStr); rRenderContext.DrawText(Point((lX0 + lX0 + lOutlineW - 1) / 2 - m_lColsWidth / 2, lY + 5), m_aColsStr);
} }
// annotation: lines // annotation: lines
{ {
long lX = lX0 + lOutlineW + 4; long lX = lX0 + lOutlineW + 4;
DrawArrow(rRenderContext, Point(lX, lY0), Point(lX, lY0 + lOutlineH - 1), true); DrawArrow(rRenderContext, Point(lX, lY0), Point(lX, lY0 + lOutlineH - 1), true);
rRenderContext.DrawText(Point(lX + 5, (lY0 + lY0 + lOutlineH - 1 - lXHeight / 2) / 2), aRowsStr); rRenderContext.DrawText(Point(lX + 5, (lY0 + lY0 + lOutlineH - 1 - m_lXHeight / 2) / 2), m_aRowsStr);
} }
} }
void SwLabPreview::UpdateItem(const SwLabItem& rItem) void SwLabPreview::UpdateItem(const SwLabItem& rItem)
{ {
aItem = rItem; m_aItem = rItem;
Invalidate(); Invalidate();
} }
......
...@@ -27,32 +27,32 @@ class SwLabFormatPage; ...@@ -27,32 +27,32 @@ class SwLabFormatPage;
class SwLabPreview : public vcl::Window class SwLabPreview : public vcl::Window
{ {
Color aGrayColor; Color m_aGrayColor;
OUString aHDistStr; OUString m_aHDistStr;
OUString aVDistStr; OUString m_aVDistStr;
OUString aWidthStr; OUString m_aWidthStr;
OUString aHeightStr; OUString m_aHeightStr;
OUString aLeftStr; OUString m_aLeftStr;
OUString aUpperStr; OUString m_aUpperStr;
OUString aColsStr; OUString m_aColsStr;
OUString aRowsStr; OUString m_aRowsStr;
OUString aPWidthStr; OUString m_aPWidthStr;
OUString aPHeightStr; OUString m_aPHeightStr;
long lHDistWidth; long m_lHDistWidth;
long lVDistWidth; long m_lVDistWidth;
long lHeightWidth; long m_lHeightWidth;
long lLeftWidth; long m_lLeftWidth;
long lUpperWidth; long m_lUpperWidth;
long lColsWidth; long m_lColsWidth;
long lPWidthWidth; long m_lPWidthWidth;
long lPHeightWidth; long m_lPHeightWidth;
long lXWidth; long m_lXWidth;
long lXHeight; long m_lXHeight;
SwLabItem aItem; SwLabItem m_aItem;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) override; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment