summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2021-08-25 18:45:50 +1000
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-10 10:07:33 +0200
commitecb7289fc3091fbbb8a65f43fc649e57a9870ac9 (patch)
tree5e5ed7a5e586f70849bf19c849b6ea0a7e2a8730 /vcl
parent4d1d485544ea947b71534fd96ba520cd6e1c721b (diff)
vcl: move OutputDevice::SetDigitLanguage() to text.cxx
Ultimately I hope to reduce outdevstate.cxx to only have push(), pop() and clearstack(), then rename outdevstate.cxx to stack.cxx. Eventually, the plan is to separate metafile processing from rendering. Add unit test for SetDigitLanguage() and GetDigitLanguage(). Change-Id: I138d08c7d79c66d296b4c96eff644a40a379c6be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121023 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/outdev.cxx21
-rw-r--r--vcl/source/outdev/outdevstate.cxx11
-rw-r--r--vcl/source/outdev/text.cxx11
3 files changed, 32 insertions, 11 deletions
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 40559ef09172..ddf3344244bf 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -61,6 +61,7 @@ public:
void testAntialias();
void testDrawMode();
void testLayoutMode();
+ void testDigitLanguage();
void testSystemTextColor();
void testShouldDrawWavePixelAsRect();
void testGetWaveLineSize();
@@ -98,6 +99,7 @@ public:
CPPUNIT_TEST(testAntialias);
CPPUNIT_TEST(testDrawMode);
CPPUNIT_TEST(testLayoutMode);
+ CPPUNIT_TEST(testDigitLanguage);
CPPUNIT_TEST(testSystemTextColor);
CPPUNIT_TEST(testShouldDrawWavePixelAsRect);
CPPUNIT_TEST(testGetWaveLineSize);
@@ -848,6 +850,25 @@ void VclOutdevTest::testLayoutMode()
CPPUNIT_ASSERT_EQUAL(ComplexTextLayoutFlags::BiDiRtl, pLayoutModeAction->GetLayoutMode());
}
+void VclOutdevTest::testDigitLanguage()
+{
+ ScopedVclPtrInstance<VirtualDevice> pVDev;
+
+ GDIMetaFile aMtf;
+ aMtf.Record(pVDev.get());
+
+ CPPUNIT_ASSERT_EQUAL(LANGUAGE_SYSTEM, pVDev->GetDigitLanguage());
+
+ pVDev->SetDigitLanguage(LANGUAGE_GERMAN);
+
+ CPPUNIT_ASSERT_EQUAL(LANGUAGE_GERMAN, pVDev->GetDigitLanguage());
+
+ MetaAction* pAction = aMtf.GetAction(0);
+ CPPUNIT_ASSERT_EQUAL(MetaActionType::TEXTLANGUAGE, pAction->GetType());
+ auto pTextLanguageAction = static_cast<MetaTextLanguageAction*>(pAction);
+ CPPUNIT_ASSERT_EQUAL(LANGUAGE_GERMAN, pTextLanguageAction->GetTextLanguage());
+}
+
void VclOutdevTest::testSystemTextColor()
{
{
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 13062ca91685..ee8eddf07fb1 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -198,15 +198,4 @@ void OutputDevice::ClearStack()
Pop();
}
-void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
-{
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) );
-
- meTextLanguage = eTextLanguage;
-
- if( mpAlphaVDev )
- mpAlphaVDev->SetDigitLanguage( eTextLanguage );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1d8164da09be..f1aa776629eb 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -63,6 +63,17 @@ void OutputDevice::SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode )
mpAlphaVDev->SetLayoutMode( nTextLayoutMode );
}
+void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
+{
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) );
+
+ meTextLanguage = eTextLanguage;
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetDigitLanguage( eTextLanguage );
+}
+
ImplMultiTextLineInfo::ImplMultiTextLineInfo()
{
}