diff options
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 2 | ||||
-rw-r--r-- | include/vcl/inputctx.hxx | 29 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/web/wview.cxx | 8 | ||||
-rw-r--r-- | vcl/inc/osx/salframe.h | 2 | ||||
-rw-r--r-- | vcl/inc/salwtype.hxx | 10 | ||||
-rw-r--r-- | vcl/osx/salframe.cxx | 6 | ||||
-rw-r--r-- | vcl/osx/salframeview.mm | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 2 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 4 |
17 files changed, 59 insertions, 56 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 3f314529ab30..676fc44015d0 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -961,7 +961,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16 { SvxFont aFont; pEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont ); - sal_uLong nContextFlags = INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT; + InputContextFlags nContextFlags = InputContextFlags::Text|InputContextFlags::ExtText; GetWindow()->SetInputContext( InputContext( aFont, nContextFlags ) ); } } diff --git a/include/vcl/inputctx.hxx b/include/vcl/inputctx.hxx index ae7c4e753174..3cd78744299a 100644 --- a/include/vcl/inputctx.hxx +++ b/include/vcl/inputctx.hxx @@ -23,15 +23,24 @@ #include <tools/solar.h> #include <vcl/dllapi.h> #include <vcl/font.hxx> +#include <o3tl/typed_flags_set.hxx> // - InputContext-Flags - -#define INPUTCONTEXT_TEXT ((sal_uLong)0x00000001) -#define INPUTCONTEXT_EXTTEXTINPUT ((sal_uLong)0x00000002) -#define INPUTCONTEXT_EXTTEXTINPUT_ON ((sal_uLong)0x00000004) -#define INPUTCONTEXT_EXTTEXTINPUT_OFF ((sal_uLong)0x00000008) +enum class InputContextFlags +{ + NONE = 0x0000, + Text = 0x0001, + ExtText = 0x0002, + ExtTextOn = 0x0004, + ExtTextOff = 0x0008, +}; +namespace o3tl +{ + template<> struct typed_flags<InputContextFlags> : is_typed_flags<InputContextFlags, 0x000f> {}; +} // - InputContext - @@ -40,23 +49,23 @@ class VCL_DLLPUBLIC InputContext { private: - vcl::Font maFont; - sal_uLong mnOptions; + vcl::Font maFont; + InputContextFlags mnOptions; public: - InputContext() { mnOptions = 0; } + InputContext() { mnOptions = InputContextFlags::NONE; } InputContext( const InputContext& rInputContext ) : maFont( rInputContext.maFont ) { mnOptions = rInputContext.mnOptions; } - InputContext( const vcl::Font& rFont, sal_uLong nOptions = 0 ) : + InputContext( const vcl::Font& rFont, InputContextFlags nOptions = InputContextFlags::NONE ) : maFont( rFont ) { mnOptions = nOptions; } void SetFont( const vcl::Font& rFont ) { maFont = rFont; } const vcl::Font& GetFont() const { return maFont; } - void SetOptions( sal_uLong nOptions ) { mnOptions = nOptions; } - sal_uLong GetOptions() const { return mnOptions; } + void SetOptions( InputContextFlags nOptions ) { mnOptions = nOptions; } + InputContextFlags GetOptions() const { return mnOptions; } InputContext& operator=( const InputContext& rInputContext ); bool operator==( const InputContext& rInputContext ) const; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 71bca6f8f2f7..9c2eaa4ae056 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3523,7 +3523,7 @@ void ScGridWindow::StopMarking() void ScGridWindow::UpdateInputContext() { bool bReadOnly = pViewData->GetDocShell()->IsReadOnly(); - sal_uLong nOptions = bReadOnly ? 0 : ( INPUTCONTEXT_TEXT | INPUTCONTEXT_EXTTEXTINPUT ); + InputContextFlags nOptions = bReadOnly ? InputContextFlags::NONE : ( InputContextFlags::Text | InputContextFlags::ExtText ); // when font from InputContext is used, // it must be taken from the cursor position's cell attributes diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 38e935e05d70..fe41345faf5e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4966,8 +4966,8 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView): if( !rMyView.GetDocShell()->IsReadOnly() ) { vcl::Font aFont; - SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT ) ); + SetInputContext( InputContext( aFont, InputContextFlags::Text | + InputContextFlags::ExtText ) ); } } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 1a199517b7d0..3be5b835e260 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2126,8 +2126,8 @@ void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet ) bool bVertical = rSh.IsInVerticalText(); aFont.SetOrientation(bVertical ? 2700 : 0); aFont.SetVertical(bVertical); - GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT ) ); + GetView().GetEditWin().SetInputContext( InputContext( aFont, InputContextFlags::Text | + InputContextFlags::ExtText ) ); } } break; diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 02c00d766132..eb369258ce26 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -422,11 +422,11 @@ void SwView::SelectShell() InputContext aCntxt( GetEditWin().GetInputContext() ); aCntxt.SetOptions( bSetExtInpCntxt ? (aCntxt.GetOptions() | - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) + ( InputContextFlags::Text | + InputContextFlags::ExtText )) : (aCntxt.GetOptions() & ~ - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) ); + InputContextFlags( InputContextFlags::Text | + InputContextFlags::ExtText )) ); GetEditWin().SetInputContext( aCntxt ); } @@ -665,11 +665,11 @@ void SwView::_CheckReadonlySelection() InputContext aCntxt( GetEditWin().GetInputContext() ); aCntxt.SetOptions( SW_DISABLE_ON_PROTECTED_CURSOR & nDisableFlags ? (aCntxt.GetOptions() & ~ - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) + InputContextFlags( InputContextFlags::Text | + InputContextFlags::ExtText )) : (aCntxt.GetOptions() | - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) ); + ( InputContextFlags::Text | + InputContextFlags::ExtText )) ); GetEditWin().SetInputContext( aCntxt ); } break; diff --git a/sw/source/uibase/web/wview.cxx b/sw/source/uibase/web/wview.cxx index ecd15c64109a..1a4e702ec1a8 100644 --- a/sw/source/uibase/web/wview.cxx +++ b/sw/source/uibase/web/wview.cxx @@ -260,11 +260,11 @@ void SwWebView::SelectShell() InputContext aCntxt( GetEditWin().GetInputContext() ); aCntxt.SetOptions( bSetExtInpCntxt ? (aCntxt.GetOptions() | - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) + ( InputContextFlags::Text | + InputContextFlags::ExtText )) : (aCntxt.GetOptions() & ~ - ( INPUTCONTEXT_TEXT | - INPUTCONTEXT_EXTTEXTINPUT )) ); + InputContextFlags( InputContextFlags::Text | + InputContextFlags::ExtText )) ); GetEditWin().SetInputContext( aCntxt ); } diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 4db73fb84c56..b030d3934ee5 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -90,7 +90,7 @@ public: Rectangle maInvalidRect; - sal_uLong mnICOptions; + InputContextFlags mnICOptions; // To prevent display sleep during presentation IOPMAssertionID mnAssertionID; diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index c20c45442b3a..b464b5c27131 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -30,6 +30,7 @@ class SalObject; namespace vcl { class Window; } class FontSelectPattern; +enum class InputContextFlags; // - SalEvent - @@ -266,18 +267,11 @@ struct SalFrameState // - SalInputContext - -// Have to match DEFINEs in inputctx.hxx, as these are not converted -#define SAL_INPUTCONTEXT_TEXT ((sal_uLong)0x00000001) -#define SAL_INPUTCONTEXT_EXTTEXTINPUT ((sal_uLong)0x00000002) -#define SAL_INPUTCONTEXT_EXTTEXTINPUT_ON ((sal_uLong)0x00000004) -#define SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ((sal_uLong)0x00000008) -#define SAL_INPUTCONTEXT_CHANGELANGUAGE ((sal_uLong)0x00000010) - struct SalInputContext { FontSelectPattern* mpFont; LanguageType meLanguage; - sal_uLong mnOptions; + InputContextFlags mnOptions; }; struct SalSwipeEvent diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index b23b3e64ff75..af1327f3d568 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -76,7 +76,7 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, sal_uLong salFrameStyle ) : mePointerStyle( POINTER_ARROW ), mnTrackingRectTag( 0 ), mrClippingPath( 0 ), - mnICOptions( 0 ) + mnICOptions( InputContextFlags::NONE ) { maSysData.nSize = sizeof( SystemEnvData ); @@ -919,13 +919,13 @@ void AquaSalFrame::SetInputContext( SalInputContext* pContext ) { if (!pContext) { - mnICOptions = 0; + mnICOptions = InputContextFlags::NONE; return; } mnICOptions = pContext->mnOptions; - if(!(pContext->mnOptions & SAL_INPUTCONTEXT_TEXT)) + if(!(pContext->mnOptions & InputContextFlags::Text)) return; } diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 2867295bbc6f..8036a0f11f9e 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -1684,7 +1684,7 @@ private: #if OSL_DEBUG_LEVEL > 1 // fprintf( stderr, "SalFrameView: doCommandBySelector %s\n", (char*)aSelector ); #endif - if( (mpFrame->mnICOptions & SAL_INPUTCONTEXT_TEXT) != 0 && + if( (mpFrame->mnICOptions & InputContextFlags::Text) && aSelector != NULL && [self respondsToSelector: aSelector] ) { [self performSelector: aSelector]; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index c64228210d00..3ff87466a41f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1943,7 +1943,7 @@ void Edit::GetFocus() Invalidate(); } - SetInputContext( InputContext( GetFont(), !IsReadOnly() ? INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT : 0 ) ); + SetInputContext( InputContext( GetFont(), !IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); } Control::GetFocus(); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 7311148bacf8..a7259326762c 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -210,7 +210,7 @@ void TextEngine::SetFont( const vcl::Font& rFont ) for ( sal_uInt16 nView = mpViews->size(); nView; ) { TextView* pView = (*mpViews)[ --nView ]; - pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT : 0 ) ); + pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); } } } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index a3758ec304b8..691fba86b2ac 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -208,7 +208,7 @@ TextView::TextView( TextEngine* pEng, vcl::Window* pWindow ) : mpImpl->mpCursor = new vcl::Cursor; mpImpl->mpCursor->Show(); pWindow->SetCursor( mpImpl->mpCursor ); - pWindow->SetInputContext( InputContext( pEng->GetFont(), INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT ) ); + pWindow->SetInputContext( InputContext( pEng->GetFont(), InputContextFlags::Text|InputContextFlags::ExtText ) ); if ( pWindow->GetSettings().GetStyleSettings().GetSelectionOptions() & SELECTION_OPTION_INVERT ) mpImpl->mbHighlightSelection = true; @@ -1227,7 +1227,7 @@ void TextView::SetReadOnly( bool bReadOnly ) else HideCursor(); - GetWindow()->SetInputContext( InputContext( mpImpl->mpTextEngine->GetFont(), bReadOnly ? INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT : 0 ) ); + GetWindow()->SetInputContext( InputContext( mpImpl->mpTextEngine->GetFont(), bReadOnly ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); } } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 610314a9c384..4f428dcdec2b 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2463,13 +2463,13 @@ void X11SalFrame::Sync() void X11SalFrame::SetInputContext( SalInputContext* pContext ) { - if (pContext == NULL) + if (pContext == NULL) return; - // 1. We should create an input context for this frame - // only when SAL_INPUTCONTEXT_TEXT is set. + // 1. We should create an input context for this frame + // only when InputContextFlags::Text is set. - if (!(pContext->mnOptions & SAL_INPUTCONTEXT_TEXT)) + if (!(pContext->mnOptions & InputContextFlags::Text)) { if( mpInputContext ) mpInputContext->Unmap( this ); @@ -2477,9 +2477,9 @@ void X11SalFrame::SetInputContext( SalInputContext* pContext ) } // 2. We should use on-the-spot inputstyle - // only when SAL_INPUTCONTEXT_EXTTEXTINPUT is set. + // only when InputContextFlags::ExtTExt is set. - if (mpInputContext == NULL) + if (mpInputContext == NULL) { vcl::I18NStatus& rStatus( vcl::I18NStatus::get() ); rStatus.setParent( this ); @@ -2490,10 +2490,10 @@ void X11SalFrame::SetInputContext( SalInputContext* pContext ) if (mbInputFocus) mpInputContext->SetICFocus( this ); } - } + } else mpInputContext->Map( this ); - return; + return; } void X11SalFrame::EndExtTextInput( sal_uInt16 nFlags ) diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 7fea4a9c60dc..8ca6a53da0ac 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -2915,7 +2915,7 @@ void GtkSalFrame::SetInputContext( SalInputContext* pContext ) if( ! pContext ) return; - if( ! (pContext->mnOptions & SAL_INPUTCONTEXT_TEXT) ) + if( ! (pContext->mnOptions & InputContextFlags::Text) ) return; // create a new im context diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 999cb660544c..fae12e695f06 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2219,7 +2219,7 @@ void WinSalFrame::Sync() static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pContext ) { WinSalFrame* pFrame = GetWindowPtr( hWnd ); - bool bIME = (pContext->mnOptions & SAL_INPUTCONTEXT_TEXT) != 0; + bool bIME(pContext->mnOptions & InputContextFlags::Text); if ( bIME ) { if ( !pFrame->mbIME ) @@ -2238,7 +2238,7 @@ static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pCont // When the application can't handle IME messages, then the // System should handle the IME handling - if ( !(pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT) ) + if ( !(pContext->mnOptions & InputContextFlags::ExtText) ) pFrame->mbHandleIME = FALSE; // Set the Font for IME Handling |