vcl: Allow pushing/popping OutputDevice’s RTLEnabled state

Change-Id: Icafdc307c5c9df768f00c3ac0d128936607bf3e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155794
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
This commit is contained in:
Khaled Hosny 2023-08-17 17:39:29 +03:00 committed by خالد حسني
parent a21ae72ab2
commit 611694b707
3 changed files with 11 additions and 1 deletions

View file

@ -53,6 +53,7 @@ enum class PushFlags
TEXTLAYOUTMODE = 0x0800,
TEXTLANGUAGE = 0x1000,
OVERLINECOLOR = 0x2000,
RTLENABLED = 0x4000,
ALL = 0xFFFF
};
}
@ -66,7 +67,7 @@ template <> struct typed_flags<vcl::PushFlags> : is_typed_flags<vcl::PushFlags,
#define PUSH_ALLFONT \
(vcl::PushFlags::TEXTCOLOR | vcl::PushFlags::TEXTFILLCOLOR | vcl::PushFlags::TEXTLINECOLOR \
| vcl::PushFlags::OVERLINECOLOR | vcl::PushFlags::TEXTALIGN | vcl::PushFlags::TEXTLAYOUTMODE \
| vcl::PushFlags::TEXTLANGUAGE | vcl::PushFlags::FONT)
| vcl::PushFlags::TEXTLANGUAGE | vcl::PushFlags::RTLENABLED | vcl::PushFlags::FONT)
namespace vcl::text
{
@ -114,6 +115,7 @@ struct State
LanguageType meTextLanguage = LANGUAGE_SYSTEM;
PushFlags mnFlags = PushFlags::NONE;
bool mbMapActive = false;
bool mbRTLEnabled = false;
};
}

View file

@ -63,6 +63,8 @@ OUString collectPushFlags(vcl::PushFlags nFlags)
aStrings.emplace_back("PushTextLanguage");
if (nFlags & vcl::PushFlags::OVERLINECOLOR)
aStrings.emplace_back("PushOverlineColor");
if (nFlags & vcl::PushFlags::RTLENABLED)
aStrings.emplace_back("PushRTLEnabled");
OUString aString;

View file

@ -84,6 +84,9 @@ void OutputDevice::Push(vcl::PushFlags nFlags)
if (nFlags & vcl::PushFlags::REFPOINT && mbRefPoint)
rState.mpRefPoint = maRefPoint;
if (nFlags & vcl::PushFlags::RTLENABLED)
rState.mbRTLEnabled = IsRTLEnabled();
if (mpAlphaVDev)
mpAlphaVDev->Push();
}
@ -184,6 +187,9 @@ void OutputDevice::Pop()
SetRefPoint();
}
if ( rState.mnFlags & vcl::PushFlags::RTLENABLED )
EnableRTL( rState.mbRTLEnabled );
maOutDevStateStack.pop_back();
mpMetaFile = pOldMetaFile;