? core.7274 Index: inc/globlmn.hrc =================================================================== RCS file: /cvs/graphics/svx/inc/globlmn.hrc,v retrieving revision 1.123 diff -u -r1.123 globlmn.hrc --- inc/globlmn.hrc 22 Jul 2003 16:35:38 -0000 1.123 +++ inc/globlmn.hrc 12 Dec 2003 22:42:59 -0000 @@ -561,6 +561,42 @@ Text[ hindi ] = "परिमाण"; \ Text[ slovak ] = "Veľkosť"; +#define ITEM_FORMAT_ATTR_CHAR_LANGUAGE \ + Identifier = SID_ATTR_CHAR_LANGUAGE ; \ + Command = ".uno:Language" ; \ + HelpID = SID_ATTR_CHAR_LANGUAGE ; \ + Text = "Language" ; \ + Text [ English ] = "~Language" ; \ + Text [ norwegian ] = "~Language" ; \ + Text [ italian ] = "~Language" ; \ + Text [ portuguese_brazilian ] = "Language" ; \ + Text [ portuguese ] = "~Language" ; \ + Text [ finnish ] = "Language" ; \ + Text [ danish ] = "~Language" ; \ + Text [ french ] = "Language" ; \ + Text [ swedish ] = "Language" ; \ + Text [ dutch ] = "Language" ; \ + Text [ spanish ] = "Language" ; \ + Text [ english_us ] = "Language" ;\ + Text[ chinese_simplified ] = "Language"; \ + Text[ russian ] = "Language"; \ + Text[ polish ] = "Language"; \ + Text[ japanese ] = "Language"; \ + Text[ chinese_traditional ] = "Language"; \ + Text[ arabic ] = "Language"; \ + Text[ dutch ] = "Language"; \ + Text[ chinese_simplified ] = "Language"; \ + Text[ greek ] = "Language"; \ + Text[ korean ] = "Language"; \ + Text[ turkish ] = "Language"; \ + Text[ language_user1 ] = " "; \ + Text[ catalan ] = "Language"; \ + Text[ thai ] = "Language"; \ + Text[ czech ] = "Language"; \ + Text[ hebrew ] = "Language"; \ + Text[ hindi ] = "Language"; \ + Text[ slovak ] = "Language"; + #define ITEM_FORMAT_ATTR_CHAR_WEIGHT \ Identifier = SID_ATTR_CHAR_WEIGHT ; \ Command = ".uno:Bold" ; \ Index: inc/tbcontrl.hxx =================================================================== RCS file: /cvs/graphics/svx/inc/tbcontrl.hxx,v retrieving revision 1.5 diff -u -r1.5 tbcontrl.hxx --- inc/tbcontrl.hxx 17 Sep 2002 06:56:12 -0000 1.5 +++ inc/tbcontrl.hxx 12 Dec 2003 22:42:59 -0000 @@ -206,6 +206,7 @@ class SvxBoxInfoItem; class SvxFontItem; class SvxFontHeightItem; +class SvxLanguageItem; class SfxStyleControllerItem_Impl; class SfxStyleSheetBasePool; class SfxTemplateItem; @@ -308,6 +309,24 @@ }; #endif // ITEMID_FONTHEIGHT + +//======================================================================== +// class SvxLanguageToolBoxControl --------------------------------------- +//======================================================================== +#ifdef ITEMID_LANGUAGE + +class SvxLanguageToolBoxControl : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SvxLanguageToolBoxControl( USHORT nId, ToolBox& rTbx, SfxBindings& rBindings ); + + virtual void StateChanged ( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual Window* CreateItemWindow ( Window *pParent ); +}; + +#endif // ITEMID_LANGUAGE //======================================================================== // class SvxFontColorToolBoxControl -------------------------------------- Index: sdi/svxslots.src =================================================================== RCS file: /cvs/graphics/svx/sdi/svxslots.src,v retrieving revision 1.95 diff -u -r1.95 svxslots.src --- sdi/svxslots.src 22 Jul 2003 16:35:56 -0000 1.95 +++ sdi/svxslots.src 12 Dec 2003 22:43:02 -0000 @@ -634,6 +634,39 @@ SlotName[ hindi ] = "फ़ॉन्ट का परिमाण"; SlotName[ slovak ] = "Veľkosť písma"; }; +SfxSlotInfo SID_ATTR_CHAR_LANGUAGE +{ + SlotName = "Language"; + SlotName [ english ] = "Language"; + SlotName[ english_us ] = "Language"; + SlotName[ portuguese ] = "Language"; + SlotName[ russian ] = "Language"; + SlotName[ dutch ] = "Language"; + SlotName[ french ] = "Language"; + SlotName[ spanish ] = "Language"; + SlotName[ italian ] = "Language"; + SlotName[ danish ] = "Language"; + SlotName[ swedish ] = "Language"; + SlotName[ polish ] = "Language"; + SlotName[ portuguese_brazilian ] = "Language"; + SlotName[ japanese ] = "Language"; + SlotName[ chinese_simplified ] = "Language"; + SlotName[ chinese_traditional ] = "Language"; + SlotName[ dutch ] = "Language"; + SlotName[ chinese_simplified ] = "Language"; + SlotName[ greek ] = "Language"; + SlotName[ korean ] = "Language"; + SlotName[ arabic ] = "Language"; + SlotName[ turkish ] = "Language"; + SlotName[ language_user1 ] = " "; + SlotName[ catalan ] = "Language"; + SlotName[ finnish ] = "Language"; + SlotName[ thai ] = "Language"; + SlotName[ czech ] = "Language"; + SlotName[ hebrew ] = "Language"; + SlotName[ hindi ] = "Language"; + SlotName[ slovak ] = "Language"; +}; SfxSlotInfo SID_ATTR_CHAR_POSTURE { SlotName = "Kursiv"; Index: source/tbxctrls/tbcontrl.cxx =================================================================== RCS file: /cvs/graphics/svx/source/tbxctrls/tbcontrl.cxx,v retrieving revision 1.42 diff -u -r1.42 tbcontrl.cxx --- source/tbxctrls/tbcontrl.cxx 6 Jun 2003 10:44:32 -0000 1.42 +++ source/tbxctrls/tbcontrl.cxx 12 Dec 2003 22:43:03 -0000 @@ -127,6 +127,7 @@ #define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST #define ITEMID_FONT SID_ATTR_CHAR_FONT #define ITEMID_FONTHEIGHT SID_ATTR_CHAR_FONTHEIGHT +#define ITEMID_LANGUAGE SID_ATTR_CHAR_LANGUAGE #define ITEMID_COLOR SID_ATTR_CHAR_COLOR #define ITEMID_BRUSH SID_ATTR_BRUSH #define ITEMID_BOX SID_ATTR_BORDER_OUTER @@ -137,6 +138,7 @@ #include "xtable.hxx" #include "fontitem.hxx" #include "fhgtitem.hxx" +#include "langitem.hxx" #include "brshitem.hxx" #include "boxitem.hxx" #include "colritem.hxx" @@ -146,6 +148,7 @@ #include "tbcontrl.hxx" #include "dlgutil.hxx" #include "dialmgr.hxx" +#include "langbox.hxx" // ------------------------------------------------------------------------ @@ -166,6 +169,7 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontHeightToolBoxControl, SvxFontHeightItem ); +SFX_IMPL_TOOLBOX_CONTROL( SvxLanguageToolBoxControl, SvxLanguageItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorToolBoxControl, SvxColorItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorExtToolBoxControl, SvxColorItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem ); @@ -282,6 +286,36 @@ }; //======================================================================== +// class SvxLanguageBox_Impl --------------------------------------------- +//======================================================================== + +class SvxLanguageToolBoxControl; + +class SvxLanguageBox_Impl : public SvxLanguageBox +{ +private: + SvxLanguageToolBoxControl* pCtrl; + BOOL bRelease; + SfxBindings& rBindings; + + void ReleaseFocus_Impl(); + +protected: + virtual void Select(); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +public: + SvxLanguageBox_Impl( Window* pParent, + SvxLanguageToolBoxControl& rCtrl, SfxBindings& rBind ); + + void StateChanged_Impl( SfxItemState eState, + const SfxPoolItem* pState ); + void Update( const SvxLanguageItem& rLanguageItem ); + + virtual long Notify( NotifyEvent& rNEvt ); +}; + +//======================================================================== // class SvxColorWindow_Impl -------------------------------------------------- //======================================================================== @@ -1002,6 +1036,129 @@ } //======================================================================== +// class SvxLanguageBox_Impl -------------------------------------------------- +//======================================================================== + +SvxLanguageBox_Impl::SvxLanguageBox_Impl( Window* pParent, SvxLanguageToolBoxControl &rCtrl, SfxBindings& rBind ) : + SvxLanguageBox( pParent, WinBits(WB_DROPDOWN) ), + pCtrl ( &rCtrl ), + bRelease ( TRUE ), + rBindings ( rBind ) +{ + SvxLanguageBox::SetDropDownLineCount( 15 ); +} + +// ----------------------------------------------------------------------- + +void SvxLanguageBox_Impl::ReleaseFocus_Impl() +{ + if ( !bRelease ) + { + bRelease = TRUE; + return; + } + + SfxViewShell* pCurSh = SfxViewShell::Current(); + + if ( pCurSh ) + { + Window* pShellWnd = pCurSh->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } +} + +// ----------------------------------------------------------------------- + +void SvxLanguageBox_Impl::Select() +{ + SvxLanguageBox::Select(); + + if ( !IsTravelSelect() ) + { + SvxLanguageItem aLanguageItem( SvxLanguageBox::GetSelectLanguage() ); + rBindings.GetDispatcher()->Execute( + SID_ATTR_CHAR_LANGUAGE, SFX_CALLMODE_RECORD, &aLanguageItem, 0L ); + ReleaseFocus_Impl(); + } +} +// ----------------------------------------------------------------------- + +void SvxLanguageBox_Impl::StateChanged_Impl( SfxItemState eState, const SfxPoolItem* pState ) +{ +} + +// ----------------------------------------------------------------------- + +void SvxLanguageBox_Impl::Update( const SvxLanguageItem& rLanguageItem ) +{ + SvxLanguageBox::SetLanguageList( LANG_LIST_ALL, TRUE, FALSE, TRUE ); + + LanguageType eLangType = (LanguageType)rLanguageItem.GetValue(); + if ( eLangType != LANGUAGE_DONTKNOW ) + { + for ( USHORT i = 0; i < GetEntryCount(); ++i ) + { + if ( (LanguageType)(ULONG)GetEntryData(i) == eLangType ) + { + SelectEntryPos(i); + break; + } + } + } +} + +// ----------------------------------------------------------------------- + +long SvxLanguageBox_Impl::Notify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + +#if 0 + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); + + switch ( nCode ) + { + case KEY_RETURN: + case KEY_TAB: + { + if ( KEY_TAB == nCode ) + bRelease = FALSE; + else + nHandled = 1; + Select(); + break; + } + + case KEY_ESCAPE: + SetText( aCurText ); + ReleaseFocus_Impl(); + nHandled = 1; + break; + } + } + else if(EVENT_LOSEFOCUS == rNEvt.GetType()) + { + Window* pFocusWin = Application::GetFocusWindow(); + if(!HasFocus() && GetSubEdit() != pFocusWin) + SetText(GetSavedValue()); + } +#endif + + return nHandled ? nHandled : SvxLanguageBox::Notify( rNEvt ); +} +/* -----------------------------08.03.2002 13:24------------------------------ + + ---------------------------------------------------------------------------*/ +void SvxLanguageBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + SvxLanguageBox::DataChanged( rDCEvt ); +} + +//======================================================================== // class SvxColorWindow_Impl -------------------------------------------------- //======================================================================== #ifndef WB_NO_DIRECTSELECT @@ -2431,6 +2588,64 @@ Window* SvxFontHeightToolBoxControl::CreateItemWindow( Window *pParent ) { pBox = new SvxFontSizeBox_Impl( pParent, *this, GetBindings() ); + return pBox; +} + +//======================================================================== +// class SvxLangaugeToolBoxControl --------------------------------------- +//======================================================================== + +SvxLanguageToolBoxControl::SvxLanguageToolBoxControl( + USHORT nId, + ToolBox& rTbx , + SfxBindings& rBindings) + : SfxToolBoxControl( nId, rTbx, rBindings ) +{ +} + +// ----------------------------------------------------------------------- + +void SvxLanguageToolBoxControl::StateChanged( + USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + USHORT nId = GetId(); + ToolBox& rTbx = GetToolBox(); + SvxLanguageBox_Impl* pBox = (SvxLanguageBox_Impl*)(rTbx.GetItemWindow( nId )); + + DBG_ASSERT( pBox, "Control not found!" ); + + if ( SFX_ITEM_DISABLED == eState ) + { + pBox->Disable(); + pBox->Update( (const SvxLanguageItem*)NULL ); + } + else + { + pBox->Enable(); + + if ( SFX_ITEM_AVAILABLE == eState ) + { + SvxLanguageItem *pLangItem = (eState == SFX_ITEM_AVAILABLE) ? (SvxLanguageItem*)pState : NULL; + + if( ! pLangItem->ISA(SvxLanguageItem) ) + fprintf( stderr, "SvxLanguageToolBoxControl::StateChanged() - bad ItemType, expected SvxLanguageItem" ); + + if ( pLangItem ) + pBox->Update( *pLangItem ); + } + else + pBox->SelectLanguage( LANGUAGE_DONTKNOW ); + pBox->SaveValue(); + } + + rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); +} + +// ----------------------------------------------------------------------- + +Window* SvxLanguageToolBoxControl::CreateItemWindow( Window *pParent ) +{ + SvxLanguageBox_Impl* pBox = new SvxLanguageBox_Impl( pParent, *this, GetBindings() ); return pBox; }