[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 10 08:07:13 UTC 2021


 include/vcl/outdev.hxx            |    2 +-
 vcl/qa/cppunit/outdev.cxx         |   25 +++++++++++++++++++++++--
 vcl/source/outdev/outdevstate.cxx |   11 -----------
 vcl/source/outdev/text.cxx        |   11 +++++++++++
 4 files changed, 35 insertions(+), 14 deletions(-)

New commits:
commit 4d1d485544ea947b71534fd96ba520cd6e1c721b
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Wed Aug 25 18:29:48 2021 +1000
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 10 10:06:36 2021 +0200

    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 at collabora.co.uk>

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()
 {
 }


More information about the Libreoffice-commits mailing list