diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
commit | d773cda7d126918249f43776b2d6053d4bc73f33 (patch) | |
tree | 126336aad16b5e52d24e3bf3b5c947d17475dda2 /cui | |
parent | c61aa274cb5631305cfbaea6f1894db756e911c8 (diff) | |
parent | 273fa6a6aa0d56660807ab29892f0618cfbb2e63 (diff) |
CWS changehid: resync to m84
Diffstat (limited to 'cui')
31 files changed, 2062 insertions, 1101 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index e7d70dd9d396..9b5453553ef3 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -296,6 +296,11 @@ void _SvxMacroTabPage::InitResources() aDisplayNames.push_back( EventDisplayName( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED ) ); aDisplayNames.push_back( EventDisplayName( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED ) ); // aDisplayNames.push_back( EventDisplayName( "OnLayoutFinished", RID_SVXSTR_EVENT_LAYOUT_FINISHED ) ); + aDisplayNames.push_back( EventDisplayName( "OnSelect", RID_SVXSTR_EVENT_SELECTIONCHANGED ) ); + aDisplayNames.push_back( EventDisplayName( "OnDoubleClick", RID_SVXSTR_EVENT_DOUBLECLICK ) ); + aDisplayNames.push_back( EventDisplayName( "OnRightClick", RID_SVXSTR_EVENT_RIGHTCLICK ) ); + aDisplayNames.push_back( EventDisplayName( "OnCalculate", RID_SVXSTR_EVENT_CALCULATE ) ); + aDisplayNames.push_back( EventDisplayName( "OnChange", RID_SVXSTR_EVENT_CONTENTCHANGED ) ); // the event name to UI string mappings for forms & dialogs // diff --git a/cui/source/customize/macropg.src b/cui/source/customize/macropg.src index 26aaea2c34db..10d9149233e0 100644 --- a/cui/source/customize/macropg.src +++ b/cui/source/customize/macropg.src @@ -457,3 +457,29 @@ String RID_SVXSTR_EVENT_LAYOUT_FINISHED { Text [ en-US ] = "Document layout finished" ; }; + +String RID_SVXSTR_EVENT_SELECTIONCHANGED +{ + Text [ en-US ] = "Selection changed" ; +}; + +String RID_SVXSTR_EVENT_DOUBLECLICK +{ + Text [ en-US ] = "Double click" ; +}; + +String RID_SVXSTR_EVENT_RIGHTCLICK +{ + Text [ en-US ] = "Right click" ; +}; + +String RID_SVXSTR_EVENT_CALCULATE +{ + Text [ en-US ] = "Formulas calculated" ; +}; + +String RID_SVXSTR_EVENT_CONTENTCHANGED +{ + Text [ en-US ] = "Content changed" ; +}; + diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index d243ce96f27c..303b54688eea 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -389,14 +389,14 @@ void SpellDialog::UpdateBoxes_Impl() } // ----------------------------------------------------------------------- -void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence) +void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrentError ) { //initially or after the last error of a sentence MarkNextError will fail //then GetNextSentence() has to be called followed again by MarkNextError() //MarkNextError is not initally called if the UndoEdit mode is active bool bNextSentence = false; - if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) || - true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError())) + if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) || + true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false ))) { const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); if( pSpellErrorDescription ) @@ -473,7 +473,7 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG ) } else { - if( SvtLinguConfig().HasAnyVendorImages() ) + if( SvtLinguConfig().HasVendorImages( "SpellAndGrammarDialogImage" ) ) { pThis->aVendorImageFI.Show(); Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); @@ -795,14 +795,12 @@ IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG ) } else { - //in case the error has been changed manually it has to be restored + //in case the error has been changed manually it has to be restored, + // since the users choice now was to ignore the error aSentenceED.RestoreCurrentError(); - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true)); - aSentenceED.ResetModified(); // the word is being ignored - SpellContinue_Impl(); - bModified = false; + SpellContinue_Impl( false, true ); } return 1; } @@ -1074,11 +1072,8 @@ IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd) -----------------------------------------------------------------------*/ IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG ) { - //apply changes first - if there are any - if(aSentenceED.IsModified()) - { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); - } + //apply changes and ignored text parts first - if there are any + rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), false); Close(); return 0; } @@ -1158,15 +1153,17 @@ void SpellDialog::InvalidateDialog() /*-- 10.09.2003 08:35:56--------------------------------------------------- -----------------------------------------------------------------------*/ -bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence) +bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) { bool bRet = false; - if(!bUseSavedSentence && aSentenceED.IsModified()) + if(!bUseSavedSentence /*&& aSentenceED.IsModified()*/) { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); + //apply changes and ignored text parts + rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck); } + aSentenceED.ResetIgnoreErrorsAt(); aSentenceED.ResetModified(); - SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence(); + SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck ); if(!bUseSavedSentence) m_aSavedSentence = aSentence; bool bHasReplaced = false; @@ -1177,8 +1174,8 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence) if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced)) { - rParent.ApplyChangedSentence(aSentence); - aSentence = rParent.GetNextWrongSentence(); + rParent.ApplyChangedSentence(aSentence, bRecheck); + aSentence = rParent.GetNextWrongSentence( bRecheck ); } else break; @@ -1642,8 +1639,10 @@ long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) /*-- 10.09.2003 13:38:14--------------------------------------------------- -----------------------------------------------------------------------*/ -bool SentenceEditWindow_Impl::MarkNextError() +bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError ) { + if (bIgnoreCurrentError) + m_aIgnoreErrorsAt.insert( m_nErrorStart ); ExtTextEngine* pTextEngine = GetTextEngine(); USHORT nTextLen = pTextEngine->GetTextLen(0); if(m_nErrorEnd >= nTextLen - 1) @@ -1981,7 +1980,8 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore aPortion1.eLanguage = eLang; aPortion1.sText = pTextEngine->GetText( TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition))); - if( bSetIgnoreFlag && m_nErrorStart == nStart ) + bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end(); + if( bSetIgnoreFlag && bIsIgnoreError /*m_nErrorStart == nStart*/ ) { aPortion1.bIgnoreThisError = true; } diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index db4a3d15f4a4..297b1ad921c4 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -107,6 +107,7 @@ SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings) mbReadOnly ( sal_False ), mbIsHTMLDoc ( sal_False ) { + SetUniqueId( HID_HYPERLINK_DIALOG ); mbGrabFocus = sal_True; // insert pages Image aImage; diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 91136b607a22..16026aaff6d1 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -28,52 +28,51 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cui.hxx" -// include --------------------------------------------------------------- -#include <tools/shl.hxx> -#include <tools/list.hxx> -#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#include <vcl/msgbox.hxx> -#include "cuires.hrc" -#include "hyphen.hrc" -#include <editeng/svxenum.hxx> #include "hyphen.hxx" +#include "hyphen.hrc" +#include "cuires.hrc" +#include "dialmgr.hxx" + #include <editeng/splwrap.hxx> -#include <svx/dlgutil.hxx> -#include <svx/dialmgr.hxx> +#include <editeng/svxenum.hxx> #include <editeng/unolingu.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" +#include <svx/dialmgr.hxx> +#include <svx/dlgutil.hxx> +#include <tools/list.hxx> +#include <tools/shl.hxx> +#include <vcl/msgbox.hxx> -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) +using namespace ::com::sun::star; -// define ---------------------------------------------------------------- -#define HYPHHERE '-' +#define HYPH_POS_CHAR '=' #define CONTINUE_HYPH USHRT_MAX -// Dies ist nur ein Hack, weil an dieser Stelle das extern char aus hmwrap -// nicht bekannt ist, wird demnaechst in hmwrap durch ein define ersetzt. -#define SW_SOFT_HYPHEN '=' +#define CUR_HYPH_POS_CHAR '-' + + +// class HyphenEdit_Impl ------------------------------------------------------- -// class SvxHyphenEdit --------------------------------------------------- +class HyphenEdit_Impl : public Edit +{ +public: + HyphenEdit_Impl( Window* pParent, const ResId& rResId ); + +protected: + virtual void KeyInput( const KeyEvent &rKEvt ); +}; -SvxHyphenEdit::SvxHyphenEdit( Window* pParent, const ResId& rResId ) : +HyphenEdit_Impl::HyphenEdit_Impl( Window* pParent, const ResId& rResId ) : Edit( pParent, rResId ) { } -// ----------------------------------------------------------------------- -void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) +void HyphenEdit_Impl::KeyInput( const KeyEvent& rKEvt ) { // sal_uInt16 nMod = rKEvt.GetKeyCode().GetModifier(); sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); @@ -99,123 +98,143 @@ void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) } } -// class SvxHyphenWordDialog --------------------------------------------- -SvxHyphenWordDialog::SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - Reference< XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ), - - aWordFT ( this, CUI_RES( FT_WORD ) ), - aWordEdit ( this, CUI_RES( ED_WORD ) ), - aLeftBtn ( this, CUI_RES( BTN_LEFT ) ), - aRightBtn ( this, CUI_RES( BTN_RIGHT ) ), - aOkBtn ( this, CUI_RES( BTN_HYPH_CUT ) ), - aCancelBtn ( this, CUI_RES( BTN_HYPH_CANCEL ) ), - aContBtn ( this, CUI_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( this, CUI_RES( BTN_HYPH_DELETE ) ), - aHelpBtn ( this, CUI_RES( BTN_HYPH_HELP ) ), - aLabel ( GetText() ), - pHyphWrapper ( pWrapper ), - xHyphenator ( xHyphen ), - aActWord ( rWord ), - nActLanguage ( nLang ), +// struct SvxHyphenWordDialog_Impl --------------------------------------------- + +struct SvxHyphenWordDialog_Impl +{ + SvxHyphenWordDialog * m_pDialog; +// Window * m_pParent; + + FixedText aWordFT; + HyphenEdit_Impl aWordEdit; + ImageButton aLeftBtn; + ImageButton aRightBtn; + OKButton aOkBtn; + PushButton aContBtn; + PushButton aDelBtn; + FixedLine aFLBottom; + HelpButton aHelpBtn; + PushButton aHyphAll; + CancelButton aCancelBtn; + String aLabel; + SvxSpellWrapper* pHyphWrapper; + uno::Reference< linguistic2::XHyphenator > xHyphenator; + uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; + String aEditWord; // aEditWord and aWordEdit.GetText() differ only by the character for the current selected hyphenation position + String aActWord; // actual word to be hyphenated + LanguageType nActLanguage; // and its language + sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos + sal_uInt16 nHyphPos; + sal_uInt16 nOldPos; + sal_Int32 nHyphenationPositionsOffset; + sal_Bool bBusy; + + + void EnableLRBtn_Impl(); + String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); + + void InitControls_Impl(); + void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); + sal_uInt16 GetHyphIndex_Impl(); + void SelLeft_Impl(); + void SelRight_Impl(); + + DECL_LINK( Left_Impl, Button* ); + DECL_LINK( Right_Impl, Button* ); + DECL_LINK( CutHdl_Impl, Button* ); + DECL_LINK( ContinueHdl_Impl, Button* ); + DECL_LINK( DeleteHdl_Impl, Button* ); + DECL_LINK( HyphenateAllHdl_Impl, Button* ); + DECL_LINK( CancelHdl_Impl, Button* ); + DECL_LINK( GetFocusHdl_Impl, Edit* ); + + + SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ); + ~SvxHyphenWordDialog_Impl(); +}; + + +SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + m_pDialog ( pDialog ), + aWordFT ( pDialog, CUI_RES( FT_WORD ) ), + aWordEdit ( pDialog, CUI_RES( ED_WORD ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aRightBtn ( pDialog, CUI_RES( BTN_RIGHT ) ), + aOkBtn ( pDialog, CUI_RES( BTN_HYPH_CUT ) ), + aContBtn ( pDialog, CUI_RES( BTN_HYPH_CONTINUE ) ), + aDelBtn ( pDialog, CUI_RES( BTN_HYPH_DELETE ) ), + aFLBottom ( pDialog, CUI_RES( FL_BOTTOM ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_HYPH_HELP ) ), + aHyphAll ( pDialog, CUI_RES( BTN_HYPH_ALL ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_HYPH_CANCEL ) ), + aLabel ( pDialog->GetText() ), + pHyphWrapper ( NULL ), + xHyphenator ( NULL ), + xPossHyph ( NULL ), + aActWord ( ), + nActLanguage ( LANGUAGE_NONE ), + nMaxHyphenationPos ( 0 ), nHyphPos ( 0 ), nOldPos ( 0 ), + nHyphenationPositionsOffset( 0 ), bBusy ( sal_False ) { - aContBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) ); - aCancelBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) ); - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) ); - - aWordEdit.SetGetFocusHdl( - LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) ); - - Reference< XHyphenatedWord > xHyphWord( pWrapper ? - pWrapper->GetLast() : Reference< XInterface > () , UNO_QUERY ); - DBG_ASSERT(xHyphWord.is(), "missing hyphenated word"); - nMaxHyphenationPos = xHyphWord.is() ? xHyphWord->getHyphenationPos() : 0; - SetLabel_Impl( nLang ); + aActWord = rWord; + nActLanguage = nLang; + xHyphenator = xHyphen; + pHyphWrapper = pWrapper; + + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ? + pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY ); + DBG_ASSERT( xHyphWord.is(), "hyphenation result missing" ); + if (xHyphWord.is()) + { + DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" ); + DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" ); + nMaxHyphenationPos = xHyphWord->getHyphenationPos(); + } InitControls_Impl(); aWordEdit.GrabFocus(); - FreeResource(); - - // disable controls if service is not available - if (!xHyphenator.is()) - Enable( sal_False ); + aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Left_Impl ) ); + aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Right_Impl ) ); + aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CutHdl_Impl ) ); + aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, ContinueHdl_Impl ) ); + aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, DeleteHdl_Impl ) ); + aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl ) ); + aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CancelHdl_Impl ) ); + aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog_Impl, GetFocusHdl_Impl ) ); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::SelLeft() +SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() { - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i-- > 0 ; ) - { - DBG_ASSERT(i <= aTxt.Len(), "index out of range"); - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); -} - -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SelRight() -{ - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) - { - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::EnableLRBtn_Impl() +void SvxHyphenWordDialog_Impl::EnableLRBtn_Impl() { - String aTxt( aWordEdit.GetText() ); + String aTxt( aEditWord ); xub_StrLen nLen = aTxt.Len(); xub_StrLen i; aRightBtn.Disable(); for ( i = nOldPos + 2; i < nLen; ++i ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aRightBtn.Enable(); break; @@ -228,7 +247,7 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() aLeftBtn.Disable(); for ( i = nOldPos; i-- > 0; ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aLeftBtn.Enable(); break; @@ -236,42 +255,55 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() } } -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SetLabel_Impl( LanguageType nLang ) -{ - String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); - String aTmp( aLabel ); - aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - aTmp.Append( aLangStr ); - aTmp.Append( sal_Unicode( ')' ) ); - SetText( aTmp ); -} - -// ----------------------------------------------------------------------- - -String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( - Reference< XPossibleHyphens > &rxPossHyph, +String SvxHyphenWordDialog_Impl::EraseUnusableHyphens_Impl( + uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 _nMaxHyphenationPos ) { // returns a String showing only those hyphen positions which will result // in a line break if hyphenation is done there + // 1) we will need to discard all hyphenation positions at th end that + // will not result in a line break where the text to the left still fits + // on the line. + // 2) since as from OOo 3.2 '-' are part of a word an thus text like + // 'multi-line-editor' is regarded as single word we also need to discard those + // hyphenation positions to the left of the rightmost '-' that is still left of + // the rightmost valid hyphenation position according to 1) + // + // Example: + // If the possible hyphenation position in 'multi-line-editor' are to eb marked + // by '=' then the text will look like this 'mul=ti-line-ed=it=or'. + // If now the first line is only large enough for 'multi-line-edi' we need to discard + // the last possible hyphnation point because of 1). The the right most valid + // hyphenation position is "ed=itor". The first '-' left of this position is + // "line-ed", thus because of 2) we now need to discard all possible hyphneation + // positions to the left of that as well. Thus in the end leaving us with just + // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation + // position for the user too choose from. However ALL the '-' characters in the word + // will ALWAYS be valid implicit hyphenation positions for the core to choose from! + // And thus even if this word is skipped in the hyphenation dialog it will still be broken + // right after 'multi-line-' (actually it might already be broken up that way before + // the hyphenation dialog is called!). + // Thus rule 2) just eliminates those positions which will not be used by the core at all + // even if the user were to select one of them. String aTxt; DBG_ASSERT(rxPossHyph.is(), "missing possible hyphens"); if (rxPossHyph.is()) { + DBG_ASSERT( aActWord == String( rxPossHyph->getWord() ), "word mismatch" ); + aTxt = String( rxPossHyph->getPossibleHyphens() ); - Sequence< sal_Int16 > aHyphenationPositions( + nHyphenationPositionsOffset = 0; + uno::Sequence< sal_Int16 > aHyphenationPositions( rxPossHyph->getHyphenationPositions() ); sal_Int32 nLen = aHyphenationPositions.getLength(); const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); // find position nIdx after which all hyphen positions are unusable - xub_StrLen nIdx = STRING_NOTFOUND, - nPos; + xub_StrLen nIdx = STRING_NOTFOUND; + xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; if (nLen) { xub_StrLen nStart = 0; @@ -282,7 +314,7 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( else { // find corresponding hyphen pos in string - nPos = aTxt.Search( sal_Unicode( SW_SOFT_HYPHEN ), nStart ); + nPos = aTxt.Search( sal_Unicode( HYPH_POS_CHAR ), nStart ); if (nStart == STRING_NOTFOUND) break; @@ -296,66 +328,77 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( } DBG_ASSERT(nIdx != STRING_NOTFOUND, "no usable hyphenation position"); - // remove not usable hyphens from string + // 1) remove all not usable hyphenation positions from the end of the string nPos = nIdx == STRING_NOTFOUND ? 0 : nIdx + 1; - String aTmp( sal_Unicode( SW_SOFT_HYPHEN ) ), - aEmpty; + nPos1 = nPos; //save for later use in 2) below + const String aTmp( sal_Unicode( HYPH_POS_CHAR ) ); + const String aEmpty; while (nPos != STRING_NOTFOUND) nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + + // 2) remove all hyphenation positions from the start that are not considered by the core + const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); + nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default + if (nPos2 != STRING_NOTFOUND) + { + String aLeft( aSearchRange.Copy( 0, nPos2 ) ); + nPos = 0; + while (nPos != STRING_NOTFOUND) + { + nPos = aLeft.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + if (nPos != STRING_NOTFOUND) + ++nHyphenationPositionsOffset; + } + aTxt.Replace( 0, nPos2, aLeft ); + } } return aTxt; } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::InitControls_Impl() +void SvxHyphenWordDialog_Impl::InitControls_Impl() { - String aTxt; xPossHyph = NULL; if (xHyphenator.is()) { lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - Sequence< PropertyValue >() ); + uno::Sequence< beans::PropertyValue >() ); if (xPossHyph.is()) - { - aTxt = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); - } - SetLabel_Impl( nActLanguage ); + aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); } - aWordEdit.SetText( aTxt ); + aWordEdit.SetText( aEditWord ); - nOldPos = aTxt.Len(); - SelLeft(); + nOldPos = aEditWord.Len(); + SelLeft_Impl(); EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) +void SvxHyphenWordDialog_Impl::ContinueHyph_Impl( sal_uInt16 nInsPos ) { if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) { if (nInsPos) { - //String aTmp( U2S( xPossHyph->getPossibleHyphens() ) ); - String aTmp( aWordEdit.GetText() ); + String aTmp( aEditWord ); DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); - sal_uInt16 nIdxPos = 0; - sal_uInt16 i = 0; - sal_Unicode c; - while (i < aTmp.Len() && HYPHHERE != (c = aTmp.GetChar(i++)) ) + sal_Int16 nIdxPos = -1; + for (sal_uInt16 i = 0; i <= nInsPos; ++i) { - if (SW_SOFT_HYPHEN == c) + if (HYPH_POS_CHAR == aTmp.GetChar( i )) nIdxPos++; } + // take the possible hyphenation positions that got removed from the + // start of the wor dinot account: + nIdxPos += nHyphenationPositionsOffset; - Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); + uno::Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); sal_Int32 nLen = aSeq.getLength(); DBG_ASSERT(nLen, "empty sequence"); - DBG_ASSERT(nIdxPos < nLen, "index out of range"); - if (nLen && nIdxPos < nLen) + DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range"); + if (nLen && 0 <= nIdxPos && nIdxPos < nLen) { nInsPos = aSeq.getConstArray()[ nIdxPos ]; pHyphWrapper->InsertHyphen( nInsPos ); @@ -370,58 +413,130 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) if ( pHyphWrapper->FindSpellError() ) { - Reference< XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), UNO_QUERY ); + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), uno::UNO_QUERY ); // adapt actual word and language to new found hyphenation result if(xHyphWord.is()) { - aActWord = String( xHyphWord->getWord() ); + aActWord = String( xHyphWord->getWord() ); nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); nMaxHyphenationPos = xHyphWord->getHyphenationPos(); InitControls_Impl(); + m_pDialog->SetWindowTitle( nActLanguage ); } } else - EndDialog( RET_OK ); + m_pDialog->EndDialog( RET_OK ); } -// ----------------------------------------------------------------------- -sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() +sal_uInt16 SvxHyphenWordDialog_Impl::GetHyphIndex_Impl() { sal_uInt16 nPos = 0; - String aTxt(aWordEdit.GetText()); + String aTxt( aWordEdit.GetText() ); for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) { - sal_Unicode nChar = aTxt.GetChar( i ); - - if ( nChar == HYPHHERE ) + sal_Unicode cChar = aTxt.GetChar( i ); + if ( cChar == CUR_HYPH_POS_CHAR ) break; - - if ( nChar != SW_SOFT_HYPHEN ) + if ( cChar != HYPH_POS_CHAR ) nPos++; } return nPos; } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) +void SvxHyphenWordDialog_Impl::SelLeft_Impl() +{ + DBG_ASSERT( nOldPos > 0, "invalid hyphenation position" ); + if (nOldPos > 0) + { + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos - 1; i > 0; --i) + { + DBG_ASSERT(i <= aTxt.Len(), "index out of range"); + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); + } +} + + +void SvxHyphenWordDialog_Impl::SelRight_Impl() +{ + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) + { + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, CutHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - ContinueHyph_Impl( nHyphPos ); + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) +{ + if( !bBusy ) + { + try + { + uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); + const rtl::OUString aName( rtl::OUString::createFromAscii( "IsHyphAuto" ) ); + uno::Any aAny; + + aAny <<= sal_True; + xProp->setPropertyValue( aName, aAny ); + + bBusy = sal_True; + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); + bBusy = sal_False; + + aAny <<= sal_False; + xProp->setPropertyValue( aName, aAny ); + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "Hyphenate All failed" ); + } + } + return 0; +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, DeleteHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -431,11 +546,9 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, ContinueHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -445,69 +558,100 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYAR } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, CancelHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; pHyphWrapper->SpellEnd(); - EndDialog( RET_CANCEL ); + m_pDialog->EndDialog( RET_CANCEL ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Left_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelLeft(); + SelLeft_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Right_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelRight(); + SelRight_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, GetFocusHdl_Impl, Edit *, EMPTYARG ) { aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK( SvxHyphenWordDialog, LangError_Impl, void *, nLang ) +// class SvxHyphenWordDialog --------------------------------------------- + +SvxHyphenWordDialog::SvxHyphenWordDialog( + const String &rWord, LanguageType nLang, + Window* pParent, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ) { - // Status anzeigen - String aErr( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_IntPtr)nLang ) ); - aErr += CUI_RESSTR( RID_SVXSTR_HMERR_CHECKINSTALL ); - InfoBox( this, aErr ).Execute(); - return 0; + m_pImpl = std::auto_ptr< SvxHyphenWordDialog_Impl >( + new SvxHyphenWordDialog_Impl( this, rWord, nLang, xHyphen, pWrapper ) ); + + FreeResource(); + + SetWindowTitle( nLang ); + + // disable controls if service is not available + if (!m_pImpl->xHyphenator.is()) + Enable( sal_False ); +} + + +SvxHyphenWordDialog::~SvxHyphenWordDialog() +{ +} + + +void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) +{ + String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); + String aTmp( m_pImpl->aLabel ); + aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); + aTmp.Append( aLangStr ); + aTmp.Append( sal_Unicode( ')' ) ); + SetText( aTmp ); +} + + +void SvxHyphenWordDialog::SelLeft() +{ + m_pImpl->SelRight_Impl(); +} + + +void SvxHyphenWordDialog::SelRight() +{ + m_pImpl->SelLeft_Impl(); } diff --git a/cui/source/dialogs/hyphen.hrc b/cui/source/dialogs/hyphen.hrc index 2c6722298655..f76e2aa75770 100644 --- a/cui/source/dialogs/hyphen.hrc +++ b/cui/source/dialogs/hyphen.hrc @@ -33,13 +33,14 @@ #define BTN_LEFT 11 #define BTN_RIGHT 12 #define FT_WORD 13 +#define FL_BOTTOM 14 #define BTN_HYPH_CONTINUE 20 #define BTN_HYPH_DELETE 21 #define BTN_HYPH_CUT 22 #define BTN_HYPH_CANCEL 23 #define BTN_HYPH_HELP 24 - +#define BTN_HYPH_ALL 25 #endif diff --git a/cui/source/dialogs/hyphen.src b/cui/source/dialogs/hyphen.src index 71720867fcc9..f10e94626f31 100644 --- a/cui/source/dialogs/hyphen.src +++ b/cui/source/dialogs/hyphen.src @@ -40,104 +40,87 @@ String RID_SVXSTR_HMERR_CHECKINSTALL ModalDialog RID_SVXDLG_HYPHENATE { HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 188 , 100 ) ; + Size = MAP_APPFONT ( 200 , 111 ) ; OutputSize = TRUE ; SvLook = TRUE ; Text [ en-US ] = "Hyphenation" ; Moveable = TRUE ; + + FixedText FT_WORD + { + Pos = MAP_APPFONT ( 5 , 5 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "~Word" ; + }; Edit ED_WORD { BORDER = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 17 ) ; + Size = MAP_APPFONT ( 132 , 12 ) ; TABSTOP = TRUE ; LEFT = TRUE ; }; ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 6 , 33 ) ; + Pos = MAP_APPFONT ( 56 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; ImageButton BTN_RIGHT { - Pos = MAP_APPFONT ( 22 , 33 ) ; + Pos = MAP_APPFONT ( 75 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; Symbol = IMAGEBUTTON_ARROW_RIGHT ; }; - FixedText FT_WORD + OKButton BTN_HYPH_CUT { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 144 , 17 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "H~yphenate" ; + TABSTOP = TRUE ; + DEFBUTTON = TRUE ; }; PushButton BTN_HYPH_CONTINUE { - Pos = MAP_APPFONT ( 132 , 43 ) ; + Pos = MAP_APPFONT ( 144 , 35 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Next" ; + Text [ en-US ] = "~Skip" ; TABSTOP = TRUE ; }; PushButton BTN_HYPH_DELETE { - Pos = MAP_APPFONT ( 132 , 60 ) ; + Pos = MAP_APPFONT ( 144 , 52 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; Text [ en-US ] = "~Remove" ; TABSTOP = TRUE ; }; - OKButton BTN_HYPH_CUT + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 0 , 81 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + }; + HelpButton BTN_HYPH_HELP { - Pos = MAP_APPFONT ( 132 , 6 ) ; + Pos = MAP_APPFONT ( 5 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Hyphenate" ; TABSTOP = TRUE ; - DEFBUTTON = TRUE ; }; - CancelButton BTN_HYPH_CANCEL + PushButton BTN_HYPH_ALL { - Pos = MAP_APPFONT ( 132 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 63 , 93 ) ; + Size = MAP_APPFONT ( 74 , 14 ) ; + Text [ en-US ] = "Hyphenate ~All" ; TABSTOP = TRUE ; }; - HelpButton BTN_HYPH_HELP + CancelButton BTN_HYPH_CANCEL { - Pos = MAP_APPFONT ( 132 , 80 ) ; + Pos = MAP_APPFONT ( 144 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Close"; TABSTOP = TRUE ; }; }; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/makefile.mk b/cui/source/dialogs/makefile.mk index 0c5b90aff202..12239a1ac781 100644..100755 --- a/cui/source/dialogs/makefile.mk +++ b/cui/source/dialogs/makefile.mk @@ -57,6 +57,7 @@ SRC1FILES = \ insrc.src \ multipat.src \ newtabledlg.src \ + passwdomdlg.src \ postdlg.src \ scriptdlg.src \ sdrcelldlg.src \ @@ -95,6 +96,7 @@ SLOFILES+=\ $(SLO)$/multifil.obj \ $(SLO)$/multipat.obj \ $(SLO)$/newtabledlg.obj \ + $(SLO)$/passwdomdlg.obj \ $(SLO)$/pastedlg.obj \ $(SLO)$/plfilter.obj \ $(SLO)$/postdlg.obj \ diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx new file mode 100755 index 000000000000..5b768c756654 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.cxx @@ -0,0 +1,343 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_cui.hxx" + +// include --------------------------------------------------------------- + +#include "passwdomdlg.hrc" +#include "passwdomdlg.hxx" + +#include "cuires.hrc" +#include "dialmgr.hxx" + +#include <sfx2/tabdlg.hxx> +#include <tools/debug.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/button.hxx> +#include <vcl/morebtn.hxx> +#include <vcl/settings.hxx> +#include <vcl/msgbox.hxx> + + +////////////////////////////////////////////////////////////////////// + +class PasswordReenterEdit_Impl : public Edit +{ + String m_aDefaultTxt; + + // disallow use of copy c-tor and assignment operator + PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & ); + PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & ); + +public: + PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ); + virtual ~PasswordReenterEdit_Impl(); + + // Edit + virtual void Paint( const Rectangle& rRect ); +}; + + +PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) : + Edit( pParent, rResId ) +{ +// currently the spec does not want to display this text anymore... +// m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) ); +} + + +PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl() +{ +} + + +void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect ) +{ + if (GetText().Len() == 0) + { + Push( /*PUSH_FILLCOLOR | PUSH_TEXTFILLCOLOR |*/ PUSH_TEXTCOLOR ); +/* + Color aFillColor( GetParent()->GetBackground().GetColor() ); + SetLineColor(); // don't draw a border when painting the Edit field rectangle with the new background color + SetFillColor( aFillColor ); + SetTextFillColor( aFillColor ); + SetTextColor( GetParent()->GetTextColor() ); // use plain text color even if the Edit field is disabled (it is hard to read the text otherwise) + + DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); +*/ + SetTextColor( Color( COL_GRAY ) ); + DrawText( Point(), m_aDefaultTxt ); + + Pop(); + } + else + Edit::Paint( rRect ); +} + + +////////////////////////////////////////////////////////////////////// + +struct PasswordToOpenModifyDialog_Impl +{ + PasswordToOpenModifyDialog * m_pParent; + + FixedLine m_aFileEncryptionFL; + FixedText m_aPasswdToOpenFT; + Edit m_aPasswdToOpenED; + FixedText m_aReenterPasswdToOpenFT; + PasswordReenterEdit_Impl m_aReenterPasswdToOpenED; +// FixedImage m_aPasswdToOpenMatchFI; + FixedText m_aPasswdNoteFT; + FixedLine m_aButtonsFL; + MoreButton m_aMoreFewerOptionsBTN; + OKButton m_aOk; + CancelButton m_aCancel; + FixedLine m_aFileSharingOptionsFL; + CheckBox m_aOpenReadonlyCB; + FixedText m_aPasswdToModifyFT; + Edit m_aPasswdToModifyED; + FixedText m_aReenterPasswdToModifyFT; + PasswordReenterEdit_Impl m_aReenterPasswdToModifyED; +// FixedImage m_aPasswdToModifyMatchFI; + + String m_aOneMismatch; + String m_aTwoMismatch; + String m_aInvalidStateForOkButton; + String m_aInvalidStateForOkButton_v2; + + bool m_bIsPasswordToModify; + + +// DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( OkBtnClickHdl, OKButton * ); + + PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent, + sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); + ~PasswordToOpenModifyDialog_Impl(); +}; + + +PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( + PasswordToOpenModifyDialog * pParent, + sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen, + bool bIsPasswordToModify ) : + m_pParent( pParent ), + m_aFileEncryptionFL ( pParent, CUI_RES( FL_FILE_ENCRYPTION ) ), + m_aPasswdToOpenFT ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ), + m_aPasswdToOpenED ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ), + m_aReenterPasswdToOpenFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ), + m_aReenterPasswdToOpenED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ) ), +// m_aPasswdToOpenMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_OPEN_MATCH ) ), + m_aPasswdNoteFT ( pParent, CUI_RES( FT_PASSWD_NOTE ) ), + m_aButtonsFL ( pParent, CUI_RES( FL_BUTTONS ) ), + m_aMoreFewerOptionsBTN ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ), + m_aOk ( pParent, CUI_RES( BTN_OK ) ), + m_aCancel ( pParent, CUI_RES( BTN_CANCEL ) ), + m_aFileSharingOptionsFL ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ), + m_aOpenReadonlyCB ( pParent, CUI_RES( CB_OPEN_READONLY ) ), + m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ), + m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ), + m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ), + m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ), +// m_aPasswdToModifyMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_MODIFY_MATCH ) ) + m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ), + m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ), + m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ), + m_aInvalidStateForOkButton_v2( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON_V2 ) ), + m_bIsPasswordToModify( bIsPasswordToModify ) +{ +/* + const sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); + const Image aImage( CUI_RES( bHighContrast ? IMG_PASSWD_MATCH_HC : IMG_PASSWD_MATCH ) ); + m_aPasswdToOpenMatchFI.SetImage( aImage ); + m_aPasswdToModifyMatchFI.SetImage( aImage ); +*/ + + m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) ); + m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) ); + +#if 0 + Link aModifyLink = LINK( this, PasswordToOpenModifyDialog_Impl, ModifyHdl ); + m_aPasswdToOpenED.SetModifyHdl( aModifyLink ); + m_aReenterPasswdToOpenED.SetModifyHdl( aModifyLink ); + m_aPasswdToModifyED.SetModifyHdl( aModifyLink ); + m_aReenterPasswdToModifyED.SetModifyHdl( aModifyLink ); +#endif + + m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) ); + +// m_aOk.Enable( FALSE ); + + if (nMaxPasswdLen) + { + m_aPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); + m_aReenterPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); + m_aPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); + m_aReenterPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); + } + + (void) nMinPasswdLen; // currently not supported + + m_aPasswdToOpenED.GrabFocus(); + +// ModifyHdl( NULL ); + + m_aMoreFewerOptionsBTN.Enable( bIsPasswordToModify ); + if (!bIsPasswordToModify) + m_aMoreFewerOptionsBTN.Hide( TRUE ); +} + + +PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl() +{ +} + +#if 0 +IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, EMPTYARG /*pEdit*/ ) +{ + // force repaints to get the m_aDefaultTxt displayed again + if (m_aReenterPasswdToOpenED.GetText().Len() == 0) + m_aReenterPasswdToOpenED.Invalidate(); + if (m_aReenterPasswdToModifyED.GetText().Len() == 0) + m_aReenterPasswdToModifyED.Invalidate(); + + const sal_Int32 nPasswdToOpenLen = m_aPasswdToOpenED.GetText().Len(); + const sal_Int32 nPasswdToModifyLen = m_aPasswdToModifyED.GetText().Len(); + + const bool bBothEmpty = nPasswdToOpenLen == 0 && nPasswdToModifyLen == 0; + const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); + const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); + + m_aOk.Enable( bToOpenMatch && bToModifyMatch && !bBothEmpty ); + +// m_aPasswdToOpenMatchFI.Enable( bToOpenMatch && !bBothEmpty ); +// m_aPasswdToModifyMatchFI.Enable( bToModifyMatch && !bBothEmpty ); + + return 0; +} +#endif + + +IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ ) +{ + bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() && + m_aPasswdToOpenED.GetText().Len() == 0 && + m_aPasswdToModifyED.GetText().Len() == 0; + if (bInvalidState) + { + ErrorBox aErrorBox( m_pParent, WB_OK, + m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2 ); + aErrorBox.Execute(); + } + else // check for mismatched passwords... + { + const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); + const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); + const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); + if (nMismatch > 0) + { + ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch ); + aErrorBox.Execute(); + + Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED; + PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED; + String aEmpty; + if (nMismatch == 1) + { + rEdit.SetText( aEmpty ); + rRepeatEdit.SetText( aEmpty ); + } + else if (nMismatch == 2) + { + m_aPasswdToOpenED.SetText( aEmpty ); + m_aReenterPasswdToOpenED.SetText( aEmpty ); + m_aPasswdToModifyED.SetText( aEmpty ); + m_aReenterPasswdToModifyED.SetText( aEmpty ); + } + rEdit.GrabFocus(); + } + else + { + m_pParent->EndDialog( RET_OK ); + } + } + + return 0; +} + +////////////////////////////////////////////////////////////////////// + + +PasswordToOpenModifyDialog::PasswordToOpenModifyDialog( + Window * pParent, + sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen, + bool bIsPasswordToModify ) : + SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) ) +{ + m_pImpl = std::auto_ptr< PasswordToOpenModifyDialog_Impl >( + new PasswordToOpenModifyDialog_Impl( this, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ) ); + + FreeResource(); +} + + +PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog() +{ +} + + +String PasswordToOpenModifyDialog::GetPasswordToOpen() const +{ + const bool bPasswdOk = + m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 && + m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText(); + return bPasswdOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String(); +} + + +String PasswordToOpenModifyDialog::GetPasswordToModify() const +{ + const bool bPasswdOk = + m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 && + m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText(); + return bPasswdOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String(); +} + + +bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const +{ + return m_pImpl->m_aOpenReadonlyCB.IsChecked(); +} + + +////////////////////////////////////////////////////////////////////// + diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc new file mode 100755 index 000000000000..522e4edf1da2 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.hrc @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CUI_PASSWDOMDLG_HRC_ +#define _CUI_PASSWDOMDLG_HRC_ + +#define FL_FILE_ENCRYPTION 10 +#define FT_PASSWD_TO_OPEN 11 +#define ED_PASSWD_TO_OPEN 12 +#define FT_REENTER_PASSWD_TO_OPEN 13 +#define ED_REENTER_PASSWD_TO_OPEN 14 +#define IMG_PASSWD_MATCH 15 +#define IMG_PASSWD_MATCH_HC 16 +#define FT_PASSWD_NOTE 17 +#define FL_BUTTONS 18 +#define BTN_MORE_FEWER_OPTIONS 19 +#define BTN_OK 20 +#define BTN_CANCEL 21 +#define FL_FILE_SHARING_OPTIONS 22 +#define FT_PASSWD_TO_MODIFY 23 +#define ED_PASSWD_TO_MODIFY 24 +#define FT_REENTER_PASSWD_TO_MODIFY 25 +#define ED_REENTER_PASSWD_TO_MODIFY 26 +#define FI_PASSWD_TO_OPEN_MATCH 27 +#define FI_PASSWD_TO_MODIFY_MATCH 28 +#define CB_OPEN_READONLY 29 + +#define STR_MORE_OPTIONS 51 +#define STR_FEWER_OPTIONS 52 +#define STR_PASSWD_MUST_BE_CONFIRMED 53 +#define STR_ONE_PASSWORD_MISMATCH 54 +#define STR_TWO_PASSWORDS_MISMATCH 55 +#define STR_INVALID_STATE_FOR_OK_BUTTON 56 +#define STR_INVALID_STATE_FOR_OK_BUTTON_V2 57 + +#endif + diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src new file mode 100755 index 000000000000..edb84813d387 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.src @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <cuires.hrc> +#include "passwdomdlg.hrc" +#include "helpid.hrc" + + +ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY +{ + Size = MAP_APPFONT( 171, 150 ); + Text [ en-US ] = "Set Password"; + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY; + Border = TRUE ; + Moveable = TRUE ; + OutputSize = TRUE ; + SVLook = TRUE ; + + FixedLine FL_FILE_ENCRYPTION + { + Pos = MAP_APPFONT( 3, 3 ); + Size = MAP_APPFONT( 165, 8 ); + Text [ en-US ] = "File encryption password"; + }; + + FixedText FT_PASSWD_TO_OPEN + { + Pos = MAP_APPFONT( 6, 17 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "~Enter password to open"; + WordBreak = TRUE; + }; + + Edit ED_PASSWD_TO_OPEN + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN; + Pos = MAP_APPFONT( 6, 28 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; + + FixedText FT_REENTER_PASSWD_TO_OPEN + { + Pos = MAP_APPFONT( 6, 45 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Confirm password"; + WordBreak = TRUE; + }; + + Edit ED_REENTER_PASSWD_TO_OPEN + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN; + Pos = MAP_APPFONT( 6, 56 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; +/* + FixedImage FI_PASSWD_TO_OPEN_MATCH + { + Pos = MAP_APPFONT ( 150, 42 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + }; +*/ + FixedText FT_PASSWD_NOTE + { + Pos = MAP_APPFONT( 6, 80 ); + Size = MAP_APPFONT( 159, 4*8 ); // some extra space for translation in other languages + Text [ en-US ] = "Note: After a password has been set, the document will only open with "\ + "the password. Should you lose the password, there will be no way to "\ + "recover the document. Please also note that this password is case-sensitive."; + WordBreak = TRUE; + }; + + FixedLine FL_BUTTONS + { + Pos = MAP_APPFONT( 0, 117 ); + Size = MAP_APPFONT( 171, 8 ); + }; + + MoreButton BTN_MORE_FEWER_OPTIONS + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE; + Pos = MAP_APPFONT( 6 , 130 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; + Delta = 92 ; + MapUnit = MAP_APPFONT ; + State = FALSE ; + }; + + OKButton BTN_OK + { + Pos = MAP_APPFONT( 62, 130 ); + Size = MAP_APPFONT( 50, 14 ); + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT( 115, 130 ); + Size = MAP_APPFONT( 50, 14 ); + }; + + FixedLine FL_FILE_SHARING_OPTIONS + { + Pos = MAP_APPFONT( 3, 154 ); + Size = MAP_APPFONT( 165, 8 ); + Text [ en-US ] = "File sharing password"; + }; + + CheckBox CB_OPEN_READONLY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY; + Pos = MAP_APPFONT( 6, 170 ); + Size = MAP_APPFONT( 159, 8 ); + + Text [ en-US ] = "Open file read-only"; + }; + + FixedText FT_PASSWD_TO_MODIFY + { + Pos = MAP_APPFONT( 6, 186 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Enter password to allow editing"; + WordBreak = TRUE; + }; + + Edit ED_PASSWD_TO_MODIFY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY; + Pos = MAP_APPFONT( 6, 196 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; + + FixedText FT_REENTER_PASSWD_TO_MODIFY + { + Pos = MAP_APPFONT( 6, 214 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Confirm password"; + WordBreak = TRUE; + }; + + Edit ED_REENTER_PASSWD_TO_MODIFY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY; + Pos = MAP_APPFONT( 6, 224 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; +/* + FixedImage FI_PASSWD_TO_MODIFY_MATCH + { + Pos = MAP_APPFONT ( 150, 224 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + }; +*/ + + String STR_PASSWD_MUST_BE_CONFIRMED + { + Text [ en-US ] = "Password must be confirmed" ; + }; + + String STR_MORE_OPTIONS + { + Text [ en-US ] = "More ~Options" ; + }; + + String STR_FEWER_OPTIONS + { + Text [ en-US ] = "Fewer ~Options" ; + }; + + String STR_ONE_PASSWORD_MISMATCH + { + Text [ en-US ] = "The confirmation password did not match the password. Set the password again by entering the same password in both boxes." ; + }; + + String STR_TWO_PASSWORDS_MISMATCH + { + Text [ en-US ] = "The confirmation passwords did not match the original passwords. Set the passwords again." ; + }; + + String STR_INVALID_STATE_FOR_OK_BUTTON + { + Text [ en-US ] = "Please enter a password to open or to modify, or check the open read-only option to continue." ; + }; +/* + Image IMG_PASSWD_MATCH + { + ImageBitmap = Bitmap { File = "apply.png"; }; + }; + + Image IMG_PASSWD_MATCH_HC + { + ImageBitmap = Bitmap { File = "apply_h.png"; }; + }; +*/ +}; + diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index c1a96541c5b7..bf617b126747 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -26,10 +26,21 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_cui.hxx" +#include "thesdlg.hrc" +#include "thesdlg.hxx" +#include "thesdlg_impl.hxx" +#include "cuires.hrc" +#include "dialmgr.hxx" + +#include <editeng/unolingu.hxx> #include <tools/shl.hxx> #include <svl/lngmisc.hxx> +#include <svtools/filter.hxx> +#include <svtools/svlbitm.hxx> +#include <svtools/svtreebx.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> @@ -39,25 +50,28 @@ #include <svx/dlgutil.hxx> #include <svx/dialmgr.hxx> #include <svx/svxerr.hxx> -#include "cuires.hrc" -#include "thesdlg.hrc" #include <editeng/unolingu.hxx> #include <svx/langbox.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" -#include <svx/dialogs.hrc> -#include <editeng/editerr.hxx> +#include <unotools/lingucfg.hxx> +#include <i18npool/mslangid.hxx> +#include <comphelper/processfactory.hxx> +#include <osl/file.hxx> + + +#include <stack> +#include <algorithm> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +using ::rtl::OUString; + + +#define A2S(x) String::CreateFromAscii( x ) -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) // GetReplaceEditString ------------------------------- @@ -89,171 +103,237 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } -// struct ThesDlg_Impl --------------------------------------------------- +// class LookUpComboBox_Impl -------------------------------------------------- -struct ThesDlg_Impl +LookUpComboBox_Impl::LookUpComboBox_Impl( + Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : + ComboBox (pParent, rResId), + m_rDialogImpl( rImpl ) { - Reference< XThesaurus > xThesaurus; - ::rtl::OUString aLookUpText; - sal_Int16 nLookUpLanguage; + m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); + m_aModifyTimer.SetTimeout( 500 ); + + EnableAutocomplete( FALSE ); +} - ThesDlg_Impl( Reference< XThesaurus > & xThes ); - SfxErrorContext* pErrContext; // ErrorContext, - // w"ahrend der Dialog oben ist -}; -ThesDlg_Impl::ThesDlg_Impl(Reference< XThesaurus > & xThes) : - xThesaurus (xThes) +LookUpComboBox_Impl::~LookUpComboBox_Impl() { - pErrContext = NULL; - nLookUpLanguage = LANGUAGE_NONE; } -// class SvxThesaurusLanguageDlg_Impl ------------------------------------ +void LookUpComboBox_Impl::Modify() +{ + m_aModifyTimer.Start(); +} + -class SvxThesaurusLanguageDlg_Impl : public ModalDialog +IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) { -private: - SvxLanguageBox aLangLB; - FixedLine aLangFL; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; + m_rDialogImpl.LookUp( GetText() ); + m_aModifyTimer.Stop(); + return 0; +} - DECL_LINK( DoubleClickHdl_Impl, ListBox * ); -public: - SvxThesaurusLanguageDlg_Impl( Window* pParent ); +// class ReplaceEdit_Impl -------------------------------------------------- - sal_uInt16 GetLanguage() const; - void SetLanguage( sal_uInt16 nLang ); -}; +ReplaceEdit_Impl::ReplaceEdit_Impl( + Window *pParent, const ResId &rResId ) : + Edit (pParent, rResId) +{ +} -// ----------------------------------------------------------------------- +ReplaceEdit_Impl::~ReplaceEdit_Impl() +{ +} -SvxThesaurusLanguageDlg_Impl::SvxThesaurusLanguageDlg_Impl( Window* pParent ) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_THES_LANGUAGE ) ), +void ReplaceEdit_Impl::Modify() +{ + if (m_pBtn) + m_pBtn->Enable( GetText().Len() > 0 ); +} - aLangLB ( this, CUI_RES( LB_THES_LANGUAGE ) ), - aLangFL ( this, CUI_RES( FL_THES_LANGUAGE ) ), - aOKBtn ( this, CUI_RES( BTN_LANG_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_LANG_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_LANG_HELP ) ) +void ReplaceEdit_Impl::SetText( const XubString& rStr ) { - FreeResource(); + Edit::SetText( rStr ); + Modify(); +} - aLangLB.SetLanguageList( LANG_LIST_THES_USED, FALSE, FALSE ); - aLangLB.SetDoubleClickHdl( - LINK( this, SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl ) ); + +void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) +{ + Edit::SetText( rStr, rNewSelection ); + Modify(); } -// ----------------------------------------------------------------------- +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- -sal_uInt16 SvxThesaurusLanguageDlg_Impl::GetLanguage() const +void AlternativesString_Impl::Paint( + const Point& rPos, + SvLBox& rDev, USHORT, + SvLBoxEntry* pEntry ) { - sal_uInt16 nLang = aLangLB.GetSelectLanguage(); - return nLang; + AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); + Point aPos( rPos ); + Font aOldFont( rDev.GetFont()); + if (pData && pData->IsHeader()) + { + Font aFont( aOldFont ); + aFont.SetWeight( WEIGHT_BOLD ); + rDev.SetFont( aFont ); + aPos.X() = 0; + } + else + aPos.X() += 5; + rDev.DrawText( aPos, GetText() ); + rDev.SetFont( aOldFont ); } -// ----------------------------------------------------------------------- -void SvxThesaurusLanguageDlg_Impl::SetLanguage( sal_uInt16 nLang ) +ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( + Window* pParent, + SvxThesaurusDialog_Impl &rImpl ) : + SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), + m_rDialogImpl( rImpl ) { - aLangLB.SelectLanguage( nLang ); + SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetHighlightRange(); } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) +ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() { - EndDialog( RET_OK ); - return 0; + ClearUserData(); } -IMPL_LINK_INLINE_END( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) -// class SvxThesaurusDialog ---------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::ClearUserData() +{ + for (USHORT i = 0; i < GetEntryCount(); ++i) + delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); +} -// ----------------------------------------------------------------------- - - -SvxThesaurusDialog::SvxThesaurusDialog( Window* pParent, Reference< XThesaurus > xThes, - const String &rWord, sal_Int16 nLanguage) : - - SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ), - - aWordText ( this, CUI_RES( FT_WORD ) ), - aWordLB ( this, CUI_RES( LB_WORD ) ), - aReplaceText( this, CUI_RES( FT_REPL ) ), - aReplaceEdit( this, CUI_RES( ED_REPL ) ), - aMeanText ( this, CUI_RES( FT_MEAN ) ), - aMeanLB ( this, CUI_RES( LB_MEAN ) ), - aSynonymText( this, CUI_RES( FT_SYNON ) ), - aSynonymLB ( this, CUI_RES( LB_SYNON ) ), - aVarFL ( this, CUI_RES( FL_VAR ) ), - aOkBtn ( this, CUI_RES( BTN_THES_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_THES_CANCEL ) ), - aLookUpBtn ( this, CUI_RES( BTN_LOOKUP ) ), - aLangBtn ( this, CUI_RES( BTN_LANGUAGE ) ), - aHelpBtn ( this, CUI_RES( BTN_THES_HELP ) ), - aErrStr ( CUI_RES( STR_ERR_WORDNOTFOUND ) ) -{ - pImpl = new ThesDlg_Impl( xThes ); - pImpl->aLookUpText = ::rtl::OUString( rWord ); - pImpl->nLookUpLanguage = nLanguage; - pImpl->pErrContext = - new SfxErrorContext( ERRCTX_SVX_LINGU_THESAURUS, String(), this, - RID_SVXERRCTX, &DIALOG_MGR() ); - - aLangBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); - aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); - aMeanLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, EntryHdl_Impl ) ); - aSynonymLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, SynonymHdl_Impl ) ); - Link aLink = LINK( this, SvxThesaurusDialog, SelectHdl_Impl ); - aMeanLB.SetDoubleClickHdl( aLink ); - aSynonymLB.SetDoubleClickHdl( aLink ); - aWordLB.SetSelectHdl( aLink ); - FreeResource(); +SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + String aText; + if (bIsHeader && nVal >= 0) + { + aText = String::CreateFromInt32( nVal ); + aText += A2S( ". " ); + } + pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column + aText += rText; + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash + pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, aText ) ); - ::rtl::OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - aReplaceEdit.SetText( aTmp ); - aWordLB.InsertEntry( aTmp ); - aWordLB.SelectEntry( aTmp ); + AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); + pEntry->SetUserData( pUserData ); + GetModel()->Insert( pEntry ); - Init_Impl( nLanguage ); + if (bIsHeader) + GetViewDataEntry( pEntry )->SetSelectable( false ); - // disable controls if service is missing - if (!pImpl->xThesaurus.is()) - Enable( sal_False ); + return pEntry; } -// ----------------------------------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode& rKey = rKEvt.GetKeyCode(); + + if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) + GetParent()->KeyInput( rKEvt ); // parent will close dialog... + else if (rKey.GetCode() == KEY_SPACE) + m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry + else if (GetEntryCount()) + SvxCheckListBox::KeyInput( rKEvt ); +} -SvxThesaurusDialog::~SvxThesaurusDialog() + +void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) +{ + if (!m_rDialogImpl.m_bWordFound) + { +/* Push( PUSH_FONT ); + + Font aFont( GetFont() ); + aFont.SetHeight( 2 * aFont.GetHeight() ); + SetFont( aFont ); +*/ + Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); + aTextSize = LogicToPixel( aTextSize ); + Point aPos; + aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; + aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; + aPos = PixelToLogic( aPos ); + DrawText( aPos, m_rDialogImpl.aErrStr ); + +// Pop(); + } + else + SvxCheckListBox::Paint( rRect ); +} + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : + m_pDialog ( pDialog ), + aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aWordText ( pDialog, CUI_RES( FT_WORD ) ), + aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), + m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), + m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), + aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), + aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), + aFL ( pDialog, CUI_RES( FL_VAR ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), + aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), + aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), + aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), + aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), + aVendorDefaultImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ), + xThesaurus ( NULL ), + aLookUpText (), + nLookUpLanguage ( LANGUAGE_NONE ), + m_bWordFound( false ) +{ + // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog + + aReplaceEdit.SetButton( &aReplaceBtn ); + + aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); + aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); + aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); + m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); + m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); + + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); +} + + +SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() { - delete pImpl->pErrContext; - delete pImpl; + delete aLangMBtn.GetPopupMenu(); } -// ----------------------------------------------------------------------- -uno::Sequence< Reference< XMeaning > > SAL_CALL - SvxThesaurusDialog::queryMeanings_Impl( - ::rtl::OUString& rTerm, - const Locale& rLocale, - const beans::PropertyValues& rProperties ) - throw(lang::IllegalArgumentException, uno::RuntimeException) +uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( + OUString& rTerm, + const lang::Locale& rLocale, + const beans::PropertyValues& rProperties ) + throw(lang::IllegalArgumentException, uno::RuntimeException) { - uno::Sequence< Reference< XMeaning > > aMeanings( - pImpl->xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( + xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); // text with '.' at the end? if (0 == aMeanings.getLength() && rTerm.getLength() && @@ -263,7 +343,7 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL // end of a sentence and not an abbreviation... String aTxt( rTerm ); aTxt.EraseTrailingChars( '.' ); - aMeanings = pImpl->xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); + aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); if (aMeanings.getLength()) { rTerm = aTxt; @@ -273,220 +353,394 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; } -// ----------------------------------------------------------------------- -sal_uInt16 SvxThesaurusDialog::GetLanguage() const +bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() { - return pImpl->nLookUpLanguage; + lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( + aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); + const sal_Int32 nMeanings = aMeanings.getLength(); + const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); + + m_pAlternativesCT->SetUpdateMode( FALSE ); + + // clear old user data of control before creating new ones via AddEntry below + m_pAlternativesCT->ClearUserData(); + + m_pAlternativesCT->Clear(); + for (sal_Int32 i = 0; i < nMeanings; ++i) + { + OUString rMeaningTxt = pMeanings[i]->getMeaning(); + uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); + const sal_Int32 nSynonyms = aSynonyms.getLength(); + const OUString *pSynonyms = aSynonyms.getConstArray(); + DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); + DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); + + m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); + for (sal_Int32 k = 0; k < nSynonyms; ++k) + m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); + } + + m_pAlternativesCT->SetUpdateMode( TRUE ); + + return nMeanings > 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateMeaningBox_Impl( uno::Sequence< Reference< XMeaning > > *pMeaningSeq ) +void SvxThesaurusDialog_Impl::LookUp( const String &rText ) { - // create temporary meaning list if not supplied from somewhere else - sal_Bool bTmpSeq = sal_False; - if (!pMeaningSeq && pImpl->xThesaurus.is()) - { - bTmpSeq = sal_True; - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - uno::Sequence< Reference< XMeaning > > aTmpMean = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ); + if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same + aWordCB.SetText( rText ); + LookUp_Impl(); +} - pMeaningSeq = new Sequence< Reference< XMeaning > > ( aTmpMean ); - // set new replace edit text if a different look up text was used - // see: queryMeanings_Impl - aReplaceEdit.SetText( pImpl->aLookUpText ); +IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) +{ + if (pBtn && aLookUpHistory.size() >= 2) + { + aLookUpHistory.pop(); // remove current look up word from stack + aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word + aLookUpHistory.pop(); + LookUp_Impl(); } + return 0; +} - sal_Int32 nMeaningCount = pMeaningSeq ? pMeaningSeq->getLength() : 0; - const Reference< XMeaning > *pMeaning = pMeaningSeq ? pMeaningSeq->getConstArray() : NULL; - aMeanLB.Clear(); - for ( sal_Int32 i = 0; i < nMeaningCount; ++i ) - aMeanLB.InsertEntry( pMeaning[i]->getMeaning() ); - - // remove temporary meaning list - if (bTmpSeq) - delete pMeaningSeq; - if (aMeanLB.GetEntryCount() > 0) - aMeanLB.SelectEntryPos(0); - UpdateSynonymBox_Impl(); +IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) +{ + PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); + if (pMenu && pBtn) + { + USHORT nItem = pBtn->GetCurItemId(); + String aLangText( pMenu->GetItemText( nItem ) ); + LanguageType nLang = SvtLanguageTable().GetType( aLangText ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + nLookUpLanguage = nLang; + m_pDialog->SetWindowTitle( nLang ); + UpdateVendorImage(); + LookUp_Impl(); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateSynonymBox_Impl() +void SvxThesaurusDialog_Impl::LookUp_Impl() { + String aText( aWordCB.GetText() ); + + aLookUpText = OUString( aText ); + if (aLookUpText.getLength() > 0 && + (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) + aLookUpHistory.push( aLookUpText ); + + m_bWordFound = UpdateAlternativesBox_Impl(); + m_pAlternativesCT->Enable( m_bWordFound ); - aSynonymLB.Clear(); + if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) + aWordCB.InsertEntry( aText ); - sal_uInt16 nPos = aMeanLB.GetSelectEntryPos(); // active meaning pos - if (nPos != LISTBOX_ENTRY_NOTFOUND && pImpl->xThesaurus.is()) + aReplaceEdit.SetText( String() ); + aLeftBtn.Enable( aLookUpHistory.size() > 1 ); +} + + +IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) +{ + if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys { - // get Reference< XMeaning > for selected meaning - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - Reference< XMeaning > xMeaning = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ) - .getConstArray()[ nPos ]; - - uno::Sequence< ::rtl::OUString > aSynonyms; - if (xMeaning.is()) - aSynonyms = xMeaning->querySynonyms(); - - sal_Int32 nSynonymCount = aSynonyms.getLength(); - const ::rtl::OUString *pSynonym = aSynonyms.getConstArray(); - for ( sal_Int32 i=0; i < nSynonymCount; ++i ) - aSynonymLB.InsertEntry( pSynonym[i] ); + USHORT nPos = pBox->GetSelectEntryPos(); + String aStr( pBox->GetEntry( nPos ) ); + GetReplaceEditString( aStr ); + aWordCB.SetText( aStr ); + LookUp_Impl(); } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Apply() +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) { + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } + aReplaceEdit.SetText( aStr ); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Init_Impl(sal_Int16 nLanguage) + +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) { - // Sprache anpassen - String aStr( GetText() ); - aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); - aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); - //aStr += GetLanguageString( (LanguageType)pImpl->pThesaurus->GetLanguage() ); - aStr += SvtLanguageTable::GetLanguageString( (LanguageType) nLanguage ); - aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // Text der Window-Leiste setzen (Wort + Sprache) + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } - // adapt meanings according to (new) language - UpdateMeaningBox_Impl(); + aWordCB.SetText( aStr ); + if (aStr.Len() > 0) + LookUp_Impl(); + } + + //! workaround to set the selection since calling SelectEntryPos within + //! the double click handler does not work + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); + return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { + (void) pThis; + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; +} - EnterWait(); +//////////////////////////////////////////////////////////// - String aText( aReplaceEdit.GetText() ); +static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) +{ + Image aRes; + + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} - ::rtl::OUString aOldLookUpText = pImpl->aLookUpText; - pImpl->aLookUpText = ::rtl::OUString( aText ); - uno::Sequence< Reference< XMeaning > > aMeanings; - if (pImpl->xThesaurus.is()) - aMeanings = queryMeanings_Impl( - pImpl->aLookUpText, - SvxCreateLocale( pImpl->nLookUpLanguage ), - Sequence< PropertyValue >() ); +static String lcl_GetThesImplName( const lang::Locale &rLocale ) +{ + String aRes; - LeaveWait(); - if ( aMeanings.getLength() == 0 ) + uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; + try { - if( pBtn == &aCancelBtn ) // called via double click - { - pImpl->aLookUpText = aOldLookUpText; - } - else + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + + DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); + if (xLngMgr.is()) { - UpdateMeaningBox_Impl( &aMeanings ); - if( pBtn == &aLookUpBtn ) - InfoBox( this, aErrStr ).Execute(); + uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; } - return 0; + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); } - UpdateMeaningBox_Impl( &aMeanings ); + return aRes; +} - if ( aWordLB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - aWordLB.InsertEntry( aText ); - aWordLB.SelectEntry( aText ); - aMeanLB.SelectEntryPos( 0 ); +void SvxThesaurusDialog_Impl::UpdateVendorImage() +{ + m_pDialog->SetUpdateMode( sal_False ); - String aStr( aMeanLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); - aSynonymLB.SetNoSelection(); + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) + { + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - return 0; + Image aImage; + String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); + OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); + else + aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; + aVendorImageFI.SetImage( aImage ); + } + + m_pDialog->SetUpdateMode( sal_True ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, Button *, EMPTYARG ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) { - if (!pImpl->xThesaurus.is()) - return 0; + pThis->m_pDialog->SetUpdateMode( sal_False ); - SvxThesaurusLanguageDlg_Impl aDlg( this ); - sal_uInt16 nLang = pImpl->nLookUpLanguage; - aDlg.SetLanguage( nLang ); - - if ( aDlg.Execute() == RET_OK ) + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) { - nLang = aDlg.GetLanguage(); - if (pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - pImpl->nLookUpLanguage = nLang; - UpdateMeaningBox_Impl(); - Init_Impl( nLang ); + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); + pThis->aVendorImageFI.SetImage( aImage ); + pThis->aVendorImageFI.Show(); + + // move down visible controls according to the vendor images height + Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); + Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); + if (aImageSize.Height()) + { + aVendorSize.Height() = aImageSize.Height(); + if(aVendorSize.Width() < aImageSize.Width()) + aVendorSize.Width() = aImageSize.Width(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + } + const sal_Int32 nDiff = aVendorSize.Height(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + Control* aControls[] = { + &pThis->aLeftBtn, + &pThis->aWordText, + &pThis->aWordCB, + &pThis->m_aAlternativesText, + pThis->m_pAlternativesCT.get(), + &pThis->aReplaceText, + &pThis->aReplaceEdit, + &pThis->aFL, + &pThis->aHelpBtn, + &pThis->aLangMBtn, + &pThis->aReplaceBtn, + &pThis->aCancelBtn, + 0 + }; + sal_Int32 nControl = 0; + while (aControls[nControl]) + { + Point aPos = aControls[nControl]->GetPosPixel(); + aPos.Y() += nDiff; + aControls[nControl]->SetPosPixel(aPos); + ++nControl; + } + Size aDlgSize = pThis->m_pDialog->GetSizePixel(); + aDlgSize.Height() += nDiff; + pThis->m_pDialog->SetSizePixel( aDlgSize ); + pThis->m_pDialog->Invalidate(); } + pThis->UpdateVendorImage(); + pThis->m_pDialog->SetUpdateMode( sal_True ); + return 0; -} +}; -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SynonymHdl_Impl, ListBox *, EMPTYARG ) +// class SvxThesaurusDialog ---------------------------------------------- + +SvxThesaurusDialog::SvxThesaurusDialog( + Window* pParent, + uno::Reference< linguistic2::XThesaurus > xThes, + const String &rWord, + LanguageType nLanguage ) : + + SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) { - if ( aSynonymLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); + + m_pImpl->xThesaurus = xThes; + m_pImpl->aLookUpText = OUString( rWord ); + m_pImpl->nLookUpLanguage = nLanguage; + if (rWord.Len() > 0) + m_pImpl->aLookUpHistory.push( rWord ); + + FreeResource(); + + OUString aTmp( rWord ); + linguistic::RemoveHyphens( aTmp ); + linguistic::ReplaceControlChars( aTmp ); + String aTmp2( aTmp ); + m_pImpl->aReplaceEdit.SetText( aTmp2 ); + m_pImpl->aWordCB.InsertEntry( aTmp2 ); + + m_pImpl->LookUp( aTmp2 ); + m_pImpl->m_pAlternativesCT->GrabFocus(); + m_pImpl->aLeftBtn.Enable( sal_False ); + + // fill language menu button list + SvtLanguageTable aLangTab; + uno::Sequence< lang::Locale > aLocales; + if (m_pImpl->xThesaurus.is()) + aLocales = m_pImpl->xThesaurus->getLocales(); + const sal_Int32 nLocales = aLocales.getLength(); + const lang::Locale *pLocales = aLocales.getConstArray(); + delete m_pImpl->aLangMBtn.GetPopupMenu(); + PopupMenu* pMenu = new PopupMenu; + pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); + std::vector< OUString > aLangVec; + for (sal_Int32 i = 0; i < nLocales; ++i ) { - String aStr( aSynonymLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); + const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + aLangVec.push_back( aLangTab.GetString( nLang ) ); } - return 0; + std::sort( aLangVec.begin(), aLangVec.end() ); + for (size_t i = 0; i < aLangVec.size(); ++i) + pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); + + SetWindowTitle( nLanguage ); + + // disable controls if service is missing + if (!m_pImpl->xThesaurus.is()) + Enable( sal_False ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SelectHdl_Impl, ListBox *, pBox ) +SvxThesaurusDialog::~SvxThesaurusDialog() { - String aStr( pBox->GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); +} - //! 'aCancelBtn' is used to indicate that the handler is called as result - //! of a double click action. - LookUpHdl_Impl( &aCancelBtn /* ??? &aLookUpBtn */ ); - return 0; +void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) +{ + // Sprache anpassen + String aStr( GetText() ); + aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); + aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); + aStr += SvtLanguageTable().GetLanguageString( nLanguage ); + aStr.Append( sal_Unicode( ')' ) ); + SetText( aStr ); // set window title } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, EntryHdl_Impl, ListBox *, EMPTYARG ) +String SvxThesaurusDialog::GetWord() { + return m_pImpl->aReplaceEdit.GetText(); +} - UpdateSynonymBox_Impl(); - return 0; +sal_uInt16 SvxThesaurusDialog::GetLanguage() const +{ + return m_pImpl->nLookUpLanguage; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SpellErrorHdl_Impl, void *, pError ) +void SvxThesaurusDialog::Apply() { - // Der "ubergebene Pointer pError ist die falsche Sprachen-Nummer - LanguageType eLang = (LanguageType)(sal_uIntPtr)pError; - String aErr( SvtLanguageTable::GetLanguageString( eLang ) ); - // Fehlermeldung ausgeben - ErrorHandler::HandleError( - *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) ); - return 0; } + diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc index 9621422a1894..994c933246de 100644 --- a/cui/source/dialogs/thesdlg.hrc +++ b/cui/source/dialogs/thesdlg.hrc @@ -29,30 +29,23 @@ // defines --------------------------------------------------------------- +#define BTN_LEFT 9 #define BTN_THES_OK 10 #define BTN_THES_CANCEL 11 -#define BTN_LANGUAGE 12 +#define MB_LANGUAGE 12 #define BTN_THES_HELP 13 -#define BTN_LOOKUP 14 #define FT_WORD 15 -#define LB_WORD 16 -#define FT_MEAN 17 -#define LB_MEAN 18 -#define FT_SYNON 19 -#define LB_SYNON 20 +#define CB_WORD 16 #define FT_REPL 21 #define ED_REPL 22 -#define FL_VAR 23 - -#define STR_ERR_WORDNOTFOUND 30 - -// LanguageDialog -------------------------------------------------------- - -#define LB_THES_LANGUAGE 10 -#define FL_THES_LANGUAGE 11 -#define BTN_LANG_OK 12 -#define BTN_LANG_CANCEL 12 -#define BTN_LANG_HELP 13 +#define FL_VAR 23 +#define FT_THES_ALTERNATIVES 24 +#define CT_THES_ALTERNATIVES 25 +#define IMG_VENDOR 26 +#define IMG_DEFAULT_VENDOR 27 +#define IMG_DEFAULT_VENDOR_HC 28 + +#define STR_ERR_TEXTNOTFOUND 101 #endif diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src index 84671c050e9a..cf5eac8e5a02 100644 --- a/cui/source/dialogs/thesdlg.src +++ b/cui/source/dialogs/thesdlg.src @@ -24,185 +24,123 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - // include --------------------------------------------------------------- + #include "cuires.hrc" #include "thesdlg.hrc" #include "helpid.hrc" #include <svx/svxids.hrc> // SID_THESAURUS -// pragma ---------------------------------------------------------------- // RID_SVXDLG_THES ------------------------------------------------------- ModalDialog RID_SVXDLG_THESAURUS { HelpId = CMD_SID_THESAURUS ; OutputSize = TRUE ; - Size = MAP_APPFONT ( 285 , 116 ) ; + Size = MAP_APPFONT ( 235, 230 ) ; Text [ en-US ] = "Thesaurus" ; - Moveable = TRUE ; SvLook = TRUE ; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 219 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL - { - Pos = MAP_APPFONT ( 219 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - PushButton BTN_LOOKUP + Moveable = TRUE ; + + FixedImage IMG_VENDOR { - Pos = MAP_APPFONT ( 219 , 40 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Search" ; + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime + Hide = TRUE; }; - PushButton BTN_LANGUAGE + + ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 219 , 57 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language..." ; - }; - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 219 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; + Pos = MAP_APPFONT ( 5 , 15 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + TABSTOP = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; FixedText FT_WORD { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 24 , 5 ) ; + Size = MAP_APPFONT ( 143 , 8 ) ; + Text [ en-US ] = "Current ~word" ; LEFT = TRUE ; }; - ListBox LB_WORD + ComboBox CB_WORD { DropDown = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 96 , 65 ) ; + Pos = MAP_APPFONT ( 24 , 16 ) ; + Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines }; - FixedText FT_MEAN + MenuButton MB_LANGUAGE { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Meaning " ; - LEFT = TRUE ; - }; - ListBox LB_MEAN - { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( 170 , 16 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Language" ; }; - FixedText FT_SYNON + + FixedText FT_THES_ALTERNATIVES { - Pos = MAP_APPFONT ( 111 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Sy~nonym" ; + Pos = MAP_APPFONT ( 5 , 33 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "~Alternatives" ; LEFT = TRUE ; }; - ListBox LB_SYNON + Control CT_THES_ALTERNATIVES { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control + Pos = MAP_APPFONT ( 5 , 45 ) ; + Size = MAP_APPFONT ( 225 , 121 ) ; + Border = TRUE; + TabStop = TRUE ; }; + FixedText FT_REPL { - Pos = MAP_APPFONT ( 111 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Replace" ; + Pos = MAP_APPFONT ( 5 , 173 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "Replace ~with" ; LEFT = TRUE ; }; Edit ED_REPL { BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 25 ) ; - Size = MAP_APPFONT ( 96 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 184 ) ; + Size = MAP_APPFONT ( 225 , 12 ) ; LEFT = TRUE ; }; FixedLine FL_VAR { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 207 , 8 ) ; - Text [ en-US ] = "Variations" ; + Pos = MAP_APPFONT ( 0 , 200 ) ; + Size = MAP_APPFONT ( 235 , 8 ) ; }; - String STR_ERR_WORDNOTFOUND + + HelpButton BTN_THES_HELP { - Text [ en-US ] = "Word not found in thesaurus" ; + Pos = MAP_APPFONT ( 5 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; -}; - // RID_SVXDLG_THES_LANGUAGE ---------------------------------------------- -ModalDialog RID_SVXDLG_THES_LANGUAGE -{ - HelpId = HID_THES_LANGUAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 170 , 86 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswhlen : Sprache auswhlen */ - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswhlen : Sprache auswhlen */ - Text [ en-US ] = "Select Language" ; - Moveable = TRUE ; - ListBox LB_THES_LANGUAGE + OkButton BTN_THES_OK { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 90 , 60 ) ; - Sort = TRUE ; + Pos = MAP_APPFONT ( 105 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Replace" ; + DefButton = TRUE ; }; - FixedLine FL_THES_LANGUAGE + CancelButton BTN_THES_CANCEL { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 102 , 8 ) ; - Text [ en-US ] = "Selection" ; + Pos = MAP_APPFONT ( 170 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; - OKButton BTN_LANG_OK + + String STR_ERR_TEXTNOTFOUND { - Pos = MAP_APPFONT ( 114 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; + Text [ en-US ] = "No alternatives found." ; }; - CancelButton BTN_LANG_CANCEL + + Image IMG_DEFAULT_VENDOR { - Pos = MAP_APPFONT ( 114 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01.png"; }; }; - HelpButton BTN_LANG_HELP + Image IMG_DEFAULT_VENDOR_HC { - Pos = MAP_APPFONT ( 114 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01h.png"; }; }; }; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx new file mode 100644 index 000000000000..70ce91391456 --- /dev/null +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_THESDLG_IMPL_HXX +#define _SVX_THESDLG_IMPL_HXX + +#include "thesdlg.hxx" + +#include <svtools/ehdl.hxx> +#include <svx/checklbx.hxx> +#include <vcl/button.hxx> +#include <vcl/combobox.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/image.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/timer.hxx> +#include <vcl/wrkwin.hxx> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> + +#include <stack> +#include <algorithm> + +using namespace ::com::sun::star; +using ::rtl::OUString; + +// class LookUpComboBox_Impl -------------------------------------------------- + +class LookUpComboBox_Impl : public ComboBox +{ + Timer m_aModifyTimer; + Selection m_aSelection; + Button * m_pBtn; + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + LookUpComboBox_Impl( const LookUpComboBox_Impl & ); + LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); + +public: + LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); + virtual ~LookUpComboBox_Impl(); + + DECL_LINK( ModifyTimer_Hdl, Timer * ); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // ComboBox + virtual void Modify(); +}; + +// class ReplaceEdit_Impl -------------------------------------------------- + +class ReplaceEdit_Impl : public Edit +{ + Button * m_pBtn; + + // disable copy c-tor and assignment operator + ReplaceEdit_Impl( const ReplaceEdit_Impl & ); + ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); + +public: + ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); + virtual ~ReplaceEdit_Impl(); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // Edit + virtual void Modify(); + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); +}; + +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- + +class AlternativesUserData_Impl +{ + String sText; + bool bHeader; + + // disable copy c-tor and assignment operator + AlternativesUserData_Impl( const AlternativesUserData_Impl & ); + AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & ); + +public: + AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + sText(rText), + bHeader(bIsHeader) + { + } + + bool IsHeader() const { return bHeader; } + const String& GetText() const { return sText; } +}; + + +class AlternativesString_Impl : public SvLBoxString +{ +public: + + AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) + : SvLBoxString( pEntry, nFlags, rStr ) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); +}; + + +class ThesaurusAlternativesCtrl_Impl : + public SvxCheckListBox +{ + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); + ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); + +public: + ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); + virtual ~ThesaurusAlternativesCtrl_Impl(); + + + SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); + void ClearUserData(); + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); +}; + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +struct SvxThesaurusDialog_Impl +{ + SvxThesaurusDialog * m_pDialog; + + FixedImage aVendorImageFI; + ImageButton aLeftBtn; + FixedText aWordText; + LookUpComboBox_Impl aWordCB; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + ReplaceEdit_Impl aReplaceEdit; + FixedLine aFL; + HelpButton aHelpBtn; + MenuButton aLangMBtn; + OKButton aReplaceBtn; + CancelButton aCancelBtn; + + String aErrStr; + Image aVendorDefaultImage; + Image aVendorDefaultImageHC; + + uno::Reference< linguistic2::XThesaurus > xThesaurus; + OUString aLookUpText; + LanguageType nLookUpLanguage; + std::stack< OUString > aLookUpHistory; + bool m_bWordFound; + + + // Handler + DECL_LINK( LeftBtnHdl_Impl, Button * ); + DECL_LINK( LanguageHdl_Impl, MenuButton * ); + DECL_LINK( LookUpHdl_Impl, Button * ); + DECL_LINK( WordSelectHdl_Impl, ComboBox * ); + DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); + DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); + + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); + + + SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ); + ~SvxThesaurusDialog_Impl(); + + uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL + queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); + + bool UpdateAlternativesBox_Impl(); + void UpdateVendorImage(); + void LookUp( const String &rText ); + void LookUp_Impl(); +}; + +#endif + diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 00412e7bf400..1f441d728d63 100644..100755 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -100,6 +100,7 @@ #include "macroass.hxx" #include "acccfg.hxx" #include "insrc.hxx" +#include "passwdomdlg.hxx" #include "hyphen.hxx" #include "thesdlg.hxx" @@ -162,6 +163,7 @@ IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl); IMPL_ABSTDLG_BASE(AbstractLinksDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSpellDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxPostItDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl); ////////////////////////////////////////////////////////////////////////// // VclAbstractDialog2_Impl @@ -983,6 +985,19 @@ Window * AbstractSvxPostItDialog_Impl::GetWindow() return (Window *)pDlg; } +String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToOpen() const +{ + return pDlg->GetPasswordToOpen(); +} +String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToModify() const +{ + return pDlg->GetPasswordToModify(); +} +bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const +{ + return pDlg->IsRecommendToOpenReadonly(); +} + // Create dialogs with simplest interface VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( Window* pParent, sal_uInt32 nResId ) { @@ -1946,3 +1961,13 @@ SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Wind { return new SvxInsRowColDlg( pParent, bCol, sHelpId ); } + +AbstractPasswordToOpenModifyDialog * AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( + Window * pParent, + sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) +{ + PasswordToOpenModifyDialog * pDlg = new PasswordToOpenModifyDialog( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ); + return new AbstractPasswordToOpenModifyDialog_Impl( pDlg ); +} + + diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index d57057501fe0..ac875d6fe24c 100644..100755 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -589,6 +589,19 @@ private: }; //add for SvxPostItDialog end +//for PasswordToOpenModifyDialog begin +class PasswordToOpenModifyDialog; +class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenModifyDialog +{ + DECL_ABSTDLG_BASE( AbstractPasswordToOpenModifyDialog_Impl, PasswordToOpenModifyDialog ) + + virtual String GetPasswordToOpen() const; + virtual String GetPasswordToModify() const; + virtual bool IsRecommendToOpenReadonly() const; +}; +//for PasswordToOpenModifyDialog end + + //------------------------------------------------------------------------ //AbstractDialogFactory_Impl implementations class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory @@ -796,6 +809,8 @@ public: Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext ); virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, const rtl::OString& sHelpId ); + + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); }; #endif diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index a2deb5192389..8d233b71e890 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -50,6 +50,8 @@ #include <svtools/xtextedt.hxx> #include <editeng/SpellPortions.hxx> +#include <set> + class ScrollBar; class TextEngine; class ExtTextView; @@ -72,11 +74,12 @@ class SentenceEditWindow_Impl : public MultiLineEdit/*, public SfxListener*/ using MultiLineEdit::SetText; private: + std::set< USHORT > m_aIgnoreErrorsAt; USHORT m_nErrorStart; USHORT m_nErrorEnd; bool m_bIsUndoEditMode; - Link m_aModifyLink; + Link m_aModifyLink; void CallModifyLink() {m_aModifyLink.Call(this);} @@ -93,7 +96,7 @@ public: void SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd ); void SetText( const String& rStr ); - bool MarkNextError(); + bool MarkNextError( bool bIgnoreCurrentError ); void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage); void MoveErrorMarkTo(USHORT nErrorStart, USHORT nErrorEnd, bool bGrammar); String GetErrorText() const; @@ -121,6 +124,8 @@ public: void UndoActionEnd( USHORT nId ); void MoveErrorEnd(long nOffset); + + void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); } }; @@ -221,7 +226,7 @@ private: void InitUserDicts(); void UpdateBoxes_Impl(); void Init_Impl(); - void SpellContinue_Impl(bool UseSavedSentence = false); + void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false ); void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;} void Impl_Restore(); @@ -230,7 +235,7 @@ private: /** Retrieves the next sentence. */ - bool GetNextSentence_Impl(bool bUseSavedSentence); + bool GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the curretn sentence*/); /** Corrects all errors that have been selected to be changed always */ bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced); diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index e7cc7e1ca2f4..52549e934ecc 100644..100755 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -284,6 +284,9 @@ #define RID_SVXSTR_ARCHIVE_HEADLINE (RID_SVX_START + 485) #define RID_SVXSTR_MULTIFILE_DBL_ERR (RID_SVX_START + 486) +// password to open/modify dialog +#define RID_DLG_PASSWORD_TO_OPEN_MODIFY (RID_SVX_START + 500) + // multi path dialog #define RID_SVXDLG_MULTIPATH (RID_SVX_START + 201) #define RID_MULTIPATH_DBL_ERR (RID_SVX_START + 207) @@ -428,4 +431,12 @@ #define RID_SVXSTR_EVENT_FIELDMERGE_FINISHED (RID_SVX_START + 1188) #define RID_SVXSTR_EVENT_LAYOUT_FINISHED (RID_SVX_START + 1189) +// For now, keep new IDs unique only within cui. +// Later, cui should perhaps get an own range of IDs. +#define RID_SVXSTR_EVENT_SELECTIONCHANGED (RID_SVX_START + 1190) +#define RID_SVXSTR_EVENT_DOUBLECLICK (RID_SVX_START + 1191) +#define RID_SVXSTR_EVENT_RIGHTCLICK (RID_SVX_START + 1192) +#define RID_SVXSTR_EVENT_CALCULATE (RID_SVX_START + 1193) +#define RID_SVXSTR_EVENT_CONTENTCHANGED (RID_SVX_START + 1194) + #endif diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index 1a5bd8562f20..22a2b92f32bd 100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -376,5 +376,16 @@ #define HID_OFAPAGE_QUOTE_SW_CLB "CUI_HID_OFAPAGE_QUOTE_SW_CLB" #define HID_OFAPAGE_QUOTE_CLB "CUI_HID_OFAPAGE_QUOTE_CLB" #define HID_POSTIT_DIALOG "CUI_HID_POSTIT_DIALOG" +#define HID_CT_THES_ALTERNATIVES "CUI_HID_CT_THES_ALTERNATIVES" + +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY" +#define HID_HYPERLINK_DIALOG "CUI_HID_HYPERLINK_DIALOG" + #endif diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx index 42ec38e31331..502b212c8a91 100644 --- a/cui/source/inc/hyphen.hxx +++ b/cui/source/inc/hyphen.hxx @@ -29,6 +29,8 @@ // include --------------------------------------------------------------- +#include <memory> + #include <vcl/edit.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> @@ -45,73 +47,24 @@ namespace linguistic2{ class SvxSpellWrapper; -// class SvxHyphenEdit --------------------------------------------------- - -class SvxHyphenEdit : public Edit -{ -public: - SvxHyphenEdit( Window* pParent, const ResId& rResId ); - -protected: - virtual void KeyInput( const KeyEvent &rKEvt ); -}; - // class SvxHyphenWordDialog --------------------------------------------- +struct SvxHyphenWordDialog_Impl; + class SvxHyphenWordDialog : public SfxModalDialog { + std::auto_ptr< SvxHyphenWordDialog_Impl > m_pImpl; + public: SvxHyphenWordDialog( const String &rWord, LanguageType nLang, Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > &xHyphen, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, SvxSpellWrapper* pWrapper ); + virtual ~SvxHyphenWordDialog(); + void SetWindowTitle( LanguageType nLang ); void SelLeft(); void SelRight(); - -private: - FixedText aWordFT; - SvxHyphenEdit aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aContBtn; - PushButton aDelBtn; - HelpButton aHelpBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > xHyphenator; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > xPossHyph; - String aActWord; // actual (to be displayed) word - LanguageType nActLanguage; // and language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Bool bBusy; - - void EnableLRBtn_Impl(); - void SetLabel_Impl( LanguageType nLang ); - String EraseUnusableHyphens_Impl( - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 nMaxHyphenationPos ); - - void InitControls_Impl(); - void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); - - DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); - DECL_LINK( ContinueHdl_Impl, Button* ); - DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); - DECL_LINK( GetFocusHdl_Impl, Edit* ); - DECL_LINK( LangError_Impl, void* ); }; diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx new file mode 100755 index 000000000000..337c9b84da11 --- /dev/null +++ b/cui/source/inc/passwdomdlg.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CUI_PASSWDOMDLG_HXX_ +#define _CUI_PASSWDOMDLG_HXX_ + + +#include <sfx2/basedlgs.hxx> + +#include <memory> + +////////////////////////////////////////////////////////////////////// + +struct PasswordToOpenModifyDialog_Impl; + +class PasswordToOpenModifyDialog : public SfxModalDialog +{ + std::auto_ptr< PasswordToOpenModifyDialog_Impl > m_pImpl; + + // disallow use of copy c-tor and assignment operator + PasswordToOpenModifyDialog( const PasswordToOpenModifyDialog & ); + PasswordToOpenModifyDialog & operator = ( const PasswordToOpenModifyDialog & ); + +public: + PasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */, + bool bIsPasswordToModify ); + virtual ~PasswordToOpenModifyDialog(); + + // AbstractPasswordToOpenModifyDialog + virtual String GetPasswordToOpen() const; + virtual String GetPasswordToModify() const; + virtual bool IsRecommendToOpenReadonly() const; +}; + +////////////////////////////////////////////////////////////////////// + +#endif + diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx index d46c2ce5affa..99b292b560a5 100644 --- a/cui/source/inc/thesdlg.hxx +++ b/cui/source/inc/thesdlg.hxx @@ -27,94 +27,34 @@ #ifndef _SVX_THESDLG_HXX #define _SVX_THESDLG_HXX -// include --------------------------------------------------------------- -#include <vcl/edit.hxx> -#include <vcl/button.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <svx/stddlg.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> -// forward --------------------------------------------------------------- +#include "svx/stddlg.hxx" +#include "svx/svxdllapi.h" -struct ThesDlg_Impl; +#include <memory> -class SvxThesaurusLanguageDlg_Impl; -namespace com { namespace sun { namespace star { - namespace linguistic2 { - class XThesaurus; - class XMeaning; - } - namespace lang { - struct Locale; - } -}}} +///////////////////////////////////////////////////////////////// -// class SvxThesaurusDialog ---------------------------------------------- +struct SvxThesaurusDialog_Impl; class SvxThesaurusDialog : public SvxStandardDialog { -public: - friend class SvxThesaurusLanguageDlg_Impl; + std::auto_ptr< SvxThesaurusDialog_Impl > m_pImpl; + + SVX_DLLPRIVATE virtual void Apply(); +public: SvxThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, + const String &rWord, LanguageType nLanguage ); ~SvxThesaurusDialog(); - String GetWord() { return aReplaceEdit.GetText(); } - + void SetWindowTitle( LanguageType nLanguage ); + String GetWord(); sal_uInt16 GetLanguage() const; - -private: - FixedText aWordText; - ListBox aWordLB; - FixedText aReplaceText; - Edit aReplaceEdit; - FixedText aMeanText; - ListBox aMeanLB; - FixedText aSynonymText; - ListBox aSynonymLB; - FixedLine aVarFL; - - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aLookUpBtn; - PushButton aLangBtn; - HelpButton aHelpBtn; - - String aErrStr; - - ThesDlg_Impl* pImpl; // always != NULL - - virtual void Apply(); - - void UpdateSynonymBox_Impl(); - void UpdateMeaningBox_Impl( - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XMeaning > > *pMeaningSeq = NULL ); - void Init_Impl(sal_Int16 nLanguage); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > - SAL_CALL queryMeanings_Impl( - ::rtl::OUString& rTerm, - const ::com::sun::star::lang::Locale& rLocale, - const ::com::sun::star::beans::PropertyValues& rProperties ) - throw(::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - // Handler - DECL_LINK( SelectHdl_Impl, ListBox * ); - DECL_LINK( SynonymHdl_Impl, ListBox * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( LanguageHdl_Impl, Button * ); - DECL_LINK( EntryHdl_Impl, ListBox * ); - DECL_LINK( SpellErrorHdl_Impl, void * ); }; #endif diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx index 1c4f12b6eb75..38b9897ad4e9 100644 --- a/cui/source/options/dbregisterednamesconfig.cxx +++ b/cui/source/options/dbregisterednamesconfig.cxx @@ -38,8 +38,9 @@ #include <comphelper/processfactory.hxx> #include <svl/eitem.hxx> #include <svl/itemset.hxx> -#include <tools/diagnose_ex.h> +#include <unotools/pathoptions.hxx> #include <unotools/confignode.hxx> +#include <tools/diagnose_ex.h> //........................................................................ namespace svx diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src index a9091926e3c2..35659dd71f5b 100644 --- a/cui/source/options/optfltr.src +++ b/cui/source/options/optfltr.src @@ -147,19 +147,19 @@ TabPage RID_OFAPAGE_MSFILTEROPT2 }; String ST_CHG_MATH { - Text [ en-US ] = "MathType to %PRODUCTNAME Math / %PRODUCTNAME Math to MathType"; + Text [ en-US ] = "MathType to %PRODUCTNAME Math or reverse"; }; String ST_CHG_WRITER { - Text [ en-US ] = "WinWord to %PRODUCTNAME Writer / %PRODUCTNAME Writer to WinWord"; + Text [ en-US ] = "WinWord to %PRODUCTNAME Writer or reverse"; }; String ST_CHG_CALC { - Text [ en-US ] = "Excel to %PRODUCTNAME Calc / %PRODUCTNAME Calc to Excel"; + Text [ en-US ] = "Excel to %PRODUCTNAME Calc or reverse"; }; String ST_CHG_IMPRESS { - Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress / %PRODUCTNAME Impress to PowerPoint"; + Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress or reverse"; }; }; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 685fa024fa62..b360a5cedfde 100644..100755 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -1329,17 +1329,10 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet ,maMacroSecFL ( this, CUI_RES( FL_SEC_MACROSEC ) ) ,maMacroSecFI ( this, CUI_RES( FI_SEC_MACROSEC ) ) ,maMacroSecPB ( this, CUI_RES( PB_SEC_MACROSEC ) ) - ,maFilesharingFL ( this, CUI_RES( FL_SEC_FILESHARING ) ) - ,maRecommReadOnlyCB ( this, CUI_RES( CB_SEC_RECOMMREADONLY ) ) - ,maRecordChangesCB ( this, CUI_RES( CB_SEC_RECORDCHANGES ) ) - ,maProtectRecordsPB ( this, CUI_RES( PB_SEC_PROTRECORDS ) ) ,mpSecOptions ( new SvtSecurityOptions ) ,mpSecOptDlg ( NULL ) - ,meRedlingMode ( RL_NONE ) - ,msProtectRecordsStr( CUI_RES( STR_SEC_PROTRECORDS ) ) - ,msUnprotectRecordsStr( CUI_RES( STR_SEC_UNPROTRECORDS ) ) ,msPasswordStoringDeactivateStr( CUI_RES( STR_SEC_NOPASSWDSAVE ) ) { @@ -1353,8 +1346,6 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) ); maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) ); maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) ); - maProtectRecordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ProtectRecordsPBHdl ) ); - maRecordChangesCB.SetClickHdl( LINK( this, SvxSecurityTabPage, RecordChangesCBHdl ) ); ActivatePage( rSet ); } @@ -1524,127 +1515,6 @@ IMPL_LINK( SvxSecurityTabPage, MacroSecPBHdl, void*, EMPTYARG ) return 0; } -namespace -{ - enum RedlineFunc { RF_ON, RF_PROTECT }; - - const SfxBoolItem* ExecuteRecordChangesFunc( SvxSecurityTabPage::RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) - { - const SfxBoolItem* pRet = NULL; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot; - if ( _eMode == SvxSecurityTabPage::RL_WRITER ) - nSlot = ( _eFunc == RF_ON )? FN_REDLINE_ON : FN_REDLINE_PROTECT; - else - nSlot = ( _eFunc == RF_ON )? FID_CHG_RECORD : SID_CHG_PROTECT; - - // execute - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - bool bNeedItem = ( _eMode == SvxSecurityTabPage::RL_WRITER || _eFunc != RF_ON ); - SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if ( _pParent ) - { - OfaPtrItem aParentItem( SID_ATTR_PARENTWINDOW, _pParent ); - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); - } - else - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); - delete pItem; - } - } - - return pRet; - } - - bool QueryState( USHORT _nSlot, bool& _rValue ) - { - bool bRet = false; - - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - const SfxPoolItem* pItem; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); - if( bRet ) - _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); - } - - return bRet; - } - - bool QueryRecordChangesProtectionState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue ) - { - bool bRet = false; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_PROTECT : SID_CHG_PROTECT; - bRet = QueryState( nSlot, _rValue ); - } - - return bRet; - } - - bool QueryRecordChangesState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue ) - { - bool bRet = false; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_ON : FID_CHG_RECORD; - bRet = QueryState( nSlot, _rValue ); - } - - return bRet; - } -} - -IMPL_LINK( SvxSecurityTabPage, RecordChangesCBHdl, void*, EMPTYARG ) -{ - ExecuteRecordChangesFunc( meRedlingMode, RF_ON, maRecordChangesCB.IsChecked(), this ); - CheckRecordChangesState(); - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, ProtectRecordsPBHdl, void*, EMPTYARG ) -{ - bool bProt; - QueryRecordChangesProtectionState( meRedlingMode, bProt ); - ExecuteRecordChangesFunc( meRedlingMode, RF_PROTECT, !bProt, this ); - CheckRecordChangesState(); - - if ( QueryRecordChangesProtectionState( meRedlingMode, bProt ) ) - { - // RecordChangesCB is enabled if protection is off - maRecordChangesCB.Enable( !bProt ); - // toggle text of button "Protect" <-> "Unprotect" - String sNewText = bProt ? msUnprotectRecordsStr : msProtectRecordsStr; - maProtectRecordsPB.SetText( sNewText ); - } - return 0; -} - -void SvxSecurityTabPage::CheckRecordChangesState( void ) -{ - bool bVal; - if( QueryRecordChangesState( meRedlingMode, bVal ) ) - { - maRecordChangesCB.Enable(); - maRecordChangesCB.Check( bVal ); - } - else - maRecordChangesCB.Disable(); // because now we don't know the state! - - maProtectRecordsPB.Enable( QueryRecordChangesProtectionState( meRedlingMode, bVal ) ); -} void SvxSecurityTabPage::InitControls() { @@ -1661,30 +1531,13 @@ void SvxSecurityTabPage::InitControls() maMacroSecFL.Hide(); maMacroSecFI.Hide(); maMacroSecPB.Hide(); - - // rearrange the following controls - Point aNewPos = maFilesharingFL.GetPosPixel(); - long nDelta = aNewPos.Y() - maMacroSecFL.GetPosPixel().Y(); - - Window* pWins[] = - { - &maFilesharingFL, &maRecommReadOnlyCB, &maRecordChangesCB, &maProtectRecordsPB - }; - Window** pCurrent = pWins; - const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] ); - for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent ) - { - aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } } // one button too small for its text? sal_Int32 i = 0; long nBtnTextWidth = 0; Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB, - &maShowConnectionsPB, &maMacroSecPB, &maProtectRecordsPB }; + &maShowConnectionsPB, &maMacroSecPB }; Window** pButton = pButtons; const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] ); for ( ; i < nBCount; ++i, ++pButton ) @@ -1724,8 +1577,7 @@ void SvxSecurityTabPage::InitControls() } Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB, - &maMasterPasswordFI, &maMacroSecFI, - &maRecommReadOnlyCB, &maRecordChangesCB }; + &maMasterPasswordFI, &maMacroSecFI }; Window** pControl = pControls; const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[ 0 ] ); for ( i = 0; i < nCCount; ++i, ++pControl ) @@ -1844,15 +1696,6 @@ BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& ) CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); } - // document options - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - if( pCurDocShell ) - { - if( pCurDocShell->HasSecurityOptOpenReadOnly() ) - pCurDocShell->SetSecurityOptOpenReadOnly( maRecommReadOnlyCB.IsChecked() ); - - } - return bModified; } @@ -1860,65 +1703,10 @@ BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& ) void SvxSecurityTabPage::Reset( const SfxItemSet& ) { - String sNewText = msProtectRecordsStr; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); if( pCurDocShell ) { - bool bIsHTMLDoc = false; - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - const SfxPoolItem* pItem; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if ( SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem ) ) - { - USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); - bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 ); - } - } - - sal_Bool bIsReadonly = pCurDocShell->IsReadOnly(); - if( pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc ) - { - maRecommReadOnlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() ); - maRecommReadOnlyCB.Enable( !bIsReadonly ); - } - else - maRecommReadOnlyCB.Disable(); - - bool bVal; - if ( QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc ) - meRedlingMode = RL_WRITER; - else if( QueryRecordChangesState( RL_CALC, bVal ) ) - meRedlingMode = RL_CALC; - else - meRedlingMode = RL_NONE; - - if ( meRedlingMode != RL_NONE ) - { - maRecordChangesCB.Check( bVal ); - maRecordChangesCB.Enable( !bVal && !bIsReadonly ); - maProtectRecordsPB.Enable( - QueryRecordChangesProtectionState( meRedlingMode, bVal ) && !bIsReadonly ); - // set the right text - if ( bVal ) - sNewText = msUnprotectRecordsStr; - } - else - { - // only Writer and Calc support redlining - maRecordChangesCB.Disable(); - maProtectRecordsPB.Disable(); - } } - else - { // no doc -> hide document settings - maRecommReadOnlyCB.Disable(); - maRecordChangesCB.Disable(); - maProtectRecordsPB.Disable(); - } - - maProtectRecordsPB.SetText( sNewText ); } //added by jmeng begin diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc index 09de829ae132..1bd09225ac9b 100644..100755 --- a/cui/source/options/optinet2.hrc +++ b/cui/source/options/optinet2.hrc @@ -116,13 +116,7 @@ #define FL_SEC_MACROSEC 19 #define FI_SEC_MACROSEC 20 #define PB_SEC_MACROSEC 21 -#define FL_SEC_FILESHARING 22 -#define CB_SEC_RECOMMREADONLY 23 -#define CB_SEC_RECORDCHANGES 24 -#define PB_SEC_PROTRECORDS 25 -#define STR_SEC_PROTRECORDS 10 -#define STR_SEC_UNPROTRECORDS 11 #define STR_SEC_NOPASSWDSAVE 12 #define TP_WIDTH 260 diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index 588549787d99..f75ff7d05c44 100644..100755 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -232,8 +232,6 @@ class SvxSecurityTabPage : public SfxTabPage { using TabPage::ActivatePage; using TabPage::DeactivatePage; -public: - enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; private: FixedLine maSecurityOptionsFL; @@ -251,17 +249,10 @@ private: FixedInfo maMacroSecFI; PushButton maMacroSecPB; - FixedLine maFilesharingFL; - CheckBox maRecommReadOnlyCB; - CheckBox maRecordChangesCB; - PushButton maProtectRecordsPB; SvtSecurityOptions* mpSecOptions; svx::SecurityOptionsDialog* mpSecOptDlg; - RedliningMode meRedlingMode; - String msProtectRecordsStr; - String msUnprotectRecordsStr; String msPasswordStoringDeactivateStr; DECL_LINK( SecurityOptionsHdl, PushButton* ); @@ -270,10 +261,7 @@ private: DECL_LINK( MasterPasswordCBHdl, void* ); DECL_LINK( ShowPasswordsHdl, PushButton* ); DECL_LINK( MacroSecPBHdl, void* ); - DECL_LINK( RecordChangesCBHdl, void* ); - DECL_LINK( ProtectRecordsPBHdl, void* ); - void CheckRecordChangesState( void ); void InitControls(); SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet ); diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src index 2b2829d9f2e5..9023dfa52394 100644..100755 --- a/cui/source/options/optinet2.src +++ b/cui/source/options/optinet2.src @@ -507,37 +507,6 @@ TabPage RID_SVXPAGE_INET_SECURITY Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); Text [ en-US ] = "Macro Security..."; }; - FixedLine FL_SEC_FILESHARING - { - Pos = MAP_APPFONT( COL_0, ROW_7 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "File sharing options for this document"; - }; - CheckBox CB_SEC_RECOMMREADONLY - { - Pos = MAP_APPFONT( COL_1, ROW_8 ); - Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Open this document in read-only mode"; - }; - CheckBox CB_SEC_RECORDCHANGES - { - Pos = MAP_APPFONT( COL_1, ROW_9 ); - Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Record changes"; - }; - PushButton PB_SEC_PROTRECORDS - { - Pos = MAP_APPFONT( COL_3, ROW_9-2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - }; - String STR_SEC_PROTRECORDS - { - Text [ en-US ] = "Protect..."; - }; - String STR_SEC_UNPROTRECORDS - { - Text [ en-US ] = "Unprotect..."; - }; String STR_SEC_NOPASSWDSAVE { Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?"; diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index b63d9afc647e..880f8d263c6b 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1830,7 +1830,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) while ( _pViewFrame ) { _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - _pViewFrame = SfxViewFrame::GetNext( *pViewFrame ); + _pViewFrame = SfxViewFrame::GetNext( *_pViewFrame ); } } } diff --git a/cui/util/hidother.src b/cui/util/hidother.src index ddce17eebb23..258d6404f19a 100644 --- a/cui/util/hidother.src +++ b/cui/util/hidother.src @@ -127,6 +127,7 @@ hidspecial HID_HANGULDLG_EDIT_NEWWORD { HelpID = HID_HANGULDLG_EDIT_NEWWO hidspecial HID_HANGULDLG_SUGGESTIONS { HelpId = HID_HANGULDLG_SUGGESTIONS; }; hidspecial HID_HANGULDLG_SUGGESTIONS_GRID { HelpId = HID_HANGULDLG_SUGGESTIONS_GRID; }; hidspecial HID_HANGULDLG_SUGGESTIONS_LIST { HelpId = HID_HANGULDLG_SUGGESTIONS_LIST; }; +hidspecial HID_HYPERLINK_DIALOG { HelpID = HID_HYPERLINK_DIALOG ;}; hidspecial HID_HYPERDLG_DOC_PATH { HelpID = HID_HYPERDLG_DOC_PATH ;}; hidspecial HID_HYPERDLG_INET_PATH { HelpID = HID_HYPERDLG_INET_PATH ;}; hidspecial HID_HYPERDLG_MAIL_PATH { HelpID = HID_HYPERDLG_MAIL_PATH ;}; @@ -199,4 +200,5 @@ hidspecial HID_WARN_NAME_DUPLICATE { HelpID = HID_WARN_NAME_DUPLICA hidspecial UID_OFA_CONNPOOL_DRIVERLIST_BACK { HelpId = UID_OFA_CONNPOOL_DRIVERLIST_BACK; }; hidspecial UID_SEARCH_RECORDSTATUS { HelpID = UID_SEARCH_RECORDSTATUS ;}; hidspecial HID_MACRO_HEADERTABLISTBOX { HelpID = HID_MACRO_HEADERTABLISTBOX ;}; +hidspecial HID_DLG_PASSWORD_TO_OPEN_MODIFY { HelpID = HID_DLG_PASSWORD_TO_OPEN_MODIFY ;}; |