diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-07-07 20:55:51 +0200 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-07-07 20:55:51 +0200 |
commit | 9d01d2bfe3cc89d8c7642e4dd72bc9fd55e1cd60 (patch) | |
tree | aaa6d99a8f1041ed69efee423e1fee686c9cc6f3 /cui/source | |
parent | c38d471b24924e0e413ff88b065f84b0f2fee52a (diff) | |
parent | c04b3821d6d9bb01ea2520629175510e816cfd88 (diff) |
rebase to DEV300_m84
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/macropg.cxx | 5 | ||||
-rw-r--r-- | cui/source/customize/macropg.src | 26 | ||||
-rw-r--r--[-rwxr-xr-x] | cui/source/dialogs/SpellDialog.cxx | 42 | ||||
-rw-r--r-- | cui/source/dialogs/cuihyperdlg.cxx | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/dialogs/makefile.mk | 2 | ||||
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.cxx | 343 | ||||
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.hrc | 61 | ||||
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.src | 228 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/factory/dlgfact.cxx | 25 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/factory/dlgfact.hxx | 15 | ||||
-rw-r--r-- | cui/source/inc/SpellDialog.hxx | 13 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/inc/cuires.hrc | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | cui/source/inc/helpid.hrc | 13 | ||||
-rwxr-xr-x | cui/source/inc/passwdomdlg.hxx | 62 | ||||
-rw-r--r-- | cui/source/options/optfltr.src | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/optinet2.cxx | 216 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/optinet2.hrc | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/optinet2.hxx | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/optinet2.src | 31 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 2 |
20 files changed, 828 insertions, 296 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 188d1d0b4..cc1f7e3b9 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 120d59047..6402587dc 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 4797a632a..22ea4611a 100755..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 ) @@ -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 5f225fa84..573819dfe 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/makefile.mk b/cui/source/dialogs/makefile.mk index 0c5b90aff..12239a1ac 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 000000000..c5a371f97 --- /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 000000000..9ce3dab16 --- /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 000000000..355051cba --- /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/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 996c24971..7a5a3a7b0 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 ) { @@ -1952,3 +1967,13 @@ SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Wind { return new SvxInsRowColDlg( pParent, bCol, nHelpId ); } + +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 f2ab0196c..41e80068d 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, ULONG nHelpId ); + + 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 3fa62d432..49a219aa6 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 c0f8f051d..494c944a8 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 ccbacc9ee..5b25f37fd 100755..100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -375,13 +375,22 @@ #define HID_OFAPAGE_QUOTE_CLB (HID_CUI_START + 340) #define HID_CT_THES_ALTERNATIVES (HID_CUI_START + 341) -// please adjust ACT_CUI_HID_END below if you add entries here! +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY (HID_CUI_START + 342) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN (HID_CUI_START + 343) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN (HID_CUI_START + 344) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE (HID_CUI_START + 345) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY (HID_CUI_START + 346) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY (HID_CUI_START + 347) +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY (HID_CUI_START + 348) +#define HID_HYPERLINK_DIALOG (HID_CUI_START + 349) + +// please adjust ACT_SVX_HID_END2 below if you add entries here! // ----------------------------------------------------------------------- // Overrun check --------------------------------------------------------- // ----------------------------------------------------------------------- -#define ACT_CUI_HID_END HID_CUI_START + 341 +#define ACT_CUI_HID_END (HID_CUI_START + 349) #if ACT_CUI_HID_END > HID_CUI_END #error Resource-Ueberlauf in #line, #file diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx new file mode 100755 index 000000000..7430fb825 --- /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/options/optfltr.src b/cui/source/options/optfltr.src index 56d7897c9..e24da54e6 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 43800ae4d..6144bb40a 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 993eabd4e..75f9445eb 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 f4c8cbc56..fc199bf2e 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 538bed92f..848cdc278 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 c18c52ff5..257d44d98 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 ); } } } |