summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMark Hung <marklm9@gmail.com>2022-06-10 21:25:07 +0800
committerMark Hung <marklh9@gmail.com>2022-06-19 10:10:07 +0200
commitf770dd18192addf0bbc587c0b2d266e3dd56819b (patch)
treebe0c4de9ad51a18191a61a04d1ca219915d97d36 /sw
parent50e60ef342b94974d57956f01427f93d91d9875f (diff)
sw: prefix namespace Justify with sw.
Change-Id: Ia813b93dc719a5715804aa06b555c99eaf99b039 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135594 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/txtnode/justify.cxx21
-rw-r--r--sw/source/core/txtnode/fntcache.cxx20
-rw-r--r--sw/source/core/txtnode/justify.cxx2
-rw-r--r--sw/source/core/txtnode/justify.hxx2
4 files changed, 24 insertions, 21 deletions
diff --git a/sw/qa/core/txtnode/justify.cxx b/sw/qa/core/txtnode/justify.cxx
index 0bdcd01e38d5..1565703f1f9e 100644
--- a/sw/qa/core/txtnode/justify.cxx
+++ b/sw/qa/core/txtnode/justify.cxx
@@ -82,7 +82,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionHalfSpace)
CharWidthArray aExpected{ 720, 851, 573, 720, 639, 612, 573, 720, 480, 720 };
aActual.InvokeWithKernArray(
- [&] { Justify::SpaceDistribution(aActual.maArray, aText, 0, 10, 425, 0, false); });
+ [&] { sw::Justify::SpaceDistribution(aActual.maArray, aText, 0, 10, 425, 0, false); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
@@ -94,7 +94,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionNoHalfSpace)
CharWidthArray aExpected{ 720, 639, 785, 720, 639, 400, 785, 720, 480, 720 };
aActual.InvokeWithKernArray(
- [&] { Justify::SpaceDistribution(aActual.maArray, aText, 0, 10, 425, 0, true); });
+ [&] { sw::Justify::SpaceDistribution(aActual.maArray, aText, 0, 10, 425, 0, true); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
@@ -106,7 +106,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionUnicodeIVS)
CharWidthArray aActual{ 1600, 1600, 1600, 0, 0, 1600, 1600, 1600, 1600, 1600, 0, 0 };
CharWidthArray aExpected{ 1800, 1800, 1800, 0, 0, 1800, 1800, 1800, 1800, 1800, 0, 0 };
aActual.InvokeWithKernArray(
- [&] { Justify::SpaceDistribution(aActual.maArray, aText, 0, 12, 0, 200, false); });
+ [&] { sw::Justify::SpaceDistribution(aActual.maArray, aText, 0, 12, 0, 200, false); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
@@ -121,7 +121,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGrid)
1360, 1040, 1200, 1200, 1200, 1200, 1200, 1200, 1040, 1360, 1200, 1040
};
aActual.InvokeWithKernArray(
- [&] { nDelta = Justify::SnapToGrid(aActual.maArray, aText, 0, 12, 400, false); });
+ [&] { nDelta = sw::Justify::SnapToGrid(aActual.maArray, aText, 0, 12, 400, false); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
CPPUNIT_ASSERT_EQUAL(tools::Long(160), nDelta);
}
@@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridMixWidth)
CharWidthArray aActual{ 640, 640, 640, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320 };
CharWidthArray aExpected{ 800, 800, 760, 400, 400, 400, 400, 400, 400, 400, 400, 400, 360 };
aActual.InvokeWithKernArray(
- [&] { nDelta = Justify::SnapToGrid(aActual.maArray, aText, 0, 13, 400, false); });
+ [&] { nDelta = sw::Justify::SnapToGrid(aActual.maArray, aText, 0, 13, 400, false); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
CPPUNIT_ASSERT_EQUAL(tools::Long(80), nDelta);
}
@@ -150,7 +150,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridIVS)
CharWidthArray aActual{ 800, 800, 800, 0, 0, 800, 800 };
CharWidthArray aExpected{ 800, 800, 800, 0, 0, 800, 800 };
aActual.InvokeWithKernArray(
- [&] { nDelta = Justify::SnapToGrid(aActual.maArray, aText, 0, 7, 400, false); });
+ [&] { nDelta = sw::Justify::SnapToGrid(aActual.maArray, aText, 0, 7, 400, false); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
CPPUNIT_ASSERT_EQUAL(tools::Long(0), nDelta);
}
@@ -159,7 +159,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridEdge1)
{
CharWidthArray aActual{ 640, 640, 640, 640, 640, 640, 320, 960 };
CharWidthArray aExpected{ 840, 840, 840, 840, 840, 840, 440, 1240 };
- aActual.InvokeWithKernArray([&] { Justify::SnapToGridEdge(aActual.maArray, 8, 400, 40, 0); });
+ aActual.InvokeWithKernArray(
+ [&] { sw::Justify::SnapToGridEdge(aActual.maArray, 8, 400, 40, 0); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
@@ -167,7 +168,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridEdge2)
{
CharWidthArray aActual{ 640, 640, 640, 640, 640, 640, 320, 640 };
CharWidthArray aExpected{ 840, 840, 840, 840, 840, 840, 440, 840 };
- aActual.InvokeWithKernArray([&] { Justify::SnapToGridEdge(aActual.maArray, 8, 100, 40, 80); });
+ aActual.InvokeWithKernArray(
+ [&] { sw::Justify::SnapToGridEdge(aActual.maArray, 8, 100, 40, 80); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
@@ -175,7 +177,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridEdgeIVS)
{
CharWidthArray aActual{ 640, 0, 0, 640, 640, 640, 640, 640 };
CharWidthArray aExpected{ 840, 0, 0, 840, 840, 840, 840, 840 };
- aActual.InvokeWithKernArray([&] { Justify::SnapToGridEdge(aActual.maArray, 8, 400, 40, 0); });
+ aActual.InvokeWithKernArray(
+ [&] { sw::Justify::SnapToGridEdge(aActual.maArray, 8, 400, 40, 0); });
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 12613bfd3b7f..4058f12a1492 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -935,12 +935,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if (pGrid->IsSnapToChars())
{
- nDelta = Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+ nDelta = sw::Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
sal_Int32(rInf.GetLen()), nGridWidth, false);
}
else
{
- Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
+ sw::Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
nSpaceAdd, rInf.GetKern());
}
@@ -1349,7 +1349,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if (m_pPrtFont->IsWordLineMode())
bNoHalfSpace = true;
- Justify::SpaceDistribution(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+ sw::Justify::SpaceDistribution(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
sal_Int32(nCnt), nSpaceAdd, rInf.GetKern(), bNoHalfSpace);
if( rInf.GetGreyWave() )
@@ -1565,13 +1565,13 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
GetTextArray(*pOutDev, rInf, aKernArray, sal_Int32(rInf.GetLen()));
if (pGrid->IsSnapToChars())
{
- Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+ sw::Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
sal_Int32(rInf.GetLen()), nGridWidth, true);
}
else
{
// use 0 to calculate raw width without rInf.GetSpace().
- Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth, 0,
+ sw::Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth, 0,
rInf.GetKern());
}
@@ -1687,16 +1687,16 @@ TextFrameIndex SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
if (pGrid->IsSnapToChars())
{
- Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+ sw::Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
sal_Int32(rInf.GetLen()), nGridWidth, true);
}
else
{
- Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
+ sw::Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
nSpaceAdd, rInf.GetKern());
}
- return TextFrameIndex(Justify::GetModelPosition(aKernArray, sal_Int32(rInf.GetLen()),
+ return TextFrameIndex(sw::Justify::GetModelPosition(aKernArray, sal_Int32(rInf.GetLen()),
rInf.GetOffset()));
}
}
@@ -1964,13 +1964,13 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe
if (pGrid->IsSnapToChars())
{
- Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
+ sw::Justify::SnapToGrid(aKernArray, rInf.GetText(), sal_Int32(rInf.GetIdx()),
sal_Int32(rInf.GetLen()), nGridWidth, true);
}
else
{
// use 0 to calculate raw width without rInf.GetSpace().
- Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
+ sw::Justify::SnapToGridEdge(aKernArray, sal_Int32(rInf.GetLen()), nGridWidth,
0, rInf.GetKern());
}
diff --git a/sw/source/core/txtnode/justify.cxx b/sw/source/core/txtnode/justify.cxx
index 1cbc16c36c0b..45a73223c9f4 100644
--- a/sw/source/core/txtnode/justify.cxx
+++ b/sw/source/core/txtnode/justify.cxx
@@ -71,7 +71,7 @@ tools::Long lcl_OffsetFromGridEdge(tools::Long nMinWidth, tools::Long nCharWidth
}
}
-namespace Justify
+namespace sw::Justify
{
sal_Int32 GetModelPosition(const std::vector<sal_Int32>& rKernArray, sal_Int32 nLen, tools::Long nX)
{
diff --git a/sw/source/core/txtnode/justify.hxx b/sw/source/core/txtnode/justify.hxx
index 6ea07adeceb7..4720a4c04d64 100644
--- a/sw/source/core/txtnode/justify.hxx
+++ b/sw/source/core/txtnode/justify.hxx
@@ -10,7 +10,7 @@
#pragma once
#include <sal/types.h>
-namespace Justify
+namespace sw::Justify
{
/// Get model position base on given kern array.
/// @param rKernArray text positions from OutDev::GetTextArray().