convert EXTTEXTINPUT_ATTR to scoped enum

Change-Id: I94706bdea91d367fc8c2bbd482f6b4d8f55449d7
Reviewed-on: https://gerrit.libreoffice.org/24821
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-09 17:07:54 +02:00 committed by Noel Grandin
parent 7b9ea3348a
commit 63ba54a168
25 changed files with 156 additions and 145 deletions

View file

@ -137,16 +137,16 @@ struct DragAndDropInfo
struct ImplIMEInfos
{
OUString aOldTextAfterStartPos;
sal_uInt16* pAttribs;
ExtTextInputAttr* pAttribs;
EditPaM aPos;
sal_Int32 nLen;
bool bCursor;
bool bWasCursorOverwrite;
bool bCursor;
bool bWasCursorOverwrite;
ImplIMEInfos( const EditPaM& rPos, const OUString& rOldTextAfterStartPos );
~ImplIMEInfos();
void CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
void CopyAttribs( const ExtTextInputAttr* pA, sal_uInt16 nL );
void DestroyAttribs();
};

View file

@ -2342,7 +2342,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rS
if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) )
{
sal_uInt16 nLastAttr = 0xFFFF;
ExtTextInputAttr nLastAttr = (ExtTextInputAttr)0xFFFF;
for( sal_Int32 n = 0; n < mpIMEInfos->nLen; n++ )
{
if ( mpIMEInfos->pAttribs[n] != nLastAttr )
@ -2769,27 +2769,27 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) &&
( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) ) )
{
sal_uInt16 nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
if ( nAttr & ExtTextInputAttr::Underline )
rFont.SetUnderline( LINESTYLE_SINGLE );
else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::BoldUnderline )
rFont.SetUnderline( LINESTYLE_BOLD );
else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DottedUnderline )
rFont.SetUnderline( LINESTYLE_DOTTED );
else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DashDotUnderline )
rFont.SetUnderline( LINESTYLE_DOTTED );
else if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
else if ( nAttr & ExtTextInputAttr::RedText )
rFont.SetColor( Color( COL_RED ) );
else if ( nAttr & EXTTEXTINPUT_ATTR_HALFTONETEXT )
else if ( nAttr & ExtTextInputAttr::HalfToneText )
rFont.SetColor( Color( COL_LIGHTGRAY ) );
if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT )
if ( nAttr & ExtTextInputAttr::Highlight )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
rFont.SetColor( rStyleSettings.GetHighlightTextColor() );
rFont.SetFillColor( rStyleSettings.GetHighlightColor() );
rFont.SetTransparent( false );
}
else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
else if ( nAttr & ExtTextInputAttr::GrayWaveline )
{
rFont.SetUnderline( LINESTYLE_WAVE );
if( pOut )

View file

@ -817,12 +817,12 @@ ImplIMEInfos::~ImplIMEInfos()
delete[] pAttribs;
}
void ImplIMEInfos::CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL )
void ImplIMEInfos::CopyAttribs( const ExtTextInputAttr* pA, sal_uInt16 nL )
{
nLen = nL;
delete[] pAttribs;
pAttribs = new sal_uInt16[ nL ];
memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) );
pAttribs = new ExtTextInputAttr[ nL ];
memcpy( pAttribs, pA, nL*sizeof(ExtTextInputAttr) );
}
void ImplIMEInfos::DestroyAttribs()

View file

@ -25,18 +25,7 @@
#include <vcl/dllapi.h>
#include <vcl/keycod.hxx>
#include <vcl/font.hxx>
#define EXTTEXTINPUT_ATTR_GRAYWAVELINE ((sal_uInt16)0x0100)
#define EXTTEXTINPUT_ATTR_UNDERLINE ((sal_uInt16)0x0200)
#define EXTTEXTINPUT_ATTR_BOLDUNDERLINE ((sal_uInt16)0x0400)
#define EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE ((sal_uInt16)0x0800)
#define EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE ((sal_uInt16)0x1000)
#define EXTTEXTINPUT_ATTR_HIGHLIGHT ((sal_uInt16)0x2000)
#define EXTTEXTINPUT_ATTR_REDTEXT ((sal_uInt16)0x4000)
#define EXTTEXTINPUT_ATTR_HALFTONETEXT ((sal_uInt16)0x8000)
#define EXTTEXTINPUT_CURSOR_INVISIBLE ((sal_uInt16)0x0001)
#define EXTTEXTINPUT_CURSOR_OVERWRITE ((sal_uInt16)0x0002)
#include <o3tl/typed_flags_set.hxx>
class CommandExtTextInputData;
class CommandWheelData;
@ -49,6 +38,26 @@ class CommandSwipeData;
class CommandLongPressData;
enum class CommandEventId;
enum class ExtTextInputAttr {
NONE = 0x0000,
GrayWaveline = 0x0100,
Underline = 0x0200,
BoldUnderline = 0x0400,
DottedUnderline = 0x0800,
DashDotUnderline = 0x1000,
Highlight = 0x2000,
RedText = 0x4000,
HalfToneText = 0x8000
};
namespace o3tl
{
template<> struct typed_flags<ExtTextInputAttr> : is_typed_flags<ExtTextInputAttr, 0xff00> {};
}
#define EXTTEXTINPUT_CURSOR_INVISIBLE ((sal_uInt16)0x0001)
#define EXTTEXTINPUT_CURSOR_OVERWRITE ((sal_uInt16)0x0002)
class VCL_DLLPUBLIC CommandEvent
{
private:
@ -82,14 +91,14 @@ class VCL_DLLPUBLIC CommandExtTextInputData
{
private:
OUString maText;
sal_uInt16* mpTextAttr;
ExtTextInputAttr* mpTextAttr;
sal_Int32 mnCursorPos;
sal_uInt16 mnCursorFlags;
bool mbOnlyCursor;
public:
CommandExtTextInputData( const OUString& rText,
const sal_uInt16* pTextAttr,
const ExtTextInputAttr* pTextAttr,
sal_Int32 nCursorPos,
sal_uInt16 nCursorFlags,
bool bOnlyCursor );
@ -97,7 +106,7 @@ public:
~CommandExtTextInputData();
const OUString& GetText() const { return maText; }
const sal_uInt16* GetTextAttr() const { return mpTextAttr; }
const ExtTextInputAttr* GetTextAttr() const { return mpTextAttr; }
sal_Int32 GetCursorPos() const { return mnCursorPos; }
bool IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }

View file

@ -24,6 +24,8 @@
#include <svl/smplhint.hxx>
#include <vcl/dllapi.h>
enum class ExtTextInputAttr;
// for Notify, if all paragraphs were deleted
#define TEXT_PARA_ALL SAL_MAX_UINT32
#define TEXT_INDEX_ALL SAL_MAX_INT32
@ -138,7 +140,7 @@ public:
struct TEIMEInfos
{
OUString aOldTextAfterStartPos;
sal_uInt16* pAttribs;
ExtTextInputAttr* pAttribs;
TextPaM aPos;
sal_Int32 nLen;
bool bCursor;
@ -147,7 +149,7 @@ struct TEIMEInfos
TEIMEInfos(const TextPaM& rPos, const OUString& rOldTextAfterStartPos);
~TEIMEInfos();
void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
void CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL);
void DestroyAttribs();
};

View file

@ -27,7 +27,7 @@ class CommandExtTextInputData;
class SwExtTextInput : public SwPaM
{
std::vector<sal_uInt16> aAttrs;
std::vector<ExtTextInputAttr> aAttrs;
OUString sOverwriteText;
bool bInsText : 1;
bool bIsOverwriteCursor : 1;
@ -37,7 +37,7 @@ public:
virtual ~SwExtTextInput();
void SetInputData( const CommandExtTextInputData& rData );
const std::vector<sal_uInt16>& GetAttrs() const { return aAttrs; }
const std::vector<ExtTextInputAttr>& GetAttrs() const { return aAttrs; }
void SetInsText( bool bFlag ) { bInsText = bFlag; }
bool IsOverwriteCursor() const { return bIsOverwriteCursor; }
void SetOverwriteCursor( bool bFlag );

View file

@ -203,7 +203,7 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData )
aAttrs.clear();
if( rData.GetTextAttr() )
{
const sal_uInt16 *pAttrs = rData.GetTextAttr();
const ExtTextInputAttr *pAttrs = rData.GetTextAttr();
aAttrs.insert( aAttrs.begin(), pAttrs, pAttrs + rData.GetText().getLength() );
}
}

View file

@ -137,7 +137,7 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX );
if( pExtInp || USHRT_MAX != nRedlPos )
{
const std::vector<sal_uInt16> *pArr = nullptr;
const std::vector<ExtTextInputAttr> *pArr = nullptr;
sal_Int32 nInputStt = 0;
if( pExtInp )
{
@ -169,7 +169,7 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
// Redline is active, nStart and nEnd are invalid.
SwRedlineItr::SwRedlineItr( const SwTextNode& rTextNd, SwFont& rFnt,
SwAttrHandler& rAH, sal_Int32 nRed, bool bShw,
const std::vector<sal_uInt16> *pArr,
const std::vector<ExtTextInputAttr> *pArr,
sal_Int32 nExtStart )
: rDoc( *rTextNd.GetDoc() ), rAttrHandler( rAH ), pSet( nullptr ),
nNdIdx( rTextNd.GetIndex() ), nFirst( nRed ),
@ -402,27 +402,27 @@ bool SwRedlineItr::CheckLine( sal_Int32 nChkStart, sal_Int32 nChkEnd )
return bRet;
}
void SwExtend::ActualizeFont( SwFont &rFnt, sal_uInt16 nAttr )
void SwExtend::ActualizeFont( SwFont &rFnt, ExtTextInputAttr nAttr )
{
if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
if ( nAttr & ExtTextInputAttr::Underline )
rFnt.SetUnderline( LINESTYLE_SINGLE );
else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::BoldUnderline )
rFnt.SetUnderline( LINESTYLE_BOLD );
else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DottedUnderline )
rFnt.SetUnderline( LINESTYLE_DOTTED );
else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DashDotUnderline )
rFnt.SetUnderline( LINESTYLE_DOTTED );
if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
if ( nAttr & ExtTextInputAttr::RedText )
rFnt.SetColor( Color( COL_RED ) );
if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT )
if ( nAttr & ExtTextInputAttr::Highlight )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
rFnt.SetColor( rStyleSettings.GetHighlightTextColor() );
rFnt.SetBackColor( new Color( rStyleSettings.GetHighlightColor() ) );
}
if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
if ( nAttr & ExtTextInputAttr::GrayWaveline )
rFnt.SetGreyWave( true );
}
@ -443,11 +443,11 @@ short SwExtend::Enter(SwFont& rFnt, sal_Int32 nNew)
bool SwExtend::Leave_(SwFont& rFnt, sal_Int32 nNew)
{
OSL_ENSURE( Inside(), "SwExtend: Leave without Enter" );
const sal_uInt16 nOldAttr = rArr[ nPos - nStart ];
const ExtTextInputAttr nOldAttr = rArr[ nPos - nStart ];
nPos = nNew;
if( Inside() )
{ // We stayed within the ExtendText-section
const sal_uInt16 nAttr = rArr[ nPos - nStart ];
const ExtTextInputAttr nAttr = rArr[ nPos - nStart ];
if( nOldAttr != nAttr ) // Is there an (inner) change of attributes?
{
rFnt = *pFnt;
@ -474,7 +474,7 @@ sal_Int32 SwExtend::Next( sal_Int32 nNext )
else if( nPos < nEnd )
{
sal_Int32 nIdx = nPos - nStart;
const sal_uInt16 nAttr = rArr[ nIdx ];
const ExtTextInputAttr nAttr = rArr[ nIdx ];
while( static_cast<size_t>(++nIdx) < rArr.size() && nAttr == rArr[ nIdx ] )
; //nothing
nIdx = nIdx + nStart;

View file

@ -34,15 +34,15 @@ class SwAttrHandler;
class SwExtend
{
SwFont *pFnt;
const std::vector<sal_uInt16> &rArr; // XAMA: Array of sal_uInt16
const std::vector<ExtTextInputAttr> &rArr;
sal_Int32 nStart;
sal_Int32 nPos;
sal_Int32 nEnd;
bool Leave_( SwFont& rFnt, sal_Int32 nNew );
bool Inside() const { return ( nPos >= nStart && nPos < nEnd ); }
static void ActualizeFont( SwFont &rFnt, sal_uInt16 nAttr );
static void ActualizeFont( SwFont &rFnt, ExtTextInputAttr nAttr );
public:
SwExtend( const std::vector<sal_uInt16> &rA, sal_Int32 nSt ) : pFnt(nullptr), rArr( rA ),
SwExtend( const std::vector<ExtTextInputAttr> &rA, sal_Int32 nSt ) : pFnt(nullptr), rArr( rA ),
nStart( nSt ), nPos( COMPLETE_STRING ), nEnd( nStart + rA.size() ) {}
~SwExtend() { delete pFnt; }
bool IsOn() const { return pFnt != nullptr; }
@ -85,7 +85,7 @@ class SwRedlineItr
}
public:
SwRedlineItr( const SwTextNode& rTextNd, SwFont& rFnt, SwAttrHandler& rAH,
sal_Int32 nRedlPos, bool bShw, const std::vector<sal_uInt16> *pArr = nullptr,
sal_Int32 nRedlPos, bool bShw, const std::vector<ExtTextInputAttr> *pArr = nullptr,
sal_Int32 nExtStart = COMPLETE_STRING );
~SwRedlineItr();
inline bool IsOn() const { return bOn || ( pExt && pExt->IsOn() ); }

View file

@ -6006,9 +6006,9 @@ void QuickHelpData::Start( SwWrtShell& rSh, sal_uInt16 nWrdLen )
OUString sStr( m_aHelpStrings[ nCurArrPos ] );
sStr = sStr.copy( nLen );
sal_uInt16 nL = sStr.getLength();
const sal_uInt16 nVal = EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE |
EXTTEXTINPUT_ATTR_HIGHLIGHT;
const std::vector<sal_uInt16> aAttrs( nL, nVal );
const ExtTextInputAttr nVal = ExtTextInputAttr::DottedUnderline |
ExtTextInputAttr::Highlight;
const std::vector<ExtTextInputAttr> aAttrs( nL, nVal );
CommandExtTextInputData aCETID( sStr, &aAttrs[0], nL,
0, false );

View file

@ -28,11 +28,11 @@ class SalGraphics;
class SalFrame;
class SalObject;
namespace vcl { class Window; }
class FontSelectPattern;
enum class InputContextFlags;
enum class WindowStateMask;
enum class WindowStateState;
enum class ExtTextInputAttr;
enum class SalEvent {
NONE,
@ -163,7 +163,7 @@ struct SalExtTextInputEvent
{
sal_uInt64 mnTime; // Time in ms, when event is created
OUString maText; // Text
const sal_uInt16* mpTextAttr; // Text-Attribute
const ExtTextInputAttr* mpTextAttr; // Text-Attribute
sal_Int32 mnCursorPos; // Cursor-Position
sal_uInt8 mnCursorFlags; // EXTTEXTINPUT_CURSOR_xxx
bool mbOnlyCursor; // true: Only Cursor-Position has been changed

View file

@ -145,7 +145,7 @@ class GtkSalFrame : public SalFrame
bool m_bFocused;
bool m_bPreeditJustChanged;
SalExtTextInputEvent m_aInputEvent;
std::vector< sal_uInt16 > m_aInputFlags;
std::vector< ExtTextInputAttr > m_aInputFlags;
IMHandler( GtkSalFrame* );
~IMHandler();

View file

@ -72,7 +72,7 @@ typedef struct {
preedit_status_t eState;
preedit_text_t aText;
SalExtTextInputEvent aInputEv;
std::vector< sal_uInt16 > aInputFlags;
std::vector< ExtTextInputAttr > aInputFlags;
} preedit_data_t;
#endif // INCLUDED_VCL_INC_UNX_I18N_CB_HXX

View file

@ -86,7 +86,7 @@ bool ImplWindowFrameProc( vcl::Window* pInst, SalEvent nEvent, const void* pEven
struct ImplWinData
{
OUString* mpExtOldText;
sal_uInt16* mpExtOldAttrAry;
ExtTextInputAttr* mpExtOldAttrAry;
Rectangle* mpCursorRect;
long mnCursorExtWidth;
bool mbVertical;

View file

@ -1610,7 +1610,7 @@ private:
if( len > 0 ) {
NSString *pString = [aString string];
OUString aInsertString( GetOUString( pString ) );
std::vector<sal_uInt16> aInputFlags = std::vector<sal_uInt16>( std::max( 1, len ), 0 );
std::vector<ExtTextInputAttr> aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, len ), ExtTextInputAttr::NONE );
for ( int i = 0; i < len; i++ )
{
unsigned int nUnderlineValue;
@ -1621,16 +1621,16 @@ private:
switch (nUnderlineValue & 0xff) {
case NSUnderlineStyleSingle:
aInputFlags[i] = EXTTEXTINPUT_ATTR_UNDERLINE;
aInputFlags[i] = ExtTextInputAttr::Underline;
break;
case NSUnderlineStyleThick:
aInputFlags[i] = EXTTEXTINPUT_ATTR_UNDERLINE | EXTTEXTINPUT_ATTR_HIGHLIGHT;
aInputFlags[i] = ExtTextInputAttr::Underline | ExtTextInputAttr::Highlight;
break;
case NSUnderlineStyleDouble:
aInputFlags[i] = EXTTEXTINPUT_ATTR_BOLDUNDERLINE;
aInputFlags[i] = ExtTextInputAttr::BoldUnderline;
break;
default:
aInputFlags[i] = EXTTEXTINPUT_ATTR_HIGHLIGHT;
aInputFlags[i] = ExtTextInputAttr::Highlight;
break;
}
}

View file

@ -112,7 +112,7 @@ struct DDInfo
struct Impl_IMEInfos
{
OUString aOldTextAfterStartPos;
sal_uInt16* pAttribs;
ExtTextInputAttr* pAttribs;
sal_Int32 nPos;
sal_Int32 nLen;
bool bCursor;
@ -121,7 +121,7 @@ struct Impl_IMEInfos
Impl_IMEInfos(sal_Int32 nPos, const OUString& rOldTextAfterStartPos);
~Impl_IMEInfos();
void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
void CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL);
void DestroyAttribs();
};
@ -140,12 +140,12 @@ Impl_IMEInfos::~Impl_IMEInfos()
delete[] pAttribs;
}
void Impl_IMEInfos::CopyAttribs(const sal_uInt16* pA, sal_Int32 nL)
void Impl_IMEInfos::CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL)
{
nLen = nL;
delete[] pAttribs;
pAttribs = new sal_uInt16[ nL ];
memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) );
pAttribs = new ExtTextInputAttr[ nL ];
memcpy( pAttribs, pA, nL*sizeof(ExtTextInputAttr) );
}
void Impl_IMEInfos::DestroyAttribs()
@ -585,7 +585,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRec
if (mpIMEInfos && mpIMEInfos->pAttribs &&
i >= mpIMEInfos->nPos && i < (mpIMEInfos->nPos+mpIMEInfos->nLen) &&
(mpIMEInfos->pAttribs[i - mpIMEInfos->nPos] & EXTTEXTINPUT_ATTR_HIGHLIGHT))
(mpIMEInfos->pAttribs[i - mpIMEInfos->nPos] & ExtTextInputAttr::Highlight))
{
bHighlight = true;
}
@ -648,7 +648,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRec
for(int i = 0; i < mpIMEInfos->nLen; )
{
sal_uInt16 nAttr = mpIMEInfos->pAttribs[i];
ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[i];
vcl::Region aClip;
int nIndex = i;
while (nIndex < mpIMEInfos->nLen && mpIMEInfos->pAttribs[nIndex] == nAttr) // #112631# check nIndex before using it
@ -662,27 +662,27 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRec
}
i = nIndex;
aClip.Intersect(aRegion);
if (!aClip.IsEmpty() && nAttr)
if (!aClip.IsEmpty() && nAttr != ExtTextInputAttr::NONE)
{
vcl::Font aFont = rRenderContext.GetFont();
if (nAttr & EXTTEXTINPUT_ATTR_UNDERLINE)
if (nAttr & ExtTextInputAttr::Underline)
aFont.SetUnderline(LINESTYLE_SINGLE);
else if (nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE)
else if (nAttr & ExtTextInputAttr::BoldUnderline)
aFont.SetUnderline( LINESTYLE_BOLD);
else if (nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE)
else if (nAttr & ExtTextInputAttr::DottedUnderline)
aFont.SetUnderline( LINESTYLE_DOTTED);
else if (nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE)
else if (nAttr & ExtTextInputAttr::DashDotUnderline)
aFont.SetUnderline( LINESTYLE_DASHDOT);
else if (nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE)
else if (nAttr & ExtTextInputAttr::GrayWaveline)
{
aFont.SetUnderline(LINESTYLE_WAVE);
rRenderContext.SetTextLineColor(Color(COL_LIGHTGRAY));
}
rRenderContext.SetFont(aFont);
if (nAttr & EXTTEXTINPUT_ATTR_REDTEXT)
if (nAttr & ExtTextInputAttr::RedText)
rRenderContext.SetTextColor(Color(COL_RED));
else if (nAttr & EXTTEXTINPUT_ATTR_HALFTONETEXT)
else if (nAttr & ExtTextInputAttr::HalfToneText)
rRenderContext.SetTextColor(Color(COL_LIGHTGRAY));
rRenderContext.SetClipRegion(aClip);

View file

@ -283,12 +283,12 @@ TEIMEInfos::~TEIMEInfos()
delete[] pAttribs;
}
void TEIMEInfos::CopyAttribs(const sal_uInt16* pA, sal_Int32 nL)
void TEIMEInfos::CopyAttribs(const ExtTextInputAttr* pA, sal_Int32 nL)
{
nLen = nL;
delete[] pAttribs;
pAttribs = new sal_uInt16[ nL ];
memcpy( pAttribs, pA, nL*sizeof(sal_uInt16) );
pAttribs = new ExtTextInputAttr[ nL ];
memcpy( pAttribs, pA, nL*sizeof(ExtTextInputAttr) );
}
void TEIMEInfos::DestroyAttribs()

View file

@ -1403,27 +1403,27 @@ void TextEngine::SeekCursor( sal_uInt32 nPara, sal_Int32 nPos, vcl::Font& rFont,
if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) &&
( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) ) )
{
sal_uInt16 nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
if ( nAttr & ExtTextInputAttr::Underline )
rFont.SetUnderline( LINESTYLE_SINGLE );
else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::BoldUnderline )
rFont.SetUnderline( LINESTYLE_BOLD );
else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DottedUnderline )
rFont.SetUnderline( LINESTYLE_DOTTED );
else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
else if ( nAttr & ExtTextInputAttr::DashDotUnderline )
rFont.SetUnderline( LINESTYLE_DOTTED );
if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
if ( nAttr & ExtTextInputAttr::RedText )
rFont.SetColor( Color( COL_RED ) );
else if ( nAttr & EXTTEXTINPUT_ATTR_HALFTONETEXT )
else if ( nAttr & ExtTextInputAttr::HalfToneText )
rFont.SetColor( Color( COL_LIGHTGRAY ) );
if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT )
if ( nAttr & ExtTextInputAttr::Highlight )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
rFont.SetColor( rStyleSettings.GetHighlightTextColor() );
rFont.SetFillColor( rStyleSettings.GetHighlightColor() );
rFont.SetTransparent( false );
}
else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
else if ( nAttr & ExtTextInputAttr::GrayWaveline )
{
rFont.SetUnderline( LINESTYLE_WAVE );
// if( pOut )
@ -1746,7 +1746,7 @@ void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos )
if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) )
{
sal_uInt16 nLastAttr = 0xFFFF;
ExtTextInputAttr nLastAttr = (ExtTextInputAttr)0xffff;
for( sal_Int32 n = 0; n < mpIMEInfos->nLen; n++ )
{
if ( mpIMEInfos->pAttribs[n] != nLastAttr )

View file

@ -22,14 +22,14 @@
#include <vcl/commandevent.hxx>
CommandExtTextInputData::CommandExtTextInputData( const OUString& rText,
const sal_uInt16* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags,
const ExtTextInputAttr* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags,
bool bOnlyCursor)
: maText(rText)
{
if ( pTextAttr && !maText.isEmpty() )
{
mpTextAttr = new sal_uInt16[maText.getLength()];
memcpy( mpTextAttr, pTextAttr, maText.getLength()*sizeof(sal_uInt16) );
mpTextAttr = new ExtTextInputAttr[maText.getLength()];
memcpy( mpTextAttr, pTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) );
}
else
{
@ -46,8 +46,8 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData&
{
if ( rData.mpTextAttr && !maText.isEmpty() )
{
mpTextAttr = new sal_uInt16[maText.getLength()];
memcpy( mpTextAttr, rData.mpTextAttr, maText.getLength()*sizeof(sal_uInt16) );
mpTextAttr = new ExtTextInputAttr[maText.getLength()];
memcpy( mpTextAttr, rData.mpTextAttr, maText.getLength()*sizeof(ExtTextInputAttr) );
}
else
{

View file

@ -1115,7 +1115,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent,
static bool ImplHandleExtTextInput( vcl::Window* pWindow,
const OUString& rText,
const sal_uInt16* pTextAttr,
const ExtTextInputAttr* pTextAttr,
sal_Int32 nCursorPos, sal_uInt16 nCursorFlags )
{
ImplSVData* pSVData = ImplGetSVData();
@ -1200,8 +1200,8 @@ static bool ImplHandleExtTextInput( vcl::Window* pWindow,
}
if ( pTextAttr )
{
pWinData->mpExtOldAttrAry = new sal_uInt16[rText.getLength()];
memcpy( pWinData->mpExtOldAttrAry, pTextAttr, rText.getLength()*sizeof( sal_uInt16 ) );
pWinData->mpExtOldAttrAry = new ExtTextInputAttr[rText.getLength()];
memcpy( pWinData->mpExtOldAttrAry, pTextAttr, rText.getLength()*sizeof( ExtTextInputAttr ) );
}
return !ImplCallCommand( pChild, CommandEventId::ExtTextInput, &aData );
}

View file

@ -246,48 +246,48 @@ Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback* feedback,
// Convert the XIM feedback values into appropriate VCL
// EXTTEXTINPUT_ATTR values
// returns an allocate list of attributes, which must be freed by caller
sal_uInt16*
Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<sal_uInt16>& rSalAttr )
ExtTextInputAttr*
Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<ExtTextInputAttr>& rSalAttr )
{
sal_uInt16 *psalattr;
sal_uInt16 nval;
sal_uInt16 noldval = 0;
XIMFeedback nfeedback;
ExtTextInputAttr *psalattr;
ExtTextInputAttr nval;
ExtTextInputAttr noldval = ExtTextInputAttr::NONE;
XIMFeedback nfeedback;
// only work with reasonable length
if (nlength > 0 && nlength > sal::static_int_cast<int>(rSalAttr.size()) )
if (nlength > 0 && nlength > sal::static_int_cast<int>(rSalAttr.size()) )
{
rSalAttr.reserve( nlength );
psalattr = &rSalAttr[0];
}
else
else
return nullptr;
for (int npos = 0; npos < nlength; npos++)
for (int npos = 0; npos < nlength; npos++)
{
nval = 0;
nval = ExtTextInputAttr::NONE;
nfeedback = pfeedback[npos];
// means to use the feedback of the previous char
if (nfeedback == 0)
{
nval = noldval;
}
}
// convert feedback to attributes
else
{
if (nfeedback & XIMReverse)
nval |= EXTTEXTINPUT_ATTR_HIGHLIGHT;
nval |= ExtTextInputAttr::Highlight;
if (nfeedback & XIMUnderline)
nval |= EXTTEXTINPUT_ATTR_UNDERLINE;
nval |= ExtTextInputAttr::Underline;
if (nfeedback & XIMHighlight)
nval |= EXTTEXTINPUT_ATTR_HIGHLIGHT;
nval |= ExtTextInputAttr::Highlight;
if (nfeedback & XIMPrimary)
nval |= EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
nval |= ExtTextInputAttr::DottedUnderline;
if (nfeedback & XIMSecondary)
nval |= EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
nval |= ExtTextInputAttr::DashDotUnderline;
if (nfeedback & XIMTertiary) // same as 2ery
nval |= EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
nval |= ExtTextInputAttr::DashDotUnderline;
}
// copy in list

View file

@ -2862,7 +2862,7 @@ void X11SalFrame::beginUnicodeSequence()
if( ! aDeleteWatch.isDeleted() )
{
sal_uInt16 nTextAttr = EXTTEXTINPUT_ATTR_UNDERLINE;
ExtTextInputAttr nTextAttr = ExtTextInputAttr::Underline;
SalExtTextInputEvent aEv;
aEv.mnTime = 0;
aEv.maText = rSeq;
@ -2890,7 +2890,7 @@ bool X11SalFrame::appendUnicodeSequence( sal_Unicode c )
aBuf.append( rSeq );
aBuf.append( c );
rSeq = aBuf.makeStringAndClear();
std::vector<sal_uInt16> attribs( rSeq.getLength(), EXTTEXTINPUT_ATTR_UNDERLINE );
std::vector<ExtTextInputAttr> attribs( rSeq.getLength(), ExtTextInputAttr::Underline );
SalExtTextInputEvent aEv;
aEv.mnTime = 0;
@ -2923,7 +2923,7 @@ bool X11SalFrame::endUnicodeSequence()
sal_uInt32 nValue = aNumbers.toUInt32( 16 );
if( nValue >= 32 )
{
sal_uInt16 nTextAttr = EXTTEXTINPUT_ATTR_UNDERLINE;
ExtTextInputAttr nTextAttr = ExtTextInputAttr::Underline;
SalExtTextInputEvent aEv;
aEv.mnTime = 0;
aEv.maText = OUString( sal_Unicode(nValue) );

View file

@ -3722,7 +3722,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pThis->m_aInputEvent.mnCursorFlags = 0;
pThis->m_aInputEvent.mbOnlyCursor = False;
pThis->m_aInputFlags = std::vector<sal_uInt16>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), 0 );
pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), ExtTextInputAttr::NONE );
PangoAttrIterator *iter = pango_attr_list_get_iterator(pAttrs);
do
@ -3730,7 +3730,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
GSList *attr_list = nullptr;
GSList *tmp_list = nullptr;
gint start, end;
guint sal_attr = 0;
ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
pango_attr_iterator_range (iter, &start, &end);
if (end == G_MAXINT)
@ -3749,14 +3749,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
switch (pango_attr->klass->type)
{
case PANGO_ATTR_BACKGROUND:
sal_attr |= EXTTEXTINPUT_ATTR_HIGHLIGHT;
sal_attr |= ExtTextInputAttr::Highlight;
pThis->m_aInputEvent.mnCursorFlags |= EXTTEXTINPUT_CURSOR_INVISIBLE;
break;
case PANGO_ATTR_UNDERLINE:
sal_attr |= EXTTEXTINPUT_ATTR_UNDERLINE;
sal_attr |= ExtTextInputAttr::Underline;
break;
case PANGO_ATTR_STRIKETHROUGH:
sal_attr |= EXTTEXTINPUT_ATTR_REDTEXT;
sal_attr |= ExtTextInputAttr::RedText;
break;
default:
break;
@ -3764,8 +3764,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pango_attribute_destroy (pango_attr);
tmp_list = tmp_list->next;
}
if (sal_attr == 0)
sal_attr |= EXTTEXTINPUT_ATTR_UNDERLINE;
if (sal_attr == ExtTextInputAttr::NONE)
sal_attr |= ExtTextInputAttr::Underline;
g_slist_free (attr_list);
// Set the sal attributes on our text

View file

@ -3794,7 +3794,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pThis->m_aInputEvent.mnCursorFlags = 0;
pThis->m_aInputEvent.mbOnlyCursor = False;
pThis->m_aInputFlags = std::vector<sal_uInt16>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), 0 );
pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), ExtTextInputAttr::NONE );
PangoAttrIterator *iter = pango_attr_list_get_iterator(pAttrs);
do
@ -3802,7 +3802,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
GSList *attr_list = nullptr;
GSList *tmp_list = nullptr;
gint start, end;
guint sal_attr = 0;
ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
pango_attr_iterator_range (iter, &start, &end);
if (end == G_MAXINT)
@ -3821,14 +3821,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
switch (pango_attr->klass->type)
{
case PANGO_ATTR_BACKGROUND:
sal_attr |= EXTTEXTINPUT_ATTR_HIGHLIGHT;
sal_attr |= ExtTextInputAttr::Highlight;
pThis->m_aInputEvent.mnCursorFlags |= EXTTEXTINPUT_CURSOR_INVISIBLE;
break;
case PANGO_ATTR_UNDERLINE:
sal_attr |= EXTTEXTINPUT_ATTR_UNDERLINE;
sal_attr |= ExtTextInputAttr::Underline;
break;
case PANGO_ATTR_STRIKETHROUGH:
sal_attr |= EXTTEXTINPUT_ATTR_REDTEXT;
sal_attr |= ExtTextInputAttr::RedText;
break;
default:
break;
@ -3836,8 +3836,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pango_attribute_destroy (pango_attr);
tmp_list = tmp_list->next;
}
if (sal_attr == 0)
sal_attr |= EXTTEXTINPUT_ATTR_UNDERLINE;
if (sal_attr == ExtTextInputAttr::NONE)
sal_attr |= ExtTextInputAttr::Underline;
g_slist_free (attr_list);
// Set the sal attributes on our text

View file

@ -5020,7 +5020,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
bDef = FALSE;
sal_uInt16* pSalAttrAry = NULL;
ExtTextInputAttr* pSalAttrAry = NULL;
LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 ) / sizeof( WCHAR );
if ( nTextLen > 0 )
{
@ -5040,25 +5040,25 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
if ( pAttrBuf )
{
sal_Int32 nTextLen2 = aEvt.maText.getLength();
pSalAttrAry = new sal_uInt16[nTextLen2];
pSalAttrAry = new ExtTextInputAttr[nTextLen2];
memset( pSalAttrAry, 0, nTextLen2*sizeof( sal_uInt16 ) );
for( sal_Int32 i = 0; (i < nTextLen2) && (i < nAttrLen); i++ )
{
BYTE nWinAttr = pAttrBuf[i];
sal_uInt16 nSalAttr;
ExtTextInputAttr nSalAttr;
if ( nWinAttr == ATTR_TARGET_CONVERTED )
{
nSalAttr = EXTTEXTINPUT_ATTR_BOLDUNDERLINE;
nSalAttr = ExtTextInputAttr::BoldUnderline;
aEvt.mnCursorFlags |= EXTTEXTINPUT_CURSOR_INVISIBLE;
}
else if ( nWinAttr == ATTR_CONVERTED )
nSalAttr = EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
nSalAttr = ExtTextInputAttr::DashDotUnderline;
else if ( nWinAttr == ATTR_TARGET_NOTCONVERTED )
nSalAttr = EXTTEXTINPUT_ATTR_HIGHLIGHT;
nSalAttr = ExtTextInputAttr::Highlight;
else if ( nWinAttr == ATTR_INPUT_ERROR )
nSalAttr = EXTTEXTINPUT_ATTR_REDTEXT | EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
nSalAttr = ExtTextInputAttr::RedText | ExtTextInputAttr::DottedUnderline;
else /* ( nWinAttr == ATTR_INPUT ) */
nSalAttr = EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
nSalAttr = ExtTextInputAttr::DottedUnderline;
pSalAttrAry[i] = nSalAttr;
}