diff options
Diffstat (limited to 'svx/source')
673 files changed, 1435 insertions, 183605 deletions
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index e4afee69da..0ed80a5af8 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -36,7 +36,7 @@ // Global header // //------------------------------------------------------------------------ -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/editdata.hxx> #include <svx/outliner.hxx> #include <svx/svdmodel.hxx> diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.hxx b/svx/source/accessibility/AccessibleEmptyEditSource.hxx index a3737c181a..83350ae116 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.hxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.hxx @@ -31,8 +31,8 @@ #ifndef _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX #define _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> #include <memory> #include <svx/unoedsrc.hxx> diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 26c855ba69..89382818f4 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -44,7 +44,7 @@ #include <rtl/uuid.h> #include <tools/debug.hxx> #include <tools/gen.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <toolkit/helper/convert.hxx> #include <svtools/colorcfg.hxx> #include <comphelper/accessibleeventnotifier.hxx> diff --git a/svx/source/cui/ControlFocusHelper.hxx b/svx/source/cui/ControlFocusHelper.hxx deleted file mode 100644 index addf0f8d1d..0000000000 --- a/svx/source/cui/ControlFocusHelper.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * 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: ControlFocusHelper.hxx,v $ - * $Revision: 1.5 $ - * - * 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_CONTROLL_FUCUS_HELPER_HXX -#define SVX_CONTROLL_FUCUS_HELPER_HXX - -#include <vcl/ctrl.hxx> - -// class SvxControlFocusHelper --------------------------------------------- - -class SvxControlFocusHelper : public Control -{ -private: - Control* m_pFocusCtrl; - -public: - SvxControlFocusHelper( Window* pParent, const ResId& rId ) : - Control( pParent, rId ), m_pFocusCtrl( NULL ) {} - - void SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; } - - virtual long Notify( NotifyEvent& rNEvt ); -}; - -#endif // SVX_CONTROLL_FUCUS_HELPER_HXX diff --git a/svx/source/cui/SpellAttrib.cxx b/svx/source/cui/SpellAttrib.cxx deleted file mode 100644 index 8d071f40c5..0000000000 --- a/svx/source/cui/SpellAttrib.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * 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: SpellAttrib.cxx,v $ - * $Revision: 1.8 $ - * - * 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_svx.hxx" - -#ifdef SVX_DLLIMPLEMENTATION -#undef SVX_DLLIMPLEMENTATION -#endif -#include <SpellAttrib.hxx> -#include <vcl/font.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/linguistic2/XSpellAlternatives.hpp> -using namespace svx; -using namespace com::sun::star::linguistic2; -using namespace com::sun::star::uno; - -/*-- 26.06.2008 10:41:57--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rDesc ) -{ -} - -/*-- 10.09.2003 12:54:34--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription ) -{ -} -/*-- 10.09.2003 12:54:34--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellErrorAttrib::~SpellErrorAttrib() -{ -} -/*-- 10.09.2003 12:54:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellErrorAttrib::SetFont( Font& ) const -{ - //this attribute doesn't have a visual effect -} -/*-- 10.09.2003 12:54:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -TextAttrib* SpellErrorAttrib::Clone() const -{ - return new SpellErrorAttrib(*this); -} -/*-- 10.09.2003 12:54:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription; -} -/*-- 10.09.2003 14:27:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(eLang) -{ -} -/*-- 10.09.2003 14:27:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(rAttr.m_eLanguage) -{ -} -/*-- 10.09.2003 14:27:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellLanguageAttrib::~SpellLanguageAttrib() -{ -} -/*-- 10.09.2003 14:27:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellLanguageAttrib::SetFont( Font& ) const -{ - //no visual effect -} -/*-- 10.09.2003 14:27:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ -TextAttrib* SpellLanguageAttrib::Clone() const -{ - return new SpellLanguageAttrib(*this); -} -/*-- 10.09.2003 14:27:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ -int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage; -} -/*-- 31.10.2003 16:07:45--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rCol) -{ -} -/*-- 31.10.2003 16:07:45--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rAttr.m_aBackgroundColor) -{ -} -/*-- 31.10.2003 16:07:46--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellBackgroundAttrib::~SpellBackgroundAttrib() -{ -} -/*-- 31.10.2003 16:07:46--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellBackgroundAttrib::SetFont( Font& rFont ) const -{ - rFont.SetFillColor(m_aBackgroundColor); -} -/*-- 31.10.2003 16:07:46--------------------------------------------------- - - -----------------------------------------------------------------------*/ -TextAttrib* SpellBackgroundAttrib::Clone() const -{ - return new SpellBackgroundAttrib(*this); -} -/*-- 31.10.2003 16:07:47--------------------------------------------------- - - -----------------------------------------------------------------------*/ -int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor; -} - diff --git a/svx/source/cui/SpellAttrib.hxx b/svx/source/cui/SpellAttrib.hxx deleted file mode 100644 index e7920d24d1..0000000000 --- a/svx/source/cui/SpellAttrib.hxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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: SpellAttrib.hxx,v $ - * $Revision: 1.6 $ - * - * 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_SPELL_ATTRIB -#define _SVX_SPELL_ATTRIB - -#include <svtools/txtattr.hxx> -#include <i18npool/lang.h> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Sequence.h> -#include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/linguistic2/XProofreader.hpp> -#include <tools/color.hxx> -//namespace com{ namespace sun{ namespace star{ namespace linguistic2{ -// class XSpellAlternatives; -//}}}} - -#define TEXTATTR_SPELL_ERROR (TEXTATTR_USER_START + 1) -#define TEXTATTR_SPELL_LANGUAGE (TEXTATTR_USER_START + 2) -#define TEXTATTR_SPELL_BACKGROUND (TEXTATTR_USER_START + 3) - -namespace svx{ -struct SpellErrorDescription -{ - bool bIsGrammarError; - ::rtl::OUString sErrorText; - ::rtl::OUString sDialogTitle; - ::rtl::OUString sExplanation; - ::com::sun::star::lang::Locale aLocale; - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker; - ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSuggestions; - ::rtl::OUString sRuleId; - - SpellErrorDescription() : - bIsGrammarError( false ){} - - SpellErrorDescription( bool bGrammar, - const ::rtl::OUString& rText, - const ::com::sun::star::lang::Locale& rLocale, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker, - const ::rtl::OUString& rServiceName, - const ::rtl::OUString* pDialogTitle = 0, - const ::rtl::OUString* pExplanation = 0, - const ::rtl::OUString* pRuleId = 0 ) : - bIsGrammarError( bGrammar ), - sErrorText( rText ), - aLocale( rLocale ), - xGrammarChecker( rxGrammarChecker ), - sServiceName( rServiceName ), - aSuggestions( rSuggestions ) - { - if( pDialogTitle ) - sDialogTitle = *pDialogTitle; - if( pExplanation ) - sExplanation = *pExplanation; - if( pRuleId ) - sRuleId = *pRuleId; - }; - - int operator==( const SpellErrorDescription& rDesc ) const - { - return bIsGrammarError == rDesc.bIsGrammarError && - sErrorText.equals( rDesc.sErrorText ) && - aLocale.Language.equals( rDesc.aLocale.Language ) && - aLocale.Country.equals( rDesc.aLocale.Country ) && - aLocale.Variant.equals( rDesc.aLocale.Variant ) && - aSuggestions == rDesc.aSuggestions && - xGrammarChecker == rDesc.xGrammarChecker && - sDialogTitle.equals( rDesc.sDialogTitle ) && - sExplanation.equals( rDesc.sExplanation ) && - sRuleId == rDesc.sRuleId; - } -}; -/* -----------------10.09.2003 14:23----------------- - - --------------------------------------------------*/ -class SpellErrorAttrib : public TextAttrib -{ -public: - -private: - //com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> m_xAlternatives; - SpellErrorDescription m_aSpellErrorDescription; - - //not accessible - SpellErrorAttrib(); -public: -// SpellErrorAttrib(com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> xAlternatives); - SpellErrorAttrib( const SpellErrorDescription& ); - SpellErrorAttrib( const SpellErrorAttrib& rAttr ); - ~SpellErrorAttrib(); - - const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; } - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; -/* -----------------10.09.2003 14:23----------------- - - --------------------------------------------------*/ -class SpellLanguageAttrib : public TextAttrib -{ - LanguageType m_eLanguage; - - //not accessible - SpellLanguageAttrib(); - -public: - SpellLanguageAttrib(LanguageType eLanguage); - SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ); - ~SpellLanguageAttrib(); - - LanguageType GetLanguage() const {return m_eLanguage;} - void SetLanguage(LanguageType eLang) - {m_eLanguage = eLang;} - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; -/* -----------------31.10.2003 16:01----------------- - - --------------------------------------------------*/ -class SpellBackgroundAttrib : public TextAttrib -{ - Color m_aBackgroundColor; - - //not accessible - SpellBackgroundAttrib(); - -public: - SpellBackgroundAttrib(const Color& rCol); - SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ); - ~SpellBackgroundAttrib(); - - const Color& GetColor() const { return m_aBackgroundColor;} - void SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;} - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; -}//namespace svx -#endif diff --git a/svx/source/cui/SpellDialog.cxx b/svx/source/cui/SpellDialog.cxx deleted file mode 100644 index 65e3c90e14..0000000000 --- a/svx/source/cui/SpellDialog.cxx +++ /dev/null @@ -1,2167 +0,0 @@ -/************************************************************************* - * - * 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: SpellDialog.cxx,v $ - * $Revision: 1.24 $ - * - * 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_svx.hxx" - -#ifdef SVX_DLLIMPLEMENTATION -#undef SVX_DLLIMPLEMENTATION -#endif - -// include --------------------------------------------------------------- - -#include <tools/ref.hxx> -#include <tools/shl.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/menu.hxx> -#include <vcl/msgbox.hxx> -#ifndef _SCRBAR_HXX //autogen -#include <vcl/scrbar.hxx> -#endif -#include <SpellAttrib.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/bindings.hxx> -#include <svtools/undo.hxx> -#include <svtools/lingucfg.hxx> -#include <svtools/textdata.hxx> -#include <svtools/filter.hxx> -#include <unolingu.hxx> -#include <svx/splwrap.hxx> -#include <linguistic/lngprops.hxx> -#ifndef _LINGUISTIC_MISC_HHX_ -#include <linguistic/misc.hxx> -#endif -#include <comphelper/processfactory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XServiceDisplayName.hpp> -#include <com/sun/star/linguistic2/SpellFailure.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <sfx2/app.hxx> -#include <vcl/help.hxx> -#include <vcl/graph.hxx> -#include <osl/file.hxx> -#include <impgrf.hxx> -#include <svx/dialogs.hrc> -#include <helpid.hrc> -#include "SpellDialog.hrc" - - - -#include "optitems.hxx" -#include <svx/svxenum.hxx> -#include <svx/SpellDialogChildWindow.hxx> -#include "SpellDialog.hxx" -//#include <svx/splwrap.hxx> // Der Wrapper -#include "dlgutil.hxx" // language -#include <svx/optlingu.hxx> -#include <svx/dialmgr.hxx> -#include "svxerr.hxx" -#include "treeopt.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; - -#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) -// struct SpellDialog_Impl --------------------------------------------- - -struct SpellDialog_Impl -{ - Sequence< Reference< XDictionary > > aDics; -}; -// ----------------------------------------------------------------------- -//#define VENDOR_IMAGE_HEIGHT 44 //as specified - -#define SPELLUNDO_CHANGE_LANGUAGE (TEXTUNDO_USER + 1) -#define SPELLUNDO_CHANGE_TEXTENGINE (TEXTUNDO_USER + 2) -#define SPELLUNDO_CHANGE_NEXTERROR (TEXTUNDO_USER + 3) -#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (TEXTUNDO_USER + 4) -#define SPELLUNDO_CHANGE_GROUP (TEXTUNDO_USER + 5) //undo list -#define SPELLUNDO_MOVE_ERROREND (TEXTUNDO_USER + 6) -#define SPELLUNDO_UNDO_EDIT_MODE (TEXTUNDO_USER + 7) -#define SPELLUNDO_ADD_IGNORE_RULE (TEXTUNDO_USER + 8) - -namespace svx{ -class SpellUndoAction_Impl : public SfxUndoAction -{ - USHORT m_nId; - const Link& m_rActionLink; - //undo of button enabling - bool m_bEnableChangePB; - bool m_bEnableChangeAllPB; - //undo of MarkNextError - used in change and change all, ignore and ignore all - long m_nNewErrorStart; - long m_nNewErrorEnd; - long m_nOldErrorStart; - long m_nOldErrorEnd; - bool m_bIsErrorLanguageSelected; - ::rtl::OUString m_sRuleId; - //undo of AddToDictionary - Reference<XDictionary> m_xDictionary; - ::rtl::OUString m_sAddedWord; - //move end of error - ::ChangeMarkedWord() - long m_nOffset; - -public: - SpellUndoAction_Impl(USHORT nId, const Link& rActionLink) : - m_nId(nId), - m_rActionLink( rActionLink), - m_bEnableChangePB(false), - m_bEnableChangeAllPB(false), - m_nNewErrorStart(-1), - m_nNewErrorEnd(-1), - m_nOldErrorStart(-1), - m_nOldErrorEnd(-1), - m_bIsErrorLanguageSelected(false), - m_nOffset(0) - {} - - ~SpellUndoAction_Impl(); - - virtual void Undo(); - virtual USHORT GetId() const; - - void SetEnableChangePB(){m_bEnableChangePB = true;} - bool IsEnableChangePB(){return m_bEnableChangePB;} - - void SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;} - bool IsEnableChangeAllPB(){return m_bEnableChangeAllPB;} - - void SetErrorMove(long nNewStart, long nNewEnd, long nOldStart, long nOldEnd) - { - m_nNewErrorStart = nNewStart; - m_nNewErrorEnd = nNewEnd; - m_nOldErrorStart = nOldStart; - m_nOldErrorEnd = nOldEnd; - } - long GetNewErrorStart() { return m_nNewErrorStart;} - long GetNewErrorEnd() { return m_nNewErrorEnd;} - long GetOldErrorStart() { return m_nOldErrorStart;} - long GetOldErrorEnd() { return m_nOldErrorEnd;} - - void SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;} - bool IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;} - - - void SetDictionary(Reference<XDictionary> xDict) { m_xDictionary = xDict; } - Reference<XDictionary> GetDictionary() const {return m_xDictionary;} - void SetAddedWord(const ::rtl::OUString& rWord) {m_sAddedWord = rWord;} - const ::rtl::OUString& GetAddedWord() const { return m_sAddedWord;} - - void SetOffset(long nSet) {m_nOffset = nSet;} - long GetOffset() const {return m_nOffset;} - - void SetErrorType( const ::rtl::OUString& rId ) { m_sRuleId = rId; } - const ::rtl::OUString& GetErrorType() const { return m_sRuleId; } - -}; -}//namespace svx -using namespace ::svx; -/*-- 06.11.2003 12:16:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SpellUndoAction_Impl::~SpellUndoAction_Impl() -{ -} -/*-- 06.11.2003 12:16:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellUndoAction_Impl::Undo() -{ - m_rActionLink.Call(this); -} -/*-- 06.11.2003 12:16:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -USHORT SpellUndoAction_Impl::GetId()const -{ - return m_nId; -} - -// class SvxSpellCheckDialog --------------------------------------------- - -SpellDialog::SpellDialog( - SpellDialogChildWindow* pChildWindow, - Window * pParent, - SfxBindings* _pBindings) - : SfxModelessDialog (_pBindings, - pChildWindow, - pParent, - SVX_RES(RID_SVXDLG_SPELLCHECK)), - - aVendorImageFI ( this , SVX_RES( IMG_VENDOR ) ), - aLanguageFT ( this, SVX_RES( FT_LANGUAGE ) ), - aLanguageLB ( this, SVX_RES( LB_LANGUAGE ) ), - aNotInDictFT ( this, SVX_RES( FT_NOTINDICT ) ), - aSentenceED ( this, SVX_RES( ED_NEWWORD ) ), - aSuggestionFT ( this, SVX_RES( FT_SUGGESTION ) ), - aSuggestionLB ( this, SVX_RES( LB_SUGGESTION ) ), - - aIgnorePB ( this, SVX_RES( PB_IGNORE ) ), - aIgnoreAllPB ( this, SVX_RES( PB_IGNOREALL ) ), - aIgnoreRulePB ( this, SVX_RES( PB_IGNORERULE ) ), - aAddToDictMB ( this, SVX_RES( MB_ADDTODICT ) ), - - aChangePB ( this, SVX_RES( PB_CHANGE ) ), - aChangeAllPB ( this, SVX_RES( PB_CHANGEALL ) ), - aExplainPB ( this, SVX_RES( PB_EXPLAIN) ), - aAutoCorrPB ( this, SVX_RES( PB_AUTOCORR ) ), - - aCheckGrammarCB ( this, SVX_RES( CB_CHECK_GRAMMAR ) ), - - aHelpPB ( this, SVX_RES( PB_HELP ) ), - aOptionsPB ( this, SVX_RES( PB_OPTIONS ) ), - aUndoPB ( this, SVX_RES( PB_UNDO ) ), - aClosePB ( this, SVX_RES( PB_CLOSE ) ), - aBackgroundGB ( this, SVX_RES( GB_BACKGROUND ) ), - - aVendorImage ( SVX_RES( IMG_DEFAULT_VENDOR ) ), - aVendorImageHC ( SVX_RES( IMG_DEFAULT_VENDOR_HC ) ), - - aResumeST ( SVX_RES(ST_RESUME )), - aIgnoreOnceST ( aIgnorePB.GetText()), - aNoSuggestionsST( SVX_RES(ST_NOSUGGESTIONS)), - m_sTitleSpelling ( SVX_RES( ST_SPELLING ) ), - m_sTitleSpellingGrammar ( SVX_RES( ST_SPELLING_AND_GRAMMAR ) ), - m_sTitleSpellingGrammarVendor ( SVX_RES( ST_SPELLING_AND_GRAMMAR_VENDORNAME ) ), - aDialogUndoLink( LINK (this, SpellDialog, DialogUndoHdl)), - bModified( false ), - bFocusLocked( true ), - rParent ( *pChildWindow ), - nOldLang ( LANGUAGE_NONE ) -{ - FreeResource(); - xSpell = LinguMgr::GetSpellChecker(); - pImpl = new SpellDialog_Impl; - - //HelpIds - aClosePB. SetHelpId(HID_SPLDLG_BUTTON_CLOSE ); - aIgnorePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORE ); - aIgnoreAllPB. SetHelpId(HID_SPLDLG_BUTTON_IGNOREALL); - aIgnoreRulePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE); - aChangePB. SetHelpId(HID_SPLDLG_BUTTON_CHANGE ); - aChangeAllPB. SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL); - aExplainPB. SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN ); - Init_Impl(); - - // disable controls if service is missing - if (!xSpell.is()) - Enable( sal_False ); - - Application::PostUserEvent( STATIC_LINK( - this, SpellDialog, InitHdl ) ); -} - -// ----------------------------------------------------------------------- - -SpellDialog::~SpellDialog() -{ - // save possibly modified user-dictionaries - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - { - linguistic::SaveDictionaries( xDicList ); - } - - delete aAddToDictMB.GetPopupMenu(); - delete pImpl; -} - -// ----------------------------------------------------------------------- - -void SpellDialog::Init_Impl() -{ - // Handler initialisieren - aClosePB.SetClickHdl(LINK( this, SpellDialog, CancelHdl ) ); - aChangePB.SetClickHdl(LINK( this, SpellDialog, ChangeHdl ) ); - aChangeAllPB.SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) ); - aIgnorePB.SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) ); - aIgnoreAllPB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) ); - aIgnoreRulePB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) ); - aUndoPB.SetClickHdl(LINK( this, SpellDialog, UndoHdl ) ); - - aAutoCorrPB.SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) ); - aCheckGrammarCB.SetClickHdl( LINK( this, SpellDialog, CheckGrammarHdl )); - aOptionsPB .SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) ); - - aSuggestionLB.SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) ); - - aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) ); - aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictionaryHdl ) ); - aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) ); - - // initialize language ListBox - aLanguageLB.SetLanguageList( LANG_LIST_SPELL_USED, FALSE, FALSE, TRUE ); - - // get current language - UpdateBoxes_Impl(); - - // fill dictionary PopupMenu - InitUserDicts(); - - aSentenceED.ClearModifyFlag(); - SvxGetChangeAllList()->clear(); -} - -// ----------------------------------------------------------------------- - -void SpellDialog::UpdateBoxes_Impl() -{ - sal_Int32 i; - aSuggestionLB.Clear(); - - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - - LanguageType nAltLanguage = LANGUAGE_NONE; - //String aAltWord; - Sequence< ::rtl::OUString > aNewWords; - bool bIsGrammarError = false; - if( pSpellErrorDescription ) - { - nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale ); - //aAltWord = String( xAlt->getWord() ); - aNewWords = pSpellErrorDescription->aSuggestions; - bIsGrammarError = pSpellErrorDescription->bIsGrammarError; - aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation ); - } - if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() ) - { - // use this function to apply the correct image to be used... - SetTitle_Impl( nAltLanguage ); - // then change the title to the one to be actually used - SetText( pSpellErrorDescription->sDialogTitle ); - } - else - SetTitle_Impl( nAltLanguage ); - SetSelectedLang_Impl( nAltLanguage ); - - - // Alternativen eintragen - const ::rtl::OUString *pNewWords = aNewWords.getConstArray(); - const sal_Int32 nSize = aNewWords.getLength(); - for ( i = 0; i < nSize; ++i ) - { - String aTmp( pNewWords[i] ); - if ( LISTBOX_ENTRY_NOTFOUND == aSuggestionLB.GetEntryPos( aTmp ) ) - { - aSuggestionLB.InsertEntry( aTmp ); - aSuggestionLB.SetEntryFlags(aSuggestionLB.GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE); - } - } - if(!nSize) - aSuggestionLB.InsertEntry( aNoSuggestionsST ); - aAutoCorrPB.Enable( nSize > 0 ); - //aSentenceED.GrabFocus(); - - aSuggestionFT.Enable(nSize > 0); - aSuggestionLB.Enable(nSize > 0); - if( nSize ) - { - aSuggestionLB.SelectEntryPos(0); - } - aChangePB.Enable( nSize > 0); - aChangeAllPB.Enable(nSize > 0); - bool bShowChangeAll = !bIsGrammarError; - aChangeAllPB.Show( bShowChangeAll ); - aExplainPB.Show( !bShowChangeAll ); - aLanguageLB.Enable( bShowChangeAll ); - aIgnoreAllPB.Show( bShowChangeAll ); - aAddToDictMB.Show( bShowChangeAll ); - aIgnoreRulePB.Show( !bShowChangeAll ); - aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength()); - aExplainPB.Enable( aExplainPB.HasExplanation() ); - aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() ); - -} -// ----------------------------------------------------------------------- - -void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence) -{ - //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())) - { - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription ) - { - UpdateBoxes_Impl(); - Control* aControls[] = - { - &aNotInDictFT, - &aSentenceED, - &aLanguageFT, - 0 - }; - sal_Int32 nIdx = 0; - do - { - aControls[nIdx]->Enable(sal_True); - } - while(aControls[++nIdx]); - - - } - if( bNextSentence ) - { - //remove undo if a new sentence is active - aSentenceED.ResetUndo(); - aUndoPB.Enable(FALSE); - } - } -} -/* -----------------10.09.2003 14:04----------------- - Initialize, asynchronous to prevent virtial calls - from a constructor - --------------------------------------------------*/ -IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG ) -{ - pThis->SetUpdateMode( sal_False ); - //show or hide AutoCorrect depending on the modules abilities - pThis->aAutoCorrPB.Show(pThis->rParent.HasAutoCorrection()); - pThis->SpellContinue_Impl(); - pThis->aSentenceED.ResetUndo(); - pThis->aUndoPB.Enable(FALSE); - - pThis->LockFocusChanges(true); - if( pThis->aChangePB.IsEnabled() ) - pThis->aChangePB.GrabFocus(); - else if( pThis->aIgnorePB.IsEnabled() ) - pThis->aIgnorePB.GrabFocus(); - else if( pThis->aClosePB.IsEnabled() ) - pThis->aClosePB.GrabFocus(); - pThis->LockFocusChanges(false); - //show grammar CheckBox depending on the modules abilities - bool bHasGrammarChecking = pThis->rParent.HasGrammarChecking(); - pThis->aCheckGrammarCB.Show( bHasGrammarChecking ); - if( !bHasGrammarChecking ) - { - //resize the dialog to hide the hidden area of the CheckBox - Size aBackSize = pThis->aBackgroundGB.GetSizePixel(); - sal_Int32 nDiff = pThis->aBackgroundGB.GetPosPixel().Y() + aBackSize.Height() - - pThis->aCheckGrammarCB.GetPosPixel().Y(); - aBackSize.Height() -= nDiff; - pThis->aBackgroundGB.SetSizePixel(aBackSize); - Button* aButtons[] = { &pThis->aHelpPB, &pThis->aOptionsPB, &pThis->aUndoPB, &pThis->aClosePB, 0 }; - sal_Int32 nButton = 0; - while( aButtons[nButton]) - { - Point aPos = aButtons[nButton]->GetPosPixel(); - aPos.Y() -= nDiff; - aButtons[nButton]->SetPosPixel(aPos); - ++nButton; - } - Size aDlgSize = pThis->GetSizePixel(); - aDlgSize.Height() -= nDiff; - pThis->SetSizePixel( aDlgSize ); - } - else - { - if( SvtLinguConfig().HasAnyVendorImages() ) - { - pThis->aVendorImageFI.Show(); - 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 ); - } - //aVendorSize.Height() = nDiff; - sal_Int32 nDiff = aVendorSize.Height(); - pThis->aVendorImageFI.SetSizePixel(aVendorSize); - Control* aControls[] = { - &pThis->aLanguageFT, - &pThis->aLanguageLB, - &pThis->aNotInDictFT, - &pThis->aSentenceED, - &pThis->aSuggestionFT, - &pThis->aSuggestionLB, - &pThis->aIgnorePB, - &pThis->aIgnoreAllPB, - &pThis->aIgnoreRulePB, - &pThis->aAddToDictMB, - &pThis->aChangePB, - &pThis->aChangeAllPB, - &pThis->aExplainPB, - &pThis->aAutoCorrPB, - &pThis->aCheckGrammarCB, - &pThis->aHelpPB, - &pThis->aOptionsPB, - &pThis->aUndoPB, - &pThis->aClosePB, - &pThis->aBackgroundGB, - 0 - }; - sal_Int32 nControl = 0; - while( aControls[nControl]) - { - Point aPos = aControls[nControl]->GetPosPixel(); - aPos.Y() += nDiff; - aControls[nControl]->SetPosPixel(aPos); - ++nControl; - } - Size aDlgSize = pThis->GetSizePixel(); - aDlgSize.Height() += nDiff; - pThis->SetSizePixel( aDlgSize ); - pThis->Invalidate(); - } - } - pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() ); - pThis->SetUpdateMode( sal_True ); - pThis->Show(); - return 0; -}; - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn ) -{ - if (&aOptionsPB == pBtn) - StartSpellOptDlg_Impl(); - else if(&aAutoCorrPB == pBtn) - { - //get the currently selected wrong word - String sCurrentErrorText = aSentenceED.GetErrorText(); - //get the wrong word from the XSpellAlternative - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription ) - { - String sWrong(pSpellErrorDescription->sErrorText); - //if the word has not been edited in the MultiLineEdit then - //the current suggestion should be used - //if it's not the 'no suggestions' entry - if(sWrong == sCurrentErrorText && - aSuggestionLB.IsEnabled() && aSuggestionLB.GetSelectEntryCount() > 0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - { - sCurrentErrorText = aSuggestionLB.GetSelectEntry(); - } - if(sWrong != sCurrentErrorText) - { - SvxPrepareAutoCorrect( sWrong, sCurrentErrorText ); - LanguageType eLang = GetSelectedLang_Impl(); - rParent.AddAutoCorrection( sWrong, sCurrentErrorText, eLang ); - } - } - } - return 0; -} -// ----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, CheckGrammarHdl, CheckBox*, pBox ) -{ - rParent.SetGrammarChecking( pBox->IsChecked() ); - Impl_Restore(); - return 0; -} - -void SpellDialog::StartSpellOptDlg_Impl() -{ - sal_uInt16 aSpellInfos[] = - { - SID_ATTR_SPELL,SID_ATTR_SPELL, - SID_SPELL_MODIFIED, SID_SPELL_MODIFIED, - SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK, - 0 - }; - SfxItemSet aSet( SFX_APP()->GetPool(), aSpellInfos); - aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL )); - SfxSingleTabDialog* pDlg = - new SfxSingleTabDialog( this, aSet, RID_SFXPAGE_LINGU ); - SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg, aSet ); - ( (SvxLinguTabPage*)pPage )->HideGroups( GROUP_MODULES ); - pDlg->SetTabPage( pPage ); - if(RET_OK == pDlg->Execute()) - { - - // Benutzerb"ucher anzeigen - InitUserDicts(); - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - if(pOutSet) - OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet); - } - delete pDlg; - -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ChangeHdl, Button *, EMPTYARG ) -{ - if(aSentenceED.IsUndoEditMode()) - { - SpellContinue_Impl(); - } - else - { - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - String aString = aSentenceED.GetErrorText(); - //dots are sometimes part of the spelled word but they are not necessarily part of the replacement - bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.'; - if(aSuggestionLB.IsEnabled() && - aSuggestionLB.GetSelectEntryCount()>0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - aString = aSuggestionLB.GetSelectEntry(); - if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.')) - aString += '.'; - - aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl()); - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); - } - if(!aChangePB.IsEnabled()) - aIgnorePB.GrabFocus(); - return 1; -} - - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - // change the current word first - String aString = aSentenceED.GetErrorText(); - if(aSuggestionLB.IsEnabled() && - aSuggestionLB.GetSelectEntryCount()>0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - aString = aSuggestionLB.GetSelectEntry(); - - LanguageType eLang = GetSelectedLang_Impl(); - - // add new word to ChangeAll list - String aOldWord( aSentenceED.GetErrorText() ); - SvxPrepareAutoCorrect( aOldWord, aString ); - Reference<XDictionary> aXDictionary( SvxGetChangeAllList(), UNO_QUERY ); - sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary, - aOldWord , sal_True, - aString, eLang ); - - if(nAdded == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(aXDictionary); - pAction->SetAddedWord(aOldWord); - aSentenceED.AddUndoAction(pAction); - } - - aSentenceED.ChangeMarkedWord(aString, eLang); - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); - return 1; -} -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - // add word to IgnoreAll list - Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY ); - //in case the error has been changed manually it has to be restored - aSentenceED.RestoreCurrentError(); - if( pButton == &aIgnoreRulePB ) - { - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - try - { - if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() ) - { - pSpellErrorDescription->xGrammarChecker->ignoreRule( pSpellErrorDescription->sRuleId, - pSpellErrorDescription->aLocale ); - } - } - catch( const uno::Exception& ) - { - } - } - else - { - String sErrorText(aSentenceED.GetErrorText()); - sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary, - sErrorText, sal_False, - ::rtl::OUString(), LANGUAGE_NONE ); - if(nAdded == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(aXDictionary); - pAction->SetAddedWord(sErrorText); - aSentenceED.AddUndoAction(pAction); - } - } - - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); - return 1; -} -/*-- 06.11.2003 11:24:08--------------------------------------------------- - - -----------------------------------------------------------------------*/ -IMPL_LINK( SpellDialog, UndoHdl, Button*, EMPTYARG ) -{ - aSentenceED.Undo(); - if(!aSentenceED.GetUndoActionCount()) - aUndoPB.Enable(FALSE); - return 0; -} -/*-- 06.11.2003 12:19:15--------------------------------------------------- - - -----------------------------------------------------------------------*/ -IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction ) -{ - switch(pAction->GetId()) - { - case SPELLUNDO_CHANGE_TEXTENGINE: - { - if(pAction->IsEnableChangePB()) - aChangePB.Enable(FALSE); - if(pAction->IsEnableChangeAllPB()) - aChangeAllPB.Enable(FALSE); - } - break; - case SPELLUNDO_CHANGE_NEXTERROR: - { - aSentenceED.MoveErrorMarkTo((USHORT)pAction->GetOldErrorStart(), (USHORT)pAction->GetOldErrorEnd(), false); - if(pAction->IsErrorLanguageSelected()) - { - UpdateBoxes_Impl(); - } - } - break; - case SPELLUNDO_CHANGE_ADD_TO_DICTIONARY: - { - if(pAction->GetDictionary().is()) - pAction->GetDictionary()->remove(pAction->GetAddedWord()); - } - break; - case SPELLUNDO_MOVE_ERROREND : - { - if(pAction->GetOffset() != 0) - aSentenceED.MoveErrorEnd(pAction->GetOffset()); - } - break; - case SPELLUNDO_UNDO_EDIT_MODE : - { - //refill the dialog with the currently spelled sentence - throw away all changes - SpellContinue_Impl(true); - } - break; - case SPELLUNDO_ADD_IGNORE_RULE: - //undo of ignored rules is not supported - break; - } - - return 0; -} -// ----------------------------------------------------------------------- -void SpellDialog::Impl_Restore() -{ - //clear the "ChangeAllList" - SvxGetChangeAllList()->clear(); - //get a new sentence - aSentenceED.SetText(rtl::OUString()); - aSentenceED.ResetModified(); - SpellContinue_Impl(); - aIgnorePB.SetText(aIgnoreOnceST); -} - -IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG ) -{ - if(aIgnorePB.GetText() == aResumeST) - { - Impl_Restore(); - } - else - { - //in case the error has been changed manually it has to be restored - aSentenceED.RestoreCurrentError(); - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true)); - aSentenceED.ResetModified(); - - // the word is being ignored - SpellContinue_Impl(); - bModified = false; - } - return 1; -} - - -// ----------------------------------------------------------------------- - -sal_Bool SpellDialog::Close() -{ - GetBindings().GetDispatcher()-> - Execute(rParent.GetType(), - SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD); - return sal_True; -} -// ----------------------------------------------------------------------- - -void SpellDialog::SetSelectedLang_Impl( LanguageType nLang ) -{ - aLanguageLB.SelectLanguage( nLang ); -} - -// ----------------------------------------------------------------------- - -LanguageType SpellDialog::GetSelectedLang_Impl() const -{ - INT16 nLang = aLanguageLB.GetSelectLanguage(); - return nLang; -} -/* -----------------28.10.2003 14:27----------------- - - --------------------------------------------------*/ -IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox) -{ - //if currently an error is selected then search for alternatives for - //this word and fill the alternatives ListBox accordingly - String sError = aSentenceED.GetErrorText(); - aSuggestionLB.Clear(); - if(sError.Len()) - { - LanguageType eLanguage = pBox->GetSelectLanguage(); - Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage, - Sequence< PropertyValue >() ); - if( xAlt.is() ) - aSentenceED.SetAlternatives( xAlt ); - else - { - aSentenceED.ChangeMarkedWord( sError, eLanguage ); - SpellContinue_Impl(); - } - - aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink)); - } - SpellDialog::UpdateBoxes_Impl(); - return 0; -} -// ----------------------------------------------------------------------- - -void SpellDialog::SetLanguage( sal_uInt16 nLang ) - -/* [Beschreibung] - - wenn die Sprache im Thesaurus umgestellt wurde, - muss auch hier die Sprache umgestellt werden. -*/ - -{ - SetTitle_Impl( nLang ); - - // den richtigen Eintrag finden, da sortiert - aLanguageLB.SelectLanguage( nLang ); -} -/*-- 16.06.2008 11:27:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl ) -{ - Image aRes; - ::rtl::OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - Graphic aGraphic; - const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); - if( GRFILTER_OK == LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} -void SpellDialog::SetTitle_Impl(LanguageType nLang) -{ - String sTitle( m_sTitleSpelling ); - if( rParent.HasGrammarChecking() ) - { - String sVendor; - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - ::rtl::OUString sSuggestionImageUrl = - SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast ); - aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) ); - uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY ); - if( xDisplayName.is() ) - sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale ); - } - else - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage ); - } - - if( sVendor.Len() ) - { - sTitle = m_sTitleSpellingGrammarVendor; - sTitle.SearchAndReplaceAscii( "$VendorName", sVendor ); - } - else - { - //bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - sTitle = m_sTitleSpellingGrammar; - } - } - sTitle.SearchAndReplaceAscii( "$LANGUAGE ($LOCATION)", ::GetLanguageString(nLang) ); - SetText( sTitle ); -} -/*------------------------------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellDialog::InitUserDicts() -{ - sal_uInt16 nLang = aLanguageLB.GetSelectLanguage(); - - const Reference< XDictionary > *pDic = 0; - - // get list of dictionaries - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - { - // add active, positive dictionary to dic-list (if not already done). - // This is to ensure that there is at least on dictionary to which - // words could be added. - Reference< XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) ); - if (xDic.is()) - xDic->setActive( sal_True ); - - pImpl->aDics = xDicList->getDictionaries(); - } - - // Benutzerbuecher anzeigen - const sal_Int32 nSize = pImpl->aDics.getLength(); - pDic = pImpl->aDics.getConstArray(); - sal_Int32 i; - delete aAddToDictMB.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - for (i = 0; i < nSize; ++i ) - { - Reference< XDictionary > xDic( pDic[i], UNO_QUERY ); - if (!xDic.is() || SvxGetIgnoreAllList() == xDic) - continue; - - // add only active and not read-only dictionaries to list - // from which to choose from - Reference< frame::XStorable > xStor( xDic, UNO_QUERY ); - if ( xDic->isActive() && (!xStor.is() || !xStor->isReadonly()) ) - { - sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE; - pMenu->InsertItem( (USHORT)i + 1, ::GetDicInfoStr( xDic->getName(), - SvxLocaleToLanguage( xDic->getLocale() ), bNegativ ) ); - } - } - aAddToDictMB.SetPopupMenu(pMenu); - - aAddToDictMB.Disable(); - - sal_uInt16 k; - for ( k = 0; k < pMenu->GetItemCount(); ++k ) - { - sal_uInt16 nId = pMenu->GetItemId(k) - 1; - sal_Bool bFound = sal_False; - - const sal_uInt16 nDicLang = SvxLocaleToLanguage( pDic[nId]->getLocale() ); - const sal_Bool bDicNegativ = - pDic[nId]->getDictionaryType() == DictionaryType_NEGATIVE; - // Stimmt die Sprache "uberein, dann enable - if ((nDicLang == nLang || nDicLang == LANGUAGE_NONE) && !bDicNegativ) - bFound = sal_True; - - if (bFound) - { - aAddToDictMB.Enable(); - break; - } - } -} -/*-- 20.10.2003 15:31:06--------------------------------------------------- - - -----------------------------------------------------------------------*/ -IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - USHORT nItem = pButton->GetCurItemId(); - - //GetErrorText() returns the current error even if the text is already - //manually changed - String sNewWord= aSentenceED.GetErrorText(); - - Reference< XDictionary > xDic( pImpl->aDics.getConstArray()[ nItem - 1 ], UNO_QUERY ); - sal_Int16 nAddRes = DIC_ERR_UNKNOWN; - if (xDic.is()) - { - String sTmpTxt( sNewWord ); - sal_Bool bNegEntry = xDic->getDictionaryType() == DictionaryType_NEGATIVE; - nAddRes = linguistic::AddEntryToDic( xDic, sTmpTxt, bNegEntry, - ::rtl::OUString(), LANGUAGE_NONE ); - - if(nAddRes == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(xDic); - pAction->SetAddedWord(sTmpTxt); - aSentenceED.AddUndoAction(pAction); - } - // failed because there is already an entry? - if (DIC_ERR_NONE != nAddRes && xDic->getEntry( sTmpTxt ).is()) - nAddRes = DIC_ERR_NONE; - } - if (DIC_ERR_NONE != nAddRes) - { - SvxDicError( this, nAddRes ); - return 0; // Nicht weitermachen - } - // nach dem Aufnehmen ggf. '='-Zeichen entfernen - sNewWord.EraseAllChars( sal_Unicode( '=' ) ); - - // go on - SpellContinue_Impl(); - aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP ); - return 0; -} -/*------------------------------------------------------------------------- - - -----------------------------------------------------------------------*/ -IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd) -{ - if (&aSentenceED == pEd) - { - bModified = true; - aSuggestionLB.SetNoSelection(); - aSuggestionLB.Disable(); - String sNewText( aSentenceED.GetText() ); - aAutoCorrPB.Enable( sNewText != aSentenceED.GetText() ); - SpellUndoAction_Impl* pSpellAction = new SpellUndoAction_Impl(SPELLUNDO_CHANGE_TEXTENGINE, aDialogUndoLink); - if(!aChangeAllPB.IsEnabled()) - { - aChangeAllPB.Enable(); - pSpellAction->SetEnableChangeAllPB(); - } - if(!aChangePB.IsEnabled()) - { - aChangePB.Enable(); - pSpellAction->SetEnableChangePB(); - } - aSentenceED.AddUndoAction(pSpellAction); - } - return 0; -}; -/*------------------------------------------------------------------------- - - -----------------------------------------------------------------------*/ -IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG ) -{ - //apply changes first - if there are any - if(aSentenceED.IsModified()) - { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); - } - Close(); - return 0; -} -/*------------------------------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SpellDialog::Paint( const Rectangle& rRect ) -{ - ModelessDialog::Paint(rRect ); - Rectangle aRect(aBackgroundGB.GetPosPixel(), aBackgroundGB.GetSizePixel()); - DecorationView aDecoView( this ); - aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL); -} -/*-- 28.10.2003 13:26:39--------------------------------------------------- - - -----------------------------------------------------------------------*/ -long SpellDialog::Notify( NotifyEvent& rNEvt ) -{ - /* #i38338# - * FIXME: LoseFocus and GetFocus are signals from vcl that - * a window actually got/lost the focus, it never should be - * forwarded from another window, that is simply wrong. - * FIXME: overloading the virtual methods GetFocus and LoseFocus - * in SpellDialogChildWindow by making them pure is at least questionable. - * The only sensible thing would be to call the new Method differently, - * e.g. DialogGot/LostFocus or so. - */ - if( IsVisible() && !bFocusLocked ) - { - if( rNEvt.GetType() == EVENT_GETFOCUS ) - { - //notify the child window of the focus change - rParent.GetFocus(); - } - else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) - { - //notify the child window of the focus change - rParent.LoseFocus(); - } - } - return SfxModelessDialog::Notify(rNEvt); -} -/* -----------------10.09.2003 08:26----------------- - - --------------------------------------------------*/ -void SpellDialog::InvalidateDialog() -{ - if( bFocusLocked ) - return; - aIgnorePB.SetText(aResumeST); - Window* aDisableArr[] = - { - &aNotInDictFT, - &aSentenceED, - &aSuggestionFT, - &aSuggestionLB, - &aLanguageFT, - &aLanguageLB, - &aIgnoreAllPB, - &aIgnoreRulePB, - &aAddToDictMB, - &aChangePB, - &aChangeAllPB, - &aAutoCorrPB, - &aUndoPB, - 0 - }; - sal_Int16 i = 0; - while(aDisableArr[i]) - { - aDisableArr[i]->Enable(FALSE); - i++; - } - SfxModelessDialog::Deactivate(); -} - -/*-- 10.09.2003 08:35:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence) -{ - bool bRet = false; - if(!bUseSavedSentence && aSentenceED.IsModified()) - { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); - } - aSentenceED.ResetModified(); - SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence(); - if(!bUseSavedSentence) - m_aSavedSentence = aSentence; - bool bHasReplaced = false; - while(aSentence.size()) - { - //apply all changes that are already part of the "ChangeAllList" - //returns true if the list still contains errors after the changes have been applied - - if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced)) - { - rParent.ApplyChangedSentence(aSentence); - aSentence = rParent.GetNextWrongSentence(); - } - else - break; - } - - if(aSentence.size()) - { - SpellPortions::iterator aStart = aSentence.begin(); - rtl::OUString sText; - while(aStart != aSentence.end()) - { - // hidden text has to be ignored - if(!aStart->bIsHidden) - sText += aStart->sText; - aStart++; - } - aSentenceED.SetText(sText); - aStart = aSentence.begin(); - sal_Int32 nStartPosition = 0; - sal_Int32 nEndPosition = 0; - - while(aStart != aSentence.end()) - { - // hidden text has to be ignored - if(!aStart->bIsHidden) - { - nEndPosition += aStart->sText.getLength(); - if(aStart->xAlternatives.is()) - { - uno::Reference< container::XNamed > xNamed( aStart->xAlternatives, uno::UNO_QUERY ); - ::rtl::OUString sServiceName; - if( xNamed.is() ) - sServiceName = xNamed->getName(); - SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(), - aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName); - aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition ); - } - else if(aStart->bIsGrammarError ) - { - uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY ); - SpellErrorDescription aDesc( true, - aStart->sText, - SvxCreateLocale( aStart->eLanguage ), - aStart->aGrammarError.aSuggestions, - aStart->xGrammarChecker, - xInfo->getImplementationName(), - &aStart->sDialogTitle, - &aStart->aGrammarError.aFullComment, - &aStart->aGrammarError.aRuleIdentifier ); - aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition ); - } - if(aStart->bIsField) - aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (USHORT) nStartPosition, (USHORT) nEndPosition ); - aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (USHORT) nStartPosition, (USHORT) nEndPosition ); - nStartPosition = nEndPosition; - } - aStart++; - } - //the edit field needs to be modified to apply the change from the ApplyChangeAllList - if(!bHasReplaced) - aSentenceED.ClearModifyFlag(); - aSentenceED.ResetUndo(); - aUndoPB.Enable(FALSE); - bRet = nStartPosition > 0; - } - return bRet; -} -/*-- 12.11.2003 15:21:25--------------------------------------------------- - replace errrors that have a replacement in the ChangeAllList - returns false if the result doesn't contain errors after the replacement - -----------------------------------------------------------------------*/ -bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasReplaced) -{ - bHasReplaced = false; - bool bRet = true; - SpellPortions::iterator aStart = rSentence.begin(); - Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY ); - if(!xChangeAll->getCount()) - return bRet; - bRet = false; - while(aStart != rSentence.end()) - { - if(aStart->xAlternatives.is()) - { - Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry( aStart->sText ); - if(xEntry.is()) - { - aStart->sText = xEntry->getReplacementText(); - aStart->xAlternatives = 0; - bHasReplaced = true; - } - else - bRet = true; - } - else if( aStart->bIsGrammarError ) - bRet = true; - aStart++; - } - return bRet; -} -/*-- 10.09.2003 10:40:21--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) : - MultiLineEdit( pParent, rResId ), - m_nErrorStart(0), - m_nErrorEnd(0), - m_bIsUndoEditMode(false) -{ - DisableSelectionOnFocus(); -} -/*-- 10.09.2003 10:40:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SentenceEditWindow_Impl::~SentenceEditWindow_Impl() -{ -} -/*-- 20.10.2003 13:42:34--------------------------------------------------- - The selection before inputting a key may have a range or not - and it may be inside or outside of field or error attributes. - A range may include the attribute partially, completely or together - with surrounding text. It may also contain more than one attribute - or no attribute at all. - Depending on this starting conditions some actions are necessary: - Attempts to delete a field are only allowed if the selection is the same - as the field's selection. Otherwise the field has to be selected and the key - input action has to be skipped. - Input of text at the start of the field requires the field attribute to be - corrected - it is not allowed to grow. - - In case of errors the appending of text should grow the error attribute because - that is what the user usually wants to do. - - Backspace at the start of the attribute requires to find out if a field ends - directly in front of the cursor position. In case of a field this attribute has to be - selected otherwise the key input method is allowed. - - All changes outside of the error attributes switch the dialog mode to a "Undo edit" state that - removes all visible attributes and switches off further attribute checks. - Undo in this restarts the dialog with a current sentence newly presented. - All changes to the sentence are undone including the ones before the "Undo edit state" has been reached - - We end up with 9 types of selection - 1 (LEFT_NO) - no range, start of attribute - can also be 3 at the same time - 2 (INSIDE_NO) - no range, inside of attribute - 3 (RIGHT_NO) - no range, end of attribute - can also be 1 at the same time - 4 (FULL) - range, same as attribute - 5 (INSIDE_YES) - range, inside of the attribute - 6 (BRACE)- range, from outside of the attribute to the inside or - including the complete attribute and something outside, - maybe more than one attribute - 7 (OUTSIDE_NO) - no range, not at an attribute - 8 (OUTSIDE_YES) - range, completely outside of all attributes - - What has to be done depending on the attribute type involved - possible actions: UE - Undo edit mode - CO - Continue, no additional action is required - FS - Field has to be completely selected - EX - The attribute has to be expanded to include the added text - - 1 - backspace delete any other - UE on field FS on error CO on field FS on error CO - - 2 - on field FS on error C - 3 - backspace delete any other - on field FS on error CO UE on field UE on error EX - - if 1 and 3 happen to apply both then backspace and other handling is 1 delete is 3 - - 4 - on field UE and on error CO - 5 - on field FS and on error CO - 6 - on field FS and on error UE - 7 - UE - 8 - UE - -----------------------------------------------------------------------*/ -#define INVALID 0 -#define LEFT_NO 1 -#define INSIDE_NO 2 -#define RIGHT_NO 3 -#define FULL 4 -#define INSIDE_YES 5 -#define BRACE 6 -#define OUTSIDE_NO 7 -#define OUTSIDE_YES 8 - -#define ACTION_UNDOEDIT 0 -#define ACTION_CONTINUE 1 -#define ACTION_SELECTFIELD 2 -#define ACTION_EXPAND 3 - -long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - bool bChange = false; - const TextCharAttrib* pErrorAttrib = 0; - if(rNEvt.GetType() == EVENT_KEYINPUT) - { - const KeyEvent& rKeyEvt = *rNEvt.GetKeyEvent(); - bChange = TextEngine::DoesKeyChangeText( rKeyEvt ); - if(bChange && !IsUndoEditMode() && - rKeyEvt.GetKeyCode().GetCode() != KEY_TAB) - { - TextEngine* pTextEngine = GetTextEngine(); - TextView* pTextView = pTextEngine->GetActiveView(); - const TextSelection& rCurrentSelection = pTextView->GetSelection(); - //determine if the selection contains a field - bool bHasField = false; - bool bHasError = false; - bool bHasFieldLeft = false; - bool bHasErrorLeft = false; -// bool bInsideAttr = false; - - bool bHasRange = rCurrentSelection.HasRange(); - sal_uInt8 nSelectionType = 0; // invalid type! - - TextPaM aCursor(rCurrentSelection.GetStart()); - const TextCharAttrib* pBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - const TextCharAttrib* pErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - const TextCharAttrib* pBackAttrLeft = 0; - const TextCharAttrib* pErrorAttrLeft = 0; - - bHasField = pBackAttr != 0 && (bHasRange || pBackAttr->GetEnd() > aCursor.GetIndex()); - bHasError = pErrorAttr != 0 && (bHasRange || pErrorAttr->GetEnd() > aCursor.GetIndex()); - if(bHasRange) - { - if(pBackAttr && - pBackAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() && - pBackAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex()) - { - nSelectionType = FULL; - } - else if(pErrorAttr && - pErrorAttr->GetStart() <= rCurrentSelection.GetStart().GetIndex() && - pErrorAttr->GetEnd() >= rCurrentSelection.GetEnd().GetIndex()) - { - nSelectionType = INSIDE_YES; - } - else - { - nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO; - while(aCursor.GetIndex() < rCurrentSelection.GetEnd().GetIndex()) - { - ++aCursor.GetIndex(); - const TextCharAttrib* pIntBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - const TextCharAttrib* pIntErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - //if any attr has been found then BRACE - if(pIntBackAttr || pIntErrorAttr) - nSelectionType = BRACE; - //the field has to be selected - if(pIntBackAttr && !pBackAttr) - pBackAttr = pIntBackAttr; - bHasField |= pIntBackAttr != 0; - } - } - } - else - { - //no range selection: then 1 2 3 and 8 are possible - const TextCharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr; - if(pCurAttr) - { - nSelectionType = pCurAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() ? - LEFT_NO : pCurAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO; - } - else - nSelectionType = OUTSIDE_NO; - - bHasFieldLeft = pBackAttr && pBackAttr->GetEnd() == aCursor.GetIndex(); - if(bHasFieldLeft) - { - pBackAttrLeft = pBackAttr; - pBackAttr = 0; - } - bHasErrorLeft = pErrorAttr && pErrorAttr->GetEnd() == aCursor.GetIndex(); - if(bHasErrorLeft) - { - pErrorAttrLeft = pErrorAttr; - pErrorAttr = 0; - } - - //check previous position if this exists - //that is a redundant in the case the the attribute found above already is on the left cursor side - //but it's o.k. for two errors/fields side by side - if(aCursor.GetIndex()) - { - --aCursor.GetIndex(); - pBackAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - pErrorAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - bHasFieldLeft = pBackAttrLeft !=0; - bHasErrorLeft = pErrorAttrLeft != 0; -// bInsideAttr = (bHasField || bHasError) && (bHasFieldLeft || bHasErrorLeft); - ++aCursor.GetIndex(); - } - } - //Here we have to determine if the error found is the one currently active - bool bIsErrorActive = (pErrorAttr && pErrorAttr->GetStart() == m_nErrorStart) || - (pErrorAttrLeft && pErrorAttrLeft->GetStart() == m_nErrorStart); - - DBG_ASSERT(nSelectionType != INVALID, "selection type not set!"); - - const KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); - bool bDelete = rKeyCode.GetCode() == KEY_DELETE; - bool bBackspace = rKeyCode.GetCode() == KEY_BACKSPACE; - - sal_Int8 nAction = ACTION_CONTINUE; -// nAction = ACTION_UNDOEDIT -// nAction = ACTION_SELECTFIELD -// nAction = ACTION_EXPAND - switch(nSelectionType) - { -// 1 - backspace delete any other -// UE on field FS on error CO on field FS on error CO - case LEFT_NO : - if(bBackspace) - { - nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_UNDOEDIT; - //to force the use of pBackAttrLeft - pBackAttr = 0; - } - else if(bDelete) - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE; - else - nAction = bHasError && !aCursor.GetIndex() ? ACTION_CONTINUE : - bHasError ? ACTION_EXPAND : bHasErrorLeft ? ACTION_CONTINUE : ACTION_UNDOEDIT; - break; -// 2 - on field FS on error C - case INSIDE_NO : - nAction = bHasField ? ACTION_SELECTFIELD : - bIsErrorActive ? ACTION_CONTINUE : ACTION_UNDOEDIT; - break; -// 3 - backspace delete any other -// on field FS on error CO UE on field UE on error EX - case RIGHT_NO : - if(bBackspace) - nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_CONTINUE; - else if(bDelete) - nAction = bHasFieldLeft && bHasError ? ACTION_CONTINUE : ACTION_UNDOEDIT; - else - nAction = bHasFieldLeft && bHasError ? ACTION_EXPAND : - bHasError ? ACTION_CONTINUE : bHasErrorLeft ? ACTION_EXPAND :ACTION_UNDOEDIT; - break; -// 4 - on field UE and on error CO - case FULL : - nAction = bHasField ? ACTION_UNDOEDIT : ACTION_CONTINUE; - break; -// 5 - on field FS and on error CO - case INSIDE_YES : - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE; - break; -// 6 - on field FS and on error UE - case BRACE : - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;; - break; -// 7 - UE -// 8 - UE - case OUTSIDE_NO : - case OUTSIDE_YES: - nAction = ACTION_UNDOEDIT; - break; - } - //save the current paragraph - USHORT nCurrentLen = GetText().Len(); - if(nAction != ACTION_SELECTFIELD) - pTextView->GetWindow()->KeyInput(rKeyEvt); - else - { - const TextCharAttrib* pCharAttr = pBackAttr ? pBackAttr : pBackAttrLeft; - if(pCharAttr) - { - TextPaM aStart(0, pCharAttr->GetStart()); - TextPaM aEnd(0, pCharAttr->GetEnd()); - TextSelection aNewSel(aStart, aEnd); - pTextView->SetSelection( aNewSel); - } - } - if(nAction == ACTION_EXPAND) - { - DBG_ASSERT(pErrorAttrLeft || pErrorAttr, "where is the error"); - //text has been added on the right and only the 'error attribute has to be corrected - if(pErrorAttrLeft) - { - TextAttrib* pNewError = pErrorAttrLeft->GetAttr().Clone(); - USHORT nStart = pErrorAttrLeft->GetStart(); - USHORT nEnd = pErrorAttrLeft->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pErrorAttrLeft ); - SetAttrib( *pNewError, 0, nStart, ++nEnd ); - //only active errors move the mark - if(bIsErrorActive) - { - bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError; - MoveErrorMarkTo(nStart, nEnd, bGrammar); - } - delete pNewError; - } - //text has been added on the left then the error attribute has to be expanded and the - //field attribute on the right - if any - has to be contracted - else if(pErrorAttr) - { - //determine the change - USHORT nAddedChars = GetText().Len() - nCurrentLen; - - TextAttrib* pNewError = pErrorAttr->GetAttr().Clone(); - USHORT nStart = pErrorAttr->GetStart(); - USHORT nEnd = pErrorAttr->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pErrorAttr ); - nStart = nStart - (USHORT)nAddedChars; - SetAttrib( *pNewError, 0, nStart - nAddedChars, nEnd ); - //only if the error is active the mark is moved here - if(bIsErrorActive) - { - bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError; - MoveErrorMarkTo(nStart, nEnd, bGrammar); - } - delete pNewError; - - if(pBackAttrLeft) - { - TextAttrib* pNewBack = pBackAttrLeft->GetAttr().Clone(); - USHORT _nStart = pBackAttrLeft->GetStart(); - USHORT _nEnd = pBackAttrLeft->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pBackAttrLeft ); - SetAttrib( *pNewBack, 0, _nStart, _nEnd - nAddedChars); - delete pNewBack; - } - } - } - else if(nAction == ACTION_UNDOEDIT) - { - SetUndoEditMode(true); - } - //make sure the error positions are correct after text changes - //the old attribute may have been deleted - //all changes inside of the current error leave the error attribute at the current - //start position - if(!IsUndoEditMode() && bIsErrorActive) - { - const TextCharAttrib* pFontColor = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_FONTCOLOR ); - pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); - if(pFontColor && pErrorAttrib ) - { - m_nErrorStart = pFontColor->GetStart(); - m_nErrorEnd = pFontColor->GetEnd(); - if(pErrorAttrib->GetStart() != m_nErrorStart || pErrorAttrib->GetEnd() != m_nErrorEnd) - { - TextAttrib* pNewError = pErrorAttrib->GetAttr().Clone(); - pTextEngine->RemoveAttrib( 0, *pErrorAttr ); - SetAttrib( *pNewError, 0, m_nErrorStart, m_nErrorEnd ); - delete pNewError; - } - } - } - //this is not a modification anymore - if(nAction != ACTION_SELECTFIELD && !m_bIsUndoEditMode) - CallModifyLink(); - } - else - bChange = false; - } - long nRet = bChange ? 1 : MultiLineEdit::PreNotify(rNEvt); - return nRet; -} -/*-- 10.09.2003 13:38:14--------------------------------------------------- - - -----------------------------------------------------------------------*/ -bool SentenceEditWindow_Impl::MarkNextError() -{ - ExtTextEngine* pTextEngine = GetTextEngine(); - USHORT nTextLen = pTextEngine->GetTextLen(0); - if(m_nErrorEnd >= nTextLen - 1) - return false; - //if it's not already modified the modified flag has to be reset at the and of the marking - bool bModified = IsModified(); - bool bRet = false; - const USHORT nOldErrorStart = m_nErrorStart; - const USHORT nOldErrorEnd = m_nErrorEnd; - - //create a cursor behind the end of the last error - //- or at 0 at the start of the sentence - TextPaM aCursor(0, m_nErrorEnd ? m_nErrorEnd + 1 : 0); - //search for SpellErrorAttrib - - const TextCharAttrib* pNextError = 0; - //iterate over the text and search for the next error that maybe has - //to be replace by a ChangeAllList replacement - bool bGrammarError = false; - while(aCursor.GetIndex() < nTextLen) - { - while(aCursor.GetIndex() < nTextLen && - 0 == (pNextError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR))) - { - ++aCursor.GetIndex(); - } - // maybe the error found here is already in the ChangeAllList and has to be replaced - - Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY ); - Reference<XDictionaryEntry> xEntry; - -// Reference <XSpellAlternatives> xAlternatives; - const SpellErrorDescription* pSpellErrorDescription = 0; - if(pNextError) - { - pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pNextError->GetAttr()).GetErrorDescription(); - bGrammarError = pSpellErrorDescription->bIsGrammarError; - } - if(xChangeAll->getCount() && pSpellErrorDescription && - (xEntry = xChangeAll->getEntry( pSpellErrorDescription->sErrorText )).is()) - { - m_nErrorStart = pNextError->GetStart(); - m_nErrorEnd = pNextError->GetEnd(); - ChangeMarkedWord(xEntry->getReplacementText(), - SvxLocaleToLanguage( pSpellErrorDescription->aLocale )); - aCursor.GetIndex() = aCursor.GetIndex() + (USHORT)(xEntry->getReplacementText().getLength()); - } - else - break; - } - - //if an attrib has been found search for the end of the error string - if(aCursor.GetIndex() < nTextLen) - { - m_nErrorStart = aCursor.GetIndex(); - m_nErrorEnd = pNextError->GetEnd(); - MoveErrorMarkTo(m_nErrorStart, m_nErrorEnd, bGrammarError); - bRet = true; - //add an undo action - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_NEXTERROR, GetSpellDialog()->aDialogUndoLink); - pAction->SetErrorMove(m_nErrorStart, m_nErrorEnd, nOldErrorStart, nOldErrorEnd); - const SpellErrorAttrib* pOldAttrib = static_cast<const SpellErrorAttrib*>( - pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR )); - pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() && - SvxLocaleToLanguage( pOldAttrib->GetErrorDescription().aLocale) == - GetSpellDialog()->aLanguageLB.GetSelectLanguage()); - AddUndoAction(pAction); - } - else - m_nErrorStart = m_nErrorEnd = nTextLen; - if( !bModified ) - ClearModifyFlag(); - SpellDialog* pSpellDialog = GetSpellDialog(); - pSpellDialog->aIgnorePB.Enable(bRet); - pSpellDialog->aIgnoreAllPB.Enable(bRet); - pSpellDialog->aAutoCorrPB.Enable(bRet); - pSpellDialog->aAddToDictMB.Enable(bRet); - return bRet; -} - -/*-- 06.11.2003 13:30:26--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::MoveErrorMarkTo(USHORT nStart, USHORT nEnd, bool bGrammarError) -{ - TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE ); - pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE ); - pTextEngine->SetAttrib( TextAttribFontWeight(WEIGHT_BOLD), 0, nStart, nEnd ); - pTextEngine->SetAttrib( TextAttribFontColor(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED), 0, nStart, nEnd ); - m_nErrorStart = nStart; - m_nErrorEnd = nEnd; -} - -/*-- 17.09.2003 10:13:08--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage) -{ - //calculate length changes - long nDiffLen = rNewWord.Len() - m_nErrorEnd + m_nErrorStart; - TextSelection aSel(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd)); - //Remove spell errror attribute - ExtTextEngine* pTextEngine = GetTextEngine(); - pTextEngine->UndoActionStart( TEXTUNDO_INSERT ); - const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); - DBG_ASSERT(pErrorAttrib, "no error attribute found"); -// Reference <XSpellAlternatives> xAlternatives; - const SpellErrorDescription* pSpellErrorDescription = 0; - if(pErrorAttrib) - { - pTextEngine->RemoveAttrib(0, *pErrorAttrib); - pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pErrorAttrib->GetAttr()).GetErrorDescription(); - } - const TextCharAttrib* pBackAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_BACKGROUND ); - pTextEngine->ReplaceText( aSel, rNewWord ); - // - if(!m_nErrorStart) - { - //attributes following an error at the start of the text are not moved but expanded from the - //text engine - this is done to keep full-paragraph-attributes - //in the current case that handling is not desired - const TextCharAttrib* pLangAttrib = - pTextEngine->FindCharAttrib( - TextPaM(0, m_nErrorEnd), TEXTATTR_SPELL_LANGUAGE ); - USHORT nTextLen = pTextEngine->GetTextLen( 0 ); - if(pLangAttrib && !pLangAttrib->GetStart() && pLangAttrib->GetEnd() == - nTextLen) - { - SpellLanguageAttrib aNewLangAttrib( static_cast<const SpellLanguageAttrib&>(pLangAttrib->GetAttr()).GetLanguage()); - pTextEngine->RemoveAttrib(0, *pLangAttrib); - pTextEngine->SetAttrib( aNewLangAttrib, 0, (USHORT)(m_nErrorEnd + nDiffLen) , nTextLen ); - } - } - // undo expanded attributes! - if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen) - { - TextAttrib* pNewBackground = pBackAttrib->GetAttr().Clone(); - USHORT nStart = pBackAttrib->GetStart(); - pTextEngine->RemoveAttrib(0, *pBackAttrib); - pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart); - delete pNewBackground; - } - pTextEngine->SetModified(TRUE); - - //adjust end position - long nEndTemp = m_nErrorEnd; - nEndTemp += nDiffLen; - m_nErrorEnd = (USHORT)nEndTemp; - - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_MOVE_ERROREND, GetSpellDialog()->aDialogUndoLink); - pAction->SetOffset(nDiffLen); - AddUndoAction(pAction); - if(pSpellErrorDescription) - SetAttrib( SpellErrorAttrib(*pSpellErrorDescription), 0, m_nErrorStart, m_nErrorEnd ); - SetAttrib( SpellLanguageAttrib(eLanguage), 0, m_nErrorStart, m_nErrorEnd ); - pTextEngine->UndoActionEnd( TEXTUNDO_INSERT ); -} -/* -----------------08.10.2003 13:18----------------- - - --------------------------------------------------*/ -String SentenceEditWindow_Impl::GetErrorText() const -{ - return GetTextEngine()->GetText(TextSelection(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd) )); -} -/*-- 26.06.2008 10:54:13--------------------------------------------------- - - -----------------------------------------------------------------------*/ -const SpellErrorDescription* SentenceEditWindow_Impl::GetAlternatives() -{ - TextPaM aCursor(0, m_nErrorStart); - const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)); - return pAttrib ? &pAttrib->GetErrorDescription() : 0; -} -/*-- 06.09.2004 10:50:32--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::RestoreCurrentError() -{ - TextPaM aCursor(0, m_nErrorStart); - const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)); - if( pAttrib ) - { - const SpellErrorDescription& rDesc = pAttrib->GetErrorDescription(); - if( !rDesc.sErrorText.equals( GetErrorText() ) ) - ChangeMarkedWord(rDesc.sErrorText, SvxLocaleToLanguage( rDesc.aLocale )); - } -} -/*-- 28.10.2003 14:44:10--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::SetAlternatives( Reference< XSpellAlternatives> xAlt ) -{ - TextPaM aCursor(0, m_nErrorStart); - DBG_ASSERT(static_cast<const SpellErrorAttrib*>( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)), "no error set?"); - - ::rtl::OUString aWord; - lang::Locale aLocale; - uno::Sequence< ::rtl::OUString > aAlts; - ::rtl::OUString sServiceName; - if (xAlt.is()) - { - aWord = xAlt->getWord(); - aLocale = xAlt->getLocale(); - aAlts = xAlt->getAlternatives(); - uno::Reference< container::XNamed > xNamed( xAlt, uno::UNO_QUERY ); - if (xNamed.is()) - sServiceName = xNamed->getName(); - } - SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0, sServiceName); - GetTextEngine()->SetAttrib( SpellErrorAttrib(aDesc), 0, m_nErrorStart, m_nErrorEnd ); -} - -/*-- 10.09.2003 14:43:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd ) -{ - GetTextEngine()->SetAttrib(rAttr, nPara, nStart, nEnd); -} -/*-- 10.09.2003 14:43:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::SetText( const String& rStr ) -{ - m_nErrorStart = m_nErrorEnd = 0; - GetTextEngine()->SetText(rStr); -// InitScrollBars(); -} -/*-- 08.10.2003 14:35:52--------------------------------------------------- - - -----------------------------------------------------------------------*/ -struct LanguagePosition_Impl -{ - USHORT nPosition; - LanguageType eLanguage; - - LanguagePosition_Impl(USHORT nPos, LanguageType eLang) : - nPosition(nPos), - eLanguage(eLang) - {} -}; -typedef std::vector<LanguagePosition_Impl> LanguagePositions_Impl; - -void lcl_InsertBreakPosition_Impl( - LanguagePositions_Impl& rBreakPositions, USHORT nInsert, LanguageType eLanguage) -{ - LanguagePositions_Impl::iterator aStart = rBreakPositions.begin(); - while(aStart != rBreakPositions.end()) - { - if(aStart->nPosition == nInsert) - { - //the language of following starts has to overwrite - //the one of previous ends - aStart->eLanguage = eLanguage; - return; - } - else if(aStart->nPosition > nInsert) - { - - rBreakPositions.insert(aStart, LanguagePosition_Impl(nInsert, eLanguage)); - return; - } - else - ++aStart; - } - rBreakPositions.push_back(LanguagePosition_Impl(nInsert, eLanguage)); -} -/*-- 17.09.2003 14:26:59--------------------------------------------------- - Returns the text in spell portions. Each portion contains text with an - equal language and attribute. The spell alternatives are empty. - -----------------------------------------------------------------------*/ -svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnoreFlag ) const -{ - svx::SpellPortions aRet; - ExtTextEngine* pTextEngine = GetTextEngine(); - const USHORT nTextLen = pTextEngine->GetTextLen(0); - if(nTextLen) - { - TextPaM aCursor(0, 0); - LanguagePositions_Impl aBreakPositions; - const TextCharAttrib* pLastLang = 0; - const TextCharAttrib* pLastError = 0; - LanguageType eLang = LANGUAGE_DONTKNOW; - const TextCharAttrib* pError = 0; - while(aCursor.GetIndex() < nTextLen) - { - const TextCharAttrib* pLang = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_LANGUAGE); - if(pLang && pLang != pLastLang) - { - eLang = static_cast<const SpellLanguageAttrib&>(pLang->GetAttr()).GetLanguage(); - lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetStart(), eLang); - lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetEnd(), eLang); - pLastLang = pLang; - } - pError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR); - if(pError && pLastError != pError) - { - lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetStart(), eLang); - lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetEnd(), eLang); - pLastError = pError; - - } - aCursor.GetIndex()++; - } - // - if(nTextLen && aBreakPositions.empty()) - { - //if all content has been overwritten the attributes may have been removed, too - svx::SpellPortion aPortion1; - aPortion1.eLanguage = GetSpellDialog()->GetSelectedLang_Impl(); - aPortion1.sText = pTextEngine->GetText( - TextSelection(TextPaM(0, 0), TextPaM(0, nTextLen))); - - aRet.push_back(aPortion1); - - } - else if(!aBreakPositions.empty()) - { - LanguagePositions_Impl::iterator aStart = aBreakPositions.begin(); - //start should always be Null - eLang = aStart->eLanguage; - USHORT nStart = aStart->nPosition; - DBG_ASSERT(!nStart, "invalid start position - language attribute missing?"); - ++aStart; - - while(aStart != aBreakPositions.end()) - { - svx::SpellPortion aPortion1; - aPortion1.eLanguage = eLang; - aPortion1.sText = pTextEngine->GetText( - TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition))); - if( bSetIgnoreFlag && m_nErrorStart == nStart ) - { - aPortion1.bIgnoreThisError = true; - } - aRet.push_back(aPortion1); - nStart = aStart->nPosition; - eLang = aStart->eLanguage; - ++aStart; - } - } - - // quick partly fix of #i71318. Correct fix needs to patch the TextEngine itself... - // this one will only prevent text from disappearing. It may to not have the - // correct language and will probably not spell checked... - ULONG nPara = pTextEngine->GetParagraphCount(); - if (nPara > 1) - { - String aLeftOverText; - for (ULONG i = 1; i < nPara; ++i) - { - aLeftOverText.AppendAscii( "\x0a" ); // the manual line break... - aLeftOverText += pTextEngine->GetText(i); - } - if (pError) - { // we need to add a new portion containing the left-over text - svx::SpellPortion aPortion2; - aPortion2.eLanguage = eLang; - aPortion2.sText = aLeftOverText; - aRet.push_back( aPortion2 ); - } - else - { // we just need to append the left-over text to the last portion (which had no errors) - aRet[ aRet.size() - 1 ].sText += aLeftOverText; - } - } - } - return aRet; -} - -/*-- 06.11.2003 11:30:10--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::Undo() -{ - SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - DBG_ASSERT(GetUndoActionCount(), "no undo actions available" ); - if(!GetUndoActionCount()) - return; - bool bSaveUndoEdit = IsUndoEditMode(); - USHORT nId; - //if the undo edit mode is active then undo all changes until the UNDO_EDIT_MODE action has been found - do - { - nId = rUndoMgr.GetUndoActionId(); - rUndoMgr.Undo(); - }while(bSaveUndoEdit && SPELLUNDO_UNDO_EDIT_MODE != nId && GetUndoActionCount()); - - if(bSaveUndoEdit || SPELLUNDO_CHANGE_GROUP == nId) - GetSpellDialog()->UpdateBoxes_Impl(); -} -/*-- 06.11.2003 11:30:10--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::ResetUndo() -{ - GetTextEngine()->ResetUndo(); -} -/*-- 06.11.2003 12:30:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg ) -{ - SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - rUndoMgr.AddUndoAction(pAction, bTryMerg); - GetSpellDialog()->aUndoPB.Enable(); -} -/*-- 06.11.2003 12:38:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ -USHORT SentenceEditWindow_Impl::GetUndoActionCount() -{ - return GetTextEngine()->GetUndoManager().GetUndoActionCount(); -} - -/*-- 12.11.2003 12:12:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::UndoActionStart( USHORT nId ) -{ - GetTextEngine()->UndoActionStart(nId); -} -/*-- 12.11.2003 12:12:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::UndoActionEnd( USHORT nId ) -{ - GetTextEngine()->UndoActionEnd(nId); -} -/*-- 12.11.2003 12:12:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset) -{ - if(nOffset > 0) - m_nErrorEnd = m_nErrorEnd - (USHORT)nOffset; - else - m_nErrorEnd = m_nErrorEnd -(USHORT)- nOffset; -} -/*-- 13.11.2003 15:15:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) -{ - DBG_ASSERT(!bSet || m_bIsUndoEditMode != bSet, "SetUndoEditMode with equal values?"); - m_bIsUndoEditMode = bSet; - //disable all buttons except the Change - SpellDialog* pSpellDialog = GetSpellDialog(); - Control* aControls[] = - { - &pSpellDialog->aChangeAllPB, - &pSpellDialog->aExplainPB, - &pSpellDialog->aIgnoreAllPB, - &pSpellDialog->aIgnoreRulePB, - &pSpellDialog->aIgnorePB, - &pSpellDialog->aSuggestionLB, - &pSpellDialog->aSuggestionFT, - &pSpellDialog->aLanguageFT, - &pSpellDialog->aLanguageLB, - &pSpellDialog->aAddToDictMB, - &pSpellDialog->aAutoCorrPB, - 0 - }; - sal_Int32 nIdx = 0; - do - { - aControls[nIdx]->Enable(sal_False); - } - while(aControls[++nIdx]); - - //remove error marks - TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE ); - pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE ); - - //put the appropriate action on the Undo-stack - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_UNDO_EDIT_MODE, GetSpellDialog()->aDialogUndoLink); - AddUndoAction(pAction); - pSpellDialog->aChangePB.Enable(); -} - -/*-- 30.06.2008 14:15:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -ExplainButton::~ExplainButton() -{ -} -/*-- 30.06.2008 14:15:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void ExplainButton::RequestHelp( const HelpEvent& ) -{ - Help::ShowBalloon( this, GetPosPixel(), m_sExplanation ); -} - -void ExplainButton::Click() -{ - RequestHelp( HelpEvent() ); -} diff --git a/svx/source/cui/SpellDialog.hrc b/svx/source/cui/SpellDialog.hrc deleted file mode 100644 index b4be954bf3..0000000000 --- a/svx/source/cui/SpellDialog.hrc +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * 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: SpellDialog.hrc,v $ - * $Revision: 1.6 $ - * - * 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. - * - ************************************************************************/ - -#define FT_SUGGESTION 31 -#define LB_SUGGESTION 32 -#define FT_NOTINDICT 33 -#define ED_NEWWORD 34 -#define FT_LANGUAGE 35 -#define LB_LANGUAGE 36 -#define PB_IGNORE 37 -#define PB_IGNOREALL 38 -#define MB_ADDTODICT 39 -#define PB_CHANGE 40 -#define PB_CHANGEALL 41 -#define PB_AUTOCORR 42 -#define GB_BACKGROUND 43 -#define PB_OPTIONS 44 -#define PB_HELP 45 -#define PB_UNDO 46 -#define PB_CLOSE 47 -#define ST_NOSUGGESTIONS 48 -#define ST_RESUME 50 -#define ST_SPELLING 51 -#define ST_SPELLING_AND_GRAMMAR 52 -#define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53 -#define CB_CHECK_GRAMMAR 54 -#define PB_EXPLAIN 55 -#define IMG_VENDOR 56 -#define IMG_DEFAULT_VENDOR 57 -#define IMG_DEFAULT_VENDOR_HC 58 -#define PB_IGNORERULE 59 diff --git a/svx/source/cui/SpellDialog.src b/svx/source/cui/SpellDialog.src deleted file mode 100644 index 9b899f77b1..0000000000 --- a/svx/source/cui/SpellDialog.src +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************* - * - * 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: SpellDialog.src,v $ - * $Revision: 1.9 $ - * - * 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 --------------------------------------------------------------- -#include <svx/dialogs.hrc> -#include "helpid.hrc" -#include "SpellDialog.hrc" - // pragma ---------------------------------------------------------------- - -// RID_SVXDLG_SPELLCHECK ------------------------------------------------- - -#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } - -ModelessDialog RID_SVXDLG_SPELLCHECK -{ - HelpId = HID_SPELLCHECK ; - Size = MAP_APPFONT( 270, 188 ); - OutputSize = TRUE; - Closeable = TRUE ; - SVLook = TRUE; - Hide = TRUE; - Text [ en-US ] = "Spellcheck: " ; - - Moveable = TRUE ; - - FixedImage IMG_VENDOR - { - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 270, 21 ) ; - Hide = TRUE; - }; - - FixedText FT_LANGUAGE - { - Pos = MAP_APPFONT( 6, 8 ); - Size = MAP_APPFONT( 100, 8 ); - Text [ en-US ] = "Text languag~e" ; - }; - ListBox LB_LANGUAGE - { - Pos = MAP_APPFONT( 110, 6 ); - Size = MAP_APPFONT( 93, 55 ); - Border = TRUE; - Sort = TRUE; - DropDown = TRUE; - }; - FixedText FT_NOTINDICT - { - Pos = MAP_APPFONT( 6, 26 ); - Size = MAP_APPFONT( 120, 8 ); - Text [ en-US ] = "~Not in dictionary" ; - }; - - MultiLineEdit ED_NEWWORD - { - Pos = MAP_APPFONT( 6, 37 ); - Size = MAP_APPFONT( 197, 48 ); - Border = TRUE; - VScroll = TRUE; - IgnoreTab = TRUE; - }; - - FixedText FT_SUGGESTION - { - Pos = MAP_APPFONT( 6, 88 ); - Size = MAP_APPFONT( 120, 8 ); - Text [ en-US ] = "~Suggestions" ; - }; - ListBox LB_SUGGESTION - { - Pos = MAP_APPFONT( 6, 99 ); - Size = MAP_APPFONT( 197, 48 ); - Border = TRUE; - }; - - CheckBox CB_CHECK_GRAMMAR - { - Pos = MAP_APPFONT( 6, 153 ); - Size = MAP_APPFONT( 100, 10 ); - Text [ en-US ] = "Check ~grammar" ; - Hide = TRUE; - }; - - PushButton PB_IGNORE - { - Pos = MAP_APPFONT( 209, 37 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore Once" ; - }; - - PushButton PB_IGNOREALL - { - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore All" ; - }; - PushButton PB_IGNORERULE - { - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore Rule" ; - Hide = TRUE; - }; - MenuButton MB_ADDTODICT - { - Pos = MAP_APPFONT( 209, 71 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Add" ; - }; - - PushButton PB_CHANGE - { - Pos = MAP_APPFONT( 209, 99 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Change" ; - DefButton = TRUE ; - }; - - PushButton PB_CHANGEALL - { - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Change A~ll" ; - }; - PushButton PB_EXPLAIN - { - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE; - Text [ en-US ] = "~Explain..." ; - }; - PushButton PB_AUTOCORR - { - Pos = MAP_APPFONT( 209, 134 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "AutoCor~rect" ; - }; - GroupBox GB_BACKGROUND - { - Pos = MAP_APPFONT( 1, 21 ); - Size = MAP_APPFONT( 268, 146 ); - Hide=TRUE; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT( 6, 170 ); - Size = MAP_APPFONT( 55, 14 ); - }; - PushButton PB_OPTIONS - { - Pos = MAP_APPFONT( 87, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "O~ptions..." ; - }; - PushButton PB_UNDO - { - Pos = MAP_APPFONT( 148, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Undo" ; - }; - - PushButton PB_CLOSE - { - Pos = MAP_APPFONT ( 209 , 170 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Cl~ose" ; - }; - String ST_RESUME - { - Text[ en-US ] = "Resu~me"; - }; - String ST_NOSUGGESTIONS - { - Text [en-US] = "(no suggestions)"; - }; - String ST_SPELLING - { - Text[ en-US ] = "Spelling: $LANGUAGE ($LOCATION)"; - }; - String ST_SPELLING_AND_GRAMMAR - { - Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION)"; - }; - String ST_SPELLING_AND_GRAMMAR_VENDORNAME - { - Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]"; - }; - Image IMG_DEFAULT_VENDOR - { - ImageBitmap = Bitmap { File = "vendor01.png"; }; - }; - Image IMG_DEFAULT_VENDOR_HC - { - ImageBitmap = Bitmap { File = "vendor01h.png"; }; - }; - -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - diff --git a/svx/source/cui/acccfg.cxx b/svx/source/cui/acccfg.cxx deleted file mode 100644 index 43e0bb5bae..0000000000 --- a/svx/source/cui/acccfg.cxx +++ /dev/null @@ -1,1700 +0,0 @@ -/************************************************************************* - * - * 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: acccfg.cxx,v $ - * $Revision: 1.40 $ - * - * 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_svx.hxx" - -//----------------------------------------------- -// include own files - -#include "acccfg.hxx" -#include "cfgutil.hxx" -#include <svx/dialmgr.hxx> - -#include <sfx2/msg.hxx> -#include <sfx2/macrconf.hxx> -#include <sfx2/app.hxx> -#include <sfx2/filedlghelper.hxx> -#include <sfx2/minfitem.hxx> -#include <svtools/stritem.hxx> - -#include "svx/dialogs.hrc" -#include "acccfg.hrc" - -//----------------------------------------------- -// include interface declarations -#include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/form/XReset.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> - -#ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_ -#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#endif -#include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/awt/KeyModifier.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/embed/ElementModes.hpp> - -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> - -//----------------------------------------------- -// include other projects -#include <unotools/processfactory.hxx> -#include <svtools/acceleratorexecute.hxx> -#include <comphelper/processfactory.hxx> -#include <svtools/svlbitm.hxx> -#include <vcl/svapp.hxx> -#include <vcl/help.hxx> -#include <rtl/ustrbuf.hxx> -#include <comphelper/sequenceashashmap.hxx> - -//----------------------------------------------- -// namespaces - -#ifdef css - #error "ambigous praeprozessor directive for css ..." -#else - namespace css = ::com::sun::star; -#endif - -using namespace com::sun::star; - -//----------------------------------------------- -// definitions - -//----------------------------------------------- -static ::rtl::OUString SERVICE_STORAGEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.embed.StorageFactory" ); -static ::rtl::OUString SERVICE_UICONFIGMGR = ::rtl::OUString::createFromAscii("com.sun.star.ui.UIConfigurationManager" ); -static ::rtl::OUString SERVICE_DESKTOP = ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" ); -static ::rtl::OUString SERVICE_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" ); -static ::rtl::OUString SERVICE_GLOBALACCCFG = ::rtl::OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration" ); -static ::rtl::OUString SERVICE_MODULEUICONFIGSUPPLIER = ::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); -static ::rtl::OUString SERVICE_UICMDDESCRIPTION = ::rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription" ); - -static ::rtl::OUString MODULEPROP_SHORTNAME = ::rtl::OUString::createFromAscii("ooSetupFactoryShortName" ); -static ::rtl::OUString MODULEPROP_UINAME = ::rtl::OUString::createFromAscii("ooSetupFactoryUIName" ); -static ::rtl::OUString CMDPROP_UINAME = ::rtl::OUString::createFromAscii("Name" ); - -static ::rtl::OUString FOLDERNAME_UICONFIG = ::rtl::OUString::createFromAscii("Configurations2" ); - -static ::rtl::OUString MEDIATYPE_PROPNAME = ::rtl::OUString::createFromAscii("MediaType" ); -static ::rtl::OUString MEDIATYPE_UICONFIG = ::rtl::OUString::createFromAscii("application/vnd.sun.xml.ui.configuration" ); - -//----------------------------------------------- -static USHORT __FAR_DATA KEYCODE_ARRAY[] = -{ - KEY_F1 , - KEY_F2 , - KEY_F3 , - KEY_F4 , - KEY_F5 , - KEY_F6 , - KEY_F7 , - KEY_F8 , - KEY_F9 , - KEY_F10 , - KEY_F11 , - KEY_F12 , - - KEY_DOWN , - KEY_UP , - KEY_LEFT , - KEY_RIGHT , - KEY_HOME , - KEY_END , - KEY_PAGEUP , - KEY_PAGEDOWN , - KEY_RETURN , - KEY_ESCAPE , - KEY_BACKSPACE, - KEY_INSERT , - KEY_DELETE , - - KEY_OPEN , - KEY_CUT , - KEY_COPY , - KEY_PASTE , - KEY_UNDO , - KEY_REPEAT , - KEY_FIND , - KEY_PROPERTIES , - KEY_FRONT , - KEY_CONTEXTMENU , - KEY_MENU , - KEY_HELP , - - KEY_F1 | KEY_SHIFT, - KEY_F2 | KEY_SHIFT, - KEY_F3 | KEY_SHIFT, - KEY_F4 | KEY_SHIFT, - KEY_F5 | KEY_SHIFT, - KEY_F6 | KEY_SHIFT, - KEY_F7 | KEY_SHIFT, - KEY_F8 | KEY_SHIFT, - KEY_F9 | KEY_SHIFT, - KEY_F10 | KEY_SHIFT, - KEY_F11 | KEY_SHIFT, - KEY_F12 | KEY_SHIFT, - - KEY_DOWN | KEY_SHIFT, - KEY_UP | KEY_SHIFT, - KEY_LEFT | KEY_SHIFT, - KEY_RIGHT | KEY_SHIFT, - KEY_HOME | KEY_SHIFT, - KEY_END | KEY_SHIFT, - KEY_PAGEUP | KEY_SHIFT, - KEY_PAGEDOWN | KEY_SHIFT, - KEY_RETURN | KEY_SHIFT, - KEY_SPACE | KEY_SHIFT, - KEY_ESCAPE | KEY_SHIFT, - KEY_BACKSPACE | KEY_SHIFT, - KEY_INSERT | KEY_SHIFT, - KEY_DELETE | KEY_SHIFT, - - KEY_0 | KEY_MOD1 , - KEY_1 | KEY_MOD1 , - KEY_2 | KEY_MOD1 , - KEY_3 | KEY_MOD1 , - KEY_4 | KEY_MOD1 , - KEY_5 | KEY_MOD1 , - KEY_6 | KEY_MOD1 , - KEY_7 | KEY_MOD1 , - KEY_8 | KEY_MOD1 , - KEY_9 | KEY_MOD1 , - KEY_A | KEY_MOD1 , - KEY_B | KEY_MOD1 , - KEY_C | KEY_MOD1 , - KEY_D | KEY_MOD1 , - KEY_E | KEY_MOD1 , - KEY_F | KEY_MOD1 , - KEY_G | KEY_MOD1 , - KEY_H | KEY_MOD1 , - KEY_I | KEY_MOD1 , - KEY_J | KEY_MOD1 , - KEY_K | KEY_MOD1 , - KEY_L | KEY_MOD1 , - KEY_M | KEY_MOD1 , - KEY_N | KEY_MOD1 , - KEY_O | KEY_MOD1 , - KEY_P | KEY_MOD1 , - KEY_Q | KEY_MOD1 , - KEY_R | KEY_MOD1 , - KEY_S | KEY_MOD1 , - KEY_T | KEY_MOD1 , - KEY_U | KEY_MOD1 , - KEY_V | KEY_MOD1 , - KEY_W | KEY_MOD1 , - KEY_X | KEY_MOD1 , - KEY_Y | KEY_MOD1 , - KEY_Z | KEY_MOD1 , - - KEY_F1 | KEY_MOD1 , - KEY_F2 | KEY_MOD1 , - KEY_F3 | KEY_MOD1 , - KEY_F4 | KEY_MOD1 , - KEY_F5 | KEY_MOD1 , - KEY_F6 | KEY_MOD1 , - KEY_F7 | KEY_MOD1 , - KEY_F8 | KEY_MOD1 , - KEY_F9 | KEY_MOD1 , - KEY_F10 | KEY_MOD1 , - KEY_F11 | KEY_MOD1 , - KEY_F12 | KEY_MOD1 , - - KEY_DOWN | KEY_MOD1 , - KEY_UP | KEY_MOD1 , - KEY_LEFT | KEY_MOD1 , - KEY_RIGHT | KEY_MOD1 , - KEY_HOME | KEY_MOD1 , - KEY_END | KEY_MOD1 , - KEY_PAGEUP | KEY_MOD1 , - KEY_PAGEDOWN | KEY_MOD1 , - KEY_RETURN | KEY_MOD1 , - KEY_SPACE | KEY_MOD1 , - KEY_BACKSPACE | KEY_MOD1 , - KEY_INSERT | KEY_MOD1 , - KEY_DELETE | KEY_MOD1 , - - KEY_ADD | KEY_MOD1 , - KEY_SUBTRACT | KEY_MOD1 , - KEY_MULTIPLY | KEY_MOD1 , - KEY_DIVIDE | KEY_MOD1 , - - KEY_0 | KEY_SHIFT | KEY_MOD1, - KEY_1 | KEY_SHIFT | KEY_MOD1, - KEY_2 | KEY_SHIFT | KEY_MOD1, - KEY_3 | KEY_SHIFT | KEY_MOD1, - KEY_4 | KEY_SHIFT | KEY_MOD1, - KEY_5 | KEY_SHIFT | KEY_MOD1, - KEY_6 | KEY_SHIFT | KEY_MOD1, - KEY_7 | KEY_SHIFT | KEY_MOD1, - KEY_8 | KEY_SHIFT | KEY_MOD1, - KEY_9 | KEY_SHIFT | KEY_MOD1, - KEY_A | KEY_SHIFT | KEY_MOD1, - KEY_B | KEY_SHIFT | KEY_MOD1, - KEY_C | KEY_SHIFT | KEY_MOD1, - KEY_D | KEY_SHIFT | KEY_MOD1, - KEY_E | KEY_SHIFT | KEY_MOD1, - KEY_F | KEY_SHIFT | KEY_MOD1, - KEY_G | KEY_SHIFT | KEY_MOD1, - KEY_H | KEY_SHIFT | KEY_MOD1, - KEY_I | KEY_SHIFT | KEY_MOD1, - KEY_J | KEY_SHIFT | KEY_MOD1, - KEY_K | KEY_SHIFT | KEY_MOD1, - KEY_L | KEY_SHIFT | KEY_MOD1, - KEY_M | KEY_SHIFT | KEY_MOD1, - KEY_N | KEY_SHIFT | KEY_MOD1, - KEY_O | KEY_SHIFT | KEY_MOD1, - KEY_P | KEY_SHIFT | KEY_MOD1, - KEY_Q | KEY_SHIFT | KEY_MOD1, - KEY_R | KEY_SHIFT | KEY_MOD1, - KEY_S | KEY_SHIFT | KEY_MOD1, - KEY_T | KEY_SHIFT | KEY_MOD1, - KEY_U | KEY_SHIFT | KEY_MOD1, - KEY_V | KEY_SHIFT | KEY_MOD1, - KEY_W | KEY_SHIFT | KEY_MOD1, - KEY_X | KEY_SHIFT | KEY_MOD1, - KEY_Y | KEY_SHIFT | KEY_MOD1, - KEY_Z | KEY_SHIFT | KEY_MOD1, - - KEY_F1 | KEY_SHIFT | KEY_MOD1, - KEY_F2 | KEY_SHIFT | KEY_MOD1, - KEY_F3 | KEY_SHIFT | KEY_MOD1, - KEY_F4 | KEY_SHIFT | KEY_MOD1, - KEY_F5 | KEY_SHIFT | KEY_MOD1, - KEY_F6 | KEY_SHIFT | KEY_MOD1, - KEY_F7 | KEY_SHIFT | KEY_MOD1, - KEY_F8 | KEY_SHIFT | KEY_MOD1, - KEY_F9 | KEY_SHIFT | KEY_MOD1, - KEY_F10 | KEY_SHIFT | KEY_MOD1, - KEY_F11 | KEY_SHIFT | KEY_MOD1, - KEY_F12 | KEY_SHIFT | KEY_MOD1, - - KEY_DOWN | KEY_SHIFT | KEY_MOD1, - KEY_UP | KEY_SHIFT | KEY_MOD1, - KEY_LEFT | KEY_SHIFT | KEY_MOD1, - KEY_RIGHT | KEY_SHIFT | KEY_MOD1, - KEY_HOME | KEY_SHIFT | KEY_MOD1, - KEY_END | KEY_SHIFT | KEY_MOD1, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD1, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1, - KEY_RETURN | KEY_SHIFT | KEY_MOD1, - KEY_SPACE | KEY_SHIFT | KEY_MOD1, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1, - KEY_INSERT | KEY_SHIFT | KEY_MOD1, - KEY_DELETE | KEY_SHIFT | KEY_MOD1, - - KEY_0 | KEY_MOD2 , - KEY_1 | KEY_MOD2 , - KEY_2 | KEY_MOD2 , - KEY_3 | KEY_MOD2 , - KEY_4 | KEY_MOD2 , - KEY_5 | KEY_MOD2 , - KEY_6 | KEY_MOD2 , - KEY_7 | KEY_MOD2 , - KEY_8 | KEY_MOD2 , - KEY_9 | KEY_MOD2 , - KEY_A | KEY_MOD2 , - KEY_B | KEY_MOD2 , - KEY_C | KEY_MOD2 , - KEY_D | KEY_MOD2 , - KEY_E | KEY_MOD2 , - KEY_F | KEY_MOD2 , - KEY_G | KEY_MOD2 , - KEY_H | KEY_MOD2 , - KEY_I | KEY_MOD2 , - KEY_J | KEY_MOD2 , - KEY_K | KEY_MOD2 , - KEY_L | KEY_MOD2 , - KEY_M | KEY_MOD2 , - KEY_N | KEY_MOD2 , - KEY_O | KEY_MOD2 , - KEY_P | KEY_MOD2 , - KEY_Q | KEY_MOD2 , - KEY_R | KEY_MOD2 , - KEY_S | KEY_MOD2 , - KEY_T | KEY_MOD2 , - KEY_U | KEY_MOD2 , - KEY_V | KEY_MOD2 , - KEY_W | KEY_MOD2 , - KEY_X | KEY_MOD2 , - KEY_Y | KEY_MOD2 , - KEY_Z | KEY_MOD2 , - - KEY_F1 | KEY_MOD2 , - KEY_F2 | KEY_MOD2 , - KEY_F3 | KEY_MOD2 , - KEY_F4 | KEY_MOD2 , - KEY_F5 | KEY_MOD2 , - KEY_F6 | KEY_MOD2 , - KEY_F7 | KEY_MOD2 , - KEY_F8 | KEY_MOD2 , - KEY_F9 | KEY_MOD2 , - KEY_F10 | KEY_MOD2 , - KEY_F11 | KEY_MOD2 , - KEY_F12 | KEY_MOD2 , - - KEY_DOWN | KEY_MOD2 , - KEY_UP | KEY_MOD2 , - KEY_LEFT | KEY_MOD2 , - KEY_RIGHT | KEY_MOD2 , - KEY_HOME | KEY_MOD2 , - KEY_END | KEY_MOD2 , - KEY_PAGEUP | KEY_MOD2 , - KEY_PAGEDOWN | KEY_MOD2 , - KEY_RETURN | KEY_MOD2 , - KEY_SPACE | KEY_MOD2 , - KEY_BACKSPACE | KEY_MOD2 , - KEY_INSERT | KEY_MOD2 , - KEY_DELETE | KEY_MOD2 , - - KEY_0 | KEY_SHIFT | KEY_MOD2, - KEY_1 | KEY_SHIFT | KEY_MOD2, - KEY_2 | KEY_SHIFT | KEY_MOD2, - KEY_3 | KEY_SHIFT | KEY_MOD2, - KEY_4 | KEY_SHIFT | KEY_MOD2, - KEY_5 | KEY_SHIFT | KEY_MOD2, - KEY_6 | KEY_SHIFT | KEY_MOD2, - KEY_7 | KEY_SHIFT | KEY_MOD2, - KEY_8 | KEY_SHIFT | KEY_MOD2, - KEY_9 | KEY_SHIFT | KEY_MOD2, - KEY_A | KEY_SHIFT | KEY_MOD2, - KEY_B | KEY_SHIFT | KEY_MOD2, - KEY_C | KEY_SHIFT | KEY_MOD2, - KEY_D | KEY_SHIFT | KEY_MOD2, - KEY_E | KEY_SHIFT | KEY_MOD2, - KEY_F | KEY_SHIFT | KEY_MOD2, - KEY_G | KEY_SHIFT | KEY_MOD2, - KEY_H | KEY_SHIFT | KEY_MOD2, - KEY_I | KEY_SHIFT | KEY_MOD2, - KEY_J | KEY_SHIFT | KEY_MOD2, - KEY_K | KEY_SHIFT | KEY_MOD2, - KEY_L | KEY_SHIFT | KEY_MOD2, - KEY_M | KEY_SHIFT | KEY_MOD2, - KEY_N | KEY_SHIFT | KEY_MOD2, - KEY_O | KEY_SHIFT | KEY_MOD2, - KEY_P | KEY_SHIFT | KEY_MOD2, - KEY_Q | KEY_SHIFT | KEY_MOD2, - KEY_R | KEY_SHIFT | KEY_MOD2, - KEY_S | KEY_SHIFT | KEY_MOD2, - KEY_T | KEY_SHIFT | KEY_MOD2, - KEY_U | KEY_SHIFT | KEY_MOD2, - KEY_V | KEY_SHIFT | KEY_MOD2, - KEY_W | KEY_SHIFT | KEY_MOD2, - KEY_X | KEY_SHIFT | KEY_MOD2, - KEY_Y | KEY_SHIFT | KEY_MOD2, - KEY_Z | KEY_SHIFT | KEY_MOD2, - - KEY_F1 | KEY_SHIFT | KEY_MOD2, - KEY_F2 | KEY_SHIFT | KEY_MOD2, - KEY_F3 | KEY_SHIFT | KEY_MOD2, - KEY_F4 | KEY_SHIFT | KEY_MOD2, - KEY_F5 | KEY_SHIFT | KEY_MOD2, - KEY_F6 | KEY_SHIFT | KEY_MOD2, - KEY_F7 | KEY_SHIFT | KEY_MOD2, - KEY_F8 | KEY_SHIFT | KEY_MOD2, - KEY_F9 | KEY_SHIFT | KEY_MOD2, - KEY_F10 | KEY_SHIFT | KEY_MOD2, - KEY_F11 | KEY_SHIFT | KEY_MOD2, - KEY_F12 | KEY_SHIFT | KEY_MOD2, - - KEY_DOWN | KEY_SHIFT | KEY_MOD2, - KEY_UP | KEY_SHIFT | KEY_MOD2, - KEY_LEFT | KEY_SHIFT | KEY_MOD2, - KEY_RIGHT | KEY_SHIFT | KEY_MOD2, - KEY_HOME | KEY_SHIFT | KEY_MOD2, - KEY_END | KEY_SHIFT | KEY_MOD2, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD2, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD2, - KEY_RETURN | KEY_SHIFT | KEY_MOD2, - KEY_SPACE | KEY_SHIFT | KEY_MOD2, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD2, - KEY_INSERT | KEY_SHIFT | KEY_MOD2, - KEY_DELETE | KEY_SHIFT | KEY_MOD2, - - KEY_0 | KEY_MOD1 | KEY_MOD2 , - KEY_1 | KEY_MOD1 | KEY_MOD2 , - KEY_2 | KEY_MOD1 | KEY_MOD2 , - KEY_3 | KEY_MOD1 | KEY_MOD2 , - KEY_4 | KEY_MOD1 | KEY_MOD2 , - KEY_5 | KEY_MOD1 | KEY_MOD2 , - KEY_6 | KEY_MOD1 | KEY_MOD2 , - KEY_7 | KEY_MOD1 | KEY_MOD2 , - KEY_8 | KEY_MOD1 | KEY_MOD2 , - KEY_9 | KEY_MOD1 | KEY_MOD2 , - KEY_A | KEY_MOD1 | KEY_MOD2 , - KEY_B | KEY_MOD1 | KEY_MOD2 , - KEY_C | KEY_MOD1 | KEY_MOD2 , - KEY_D | KEY_MOD1 | KEY_MOD2 , - KEY_E | KEY_MOD1 | KEY_MOD2 , - KEY_F | KEY_MOD1 | KEY_MOD2 , - KEY_G | KEY_MOD1 | KEY_MOD2 , - KEY_H | KEY_MOD1 | KEY_MOD2 , - KEY_I | KEY_MOD1 | KEY_MOD2 , - KEY_J | KEY_MOD1 | KEY_MOD2 , - KEY_K | KEY_MOD1 | KEY_MOD2 , - KEY_L | KEY_MOD1 | KEY_MOD2 , - KEY_M | KEY_MOD1 | KEY_MOD2 , - KEY_N | KEY_MOD1 | KEY_MOD2 , - KEY_O | KEY_MOD1 | KEY_MOD2 , - KEY_P | KEY_MOD1 | KEY_MOD2 , - KEY_Q | KEY_MOD1 | KEY_MOD2 , - KEY_R | KEY_MOD1 | KEY_MOD2 , - KEY_S | KEY_MOD1 | KEY_MOD2 , - KEY_T | KEY_MOD1 | KEY_MOD2 , - KEY_U | KEY_MOD1 | KEY_MOD2 , - KEY_V | KEY_MOD1 | KEY_MOD2 , - KEY_W | KEY_MOD1 | KEY_MOD2 , - KEY_X | KEY_MOD1 | KEY_MOD2 , - KEY_Y | KEY_MOD1 | KEY_MOD2 , - KEY_Z | KEY_MOD1 | KEY_MOD2 , - - KEY_F1 | KEY_MOD1 | KEY_MOD2 , - KEY_F2 | KEY_MOD1 | KEY_MOD2 , - KEY_F3 | KEY_MOD1 | KEY_MOD2 , - KEY_F4 | KEY_MOD1 | KEY_MOD2 , - KEY_F5 | KEY_MOD1 | KEY_MOD2 , - KEY_F6 | KEY_MOD1 | KEY_MOD2 , - KEY_F7 | KEY_MOD1 | KEY_MOD2 , - KEY_F8 | KEY_MOD1 | KEY_MOD2 , - KEY_F9 | KEY_MOD1 | KEY_MOD2 , - KEY_F10 | KEY_MOD1 | KEY_MOD2 , - KEY_F11 | KEY_MOD1 | KEY_MOD2 , - KEY_F12 | KEY_MOD1 | KEY_MOD2 , - - KEY_DOWN | KEY_MOD1 | KEY_MOD2 , - KEY_UP | KEY_MOD1 | KEY_MOD2 , - KEY_LEFT | KEY_MOD1 | KEY_MOD2 , - KEY_RIGHT | KEY_MOD1 | KEY_MOD2 , - KEY_HOME | KEY_MOD1 | KEY_MOD2 , - KEY_END | KEY_MOD1 | KEY_MOD2 , - KEY_PAGEUP | KEY_MOD1 | KEY_MOD2 , - KEY_PAGEDOWN | KEY_MOD1 | KEY_MOD2 , - KEY_RETURN | KEY_MOD1 | KEY_MOD2 , - KEY_SPACE | KEY_MOD1 | KEY_MOD2 , - KEY_BACKSPACE | KEY_MOD1 | KEY_MOD2 , - KEY_INSERT | KEY_MOD1 | KEY_MOD2 , - KEY_DELETE | KEY_MOD1 | KEY_MOD2 , - - KEY_0 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_A | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_B | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_C | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_D | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_E | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_G | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_H | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_I | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_J | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_K | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_L | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_M | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_N | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_O | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_P | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Q | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_R | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_S | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_T | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_U | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_V | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_W | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_X | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - - KEY_F1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F10 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F11 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F12 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - - KEY_DOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_UP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_LEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_RIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_HOME | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_END | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_RETURN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_SPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_INSERT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2 -}; - -static USHORT KEYCODE_ARRAY_SIZE = (sizeof(KEYCODE_ARRAY) / sizeof(KEYCODE_ARRAY[0])); - -//----------------------------------------------- -// seems to be needed to layout the list box, which shows all -// assignable shortcuts -static long AccCfgTabs[] = -{ - 2, // Number of Tabs - 0, - 120 // Function -}; - -//----------------------------------------------- -class SfxAccCfgLBoxString_Impl : public SvLBoxString -{ - public: - SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - USHORT nFlags, - const String& sText ); - - virtual ~SfxAccCfgLBoxString_Impl(); - - virtual void Paint(const Point& aPos , - SvLBox& rDevice, - USHORT nFlags , - SvLBoxEntry* pEntry ); -}; - -//----------------------------------------------- -SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - USHORT nFlags, - const String& sText ) - : SvLBoxString(pEntry, nFlags, sText) -{ -} - -//----------------------------------------------- -SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() -{ -} - -//----------------------------------------------- -void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos , - SvLBox& rDevice, - USHORT /*nFlags*/, - SvLBoxEntry* pEntry ) -{ - /*/ ??? realy needed !!! - Font aOldFont(rDevice.GetFont()); - Font aNewFont(aOldFont ); - rDevice.SetFont( aFont ); - */ - - if (!pEntry) - return; - - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (!pUserData) - return; - - if (pUserData->m_bIsConfigurable) - rDevice.DrawText(aPos, GetText()); - else - rDevice.DrawCtrlText(aPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE); - - //rDev.SetFont( aOldFont ); -} - -//----------------------------------------------- -void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry , - const XubString& sText , - const Image& aImage1, - const Image& aImage2, - SvLBoxButtonKind eButtonKind) -{ - SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind); -} - -//----------------------------------------------- -/** select the entry, which match the current key input ... excepting - keys, which are used for the dialog itself. - */ -void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey) -{ - KeyCode aCode1 = aKey.GetKeyCode(); - USHORT nCode1 = aCode1.GetCode(); - USHORT nMod1 = aCode1.GetModifier(); - - // is it related to our list box ? - if ( - (nCode1 != KEY_DOWN ) && - (nCode1 != KEY_UP ) && - (nCode1 != KEY_LEFT ) && - (nCode1 != KEY_RIGHT ) && - (nCode1 != KEY_PAGEUP ) && - (nCode1 != KEY_PAGEDOWN) - ) - { - SvLBoxEntry* pEntry = First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - { - USHORT nCode2 = pUserData->m_aKey.GetCode(); - USHORT nMod2 = pUserData->m_aKey.GetModifier(); - if ( - (nCode1 == nCode2) && - (nMod1 == nMod2 ) - ) - { - Select (pEntry); - MakeVisible(pEntry); - return; - } - } - pEntry = Next(pEntry); - } - } - - // no - handle it as normal dialog input - SvTabListBox::KeyInput(aKey); -} - -//----------------------------------------------- -SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxItemSet& aSet ) - : SfxTabPage (pParent, SVX_RES(RID_SVXPAGE_KEYBOARD), aSet) - , m_pMacroInfoItem () - , m_pStringItem () - , m_pFontItem () - , m_pFileDlg (NULL) - , aEntriesBox (this , this, SVX_RES(BOX_ACC_ENTRIES )) - , aKeyboardGroup (this , SVX_RES(GRP_ACC_KEYBOARD )) - , aOfficeButton (this , SVX_RES(RB_OFFICE )) - , aModuleButton (this , SVX_RES(RB_MODULE )) - , aChangeButton (this , SVX_RES(BTN_ACC_CHANGE )) - , aRemoveButton (this , SVX_RES(BTN_ACC_REMOVE )) - , aGroupText (this , SVX_RES(TXT_ACC_GROUP )) - , pGroupLBox(new SfxConfigGroupListBox_Impl( this, SVX_RES(BOX_ACC_GROUP), SFX_SLOT_ACCELCONFIG )) - , aFunctionText (this , SVX_RES(TXT_ACC_FUNCTION )) - , pFunctionBox(new SfxConfigFunctionListBox_Impl( this, SVX_RES( BOX_ACC_FUNCTION ))) - , aKeyText (this , SVX_RES(TXT_ACC_KEY )) - , aKeyBox (this , SVX_RES(BOX_ACC_KEY )) - , aFunctionsGroup (this , SVX_RES(GRP_ACC_FUNCTIONS )) - , aLoadButton (this , SVX_RES(BTN_LOAD )) - , aSaveButton (this , SVX_RES(BTN_SAVE )) - , aResetButton (this , SVX_RES(BTN_RESET )) - , aLoadAccelConfigStr ( SVX_RES( STR_LOADACCELCONFIG ) ) - , aSaveAccelConfigStr ( SVX_RES( STR_SAVEACCELCONFIG ) ) - , aFilterAllStr ( SVX_RES( STR_SFX_FILTERNAME_ALL ) ) - , aFilterCfgStr ( SVX_RES( STR_FILTERNAME_CFG ) ) - , m_bStylesInfoInitialized(sal_False) - , m_xGlobal () - , m_xModule () - , m_xAct () -{ - FreeResource(); - -// install handler functions - aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl )); - aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl )); - aEntriesBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - aKeyBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - aLoadButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load )); - aSaveButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save )); - aResetButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default )); - aOfficeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); - aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); - - // initialize Entriesbox - aEntriesBox.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); - aEntriesBox.SetSelectionMode(SINGLE_SELECTION); - aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT); - aEntriesBox.Resize(); // OS: Hack for right selection - aEntriesBox.SetSpaceBetweenEntries(0); - aEntriesBox.SetDragDropMode(0); - - // detect max keyname width - long nMaxWidth = 0; - for ( USHORT i = 0; i < KEYCODE_ARRAY_SIZE; ++i ) - { - long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() ); - if ( nTmp > nMaxWidth ) - nMaxWidth = nTmp; - } - // recalc second tab - long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width(); - nNewTab = nNewTab + 5; // additional space - aEntriesBox.SetTab( 1, nNewTab ); - - // initialize GroupBox - pGroupLBox->SetFunctionListBox(pFunctionBox); - - // initialize KeyBox - aKeyBox.SetWindowBits(WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); -} - -//----------------------------------------------- -SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage() -{ - // free memory - remove all dynamic user data - SvLBoxEntry* pEntry = aEntriesBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - delete pUserData; - pEntry = aEntriesBox.Next(pEntry); - } - - pEntry = aKeyBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - delete pUserData; - pEntry = aKeyBox.Next(pEntry); - } - - aEntriesBox.Clear(); - aKeyBox.Clear(); - - delete m_pFileDlg; - delete pGroupLBox; - delete pFunctionBox; -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::InitAccCfg() -{ - // already initialized ? - if (m_xSMGR.is()) - return; // yes -> do nothing - - try - { - // no - initialize this instance - m_xSMGR = ::utl::getProcessServiceFactory(); - - m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW); - - // get the current active frame, which should be our "parent" - // for this session - m_xFrame = GetFrame(); - if ( !m_xFrame.is() ) - { - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW); - m_xFrame = xDesktop->getActiveFrame(); - } - - // identify module - css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW); - m_sModuleLongName = xModuleManager->identify(m_xFrame); - ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName)); - m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString()); - m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString()); - - // get global accelerator configuration - m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW); - - // get module accelerator configuration - css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(m_xSMGR->createInstance(SERVICE_MODULEUICONFIGSUPPLIER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName); - m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { m_xSMGR.clear(); } -} - -//----------------------------------------------- -/** Initialize text columns with own class to enable custom painting - This is needed as we have to paint disabled entries by ourself. No support for that in the - original SvTabListBox! - */ -void SfxAcceleratorConfigPage::CreateCustomItems( SvLBoxEntry* pEntry, - const String& sCol1 , - const String& sCol2 ) -{ - SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1); - pEntry->ReplaceItem(pStringItem, 1); - - pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2); - pEntry->ReplaceItem(pStringItem, 2); -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) -{ - if (!xAccMgr.is()) - return; - - if (!m_bStylesInfoInitialized) - { - css::uno::Reference< css::frame::XController > xController; - css::uno::Reference< css::frame::XModel > xModel; - if (m_xFrame.is()) - xController = m_xFrame->getController(); - if (xController.is()) - xModel = xController->getModel(); - - m_aStylesInfo.setModel(xModel); - pFunctionBox->SetStylesInfo(&m_aStylesInfo); - pGroupLBox->SetStylesInfo(&m_aStylesInfo); - m_bStylesInfoInitialized = sal_True; - } - - // Insert all editable accelerators into list box. It is possible - // that some accelerators are not mapped on the current system/keyboard - // but we don't want to lose these mappings. - USHORT c1 = KEYCODE_ARRAY_SIZE; - USHORT i1 = 0; - USHORT nListPos = 0; - for (i1=0; i1<c1; ++i1) - { - KeyCode aKey = KEYCODE_ARRAY[i1]; - String sKey = aKey.GetName(); - if (!sKey.Len()) - continue; - TAccInfo* pEntry = new TAccInfo(i1, nListPos, aKey); - SvLBoxEntry* pLBEntry = aEntriesBox.InsertEntryToColumn(sKey, 0L, LIST_APPEND, 0xFFFF); - pLBEntry->SetUserData(pEntry); - } - - // Assign all commands to its shortcuts - reading the accelerator config. - css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents(); - sal_Int32 c2 = lKeys.getLength(); - sal_Int32 i2 = 0; - USHORT nCol = aEntriesBox.TabCount()-1; - - for (i2=0; i2<c2; ++i2) - { - const css::awt::KeyEvent& aAWTKey = lKeys[i2]; - ::rtl::OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey); - String sLabel = GetLabel4Command(sCommand); - KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey); - USHORT nPos = MapKeyCodeToPos(aKeyCode); - - if (nPos == LISTBOX_ENTRY_NOTFOUND) - continue; - - aEntriesBox.SetEntryText(sLabel, nPos, nCol); - - SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos); - TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData(); - - pEntry->m_bIsConfigurable = sal_True; - pEntry->m_sCommand = sCommand; - CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), sLabel); - } - - // Map the VCL hardcoded key codes and mark them as not changeable - ULONG c3 = Application::GetReservedKeyCodeCount(); - ULONG i3 = 0; - for (i3=0; i3<c3; ++i3) - { - const KeyCode* pKeyCode = Application::GetReservedKeyCode(i3); - USHORT nPos = MapKeyCodeToPos(*pKeyCode); - - if (nPos == LISTBOX_ENTRY_NOTFOUND) - continue; - - // Hardcoded function mapped so no ID possible and mark entry as not changeable - SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos); - TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData(); - - pEntry->m_bIsConfigurable = sal_False; - CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), String()); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) -{ - if (!xAccMgr.is()) - return; - - // Go through the list from the bottom to the top ... - // because logical accelerator must be preferred instead of - // physical ones! - SvLBoxEntry* pEntry = aEntriesBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - ::rtl::OUString sCommand ; - css::awt::KeyEvent aAWTKey ; - - if (pUserData) - { - sCommand = pUserData->m_sCommand; - aAWTKey = ::svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey); - } - - try - { - if (sCommand.getLength()) - xAccMgr->setKeyEvent(aAWTKey, sCommand); - else - xAccMgr->removeKeyEvent(aAWTKey); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - pEntry = aEntriesBox.Next(pEntry); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::ResetConfig() -{ - aEntriesBox.Clear(); -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG ) -{ - // ask for filename, where we should load the new config data from - StartFileDialog( WB_OPEN | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG ) -{ - StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG) -{ - css::uno::Reference< css::form::XReset > xReset(m_xAct, css::uno::UNO_QUERY); - if (xReset.is()) - xReset->reset(); - - aEntriesBox.SetUpdateMode(FALSE); - ResetConfig(); - Init(m_xAct); - aEntriesBox.SetUpdateMode(TRUE); - aEntriesBox.Invalidate(); - aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) -{ - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - String sNewCommand = pFunctionBox->GetCurCommand(); - String sLabel = pFunctionBox->GetCurLabel(); - if (!sLabel.Len()) - sLabel = GetLabel4Command(sNewCommand); - - pEntry->m_sCommand = sNewCommand; - USHORT nCol = aEntriesBox.TabCount() - 1; - aEntriesBox.SetEntryText(sLabel, nPos, nCol); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG ) -{ - // get selected entry - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - - // remove function name from selected entry - USHORT nCol = aEntriesBox.TabCount() - 1; - aEntriesBox.SetEntryText( String(), nPos, nCol ); - pEntry->m_sCommand = ::rtl::OUString(); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) -{ - // disable help - Help::ShowBalloon( this, Point(), String() ); - if ( pListBox == &aEntriesBox ) - { - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); - - aRemoveButton.Enable( FALSE ); - aChangeButton.Enable( FALSE ); - - if (pEntry->m_bIsConfigurable) - { - if (pEntry->isConfigured()) - aRemoveButton.Enable( TRUE ); - aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); - } - } - else if ( pListBox == pGroupLBox ) - { - pGroupLBox->GroupSelected(); - if ( !pFunctionBox->FirstSelected() ) - aChangeButton.Enable( FALSE ); - } - else if ( pListBox == pFunctionBox ) - { - aRemoveButton.Enable( FALSE ); - aChangeButton.Enable( FALSE ); - - // #i36994 First selected can return zero! - SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected(); - if ( pLBEntry != 0 ) - { - USHORT nPos = (USHORT) aEntriesBox.GetModel()->GetRelPos( pLBEntry ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); - - if (pEntry->m_bIsConfigurable) - { - if (pEntry->isConfigured()) - aRemoveButton.Enable( TRUE ); - aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); - } - - // update key box - aKeyBox.Clear(); - SvLBoxEntry* pIt = aEntriesBox.First(); - while ( pIt ) - { - TAccInfo* pUserData = (TAccInfo*)pIt->GetUserData(); - if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand ) - { - TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey); - SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, TRUE, LIST_APPEND ); - pE1->SetUserData(pU1); - pE1->EnableChildsOnDemand( FALSE ); - } - pIt = aEntriesBox.Next(pIt); - } - } - } - else - { - // goto selected "key" entry of the key box - SvLBoxEntry* pE2 = 0; - TAccInfo* pU2 = 0; - USHORT nP2 = LISTBOX_ENTRY_NOTFOUND; - SvLBoxEntry* pE3 = 0; - - pE2 = aKeyBox.FirstSelected(); - if (pE2) - pU2 = (TAccInfo*)pE2->GetUserData(); - if (pU2) - nP2 = MapKeyCodeToPos(pU2->m_aKey); - if (nP2 != LISTBOX_ENTRY_NOTFOUND) - pE3 = aEntriesBox.GetEntry( 0, nP2 ); - if (pE3) - { - aEntriesBox.Select( pE3 ); - aEntriesBox.MakeVisible( pE3 ); - } - } - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG ) -{ - css::uno::Reference< css::ui::XAcceleratorConfiguration > xOld = m_xAct; - - if (aOfficeButton.IsChecked()) - m_xAct = m_xGlobal; - else if (aModuleButton.IsChecked()) - m_xAct = m_xModule; - - // nothing changed? => do nothing! - if ( m_xAct.is() && ( xOld == m_xAct ) ) - return 0; - - aEntriesBox.SetUpdateMode( FALSE ); - ResetConfig(); - Init(m_xAct); - aEntriesBox.SetUpdateMode( TRUE ); - aEntriesBox.Invalidate(); - - pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName); - - // pb: #133213# do not select NULL entries - SvLBoxEntry* pEntry = aEntriesBox.GetEntry( 0, 0 ); - if ( pEntry ) - aEntriesBox.Select( pEntry ); - pEntry = pGroupLBox->GetEntry( 0, 0 ); - if ( pEntry ) - pGroupLBox->Select( pEntry ); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 1L; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG ) -{ - DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); - - ::rtl::OUString sCfgName; - if ( ERRCODE_NONE == m_pFileDlg->GetError() ) - sCfgName = m_pFileDlg->GetPath(); - - if ( !sCfgName.getLength() ) - return 0; - - GetTabDialog()->EnterWait(); - - css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; - css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used! - - try - { - // first check if URL points to a document already loaded - xDoc = SearchForAlreadyLoadedDoc(sCfgName); - if (xDoc.is()) - { - // Get ui config manager. There should always be one at the model. - css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); - xCfgMgr = xCfgSupplier->getUIConfigurationManager(); - } - else - { - // URL doesn't point to a loaded document, try to access it as a single storage - // dont forget to release the storage afterwards! - css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sCfgName; - lArgs[1] <<= css::embed::ElementModes::READ; - - xRootStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ); - if (xUIConfig.is()) - { - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xCfgMgrStore->setStorage(xUIConfig); - } - } - - if (xCfgMgr.is()) - { - // open the configuration and update our UI - css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); - - aEntriesBox.SetUpdateMode(FALSE); - ResetConfig(); - Init(xTempAccMgr); - aEntriesBox.SetUpdateMode(TRUE); - aEntriesBox.Invalidate(); - aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); - - } - - // dont forget to close the new opened storage! - // We are the owner of it. - if (xRootStorage.is()) - { - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - GetTabDialog()->LeaveWait(); - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG ) -{ - DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); - - ::rtl::OUString sCfgName; - if ( ERRCODE_NONE == m_pFileDlg->GetError() ) - sCfgName = m_pFileDlg->GetPath(); - - if ( !sCfgName.getLength() ) - return 0; - - GetTabDialog()->EnterWait(); - - css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; - css::uno::Reference< css::embed::XStorage > xRootStorage; - - try - { - // first check if URL points to a document already loaded - xDoc = SearchForAlreadyLoadedDoc(sCfgName); - if (xDoc.is()) - { - // get config manager, force creation if there was none before - css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); - xCfgMgr = xCfgSupplier->getUIConfigurationManager(); - } - else - { - // URL doesn't point to a loaded document, try to access it as a single storage - css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sCfgName; - lArgs[1] <<= css::embed::ElementModes::WRITE; - - xRootStorage = css::uno::Reference< css::embed::XStorage >( - xStorageFactory->createInstanceWithArguments(lArgs), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::embed::XStorage > xUIConfig( - xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::WRITE), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet > xUIConfigProps( - xUIConfig, - css::uno::UNO_QUERY_THROW); - - // set the correct media type if the storage was new created - ::rtl::OUString sMediaType; - xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType; - if (!sMediaType.getLength()) - xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG)); - - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xUICfgStore->setStorage(xUIConfig); - } - - if (xCfgMgr.is()) - { - // get the target configuration access and update with all shortcuts - // which are set currently at the UI ! - // Dont copy the m_xAct content to it ... because m_xAct will be updated - // from the UI on pressing the button "OK" only. And inbetween it's not up to date ! - css::uno::Reference< css::ui::XAcceleratorConfiguration > xTargetAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); - Apply(xTargetAccMgr); - - // commit (order is important!) - css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit1(xTargetAccMgr, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit2(xCfgMgr , css::uno::UNO_QUERY_THROW); - xCommit1->store(); - xCommit2->store(); - - if (xRootStorage.is()) - { - // Commit root storage - css::uno::Reference< css::embed::XTransactedObject > xCommit3(xRootStorage, css::uno::UNO_QUERY_THROW); - xCommit3->commit(); - } - } - - if (xRootStorage.is()) - { - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - GetTabDialog()->LeaveWait(); - - return 0; -} - -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) -{ - ::rtl::OUString aLabel; - if ( aCmdURL.getLength() ) - { - try - { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) - { - uno::Reference< container::XNameAccess > xUICommandLabels; - const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); - uno::Any a = xNameAccess->getByName( aModule ); - uno::Reference< container::XNameAccess > xUICommands; - a >>= xUICommandLabels; - rtl::OUString aStr; - uno::Sequence< beans::PropertyValue > aPropSeq; - a = xUICommandLabels->getByName( aCmdURL ); - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name.equalsAscii( "Name" )) - { - aPropSeq[i].Value >>= aStr; - break; - } - } - } - aLabel = aStr; - } - } - catch ( uno::Exception& ) - { - } - } - - return aLabel; -} - - -//----------------------------------------------- -String SfxAcceleratorConfigPage::GetFunctionName(KeyFuncType eType) const -{ - ::rtl::OUStringBuffer sName(256); - sName.appendAscii("\""); - switch(eType) - { - case KEYFUNC_NEW : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:NewDoc") ) ); - break; - - case KEYFUNC_OPEN : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Open") ) ); - break; - - case KEYFUNC_SAVE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Save") ) ); - break; - - case KEYFUNC_SAVEAS : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:SaveAs") ) ); - break; - - case KEYFUNC_PRINT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Print") ) ); - break; - - case KEYFUNC_CLOSE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Close") ) ); - break; - - case KEYFUNC_QUIT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Quit") ) ); - break; - - case KEYFUNC_CUT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Cut") ) ); - break; - - case KEYFUNC_COPY : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Copy") ) ); - break; - - case KEYFUNC_PASTE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Paste") ) ); - break; - - case KEYFUNC_UNDO : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Undo") ) ); - break; - - case KEYFUNC_REDO : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Redo") ) ); - break; - - case KEYFUNC_DELETE : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Delete") ) ); - break; - - case KEYFUNC_REPEAT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Repeat") ) ); - break; - - case KEYFUNC_FIND : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Search") ) ); - break; - - case KEYFUNC_FINDBACKWARD : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:SearchBackwards") ) ); - break; - - case KEYFUNC_PROPERTIES : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:Options") ) ); - break; - - case KEYFUNC_FRONT : - sName.append( RetrieveLabelFromCommand( ::rtl::OUString::createFromAscii(".uno:ToFront") ) ); - break; - - default: - break; - } - sName.appendAscii("\""); - return String(sName.makeStringAndClear()); -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle ) -{ - bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS ); - short nDialogType = bSave ? css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE - : css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE; - if ( m_pFileDlg ) - delete m_pFileDlg; - m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 ); - - m_pFileDlg->SetTitle( rTitle ); -// m_pFileDlg->SetDialogHelpId( bSave ? HID_CONFIG_SAVE : HID_CONFIG_LOAD ); - m_pFileDlg->AddFilter( aFilterAllStr, DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL ) ); - m_pFileDlg->AddFilter( aFilterCfgStr, DEFINE_CONST_UNICODE( "*.cfg" ) ); - - Link aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl ) - : LINK( this, SfxAcceleratorConfigPage, LoadHdl ); - m_pFileDlg->StartExecuteModal( aDlgClosedLink ); -} - -//----------------------------------------------- -BOOL SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) -{ - Apply(m_xAct); - try - { - m_xAct->store(); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { return FALSE; } - - return TRUE; -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) -{ - // open accelerator configs - // Note: It initialize some other members too, which are needed here ... - // e.g. m_sModuleUIName! - InitAccCfg(); - - // change te description of the radio button, which switch to the module - // dependend accelerator configuration - String sButtonText = aModuleButton.GetText(); - sButtonText.SearchAndReplace(String::CreateFromAscii("$(MODULE)"), m_sModuleUIName); - aModuleButton.SetText(sButtonText); - - if (m_xModule.is()) - aModuleButton.Check(); - else - { - aModuleButton.Hide(); - aOfficeButton.Check(); - } - - RadioHdl(0); - - const SfxPoolItem* pMacroItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, TRUE, &pMacroItem ) ) - { - m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem ); - pGroupLBox->SelectMacro( m_pMacroInfoItem ); - } - else - { - const SfxPoolItem* pStringItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, TRUE, &pStringItem ) ) - m_pStringItem = PTR_CAST( SfxStringItem, pStringItem ); - - const SfxPoolItem* pFontItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, TRUE, &pFontItem ) ) - m_pFontItem = PTR_CAST( SfxStringItem, pFontItem ); - - if ( m_pStringItem ) - pGroupLBox->AddAndSelect( m_pStringItem, m_pFontItem ); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::SelectMacro(const SfxMacroInfoItem *pItem) -{ - m_pMacroInfoItem = pItem; - pGroupLBox->SelectMacro( pItem ); -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::CopySource2Target(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xSourceAccMgr, - const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xTargetAccMgr) -{ - const css::uno::Sequence< css::awt::KeyEvent > lKeys = xSourceAccMgr->getAllKeyEvents(); - sal_Int32 c = lKeys.getLength(); - sal_Int32 i = 0; - for (i=0; i<c; ++i) - { - const css::awt::KeyEvent& rKey = lKeys[i]; - ::rtl::OUString sCommand = xSourceAccMgr->getCommandByKeyEvent(rKey); - xTargetAccMgr->setKeyEvent(rKey, sCommand); - } -} - -//----------------------------------------------- -KeyCode SfxAcceleratorConfigPage::MapPosToKeyCode(USHORT nPos) const -{ - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - KeyCode aCode(KEYCODE_ARRAY[pEntry->m_nKeyPos] & 0xFFF , - KEYCODE_ARRAY[pEntry->m_nKeyPos] & (KEY_SHIFT | KEY_MOD2)); - return aCode; -} - -//----------------------------------------------- -USHORT SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const -{ - USHORT nCode1 = aKey.GetCode()+aKey.GetModifier(); - SvLBoxEntry* pEntry = aEntriesBox.First(); - USHORT i = 0; - - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - { - USHORT nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier(); - if (nCode1 == nCode2) - return i; - } - pEntry = aEntriesBox.Next(pEntry); - ++i; - } - - return LISTBOX_ENTRY_NOTFOUND; -} - -//----------------------------------------------- -String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand) -{ - try - { - // check global command configuration first - css::uno::Reference< css::container::XNameAccess > xModuleConf; - m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf; - if (xModuleConf.is()) - { - ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand)); - String sLabel = String(lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, ::rtl::OUString())); - if (sLabel.Len()) - return sLabel; - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - // may be it's a style URL .. they must be handled special - SfxStyleInfo_Impl aStyle; - aStyle.sCommand = sCommand; - if (m_aStylesInfo.parseStyleCommand(aStyle)) - { - m_aStylesInfo.getLabel4Style(aStyle); - return aStyle.sLabel; - } - else - { - String aRet( String::CreateFromAscii("Symbols: ") ); - xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string="); - if ( nPos == 0 ) - { - aRet += String( sCommand, 34, sCommand.Len()-34 ); - return aRet; - } - } - - return sCommand; -} - -SfxTabPage* SfxAcceleratorConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SfxAcceleratorConfigPage( pParent, rAttrSet ); -} - -//----------------------------------------------- -css::uno::Reference< css::frame::XModel > SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const String& /*sName*/) -{ - return css::uno::Reference< css::frame::XModel >(); -} - -SvxShortcutAssignDlg::SvxShortcutAssignDlg( Window* pParent, const uno::Reference< frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) - : SfxSingleTabDialog( pParent, rSet, 0 ) -{ - SfxTabPage* pPage = SfxAcceleratorConfigPage::Create( this, rSet ); - pPage->SetFrame( rxDocumentFrame ); - SetTabPage( pPage ); - -} - -SvxShortcutAssignDlg::~SvxShortcutAssignDlg() -{ -} - - -// .uno:InsertSymbol?Symbols:string=bla diff --git a/svx/source/cui/acccfg.hrc b/svx/source/cui/acccfg.hrc deleted file mode 100644 index 4fecaf4cb1..0000000000 --- a/svx/source/cui/acccfg.hrc +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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: cfg.hrc,v $ - * $Revision: 1.8 $ - * - * 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. - * - ************************************************************************/ - -#define GRP_FUNCTIONS 22 -#define BTN_ACC_OK 1 -#define BTN_ACC_CANCEL 2 -#define BTN_ACC_CHANGE 3 -#define BTN_ACC_REMOVE 4 -#define BOX_ACC_ENTRIES 5 -#define TXT_ACC_DESCRIPTIONTEXT 6 -#define TXT_ACC_DESCRIPTIONINFO 7 -#define GRP_ACC_KEYBOARD 8 -#define TXT_ACC_GROUP 9 -#define BOX_ACC_GROUP 10 -#define TXT_ACC_FUNCTION 11 -#define BOX_ACC_FUNCTION 12 -#define TXT_ACC_KEY 13 -#define BOX_ACC_KEY 14 -#define GRP_ACC_FUNCTIONS 15 -#define BTN_RESET 20 -#define BTN_LOAD 40 -#define BTN_SAVE 41 -#define RB_OFFICE 44 -#define RB_MODULE 45 -#define STR_LOADACCELCONFIG 46 -#define STR_SAVEACCELCONFIG 47 - -#define IMG_HARDDISK 48 -#define IMG_HARDDISK_HC 49 -#define STR_PRODMACROS 50 -#define STR_MYMACROS 51 -#define IMG_LIB 52 -#define IMG_LIB_HC 53 -#define IMG_MACRO 54 -#define IMG_MACRO_HC 55 -#define IMG_DOC 56 -#define IMG_DOC_HC 57 -#define STR_GROUP_STYLES 58 -#define STR_PDF_EXPORT_SEND 59 -#define STR_RECHECK_DOCUMENT 60 -#define IMG_INFO 61 -#define STR_BASICNAME 62 -#define BMP_COLLAPSED 63 -#define BMP_EXPANDED 64 -#define BMP_COLLAPSED_HC 65 -#define BMP_EXPANDED_HC 66 -#define STR_BASICMACROS 67 -#define STR_DLG_MACROS 68 -#define STR_HUMAN_APPNAME 69 -#define STR_FILTERNAME_CFG 70 - diff --git a/svx/source/cui/acccfg.hxx b/svx/source/cui/acccfg.hxx deleted file mode 100644 index d115544cfb..0000000000 --- a/svx/source/cui/acccfg.hxx +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************* - * - * 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: acccfg.hxx,v $ - * $Revision: 1.7 $ - * - * 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 _ACCCFG_HXX -#define _ACCCFG_HXX - -// #include ***************************************************************** - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XIndexContainer.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <com/sun/star/script/browse/XBrowseNode.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XFrame.hpp> - -#include <algorithm> - -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/group.hxx> -#include <svtools/svtabbx.hxx> -#include <svtools/svtreebx.hxx> -#include <sfx2/tabdlg.hxx> -#include <sfx2/basedlgs.hxx> - -#define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> - -#include <sfx2/minarray.hxx> - -#include "cfgutil.hxx" - -// class SfxAcceleratorConfigListBox ************************************************* - -#define css ::com::sun::star - -class SfxMacroInfoItem; -class SfxConfigGroupListBox_Impl; -class SfxConfigFunctionListBox_Impl; -class SfxAcceleratorConfigPage; - -class SfxAccCfgTabListBox_Impl : public SvTabListBox -{ - SfxAcceleratorConfigPage* m_pAccelConfigPage; - - void KeyInput( const KeyEvent &rKEvt ); - -protected: - virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind ); - -public: - SfxAccCfgTabListBox_Impl( - SfxAcceleratorConfigPage* pAccelConfigPage, - Window *pParent, - const ResId &rResId ) : - SvTabListBox( pParent, rResId ), - m_pAccelConfigPage( pAccelConfigPage ) - {} - - void ReplaceEntry( USHORT nPos, const String &rStr ); -}; - -// class SfxAcceleratorConfigPage ---------------------------------------- - -struct TAccInfo -{ - public: - - TAccInfo( sal_Int32 nKeyPos , - sal_Int32 nListPos, - const KeyCode& aKey ) - : m_nKeyPos (nKeyPos ) - , m_nListPos (nListPos ) - , m_bIsConfigurable(sal_True ) - , m_sCommand ( ) - , m_aKey (aKey ) - // its important to set TRUE as default - - // because only fix entries will be disabled later ... - {} - - sal_Bool isConfigured() const - { - return (m_nKeyPos>-1 && m_nListPos>-1 && m_sCommand.getLength()); - } - - sal_Int32 m_nKeyPos; - sal_Int32 m_nListPos; - sal_Bool m_bIsConfigurable; - ::rtl::OUString m_sCommand; - KeyCode m_aKey; -}; - -namespace sfx2 -{ - class FileDialogHelper; -} - -class SfxAcceleratorConfigPage : public SfxTabPage -{ - friend class SfxAccCfgTabListBox_Impl; -private: - const SfxMacroInfoItem* m_pMacroInfoItem; - const SfxStringItem* m_pStringItem; - const SfxStringItem* m_pFontItem; - sfx2::FileDialogHelper* m_pFileDlg; - - SfxAccCfgTabListBox_Impl aEntriesBox; - FixedLine aKeyboardGroup; - RadioButton aOfficeButton; - RadioButton aModuleButton; - PushButton aChangeButton; - PushButton aRemoveButton; - FixedText aGroupText; - SfxConfigGroupListBox_Impl* pGroupLBox; - FixedText aFunctionText; - SfxConfigFunctionListBox_Impl* pFunctionBox; - FixedText aKeyText; - SvTreeListBox aKeyBox; - FixedLine aFunctionsGroup; - PushButton aLoadButton; - PushButton aSaveButton; - PushButton aResetButton; - String aLoadAccelConfigStr; - String aSaveAccelConfigStr; - String aFilterAllStr; - String aFilterCfgStr; - SfxStylesInfo_Impl m_aStylesInfo; - sal_Bool m_bStylesInfoInitialized; - - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct; - css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription; - css::uno::Reference< css::frame::XFrame > m_xFrame; - - ::rtl::OUString m_sModuleLongName; - ::rtl::OUString m_sModuleShortName; - ::rtl::OUString m_sModuleUIName; - - DECL_LINK( ChangeHdl, Button * ); - DECL_LINK( RemoveHdl, Button * ); - DECL_LINK( SelectHdl, Control * ); - DECL_LINK( Save, Button * ); - DECL_LINK( Load, Button * ); - DECL_LINK( Default, PushButton * ); - DECL_LINK( RadioHdl, RadioButton* ); - - DECL_LINK( LoadHdl, sfx2::FileDialogHelper* ); - DECL_LINK( SaveHdl, sfx2::FileDialogHelper* ); - - String GetLabel4Command(const String& sCommand); - void InitAccCfg(); - KeyCode MapPosToKeyCode( USHORT nPos ) const; - USHORT MapKeyCodeToPos( const KeyCode &rCode ) const; - String GetFunctionName( KeyFuncType eType ) const; - css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const String& sName); - void StartFileDialog( WinBits nBits, const String& rTitle ); - - void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr); - void ResetConfig(); - - void CreateCustomItems( SvLBoxEntry* pEntry, const String& aCol1, const String& aCol2 ); - -public: - SfxAcceleratorConfigPage( Window *pParent, const SfxItemSet& rItemSet ); - virtual ~SfxAcceleratorConfigPage(); - - virtual BOOL FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet& ); - - void SelectMacro(const SfxMacroInfoItem*); - void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr); - void CopySource2Target(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xSourceAccMgr, - const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xTargetAccMgr); - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); -}; - - -class SfxAcceleratorConfigListBox : public ListBox -{ - void KeyInput( const KeyEvent &rKEvt ); - -public: - - SfxAcceleratorConfigListBox( Window *pParent, ResId &rResId ) : - ListBox( pParent, rResId ) {} - - void ReplaceEntry( USHORT nPos, const String &rStr ); - void ExpandEntry ( USHORT nPos, const String &rStr ); -}; - -/* -// class USHORTArr ********************************************************** - -DECL_2BYTEARRAY(USHORTArr, USHORT, 10, 10) - -// class SfxAcceleratorConfigDialog ************************************************** - -class SfxAcceleratorConfigDialog : public ModalDialog -{ - OKButton aOKButton; - CancelButton aCancelButton; - PushButton aChangeButton; - PushButton aRemoveButton; - SfxAcceleratorConfigListBox aEntriesBox; - FixedText aDescriptionTextText; - FixedText aDescriptionInfoText; - FixedLine aKeyboardGroup; - FixedText aGroupText; - ListBox aGroupLBox; - FixedText aFunctionText; - ListBox aFunctionBox; - FixedText aKeyText; - ListBox aKeyBox; - FixedLine aFunctionsGroup; - - USHORTArr aAccelArr; - USHORTArr aFunctionArr; - USHORTArr aKeyArr; - - void OKHdl ( Button * ); - void ChangeHdl( Button * ); - void RemoveHdl( Button * ); - void SelectHdl( ListBox *pListBox ); - - KeyCode PosToKeyCode ( USHORT nPos ) const; - USHORT KeyCodeToPos ( const KeyCode &rCode ) const; - String GetFunctionName( KeyFuncType eType ) const; - -public: - - SfxAcceleratorConfigDialog( Window *pParent ); -}; -*/ - -class SvxShortcutAssignDlg : public SfxSingleTabDialog -{ -public: - SvxShortcutAssignDlg( - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, - const SfxItemSet& rSet ); - virtual ~SvxShortcutAssignDlg(); -}; - - - -#undef css - -#endif - diff --git a/svx/source/cui/acccfg.src b/svx/source/cui/acccfg.src deleted file mode 100644 index a8a5ca549b..0000000000 --- a/svx/source/cui/acccfg.src +++ /dev/null @@ -1,360 +0,0 @@ -/************************************************************************* - * - * 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: cfg.src,v $ - * $Revision: 1.47 $ - * - * 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 --------------------------------------------------------------- -#include "helpid.hrc" -#include "svx/dialogs.hrc" -#include "acccfg.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -#define PUSHBUTTON_TEXT_SAVE \ - Text [ en-US ] = "~Save..." ; \ - -#define PUSHBUTTON_TEXT_RESET \ - Text [ en-US ] = "R~eset" ; \ - -#define PUSHBUTTON_TEXT_LOAD \ - Text [ en-US ] = "~Load..." ; \ - -#define PUSHBUTTON_TEXT_REMOVE \ - Text [ en-US ] = "~Delete" ; \ - -#define PUSHBUTTON_TEXT_CHANGE \ - Text [ en-US ] = "~Modify" ; \ - -#define PUSHBUTTON_TEXT_NEW \ - Text [ en-US ] = "~New" ; \ - -#define FIXEDTEXT_TEXT_GROUP \ - Text [ en-US ] = "~Category" ; \ - -#define FIXEDTEXT_TEXT_FUNCTION \ - Text [ en-US ] = "Function" ; \ - -#define GROUPBOX_TEXT_FUNCTIONS \ - Text [ en-US ] = "Functions" ; \ - - // TP_CONFIG_ACCEL ------------------------------------------------------- -TabPage RID_SVXPAGE_KEYBOARD -{ - HelpId = HID_CONFIG_ACCEL ; - Hide = TRUE ; - Size = MAP_APPFONT ( 273 , 258 ) ; - RadioButton RB_OFFICE - { - Pos = MAP_APPFONT ( 192 , 6 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text = "%PRODUCTNAME" ; - }; - RadioButton RB_MODULE - { - Pos = MAP_APPFONT ( 192 , 19 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text = "$(MODULE)" ; - }; - PushButton BTN_ACC_CHANGE - { - Pos = MAP_APPFONT ( 192 , 35 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - PUSHBUTTON_TEXT_CHANGE - }; - PushButton BTN_ACC_REMOVE - { - Pos = MAP_APPFONT ( 192 , 52 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_REMOVE - }; - FixedLine GRP_ACC_KEYBOARD - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Shortcut keys"; - }; - Control BOX_ACC_ENTRIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 174 , 120 ) ; - TabStop = TRUE ; - Group = TRUE ; - HelpId = HID_ACCELCONFIG_LISTBOX ; - }; - FixedLine GRP_ACC_FUNCTIONS - { - Pos = MAP_APPFONT ( 6 , 140 ) ; - Size = MAP_APPFONT ( 258 , 8 ) ; - Group = TRUE ; - GROUPBOX_TEXT_FUNCTIONS - }; - FixedText TXT_ACC_GROUP - { - Pos = MAP_APPFONT ( 12 , 151 ) ; - Size = MAP_APPFONT ( 78 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - FIXEDTEXT_TEXT_GROUP - }; - Control BOX_ACC_GROUP - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 161 ) ; - Size = MAP_APPFONT ( 78 , 91 ) ; - TabStop = TRUE ; - HelpId = HID_CONFIGGROUP_ACC_LISTBOX ; - }; - FixedText TXT_ACC_FUNCTION - { - Pos = MAP_APPFONT ( 93 , 151 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Left = TRUE ; - FIXEDTEXT_TEXT_FUNCTION - }; - Control BOX_ACC_FUNCTION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 93 , 161 ) ; - Size = MAP_APPFONT ( 88 , 91 ) ; - TabStop = TRUE ; - HelpId = HID_CONFIGFUNCTION_ACC_LISTBOX ; - }; - FixedText TXT_ACC_KEY - { - Pos = MAP_APPFONT ( 184 , 151 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "~Keys" ; - Left = TRUE ; - }; - Control BOX_ACC_KEY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 184 , 161 ) ; - Size = MAP_APPFONT ( 80 , 91 ) ; - TabStop = TRUE ; - }; - PushButton BTN_LOAD - { - Pos = MAP_APPFONT ( 192 , 86 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_LOAD - }; - PushButton BTN_SAVE - { - Pos = MAP_APPFONT ( 192 , 103 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_SAVE - }; - PushButton BTN_RESET - { - Pos = MAP_APPFONT ( 192 , 120 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_RESET - }; - String STR_LOADACCELCONFIG - { - Text [ en-US ] = "Load Keyboard Configuration" ; - }; - String STR_SAVEACCELCONFIG - { - Text [ en-US ] = "Save Keyboard Configuration" ; - }; - String STR_SFX_FILTERNAME_ALL - { - Text [ en-US ] = "All files (*.*)" ; - }; - String STR_FILTERNAME_CFG - { - Text [ en-US ] = "Configuration" ; - }; -}; - -Resource RID_SVXPAGE_CONFIGGROUPBOX -{ - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - String STR_BASICMACROS - { - Text [ en-US ] = "BASIC Macros" ; - }; - String STR_DLG_MACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros" ; - }; - String STR_HUMAN_APPNAME - { - TEXT = "%PRODUCTNAME" ; - }; - String STR_GROUP_STYLES - { - Text [ en-US ] = "Styles" ; - }; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_HARDDISK_HC - { - ImageBitmap = Bitmap { File = "harddisk_16_h.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_LIB_HC - { - ImageBitmap = Bitmap { File = "imh30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_MACRO_HC - { - ImageBitmap = Bitmap { File = "imh30821.png"; }; - MASKCOLOR - }; - Image IMG_DOC - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - Image IMG_DOC_HC - { - ImageBitmap = Bitmap { File = "imh30826.png"; }; - MASKCOLOR - }; - String STR_BASICNAME - { - Text = "%PRODUCTNAME Basic" ; - }; - Image BMP_COLLAPSED - { - ImageBitmap = Bitmap - { - File = "plus.bmp" ; - }; - // MaskColor = Color { Predefine = COL_GREEN ; }; - }; - Image BMP_EXPANDED - { - ImageBitmap = Bitmap - { - File = "minus.bmp" ; - }; - // MaskColor = Color { Predefine = COL_GREEN ; }; - }; - Image BMP_EXPANDED_HC - { - ImageBitmap = Bitmap - { - File = "minus_h.bmp" ; - }; - }; - Image BMP_COLLAPSED_HC - { - ImageBitmap = Bitmap - { - File = "plus_h.bmp" ; - }; - }; -}; - - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svx/source/cui/align.cxx b/svx/source/cui/align.cxx deleted file mode 100644 index 8e84817027..0000000000 --- a/svx/source/cui/align.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/************************************************************************* - * - * 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: align.cxx,v $ - * $Revision: 1.26.272.1 $ - * - * 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_svx.hxx" - -#ifdef SVX_DLLIMPLEMENTATION -#undef SVX_DLLIMPLEMENTATION -#endif - -// include --------------------------------------------------------------- - -#include <svx/svxenum.hxx> - -#include <svx/dialogs.hrc> -#include "align.hrc" -#include "rotmodit.hxx" - -#include <svx/algitem.hxx> -#include <svx/frmdiritem.hxx> -#include "align.hxx" -#include <svx/dialmgr.hxx> -#include "dlgutil.hxx" -#include <tools/shl.hxx> -#include <sfx2/app.hxx> -#include <sfx2/module.hxx> -#include <sfx2/itemconnect.hxx> -#include <svtools/cjkoptions.hxx> -#include <svtools/languageoptions.hxx> -#include <svtools/localresaccess.hxx> -#include <svx/svxids.hrc> //CHINA001 -#include "flagsdef.hxx" //CHINA001 -#include <svtools/intitem.hxx> //CHINA001 -#include <sfx2/request.hxx> //CHINA001 - -namespace svx { - -// item connections =========================================================== - -// horizontal alignment ------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, USHORT > HorJustItemWrapper; -typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection; - -static const HorJustConnection::MapEntryType s_pHorJustMap[] = -{ - { ALIGNDLG_HORALIGN_STD, SVX_HOR_JUSTIFY_STANDARD }, - { ALIGNDLG_HORALIGN_LEFT, SVX_HOR_JUSTIFY_LEFT }, - { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER }, - { ALIGNDLG_HORALIGN_RIGHT, SVX_HOR_JUSTIFY_RIGHT }, - { ALIGNDLG_HORALIGN_BLOCK, SVX_HOR_JUSTIFY_BLOCK }, - { ALIGNDLG_HORALIGN_FILL, SVX_HOR_JUSTIFY_REPEAT }, - { LISTBOX_ENTRY_NOTFOUND, SVX_HOR_JUSTIFY_STANDARD } -}; - -// vertical alignment --------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, USHORT > VerJustItemWrapper; -typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection; - -static const VerJustConnection::MapEntryType s_pVerJustMap[] = -{ - { ALIGNDLG_VERALIGN_STD, SVX_VER_JUSTIFY_STANDARD }, - { ALIGNDLG_VERALIGN_TOP, SVX_VER_JUSTIFY_TOP }, - { ALIGNDLG_VERALIGN_MID, SVX_VER_JUSTIFY_CENTER }, - { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM }, - { LISTBOX_ENTRY_NOTFOUND, SVX_VER_JUSTIFY_STANDARD } -}; - -// cell rotate mode ----------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, USHORT > RotateModeItemWrapper; -typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection; - -static const RotateModeConnection::MapEntryType s_pRotateModeMap[] = -{ - { IID_BOTTOMLOCK, SVX_ROTATE_MODE_BOTTOM }, - { IID_TOPLOCK, SVX_ROTATE_MODE_TOP }, - { IID_CELLLOCK, SVX_ROTATE_MODE_STANDARD }, - { VALUESET_ITEM_NOTFOUND, SVX_ROTATE_MODE_STANDARD } -}; - -// ============================================================================ - -static USHORT s_pRanges[] = -{ - SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY, - SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK, - SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT, - SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES, - SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS, - SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION, - SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL, - SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION, - SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT, - 0 -}; - -// ============================================================================ - -AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) : - - SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ), - - maFlAlignment ( this, SVX_RES( FL_ALIGNMENT ) ), - maFtHorAlign ( this, SVX_RES( FT_HORALIGN ) ), - maLbHorAlign ( this, SVX_RES( LB_HORALIGN ) ), - maFtIndent ( this, SVX_RES( FT_INDENT ) ), - maEdIndent ( this, SVX_RES( ED_INDENT ) ), - maFtVerAlign ( this, SVX_RES( FT_VERALIGN ) ), - maLbVerAlign ( this, SVX_RES( LB_VERALIGN ) ), - - maFlOrient ( this, SVX_RES( FL_ORIENTATION ) ), - maCtrlDial ( this, SVX_RES( CTR_DIAL ) ), - maFtRotate ( this, SVX_RES( FT_DEGREES ) ), - maNfRotate ( this, SVX_RES( NF_DEGREES ) ), - maFtRefEdge ( this, SVX_RES( FT_BORDER_LOCK ) ), - maVsRefEdge ( this, SVX_RES( CTR_BORDER_LOCK ) ), - maCbStacked ( this, SVX_RES( BTN_TXTSTACKED ) ), - maCbAsianMode ( this, SVX_RES( BTN_ASIAN_VERTICAL ) ), - maOrientHlp ( maCtrlDial, maNfRotate, maCbStacked ), - - maFlProperties ( this, SVX_RES( FL_WRAP ) ), - maBtnWrap ( this, SVX_RES( BTN_WRAP ) ), - maBtnHyphen ( this, SVX_RES( BTN_HYPH ) ), - maBtnShrink ( this, SVX_RES( BTN_SHRINK ) ), - maFtFrameDir ( this, SVX_RES( FT_TEXTFLOW ) ), - maLbFrameDir ( this, SVX_RES( LB_FRAMEDIR ) ) -{ - InitVsRefEgde(); - - // windows to be disabled, if stacked text is turned ON - maOrientHlp.AddDependentWindow( maFtRotate, STATE_CHECK ); - maOrientHlp.AddDependentWindow( maFtRefEdge, STATE_CHECK ); - maOrientHlp.AddDependentWindow( maVsRefEdge, STATE_CHECK ); - // windows to be disabled, if stacked text is turned OFF - maOrientHlp.AddDependentWindow( maCbAsianMode, STATE_NOCHECK ); - - Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl ); - - maLbHorAlign.SetSelectHdl( aLink ); - maBtnWrap.SetClickHdl( aLink ); - - // Asian vertical mode - maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() ); - - // CTL frame direction - maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); - maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); - maLbFrameDir.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); - if( !SvtLanguageOptions().IsCTLFontEnabled() ) - { - maFtFrameDir.Hide(); - maLbFrameDir.Hide(); - } - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - FreeResource(); - - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) ); -} - -AlignmentTabPage::~AlignmentTabPage() -{ -} - -SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new AlignmentTabPage( pParent, rAttrSet ); -} - -USHORT* AlignmentTabPage::GetRanges() -{ - return s_pRanges; -} - -void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs ) -{ - SfxTabPage::Reset( rCoreAttrs ); - UpdateEnableControls(); -} - -int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxTabPage::DataChanged( rDCEvt ); - if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - svt::OLocalResourceAccess aLocalResAcc( SVX_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE ); - InitVsRefEgde(); - } -} - -void AlignmentTabPage::InitVsRefEgde() -{ - // remember selection - is deleted in call to ValueSet::Clear() - USHORT nSel = maVsRefEdge.GetSelectItemId(); - - ResId aResId( GetSettings().GetStyleSettings().GetHighContrastMode() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, DIALOG_MGR() ); - ImageList aImageList( aResId ); - Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); - - maVsRefEdge.Clear(); - maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - - maVsRefEdge.SetColCount( 3 ); - maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ), String( SVX_RES( STR_BOTTOMLOCK ) ) ); - maVsRefEdge.InsertItem( IID_TOPLOCK, aImageList.GetImage( IID_TOPLOCK ), String( SVX_RES( STR_TOPLOCK ) ) ); - maVsRefEdge.InsertItem( IID_CELLLOCK, aImageList.GetImage( IID_CELLLOCK ), String( SVX_RES( STR_CELLLOCK ) ) ); - - maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) ); - - maVsRefEdge.SelectItem( nSel ); -} - -void AlignmentTabPage::UpdateEnableControls() -{ - USHORT nHorAlign = maLbHorAlign.GetSelectEntryPos(); - bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT); - bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK); - bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL); - - // indent edit field only for left alignment - maFtIndent.Enable( bHorLeft ); - maEdIndent.Enable( bHorLeft ); - - // rotation/stacked disabled for fill alignment - maOrientHlp.Enable( !bHorFill ); - - // hyphenation only for automatic line breaks or for block alignment - maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock ); - - // shrink only without automatic line break, and not for block and fill - maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill ); - - // visibility of fixed lines - maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() ); - maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() ); - maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() ); -} - -IMPL_LINK( AlignmentTabPage, UpdateEnableHdl, void*, EMPTYARG ) -{ - UpdateEnableControls(); - return 0; -} - -// ============================================================================ - -} // namespace svx - diff --git a/svx/source/cui/align.hrc b/svx/source/cui/align.hrc deleted file mode 100644 index 0eb5bf29f1..0000000000 --- a/svx/source/cui/align.hrc +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* - * - * 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: align.hrc,v $ - * $Revision: 1.10 $ - * - * 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_ALIGN_HRC -#define _SVX_ALIGN_HRC - -// defines ------------------------------------------------------------------ - -// resource id's -#define FL_ALIGNMENT 10 -#define FT_HORALIGN 11 -#define LB_HORALIGN 12 -#define FT_INDENT 13 -#define ED_INDENT 14 -#define FT_VERALIGN 15 -#define LB_VERALIGN 16 - -#define FL_ORIENTATION 20 -#define BTN_TXTSTACKED 21 -#define CTR_DIAL 22 -#define FT_DEGREES 23 -#define NF_DEGREES 24 -#define FT_BORDER_LOCK 25 -#define CTR_BORDER_LOCK 26 -#define BTN_ASIAN_VERTICAL 27 - -#define FL_WRAP 40 -#define BTN_WRAP 41 -#define BTN_HYPH 42 -#define FT_TEXTFLOW 43 -#define LB_FRAMEDIR 44 -#define BTN_SHRINK 45 - -//#define ED_INDENT1 100 - -// list box indexes -#define ALIGNDLG_HORALIGN_STD 0 -#define ALIGNDLG_HORALIGN_LEFT 1 -#define ALIGNDLG_HORALIGN_CENTER 2 -#define ALIGNDLG_HORALIGN_RIGHT 3 -#define ALIGNDLG_HORALIGN_BLOCK 4 -#define ALIGNDLG_HORALIGN_FILL 5 - -#define ALIGNDLG_VERALIGN_STD 0 -#define ALIGNDLG_VERALIGN_TOP 1 -#define ALIGNDLG_VERALIGN_MID 2 -#define ALIGNDLG_VERALIGN_BOTTOM 3 - -// image list for ValueSets: -#define IL_LOCK_BMPS 1100 -#define IL_LOCK_BMPS_HC 1101 -#define IID_BOTTOMLOCK 1 -#define IID_TOPLOCK 2 -#define IID_CELLLOCK 3 - -#define STR_BOTTOMLOCK 1 -#define STR_TOPLOCK 2 -#define STR_CELLLOCK 3 - -#endif - diff --git a/svx/source/cui/align.hxx b/svx/source/cui/align.hxx deleted file mode 100644 index 4d93e16872..0000000000 --- a/svx/source/cui/align.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * 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: align.hxx,v $ - * $Revision: 1.7 $ - * - * 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_ALIGN_HXX -#define _SVX_ALIGN_HXX - -// include --------------------------------------------------------------- - - -#ifndef _FIELD_HXX //autogen -#include <vcl/field.hxx> -#endif -#ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> -#endif -#ifndef _FIXED_HXX //autogen -#include <vcl/fixed.hxx> -#endif -#ifndef _LSTBOX_HXX //autogen -#include <vcl/lstbox.hxx> -#endif -#include <sfx2/tabdlg.hxx> -#include <svtools/valueset.hxx> -#include "dialcontrol.hxx" -#include "wrapfield.hxx" -#include "orienthelper.hxx" -#include <svx/frmdirlbox.hxx> - -namespace svx { - -// ============================================================================ - -class AlignmentTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - -public: - virtual ~AlignmentTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - static USHORT* GetRanges(); - - virtual void Reset( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -private: - explicit AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreSet ); - - void InitVsRefEgde(); - void UpdateEnableControls(); - - DECL_LINK( UpdateEnableHdl, void* ); - -private: - FixedLine maFlAlignment; - FixedText maFtHorAlign; - ListBox maLbHorAlign; - FixedText maFtIndent; - MetricField maEdIndent; - FixedText maFtVerAlign; - ListBox maLbVerAlign; - - FixedLine maFlOrient; - DialControl maCtrlDial; - FixedText maFtRotate; - WrapField maNfRotate; - FixedText maFtRefEdge; - ValueSet maVsRefEdge; - TriStateBox maCbStacked; - TriStateBox maCbAsianMode; - OrientationHelper maOrientHlp; - - FixedLine maFlProperties; - TriStateBox maBtnWrap; - TriStateBox maBtnHyphen; - TriStateBox maBtnShrink; - FixedText maFtFrameDir; - FrameDirListBox maLbFrameDir; -}; - -// ============================================================================ - -} // namespace svx - -#endif - diff --git a/svx/source/cui/align.src b/svx/source/cui/align.src deleted file mode 100644 index 9780555d95..0000000000 --- a/svx/source/cui/align.src +++ /dev/null @@ -1,251 +0,0 @@ -/************************************************************************* - * - * 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: align.src,v $ - * $Revision: 1.55 $ - * - * 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 --------------------------------------------------------------- -#include <svx/dialogs.hrc> -#include "helpid.hrc" -#include "align.hrc" - // pragma ---------------------------------------------------------------- - -#define MASKCOLOR \ - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; } - - // define --------------------------------------------------------------- -#define IL_LOCK_MCOL Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } - // RID_SVXPAGE_ALIGNMENT ------------------------------------------------- -TabPage RID_SVXPAGE_ALIGNMENT -{ - HelpId = HID_ALIGNMENT ; - Hide = TRUE ; - Text [ en-US ] = "Alignment" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - FixedLine FL_ALIGNMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Text alignment"; - }; - FixedText FT_HORALIGN - { - Pos = MAP_APPFONT ( 12 ,14 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Hori~zontal"; - }; - ListBox LB_HORALIGN - { - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 25 ); - Size = MAP_APPFONT ( 100 , 60 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Default" ; ALIGNDLG_HORALIGN_STD ; > ; - < "Left" ; ALIGNDLG_HORALIGN_LEFT ; > ; - < "Center" ; ALIGNDLG_HORALIGN_CENTER ; > ; - < "Right" ; ALIGNDLG_HORALIGN_RIGHT ; > ; - < "Justified" ; ALIGNDLG_HORALIGN_BLOCK ; > ; - < "Filled" ; ALIGNDLG_HORALIGN_FILL ; > ; - }; - }; - FixedText FT_INDENT - { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "I~ndent" ; - }; - MetricField ED_INDENT - { - Border = TRUE ; - Pos = MAP_APPFONT ( 118 , 25 ) ; - Size = MAP_APPFONT ( 36 , 12 ) ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 990 ; - SpinSize = 10 ; - Unit = FUNIT_POINT ; - }; - FixedText FT_VERALIGN - { - Pos = MAP_APPFONT ( 160 , 14 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Text [ en-US ] = "~Vertical"; - }; - ListBox LB_VERALIGN - { - Border = TRUE; - Pos = MAP_APPFONT ( 160 , 25 ); - Size = MAP_APPFONT ( 88 , 60 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Default" ; ALIGNDLG_VERALIGN_STD ; > ; - < "Top" ; ALIGNDLG_VERALIGN_TOP ; > ; - < "Middle" ; ALIGNDLG_VERALIGN_MID ; > ; - < "Bottom" ; ALIGNDLG_VERALIGN_BOTTOM ; > ; - }; - }; - FixedLine FL_ORIENTATION - { - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Text orientation" ; - }; - TriStateBox BTN_TXTSTACKED - { - Pos = MAP_APPFONT ( 133 , 54 ) ; - Size = MAP_APPFONT ( 115 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Ve~rtically stacked"; - }; - Control CTR_DIAL - { - HelpId = HID_ALIGNMENT_CTR_DIAL ; - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 42 , 43 ) ; - Text = "ABCD" ; - }; - FixedText FT_DEGREES - { - Pos = MAP_APPFONT ( 72 , 54 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "De~grees"; - }; - NumericField NF_DEGREES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 65 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 359 ; - SpinSize = 5 ; - StrictFormat = TRUE ; - }; - FixedText FT_BORDER_LOCK - { - Pos = MAP_APPFONT ( 72 , 83 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Re~ference edge" ; - }; - Control CTR_BORDER_LOCK - { - HelpId = HID_ALIGNMENT_CTR_BORDER_LOCK ; - Pos = MAP_APPFONT ( 72 , 94 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - TabStop = TRUE ; - }; - TriStateBox BTN_ASIAN_VERTICAL - { - Pos = MAP_APPFONT ( 143 , 68 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Asian layout ~mode" ; - }; - FixedLine FL_WRAP - { - Pos = MAP_APPFONT ( 6 , 115 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Properties" ; - }; - TriStateBox BTN_WRAP - { - Pos = MAP_APPFONT ( 12 , 126 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "~Wrap text automatically" ; - }; - TriStateBox BTN_HYPH - { - Pos = MAP_APPFONT ( 22 , 139 ) ; - Size = MAP_APPFONT ( 226 , 10 ) ; - Text [ en-US ] = "Hyphenation ~active"; - }; - TriStateBox BTN_SHRINK - { - Pos = MAP_APPFONT( 12, 152 ); - Size = MAP_APPFONT( 236, 10 ); - Text [ en-US ] = "~Shrink to fit cell size"; - }; - FixedText FT_TEXTFLOW - { - Pos = MAP_APPFONT( 12 , 170 ); - Size = MAP_APPFONT( 64 , 8 ); - Text [ en-US ] = "Te~xt direction"; - }; - ListBox LB_FRAMEDIR - { - Pos = MAP_APPFONT( 78 , 168 ); - Size = MAP_APPFONT( 170 , 50 ); - Border = TRUE; - DropDown = TRUE; - }; - ImageList IL_LOCK_BMPS - { - Prefix = "lo"; - MaskColor = IL_LOCK_MCOL ; - IdList = - { - IID_BOTTOMLOCK ; - IID_TOPLOCK ; - IID_CELLLOCK ; - }; - IdCount = { 3 ; }; - }; - ImageList IL_LOCK_BMPS_HC - { - Prefix = "loh"; - MaskColor = IL_LOCK_MCOL ; - IdList = - { - IID_BOTTOMLOCK ; - IID_TOPLOCK ; - IID_CELLLOCK ; - }; - IdCount = { 3 ; }; - }; - String STR_BOTTOMLOCK - { - Text [ en-US ] = "Text Extension From Lower Cell Border" ; - }; - String STR_TOPLOCK - { - Text [ en-US ] = "Text Extension From Upper Cell Border" ; - }; - String STR_CELLLOCK - { - Text [ en-US ] = "Text Extension Inside Cell" ; - }; -}; - // ********************************************************************** EOF - diff --git a/svx/source/cui/autocdlg.cxx b/svx/source/cui/autocdlg.cxx deleted file mode 100644 index 4da7f0d8d8..0000000000 --- a/svx/source/cui/autocdlg.cxx +++ /dev/null @@ -1,2780 +0,0 @@ -/************************************************************************* - * - * 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: autocdlg.cxx,v $ - * $Revision: 1.25 $ - * - * 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_svx.hxx" - -#ifdef SVX_DLLIMPLEMENTATION -#undef SVX_DLLIMPLEMENTATION -#endif - -#define _SVSTDARR_STRINGSISORTDTOR -#define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/field.hxx> -#include <vcl/keycodes.hxx> -#include <sot/exchange.hxx> -#include <svtools/transfer.hxx> -#include <svtools/syslocale.hxx> -#include <sfx2/objsh.hxx> -#include <sfx2/viewsh.hxx> -#include <unotools/charclass.hxx> -#include <unotools/collatorwrapper.hxx> -#include <com/sun/star/i18n/CollatorOptions.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <comphelper/processfactory.hxx> - -#include <vcl/svapp.hxx> -#include <sfx2/module.hxx> -#include <sfx2/request.hxx> -#include <sfx2/sfxsids.hrc> -#include <svtools/eitem.hxx> -#include <svtools/languageoptions.hxx> -#include <svx/SmartTagMgr.hxx> -#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp> -#include <com/sun/star/smarttags/XSmartTagAction.hpp> - -#define _OFA_AUTOCDLG_CXX -#include "autocdlg.hxx" -#include "autocdlg.hrc" -#include "helpid.hrc" -#include "acorrcfg.hxx" -#include <svx/svxacorr.hxx> -#include "cuicharmap.hxx" -#include "unolingu.hxx" -#include <svx/dialmgr.hxx> - -static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM; - -using namespace ::com::sun::star::util; -using namespace ::com::sun::star; -using namespace ::rtl; - -static ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact() -{ - static ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > xMSF = - ::comphelper::getProcessServiceFactory(); - return xMSF; -} - -/*-----------------14.10.96 15.47------------------- - ---------------------------------------------------*/ - -OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) : - SfxTabDialog(pParent, SVX_RES( RID_OFA_AUTOCORR_DLG ), _pSet), - aLanguageFT( this, SVX_RES(FT_LANG )), - aLanguageLB( this, SVX_RES(LB_LANG )) -{ - BOOL bShowSWOptions = FALSE; - BOOL bOpenSmartTagOptions = FALSE; - - if ( _pSet ) - { - SFX_ITEMSET_ARG( _pSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, FALSE ); - if ( pItem && pItem->GetValue() ) - bShowSWOptions = TRUE; - - SFX_ITEMSET_ARG( _pSet, pItem2, SfxBoolItem, SID_OPEN_SMARTTAGOPTIONS, FALSE ); - if ( pItem2 && pItem2->GetValue() ) - bOpenSmartTagOptions = TRUE; - } - - aLanguageFT.SetZOrder(0, WINDOW_ZORDER_FIRST); - aLanguageLB.SetZOrder(&aLanguageFT, WINDOW_ZORDER_BEHIND); - aLanguageLB.SetHelpId(HID_AUTOCORR_LANGUAGE); - FreeResource(); - - AddTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS, OfaAutocorrOptionsPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOFMT_APPLY, OfaSwAutoFmtOptionsPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS, OfaAutoCompleteTabPage::Create, 0); - AddTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS, OfaSmartTagOptionsTabPage::Create, 0); - - if (!bShowSWOptions) - { - RemoveTabPage(RID_OFAPAGE_AUTOFMT_APPLY); - RemoveTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS); - RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); - } - else - { - // remove smart tag tab page if no extensions are installed - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() ) - RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); - - RemoveTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS); - } - - AddTabPage(RID_OFAPAGE_AUTOCORR_REPLACE, OfaAutocorrReplacePage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCORR_EXCEPT, OfaAutocorrExceptPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCORR_QUOTE, OfaQuoteTabPage::Create, 0); - - // initialize languages - //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType - //! will be set to LANGUAGE_DONTKNOW - sal_Int16 nLangList = LANG_LIST_WESTERN; - - if( SvtLanguageOptions().IsCTLFontEnabled() ) - nLangList |= LANG_LIST_CTL; - aLanguageLB.SetLanguageList( nLangList, TRUE, TRUE ); - aLanguageLB.SelectLanguage( LANGUAGE_NONE ); - USHORT nPos = aLanguageLB.GetSelectEntryPos(); - DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); - aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW ); - - // Initialisierung funktionier fuer static nicht unter Linux - deswegen hier - if( LANGUAGE_SYSTEM == eLastDialogLanguage ) - eLastDialogLanguage = Application::GetSettings().GetLanguage(); - - LanguageType nSelectLang = LANGUAGE_DONTKNOW; - nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage ); - if (LISTBOX_ENTRY_NOTFOUND != nPos) - nSelectLang = eLastDialogLanguage; - aLanguageLB.SelectLanguage( nSelectLang ); - - aLanguageLB.SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); - - Size aMinSize(aLanguageFT.CalcMinimumSize()); - //reserve some extra space for CJK accelerators that are possible inserted - //later (like '(A)') - aLanguageFT.SetPosSizePixel( 0, 0, aMinSize.Width() + 20, 0, WINDOW_POSSIZE_WIDTH ); - - if ( bOpenSmartTagOptions ) - SetCurPageId( RID_OFAPAGE_SMARTTAG_OPTIONS ); -} -/*-----------------16.10.96 14.06------------------- - ---------------------------------------------------*/ - -BOOL lcl_FindEntry( ListBox& rLB, const String& rEntry, - CollatorWrapper& rCmpClass ) -{ - USHORT nCount = rLB.GetEntryCount(); - USHORT nSelPos = rLB.GetSelectEntryPos(); - USHORT i; - for(i = 0; i < nCount; i++) - { - if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) )) - { - rLB.SelectEntryPos(i, TRUE); - return TRUE; - } - } - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - rLB.SelectEntryPos(nSelPos, FALSE); - return FALSE; -} - -/* -----------------23.11.98 10:46------------------- - * - * --------------------------------------------------*/ -IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox*, pBox) -{ - USHORT nPos = pBox->GetSelectEntryPos(); - void* pVoid = pBox->GetEntryData(nPos); - LanguageType eNewLang = (LanguageType)(long)pVoid; - //alte Einstellungen speichern und neu fuellen - if(eNewLang != eLastDialogLanguage) - { - USHORT nPageId = GetCurPageId(); - if(RID_OFAPAGE_AUTOCORR_REPLACE == nPageId) - ((OfaAutocorrReplacePage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); - else if(RID_OFAPAGE_AUTOCORR_EXCEPT == nPageId) - ((OfaAutocorrExceptPage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); - } - return 0; -} -/*-----------------14.10.96 15.57------------------- - ---------------------------------------------------*/ - -OfaAutocorrOptionsPage::OfaAutocorrOptionsPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_OPTIONS ), rSet), - aCheckLB (this, SVX_RES(CLB_SETTINGS )), - - sInput (SVX_RES(ST_USE_REPLACE )), - sDoubleCaps (SVX_RES(ST_CPTL_STT_WORD )), - sStartCap (SVX_RES(ST_CPTL_STT_SENT )), - sBoldUnderline (SVX_RES(ST_BOLD_UNDER )), - sURL (SVX_RES(ST_DETECT_URL )), - sNoDblSpaces (SVX_RES(STR_NO_DBL_SPACES )), - sHalf (SVX_RES(ST_FRACTION )), - sDash (SVX_RES(ST_DASH )), - sFirst (SVX_RES(ST_ORDINAL )) -{ - FreeResource(); - - aCheckLB.SetHelpId(HID_OFAPAGE_AUTOCORR_CLB); -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage() -{ -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrOptionsPage(pParent, rSet); -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -BOOL OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - long nFlags = pAutoCorrect->GetFlags(); - - USHORT nPos = 0; - pAutoCorrect->SetAutoCorrFlag(Autocorrect, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(SetINetAttr, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace, aCheckLB.IsChecked(nPos++)); - - BOOL bReturn = nFlags != pAutoCorrect->GetFlags(); - if(bReturn ) - { - SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); - pCfg->SetModified(); - pCfg->Commit(); - } - return bReturn; -} - -/* -----------------23.11.98 16:15------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -void OfaAutocorrOptionsPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - const long nFlags = pAutoCorrect->GetFlags(); - - aCheckLB.SetUpdateMode(FALSE); - aCheckLB.Clear(); - - aCheckLB.InsertEntry(sInput); - aCheckLB.InsertEntry(sDoubleCaps); - aCheckLB.InsertEntry(sStartCap); - aCheckLB.InsertEntry(sBoldUnderline); - aCheckLB.InsertEntry(sURL); - aCheckLB.InsertEntry(sFirst); - aCheckLB.InsertEntry(sHalf); - aCheckLB.InsertEntry(sDash); - aCheckLB.InsertEntry(sNoDblSpaces); - - USHORT nPos = 0; - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & Autocorrect) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttWrd) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttSntnc) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgWeightUnderl) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & SetINetAttr) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgOrdinalNumber) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgFractionSymbol) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgToEnEmDash) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & IngnoreDoubleSpace) ); - - aCheckLB.SetUpdateMode(TRUE); -} - -/*********************************************************************/ -/* */ -/* Hilfs-struct fuer dUserDaten der Checklistbox */ -/* */ -/*********************************************************************/ - -struct ImpUserData -{ - String *pString; - Font* pFont; - - ImpUserData(String* pText, Font* pFnt) - { pString = pText; pFont = pFnt;} -}; - - -/*********************************************************************/ -/* */ -/* Dialog fuer Prozenteinstellung */ -/* */ -/*********************************************************************/ - -class OfaAutoFmtPrcntSet : public ModalDialog -{ - OKButton aOKPB; - CancelButton aCancelPB; - FixedLine aPrcntFL; - MetricField aPrcntMF; - - public: - OfaAutoFmtPrcntSet(Window* pParent) : - ModalDialog(pParent, SVX_RES(RID_OFADLG_PRCNT_SET)), - aOKPB(this, SVX_RES(BT_OK)), - aCancelPB(this, SVX_RES(BT_CANCEL)), - aPrcntFL(this, SVX_RES(FL_PRCNT)), - aPrcntMF(this, SVX_RES(ED_RIGHT_MARGIN)) - { - FreeResource(); - } - MetricField& GetPrcntFld(){return aPrcntMF;} -}; - - -/*********************************************************************/ -/* */ -/* veraenderter LBoxString */ -/* */ -/*********************************************************************/ - -class OfaImpBrwString : public SvLBoxString -{ -public: - - OfaImpBrwString( SvLBoxEntry* pEntry, USHORT nFlags, - const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} - - virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, - SvLBoxEntry* pEntry); -}; - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -void __EXPORT OfaImpBrwString::Paint( const Point& rPos, SvLBox& rDev, USHORT /*nFlags*/, - SvLBoxEntry* pEntry ) -{ - rDev.DrawText( rPos, GetText() ); - if(pEntry->GetUserData()) - { - ImpUserData* pUserData = (ImpUserData* )pEntry->GetUserData(); - Point aNewPos(rPos); - aNewPos.X() += rDev.GetTextWidth(GetText()); - Font aOldFont( rDev.GetFont()); - Font aFont( aOldFont ); - if(pUserData->pFont) - { - aFont = *pUserData->pFont; - aFont.SetColor(aOldFont.GetColor()); - aFont.SetSize(aOldFont.GetSize()); - } - aFont.SetWeight( WEIGHT_BOLD ); - - BOOL bFett = TRUE; - USHORT nPos = 0; - do { - String sTxt( pUserData->pString->GetToken( 0, 1, nPos )); - - if( bFett ) - rDev.SetFont( aFont ); - - rDev.DrawText( aNewPos, sTxt ); - - if( STRING_NOTFOUND != nPos ) - aNewPos.X() += rDev.GetTextWidth( sTxt ); - - if( bFett ) - rDev.SetFont( aOldFont ); - - bFett = !bFett; - } while( STRING_NOTFOUND != nPos ); - } -} - -/*********************************************************************/ -/* */ -/* TabPage Autoformat anwenden */ -/* */ -/*********************************************************************/ - -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 -#define CBCOL_BOTH 2 - -enum OfaAutoFmtOptions -{ - USE_REPLACE_TABLE, - CORR_UPPER, - BEGIN_UPPER, - BOLD_UNDERLINE, - DETECT_URL, - REPLACE_1ST, - REPLACE_HALF, - REPLACE_DASHES, - DEL_SPACES_AT_STT_END, - DEL_SPACES_BETWEEN_LINES, - IGNORE_DBLSPACE, - APPLY_NUMBERING, - INSERT_BORDER, - CREATE_TABLE, - REPLACE_STYLES, - DEL_EMPTY_NODE, - REPLACE_USER_COLL, - REPLACE_BULLETS, - REPLACE_QUOTATION, - MERGE_SINGLE_LINE_PARA -}; - -OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, SVX_RES(RID_OFAPAGE_AUTOFMT_APPLY), rSet), - aCheckLB (this, SVX_RES(CLB_SETTINGS)), - aEditPB (this, SVX_RES(PB_EDIT)), - aHeader1Expl (this, SVX_RES(FT_HEADER1_EXPLANATION)), - aHeader2Expl (this, SVX_RES(FT_HEADER2_EXPLANATION)), - sHeader1 (SVX_RES( STR_HEADER1 )), - sHeader2 (SVX_RES( STR_HEADER2 )), - sDeleteEmptyPara (SVX_RES( ST_DEL_EMPTY_PARA)), - sUseReplaceTbl (SVX_RES( ST_USE_REPLACE )), - sCptlSttWord (SVX_RES( ST_CPTL_STT_WORD)), - sCptlSttSent (SVX_RES( ST_CPTL_STT_SENT)), - sTypo (SVX_RES( ST_TYPO )), - sUserStyle (SVX_RES( ST_USER_STYLE )), - sBullet (SVX_RES( ST_BULLET )), - sBoldUnder (SVX_RES( ST_BOLD_UNDER )), - sNoDblSpaces (SVX_RES( STR_NO_DBL_SPACES)), - sFraction (SVX_RES( ST_FRACTION )), - sDetectURL (SVX_RES( ST_DETECT_URL )), - sDash (SVX_RES( ST_DASH )), - sOrdinal (SVX_RES( ST_ORDINAL )), - sRightMargin (SVX_RES( ST_RIGHT_MARGIN )), - sNum (SVX_RES( STR_NUM )), - sBorder (SVX_RES( STR_BORDER )), - sTable (SVX_RES( STR_TABLE )), - sReplaceTemplates (SVX_RES( STR_REPLACE_TEMPLATES)), - sDelSpaceAtSttEnd (SVX_RES( STR_DEL_SPACES_AT_STT_END)), - sDelSpaceBetweenLines(SVX_RES(STR_DEL_SPACES_BETWEEN_LINES)), - - nPercent ( 50 ), - pCheckButtonData( NULL ) - -{ - FreeResource(); - - //typ. Anfuehrungszeichen einsetzen - SvtSysLocale aSysLcl; - const LocaleDataWrapper& rLcl = aSysLcl.GetLocaleData(); - sTypo.SearchAndReplace( String::CreateFromAscii("%1"), - rLcl.getDoubleQuotationMarkStart()); - sTypo.SearchAndReplace( String::CreateFromAscii("%2"), - rLcl.getDoubleQuotationMarkEnd()); - - aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB); - aCheckLB.SetWindowBits(WB_HSCROLL| WB_VSCROLL); - - aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl)); - aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); - - static long aStaticTabs[]= - { - 3, 0, 20, 40 - }; - - aCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); - String sHeader( sHeader1 ); - sHeader += '\t'; - sHeader += sHeader2; - sHeader += '\t'; - aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, - HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); - - aEditPB.SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SvLBoxEntry* OfaSwAutoFmtOptionsPage::CreateEntry(String& rTxt, USHORT nCol) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if ( !pCheckButtonData ) - { - pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); - aCheckLB.SetCheckButtonData( pCheckButtonData ); - } - - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - - String sEmpty; - if (nCol == CBCOL_SECOND) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - - if (nCol == CBCOL_FIRST) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); - - return pEntry; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -__EXPORT OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage() -{ - delete (ImpUserData*) aCheckLB.GetUserData( REPLACE_BULLETS ); - delete (ImpUserData*) aCheckLB.GetUserData( APPLY_NUMBERING ); - delete (ImpUserData*) aCheckLB.GetUserData( MERGE_SINGLE_LINE_PARA ); - delete pCheckButtonData; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SfxTabPage* __EXPORT OfaSwAutoFmtOptionsPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new OfaSwAutoFmtOptionsPage(pParent, rAttrSet); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -BOOL OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& ) -{ - BOOL bModified = FALSE; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - long nFlags = pAutoCorrect->GetFlags(); - - BOOL bCheck = aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_FIRST); - bModified |= pOpt->bAutoCorrect != bCheck; - pOpt->bAutoCorrect = bCheck; - pAutoCorrect->SetAutoCorrFlag(Autocorrect, - aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(CORR_UPPER, CBCOL_FIRST); - bModified |= pOpt->bCptlSttWrd != bCheck; - pOpt->bCptlSttWrd = bCheck; - pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, - aCheckLB.IsChecked(CORR_UPPER, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_FIRST); - bModified |= pOpt->bCptlSttSntnc != bCheck; - pOpt->bCptlSttSntnc = bCheck; - pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, - aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_FIRST); - bModified |= pOpt->bChgWeightUnderl != bCheck; - pOpt->bChgWeightUnderl = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, - aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_SECOND)); - - pAutoCorrect->SetAutoCorrFlag(IngnoreDoubleSpace, - aCheckLB.IsChecked(IGNORE_DBLSPACE, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DETECT_URL, CBCOL_FIRST); - bModified |= pOpt->bSetINetAttr != bCheck; - pOpt->bSetINetAttr = bCheck; - pAutoCorrect->SetAutoCorrFlag(SetINetAttr, - aCheckLB.IsChecked(DETECT_URL, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(REPLACE_1ST, CBCOL_FIRST); - bModified |= pOpt->bChgOrdinalNumber != bCheck; - pOpt->bChgOrdinalNumber = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, - aCheckLB.IsChecked(REPLACE_1ST, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DEL_EMPTY_NODE, CBCOL_FIRST); - bModified |= pOpt->bDelEmptyNode != bCheck; - pOpt->bDelEmptyNode = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_QUOTATION, CBCOL_FIRST); - bModified |= pOpt->bReplaceQuote != bCheck; - pOpt->bReplaceQuote = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_USER_COLL, CBCOL_FIRST); - bModified |= pOpt->bChgUserColl != bCheck; - pOpt->bChgUserColl = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_BULLETS, CBCOL_FIRST); - bModified |= pOpt->bChgEnumNum != bCheck; - pOpt->bChgEnumNum = bCheck; - bModified |= aBulletFont != pOpt->aBulletFont; - pOpt->aBulletFont = aBulletFont; - bModified |= String(pOpt->cBullet) != sBulletChar; - pOpt->cBullet = sBulletChar.GetChar(0); - - bModified |= aByInputBulletFont != pOpt->aByInputBulletFont; - bModified |= String(pOpt->cByInputBullet) != sByInputBulletChar; - pOpt->aByInputBulletFont = aByInputBulletFont; - pOpt->cByInputBullet = sByInputBulletChar.GetChar(0); - - bCheck = aCheckLB.IsChecked(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST); - bModified |= pOpt->bRightMargin != bCheck; - pOpt->bRightMargin = bCheck; - bModified |= nPercent != pOpt->nRightMargin; - pOpt->nRightMargin = (BYTE)nPercent; - - bCheck = aCheckLB.IsChecked(APPLY_NUMBERING, CBCOL_SECOND); - bModified |= pOpt->bSetNumRule != bCheck; - pOpt->bSetNumRule = bCheck; - - bCheck = aCheckLB.IsChecked(INSERT_BORDER, CBCOL_SECOND); - bModified |= pOpt->bSetBorder != bCheck; - pOpt->bSetBorder = bCheck; - - bCheck = aCheckLB.IsChecked(CREATE_TABLE, CBCOL_SECOND); - bModified |= pOpt->bCreateTable != bCheck; - pOpt->bCreateTable = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_STYLES, CBCOL_SECOND); - bModified |= pOpt->bReplaceStyles != bCheck; - pOpt->bReplaceStyles = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_HALF, CBCOL_FIRST); - bModified |= pOpt->bChgFracionSymbol != bCheck; - pOpt->bChgFracionSymbol = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgFractionSymbol, - aCheckLB.IsChecked(REPLACE_HALF, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_FIRST); - bModified |= pOpt->bChgToEnEmDash != bCheck; - pOpt->bChgToEnEmDash = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, - aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_FIRST); - bModified |= pOpt->bAFmtDelSpacesAtSttEnd != bCheck; - pOpt->bAFmtDelSpacesAtSttEnd = bCheck; - bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_SECOND); - bModified |= pOpt->bAFmtByInpDelSpacesAtSttEnd != bCheck; - pOpt->bAFmtByInpDelSpacesAtSttEnd = bCheck; - - bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST); - bModified |= pOpt->bAFmtDelSpacesBetweenLines != bCheck; - pOpt->bAFmtDelSpacesBetweenLines = bCheck; - bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND); - bModified |= pOpt->bAFmtByInpDelSpacesBetweenLines != bCheck; - pOpt->bAFmtByInpDelSpacesBetweenLines = bCheck; - - if(bModified || nFlags != pAutoCorrect->GetFlags()) - { - SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); - pCfg->SetModified(); - pCfg->Commit(); - } - - return TRUE; -} - -/* -----------------23.11.98 16:15------------------- - * - * --------------------------------------------------*/ -void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - const long nFlags = pAutoCorrect->GetFlags(); - - aCheckLB.SetUpdateMode(FALSE); - aCheckLB.Clear(); - - // Die folgenden Eintraege muessen in der selben Reihenfolge, wie im - // OfaAutoFmtOptions-enum eingefuegt werden! - aCheckLB.GetModel()->Insert(CreateEntry(sUseReplaceTbl, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttWord, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttSent, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sBoldUnder, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDetectURL, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sOrdinal, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sFraction, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDash, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH )); - - aCheckLB.GetModel()->Insert(CreateEntry(sNoDblSpaces, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sNum, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sBorder, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sTable, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sReplaceTemplates, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sDeleteEmptyPara, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sUserStyle, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sBullet, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sTypo, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sRightMargin, CBCOL_FIRST )); - - aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_FIRST, pOpt->bAutoCorrect ); - aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_SECOND, 0 != (nFlags & Autocorrect)); - aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_FIRST, pOpt->bCptlSttWrd ); - aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttWrd) ); - aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_FIRST, pOpt->bCptlSttSntnc ); - aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttSntnc) ); - aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_FIRST, pOpt->bChgWeightUnderl ); - aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_SECOND, 0 != (nFlags & ChgWeightUnderl) ); - aCheckLB.CheckEntryPos( IGNORE_DBLSPACE, CBCOL_SECOND, 0 != (nFlags & IngnoreDoubleSpace) ); - aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_FIRST, pOpt->bSetINetAttr ); - aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_SECOND, 0 != (nFlags & SetINetAttr) ); - aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_FIRST, pOpt->bChgOrdinalNumber ); - aCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_SECOND, 0 != (nFlags & ChgOrdinalNumber) ); - aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_FIRST, pOpt->bChgFracionSymbol ); - aCheckLB.CheckEntryPos( REPLACE_HALF, CBCOL_SECOND, 0 != (nFlags & ChgFractionSymbol) ); - aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_FIRST, pOpt->bChgToEnEmDash ); - aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_SECOND, 0 != (nFlags & ChgToEnEmDash) ); - aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_FIRST, pOpt->bAFmtDelSpacesAtSttEnd ); - aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesAtSttEnd ); - aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST, pOpt->bAFmtDelSpacesBetweenLines ); - aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesBetweenLines ); - aCheckLB.CheckEntryPos( DEL_EMPTY_NODE, CBCOL_FIRST, pOpt->bDelEmptyNode ); - aCheckLB.CheckEntryPos( REPLACE_QUOTATION, CBCOL_FIRST, pOpt->bReplaceQuote ); - aCheckLB.CheckEntryPos( REPLACE_USER_COLL, CBCOL_FIRST, pOpt->bChgUserColl ); - aCheckLB.CheckEntryPos( REPLACE_BULLETS, CBCOL_FIRST, pOpt->bChgEnumNum ); - - aBulletFont = pOpt->aBulletFont; - sBulletChar = pOpt->cBullet; - ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont); - aCheckLB.SetUserData( REPLACE_BULLETS, pUserData ); - - nPercent = pOpt->nRightMargin; - sMargin = ' '; - sMargin += String::CreateFromInt32( nPercent ); - sMargin += '%'; - pUserData = new ImpUserData(&sMargin, 0); - aCheckLB.SetUserData( MERGE_SINGLE_LINE_PARA, pUserData ); - - aCheckLB.CheckEntryPos( APPLY_NUMBERING, CBCOL_SECOND, pOpt->bSetNumRule ); - - aByInputBulletFont = pOpt->aByInputBulletFont; - sByInputBulletChar = pOpt->cByInputBullet; - ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont); - aCheckLB.SetUserData( APPLY_NUMBERING , pUserData2 ); - - aCheckLB.CheckEntryPos( MERGE_SINGLE_LINE_PARA, CBCOL_FIRST, pOpt->bRightMargin ); - aCheckLB.CheckEntryPos( INSERT_BORDER, CBCOL_SECOND, pOpt->bSetBorder ); - aCheckLB.CheckEntryPos( CREATE_TABLE, CBCOL_SECOND, pOpt->bCreateTable ); - aCheckLB.CheckEntryPos( REPLACE_STYLES, CBCOL_SECOND, pOpt->bReplaceStyles ); - - aCheckLB.SetUpdateMode(TRUE); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, OfaACorrCheckListBox*, pBox) -{ - aEditPB.Enable(0 != pBox->FirstSelected()->GetUserData()); - return 0; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -IMPL_LINK(OfaSwAutoFmtOptionsPage, EditHdl, PushButton*, EMPTYARG) -{ - ULONG nSelEntryPos = aCheckLB.GetSelectEntryPos(); - if( nSelEntryPos == REPLACE_BULLETS || - nSelEntryPos == APPLY_NUMBERING) - { - SvxCharacterMap *pMapDlg = new SvxCharacterMap(this); - ImpUserData* pUserData = (ImpUserData*)aCheckLB.FirstSelected()->GetUserData(); - pMapDlg->SetCharFont(*pUserData->pFont); - pMapDlg->SetChar( pUserData->pString->GetChar(0) ); - if(RET_OK == pMapDlg->Execute()) - { - Font aFont(pMapDlg->GetCharFont()); - *pUserData->pFont = aFont; - sal_UCS4 aChar = pMapDlg->GetChar(); - // using the UCS4 constructor - rtl::OUString aOUStr( &aChar, 1 ); - *pUserData->pString = aOUStr; - } - delete pMapDlg; - } - else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos ) - { - // Dialog fuer Prozenteinstellung - OfaAutoFmtPrcntSet aDlg(this); - aDlg.GetPrcntFld().SetValue(nPercent); - if(RET_OK == aDlg.Execute()) - { - nPercent = (USHORT)aDlg.GetPrcntFld().GetValue(); - sMargin = ' '; - sMargin += String::CreateFromInt32( nPercent ); - sMargin += '%'; - } - } - aCheckLB.Invalidate(); - return 0; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::SetTabs() -{ - SvxSimpleTable::SetTabs(); - USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; - - if( aTabs.Count() > 1 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } - if( aTabs.Count() > 2 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked) -{ - if ( nPos < GetEntryCount() ) - SetCheckButtonState( - GetEntry(nPos), - nCol, - bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : - SvButtonState( SV_BUTTON_UNCHECKED ) ); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -BOOL OfaACorrCheckListBox::IsChecked(ULONG nPos, USHORT nCol) -{ - return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState) -{ - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - switch( eState ) - { - case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); - break; - - case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); - break; - - case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); - break; - } - InvalidateEntry( pEntry ); - } -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol ) const -{ - SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); - - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - USHORT nButtonFlags = pItem->GetButtonFlags(); - eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); - } - - return eState; -} - -void OfaACorrCheckListBox::HBarClick() -{ - // Sortierung durch diese Ueberladung abgeklemmt -} -/* -----------------------------22.05.2002 11:06------------------------------ - - ---------------------------------------------------------------------------*/ -void OfaACorrCheckListBox::KeyInput( const KeyEvent& rKEvt ) -{ - if(!rKEvt.GetKeyCode().GetModifier() && - KEY_SPACE == rKEvt.GetKeyCode().GetCode()) - { - ULONG nSelPos = GetSelectEntryPos(); - USHORT nCol = GetCurrentTabPos() - 1; - if ( nCol < 2 ) - { - CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) ); - CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) ); - } - else - { - USHORT nCheck = IsChecked(nSelPos, 1) ? 1 : 0; - if(IsChecked(nSelPos, 0)) - nCheck += 2; - nCheck--; - nCheck &= 3; - CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); - CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); - } - } - else - SvxSimpleTable::KeyInput(rKEvt); -} -/* -----------------19.11.98 15:57------------------- - * - * --------------------------------------------------*/ -struct DoubleString -{ - String sShort; - String sLong; - void* pUserData; // CheckBox -> form. Text Bool -> Selektionstext -}; -typedef DoubleString* DoubleStringPtr; -SV_DECL_PTRARR_DEL(DoubleStringArray, DoubleStringPtr, 4, 4) -SV_IMPL_PTRARR(DoubleStringArray, DoubleStringPtr); - -/* -----------------19.11.98 16:07------------------- - * - * --------------------------------------------------*/ -void lcl_ClearTable(DoubleStringTable& rTable) -{ - DoubleStringArrayPtr pArray = rTable.Last(); - while(pArray) - { - pArray->DeleteAndDestroy(0, pArray->Count()); - delete pArray; - pArray = rTable.Prev(); - } - rTable.Clear(); -} - -/*-----------------14.10.96 15.57------------------- - ---------------------------------------------------*/ - -OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_REPLACE ), rSet), - aTextOnlyCB( this, SVX_RES(CB_TEXT_ONLY )), - aShortFT ( this, SVX_RES(FT_SHORT )), - aShortED ( this, SVX_RES(ED_SHORT )), - aReplaceFT( this, SVX_RES(FT_REPLACE )), - aReplaceED( this, SVX_RES(ED_REPLACE )), - aReplaceTLB( this, SVX_RES(TLB_REPLACE )), - aNewReplacePB( this, SVX_RES(PB_NEW_REPLACE )), - aDeleteReplacePB(this,SVX_RES(PB_DELETE_REPLACE )), - sModify(SVX_RES(STR_MODIFY)), - sNew(aNewReplacePB.GetText()), - pFormatText(0), - eLang(eLastDialogLanguage), - bHasSelectionText(FALSE), - bFirstSelect(TRUE), - bReplaceEditChanged(FALSE), - bSWriter(TRUE) -{ - FreeResource(); - SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER); - bSWriter = pMod == SfxModule::GetActiveModule(); - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); - pCharClass = new CharClass( aLcl ); - - static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; - aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); - - aReplaceTLB.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); - aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl)); - aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aShortED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); - aReplaceED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); - aShortED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aReplaceED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - - aReplaceED.SetSpaces(TRUE); - aShortED.SetSpaces(TRUE); - aShortED.SetMaxTextLen(30); -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -OfaAutocorrReplacePage::~OfaAutocorrReplacePage() -{ - delete pFormatText; - lcl_ClearTable(aDoubleStringTable); - delete pCompareClass; - delete pCompareCaseClass; - delete pCharClass; -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -SfxTabPage* OfaAutocorrReplacePage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrReplacePage(pParent, rSet); -} -/* -----------------20.11.98 13:26------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& ) -{ - if(eLang != eLastDialogLanguage) - SetLanguage(eLastDialogLanguage); - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE); -} -/* -----------------20.11.98 13:26------------------- - * - * --------------------------------------------------*/ -int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -BOOL OfaAutocorrReplacePage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last(); - while(pDoubleStringArray) - { - LanguageType eCurLang = (LanguageType)aDoubleStringTable.GetCurKey(); - if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt - { - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eCurLang); - USHORT nWordListCount = pWordList->Count(); - USHORT nDoubleStringArrayCount = pDoubleStringArray->Count(); - USHORT nPos = nDoubleStringArrayCount; - USHORT nLastPos = nPos; - // 1. Durchlauf: Eintraege loeschen oder veraendern: - - - for( USHORT nWordListPos = nWordListCount; nWordListPos; nWordListPos-- ) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(nWordListPos - 1); - String sEntry(pWordPtr->GetShort()); - // formatierter Text steht nur im Writer - BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly(); - while(!bFound && nPos) - { - DoubleString* pDouble = pDoubleStringArray->GetObject( nPos - 1); - - if( 0 == pCompareClass->compareString( - sEntry, pDouble->sShort )) - { - nLastPos = nPos - 1; - bFound = TRUE; - if( !(pWordPtr->IsTextOnly() == (0 == pDouble->pUserData) - && 0 == pCompareCaseClass->compareString( - pWordPtr->GetLong(), pDouble->sLong ) ) ) - { - pAutoCorrect->PutText(sEntry, pDouble->sLong, eCurLang); - } - pDoubleStringArray->DeleteAndDestroy(nPos - 1, 1); - break; - } - nPos--; - } - nPos = nLastPos; - if(!bFound) - { - pAutoCorrect->DeleteText(sEntry, eCurLang); - } - } - nDoubleStringArrayCount = pDoubleStringArray->Count(); - for(USHORT nDoubleStringArrayPos = 0; nDoubleStringArrayPos < nDoubleStringArrayCount; nDoubleStringArrayPos++ ) - { - //jetzt sollte es nur noch neue Eintraege geben - DoubleString* pDouble = pDoubleStringArray->GetObject( nDoubleStringArrayPos ); - if(pDouble->pUserData == &bHasSelectionText) - pAutoCorrect->PutText( pDouble->sShort, - *SfxObjectShell::Current(), eCurLang ); - else - { - pAutoCorrect->PutText( pDouble->sShort, pDouble->sLong, - eCurLang); - } - } - } - pDoubleStringArray->DeleteAndDestroy(0, pDoubleStringArray->Count()); - delete pDoubleStringArray; - pDoubleStringArray = aDoubleStringTable.Prev(); - } - aDoubleStringTable.Clear(); - // jetzt noch die aktuelle Selektion - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); - USHORT nWordListCount = pWordList->Count(); - USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); - - aReplaceTLB.SetUpdateMode(FALSE); - USHORT nListBoxPos = nListBoxCount; - USHORT nLastListBoxPos = nListBoxPos; - // 1. Durchlauf: Eintraege loeschen oder veraendern: - - USHORT i; - for( i = nWordListCount; i; i-- ) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i- 1); - String sEntry(pWordPtr->GetShort()); - // formatierter Text steht nur im Writer - BOOL bFound = !bSWriter && !pWordPtr->IsTextOnly(); - while(!bFound && nListBoxPos) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( nListBoxPos - 1); - if( 0 == pCompareClass->compareString( sEntry, - aReplaceTLB.GetEntryText(pEntry, 0))) - { - nLastListBoxPos = nListBoxPos - 1; - bFound = TRUE; - String sLong = aReplaceTLB.GetEntryText(pEntry, 1); - if( !(pWordPtr->IsTextOnly() == (0 == pEntry->GetUserData()) - && 0 == pCompareCaseClass->compareString( - pWordPtr->GetLong(), sLong ))) - { - pAutoCorrect->PutText(sEntry, sLong, eLang); - } - aReplaceTLB.GetModel()->Remove(pEntry); - break; - - } - nListBoxPos --; - } - nListBoxPos = nLastListBoxPos; - if(!bFound) - { - pAutoCorrect->DeleteText(sEntry, eLang); - } - - } - nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); - for(i = 0; i < nListBoxCount; i++ ) - { - //jetzt sollte es nur noch neue Eintraege geben - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - String sShort = aReplaceTLB.GetEntryText(pEntry, 0); - if(pEntry->GetUserData() == &bHasSelectionText) - pAutoCorrect->PutText(sShort, *SfxObjectShell::Current(), eLang); - else - { - String sLong = aReplaceTLB.GetEntryText(pEntry, 1); - pAutoCorrect->PutText(sShort, sLong, eLang); - } - } - - return FALSE; -} - -/* -----------------19.11.98 13:16------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrReplacePage::RefillReplaceBox(BOOL bFromReset, - LanguageType eOldLanguage, - LanguageType eNewLanguage) -{ - eLang = eNewLanguage; - if(bFromReset) - lcl_ClearTable(aDoubleStringTable); - else - { - DoubleStringArray* pArray = 0; - if(aDoubleStringTable.IsKeyValid(eOldLanguage)) - { - pArray = aDoubleStringTable.Seek(ULONG(eOldLanguage)); - pArray->DeleteAndDestroy(0, pArray->Count()); - } - else - { - pArray = new DoubleStringArray; - aDoubleStringTable.Insert(ULONG(eOldLanguage), pArray); - } - - USHORT nListBoxCount = (USHORT)aReplaceTLB.GetEntryCount(); - USHORT i; - for(i = 0; i < nListBoxCount; i++) - { - DoubleString* pDouble = new DoubleString(); - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - pDouble->sShort = aReplaceTLB.GetEntryText(pEntry, 0); - pDouble->sLong = aReplaceTLB.GetEntryText(pEntry, 1); - pDouble->pUserData = pEntry->GetUserData(); - pArray->Insert(pDouble, i); - } - } - - aReplaceTLB.Clear(); - if(!bSWriter) - { - if(pFormatText) - pFormatText->DeleteAndDestroy(0, pFormatText->Count()); - else - pFormatText = new SvStringsISortDtor(); - } - - if(aDoubleStringTable.IsKeyValid(eLang)) - { - DoubleStringArray* pArray = aDoubleStringTable.Seek(ULONG(eNewLanguage)); - for(USHORT i = 0; i < pArray->Count(); i++) - { - DoubleString* pDouble = pArray->GetObject(i); - BOOL bTextOnly = 0 == pDouble->pUserData; - // formatierter Text wird nur im Writer angeboten - if(bSWriter || bTextOnly) - { - String sEntry(pDouble->sShort); - sEntry += '\t'; - sEntry += pDouble->sLong; - SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); - aTextOnlyCB.Check(bTextOnly); - if(!bTextOnly) - pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext - } - else - { - pFormatText->Insert(new String(pDouble->sShort)); - } - } - } - else - { - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); - - for(USHORT i = 0; i < pWordList->Count(); i++) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i); - BOOL bTextOnly = pWordPtr->IsTextOnly(); - // formatierter Text wird nur im Writer angeboten - if(bSWriter || bTextOnly) - { - String sEntry(pWordPtr->GetShort()); - sEntry += '\t'; - sEntry += pWordPtr->GetLong(); - SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); - aTextOnlyCB.Check(pWordPtr->IsTextOnly()); - if(!bTextOnly) - pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo - } - else - { - pFormatText->Insert(new String(pWordPtr->GetShort())); - } - } - aNewReplacePB.Enable(FALSE); - aDeleteReplacePB.Enable(FALSE); - - } - - SfxViewShell* pViewShell = SfxViewShell::Current(); - if( pViewShell && pViewShell->HasSelection( TRUE ) ) - { - bHasSelectionText = TRUE; - const String sSelection( pViewShell->GetSelectionText() ); - aReplaceED.SetText( sSelection ); - aTextOnlyCB.Check( !bSWriter ); - aTextOnlyCB.Enable( bSWriter && sSelection.Len() ); - } - else - aTextOnlyCB.Enable( FALSE ); -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -void OfaAutocorrReplacePage::Reset( const SfxItemSet& ) -{ - RefillReplaceBox(TRUE, eLang, eLang); - aShortED.GrabFocus(); -} - -/* -----------------23.11.98 10:33------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) -{ - //save old settings an refill - if(eSet != eLang) - { - RefillReplaceBox(FALSE, eLang, eSet); - eLastDialogLanguage = eSet; - delete pCompareClass; - delete pCompareCaseClass; - delete pCharClass; - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); - pCharClass = new CharClass( aLcl ); - ModifyHdl(&aShortED); - } -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox) -{ - if(!bFirstSelect || !bHasSelectionText) - { - SvLBoxEntry* pEntry = pBox->FirstSelected(); - String sTmpShort(pBox->GetEntryText(pEntry, 0)); - // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor sonst immer am Wortanfang, - // obwohl man gerade hier editiert - BOOL bSameContent = 0 == pCompareClass->compareString( - sTmpShort, aShortED.GetText() ); - Selection aSel = aShortED.GetSelection(); - if(aShortED.GetText() != sTmpShort) - { - aShortED.SetText(sTmpShort); - //war es nur eine andere Schreibweise, dann muss die Selektion auch wieder gesetzt werden - if(bSameContent) - aShortED.SetSelection(aSel); - } - aReplaceED.SetText(pBox->GetEntryText(pEntry, 1)); - // mit UserData gibt es eine Formatinfo - aTextOnlyCB.Check(0 == pEntry->GetUserData()); - } - else - bFirstSelect = FALSE; - - aNewReplacePB.Enable(FALSE); - aDeleteReplacePB.Enable(); - return 0; -}; - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - - -IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) -{ - SvLBoxEntry* _pEntry = aReplaceTLB.FirstSelected(); - if(pBtn == &aDeleteReplacePB) - { - DBG_ASSERT(_pEntry, "keine Eintrag selektiert"); - if(_pEntry) - { - aReplaceTLB.GetModel()->Remove(_pEntry); - ModifyHdl(&aShortED); - return 0; - } - } - if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled()) - { - SvLBoxEntry* _pNewEntry = aReplaceTLB.FirstSelected(); - String sEntry(aShortED.GetText()); - if(sEntry.Len() && ( aReplaceED.GetText().Len() || - ( bHasSelectionText && bSWriter ) )) - { - aReplaceTLB.SetUpdateMode(FALSE); - USHORT nPos = USHRT_MAX; - sEntry += '\t'; - sEntry += aReplaceED.GetText(); - if(_pNewEntry) - { - nPos = (USHORT)aReplaceTLB.GetModel()->GetAbsPos(_pNewEntry); - aReplaceTLB.GetModel()->Remove(_pNewEntry); - } - else - { - USHORT j; - for( j = 0; j < aReplaceTLB.GetEntryCount(); j++ ) - { - SvLBoxEntry* pReplaceEntry = aReplaceTLB.GetEntry(j); - if( 0 >= pCompareClass->compareString(sEntry, - aReplaceTLB.GetEntryText(pReplaceEntry, 0) ) ) - break; - } - nPos = j; - } - SvLBoxEntry* pInsEntry = - aReplaceTLB.InsertEntry( - sEntry, static_cast< SvLBoxEntry * >(NULL), false, - nPos == USHRT_MAX ? LIST_APPEND : nPos); - if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked()) - pInsEntry->SetUserData(&bHasSelectionText); // neuer formatierter Text - - aReplaceTLB.MakeVisible( pInsEntry ); - aReplaceTLB.SetUpdateMode(TRUE); - // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen - if(aReplaceED.HasFocus()) - aShortED.GrabFocus(); - - } - } - else - { - // das kann nur ein Enter in einem der beiden Edit-Felder sein und das - // bedeutet EndDialog() - muss im KeyInput ausgewertet werden - return 0; - } - ModifyHdl(&aShortED); - return 1; -} - -/*-----------------17.10.96 07.49------------------- - ---------------------------------------------------*/ -IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) -{ - SvLBoxEntry* pFirstSel = aReplaceTLB.FirstSelected(); - BOOL bShort = pEdt == &aShortED; - const String rEntry = pEdt->GetText(); - const String rRepString = aReplaceED.GetText(); - String aWordStr( pCharClass->lower( rEntry )); - - if(bShort) - { - if(rEntry.Len()) - { - BOOL bFound = FALSE; - BOOL bTmpSelEntry=FALSE; - - for(USHORT i = 0; i < aReplaceTLB.GetEntryCount(); i++) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - String aTestStr=aReplaceTLB.GetEntryText(pEntry, 0); - if( 0 == pCompareClass->compareString(rEntry, aTestStr )) - { - if(rRepString.Len()) - bFirstSelect = TRUE; - aReplaceTLB.SetCurEntry(pEntry); - pFirstSel = pEntry; - aNewReplacePB.SetText(sModify); - bFound= TRUE; - break; - } - else - { - pCharClass->toLower( aTestStr ); - if(aTestStr.Search(aWordStr)==0 && !bTmpSelEntry) - { - aReplaceTLB.MakeVisible(pEntry); - bTmpSelEntry=TRUE; - } - } - } - if(!bFound) - { - aReplaceTLB.SelectAll(FALSE); - pFirstSel = 0; - aNewReplacePB.SetText(sNew); - if(bReplaceEditChanged) - aTextOnlyCB.Enable(FALSE); - } - aDeleteReplacePB.Enable(bFound); - } - else if(aReplaceTLB.GetEntryCount()>0) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( 0 ); - aReplaceTLB.MakeVisible(pEntry); - } - - } - else if(!bShort) - { - bReplaceEditChanged = TRUE; - if(pFirstSel) - { - aNewReplacePB.SetText(sModify); - } - } - - const String& rShortTxt = aShortED.GetText(); - BOOL bEnableNew = rShortTxt.Len() && - ( rRepString.Len() || - ( bHasSelectionText && bSWriter )) && - ( !pFirstSel || rRepString != - aReplaceTLB.GetEntryText( pFirstSel, 1 ) ); - if(bEnableNew && pFormatText) - { - for(USHORT i = 0; i < pFormatText->Count(); i++) - if(*pFormatText->GetObject(i) == rShortTxt) - { - bEnableNew = FALSE; - break; - } - } - aNewReplacePB.Enable(bEnableNew); - - return 0; -} - -/* -----------------20.11.98 13:48------------------- - * - * --------------------------------------------------*/ - -struct StringsArrays -{ - - SvStringsDtor aAbbrevStrings; - SvStringsDtor aDoubleCapsStrings; - - StringsArrays() : - aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {} -}; -typedef StringsArrays* StringsArraysPtr; -/* -----------------19.11.98 16:07------------------- - * - * --------------------------------------------------*/ -BOOL lcl_FindInArray(SvStringsDtor& rStrings, const String& rString) -{ - for(USHORT i = 0; i < rStrings.Count(); i++) - if(rString == *rStrings.GetObject(i)) - return TRUE; - return FALSE; -} - -void lcl_ClearTable(StringsTable& rTable) -{ - StringsArraysPtr pArrays = rTable.Last(); - while(pArrays) - { - delete pArrays; - pArrays = rTable.Prev(); - } - rTable.Clear(); -} - -/*-----------------14.10.96 15.57------------------- - ---------------------------------------------------*/ - -OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_EXCEPT ), rSet), - aAbbrevFL (this, SVX_RES(FL_ABBREV )), - aAbbrevED (this, SVX_RES(ED_ABBREV )), - aAbbrevLB (this, SVX_RES(LB_ABBREV )), - aNewAbbrevPB (this, SVX_RES(PB_NEWABBREV )), - aDelAbbrevPB (this, SVX_RES(PB_DELABBREV )), - aAutoAbbrevCB (this, SVX_RES(CB_AUTOABBREV )), - aDoubleCapsFL (this, SVX_RES(FL_DOUBLECAPS )), - aDoubleCapsED (this, SVX_RES(ED_DOUBLE_CAPS )), - aDoubleCapsLB (this, SVX_RES(LB_DOUBLE_CAPS )), - aNewDoublePB (this, SVX_RES(PB_NEWDOUBLECAPS)), - aDelDoublePB (this, SVX_RES(PB_DELDOUBLECAPS)), - aAutoCapsCB (this, SVX_RES(CB_AUTOCAPS )), - eLang(eLastDialogLanguage) -{ - FreeResource(); - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - - aNewAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDelAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aNewDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDelDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - - aAbbrevLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - aDoubleCapsLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - aAbbrevED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - aDoubleCapsED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - - aAbbrevED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDoubleCapsED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -OfaAutocorrExceptPage::~OfaAutocorrExceptPage() -{ - lcl_ClearTable(aStringsTable); - delete pCompareClass; -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -SfxTabPage* OfaAutocorrExceptPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrExceptPage(pParent, rSet); -} -/* -----------------20.11.98 13:26------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) -{ - if(eLang != eLastDialogLanguage) - SetLanguage(eLastDialogLanguage); - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(TRUE); -} -/* -----------------20.11.98 13:26------------------- - * - * --------------------------------------------------*/ -int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -BOOL OfaAutocorrExceptPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - StringsArraysPtr pArrays = aStringsTable.Last(); - while(pArrays) - { - LanguageType eCurLang = (LanguageType)aStringsTable.GetCurKey(); - if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt - { - SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang); - - if(pWrdList) - { - USHORT nCount = pWrdList->Count(); - USHORT i; - for( i = nCount; i; ) - { - String* pString = pWrdList->GetObject( --i ); - //Eintrag finden u. gfs entfernen - if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString)) - pWrdList->DeleteAndDestroy( i ); - } - nCount = pArrays->aDoubleCapsStrings.Count(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) ); - if( !pWrdList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveWrdSttExceptList(eCurLang); - } - - SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang); - - if(pCplList) - { - USHORT nCount = pCplList->Count(); - USHORT i; - for( i = nCount; i; ) - { - String* pString = pCplList->GetObject( --i ); - if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString)) - pCplList->DeleteAndDestroy( i ); - } - nCount = pArrays->aAbbrevStrings.Count(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) ); - if( !pCplList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveCplSttExceptList(eCurLang); - } - } - pArrays = aStringsTable.Prev(); - } - aStringsTable.Clear(); - - SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang); - - if(pWrdList) - { - USHORT nCount = pWrdList->Count(); - USHORT i; - for( i = nCount; i; ) - { - String* pString = pWrdList->GetObject( --i ); - if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) ) - pWrdList->DeleteAndDestroy( i ); - } - nCount = aDoubleCapsLB.GetEntryCount(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) ); - if( !pWrdList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveWrdSttExceptList(eLang); - } - - SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang); - - if(pCplList) - { - USHORT nCount = pCplList->Count(); - USHORT i; - for( i = nCount; i; ) - { - String* pString = pCplList->GetObject( --i ); - if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) ) - pCplList->DeleteAndDestroy( i ); - } - nCount = aAbbrevLB.GetEntryCount(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( aAbbrevLB.GetEntry( i ) ); - if( !pCplList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveCplSttExceptList(eLang); - } - if(aAutoAbbrevCB.IsChecked() != aAutoAbbrevCB.GetSavedValue()) - pAutoCorrect->SetAutoCorrFlag( SaveWordCplSttLst, aAutoAbbrevCB.IsChecked()); - if(aAutoCapsCB.IsChecked() != aAutoCapsCB.GetSavedValue()) - pAutoCorrect->SetAutoCorrFlag( SaveWordWrdSttLst, aAutoCapsCB.IsChecked()); - return FALSE; -} - -/* -----------------23.11.98 10:33------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet) -{ - if(eLang != eSet) - { - //alte Einstellungen speichern und neu fuellen - RefillReplaceBoxes(FALSE, eLang, eSet); - eLastDialogLanguage = eSet; - delete pCompareClass; - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ), - ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - ModifyHdl(&aAbbrevED); - ModifyHdl(&aDoubleCapsED); - } -} -/* -----------------20.11.98 14:06------------------- - * - * --------------------------------------------------*/ -void OfaAutocorrExceptPage::RefillReplaceBoxes(BOOL bFromReset, - LanguageType eOldLanguage, - LanguageType eNewLanguage) -{ - eLang = eNewLanguage; - if(bFromReset) - lcl_ClearTable(aStringsTable); - else - { - StringsArraysPtr pArrays = 0; - if(aStringsTable.IsKeyValid(eOldLanguage)) - { - pArrays = aStringsTable.Seek(ULONG(eOldLanguage)); - pArrays->aAbbrevStrings.DeleteAndDestroy( - 0, pArrays->aAbbrevStrings.Count()); - pArrays->aDoubleCapsStrings.DeleteAndDestroy( - 0, pArrays->aDoubleCapsStrings.Count()); - } - else - { - pArrays = new StringsArrays; - aStringsTable.Insert(ULONG(eOldLanguage), pArrays); - } - - USHORT i; - for(i = 0; i < aAbbrevLB.GetEntryCount(); i++) - { - pArrays->aAbbrevStrings.Insert( - new String(aAbbrevLB.GetEntry(i)), i); - - } - for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++) - { - pArrays->aDoubleCapsStrings.Insert( - new String(aDoubleCapsLB.GetEntry(i)), i); - } - } - aDoubleCapsLB.Clear(); - aAbbrevLB.Clear(); - String sTemp; - aAbbrevED.SetText(sTemp); - aDoubleCapsED.SetText(sTemp); - - if(aStringsTable.IsKeyValid(eLang)) - { - StringsArraysPtr pArrays = aStringsTable.Seek(ULONG(eLang)); - USHORT i; - for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ ) - { - aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i)); - } - for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ ) - { - aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i)); - } - } - else - { - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang); - const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang); - USHORT i; - for( i = 0; i < pCplList->Count(); i++ ) - { - aAbbrevLB.InsertEntry(*pCplList->GetObject(i)); - } - for( i = 0; i < pWrdList->Count(); i++ ) - { - aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i)); - } - } -} - -/*-----------------14.10.96 15.58------------------- - ---------------------------------------------------*/ - -void OfaAutocorrExceptPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - RefillReplaceBoxes(TRUE, eLang, eLang); - aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst )); - aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst )); - aAutoAbbrevCB.SaveValue(); - aAutoCapsCB.SaveValue(); -} - -/*-----------------16.10.96 12.27------------------- - ---------------------------------------------------*/ - - -IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, PushButton*, pBtn) -{ - if((pBtn == &aNewAbbrevPB || pBtn == (PushButton*)&aAbbrevED ) - && aAbbrevED.GetText().Len()) - { - aAbbrevLB.InsertEntry(aAbbrevED.GetText()); - ModifyHdl(&aAbbrevED); - } - else if(pBtn == &aDelAbbrevPB) - { - aAbbrevLB.RemoveEntry(aAbbrevED.GetText()); - ModifyHdl(&aAbbrevED); - } - else if((pBtn == &aNewDoublePB || pBtn == (PushButton*)&aDoubleCapsED ) - && aDoubleCapsED.GetText().Len()) - { - aDoubleCapsLB.InsertEntry(aDoubleCapsED.GetText()); - ModifyHdl(&aDoubleCapsED); - } - else if(pBtn == &aDelDoublePB) - { - aDoubleCapsLB.RemoveEntry(aDoubleCapsED.GetText()); - ModifyHdl(&aDoubleCapsED); - } - return 0; -} - -/*-----------------16.10.96 12.57------------------- - ---------------------------------------------------*/ - -IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox) -{ - if(pBox == &aAbbrevLB) - { - aAbbrevED.SetText(pBox->GetSelectEntry()); - aNewAbbrevPB.Enable(FALSE); - aDelAbbrevPB.Enable(); - } - else - { - aDoubleCapsED.SetText(pBox->GetSelectEntry()); - aNewDoublePB.Enable(FALSE); - aDelDoublePB.Enable(); - } - return 0; -} - -/*-----------------16.10.96 13.02------------------- - ---------------------------------------------------*/ - -IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt) -{ -// BOOL bSame = pEdt->GetText() == ->GetSelectEntry(); - const String& sEntry = pEdt->GetText(); - BOOL bEntryLen = 0!= sEntry.Len(); - if(pEdt == &aAbbrevED) - { - BOOL bSame = lcl_FindEntry(aAbbrevLB, sEntry, *pCompareClass); - if(bSame && sEntry != aAbbrevLB.GetSelectEntry()) - pEdt->SetText(aAbbrevLB.GetSelectEntry()); - aNewAbbrevPB.Enable(!bSame && bEntryLen); - aDelAbbrevPB.Enable(bSame && bEntryLen); - } - else - { - BOOL bSame = lcl_FindEntry(aDoubleCapsLB, sEntry, *pCompareClass); - if(bSame && sEntry != aDoubleCapsLB.GetSelectEntry()) - pEdt->SetText(aDoubleCapsLB.GetSelectEntry()); - aNewDoublePB.Enable(!bSame && bEntryLen); - aDelDoublePB.Enable(bSame && bEntryLen); - } - return 0; -} - -/*-----------------16.10.96 15.03------------------- - ---------------------------------------------------*/ - -void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) -{ - const KeyCode aKeyCode = rKEvt.GetKeyCode(); - const USHORT nModifier = aKeyCode.GetModifier(); - if( aKeyCode.GetCode() == KEY_RETURN ) - { - //wird bei Enter nichts getan, dann doch die Basisklasse rufen - // um den Dialog zu schliessen - if(!nModifier && !aActionLink.Call(this)) - Edit::KeyInput(rKEvt); - } - else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) - Edit::KeyInput(rKEvt); -} - -/*-----------------03.07.97 13:17------------------- - ---------------------------------------------------*/ - -OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCORR_QUOTE ), rSet), - aSingleFL (this, SVX_RES(FL_SINGLE )), - aSingleTypoCB (this, SVX_RES(CB_SGL_TYPO )), - aSglStartQuoteFT (this, SVX_RES(FT_SGL_STARTQUOTE )), - aSglStartQuotePB (this, SVX_RES(PB_SGL_STARTQUOTE )), - aSglStartExFT (this, SVX_RES(FT_SGSTEX )), - aSglEndQuoteFT (this, SVX_RES(FT_SGL_ENDQUOTE )), - aSglEndQuotePB (this, SVX_RES(PB_SGL_ENDQUOTE )), - aSglEndExFT (this, SVX_RES(FT_SGENEX )), - aSglStandardPB (this, SVX_RES(PB_SGL_STD )), - - aDoubleFL (this, SVX_RES(FL_DOUBLE )), - aTypoCB (this, SVX_RES(CB_TYPO )), - aStartQuoteFT (this, SVX_RES(FT_STARTQUOTE )), - aStartQuotePB (this, SVX_RES(PB_STARTQUOTE )), - aDblStartExFT (this, SVX_RES(FT_DBSTEX )), - aEndQuoteFT (this, SVX_RES(FT_ENDQUOTE )), - aEndQuotePB (this, SVX_RES(PB_ENDQUOTE )), - aDblEndExFT (this, SVX_RES(FT_DBECEX )), - aDblStandardPB (this, SVX_RES(PB_DBL_STD )), - - sStartQuoteDlg (SVX_RES(STR_CHANGE_START)), - sEndQuoteDlg (SVX_RES(STR_CHANGE_END)), - - sStandard(SVX_RES(ST_STANDARD)) -{ - FreeResource(); - - aStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aSglStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aSglEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aDblStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); - aSglStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); - -} -/*-----------------03.07.97 13:17------------------- - ---------------------------------------------------*/ -OfaQuoteTabPage::~OfaQuoteTabPage() -{ -} -/*-----------------03.07.97 13:17------------------- - ---------------------------------------------------*/ -SfxTabPage* OfaQuoteTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new OfaQuoteTabPage(pParent, rAttrSet); -} -/*-----------------03.07.97 13:18------------------- - ---------------------------------------------------*/ -BOOL OfaQuoteTabPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - - long nFlags = pAutoCorrect->GetFlags(); - pAutoCorrect->SetAutoCorrFlag(ChgQuotes, aTypoCB.IsChecked()); - pAutoCorrect->SetAutoCorrFlag(ChgSglQuotes, aSingleTypoCB.IsChecked()); - BOOL bReturn = nFlags != pAutoCorrect->GetFlags(); - if(cStartQuote != pAutoCorrect->GetStartDoubleQuote()) - { - bReturn = TRUE; - sal_Unicode cUCS2 = static_cast<sal_Unicode>(cStartQuote); //TODO - pAutoCorrect->SetStartDoubleQuote(cUCS2); - } - if(cEndQuote != pAutoCorrect->GetEndDoubleQuote()) - { - bReturn = TRUE; - sal_Unicode cUCS2 = static_cast<sal_Unicode>(cEndQuote); //TODO - pAutoCorrect->SetEndDoubleQuote(cUCS2); - } - if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote()) - { - bReturn = TRUE; - sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglStartQuote); //TODO - pAutoCorrect->SetStartSingleQuote(cUCS2); - } - if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote()) - { - bReturn = TRUE; - sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglEndQuote); //TODO - pAutoCorrect->SetEndSingleQuote(cUCS2); - } - - if(bReturn ) - { - SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); - pCfg->SetModified(); - pCfg->Commit(); - } - return bReturn; -} -/* -----------------23.11.98 16:15------------------- - * - * --------------------------------------------------*/ -void OfaQuoteTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(FALSE); -} -/*-----------------03.07.97 13:18------------------- - ---------------------------------------------------*/ -void OfaQuoteTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - const long nFlags = pAutoCorrect->GetFlags(); - - aTypoCB .Check(0 != (nFlags & ChgQuotes)); - aSingleTypoCB .Check(0 != (nFlags & ChgSglQuotes)); - aTypoCB .SaveValue(); - aSingleTypoCB .SaveValue(); - - cStartQuote = pAutoCorrect->GetStartDoubleQuote(); - cEndQuote = pAutoCorrect->GetEndDoubleQuote(); - cSglStartQuote = pAutoCorrect->GetStartSingleQuote(); - cSglEndQuote = pAutoCorrect->GetEndSingleQuote(); - - aSglStartExFT .SetText(ChangeStringExt_Impl(cSglStartQuote)); - aSglEndExFT .SetText(ChangeStringExt_Impl(cSglEndQuote)); - aDblStartExFT .SetText(ChangeStringExt_Impl(cStartQuote)); - aDblEndExFT .SetText(ChangeStringExt_Impl(cEndQuote)); -} - - -/*-----------------15.10.96 16.42------------------- - ---------------------------------------------------*/ -#define SGL_START 0 -#define DBL_START 1 -#define SGL_END 2 -#define DBL_END 3 - - -IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn ) -{ - USHORT nMode = SGL_START; - if(pBtn == &aSglEndQuotePB) - nMode = SGL_END; - else if(pBtn == &aStartQuotePB) - nMode = DBL_START; - else if(pBtn == &aEndQuotePB) - nMode = DBL_END; - // Zeichenauswahl-Dialog starten - SvxCharacterMap* pMap = new SvxCharacterMap( this, TRUE ); - pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, - LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 )); - pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg ); - sal_UCS4 cDlg; - //The two lines below are added by BerryJia for Bug95846 Time:2002-8-13 15:50 - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - LanguageType eLang = Application::GetSettings().GetLanguage(); - switch( nMode ) - { - case SGL_START: - cDlg = cSglStartQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\'',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 - break; - case SGL_END: - cDlg = cSglEndQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\'',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 - break; - case DBL_START: - cDlg = cStartQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\"',TRUE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 - break; - case DBL_END: - cDlg = cEndQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\"',FALSE,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 - break; - default: - DBG_ERROR("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" ); - cDlg = 0; - break; - - } - pMap->SetChar( cDlg ); - pMap->DisableFontSelection(); - if(pMap->Execute() == RET_OK) - { - sal_UCS4 cNewChar = pMap->GetChar(); - switch( nMode ) - { - case SGL_START: - cSglStartQuote = cNewChar; - aSglStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case SGL_END: - cSglEndQuote = cNewChar; - aSglEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case DBL_START: - cStartQuote = cNewChar; - aDblStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case DBL_END: - cEndQuote = cNewChar; - aDblEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - } - } - delete pMap; - - return 0; -} - -/*-----------------27.06.97 09.55------------------- - ---------------------------------------------------*/ -IMPL_LINK( OfaQuoteTabPage, StdQuoteHdl, PushButton*, pBtn ) -{ - if(pBtn == &aDblStandardPB) - { - cStartQuote = 0; - aDblStartExFT.SetText(ChangeStringExt_Impl(0)); - cEndQuote = 0; - aDblEndExFT.SetText(ChangeStringExt_Impl(0)); - - } - else - { - cSglStartQuote = 0; - aSglStartExFT.SetText(ChangeStringExt_Impl(0)); - cSglEndQuote = 0; - aSglEndExFT.SetText(ChangeStringExt_Impl(0)); - } - return 0; -} - -// -------------------------------------------------- - -String OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar ) -{ - if( !cChar ) - return sStandard; - - // convert codepoint value to unicode-hex string - sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' }; - aStrCodes[0] = cChar; - int nFullLen = 5; - int nHexLen = 4; - while( (cChar >> (4*nHexLen)) != 0 ) - ++nHexLen; - for( int i = nHexLen; --i >= 0;) - { - sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0'; - if( cHexDigit > '9' ) - cHexDigit += 'A' - ('9' + 1); - aStrCodes[ nFullLen++ ] = cHexDigit; - } - aStrCodes[ nFullLen++ ] = ')'; - // using the new UCS4 constructor - rtl::OUString aOUStr( aStrCodes, nFullLen ); - return aOUStr; -} - -OfaAutoCompleteTabPage::OfaAutoCompleteTabPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ), rSet), - aCBActiv (this, SVX_RES(CB_ACTIV)), - aCBAppendSpace (this, SVX_RES(CB_APPEND_SPACE)), - aCBAsTip (this, SVX_RES(CB_AS_TIP)), - aCBCollect (this, SVX_RES(CB_COLLECT)), - aCBRemoveList (this, SVX_RES(CB_REMOVE_LIST)), - aFTExpandKey (this, SVX_RES(FT_EXPAND_KEY)), - aDCBExpandKey (this, SVX_RES(DCB_EXPAND_KEY)), - aFTMinWordlen (this, SVX_RES(FT_MIN_WORDLEN)), - aNFMinWordlen (this, SVX_RES(NF_MIN_WORDLEN)), - aFTMaxEntries (this, SVX_RES(FT_MAX_ENTRIES)), - aNFMaxEntries (this, SVX_RES(NF_MAX_ENTRIES)), - aLBEntries (*this, SVX_RES(LB_ENTRIES)), - aPBEntries (this, SVX_RES(PB_ENTRIES)), - pAutoCmpltList( 0 ), - nAutoCmpltListCnt( 0 ) -{ - FreeResource(); - - // the defined KEYs - static const USHORT aKeyCodes[] = { - KEY_END, - KEY_RETURN, - KEY_SPACE, - KEY_RIGHT, - KEY_TAB, - 0 - }; - - for( const USHORT* pKeys = aKeyCodes; *pKeys; ++pKeys ) - { - KeyCode aKCode( *pKeys ); - USHORT nPos = aDCBExpandKey.InsertEntry( aKCode.GetName() ); - aDCBExpandKey.SetEntryData( nPos, (void*)(ULONG)*pKeys ); - if( KEY_RETURN == *pKeys ) // default to RETURN - aDCBExpandKey.SelectEntryPos( nPos ); - } - - aPBEntries.SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl)); - aCBActiv.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); - aCBCollect.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); -} - -OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage() -{ -} - -SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutoCompleteTabPage( pParent, rSet ); -} - -BOOL OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& ) -{ - BOOL bModified = FALSE, bCheck; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - USHORT nVal; - - bCheck = aCBActiv.IsChecked(); - bModified |= pOpt->bAutoCompleteWords != bCheck; - pOpt->bAutoCompleteWords = bCheck; - bCheck = aCBCollect.IsChecked(); - bModified |= pOpt->bAutoCmpltCollectWords != bCheck; - pOpt->bAutoCmpltCollectWords = bCheck; - bCheck = !aCBRemoveList.IsChecked(); // inverted value! - bModified |= pOpt->bAutoCmpltKeepList != bCheck; - pOpt->bAutoCmpltKeepList = bCheck; - bCheck = aCBAppendSpace.IsChecked(); - bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck; - pOpt->bAutoCmpltAppendBlanc = bCheck; - bCheck = aCBAsTip.IsChecked(); - bModified |= pOpt->bAutoCmpltShowAsTip != bCheck; - pOpt->bAutoCmpltShowAsTip = bCheck; - - nVal = (USHORT)aNFMinWordlen.GetValue(); - bModified |= nVal != pOpt->nAutoCmpltWordLen; - pOpt->nAutoCmpltWordLen = nVal; - - nVal = (USHORT)aNFMaxEntries.GetValue(); - bModified |= nVal != pOpt->nAutoCmpltListLen; - pOpt->nAutoCmpltListLen = nVal; - - nVal = aDCBExpandKey.GetSelectEntryPos(); - if( nVal < aDCBExpandKey.GetEntryCount() ) - { - ULONG nKey = (ULONG)aDCBExpandKey.GetEntryData( nVal ); - bModified |= nKey != pOpt->nAutoCmpltExpandKey; - pOpt->nAutoCmpltExpandKey = (USHORT)nKey; - } - - if( pAutoCmpltList && nAutoCmpltListCnt != aLBEntries.GetEntryCount() ) - { - bModified = TRUE; - pOpt->pAutoCmpltList = pAutoCmpltList; - } - if( bModified ) - { - SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); - pCfg->SetModified(); - pCfg->Commit(); - } - return TRUE; -} - -void OfaAutoCompleteTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - - aCBActiv.Check( 0 != pOpt->bAutoCompleteWords ); - aCBCollect.Check( 0 != pOpt->bAutoCmpltCollectWords ); - aCBRemoveList.Check( !pOpt->bAutoCmpltKeepList ); //inverted value! - aCBAppendSpace.Check( 0 != pOpt->bAutoCmpltAppendBlanc ); - aCBAsTip.Check( 0 != pOpt->bAutoCmpltShowAsTip ); - - aNFMinWordlen.SetValue( pOpt->nAutoCmpltWordLen ); - aNFMaxEntries.SetValue( pOpt->nAutoCmpltListLen ); - - // select the specific KeyCode: - { - ULONG nKey = pOpt->nAutoCmpltExpandKey; - for( USHORT n = 0, nCnt = aDCBExpandKey.GetEntryCount(); n < nCnt; ++n ) - if( nKey == (ULONG)aDCBExpandKey.GetEntryData( n )) - { - aDCBExpandKey.SelectEntryPos( n ); - break; - } - } - - if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() ) - { - pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList; - pOpt->pAutoCmpltList = 0; - nAutoCmpltListCnt = pAutoCmpltList->Count(); - for( USHORT n = 0; n < nAutoCmpltListCnt; ++n ) - { - const StringPtr pStr = pAutoCmpltList->GetObject( n ); - USHORT nPos = aLBEntries.InsertEntry( *pStr ); - aLBEntries.SetEntryData( nPos, (void*)pStr ); - } - } - else - { - aLBEntries.Disable(); - aPBEntries.Disable(); - } - - CheckHdl( &aCBActiv ); - CheckHdl( &aCBCollect ); -} - -void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE ); -} - -IMPL_LINK( OfaAutoCompleteTabPage, DeleteHdl, PushButton*, EMPTYARG ) -{ - USHORT nSelCnt = pAutoCmpltList ? aLBEntries.GetSelectEntryCount() : 0; - while( nSelCnt ) - { - USHORT nPos = aLBEntries.GetSelectEntryPos( --nSelCnt ); - const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos ); - aLBEntries.RemoveEntry( nPos ); - nPos = pAutoCmpltList->GetPos( pStr ); - if( USHRT_MAX != nPos ) - pAutoCmpltList->Remove( nPos ); - } - return 0; -} - -IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox*, pBox ) -{ - BOOL bEnable = pBox->IsChecked(); - if( pBox == &aCBActiv ) - { - aCBAppendSpace.Enable( bEnable ); - aCBAppendSpace.Enable( bEnable ); - aCBAsTip.Enable( bEnable ); - aDCBExpandKey.Enable( bEnable ); - } - else if(&aCBCollect == pBox) - aCBRemoveList.Enable( bEnable ); - return 0; -} - -void OfaAutoCompleteTabPage::CopyToClipboard() const -{ - USHORT nSelCnt = aLBEntries.GetSelectEntryCount(); - if( pAutoCmpltList && nSelCnt ) - { - TransferDataContainer* pCntnr = new TransferDataContainer; - ::com::sun::star::uno::Reference< - ::com::sun::star::datatransfer::XTransferable > xRef( pCntnr ); - - ByteString sData; - const sal_Char* pLineEnd = -#if defined(UNX) - "\012"; -#else - "\015\012"; -#endif - - rtl_TextEncoding nEncode = gsl_getSystemTextEncoding(); - - for( USHORT n = 0; n < nSelCnt; ++n ) - { - sData += ByteString( aLBEntries.GetSelectEntry( n ), nEncode ); - sData += pLineEnd; - } - pCntnr->CopyByteString( SOT_FORMAT_STRING, sData ); - pCntnr->CopyToClipboard( (Window*)this ); - } -} - -long OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify( - NotifyEvent& rNEvt ) -{ - long nHandled = MultiListBox::PreNotify( rNEvt ); - - if( !nHandled && EVENT_KEYUP == rNEvt.GetType() ) - { - const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) - { - case KEY_DELETE: - rPage.DeleteHdl( 0 ); - nHandled = 1; - break; - - default: - if( KEYFUNC_COPY == rKeyCode.GetFunction() ) - { - rPage.CopyToClipboard(); - nHandled = 1; - } - break; - } - } - return nHandled; -} - -// class OfaSmartTagOptionsTabPage --------------------------------------------- - -OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, SVX_RES( RID_OFAPAGE_SMARTTAG_OPTIONS ), rSet), - m_aMainCB( this, SVX_RES(CB_SMARTTAGS) ), - m_aSmartTagTypesLB( this, SVX_RES(LB_SMARTTAGS) ), - m_aPropertiesPB( this, SVX_RES(PB_SMARTTAGS) ), - m_aTitleFT( this, SVX_RES(FT_SMARTTAGS) ) -{ - FreeResource(); - - // some options for the list box: - m_aSmartTagTypesLB.SetWindowBits( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); - m_aSmartTagTypesLB.SetHighlightRange(); - - // set the handlers: - m_aMainCB.SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl)); - m_aPropertiesPB.SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl)); - m_aSmartTagTypesLB.SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl)); -} - -OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage() -{ - -} - -SfxTabPage* OfaSmartTagOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet) -{ - return new OfaSmartTagOptionsTabPage( pParent, rSet ); -} - -/** This struct is used to associate list box entries with smart tag data -*/ -struct ImplSmartTagLBUserData -{ - rtl::OUString maSmartTagType; - uno::Reference< smarttags::XSmartTagRecognizer > mxRec; - sal_Int32 mnSmartTagIdx; - - ImplSmartTagLBUserData( const rtl::OUString& rSmartTagType, - uno::Reference< smarttags::XSmartTagRecognizer > xRec, - sal_Int32 nSmartTagIdx ) : - maSmartTagType( rSmartTagType ), - mxRec( xRec ), - mnSmartTagIdx( nSmartTagIdx ) {} -}; - -/** Clears m_aSmartTagTypesLB -*/ -void OfaSmartTagOptionsTabPage::ClearListBox() -{ - const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount(); - for ( USHORT i = 0; i < nCount; ++i ) - { - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - delete pUserData; - } - - m_aSmartTagTypesLB.Clear(); -} - -/** Inserts items into m_aSmartTagTypesLB -*/ -void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr ) -{ - // first we have to clear the list box: - ClearListBox(); - - // fill list box: - const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers(); - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - std::vector< ActionReference > aActionReferences; - - for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i ) - { - uno::Reference< smarttags::XSmartTagRecognizer > xRec = rSmartTagMgr.GetRecognizer(i); - - const rtl::OUString aName = xRec->getName( aLocale ); - const rtl::OUString aDesc = xRec->getDescription( aLocale ); - const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount(); - - for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j ) - { - const rtl::OUString aSmartTagType = xRec->getSmartTagName(j); - rtl::OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale ); - - if ( !aSmartTagCaption.getLength() ) - aSmartTagCaption = aSmartTagType; - - const rtl::OUString aLBEntry = aSmartTagCaption + - OUString::createFromAscii(" (") + - aName + - OUString::createFromAscii(")"); - - SvLBoxEntry* pEntry = m_aSmartTagTypesLB.SvTreeListBox::InsertEntry( aLBEntry ); - if ( pEntry ) - { - const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType ); - m_aSmartTagTypesLB.SetCheckButtonState( pEntry, bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData(static_cast<void*>(new ImplSmartTagLBUserData( aSmartTagType, xRec, j ) ) ); - } - } - } -} - -/** Handler for the push button -*/ -IMPL_LINK( OfaSmartTagOptionsTabPage, ClickHdl, PushButton*, EMPTYARG ) -{ - const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; - const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; - - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) - xRec->displayPropertyPage( nSmartTagIdx, aLocale ); - - return 0; -} - -/** Handler for the check box -*/ -IMPL_LINK( OfaSmartTagOptionsTabPage, CheckHdl, CheckBox*, EMPTYARG ) -{ - const BOOL bEnable = m_aMainCB.IsChecked(); - m_aSmartTagTypesLB.Enable( bEnable ); - m_aSmartTagTypesLB.Invalidate(); - m_aPropertiesPB.Enable( false ); - - // if the controls are currently enabled, we still have to check - // if the properties button should be disabled because the currently - // seleted smart tag type does not have a properties dialog. - // We do this by calling SelectHdl: - if ( bEnable ) - SelectHdl( &m_aSmartTagTypesLB ); - - return 0; -} - -/** Handler for the list box -*/ -IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG) -{ - if ( m_aSmartTagTypesLB.GetEntryCount() < 1 ) - return 0; - - const USHORT nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; - const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; - - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) - m_aPropertiesPB.Enable( sal_True ); - else - m_aPropertiesPB.Enable( sal_False ); - - return 0; -} - -/** Propagates the current settings to the smart tag manager. -*/ -BOOL OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; - - // robust! - if ( !pSmartTagMgr ) - return FALSE; - - BOOL bModifiedSmartTagTypes = FALSE; - std::vector< rtl::OUString > aDisabledSmartTagTypes; - - const ULONG nCount = m_aSmartTagTypesLB.GetEntryCount(); - - for ( USHORT i = 0; i < nCount; ++i ) - { - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - const BOOL bChecked = m_aSmartTagTypesLB.IsChecked(i); - const BOOL bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType ); - - bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled ); - - if ( !bChecked ) - aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType ); - - delete pUserData; - } - - const BOOL bModifiedRecognize = ( !m_aMainCB.IsChecked() != !pSmartTagMgr->IsLabelTextWithSmartTags() ); - if ( bModifiedSmartTagTypes || bModifiedRecognize ) - { - bool bLabelTextWithSmartTags = m_aMainCB.IsChecked() ? true : false; - pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : 0, - bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : 0 ); - } - - return TRUE; -} - -/** Sets the controls based on the current settings at SmartTagMgr. -*/ -void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; - - // robust, should not happen! - if ( !pSmartTagMgr ) - return; - - FillListBox( *pSmartTagMgr ); - m_aSmartTagTypesLB.SelectEntryPos( 0 ); - m_aMainCB.Check( pSmartTagMgr->IsLabelTextWithSmartTags() ); - CheckHdl( &m_aMainCB ); -} - -void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( FALSE ); -} - diff --git a/svx/source/cui/autocdlg.hrc b/svx/source/cui/autocdlg.hrc deleted file mode 100644 index 65770dbae1..0000000000 --- a/svx/source/cui/autocdlg.hrc +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * 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: autocdlg.hrc,v $ - * $Revision: 1.7 $ - * - * 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_AUTOCDLG_HRC -#define _SVX_AUTOCDLG_HRC - -#include <svx/dialogs.hrc> - -// defines ------------------------------------------------------------------ - -#define CLB_SETTINGS 1 -/* -#define STR_DOUBLECAPS 3 -#define STR_STARTCAPS 4 -#define STR_FIRST 5 -#define STR_HALF 6 -#define STR_DASH 7 -#define STR_BOLDUNDERLINE 8 -#define STR_URL 9 -*/ - -#define CB_TYPO 11 -#define FT_STARTQUOTE 12 -#define PB_STARTQUOTE 13 -#define FT_ENDQUOTE 14 -#define PB_ENDQUOTE 15 - -#define FL_ABBREV 16 -#define ED_ABBREV 17 -#define LB_ABBREV 18 -#define PB_NEWABBREV 19 -#define PB_DELABBREV 20 -#define FL_DOUBLECAPS 21 -#define ED_DOUBLE_CAPS 22 -#define LB_DOUBLE_CAPS 23 -#define PB_NEWDOUBLECAPS 24 -#define PB_DELDOUBLECAPS 25 - -#define ED_SHORT 31 -#define ED_REPLACE 32 -#define TLB_REPLACE 33 -#define CB_TEXT_ONLY 34 -#define PB_NEW_REPLACE 35 -#define PB_DELETE_REPLACE 36 -#define STR_MODIFY 37 -#define STR_CLOSE_AUTOCORR 38 -#define FT_SHORT 39 -#define FT_REPLACE 40 -#define STR_CHANGE_START 41 -#define STR_CHANGE_END 42 -#define CB_AUTOABBREV 43 -#define CB_AUTOCAPS 44 - -#define FT_SGL_STARTQUOTE 45 -#define PB_SGL_STARTQUOTE 46 -#define FT_SGL_ENDQUOTE 47 -#define PB_SGL_ENDQUOTE 48 -#define PB_SGL_STD 49 -#define PB_DBL_STD 50 -#define FL_SINGLE 51 -#define FL_DOUBLE 52 -#define FT_SGSTEX 53 -#define FT_SGENEX 54 -#define FT_DBSTEX 55 -#define FT_DBECEX 56 -#define CB_SGL_TYPO 57 -#define ST_STANDARD 58 - -#define PB_EDIT 61 -#define ST_DEL_EMPTY_PARA 62 -#define ST_TYPO 66 -#define ST_USER_STYLE 67 -#define ST_BULLET 68 -#define STR_DEL_SPACES_AT_STT_END 69 -#define STR_DEL_SPACES_BETWEEN_LINES 70 - -#define ST_RIGHT_MARGIN 74 -#define STR_NUM 75 -#define STR_BORDER 76 -#define STR_TABLE 77 -#define STR_REPLACE_TEMPLATES 78 -#define FL_PRCNT 79 - -#define STR_HEADER 90 -#define FT_HEADER_EXPLANATION 91 -#define STR_HEADER1 92 -#define STR_HEADER2 93 -#define FT_HEADER1_EXPLANATION 94 -#define FT_HEADER2_EXPLANATION 95 - -#define ED_RIGHT_MARGIN 100 -#define BT_OK 101 -#define BT_CANCEL 102 - -#define BT_AWCP_OK 110 -#define BT_AWCP_CANCEL 111 -#define GB_AWCP_VALUE 112 -#define ED_AWCP_WORD_LEN 113 -#define ED_AWCP_LIST_LEN 114 -#define FT_AWCP_WORD_LEN 115 -#define FT_AWCP_LIST_LEN 116 - -#define CB_ACTIV 121 -#define CB_COLLECT 122 -#define CB_APPEND_SPACE 123 -#define CB_REMOVE_LIST 124 -#define CB_AS_TIP 125 -#define FT_MIN_WORDLEN 126 -#define FT_MAX_ENTRIES 127 -#define NF_MIN_WORDLEN 128 -#define NF_MAX_ENTRIES 129 -#define FT_EXPAND_KEY 130 -#define DCB_EXPAND_KEY 131 -#define LB_ENTRIES 132 -#define PB_ENTRIES 133 - - -#define ST_USE_REPLACE 200 -#define ST_CPTL_STT_WORD 201 -#define ST_CPTL_STT_SENT 202 -#define ST_BOLD_UNDER 203 -#define STR_NO_DBL_SPACES 204 -#define ST_DETECT_URL 205 -#define ST_ORDINAL 206 -#define ST_FRACTION 207 -#define ST_DASH 208 -#define FT_LANG 209 -#define LB_LANG 210 - -#define CB_SMARTTAGS 220 -#define FT_SMARTTAGS 221 -#define LB_SMARTTAGS 222 -#define PB_SMARTTAGS 223 - -#endif - diff --git a/svx/source/cui/autocdlg.hxx b/svx/source/cui/autocdlg.hxx deleted file mode 100644 index f6e48d671d..0000000000 --- a/svx/source/cui/autocdlg.hxx +++ /dev/null @@ -1,508 +0,0 @@ -/************************************************************************* - * - * 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: autocdlg.hxx,v $ - * $Revision: 1.11 $ - * - * 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 _OFA_AUTOCDLG_HXX -#define _OFA_AUTOCDLG_HXX - -#include <svtools/langtab.hxx> -#include <sfx2/tabdlg.hxx> -#include <tools/table.hxx> -#include <svx/checklbx.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/metric.hxx> -#include <svx/langbox.hxx> - -class SvxAutoCorrect; -class CharClass; -class CollatorWrapper; -class SmartTagMgr; - -// class OfaAutoCorrDlg -------------------------------------------------- - -class OfaAutoCorrDlg : public SfxTabDialog -{ - FixedText aLanguageFT; - SvxLanguageBox aLanguageLB; - - DECL_LINK(SelectLanguageHdl, ListBox*); -public: - - OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet ); - - void EnableLanguage(BOOL bEnable) - { aLanguageFT.Enable(bEnable); - aLanguageLB.Enable(bEnable);} - -}; - -#ifdef _OFA_AUTOCDLG_CXX -#include <vcl/group.hxx> -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif -#include <vcl/lstbox.hxx> -#include <svtools/svtabbx.hxx> -#include <svx/simptabl.hxx> - -class SvStringsISortDtor; - -// class OfaACorrCheckListBox ------------------------------------------ - -class OfaACorrCheckListBox : public SvxSimpleTable -{ - using SvxSimpleTable::SetTabs; - using SvTreeListBox::GetCheckButtonState; - using SvTreeListBox::SetCheckButtonState; - - protected: - virtual void SetTabs(); - virtual void HBarClick(); - virtual void KeyInput( const KeyEvent& rKEvt ); - - public: - OfaACorrCheckListBox(Window* pParent, const ResId& rResId ) : - SvxSimpleTable( pParent, rResId ){} - - inline void *GetUserData(ULONG nPos) { return GetEntry(nPos)->GetUserData(); } - inline void SetUserData(ULONG nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); } - inline ULONG GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); } - - BOOL IsChecked(ULONG nPos, USHORT nCol = 0); - void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked); - SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const; - void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState ); -}; - -// class OfaAutocorrOptionsPage ------------------------------------------ - - -class OfaAutocorrOptionsPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - SvxCheckListBox aCheckLB; - - String sInput; - String sDoubleCaps; - String sStartCap; - String sBoldUnderline; - String sURL; - String sNoDblSpaces; - String sHalf; - String sDash; - String sFirst; - -public: - OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrOptionsPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - -}; - -// class OfaSwAutoFmtOptionsPage ---------------------------------------------------- - -class OfaSwAutoFmtOptionsPage : public SfxTabPage -{ - using TabPage::ActivatePage; - - OfaACorrCheckListBox aCheckLB; - PushButton aEditPB; - FixedText aHeader1Expl; - FixedText aHeader2Expl; - - String sHeader1; - String sHeader2; - - String sDeleteEmptyPara; - String sUseReplaceTbl; - String sCptlSttWord; - String sCptlSttSent; - String sTypo; - String sUserStyle; - String sBullet; - String sByInputBullet; - String sBoldUnder; - String sNoDblSpaces; - String sFraction; - String sDetectURL; - String sDash; - String sOrdinal; - String sRightMargin; - String sNum; - String sBorder; - String sTable; - String sReplaceTemplates; - String sDelSpaceAtSttEnd; - String sDelSpaceBetweenLines; - - String sMargin; - String sBulletChar; - String sByInputBulletChar; - - Font aBulletFont; - Font aByInputBulletFont; - USHORT nPercent; - - SvLBoxButtonData* pCheckButtonData; - - DECL_LINK(SelectHdl, OfaACorrCheckListBox*); - DECL_LINK(EditHdl, PushButton*); - SvLBoxEntry* CreateEntry(String& rTxt, USHORT nCol); - - - OfaSwAutoFmtOptionsPage( Window* pParent, - const SfxItemSet& rSet ); - ~OfaSwAutoFmtOptionsPage(); - - public: - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -// class AutoCorrEdit ---------------------------------------------------- - -class AutoCorrEdit : public Edit -{ - Link aActionLink; - BOOL bSpaces; - - public: - AutoCorrEdit(Window* pParent, const ResId& rResId) : - Edit(pParent, rResId), bSpaces(FALSE){} - - void SetActionHdl( const Link& rLink ) - { aActionLink = rLink;} - - void SetSpaces(BOOL bSet) - {bSpaces = bSet;} - - virtual void KeyInput( const KeyEvent& rKEvent ); -}; - -// class OfaAutocorrReplacePage ------------------------------------------ - -class DoubleStringArray; -typedef DoubleStringArray* DoubleStringArrayPtr; -DECLARE_TABLE(DoubleStringTable, DoubleStringArrayPtr) - -class OfaAutocorrReplacePage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - CheckBox aTextOnlyCB; - FixedText aShortFT; - AutoCorrEdit aShortED; - FixedText aReplaceFT; - AutoCorrEdit aReplaceED; - SvTabListBox aReplaceTLB; - PushButton aNewReplacePB; - PushButton aDeleteReplacePB; - - String sModify; - String sNew; - - SvStringsISortDtor* pFormatText; - DoubleStringTable aDoubleStringTable; - CollatorWrapper* pCompareClass; - CollatorWrapper* pCompareCaseClass; - CharClass* pCharClass; - LanguageType eLang; - - BOOL bHasSelectionText; - BOOL bFirstSelect:1; - BOOL bReplaceEditChanged:1; - BOOL bSWriter:1; - - DECL_LINK(SelectHdl, SvTabListBox*); - DECL_LINK(NewDelHdl, PushButton*); - DECL_LINK(ModifyHdl, Edit*); - - void RefillReplaceBox(BOOL bFromReset, //Box mit neuer Sprache fuellen - LanguageType eOldLanguage, - LanguageType eNewLanguage); - -public: - OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrReplacePage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - - void SetLanguage(LanguageType eSet); -}; - -// class OfaAutocorrExceptPage --------------------------------------------- - -struct StringsArrays; -typedef StringsArrays* StringsArraysPtr; -DECLARE_TABLE(StringsTable, StringsArraysPtr) - -class OfaAutocorrExceptPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aAbbrevFL; - AutoCorrEdit aAbbrevED; - ListBox aAbbrevLB; - PushButton aNewAbbrevPB; - PushButton aDelAbbrevPB; - CheckBox aAutoAbbrevCB; - - FixedLine aDoubleCapsFL; - AutoCorrEdit aDoubleCapsED; - ListBox aDoubleCapsLB; - PushButton aNewDoublePB; - PushButton aDelDoublePB; - CheckBox aAutoCapsCB; - - StringsTable aStringsTable; - CollatorWrapper* pCompareClass; - LanguageType eLang; - - DECL_LINK(NewDelHdl, PushButton*); - DECL_LINK(SelectHdl, ListBox*); - DECL_LINK(ModifyHdl, Edit*); - - void RefillReplaceBoxes(BOOL bFromReset, //Box mit neuer Sprache fuellen - LanguageType eOldLanguage, - LanguageType eNewLanguage); -public: - OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrExceptPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - void SetLanguage(LanguageType eSet); - -}; - -// class OfaQuoteTabPage ------------------------------------------------- - -class OfaQuoteTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - - FixedLine aSingleFL; - CheckBox aSingleTypoCB; - FixedText aSglStartQuoteFT; - PushButton aSglStartQuotePB; - FixedText aSglStartExFT; - FixedText aSglEndQuoteFT; - PushButton aSglEndQuotePB; - FixedText aSglEndExFT; - PushButton aSglStandardPB; - - FixedLine aDoubleFL; - CheckBox aTypoCB; - FixedText aStartQuoteFT; - PushButton aStartQuotePB; - FixedText aDblStartExFT; - FixedText aEndQuoteFT; - PushButton aEndQuotePB; - FixedText aDblEndExFT; - PushButton aDblStandardPB; - - String sStartQuoteDlg; - String sEndQuoteDlg; - - String sStandard; - - - sal_UCS4 cSglStartQuote; - sal_UCS4 cSglEndQuote; - - sal_UCS4 cStartQuote; - sal_UCS4 cEndQuote; - - DECL_LINK( QuoteHdl, PushButton* ); - DECL_LINK( StdQuoteHdl, PushButton* ); - - String ChangeStringExt_Impl( sal_UCS4 ); - - OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ); -public: - ~OfaQuoteTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -// class OfaAutoCompleteTabPage --------------------------------------------- - -class OfaAutoCompleteTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - - class AutoCompleteMultiListBox : public MultiListBox - { - OfaAutoCompleteTabPage& rPage; - public: - AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg, - const ResId& rResId ) - : MultiListBox( &rPg, rResId ), rPage( rPg ) {} - - virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - CheckBox aCBActiv; //Enable word completion - CheckBox aCBAppendSpace;//Append space - CheckBox aCBAsTip; //Show as tip - - CheckBox aCBCollect;//Collect words - CheckBox aCBRemoveList;//...save the list for later use... - //--removed--CheckBox aCBEndless;// - - FixedText aFTExpandKey; - ListBox aDCBExpandKey; - FixedText aFTMinWordlen; - NumericField aNFMinWordlen; - FixedText aFTMaxEntries; - NumericField aNFMaxEntries; - AutoCompleteMultiListBox aLBEntries; - PushButton aPBEntries; - SvStringsISortDtor* pAutoCmpltList; - USHORT nAutoCmpltListCnt; - - DECL_LINK( CheckHdl, CheckBox* ); - - OfaAutoCompleteTabPage( Window* pParent, - const SfxItemSet& rSet ); -public: - virtual ~OfaAutoCompleteTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - - void CopyToClipboard() const; - DECL_LINK( DeleteHdl, PushButton* ); -}; - -// class OfaSmartTagOptionsTabPage --------------------------------------------- - -/** Smart tag options tab page - - This tab page is used to enable/disable smart tag types -*/ -class OfaSmartTagOptionsTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - - // controls - CheckBox m_aMainCB; - SvxCheckListBox m_aSmartTagTypesLB; - PushButton m_aPropertiesPB; - FixedText m_aTitleFT; - - // construction via Create() - OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); - - /** Inserts items into m_aSmartTagTypesLB - - Reads out the smart tag types supported by the SmartTagMgr and - inserts the associated strings into the list box. - */ - void FillListBox( const SmartTagMgr& rSmartTagMgr ); - - /** Clears the m_aSmartTagTypesLB - */ - void ClearListBox(); - - /** Handler for the check box - - Enables/disables all controls in the tab page (except from the - check box. - */ - DECL_LINK( CheckHdl, CheckBox* ); - - /** Handler for the push button - - Calls the displayPropertyPage function of the smart tag recognizer - associated with the currently selected smart tag type. - */ - DECL_LINK( ClickHdl, PushButton* ); - - /** Handler for the list box - - Enables/disables the properties push button if selection in the - smart tag types list box changes. - */ - DECL_LINK( SelectHdl, SvxCheckListBox* ); - -public: - - virtual ~OfaSmartTagOptionsTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet); - - virtual BOOL FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -#endif // _OFA_AUTOCDLG_CXX - -#endif // - diff --git a/svx/source/cui/autocdlg.src b/svx/source/cui/autocdlg.src deleted file mode 100644 index 0d9bc123d4..0000000000 --- a/svx/source/cui/autocdlg.src +++ /dev/null @@ -1,856 +0,0 @@ -/************************************************************************* - * - * 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: autocdlg.src,v $ - * $Revision: 1.14 $ - * - * 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 ------------------------------------------------------------------ -#include <svx/svxids.hrc> -#include "autocdlg.hrc" -#include <svx/dialogs.hrc> -#include "helpid.hrc" - - // pragma ------------------------------------------------------------------- -/**************************************************************************/ -/* */ -/* TabDialog RID_OFA_AUTOCORR_DLG */ -/* */ -/**************************************************************************/ -TabDialog RID_OFA_AUTOCORR_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "AutoCorrect" ; - Moveable = TRUE ; - TabControl 1 - { - SVLook = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_REPLACE ; - Text [ en-US ] = "Replace" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_EXCEPT ; - Text [ en-US ] = "Exceptions" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_OPTIONS ; - Text [ en-US ] = "Options" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOFMT_APPLY ; - Text [ en-US ] = "Options" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_QUOTE ; - Text [ en-US ] = "Custom Quotes" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; - Text [ en-US ] = "Word Completion"; - }; - PageItem - { - Identifier = RID_OFAPAGE_SMARTTAG_OPTIONS ; - Text [ en-US ] = "Smart Tags"; - }; - }; - }; - FixedText FT_LANG - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 140 , 8 ) ; - - Left = TRUE ; - Text [ en-US ] = "Replacements and exceptions for language:"; - }; - ListBox LB_LANG - { - Pos = MAP_APPFONT ( 150 , 3 ) ; - Size = MAP_APPFONT ( 60 , 100 ) ; - DropDown = TRUE; - TabStop = TRUE ; - Border = TRUE ; - }; -}; -#define COMMON_CLB_ENTRIES \ - String ST_USE_REPLACE \ - { \ - Text [ en-US ] = "Use replacement table" ; \ - }; \ - String ST_CPTL_STT_WORD \ - { \ - Text [ en-US ] = "Correct TWo INitial CApitals" ; \ - }; \ - String ST_CPTL_STT_SENT \ - { \ - Text [ en-US ] = "Capitalize first letter of every sentence" ; \ - }; \ - String ST_BOLD_UNDER \ - { \ - Text [ en-US ] = "Automatic *bold* and _underline_" ; \ - }; \ - String STR_NO_DBL_SPACES \ - { \ - Text [ en-US ] = "Ignore double spaces" ; \ - }; \ - String ST_DETECT_URL \ - { \ - Text [ en-US ] = "URL Recognition" ; \ - }; \ - String ST_ORDINAL \ - { \ - Text [ en-US ] = "Replace 1st... with 1^st..." ; \ - }; \ - String ST_FRACTION \ - { \ - Text [ en-US ] = "Replace 1/2 ... with ½ ..." ; \ - }; \ - String ST_DASH \ - { \ - Text [ en-US ] = "Replace dashes" ; \ - }; - -/**************************************************************************/ -/* */ -/* Beschreibung: Autokorrektur-Optionen */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_OPTIONS -{ - HelpId = HID_OFAPAGE_AUTOCORR_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Settings" ; - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 173 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - COMMON_CLB_ENTRIES -}; -/**************************************************************************/ -/* */ -/* */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOFMT_APPLY -{ - HelpID = HID_OFAPAGE_AUTOFMT_OPTIONS ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 149 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_EDIT - { - Pos = MAP_APPFONT ( 6 , 162 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Edit..." ; - TabStop = TRUE ; - }; - String STR_HEADER1 - { - Text [ en-US ] = "[M]" ; - }; - String STR_HEADER2 - { - Text [ en-US ] = "[T]" ; - }; - FixedText FT_HEADER1_EXPLANATION - { - Pos = MAP_APPFONT ( 80 , 159 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "[M]: Replace while modifying existing text" ; - }; - FixedText FT_HEADER2_EXPLANATION - { - Pos = MAP_APPFONT ( 80 , 171 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "[T]: AutoFormat/AutoCorrect while typing" ; - }; - COMMON_CLB_ENTRIES - String ST_DEL_EMPTY_PARA - { - /* ### ACHTUNG: Neuer Text in Resource? Leere Absätze entfernen : Leere Absõtze entfernen */ - Text [ en-US ] = "Remove blank paragraphs" ; - }; - String ST_TYPO - { - Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ; - }; - String ST_USER_STYLE - { - Text [ en-US ] = "Replace Custom Styles" ; - }; - String ST_BULLET - { - Text [ en-US ] = "Replace bullets with: " ; - }; - String ST_RIGHT_MARGIN - { - /* ### ACHTUNG: Neuer Text in Resource? Zusammenfassen von einzeiligen Absätzen ab : Zusammenfassen von einzeiligen Absõtzen ab */ - // Text [ norwegian_wrong ] = "+++Combine single line paragraphs at" ; - // Text [ swedish_wrong ] = ~Kombinera enradiga stycken B738vid " ; - Text [ en-US ] = "Combine single line paragraphs if length greater than" ; - }; - String STR_NUM - { - Text [ en-US ] = "Apply numbering - symbol: " ; - }; - String STR_BORDER - { - Text [ en-US ] = "Apply border" ; - }; - String STR_TABLE - { - Text [ en-US ] = "Create table" ; - }; - String STR_REPLACE_TEMPLATES - { - Text [ en-US ] = "Apply Styles" ; - }; - String STR_DEL_SPACES_AT_STT_END - { - Text [ en-US ] = "Delete spaces and tabs at beginning and end of paragraph"; - }; - String STR_DEL_SPACES_BETWEEN_LINES - { - Text [ en-US ] = "Delete spaces and tabs at end and start of line"; - }; -}; - -ModalDialog RID_OFADLG_PRCNT_SET -{ - HelpID = SID_AUTOFORMAT ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 155 , 43 ) ; - Moveable = TRUE ; - FixedLine FL_PRCNT - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 87 , 8 ) ; - Text [ en-US ] = "Minimum size" ; - }; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 99 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 99 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - MetricField ED_RIGHT_MARGIN - { - Border = TRUE ; - Pos = MAP_APPFONT ( 7 , 14 ) ; - Size = MAP_APPFONT ( 31 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Value = 77 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 10 ; - Last = 100 ; - SpinSize = 5 ; - }; - Text [ en-US ] = "Combine" ; -}; - -/**************************************************************************/ -/* */ -/* Beschreibung: Ersetzungstabelle */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_REPLACE -{ - HelpId = HID_OFAPAGE_AUTOCORR_REPLACE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedText FT_SHORT - { - Pos = MAP_APPFONT ( 7 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Repla~ce" ; - Left = TRUE ; - }; - Edit ED_SHORT - { - Pos = MAP_APPFONT ( 7 , 13 ) ; - Size = MAP_APPFONT ( 60 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_REPLACE - { - Pos = MAP_APPFONT ( 71 , 3 ) ; - Size = MAP_APPFONT ( 64 , 8 ) ; - Text [ en-US ] = "~With:" ; - Left = TRUE ; - }; - Edit ED_REPLACE - { - Pos = MAP_APPFONT ( 71 , 13 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - CheckBox CB_TEXT_ONLY - { - Pos = MAP_APPFONT ( 140 , 3 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Text only" ; - }; - PushButton PB_NEW_REPLACE - { - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~New" ; - }; - PushButton PB_DELETE_REPLACE - { - Pos = MAP_APPFONT ( 198 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - Control TLB_REPLACE - { - HelpId = HID_OFACTL_AUTOCORR_REPLACE ; - Pos = MAP_APPFONT ( 7 , 29 ) ; - Size = MAP_APPFONT ( 187 , 150 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - String STR_MODIFY - { - Text [ en-US ] = "~Replace" ; - }; -}; -/**************************************************************************/ -/* */ -/* Beschreibung: Ausnahmelisten */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_EXCEPT -{ - HelpId = HID_OFAPAGE_AUTOCORR_EXCEPT ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedLine FL_ABBREV - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Abbreviations (no subsequent capital)" ; - }; - Edit ED_ABBREV - { - Pos = MAP_APPFONT ( 7 , 14 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - ListBox LB_ABBREV - { - Pos = MAP_APPFONT ( 7 , 30 ) ; - Size = MAP_APPFONT ( 123 , 58 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - Border = TRUE ; - }; - PushButton PB_NEWABBREV - { - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Text [ en-US ] = "~New" ; - }; - PushButton PB_DELABBREV - { - Pos = MAP_APPFONT ( 198 , 31 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - CheckBox CB_AUTOABBREV - { - Pos = MAP_APPFONT ( 137 , 78 ) ; - Size = MAP_APPFONT ( 111 , 10 ) ; - Text [ en-US ] = "~AutoInclude"; - Text [ en-US ] = "~AutoInclude" ; - TabStop = TRUE ; - }; - FixedLine FL_DOUBLECAPS - { - Pos = MAP_APPFONT ( 4 , 94 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Words with TWo INitial CApitals" ; - }; - Edit ED_DOUBLE_CAPS - { - Pos = MAP_APPFONT ( 7 , 105 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - ListBox LB_DOUBLE_CAPS - { - Pos = MAP_APPFONT ( 7 , 120 ) ; - Size = MAP_APPFONT ( 123 , 59 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - Border = TRUE ; - }; - PushButton PB_NEWDOUBLECAPS - { - Pos = MAP_APPFONT ( 198 , 105 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "Ne~w" ; - }; - PushButton PB_DELDOUBLECAPS - { - Pos = MAP_APPFONT ( 198 , 122 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "Dele~te" ; - }; - CheckBox CB_AUTOCAPS - { - Pos = MAP_APPFONT ( 137 , 169 ) ; - Size = MAP_APPFONT ( 111 , 10 ) ; - Text [ en-US ] = "A~utoInclude"; - Text [ en-US ] = "A~utoInclude" ; - }; -}; -/**************************************************************************/ -/* */ -/* Beschreibung: Typografische Anfuehrungszeichen */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_QUOTE -{ - HelpId = HID_OFAPAGE_AUTOCORR_QUOTE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Custom Quotes" ; - FixedLine FL_SINGLE - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Single quotes" ; - }; - Checkbox CB_SGL_TYPO - { - Pos = MAP_APPFONT ( 7 , 14 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "Repla~ce" ; - }; - FixedText FT_SGL_STARTQUOTE - { - Pos = MAP_APPFONT ( 7 , 30 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "~Start quote:" ; - }; - PushButton PB_SGL_STARTQUOTE - { - Pos = MAP_APPFONT ( 105 , 28 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\'" ; - TabStop = TRUE ; - }; - FixedText FT_SGSTEX - { - Pos = MAP_APPFONT ( 124 , 30 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - FixedText FT_SGL_ENDQUOTE - { - Pos = MAP_APPFONT ( 7 , 46 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "~End quote:" ; - }; - PushButton PB_SGL_ENDQUOTE - { - Pos = MAP_APPFONT ( 105 , 44 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\'" ; - TabStop = TRUE ; - }; - FixedText FT_SGENEX - { - Pos = MAP_APPFONT ( 124 , 46 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - PushButton PB_SGL_STD - { - Pos = MAP_APPFONT ( 198 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Default" ; - }; - FixedLine FL_DOUBLE - { - Pos = MAP_APPFONT ( 4 , 83 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Double quotes" ; - }; - CheckBox CB_TYPO - { - Pos = MAP_APPFONT ( 7 , 94 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Repl~ace" ; - }; - FixedText FT_STARTQUOTE - { - Pos = MAP_APPFONT ( 7 , 110 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "Start q~uote:" ; - }; - PushButton PB_STARTQUOTE - { - Pos = MAP_APPFONT ( 105 , 108 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\"" ; - TabStop = TRUE ; - }; - FixedText FT_DBSTEX - { - Pos = MAP_APPFONT ( 124 , 110 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - FixedText FT_ENDQUOTE - { - Pos = MAP_APPFONT ( 7 , 126 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "E~nd quote:" ; - }; - PushButton PB_ENDQUOTE - { - Pos = MAP_APPFONT ( 105 , 124 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\"" ; - TabStop = TRUE ; - }; - FixedText FT_DBECEX - { - Pos = MAP_APPFONT ( 124 , 126 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - PushButton PB_DBL_STD - { - Pos = MAP_APPFONT ( 195 , 143 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "De~fault" ; - }; - String STR_CHANGE_START - { - Text [ en-US ] = "Start quote" ; - }; - String STR_CHANGE_END - { - Text [ en-US ] = "End quote" ; - }; - String ST_STANDARD - { - Text [ en-US ] = "Default" ; - }; -}; - -/**************************************************************************/ -/* */ -/* Beschreibung: automatische Wortergänzung */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCOMPLETE_OPTIONS -{ - HelpId = HID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - CheckBox CB_ACTIV - { - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "Enable word ~completion"; - }; - CheckBox CB_APPEND_SPACE - { - Pos = MAP_APPFONT( 10, 17 ); - Size = MAP_APPFONT( 110, 10 ); - Text [ en-US ] = "~Append space"; - }; - CheckBox CB_AS_TIP - { - Pos = MAP_APPFONT( 10, 31 ); - Size = MAP_APPFONT( 110, 10 ); - Text [ en-US ] = "~Show as tip"; - }; - CheckBox CB_COLLECT - { - Pos = MAP_APPFONT( 4, 45 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "C~ollect words"; - }; - CheckBox CB_REMOVE_LIST - { - Pos = MAP_APPFONT( 10, 59 ); - Size = MAP_APPFONT( 110, 40 ); - WordBreak = TRUE; - Text [ en-US ] = "~When closing a document, remove the words collected from it from the list"; - }; - FixedText FT_EXPAND_KEY - { - Pos = MAP_APPFONT( 4, 102 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Acc~ept with"; - }; - ListBox DCB_EXPAND_KEY - { - Pos = MAP_APPFONT( 4, 113 ); - Size = MAP_APPFONT( 116, 60 ); - TabStop = TRUE; - DropDown = TRUE; - Group = TRUE; - Sort = FALSE; - }; - FixedText FT_MIN_WORDLEN - { - Pos = MAP_APPFONT( 4, 129 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Mi~n. word length"; - }; - NumericField NF_MIN_WORDLEN - { - Border = TRUE; - Pos = MAP_APPFONT( 4, 140 ); - Size = MAP_APPFONT( 30, 12 ); - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Value = 10 ; - Minimum = 5 ; - First = 5 ; - Last = 100 ; - Maximum = 100 ; - SpinSize = 1 ; - }; - FixedText FT_MAX_ENTRIES - { - Pos = MAP_APPFONT( 4, 156 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "~Max. entries"; - }; - NumericField NF_MAX_ENTRIES - { - Border = TRUE; - Pos = MAP_APPFONT( 4, 167 ); - Size = MAP_APPFONT( 30, 12 ); - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Value = 500 ; - Maximum = 10000; - Last = 10000 ; - First = 50 ; - Minimum = 50; - SpinSize = 25 ; - }; - MultiListBox LB_ENTRIES - { - Pos = MAP_APPFONT( 127, 3 ); - Size = MAP_APPFONT( 121, 158 ); - TabStop = TRUE; - DropDown = FALSE; - Group = TRUE; - Border = TRUE; - Sort = TRUE; - }; - PushButton PB_ENTRIES - { - Pos = MAP_APPFONT( 127, 165 ); - Size = MAP_APPFONT( 121, 14 ); - TabStop = TRUE ; - Text [ en-US ] = "~Delete Entry"; - }; - Text [ en-US ] = "Word Completion"; -}; - - -/**************************************************************************/ -/* */ -/* Beschreibung: Smart Tag Options */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_SMARTTAG_OPTIONS -{ - HelpId = HID_OFAPAGE_SMARTTAG_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Smart Tags"; - - CheckBox CB_SMARTTAGS - { - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "Label text with smart tags"; - }; - - FixedText FT_SMARTTAGS - { - Pos = MAP_APPFONT( 12, 15 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Currently installed smart tags"; - }; - - Control LB_SMARTTAGS - { - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 172 , 154 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - - PushButton PB_SMARTTAGS - { - Pos = MAP_APPFONT ( 188 , 25 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Properties..."; - }; - -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svx/source/cui/backgrnd.cxx b/svx/source/cui/backgrnd.cxx deleted file mode 100644 index f297f052e8..0000000000 --- a/svx/source/cui/backgrnd.cxx +++ /dev/null @@ -1,1990 +0,0 @@ -/************************************************************************* - * - * 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: backgrnd.cxx,v $ - * $Revision: 1.39 $ - * - * 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_svx.hxx" - -#ifdef SVX_DLLIMPLEMENTATION -#undef SVX_DLLIMPLEMENTATION -#endif - -// include --------------------------------------------------------------- -#include <svtools/pathoptions.hxx> -#include <svtools/intitem.hxx> -#include <vcl/msgbox.hxx> -#include <tools/urlobj.hxx> -#include <sfx2/objsh.hxx> -#include <sfx2/docfile.hxx> -#include <svtools/wallitem.hxx> -#include <svtools/cntwall.hxx> -#ifndef _CNTIDS_HRC -#include <sfx2/cntids.hrc> -#endif - -#define _SVX_BACKGRND_CXX - -#include <svx/dialogs.hrc> -#include "backgrnd.hrc" -#include <svx/svxitems.hrc> - - - - -// Tabellenhintergrund -#define TBL_DEST_CELL 0 -#define TBL_DEST_ROW 1 -#define TBL_DEST_TBL 2 - -#include <svx/brshitem.hxx> -#include "backgrnd.hxx" - -#include <svx/xtable.hxx> -#include "opengrf.hxx" -#include "impgrf.hxx" -#include "svxerr.hxx" -#include "drawitem.hxx" -#include <svx/dialmgr.hxx> -#include "htmlmode.hxx" -#ifndef _SVT_CONTROLDIMS_HRC_ -#include <svtools/controldims.hrc> -#endif -#include <svx/svxids.hrc> //CHINA001 -#include "flagsdef.hxx" //CHINA001 -#include <svtools/intitem.hxx> //CHINA001 -#include <sfx2/request.hxx> //CHINA001 -using namespace ::com::sun::star; -// static ---------------------------------------------------------------- - -static USHORT pRanges[] = -{ - SID_VIEW_FLD_PIC, SID_VIEW_FLD_PIC, - SID_ATTR_BRUSH, SID_ATTR_BRUSH, - SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, - 0 -}; - -struct SvxBackgroundTable_Impl -{ - SvxBrushItem* pCellBrush; - SvxBrushItem* pRowBrush; - SvxBrushItem* pTableBrush; - USHORT nCellWhich; - USHORT nRowWhich; - USHORT nTableWhich; - USHORT nActPos; - - SvxBackgroundTable_Impl() : - pCellBrush(NULL), pRowBrush(NULL), pTableBrush(NULL), - nCellWhich(0), nRowWhich(0), nTableWhich(0) {} -}; - -struct SvxBackgroundPara_Impl -{ - SvxBrushItem* pParaBrush; - SvxBrushItem* pCharBrush; - - USHORT nActPos; - - SvxBackgroundPara_Impl() : - pParaBrush(NULL), pCharBrush(NULL) {} -}; - -struct SvxBackgroundPage_Impl -{ - Timer* pLoadTimer; - BOOL bIsImportDlgInExecute; - - SvxBackgroundPage_Impl() : - pLoadTimer(NULL), bIsImportDlgInExecute(FALSE) {} -}; -/* -----------------------------15.08.2002 12:21------------------------------ - - ---------------------------------------------------------------------------*/ -inline BYTE lcl_PercentToTransparency(long nPercent) -{ - //0xff must not be returned! - return BYTE(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); -} -inline BYTE lcl_TransparencyToPercent(BYTE nTrans) -{ - return (nTrans * 100 + 127) / 254; -} -void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency) -{ - uno::Any aTransparency; - aTransparency <<= (sal_Int8)nTransparency; - rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY); -} -//------------------------------------------------------------------------- - -/* [Beschreibung] - -*/ - -USHORT GetItemId_Impl( ValueSet& rValueSet, const Color& rCol ) -{ - BOOL bFound = FALSE; - USHORT nCount = rValueSet.GetItemCount(); - USHORT n = 1; - - while ( !bFound && n <= nCount ) - { - Color aValCol = rValueSet.GetItemColor(n); - - bFound = ( aValCol.GetRed() == rCol.GetRed() - && aValCol.GetGreen() == rCol.GetGreen() - && aValCol.GetBlue() == rCol.GetBlue() ); - - if ( !bFound ) - n++; - } - return bFound ? n : 0; -} - -// class BackgroundPreview ----------------------------------------------- - -/* [Beschreibung] - - Vorschaufenster f"ur Brush oder Bitmap -*/ - -class BackgroundPreviewImpl : public Window -{ -public: - BackgroundPreviewImpl( Window* pParent, - const ResId& rResId, BOOL bIsBmpPreview ); - ~BackgroundPreviewImpl(); - - void NotifyChange( const Color& rColor ); - void NotifyChange( const Bitmap* pBitmap ); - -protected: - virtual void Paint( const Rectangle& rRect ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -private: - const BOOL bIsBmp; - Bitmap* pBitmap; - Point aDrawPos; - Size aDrawSize; - Rectangle aDrawRect; - BYTE nTransparency; -}; - -//----------------------------------------------------------------------- - -BackgroundPreviewImpl::BackgroundPreviewImpl -( - Window* pParent, - const ResId& rResId, - BOOL bIsBmpPreview -) : - -/* [Beschreibung] - -*/ - - Window( pParent, rResId ), - - bIsBmp ( bIsBmpPreview ), - pBitmap ( NULL ), - aDrawRect( Point(0,0), GetOutputSizePixel() ), - nTransparency(0) - -{ - SetBorderStyle(WINDOW_BORDER_MONO); - Paint( aDrawRect ); -} - -//----------------------------------------------------------------------- - -BackgroundPreviewImpl::~BackgroundPreviewImpl() - -/* [Beschreibung] - -*/ - -{ - delete pBitmap; -} - -//----------------------------------------------------------------------- -void BackgroundPreviewImpl::NotifyChange( const Color& rColor ) -{ - if ( !bIsBmp ) - { - const static Color aTranspCol( COL_TRANSPARENT ); - - nTransparency = lcl_TransparencyToPercent( rColor.GetTransparency() ); - - SetFillColor( rColor == aTranspCol ? GetSettings().GetStyleSettings().GetFieldColor() : (Color) rColor.GetRGBColor() ); - Paint( aDrawRect ); - } -} - -//----------------------------------------------------------------------- - -void BackgroundPreviewImpl::NotifyChange( const Bitmap* pNewBitmap ) -/* [Beschreibung] - -*/ - -{ - if ( bIsBmp && (pNewBitmap || pBitmap) ) - { - if ( pNewBitmap && pBitmap ) - *pBitmap = *pNewBitmap; - else if ( pNewBitmap && !pBitmap ) - pBitmap = new Bitmap( *pNewBitmap ); - else if ( !pNewBitmap ) - DELETEZ( pBitmap ); - - if ( pBitmap ) - { - Size aSize = GetOutputSizePixel(); - // InnerSize == Size without one pixel border - Size aInnerSize = aSize; - aInnerSize.Width() -= 2; - aInnerSize.Height() -= 2; - aDrawSize = pBitmap->GetSizePixel(); - - // bitmap bigger than preview window? - if ( aDrawSize.Width() > aInnerSize.Width() ) - { - aDrawSize.Height() = aDrawSize.Height() * aInnerSize.Width() / aDrawSize.Width(); - if ( aDrawSize.Height() > aInnerSize.Height() ) - { - aDrawSize.Width() = aDrawSize.Height(); - aDrawSize.Height() = aInnerSize.Height(); - } - else - aDrawSize.Width() = aInnerSize.Width(); - } - else if ( aDrawSize.Height() > aInnerSize.Height() ) - { - aDrawSize.Width() = aDrawSize.Width() * aInnerSize.Height() / aDrawSize.Height(); - if ( aDrawSize.Width() > aInnerSize.Width() ) - { - aDrawSize.Height() = aDrawSize.Width(); - aDrawSize.Width() = aInnerSize.Width(); - } - else - aDrawSize.Height() = aInnerSize.Height(); - } - - aDrawPos.X() = (aSize.Width() - aDrawSize.Width()) / 2; - aDrawPos.Y() = (aSize.Height() - aDrawSize.Height()) / 2; - } - Invalidate( aDrawRect ); - Update(); - } -} - -//----------------------------------------------------------------------- - -void BackgroundPreviewImpl::Paint( const Rectangle& ) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); - SetLineColor(); - if(bIsBmp) - SetFillColor( Color(COL_TRANSPARENT) ); - DrawRect( aDrawRect ); - if ( bIsBmp ) - { - if ( pBitmap ) - DrawBitmap( aDrawPos, aDrawSize, *pBitmap ); - else - { - Size aSize = GetOutputSizePixel(); - DrawLine( Point(0,0), Point(aSize.Width(),aSize.Height()) ); - DrawLine( Point(0,aSize.Height()), Point(aSize.Width(),0) ); - } - } -} -/* -----------------------------27.02.2002 11:07------------------------------ - - ---------------------------------------------------------------------------*/ -void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - Invalidate(); - } - Window::DataChanged( rDCEvt ); -} - -// class SvxBackgroundTabPage -------------------------------------------- - -#define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl) - -SvxBackgroundTabPage::SvxBackgroundTabPage( Window* pParent, - const SfxItemSet& rCoreSet ) : - -/* [Beschreibung] - -*/ - - SvxTabPage( pParent, SVX_RES( RID_SVXPAGE_BACKGROUND ), rCoreSet ), - - aBorderWin ( this, SVX_RES(CT_BORDER) ), - aBackgroundColorSet ( &aBorderWin, SVX_RES( SET_BGDCOLOR ) ), - aBackgroundColorBox ( this, SVX_RES( GB_BGDCOLOR ) ), - pPreviewWin1 ( new BackgroundPreviewImpl( - this, SVX_RES( WIN_PREVIEW1 ), FALSE ) ), - aColTransFT ( this, SVX_RES( FT_COL_TRANS ) ), - aColTransMF ( this, SVX_RES( MF_COL_TRANS ) ), - aBtnBrowse ( this, SVX_RES( BTN_BROWSE ) ), - aBtnLink ( this, SVX_RES( BTN_LINK ) ), - aBtnPreview ( this, SVX_RES( BTN_PREVIEW ) ), - aFtFile ( this, SVX_RES( FT_FILE ) ), - aGbFile ( this, SVX_RES( GB_FILE ) ), - aBtnPosition ( this, SVX_RES( BTN_POSITION ) ), - aBtnArea ( this, SVX_RES( BTN_AREA ) ), - aBtnTile ( this, SVX_RES( BTN_TILE ) ), - aWndPosition ( this, SVX_RES( WND_POSITION ), RP_MM ), - aGbPosition ( this, SVX_RES( GB_POSITION ) ), - aGraphTransFL ( this, SVX_RES( FL_GRAPH_TRANS ) ), - aGraphTransMF ( this, SVX_RES( MF_GRAPH_TRANS ) ), - pPreviewWin2 ( new BackgroundPreviewImpl( - this, SVX_RES( WIN_PREVIEW2 ), TRUE ) ), - aSelectTxt ( this, SVX_RES( FT_SELECTOR ) ), - aLbSelect ( this, SVX_RES( LB_SELECTOR ) ), - aStrBrowse ( SVX_RES( STR_BROWSE ) ), - aStrUnlinked ( SVX_RES( STR_UNLINKED ) ), - aTblDesc ( this, SVX_RES( FT_TBL_DESC ) ), - aTblLBox ( this, SVX_RES( LB_TBL_BOX ) ), - aParaLBox ( this, SVX_RES( LB_PARA_BOX ) ), - nHtmlMode ( 0 ), - bAllowShowSelector ( TRUE ), - bIsGraphicValid ( FALSE ), - bLinkOnly ( FALSE ), - bResized ( FALSE ), - bColTransparency ( FALSE ), - bGraphTransparency ( FALSE ), - - pPageImpl ( new SvxBackgroundPage_Impl ), - pImportDlg ( NULL ), - pTableBck_Impl ( NULL ), - pParaBck_Impl ( NULL ) - -{ - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - const SfxPoolItem* pItem; - SfxObjectShell* pShell; - - if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_HTML_MODE, FALSE, &pItem ) - || ( 0 != ( pShell = SfxObjectShell::Current()) && - 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) - { - nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); - } - - FillColorValueSets_Impl(); - - aBackgroundColorSet.SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); - FreeResource(); -} - -//------------------------------------------------------------------------ - -SvxBackgroundTabPage::~SvxBackgroundTabPage() - -/* [Beschreibung] - -*/ - -{ - delete pPreviewWin1; - delete pPreviewWin2; - delete pPageImpl->pLoadTimer; - delete pPageImpl; - delete pImportDlg; - - if( pTableBck_Impl) - { - delete pTableBck_Impl->pCellBrush; - delete pTableBck_Impl->pRowBrush; - delete pTableBck_Impl->pTableBrush; - delete pTableBck_Impl; - } - - if(pParaBck_Impl) - { - delete pParaBck_Impl->pParaBrush; - delete pParaBck_Impl->pCharBrush; - delete pParaBck_Impl; - } -} - -//------------------------------------------------------------------------ - -USHORT* SvxBackgroundTabPage::GetRanges() - -/* [Beschreibung] - - gibt den Bereich der Which-Werte zur"uck -*/ - -{ - return pRanges; -} - -//------------------------------------------------------------------------ - -SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) - -/* [Beschreibung] - - Create-Methode f"ur den TabDialog -*/ - -{ - return ( new SvxBackgroundTabPage( pParent, rAttrSet ) ); -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) - -/* [Beschreibung] - -*/ - -{ -// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, -// es muss aber im rSet vorhanden sein! -// const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) - if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE)) - { - ResetFromWallpaperItem( rSet ); - return; - } - - // Zustand des Vorschau-Buttons durch UserData persistent - String aUserData = GetUserData(); - aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); - - // nach Reset kein ShowSelector() mehr aufrufen d"urfen - bAllowShowSelector = FALSE; - - - // Input-BrushItem besorgen und auswerten - const SvxBrushItem* pBgdAttr = NULL; - USHORT nSlot = SID_ATTR_BRUSH; - const SfxPoolItem* pItem; - USHORT nDestValue = USHRT_MAX; - - if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION, - FALSE, &pItem ) ) - { - nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); - aTblLBox.SelectEntryPos(nDestValue); - - switch ( nDestValue ) - { - case TBL_DEST_CELL: - nSlot = SID_ATTR_BRUSH; - break; - case TBL_DEST_ROW: - nSlot = SID_ATTR_BRUSH_ROW; - break; - case TBL_DEST_TBL: - nSlot = SID_ATTR_BRUSH_TABLE; - break; - } - } - else if( SFX_ITEM_SET == rSet.GetItemState( - SID_PARA_BACKGRND_DESTINATION, FALSE, &pItem ) ) - { - nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); - // ist gerade Zeichen aktiviert? - USHORT nParaSel = aParaLBox.GetSelectEntryPos(); - if(1 == nParaSel) - { - // dann war das ein "Standard" - Aufruf - nDestValue = nParaSel; - } - aParaLBox.SelectEntryPos(nDestValue); - - switch ( nDestValue ) - { - case PARA_DEST_PARA: - nSlot = SID_ATTR_BRUSH; - break; - case PARA_DEST_CHAR: - nSlot = SID_ATTR_BRUSH_CHAR; - break; - } - } - //#111173# the destination item is missing when the parent style has been changed - if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible())) - nDestValue = 0; - USHORT nWhich = GetWhich( nSlot ); - - if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - - aBtnTile.Check(); - - if ( pBgdAttr ) - { - FillControls_Impl(*pBgdAttr, aUserData); - aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor(); - } - else - { - aSelectTxt.Hide(); - aLbSelect.Hide(); - aLbSelect.SelectEntryPos( 0 ); - ShowColorUI_Impl(); - - const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH ); - - if ( pOld ) - aBgdColor = ( (SvxBrushItem*)pOld )->GetColor(); - } - - if ( nDestValue != USHRT_MAX ) - { - if(aTblLBox.IsVisible()) - { - USHORT nValue = aTblLBox.GetSelectEntryPos(); - - if ( pTableBck_Impl ) - { - DELETEZ( pTableBck_Impl->pCellBrush); - DELETEZ( pTableBck_Impl->pRowBrush); - DELETEZ( pTableBck_Impl->pTableBrush); - } - else - pTableBck_Impl = new SvxBackgroundTable_Impl(); - - pTableBck_Impl->nActPos = nValue; - - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nCellWhich = nWhich; - - if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, FALSE ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); - pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; - - if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, FALSE ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); - pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; - - TblDestinationHdl_Impl(&aTblLBox); - aTblLBox.SaveValue(); - } - else - { - USHORT nValue = aParaLBox.GetSelectEntryPos(); - - if ( pParaBck_Impl ) - { - delete pParaBck_Impl->pParaBrush; - delete pParaBck_Impl->pCharBrush; - } - else - pParaBck_Impl = new SvxBackgroundPara_Impl(); - - pParaBck_Impl->nActPos = nValue; - - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); - } - - nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); - SfxItemState eState = rSet.GetItemState( nWhich, TRUE ); - eState = rSet.GetItemState( nWhich, FALSE ); - if ( rSet.GetItemState( nWhich, TRUE ) > SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); - } - else - pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); - - ParaDestinationHdl_Impl(&aParaLBox); - aParaLBox.SaveValue(); - } - } - if(!bResized) - { - if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible()) - { - long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X()); - long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y()); - Point aPos(aBorderWin.GetPosPixel()); - aPos.X() = nX; - aPos.Y() = nY; - aBorderWin.SetPosPixel(aPos); - aPos = pPreviewWin1->GetPosPixel(); - aPos.Y() = nY; - pPreviewWin1->SetPosPixel(aPos); - aBackgroundColorBox.Hide(); - } - } -} - -void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) -{ - ShowSelector(); - - // Zustand des Vorschau-Buttons durch UserData persistent - String aUserData = GetUserData(); - aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); - - // Input-BrushItem besorgen und auswerten - const SvxBrushItem* pBgdAttr = NULL; - USHORT nSlot = SID_VIEW_FLD_PIC; - USHORT nWhich = GetWhich( nSlot ); - SvxBrushItem* pTemp = 0; - const CntWallpaperItem* pItem = 0; - - if ( rSet.GetItemState( nWhich, FALSE ) >= SFX_ITEM_AVAILABLE ) - { - pItem = (const CntWallpaperItem*)&rSet.Get( nWhich ); - pTemp = new SvxBrushItem( *pItem, nWhich ); - pBgdAttr = pTemp; - } - - aBtnTile.Check(); - - if ( pBgdAttr ) - { - FillControls_Impl(*pBgdAttr, aUserData); - // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben - if( aBgdColor != pBgdAttr->GetColor() ) - { - aBgdColor = pBgdAttr->GetColor(); - USHORT nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor ); - aBackgroundColorSet.SelectItem( nCol ); - pPreviewWin1->NotifyChange( aBgdColor ); - } - } - else - { - aLbSelect.SelectEntryPos( 0 ); - ShowColorUI_Impl(); - - const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC ); - if ( pOld ) - aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() ); - } - - // We now have always a link to the background - bLinkOnly = TRUE; - aBtnLink.Check( TRUE ); - aBtnLink.Show( FALSE ); -// if( !pItem || !pItem->GetWallpaper(FALSE).IsBitmap() ) -// aBtnLink.Check(); - - delete pTemp; -} - - - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::FillUserData() - -/* [Beschreibung] - - Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen, - damit die TabPage interne Informationen sichern kann. - - In diesem Fall wird der Zustand des Vorschau-Buttons gesichert. -*/ - -{ - SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) ); -} - -//------------------------------------------------------------------------ - -BOOL SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet ) - -/* [Beschreibung] - -*/ - -{ - if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() ) - { - pPageImpl->pLoadTimer->Stop(); - LoadTimerHdl_Impl( pPageImpl->pLoadTimer ); - } -// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, -// es muss aber im rSet vorhanden sein! - -// const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) - if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), FALSE)) - return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC ); - - BOOL bModified = FALSE; - USHORT nSlot = SID_ATTR_BRUSH; - - if ( aTblLBox.IsVisible() ) - { - switch( aTblLBox.GetSelectEntryPos() ) - { - case TBL_DEST_CELL: - nSlot = SID_ATTR_BRUSH; - break; - case TBL_DEST_ROW: - nSlot = SID_ATTR_BRUSH_ROW; - break; - case TBL_DEST_TBL: - nSlot = SID_ATTR_BRUSH_TABLE; - break; - } - } - else if(aParaLBox.GetData() == &aParaLBox) - { - switch(aParaLBox.GetSelectEntryPos()) - { - case PARA_DEST_PARA: - nSlot = SID_ATTR_BRUSH; - break; - case PARA_DEST_CHAR: - nSlot = SID_ATTR_BRUSH_CHAR; - break; - } - } - USHORT nWhich = GetWhich( nSlot ); - - const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); - SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, FALSE); - const SfxItemSet& rOldSet = GetItemSet(); - - BOOL bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue()); - if ( pOld ) - { - const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld; - SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); - const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); - - // transparency has to be set if enabled, the color not already set to "No fill" and - if( bColTransparency && - aBgdColor.GetTransparency() < 0xff) - { - aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(aColTransMF.GetValue()))); - } - if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) - || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? - { - // Hintergrund-Art wurde nicht gewechselt: - - if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) - { - // Brush-Behandlung: - if ( rOldItem.GetColor() != aBgdColor || - (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection())) - { - bModified = TRUE; - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) - rCoreSet.ClearItem( nWhich ); - } - else - { - // Bitmap-Behandlung: - - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - const BOOL bIsLink = aBtnLink.IsChecked(); - const BOOL bWasLink = (NULL != rOldItem.GetGraphicLink() ); - - - if ( !bIsLink && !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bGraphTransparencyChanged || - eNewPos != eOldPos - || bIsLink != bWasLink - || ( bWasLink && *rOldItem.GetGraphicLink() - != aBgdGraphicPath ) - || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap() - != aBgdGraphic.GetBitmap() ) - ) - { - bModified = TRUE; - - SvxBrushItem aTmpBrush(nWhich); - if ( bIsLink ) - { - aTmpBrush = SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - eNewPos, - nWhich ); - } - else - aTmpBrush = SvxBrushItem( aBgdGraphic, - eNewPos, - nWhich ); - lcl_SetTransparency(aTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); - - rCoreSet.Put(aTmpBrush); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) - rCoreSet.ClearItem( nWhich ); - } - } - else // Brush <-> Bitmap gewechselt! - { - if ( bIsBrush ) - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - else - { - SvxBrushItem* pTmpBrush = 0; - if ( aBtnLink.IsChecked() ) - { - pTmpBrush = new SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - GetGraphicPosition_Impl(), - nWhich ); - } - else - { - if ( !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bIsGraphicValid ) - pTmpBrush = new SvxBrushItem( aBgdGraphic, - GetGraphicPosition_Impl(), - nWhich ); - } - if(pTmpBrush) - { - lcl_SetTransparency(*pTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); - rCoreSet.Put(*pTmpBrush); - delete pTmpBrush; - } - } - bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid ); - } - } - else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) ) - { - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - bModified = TRUE; - } - - if( aTblLBox.IsVisible() ) - { - // Der aktuelle Zustand wurde bereits geputtet - if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush) - { - const SfxPoolItem* pOldCell = - GetOldItem( rCoreSet, SID_ATTR_BRUSH ); - - if ( *pTableBck_Impl->pCellBrush != *pOldCell ) - { - rCoreSet.Put( *pTableBck_Impl->pCellBrush ); - bModified |= TRUE; - } - } - - if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush) - { - const SfxPoolItem* pOldRow = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW ); - - if ( *pTableBck_Impl->pRowBrush != *pOldRow ) - { - rCoreSet.Put( *pTableBck_Impl->pRowBrush ); - bModified |= TRUE; - } - } - - if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush) - { - const SfxPoolItem* pOldTable = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE ); - - if ( *pTableBck_Impl->pTableBrush != *pOldTable ) - { - rCoreSet.Put( *pTableBck_Impl->pTableBrush ); - bModified |= TRUE; - } - } - - if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() ) - { - rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, - aTblLBox.GetSelectEntryPos() ) ); - bModified |= TRUE; - } - } - else if(aParaLBox.GetData() == &aParaLBox) - { - // Der aktuelle Zustand wurde bereits geputtet - if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog - { - const SfxPoolItem* pOldPara = - GetOldItem( rCoreSet, SID_ATTR_BRUSH ); - - if ( *pParaBck_Impl->pParaBrush != *pOldPara ) - { - rCoreSet.Put( *pParaBck_Impl->pParaBrush ); - bModified |= TRUE; - } - } - - if( nSlot != SID_ATTR_BRUSH_CHAR ) - { - const SfxPoolItem* pOldChar = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR ); - DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?"); - if ( pOldChar && - //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown - pParaBck_Impl && - (*pParaBck_Impl->pCharBrush != *pOldChar || - *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) - { - rCoreSet.Put( *pParaBck_Impl->pCharBrush ); - bModified |= TRUE; - } - } - - if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() ) - { - rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, - aParaLBox.GetSelectEntryPos() ) ); - bModified |= TRUE; - } - } - return bModified; -} - -BOOL SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, USHORT nSlot) -{ - USHORT nWhich = GetWhich( nSlot ); - const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); - const SfxItemSet& rOldSet = GetItemSet(); - DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found"); - - SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich ); - SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); - const BOOL bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); - BOOL bModified = FALSE; - - if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) - || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? - { - // Hintergrund-Art wurde nicht gewechselt: - - if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) - { - // Brush-Behandlung: - if ( rOldItem.GetColor() != aBgdColor ) - { - bModified = TRUE; - CntWallpaperItem aItem( nWhich ); - aItem.SetColor( aBgdColor ); - rCoreSet.Put( aItem ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) - rCoreSet.ClearItem( nWhich ); - } - else - { - // Bitmap-Behandlung: - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - - int bBitmapChanged = ( ( eNewPos != eOldPos ) || - ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) ); - int bBrushChanged = ( rOldItem.GetColor() != aBgdColor ); - if( bBitmapChanged || bBrushChanged ) - { - bModified = TRUE; - - CntWallpaperItem aItem( nWhich ); - WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos); - aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) ); - aItem.SetColor( aBgdColor ); - aItem.SetBitmapURL( aBgdGraphicPath ); - rCoreSet.Put( aItem ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, FALSE ) ) - rCoreSet.ClearItem( nWhich ); - } - } - else // Brush <-> Bitmap gewechselt! - { - CntWallpaperItem aItem( nWhich ); - if ( bIsBrush ) - { - aItem.SetColor( aBgdColor ); - rCoreSet.Put( aItem ); - } - else - { - WallpaperStyle eWallStyle = - SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() ); - aItem.SetStyle( sal::static_int_cast< USHORT >( eWallStyle ) ); - aItem.SetColor( aBgdColor ); - aItem.SetBitmapURL( aBgdGraphicPath ); - rCoreSet.Put( aItem ); - } - - bModified = TRUE; - } - return bModified; -} - -//----------------------------------------------------------------------- - -int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet ) - -/* [Beschreibung] - - virtuelle Methode, wird beim Deaktivieren gerufen -*/ - -{ - if ( pPageImpl->bIsImportDlgInExecute ) - return KEEP_PAGE; - - if ( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT ) - -/* [Beschreibung] - -*/ - -{ - // muss implementiert werden, damit Position-Control funktioniert -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::ShowSelector() - -/* [Beschreibung] - -*/ - -{ - if( bAllowShowSelector) - { - aSelectTxt.Show(); - aLbSelect.Show(); - aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) ); - aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) ); - aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) ); - aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) ); - aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) ); - aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) ); - aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) ); - - // Verz"ogertes Laden "uber Timer (wg. UI-Update) - pPageImpl->pLoadTimer = new Timer; - pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern - pPageImpl->pLoadTimer->SetTimeoutHdl( - LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) ); - - bAllowShowSelector = FALSE; - - if(nHtmlMode & HTMLMODE_ON) - { - if(!(nHtmlMode & HTMLMODE_GRAPH_POS)) - aBtnPosition.Enable(FALSE); - aBtnArea.Enable(FALSE); - } - } -} - -//------------------------------------------------------------------------ - - -void SvxBackgroundTabPage::RaiseLoadError_Impl() - -/* [Beschreibung] - -*/ - -{ - SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, - String(), - this, - RID_SVXERRCTX, - &DIALOG_MGR() ); - - ErrorHandler::HandleError( - *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE, - aBgdGraphicPath ) ); -} - -//------------------------------------------------------------------------ - -BOOL SvxBackgroundTabPage::LoadLinkedGraphic_Impl() - -/* [Beschreibung] - -*/ - -{ - BOOL bResult = ( aBgdGraphicPath.Len() > 0 ) && - ( GRFILTER_OK == LoadGraphic( aBgdGraphicPath, - aBgdGraphicFilter, - aBgdGraphic ) ); - return bResult; -} - -//------------------------------------------------------------------------ - - -void SvxBackgroundTabPage::FillColorValueSets_Impl() - -/* [Beschreibung] - - F"ullen des Farb-Sets -*/ - -{ - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = NULL; - XColorTable* pColorTable = NULL; - const Size aSize15x15 = Size( 15, 15 ); - FASTBOOL bOwn = FALSE; - - if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - - if ( !pColorTable ) - { - bOwn = TRUE; - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - } - - if ( pColorTable ) - { - short i = 0; - long nCount = pColorTable->Count(); - XColorEntry* pEntry = NULL; - Color aColWhite( COL_WHITE ); - String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) ); - WinBits nBits = ( aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD ); - aBackgroundColorSet.SetText( String( SVX_RES( RID_SVXSTR_TRANSPARENT ) ) ); - aBackgroundColorSet.SetStyle( nBits ); - for ( i = 0; i < nCount; i++ ) - { - pEntry = pColorTable->GetColor(i); - aBackgroundColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); - } - - while ( i < 80 ) - { - aBackgroundColorSet.InsertItem( i + 1, aColWhite, aStrWhite ); - i++; - } - - if ( nCount > 80 ) - { - aBackgroundColorSet.SetStyle( nBits | WB_VSCROLL ); - } - } - - if ( bOwn ) - delete pColorTable; - - aBackgroundColorSet.SetColCount( 10 ); - aBackgroundColorSet.SetLineCount( 10 ); - aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 ); - -} - -//------------------------------------------------------------------------ - - - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::ShowColorUI_Impl() - -/* [Beschreibung] - - Die Controls f"ur das Einstellen der Grafik ausblenden und die - Controls f"ur die Farbeinstellung einblenden. -*/ - -{ - if( !aBackgroundColorSet.IsVisible() ) - { - aBackgroundColorSet.Show(); - aBackgroundColorBox.Show(); - aBorderWin.Show(); - pPreviewWin1->Show(); - aBtnBrowse.Hide(); - aFtFile.Hide(); - aBtnLink.Hide(); - aBtnPreview.Hide(); - aGbFile.Hide(); - aBtnPosition.Hide(); - aBtnArea.Hide(); - aBtnTile.Hide(); - aWndPosition.Hide(); - aGbPosition.Hide(); - pPreviewWin2->Hide(); - aGraphTransFL.Show(FALSE); - aGraphTransMF.Show(FALSE); - if(bColTransparency) - { - aColTransFT.Show(); - aColTransMF.Show(); - } - } -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::ShowBitmapUI_Impl() - -/* [Beschreibung] - - Die Controls f"ur die Farbeinstellung ausblenden und die - Controls f"ur das Einstellen der Grafik einblenden. -*/ - -{ - if ( aLbSelect.IsVisible() && - ( - aBackgroundColorSet.IsVisible() - || !aBtnBrowse.IsVisible() ) ) - { - aBackgroundColorSet.Hide(); - aBackgroundColorBox.Hide(); - aBorderWin.Hide(); - pPreviewWin1->Hide(); - aBtnBrowse.Show(); - aFtFile.Show(); - - if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON ) - aBtnLink.Show(); - aBtnPreview.Show(); - aGbFile.Show(); - aBtnPosition.Show(); - aBtnArea.Show(); - aBtnTile.Show(); - aWndPosition.Show(); - aGbPosition.Show(); - pPreviewWin2->Show(); - if(bGraphTransparency) - { - aGraphTransFL.Show(); - aGraphTransMF.Show(); - } - aColTransFT.Show(FALSE); - aColTransMF.Show(FALSE); - } -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos ) - -/* [Beschreibung] - - Die Controls f"ur die Grafikposition einstellen. -*/ - -{ - switch ( ePos ) - { - case GPOS_AREA: - { - aBtnArea.Check(); - aWndPosition.Disable(); - } - break; - - case GPOS_TILED: - { - aBtnTile.Check(); - aWndPosition.Disable(); - } - break; - - default: - { - aBtnPosition.Check(); - aWndPosition.Enable(); - RECT_POINT eNewPos = RP_MM; - - switch ( ePos ) - { - case GPOS_MM: break; - case GPOS_LT: eNewPos = RP_LT; break; - case GPOS_MT: eNewPos = RP_MT; break; - case GPOS_RT: eNewPos = RP_RT; break; - case GPOS_LM: eNewPos = RP_LM; break; - case GPOS_RM: eNewPos = RP_RM; break; - case GPOS_LB: eNewPos = RP_LB; break; - case GPOS_MB: eNewPos = RP_MB; break; - case GPOS_RB: eNewPos = RP_RB; break; - default: ;//prevent warning - } - aWndPosition.SetActualRP( eNewPos ); - } - break; - } - aWndPosition.Invalidate(); -} - -//------------------------------------------------------------------------ - -SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl() - -/* [Beschreibung] - - Die Position der Grafik zur"uckgeben. -*/ - -{ - if ( aBtnTile.IsChecked() ) - return GPOS_TILED; - else if ( aBtnArea.IsChecked() ) - return GPOS_AREA; - else - { - switch ( aWndPosition.GetActualRP() ) - { - case RP_LT: return GPOS_LT; - case RP_MT: return GPOS_MT; - case RP_RT: return GPOS_RT; - case RP_LM: return GPOS_LM; - case RP_MM: return GPOS_MM; - case RP_RM: return GPOS_RM; - case RP_LB: return GPOS_LB; - case RP_MB: return GPOS_MB; - case RP_RB: return GPOS_RB; - } - } - return GPOS_MM; -} - -//----------------------------------------------------------------------- -// Handler -//----------------------------------------------------------------------- - -IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG ) -/* - Handler, called when color selection is changed -*/ -{ - USHORT nItemId = aBackgroundColorSet.GetSelectItemId(); - Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT ); - aBgdColor = aColor; - pPreviewWin1->NotifyChange( aBgdColor ); - BOOL bEnableTransp = aBgdColor.GetTransparency() < 0xff; - aColTransFT.Enable(bEnableTransp); - aColTransMF.Enable(bEnableTransp); - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG ) - -/* [Beschreibung] - -*/ - -{ - if ( 0 == aLbSelect.GetSelectEntryPos() ) - { - ShowColorUI_Impl(); - aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein - } - else - { - ShowBitmapUI_Impl(); - aParaLBox.Enable(FALSE);// Zeichenhintergrund kann keine Bitmap sein - } - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox ) - -/* [Beschreibung] - -*/ - -{ |