From e6caeefce4cf1f814bc342324490892ca80356ab Mon Sep 17 00:00:00 2001 From: Rachit Gupta Date: Tue, 22 Jul 2014 22:06:48 +0530 Subject: Converted RID_SVX_MDLG_HANGULHANJA to Widget Layout. Also, removed the unused hrc/src files. Change-Id: Ice45dde1af7492e40e0847ead06bb26f4e58ed9c Reviewed-on: https://gerrit.libreoffice.org/10595 Reviewed-by: David Tardon Tested-by: David Tardon --- cui/AllLangResTarget_cui.mk | 2 - cui/Library_cui.mk | 1 - cui/UIConfig_cui.mk | 1 + cui/source/dialogs/commonlingui.cxx | 232 ---------- cui/source/dialogs/commonlingui.hxx | 153 ------- cui/source/dialogs/commonlingui.src | 130 ------ cui/source/dialogs/hangulhanjadlg.cxx | 372 ++++++++--------- cui/source/dialogs/hangulhanjadlg.hrc | 80 ---- cui/source/dialogs/hangulhanjadlg.src | 182 -------- cui/source/inc/hangulhanjadlg.hxx | 54 ++- cui/uiconfig/ui/hangulhanjaconversiondialog.ui | 558 +++++++++++++++++++++++++ extras/source/glade/libreoffice-catalog.xml.in | 6 + 12 files changed, 767 insertions(+), 1004 deletions(-) delete mode 100644 cui/source/dialogs/commonlingui.cxx delete mode 100644 cui/source/dialogs/commonlingui.hxx delete mode 100644 cui/source/dialogs/commonlingui.src delete mode 100644 cui/source/dialogs/hangulhanjadlg.hrc delete mode 100644 cui/source/dialogs/hangulhanjadlg.src create mode 100644 cui/uiconfig/ui/hangulhanjaconversiondialog.ui diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk index cc4dffad37e7..931fd1f7c9d5 100644 --- a/cui/AllLangResTarget_cui.mk +++ b/cui/AllLangResTarget_cui.mk @@ -26,11 +26,9 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\ cui/source/customize/acccfg.src \ cui/source/customize/cfg.src \ cui/source/customize/macropg.src \ - cui/source/dialogs/commonlingui.src \ cui/source/dialogs/cuires.src \ cui/source/dialogs/fmsearch.src \ cui/source/dialogs/gallery.src \ - cui/source/dialogs/hangulhanjadlg.src \ cui/source/dialogs/hyperdlg.src \ cui/source/dialogs/iconcdlg.src \ cui/source/dialogs/multipat.src \ diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 1ac0ed757ea0..d1e98e68be11 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -84,7 +84,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/customize/selector \ cui/source/dialogs/about \ cui/source/dialogs/colorpicker \ - cui/source/dialogs/commonlingui \ cui/source/dialogs/cuicharmap \ cui/source/dialogs/cuifmsearch \ cui/source/dialogs/cuigaldlg \ diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index e605ff3387c9..dbd98d091b0e 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -71,6 +71,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/galleryupdateprogress \ cui/uiconfig/ui/hangulhanjaadddialog \ cui/uiconfig/ui/hangulhanjaeditdictdialog \ + cui/uiconfig/ui/hangulhanjaconversiondialog \ cui/uiconfig/ui/hangulhanjaoptdialog \ cui/uiconfig/ui/hatchpage \ cui/uiconfig/ui/hyperlinkdialog \ diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx deleted file mode 100644 index 48aae6864a99..000000000000 --- a/cui/source/dialogs/commonlingui.cxx +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "commonlingui.hxx" - -#include -#include -#include -#include - -#include "hangulhanjadlg.hrc" - - -// SvxClickInfoCtr - - - -SvxClickInfoCtr::SvxClickInfoCtr( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ), - aFixedInfo( this) -{ - aFixedInfo.SetSizePixel(GetOutputSizePixel()); - aFixedInfo.Show(); -} - - -void SvxClickInfoCtr::MouseButtonDown( const MouseEvent& ) -{ - aActivateLink.Call(this); -} - - -bool SvxClickInfoCtr::PreNotify( NotifyEvent& rNEvt ) -{ - if(rNEvt.GetType()==EVENT_GETFOCUS || rNEvt.GetType()==EVENT_MOUSEBUTTONDOWN) - { - aActivateLink.Call(this); - } - - return Control::PreNotify(rNEvt); -} - - -void SvxClickInfoCtr::SetText( const OUString& rStr ) -{ - aFixedInfo.SetText(rStr ); -} - - -OUString SvxClickInfoCtr::GetText() const -{ - return aFixedInfo.GetText(); -} - - -SvxClickInfoCtr::~SvxClickInfoCtr() -{ -} - - -// SvxCommonLinguisticControl - - -SvxCommonLinguisticControl::SvxCommonLinguisticControl( ModalDialog* _pParent ) - :Window( _pParent, CUI_RES( RID_SVX_WND_COMMON_LINGU ) ) - ,aWordText ( this, CUI_RES( FT_WORD ) ) - ,aAktWord ( this, CUI_RES( FT_AKTWORD ) ) - ,aNewWord ( this, CUI_RES( FT_NEWWORD ) ) - ,aNewWordED ( this, CUI_RES( ED_NEWWORD ) ) - ,aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ) - ,aIgnoreBtn ( this, CUI_RES( BTN_IGNORE ) ) - ,aIgnoreAllBtn ( this, CUI_RES( BTN_IGNOREALL ) ) - ,aChangeBtn ( this, CUI_RES( BTN_CHANGE ) ) - ,aChangeAllBtn ( this, CUI_RES( BTN_CHANGEALL ) ) - ,aOptionsBtn ( this, CUI_RES( BTN_OPTIONS ) ) - ,aStatusText ( this, CUI_RES( FT_STATUS ) ) - ,aHelpBtn ( this, CUI_RES( BTN_SPL_HELP ) ) - ,aCancelBtn ( this, CUI_RES( BTN_SPL_CANCEL ) ) - ,aAuditBox ( this, CUI_RES( GB_AUDIT ) ) -{ - FreeResource(); - aAktWord.SetAccessibleName(aWordText.GetText()); - SetPosSizePixel( Point( 0, 0 ), _pParent->GetOutputSizePixel() ); - Show(); -} - - -PushButton* SvxCommonLinguisticControl::implGetButton( ButtonType _eType ) const -{ - const PushButton* pButton = NULL; - switch ( _eType ) - { - case eClose: pButton = &aCancelBtn; break; - case eIgnore: pButton = &aIgnoreBtn; break; - case eIgnoreAll: pButton = &aIgnoreAllBtn; break; - case eChange: pButton = &aChangeBtn; break; - case eChangeAll: pButton = &aChangeAllBtn; break; - case eOptions: pButton = &aOptionsBtn; break; - } - return const_cast< PushButton* >( pButton ); -} - - -void SvxCommonLinguisticControl::SetButtonHandler( ButtonType _eType, const Link& _rHandler ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->SetClickHdl( _rHandler ); -} - - -void SvxCommonLinguisticControl::EnableButton( ButtonType _eType, bool _bEnable ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->Enable( _bEnable ); -} - - -void SvxCommonLinguisticControl::InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ) -{ - Window* pInsertAfter = NULL; // will be the last window of our own "undividable" group, after which we insert the foreign group - switch ( _eInsertAfter ) - { - case eLeftRightWords : pInsertAfter = &aNewWordED; break; - case eSuggestionLabel : pInsertAfter = &aSuggestionFT; break; - case eActionButtons : pInsertAfter = &aChangeAllBtn; break; - case eDialogButtons : pInsertAfter = &aCancelBtn; break; - } - - // now loop through the remaining windows of the foreign group - Window* pInsertBehind = pInsertAfter; - Window* pInsert = &_rFirstGroupWindow; - - // some strange thing below: asking a window for WINDOW_NEXT or WINDOW_PREV does not take into - // account the border window, _but_ SetZOrder _does_!. Thus, when advancing through a chain - // of windows, we need to work with the border windows (WINDOW_BORDER), instead of simply - // asking for WINDOW_NEXT. - - Window* pLoopEnd = _rLastGroupWindow.GetWindow( WINDOW_BORDER ); - while ( pInsert && ( pInsertBehind != pLoopEnd ) ) - { - // we'll destroy the NEXT relation immediately, so remember the next window - DBG_ASSERT( pInsert->GetWindow( WINDOW_BORDER ), "SvxCommonLinguisticControl::InsertControlGroup: border window is expected to be non NULL!" ); - Window* pNextInsert = pInsert->GetWindow( WINDOW_BORDER )->GetWindow( WINDOW_NEXT ); - // knit - pInsert->SetZOrder( pInsertBehind, WINDOW_ZORDER_BEHIND ); - // advance - pInsertBehind = pInsert; - pInsert = pNextInsert; - } - DBG_ASSERT( pInsertBehind == pLoopEnd, "SvxCommonLinguisticControl::InsertControlGroup: controls do not form a group!" ); - // if we did not reach pLoopEnd, then we did not reach _rLastGroupWindow in the loop, then - // (FirstWindow, LastWindow) was no valid control group -} - - -void SvxCommonLinguisticControl::Paint( const Rectangle& rRect ) -{ - Window::Paint(rRect ); - - DecorationView aDecoView( this ); - - Rectangle aRect( aAuditBox.GetPosPixel(), aAuditBox.GetSizePixel() ); - aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL ); -} - - -void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY ) -{ - Size aSize; - Point aPos; - - // the controls which need to be resized - { - Window* pResize[] = - { - this, &aAuditBox, &aStatusText - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pResize ); ++i ) - { - aSize = pResize[i]->GetSizePixel( ); - pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) ); - } - } - - // the controls which stick to the bottom of the window - { - Window* pMoveDown[] = - { - &aStatusText, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveDown ); ++i ) - { - aPos = pMoveDown[i]->GetPosPixel(); - aPos.Y() += _nY; - pMoveDown[i]->SetPosPixel( aPos ); - } - } - - // the controls which stick to the right - { - Window* pMoveRight[] = - { - &aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveRight ); ++i ) - { - aPos = pMoveRight[i]->GetPosPixel(); - aPos.X() += _nX; - pMoveRight[i]->SetPosPixel( aPos ); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.hxx b/cui/source/dialogs/commonlingui.hxx deleted file mode 100644 index b5598b7cd425..000000000000 --- a/cui/source/dialogs/commonlingui.hxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX -#define INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX - -#include -#include -#include -#include -#include -#include - - -// SvxClickInfoCtr - - -class SvxClickInfoCtr: public Control -{ -private: - FixedInfo aFixedInfo; - Link aActivateLink; - -public: - SvxClickInfoCtr( Window* pParent, const ResId& rResId ); - virtual ~SvxClickInfoCtr(); - - virtual void SetText( const OUString& rStr ) SAL_OVERRIDE; - virtual OUString GetText() const SAL_OVERRIDE; - - void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; } - const Link& GetActivateHdl() const { return aActivateLink; } - -protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; - virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - -}; - - -// SvxCommonLinguisticControl - -class SvxCommonLinguisticControl : public Window -{ -public: - enum ButtonType - { - eClose, - eIgnore, - eIgnoreAll, - eChange, - eChangeAll, - eOptions - }; - -protected: - FixedText aWordText; - SvxClickInfoCtr aAktWord; - - FixedText aNewWord; - Edit aNewWordED; - - FixedText aSuggestionFT; - - PushButton aIgnoreBtn; - PushButton aIgnoreAllBtn; - PushButton aChangeBtn; - PushButton aChangeAllBtn; - PushButton aOptionsBtn; - - FixedInfo aStatusText; - HelpButton aHelpBtn; - CancelButton aCancelBtn; - - GroupBox aAuditBox; - -protected: - virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - -private: - PushButton* implGetButton( ButtonType _eType ) const; - -public: - SvxCommonLinguisticControl( ModalDialog* _pParent ); - - // handlers - inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); } - inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); } - - void SetButtonHandler( ButtonType _eType, const Link& _rHandler ); - void EnableButton( ButtonType _eType, bool _bEnable ); - - inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); } - inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); } - - /// control groups in this window which cannot be devided (e.g. are adjacent in the Z order) - enum ControlGroup - { - eLeftRightWords, ///< the controls for the two words (original and suggestion), including the labels - eSuggestionLabel, ///< the label for the suggestion - eActionButtons, ///< the group of "ignore(all)" / "change(all)" buttons - eDialogButtons ///< the group of dialog control buttons (help and close) - }; - - /** Users of this class may want to insert own controls in some places, - where the ordinary Z-Order determined by construction time is not - sufficient. Use the following methods for this. - */ - void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ); - - /** enlarges the window - - Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks - to the right, the dictionary list as well as the close/help buttons stick to the bottom of the - window. - */ - void Enlarge( sal_Int32 _nX, sal_Int32 _nY ); - - // control access methods - inline void SetCurrentText( const OUString& _rText ) { aAktWord.SetText( _rText ); } - inline OUString GetCurrentText( ) const { return aAktWord.GetText(); } - - inline void SetStatusText( const OUString& _rText ) { aStatusText.SetText( _rText ); } - inline OUString GetStatusText( ) const { return aStatusText.GetText(); } - - inline Edit& GetWordInputControl() { return aNewWordED; } - inline const Edit& GetWordInputControl() const { return aNewWordED; } - - /// @return the location (upper-left corner) of the group of action buttons - inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); } -}; - - - -#endif // INCLUDED_CUI_SOURCE_DIALOGS_COMMONLINGUI_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.src b/cui/source/dialogs/commonlingui.src deleted file mode 100644 index 3d66cfaad88c..000000000000 --- a/cui/source/dialogs/commonlingui.src +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include "helpid.hrc" -#include "hangulhanjadlg.hrc" - -Window RID_SVX_WND_COMMON_LINGU -{ - DialogControl = TRUE; // we want to tab out of this - Hide = TRUE; - - FixedText FT_WORD - { - Pos = MAP_APPFONT( 6, 9 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "Origi~nal"; - }; - Control FT_AKTWORD - { - HelpId=HID_SPELLDLG_SETWORD; - Pos = MAP_APPFONT( 51, 9 ); - Size = MAP_APPFONT( 164, 10 ); - Border =FALSE; - TabStop = TRUE; - }; - - FixedText FT_NEWWORD - { - Pos = MAP_APPFONT( 6, 25 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Word" ; - }; - - Edit ED_NEWWORD - { - Pos = MAP_APPFONT( 51, 24 ); - Size = MAP_APPFONT( 137, 12 ); - Border = TRUE; - }; - - FixedText FT_SUGGESTION - { - Pos = MAP_APPFONT( 6, 48 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Suggestions" ; - }; - - PushButton BTN_IGNORE - { - Pos = MAP_APPFONT( 224, 6 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore" ; - }; - - PushButton BTN_IGNOREALL - { - Pos = MAP_APPFONT( 224, 22 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always I~gnore" ; - }; - - PushButton BTN_CHANGE - { - Pos = MAP_APPFONT( 224, 40 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Replace" ; - DefButton = TRUE ; - }; - - PushButton BTN_CHANGEALL - { - Pos = MAP_APPFONT( 224, 56 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always R~eplace" ; - }; - - PushButton BTN_OPTIONS - { - Pos = MAP_APPFONT( 224, 129 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE ; - Text [ en-US ] = "Options..." ; - }; - - FixedText FT_STATUS - { - Pos = MAP_APPFONT( 6, 155 ); - Size = MAP_APPFONT( 130, 10 ); - }; - - GroupBox GB_AUDIT - { - Pos = MAP_APPFONT( 1, 1 ); - Size = MAP_APPFONT( 283, 148 ); - Hide=TRUE; - }; - - HelpButton BTN_SPL_HELP - { - Pos = MAP_APPFONT( 160, 153 ); - Size = MAP_APPFONT( 55, 14 ); - }; - - CancelButton BTN_SPL_CANCEL - { - Pos = MAP_APPFONT ( 224 , 153 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Close" ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index cbc49427bf57..7a9968140c08 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -18,8 +18,6 @@ */ #include "hangulhanjadlg.hxx" -#include "hangulhanjadlg.hrc" -#include "commonlingui.hxx" #include #include @@ -42,6 +40,7 @@ #define HHC editeng::HangulHanjaConversion #define LINE_CNT static_cast< sal_uInt16 >(2) +#define MAXNUM_SUGGESTIONS 50 namespace svx @@ -75,7 +74,6 @@ namespace svx }; } - //= PseudoRubyText /** a class which allows to draw two texts in a pseudo-ruby way (which basically @@ -90,12 +88,16 @@ namespace svx }; protected: - const OUString m_sPrimaryText; - const OUString m_sSecondaryText; - const RubyPosition m_ePosition; + OUString m_sPrimaryText; + OUString m_sSecondaryText; + RubyPosition m_ePosition; public: PseudoRubyText( const OUString& _rPrimary, const OUString& _rSecondary, const RubyPosition _ePosition ); + PseudoRubyText(); + void init( const OUString& rPrimaryText, const OUString& rSecondaryText, const RubyPosition& rPosition ); + const OUString& getPrimaryText() const { return m_sPrimaryText; } + const OUString& getSecondaryText() const { return m_sSecondaryText; } public: void Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, @@ -103,7 +105,6 @@ namespace svx ::vcl::ControlLayoutData* _pLayoutData = NULL ); }; - PseudoRubyText::PseudoRubyText( const OUString& _rPrimary, const OUString& _rSecondary, const RubyPosition _ePosition ) :m_sPrimaryText( _rPrimary ) ,m_sSecondaryText( _rSecondary ) @@ -111,6 +112,17 @@ namespace svx { } + PseudoRubyText::PseudoRubyText() + { + } + + void PseudoRubyText::init( const OUString& rPrimaryText, const OUString& rSecondaryText, const RubyPosition& rPosition ) + { + m_sPrimaryText = rPrimaryText; + m_sSecondaryText = rSecondaryText; + m_ePosition = rPosition; + } + void PseudoRubyText::Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, Rectangle* _pPrimaryLocation, Rectangle* _pSecondaryLocation, ::vcl::ControlLayoutData* _pLayoutData ) @@ -201,31 +213,31 @@ namespace svx *_pSecondaryLocation = aSecondaryRect; } - //= RubyRadioButton class RubyRadioButton :public RadioButton - ,protected PseudoRubyText { - using svx::PseudoRubyText::Paint; public: - RubyRadioButton( - Window* _pParent, - const ResId& _rId, // the text in the resource will be taken as primary text - const OUString& _rSecondary, // this will be the secondary text which will be printed somewhat smaller - const PseudoRubyText::RubyPosition _ePosition ); + RubyRadioButton( Window* _pParent, WinBits nBits ); + void init( const OUString& rPrimaryText, const OUString& rSecondaryText, const PseudoRubyText::RubyPosition& rPosition ); + virtual Size GetOptimalSize() const SAL_OVERRIDE; protected: virtual void Paint( const Rectangle& _rRect ) SAL_OVERRIDE; + + private: + PseudoRubyText m_aRubyText; }; + RubyRadioButton::RubyRadioButton( Window* _pParent, WinBits nBits ) + :RadioButton( _pParent, nBits ) + { + } - RubyRadioButton::RubyRadioButton( Window* _pParent, const ResId& _rId, - const OUString& _rSecondary, const PseudoRubyText::RubyPosition _ePosition ) - :RadioButton( _pParent, _rId ) - ,PseudoRubyText( RadioButton::GetText(), _rSecondary, _ePosition ) + void RubyRadioButton::init( const OUString& rPrimaryText, const OUString& rSecondaryText, const PseudoRubyText::RubyPosition& rPosition ) { + m_aRubyText.init( rPrimaryText, rSecondaryText, rPosition ); } @@ -236,8 +248,8 @@ namespace svx // calculate the size of the radio image - we're to paint our text _after_ this image DBG_ASSERT( !GetModeRadioImage(), "RubyRadioButton::Paint: images not supported!" ); Size aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel(); - aImageSize.Width() = CalcZoom( aImageSize.Width() ); - aImageSize.Height() = CalcZoom( aImageSize.Height() ); + aImageSize.Width() = CalcZoom( aImageSize.Width() ) + 2; // + 2 because otherwise the radiobuttons + aImageSize.Height() = CalcZoom( aImageSize.Height() ) + 2; // appear a bit cut from right and top. Rectangle aOverallRect( Point( 0, 0 ), GetOutputSizePixel() ); aOverallRect.Left() += aImageSize.Width() + 4; // 4 is the separator between the image and the text @@ -270,7 +282,7 @@ namespace svx // paint the ruby text Rectangle aPrimaryTextLocation, aSecondaryTextLocation; - PseudoRubyText::Paint( *this, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation ); + m_aRubyText.Paint( *this, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation ); // the focus rectangle is to be painted around both texts Rectangle aCombinedRect( aPrimaryTextLocation ); @@ -297,10 +309,33 @@ namespace svx ShowFocus( aTextRect ); } + Size RubyRadioButton::GetOptimalSize() const + { + Font aSmallerFont( GetFont() ); + aSmallerFont.SetHeight( static_cast( 0.8 * aSmallerFont.GetHeight() ) ); + Rectangle rect( Point(), Size( SAL_MAX_INT32, SAL_MAX_INT32 ) ); + sal_uInt16 style = GetStyle(); - //= SuggestionSet + Size aPrimarySize = GetTextRect( rect, m_aRubyText.getPrimaryText(), style ).GetSize(); + Size aSecondarySize; + { + FontSwitch aFontRestore( const_cast(*this), aSmallerFont ); + aSecondarySize = GetTextRect( rect, m_aRubyText.getSecondaryText(), style ).GetSize(); + } + + Size minimumSize = CalcMinimumSize(); + minimumSize.Height() = aPrimarySize.Height() + aSecondarySize.Height() + 5; + minimumSize.Width() = aPrimarySize.Width() + aSecondarySize.Width() + 5; + return minimumSize; + } + + extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeRubyRadioButton( Window *pParent, VclBuilder::stringmap & ) + { + return new RubyRadioButton( pParent, WB_LEFT|WB_VCENTER ); + } + //= SuggestionSet SuggestionSet::SuggestionSet( Window* pParent ) : ValueSet( pParent, pParent->GetStyle() | WB_BORDER ) @@ -335,13 +370,12 @@ namespace svx //= SuggestionDisplay - - SuggestionDisplay::SuggestionDisplay( Window* pParent, const ResId& rResId ) - : Control( pParent, rResId ) - , m_bDisplayListBox(true) - , m_aValueSet(this) - , m_aListBox(this,GetStyle() | WB_BORDER ) - , m_bInSelectionUpdate(false) + SuggestionDisplay::SuggestionDisplay( Window* pParent, WinBits nBits ) + : Control( pParent, nBits ) + , m_bDisplayListBox( true ) + , m_aValueSet( this ) + , m_aListBox( this,GetStyle() | WB_BORDER ) + , m_bInSelectionUpdate( false ) { m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); @@ -353,9 +387,9 @@ namespace svx long nItemWidth = 2*GetTextWidth( aOneCharacter ); m_aValueSet.SetItemWidth( nItemWidth ); - Size aSize(GetSizePixel()); - m_aValueSet.SetSizePixel(aSize); - m_aListBox.SetSizePixel(aSize); + Size aSize( approximate_char_width() * 48, GetTextHeight() * 5 ); + m_aValueSet.SetSizePixel( aSize ); + m_aListBox.SetSizePixel( aSize ); implUpdateDisplay(); } @@ -369,8 +403,8 @@ namespace svx bool bShowBox = IsVisible() && m_bDisplayListBox; bool bShowSet = IsVisible() && !m_bDisplayListBox; - m_aListBox.Show(bShowBox); - m_aValueSet.Show(bShowSet); + m_aListBox.Show( bShowBox ); + m_aValueSet.Show( bShowSet ); } void SuggestionDisplay::StateChanged( StateChangedType nStateChange ) @@ -440,7 +474,7 @@ namespace svx return 0L; m_bInSelectionUpdate = true; - if(pControl==&m_aListBox) + if( pControl == &m_aListBox ) { sal_uInt16 nPos = m_aListBox.GetSelectEntryPos(); m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning) @@ -451,7 +485,7 @@ namespace svx m_aListBox.SelectEntryPos( nPos ); } m_bInSelectionUpdate = false; - m_aSelectLink.Call(this); + m_aSelectLink.Call( this ); return 0L; } @@ -468,7 +502,7 @@ namespace svx { sal_uInt16 nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning) m_aValueSet.InsertItem( nItemId ); - OUString* pItemData = new OUString(rStr); + OUString* pItemData = new OUString( rStr ); m_aValueSet.SetItemData( nItemId, pItemData ); } void SuggestionDisplay::SelectEntryPos( sal_uInt16 nPos ) @@ -495,116 +529,73 @@ namespace svx m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST ); } + extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSuggestionDisplay( Window *pParent, VclBuilder::stringmap & ) + { + return new SuggestionDisplay( pParent, WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL ); + } + //= HangulHanjaConversionDialog - HangulHanjaConversionDialog::HangulHanjaConversionDialog( Window* _pParent, HHC::ConversionDirection _ePrimaryDirection ) - :ModalDialog( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA ) ) - ,m_pPlayground( new SvxCommonLinguisticControl( this ) ) - ,m_aFind ( m_pPlayground.get(), CUI_RES( PB_FIND ) ) - ,m_aSuggestions ( m_pPlayground.get(), CUI_RES( CTL_SUGGESTIONS ) ) - ,m_aFormat ( m_pPlayground.get(), CUI_RES( FT_FORMAT ) ) - ,m_aSimpleConversion( m_pPlayground.get(), CUI_RES( RB_SIMPLE_CONVERSION ) ) - ,m_aHangulBracketed ( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BRACKETED ) ) - ,m_aHanjaBracketed ( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BRACKETED ) ) - ,m_aConversion ( m_pPlayground.get(), CUI_RES( FT_CONVERSION ) ) - ,m_aHangulOnly ( m_pPlayground.get(), CUI_RES( CB_HANGUL_ONLY ) ) - ,m_aHanjaOnly ( m_pPlayground.get(), CUI_RES( CB_HANJA_ONLY ) ) - ,m_aReplaceByChar ( m_pPlayground.get(), CUI_RES( CB_REPLACE_BY_CHARACTER ) ) + :ModalDialog( _pParent, "HangulHanjaConversionDialog", "cui/ui/hangulhanjaconversiondialog.ui" ) ,m_pIgnoreNonPrimary( NULL ) ,m_bDocumentMode( true ) { - // special creation of the 4 pseudo-ruby radio buttons - OUString sSecondaryHangul( CUI_RES( STR_HANGUL ) ); - OUString sSecondaryHanja( CUI_RES( STR_HANJA ) ); - m_pHanjaAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_ABOVE ), sSecondaryHanja, PseudoRubyText::eAbove ) ); - m_pHanjaBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BELOW ), sSecondaryHanja, PseudoRubyText::eBelow ) ); - m_pHangulAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_ABOVE ), sSecondaryHangul, PseudoRubyText::eAbove ) ); - m_pHangulBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BELOW ), sSecondaryHangul, PseudoRubyText::eBelow ) ); - - // since these 4 buttons are not created within the other members, they have a wrong initial Z-Order - // correct this - m_pHanjaAbove->SetZOrder( &m_aHanjaBracketed, WINDOW_ZORDER_BEHIND ); - m_pHanjaBelow->SetZOrder( m_pHanjaAbove.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulAbove->SetZOrder( m_pHanjaBelow.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulBelow->SetZOrder( m_pHangulAbove.get(), WINDOW_ZORDER_BEHIND ); - - // VCL automatically sets the WB_GROUP bit, if the previous sibling (at the moment of creation) - // is no radion button - m_pHanjaAbove->SetStyle( m_pHanjaAbove->GetStyle() & ~WB_GROUP ); - - // the "Find" button and the word input control may not have the proper distance/extensions - // -> correct this - Point aDistance = LogicToPixel( Point( 3, 0 ), MAP_APPFONT ); - sal_Int32 nTooLargeByPixels = - // right margin of the word input control - ( m_pPlayground->GetWordInputControl().GetPosPixel().X() - + m_pPlayground->GetWordInputControl().GetSizePixel().Width() - ) - // minus left margin of the find button - - m_aFind.GetPosPixel().X() - // plus desired distance between the both - + aDistance.X(); - // make the word input control smaller - Size aSize = m_pPlayground->GetWordInputControl().GetSizePixel(); - aSize.Width() -= nTooLargeByPixels; - m_pPlayground->GetWordInputControl().SetSizePixel( aSize ); - - // additionall, the playground is not wide enough (in it's default size) - sal_Int32 nEnlargeWidth = 0; - { - FixedText aBottomAnchor( m_pPlayground.get(), CUI_RES( FT_RESIZE_ANCHOR ) ); - Point aAnchorPos = aBottomAnchor.GetPosPixel(); - - nEnlargeWidth = aAnchorPos.X() - m_pPlayground->GetActionButtonsLocation().X(); - } - m_pPlayground->Enlarge( nEnlargeWidth, 0 ); - - // insert our controls into the z-order of the playground - m_pPlayground->InsertControlGroup( m_aFind, m_aFind, SvxCommonLinguisticControl::eLeftRightWords ); - m_pPlayground->InsertControlGroup( m_aSuggestions, m_aHanjaOnly, SvxCommonLinguisticControl::eSuggestionLabel ); - m_pPlayground->InsertControlGroup( m_aReplaceByChar, m_aReplaceByChar, SvxCommonLinguisticControl::eActionButtons ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eClose, LINK( this, HangulHanjaConversionDialog, OnClose ) ); - m_pPlayground->GetWordInputControl().SetModifyHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionModified ) ); - m_aSuggestions.SetSelectHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionSelected ) ); - - m_aReplaceByChar.SetClickHdl( LINK( this, HangulHanjaConversionDialog, ClickByCharacterHdl ) ); - - m_aHangulOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - m_aHanjaOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions, - LINK( this, HangulHanjaConversionDialog, OnOption ) ); - m_pPlayground->GetButton( SvxCommonLinguisticControl::eOptions )->Show(); + get( m_pFind, "find" ); + get( m_pIgnore, "ignore" ); + get( m_pSuggestions, "suggestions" ); + get( m_pSimpleConversion, "simpleconversion" ); + get( m_pHangulBracketed, "hangulbracket" ); + get( m_pHanjaBracketed, "hanjabracket" ); + get( m_pHangulOnly, "hangulonly" ); + get( m_pHanjaOnly, "hanjaonly" ); + get( m_pReplaceByChar, "replacebychar" ); + get( m_pOptions, "options" ); + get( m_pIgnore, "ignore" ); + get( m_pIgnoreAll, "ignoreall" ); + get( m_pReplace, "replace" ); + get( m_pReplaceAll, "replaceall" ); + get( m_pWordInput, "wordinput" ); + get( m_pOriginalWord, "originalword" ); + get( m_pHanjaAbove, "hanja_above" ); + get( m_pHanjaBelow, "hanja_below" ); + get( m_pHangulAbove, "hangul_above" ); + get( m_pHangulBelow, "hangul_below" ); + + m_pSuggestions->set_height_request( m_pSuggestions->GetTextHeight() * 5 ); + m_pSuggestions->set_width_request( m_pSuggestions->approximate_char_width() * 48 ); + + const OUString sHangul = "Hangul"; + const OUString sHanja = "Hanja"; + m_pHanjaAbove->init( sHangul, sHanja, PseudoRubyText::eAbove ); + m_pHanjaBelow->init( sHangul, sHanja, PseudoRubyText::eBelow ); + m_pHangulAbove->init( sHanja, sHangul, PseudoRubyText::eAbove ); + m_pHangulBelow->init( sHanja, sHangul, PseudoRubyText::eBelow ); + + m_pWordInput->SetModifyHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionModified ) ); + m_pSuggestions->SetSelectHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionSelected ) ); + m_pReplaceByChar->SetClickHdl( LINK( this, HangulHanjaConversionDialog, ClickByCharacterHdl ) ); + m_pHangulOnly->SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); + m_pHanjaOnly->SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); + m_pOptions->SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnOption ) ); if ( editeng::HangulHanjaConversion::eHangulToHanja == _ePrimaryDirection ) { - m_pIgnoreNonPrimary = &m_aHangulOnly; + m_pIgnoreNonPrimary = m_pHangulOnly; } else { - m_pIgnoreNonPrimary = &m_aHanjaOnly; + m_pIgnoreNonPrimary = m_pHanjaOnly; } // initial focus FocusSuggestion( ); // initial control values - m_aSimpleConversion.Check(); + m_pSimpleConversion->Check(); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eClose )->SetHelpId(HID_HANGULDLG_BUTTON_CLOSE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnore )->SetHelpId(HID_HANGULDLG_BUTTON_IGNORE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnoreAll )->SetHelpId(HID_HANGULDLG_BUTTON_IGNOREALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChange )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChangeAll )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGEALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eOptions )->SetHelpId(HID_HANGULDLG_BUTTON_OPTIONS ); - m_pPlayground->GetWordInputControl().SetHelpId(HID_HANGULDLG_EDIT_NEWWORD); - - FreeResource(); - - m_aSuggestions.SetHelpIds(); + m_pSuggestions->SetHelpIds(); } @@ -615,23 +606,22 @@ namespace svx void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions ) { - m_aSuggestions.Clear(); - + m_pSuggestions->Clear(); const OUString* pSuggestions = _rSuggestions.getConstArray(); const OUString* pSuggestionsEnd = _rSuggestions.getConstArray() + _rSuggestions.getLength(); while ( pSuggestions != pSuggestionsEnd ) - m_aSuggestions.InsertEntry( *pSuggestions++ ); + m_pSuggestions->InsertEntry( *pSuggestions++ ); // select the first suggestion, and fill in the suggestion edit field OUString sFirstSuggestion; - if ( m_aSuggestions.GetEntryCount() ) + if ( m_pSuggestions->GetEntryCount() ) { - sFirstSuggestion = m_aSuggestions.GetEntry( 0 ); - m_aSuggestions.SelectEntryPos( 0 ); + sFirstSuggestion = m_pSuggestions->GetEntry( 0 ); + m_pSuggestions->SelectEntryPos( 0 ); } - m_pPlayground->GetWordInputControl().SetText( sFirstSuggestion ); - m_pPlayground->GetWordInputControl().SaveValue(); - OnSuggestionModified( &m_pPlayground->GetWordInputControl() ); + m_pWordInput->SetText( sFirstSuggestion ); + m_pWordInput->SaveValue(); + OnSuggestionModified( m_pWordInput ); } @@ -643,39 +633,39 @@ namespace svx void HangulHanjaConversionDialog::SetIgnoreHdl( const Link& _rHdl ) { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnore, _rHdl ); + m_pIgnore->SetClickHdl( _rHdl ); } void HangulHanjaConversionDialog::SetIgnoreAllHdl( const Link& _rHdl ) { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnoreAll, _rHdl ); + m_pIgnoreAll->SetClickHdl( _rHdl ); } void HangulHanjaConversionDialog::SetChangeHdl( const Link& _rHdl ) { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChange, _rHdl ); + m_pReplace->SetClickHdl( _rHdl ); } void HangulHanjaConversionDialog::SetChangeAllHdl( const Link& _rHdl ) { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChangeAll, _rHdl ); + m_pReplaceAll->SetClickHdl( _rHdl ); } void HangulHanjaConversionDialog::SetFindHdl( const Link& _rHdl ) { - m_aFind.SetClickHdl( _rHdl ); + m_pFind->SetClickHdl( _rHdl ); } void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link& _rHdl ) { - m_aSimpleConversion.SetClickHdl( _rHdl ); - m_aHangulBracketed.SetClickHdl( _rHdl ); - m_aHanjaBracketed.SetClickHdl( _rHdl ); + m_pSimpleConversion->SetClickHdl( _rHdl ); + m_pHangulBracketed->SetClickHdl( _rHdl ); + m_pHanjaBracketed->SetClickHdl( _rHdl ); m_pHanjaAbove->SetClickHdl( _rHdl ); m_pHanjaBelow->SetClickHdl( _rHdl ); m_pHangulAbove->SetClickHdl( _rHdl ); @@ -689,21 +679,21 @@ namespace svx } - IMPL_LINK_NOARG(HangulHanjaConversionDialog, OnSuggestionSelected) + IMPL_LINK_NOARG( HangulHanjaConversionDialog, OnSuggestionSelected ) { - m_pPlayground->GetWordInputControl().SetText( m_aSuggestions.GetSelectEntry() ); + m_pWordInput->SetText( m_pSuggestions->GetSelectEntry() ); OnSuggestionModified( NULL ); return 0L; } - IMPL_LINK_NOARG(HangulHanjaConversionDialog, OnSuggestionModified) + IMPL_LINK_NOARG( HangulHanjaConversionDialog, OnSuggestionModified ) { - m_aFind.Enable( m_pPlayground->GetWordInputControl().IsValueChangedFromSaved() ); + m_pFind->Enable( m_pWordInput->IsValueChangedFromSaved() ); - bool bSameLen = m_pPlayground->GetWordInputControl().GetText().getLength() == m_pPlayground->GetCurrentText().getLength(); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChange, m_bDocumentMode && bSameLen ); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChangeAll, m_bDocumentMode && bSameLen ); + bool bSameLen = m_pWordInput->GetText().getLength() == m_pOriginalWord->GetText().getLength(); + m_pReplace->Enable( m_bDocumentMode && bSameLen ); + m_pReplaceAll->Enable( m_bDocumentMode && bSameLen ); return 0L; } @@ -711,10 +701,10 @@ namespace svx IMPL_LINK( HangulHanjaConversionDialog, ClickByCharacterHdl, CheckBox *, pBox ) { - m_aClickByCharacterLink.Call(pBox); + m_aClickByCharacterLink.Call( pBox ); bool bByCharacter = pBox->IsChecked(); - m_aSuggestions.DisplayListBox( !bByCharacter ); + m_pSuggestions->DisplayListBox( !bByCharacter ); return 0L; } @@ -723,14 +713,14 @@ namespace svx IMPL_LINK( HangulHanjaConversionDialog, OnConversionDirectionClicked, CheckBox *, pBox ) { CheckBox *pOtherBox = 0; - if (pBox == &m_aHangulOnly) - pOtherBox = &m_aHanjaOnly; - else if (pBox == &m_aHanjaOnly) - pOtherBox = &m_aHangulOnly; - if (pBox && pOtherBox) + if ( pBox == m_pHangulOnly ) + pOtherBox = m_pHanjaOnly; + else if ( pBox == m_pHanjaOnly ) + pOtherBox = m_pHangulOnly; + if ( pBox && pOtherBox ) { bool bBoxChecked = pBox->IsChecked(); - if (bBoxChecked) + if ( bBoxChecked ) pOtherBox->Check( false ); pOtherBox->Enable( !bBoxChecked ); } @@ -738,31 +728,24 @@ namespace svx return 0L; } - - IMPL_LINK_NOARG(HangulHanjaConversionDialog, OnClose) - { - Close(); - return 0L; - } - - IMPL_LINK_NOARG(HangulHanjaConversionDialog, OnOption) + IMPL_LINK_NOARG( HangulHanjaConversionDialog, OnOption ) { HangulHanjaOptionsDialog aOptDlg( this ); aOptDlg.Execute(); - m_aOptionsChangedLink.Call(this); + m_aOptionsChangedLink.Call( this ); return 0L; } OUString HangulHanjaConversionDialog::GetCurrentString( ) const { - return m_pPlayground->GetCurrentText( ); + return m_pOriginalWord->GetText( ); } void HangulHanjaConversionDialog::FocusSuggestion( ) { - m_pPlayground->GetWordInputControl().GrabFocus(); + m_pWordInput->GrabFocus(); } @@ -780,14 +763,13 @@ namespace svx void HangulHanjaConversionDialog::SetCurrentString( const OUString& _rNewString, const Sequence< OUString >& _rSuggestions, bool _bOriginatesFromDocument ) { - m_pPlayground->SetCurrentText( _rNewString ); + m_pOriginalWord->SetText( _rNewString ); bool bOldDocumentMode = m_bDocumentMode; m_bDocumentMode = _bOriginatesFromDocument; // before FillSuggestions! FillSuggestions( _rSuggestions ); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eIgnoreAll, m_bDocumentMode ); - // all other buttons have been implicitly enabled or disabled during filling in the suggestions + m_pIgnoreAll->Enable( m_bDocumentMode ); // switch the def button depending if we're working for document text if ( bOldDocumentMode != m_bDocumentMode ) @@ -796,13 +778,13 @@ namespace svx Window* pNewDefButton = NULL; if ( m_bDocumentMode ) { - pOldDefButton = &m_aFind; - pNewDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); + pOldDefButton = m_pFind; + pNewDefButton = m_pReplace; } else { - pOldDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); - pNewDefButton = &m_aFind; + pOldDefButton = m_pReplace; + pNewDefButton = m_pFind; } DBG_ASSERT( WB_DEFBUTTON == ( pOldDefButton->GetStyle( ) & WB_DEFBUTTON ), @@ -824,14 +806,14 @@ namespace svx OUString HangulHanjaConversionDialog::GetCurrentSuggestion( ) const { - return m_pPlayground->GetWordInputControl().GetText(); + return m_pWordInput->GetText(); } void HangulHanjaConversionDialog::SetByCharacter( bool _bByCharacter ) { - m_aReplaceByChar.Check( _bByCharacter ); - m_aSuggestions.DisplayListBox( !_bByCharacter ); + m_pReplaceByChar->Check( _bByCharacter ); + m_pSuggestions->DisplayListBox( !_bByCharacter ); } @@ -840,15 +822,15 @@ namespace svx HHC::ConversionDirection _ePrimaryConversionDirection ) { // default state: try both direction - m_aHangulOnly.Check( false ); - m_aHangulOnly.Enable( true ); - m_aHanjaOnly.Check( false ); - m_aHanjaOnly.Enable( true ); + m_pHangulOnly->Check( false ); + m_pHangulOnly->Enable( true ); + m_pHanjaOnly->Check( false ); + m_pHanjaOnly->Enable( true ); if (!_bTryBothDirections) { CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja? - &m_aHangulOnly : &m_aHanjaOnly; + m_pHangulOnly : m_pHanjaOnly; pBox->Check( true ); OnConversionDirectionClicked( pBox ); } @@ -857,7 +839,7 @@ namespace svx bool HangulHanjaConversionDialog::GetUseBothDirections( ) const { - return !m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked(); + return !m_pHangulOnly->IsChecked() && !m_pHanjaOnly->IsChecked(); } @@ -865,9 +847,9 @@ namespace svx HHC::ConversionDirection eDefaultDirection ) const { HHC::ConversionDirection eDirection = eDefaultDirection; - if (m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked()) + if ( m_pHangulOnly->IsChecked() && !m_pHanjaOnly->IsChecked() ) eDirection = HHC::eHangulToHanja; - else if (!m_aHangulOnly.IsChecked() && m_aHanjaOnly.IsChecked()) + else if ( !m_pHangulOnly->IsChecked() && m_pHanjaOnly->IsChecked() ) eDirection = HHC::eHanjaToHangul; return eDirection; } @@ -877,9 +859,9 @@ namespace svx { switch ( _eType ) { - case HHC::eSimpleConversion: m_aSimpleConversion.Check(); break; - case HHC::eHangulBracketed: m_aHangulBracketed.Check(); break; - case HHC::eHanjaBracketed: m_aHanjaBracketed.Check(); break; + case HHC::eSimpleConversion: m_pSimpleConversion->Check(); break; + case HHC::eHangulBracketed: m_pHangulBracketed->Check(); break; + case HHC::eHanjaBracketed: m_pHanjaBracketed->Check(); break; case HHC::eRubyHanjaAbove: m_pHanjaAbove->Check(); break; case HHC::eRubyHanjaBelow: m_pHanjaBelow->Check(); break; case HHC::eRubyHangulAbove: m_pHangulAbove->Check(); break; @@ -892,11 +874,11 @@ namespace svx HHC::ConversionFormat HangulHanjaConversionDialog::GetConversionFormat( ) const { - if ( m_aSimpleConversion.IsChecked() ) + if ( m_pSimpleConversion->IsChecked() ) return HHC::eSimpleConversion; - if ( m_aHangulBracketed.IsChecked() ) + if ( m_pHangulBracketed->IsChecked() ) return HHC::eHangulBracketed; - if ( m_aHanjaBracketed.IsChecked() ) + if ( m_pHanjaBracketed->IsChecked() ) return HHC::eHanjaBracketed; if ( m_pHanjaAbove->IsChecked() ) return HHC::eRubyHanjaAbove; diff --git a/cui/source/dialogs/hangulhanjadlg.hrc b/cui/source/dialogs/hangulhanjadlg.hrc deleted file mode 100644 index c06a2edadac4..000000000000 --- a/cui/source/dialogs/hangulhanjadlg.hrc +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef SVX_HANGUL_HANJA_DLG_HRC -#define SVX_HANGUL_HANJA_DLG_HRC - -#include - -// PushButton -#define PB_FIND 1 - -// Control -#define CTL_SUGGESTIONS 1 - -// FixedText -#define FT_FORMAT 1 -#define FT_RESIZE_ANCHOR 2 -#define FT_CONVERSION 3 - -// RadioButton -#define RB_SIMPLE_CONVERSION 1 -#define RB_HANJA_HANGUL_BRACKETED 2 -#define RB_HANGUL_HANJA_BRACKETED 3 -#define RB_HANGUL_HANJA_ABOVE 4 -#define RB_HANGUL_HANJA_BELOW 5 -#define RB_HANJA_HANGUL_ABOVE 6 -#define RB_HANJA_HANGUL_BELOW 7 - -// CheckBox -#define CB_REPLACE_BY_CHARACTER 1 -#define CB_HANGUL_ONLY 2 -#define CB_HANJA_ONLY 3 - -// String -#define STR_HANGUL 1 -#define STR_HANJA 2 - -#define FT_WORD 10 -#define FT_AKTWORD 11 -#define FT_NEWWORD 12 -#define GB_AUDIT 13 -#define BTN_IGNORE 14 -#define BTN_IGNOREALL 15 -#define BTN_CHANGE 16 -#define BTN_CHANGEALL 17 -#define FT_STATUS 18 -#define BTN_SPL_CANCEL 19 -#define BTN_SPL_HELP 20 -#define ED_NEWWORD 21 -#define FT_SUGGESTION 22 - -// Hangul / Hanja Options Dialog - -#define BTN_OPTIONS 10 - -// metrics - -#define HHO_DLGWIDTH 287 - -// Hangul Hanja Edit Custom Dictionary Dialog -#define MAXNUM_SUGGESTIONS 50 - -#endif // SVX_HANGUL_HANJA_DLG_HRC - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hangulhanjadlg.src b/cui/source/dialogs/hangulhanjadlg.src deleted file mode 100644 index 516b251139b4..000000000000 --- a/cui/source/dialogs/hangulhanjadlg.src +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include -#include "helpid.hrc" - -#include "hangulhanjadlg.hrc" - -ModalDialog RID_SVX_MDLG_HANGULHANJA -{ - HelpId = HID_DIALOG_HANGULHANJA; - Size = MAP_APPFONT( 302, 175 ); - OutputSize = TRUE; - Closeable = TRUE ; - Moveable = TRUE ; - SVLook = TRUE; - - Text [ en-US ] = "Hangul/Hanja Conversion"; - - PushButton PB_FIND - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA:PB_FIND"; - Pos = MAP_APPFONT( 207, 23 ); - Size = MAP_APPFONT( 30, 14 ); - - Text [ en-US ] = "~Find"; - }; - - Control CTL_SUGGESTIONS - { - Pos = MAP_APPFONT( 51, 46 ); - Size = MAP_APPFONT( 186, 30 ); - TabStop = TRUE ; - }; - - FixedText FT_FORMAT - { - Pos = MAP_APPFONT( 6, 81 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Format"; - }; - - RadioButton RB_SIMPLE_CONVERSION - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_SIMPLE_CONVERSION"; - Pos = MAP_APPFONT( 51, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Group = TRUE; - - Text [ en-US ] = "~Hangul/Hanja"; - }; - - RadioButton RB_HANJA_HANGUL_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BRACKETED"; - Pos = MAP_APPFONT( 114, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hanja (Han~gul)"; - }; - - RadioButton RB_HANGUL_HANJA_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BRACKETED"; - Pos = MAP_APPFONT( 177, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hang~ul (Hanja)"; - }; - - RadioButton RB_HANGUL_HANJA_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_ABOVE"; - Pos = MAP_APPFONT( 51, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hangu~l"; - }; - - RadioButton RB_HANGUL_HANJA_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BELOW"; - Pos = MAP_APPFONT( 114, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hang~ul"; - }; - - RadioButton RB_HANJA_HANGUL_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_ABOVE"; - Pos = MAP_APPFONT( 56, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Han~ja"; - }; - - RadioButton RB_HANJA_HANGUL_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BELOW"; - Pos = MAP_APPFONT( 114, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Ha~nja"; - }; - - FixedText FT_CONVERSION - { - Pos = MAP_APPFONT( 6, 134 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Conversion"; - }; - - CheckBox CB_HANGUL_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANGUL_ONLY"; - Pos = MAP_APPFONT( 51, 134 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hangul ~only"; - }; - - CheckBox CB_HANJA_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANJA_ONLY"; - Pos = MAP_APPFONT( 114, 134 ); - Size = MAP_APPFONT( 55, 8 ); - - Text [ en-US ] = "Hanja onl~y"; - }; - - // this element is only for determining where our radio button group ends (in both directions) - FixedText FT_RESIZE_ANCHOR - { - Pos = MAP_APPFONT( 241, 133 ); - }; - - CheckBox CB_REPLACE_BY_CHARACTER - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_REPLACE_BY_CHARACTER"; - Pos = MAP_APPFONT( 241, 81 ); - Size = MAP_APPFONT( 55, 24 ); - - WordBreak = TRUE; - - Text [ en-US ] = "Replace b~y character"; - }; - - String STR_HANGUL - { - Text [ en-US ] = "Hangul"; - }; - - String STR_HANJA - { - Text [ en-US ] = "Hanja"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx index 6b1828addf76..cbee8ef6b0d7 100644 --- a/cui/source/inc/hangulhanjadlg.hxx +++ b/cui/source/inc/hangulhanjadlg.hxx @@ -35,16 +35,9 @@ #include #include -class SvxCommonLinguisticControl; - namespace svx { - - - //= HangulHanjaConversionDialog - - class SuggestionSet : public ValueSet { public: @@ -58,7 +51,7 @@ namespace svx class SuggestionDisplay : public Control { public: - SuggestionDisplay( Window* pParent, const ResId& rResId ); + SuggestionDisplay( Window* pParent, WinBits nBits ); virtual ~SuggestionDisplay(); void DisplayListBox( bool bDisplayListBox ); @@ -101,30 +94,33 @@ namespace svx bool m_bInSelectionUpdate; }; + class RubyRadioButton; + + //= HangulHanjaConversionDialog + class HangulHanjaConversionDialog : public ModalDialog { private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< SvxCommonLinguisticControl > - m_pPlayground; // order matters: before all other controls! - SAL_WNODEPRECATED_DECLARATIONS_POP - - PushButton m_aFind; - SuggestionDisplay m_aSuggestions; - FixedText m_aFormat; - RadioButton m_aSimpleConversion; - RadioButton m_aHangulBracketed; - RadioButton m_aHanjaBracketed; - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< RadioButton > m_pHanjaAbove; - ::std::auto_ptr< RadioButton > m_pHanjaBelow; - ::std::auto_ptr< RadioButton > m_pHangulAbove; - ::std::auto_ptr< RadioButton > m_pHangulBelow; - SAL_WNODEPRECATED_DECLARATIONS_POP - FixedText m_aConversion; - CheckBox m_aHangulOnly; - CheckBox m_aHanjaOnly; - CheckBox m_aReplaceByChar; + + PushButton* m_pFind; + PushButton* m_pIgnore; + PushButton* m_pIgnoreAll; + PushButton* m_pReplace; + PushButton* m_pReplaceAll; + PushButton* m_pOptions; + SuggestionDisplay* m_pSuggestions; + RadioButton* m_pSimpleConversion; + RadioButton* m_pHangulBracketed; + RadioButton* m_pHanjaBracketed; + Edit* m_pWordInput; + FixedText* m_pOriginalWord; + RubyRadioButton* m_pHanjaAbove; + RubyRadioButton* m_pHanjaBelow; + RubyRadioButton* m_pHangulAbove; + RubyRadioButton* m_pHangulBelow; + CheckBox* m_pHangulOnly; + CheckBox* m_pHanjaOnly; + CheckBox* m_pReplaceByChar; CheckBox* m_pIgnoreNonPrimary; /** are we working for a document? This is normally true, but in case diff --git a/cui/uiconfig/ui/hangulhanjaconversiondialog.ui b/cui/uiconfig/ui/hangulhanjaconversiondialog.ui new file mode 100644 index 000000000000..e9b0ddb8ed9d --- /dev/null +++ b/cui/uiconfig/ui/hangulhanjaconversiondialog.ui @@ -0,0 +1,558 @@ + + + + + + + False + Hangul/Hanja Conversion + normal + + + False + vertical + 2 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + 6 + 6 + 6 + 6 + 12 + + + True + False + vertical + 6 + + + True + False + 6 + + + True + False + 28 + Original + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 6 + + + True + False + 42 + Word + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + _Find + True + True + True + True + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + 6 + + + True + False + Suggestions + + + True + True + 0 + + + + + True + True + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + baseline + True + 6 + + + True + False + 28 + Format + + + False + True + 0 + + + + + _Hangul/Hanja + True + True + False + True + 0 + True + True + hangulbracket + + + False + True + 1 + + + + + Hanja(Han_gul) + True + True + False + True + 0 + True + True + + + False + True + 2 + + + + + Hang_ul(Hanja) + True + True + False + True + 0 + True + True + simpleconversion + + + False + True + 3 + + + + + False + True + 3 + + + + + True + False + 12 + 12 + + + Hanja + True + True + False + 88 + 0.2 + True + True + hanja_below + + + 0 + 0 + 1 + 1 + + + + + Hanja + True + True + False + 12 + 0.2 + True + hangul_above + + + 1 + 0 + 1 + 1 + + + + + Hangul + True + True + False + 88 + 0.2 + True + hangul_below + + + 0 + 1 + 1 + 1 + + + + + Hangul + True + True + False + 12 + 0.2 + True + hanja_above + + + 1 + 1 + 1 + 1 + + + + + False + True + 4 + + + + + True + False + 6 + True + + + True + False + Conversion + + + False + True + 0 + + + + + Hangul _only + True + True + False + 6 + True + 0 + True + + + False + True + 1 + + + + + Hanja onl_y + True + True + False + 6 + True + 0 + True + + + False + True + 2 + + + + + False + True + 6 + + + + + False + True + 0 + + + + + True + False + vertical + 6 + True + + + _Ignore + True + True + True + True + True + True + + + True + True + 0 + + + + + Always I_gnore + True + True + True + True + + + True + True + 1 + + + + + _Replace + True + True + True + True + + + True + True + 2 + + + + + Always R_eplace + True + True + True + True + + + True + True + 3 + + + + + + + + Replace b_y character + True + True + False + True + 0 + True + + + False + False + 5 + + + + + Options + True + True + True + + + False + True + 6 + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + ok + cancel + help + + + diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index f296d6c2385d..6f3eaf0efbb2 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -780,5 +780,11 @@ + + -- cgit