diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2021-08-25 18:29:48 +1000 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-10 10:06:36 +0200 |
commit | 4d1d485544ea947b71534fd96ba520cd6e1c721b (patch) | |
tree | 0bf88b2b6d6076230d35a74771e95e453eaf27bc | |
parent | 9db1e85a8da3952cefef552853753342d7147b98 (diff) |
vcl: move SetLayoutMode() 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.
Also add a unit test for SetLayoutMode() and GetLayoutMode()
Change-Id: I92cada7bf3d57ca8b84e04308c74428a1a19e775
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121022
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 25 | ||||
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 11 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 11 |
4 files changed, 35 insertions, 14 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 8fa546b20b60..2839e5c98da5 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -483,7 +483,7 @@ public: DrawModeFlags GetDrawMode() const { return mnDrawMode; } void SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode ); - ComplexTextLayoutFlags GetLayoutMode() const { return mnTextLayoutMode; } + ComplexTextLayoutFlags GetLayoutMode() const { return mnTextLayoutMode; } void SetDigitLanguage( LanguageType ); LanguageType GetDigitLanguage() const { return meTextLanguage; } diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index f7a50b3bb5d2..40559ef09172 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -58,8 +58,9 @@ public: void testRefPoint(); void testRasterOp(); void testOutputFlag(); - void testDrawMode(); void testAntialias(); + void testDrawMode(); + void testLayoutMode(); void testSystemTextColor(); void testShouldDrawWavePixelAsRect(); void testGetWaveLineSize(); @@ -93,9 +94,10 @@ public: CPPUNIT_TEST(testDefaultRefPoint); CPPUNIT_TEST(testRefPoint); CPPUNIT_TEST(testRasterOp); + CPPUNIT_TEST(testOutputFlag); CPPUNIT_TEST(testAntialias); CPPUNIT_TEST(testDrawMode); - CPPUNIT_TEST(testOutputFlag); + CPPUNIT_TEST(testLayoutMode); CPPUNIT_TEST(testSystemTextColor); CPPUNIT_TEST(testShouldDrawWavePixelAsRect); CPPUNIT_TEST(testGetWaveLineSize); @@ -827,6 +829,25 @@ void VclOutdevTest::testDrawMode() CPPUNIT_ASSERT_EQUAL(DrawModeFlags::BlackLine, pVDev->GetDrawMode()); } +void VclOutdevTest::testLayoutMode() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + + GDIMetaFile aMtf; + aMtf.Record(pVDev.get()); + + CPPUNIT_ASSERT_EQUAL(ComplexTextLayoutFlags::Default, pVDev->GetLayoutMode()); + + pVDev->SetLayoutMode(ComplexTextLayoutFlags::BiDiRtl); + + CPPUNIT_ASSERT_EQUAL(ComplexTextLayoutFlags::BiDiRtl, pVDev->GetLayoutMode()); + + MetaAction* pAction = aMtf.GetAction(0); + CPPUNIT_ASSERT_EQUAL(MetaActionType::LAYOUTMODE, pAction->GetType()); + auto pLayoutModeAction = static_cast<MetaLayoutModeAction*>(pAction); + CPPUNIT_ASSERT_EQUAL(ComplexTextLayoutFlags::BiDiRtl, pLayoutModeAction->GetLayoutMode()); +} + void VclOutdevTest::testSystemTextColor() { { diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 3d788019854c..13062ca91685 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -198,17 +198,6 @@ void OutputDevice::ClearStack() Pop(); } -void OutputDevice::SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode ) -{ - if( mpMetaFile ) - mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) ); - - mnTextLayoutMode = nTextLayoutMode; - - if( mpAlphaVDev ) - mpAlphaVDev->SetLayoutMode( nTextLayoutMode ); -} - void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage ) { if( mpMetaFile ) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 801615401fcd..1d8164da09be 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -52,6 +52,17 @@ #define TEXT_DRAW_ELLIPSIS (DrawTextFlags::EndEllipsis | DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis) +void OutputDevice::SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode ) +{ + if( mpMetaFile ) + mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) ); + + mnTextLayoutMode = nTextLayoutMode; + + if( mpAlphaVDev ) + mpAlphaVDev->SetLayoutMode( nTextLayoutMode ); +} + ImplMultiTextLineInfo::ImplMultiTextLineInfo() { } |