diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:52:45 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:52:45 +0100 |
commit | 2e626373db2412ac22e8c5c27a60d11cd29e875b (patch) | |
tree | 9e9f67205cd5b72f1031721273e1534a3a1e5b0f /cui/source/dialogs | |
parent | f7ee7bbd5174b084f018c2ec94d8c70c98ee04da (diff) |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'cui/source/dialogs')
95 files changed, 0 insertions, 31370 deletions
diff --git a/cui/source/dialogs/SpellAttrib.cxx b/cui/source/dialogs/SpellAttrib.cxx deleted file mode 100644 index 34dd071e5..000000000 --- a/cui/source/dialogs/SpellAttrib.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <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; - - -//----------------------------------------------------------------------- -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rDesc ) -{ -} - - -//----------------------------------------------------------------------- -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription ) -{ -} - -//----------------------------------------------------------------------- -SpellErrorAttrib::~SpellErrorAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellErrorAttrib::SetFont( Font& ) const -{ - //this attribute doesn't have a visual effect -} - -//----------------------------------------------------------------------- -TextAttrib* SpellErrorAttrib::Clone() const -{ - return new SpellErrorAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription; -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(eLang) -{ -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(rAttr.m_eLanguage) -{ -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::~SpellLanguageAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellLanguageAttrib::SetFont( Font& ) const -{ - //no visual effect -} - -//----------------------------------------------------------------------- -TextAttrib* SpellLanguageAttrib::Clone() const -{ - return new SpellLanguageAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage; -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rCol) -{ -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rAttr.m_aBackgroundColor) -{ -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::~SpellBackgroundAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellBackgroundAttrib::SetFont( Font& rFont ) const -{ - rFont.SetFillColor(m_aBackgroundColor); -} - -//----------------------------------------------------------------------- -TextAttrib* SpellBackgroundAttrib::Clone() const -{ - return new SpellBackgroundAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx deleted file mode 100644 index 04a9bfbe0..000000000 --- a/cui/source/dialogs/SpellAttrib.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _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> - -#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; - } -}; - -//------------------------------------------------- -class SpellErrorAttrib : public TextAttrib -{ -public: - -private: - SpellErrorDescription m_aSpellErrorDescription; - - //not accessible - SpellErrorAttrib(); -public: - 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; -}; - -//------------------------------------------------- -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; -}; - -//------------------------------------------------- -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 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx deleted file mode 100644 index 85fb0c5cb..000000000 --- a/cui/source/dialogs/SpellDialog.cxx +++ /dev/null @@ -1,2091 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include <tools/ref.hxx> -#include <tools/shl.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/menu.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/scrbar.hxx> -#include <SpellAttrib.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/bindings.hxx> -#include <svl/undo.hxx> -#include <unotools/lingucfg.hxx> -#include <svtools/textdata.hxx> -#include <svtools/filter.hxx> -#include <editeng/unolingu.hxx> -#include <editeng/splwrap.hxx> -#include <linguistic/lngprops.hxx> -#include <linguistic/misc.hxx> -#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 <cuires.hrc> -#include <helpid.hrc> -#include "SpellDialog.hrc" -#include <editeng/optitems.hxx> -#include <editeng/svxenum.hxx> -#include <svx/SpellDialogChildWindow.hxx> -#include "SpellDialog.hxx" -#include <svx/dlgutil.hxx> -#include "optlingu.hxx" -#include <dialmgr.hxx> -#include <svx/svxerr.hxx> -#include "treeopt.hxx" -#include <svtools/langtab.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; - -using ::rtl::OUString; - -#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) -// struct SpellDialog_Impl --------------------------------------------- - -struct SpellDialog_Impl -{ - Sequence< Reference< XDictionary > > aDics; -}; -// ----------------------------------------------------------------------- - -#define SPELLUNDO_START 200 - -#define SPELLUNDO_CHANGE_LANGUAGE (SPELLUNDO_START + 1) -#define SPELLUNDO_CHANGE_TEXTENGINE (SPELLUNDO_START + 2) -#define SPELLUNDO_CHANGE_NEXTERROR (SPELLUNDO_START + 3) -#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (SPELLUNDO_START + 4) -#define SPELLUNDO_CHANGE_GROUP (SPELLUNDO_START + 5) //undo list -#define SPELLUNDO_MOVE_ERROREND (SPELLUNDO_START + 6) -#define SPELLUNDO_UNDO_EDIT_MODE (SPELLUNDO_START + 7) -#define SPELLUNDO_ADD_IGNORE_RULE (SPELLUNDO_START + 8) - -namespace svx{ -class SpellUndoAction_Impl : public SfxUndoAction -{ - sal_uInt16 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(sal_uInt16 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 sal_uInt16 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; - -//----------------------------------------------------------------------- -SpellUndoAction_Impl::~SpellUndoAction_Impl() -{ -} - -//----------------------------------------------------------------------- -void SpellUndoAction_Impl::Undo() -{ - m_rActionLink.Call(this); -} - -//----------------------------------------------------------------------- -sal_uInt16 SpellUndoAction_Impl::GetId()const -{ - return m_nId; -} - -// class SvxSpellCheckDialog --------------------------------------------- - -SpellDialog::SpellDialog( - SpellDialogChildWindow* pChildWindow, - Window * pParent, - SfxBindings* _pBindings) - : SfxModelessDialog (_pBindings, - pChildWindow, - pParent, - CUI_RES(RID_SVXDLG_SPELLCHECK)), - - aVendorImageFI ( this , CUI_RES( IMG_VENDOR ) ), - aLanguageFT ( this, CUI_RES( FT_LANGUAGE ) ), - aLanguageLB ( this, CUI_RES( LB_LANGUAGE ) ), - aNotInDictFT ( this, CUI_RES( FT_NOTINDICT ) ), - aSentenceED ( this, CUI_RES( ED_NEWWORD ) ), - aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ), - aSuggestionLB ( this, CUI_RES( LB_SUGGESTION ) ), - - aIgnorePB ( this, CUI_RES( PB_IGNORE ) ), - aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ), - aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ), - aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ), - - aChangePB ( this, CUI_RES( PB_CHANGE ) ), - aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ), - aExplainPB ( this, CUI_RES( PB_EXPLAIN) ), - aAutoCorrPB ( this, CUI_RES( PB_AUTOCORR ) ), - - aCheckGrammarCB ( this, CUI_RES( CB_CHECK_GRAMMAR ) ), - - aHelpPB ( this, CUI_RES( PB_HELP ) ), - aOptionsPB ( this, CUI_RES( PB_OPTIONS ) ), - aUndoPB ( this, CUI_RES( PB_UNDO ) ), - aClosePB ( this, CUI_RES( PB_CLOSE ) ), - aBackgroundGB ( this, CUI_RES( GB_BACKGROUND ) ), - - aVendorImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), - - aResumeST ( CUI_RES(ST_RESUME )), - aIgnoreOnceST ( aIgnorePB.GetText()), - aNoSuggestionsST( CUI_RES(ST_NOSUGGESTIONS)), - m_sTitleSpelling ( CUI_RES( ST_SPELLING ) ), - m_sTitleSpellingGrammar ( CUI_RES( ST_SPELLING_AND_GRAMMAR ) ), - m_sTitleSpellingGrammarVendor ( CUI_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, sal_False, sal_False, sal_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; - Sequence< ::rtl::OUString > aNewWords; - bool bIsGrammarError = false; - if( pSpellErrorDescription ) - { - nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale ); - 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 ); - - 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, bool bIgnoreCurrentError ) -{ - //initially or after the last error of a sentence MarkNextError will fail - //then GetNextSentence() has to be called followed again by MarkNextError() - //MarkNextError is not initally called if the UndoEdit mode is active - bool bNextSentence = false; - if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) || - true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false ))) - { - 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(sal_False); - } - } -} -/* 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(sal_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().HasVendorImages( "SpellAndGrammarDialogImage" ) ) - { - 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 ); - } - 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(); - } - 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(); - 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(); - return 1; -} - -//----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, UndoHdl, Button*, EMPTYARG ) -{ - aSentenceED.Undo(); - if(!aSentenceED.GetUndoActionCount()) - aUndoPB.Enable(sal_False); - return 0; -} - -//----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction ) -{ - switch(pAction->GetId()) - { - case SPELLUNDO_CHANGE_TEXTENGINE: - { - if(pAction->IsEnableChangePB()) - aChangePB.Enable(sal_False); - if(pAction->IsEnableChangeAllPB()) - aChangeAllPB.Enable(sal_False); - } - break; - case SPELLUNDO_CHANGE_NEXTERROR: - { - aSentenceED.MoveErrorMarkTo((sal_uInt16)pAction->GetOldErrorStart(), (sal_uInt16)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, - // since the users choice now was to ignore the error - aSentenceED.RestoreCurrentError(); - - // the word is being ignored - SpellContinue_Impl( false, true ); - } - 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 -{ - sal_Int16 nLang = aLanguageLB.GetSelectLanguage(); - return nLang; -} - -//------------------------------------------------- -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 ); -} - -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 == GraphicFilter::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() ) - { - ::rtl::OUString sSuggestionImageUrl = - SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName ); - aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) ); - uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY ); - if( xDisplayName.is() ) - sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale ); - } - else - { - aVendorImageFI.SetImage( aVendorImage ); - } - - if( sVendor.Len() ) - { - sTitle = m_sTitleSpellingGrammarVendor; - sTitle.SearchAndReplaceAscii( "$VendorName", sVendor ); - } - else - { - sTitle = m_sTitleSpellingGrammar; - } - } - sTitle.SearchAndReplaceAscii( "$LANGUAGE ($LOCATION)", SvtLanguageTable::GetLanguageString(nLang) ); - SetText( sTitle ); -} - -void SpellDialog::InitUserDicts() -{ - const LanguageType 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(); - } - - SvtLinguConfig aCfg; - - // list suitable dictionaries - bool bEnable = false; - const sal_Int32 nSize = pImpl->aDics.getLength(); - pDic = pImpl->aDics.getConstArray(); - delete aAddToDictMB.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); - sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0 - for (sal_Int32 i = 0; i < nSize; ++i) - { - uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); - if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp) - continue; - - uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY ); - LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() ); - if( xDicTmp->isActive() - && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE - && (nLang == nActLanguage || LANGUAGE_NONE == nActLanguage ) - && (!xStor.is() || !xStor->isReadonly()) ) - { - pMenu->InsertItem( nItemId, xDicTmp->getName() ); - bEnable = sal_True; - - uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); - if (xSvcInfo.is()) - { - OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( - xSvcInfo->getImplementationName()) ); - if (aDictionaryImageUrl.getLength() > 0) - { - Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); - pMenu->SetItemImage( nItemId, aImage ); - } - } - - ++nItemId; - } - } - aAddToDictMB.SetPopupMenu(pMenu); - aAddToDictMB.Enable( bEnable ); -} - -//----------------------------------------------------------------------- -IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - - //GetErrorText() returns the current error even if the text is already - //manually changed - const String aNewWord= aSentenceED.GetErrorText(); - - sal_uInt16 nItemId = pButton->GetCurItemId(); - PopupMenu *pMenu = pButton->GetPopupMenu(); - String aDicName ( pMenu->GetItemText( nItemId ) ); - - uno::Reference< linguistic2::XDictionary > xDic; - uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - xDic = xDicList->getDictionaryByName( aDicName ); - - sal_Int16 nAddRes = DIC_ERR_UNKNOWN; - if (xDic.is()) - { - nAddRes = linguistic::AddEntryToDic( xDic, aNewWord, sal_False, OUString(), LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (nAddRes == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary( xDic ); - pAction->SetAddedWord( aNewWord ); - aSentenceED.AddUndoAction( pAction ); - } - // failed because there is already an entry? - if (DIC_ERR_NONE != nAddRes && xDic->getEntry( aNewWord ).is()) - nAddRes = DIC_ERR_NONE; - } - if (DIC_ERR_NONE != nAddRes) - { - SvxDicError( this, nAddRes ); - return 0; // Nicht weitermachen - } - - // go on - SpellContinue_Impl(); - aSentenceED.UndoActionEnd(); - 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 and ignored text parts first - if there are any - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), 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); -} - -//----------------------------------------------------------------------- -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); -} - -//------------------------------------------------- -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(sal_False); - i++; - } - SfxModelessDialog::Deactivate(); -} - -//----------------------------------------------------------------------- -bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) -{ - bool bRet = false; - if(!bUseSavedSentence) - { - //apply changes and ignored text parts - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck); - } - aSentenceED.ResetIgnoreErrorsAt(); - aSentenceED.ResetModified(); - SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck ); - 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, bRecheck); - aSentence = rParent.GetNextWrongSentence( bRecheck ); - } - 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, (sal_uInt16) nStartPosition, (sal_uInt16) 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, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - } - if(aStart->bIsField) - aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (sal_uInt16) nStartPosition, (sal_uInt16) 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(sal_False); - bRet = nStartPosition > 0; - } - return bRet; -} -/*------------------------------------------------------------------------- - 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; -} - -//----------------------------------------------------------------------- -SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) : - MultiLineEdit( pParent, rResId ), - m_nErrorStart(0), - m_nErrorEnd(0), - m_bIsUndoEditMode(false) -{ - DisableSelectionOnFocus(); -} - -//----------------------------------------------------------------------- -SentenceEditWindow_Impl::~SentenceEditWindow_Impl() -{ -} -/*------------------------------------------------------------------------- - 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 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; - ++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; - 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 - sal_uInt16 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 = NULL; - sal_uInt16 nStart = pErrorAttrLeft->GetStart(); - sal_uInt16 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 - sal_uInt16 nAddedChars = GetText().Len() - nCurrentLen; - - TextAttrib* pNewError = NULL; - sal_uInt16 nStart = pErrorAttr->GetStart(); - sal_uInt16 nEnd = pErrorAttr->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pErrorAttr ); - nStart = nStart - (sal_uInt16)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 = NULL; - sal_uInt16 _nStart = pBackAttrLeft->GetStart(); - sal_uInt16 _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 = NULL; - 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; -} - -//----------------------------------------------------------------------- -bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError ) -{ - if (bIgnoreCurrentError) - m_aIgnoreErrorsAt.insert( m_nErrorStart ); - ExtTextEngine* pTextEngine = GetTextEngine(); - sal_uInt16 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 sal_uInt16 nOldErrorStart = m_nErrorStart; - const sal_uInt16 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; - - 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() + (sal_uInt16)(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; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_uInt16 nStart, sal_uInt16 nEnd, bool bGrammarError) -{ - TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTCOLOR, sal_True ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT, sal_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; -} - -//----------------------------------------------------------------------- -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(); - const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); - DBG_ASSERT(pErrorAttrib, "no error attribute found"); - 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 ); - sal_uInt16 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, (sal_uInt16)(m_nErrorEnd + nDiffLen) , nTextLen ); - } - } - // undo expanded attributes! - if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen) - { - TextAttrib* pNewBackground = NULL; - sal_uInt16 nStart = pBackAttrib->GetStart(); - pTextEngine->RemoveAttrib(0, *pBackAttrib); - pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart); - delete pNewBackground; - } - pTextEngine->SetModified(sal_True); - - //adjust end position - long nEndTemp = m_nErrorEnd; - nEndTemp += nDiffLen; - m_nErrorEnd = (sal_uInt16)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(); -} - -//------------------------------------------------- -String SentenceEditWindow_Impl::GetErrorText() const -{ - return GetTextEngine()->GetText(TextSelection(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd) )); -} - -//----------------------------------------------------------------------- -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; -} - -//----------------------------------------------------------------------- -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 )); - } -} - -//----------------------------------------------------------------------- -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 ); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ) -{ - GetTextEngine()->SetAttrib(rAttr, nPara, nStart, nEnd); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetText( const String& rStr ) -{ - m_nErrorStart = m_nErrorEnd = 0; - GetTextEngine()->SetText(rStr); -} - -//----------------------------------------------------------------------- -struct LanguagePosition_Impl -{ - sal_uInt16 nPosition; - LanguageType eLanguage; - - LanguagePosition_Impl(sal_uInt16 nPos, LanguageType eLang) : - nPosition(nPos), - eLanguage(eLang) - {} -}; -typedef std::vector<LanguagePosition_Impl> LanguagePositions_Impl; - -void lcl_InsertBreakPosition_Impl( - LanguagePositions_Impl& rBreakPositions, sal_uInt16 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)); -} -/*------------------------------------------------------------------------- - 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 sal_uInt16 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; - sal_uInt16 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))); - bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end(); - if( bSetIgnoreFlag && bIsIgnoreError ) - { - 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... - sal_uLong nPara = pTextEngine->GetParagraphCount(); - if (nPara > 1) - { - String aLeftOverText; - for (sal_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; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::Undo() -{ - ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - DBG_ASSERT(GetUndoActionCount(), "no undo actions available" ); - if(!GetUndoActionCount()) - return; - bool bSaveUndoEdit = IsUndoEditMode(); - sal_uInt16 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(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::ResetUndo() -{ - GetTextEngine()->ResetUndo(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg ) -{ - ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - rUndoMgr.AddUndoAction(pAction, bTryMerg); - GetSpellDialog()->aUndoPB.Enable(); -} - -//----------------------------------------------------------------------- -sal_uInt16 SentenceEditWindow_Impl::GetUndoActionCount() -{ - return GetTextEngine()->GetUndoManager().GetUndoActionCount(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::UndoActionStart( sal_uInt16 nId ) -{ - GetTextEngine()->UndoActionStart(nId); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::UndoActionEnd() -{ - GetTextEngine()->UndoActionEnd(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset) -{ - if(nOffset > 0) - m_nErrorEnd = m_nErrorEnd - (sal_uInt16)nOffset; - else - m_nErrorEnd = m_nErrorEnd -(sal_uInt16)- nOffset; -} - -//----------------------------------------------------------------------- -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, (sal_uInt16)TEXTATTR_FONTCOLOR, sal_True ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT, sal_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(); -} - -//----------------------------------------------------------------------- -ExplainButton::~ExplainButton() -{ -} - -//----------------------------------------------------------------------- -void ExplainButton::RequestHelp( const HelpEvent& ) -{ - Help::ShowBalloon( this, GetPosPixel(), m_sExplanation ); -} - -void ExplainButton::Click() -{ - RequestHelp( HelpEvent() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc deleted file mode 100644 index d51ec1e82..000000000 --- a/cui/source/dialogs/SpellDialog.hrc +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#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 PB_IGNORERULE 59 diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src deleted file mode 100644 index 663b156b4..000000000 --- a/cui/source/dialogs/SpellDialog.src +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include <cuires.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 - { - HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK: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 - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK: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 - { - HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION"; - Pos = MAP_APPFONT( 6, 99 ); - Size = MAP_APPFONT( 197, 48 ); - Border = TRUE; - }; - - CheckBox CB_CHECK_GRAMMAR - { - HelpID = "cui:CheckBox:RID_SVXDLG_SPELLCHECK:CB_CHECK_GRAMMAR"; - Pos = MAP_APPFONT( 6, 153 ); - Size = MAP_APPFONT( 100, 10 ); - Text [ en-US ] = "Check ~grammar" ; - Hide = TRUE; - }; - - PushButton PB_IGNORE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORE"; - Pos = MAP_APPFONT( 209, 37 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore Once" ; - }; - - PushButton PB_IGNOREALL - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNOREALL"; - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore All" ; - }; - PushButton PB_IGNORERULE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE"; - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore Rule" ; - Hide = TRUE; - }; - MenuButton MB_ADDTODICT - { - HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; - Pos = MAP_APPFONT( 209, 71 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Add" ; - }; - - PushButton PB_CHANGE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE"; - Pos = MAP_APPFONT( 209, 99 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Change" ; - DefButton = TRUE ; - }; - - PushButton PB_CHANGEALL - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGEALL"; - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Change A~ll" ; - }; - PushButton PB_EXPLAIN - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_EXPLAIN"; - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE; - Text [ en-US ] = "~Explain..." ; - }; - PushButton PB_AUTOCORR - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK: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 - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_OPTIONS"; - Pos = MAP_APPFONT( 87, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "O~ptions..." ; - }; - PushButton PB_UNDO - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_UNDO"; - Pos = MAP_APPFONT( 148, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Undo" ; - }; - - PushButton PB_CLOSE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK: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"; }; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx deleted file mode 100644 index 0b478a708..000000000 --- a/cui/source/dialogs/about.cxx +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> - -#include <tools/stream.hxx> -#include <tools/urlobj.hxx> -#include <rtl/bootstrap.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/bootstrap.hxx> -#include <com/sun/star/uno/Any.h> -#include <unotools/configmgr.hxx> -#include <vcl/svapp.hxx> -#include <vcl/graph.hxx> -#include <svtools/filter.hxx> - -#include "com/sun/star/system/SystemShellExecuteFlags.hpp" -#include "com/sun/star/system/XSystemShellExecute.hpp" -#include <comphelper/processfactory.hxx> -#include "comphelper/anytostring.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "cppuhelper/bootstrap.hxx" - -#include <sfx2/sfxuno.hxx> -#include <sfx2/sfxcommands.h> -#include "about.hxx" -#include "about.hrc" -#include <sfx2/sfxdefs.hxx> -#include <sfx2/app.hxx> -#include <rtl/ustrbuf.hxx> - -using namespace ::com::sun::star; - -// defines --------------------------------------------------------------- - -#define SCROLL_OFFSET 1 -#define SPACE_OFFSET 5 -#define SCROLL_TIMER 30 - -/** loads the application logo as used in the about dialog and impress slideshow pause screen */ -Image SfxApplication::GetApplicationLogo() -{ - BitmapEx aBitmap; - Application::LoadBrandBitmap ("about", aBitmap); - return Image( aBitmap ); -} - -/* get good version information */ -static String -GetBuildId() -{ - rtl::OUString sDefault; - rtl::OUString sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); - if (!sBuildId.isEmpty() && sBuildId.getLength() > 50) - { - rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t")); - sal_Int32 nIndex = 0; - do - { - rtl::OUString aToken = sBuildId.getToken( 0, '-', nIndex ); - if (!aToken.isEmpty()) - { - aBuffer.append(aToken); - if (nIndex >= 0) - { - if (nIndex % 5) - aBuffer.append(static_cast<sal_Unicode>('-')); - else - aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t")); - } - } - } - while ( nIndex >= 0 ); - sBuildId = aBuffer.makeStringAndClear(); - } - - OSL_ENSURE( sBuildId.getLength() > 0, "No BUILDID in bootstrap file" ); - return sBuildId; -} - -AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : - - SfxModalDialog ( pParent, rId ), - - aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), - aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), - aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), - aInfoLink ( this, ResId( ABOUT_FTXT_LINK, *rId.GetResMgr() ) ), - aVersionTextStr(ResId(ABOUT_STR_VERSION, *rId.GetResMgr())), - m_aVendorTextStr(ResId(ABOUT_STR_VENDOR, *rId.GetResMgr())), - m_aOracleCopyrightTextStr(ResId(ABOUT_STR_COPYRIGHT_ORACLE_DERIVED, *rId.GetResMgr())), - m_aAcknowledgementTextStr(ResId(ABOUT_STR_ACKNOWLEDGEMENT, *rId.GetResMgr())), - m_aLinkStr(ResId( ABOUT_STR_LINK, *rId.GetResMgr())), - m_sBuildStr(ResId(ABOUT_STR_BUILD, *rId.GetResMgr())) -{ - rtl::OUString sProduct; - utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - - // load image from module path - aAppLogo = SfxApplication::GetApplicationLogo(); - - // Transparent Font - Font aFont = GetFont(); - aFont.SetTransparent( sal_True ); - SetFont( aFont ); - - // if necessary more info - String sVersion = aVersionTextStr; - sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); - sVersion += '\n'; - sVersion += m_sBuildStr; - sVersion += ' '; - sVersion += GetBuildId(); -#ifdef BUILD_VER_STRING - String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); - sVersion += '\n'; - sVersion += aBuildString; -#endif - aVersionText.SetText( sVersion ); - - // set for background and text the correct system color - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - Color aWhiteCol( rSettings.GetWindowColor() ); - Wallpaper aWall( aWhiteCol ); - SetBackground( aWall ); - Font aNewFont( aCopyrightText.GetFont() ); - aNewFont.SetTransparent( sal_True ); - - aVersionText.SetFont( aNewFont ); - aCopyrightText.SetFont( aNewFont ); - - aVersionText.SetBackground(); - aCopyrightText.SetBackground(); - aInfoLink.SetURL(m_aLinkStr); - aInfoLink.SetBackground(); - aInfoLink.SetClickHdl( LINK( this, AboutDialog, HandleHyperlink ) ); - - Color aTextColor( rSettings.GetWindowTextColor() ); - aVersionText.SetControlForeground( aTextColor ); - aCopyrightText.SetControlForeground( aTextColor ); - - rtl::OUStringBuffer sText(m_aVendorTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sal_uInt32 nCopyrightId = sProduct.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("LibreOffice" )) ? - ABOUT_STR_COPYRIGHT : ABOUT_STR_COPYRIGHT_DERIVED; - String aProductCopyrightTextStr(ResId(nCopyrightId, *rId.GetResMgr())); - sText.append(aProductCopyrightTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sText.append(m_aOracleCopyrightTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sText.append(m_aAcknowledgementTextStr); - aCopyrightText.SetText(sText.makeStringAndClear()); - - // determine size and position of the dialog & elements - Size aAppLogoSiz = aAppLogo.GetSizePixel(); - - // analyze size of the aVersionText widget - // character size - Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - // preferred Version widget size - long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); - long nDlgMargin = a6Size.Width() * 2; - long nCtrlMargin = a6Size.Height() * 2; - - aVersionText.SetSizePixel(Size(800, 600)); - Size aVersionTextSize = aVersionText.CalcMinimumSize(); - aVersionTextSize.Width() += nDlgMargin; - - Size aOutSiz = GetOutputSizePixel(); - aOutSiz.Width() = aAppLogoSiz.Width(); - - if (aOutSiz.Width() < aVersionTextSize.Width()) - aOutSiz.Width() = aVersionTextSize.Width(); - - if (aOutSiz.Width() < 300) - aOutSiz.Width() = 300; - - //round up to nearest even - aOutSiz.Width() += aOutSiz.Width() & 1; - - long nTextWidth = (aOutSiz.Width() - nDlgMargin); - - // finally set the aVersionText widget position and size - Size aVTSize = aVersionText.GetSizePixel(); - aVTSize.Width() = nTextWidth; - aVersionText.SetSizePixel(aVTSize); - aVTSize = aVersionText.CalcMinimumSize(); - Point aVTPnt; - aVTPnt.X() = ( aOutSiz.Width() - aVTSize.Width() ) / 2; - aVTPnt.Y() = nY; - aVersionText.SetPosSizePixel( aVTPnt, aVTSize ); - - nY += aVTSize.Height() + nCtrlMargin; - - // Multiline edit with Copyright-Text - // preferred Version widget size - aCopyrightText.SetSizePixel(Size(nTextWidth,600)); - Size aCTSize = aCopyrightText.CalcMinimumSize(); - aCTSize.Width()= nTextWidth; - Point aCTPnt; - aCTPnt.X() = ( aOutSiz.Width() - aCTSize.Width() ) / 2; - aCTPnt.Y() = nY; - aCopyrightText.SetPosSizePixel( aCTPnt, aCTSize ); - - nY += aCTSize.Height() + nCtrlMargin; - - // FixedHyperlink with more info link - Size aLTSize = aInfoLink.CalcMinimumSize(); - Point aLTPnt; - aLTPnt.X() = ( aOutSiz.Width() - aLTSize.Width() ) / 2; - aLTPnt.Y() = nY; - aInfoLink.SetPosSizePixel( aLTPnt, aLTSize ); - - nY += aLTSize.Height() + nCtrlMargin; - - // OK-Button-Position (at the bottom and centered) - Size aOKSiz = aOKButton.GetSizePixel(); - Point aOKPnt; - aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; - aOKPnt.Y() = nY; - aOKButton.SetPosPixel( aOKPnt ); - - nY += aOKSiz.Height() + nCtrlMargin; - - aOutSiz.Height() = nY; - - // Change the size of the dialog - SetOutputSizePixel( aOutSiz ); - - FreeResource(); - - // explicit Help-Id - SetHelpId( CMD_SID_ABOUT ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) -{ - rtl::OUString sURL=pHyperlink->GetURL(); - rtl::OUString sTitle=GetText(); - - if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty - return 1; - try - { - uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); - } - catch ( uno::Exception& ) - { - uno::Any exc( ::cppu::getCaughtException() ); - rtl::OUString msg( ::comphelper::anyToString( exc ) ); - const SolarMutexGuard guard; - ErrorBox aErrorBox( NULL, WB_OK, msg ); - aErrorBox.SetText( sTitle ); - aErrorBox.Execute(); - } - - return 1; -} - -void AboutDialog::Paint( const Rectangle& rRect ) -{ - SetClipRegion( rRect ); - Point aPos( 0, 0 ); - DrawImage( aPos, aAppLogo ); -} - -sal_Bool AboutDialog::Close() -{ - EndDialog( RET_OK ); - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/about.hrc b/cui/source/dialogs/about.hrc deleted file mode 100644 index 37c04993b..000000000 --- a/cui/source/dialogs/about.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/sfx.hrc> - -#define ABOUT_BTN_OK 1 -#define ABOUT_FTXT_VERSION 2 -#define ABOUT_FTXT_COPYRIGHT 3 -#define ABOUT_FTXT_LINK 4 -#define ABOUT_STR_BUILD 5 -#define ABOUT_STR_VERSION 6 -#define ABOUT_STR_VENDOR 7 -#define ABOUT_STR_COPYRIGHT 8 -#define ABOUT_STR_COPYRIGHT_DERIVED 9 -#define ABOUT_STR_COPYRIGHT_ORACLE_DERIVED 10 -#define ABOUT_STR_ACKNOWLEDGEMENT 11 -#define ABOUT_STR_LINK 12 diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src deleted file mode 100644 index 9cf835a4d..000000000 --- a/cui/source/dialogs/about.src +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "about.hrc" - -ModalDialog RID_DEFAULTABOUT -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 280 ) ; - Moveable = TRUE ; - SVLook = TRUE ; - OKButton ABOUT_BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 174 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - MultiLineEdit ABOUT_FTXT_VERSION - { - Border = FALSE ; - Pos = MAP_APPFONT ( 54 , 6 ) ; - Size = MAP_APPFONT ( 118 , 16 ) ; - IgnoreTab = TRUE ; - ReadOnly = TRUE ; - AutoVScroll = TRUE ; - }; - MultiLineEdit ABOUT_FTXT_COPYRIGHT - { - Border = FALSE ; - Pos = MAP_APPFONT ( 54 , 25 ) ; - Size = MAP_APPFONT ( 168 , 71 ) ; - IgnoreTab = TRUE ; - ReadOnly = TRUE ; - AutoVScroll = TRUE ; - LEFT = FALSE ; - CENTER = TRUE ; - RIGHT = FALSE ; - }; - FixedText ABOUT_FTXT_LINK - { - NoLabel = TRUE; - TabStop = TRUE; - Text [ en-US ] = "Contributor credits"; - Pos = MAP_APPFONT ( 54 , 100 ) ; - Size = MAP_APPFONT ( 168 , 10 ) ; - }; - String ABOUT_STR_VERSION - { - Text[ en-US ] = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION"; - }; - String ABOUT_STR_VENDOR - { - Text[ en-US ] = "This product was supplied by %OOOVENDOR."; - }; - String ABOUT_STR_COPYRIGHT - { - Text[ en-US ] = "LibreOffice is copyright © 2000, 2011 LibreOffice contributors and/or their affiliates. All rights reserved."; - }; - String ABOUT_STR_COPYRIGHT_DERIVED - { - Text[ en-US ] = "%PRODUCTNAME is derived from LibreOffice. LibreOffice is copyright © 2000, 2011 LibreOffice contributors and/or their affiliates. All rights reserved."; - }; - String ABOUT_STR_COPYRIGHT_ORACLE_DERIVED - { - Text[ en-US ] = "LibreOffice is derived from OpenOffice.org. OpenOffice.org is copyright © 2000, 2011 Oracle and/or its affiliates. All rights reserved."; - }; - String ABOUT_STR_ACKNOWLEDGEMENT - { - Text[ en-US ] = "%OOOVENDOR acknowledges all community members, please find more info at the link below:"; - }; - String ABOUT_STR_LINK - { - Text[ en-US ] = "http://www.libreoffice.org/credits.html"; - }; - String ABOUT_STR_BUILD - { - Text[ en-US ] = "Build ID:"; - }; -}; diff --git a/cui/source/dialogs/charmap.hrc b/cui/source/dialogs/charmap.hrc deleted file mode 100644 index 644ea47b3..000000000 --- a/cui/source/dialogs/charmap.hrc +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CHARMAP_HRC -#define _SVX_CHARMAP_HRC - -// defines ------------------------------------------------------------------ - -#define CT_SHOWSET 10 -#define FT_FONT 11 -#define LB_FONT 12 -#define CT_SHOWTEXT 13 -#define FT_SYMBOLE 14 -#define CT_SHOWCHAR 15 -#define FT_CHARCODE 16 -#define BTN_CHAR_OK 17 -#define BTN_CHAR_CANCEL 18 -#define BTN_CHAR_HELP 19 -#define BTN_DELETE 20 -#define FT_SUBSET 30 -#define LB_SUBSET 31 -#define ED_SHORTCUT 32 -#define BT_ASSIGN 33 -#define FT_ASSIGN 34 -#define CT_ASSIGN 35 - -#endif - diff --git a/cui/source/dialogs/charmap.src b/cui/source/dialogs/charmap.src deleted file mode 100644 index c59c7381a..000000000 --- a/cui/source/dialogs/charmap.src +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- - -#include <cuires.hrc> -#include "charmap.hrc" -#include "helpid.hrc" -#include <svx/dialogs.hrc> // for RID_SVXDLG_CHARMAP - - // RID_SVXDLG_CHARMAP ---------------------------------------------------- -ModalDialog RID_SVXDLG_CHARMAP -{ - HelpId = CMD_SID_CHARMAP ; - SvLook = TRUE ; - Text [ en-US ] = "Special Characters"; - Size = MAP_APPFONT ( 297 , 153 ) ; - OutputSize = TRUE ; - Moveable = TRUE ; - Control CT_SHOWSET - { - HelpId = HID_CHARMAP_CTL_SHOWSET ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 230 , 112 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - FixedText FT_FONT - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 33 , 8 ) ; - Text [ en-US ] = "~Font" ; - Left = TRUE ; - Group = TRUE ; - }; - ListBox LB_FONT - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_FONT"; - Pos = MAP_APPFONT ( 42 , 6 ) ; - Size = MAP_APPFONT ( 70 , 58 ) ; - Sort = TRUE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SUBSET - { - Pos = MAP_APPFONT ( 118 , 8 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Subset"; - }; - ListBox LB_SUBSET - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_SUBSET"; - Pos = MAP_APPFONT ( 161 , 6 ) ; - Size = MAP_APPFONT ( 63 , 68 ) ; - Sort = FALSE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SYMBOLE - { - Pos = MAP_APPFONT ( 6 , 140 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Characters:"; - }; - Control CT_SHOWTEXT - { - HelpId = HID_CHARMAP_CTL_SHOWTEXT ; - Pos = MAP_APPFONT ( 46 , 137 ) ; - Size = MAP_APPFONT ( 244 , 16 ) ; - Group = TRUE ; - }; - Control CT_SHOWCHAR - { - HelpId = HID_CHARMAP_CTL_SHOWCHAR ; - Pos = MAP_APPFONT ( 241 , 79 ) ; - Size = MAP_APPFONT ( 50 , 44 ) ; - Group = TRUE ; - }; - FixedText FT_CHARCODE - { - Pos = MAP_APPFONT ( 241 , 126 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Center = TRUE ; - }; - OKButton BTN_CHAR_OK - { - Pos = MAP_APPFONT ( 242 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CHAR_CANCEL - { - Pos = MAP_APPFONT ( 242 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_CHAR_HELP - { - Pos = MAP_APPFONT ( 242 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXDLG_CHARMAP:BTN_DELETE"; - Pos = MAP_APPFONT ( 242 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete"; - }; -}; - -// ********************************************************************** EOF diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx deleted file mode 100644 index 3f3110de5..000000000 --- a/cui/source/dialogs/colorpicker.cxx +++ /dev/null @@ -1,1659 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka <cl@lippka.com> - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <com/sun/star/beans/XPropertyAccess.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/datatransfer/XTransferable.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> -#include <com/sun/star/awt/XWindow.hpp> - -#include <cppuhelper/compbase4.hxx> - -#include <comphelper/broadcasthelper.hxx> - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <vcl/field.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/decoview.hxx> -#include <vcl/sound.hxx> -#include <vcl/svapp.hxx> - -#include <toolkit/helper/vclunohelper.hxx> - -#include <sot/exchange.hxx> -#include <sot/formats.hxx> - -#include <sax/tools/converter.hxx> - -#include <basegfx/color/bcolortools.hxx> - -#include "dialmgr.hxx" -#include "colorpicker.hrc" - -#include <cmath> - -using rtl::OUString; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::beans; -using namespace ::basegfx; - -namespace cui -{ - -const sal_uInt16 COLORMODE_RGB = 0x10; -const sal_uInt16 COLORMODE_HSV = 0x20; -const sal_uInt16 COLORMODE_CMYK = 0x40; - -const sal_uInt16 COLORCOMP_RED = 0x10; -const sal_uInt16 COLORCOMP_GREEN = 0x11; -const sal_uInt16 COLORCOMP_BLUE = 0x12; - -const sal_uInt16 COLORCOMP_HUE = 0x20; -const sal_uInt16 COLORCOMP_SAT = 0x21; -const sal_uInt16 COLORCOMP_BRI = 0x22; - -const sal_uInt16 COLORCOMP_CYAN = 0x40; -const sal_uInt16 COLORCOMP_YELLOW = 0x41; -const sal_uInt16 COLORCOMP_MAGENTA = 0x42; -const sal_uInt16 COLORCOMP_KEY = 0x43; - -// color space conversion helpers - -static void RGBtoHSV( double dR, double dG, double dB, double& dH, double& dS, double& dV ) -{ - BColor result = tools::rgb2hsv( BColor( dR, dG, dB ) ); - - dH = result.getX(); - dS = result.getY(); - dV = result.getZ(); -} - -static void HSVtoRGB(double dH, double dS, double dV, double& dR, double& dG, double& dB ) -{ - BColor result = tools::hsv2rgb( BColor( dH, dS, dV ) ); - - dR = result.getRed(); - dG = result.getGreen(); - dB = result.getBlue(); -} - -// ----------------------------------------------------------------------- - -// CMYK values from 0 to 1 -static void CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey, double& dR, double& dG, double& dB ) -{ - fCyan = (fCyan * ( 1.0 - fKey )) + fKey; - fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey; - fYellow = (fYellow * ( 1.0 - fKey )) + fKey; - - dR = std::max( std::min( ( 1.0 - fCyan ), 1.0), 0.0 ); - dG = std::max( std::min( ( 1.0 - fMagenta ), 1.0), 0.0 ); - dB = std::max( std::min( ( 1.0 - fYellow ), 1.0), 0.0 ); -} - -// ----------------------------------------------------------------------- - -// CMY results from 0 to 1 -static void RGBtoCMYK( double dR, double dG, double dB, double& fCyan, double& fMagenta, double& fYellow, double& fKey ) -{ - fCyan = 1 - dR; - fMagenta = 1 - dG; - fYellow = 1 - dB; - - //CMYK and CMY values from 0 to 1 - fKey = 1.0; - if( fCyan < fKey ) fKey = fCyan; - if( fMagenta < fKey ) fKey = fMagenta; - if( fYellow < fKey ) fKey = fYellow; - - if( fKey >= 1.0 ) - { - //Black - fCyan = 0.0; - fMagenta = 0.0; - fYellow = 0.0; - } - else - { - fCyan = ( fCyan - fKey ) / ( 1.0 - fKey ); - fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey ); - fYellow = ( fYellow - fKey ) / ( 1.0 - fKey ); - } -} - -// ==================================================================== - -class HexColorControl : public Edit -{ -public: - HexColorControl( Window* pParent, const ResId& rResId ); - - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual void Paste(); - - void SetColor( sal_Int32 nColor ); - sal_Int32 GetColor(); - -private: - bool ImplProcessKeyInput( const KeyEvent& rKEv ); -}; - -HexColorControl::HexColorControl( Window* pParent, const ResId& rResId ) -: Edit( pParent, rResId ) -{ - SetMaxTextLen( 6 ); -} - -// ----------------------------------------------------------------------- - -void HexColorControl::SetColor( sal_Int32 nColor ) -{ - ::rtl::OUStringBuffer aBuffer; - sax::Converter::convertColor( aBuffer, nColor ); - SetText( aBuffer.makeStringAndClear().copy(1) ); -} - -// ----------------------------------------------------------------------- - -sal_Int32 HexColorControl::GetColor() -{ - sal_Int32 nColor = -1; - - OUString aStr( RTL_CONSTASCII_USTRINGPARAM( "#" ) ); - aStr += GetText(); - sal_Int32 nLen = aStr.getLength(); - if( nLen < 7 ) - { - static const sal_Char* pNullStr = "000000"; - aStr += OUString::createFromAscii( &pNullStr[nLen-1] ); - } - - sax::Converter::convertColor( nColor, aStr ); - - if( nColor == -1 ) - SetControlBackground( Color( COL_RED ) ); - else - SetControlBackground(); - - return nColor; -} - -// ----------------------------------------------------------------------- - -long HexColorControl::PreNotify( NotifyEvent& rNEvt ) -{ - if ( (rNEvt.GetType() == EVENT_KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) - { - if ( ImplProcessKeyInput( *rNEvt.GetKeyEvent() ) ) - return 1; - } - - return Edit::PreNotify( rNEvt ); -} - -// ----------------------------------------------------------------------- - -void HexColorControl::Paste() -{ - ::com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipboard(GetClipboard()); - if ( aClipboard.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj; - - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - - try - { - xDataObj = aClipboard->getContents(); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - - Application::AcquireSolarMutex( nRef ); - - if ( xDataObj.is() ) - { - ::com::sun::star::datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - try - { - ::com::sun::star::uno::Any aData = xDataObj->getTransferData( aFlavor ); - ::rtl::OUString aText; - aData >>= aText; - - if( aText.getLength() && aText.matchAsciiL( "#", 1, 0 ) ) - aText = aText.copy(1); - - if( aText.getLength() > 6 ) - aText = aText.copy( 0, 6 ); - - SetText( aText ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - } - } -} - -// ----------------------------------------------------------------------- - -bool HexColorControl::ImplProcessKeyInput( const KeyEvent& rKEv ) -{ - const KeyCode& rKeyCode = rKEv.GetKeyCode(); - - if( rKeyCode.GetGroup() == KEYGROUP_ALPHA && !rKeyCode.IsMod1() && !rKeyCode.IsMod2() ) - { - if( (rKeyCode.GetCode() < KEY_A) || (rKeyCode.GetCode() > KEY_F) ) - return true; - } - else if( rKeyCode.GetGroup() == KEYGROUP_NUM ) - { - if( rKeyCode.IsShift() ) - return true; - } - return false; -} - -// ==================================================================== - -class ColorPreviewControl : public Control -{ -public: - ColorPreviewControl( Window* pParent, const ResId& rResId ); - - virtual void Paint( const Rectangle& rRect ); - - void SetColor( const Color& rColor ); -private: - Color maColor; -}; - -// ----------------------------------------------------------------------- - -ColorPreviewControl::ColorPreviewControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - -// ----------------------------------------------------------------------- - -void ColorPreviewControl::SetColor( const Color& rCol ) -{ - if( rCol != maColor ) - { - maColor = rCol; - SetFillColor( maColor ); - SetLineColor( maColor ); - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void ColorPreviewControl::Paint( const Rectangle& rRect ) -{ - DrawRect( rRect ); -} - -// ==================================================================== - -enum ColorMode { HUE, SATURATION, BRIGHTNESS, RED, GREEN, BLUE }; -const ColorMode DefaultMode = HUE; - -class ColorFieldControl : public Control -{ -public: - ColorFieldControl( Window* pParent, const ResId& rResId ); - ~ColorFieldControl(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); - - void UpdateBitmap(); - void ShowPosition( const Point& rPos, bool bUpdate ); - void UpdatePosition(); - void Modify(); - - void SetValues( Color aColor, ColorMode eMode, double x, double y ); - double GetX(); - double GetY(); - - void KeyMove( int dx, int dy ); - - void SetModifyHdl( Link& rLink ) { maModifyHdl = rLink; } - -private: - Link maModifyHdl; - ColorMode meMode; - Color maColor; - double mdX; - double mdY; - Point maPosition; - Bitmap* mpBitmap; - std::vector< sal_uInt8 > maRGB_Horiz; - std::vector< sal_uInt16 > maGrad_Horiz; - std::vector< sal_uInt16 > maPercent_Horiz; - std::vector< sal_uInt8 > maRGB_Vert; - std::vector< sal_uInt16 > maPercent_Vert; - bool mbInit; -}; - -// ----------------------------------------------------------------------- - -ColorFieldControl::ColorFieldControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -, meMode( DefaultMode ) -, mdX( -1.0 ) -, mdY( -1.0 ) -, mpBitmap( 0 ) -, mbInit( false ) -{ - SetControlBackground(); -} - -// ----------------------------------------------------------------------- - -ColorFieldControl::~ColorFieldControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::UpdateBitmap() -{ - const Size aSize( GetOutputSizePixel() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - const sal_Int32 nWidth = aSize.Width(); - const sal_Int32 nHeight = aSize.Height(); - - if( !mpBitmap ) - { - mpBitmap = new Bitmap( aSize, 24 ); - - maRGB_Horiz.resize( nWidth ); - maGrad_Horiz.resize( nWidth ); - maPercent_Horiz.resize( nWidth ); - - sal_uInt8* pRGB = &(*maRGB_Horiz.begin()); - sal_uInt16* pGrad = &(*maGrad_Horiz.begin()); - sal_uInt16* pPercent = &(*maPercent_Horiz.begin()); - - for( sal_Int32 x = 0; x < nWidth; x++ ) - { - *pRGB++ = static_cast< sal_uInt8 >( (x * 256) / nWidth ); - *pGrad++ = static_cast< sal_uInt16 >( (x * 359) / nWidth ); - *pPercent++ = static_cast< sal_uInt16 >( (x * 100) / nWidth ); - } - - maRGB_Vert.resize( nHeight ); - maPercent_Vert.resize( nHeight ); - - pRGB = &(*maRGB_Vert.begin()); - pPercent = &(*maPercent_Vert.begin()); - - sal_Int32 y = nHeight; - while( y-- ) - { - *pRGB++ = static_cast< sal_uInt8 >( (y * 256) / nHeight ); - *pPercent++ = static_cast< sal_uInt16 >( (y * 100) / nHeight ); - } - } - - sal_uInt8* pRGB_Horiz = &(*maRGB_Horiz.begin()); - sal_uInt16* pGrad_Horiz = &(*maGrad_Horiz.begin()); - sal_uInt16* pPercent_Horiz = &(*maPercent_Horiz.begin()); - sal_uInt8* pRGB_Vert = &(*maRGB_Vert.begin()); - sal_uInt16* pPercent_Vert = &(*maPercent_Vert.begin()); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - if( pWriteAccess ) - { - BitmapColor aBitmapColor( maColor ); - - sal_uInt16 nHue, nSat, nBri; - maColor.RGBtoHSB( nHue, nSat, nBri ); - - // this has been unlooped for performance reason, please do not merge back! - - sal_uInt16 y = nHeight,x; - - switch( meMode ) - { - case HUE: - while( y-- ) - { - nBri = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nSat = pPercent_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case SATURATION: - while( y-- ) - { - nBri = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case BRIGHTNESS: - while( y-- ) - { - nSat = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case RED: - while( y-- ) - { - aBitmapColor.SetGreen( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetBlue( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - case GREEN: - while( y-- ) - { - aBitmapColor.SetRed( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetBlue( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - case BLUE: - while( y-- ) - { - aBitmapColor.SetGreen( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetRed( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate ) -{ - if( !mpBitmap ) - { - UpdateBitmap(); - Invalidate(); - } - - const Size aSize( mpBitmap->GetSizePixel() ); - - long nX = rPos.X(); - long nY = rPos.Y(); - if( nX < 0L ) - nX = 0L; - else if( nX >= aSize.Width() ) - nX = aSize.Width() - 1L; - - if( nY < 0L ) - nY= 0L; - else if( nY >= aSize.Height() ) - nY = aSize.Height() - 1L; - - Point aPos = maPosition; - maPosition.X() = nX - 5; - maPosition.Y() = nY - 5; - Invalidate( Rectangle( aPos, Size( 11, 11) ) ); - Invalidate( Rectangle( maPosition, Size( 11, 11) ) ); - - if( bUpdate ) - { - mdX = (double)nX / (double)(aSize.Width()-1); - mdY = (double)(aSize.Height()-1-nY) / (double)(aSize.Height()-1); - - BitmapReadAccess* pReadAccess = mpBitmap->AcquireReadAccess(); - if( pReadAccess != NULL ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = pReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( pReadAccess ); - pReadAccess = NULL; - } - } -} -// ----------------------------------------------------------------------- - -void ColorFieldControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ShowPosition( rMEvt.GetPosPixel(), true ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorFieldControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - CaptureMouse(); - ShowPosition( rMEvt.GetPosPixel(), true ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorFieldControl::MouseButtonUp( const MouseEvent& ) -{ - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::KeyMove( int dx, int dy ) -{ - Size aSize( GetOutputSizePixel() ); - Point aPos(static_cast<long>(mdX * aSize.Width()), static_cast<long>((1.0 - mdY) * aSize.Height())); - aPos.X() += dx; - aPos.Y() += dy; - if( aPos.X() < 0 ) - aPos.X() += aSize.Width(); - else if( aPos.X() >= aSize.Width() ) - aPos.X() -= aSize.Width(); - - if( aPos.Y() < 0 ) - aPos.Y() += aSize.Height(); - else if( aPos.Y() >= aSize.Height() ) - aPos.Y() -= aSize.Height(); - - ShowPosition( aPos, true ); - Modify(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::KeyInput( const KeyEvent& rKEvt ) -{ - bool bShift = rKEvt.GetKeyCode().IsShift(); - bool bCtrl = rKEvt.GetKeyCode().IsMod1(); - bool bAlt = rKEvt.GetKeyCode().IsMod2(); - - if ( !bAlt && !bShift ) - { - switch( rKEvt.GetKeyCode().GetCode() ) - { - case KEY_DOWN: KeyMove( 0, bCtrl ? 5 : 1 ); return; - case KEY_UP: KeyMove( 0, bCtrl ? -5 : -1 ); return; - case KEY_LEFT: KeyMove( bCtrl ? -5 : -1, 0 ); return; - case KEY_RIGHT: KeyMove( bCtrl ? 5 : 1, 0 ); return; - } - } - Control::KeyInput( rKEvt ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Paint( const Rectangle& rRect ) -{ - if( !mpBitmap ) - UpdateBitmap(); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - DrawBitmap( rRect.TopLeft(), rRect.GetSize(), rRect.TopLeft(), rRect.GetSize(), aOutputBitmap ); - - // draw circle around current color - if( maColor.IsDark() ) - SetLineColor( COL_WHITE ); - else - SetLineColor( COL_BLACK ); - - SetFillColor(); - - DrawEllipse( Rectangle( maPosition, Size( 11, 11) ) ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Resize() -{ - UpdateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y ) -{ - bool bUpdateBitmap = (maColor!= aColor) || (meMode != eMode); - if( bUpdateBitmap || (mdX != x) || (mdY != y) ) - { - maColor = aColor; - meMode = eMode; - mdX = x; - mdY = y; - - if( bUpdateBitmap ) - UpdateBitmap(); - UpdatePosition(); - if( bUpdateBitmap ) - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -double ColorFieldControl::GetX() -{ - return mdX; -} - -// ----------------------------------------------------------------------- - -double ColorFieldControl::GetY() -{ - return mdY; -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::UpdatePosition() -{ - Size aSize( GetOutputSizePixel() ); - ShowPosition( Point(static_cast<long>(mdX * aSize.Width()), static_cast<long>((1.0 - mdY) * aSize.Height())), false ); -} - -// ==================================================================== - -class ColorSliderControl : public Control -{ -public: - ColorSliderControl( Window* pParent, const ResId& rResId ); - ~ColorSliderControl(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); - - void UpdateBitmap(); - void ChangePosition( long nY ); - void Modify(); - - void SetValue( const Color& rColor, ColorMode eMode, double dValue ); - double GetValue() const { return mdValue; } - - void KeyMove( int dy ); - - void SetModifyHdl( Link& rLink ) { maModifyHdl = rLink; } - - sal_Int16 GetLevel() const { return mnLevel; } - -private: - Link maModifyHdl; - Color maColor; - ColorMode meMode; - Bitmap* mpBitmap; - sal_Int16 mnLevel; - double mdValue; -}; - -// ----------------------------------------------------------------------- - -ColorSliderControl::ColorSliderControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -, meMode( DefaultMode ) -, mpBitmap( 0 ) -, mnLevel( 0 ) -, mdValue( -1.0 ) -{ - SetControlBackground(); -} - -// ----------------------------------------------------------------------- - -ColorSliderControl::~ColorSliderControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::UpdateBitmap() -{ - Size aSize( 1, GetOutputSizePixel().Height() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - if( !mpBitmap ) - mpBitmap = new Bitmap( aSize, 24 ); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - - if( pWriteAccess ) - { - const long nY = aSize.Height()-1; - - BitmapColor aBitmapColor( maColor ); - - sal_uInt16 nHue, nSat, nBri; - maColor.RGBtoHSB( nHue, nSat, nBri ); - - // this has been unlooped for performance reason, please do not merge back! - - switch( meMode ) - { - case HUE: - nSat = 100; - nBri = 100; - for( long y = 0; y <= nY; y++ ) - { - nHue = static_cast< sal_uInt16 >( (359 * y) / nY ); - aBitmapColor = BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case SATURATION: - nBri = std::max( (sal_uInt16)32, nBri ); - for( long y = 0; y <= nY; y++ ) - { - nSat = static_cast< sal_uInt16 >( (100 * y) / nY ); - pWriteAccess->SetPixel( nY-y, 0, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - break; - - case BRIGHTNESS: - for( long y = 0; y <= nY; y++ ) - { - nBri = static_cast< sal_uInt16 >( (100 * y) / nY ); - pWriteAccess->SetPixel( nY-y, 0, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - break; - - case RED: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetRed( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case GREEN: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetGreen( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case BLUE: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetBlue( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::ChangePosition( long nY ) -{ - const long nHeight = GetOutputSizePixel().Height() - 1; - - if( nY < 0L ) - nY = 0; - else if( nY > nHeight ) - nY = nHeight; - - mnLevel = nY; - mdValue = ((double)(nHeight - nY)) / (double)nHeight; -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ChangePosition( rMEvt.GetPosPixel().Y() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorSliderControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - CaptureMouse(); - ChangePosition( rMEvt.GetPosPixel().Y() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorSliderControl::MouseButtonUp( const MouseEvent& ) -{ - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::KeyMove( int dy ) -{ - ChangePosition( mnLevel + dy ); - Modify(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::KeyInput( const KeyEvent& rKEvt ) -{ - if ( !rKEvt.GetKeyCode().IsMod2() && !rKEvt.GetKeyCode().IsShift() ) - { - switch( rKEvt.GetKeyCode().GetCode() ) - { - case KEY_DOWN: KeyMove( rKEvt.GetKeyCode().IsMod1() ? 5 : 1 ); return; - case KEY_UP: KeyMove( rKEvt.GetKeyCode().IsMod1() ? -5 : -1 ); return; - } - } - - Control::KeyInput( rKEvt ); -} -// ----------------------------------------------------------------------- - -void ColorSliderControl::Paint( const Rectangle& /*rRect*/ ) -{ - if( !mpBitmap ) - UpdateBitmap(); - - const Size aSize( GetOutputSizePixel() ); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - Point aPos; - int x = aSize.Width(); - while( x-- ) - { - DrawBitmap( aPos, aOutputBitmap ); - aPos.X() += 1; - } -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::Resize() -{ - UpdateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::SetValue( const Color& rColor, ColorMode eMode, double dValue ) -{ - bool bUpdateBitmap = (rColor != maColor) || (eMode != meMode); - if( bUpdateBitmap || (mdValue != dValue)) - { - maColor = rColor; - mdValue = dValue; - mnLevel = static_cast<sal_Int16>((1.0-dValue) * GetOutputSizePixel().Height()); - meMode = eMode; - if( bUpdateBitmap ) - UpdateBitmap(); - Invalidate(); - } -} - -// ==================================================================== - -const sal_uInt16 UPDATE_RGB = 0x01; -const sal_uInt16 UPDATE_CMYK = 0x02; -const sal_uInt16 UPDATE_HSB = 0x04; -const sal_uInt16 UPDATE_COLORCHOOSER = 0x08; -const sal_uInt16 UPDATE_COLORSLIDER = 0x10; -const sal_uInt16 UPDATE_HEX = 0x20; -const sal_uInt16 UPDATE_ALL = 0xff; - -class ColorPickerDialog : public ModalDialog -{ -public: - ColorPickerDialog( Window* pParent, sal_Int32 nColor, sal_Int16 nMode ); - - void update_color( sal_uInt16 n = UPDATE_ALL ); - - DECL_LINK( ColorModifyHdl, void * ); - DECL_LINK( ModeModifyHdl, void * ); - - sal_Int32 GetColor() const; - - void setColorComponent( sal_uInt16 nComp, double dValue ); - -private: - Color maPreviousColor; - sal_Int16 mnDialogMode; - ColorMode meMode; - - double mdRed, mdGreen, mdBlue; - double mdHue, mdSat, mdBri; - double mdCyan, mdMagenta, mdYellow, mdKey; - -private: - ColorFieldControl maColorField; - ColorSliderControl maColorSlider; - ColorPreviewControl maColorPreview; - ColorPreviewControl maColorPrevious; - - FixedImage maFISliderLeft; - FixedImage maFISliderRight; - Image maSliderImage; - -#if 0 - ImageButton maBtnPicker; -#endif - - FixedLine maFLRGB; - - RadioButton maRBRed; - RadioButton maRBGreen; - RadioButton maRBBlue; - RadioButton maRBHue; - RadioButton maRBSaturation; - RadioButton maRBBrightness; - - FixedText maFTRed; - MetricField maMFRed; - FixedText maFTGreen; - MetricField maMFGreen; - FixedText maFTBlue; - MetricField maMFBlue; - FixedText maFTHex; - HexColorControl maEDHex; - - FixedLine maFLHSB; - FixedText maFTHue; - MetricField maMFHue; - FixedText maFTSaturation; - MetricField maMFSaturation; - FixedText maFTBrightness; - MetricField maMFBrightness; - - FixedLine maFLCMYK; - FixedText maFTCyan; - MetricField maMFCyan; - FixedText maFTMagenta; - MetricField maMFMagenta; - FixedText maFTYellow; - MetricField maMFYellow; - FixedText maFTKey; - MetricField maMFKey; - - FixedLine maFLBottmLine; - HelpButton maBTNHelp; - OKButton maBTNOk; - CancelButton maBTNCancel; -}; - -// -------------------------------------------------------------------- - -ColorPickerDialog::ColorPickerDialog( Window* pParent, sal_Int32 nColor, sal_Int16 nMode ) -: ModalDialog( pParent, CUI_RES( RID_CUI_DIALOG_COLORPICKER ) ) -, maPreviousColor( nColor ) -, mnDialogMode( nMode ) -, meMode( DefaultMode ) -, maColorField( this, CUI_RES( CT_COLORFIELD ) ) -, maColorSlider( this, CUI_RES( CT_COLORSLIDER ) ) -, maColorPreview( this, CUI_RES( CT_PREVIEW ) ) -, maColorPrevious( this, CUI_RES( CT_PREVIOUS ) ) -, maFISliderLeft( this, CUI_RES( CT_LEFT_SLIDER ) ) -, maFISliderRight( this, CUI_RES( CT_RIGHT_SLIDER ) ) -, maSliderImage( CUI_RES( CT_SLIDERIMG ) ) -#if 0 -, maBtnPicker( this, CUI_RES( PB_PICKER ) ) -#endif -, maFLRGB( this, CUI_RES( FL_RGB ) ) -, maRBRed( this, CUI_RES( CT_RED ) ) -, maRBGreen( this, CUI_RES( CT_GREEN ) ) -, maRBBlue( this, CUI_RES( CT_BLUE ) ) -, maRBHue( this, CUI_RES( CT_HUE ) ) -, maRBSaturation( this, CUI_RES( CT_SATURATION ) ) -, maRBBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maFTRed( this, CUI_RES( CT_RED ) ) -, maMFRed( this, CUI_RES( CT_RED ) ) -, maFTGreen( this, CUI_RES( CT_GREEN ) ) -, maMFGreen( this, CUI_RES( CT_GREEN ) ) -, maFTBlue( this, CUI_RES( CT_BLUE ) ) -, maMFBlue( this, CUI_RES( CT_BLUE ) ) -, maFTHex( this, CUI_RES( CT_HEX ) ) -, maEDHex( this, CUI_RES( CT_HEX ) ) -, maFLHSB( this, CUI_RES( FL_HSB ) ) -, maFTHue( this, CUI_RES( CT_HUE ) ) -, maMFHue( this, CUI_RES( CT_HUE ) ) -, maFTSaturation( this, CUI_RES( CT_SATURATION ) ) -, maMFSaturation( this, CUI_RES( CT_SATURATION ) ) -, maFTBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maMFBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maFLCMYK( this, CUI_RES( FL_CMYK ) ) -, maFTCyan( this, CUI_RES( CT_CYAN ) ) -, maMFCyan( this, CUI_RES( CT_CYAN ) ) -, maFTMagenta( this, CUI_RES( CT_MAGENTA ) ) -, maMFMagenta( this, CUI_RES( CT_MAGENTA ) ) -, maFTYellow( this, CUI_RES( CT_YELLOW ) ) -, maMFYellow( this, CUI_RES( CT_YELLOW ) ) -, maFTKey( this, CUI_RES( CT_KEY ) ) -, maMFKey( this, CUI_RES( CT_KEY ) ) - -, maFLBottmLine( this, CUI_RES( FT_BOTTOMLINE ) ) -, maBTNHelp( this, CUI_RES( BTN_HELP ) ) -, maBTNOk( this, CUI_RES( BTN_OK ) ) -, maBTNCancel( this, CUI_RES( BTN_CANCEL ) ) -{ - FreeResource(); - - String sUnitText; - sUnitText.Append( ' ' ); - sUnitText.Append( (sal_Unicode) 0xb0 ); - - maMFHue.SetCustomUnitText( sUnitText ); - - Link aLink( LINK( this, ColorPickerDialog, ColorModifyHdl ) ); - maColorField.SetModifyHdl( aLink ); - maColorSlider.SetModifyHdl( aLink ); - - maMFRed.SetModifyHdl( aLink ); - maMFGreen.SetModifyHdl( aLink ); - maMFBlue.SetModifyHdl( aLink ); - - maMFCyan.SetModifyHdl( aLink ); - maMFMagenta.SetModifyHdl( aLink ); - maMFYellow.SetModifyHdl( aLink ); - maMFKey.SetModifyHdl( aLink ); - - maMFHue.SetModifyHdl( aLink ); - maMFSaturation.SetModifyHdl( aLink ); - maMFBrightness.SetModifyHdl( aLink ); - - maEDHex.SetModifyHdl( aLink ); - - aLink = LINK( this, ColorPickerDialog, ModeModifyHdl ); - maRBRed.SetToggleHdl( aLink ); - maRBGreen.SetToggleHdl( aLink ); - maRBBlue.SetToggleHdl( aLink ); - maRBHue.SetToggleHdl( aLink ); - maRBSaturation.SetToggleHdl( aLink ); - maRBBrightness.SetToggleHdl( aLink ); - - Image aSliderImage( maSliderImage ); - - maFISliderLeft.SetImage( aSliderImage ); - - BitmapEx aTmpBmp( maSliderImage.GetBitmapEx() ); - aTmpBmp.Mirror( BMP_MIRROR_HORZ ); - maFISliderRight.SetImage( Image( aTmpBmp ) ); - - Size aSize( maSliderImage.GetSizePixel() ); - maFISliderLeft.SetSizePixel( aSize ); - maFISliderRight.SetSizePixel( aSize ); - - Point aPos( maColorSlider.GetPosPixel() ); - - aPos.X() -= aSize.Width(); - aPos.Y() -= aSize.Height() / 2; - maFISliderLeft.SetPosPixel( aPos ); - - aPos.X() += aSize.Width() + maColorSlider.GetSizePixel().Width(); - maFISliderRight.SetPosPixel( aPos ); - - Color aColor( nColor ); - - // modify - if( mnDialogMode == 2 ) - { - maColorPreview.SetSizePixel( maColorPrevious.GetSizePixel() ); - maColorPrevious.SetColor( aColor ); - maColorPrevious.Show( true ); - } - - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetGreen()) / 255.0; - mdBlue = ((double)aColor.GetBlue()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - - update_color(); -} - -// -------------------------------------------------------------------- - -static int toInt( double dValue, double dRange ) -{ - return static_cast< int >( std::floor((dValue * dRange) + 0.5 ) ); -} - -sal_Int32 ColorPickerDialog::GetColor() const -{ - return Color( toInt(mdRed,255.0), toInt(mdGreen,255.0), toInt(mdBlue,255.0) ).GetColor(); -} - -void ColorPickerDialog::update_color( sal_uInt16 n ) -{ - sal_uInt8 nRed = toInt(mdRed,255.0); - sal_uInt8 nGreen = toInt(mdGreen,255.0); - sal_uInt8 nBlue = toInt(mdBlue,255.0); - - Color aColor( nRed, nGreen, nBlue ); - - if( n & UPDATE_RGB ) // update RGB - { - maMFRed.SetValue( nRed ); - maMFGreen.SetValue( nGreen ); - maMFBlue.SetValue( nBlue ); - } - - if( n & UPDATE_CMYK ) // update CMYK - { - maMFCyan.SetValue( toInt( mdCyan, 100.0 ) ); - maMFMagenta.SetValue( toInt( mdMagenta, 100.0 ) ); - maMFYellow.SetValue( toInt( mdYellow, 100.0 ) ); - maMFKey.SetValue( toInt( mdKey, 100.0 ) ); - } - - if( n & UPDATE_HSB ) // update HSB - { - maMFHue.SetValue( toInt( mdHue, 1.0 ) ); - maMFSaturation.SetValue( toInt( mdSat, 100.0 ) ); - maMFBrightness.SetValue( toInt( mdBri, 100.0 ) ); - } - - if( n & UPDATE_COLORCHOOSER ) // update Color Chooser 1 - { - switch( meMode ) - { - case HUE: maColorField.SetValues( aColor, meMode, mdSat, mdBri ); break; - case SATURATION: maColorField.SetValues( aColor, meMode, mdHue / 360.0, mdBri ); break; - case BRIGHTNESS: maColorField.SetValues( aColor, meMode, mdHue / 360.0, mdSat ); break; - case RED: maColorField.SetValues( aColor, meMode, mdBlue, mdGreen ); break; - case GREEN: maColorField.SetValues( aColor, meMode, mdBlue, mdRed ); break; - case BLUE: maColorField.SetValues( aColor, meMode, mdRed, mdGreen ); break; - } - } - - if( n & UPDATE_COLORSLIDER ) // update Color Chooser 2 - { - switch( meMode ) - { - case HUE: maColorSlider.SetValue( aColor, meMode, mdHue / 360.0 ); break; - case SATURATION: maColorSlider.SetValue( aColor, meMode, mdSat ); break; - case BRIGHTNESS: maColorSlider.SetValue( aColor, meMode, mdBri ); break; - case RED: maColorSlider.SetValue( aColor, meMode, mdRed ); break; - case GREEN: maColorSlider.SetValue( aColor, meMode, mdGreen ); break; - case BLUE: maColorSlider.SetValue( aColor, meMode, mdBlue ); break; - } - } - - if( n & UPDATE_HEX ) // update hex - { - maEDHex.SetColor( aColor.GetColor() ); - } - - { - Point aPos( 0, maColorSlider.GetLevel() + maColorSlider.GetPosPixel().Y() - 1 ); - - aPos.X() = maFISliderLeft.GetPosPixel().X(); - if( aPos != maFISliderLeft.GetPosPixel() ) - { - maFISliderLeft.SetPosPixel( aPos ); - - aPos.X() = maFISliderRight.GetPosPixel().X(); - maFISliderRight.SetPosPixel( aPos ); - } - } - - maColorPreview.SetColor( aColor ); -} - -// -------------------------------------------------------------------- - -IMPL_LINK( ColorPickerDialog, ColorModifyHdl, void *, p ) -{ - sal_uInt16 n = 0; - - if( p == &maColorField ) - { - double x = maColorField.GetX(); - double y = maColorField.GetY(); - - switch( meMode ) - { - case HUE: mdSat = x; setColorComponent( COLORCOMP_BRI, y ); break; - case SATURATION: mdHue = x * 360.0; setColorComponent( COLORCOMP_BRI, y ); break; - case BRIGHTNESS: mdHue = x * 360.0; setColorComponent( COLORCOMP_SAT, y ); break; - case RED: mdBlue = x; setColorComponent( COLORCOMP_GREEN, y ); break; - case GREEN: mdBlue = x; setColorComponent( COLORCOMP_RED, y ); break; - case BLUE: mdRed = x; setColorComponent( COLORCOMP_GREEN, y ); break; - } - - n = UPDATE_ALL&~(UPDATE_COLORCHOOSER); - } - else if( p == &maColorSlider ) - { - double dValue = maColorSlider.GetValue(); - switch( meMode ) - { - case HUE: setColorComponent( COLORCOMP_HUE, dValue * 360.0 ); break; - case SATURATION: setColorComponent( COLORCOMP_SAT, dValue ); break; - case BRIGHTNESS: setColorComponent( COLORCOMP_BRI, dValue ); break; - case RED: setColorComponent( COLORCOMP_RED, dValue ); break; - case GREEN: setColorComponent( COLORCOMP_GREEN, dValue ); break; - case BLUE: setColorComponent( COLORCOMP_BLUE, dValue ); break; - } - - n = UPDATE_ALL&~(UPDATE_COLORSLIDER); - } - else if( p == &maMFRed ) - { - setColorComponent( COLORCOMP_RED, ((double)maMFRed.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFGreen ) - { - setColorComponent( COLORCOMP_GREEN, ((double)maMFGreen.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFBlue ) - { - setColorComponent( COLORCOMP_BLUE, ((double)maMFBlue.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFHue ) - { - setColorComponent( COLORCOMP_HUE, (double)maMFHue.GetValue() ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFSaturation ) - { - setColorComponent( COLORCOMP_SAT, ((double)maMFSaturation.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFBrightness ) - { - setColorComponent( COLORCOMP_BRI, ((double)maMFBrightness.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFCyan ) - { - setColorComponent( COLORCOMP_CYAN, ((double)maMFCyan.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFMagenta ) - { - setColorComponent( COLORCOMP_MAGENTA, ((double)maMFMagenta.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFYellow ) - { - setColorComponent( COLORCOMP_YELLOW, ((double)maMFYellow.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFKey ) - { - setColorComponent( COLORCOMP_KEY, ((double)maMFKey.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maEDHex ) - { - sal_Int32 nColor = maEDHex.GetColor(); - - if( nColor != -1 ) - { - Color aColor( nColor ); - - if( aColor != GetColor() ) - { - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetRed()) / 255.0; - mdBlue = ((double)aColor.GetRed()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - n = UPDATE_ALL&~(UPDATE_HEX); - } - } - } - - if( n ) - update_color( n ); - - return 0; -} - -// -------------------------------------------------------------------- - -IMPL_LINK( ColorPickerDialog, ModeModifyHdl, void *, EMPTYARG ) -{ - ColorMode eMode = HUE; - - if( maRBRed.IsChecked() ) - { - eMode = RED; - } - else if( maRBGreen.IsChecked() ) - { - eMode = GREEN; - } - else if( maRBBlue.IsChecked() ) - { - eMode = BLUE; - } - else if( maRBSaturation.IsChecked() ) - { - eMode = SATURATION; - } - else if( maRBBrightness.IsChecked() ) - { - eMode = BRIGHTNESS; - } - - if( meMode != eMode ) - { - meMode = eMode; - update_color( UPDATE_COLORCHOOSER | UPDATE_COLORSLIDER ); - } - - return 0; -} - -// -------------------------------------------------------------------- - -void ColorPickerDialog::setColorComponent( sal_uInt16 nComp, double dValue ) -{ - switch( nComp ) - { - case COLORCOMP_RED: mdRed = dValue; break; - case COLORCOMP_GREEN: mdGreen = dValue; break; - case COLORCOMP_BLUE: mdBlue = dValue; break; - case COLORCOMP_HUE: mdHue = dValue; break; - case COLORCOMP_SAT: mdSat = dValue; break; - case COLORCOMP_BRI: mdBri = dValue; break; - case COLORCOMP_CYAN: mdCyan = dValue; break; - case COLORCOMP_YELLOW: mdYellow = dValue; break; - case COLORCOMP_MAGENTA: mdMagenta = dValue; break; - case COLORCOMP_KEY: mdKey = dValue; break; - } - - if( nComp & COLORMODE_RGB ) - { - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - } - else if( nComp & COLORMODE_HSV ) - { - HSVtoRGB( mdHue, mdSat, mdBri, mdRed, mdGreen, mdBlue ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - } - else - { - CMYKtoRGB( mdCyan, mdMagenta, mdYellow, mdKey, mdRed, mdGreen, mdBlue ); - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - } -} - -// -------------------------------------------------------------------- - -typedef ::cppu::WeakComponentImplHelper4< XServiceInfo, XExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; - -class ColorPicker : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses. - public ColorPickerBase -{ -public: - ColorPicker( Reference< XComponentContext > const & xContext ); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); - - // XInitialization - virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - - // XPropertyAccess - virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) throw (RuntimeException); - virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException); - - // XExecutableDialog - virtual void SAL_CALL setTitle( const OUString& aTitle ) throw (RuntimeException); - virtual sal_Int16 SAL_CALL execute( ) throw (RuntimeException); - -private: - Reference< XComponentContext > mxContext; - OUString msTitle; - const OUString msColorKey; - const OUString msModeKey; - sal_Int32 mnColor; - sal_Int16 mnMode; - Reference< ::com::sun::star::awt::XWindow > mxParent; -}; - -// -------------------------------------------------------------------- - -OUString SAL_CALL ColorPicker_getImplementationName() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.cui.ColorPicker" ) ); -} - -// -------------------------------------------------------------------- - -Reference< XInterface > SAL_CALL ColorPicker_createInstance( Reference< XComponentContext > const & xContext ) SAL_THROW( (Exception) ) -{ - return static_cast<XWeak*>( new ColorPicker( xContext ) ); -} - -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( RuntimeException ) -{ - Sequence< OUString > seq(1); - seq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.ColorPicker" ) ); - return seq; -} - -// -------------------------------------------------------------------- - -ColorPicker::ColorPicker( Reference< XComponentContext > const & xContext ) -: ColorPickerBase( m_aMutex ) -, mxContext( xContext ) -, msColorKey( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ) -, msModeKey( RTL_CONSTASCII_USTRINGPARAM( "Mode" ) ) -, mnColor( 0 ) -, mnMode( 0 ) -{ -} - -// -------------------------------------------------------------------- - -// XInitialization -void SAL_CALL ColorPicker::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) -{ - if( aArguments.getLength() == 1 ) - { - aArguments[0] >>= mxParent; - } -} - -// -------------------------------------------------------------------- - -// XInitialization -OUString SAL_CALL ColorPicker::getImplementationName( ) throw (RuntimeException) -{ - return ColorPicker_getImplementationName(); -} - -// -------------------------------------------------------------------- - -sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) throw (RuntimeException) -{ - return sServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.ui.dialogs.ColorPicker" ) ); -} - -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( ) throw (RuntimeException) -{ - return ColorPicker_getSupportedServiceNames(); -} - -// -------------------------------------------------------------------- - -// XPropertyAccess -Sequence< PropertyValue > SAL_CALL ColorPicker::getPropertyValues( ) throw (RuntimeException) -{ - Sequence< PropertyValue > props(1); - props[0].Name = msColorKey; - props[0].Value <<= mnColor; - return props; -} - -// -------------------------------------------------------------------- - -void SAL_CALL ColorPicker::setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) -{ - for( sal_Int32 n = 0; n < aProps.getLength(); n++ ) - { - if( aProps[n].Name.equals( msColorKey ) ) - { - aProps[n].Value >>= mnColor; - } - else if( aProps[n].Name.equals( msModeKey ) ) - { - aProps[n].Value >>= mnMode; - } - } -} - -// -------------------------------------------------------------------- - -// XExecutableDialog -void SAL_CALL ColorPicker::setTitle( const OUString& sTitle ) throw (RuntimeException) -{ - msTitle = sTitle; -} - -// -------------------------------------------------------------------- - -sal_Int16 SAL_CALL ColorPicker::execute( ) throw (RuntimeException) -{ - ColorPickerDialog aDlg( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode ); - sal_Int16 ret = aDlg.Execute(); - if( ret ) - mnColor = aDlg.GetColor(); - - return ret; -} - -// -------------------------------------------------------------------- - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/colorpicker.hrc b/cui/source/dialogs/colorpicker.hrc deleted file mode 100644 index 0c40686dd..000000000 --- a/cui/source/dialogs/colorpicker.hrc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka <cl@lippka.com> - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef _CUI_COLORPICKER_HRC_ -#define _CUI_COLORPICKER_HRC_ - -#include <cuires.hrc> - - -#define FT_BOTTOMLINE 1 -#define BTN_OK 2 -#define BTN_CANCEL 3 -#define BTN_HELP 4 - -#define CT_COLORFIELD 5 -#define CT_COLORSLIDER 6 -#define CT_PREVIEW 7 -#define CT_PREVIOUS 8 - -#define FL_RGB 9 -#define CT_RED 10 -#define CT_GREEN 11 -#define CT_BLUE 12 -#define CT_HEX 13 - -#define FL_HSB 14 -#define CT_HUE 15 -#define CT_SATURATION 16 -#define CT_BRIGHTNESS 17 - -#define FL_CMYK 18 -#define CT_CYAN 19 -#define CT_MAGENTA 20 -#define CT_YELLOW 21 -#define CT_KEY 22 - -#define PB_PICKER 23 - -#define CT_LEFT_SLIDER 24 -#define CT_RIGHT_SLIDER 25 - -#define CT_SLIDERIMG 26 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/colorpicker.src b/cui/source/dialogs/colorpicker.src deleted file mode 100644 index b444f7442..000000000 --- a/cui/source/dialogs/colorpicker.src +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka <cl@lippka.com> - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "colorpicker.hrc" - -#define DLG_WIDTH 295 -#define DLG_HEIGHT 216 - -#define BUTTON_WIDTH 50 -#define BUTTON_HEIGHT 14 - -#define METRIC_WIDTH 30 -#define METRIC_HEIGHT 12 - -#define RADIO_WIDTH 8 -#define RADIO_HEIGHT 8 - -#define LABEL_WIDTH 50 -#define LABEL_HEIGHT 10 - -#define SLIDER_WIDTH 22 -#define PREVIEW_HEIGHT 16 - -#define LINE_WIDTH (3 + RADIO_WIDTH + 2 + LABEL_WIDTH + 3 + METRIC_WIDTH + 3) -#define LINE_HEIGHT 8 - -#define CONTROL_AREA_X (DLG_WIDTH - LINE_WIDTH - 6) -#define CONTROL_AREA_X_RADIO (CONTROL_AREA_X + 3) -#define CONTROL_AREA_X_LABEL (CONTROL_AREA_X + 3 + RADIO_WIDTH + 2) -#define CONTROL_AREA_X_METRIC (CONTROL_AREA_X + 3 + RADIO_WIDTH + 2 + LABEL_WIDTH + 3) - -#define CHOOSER_SIZE (CONTROL_AREA_X - 6 - SLIDER_WIDTH - 2 - 2 ) - -#define BOTTOMLINE_Y (DLG_HEIGHT - 3 - 3 - 8 - 14) -#define BUTTON_LINE_Y (BOTTOMLINE_Y + 8 + 3) - -#define RGB_Y1 (6 + LINE_HEIGHT + 1) -#define RGB_Y2 (RGB_Y1 + METRIC_HEIGHT + 2) -#define RGB_Y3 (RGB_Y2 + METRIC_HEIGHT + 2) -#define RGB_Y4 (RGB_Y3 + METRIC_HEIGHT + 4) -#define HSB_Y0 (RGB_Y4 + METRIC_HEIGHT + 1) -#define HSB_Y1 (HSB_Y0 + LINE_HEIGHT + 2) -#define HSB_Y2 (HSB_Y1 + METRIC_HEIGHT + 2) -#define HSB_Y3 (HSB_Y2 + METRIC_HEIGHT + 2) -#define CMYK_Y0 (HSB_Y3 + METRIC_HEIGHT + 1) -#define CMYK_Y1 (CMYK_Y0 + LINE_HEIGHT + 1) -#define CMYK_Y2 (CMYK_Y1 + METRIC_HEIGHT + 2) -#define CMYK_Y3 (CMYK_Y2 + METRIC_HEIGHT + 2) -#define CMYK_Y4 (CMYK_Y3 + METRIC_HEIGHT + 2) - - - -ModalDialog RID_CUI_DIALOG_COLORPICKER -{ - HelpID = "cui:ModalDialog:ColorPicker"; - - OutputSize = TRUE ; - SvLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ; - - Text [ en-US ] = "Color Picker" ; - - Control CT_COLORFIELD - { - HelpID = "cui:Control:ColorPicker:ColorField"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE , CHOOSER_SIZE ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - Control CT_COLORSLIDER - { - HelpID = "cui:Control:ColorPicker:ColorSlider"; - Pos = MAP_APPFONT ( CONTROL_AREA_X - 2 - SLIDER_WIDTH + 4 , 6 ) ; - Size = MAP_APPFONT ( SLIDER_WIDTH - 8 , CHOOSER_SIZE ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - Control CT_PREVIEW - { - HelpID = "cui:Control:ColorPicker:ColorPreview"; - Pos = MAP_APPFONT ( 6 , 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE , PREVIEW_HEIGHT ) ; - Border = FALSE; - }; - - Control CT_PREVIOUS - { - HelpID = "cui:Control:ColorPicker:ColorPrevious"; - Pos = MAP_APPFONT ( 6 + (CHOOSER_SIZE/2), 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE/2 , PREVIEW_HEIGHT ) ; - Border = FALSE; - Hide = TRUE; - }; - - FixedImage CT_LEFT_SLIDER - { - }; - - FixedImage CT_RIGHT_SLIDER - { - }; - - Image CT_SLIDERIMG - { - ImageBitmap = Bitmap { File = "colorslider.png" ; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - }; - -#if 0 - ImageButton PB_PICKER - { - HelpID = "cui:ImageButton:ColorPicker:Picker"; - Pos = MAP_APPFONT ( CONTROL_AREA_X - 2 - SLIDER_WIDTH + 4, 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT( SLIDER_WIDTH - 8, PREVIEW_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Pick a color from the document" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "pipette.png" ; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ; - }; - }; -#endif - - FixedLine FL_RGB - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , 6 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "RGB" ; - }; - - RadioButton CT_RED - { - HelpID = "cui:RadioButton:ColorPicker:Red"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y1+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - Group = TRUE; - }; - - RadioButton CT_GREEN - { - HelpID = "cui:RadioButton:ColorPicker:Green"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y2+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_BLUE - { - HelpID = "cui:RadioButton:ColorPicker:Blue"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y3+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_HUE - { - HelpID = "cui:RadioButton:ColorPicker:Hue"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y1+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - Check = TRUE ; - }; - - RadioButton CT_SATURATION - { - HelpID = "cui:RadioButton:ColorPicker:Saturation"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y2+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_BRIGHTNESS - { - HelpID = "cui:RadioButton:ColorPicker:Brightness"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y3+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - FixedText CT_RED - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Red" ; - }; - - MetricField CT_RED - { - HelpID = "cui:MetricField:ColorPicker:Red"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_GREEN - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Green" ; - }; - - MetricField CT_GREEN - { - HelpID = "cui:MetricField:ColorPicker:Green"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_BLUE - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Blue" ; - }; - - MetricField CT_BLUE - { - HelpID = "cui:MetricField:ColorPicker:Blue"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_HEX - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y4+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "Hex ~#" ; - }; - - Edit CT_HEX - { - HelpID = "cui:MetricField:ColorPicker:Hex"; - Border = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y4 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - }; - -// ------------------------------------------------------------------------- -// HSB -// ------------------------------------------------------------------------- - - FixedLine FL_HSB - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , HSB_Y0 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "HSB" ; - }; - - FixedText CT_HUE - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "H~ue" ; - }; - - MetricField CT_HUE - { - HelpID = "cui:MetricField:ColorPicker:Hue"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 360 ; - Last = 360 ; - Unit = FUNIT_CUSTOM ; - }; - - FixedText CT_SATURATION - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Saturation" ; - }; - - MetricField CT_SATURATION - { - HelpID = "cui:MetricField:ColorPicker:Saturation"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_BRIGHTNESS - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "Bright~ness" ; - }; - - MetricField CT_BRIGHTNESS - { - HelpID = "cui:MetricField:ColorPicker:Brightness"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - -// ------------------------------------------------------------------------- -// CMYK -// ------------------------------------------------------------------------- - - FixedLine FL_CMYK - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , CMYK_Y0 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "CMYK" ; - }; - - FixedText CT_CYAN - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Cyan" ; - }; - - MetricField CT_CYAN - { - HelpID = "cui:MetricField:ColorPicker:Cyan"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_MAGENTA - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Magenta" ; - }; - - MetricField CT_MAGENTA - { - HelpID = "cui:MetricField:ColorPicker:Magenta"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_YELLOW - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Yellow" ; - }; - - MetricField CT_YELLOW - { - HelpID = "cui:MetricField:ColorPicker:Yellow"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_KEY - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y4+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Key" ; - }; - - MetricField CT_KEY - { - HelpID = "cui:MetricField:ColorPicker:Key"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y4 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - // ------------------------------------------------------ - // bottom buttons - // ------------------------------------------------------ - - FixedLine FT_BOTTOMLINE - { - Pos = MAP_APPFONT ( 0 , BOTTOMLINE_Y ) ; - Size = MAP_APPFONT ( DLG_WIDTH , 8 ) ; - }; - - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 3 , BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( DLG_WIDTH - 3 - BUTTON_WIDTH - 3 - BUTTON_WIDTH, BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( DLG_WIDTH - 3 - BUTTON_WIDTH, BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx deleted file mode 100644 index 1ab3edec3..000000000 --- a/cui/source/dialogs/commonlingui.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "commonlingui.hxx" - -#include <cuires.hrc> -#include <dialmgr.hxx> -#include <vcl/decoview.hxx> -#include <sal/macros.h> - -#include "hangulhanjadlg.hrc" - -//============================================================================= -// SvxClickInfoCtr -//============================================================================= - -//----------------------------------------------------------------------------- -SvxClickInfoCtr::SvxClickInfoCtr( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ), - aFixedInfo( this) -{ - aFixedInfo.SetSizePixel(GetOutputSizePixel()); - aFixedInfo.Show(); -} - -//----------------------------------------------------------------------------- -void SvxClickInfoCtr::MouseButtonDown( const MouseEvent& ) -{ - aActivateLink.Call(this); -} - -//----------------------------------------------------------------------------- -long SvxClickInfoCtr::PreNotify( NotifyEvent& rNEvt ) -{ - if(rNEvt.GetType()==EVENT_GETFOCUS || rNEvt.GetType()==EVENT_MOUSEBUTTONDOWN) - { - aActivateLink.Call(this); - } - - return Control::PreNotify(rNEvt); -} - -//----------------------------------------------------------------------------- -void SvxClickInfoCtr::SetText( const XubString& rStr ) -{ - aFixedInfo.SetText(rStr ); -} - -//----------------------------------------------------------------------------- -XubString SvxClickInfoCtr::GetText() const -{ - return aFixedInfo.GetText(); -} - -//----------------------------------------------------------------------------- -SvxClickInfoCtr::~SvxClickInfoCtr() -{ -} - -//============================================================================= -// SvxCommonLinguisticControl -//============================================================================= -//----------------------------------------------------------------------------- -SvxCommonLinguisticControl::SvxCommonLinguisticControl( ModalDialog* _pParent ) - :Window( _pParent, CUI_RES( RID_SVX_WND_COMMON_LINGU ) ) - ,aWordText ( this, CUI_RES( FT_WORD ) ) - ,aAktWord ( this, CUI_RES( FT_AKTWORD ) ) - ,aNewWord ( this, CUI_RES( FT_NEWWORD ) ) - ,aNewWordED ( this, CUI_RES( ED_NEWWORD ) ) - ,aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ) - ,aIgnoreBtn ( this, CUI_RES( BTN_IGNORE ) ) - ,aIgnoreAllBtn ( this, CUI_RES( BTN_IGNOREALL ) ) - ,aChangeBtn ( this, CUI_RES( BTN_CHANGE ) ) - ,aChangeAllBtn ( this, CUI_RES( BTN_CHANGEALL ) ) - ,aOptionsBtn ( this, CUI_RES( BTN_OPTIONS ) ) - ,aStatusText ( this, CUI_RES( FT_STATUS ) ) - ,aHelpBtn ( this, CUI_RES( BTN_SPL_HELP ) ) - ,aCancelBtn ( this, CUI_RES( BTN_SPL_CANCEL ) ) - ,aAuditBox ( this, CUI_RES( GB_AUDIT ) ) -{ - FreeResource(); - aAktWord.SetAccessibleName(aWordText.GetText()); - SetPosSizePixel( Point( 0, 0 ), _pParent->GetOutputSizePixel() ); - Show(); -} - -// ----------------------------------------------------------------------- -PushButton* SvxCommonLinguisticControl::implGetButton( ButtonType _eType ) const -{ - const PushButton* pButton = NULL; - switch ( _eType ) - { - case eClose: pButton = &aCancelBtn; break; - case eIgnore: pButton = &aIgnoreBtn; break; - case eIgnoreAll: pButton = &aIgnoreAllBtn; break; - case eChange: pButton = &aChangeBtn; break; - case eChangeAll: pButton = &aChangeAllBtn; break; - case eOptions: pButton = &aOptionsBtn; break; - } - return const_cast< PushButton* >( pButton ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::SetButtonHandler( ButtonType _eType, const Link& _rHandler ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->SetClickHdl( _rHandler ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::EnableButton( ButtonType _eType, sal_Bool _bEnable ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->Enable( _bEnable ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ) -{ - Window* pInsertAfter = NULL; // will be the last window of our own "undividable" group, after which we insert the foreign group - switch ( _eInsertAfter ) - { - case eLeftRightWords : pInsertAfter = &aNewWordED; break; - case eSuggestionLabel : pInsertAfter = &aSuggestionFT; break; - case eActionButtons : pInsertAfter = &aChangeAllBtn; break; - case eDialogButtons : pInsertAfter = &aCancelBtn; break; - } - - // now loop through the remaining windows of the foreign group - Window* pInsertBehind = pInsertAfter; - Window* pInsert = &_rFirstGroupWindow; - - // some strange thing below: asking a window for WINDOW_NEXT or WINDOW_PREV does not take into - // account the border window, _but_ SetZOrder _does_!. Thus, when advancing through a chain - // of windows, we need to work with the border windows (WINDOW_BORDER), instead of simply - // asking for WINDOW_NEXT. - - Window* pLoopEnd = _rLastGroupWindow.GetWindow( WINDOW_BORDER ); - while ( pInsert && ( pInsertBehind != pLoopEnd ) ) - { - // we'll destroy the NEXT relation immediately, so remember the next window - DBG_ASSERT( pInsert->GetWindow( WINDOW_BORDER ), "SvxCommonLinguisticControl::InsertControlGroup: border window is expected to be non NULL!" ); - Window* pNextInsert = pInsert->GetWindow( WINDOW_BORDER )->GetWindow( WINDOW_NEXT ); - // knit - pInsert->SetZOrder( pInsertBehind, WINDOW_ZORDER_BEHIND ); - // advance - pInsertBehind = pInsert; - pInsert = pNextInsert; - } - DBG_ASSERT( pInsertBehind == pLoopEnd, "SvxCommonLinguisticControl::InsertControlGroup: controls do not form a group!" ); - // if we did not reach pLoopEnd, then we did not reach _rLastGroupWindow in the loop, then - // (FirstWindow, LastWindow) was no valid control group -} - -//----------------------------------------------------------------------------- -void SvxCommonLinguisticControl::Paint( const Rectangle& rRect ) -{ - Window::Paint(rRect ); - - DecorationView aDecoView( this ); - - Rectangle aRect( aAuditBox.GetPosPixel(), aAuditBox.GetSizePixel() ); - aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL ); -} - -//----------------------------------------------------------------------------- -void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY ) -{ - Size aSize; - Point aPos; - - // the controls which need to be resized - { - Window* pResize[] = - { - this, &aAuditBox, &aStatusText - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pResize ); ++i ) - { - aSize = pResize[i]->GetSizePixel( ); - pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) ); - } - } - - // the controls which stick to the bottom of the window - { - Window* pMoveDown[] = - { - &aStatusText, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveDown ); ++i ) - { - aPos = pMoveDown[i]->GetPosPixel(); - aPos.Y() += _nY; - pMoveDown[i]->SetPosPixel( aPos ); - } - } - - // the controls which stick to the right - { - Window* pMoveRight[] = - { - &aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveRight ); ++i ) - { - aPos = pMoveRight[i]->GetPosPixel(); - aPos.X() += _nX; - pMoveRight[i]->SetPosPixel( aPos ); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.hxx b/cui/source/dialogs/commonlingui.hxx deleted file mode 100644 index 64e199705..000000000 --- a/cui/source/dialogs/commonlingui.hxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_COMMON_LINGUI_HXX -#define SVX_COMMON_LINGUI_HXX - -#include <vcl/ctrl.hxx> -#include <svtools/stdctrl.hxx> -#include <vcl/edit.hxx> -#include <svtools/svxbox.hxx> -#include <vcl/button.hxx> -#include <vcl/group.hxx> -#include <vcl/dialog.hxx> - -//============================================================================= -// SvxClickInfoCtr -//============================================================================= - -class SvxClickInfoCtr: public Control -{ -private: - FixedInfo aFixedInfo; - Link aActivateLink; - -public: - SvxClickInfoCtr( Window* pParent, const ResId& rResId ); - ~SvxClickInfoCtr(); - - virtual void SetText( const XubString& rStr ); - virtual XubString GetText() const; - - void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; } - const Link& GetActivateHdl() const { return aActivateLink; } - -protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual long PreNotify( NotifyEvent& rNEvt ); - -}; - -//============================================================================= -// SvxCommonLinguisticControl -//============================================================================= -class SvxCommonLinguisticControl : public Window -{ -public: - enum ButtonType - { - eClose, - eIgnore, - eIgnoreAll, - eChange, - eChangeAll, - eOptions - }; - -protected: - FixedText aWordText; - SvxClickInfoCtr aAktWord; - - FixedText aNewWord; - Edit aNewWordED; - - FixedText aSuggestionFT; - - PushButton aIgnoreBtn; - PushButton aIgnoreAllBtn; - PushButton aChangeBtn; - PushButton aChangeAllBtn; - PushButton aOptionsBtn; - - FixedInfo aStatusText; - HelpButton aHelpBtn; - CancelButton aCancelBtn; - - GroupBox aAuditBox; - -protected: - virtual void Paint( const Rectangle& rRect ); - -private: - PushButton* implGetButton( ButtonType _eType ) const; - -public: - SvxCommonLinguisticControl( ModalDialog* _pParent ); - - // handlers - inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); } - inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); } - - void SetButtonHandler( ButtonType _eType, const Link& _rHandler ); - void EnableButton( ButtonType _eType, sal_Bool _bEnable ); - - inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); } - inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); } - - // users of this class may want to insert own controls in some places, where the ordinary - // Z-Order determined by construction time is not sufficient - // Use the following methods for this - enum ControlGroup // control groups in this window which cannot be devided (e.g. are adjacent in the Z order) - { - eLeftRightWords, // the controls for the two words (original and suggestion), including the labels - eSuggestionLabel, // the label for the suggestion - eActionButtons, // the group of "ignore(all)" / "change(all)" buttons - eDialogButtons // the group of dialog control buttons (help and close) - }; - void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ); - - /** enlarges the window - - Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks - to the right, the dictionary list as well as the close/help buttons stick to the bottom of the - window. - */ - void Enlarge( sal_Int32 _nX, sal_Int32 _nY ); - - // control access methods - inline void SetCurrentText( const String& _rText ) { aAktWord.SetText( _rText ); } - inline String GetCurrentText( ) const { return aAktWord.GetText(); } - - inline void SetStatusText( const String& _rText ) { aStatusText.SetText( _rText ); } - inline String GetStatusText( ) const { return aStatusText.GetText(); } - - inline Edit& GetWordInputControl() { return aNewWordED; } - inline const Edit& GetWordInputControl() const { return aNewWordED; } - - // returns the location (upper-left corner) of the group of action buttons - inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); } -}; - - - -#endif // SVX_COMMON_LINGUI_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.src b/cui/source/dialogs/commonlingui.src deleted file mode 100644 index 148cd89b9..000000000 --- a/cui/source/dialogs/commonlingui.src +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include <cuires.hrc> -#include "helpid.hrc" -#include "hangulhanjadlg.hrc" - -Window RID_SVX_WND_COMMON_LINGU -{ - DialogControl = TRUE; // we want to tab out of this - Hide = TRUE; - - FixedText FT_WORD - { - Pos = MAP_APPFONT( 6, 9 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "Origi~nal"; - }; - Control FT_AKTWORD - { - HelpId=HID_SPELLDLG_SETWORD; - Pos = MAP_APPFONT( 51, 9 ); - Size = MAP_APPFONT( 164, 10 ); - Border =FALSE; - TabStop = TRUE; - }; - - FixedText FT_NEWWORD - { - Pos = MAP_APPFONT( 6, 25 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Word" ; - }; - - Edit ED_NEWWORD - { - Pos = MAP_APPFONT( 51, 24 ); - Size = MAP_APPFONT( 137, 12 ); - Border = TRUE; - }; - - FixedText FT_SUGGESTION - { - Pos = MAP_APPFONT( 6, 48 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Suggestions" ; - }; - - PushButton BTN_IGNORE - { - Pos = MAP_APPFONT( 224, 6 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore" ; - }; - - PushButton BTN_IGNOREALL - { - Pos = MAP_APPFONT( 224, 22 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always I~gnore" ; - }; - - PushButton BTN_CHANGE - { - Pos = MAP_APPFONT( 224, 40 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Replace" ; - DefButton = TRUE ; - }; - - PushButton BTN_CHANGEALL - { - Pos = MAP_APPFONT( 224, 56 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always R~eplace" ; - }; - - PushButton BTN_OPTIONS - { - Pos = MAP_APPFONT( 224, 129 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE ; - Text [ en-US ] = "Options..." ; - }; - - FixedText FT_STATUS - { - Pos = MAP_APPFONT( 6, 155 ); - Size = MAP_APPFONT( 130, 10 ); - }; - - GroupBox GB_AUDIT - { - Pos = MAP_APPFONT( 1, 1 ); - Size = MAP_APPFONT( 283, 148 ); - Hide=TRUE; - }; - - HelpButton BTN_SPL_HELP - { - Pos = MAP_APPFONT( 160, 153 ); - Size = MAP_APPFONT( 55, 14 ); - }; - - CancelButton BTN_SPL_CANCEL - { - Pos = MAP_APPFONT ( 224 , 153 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Close" ; - }; -}; diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx deleted file mode 100644 index 777851cce..000000000 --- a/cui/source/dialogs/cuicharmap.cxx +++ /dev/null @@ -1,581 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include <stdio.h> - -#define _CUI_CHARMAP_CXX_ -#include <tools/shl.hxx> -#include <tools/debug.hxx> -#include <vcl/sound.hxx> -#include <vcl/svapp.hxx> -#include <svtools/colorcfg.hxx> -#include <svl/eitem.hxx> -#include <svl/intitem.hxx> -#include <svl/itempool.hxx> - -#include <rtl/textenc.h> -#include <svx/ucsubset.hxx> -#include <sfx2/objsh.hxx> -#include <vcl/msgbox.hxx> -#include <svl/stritem.hxx> - -#include <cuires.hrc> -#include <dialmgr.hxx> -#include "cuicharmap.hxx" -#include <sfx2/request.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/app.hxx> -#include <editeng/fontitem.hxx> -#include "charmap.hrc" -#include "macroass.hxx" - -// class SvxCharacterMap ================================================= - -SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne, const SfxItemSet* pSet ) : - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_CHARMAP ) ), - mpCharMapData( 0 ) -{ - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, sal_False ); - if ( pItem ) - bOne = pItem->GetValue(); - - mpCharMapData = new SvxCharMapData( this, bOne, &CUI_MGR() ); - - SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, sal_False ); - if ( pCharItem ) - SetChar( pCharItem->GetValue() ); - - SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, sal_False ); - if ( pDisableItem && pDisableItem->GetValue() ) - DisableFontSelection(); - - SFX_ITEMSET_ARG( pSet, pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); - SFX_ITEMSET_ARG( pSet, pFontNameItem, SfxStringItem, SID_FONT_NAME, sal_False ); - if ( pFontItem ) - { - Font aFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetSize() ); - aFont.SetCharSet( pFontItem->GetCharSet() ); - aFont.SetPitch( pFontItem->GetPitch() ); - SetCharFont( aFont ); - } - else if ( pFontNameItem ) - { - Font aFont( GetCharFont() ); - aFont.SetName( pFontNameItem->GetValue() ); - SetCharFont( aFont ); - } - - FreeResource(); - CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() ); -} - -// ----------------------------------------------------------------------- - -SvxCharacterMap::~SvxCharacterMap() -{ - delete mpCharMapData; -} - -// ----------------------------------------------------------------------- - -const Font& SvxCharacterMap::GetCharFont() const -{ - return mpCharMapData->aFont; -} - -// ----------------------------------------------------------------------- - -void SvxCharacterMap::SetChar( sal_UCS4 c ) -{ - mpCharMapData->aShowSet.SelectCharacter( c ); -} - -// ----------------------------------------------------------------------- - -sal_UCS4 SvxCharacterMap::GetChar() const -{ - return mpCharMapData->aShowSet.GetSelectCharacter(); -} - -// ----------------------------------------------------------------------- - -String SvxCharacterMap::GetCharacters() const -{ - return mpCharMapData->aShowText.GetText(); -} - - -// ----------------------------------------------------------------------- - -void SvxCharacterMap::DisableFontSelection() -{ - mpCharMapData->aFontText.Disable(); - mpCharMapData->aFontLB.Disable(); -} - -void SvxCharacterMap::SetCharFont( const Font& rFont ) -{ - mpCharMapData->SetCharFont( rFont ); -} - -short SvxCharacterMap::Execute() -{ - short nResult = SfxModalDialog::Execute(); - if ( nResult == RET_OK ) - { - SfxItemSet* pSet = GetItemSet(); - if ( pSet ) - { - const SfxItemPool* pPool = pSet->GetPool(); - const Font& rFont( GetCharFont() ); - pSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), GetCharacters() ) ); - pSet->Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(), - rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) ); - pSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), rFont.GetName() ) ); - pSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), GetChar() ) ); - } - } - - return nResult; -} - - -// class SvxShowText ===================================================== - -SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter ) -: Control( pParent, rResId ), - mbCenter( bCenter) -{} - -// ----------------------------------------------------------------------- - -void SvxShowText::Paint( const Rectangle& ) -{ - Color aTextCol = GetTextColor(); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - const Color aWindowTextColor( rStyleSettings.GetDialogTextColor() ); - SetTextColor( aWindowTextColor ); - - const String aText = GetText(); - const Size aSize = GetOutputSizePixel(); - Point aPoint( 2, mnY ); - - // adjust position using ink boundary if possible - Rectangle aBoundRect; - if( !GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty() ) - aPoint.X() = (aSize.Width() - GetTextWidth( aText )) / 2; - else - { - // adjust position before it gets out of bounds - aBoundRect += aPoint; - - // shift back vertically if needed - int nYLDelta = aBoundRect.Top(); - int nYHDelta = aSize.Height() - aBoundRect.Bottom(); - if( nYLDelta <= 0 ) - aPoint.Y() -= nYLDelta - 1; - else if( nYHDelta <= 0 ) - aPoint.Y() += nYHDelta - 1; - - if( mbCenter ) - { - // move glyph to middle of cell - aPoint.X() = -aBoundRect.Left() - + (aSize.Width() - aBoundRect.GetWidth()) / 2; - } - else - { - // shift back horizontally if needed - int nXLDelta = aBoundRect.Left(); - int nXHDelta = aSize.Width() - aBoundRect.Right(); - if( nXLDelta <= 0 ) - aPoint.X() -= nXLDelta - 1; - else if( nXHDelta <= 0 ) - aPoint.X() += nXHDelta - 1; - } - } - - DrawText( aPoint, aText ); - SetTextColor( aTextCol ); -} - -// ----------------------------------------------------------------------- - -void SvxShowText::SetFont( const Font& rFont ) -{ - long nWinHeight = GetOutputSizePixel().Height(); - Font aFont = rFont; - aFont.SetWeight( WEIGHT_NORMAL ); - aFont.SetAlign( ALIGN_TOP ); - aFont.SetSize( PixelToLogic( Size( 0, nWinHeight/2 ) ) ); - aFont.SetTransparent( sal_True ); - Control::SetFont( aFont ); - mnY = ( nWinHeight - GetTextHeight() ) / 2; - - Invalidate(); -} - -// ----------------------------------------------------------------------- - -void SvxShowText::SetText( const String& rText ) -{ - Control::SetText( rText ); - Invalidate(); -} - -// ----------------------------------------------------------------------- - -SvxShowText::~SvxShowText() -{} - -// class SvxCharacterMap ================================================= - -SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* pResContext ) -: mpDialog( pDialog ), - aShowSet ( pDialog, ResId( CT_SHOWSET, *pResContext ) ), - aShowText ( pDialog, ResId( CT_SHOWTEXT, *pResContext ) ), - aOKBtn ( pDialog, ResId( BTN_CHAR_OK, *pResContext ) ), - aCancelBtn ( pDialog, ResId( BTN_CHAR_CANCEL, *pResContext ) ), - aHelpBtn ( pDialog, ResId( BTN_CHAR_HELP, *pResContext ) ), - aDeleteBtn ( pDialog, ResId( BTN_DELETE, *pResContext ) ), - aFontText ( pDialog, ResId( FT_FONT, *pResContext ) ), - aFontLB ( pDialog, ResId( LB_FONT, *pResContext ) ), - aSubsetText ( pDialog, ResId( FT_SUBSET, *pResContext ) ), - aSubsetLB ( pDialog, ResId( LB_SUBSET, *pResContext ) ), - aSymbolText ( pDialog, ResId( FT_SYMBOLE, *pResContext ) ), - aShowChar ( pDialog, ResId( CT_SHOWCHAR, *pResContext ), sal_True ), - aCharCodeText ( pDialog, ResId( FT_CHARCODE, *pResContext ) ), - bOne( bOne_ ), - pSubsetMap( NULL ) -{ - aFont = pDialog->GetFont(); - aFont.SetTransparent( sal_True ); - aFont.SetFamily( FAMILY_DONTKNOW ); - aFont.SetPitch( PITCH_DONTKNOW ); - aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); - - if ( bOne ) - { - Size aDlgSize = pDialog->GetSizePixel(); - pDialog->SetSizePixel( Size( aDlgSize.Width(), - aDlgSize.Height()-aShowText.GetSizePixel().Height() ) ); - aSymbolText.Hide(); - aShowText.Hide(); - aDeleteBtn.Hide(); - } - - String aDefStr( aFont.GetName() ); - String aLastName; - int nCount = mpDialog->GetDevFontCount(); - for ( int i = 0; i < nCount; i++ ) - { - String aFontName( mpDialog->GetDevFont( i ).GetName() ); - if ( aFontName != aLastName ) - { - aLastName = aFontName; - sal_uInt16 nPos = aFontLB.InsertEntry( aFontName ); - aFontLB.SetEntryData( nPos, (void*)(sal_uLong)i ); - } - } - // the font may not be in the list => - // try to find a font name token in list and select found font, - // else select topmost entry - bool bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND ); - if( !bFound ) - { - for ( xub_StrLen i = 0; i < aDefStr.GetTokenCount(); ++i ) - { - String aToken = aDefStr.GetToken(i); - if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND ) - { - aDefStr = aToken; - bFound = sal_True; - break; - } - } - } - - if ( bFound ) - aFontLB.SelectEntry( aDefStr ); - else if ( aFontLB.GetEntryCount() ) - aFontLB.SelectEntryPos(0); - FontSelectHdl( &aFontLB ); - - aOKBtn.SetClickHdl( LINK( this, SvxCharMapData, OKHdl ) ); - aFontLB.SetSelectHdl( LINK( this, SvxCharMapData, FontSelectHdl ) ); - aSubsetLB.SetSelectHdl( LINK( this, SvxCharMapData, SubsetSelectHdl ) ); - aShowSet.SetDoubleClickHdl( LINK( this, SvxCharMapData, CharDoubleClickHdl ) ); - aShowSet.SetSelectHdl( LINK( this, SvxCharMapData, CharSelectHdl ) ); - aShowSet.SetHighlightHdl( LINK( this, SvxCharMapData, CharHighlightHdl ) ); - aShowSet.SetPreSelectHdl( LINK( this, SvxCharMapData, CharPreSelectHdl ) ); - aDeleteBtn.SetClickHdl( LINK( this, SvxCharMapData, DeleteHdl ) ); - - if( SvxShowCharSet::getSelectedChar() == ' ') - aOKBtn.Disable(); - else - aOKBtn.Enable(); - - // left align aShowText field - int nLeftEdge = aSymbolText.GetPosPixel().X(); - nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() ); - aShowText.SetPosPixel( Point( nLeftEdge+4, aShowText.GetPosPixel().Y() ) ); -} - -// ----------------------------------------------------------------------- - -void SvxCharMapData::SetCharFont( const Font& rFont ) -{ - // first get the underlying info in order to get font names - // like "Times New Roman;Times" resolved - Font aTmp( mpDialog->GetFontMetric( rFont ) ); - - if ( aFontLB.GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND ) - return; - - aFontLB.SelectEntry( aTmp.GetName() ); - aFont = aTmp; - FontSelectHdl( &aFontLB ); - - // for compatibility reasons - mpDialog->ModalDialog::SetFont( aFont ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, OKHdl, OKButton *, EMPTYARG ) -{ - String aStr = aShowText.GetText(); - - if ( !aStr.Len() ) - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - // using the new UCS4 constructor - rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aOUStr ); - } - mpDialog->EndDialog( sal_True ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aFontLB.GetSelectEntryPos(), - nFont = (sal_uInt16)(sal_uLong)aFontLB.GetEntryData( nPos ); - aFont = mpDialog->GetDevFont( nFont ); - aFont.SetWeight( WEIGHT_DONTKNOW ); - aFont.SetItalic( ITALIC_NONE ); - aFont.SetWidthType( WIDTH_DONTKNOW ); - aFont.SetPitch( PITCH_DONTKNOW ); - aFont.SetFamily( FAMILY_DONTKNOW ); - - // notify children using this font - aShowSet.SetFont( aFont ); - aShowChar.SetFont( aFont ); - aShowText.SetFont( aFont ); - - // right align some fields to aShowSet - int nRightEdge = aShowSet.GetPosPixel().X() + aShowSet.GetOutputSizePixel().Width(); - Size aNewSize = aSubsetLB.GetOutputSizePixel(); - aNewSize.setWidth( nRightEdge - aSubsetLB.GetPosPixel().X() ); - aSubsetLB.SetOutputSizePixel( aNewSize ); - - // setup unicode subset listbar with font specific subsets, - // hide unicode subset listbar for symbol fonts - // TODO: get info from the Font once it provides it - if( pSubsetMap) - delete pSubsetMap; - pSubsetMap = NULL; - - sal_Bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL); - if( bNeedSubset ) - { - FontCharMap aFontCharMap; - aShowSet.GetFontCharMap( aFontCharMap ); - pSubsetMap = new SubsetMap( &aFontCharMap ); - - // update subset listbox for new font's unicode subsets - aSubsetLB.Clear(); - // TODO: is it worth to improve the stupid linear search? - bool bFirst = true; - const Subset* s; - while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) ) - { - sal_uInt16 nPos_ = aSubsetLB.InsertEntry( s->GetName() ); - aSubsetLB.SetEntryData( nPos_, (void*)s ); - // NOTE: subset must live at least as long as the selected font - if( bFirst ) - aSubsetLB.SelectEntryPos( nPos_ ); - bFirst = false; - } - if( aSubsetLB.GetEntryCount() <= 1 ) - bNeedSubset = sal_False; - } - - aSubsetText.Show( bNeedSubset); - aSubsetLB.Show( bNeedSubset); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, SubsetSelectHdl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aSubsetLB.GetSelectEntryPos(); - const Subset* pSubset = reinterpret_cast<const Subset*> (aSubsetLB.GetEntryData(nPos)); - if( pSubset ) - { - sal_UCS4 cFirst = pSubset->GetRangeMin(); - aShowSet.SelectCharacter( cFirst ); - } - aSubsetLB.SelectEntryPos( nPos ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharDoubleClickHdl, Control *, EMPTYARG ) -{ - mpDialog->EndDialog( sal_True ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharSelectHdl, Control *, EMPTYARG ) -{ - if ( !bOne ) - { - String aText = aShowText.GetText(); - - if ( aText.Len() == CHARMAP_MAXLEN ) - Sound::Beep( SOUND_WARNING ); - else - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - // using the new UCS4 constructor - rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aText + aOUStr ); - } - - } - aOKBtn.Enable(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharHighlightHdl, Control *, EMPTYARG ) -{ - String aText; - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - sal_Bool bSelect = (cChar > 0); - - // show char sample - if ( bSelect ) - { - // using the new UCS4 constructor - aText = rtl::OUString( &cChar, 1 ); - - const Subset* pSubset = NULL; - if( pSubsetMap ) - pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); - if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); - else - aSubsetLB.SetNoSelection(); - } - aShowChar.SetText( aText ); - aShowChar.Update(); - - // show char code - if ( bSelect ) - { - char aBuf[32]; - snprintf( aBuf, sizeof(aBuf), "U+%04X", static_cast<unsigned>(cChar) ); - if( cChar < 0x0100 ) - snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast<unsigned>(cChar) ); - aText = String::CreateFromAscii( aBuf ); - } - aCharCodeText.SetText( aText ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharPreSelectHdl, Control *, EMPTYARG ) -{ - // adjust subset selection - if( pSubsetMap ) - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); - if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); - } - - aOKBtn.Enable(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, DeleteHdl, PushButton *, EMPTYARG ) -{ - aShowText.SetText( String() ); - aOKBtn.Disable(); - return 0; -} - -IMPL_LINK( SvxCharMapData, AssignHdl, PushButton *, EMPTYARG ) -{ - SfxAllItemSet aSet( SfxObjectShell::Current()->GetPool() ); - aSet.Put( SfxStringItem( SID_CHARMAP, String::CreateFromAscii("test") ) ); - SfxModalDialog* pDlg = new SfxMacroAssignDlg( mpDialog, com::sun::star::uno::Reference < com::sun::star::frame::XFrame >(), aSet ); - if ( pDlg && pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pOutSet->GetItemState( SID_CHARMAP, sal_False, &pItem ) ) - { - // show assigned shortcut - } - } - - delete pDlg; - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx deleted file mode 100644 index 4d9c7e772..000000000 --- a/cui/source/dialogs/cuifmsearch.cxx +++ /dev/null @@ -1,963 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/debug.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <tools/shl.hxx> -#include <dialmgr.hxx> -#include <sfx2/tabdlg.hxx> -#include <osl/mutex.hxx> -#include <sfx2/app.hxx> -#include <cuires.hrc> -#include <svl/filerec.hxx> -#include <svx/fmsrccfg.hxx> -#include <svx/fmsrcimp.hxx> -#include "fmsearch.hrc" -#include "cuifmsearch.hxx" -#include <svx/srchdlg.hxx> -#include <svl/cjkoptions.hxx> -#include <com/sun/star/i18n/TransliterationModules.hpp> -#include <comphelper/processfactory.hxx> -#include <svx/svxdlg.hxx> -#include <sal/macros.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::i18n; -using namespace ::svxform; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::util; - -#define MAX_HISTORY_ENTRIES 50 - -//------------------------------------------------------------------------ -void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor ) -{ - // init the engine - DBG_ASSERT( m_pSearchEngine, "FmSearchDialog::initCommon: have no engine!" ); - m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress)); - - // some layout changes according to available CJK options - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsJapaneseFindEnabled()) - { - sal_Int32 nUpper = m_cbApprox.GetPosPixel().Y(); - sal_Int32 nDifference = m_aSoundsLikeCJKSettings.GetPosPixel().Y() - nUpper; - - // hide the options for the japanese search - Control* pFieldsToMove[] = { &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint }; - implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flOptions); - - m_aSoundsLikeCJK.Hide(); - m_aSoundsLikeCJKSettings.Hide(); - } - - if (!aCJKOptions.IsCJKFontEnabled()) - { - m_aHalfFullFormsCJK.Hide(); - - // never ignore the width (ignoring is expensive) if the option is not available at all - m_pSearchEngine->SetIgnoreWidthCJK( sal_False ); - } - - // some initial record texts - m_ftRecord.SetText( String::CreateFromInt32( _rxCursor->getRow() ) ); - m_pbClose.SetHelpText(String()); -} - -//------------------------------------------------------------------------ -FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, const ::std::vector< String >& _rContexts, sal_Int16 nInitialContext, - const Link& lnkContextSupplier) - :ModalDialog(pParent, CUI_RES(RID_SVXDLG_SEARCHFORM)) - ,m_flSearchFor (this, CUI_RES(FL_SEARCHFOR)) - ,m_rbSearchForText (this, CUI_RES(RB_SEARCHFORTEXT)) - ,m_rbSearchForNull (this, CUI_RES(RB_SEARCHFORNULL)) - ,m_rbSearchForNotNull (this, CUI_RES(RB_SEARCHFORNOTNULL)) - ,m_cmbSearchText (this, CUI_RES(CMB_SEARCHTEXT)) - ,m_flWhere (this, CUI_RES(FL_WHERE)) - ,m_ftForm (this, CUI_RES(FT_FORM)) - ,m_lbForm (this, CUI_RES(LB_FORM)) - ,m_rbAllFields (this, CUI_RES(RB_ALLFIELDS)) - ,m_rbSingleField (this, CUI_RES(RB_SINGLEFIELD)) - ,m_lbField (this, CUI_RES(LB_FIELD)) - ,m_flOptions (this, CUI_RES(FL_OPTIONS)) - ,m_ftPosition (this, CUI_RES(FT_POSITION)) - ,m_lbPosition (this, CUI_RES(LB_POSITION)) - ,m_cbUseFormat (this, CUI_RES(CB_USEFORMATTER)) - ,m_cbCase (this, CUI_RES(CB_CASE)) - ,m_cbBackwards (this, CUI_RES(CB_BACKWARD)) - ,m_cbStartOver (this, CUI_RES(CB_STARTOVER)) - ,m_cbWildCard (this, CUI_RES(CB_WILDCARD)) - ,m_cbRegular (this, CUI_RES(CB_REGULAR)) - ,m_cbApprox (this, CUI_RES(CB_APPROX)) - ,m_pbApproxSettings (this, CUI_RES(PB_APPROXSETTINGS)) - ,m_aHalfFullFormsCJK (this, CUI_RES(CB_HALFFULLFORMS)) - ,m_aSoundsLikeCJK (this, CUI_RES(CB_SOUNDSLIKECJK)) - ,m_aSoundsLikeCJKSettings (this, CUI_RES(PB_SOUNDSLIKESETTINGS)) - ,m_flState (this, CUI_RES(FL_STATE)) - ,m_ftRecordLabel (this, CUI_RES(FT_RECORDLABEL)) - ,m_ftRecord (this, CUI_RES(FT_RECORD)) - ,m_ftHint (this, CUI_RES(FT_HINT)) - ,m_pbSearchAgain (this, CUI_RES(PB_SEARCH)) - ,m_pbClose (this, CUI_RES(1)) - ,m_pbHelp (this, CUI_RES(1)) - ,m_sSearch ( m_pbSearchAgain.GetText() ) - ,m_sCancel ( Button::GetStandardText( BUTTON_CANCEL ) ) - ,m_pPreSearchFocus( NULL ) - ,m_lnkContextSupplier(lnkContextSupplier) - ,m_pConfig( NULL ) -{ - DBG_ASSERT(m_lnkContextSupplier.IsSet(), "FmSearchDialog::FmSearchDialog : have no ContextSupplier !"); - - // erst mal die Informationen fuer den initialen Kontext - FmSearchContext fmscInitial; - fmscInitial.nContext = nInitialContext; - m_lnkContextSupplier.Call(&fmscInitial); - DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); - DBG_ASSERT(fmscInitial.strUsedFields.GetTokenCount(';') == (xub_StrLen)fmscInitial.arrFields.size(), - "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !"); -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i) - DBG_ASSERT(fmscInitial.arrFields.at(i).is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); -#endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL - - for ( ::std::vector< String >::const_iterator context = _rContexts.begin(); - context != _rContexts.end(); - ++context - ) - { - m_arrContextFields.push_back(String()); - m_lbForm.InsertEntry(*context); - } - m_lbForm.SelectEntryPos(nInitialContext); - - m_lbForm.SetSelectHdl(LINK(this, FmSearchDialog, OnContextSelection)); - - if (m_arrContextFields.size() == 1) - { // remove the context selection listbox and rearrange the controls accordingly - sal_Int32 nUpper = m_lbForm.GetPosPixel().Y(); - sal_Int32 nDifference = m_rbAllFields.GetPosPixel().Y() - nUpper; - - // move all controls below the affected ones up - Control* pFieldsToMove[] = { &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition, - &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox, - &m_pbApproxSettings, &m_aHalfFullFormsCJK, &m_aSoundsLikeCJK, &m_aSoundsLikeCJKSettings, - &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint }; - - implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flWhere); - - Point pt = m_rbAllFields.GetPosPixel(); - pt.X() = m_ftForm.GetPosPixel().X(); - m_rbAllFields.SetPosPixel( pt ); - pt = m_rbSingleField.GetPosPixel(); - pt.X() = m_ftForm.GetPosPixel().X(); - m_rbSingleField.SetPosPixel( pt ); - - // hide dispensable controls - m_ftForm.Hide(); - m_lbForm.Hide(); - } - - m_pSearchEngine = new FmSearchEngine( - ::comphelper::getProcessServiceFactory(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields, SM_ALLOWSCHEDULE ); - initCommon( fmscInitial.xCursor ); - - if (fmscInitial.sFieldDisplayNames.Len() != 0) - { // use the display names if supplied - DBG_ASSERT(fmscInitial.sFieldDisplayNames.GetTokenCount() == fmscInitial.strUsedFields.GetTokenCount(), - "FmSearchDialog::FmSearchDialog : invalid initial context description !"); - Init(fmscInitial.sFieldDisplayNames, sInitialText); - } - else - Init(fmscInitial.strUsedFields, sInitialText); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::implMoveControls( - Control** _ppControls, - sal_Int32 _nControls, - sal_Int32 _nUp, - Control* /*_pToResize*/) -{ - for (sal_Int32 i=0; i<_nControls; ++i) - { - Point pt = _ppControls[i]->GetPosPixel(); - pt.Y() -= _nUp; - _ppControls[i]->SetPosPixel(pt); - } - - // resize myself - Size sz = GetSizePixel(); - sz.Height() -= _nUp; - SetSizePixel(sz); -} - -//------------------------------------------------------------------------ -FmSearchDialog::~FmSearchDialog() -{ - if (m_aDelayedPaint.IsActive()) - m_aDelayedPaint.Stop(); - - SaveParams(); - - if (m_pConfig) - { - delete m_pConfig; - m_pConfig = NULL; - } - - delete m_pSearchEngine; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::Init(const UniString& strVisibleFields, const UniString& sInitialText) -{ - //the initialization of all the Controls - m_rbSearchForText.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSearchForNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSearchForNotNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - - m_rbAllFields.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSingleField.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - - m_pbSearchAgain.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSearchAgain)); - m_pbApproxSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings)); - m_aSoundsLikeCJKSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings)); - - m_lbPosition.SetSelectHdl(LINK(this, FmSearchDialog, OnPositionSelected)); - m_lbField.SetSelectHdl(LINK(this, FmSearchDialog, OnFieldSelected)); - - m_cmbSearchText.SetModifyHdl(LINK(this, FmSearchDialog, OnSearchTextModified)); - m_cmbSearchText.EnableAutocomplete(sal_False); - - m_cbUseFormat.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbBackwards.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbStartOver.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbCase.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbWildCard.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbRegular.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbApprox.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_aHalfFullFormsCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_aSoundsLikeCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - - // fill the listboxes - // method of field comparison - sal_uInt16 nResIds[] = { - RID_STR_SEARCH_ANYWHERE, - RID_STR_SEARCH_BEGINNING, - RID_STR_SEARCH_END, - RID_STR_SEARCH_WHOLE - }; - for ( size_t i=0; i<SAL_N_ELEMENTS(nResIds); ++i ) - m_lbPosition.InsertEntry( String( CUI_RES( nResIds[i] ) ) ); - m_lbPosition.SelectEntryPos(MATCHING_ANYWHERE); - - // the field listbox - for (sal_uInt16 i=0; i<strVisibleFields.GetTokenCount(';'); ++i) - m_lbField.InsertEntry(strVisibleFields.GetToken(i, ';')); - - - m_pConfig = new FmSearchConfigItem; - LoadParams(); - - m_cmbSearchText.SetText(sInitialText); - // if the Edit-line has changed the text (e.g. because it contains - // control characters, as can be the case with memo fields), I use - // an empty UniString. - UniString sRealSetText = m_cmbSearchText.GetText(); - if (!sRealSetText.Equals(sInitialText)) - m_cmbSearchText.SetText(UniString()); - LINK(this, FmSearchDialog, OnSearchTextModified).Call(&m_cmbSearchText); - - // initial - m_aDelayedPaint.SetTimeoutHdl(LINK(this, FmSearchDialog, OnDelayedPaint)); - m_aDelayedPaint.SetTimeout(500); - EnableSearchUI(sal_True); - - if ( m_rbSearchForText.IsChecked() ) - m_cmbSearchText.GrabFocus(); - - FreeResource(); -} - -//------------------------------------------------------------------------ -sal_Bool FmSearchDialog::Close() -{ - // If the close button is disabled and ESC is pressed in a dialog, - // then Frame will call Close anyway, which I don't want to happen - // while I'm in the middle of a search (maybe one that's running - // in its own thread) - if (!m_pbClose.IsEnabled()) - return sal_False; - return ModalDialog::Close(); -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnClickedFieldRadios, Button*, pButton) -{ - if ((pButton == &m_rbSearchForText) || (pButton == &m_rbSearchForNull) || (pButton == &m_rbSearchForNotNull)) - { - EnableSearchForDependees(sal_True); - } - else - // en- or disable field list box accordingly - if (pButton == &m_rbSingleField) - { - m_lbField.Enable(); - m_pSearchEngine->RebuildUsedFields(m_lbField.GetSelectEntryPos()); - } - else - { - m_lbField.Disable(); - m_pSearchEngine->RebuildUsedFields(-1); - } - - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnClickedSearchAgain, Button*, EMPTYARG) -{ - if (m_pbClose.IsEnabled()) - { // der Button hat die Funktion 'Suchen' - UniString strThisRoundText = m_cmbSearchText.GetText(); - // zur History dazu - m_cmbSearchText.RemoveEntry(strThisRoundText); - m_cmbSearchText.InsertEntry(strThisRoundText, 0); - // das Remove/Insert stellt a) sicher, dass der UniString nicht zweimal auftaucht, b), dass die zuletzt gesuchten Strings am - // Anfang stehen - // und die Listenlaenge beschraenken - while (m_cmbSearchText.GetEntryCount() > MAX_HISTORY_ENTRIES) - m_cmbSearchText.RemoveEntry(m_cmbSearchText.GetEntryCount()-1); - - // den 'Ueberlauf'-Hint rausnehmen - m_ftHint.SetText(UniString()); - m_ftHint.Invalidate(); - - if (m_cbStartOver.IsChecked()) - { - m_cbStartOver.Check(sal_False); - EnableSearchUI(sal_False); - if (m_rbSearchForText.IsChecked()) - m_pSearchEngine->StartOver(strThisRoundText); - else - m_pSearchEngine->StartOverSpecial(m_rbSearchForNull.IsChecked()); - } - else - { - EnableSearchUI(sal_False); - if (m_rbSearchForText.IsChecked()) - m_pSearchEngine->SearchNext(strThisRoundText); - else - m_pSearchEngine->SearchNextSpecial(m_rbSearchForNull.IsChecked()); - } - } - else - { // der Button hat die Fukntion 'Abbrechen' - DBG_ASSERT(m_pSearchEngine->GetSearchMode() != SM_BRUTE, "FmSearchDialog, OnClickedSearchAgain : falscher Modus !"); - // der CancelButton wird normalerweise nur disabled, wenn ich in einem Thread oder mit Reschedule arbeite - m_pSearchEngine->CancelSearch(); - // mein ProgressHandler wird gerufen, wenn es wirklich zu Ende ist, das hier war nur eine Anforderung - } - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton ) -{ - if (&m_pbApproxSettings == pButton) - { - AbstractSvxSearchSimilarityDialog* pDlg = NULL; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - pDlg = pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(), - m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ); - DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" ); - - if ( pDlg && pDlg->Execute() == RET_OK ) - { - m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() ); - m_pSearchEngine->SetLevOther( pDlg->GetOther() ); - m_pSearchEngine->SetLevShorter(pDlg->GetShorter() ); - m_pSearchEngine->SetLevLonger( pDlg->GetLonger() ); - } - delete pDlg; - } - else if (&m_aSoundsLikeCJKSettings == pButton) - { - SfxItemSet aSet( SFX_APP()->GetPool() ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() ); - DBG_ASSERT(aDlg, "Dialogdiet fail!"); - aDlg->Execute(); - - - sal_Int32 nFlags = aDlg->GetTransliterationFlags(); - m_pSearchEngine->SetTransliterationFlags(nFlags); - - m_cbCase.Check(m_pSearchEngine->GetCaseSensitive()); - OnCheckBoxToggled( &m_cbCase ); - m_aHalfFullFormsCJK.Check( !m_pSearchEngine->GetIgnoreWidthCJK() ); - OnCheckBoxToggled( &m_aHalfFullFormsCJK ); - delete aDlg; - } - } - - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnSearchTextModified, ComboBox*, EMPTYARG) -{ - if ((m_cmbSearchText.GetText().Len() != 0) || !m_rbSearchForText.IsChecked()) - m_pbSearchAgain.Enable(); - else - m_pbSearchAgain.Disable(); - - m_pSearchEngine->InvalidatePreviousLoc(); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnPositionSelected, ListBox*, pBox) -{ - (void) pBox; // avoid warning - DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnMethodSelected : unerwartet : nicht genau ein Eintrag selektiert !"); - - m_pSearchEngine->SetPosition(m_lbPosition.GetSelectEntryPos()); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnFieldSelected, ListBox*, pBox) -{ - (void) pBox; // avoid warning - DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnFieldSelected : unerwartet : nicht genau ein Eintrag selektiert !"); - - m_pSearchEngine->RebuildUsedFields(m_rbAllFields.IsChecked() ? -1 : (sal_Int16)m_lbField.GetSelectEntryPos()); - // ruft auch m_pSearchEngine->InvalidatePreviousLoc auf - - sal_Int32 nCurrentContext = m_lbForm.GetSelectEntryPos(); - if (nCurrentContext != LISTBOX_ENTRY_NOTFOUND) - m_arrContextFields[nCurrentContext] = UniString(m_lbField.GetSelectEntry()); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox) -{ - sal_Bool bChecked = pBox->IsChecked(); - - // Formatter oder case -> an die Engine weiterreichen - if (pBox == &m_cbUseFormat) - m_pSearchEngine->SetFormatterUsing(bChecked); - else if (pBox == &m_cbCase) - m_pSearchEngine->SetCaseSensitive(bChecked); - // Richtung -> weiterreichen und Checkbox-Text fuer StartOver neu setzen - else if (pBox == &m_cbBackwards) - { - m_cbStartOver.SetText( String( CUI_RES( bChecked ? RID_STR_FROM_BOTTOM : RID_STR_FROM_TOP ) ) ); - m_pSearchEngine->SetDirection(!bChecked); - } - // Aehnlichkeitssuche oder regulaerer Ausdruck - else if ((pBox == &m_cbApprox) || (pBox == &m_cbRegular) || (pBox == &m_cbWildCard)) - { - // die beiden jeweils anderen Boxes disablen oder enablen - CheckBox* pBoxes[] = { &m_cbWildCard, &m_cbRegular, &m_cbApprox }; - for (sal_uInt32 i=0; i< SAL_N_ELEMENTS(pBoxes); ++i) - { - if (pBoxes[i] != pBox) - { - if (bChecked) - pBoxes[i]->Disable(); - else - pBoxes[i]->Enable(); - } - } - - // an die Engine weiterreichen - m_pSearchEngine->SetWildcard(m_cbWildCard.IsEnabled() ? m_cbWildCard.IsChecked() : sal_False); - m_pSearchEngine->SetRegular(m_cbRegular.IsEnabled() ? m_cbRegular.IsChecked() : sal_False); - m_pSearchEngine->SetLevenshtein(m_cbApprox.IsEnabled() ? m_cbApprox.IsChecked() : sal_False); - // (Boxes, die disabled sind, muessen als sal_False an die Engine gehen) - - // die Position-Listbox anpassen (ist bei Wildcard-Suche nicht erlaubt) - if (pBox == &m_cbWildCard) - { - if (bChecked) - { - m_ftPosition.Disable(); - m_lbPosition.Disable(); - } - else - { - m_ftPosition.Enable(); - m_lbPosition.Enable(); - } - } - - // und den Button fuer die Aehnlichkeitssuche - if (pBox == &m_cbApprox) - { - if (bChecked) - m_pbApproxSettings.Enable(); - else - m_pbApproxSettings.Disable(); - } - } - else if (pBox == &m_aHalfFullFormsCJK) - { - // forward to the search engine - m_pSearchEngine->SetIgnoreWidthCJK( !bChecked ); - } - else if (pBox == &m_aSoundsLikeCJK) - { - m_aSoundsLikeCJKSettings.Enable(bChecked); - - // two other buttons which depend on this one - sal_Bool bEnable = ( m_rbSearchForText.IsChecked() - && !m_aSoundsLikeCJK.IsChecked() - ) - || !SvtCJKOptions().IsJapaneseFindEnabled(); - m_cbCase.Enable(bEnable); - m_aHalfFullFormsCJK.Enable(bEnable); - - // forward to the search engine - m_pSearchEngine->SetTransliteration( bChecked ); - } - - return 0; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::InitContext(sal_Int16 nContext) -{ - FmSearchContext fmscContext; - fmscContext.nContext = nContext; - -#ifdef DBG_UTIL - sal_uInt32 nResult = -#endif - m_lnkContextSupplier.Call(&fmscContext); - DBG_ASSERT(nResult > 0, "FmSearchDialog::InitContext : ContextSupplier didn't give me any controls !"); - - // packen wir zuerst die Feld-Namen in die entsprechende Listbox - m_lbField.Clear(); - - if (fmscContext.sFieldDisplayNames.Len() != 0) - { - // use the display names if supplied - DBG_ASSERT(fmscContext.sFieldDisplayNames.GetTokenCount() == fmscContext.strUsedFields.GetTokenCount(), - "FmSearchDialog::InitContext : invalid context description supplied !"); - for (xub_StrLen i=0; i<fmscContext.sFieldDisplayNames.GetTokenCount(); ++i) - m_lbField.InsertEntry(fmscContext.sFieldDisplayNames.GetToken(i)); - } - else - // else use the field names - for (xub_StrLen i=0; i<fmscContext.strUsedFields.GetTokenCount(); ++i) - m_lbField.InsertEntry(fmscContext.strUsedFields.GetToken(i)); - - if (nContext < (sal_Int32)m_arrContextFields.size() && m_arrContextFields[nContext].Len()) - { - m_lbField.SelectEntry(m_arrContextFields[nContext]); - } - else - { - m_lbField.SelectEntryPos(0); - if (m_rbSingleField.IsChecked() && (m_lbField.GetEntryCount() > 1)) - m_lbField.GrabFocus(); - } - - // dann geben wir der Engine Bescheid - m_pSearchEngine->SwitchToContext(fmscContext.xCursor, fmscContext.strUsedFields, fmscContext.arrFields, - m_rbAllFields.IsChecked() ? -1 : 0); - - // und die Position des neuen Cursors anzeigen - m_ftRecord.SetText(String::CreateFromInt32(fmscContext.xCursor->getRow())); -} - -//------------------------------------------------------------------------ -IMPL_LINK( FmSearchDialog, OnContextSelection, ListBox*, pBox) -{ - InitContext(pBox->GetSelectEntryPos()); - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableSearchUI(sal_Bool bEnable) -{ - // wenn die Controls disabled werden sollen, schalte ich mal eben kurz ihr Paint aus und verzoegert wieder an - if (!bEnable) - EnableControlPaint(sal_False); - else - { // beim Enablen teste ich, ob der Timer fuer das delayed paint aktiv ist und stoppe ihn wenn noetig - if (m_aDelayedPaint.IsActive()) - m_aDelayedPaint.Stop(); - } - // (das ganze geht unten noch weiter) - // diese kleine Verrenkung fuehrt hoffentlich dazu, dass es nicht flackert, wenn man die SearchUI schnell hintereinander - // aus- und wieder einschaltet (wie das bei einem kurzen Suchvorgang zwangslaeufig der Fall ist) - - if ( !bEnable ) - { - // if one of my children has the focus, remember it - Window* pFocusWindow = Application::GetFocusWindow( ); - if ( pFocusWindow && IsChild( pFocusWindow ) ) - m_pPreSearchFocus = pFocusWindow; - else - m_pPreSearchFocus = NULL; - } - - // der Suchen-Button hat einen Doppelfunktion, seinen Text entsprechend anpassen - String sButtonText( bEnable ? m_sSearch : m_sCancel ); - m_pbSearchAgain.SetText( sButtonText ); - - // jetzt Controls en- oder disablen - if (m_pSearchEngine->GetSearchMode() != SM_BRUTE) - { - m_flSearchFor.Enable (bEnable); - m_rbSearchForText.Enable (bEnable); - m_rbSearchForNull.Enable (bEnable); - m_rbSearchForNotNull.Enable (bEnable); - m_flWhere.Enable (bEnable); - m_ftForm.Enable (bEnable); - m_lbForm.Enable (bEnable); - m_rbAllFields.Enable (bEnable); - m_rbSingleField.Enable (bEnable); - m_lbField.Enable (bEnable && m_rbSingleField.IsChecked()); - m_flOptions.Enable (bEnable); - m_cbBackwards.Enable (bEnable); - m_cbStartOver.Enable (bEnable); - m_pbClose.Enable (bEnable); - EnableSearchForDependees (bEnable); - - if ( !bEnable ) - { // this means we're preparing for starting a search - // In this case, EnableSearchForDependees disabled the search button - // But as we're about to use it for cancelling the search, we really need to enable it, again - m_pbSearchAgain.Enable( sal_True ); - } - } - - // und den Rest fuer das delayed paint - if (!bEnable) - m_aDelayedPaint.Start(); - else - EnableControlPaint(sal_True); - - if ( bEnable ) - { // restore focus - if ( m_pPreSearchFocus ) - { - m_pPreSearchFocus->GrabFocus(); - if ( WINDOW_EDIT == m_pPreSearchFocus->GetType() ) - { - Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus ); - pEdit->SetSelection( Selection( 0, pEdit->GetText().Len() ) ); - } - } - m_pPreSearchFocus = NULL; - } - -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableSearchForDependees(sal_Bool bEnable) -{ - sal_Bool bSearchingForText = m_rbSearchForText.IsChecked(); - m_pbSearchAgain.Enable(bEnable && (!bSearchingForText || (m_cmbSearchText.GetText().Len() != 0))); - - bEnable = bEnable && bSearchingForText; - - sal_Bool bEnableRedundants = !m_aSoundsLikeCJK.IsChecked() || !SvtCJKOptions().IsJapaneseFindEnabled(); - - m_cmbSearchText.Enable (bEnable); - m_ftPosition.Enable (bEnable && !m_cbWildCard.IsChecked()); - m_cbWildCard.Enable (bEnable && !m_cbRegular.IsChecked() && !m_cbApprox.IsChecked()); - m_cbRegular.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbApprox.IsChecked()); - m_cbApprox.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbRegular.IsChecked()); - m_pbApproxSettings.Enable (bEnable && m_cbApprox.IsChecked()); - m_aHalfFullFormsCJK.Enable (bEnable && bEnableRedundants); - m_aSoundsLikeCJK.Enable (bEnable); - m_aSoundsLikeCJKSettings.Enable (bEnable && m_aSoundsLikeCJK.IsChecked()); - m_lbPosition.Enable (bEnable && !m_cbWildCard.IsChecked()); - m_cbUseFormat.Enable (bEnable); - m_cbCase.Enable (bEnable && bEnableRedundants); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableControlPaint(sal_Bool bEnable) -{ - Control* pAffectedControls[] = { &m_flSearchFor, &m_rbSearchForText, &m_cmbSearchText, &m_rbSearchForNull, &m_rbSearchForNotNull, - &m_rbSearchForText, &m_flWhere, &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition, - &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox, &m_pbApproxSettings, - &m_pbSearchAgain, &m_pbClose }; - - if (!bEnable) - for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i) - { - pAffectedControls[i]->SetUpdateMode(bEnable); - pAffectedControls[i]->EnablePaint(bEnable); - } - else - for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(pAffectedControls); ++i) - { - pAffectedControls[i]->EnablePaint(bEnable); - pAffectedControls[i]->SetUpdateMode(bEnable); - } -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnDelayedPaint, void*, EMPTYARG) -{ - EnableControlPaint(sal_True); - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos) -{ - FmFoundRecordInformation friInfo; - friInfo.nContext = m_lbForm.GetSelectEntryPos(); - // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal - friInfo.aPosition = aCursorPos; - if (m_rbAllFields.IsChecked()) - friInfo.nFieldPos = nFieldPos; - else - friInfo.nFieldPos = m_lbField.GetSelectEntryPos(); - // das setzt natuerlich voraus, dass ich wirklich in dem Feld gesucht habe, dass in der Listbox ausgewaehlt ist, - // genau das wird auch in RebuildUsedFields sichergestellt - - // dem Handler Bescheid sagen - m_lnkFoundHandler.Call(&friInfo); - - // und wieder Focus auf mich - m_cmbSearchText.GrabFocus(); -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnSearchProgress, FmSearchProgress*, pProgress) -{ - SolarMutexGuard aGuard; - // diese eine Methode Thread-sicher machen (das ist ein Overkill, die ganze restliche Applikation dafuer zu blockieren, - // aber im Augenblick haben wir kein anderes Sicherheitskonpzept) - - switch (pProgress->aSearchState) - { - case FmSearchProgress::STATE_PROGRESS: - if (pProgress->bOverflow) - { - String sHint( CUI_RES( m_cbBackwards.IsChecked() ? RID_STR_OVERFLOW_BACKWARD : RID_STR_OVERFLOW_FORWARD ) ); - m_ftHint.SetText( sHint ); - m_ftHint.Invalidate(); - } - - m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord)); - m_ftRecord.Invalidate(); - break; - - case FmSearchProgress::STATE_PROGRESS_COUNTING: - m_ftHint.SetText(CUI_RESSTR(RID_STR_SEARCH_COUNTING)); - m_ftHint.Invalidate(); - - m_ftRecord.SetText(String::CreateFromInt32(pProgress->nCurrentRecord)); - m_ftRecord.Invalidate(); - break; - - case FmSearchProgress::STATE_SUCCESSFULL: - OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex); - EnableSearchUI(sal_True); - break; - - case FmSearchProgress::STATE_ERROR: - case FmSearchProgress::STATE_NOTHINGFOUND: - { - sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == pProgress->aSearchState) - ? RID_SVXERR_SEARCH_GENERAL_ERROR - : RID_SVXERR_SEARCH_NORECORD; - ErrorBox(this, CUI_RES(nErrorId)).Execute(); - } - // NO break ! - case FmSearchProgress::STATE_CANCELED: - EnableSearchUI(sal_True); - if (m_lnkCanceledNotFoundHdl.IsSet()) - { - FmFoundRecordInformation friInfo; - friInfo.nContext = m_lbForm.GetSelectEntryPos(); - // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal - friInfo.aPosition = pProgress->aBookmark; - m_lnkCanceledNotFoundHdl.Call(&friInfo); - } - break; - } - - m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord)); - - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::LoadParams() -{ - FmSearchParams aParams(m_pConfig->getParams()); - - const ::rtl::OUString* pHistory = aParams.aHistory.getConstArray(); - const ::rtl::OUString* pHistoryEnd = pHistory + aParams.aHistory.getLength(); - for (; pHistory != pHistoryEnd; ++pHistory) - m_cmbSearchText.InsertEntry( *pHistory ); - - // die Einstellungen nehme ich an meinen UI-Elementen vor und rufe dann einfach den entsprechenden Change-Handler auf, - // dadurch werden die Daten an die SearchEngine weitergereicht und alle abhaengigen Enstellungen vorgenommen - - // aktuelles Feld - sal_uInt16 nInitialField = m_lbField.GetEntryPos( String( aParams.sSingleSearchField ) ); - if (nInitialField == COMBOBOX_ENTRY_NOTFOUND) - nInitialField = 0; - m_lbField.SelectEntryPos(nInitialField); - LINK(this, FmSearchDialog, OnFieldSelected).Call(&m_lbField); - // alle/einzelnes Feld (NACH dem Selektieren des Feldes, da OnClickedFieldRadios dort einen gueltigen Eintrag erwartet) - if (aParams.bAllFields) - { - m_rbSingleField.Check(sal_False); - m_rbAllFields.Check(sal_True); - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbAllFields); - // OnClickedFieldRadios ruft auch um RebuildUsedFields - } - else - { - m_rbAllFields.Check(sal_False); - m_rbSingleField.Check(sal_True); - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSingleField); - } - - // Position im Feld - m_lbPosition.SelectEntryPos(aParams.nPosition); - LINK(this, FmSearchDialog, OnPositionSelected).Call(&m_lbPosition); - - // Feld-Formatierung/Case-Sensitivitaet/Richtung - m_cbUseFormat.Check(aParams.bUseFormatter); - m_cbCase.Check( aParams.isCaseSensitive() ); - m_cbBackwards.Check(aParams.bBackwards); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbUseFormat); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbCase); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbBackwards); - - m_aHalfFullFormsCJK.Check( !aParams.isIgnoreWidthCJK( ) ); // BEWARE: this checkbox has a inverse semantics! - m_aSoundsLikeCJK.Check( aParams.bSoundsLikeCJK ); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aHalfFullFormsCJK); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aSoundsLikeCJK); - - // die drei Checkboxen fuer spezielle Sucharten - // erst mal alle ruecksetzen - m_cbWildCard.Check(sal_False); - m_cbRegular.Check(sal_False); - m_cbApprox.Check(sal_False); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbWildCard); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbRegular); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbApprox); - - // dann die richtige setzen - CheckBox* pToCheck = NULL; - if (aParams.bWildcard) - pToCheck = &m_cbWildCard; - if (aParams.bRegular) - pToCheck = &m_cbRegular; - if (aParams.bApproxSearch) - pToCheck = &m_cbApprox; - if (aParams.bSoundsLikeCJK) - pToCheck = &m_aSoundsLikeCJK; - if (pToCheck) - { - pToCheck->Check(sal_True); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(pToCheck); - } - - // die Levenshtein-Parameter direkt an der SearchEngine setzen - m_pSearchEngine->SetLevRelaxed(aParams.bLevRelaxed); - m_pSearchEngine->SetLevOther(aParams.nLevOther); - m_pSearchEngine->SetLevShorter(aParams.nLevShorter); - m_pSearchEngine->SetLevLonger(aParams.nLevLonger); - - m_pSearchEngine->SetTransliterationFlags( aParams.getTransliterationFlags( ) ); - - m_rbSearchForText.Check(sal_False); - m_rbSearchForNull.Check(sal_False); - m_rbSearchForNotNull.Check(sal_False); - switch (aParams.nSearchForType) - { - case 1: m_rbSearchForNull.Check(sal_True); break; - case 2: m_rbSearchForNotNull.Check(sal_True); break; - default: m_rbSearchForText.Check(sal_True); break; - } - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSearchForText); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::SaveParams() const -{ - if (!m_pConfig) - return; - - FmSearchParams aCurrentSettings; - - aCurrentSettings.aHistory.realloc( m_cmbSearchText.GetEntryCount() ); - ::rtl::OUString* pHistory = aCurrentSettings.aHistory.getArray(); - for (sal_uInt16 i=0; i<m_cmbSearchText.GetEntryCount(); ++i, ++pHistory) - *pHistory = m_cmbSearchText.GetEntry(i); - - aCurrentSettings.sSingleSearchField = m_lbField.GetSelectEntry(); - aCurrentSettings.bAllFields = m_rbAllFields.IsChecked(); - aCurrentSettings.nPosition = m_pSearchEngine->GetPosition(); - aCurrentSettings.bUseFormatter = m_pSearchEngine->GetFormatterUsing(); - aCurrentSettings.setCaseSensitive ( m_pSearchEngine->GetCaseSensitive() ); - aCurrentSettings.bBackwards = !m_pSearchEngine->GetDirection(); - aCurrentSettings.bWildcard = m_pSearchEngine->GetWildcard(); - aCurrentSettings.bRegular = m_pSearchEngine->GetRegular(); - aCurrentSettings.bApproxSearch = m_pSearchEngine->GetLevenshtein(); - aCurrentSettings.bLevRelaxed = m_pSearchEngine->GetLevRelaxed(); - aCurrentSettings.nLevOther = m_pSearchEngine->GetLevOther(); - aCurrentSettings.nLevShorter = m_pSearchEngine->GetLevShorter(); - aCurrentSettings.nLevLonger = m_pSearchEngine->GetLevLonger(); - - aCurrentSettings.bSoundsLikeCJK = m_pSearchEngine->GetTransliteration(); - aCurrentSettings.setTransliterationFlags ( m_pSearchEngine->GetTransliterationFlags() ); - - if (m_rbSearchForNull.IsChecked()) - aCurrentSettings.nSearchForType = 1; - else if (m_rbSearchForNotNull.IsChecked()) - aCurrentSettings.nSearchForType = 2; - else - aCurrentSettings.nSearchForType = 0; - - m_pConfig->setParams( aCurrentSettings ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx deleted file mode 100644 index c09912899..000000000 --- a/cui/source/dialogs/cuigaldlg.cxx +++ /dev/null @@ -1,1300 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <algorithm> -#include <ucbhelper/content.hxx> -#include <osl/mutex.hxx> -#include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> -#include <avmedia/mediawindow.hxx> -#include <unotools/pathoptions.hxx> -#include <sfx2/opengrf.hxx> -#include <svtools/filter.hxx> -#include <svx/gallery1.hxx> -#include <svx/galtheme.hxx> -#include "cuigaldlg.hxx" -#include "helpid.hrc" -#include <unotools/syslocale.hxx> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/ucb/XContentAccess.hpp> -#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> -#include <sfx2/sfxuno.hxx> -#include "dialmgr.hxx" -#include "gallery.hrc" -#include <svx/dialogs.hrc> -#include <svx/dialmgr.hxx> - - -// -------------- -// - Namespaces - -// -------------- - -using namespace ::ucbhelper; -using namespace ::rtl; -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - - -// ----------- -// - Defines - -// ----------- - -#define MAXPATH 1024 - -// ---------------- -// - SearchThread - -// ---------------- - -SearchThread::SearchThread( SearchProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - const INetURLObject& rStartURL ) : - mpProgress ( pProgess ), - mpBrowser ( pBrowser ), - maStartURL ( rStartURL ) -{ -} - -// ------------------------------------------------------------------------ - -SearchThread::~SearchThread() -{ -} - -// ------------------------------------------------------------------------ - -void SAL_CALL SearchThread::run() -{ - const String aFileType( mpBrowser->aCbbFileType.GetText() ); - - if( aFileType.Len() ) - { - const sal_uInt16 nFileNumber = mpBrowser->aCbbFileType.GetEntryPos( aFileType ); - sal_uInt16 nBeginFormat, nEndFormat; - ::std::vector< String > aFormats; - - if( !nFileNumber || ( nFileNumber >= mpBrowser->aCbbFileType.GetEntryCount() ) ) - { - nBeginFormat = 1; - nEndFormat = mpBrowser->aCbbFileType.GetEntryCount() - 1; - } - else - nBeginFormat = nEndFormat = nFileNumber; - - for( sal_uInt16 i = nBeginFormat; i <= nEndFormat; ++i ) - aFormats.push_back( mpBrowser->aFilterEntryList[ i ]->aFilterName.ToLowerAscii() ); - - ImplSearch( maStartURL, aFormats, mpBrowser->bSearchRecursive ); - } -} - -// ------------------------------------------------------------------------ - -void SAL_CALL SearchThread::onTerminated() -{ - Application::PostUserEvent( LINK( mpProgress, SearchProgress, CleanUpHdl ) ); -} - -// ------------------------------------------------------------------------ - -void SearchThread::ImplSearch( const INetURLObject& rStartURL, - const ::std::vector< String >& rFormats, - sal_Bool bRecursive ) -{ - { - SolarMutexGuard aGuard; - - mpProgress->SetDirectory( rStartURL ); - mpProgress->Sync(); - } - - try - { - ::com::sun::star::uno::Reference< XCommandEnvironment > xEnv; - Content aCnt( rStartURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv ); - Sequence< OUString > aProps( 2 ); - - aProps.getArray()[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( "IsFolder" )); - aProps.getArray()[ 1 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( "IsDocument" )); - ::com::sun::star::uno::Reference< XResultSet > xResultSet( - aCnt.createCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS ) ); - - if( xResultSet.is() ) - { - ::com::sun::star::uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY_THROW ); - ::com::sun::star::uno::Reference< XRow > xRow( xResultSet, UNO_QUERY_THROW ); - - while( xResultSet->next() && schedule() ) - { - INetURLObject aFoundURL( xContentAccess->queryContentIdentifierString() ); - DBG_ASSERT( aFoundURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - sal_Bool bFolder = xRow->getBoolean( 1 ); // property "IsFolder" - if ( xRow->wasNull() ) - bFolder = sal_False; - - if( bRecursive && bFolder ) - ImplSearch( aFoundURL, rFormats, sal_True ); - else - { - sal_Bool bDocument = xRow->getBoolean( 2 ); // property "IsDocument" - if ( xRow->wasNull() ) - bDocument = sal_False; - - if( bDocument ) - { - GraphicDescriptor aDesc( aFoundURL ); - String aFileName; - - if( ( aDesc.Detect() && - ::std::find( rFormats.begin(), - rFormats.end(), - aDesc.GetImportFormatShortName( - aDesc.GetFileFormat() ).ToLowerAscii() ) - != rFormats.end() ) || - ::std::find( rFormats.begin(), - rFormats.end(), - String(aFoundURL.GetExtension().toAsciiLowerCase()) ) - != rFormats.end() ) - { - SolarMutexGuard aGuard; - - mpBrowser->aFoundList.push_back( - new String( aFoundURL.GetMainURL( INetURLObject::NO_DECODE ) ) - ); - mpBrowser->aLbxFound.InsertEntry( - GetReducedString( aFoundURL, 50 ), - (sal_uInt16) mpBrowser->aFoundList.size() - 1 ); - } - } - } - } - } - } - catch (const ContentCreationException&) - { - } - catch (const ::com::sun::star::uno::RuntimeException&) - { - } - catch (const ::com::sun::star::uno::Exception&) - { - } -} - -// ------------------ -// - SearchProgress - -// ------------------ - -SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL ) : - ModalDialog ( pParent, CUI_RES(RID_SVXDLG_GALLERY_SEARCH_PROGRESS ) ), - aFtSearchDir ( this, CUI_RES( FT_SEARCH_DIR ) ), - aFLSearchDir ( this, CUI_RES( FL_SEARCH_DIR ) ), - aFtSearchType ( this, CUI_RES( FT_SEARCH_TYPE ) ), - aFLSearchType ( this, CUI_RES( FL_SEARCH_TYPE ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maSearchThread ( this, (TPGalleryThemeProperties*) pParent, rStartURL ) -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, SearchProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - -void SearchProgress::Terminate() -{ - maSearchThread.terminate(); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( SearchProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - Terminate(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( SearchProgress, CleanUpHdl, void*, EMPTYARG ) -{ - EndDialog( RET_OK ); - delete this; - return 0L; -} - -// ------------------------------------------------------------------------ - -short SearchProgress::Execute() -{ - OSL_FAIL( "SearchProgress cannot be executed via Dialog::Execute!\n" - "It creates a thread that will call back to VCL apartment => deadlock!\n" - "Use Dialog::StartExecuteModal to execute the dialog!" ); - return RET_CANCEL; -} - -// ------------------------------------------------------------------------ - -void SearchProgress::StartExecuteModal( const Link& rEndDialogHdl ) -{ - maSearchThread.create(); - ModalDialog::StartExecuteModal( rEndDialogHdl ); -} - -// -------------- -// - TakeThread - -// -------------- - -TakeThread::TakeThread( - TakeProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - TokenList_impl& rTakenList -) : - mpProgress ( pProgess ), - mpBrowser ( pBrowser ), - mrTakenList ( rTakenList ) -{ -} - -// ------------------------------------------------------------------------ - -TakeThread::~TakeThread() -{ -} - -// ------------------------------------------------------------------------ - -void SAL_CALL TakeThread::run() -{ - String aName; - INetURLObject aURL; - sal_uInt16 nEntries; - GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme; - sal_uInt16 nPos; - GalleryProgress* pStatusProgress; - - { - SolarMutexGuard aGuard; - pStatusProgress = new GalleryProgress; - nEntries = mpBrowser->bTakeAll ? mpBrowser->aLbxFound.GetEntryCount() : mpBrowser->aLbxFound.GetSelectEntryCount(); - pThm->LockBroadcaster(); - } - - for( sal_uInt16 i = 0; i < nEntries && schedule(); i++ ) - { - // kompletten Filenamen aus FoundList holen - if( mpBrowser->bTakeAll ) - aURL = INetURLObject( *mpBrowser->aFoundList[ nPos = i ] ); - else - aURL = INetURLObject(*mpBrowser->aFoundList[ nPos = mpBrowser->aLbxFound.GetSelectEntryPos( i ) ]); - - // Position in Taken-Liste uebernehmen - mrTakenList.push_back( (sal_uLong)nPos ); - - { - SolarMutexGuard aGuard; - - mpProgress->SetFile( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - pStatusProgress->Update( i, nEntries - 1 ); - mpProgress->Sync(); - pThm->InsertURL( aURL ); - } - } - - { - SolarMutexGuard aGuard; - - pThm->UnlockBroadcaster(); - delete pStatusProgress; - } -} - -// ------------------------------------------------------------------------ - -void SAL_CALL TakeThread::onTerminated() -{ - Application::PostUserEvent( LINK( mpProgress, TakeProgress, CleanUpHdl ) ); -} - -// ---------------- -// - TakeProgress - -// ---------------- - -TakeProgress::TakeProgress( Window* pWindow ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_GALLERY_TAKE_PROGRESS ) ), - aFtTakeFile ( this, CUI_RES( FT_TAKE_FILE ) ), - aFLTakeProgress( this, CUI_RES( FL_TAKE_PROGRESS ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maTakeThread ( this, (TPGalleryThemeProperties*) pWindow, maTakenList ) - -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, TakeProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - - -void TakeProgress::Terminate() -{ - maTakeThread.terminate(); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TakeProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - Terminate(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TakeProgress, CleanUpHdl, void*, EMPTYARG ) -{ - TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent(); - ::std::vector<bool, std::allocator<bool> > aRemoveEntries( mpBrowser->aFoundList.size(), false ); - ::std::vector< String > aRemainingVector; - sal_uInt32 i, nCount; - - GetParent()->EnterWait(); - mpBrowser->aLbxFound.SetUpdateMode( sal_False ); - mpBrowser->aLbxFound.SetNoSelection(); - - // mark all taken positions in aRemoveEntries - for( i = 0, nCount = maTakenList.size(); i < nCount; ++i ) - aRemoveEntries[ maTakenList[ i ] ] = true; - maTakenList.clear(); - - // refill found list - for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) - if( !aRemoveEntries[ i ] ) - aRemainingVector.push_back( *mpBrowser->aFoundList[ i ] ); - - for ( i = 0, nCount = mpBrowser->aFoundList.size(); i < nCount; ++i ) - delete mpBrowser->aFoundList[ i ]; - mpBrowser->aFoundList.clear(); - - for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i ) - mpBrowser->aFoundList.push_back( new String( aRemainingVector[ i ] ) ); - - aRemainingVector.clear(); - - // refill list box - for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) - if( !aRemoveEntries[ i ] ) - aRemainingVector.push_back( mpBrowser->aLbxFound.GetEntry( (sal_uInt16) i ) ); - - mpBrowser->aLbxFound.Clear(); - - for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i ) - mpBrowser->aLbxFound.InsertEntry( aRemainingVector[ i ] ); - - aRemainingVector.clear(); - - mpBrowser->aLbxFound.SetUpdateMode( sal_True ); - mpBrowser->SelectFoundHdl( NULL ); - GetParent()->LeaveWait(); - - EndDialog( RET_OK ); - delete this; - return 0L; -} - -// ------------------------------------------------------------------------ - -short TakeProgress::Execute() -{ - OSL_FAIL( "TakeProgress cannot be executed via Dialog::Execute!\n" - "It creates a thread that will call back to VCL apartment => deadlock!\n" - "Use Dialog::StartExecuteModal to execute the dialog!" ); - return RET_CANCEL; -} - -// ------------------------------------------------------------------------ - -void TakeProgress::StartExecuteModal( const Link& rEndDialogHdl ) -{ - maTakeThread.create(); - ModalDialog::StartExecuteModal( rEndDialogHdl ); -} - -// --------------------- -// - ActualizeProgress - -// --------------------- - -ActualizeProgress::ActualizeProgress( Window* pWindow, GalleryTheme* pThm ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS ) ), - aFtActualizeFile ( this, CUI_RES( FT_ACTUALIZE_FILE ) ), - aFLActualizeProgress ( this, CUI_RES( FL_ACTUALIZE_PROGRESS ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - pTheme ( pThm ) -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, ActualizeProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - -short ActualizeProgress::Execute() -{ - short nRet; - - pTimer = new Timer; - - if ( pTimer ) - { - pTimer->SetTimeoutHdl( LINK( this, ActualizeProgress, TimeoutHdl ) ); - pTimer->SetTimeout( 500 ); - pTimer->Start(); - } - - nRet = ModalDialog::Execute(); - - return nRet; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - pTheme->AbortActualize(); - EndDialog( RET_OK ); - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, TimeoutHdl, Timer*, _pTimer ) -{ - if ( _pTimer ) - { - _pTimer->Stop(); - delete _pTimer; - } - - pTheme->Actualize( LINK( this, ActualizeProgress, ActualizeHdl ), &aStatusProgress ); - ClickCancelBtn( NULL ); - - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, ActualizeHdl, INetURLObject*, pURL ) -{ - for( long i = 0; i < 128; i++ ) - Application::Reschedule(); - - Flush(); - Sync(); - - if( pURL ) - { - aFtActualizeFile.SetText( GetReducedString( *pURL, 30 ) ); - aFtActualizeFile.Flush(); - aFtActualizeFile.Sync(); - } - - return 0; -} - -// --------------- -// - TitleDialog - -// --------------- - -TitleDialog::TitleDialog( Window* pParent, const String& rOldTitle ) : - ModalDialog ( pParent, CUI_RES( RID_SVXDLG_GALLERY_TITLE ) ), - maOk ( this, CUI_RES( BTN_OK ) ), - maCancel ( this, CUI_RES( BTN_CANCEL ) ), - maHelp ( this, CUI_RES( BTN_HELP ) ), - maFL ( this, CUI_RES( FL_TITLE ) ), - maEdit ( this, CUI_RES( EDT_TITLE ) ) -{ - FreeResource(); - maEdit.SetText( rOldTitle ); - maEdit.GrabFocus(); -} - -// ------------------- -// - GalleryIdDialog - -// ------------------- - -GalleryIdDialog::GalleryIdDialog( Window* pParent, GalleryTheme* _pThm ) : - ModalDialog ( pParent, CUI_RES( RID_SVXDLG_GALLERY_THEMEID ) ), - aBtnOk ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aFLId ( this, CUI_RES( FL_ID ) ), - aLbResName ( this, CUI_RES( LB_RESNAME ) ), - pThm ( _pThm ) -{ - FreeResource(); - - aLbResName.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( "!!! No Id !!!" ) ) ); - - GalleryTheme::InsertAllThemes( aLbResName ); - - aLbResName.SelectEntryPos( (sal_uInt16) pThm->GetId() ); - aLbResName.GrabFocus(); - - aBtnOk.SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GalleryIdDialog, ClickOkHdl, void*, EMPTYARG ) -{ - Gallery* pGal = pThm->GetParent(); - const sal_uLong nId = GetId(); - sal_Bool bDifferentThemeExists = sal_False; - - for( sal_uLong i = 0, nCount = pGal->GetThemeCount(); i < nCount && !bDifferentThemeExists; i++ ) - { - const GalleryThemeEntry* pInfo = pGal->GetThemeInfo( i ); - - if( ( pInfo->GetId() == nId ) && ( pInfo->GetThemeName() != pThm->GetName() ) ) - { - String aStr( CUI_RES( RID_SVXSTR_GALLERY_ID_EXISTS ) ); - - aStr += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); - aStr += pInfo->GetThemeName(); - aStr += ')'; - - InfoBox aBox( this, aStr ); - aBox.Execute(); - aLbResName.GrabFocus(); - bDifferentThemeExists = sal_True; - } - } - - if( !bDifferentThemeExists ) - EndDialog( RET_OK ); - - return 0L; -} - - -// -------------------------- -// - GalleryThemeProperties - -// -------------------------- - -GalleryThemeProperties::GalleryThemeProperties( Window* pParent, ExchangeData* _pData, SfxItemSet* pItemSet ) : - SfxTabDialog ( pParent, CUI_RES( RID_SVXTABDLG_GALLERYTHEME ), pItemSet ), - pData ( _pData ) -{ - FreeResource(); - - AddTabPage( RID_SVXTABPAGE_GALLERY_GENERAL, TPGalleryThemeGeneral::Create, 0 ); - AddTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES, TPGalleryThemeProperties::Create, 0 ); - - if( pData->pTheme->IsReadOnly() ) - RemoveTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES ); - - String aText( GetText() ); - - aText += pData->pTheme->GetName(); - - if( pData->pTheme->IsReadOnly() ) - aText += String( CUI_RES( RID_SVXSTR_GALLERY_READONLY ) ); - - SetText( aText ); -} - -// ------------------------------------------------------------------------ - -void GalleryThemeProperties::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - if( RID_SVXTABPAGE_GALLERY_GENERAL == nId ) - ( (TPGalleryThemeGeneral&) rPage ).SetXChgData( pData ); - else - ( (TPGalleryThemeProperties&) rPage ).SetXChgData( pData ); -} - -// ------------------------- -// - TPGalleryThemeGeneral - -// ------------------------- - -TPGalleryThemeGeneral::TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage ( pParent, CUI_RES( RID_SVXTABPAGE_GALLERY_GENERAL ), rSet ), - aFiMSImage ( this, CUI_RES( FI_MS_IMAGE ) ), - aEdtMSName ( this, CUI_RES( EDT_MS_NAME ) ), - aFlMSGeneralFirst ( this, CUI_RES( FL_MS_GENERAL_FIRST ) ), - aFtMSType ( this, CUI_RES( FT_MS_TYPE ) ), - aFtMSShowType ( this, CUI_RES( FT_MS_SHOW_TYPE ) ), - aFtMSPath ( this, CUI_RES( FT_MS_PATH ) ), - aFtMSShowPath ( this, CUI_RES( FT_MS_SHOW_PATH ) ), - aFtMSContent ( this, CUI_RES( FT_MS_CONTENT ) ), - aFtMSShowContent ( this, CUI_RES( FT_MS_SHOW_CONTENT ) ), - aFlMSGeneralSecond ( this, CUI_RES( FL_MS_GENERAL_SECOND ) ), - aFtMSChangeDate ( this, CUI_RES( FT_MS_CHANGEDATE ) ), - aFtMSShowChangeDate ( this, CUI_RES( FT_MS_SHOW_CHANGEDATE ) ) -{ - FreeResource(); - - String aAccName(SVX_RES(RID_SVXSTR_GALLERY_THEMENAME)); - aEdtMSName.SetAccessibleName(aAccName); - aFiMSImage.SetAccessibleName(aAccName); - aEdtMSName.SetAccessibleRelationLabeledBy( &aFiMSImage ); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData ) -{ - pData = _pData; - - GalleryTheme* pThm = pData->pTheme; - String aOutStr( String::CreateFromInt32( pThm->GetObjectCount() ) ); - String aObjStr( CUI_RES( RID_SVXSTR_GALLERYPROPS_OBJECT ) ); - String aAccess; - String aType( SVX_RES( RID_SVXSTR_GALLERYPROPS_GALTHEME ) ); - sal_Bool bReadOnly = pThm->IsReadOnly() && !pThm->IsImported(); - - aEdtMSName.SetHelpId( HID_GALLERY_EDIT_MSNAME ); - aEdtMSName.SetText( pThm->GetName() ); - aEdtMSName.SetReadOnly( bReadOnly ); - - if( bReadOnly ) - aEdtMSName.Disable(); - else - aEdtMSName.Enable(); - - if( pThm->IsReadOnly() ) - aType += String( CUI_RES( RID_SVXSTR_GALLERY_READONLY ) ); - - aFtMSShowType.SetText( aType ); - aFtMSShowPath.SetText( pThm->GetSdgURL().GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - - // Ein- oder Mehrzahl? - if ( 1 == pThm->GetObjectCount() ) - aObjStr = aObjStr.GetToken( 0 ); - else - aObjStr = aObjStr.GetToken( 1 ); - - aOutStr += ' '; - aOutStr += aObjStr; - - aFtMSShowContent.SetText( aOutStr ); - - // get locale wrapper (singleton) - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& aLocaleData = aSysLocale.GetLocaleData(); - - // ChangeDate/Time - aAccess = aLocaleData.getDate( pData->aThemeChangeDate ); - aAccess += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - aAccess += aLocaleData.getTime( pData->aThemeChangeTime ); - aFtMSShowChangeDate.SetText( aAccess ); - - // Image setzen - sal_uInt16 nId; - - if( pThm->IsImported() ) - nId = RID_SVXBMP_THEME_IMPORTED_BIG; - else if( pThm->IsReadOnly() ) - nId = RID_SVXBMP_THEME_READONLY_BIG; - else if( pThm->IsDefault() ) - nId = RID_SVXBMP_THEME_DEFAULT_BIG; - else - nId = RID_SVXBMP_THEME_NORMAL_BIG; - - aFiMSImage.SetImage( Image( Bitmap( CUI_RES( nId ) ), COL_LIGHTMAGENTA ) ); -} - -// ------------------------------------------------------------------------ - -sal_Bool TPGalleryThemeGeneral::FillItemSet( SfxItemSet& /*rSet*/ ) -{ - pData->aEditedTitle = aEdtMSName.GetText(); - return sal_True; -} - -// ------------------------------------------------------------------------ - -SfxTabPage* TPGalleryThemeGeneral::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new TPGalleryThemeGeneral( pParent, rSet ); -} - -// ---------------------------- -// - TPGalleryThemeProperties - -// ---------------------------- - -TPGalleryThemeProperties::TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet ) : - SfxTabPage ( pWindow, CUI_RES( RID_SVXTABPAGE_GALLERYTHEME_FILES ), rSet ), - aFtFileType ( this, CUI_RES(FT_FILETYPE ) ), - aCbbFileType ( this, CUI_RES(CBB_FILETYPE ) ), - aLbxFound ( this, CUI_RES(LBX_FOUND ) ), - aBtnSearch ( this, CUI_RES(BTN_SEARCH ) ), - aBtnTake ( this, CUI_RES(BTN_TAKE ) ), - aBtnTakeAll ( this, CUI_RES(BTN_TAKEALL ) ), - aCbxPreview ( this, CUI_RES(CBX_PREVIEW ) ), - aWndPreview ( this, CUI_RES( WND_BRSPRV ) ), - nCurFilterPos (0), - nFirstExtFilterPos (0), - bEntriesFound (sal_False), - bInputAllowed (sal_True), - bSearchRecursive (sal_False), - xDialogListener ( new ::svt::DialogClosedListener() ) -{ - FreeResource(); - - xDialogListener->SetDialogClosedLink( LINK( this, TPGalleryThemeProperties, DialogClosedHdl ) ); - aLbxFound.SetAccessibleName(String(SVX_RES(RID_SVXSTR_GALLERY_FILESFOUND))); - aWndPreview.SetAccessibleName(aCbxPreview.GetText()); - aLbxFound.SetAccessibleRelationLabeledBy(&aLbxFound); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData ) -{ - pData = _pData; - - aPreviewTimer.SetTimeoutHdl( LINK( this, TPGalleryThemeProperties, PreviewTimerHdl ) ); - aPreviewTimer.SetTimeout( 500 ); - aBtnSearch.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickSearchHdl)); - aBtnTake.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeHdl)); - aBtnTakeAll.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeAllHdl)); - aCbxPreview.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickPreviewHdl)); - aCbbFileType.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFileTypeHdl)); - aCbbFileType.EnableDDAutoWidth( sal_False ); - aLbxFound.SetDoubleClickHdl(LINK(this, TPGalleryThemeProperties, DClickFoundHdl)); - aLbxFound.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFoundHdl)); - aLbxFound.InsertEntry(String(CUI_RES(RID_SVXSTR_GALLERY_NOFILES))); - aLbxFound.Show(); - - FillFilterList(); - - aBtnTake.Enable(); - aBtnTakeAll.Disable(); - aCbxPreview.Disable(); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::StartSearchFiles( const String& _rFolderURL, short _nDlgResult ) -{ - if ( RET_OK == _nDlgResult ) - { - aURL = INetURLObject( _rFolderURL ); - bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls - SearchFiles(); - } - - nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); -} - -// ------------------------------------------------------------------------ - -TPGalleryThemeProperties::~TPGalleryThemeProperties() -{ - xMediaPlayer.clear(); - xDialogListener.clear(); - - for ( size_t i = 0, n = aFoundList.size(); i < n; ++i ) - delete aFoundList[ i ]; - - for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) { - delete aFilterEntryList[ i ]; - } -} - -// ------------------------------------------------------------------------ - -SfxTabPage* TPGalleryThemeProperties::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new TPGalleryThemeProperties( pParent, rSet ); -} - -// ------------------------------------------------------------------------ - -::rtl::OUString TPGalleryThemeProperties::addExtension( const ::rtl::OUString& _rDisplayText, const ::rtl::OUString& _rExtension ) -{ - ::rtl::OUString sAllFilter( RTL_CONSTASCII_USTRINGPARAM( "(*.*)" ) ); - ::rtl::OUString sOpenBracket( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); - ::rtl::OUString sCloseBracket( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); - ::rtl::OUString sRet = _rDisplayText; - - if ( sRet.indexOf( sAllFilter ) == -1 ) - { - String sExt = _rExtension; - sRet += sOpenBracket; - sRet += sExt; - sRet += sCloseBracket; - } - return sRet; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::FillFilterList() -{ - GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); - String aExt; - String aName; - FilterEntry* pFilterEntry; - FilterEntry* pTestEntry; - sal_uInt16 i, nKeyCount; - sal_Bool bInList; - - // graphic filters - for( i = 0, nKeyCount = rFilter.GetImportFormatCount(); i < nKeyCount; i++ ) - { - aExt = rFilter.GetImportFormatShortName( i ); - aName = rFilter.GetImportFormatName( i ); - size_t entryIndex = 0; - pTestEntry = aFilterEntryList.empty() ? NULL : aFilterEntryList[ entryIndex ]; - bInList = sal_False; - - String aExtensions; - int j = 0; - String sWildcard; - while( sal_True ) - { - sWildcard = rFilter.GetImportWildcard( i, j++ ); - if ( !sWildcard.Len() ) - break; - if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode(';'); - aExtensions += sWildcard; - } - } - aName = addExtension( aName, aExtensions ); - - while( pTestEntry ) - { - if ( pTestEntry->aFilterName == aExt ) - { - bInList = sal_True; - break; - } - pTestEntry = ( ++entryIndex < aFilterEntryList.size() ) - ? aFilterEntryList[ entryIndex ] : NULL; - } - if ( !bInList ) - { - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = aExt; - size_t pos = aCbbFileType.InsertEntry( aName ); - if ( pos < aFilterEntryList.size() ) { - aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - } - } - - // media filters - static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) ); - ::avmedia::FilterNameVector aFilters; - const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - ::rtl::OUString aAllTypes; - - ::avmedia::MediaWindow::getMediaFilters( aFilters ); - - for( unsigned long l = 0; l < aFilters.size(); ++l ) - { - for( sal_Int32 nIndex = 0; nIndex >= 0; ) - { - ::rtl::OUString aFilterWildcard( aWildcard ); - - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = aFilters[ l ].second.getToken( 0, ';', nIndex ); - nFirstExtFilterPos = aCbbFileType.InsertEntry( - addExtension( - aFilters[ l ].first, - aFilterWildcard += pFilterEntry->aFilterName - ) - ); - if ( nFirstExtFilterPos < aFilterEntryList.size() ) { - aFilterEntryList.insert( - aFilterEntryList.begin() + nFirstExtFilterPos, - pFilterEntry - ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - } - } - - // 'All' filters - String aExtensions; - - // graphic filters - for ( i = 0; i < nKeyCount; ++i ) - { - int j = 0; - String sWildcard; - while( sal_True ) - { - sWildcard = rFilter.GetImportWildcard( i, j++ ); - if ( !sWildcard.Len() ) - break; - if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode( ';' ); - - aExtensions += sWildcard; - } - } - } - - // media filters - for( unsigned long k = 0; k < aFilters.size(); ++k ) - { - for( sal_Int32 nIndex = 0; nIndex >= 0; ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode( ';' ); - ( aExtensions += String( aWildcard ) ) += String( aFilters[ k ].second.getToken( 0, ';', nIndex ) ); - } - } - -#if defined(WNT) - if ( aExtensions.Len() > 240 ) - aExtensions = DEFINE_CONST_UNICODE( "*.*" ); -#endif - - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = String( CUI_RES( RID_SVXSTR_GALLERY_ALLFILES ) ); - pFilterEntry->aFilterName = addExtension( pFilterEntry->aFilterName, aExtensions ); - size_t pos = aCbbFileType.InsertEntry( pFilterEntry->aFilterName, 0 ); - if ( pos < aFilterEntryList.size() ) { - aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - aCbbFileType.SetText( pFilterEntry->aFilterName ); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, SelectFileTypeHdl, void *, EMPTYARG ) -{ - String aText( aCbbFileType.GetText() ); - - if( bInputAllowed && ( aLastFilterName != aText ) ) - { - aLastFilterName = aText; - - if( QueryBox( this, WB_YES_NO, String( CUI_RES( RID_SVXSTR_GALLERY_SEARCH ) ) ).Execute() == RET_YES ) - SearchFiles(); - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::SearchFiles() -{ - SearchProgress* pProgress = new SearchProgress( this, aURL ); - - for ( size_t i = 0, n = aFoundList.size(); i < n; ++i ) - delete aFoundList[ i ]; - aFoundList.clear(); - - aLbxFound.Clear(); - - pProgress->SetFileType( aCbbFileType.GetText() ); - pProgress->SetDirectory( rtl::OUString() ); - pProgress->Update(); - - pProgress->StartExecuteModal( LINK( this, TPGalleryThemeProperties, EndSearchProgressHdl ) ); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickCloseBrowserHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - aPreviewTimer.Stop(); - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickSearchHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - try - { - // setup folder picker - ::com::sun::star::uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >( - xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ))), UNO_QUERY ); - - if ( xFolderPicker.is() ) - { - String aDlgPathName( SvtPathOptions().GetGraphicPath() ); - xFolderPicker->setDisplayDirectory(aDlgPathName); - - aPreviewTimer.Stop(); - - ::com::sun::star::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else - { - if( xFolderPicker->execute() == RET_OK ) - { - aURL = INetURLObject( xFolderPicker->getDirectory() ); - bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls - SearchFiles(); - } - - nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); - } - } - } - } - catch (const IllegalArgumentException&) - { - OSL_FAIL( "Folder picker failed with illegal arguments" ); - } - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::TakeFiles() -{ - if( aLbxFound.GetSelectEntryCount() || ( bTakeAll && bEntriesFound ) ) - { - TakeProgress* pTakeProgress = new TakeProgress( this ); - pTakeProgress->Update(); - - pTakeProgress->StartExecuteModal( - Link() /* no postprocessing needed, pTakeProgress - will be deleted in TakeProgress::CleanupHdl */ ); - } -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickPreviewHdl, void *, EMPTYARG ) -{ - if ( bInputAllowed ) - { - aPreviewTimer.Stop(); - aPreviewString.Erase(); - - if( !aCbxPreview.IsChecked() ) - { - xMediaPlayer.clear(); - aWndPreview.SetGraphic( Graphic() ); - aWndPreview.Invalidate(); - } - else - DoPreview(); - } - - return 0; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::DoPreview() -{ - String aString( aLbxFound.GetSelectEntry() ); - - if( aString != aPreviewString ) - { - INetURLObject _aURL( *aFoundList[ aLbxFound.GetEntryPos( aString ) ] ); - bInputAllowed = sal_False; - - if ( !aWndPreview.SetGraphic( _aURL ) ) - { - GetParent()->LeaveWait(); - ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH ); - GetParent()->EnterWait(); - } - else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) - { - xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - if( xMediaPlayer.is() ) - xMediaPlayer->start(); - } - - bInputAllowed = sal_True; - aPreviewString = aString; - } -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickTakeHdl, void*, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - - if( !aLbxFound.GetSelectEntryCount() || !bEntriesFound ) - { - SvxOpenGraphicDialog aDlg(String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ) ); - aDlg.EnableLink(sal_False); - aDlg.AsLink(sal_False); - - if( !aDlg.Execute() ) - pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) ); - } - else - { - bTakeAll = sal_False; - TakeFiles(); - } - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickTakeAllHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - bTakeAll = sal_True; - TakeFiles(); - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, SelectFoundHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - sal_Bool bPreviewPossible = sal_False; - - aPreviewTimer.Stop(); - - if( bEntriesFound ) - { - if( aLbxFound.GetSelectEntryCount() == 1 ) - { - aCbxPreview.Enable(); - bPreviewPossible = sal_True; - } - else - aCbxPreview.Disable(); - - if( aFoundList.size() ) - aBtnTakeAll.Enable(); - else - aBtnTakeAll.Disable(); - } - - if( bPreviewPossible && aCbxPreview.IsChecked() ) - aPreviewTimer.Start(); - } - - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, DClickFoundHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - - return (aLbxFound.GetSelectEntryCount() == 1 && bEntriesFound) ? - ClickTakeHdl(NULL) : 0; - } - else - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, PreviewTimerHdl, void *, EMPTYARG ) -{ - aPreviewTimer.Stop(); - DoPreview(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, EndSearchProgressHdl, SearchProgress *, EMPTYARG ) -{ - if( aFoundList.size() ) - { - aLbxFound.SelectEntryPos( 0 ); - aBtnTakeAll.Enable(); - aCbxPreview.Enable(); - bEntriesFound = sal_True; - } - else - { - aLbxFound.InsertEntry( String( CUI_RES( RID_SVXSTR_GALLERY_NOFILES ) ) ); - aBtnTakeAll.Disable(); - aCbxPreview.Disable(); - bEntriesFound = sal_False; - } - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent*, pEvt ) -{ - DBG_ASSERT( xFolderPicker.is() == sal_True, "TPGalleryThemeProperties::DialogClosedHdl(): no folder picker" ); - - String sURL = String( xFolderPicker->getDirectory() ); - StartSearchFiles( sURL, pEvt->DialogResult ); - - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx deleted file mode 100644 index e1855d567..000000000 --- a/cui/source/dialogs/cuigrfflt.cxx +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/shl.hxx> -#include <vcl/msgbox.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/objsh.hxx> -#include <sfx2/request.hxx> -#include <dialmgr.hxx> -#include "cuigrfflt.hxx" -#include "grfflt.hrc" -#include <cuires.hrc> -#include <svx/dialogs.hrc> // RID_SVX_GRFFILTER_DLG_... - -// -------------------------------------- -// - GraphicFilterDialog::PreviewWindow - -// -------------------------------------- - -GraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ) -{ -} - -// ----------------------------------------------------------------------------- - -GraphicFilterDialog::PreviewWindow::~PreviewWindow() -{ -} - -// ----------------------------------------------------------------------------- - -void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) -{ - Control::Paint( rRect ); - - const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) ); - const Size aOutSize( GetOutputSizePixel() ); - const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1, - ( aOutSize.Height() - aGrfSize.Height() ) >> 1 ); - - if( maGraphic.IsAnimated() ) - maGraphic.StartAnimation( this , aGrfPos, aGrfSize ); - else - maGraphic.Draw( this, aGrfPos, aGrfSize ); -} - -// ----------------------------------------------------------------------------- - -void GraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic ) -{ - maGraphic = rGraphic; - - if( maGraphic.IsAnimated() || maGraphic.IsTransparent() ) - Invalidate(); - else - Paint( Rectangle( Point(), GetOutputSizePixel() ) ); -} - -// ----------------------- -// - GraphicFilterDialog - -// ----------------------- - -GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) : - ModalDialog ( pParent, rResId ), - maModifyHdl ( LINK( this, GraphicFilterDialog, ImplModifyHdl ) ), - mfScaleX ( 0.0 ), - mfScaleY ( 0.0 ), - maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ), - maPreview ( this, CUI_RES( CTL_PREVIEW ) ), - maBtnOK ( this, CUI_RES( BTN_OK ) ), - maBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maBtnHelp ( this, CUI_RES( BTN_HELP ) ), - maFlParameter ( this, CUI_RES( FL_PARAMETER ) ) -{ - const Size aPreviewSize( maPreview.GetOutputSizePixel() ); - Size aGrfSize( maSizePixel ); - - if( rGraphic.GetType() == GRAPHIC_BITMAP && - aPreviewSize.Width() && aPreviewSize.Height() && - aGrfSize.Width() && aGrfSize.Height() ) - { - const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height(); - const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height(); - - if( fGrfWH < fPreWH ) - { - aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); - aGrfSize.Height()= aPreviewSize.Height(); - } - else - { - aGrfSize.Width() = aPreviewSize.Width(); - aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH); - } - - mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width(); - mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height(); - - if( !rGraphic.IsAnimated() ) - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Scale( aGrfSize, BMP_SCALE_INTERPOLATE ) ) - maGraphic = aBmpEx; - } - } - - maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) ); - maTimer.SetTimeout( 100 ); - ImplModifyHdl( NULL ); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterDialog::~GraphicFilterDialog() -{ -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer*, EMPTYARG ) -{ - maTimer.Stop(); - maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GraphicFilterDialog, ImplModifyHdl, void*, EMPTYARG ) -{ - if( maGraphic.GetType() == GRAPHIC_BITMAP ) - { - maTimer.Stop(); - maTimer.Start(); - } - - return 0; -} - -// ---------------- -// - FilterMosaic - -// ---------------- - -GraphicFilterMosaic::GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges ) : - GraphicFilterDialog( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_MOSAIC ), rGraphic ), - maFtWidth ( this, CUI_RES( DLG_FILTERMOSAIC_FT_WIDTH ) ), - maMtrWidth ( this, CUI_RES( DLG_FILTERMOSAIC_MTR_WIDTH ) ), - maFtHeight ( this, CUI_RES( DLG_FILTERMOSAIC_FT_HEIGHT ) ), - maMtrHeight ( this, CUI_RES( DLG_FILTERMOSAIC_MTR_HEIGHT ) ), - maCbxEdges ( this, CUI_RES( DLG_FILTERMOSAIC_CBX_EDGES ) ) -{ - FreeResource(); - - maMtrWidth.SetValue( nTileWidth ); - maMtrWidth.SetLast( GetGraphicSizePixel().Width() ); - maMtrWidth.SetModifyHdl( GetModifyHdl() ); - - maMtrHeight.SetValue( nTileHeight ); - maMtrHeight.SetLast( GetGraphicSizePixel().Height() ); - maMtrHeight.SetModifyHdl( GetModifyHdl() ); - - maCbxEdges.Check( bEnhanceEdges ); - maCbxEdges.SetToggleHdl( GetModifyHdl() ); - - maMtrWidth.GrabFocus(); - - maFtWidth.SetAccessibleRelationMemberOf(&maFlParameter); - maMtrWidth.SetAccessibleRelationMemberOf(&maFlParameter); - maFtHeight.SetAccessibleRelationMemberOf(&maFlParameter); - maMtrHeight.SetAccessibleRelationMemberOf(&maFlParameter); - maCbxEdges.SetAccessibleRelationMemberOf(&maFlParameter); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterMosaic::~GraphicFilterMosaic() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, - double fScaleX, double fScaleY ) -{ - Graphic aRet; - const Size aSize( Max( FRound( GetTileWidth() * fScaleX ), 1L ), - Max( FRound( GetTileHeight() * fScaleY ), 1L ) ); - BmpFilterParam aParam( aSize ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_MOSAIC, &aParam ) ) - { - if( IsEnhanceEdges() ) - aAnim.Filter( BMP_FILTER_SHARPEN ); - - aRet = aAnim; - } - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_MOSAIC, &aParam ) ) - { - if( IsEnhanceEdges() ) - aBmpEx.Filter( BMP_FILTER_SHARPEN ); - - aRet = aBmpEx; - } - } - - return aRet; -} - -// ------------------ -// - GraphicFilterSolarize - -// ------------------ - -GraphicFilterSolarize::GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic, - sal_uInt8 cGreyThreshold, sal_Bool bInvert ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SOLARIZE ), rGraphic ), - maFtThreshold ( this, CUI_RES( DLG_FILTERSOLARIZE_FT_THRESHOLD ) ), - maMtrThreshold ( this, CUI_RES( DLG_FILTERSOLARIZE_MTR_THRESHOLD ) ), - maCbxInvert ( this, CUI_RES( DLG_FILTERSOLARIZE_CBX_INVERT ) ) -{ - FreeResource(); - - maMtrThreshold.SetValue( FRound( cGreyThreshold / 2.55 ) ); - maMtrThreshold.SetModifyHdl( GetModifyHdl() ); - - maCbxInvert.Check( bInvert ); - maCbxInvert.SetToggleHdl( GetModifyHdl() ); - - maMtrThreshold.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterSolarize::~GraphicFilterSolarize() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - BmpFilterParam aParam( GetGreyThreshold() ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_SOLARIZE, &aParam ) ) - { - if( IsInvert() ) - aAnim.Invert(); - - aRet = aAnim; - } - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_SOLARIZE, &aParam ) ) - { - if( IsInvert() ) - aBmpEx.Invert(); - - aRet = aBmpEx; - } - } - - return aRet; -} - -// ---------------------- -// - GraphicFilterSepia - -// ---------------------- - -GraphicFilterSepia::GraphicFilterSepia( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nSepiaPercent ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SEPIA ), rGraphic ), - maFtSepia ( this, CUI_RES( DLG_FILTERSEPIA_FT_SEPIA ) ), - maMtrSepia ( this, CUI_RES( DLG_FILTERSEPIA_MTR_SEPIA ) ) -{ - FreeResource(); - - maMtrSepia.SetValue( nSepiaPercent ); - maMtrSepia.SetModifyHdl( GetModifyHdl() ); - - maMtrSepia.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterSepia::~GraphicFilterSepia() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - BmpFilterParam aParam( GetSepiaPercent() ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_SEPIA, &aParam ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_SEPIA, &aParam ) ) - aRet = aBmpEx; - } - - return aRet; -} - -// ----------------------- -// - GraphicFilterPoster - -// ----------------------- - -GraphicFilterPoster::GraphicFilterPoster( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nPosterCount ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_POSTER ), rGraphic ), - maFtPoster ( this, CUI_RES( DLG_FILTERPOSTER_FT_POSTER ) ), - maNumPoster ( this, CUI_RES( DLG_FILTERPOSTER_NUM_POSTER ) ) -{ - FreeResource(); - - maNumPoster.SetFirst( 2 ); - maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() ); - maNumPoster.SetValue( nPosterCount ); - maNumPoster.SetModifyHdl( GetModifyHdl() ); - maNumPoster.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterPoster::~GraphicFilterPoster() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - const sal_uInt16 nPosterCount = GetPosterColorCount(); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) ) - aRet = aBmpEx; - } - - return aRet; -} - -// ----------------------- -// - GraphicFilterEmboss - -// ----------------------- - -void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt ) -{ - const RECT_POINT eOldRP = GetActualRP(); - - SvxRectCtl::MouseButtonDown( rEvt ); - - if( GetActualRP() != eOldRP ) - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ), - maFtLight ( this, CUI_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ), - maCtlLight ( this, CUI_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource ) -{ - FreeResource(); - - maCtlLight.SetModifyHdl( GetModifyHdl() ); - maCtlLight.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterEmboss::~GraphicFilterEmboss() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - sal_uInt16 nAzim, nElev; - - switch( maCtlLight.GetActualRP() ) - { - default: OSL_FAIL("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" ); - case( RP_LT ): nAzim = 4500, nElev = 4500; break; - case( RP_MT ): nAzim = 9000, nElev = 4500; break; - case( RP_RT ): nAzim = 13500, nElev = 4500; break; - case( RP_LM ): nAzim = 0, nElev = 4500; break; - case( RP_MM ): nAzim = 0, nElev = 9000; break; - case( RP_RM ): nAzim = 18000, nElev = 4500; break; - case( RP_LB ): nAzim = 31500, nElev = 4500; break; - case( RP_MB ): nAzim = 27000, nElev = 4500; break; - case( RP_RB ): nAzim = 22500, nElev = 4500; break; - } - - BmpFilterParam aParam( nAzim, nElev ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) ) - aRet = aBmpEx; - } - - return aRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx deleted file mode 100644 index 1e15f89f5..000000000 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include <vcl/settings.hxx> -#include <unotools/viewoptions.hxx> -#include "cuihyperdlg.hxx" -#include "hlinettp.hxx" -#include "hlmailtp.hxx" -#include "hldoctp.hxx" -#include "hldocntp.hxx" -#include "hyperdlg.hrc" -#include <svx/svxids.hrc> // SID_READONLY_MODE - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::frame::XFrame; - -//######################################################################## -//# # -//# Childwindow-Wrapper-Class # -//# # -//######################################################################## - -SvxHlinkCtrl::SvxHlinkCtrl( sal_uInt16 _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg ) -: SfxControllerItem ( _nId, rBindings ) - ,aOnlineForwarder ( SID_INTERNET_ONLINE , *this ) - ,aRdOnlyForwarder ( SID_READONLY_MODE, *this ) -{ - pParent = pDlg; -} - -void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) -{ - if ( eState == SFX_ITEM_AVAILABLE ) - { - switch ( nSID ) - { - case SID_INTERNET_ONLINE : - { - pParent->EnableInetBrowse( !( (SfxBoolItem*)pState)->GetValue() ); - } - break; - case SID_HYPERLINK_GETLINK : - { - pParent->SetPage ( (SvxHyperlinkItem*)pState); - } - break; - case SID_READONLY_MODE : - { - pParent->SetReadOnlyMode( ( (SfxBoolItem*)pState)->GetValue() == sal_True ); - } - break; - } - } -} - - - -// ----------------------------------------------------------------------- - - - -//######################################################################## -//# # -//# Hyperlink - Dialog # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings) -: IconChoiceDialog( pParent, CUI_RES ( RID_SVXDLG_NEWHYPERLINK ) ), - maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ), - mpBindings ( pBindings ), - mbReadOnly ( sal_False ), - mbIsHTMLDoc ( sal_False ) -{ - SetUniqueId( HID_HYPERLINK_DIALOG ); - mbGrabFocus = sal_True; - // insert pages - Image aImage; - String aStrTitle; - SvxIconChoiceCtrlEntry* pEntry = NULL; - - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, SvxHyperlinkInternetTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLMAILTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, SvxHyperlinkMailTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, SvxHyperlinkDocTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, SvxHyperlinkNewDocTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) ); - - // create itemset for tabpages - mpItemSet = new SfxItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK, - SID_HYPERLINK_SETLINK ); - - SvxHyperlinkItem aItem; - mpItemSet->Put (aItem, SID_HYPERLINK_GETLINK); - - SetInputSet (mpItemSet); - - // Init Dialog - Start (sal_False); - - pBindings->Update( SID_READONLY_MODE ); - - // set OK/Cancel - button - GetOKButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_APPLYBUT) ); - GetCancelButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_CLOSEBUT) ); - - GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) ); - GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) ); -} - -SvxHpLinkDlg::~SvxHpLinkDlg () -{ - // delete config item, so the base class (IconChoiceDialog) can not load it on the next start - SvtViewOptions aViewOpt( E_TABDIALOG, String::CreateFromInt32( SID_HYPERLINK_DIALOG ) ); - aViewOpt.Delete(); - - delete mpItemSet; -} - -/************************************************************************* -|* -|* Close Dialog-Window -|* -|************************************************************************/ - -sal_Bool SvxHpLinkDlg::Close() -{ - GetDispatcher()->Execute( SID_HYPERLINK_DIALOG, - SFX_CALLMODE_ASYNCHRON | - SFX_CALLMODE_RECORD); - return sal_True; -} - -/************************************************************************* -|* -|* When extrawindow is visible and its never moved by user, then move that -|* window, too. -|* -|************************************************************************/ - -void SvxHpLinkDlg::Move() -{ - SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* ) - GetTabPage ( GetCurPageId() ); - - if( pCurrentPage->IsMarkWndVisible () ) - { - // Pos&Size of this dialog-window - Point aDlgPos ( GetPosPixel () ); - Size aDlgSize ( GetSizePixel () ); - - // Size of Office-Main-Window - Size aWindowSize( SFX_APP()->GetTopWindow()->GetSizePixel() ); - - // Size of Extrawindow - Size aExtraWndSize( pCurrentPage->GetSizeExtraWnd() ); - - sal_Bool bDoInvalid ; - if( aDlgPos.X()+(1.02*aDlgSize.Width())+aExtraWndSize.Width() > aWindowSize.Width() ) - { - if( aDlgPos.X() - ( 0.02*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 ) - { - // Pos Extrawindow anywhere - bDoInvalid = pCurrentPage->MoveToExtraWnd( Point( 1, long(1.1*aDlgPos.Y()) ), sal_True ); - } - else - { - // Pos Extrawindow on the left side of Dialog - bDoInvalid = pCurrentPage->MoveToExtraWnd( aDlgPos - - Point( long(0.02*aDlgSize.Width()), 0 ) - - Point( aExtraWndSize.Width(), 0 ) ); - } - } - else - { - // Pos Extrawindow on the right side of Dialog - bDoInvalid = pCurrentPage->MoveToExtraWnd ( aDlgPos + Point( long(1.02*aDlgSize.Width()), 0 ) ); - } - - if ( bDoInvalid ) - Invalidate(INVALIDATE_BACKGROUND); - } - - Window::Move(); -} - -/************************************************************************* -|* -|* Click on Apply-button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHpLinkDlg, ClickApplyHdl_Impl, void *, EMPTYARG ) -{ - SfxItemSet aItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK, - SID_HYPERLINK_SETLINK ); - - SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*) - GetTabPage ( GetCurPageId() ); - - if ( pCurrentPage->AskApply() ) - { - pCurrentPage->FillItemSet( aItemSet ); - - SvxHyperlinkItem *aItem = (SvxHyperlinkItem *) - aItemSet.GetItem (SID_HYPERLINK_SETLINK); - - String aStrEmpty; - if ( aItem->GetURL() != aStrEmpty ) - GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON | - SFX_CALLMODE_RECORD, aItem, 0L); - - ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply(); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Close-button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHpLinkDlg, ClickCloseHdl_Impl, void *, EMPTYARG ) -{ - Close(); - - return( 0L ); -} - -/************************************************************************* -|* -|* Set Page -|* -|************************************************************************/ - -sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem ) -{ - sal_uInt16 nPageId = RID_SVXPAGE_HYPERLINK_INTERNET; - - String aStrURL ( pItem->GetURL() ); - INetURLObject aURL ( aStrURL ); - INetProtocol eProtocolTyp = aURL.GetProtocol(); - - switch ( eProtocolTyp ) - { - case INET_PROT_HTTP : - case INET_PROT_FTP : - nPageId = RID_SVXPAGE_HYPERLINK_INTERNET; - break; - case INET_PROT_FILE : - case INET_PROT_POP3 : - case INET_PROT_IMAP : - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - break; - case INET_PROT_MAILTO : - case INET_PROT_NEWS : - nPageId = RID_SVXPAGE_HYPERLINK_MAIL; - break; - default : - sal_Char const sNewsSrvScheme[] = "news://"; - // TODO news:// is nonsense - - if ( aStrURL.SearchAscii( sNewsSrvScheme ) == 0 ) - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - else - { - sal_Char const sHash[] = "#"; - if( aStrURL.SearchAscii( sHash ) == 0 ) - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - else - { - eProtocolTyp = INET_PROT_NOT_VALID; - nPageId = GetCurPageId(); - } - } - break; - } - - ShowPage (nPageId); - - SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)GetTabPage( nPageId ); - - mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) ? true : false; - - SfxItemSet& aPageSet = (SfxItemSet&)GetTabPage (nPageId)->GetItemSet (); - aPageSet.Put ( *pItem ); - - pCurrentPage->Reset( aPageSet ); - if ( mbGrabFocus ) - { - pCurrentPage->SetInitFocus(); // #92535# grab the focus only once at initialization - mbGrabFocus = sal_False; - } - return nPageId; -} - -/************************************************************************* -|* -|* Enable/Disable to browse targets in a html-doc -|* -|************************************************************************/ - -void SvxHpLinkDlg::EnableInetBrowse( sal_Bool bEnable ) -{ - SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* ) - GetTabPage ( GetCurPageId() ); - pCurrentPage->SetOnlineMode( bEnable ); -} - -/************************************************************************* -|* -|* Enable/Disable ReadOnly mode -|* -|************************************************************************/ - -void SvxHpLinkDlg::SetReadOnlyMode( sal_Bool bRdOnly ) -{ - mbReadOnly = bRdOnly; - if ( bRdOnly ) - GetOKButton().Disable(); - else - GetOKButton().Enable(); -} - -/************************************************************************* -|* -|* late-initialization of newly created pages -|* -|************************************************************************/ - -void SvxHpLinkDlg::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& rPage ) -{ - SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage ); - Reference< XFrame > xDocumentFrame; - if ( mpBindings ) - xDocumentFrame = mpBindings->GetActiveFrame(); - OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" ); - rHyperlinkPage.SetDocumentFrame( xDocumentFrame ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuiimapdlg.hrc b/cui/source/dialogs/cuiimapdlg.hrc deleted file mode 100644 index 8635f1baf..000000000 --- a/cui/source/dialogs/cuiimapdlg.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <cuires.hrc> - -// ImapDlg-Dialoge - -#define FT_URLDESCRIPTION 1 -#define FT_URL1 2 -#define FT_TARGET 3 -#define FT_NAME 4 -#define FT_DESCRIPTION 5 -#define EDT_URLDESCRIPTION 1 -#define EDT_URL 2 -#define EDT_NAME 3 -#define EDT_DESCRIPTION 4 -#define BTN_HELP1 1 -#define BTN_OK1 2 -#define BTN_CANCEL1 3 -#define FL_URL 1 -#define CBB_TARGETS 1 diff --git a/cui/source/dialogs/cuiimapdlg.src b/cui/source/dialogs/cuiimapdlg.src deleted file mode 100644 index 95ed0f483..000000000 --- a/cui/source/dialogs/cuiimapdlg.src +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "cuiimapdlg.hrc" - // pragma ---------------------------------------------------------------- - -ModalDialog RID_SVXDLG_IMAPURL -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_IMAPURL"; - SVLook = TRUE ; - OutputSize = TRUE ; - Closeable = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 214 , 188 ) ; - Text [ en-US ] = "Properties" ; - - FixedText FT_URL1 - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~URL" ; - }; - Edit EDT_URL - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_URL"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - - FixedText FT_TARGET - { - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CBB_TARGETS - { - HelpID = "cui:ComboBox:RID_SVXDLG_IMAPURL:CBB_TARGETS"; - Border = TRUE ; - Sort = TRUE ; - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 101 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - HScroll = TRUE ; - }; - - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 6 , 59 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~Name" ; - }; - Edit EDT_NAME - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_NAME"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 70 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - - FixedText FT_URLDESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 85 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "Alternative ~text" ; - }; - - Edit EDT_URLDESCRIPTION - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_URLDESCRIPTION"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 96 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 111 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~Description" ; - }; - - MultiLineEdit EDT_DESCRIPTION - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_IMAPURL:EDT_DESCRIPTION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 122 ) ; - Size = MAP_APPFONT ( 202 , 34 ) ; - TabStop = TRUE ; - IgnoreTab = TRUE; - VScroll = TRUE; - }; - - FixedLine FL_URL - { - Pos = MAP_APPFONT ( 0 , 160 ) ; - Size = MAP_APPFONT ( 214 , 4 ) ; - }; - - // Buttons - HelpButton BTN_HELP1 - { - Pos = MAP_APPFONT ( 6, 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - OKButton BTN_OK1 - { - TabStop = TRUE ; - DefButton = TRUE ; - Pos = MAP_APPFONT ( 107 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - - CancelButton BTN_CANCEL1 - { - TabStop = TRUE ; - Pos = MAP_APPFONT ( 160 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx deleted file mode 100644 index 2d4516387..000000000 --- a/cui/source/dialogs/cuiimapwnd.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/urlobj.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/help.hxx> -#include <sfx2/sfxsids.hrc> -#define _ANIMATION -#include "macroass.hxx" -#include <svtools/imaprect.hxx> -#include <svtools/imapcirc.hxx> -#include <svtools/imappoly.hxx> -#include <svl/urlbmk.hxx> -#include <svx/xoutbmp.hxx> -#include <dialmgr.hxx> -#include <cuires.hrc> -#include <cuiimapdlg.hrc> -#include <cuiimapwnd.hxx> -#include <svx/svdpage.hxx> -#include <svx/svdorect.hxx> -#include <svx/svdocirc.hxx> -#include <svx/svdopath.hxx> -#include <svx/xfltrit.hxx> -#include <svx/svdpagv.hxx> -#include <svl/urihelper.hxx> -#include <svx/xfillit.hxx> -#include <svx/xlineit.hxx> - -#include <sot/formats.hxx> - -#define TRANSCOL Color( COL_WHITE ) - -/************************************************************************* -|* -|* URLDlg -|* -\************************************************************************/ - -URLDlg::URLDlg( Window* pWindow, const String& rURL, const String& rAlternativeText, const String& rDescription, const String& rTarget, const String& rName, TargetList& rTargetList ) -: ModalDialog( pWindow, CUI_RES( RID_SVXDLG_IMAPURL ) ) -, maFtURL( this, CUI_RES( FT_URL1 ) ) -, maEdtURL( this, CUI_RES( EDT_URL ) ) -, maFtTarget( this, CUI_RES( FT_TARGET ) ) -, maCbbTargets( this, CUI_RES( CBB_TARGETS ) ) -, maFtName( this, CUI_RES( FT_NAME ) ) -, maEdtName( this, CUI_RES( EDT_NAME ) ) -, maFtAlternativeText( this, CUI_RES( FT_URLDESCRIPTION ) ) -, maEdtAlternativeText( this, CUI_RES( EDT_URLDESCRIPTION ) ) -, maFtDescription( this, CUI_RES( FT_DESCRIPTION ) ) -, maEdtDescription( this, CUI_RES( EDT_DESCRIPTION ) ) -, maFlURL( this, CUI_RES( FL_URL ) ) -, maBtnHelp( this, CUI_RES( BTN_HELP1 ) ) -, maBtnOk( this, CUI_RES( BTN_OK1 ) ) -, maBtnCancel( this, CUI_RES( BTN_CANCEL1 ) ) -{ - FreeResource(); - - maEdtURL.SetText( rURL ); - maEdtAlternativeText.SetText( rAlternativeText ); - maEdtDescription.SetText( rDescription ); - maEdtName.SetText( rName ); - - for( size_t i = 0, n = rTargetList.size(); i < n; ++i ) - maCbbTargets.InsertEntry( *rTargetList[ i ] ); - - if( !rTarget.Len() ) - maCbbTargets.SetText( String::CreateFromAscii( "_self" ) ); - else - maCbbTargets.SetText( rTarget ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx deleted file mode 100644 index 2e14b9752..000000000 --- a/cui/source/dialogs/cuitbxform.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string> -#include <tools/ref.hxx> -#include <tools/shl.hxx> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <sfx2/dispatch.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/fixed.hxx> -#include <vcl/sound.hxx> -#include <dialmgr.hxx> -#include <cuires.hrc> -#include "cuitbxform.hxx" -#include <sfx2/viewfrm.hxx> -#include <sfx2/viewsh.hxx> -#include "fmsearch.hrc" - -//======================================================================== -// class FmInputRecordNoDialog -//======================================================================== - -FmInputRecordNoDialog::FmInputRecordNoDialog(Window * pParent) - :ModalDialog( pParent, CUI_RES(RID_SVX_DLG_INPUTRECORDNO)) - ,m_aLabel(this, CUI_RES(1)) - ,m_aRecordNo(this, CUI_RES(1)) - ,m_aOk(this, CUI_RES(1)) - ,m_aCancel(this, CUI_RES(1)) -{ - m_aRecordNo.SetMin(1); - m_aRecordNo.SetMax(0x7FFFFFFF); - m_aRecordNo.SetStrictFormat(sal_True); - m_aRecordNo.SetDecimalDigits(0); - - FreeResource(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx deleted file mode 100644 index 96262a840..000000000 --- a/cui/source/dialogs/dlgname.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/ref.hxx> -#include <tools/shl.hxx> -#include <tools/debug.hxx> -#include <vcl/msgbox.hxx> - -#include <cuires.hrc> - -#include "dlgname.hxx" -#include "defdlgname.hxx" -#include "dlgname.hrc" -#include <dialmgr.hxx> - -#define MAX_DESCRIPTION_LINES ((long)5) - -/************************************************************************* -|* -|* Dialog zum Editieren eines Namens -|* -\************************************************************************/ - -SvxNameDialog::SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_NAME ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aEdtName ( this, CUI_RES( EDT_STRING ) ), - aBtnOK ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aBtnHelp ( this, CUI_RES( BTN_HELP ) ) -{ - FreeResource(); - - aFtDescription.SetText( rDesc ); - aEdtName.SetText( rName ); - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); - - // dynamic height of the description field - Size aSize = aFtDescription.GetSizePixel(); - long nTxtWidth = aFtDescription.GetCtrlTextWidth( rDesc ); - if ( nTxtWidth > aSize.Width() ) - { - long nLines = Min( ( nTxtWidth / aSize.Width() + 1 ), MAX_DESCRIPTION_LINES ); - long nHeight = aSize.Height(); - aSize.Height() = nHeight * nLines; - aFtDescription.SetSizePixel( aSize ); - Point aPnt = aEdtName.GetPosPixel(); - aPnt.Y() += ( aSize.Height() - nHeight ); - aEdtName.SetPosPixel( aPnt ); - } -} - -IMPL_LINK(SvxNameDialog, ModifyHdl, Edit*, EMPTYARG) -{ - if(aCheckNameHdl.IsSet()) - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Name -// plus uniqueness-callback-linkHandler - -SvxObjectNameDialog::SvxObjectNameDialog( - Window* pWindow, - const String& rName) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_NAME)), - aFtName(this, CUI_RES(NTD_FT_NAME)), - aEdtName(this, CUI_RES(NTD_EDT_NAME)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_A)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) -{ - FreeResource(); - - // set name - aEdtName.SetText(rName); - - // activate name - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl)); -} - -IMPL_LINK(SvxObjectNameDialog, ModifyHdl, Edit*, EMPTYARG) -{ - if(aCheckNameHdl.IsSet()) - { - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); - } - - return 0; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Title and Description - -SvxObjectTitleDescDialog::SvxObjectTitleDescDialog( - Window* pWindow, - const String& rTitle, - const String& rDescription) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_TITLE_DESC)), - aFtTitle(this, CUI_RES(NTD_FT_TITLE)), - aEdtTitle(this, CUI_RES(NTD_EDT_TITLE)), - aFtDescription(this, CUI_RES(NTD_FT_DESC)), - aEdtDescription(this, CUI_RES(NTD_EDT_DESC)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_B)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) -{ - FreeResource(); - - // set title & desc - aEdtTitle.SetText(rTitle); - aEdtDescription.SetText(rDescription); - - // activate title - aEdtTitle.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); -} - -/////////////////////////////////////////////////////////////////////////////////////////////// - -/************************************************************************* -|* -|* Dialog zum Abbrechen, Speichern oder Hinzufuegen -|* -\************************************************************************/ - -SvxMessDialog::SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_MESSBOX ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aBtn1 ( this, CUI_RES( BTN_1 ) ), - aBtn2 ( this, CUI_RES( BTN_2 ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aFtImage ( this ) -{ - FreeResource(); - - if( pImg ) - { - pImage = new Image( *pImg ); - aFtImage.SetImage( *pImage ); - aFtImage.SetStyle( ( aFtImage.GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK ); - aFtImage.SetPosSizePixel( LogicToPixel( Point( 3, 6 ), MAP_APPFONT ), - aFtImage.GetImage().GetSizePixel() ); - aFtImage.Show(); - } - - SetText( rText ); - aFtDescription.SetText( rDesc ); - - aBtn1.SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) ); - aBtn2.SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) ); -} - -SvxMessDialog::~SvxMessDialog() -{ - if( pImage ) - delete pImage; -} - -/*************************************************************************/ - -IMPL_LINK_INLINE_START( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) -{ - EndDialog( RET_BTN_1 ); - return 0; -} -IMPL_LINK_INLINE_END( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) - -/*************************************************************************/ - -IMPL_LINK_INLINE_START( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) -{ - EndDialog( RET_BTN_2 ); - return 0; -} -IMPL_LINK_INLINE_END( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) - -/*************************************************************************/ - -void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ) -{ - switch ( nBtnId ) - { - case MESS_BTN_1: - aBtn1.SetText( rNewTxt ); - break; - - case MESS_BTN_2: - aBtn2.SetText( rNewTxt ); - break; - - default: - OSL_FAIL( "Falsche Button-Nummer!!!" ); - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/dlgname.hrc b/cui/source/dialogs/dlgname.hrc deleted file mode 100644 index be0f2ad84..000000000 --- a/cui/source/dialogs/dlgname.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define EDT_STRING 1 -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FT_DESCRIPTION 1 -#define BTN_1 1 -#define BTN_2 2 - -// #i68101# -#define NTD_FT_NAME 2 -#define NTD_EDT_NAME 2 -#define NTD_FT_TITLE 3 -#define NTD_EDT_TITLE 3 -#define NTD_FT_DESC 4 -#define NTD_EDT_DESC 4 -#define FL_SEPARATOR_A 1 -#define FL_SEPARATOR_B 2 - -// eof diff --git a/cui/source/dialogs/dlgname.src b/cui/source/dialogs/dlgname.src deleted file mode 100644 index 65f5fff65..000000000 --- a/cui/source/dialogs/dlgname.src +++ /dev/null @@ -1,250 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include ------------------------------------------------------------------ - -#include <cuires.hrc> -#include "helpid.hrc" -#include "dlgname.hrc" - -// RID_SVXDLG_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_NAME -{ - HelpId = HID_DLG_NAME ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 63 ) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - WordBreak = TRUE ; - }; - Edit EDT_STRING - { - HelpID = "cui:Edit:RID_SVXDLG_NAME:EDT_STRING"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 112 , 12 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 124 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 124 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 124 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECT_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_NAME -{ - HelpId = HID_DLG_OBJECT_NAME; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 54 + 2) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - - // name - FixedText NTD_FT_NAME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - Text [ en-US ] = "~Name"; - }; - Edit NTD_EDT_NAME - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_NAME:NTD_EDT_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // divider - FixedLine FL_SEPARATOR_A - { - Pos = MAP_APPFONT ( 0 , 39 - 6 - 2 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECTTITLE_DESC ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_TITLE_DESC -{ - HelpId = HID_DLG_OBJECT_TITLE_DESC; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 78 + 27 ) ; - Text [ en-US ] = "Description" ; - Moveable = TRUE ; - - // title - FixedText NTD_FT_TITLE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Title"; - }; - Edit NTD_EDT_TITLE - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_TITLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // description - FixedText NTD_FT_DESC - { - Pos = MAP_APPFONT ( 6 , 30 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Description"; - }; - MultiLineEdit NTD_EDT_DESC - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_DESC"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 41 ) ; - Size = MAP_APPFONT ( 168 , (12 * 3) - 2 ) ; - TabStop = TRUE ; - IgnoreTab = TRUE; - VScroll = TRUE; - }; - - // divider - FixedLine FL_SEPARATOR_B - { - Pos = MAP_APPFONT ( 0 , 41 + 39 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// RID_SVXDLG_MESSBOX ------------------------------------------------------- - -ModalDialog RID_SVXDLG_MESSBOX -{ - HelpId = HID_DLG_MESSBOX ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 212 , 64 ) ; - Text = "" ; - Moveable = TRUE ; - PushButton BTN_1 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_1"; - Pos = MAP_APPFONT ( 25 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_2 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_2"; - Pos = MAP_APPFONT ( 78 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 131 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 28 , 6 ) ; - Size = MAP_APPFONT ( 200 , 35 ) ; - WordBreak = TRUE ; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/fmsearch.hrc b/cui/source/dialogs/fmsearch.hrc deleted file mode 100644 index 16936f81f..000000000 --- a/cui/source/dialogs/fmsearch.hrc +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _FMSEARCH_HRC -#define _FMSEARCH_HRC - -#include "svl/solar.hrc" - -#define RID_SVX_DLG_INPUTRECORDNO (RID_FORMS_START + 10) -#define RID_SVX_DLG_SHOWGRIDCOLUMNS (RID_FORMS_START + 11) -#define RID_SVXDLG_SEARCHFORM (RID_FORMS_START + 7) -#define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85) -#define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86) -#define RID_STR_SEARCH_END (RID_FORMS_START + 87) -#define RID_STR_SEARCH_WHOLE (RID_FORMS_START + 88) -#define RID_STR_FROM_TOP (RID_FORMS_START + 74) -#define RID_STR_FROM_BOTTOM (RID_FORMS_START + 75) -#define RID_SVXERR_SEARCH_NORECORD (RID_FORMS_START + 8) -#define RID_SVXERR_SEARCH_GENERAL_ERROR (RID_FORMS_START + 9) -#define RID_STR_OVERFLOW_FORWARD (RID_FORMS_START + 34) -#define RID_STR_OVERFLOW_BACKWARD (RID_FORMS_START + 35) -#define RID_STR_SEARCH_COUNTING (RID_FORMS_START + 76) - -#define FT_SEARCHTEXT 1 -#define FT_FORM 2 -#define FT_POSITION 3 -#define FT_RECORDLABEL 4 -#define FT_RECORD 5 -#define FT_HINT 6 - - -#define CMB_SEARCHTEXT 1 - -#define RB_ALLFIELDS 1 -#define RB_SINGLEFIELD 2 -#define RB_SEARCHFORTEXT 3 -#define RB_SEARCHFORNULL 4 -#define RB_SEARCHFORNOTNULL 5 - -#define LB_FORM 1 -#define LB_FIELD 2 -#define LB_POSITION 3 - -#define PB_APPROXSETTINGS 1 -#define PB_SEARCH 2 -#define PB_SOUNDSLIKESETTINGS 3 - -#define FL_SEARCHFOR 1 -#define FL_WHERE 2 -#define FL_OPTIONS 3 -#define FL_STATE 4 - -#define CB_USEFORMATTER 1 -#define CB_BACKWARD 2 -#define CB_STARTOVER 3 -#define CB_CASE 4 -#define CB_WILDCARD 5 -#define CB_REGULAR 6 -#define CB_APPROX 7 -#define CB_HALFFULLFORMS 8 -#define CB_SOUNDSLIKECJK 9 - -#endif // _FMSEARCH_HRC diff --git a/cui/source/dialogs/fmsearch.src b/cui/source/dialogs/fmsearch.src deleted file mode 100644 index 62bae4533..000000000 --- a/cui/source/dialogs/fmsearch.src +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "fmsearch.hrc" -#include "helpid.hrc" - -ModalDialog RID_SVXDLG_SEARCHFORM -{ - OutputSize = TRUE; - SVLook = TRUE; - Size = MAP_APPFONT( 300, 253 ); - Text [ en-US ] = "Record Search"; - Moveable = TRUE; - HelpId = HID_FM_DLG_SEARCH; - - FixedLine FL_SEARCHFOR - { - Pos = MAP_APPFONT( 6, 8 ); - Size = MAP_APPFONT( 232, 8 ); - Text [ en-US ] = "Search for"; - }; - RadioButton RB_SEARCHFORTEXT - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORTEXT"; - Pos = MAP_APPFONT( 12, 23 ); - Size = MAP_APPFONT( 50, 10 ); - Group = TRUE; - Text [ en-US ] = "~Text"; - }; - RadioButton RB_SEARCHFORNULL - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORNULL"; - Pos = MAP_APPFONT( 12, 36 ); - Size = MAP_APPFONT( 207, 10 ); - Text [ en-US ] = "Field content is ~NULL"; - }; - RadioButton RB_SEARCHFORNOTNULL - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORNOTNULL"; - Pos = MAP_APPFONT( 12, 49 ); - Size = MAP_APPFONT( 207, 10 ); - Text [ en-US ] = "Field content is not NU~LL"; - }; - ComboBox CMB_SEARCHTEXT - { - Border = TRUE; - Pos = MAP_APPFONT( 65, 20 ); - Size = MAP_APPFONT( 154, 80 ); - DropDown = TRUE; - TabStop = TRUE; - HelpId = HID_SEARCH_TEXT; - }; - - FixedLine FL_WHERE - { - Pos = MAP_APPFONT( 6, 65 ); - Size = MAP_APPFONT( 232, 8 ); - Text [ en-US ] = "Where to search"; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT( 12, 77 ); - Size = MAP_APPFONT( 87, 10 ); - Text [ en-US ] = "Form"; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXDLG_SEARCHFORM:LB_FORM"; - Border = TRUE; - Pos = MAP_APPFONT( 110, 76 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - }; - RadioButton RB_ALLFIELDS - { - Pos = MAP_APPFONT( 24, 91 ); - Size = MAP_APPFONT( 75, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_ALLFIELDS; - Text [ en-US ] = "All Fields"; - }; - RadioButton RB_SINGLEFIELD - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SINGLEFIELD"; - Pos = MAP_APPFONT( 24, 106 ); - Size = MAP_APPFONT( 75, 10 ); - Text [ en-US ] = "Single field"; - }; - ListBox LB_FIELD - { - Border = TRUE; - Pos = MAP_APPFONT( 110, 105 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - HelpId = HID_SEARCH_FIELDSELECTION; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT( 6, 126 ); - Size = MAP_APPFONT( 288, 8 ); - Text [ en-US ] = "Settings"; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT( 12, 138 ); - Size = MAP_APPFONT( 87, 8 ); - Text [ en-US ] = "Position"; - }; - ListBox LB_POSITION - { - Border = TRUE; - Pos = MAP_APPFONT( 110, 136 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - HelpId = HID_SEARCH_POSITION; - }; - CheckBox CB_USEFORMATTER - { - Pos = MAP_APPFONT( 12, 158 ); - Size = MAP_APPFONT( 90, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_FORMATTER; - Text [ en-US ] = "Apply field format"; - }; - CheckBox CB_CASE - { - Pos = MAP_APPFONT( 12, 171 ); - Size = MAP_APPFONT( 90, 20 ); - TabStop = TRUE; - WordBreak = TRUE; - HelpId = HID_SEARCH_CASE; - Text [ en-US ] = "Match case"; - }; - CheckBox CB_BACKWARD - { - Pos = MAP_APPFONT( 105, 158 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_BACKWARD; - Text [ en-US ] = "Search backwards"; - }; - CheckBox CB_STARTOVER - { - Pos = MAP_APPFONT( 105, 171 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_STARTOVER; - Text [ en-US ] = "From Beginning"; - }; - CheckBox CB_WILDCARD - { - Pos = MAP_APPFONT( 190, 158 ); - Size = MAP_APPFONT( 100, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_WILDCARD; - Text [ en-US ] = "Wildcard expression"; - }; - CheckBox CB_REGULAR - { - Pos = MAP_APPFONT( 190, 171 ); - Size = MAP_APPFONT( 100, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_REGULAR; - Text [ en-US ] = "Regular expression"; - }; - CheckBox CB_APPROX - { - Pos = MAP_APPFONT( 190, 184 ); - Size = MAP_APPFONT( 84, 20 ); - TabStop = TRUE; - WordBreak = TRUE; - HelpId = HID_SEARCH_APPROX; - Text [ en-US ] = "Similarity Search"; - }; - PushButton PB_APPROXSETTINGS - { - Pos = MAP_APPFONT( 275, 182 ); - Size = MAP_APPFONT( 14, 14 ); - TabStop = TRUE ; - HelpId = HID_SEARCH_APPROXSETTINGS; - Text [ en-US ] = "..."; - }; - CheckBox CB_HALFFULLFORMS - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHFORM:CB_HALFFULLFORMS"; - Pos = MAP_APPFONT( 105, 209 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE ; - Text [ en-US ] = "Match character width" ; - }; - CheckBox CB_SOUNDSLIKECJK - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHFORM:CB_SOUNDSLIKECJK"; - Pos = MAP_APPFONT( 190, 209 ); - Size = MAP_APPFONT( 84, 10 ); - TabStop = TRUE ; - Text [ en-US ] = "Sounds like (Japanese)"; - }; - PushButton PB_SOUNDSLIKESETTINGS - { - HelpID = "cui:PushButton:RID_SVXDLG_SEARCHFORM:PB_SOUNDSLIKESETTINGS"; - Pos = MAP_APPFONT( 275, 207 ); - Size = MAP_APPFONT( 14, 14 ); - TabStop = TRUE ; - Text [ en-US ] = "..." ; - }; - FixedLine FL_STATE - { - Pos = MAP_APPFONT( 6, 222 ); - Size = MAP_APPFONT( 288, 8 ); - Text [ en-US ] = "State"; - }; - FixedText FT_RECORDLABEL - { - Pos = MAP_APPFONT( 12, 232 ); - Size = MAP_APPFONT( 45, 10 ); - Text [ en-US ] = "Record :"; - }; - FixedText FT_RECORD - { - Pos = MAP_APPFONT( 60, 232 ); - Size = MAP_APPFONT( 30, 10 ); - UniqueId = UID_SEARCH_RECORDSTATUS; - }; - FixedText FT_HINT - { - Pos = MAP_APPFONT( 99, 232 ); - Size = MAP_APPFONT( 190, 10 ); - }; - PushButton PB_SEARCH - { - Pos = MAP_APPFONT( 244, 6 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE; - HelpId = HID_SEARCH_BTN_SEARCH; - Text [ en-US ] = "Search"; - }; - CancelButton 1 - { - Pos = MAP_APPFONT( 244, 26 ); - Size = MAP_APPFONT( 50, 14 ); - HelpId = HID_SEARCH_BTN_CLOSE; - TabStop = TRUE; - Text [ en-US ] = "~Close"; - }; - HelpButton 1 - { - Pos = MAP_APPFONT( 244, 46 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - Text [ en-US ] = "~Help"; - }; -}; - -String RID_STR_SEARCH_ANYWHERE -{ - Text [ en-US ] = "anywhere in the field"; -}; - -String RID_STR_SEARCH_BEGINNING -{ - Text [ en-US ] = "beginning of field"; -}; - -String RID_STR_SEARCH_END -{ - Text [ en-US ] = "end of field"; -}; - -String RID_STR_SEARCH_WHOLE -{ - Text [ en-US ] = "entire field"; -}; - -String RID_STR_FROM_TOP -{ - Text [ en-US ] = "From top"; -}; -String RID_STR_FROM_BOTTOM -{ - Text [ en-US ] = "From bottom"; -}; - -ErrorBox RID_SVXERR_SEARCH_NORECORD -{ - Buttons = WB_OK; - Message [ en-US ] = "No records corresponding to your data found."; -}; - -ErrorBox RID_SVXERR_SEARCH_GENERAL_ERROR -{ - Buttons = WB_OK; - Message [ en-US ] = "An unknown error occurred. The search could not be finished."; -}; - -String RID_STR_OVERFLOW_FORWARD -{ - Text [ en-US ] = "Overflow, search continued at the beginning"; -}; - -String RID_STR_OVERFLOW_BACKWARD -{ - Text [ en-US ] = "Overflow, search continued at the end"; -}; - -String RID_STR_SEARCH_COUNTING -{ - Text [ en-US ] = "counting records"; -}; diff --git a/cui/source/dialogs/gallery.src b/cui/source/dialogs/gallery.src deleted file mode 100644 index ec7ee3d13..000000000 --- a/cui/source/dialogs/gallery.src +++ /dev/null @@ -1,486 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/sfxsids.hrc> -#include "helpid.hrc" -#include "gallery.hrc" -#include <svx/exthelpid.hrc> - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -TabDialog RID_SVXTABDLG_GALLERY -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Properties of " ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERY_GENERAL ; - Text [ en-US ] = "General" ; - }; - }; - }; -}; - -/******************************************************************************/ - -TabDialog RID_SVXTABDLG_GALLERYTHEME -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Properties of " ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERY_GENERAL ; - Text [ en-US ] = "General" ; - }; - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERYTHEME_FILES ; - Text [ en-US ] = "Files" ; - }; - }; - }; -}; - -/******************************************************************************/ - -TabPage RID_SVXTABPAGE_GALLERY_GENERAL -{ - HelpId = HID_GALLERY_PROPERTIES_GENERAL; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedImage FI_MS_IMAGE - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 20 , 20 ) ; - }; - Edit EDT_MS_NAME - { - HelpID = "cui:Edit:RID_SVXTABPAGE_GALLERY_GENERAL:EDT_MS_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 10 ) ; - Size = MAP_APPFONT ( 194 , 12 ) ; - }; - FixedLine FL_MS_GENERAL_FIRST - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 248 , 1 ) ; - }; - FixedText FT_MS_TYPE - { - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Type:" ; - }; - FixedText FT_MS_SHOW_TYPE - { - Pos = MAP_APPFONT ( 60 , 43 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedText FT_MS_PATH - { - Pos = MAP_APPFONT ( 6 , 57 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Location:" ; - }; - FixedText FT_MS_SHOW_PATH - { - Pos = MAP_APPFONT ( 60 , 57 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedText FT_MS_CONTENT - { - Pos = MAP_APPFONT ( 6 , 71 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Contents:" ; - }; - FixedText FT_MS_SHOW_CONTENT - { - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedLine FL_MS_GENERAL_SECOND - { - Pos = MAP_APPFONT ( 6 , 91 ) ; - Size = MAP_APPFONT ( 248 , 1 ) ; - }; - FixedText FT_MS_CHANGEDATE - { - Pos = MAP_APPFONT ( 6 , 98 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Modified:" ; - }; - FixedText FT_MS_SHOW_CHANGEDATE - { - Pos = MAP_APPFONT ( 60 , 98 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; -}; - -/******************************************************************************/ - -TabPage RID_SVXTABPAGE_GALLERYTHEME_FILES -{ - HelpId = HID_GALLERY_BROWSER ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedText FT_FILETYPE - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 48 , 10 ) ; - Text [ en-US ] = "~File type" ; - }; - ComboBox CBB_FILETYPE - { - HelpID = "cui:ComboBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:CBB_FILETYPE"; - Pos = MAP_APPFONT ( 57 , 6 ) ; - Size = MAP_APPFONT ( 121 , 69 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoSize = TRUE; - AutoHScroll = TRUE ; - }; - MultiListBox LBX_FOUND - { - HelpID = "cui:MultiListBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:LBX_FOUND"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 23 ) ; - Size = MAP_APPFONT ( 172 , 156 ) ; - TabStop = TRUE ; - SimpleMode = TRUE ; - }; - PushButton BTN_SEARCH - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_SEARCH"; - Pos = MAP_APPFONT ( 184 , 6 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Find Files..." ; - }; - PushButton BTN_TAKE - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_TAKE"; - Pos = MAP_APPFONT ( 184 , 24 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Add" ; - }; - PushButton BTN_TAKEALL - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_TAKEALL"; - Pos = MAP_APPFONT ( 184 , 42 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "A~dd All" ; - }; - CheckBox CBX_PREVIEW - { - HelpID = "cui:CheckBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:CBX_PREVIEW"; - Pos = MAP_APPFONT ( 184 , 76 ) ; - Size = MAP_APPFONT ( 70 , 12 ) ; - Text [ en-US ] = "Pr~eview" ; - }; - Window WND_BRSPRV - { - Border = TRUE ; - Pos = MAP_APPFONT ( 184 , 91 ) ; - Size = MAP_APPFONT ( 70 , 88 ) ; - }; - PushButton BTN_MADDIN1 - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_MADDIN1"; - Pos = MAP_APPFONT ( 220 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Maddin1" ; - }; - PushButton BTN_MADDIN2 - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_MADDIN2"; - Pos = MAP_APPFONT ( 220 , 80 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Maddin2" ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_TITLE -{ - HelpId = HID_GALLERY_TITLE; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 63 ) ; - Text [ en-US ] = "Enter Title" ; - Moveable = TRUE ; - - OkButton BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 112 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 112 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 112 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - FixedLine FL_TITLE - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Title" ; - }; - Edit EDT_TITLE - { - HelpId = HID_GALLERY_TITLE_EDIT; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 18 ) ; - Size = MAP_APPFONT ( 88, 12 ) ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_SEARCH_PROGRESS -{ - HelpId = HID_GALLERY_SEARCH ; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 86 ) ; - Text [ en-US ] = "Find" ; - Moveable = TRUE ; - FixedLine FL_SEARCH_DIR - { - Pos = MAP_APPFONT ( 6 , 33 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "Directory" ; - }; - FixedText FT_SEARCH_DIR - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 66 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_SEARCH_TYPE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File type" ; - }; - FixedText FT_SEARCH_TYPE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_TAKE_PROGRESS -{ - HelpId = HID_GALLERY_APPLY ; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 56 ) ; - Text [ en-US ] = "Apply" ; - Moveable = TRUE ; - FixedLine FL_TAKE_PROGRESS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File" ; - }; - FixedText FT_TAKE_FILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 36 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS -{ - HelpId = HID_GALLERY_ACTUALIZE; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 56 ) ; - Text [ en-US ] = "Update" ; - Moveable = TRUE ; - FixedLine FL_ACTUALIZE_PROGRESS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File" ; - }; - FixedText FT_ACTUALIZE_FILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 36 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -ModalDialog RID_SVXDLG_GALLERY_THEMEID -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_GALLERY_THEMEID"; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 180 , 63 ) ; - Text [ en-US ] = "Theme ID" ; - Moveable = TRUE ; - OkButton BTN_OK - { - Pos = MAP_APPFONT ( 124 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 124 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_ID - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "ID"; - }; - ListBox LB_RESNAME - { - HelpID = "cui:ListBox:RID_SVXDLG_GALLERY_THEMEID:LB_RESNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - HScroll = TRUE ; - VScroll = TRUE ; - }; -}; - -String RID_SVXSTR_GALLERY_NOFILES -{ - Text [ en-US ] = "<No Files>" ; -}; -String RID_SVXSTR_GALLERY_SEARCH -{ - Text [ en-US ] = "Do you want to update the file list?" ; -}; -String RID_SVXSTR_GALLERYPROPS_OBJECT -{ - Text [ en-US ] = "Object;Objects" ; -}; -String RID_SVXSTR_GALLERY_READONLY -{ - Text [ en-US ] = " (read-only)" ; -}; -String RID_SVXSTR_GALLERY_ALLFILES -{ - Text [ en-US ] = "<All Files>" ; -}; -String RID_SVXSTR_GALLERY_ID_EXISTS -{ - Text [ en-US ] = "This ID already exists..." ; -}; - -/******************************************************************************/ - -Bitmap RID_SVXBMP_THEME_NORMAL_BIG -{ - File = "galnorl.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_IMPORTED_BIG -{ - File = "galimpl.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_READONLY_BIG -{ - File = "galrdol.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_DEFAULT_BIG -{ - File = "galdefl.bmp" ; -}; - - diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc deleted file mode 100644 index eaafe3818..000000000 --- a/cui/source/dialogs/grfflt.hrc +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_DLGFLT_HRC -#define _SVX_DLGFLT_HRC - -// ---------- -// - Common - -// ---------- - -#define BTN_OK 101 -#define BTN_CANCEL 102 -#define BTN_HELP 103 -#define CTL_PREVIEW 105 -#define FL_PARAMETER 106 - -// -------------------- -// - DLG_FILTERMOSAIC - -// -------------------- - -#define DLG_FILTERMOSAIC_FT_WIDTH 1 -#define DLG_FILTERMOSAIC_MTR_WIDTH 2 -#define DLG_FILTERMOSAIC_FT_HEIGHT 3 -#define DLG_FILTERMOSAIC_MTR_HEIGHT 4 -#define DLG_FILTERMOSAIC_CBX_EDGES 5 - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -#define DLG_FILTERSOLARIZE_FT_THRESHOLD 1 -#define DLG_FILTERSOLARIZE_MTR_THRESHOLD 2 -#define DLG_FILTERSOLARIZE_CBX_INVERT 3 - -// ------------------- -// - DLG_FILTERSEPIA - -// ------------------- - -#define DLG_FILTERSEPIA_FT_SEPIA 1 -#define DLG_FILTERSEPIA_MTR_SEPIA 2 - -// -------------------- -// - DLG_FILTERPOSTER - -// -------------------- - -#define DLG_FILTERPOSTER_FT_POSTER 1 -#define DLG_FILTERPOSTER_NUM_POSTER 2 - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -#define DLG_FILTEREMBOSS_FT_LIGHT 1 -#define DLG_FILTEREMBOSS_CTL_LIGHT 2 - -#endif diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src deleted file mode 100644 index c7dc35fa8..000000000 --- a/cui/source/dialogs/grfflt.src +++ /dev/null @@ -1,430 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svtools/controldims.hrc> -#include <cuires.hrc> -#include "helpid.hrc" -#include "grfflt.hrc" -#include <svx/dialogs.hrc> - -// -------------------- -// - DLG_FILTERMOSAIC - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_MOSAIC -{ - HelpID = CMD_SID_GRFFILTER_MOSAIC; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Mosaic" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y0 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERMOSAIC_FT_WIDTH - { - Pos = MAP_APPFONT ( 12, MA_Y0 ) ; - Size = MAP_APPFONT ( 77, 10 ) ; - Text [ en-US ] = "~Width" ; - }; -#define MA_Y1 MA_Y0 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERMOSAIC_MTR_WIDTH - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_MTR_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y1 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 999 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " Pixel" ; - First = 1 ; - Last = 999 ; - SpinSize = 1 ; - }; -#define MA_Y2 MA_Y1 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - FixedText DLG_FILTERMOSAIC_FT_HEIGHT - { - Pos = MAP_APPFONT ( 12, MA_Y2 ) ; - Size = MAP_APPFONT ( 77, 10 ) ; - Text [ en-US ] = "H~eight" ; - }; -#define MA_Y3 MA_Y2 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERMOSAIC_MTR_HEIGHT - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_MTR_HEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12, MA_Y3 ) ; - Size = MAP_APPFONT ( 35, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 999 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " Pixel" ; - First = 1 ; - Last = 999 ; - SpinSize = 1 ; - }; -#define MA_Y4 MA_Y3 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_Y - CheckBox DLG_FILTERMOSAIC_CBX_EDGES - { - HelpID = "cui:CheckBox:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_CBX_EDGES"; - Pos = MAP_APPFONT ( 12, MA_Y4 ) ; - Size = MAP_APPFONT ( 91, 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "E~nhance edges" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_SOLARIZE -{ - HelpID = CMD_SID_GRFFILTER_SOLARIZE; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Solarization" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y5 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERSOLARIZE_FT_THRESHOLD - { - Pos = MAP_APPFONT ( 12, MA_Y5 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Threshold ~value" ; - }; -#define MA_Y6 MA_Y5 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERSOLARIZE_MTR_THRESHOLD - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_SOLARIZE:DLG_FILTERSOLARIZE_MTR_THRESHOLD"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y6 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 1 ; - }; -#define MA_Y7 MA_Y6 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - CheckBox DLG_FILTERSOLARIZE_CBX_INVERT - { - HelpID = "cui:CheckBox:RID_SVX_GRFFILTER_DLG_SOLARIZE:DLG_FILTERSOLARIZE_CBX_INVERT"; - Pos = MAP_APPFONT ( 12, 46 ) ; - Size = MAP_APPFONT ( 77, 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Invert" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_SEPIA -{ - HelpID = CMD_SID_GRFFILTER_SEPIA; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Aging" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y8 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERSEPIA_FT_SEPIA - { - Pos = MAP_APPFONT ( 12 , MA_Y8 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Aging degree" ; - }; -#define MA_Y9 MA_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERSEPIA_MTR_SEPIA - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_SEPIA:DLG_FILTERSEPIA_MTR_SEPIA"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y9 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 1 ; - Last = 100 ; - SpinSize = 1 ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// -------------------- -// - DLG_FILTERPOSTER - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_POSTER -{ - HelpID = CMD_SID_GRFFILTER_POSTER; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Posterize" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y10 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERPOSTER_FT_POSTER - { - Pos = MAP_APPFONT ( 12 , MA_Y10 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Poster colors" ; - }; -#define MA_Y11 MA_Y10 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - NumericField DLG_FILTERPOSTER_NUM_POSTER - { - HelpID = "cui:NumericField:RID_SVX_GRFFILTER_DLG_POSTER:DLG_FILTERPOSTER_NUM_POSTER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y11 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 64 ; - StrictFormat = TRUE ; - First = 2 ; - Last = 64 ; - SpinSize = 1 ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -TabPage RID_SVX_GRFFILTER_DLG_EMBOSS_TAB -{ - HelpID = "cui:TabPage:RID_SVX_GRFFILTER_DLG_EMBOSS_TAB"; - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 0, 0 ) ; -}; - -ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS -{ - HelpID = CMD_SID_GRFFILTER_EMBOSS; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Relief" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y12 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTEREMBOSS_FT_LIGHT - { - Pos = MAP_APPFONT ( 12 , MA_Y12 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Light source" ; - }; -#define MA_Y13 MA_Y12 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - Control DLG_FILTEREMBOSS_CTL_LIGHT - { - HelpID = HID_GRFFILTER_EMBOSS_LIGHT ; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y13 ) ; - Size = MAP_APPFONT ( 77 , 60 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx deleted file mode 100644 index 375302920..000000000 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ /dev/null @@ -1,1883 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hangulhanjadlg.hxx" -#include "hangulhanjadlg.hrc" -#include "commonlingui.hxx" -#include <dialmgr.hxx> - -#include <cuires.hrc> -#include "helpid.hrc" - -#include <algorithm> -#include <tools/urlobj.hxx> -#include <vcl/controllayout.hxx> -#include <vcl/msgbox.hxx> -#include <unotools/lingucfg.hxx> -#include <unotools/linguprops.hxx> -#include <com/sun/star/linguistic2/ConversionDictionaryType.hpp> -#include <com/sun/star/linguistic2/ConversionDirection.hdl> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/i18n/TextConversionOption.hdl> -#include <com/sun/star/util/XFlushable.hpp> - -#include <comphelper/processfactory.hxx> - -#define HHC editeng::HangulHanjaConversion -#define LINE_CNT static_cast< sal_uInt16 >(2) - -//............................................................................. -namespace svx -{ -//............................................................................. - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::linguistic2; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; - using ::rtl::OUString; - - //------------------------------------------------------------------------- - namespace - { - class FontSwitch - { - private: - OutputDevice& m_rDev; - - public: - inline FontSwitch( OutputDevice& _rDev, const Font& _rTemporaryFont ) - :m_rDev( _rDev ) - { - m_rDev.Push( PUSH_FONT ); - m_rDev.SetFont( _rTemporaryFont ); - } - inline ~FontSwitch( ) - { - m_rDev.Pop( ); - } - }; - } - - //========================================================================= - //= PseudoRubyText - //========================================================================= - /** a class which allows to draw two texts in a pseudo-ruby way (which basically - means one text above or below the other, and a little bit smaller) - */ - class PseudoRubyText - { - public: - enum RubyPosition - { - eAbove, eBelow - }; - - protected: - const String m_sPrimaryText; - const String m_sSecondaryText; - const RubyPosition m_ePosition; - - public: - PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition ); - - public: - void Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, - Rectangle* _pPrimaryLocation = NULL, Rectangle* _pSecondaryLocation = NULL, - ::vcl::ControlLayoutData* _pLayoutData = NULL ); - }; - - //------------------------------------------------------------------------- - PseudoRubyText::PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition ) - :m_sPrimaryText( _rPrimary ) - ,m_sSecondaryText( _rSecondary ) - ,m_ePosition( _ePosition ) - { - } - - //------------------------------------------------------------------------- - void PseudoRubyText::Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, - Rectangle* _pPrimaryLocation, Rectangle* _pSecondaryLocation, ::vcl::ControlLayoutData* _pLayoutData ) - { - bool bLayoutOnly = NULL != _pLayoutData; - MetricVector* pTextMetrics = bLayoutOnly ? &_pLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayoutOnly ? &_pLayoutData->m_aDisplayText : NULL; - - Size aPlaygroundSize( _rRect.GetSize() ); - - // the font for the secondary text: - Font aSmallerFont( _rDevice.GetFont() ); - // heuristic: 80% of the original size - aSmallerFont.SetHeight( (long)( 0.8 * aSmallerFont.GetHeight() ) ); - - // let's calculate the size of our two texts - Rectangle aPrimaryRect = _rDevice.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle ); - Rectangle aSecondaryRect; - { - FontSwitch aFontRestore( _rDevice, aSmallerFont ); - aSecondaryRect = _rDevice.GetTextRect( _rRect, m_sSecondaryText, _nTextStyle ); - } - - // position these rectangles properly - // x-axis: - sal_Int32 nCombinedWidth = ::std::max( aSecondaryRect.GetWidth(), aPrimaryRect.GetWidth() ); - // the rectangle where both texts will reside is as high as possible, and as wide as the - // widest of both text rects - aPrimaryRect.Left() = aSecondaryRect.Left() = _rRect.Left(); - aPrimaryRect.Right() = aSecondaryRect.Right() = _rRect.Left() + nCombinedWidth; - if ( TEXT_DRAW_RIGHT & _nTextStyle ) - { - // move the rectangles to the right - aPrimaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 ); - aSecondaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 ); - } - else if ( TEXT_DRAW_CENTER & _nTextStyle ) - { - // center the rectangles - aPrimaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 ); - aSecondaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 ); - } - - // y-axis: - sal_Int32 nCombinedHeight = aPrimaryRect.GetHeight() + aSecondaryRect.GetHeight(); - // align to the top, for the moment - aPrimaryRect.Move( 0, _rRect.Top() - aPrimaryRect.Top() ); - aSecondaryRect.Move( 0, aPrimaryRect.Top() + aPrimaryRect.GetHeight() - aSecondaryRect.Top() ); - if ( TEXT_DRAW_BOTTOM & _nTextStyle ) - { - // move the rects to the bottom - aPrimaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight ); - aSecondaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight ); - } - else if ( TEXT_DRAW_VCENTER & _nTextStyle ) - { - // move the rects to the bottom - aPrimaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 ); - aSecondaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 ); - } - - // 'til here, everything we did assumes that the secondary text is painted _below_ the primary - // text. If this isn't the case, we need to correct the rectangles - if ( eAbove == m_ePosition ) - { - sal_Int32 nVertDistance = aSecondaryRect.Top() - aPrimaryRect.Top(); - aSecondaryRect.Move( 0, -nVertDistance ); - aPrimaryRect.Move( 0, nCombinedHeight - nVertDistance ); - } - - // now draw the texts - // as we already calculated the precise rectangles for the texts, we don't want to - // use the alignment flags given - within it's rect, every text is centered - sal_uInt16 nDrawTextStyle( _nTextStyle ); - nDrawTextStyle &= ~( TEXT_DRAW_RIGHT | TEXT_DRAW_LEFT | TEXT_DRAW_BOTTOM | TEXT_DRAW_TOP ); - nDrawTextStyle |= TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER; - - _rDevice.DrawText( aPrimaryRect, m_sPrimaryText, nDrawTextStyle, pTextMetrics, pDisplayText ); - { - FontSwitch aFontRestore( _rDevice, aSmallerFont ); - _rDevice.DrawText( aSecondaryRect, m_sSecondaryText, nDrawTextStyle, pTextMetrics, pDisplayText ); - } - - // outta here - if ( _pPrimaryLocation ) - *_pPrimaryLocation = aPrimaryRect; - if ( _pSecondaryLocation ) - *_pSecondaryLocation = aSecondaryRect; - } - - //========================================================================= - //= RubyRadioButton - //========================================================================= - class RubyRadioButton :public RadioButton - ,protected PseudoRubyText - { - using svx::PseudoRubyText::Paint; - - public: - RubyRadioButton( - Window* _pParent, - const ResId& _rId, // the text in the resource will be taken as primary text - const String& _rSecondary, // this will be the secondary text which will be printed somewhat smaller - const PseudoRubyText::RubyPosition _ePosition ); - - protected: - virtual void Paint( const Rectangle& _rRect ); - }; - - //------------------------------------------------------------------------- - RubyRadioButton::RubyRadioButton( Window* _pParent, const ResId& _rId, - const String& _rSecondary, const PseudoRubyText::RubyPosition _ePosition ) - :RadioButton( _pParent, _rId ) - ,PseudoRubyText( RadioButton::GetText(), _rSecondary, _ePosition ) - { - } - - //------------------------------------------------------------------------- - void RubyRadioButton::Paint( const Rectangle& ) - { - HideFocus(); - - // calculate the size of the radio image - we're to paint our text _after_ this image - DBG_ASSERT( !GetModeRadioImage(), "RubyRadioButton::Paint: images not supported!" ); - Size aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel(); - aImageSize.Width() = CalcZoom( aImageSize.Width() ); - aImageSize.Height() = CalcZoom( aImageSize.Height() ); - - Rectangle aOverallRect( Point( 0, 0 ), GetOutputSizePixel() ); - aOverallRect.Left() += aImageSize.Width() + 4; // 4 is the separator between the image and the text - // inflate the rect a little bit (because the VCL radio button does the same) - Rectangle aTextRect( aOverallRect ); - ++aTextRect.Left(); --aTextRect.Right(); - ++aTextRect.Top(); --aTextRect.Bottom(); - - // calculate the text flags for the painting - sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC; - WinBits nStyle = GetStyle( ); - - // the horizontal alignment - if ( nStyle & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; - else if ( nStyle & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; - else - nTextStyle |= TEXT_DRAW_LEFT; - // the vertical alignment - if ( nStyle & WB_BOTTOM ) - nTextStyle |= TEXT_DRAW_BOTTOM; - else if ( nStyle & WB_VCENTER ) - nTextStyle |= TEXT_DRAW_VCENTER; - else - nTextStyle |= TEXT_DRAW_TOP; - // mnemonics - if ( 0 == ( nStyle & WB_NOLABEL ) ) - nTextStyle |= TEXT_DRAW_MNEMONIC; - - // paint the ruby text - Rectangle aPrimaryTextLocation, aSecondaryTextLocation; - PseudoRubyText::Paint( *this, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation ); - - // the focus rectangle is to be painted around both texts - Rectangle aCombinedRect( aPrimaryTextLocation ); - aCombinedRect.Union( aSecondaryTextLocation ); - SetFocusRect( aCombinedRect ); - - // let the base class paint the radio button - // for this, give it the proper location to paint the image (vertically centered, relative to our text) - Rectangle aImageLocation( Point( 0, 0 ), aImageSize ); - sal_Int32 nTextHeight = aSecondaryTextLocation.Bottom() - aPrimaryTextLocation.Top(); - aImageLocation.Top() = aPrimaryTextLocation.Top() + ( nTextHeight - aImageSize.Height() ) / 2; - aImageLocation.Bottom() = aImageLocation.Top() + aImageSize.Height(); - SetStateRect( aImageLocation ); - DrawRadioButtonState( ); - - // mouse clicks should be recognized in a rect which is one pixel larger in each direction, plus - // includes the image - aCombinedRect.Left() = aImageLocation.Left(); ++aCombinedRect.Right(); - --aCombinedRect.Top(); ++aCombinedRect.Bottom(); - SetMouseRect( aCombinedRect ); - - // paint the focus rect, if necessary - if ( HasFocus() ) - ShowFocus( aTextRect ); - } - - //========================================================================= - //= SuggestionSet - //========================================================================= - //------------------------------------------------------------------------- - - SuggestionSet::SuggestionSet( Window* pParent ) - : ValueSet( pParent, pParent->GetStyle() | WB_BORDER ) - - { - } - - SuggestionSet::~SuggestionSet() - { - ClearSet(); - } - - void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt ) - { - OutputDevice* pDev = rUDEvt.GetDevice(); - Rectangle aRect = rUDEvt.GetRect(); - sal_uInt16 nItemId = rUDEvt.GetItemId(); - - String sText = *static_cast< String* >( GetItemData( nItemId ) ); - pDev->DrawText( aRect, sText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER ); - } - - void SuggestionSet::ClearSet() - { - sal_uInt16 i, nCount = GetItemCount(); - for ( i = 0; i < nCount; ++i ) - delete static_cast< String* >( GetItemData(i) ); - Clear(); - } - - //========================================================================= - //= SuggestionDisplay - //========================================================================= - //------------------------------------------------------------------------- - - SuggestionDisplay::SuggestionDisplay( Window* pParent, const ResId& rResId ) - : Control( pParent, rResId ) - , m_bDisplayListBox(true) - , m_aValueSet(this) - , m_aListBox(this,GetStyle() | WB_BORDER ) - , m_bInSelectionUpdate(false) - { - m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); - m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); - - m_aValueSet.SetLineCount( LINE_CNT ); - m_aValueSet.SetStyle( m_aValueSet.GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL ); - m_aValueSet.SetBorderStyle( WINDOW_BORDER_MONO ); - String aOneCharacter(RTL_CONSTASCII_USTRINGPARAM("AU")); - long nItemWidth = 2*GetTextWidth( aOneCharacter ); - m_aValueSet.SetItemWidth( nItemWidth ); - - Point aPos(0,0); - Size aSize(GetSizePixel()); - m_aValueSet.SetSizePixel(aSize); - m_aListBox.SetSizePixel(aSize); - - implUpdateDisplay(); - } - - SuggestionDisplay::~SuggestionDisplay() - { - } - - void SuggestionDisplay::implUpdateDisplay() - { - bool bShowBox = IsVisible() && m_bDisplayListBox; - bool bShowSet = IsVisible() && !m_bDisplayListBox; - - m_aListBox.Show(bShowBox); - m_aValueSet.Show(bShowSet); - } - - void SuggestionDisplay::StateChanged( StateChangedType nStateChange ) - { - if( STATE_CHANGE_VISIBLE == nStateChange ) - implUpdateDisplay(); - } - - Control& SuggestionDisplay::implGetCurrentControl() - { - if( m_bDisplayListBox ) - return m_aListBox; - return m_aValueSet; - } - - void SuggestionDisplay::KeyInput( const KeyEvent& rKEvt ) - { - implGetCurrentControl().KeyInput( rKEvt ); - } - void SuggestionDisplay::KeyUp( const KeyEvent& rKEvt ) - { - implGetCurrentControl().KeyUp( rKEvt ); - } - void SuggestionDisplay::Activate() - { - implGetCurrentControl().Activate(); - } - void SuggestionDisplay::Deactivate() - { - implGetCurrentControl().Deactivate(); - } - void SuggestionDisplay::GetFocus() - { - implGetCurrentControl().GetFocus(); - } - void SuggestionDisplay::LoseFocus() - { - implGetCurrentControl().LoseFocus(); - } - void SuggestionDisplay::Command( const CommandEvent& rCEvt ) - { - implGetCurrentControl().Command( rCEvt ); - } - - void SuggestionDisplay::DisplayListBox( bool bDisplayListBox ) - { - if( m_bDisplayListBox != bDisplayListBox ) - { - Control& rOldControl = implGetCurrentControl(); - sal_Bool bHasFocus = rOldControl.HasFocus(); - - m_bDisplayListBox = bDisplayListBox; - - if( bHasFocus ) - { - Control& rNewControl = implGetCurrentControl(); - rNewControl.GrabFocus(); - } - - implUpdateDisplay(); - } - } - - IMPL_LINK( SuggestionDisplay, SelectSuggestionHdl, Control*, pControl ) - { - if( m_bInSelectionUpdate ) - return 0L; - - m_bInSelectionUpdate = true; - if(pControl==&m_aListBox) - { - sal_uInt16 nPos = m_aListBox.GetSelectEntryPos(); - m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning) - } - else - { - sal_uInt16 nPos = m_aValueSet.GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning) - m_aListBox.SelectEntryPos( nPos ); - } - m_bInSelectionUpdate = false; - m_aSelectLink.Call(this); - return 0L; - } - - void SuggestionDisplay::SetSelectHdl( const Link& rLink ) - { - m_aSelectLink = rLink; - } - void SuggestionDisplay::Clear() - { - m_aListBox.Clear(); - m_aValueSet.Clear(); - } - void SuggestionDisplay::InsertEntry( const XubString& rStr ) - { - sal_uInt16 nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning) - m_aValueSet.InsertItem( nItemId ); - String* pItemData = new String(rStr); - m_aValueSet.SetItemData( nItemId, pItemData ); - } - void SuggestionDisplay::SelectEntryPos( sal_uInt16 nPos ) - { - m_aListBox.SelectEntryPos( nPos ); - m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning) - } - sal_uInt16 SuggestionDisplay::GetEntryCount() const - { - return m_aListBox.GetEntryCount(); - } - XubString SuggestionDisplay::GetEntry( sal_uInt16 nPos ) const - { - return m_aListBox.GetEntry( nPos ); - } - XubString SuggestionDisplay::GetSelectEntry() const - { - return m_aListBox.GetSelectEntry(); - } - void SuggestionDisplay::SetHelpIds() - { - this->SetHelpId( HID_HANGULDLG_SUGGESTIONS ); - m_aValueSet.SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID ); - m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST ); - } - - //========================================================================= - //= HangulHanjaConversionDialog - //========================================================================= - //------------------------------------------------------------------------- - HangulHanjaConversionDialog::HangulHanjaConversionDialog( Window* _pParent, HHC::ConversionDirection _ePrimaryDirection ) - :ModalDialog( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA ) ) - ,m_pPlayground( new SvxCommonLinguisticControl( this ) ) - ,m_aFind ( m_pPlayground.get(), CUI_RES( PB_FIND ) ) - ,m_aSuggestions ( m_pPlayground.get(), CUI_RES( CTL_SUGGESTIONS ) ) - ,m_aFormat ( m_pPlayground.get(), CUI_RES( FT_FORMAT ) ) - ,m_aSimpleConversion( m_pPlayground.get(), CUI_RES( RB_SIMPLE_CONVERSION ) ) - ,m_aHangulBracketed ( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BRACKETED ) ) - ,m_aHanjaBracketed ( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BRACKETED ) ) - ,m_aConversion ( m_pPlayground.get(), CUI_RES( FT_CONVERSION ) ) - ,m_aHangulOnly ( m_pPlayground.get(), CUI_RES( CB_HANGUL_ONLY ) ) - ,m_aHanjaOnly ( m_pPlayground.get(), CUI_RES( CB_HANJA_ONLY ) ) - ,m_aReplaceByChar ( m_pPlayground.get(), CUI_RES( CB_REPLACE_BY_CHARACTER ) ) - ,m_pIgnoreNonPrimary( NULL ) - ,m_bDocumentMode( true ) - { - // special creation of the 4 pseudo-ruby radio buttons - String sSecondaryHangul( CUI_RES( STR_HANGUL ) ); - String sSecondaryHanja( CUI_RES( STR_HANJA ) ); - m_pHanjaAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_ABOVE ), sSecondaryHanja, PseudoRubyText::eAbove ) ); - m_pHanjaBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BELOW ), sSecondaryHanja, PseudoRubyText::eBelow ) ); - m_pHangulAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_ABOVE ), sSecondaryHangul, PseudoRubyText::eAbove ) ); - m_pHangulBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BELOW ), sSecondaryHangul, PseudoRubyText::eBelow ) ); - - // since these 4 buttons are not created within the other members, they have a wrong initial Z-Order - // correct this - m_pHanjaAbove->SetZOrder( &m_aHanjaBracketed, WINDOW_ZORDER_BEHIND ); - m_pHanjaBelow->SetZOrder( m_pHanjaAbove.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulAbove->SetZOrder( m_pHanjaBelow.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulBelow->SetZOrder( m_pHangulAbove.get(), WINDOW_ZORDER_BEHIND ); - - // VCL automatically sets the WB_GROUP bit, if the previous sibling (at the moment of creation) - // is no radion button - m_pHanjaAbove->SetStyle( m_pHanjaAbove->GetStyle() & ~WB_GROUP ); - - // the "Find" button and the word input control may not have the proper distance/extensions - // -> correct this - Point aDistance = LogicToPixel( Point( 3, 0 ), MAP_APPFONT ); - sal_Int32 nTooLargeByPixels = - // right margin of the word input control - ( m_pPlayground->GetWordInputControl().GetPosPixel().X() - + m_pPlayground->GetWordInputControl().GetSizePixel().Width() - ) - // minus left margin of the find button - - m_aFind.GetPosPixel().X() - // plus desired distance between the both - + aDistance.X(); - // make the word input control smaller - Size aSize = m_pPlayground->GetWordInputControl().GetSizePixel(); - aSize.Width() -= nTooLargeByPixels; - m_pPlayground->GetWordInputControl().SetSizePixel( aSize ); - - // additionall, the playground is not wide enough (in it's default size) - sal_Int32 nEnlargeWidth = 0; - { - FixedText aBottomAnchor( m_pPlayground.get(), CUI_RES( FT_RESIZE_ANCHOR ) ); - Point aAnchorPos = aBottomAnchor.GetPosPixel(); - - nEnlargeWidth = aAnchorPos.X() - m_pPlayground->GetActionButtonsLocation().X(); - } - m_pPlayground->Enlarge( nEnlargeWidth, 0 ); - - // insert our controls into the z-order of the playground - m_pPlayground->InsertControlGroup( m_aFind, m_aFind, SvxCommonLinguisticControl::eLeftRightWords ); - m_pPlayground->InsertControlGroup( m_aSuggestions, m_aHanjaOnly, SvxCommonLinguisticControl::eSuggestionLabel ); - m_pPlayground->InsertControlGroup( m_aReplaceByChar, m_aReplaceByChar, SvxCommonLinguisticControl::eActionButtons ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eClose, LINK( this, HangulHanjaConversionDialog, OnClose ) ); - m_pPlayground->GetWordInputControl().SetModifyHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionModified ) ); - m_aSuggestions.SetSelectHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionSelected ) ); - - m_aReplaceByChar.SetClickHdl( LINK( this, HangulHanjaConversionDialog, ClickByCharacterHdl ) ); - - m_aHangulOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - m_aHanjaOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions, - LINK( this, HangulHanjaConversionDialog, OnOption ) ); - m_pPlayground->GetButton( SvxCommonLinguisticControl::eOptions )->Show(); - - if ( editeng::HangulHanjaConversion::eHangulToHanja == _ePrimaryDirection ) - { - m_pIgnoreNonPrimary = &m_aHangulOnly; - } - else - { - m_pIgnoreNonPrimary = &m_aHanjaOnly; - } - - // initial focus - FocusSuggestion( ); - - // initial control values - m_aSimpleConversion.Check(); - - m_pPlayground->GetButton(SvxCommonLinguisticControl::eClose )->SetHelpId(HID_HANGULDLG_BUTTON_CLOSE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnore )->SetHelpId(HID_HANGULDLG_BUTTON_IGNORE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnoreAll )->SetHelpId(HID_HANGULDLG_BUTTON_IGNOREALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChange )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChangeAll )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGEALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eOptions )->SetHelpId(HID_HANGULDLG_BUTTON_OPTIONS ); - m_pPlayground->GetWordInputControl().SetHelpId(HID_HANGULDLG_EDIT_NEWWORD); - - FreeResource(); - - m_aSuggestions.SetHelpIds(); - } - - //------------------------------------------------------------------------- - HangulHanjaConversionDialog::~HangulHanjaConversionDialog( ) - { - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions ) - { - m_aSuggestions.Clear(); - - const ::rtl::OUString* pSuggestions = _rSuggestions.getConstArray(); - const ::rtl::OUString* pSuggestionsEnd = _rSuggestions.getConstArray() + _rSuggestions.getLength(); - while ( pSuggestions != pSuggestionsEnd ) - m_aSuggestions.InsertEntry( *pSuggestions++ ); - - // select the first suggestion, and fill in the suggestion edit field - String sFirstSuggestion; - if ( m_aSuggestions.GetEntryCount() ) - { - sFirstSuggestion = m_aSuggestions.GetEntry( 0 ); - m_aSuggestions.SelectEntryPos( 0 ); - } - m_pPlayground->GetWordInputControl().SetText( sFirstSuggestion ); - m_pPlayground->GetWordInputControl().SaveValue(); - OnSuggestionModified( &m_pPlayground->GetWordInputControl() ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetOptionsChangedHdl( const Link& _rHdl ) - { - m_aOptionsChangedLink = _rHdl; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetIgnoreHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnore, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetIgnoreAllHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnoreAll, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetChangeHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChange, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetChangeAllHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChangeAll, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetFindHdl( const Link& _rHdl ) - { - m_aFind.SetClickHdl( _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link& _rHdl ) - { - m_aSimpleConversion.SetClickHdl( _rHdl ); - m_aHangulBracketed.SetClickHdl( _rHdl ); - m_aHanjaBracketed.SetClickHdl( _rHdl ); - m_pHanjaAbove->SetClickHdl( _rHdl ); - m_pHanjaBelow->SetClickHdl( _rHdl ); - m_pHangulAbove->SetClickHdl( _rHdl ); - m_pHangulBelow->SetClickHdl( _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetClickByCharacterHdl( const Link& _rHdl ) - { - m_aClickByCharacterLink = _rHdl; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionSelected, void*, EMPTYARG ) - { - m_pPlayground->GetWordInputControl().SetText( m_aSuggestions.GetSelectEntry() ); - OnSuggestionModified( NULL ); - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionModified, void*, EMPTYARG ) - { - m_aFind.Enable( m_pPlayground->GetWordInputControl().GetSavedValue() != m_pPlayground->GetWordInputControl().GetText() ); - - bool bSameLen = m_pPlayground->GetWordInputControl().GetText().Len() == m_pPlayground->GetCurrentText().Len(); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChange, m_bDocumentMode && bSameLen ); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChangeAll, m_bDocumentMode && bSameLen ); - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, ClickByCharacterHdl, CheckBox *, pBox ) - { - m_aClickByCharacterLink.Call(pBox); - - bool bByCharacter = pBox->IsChecked(); - m_aSuggestions.DisplayListBox( !bByCharacter ); - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnConversionDirectionClicked, CheckBox *, pBox ) - { - CheckBox *pOtherBox = 0; - if (pBox == &m_aHangulOnly) - pOtherBox = &m_aHanjaOnly; - else if (pBox == &m_aHanjaOnly) - pOtherBox = &m_aHangulOnly; - if (pBox && pOtherBox) - { - sal_Bool bBoxChecked = pBox->IsChecked(); - if (bBoxChecked) - pOtherBox->Check( sal_False ); - pOtherBox->Enable( !bBoxChecked ); - } - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnClose, void*, EMPTYARG ) - { - Close(); - return 0L; - } - - IMPL_LINK( HangulHanjaConversionDialog, OnOption, void*, EMPTYARG ) - { - HangulHanjaOptionsDialog aOptDlg( this ); - aOptDlg.Execute(); - m_aOptionsChangedLink.Call(this); - return 0L; - } - - //------------------------------------------------------------------------- - String HangulHanjaConversionDialog::GetCurrentString( ) const - { - return m_pPlayground->GetCurrentText( ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::FocusSuggestion( ) - { - m_pPlayground->GetWordInputControl().GrabFocus(); - } - - //------------------------------------------------------------------------- - namespace - { - void lcl_modifyWindowStyle( Window* _pWin, WinBits _nSet, WinBits _nReset ) - { - DBG_ASSERT( 0 == ( _nSet & _nReset ), "lcl_modifyWindowStyle: set _and_ reset the same bit?" ); - if ( _pWin ) - _pWin->SetStyle( ( _pWin->GetStyle() | _nSet ) & ~_nReset ); - } - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetCurrentString( const String& _rNewString, - const Sequence< ::rtl::OUString >& _rSuggestions, bool _bOriginatesFromDocument ) - { - m_pPlayground->SetCurrentText( _rNewString ); - - bool bOldDocumentMode = m_bDocumentMode; - m_bDocumentMode = _bOriginatesFromDocument; // before FillSuggestions! - FillSuggestions( _rSuggestions ); - - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eIgnoreAll, m_bDocumentMode ); - // all other buttons have been implicitly enabled or disabled during filling in the suggestions - - // switch the def button depending if we're working for document text - if ( bOldDocumentMode != m_bDocumentMode ) - { - Window* pOldDefButton = NULL; - Window* pNewDefButton = NULL; - if ( m_bDocumentMode ) - { - pOldDefButton = &m_aFind; - pNewDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); - } - else - { - pOldDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); - pNewDefButton = &m_aFind; - } - - DBG_ASSERT( WB_DEFBUTTON == ( pOldDefButton->GetStyle( ) & WB_DEFBUTTON ), - "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (1)!" ); - DBG_ASSERT( 0 == ( pNewDefButton->GetStyle( ) & WB_DEFBUTTON ), - "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (2)!" ); - - lcl_modifyWindowStyle( pOldDefButton, 0, WB_DEFBUTTON ); - lcl_modifyWindowStyle( pNewDefButton, WB_DEFBUTTON, 0 ); - - // give the focus to the new def button temporarily - VCL is somewhat peculiar - // in recognizing a new default button - sal_uInt32 nSaveFocusId = Window::SaveFocus(); - pNewDefButton->GrabFocus(); - Window::EndSaveFocus( nSaveFocusId ); - } - } - - //------------------------------------------------------------------------- - String HangulHanjaConversionDialog::GetCurrentSuggestion( ) const - { - return m_pPlayground->GetWordInputControl().GetText(); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetByCharacter( sal_Bool _bByCharacter ) - { - m_aReplaceByChar.Check( _bByCharacter ); - m_aSuggestions.DisplayListBox( !_bByCharacter ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionDirectionState( - sal_Bool _bTryBothDirections, - HHC::ConversionDirection _ePrimaryConversionDirection ) - { - // default state: try both direction - m_aHangulOnly.Check( sal_False ); - m_aHangulOnly.Enable( sal_True ); - m_aHanjaOnly.Check( sal_False ); - m_aHanjaOnly.Enable( sal_True ); - - if (!_bTryBothDirections) - { - CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja? - &m_aHangulOnly : &m_aHanjaOnly; - pBox->Check( sal_True ); - OnConversionDirectionClicked( pBox ); - } - } - - //------------------------------------------------------------------------- - sal_Bool HangulHanjaConversionDialog::GetUseBothDirections( ) const - { - return !m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked(); - } - - //------------------------------------------------------------------------- - HHC::ConversionDirection HangulHanjaConversionDialog::GetDirection( - HHC::ConversionDirection eDefaultDirection ) const - { - HHC::ConversionDirection eDirection = eDefaultDirection; - if (m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked()) - eDirection = HHC::eHangulToHanja; - else if (!m_aHangulOnly.IsChecked() && m_aHanjaOnly.IsChecked()) - eDirection = HHC::eHanjaToHangul; - return eDirection; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionFormat( HHC::ConversionFormat _eType ) - { - switch ( _eType ) - { - case HHC::eSimpleConversion: m_aSimpleConversion.Check(); break; - case HHC::eHangulBracketed: m_aHangulBracketed.Check(); break; - case HHC::eHanjaBracketed: m_aHanjaBracketed.Check(); break; - case HHC::eRubyHanjaAbove: m_pHanjaAbove->Check(); break; - case HHC::eRubyHanjaBelow: m_pHanjaBelow->Check(); break; - case HHC::eRubyHangulAbove: m_pHangulAbove->Check(); break; - case HHC::eRubyHangulBelow: m_pHangulBelow->Check(); break; - default: - OSL_FAIL( "HangulHanjaConversionDialog::SetConversionFormat: unknown type!" ); - } - } - - //------------------------------------------------------------------------- - HHC::ConversionFormat HangulHanjaConversionDialog::GetConversionFormat( ) const - { - if ( m_aSimpleConversion.IsChecked() ) - return HHC::eSimpleConversion; - if ( m_aHangulBracketed.IsChecked() ) - return HHC::eHangulBracketed; - if ( m_aHanjaBracketed.IsChecked() ) - return HHC::eHanjaBracketed; - if ( m_pHanjaAbove->IsChecked() ) - return HHC::eRubyHanjaAbove; - if ( m_pHanjaBelow->IsChecked() ) - return HHC::eRubyHanjaBelow; - if ( m_pHangulAbove->IsChecked() ) - return HHC::eRubyHangulAbove; - if ( m_pHangulBelow->IsChecked() ) - return HHC::eRubyHangulBelow; - - OSL_FAIL( "HangulHanjaConversionDialog::GetConversionFormat: no radio checked?" ); - return HHC::eSimpleConversion; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::EnableRubySupport( sal_Bool bVal ) - { - m_pHanjaAbove->Enable( bVal ); - m_pHanjaBelow->Enable( bVal ); - m_pHangulAbove->Enable( bVal ); - m_pHangulBelow->Enable( bVal ); - } - - - //========================================================================= - //= HangulHanjaOptionsDialog - //========================================================================= - //------------------------------------------------------------------------- - - void HangulHanjaOptionsDialog::Init( void ) - { - if( !m_xConversionDictionaryList.is() ) - { - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - m_xConversionDictionaryList = Reference< XConversionDictionaryList >( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.ConversionDictionaryList")) ), - UNO_QUERY ); - } - } - - m_aDictList.clear(); - m_aDictsLB.Clear(); - - if( m_xConversionDictionaryList.is() ) - { - Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer(); - Reference< XNameAccess > xNameAccess = Reference< XNameAccess >( xNameCont, UNO_QUERY ); - if( xNameAccess.is() ) - { - Sequence< ::rtl::OUString > aDictNames( xNameAccess->getElementNames() ); - - const ::rtl::OUString* pDic = aDictNames.getConstArray(); - sal_Int32 nCount = aDictNames.getLength(); - - sal_Int32 i; - for( i = 0 ; i < nCount ; ++i ) - { - Any aAny( xNameAccess->getByName( pDic[ i ] ) ); - Reference< XConversionDictionary > xDic; - if( ( aAny >>= xDic ) && xDic.is() ) - { - if( LANGUAGE_KOREAN == SvxLocaleToLanguage( xDic->getLocale() ) ) - { - m_aDictList.push_back( xDic ); - AddDict( xDic->getName(), xDic->isActive() ); - } - } - } - } - } - } - - IMPL_LINK( HangulHanjaOptionsDialog, OkHdl, void*, EMPTYARG ) - { - sal_uInt32 nCnt = m_aDictList.size(); - sal_uInt32 n = 0; - sal_uInt32 nActiveDics = 0; - Sequence< OUString > aActiveDics; - - aActiveDics.realloc( nCnt ); - OUString* pActActiveDic = aActiveDics.getArray(); - - while( nCnt ) - { - Reference< XConversionDictionary > xDict = m_aDictList[ n ]; - SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::GetEntry( n ); - - DBG_ASSERT( xDict.is(), "-HangulHanjaOptionsDialog::OkHdl(): someone is evaporated..." ); - DBG_ASSERT( pEntry, "-HangulHanjaOptionsDialog::OkHdl(): no one there in list?" ); - - bool bActive = m_aDictsLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED; - xDict->setActive( bActive ); - Reference< util::XFlushable > xFlush( xDict, uno::UNO_QUERY ); - if( xFlush.is() ) - xFlush->flush(); - - if( bActive ) - { - pActActiveDic[ nActiveDics ] = xDict->getName(); - ++nActiveDics; - } - - ++n; - --nCnt; - } - - // save configuration - aActiveDics.realloc( nActiveDics ); - Any aTmp; - SvtLinguConfig aLngCfg; - aTmp <<= aActiveDics; - aLngCfg.SetProperty( UPH_ACTIVE_CONVERSION_DICTIONARIES, aTmp ); - - aTmp <<= bool( m_aIgnorepostCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD, aTmp ); - - aTmp <<= bool( m_aShowrecentlyfirstCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, aTmp ); - - aTmp <<= bool( m_aAutoreplaceuniqueCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES, aTmp ); - - EndDialog( RET_OK ); - return 0; - } - - IMPL_LINK( HangulHanjaOptionsDialog, DictsLB_SelectHdl, void*, EMPTYARG ) - { - bool bSel = m_aDictsLB.FirstSelected() != NULL; - - m_aEditPB.Enable( bSel ); - m_aDeletePB.Enable( bSel ); - - return 0; - } - - IMPL_LINK( HangulHanjaOptionsDialog, NewDictHdl, void*, EMPTYARG ) - { - String aName; - HangulHanjaNewDictDialog aNewDlg( this ); - aNewDlg.Execute(); - if( aNewDlg.GetName( aName ) ) - { - if( m_xConversionDictionaryList.is() ) - { - try - { - Reference< XConversionDictionary > xDic = - m_xConversionDictionaryList->addNewDictionary( aName, SvxCreateLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA ); - - if( xDic.is() ) - { - //adapt local caches: - m_aDictList.push_back( xDic ); - AddDict( xDic->getName(), xDic->isActive() ); - } - } - catch( const ElementExistException& ) - { - } - catch( const NoSupportException& ) - { - } - } - } - - return 0L; - } - - IMPL_LINK( HangulHanjaOptionsDialog, EditDictHdl, void*, EMPTYARG ) - { - SvLBoxEntry* pEntry = m_aDictsLB.FirstSelected(); - DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" ); - if( pEntry ) - { - HangulHanjaEditDictDialog aEdDlg( this, m_aDictList, m_aDictsLB.GetSelectEntryPos() ); - aEdDlg.Execute(); - } - return 0L; - } - - IMPL_LINK( HangulHanjaOptionsDialog, DeleteDictHdl, void*, EMPTYARG ) - { - sal_uInt16 nSelPos = m_aDictsLB.GetSelectEntryPos(); - if( nSelPos != LISTBOX_ENTRY_NOTFOUND ) - { - Reference< XConversionDictionary > xDic( m_aDictList[ nSelPos ] ); - if( m_xConversionDictionaryList.is() && xDic.is() ) - { - Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer(); - if( xNameCont.is() ) - { - try - { - xNameCont->removeByName( xDic->getName() ); - - //adapt local caches: - HHDictList::iterator aIter(m_aDictList.begin()); - m_aDictList.erase(aIter+nSelPos ); - m_aDictsLB.RemoveEntry( nSelPos ); - } - catch( const ElementExistException& ) - { - } - catch( const NoSupportException& ) - { - } - } - } - } - - return 0L; - } - - HangulHanjaOptionsDialog::HangulHanjaOptionsDialog( Window* _pParent ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_OPT ) ) - ,m_aUserdefdictFT ( this, CUI_RES( FT_USERDEFDICT ) ) - ,m_aDictsLB ( this, CUI_RES( LB_DICTS ) ) - ,m_aOptionsFL ( this, CUI_RES( FL_OPTIONS ) ) - ,m_aIgnorepostCB ( this, CUI_RES( CB_IGNOREPOST ) ) - ,m_aShowrecentlyfirstCB ( this, CUI_RES( CB_SHOWRECENTLYFIRST ) ) - ,m_aAutoreplaceuniqueCB ( this, CUI_RES( CB_AUTOREPLACEUNIQUE ) ) - ,m_aNewPB ( this, CUI_RES( PB_HHO_NEW ) ) - ,m_aEditPB ( this, CUI_RES( PB_HHO_EDIT ) ) - ,m_aDeletePB ( this, CUI_RES( PB_HHO_DELETE ) ) - ,m_aOkPB ( this, CUI_RES( PB_HHO_OK ) ) - ,m_aCancelPB ( this, CUI_RES( PB_HHO_CANCEL ) ) - ,m_aHelpPB ( this, CUI_RES( PB_HHO_HELP ) ) - - ,m_pCheckButtonData ( NULL ) - ,m_xConversionDictionaryList( NULL ) - { - m_aDictsLB.SetStyle( m_aDictsLB.GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); - m_aDictsLB.SetSelectionMode( SINGLE_SELECTION ); - m_aDictsLB.SetHighlightRange(); - m_aDictsLB.SetSelectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) ); - m_aDictsLB.SetDeselectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) ); - - m_aOkPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, OkHdl ) ); - m_aNewPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, NewDictHdl ) ); - m_aEditPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, EditDictHdl ) ); - m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, DeleteDictHdl ) ); - - FreeResource(); - - SvtLinguConfig aLngCfg; - Any aTmp; - bool bVal = bool(); - aTmp = aLngCfg.GetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD ); - if( aTmp >>= bVal ) - m_aIgnorepostCB.Check( bVal ); - - aTmp = aLngCfg.GetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST ); - if( aTmp >>= bVal ) - m_aShowrecentlyfirstCB.Check( bVal ); - - aTmp = aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES ); - if( aTmp >>= bVal ) - m_aAutoreplaceuniqueCB.Check( bVal ); - - Init(); - } - - HangulHanjaOptionsDialog::~HangulHanjaOptionsDialog() - { - SvLBoxEntry* pEntry = m_aDictsLB.First(); - String* pDel; - while( pEntry ) - { - pDel = ( String* ) pEntry->GetUserData(); - if( pDel ) - delete pDel; - pEntry = m_aDictsLB.Next( pEntry ); - } - - if( m_pCheckButtonData ) - delete m_pCheckButtonData; - } - - void HangulHanjaOptionsDialog::AddDict( const String& _rName, bool _bChecked ) - { - SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::InsertEntry( _rName ); - m_aDictsLB.SetCheckButtonState( pEntry, _bChecked? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData( new String( _rName ) ); - } - - //========================================================================= - //= HangulHanjaNewDictDialog - //========================================================================= - //------------------------------------------------------------------------- - - IMPL_LINK( HangulHanjaNewDictDialog, OKHdl, void*, EMPTYARG ) - { - String aName( m_aDictNameED.GetText() ); - - aName.EraseTrailingChars(); - m_bEntered = aName.Len() > 0; - if( m_bEntered ) - m_aDictNameED.SetText( aName ); // do this in case of trailing chars have been deleted - - EndDialog( RET_OK ); - return 0; - } - - IMPL_LINK( HangulHanjaNewDictDialog, ModifyHdl, void*, EMPTYARG ) - { - String aName( m_aDictNameED.GetText() ); - - aName.EraseTrailingChars(); - m_aOkBtn.Enable( aName.Len() > 0 ); - - return 0; - } - - HangulHanjaNewDictDialog::HangulHanjaNewDictDialog( Window* _pParent ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_NEWDICT ) ) - ,m_aNewDictFL ( this, CUI_RES( FL_NEWDICT ) ) - ,m_aDictNameFT ( this, CUI_RES( FT_DICTNAME ) ) - ,m_aDictNameED ( this, CUI_RES( ED_DICTNAME ) ) - ,m_aOkBtn ( this, CUI_RES( PB_NEWDICT_OK ) ) - ,m_aCancelBtn ( this, CUI_RES( PB_NEWDICT_ESC ) ) - ,m_aHelpBtn ( this, CUI_RES( PB_NEWDICT_HLP ) ) - - ,m_bEntered ( false ) - { - m_aOkBtn.SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) ); - - m_aDictNameED.SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) ); - - FreeResource(); - } - - HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog() - { - } - - bool HangulHanjaNewDictDialog::GetName( String& _rRetName ) const - { - if( m_bEntered ) - { - _rRetName = m_aDictNameED.GetText(); - _rRetName.EraseTrailingChars(); - } - - return m_bEntered; - } - - //========================================================================= - //= HangulHanjaEditDictDialog - //========================================================================= - //------------------------------------------------------------------------- - - class SuggestionList - { - private: - protected: - sal_uInt16 m_nSize; - String** m_ppElements; - sal_uInt16 m_nNumOfEntries; - sal_uInt16 m_nAct; - - const String* _Next( void ); - public: - SuggestionList( sal_uInt16 _nNumOfElements ); - virtual ~SuggestionList(); - - bool Set( const String& _rElement, sal_uInt16 _nNumOfElement ); - bool Reset( sal_uInt16 _nNumOfElement ); - const String* Get( sal_uInt16 _nNumOfElement ) const; - void Clear( void ); - - const String* First( void ); - const String* Next( void ); - - inline sal_uInt16 GetCount( void ) const; - }; - - inline sal_uInt16 SuggestionList::GetCount( void ) const - { - return m_nNumOfEntries; - } - - SuggestionList::SuggestionList( sal_uInt16 _nNumOfElements ) - { - if( !_nNumOfElements ) - _nNumOfElements = 1; - - m_nSize = _nNumOfElements; - - m_ppElements = new String*[ m_nSize ]; - m_nAct = m_nNumOfEntries = 0; - - String** ppNull = m_ppElements; - sal_uInt16 n = _nNumOfElements; - while( n ) - { - *ppNull = NULL; - ++ppNull; - --n; - } - } - - SuggestionList::~SuggestionList() - { - Clear(); - } - - bool SuggestionList::Set( const String& _rElement, sal_uInt16 _nNumOfElement ) - { - bool bRet = _nNumOfElement < m_nSize; - if( bRet ) - { - String** ppElem = m_ppElements + _nNumOfElement; - if( *ppElem ) - **ppElem = _rElement; - else - { - *ppElem = new String( _rElement ); - ++m_nNumOfEntries; - } - } - - return bRet; - } - - bool SuggestionList::Reset( sal_uInt16 _nNumOfElement ) - { - bool bRet = _nNumOfElement < m_nSize; - if( bRet ) - { - String** ppElem = m_ppElements + _nNumOfElement; - if( *ppElem ) - { - delete *ppElem; - *ppElem = NULL; - --m_nNumOfEntries; - } - } - - return bRet; - } - - const String* SuggestionList::Get( sal_uInt16 _nNumOfElement ) const - { - const String* pRet; - - if( _nNumOfElement < m_nSize ) - pRet = m_ppElements[ _nNumOfElement ]; - else - pRet = NULL; - - return pRet; - } - - void SuggestionList::Clear( void ) - { - if( m_nNumOfEntries ) - { - String** ppDel = m_ppElements; - sal_uInt16 nCnt = m_nSize; - while( nCnt ) - { - if( *ppDel ) - { - delete *ppDel; - *ppDel = NULL; - } - - ++ppDel; - --nCnt; - } - - m_nNumOfEntries = m_nAct = 0; - } - } - - const String* SuggestionList::_Next( void ) - { - const String* pRet = NULL; - while( m_nAct < m_nSize && !pRet ) - { - pRet = m_ppElements[ m_nAct ]; - if( !pRet ) - ++m_nAct; - } - - return pRet; - } - - const String* SuggestionList::First( void ) - { - m_nAct = 0; - return _Next(); - } - - const String* SuggestionList::Next( void ) - { - const String* pRet; - - if( m_nAct < m_nNumOfEntries ) - { - ++m_nAct; - pRet = _Next(); - } - else - pRet = NULL; - - return pRet; - } - - - bool SuggestionEdit::ShouldScroll( bool _bUp ) const - { - bool bRet = false; - - if( _bUp ) - { - if( !m_pPrev ) - bRet = m_rScrollBar.GetThumbPos() > m_rScrollBar.GetRangeMin(); - } - else - { - if( !m_pNext ) - bRet = m_rScrollBar.GetThumbPos() < ( m_rScrollBar.GetRangeMax() - 4 ); - } - - return bRet; - } - - void SuggestionEdit::DoJump( bool _bUp ) - { - const Link& rLoseFocusHdl = GetLoseFocusHdl(); - if( rLoseFocusHdl.IsSet() ) - rLoseFocusHdl.Call( this ); - m_rScrollBar.SetThumbPos( m_rScrollBar.GetThumbPos() + ( _bUp? -1 : 1 ) ); - - ( static_cast< HangulHanjaEditDictDialog* >( GetParent() ) )->UpdateScrollbar(); - } - - SuggestionEdit::SuggestionEdit( Window* pParent, const ResId& rResId, - ScrollBar& _rScrollBar, SuggestionEdit* _pPrev, SuggestionEdit* _pNext ) - :Edit( pParent, rResId ) - ,m_pPrev( _pPrev ) - ,m_pNext( _pNext ) - ,m_rScrollBar( _rScrollBar ) - { - } - - SuggestionEdit::~SuggestionEdit() - { - } - - long SuggestionEdit::PreNotify( NotifyEvent& rNEvt ) - { - long nHandled = 0; - if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - const KeyCode& rKeyCode = pKEvt->GetKeyCode(); - sal_uInt16 nMod = rKeyCode.GetModifier(); - sal_uInt16 nCode = rKeyCode.GetCode(); - if( nCode == KEY_TAB && ( !nMod || KEY_SHIFT == nMod ) ) - { - bool bUp = KEY_SHIFT == nMod; - if( ShouldScroll( bUp ) ) - { - DoJump( bUp ); - SetSelection( Selection( 0, SELECTION_MAX ) ); - // Tab-travel doesn't really happen, so emulate it by setting a selection manually - nHandled = 1; - } - } - else if( KEY_UP == nCode || KEY_DOWN == nCode ) - { - bool bUp = KEY_UP == nCode; - if( ShouldScroll( bUp ) ) - { - DoJump( bUp ); - nHandled = 1; - } - else if( bUp ) - { - if( m_pPrev ) - { - m_pPrev->GrabFocus(); - nHandled = 1; - } - } - else if( m_pNext ) - { - m_pNext->GrabFocus(); - nHandled = 1; - } - } - } - - if( !nHandled ) - nHandled = Edit::PreNotify( rNEvt ); - return nHandled; - } - - - namespace - { - bool GetConversions( Reference< XConversionDictionary > _xDict, - const OUString& _rOrg, - Sequence< OUString >& _rEntries ) - { - bool bRet = false; - if( _xDict.is() && _rOrg.getLength() ) - { - try - { - _rEntries = _xDict->getConversions( _rOrg, - 0, - _rOrg.getLength(), - ConversionDirection_FROM_LEFT, - ::com::sun::star::i18n::TextConversionOption::NONE ); - bRet = _rEntries.getLength() > 0; - } - catch( const IllegalArgumentException& ) - { - } - } - - return bRet; - } - } - - - IMPL_LINK( HangulHanjaEditDictDialog, ScrollHdl, void*, EMPTYARG ) - { - UpdateScrollbar(); - - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, OriginalModifyHdl, void*, EMPTYARG ) - { - m_bModifiedOriginal = true; - m_aOriginal = m_aOriginalLB.GetText(); - m_aOriginal.EraseTrailingChars(); - - UpdateSuggestions(); - UpdateButtonStates(); - - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl1, Edit*, pEdit ) - { - EditModify( pEdit, 0 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl2, Edit*, pEdit ) - { - EditModify( pEdit, 1 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl3, Edit*, pEdit ) - { - EditModify( pEdit, 2 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl4, Edit*, pEdit ) - { - EditModify( pEdit, 3 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, BookLBSelectHdl, void*, EMPTYARG ) - { - InitEditDictDialog( m_aBookLB.GetSelectEntryPos() ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, NewPBPushHdl, void*, EMPTYARG ) - { - DBG_ASSERT( m_pSuggestions, "-HangulHanjaEditDictDialog::NewPBPushHdl(): no suggestions... search in hell..." ); - Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ]; - if( xDict.is() && m_pSuggestions ) - { - //delete old entry - bool bRemovedSomething = DeleteEntryFromDictionary( m_aOriginal, xDict ); - - OUString aLeft( m_aOriginal ); - const String* pRight = m_pSuggestions->First(); - bool bAddedSomething = false; - while( pRight ) - { - try - { - //add new entry - xDict->addEntry( aLeft, *pRight ); - bAddedSomething = true; - } - catch( const IllegalArgumentException& ) - { - } - catch( const ElementExistException& ) - { - } - - pRight = m_pSuggestions->Next(); - } - - if(bAddedSomething||bRemovedSomething) - InitEditDictDialog( m_nCurrentDict ); - } - else - { - DBG_WARNING( "+HangulHanjaEditDictDialog::NewPBPushHdl(): dictionary faded away..." ); - } - return 0; - } - - bool HangulHanjaEditDictDialog::DeleteEntryFromDictionary( const OUString&, const Reference< XConversionDictionary >& xDict ) - { - bool bRemovedSomething = false; - if( xDict.is() ) - { - OUString aOrg( m_aOriginal ); - Sequence< OUString > aEntries; - GetConversions( xDict, m_aOriginal, aEntries ); - - sal_uInt32 n = aEntries.getLength(); - OUString* pEntry = aEntries.getArray(); - while( n ) - { - try - { - xDict->removeEntry( aOrg, *pEntry ); - bRemovedSomething = true; - } - catch( const NoSuchElementException& ) - { // can not be... - } - - ++pEntry; - --n; - } - } - return bRemovedSomething; - } - - IMPL_LINK( HangulHanjaEditDictDialog, DeletePBPushHdl, void*, EMPTYARG ) - { - if( DeleteEntryFromDictionary( m_aOriginal, m_rDictList[ m_nCurrentDict ] ) ) - { - m_aOriginal.Erase(); - m_bModifiedOriginal = true; - InitEditDictDialog( m_nCurrentDict ); - } - return 0; - } - - void HangulHanjaEditDictDialog::InitEditDictDialog( sal_uInt32 _nSelDict ) - { - if( m_pSuggestions ) - m_pSuggestions->Clear(); - - if( m_nCurrentDict != _nSelDict ) - { - m_nCurrentDict = _nSelDict; - m_aOriginal.Erase(); - m_bModifiedOriginal = true; - } - - UpdateOriginalLB(); - - m_aOriginalLB.SetText( m_aOriginal.Len()? m_aOriginal : m_aEditHintText, Selection( 0, SELECTION_MAX ) ); - m_aOriginalLB.GrabFocus(); - - UpdateSuggestions(); - UpdateButtonStates(); - } - - void HangulHanjaEditDictDialog::UpdateOriginalLB( void ) - { - m_aOriginalLB.Clear(); - Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ]; - if( xDict.is() ) - { - Sequence< OUString > aEntries = xDict->getConversionEntries( ConversionDirection_FROM_LEFT ); - sal_uInt32 n = aEntries.getLength(); - OUString* pEntry = aEntries.getArray(); - while( n ) - { - m_aOriginalLB.InsertEntry( *pEntry ); - - ++pEntry; - --n; - } - } - else - { - DBG_WARNING( "+HangulHanjaEditDictDialog::UpdateOriginalLB(): dictionary faded away..." ); - } - } - - void HangulHanjaEditDictDialog::UpdateButtonStates() - { - bool bHaveValidOriginalString = m_aOriginal.Len() && m_aOriginal != m_aEditHintText; - bool bNew = bHaveValidOriginalString && m_pSuggestions && m_pSuggestions->GetCount() > 0; - bNew = bNew && (m_bModifiedSuggestions || m_bModifiedOriginal); - - m_aNewPB.Enable( bNew ); - m_aDeletePB.Enable( !m_bModifiedOriginal && bHaveValidOriginalString ); - } - - void HangulHanjaEditDictDialog::UpdateSuggestions( void ) - { - Sequence< OUString > aEntries; - bool bFound = GetConversions( m_rDictList[ m_nCurrentDict ], m_aOriginal, aEntries ); - if( bFound ) - { - m_bModifiedOriginal = false; - - if( m_pSuggestions ) - m_pSuggestions->Clear(); - - //fill found entries into boxes - sal_uInt32 nCnt = aEntries.getLength(); - if( nCnt ) - { - if( !m_pSuggestions ) - m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS ); - - const OUString* pSugg = aEntries.getConstArray(); - sal_uInt32 n = 0; - while( nCnt ) - { - m_pSuggestions->Set( pSugg[ n ], sal_uInt16( n ) ); - ++n; - --nCnt; - } - } - m_bModifiedSuggestions=false; - } - - m_aScrollSB.SetThumbPos( 0 ); - UpdateScrollbar(); // will force edits to be filled new - } - - void HangulHanjaEditDictDialog::SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum ) - { - String aStr; - if( m_pSuggestions ) - { - const String* p = m_pSuggestions->Get( _nEntryNum ); - if( p ) - aStr = *p; - } - - _rEdit.SetText( aStr ); - } - - void HangulHanjaEditDictDialog::EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset ) - { - m_bModifiedSuggestions = true; - - String aTxt( _pEdit->GetText() ); - sal_uInt16 nEntryNum = m_nTopPos + _nEntryOffset; - if( aTxt.Len() == 0 ) - { - //reset suggestion - if( m_pSuggestions ) - m_pSuggestions->Reset( nEntryNum ); - } - else - { - //set suggestion - if( !m_pSuggestions ) - m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS ); - m_pSuggestions->Set( aTxt, nEntryNum ); - } - - UpdateButtonStates(); - } - - HangulHanjaEditDictDialog::HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_EDIT ) ) - ,m_aEditHintText ( CUI_RES( STR_EDITHINT ) ) - ,m_rDictList ( _rDictList ) - ,m_nCurrentDict ( 0xFFFFFFFF ) - ,m_pSuggestions ( NULL ) - ,m_aBookFT ( this, CUI_RES( FT_BOOK ) ) - ,m_aBookLB ( this, CUI_RES( LB_BOOK ) ) - ,m_aOriginalFT ( this, CUI_RES( FT_ORIGINAL ) ) - ,m_aOriginalLB ( this, CUI_RES( LB_ORIGINAL ) ) - ,m_aSuggestionsFT ( this, CUI_RES( FT_SUGGESTIONS ) ) - ,m_aEdit1 ( this, CUI_RES( ED_1 ), m_aScrollSB, NULL, &m_aEdit2 ) - ,m_aEdit2 ( this, CUI_RES( ED_2 ), m_aScrollSB, &m_aEdit1, &m_aEdit3 ) - ,m_aEdit3 ( this, CUI_RES( ED_3 ), m_aScrollSB, &m_aEdit2, &m_aEdit4 ) - ,m_aEdit4 ( this, CUI_RES( ED_4 ), m_aScrollSB, &m_aEdit3, NULL ) - ,m_aScrollSB ( this, CUI_RES( SB_SCROLL ) ) - ,m_aNewPB ( this, CUI_RES( PB_HHE_NEW ) ) - ,m_aDeletePB ( this, CUI_RES( PB_HHE_DELETE ) ) - ,m_aHelpPB ( this, CUI_RES( PB_HHE_HELP ) ) - ,m_aClosePB ( this, CUI_RES( PB_HHE_CLOSE ) ) - ,m_nTopPos ( 0 ) - ,m_bModifiedSuggestions ( false ) - ,m_bModifiedOriginal ( false ) - { - m_aOriginalLB.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, OriginalModifyHdl ) ); - - m_aNewPB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, NewPBPushHdl ) ); - m_aNewPB.Enable( false ); - - m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, DeletePBPushHdl ) ); - - m_aDeletePB.Enable( false ); - - #if( MAXNUM_SUGGESTIONS <= 4 ) - #error number of suggestions should not under-run the value of 5 - #endif - - Link aScrLk( LINK( this, HangulHanjaEditDictDialog, ScrollHdl ) ); - m_aScrollSB.SetScrollHdl( aScrLk ); - m_aScrollSB.SetEndScrollHdl( aScrLk ); - m_aScrollSB.SetRangeMin( 0 ); - m_aScrollSB.SetRangeMax( MAXNUM_SUGGESTIONS ); - m_aScrollSB.SetPageSize( 4 ); // because we have 4 edits / page - m_aScrollSB.SetVisibleSize( 4 ); - - m_aEdit1.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl1 ) ); - m_aEdit2.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl2 ) ); - m_aEdit3.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl3 ) ); - m_aEdit4.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl4 ) ); - - m_aBookLB.SetSelectHdl( LINK( this, HangulHanjaEditDictDialog, BookLBSelectHdl ) ); - sal_uInt32 nDictCnt = m_rDictList.size(); - for( sal_uInt32 n = 0 ; n < nDictCnt ; ++n ) - { - Reference< XConversionDictionary > xDic( m_rDictList[n] ); - String aName; - if(xDic.is()) - aName = xDic->getName(); - m_aBookLB.InsertEntry( aName ); - } - m_aBookLB.SelectEntryPos( sal_uInt16( _nSelDict ) ); - - FreeResource(); - - InitEditDictDialog( _nSelDict ); - } - - HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog() - { - if( m_pSuggestions ) - delete m_pSuggestions; - } - - void HangulHanjaEditDictDialog::UpdateScrollbar( void ) - { - sal_uInt16 nPos = sal_uInt16( m_aScrollSB.GetThumbPos() ); - m_nTopPos = nPos; - - SetEditText( m_aEdit1, nPos++ ); - SetEditText( m_aEdit2, nPos++ ); - SetEditText( m_aEdit3, nPos++ ); - SetEditText( m_aEdit4, nPos ); - } - -//............................................................................. -} // namespace svx -//............................................................................. - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hangulhanjadlg.hrc b/cui/source/dialogs/hangulhanjadlg.hrc deleted file mode 100644 index d8ad70b21..000000000 --- a/cui/source/dialogs/hangulhanjadlg.hrc +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_HANGUL_HANJA_DLG_HRC -#define SVX_HANGUL_HANJA_DLG_HRC - -#ifndef _SVT_CONTROLDIMS_HRC_ -#include <svtools/controldims.hrc> -#endif - -// PushButton -#define PB_FIND 1 - -// Control -#define CTL_SUGGESTIONS 1 - -// FixedText -#define FT_FORMAT 1 -#define FT_RESIZE_ANCHOR 2 -#define FT_CONVERSION 3 - -// RadioButton -#define RB_SIMPLE_CONVERSION 1 -#define RB_HANJA_HANGUL_BRACKETED 2 -#define RB_HANGUL_HANJA_BRACKETED 3 -#define RB_HANGUL_HANJA_ABOVE 4 -#define RB_HANGUL_HANJA_BELOW 5 -#define RB_HANJA_HANGUL_ABOVE 6 -#define RB_HANJA_HANGUL_BELOW 7 - -// CheckBox -#define CB_REPLACE_BY_CHARACTER 1 -#define CB_HANGUL_ONLY 2 -#define CB_HANJA_ONLY 3 - -// String -#define STR_HANGUL 1 -#define STR_HANJA 2 - -#define FT_WORD 10 -#define FT_AKTWORD 11 -#define FT_NEWWORD 12 -#define GB_AUDIT 13 -#define BTN_IGNORE 14 -#define BTN_IGNOREALL 15 -#define BTN_CHANGE 16 -#define BTN_CHANGEALL 17 -#define FT_STATUS 18 -#define BTN_SPL_CANCEL 19 -#define BTN_SPL_HELP 20 -#define ED_NEWWORD 21 -#define FT_SUGGESTION 22 - - - -// Hangul / Hanja Options Dialog - -#define FT_USERDEFDICT 1 -#define FL_OPTIONS 2 -#define BTN_OPTIONS 10 - -#define LB_DICTS 1 - -#define CB_IGNOREPOST 1 -#define CB_SHOWRECENTLYFIRST 3 -#define CB_AUTOREPLACEUNIQUE 4 - -#define PB_HHO_NEW 1 -#define PB_HHO_EDIT 2 -#define PB_HHO_DELETE 3 -#define PB_HHO_OK 4 -#define PB_HHO_CANCEL 5 -#define PB_HHO_HELP 6 - -// metrics - -#define HHO_DLGWIDTH 287 -#define HHx_DLGHIGHT 175 -#define HHO_COL_1 RSC_SP_DLG_INNERBORDER_LEFT -#define HHO_COL_1a (HHO_COL_1+3) -#define HHO_COL_6 (HHO_DLGWIDTH-6) -#define HHO_COL_5 (HHO_COL_6-50) -#define HHO_COL_4 (HHO_COL_5-12) -#define HHO_COL_3 (HHO_COL_4-50) -#define HHO_COL_2 (HHO_COL_3-6) - -#define HHO_ROW_1 RSC_SP_DLG_INNERBORDER_TOP -#define HHO_ROW_2 (HHO_ROW_1+8+2) -#define HHO_ROW_3 (HHO_ROW_2+14) -#define HHO_ROW_4 (HHO_ROW_3+2) -#define HHO_ROW_5 (HHO_ROW_4+14) -#define HHO_ROW_6 (HHO_ROW_5+2) -#define HHO_ROW_7 (HHO_ROW_6+14) -#define HHO_ROW_8 (HHO_ROW_7+4) -#define HHO_ROW_9 (HHO_ROW_8+8+4) -#define HHO_ROW_11 (HHO_ROW_9+8+4) -#define HHO_ROW_12 (HHO_ROW_11+8+4) - -#define HHO_ROW_a1 HHO_ROW_1 -#define HHO_ROW_a2 (HHO_ROW_a1+14) -#define HHO_ROW_a3 (HHO_ROW_a2+2) -#define HHO_ROW_a4 (HHO_ROW_a3+14) -#define HHO_ROW_a5 (HHO_ROW_a4+4) -#define HHO_ROW_a6 (HHO_ROW_a5+14) - - -// Hangul / Hanja New Dictonary Dialog -#define FL_NEWDICT 1 - -#define FT_DICTNAME 1 - -#define ED_DICTNAME 1 - -#define PB_NEWDICT_OK 1 -#define PB_NEWDICT_ESC 2 -#define PB_NEWDICT_HLP 3 - - -// Hangul Hanja Edit Custom Dictionary Dialog -#define MAXNUM_SUGGESTIONS 50 - -#define STR_EDITHINT 1 - -#define FT_BOOK 1 -#define FT_ORIGINAL 2 -#define FT_SUGGESTIONS 3 - -#define LB_BOOK 1 -#define LB_ORIGINAL 2 - -#define PB_HHE_NEW 1 -#define PB_HHE_DELETE 2 -#define PB_HHE_HELP 3 -#define PB_HHE_CLOSE 4 - -#define SB_SCROLL 1 - -#define ED_1 1 -#define ED_2 2 -#define ED_3 3 -#define ED_4 4 - -// metrics - -#define RSC_CD_VSCRLWIDTH 8 // vertical scroll bar width -#define HHE_DLGWIDTH HHO_DLGWIDTH -#define HHE_COL_1 RSC_SP_DLG_INNERBORDER_LEFT -#define HHE_COL_6 (HHE_DLGWIDTH-RSC_SP_DLG_INNERBORDER_RIGHT) -#define HHE_COL_5 (HHE_COL_6-RSC_CD_PUSHBUTTON_WIDTH) -#define HHE_COL_4 (HHE_COL_5-6) -#define HHE_COL_3_2 (HHE_COL_4-RSC_CD_VSCRLWIDTH) -#define HHE_COL_3_1 (HHE_COL_3_2-RSC_SP_CTRL_GROUP_X) -#define HHE_COL_3_0 (HHE_COL_3_2-RSC_CD_PUSHBUTTON_WIDTH) -#define HHE_COL_2 (HHE_COL_1+50) -#define HHE_COL_3 (HHE_COL_2+1) - -#define HHE_ROW_1 RSC_SP_DLG_INNERBORDER_TOP -#define HHE_ROW_2 (HHE_ROW_1+2) -#define HHE_ROW_3 (HHE_ROW_2+12) -#define HHE_ROW_4 (HHE_ROW_3+12) -#define HHE_ROW_5 (HHE_ROW_4+8+2) -#define HHE_ROW_6 (HHE_ROW_5+12) -#define HHE_ROW_7 (HHE_ROW_6+2) -#define HHE_ROW_8 (HHE_ROW_7+2) -#define HHE_ROW_9 (HHE_ROW_6+12) -#define HHE_ROW_10 (HHE_ROW_8+RSC_SP_CTRL_GROUP_Y) -#define HHE_ROW_11 (HHE_ROW_10+8+2) -#define HHE_ROW_12 (HHE_ROW_11+4*12) -#define HHE_ROW_14 (HHx_DLGHIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM) -#define HHE_ROW_13 (HHE_ROW_14-RSC_CD_PUSHBUTTON_HEIGHT) -#define HHE_ROW_a1 (HHE_ROW_5) -#define HHE_ROW_a3 (HHE_ROW_a1+RSC_CD_PUSHBUTTON_HEIGHT+2) - -#endif // SVX_HANGUL_HANJA_DLG_HRC diff --git a/cui/source/dialogs/hangulhanjadlg.src b/cui/source/dialogs/hangulhanjadlg.src deleted file mode 100644 index c7c7172de..000000000 --- a/cui/source/dialogs/hangulhanjadlg.src +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <cuires.hrc> -#include "helpid.hrc" - -#ifndef SVX_HANGUL_HANJA_DLG_HRC -#include "hangulhanjadlg.hrc" -#endif - -ModalDialog RID_SVX_MDLG_HANGULHANJA -{ - HelpId = HID_DIALOG_HANGULHANJA; - Size = MAP_APPFONT( 302, 175 ); - OutputSize = TRUE; - Closeable = TRUE ; - Moveable = TRUE ; - SVLook = TRUE; - - Text [ en-US ] = "Hangul/Hanja Conversion"; - - PushButton PB_FIND - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA:PB_FIND"; - Pos = MAP_APPFONT( 207, 23 ); - Size = MAP_APPFONT( 30, 14 ); - - Text [ en-US ] = "~Find"; - }; - - Control CTL_SUGGESTIONS - { - Pos = MAP_APPFONT( 51, 46 ); - Size = MAP_APPFONT( 186, 30 ); - TabStop = TRUE ; - }; - - FixedText FT_FORMAT - { - Pos = MAP_APPFONT( 6, 81 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Format"; - }; - - RadioButton RB_SIMPLE_CONVERSION - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_SIMPLE_CONVERSION"; - Pos = MAP_APPFONT( 51, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Group = TRUE; - - Text [ en-US ] = "~Hangul/Hanja"; - }; - - RadioButton RB_HANJA_HANGUL_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BRACKETED"; - Pos = MAP_APPFONT( 114, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hanja (Han~gul)"; - }; - - RadioButton RB_HANGUL_HANJA_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BRACKETED"; - Pos = MAP_APPFONT( 177, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hang~ul (Hanja)"; - }; - - RadioButton RB_HANGUL_HANJA_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_ABOVE"; - Pos = MAP_APPFONT( 51, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hangu~l"; - }; - - RadioButton RB_HANGUL_HANJA_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BELOW"; - Pos = MAP_APPFONT( 114, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hang~ul"; - }; - - RadioButton RB_HANJA_HANGUL_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_ABOVE"; - Pos = MAP_APPFONT( 56, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Han~ja"; - }; - - RadioButton RB_HANJA_HANGUL_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BELOW"; - Pos = MAP_APPFONT( 114, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Ha~nja"; - }; - - FixedText FT_CONVERSION - { - Pos = MAP_APPFONT( 6, 134 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Conversion"; - }; - - CheckBox CB_HANGUL_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANGUL_ONLY"; - Pos = MAP_APPFONT( 51, 134 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hangul ~only"; - }; - - CheckBox CB_HANJA_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANJA_ONLY"; - Pos = MAP_APPFONT( 114, 134 ); - Size = MAP_APPFONT( 55, 8 ); - - Text [ en-US ] = "Hanja onl~y"; - }; - - // this element is only for determining where our radio button group ends (in both directions) - FixedText FT_RESIZE_ANCHOR - { - Pos = MAP_APPFONT( 241, 133 ); - }; - - CheckBox CB_REPLACE_BY_CHARACTER - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_REPLACE_BY_CHARACTER"; - Pos = MAP_APPFONT( 241, 81 ); - Size = MAP_APPFONT( 55, 24 ); - - WordBreak = TRUE; - - Text [ en-US ] = "Replace b~y character"; - }; - - String STR_HANGUL - { - Text [ en-US ] = "Hangul"; - }; - - String STR_HANJA - { - Text [ en-US ] = "Hanja"; - }; -}; - -ModalDialog RID_SVX_MDLG_HANGULHANJA_OPT -{ - OutputSize = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - HelpId = HID_HANGULHANJA_OPT_DLG; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( HHO_DLGWIDTH , HHx_DLGHIGHT ) ; - Text [ en-US ] = "Hangul/Hanja Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedText FT_USERDEFDICT - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_1 ) ; - Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1, 8 ) ; - Text[ en-US ] = "User-defined dictionaries"; - }; - Control LB_DICTS - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_2 ) ; - Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1 , HHO_ROW_7 - HHO_ROW_2 ) ; - HelpId = HID_HANGULHANJA_OPT_DICTS_LB; - TabStop = TRUE; - Border = TRUE; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_8 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_1, 8 ) ; - Text[ en-US ] = "Options"; - }; - CheckBox CB_IGNOREPOST - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_IGNOREPOST"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_9 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text[ en-US ] = "Ignore post-positional word"; - }; - CheckBox CB_SHOWRECENTLYFIRST - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_SHOWRECENTLYFIRST"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_11 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text [ en-US ] = "Show recently used entries first"; - }; - CheckBox CB_AUTOREPLACEUNIQUE - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_AUTOREPLACEUNIQUE"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_12 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text [ en-US ] = "Replace all unique entries automatically"; - }; - PushButton PB_HHO_NEW - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_NEW"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_2 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "New..."; - }; - PushButton PB_HHO_EDIT - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_EDIT"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_4 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "Edit..."; - }; - PushButton PB_HHO_DELETE - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_DELETE"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_6 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "Delete"; - }; - OKButton PB_HHO_OK - { - DefButton = TRUE; - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a1 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - CancelButton PB_HHO_CANCEL - { - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a3 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - HelpButton PB_HHO_HELP - { - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a5 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - -}; - - -ModalDialog RID_SVX_MDLG_HANGULHANJA_NEWDICT -{ - HelpId = HID_HANGULHANJA_NEWDICT_DLG; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 213 , 66 ) ; - Moveable = TRUE ; - - Text [ en-US ] = "New Dictionary" ; - - FixedLine FL_NEWDICT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 145 , 8 ) ; - Text [ en-US ] = "Dictionary" ; - }; - FixedText FT_DICTNAME - { - Pos = MAP_APPFONT ( 11 , 15 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "~Name" ; - }; - Edit ED_DICTNAME - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_NEWDICT:ED_DICTNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 14 ) ; - Size = MAP_APPFONT ( 90 , 12 ) ; - MaxTextLength = 32 ; - }; - OKButton PB_NEWDICT_OK - { - Pos = MAP_APPFONT ( 157 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_NEWDICT_ESC - { - Pos = MAP_APPFONT ( 157 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_NEWDICT_HLP - { - Pos = MAP_APPFONT ( 157 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - - -ModalDialog RID_SVX_MDLG_HANGULHANJA_EDIT -{ - OutputSize = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - HelpId = HID_HANGULHANJA_EDIT_DLG; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( HHE_DLGWIDTH , HHx_DLGHIGHT ) ; - Text [ en-US ] = "Edit Custom Dictionary" ; - Moveable = TRUE ; - Closeable = TRUE ; - - String STR_EDITHINT - { - Text [ en-US ] = "[Enter text here]"; - }; - FixedText FT_BOOK - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_2 ) ; - Size = MAP_APPFONT ( HHE_COL_2 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Book"; - }; - ListBox LB_BOOK - { - HelpID = "cui:ListBox:RID_SVX_MDLG_HANGULHANJA_EDIT:LB_BOOK"; - Pos = MAP_APPFONT ( HHE_COL_3 , HHE_ROW_1 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_3 , 60 ) ; - DropDown = TRUE; - Border = TRUE; - }; - FixedText FT_ORIGINAL - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_4 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Original"; - }; - ComboBox LB_ORIGINAL - { - HelpID = "cui:ComboBox:RID_SVX_MDLG_HANGULHANJA_EDIT:LB_ORIGINAL"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_5 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1 , 60 ) ; - DropDown = TRUE; - Border = TRUE; - }; - FixedText FT_SUGGESTIONS - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_10 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Suggestions (max. 8)"; - }; - Edit ED_1 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_1"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_2 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_2"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 12 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_3 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_3"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 24 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_4 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_4"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 36 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - ScrollBar SB_SCROLL - { - Pos = MAP_APPFONT ( HHE_COL_3_2 , HHE_ROW_11 ) ; - Size = MAP_APPFONT ( RSC_CD_VSCRLWIDTH , HHE_ROW_12 - HHE_ROW_11 ) ; // height = 48 - VScroll = TRUE ; - Drag = TRUE ; - }; - PushButton PB_HHE_NEW - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_NEW"; - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a1 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "New"; - }; - PushButton PB_HHE_DELETE - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_DELETE"; - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Delete"; - }; - HelpButton PB_HHE_HELP - { - Pos = MAP_APPFONT ( HHE_COL_3_0 , HHE_ROW_13 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - }; - CancelButton PB_HHE_CLOSE - { - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_13 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Close"; - }; -}; - - - diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx deleted file mode 100644 index 212416c64..000000000 --- a/cui/source/dialogs/hldocntp.cxx +++ /dev/null @@ -1,485 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hldocntp.hxx" -#include <sfx2/viewfrm.hxx> -#include <sfx2/docfac.hxx> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Sequence.h> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/uno/Exception.hpp> -#include <unotools/localfilehelper.hxx> -#include <tools/config.hxx> -#include <vcl/image.hxx> -#include <tools/urlobj.hxx> -#include <unotools/pathoptions.hxx> -#include <unotools/dynamicmenuoptions.hxx> -#include <sfx2/filedlghelper.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <unotools/ucbhelper.hxx> - -#include "hyperdlg.hrc" -#include <comphelper/processfactory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - -using namespace ::rtl; -using namespace ::com::sun::star; - -/************************************************************************* -|* -|* Data-struct for documenttypes in listbox -|* -|************************************************************************/ - -struct DocumentTypeData -{ - String aStrURL; - String aStrExt; - DocumentTypeData (String aURL, String aExt) : aStrURL(aURL), aStrExt(aExt) - {} -}; - -sal_Bool SvxHyperlinkNewDocTp::ImplGetURLObject( const String& rPath, const String& rBase, INetURLObject& aURLObject ) const -{ - sal_Bool bIsValidURL = rPath.Len() != 0; - if ( bIsValidURL ) - { - aURLObject.SetURL( rPath ); - if ( aURLObject.GetProtocol() == INET_PROT_NOT_VALID ) // test if the source is already a valid url - { // if not we have to create a url from a physical file name - bool wasAbs; - INetURLObject base(rBase); - base.setFinalSlash(); - aURLObject = base.smartRel2Abs( - rPath, wasAbs, true, INetURLObject::ENCODE_ALL, - RTL_TEXTENCODING_UTF8, true); - } - bIsValidURL = aURLObject.GetProtocol() != INET_PROT_NOT_VALID; - if ( bIsValidURL ) - { - String aBase( aURLObject.getName( INetURLObject::LAST_SEGMENT, sal_False ) ); - if ( ( aBase.Len() == 0 ) || ( aBase.GetChar( 0 ) == '.' ) ) - bIsValidURL = sal_False; - } - if ( bIsValidURL ) - { - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aURLObject.SetExtension( ((DocumentTypeData*)maLbDocTypes.GetEntryData( nPos ))->aStrExt ); - } - - } - return bIsValidURL; -} - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( Window *pParent, const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT ), rItemSet ), - maGrpNewDoc ( this, CUI_RES (GRP_NEWDOCUMENT) ), - maRbtEditNow ( this, CUI_RES (RB_EDITNOW) ), - maRbtEditLater ( this, CUI_RES (RB_EDITLATER) ), - maFtPath ( this, CUI_RES (FT_PATH_NEWDOC) ), - maCbbPath ( this, INET_PROT_FILE ), - maBtCreate ( this, CUI_RES (BTN_CREATE) ), - maFtDocTypes ( this, CUI_RES (FT_DOCUMENT_TYPES) ), - maLbDocTypes ( this, CUI_RES (LB_DOCUMENT_TYPES) ) -{ - // Set HC bitmaps and disable display of bitmap names. - maBtCreate.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - SetExchangeSupport (); - - maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2 , 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbPath.Show(); - maCbbPath.SetBaseURL(SvtPathOptions().GetWorkPath()); - - // set defaults - maRbtEditNow.Check(); - - maBtCreate.SetClickHdl ( LINK ( this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl ) ); - - maBtCreate.SetAccessibleRelationMemberOf( &maGrpNewDoc ); - maBtCreate.SetAccessibleRelationLabeledBy( &maFtPath ); - - FillDocumentList (); -} - -SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp () -{ - for ( sal_uInt16 n=0; n<maLbDocTypes.GetEntryCount(); n++ ) - { - DocumentTypeData* pTypeData = (DocumentTypeData*) - maLbDocTypes.GetEntryData ( n ); - delete pTypeData; - } -} - -/************************************************************************* -|* -|* Fill the all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - - -void SvxHyperlinkNewDocTp::FillDlgFields ( String& /*aStrURL*/ ) -{ -} - -#define INTERNETSHORTCUT_ID_TAG "InternetShortcut" -#define INTERNETSHORTCUT_TITLE_TAG "Title" -#define INTERNETSHORTCUT_TARGET_TAG "Target" -#define INTERNETSHORTCUT_FOLDER_TAG "Folder" -#define INTERNETSHORTCUT_URL_TAG "URL" -#define INTERNETSHORTCUT_ICONID_TAG "IconIndex" - -void SvxHyperlinkNewDocTp::FillDocumentList () -{ - EnterWait(); - - uno::Sequence< uno::Sequence< beans::PropertyValue > > - aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( E_NEWMENU ) ); - - sal_uInt32 i, nCount = aDynamicMenuEntries.getLength(); - for ( i = 0; i < nCount; i++ ) - { - uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ]; - - rtl::OUString aDocumentUrl, aTitle, aImageId, aTargetName; - - for ( int e = 0; e < rDynamicMenuEntry.getLength(); e++ ) - { - if ( rDynamicMenuEntry[ e ].Name == DYNAMICMENU_PROPERTYNAME_URL ) - rDynamicMenuEntry[ e ].Value >>= aDocumentUrl; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TITLE ) - rDynamicMenuEntry[e].Value >>= aTitle; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ) - rDynamicMenuEntry[e].Value >>= aImageId; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME ) - rDynamicMenuEntry[e].Value >>= aTargetName; - } - //#i96822# business cards, labels and database should not be inserted here - if( aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21051" ) ) || - aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21052" )) || - aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/sdatabase?Interactive" ))) - continue; - - // Insert into listbox - if ( aDocumentUrl.getLength() ) - { - if ( aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:factory/simpress?slot=6686" ) ) ) // SJ: #106216# do not start - aDocumentUrl = String( RTL_CONSTASCII_USTRINGPARAM( "private:factory/simpress" ) ); // the AutoPilot for impress - - // insert private-url and default-extension as user-data - const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aDocumentUrl ); - if ( pFilter ) - { - // insert doc-name and image - String aTitleName( aTitle ); - aTitleName.Erase( aTitleName.Search( (sal_Unicode)'~' ), 1 ); - - sal_Int16 nPos = maLbDocTypes.InsertEntry ( aTitleName ); - String aStrDefExt( pFilter->GetDefaultExtension () ); - DocumentTypeData *pTypeData = new DocumentTypeData ( aDocumentUrl, aStrDefExt.Copy( 2, aStrDefExt.Len() ) ); - maLbDocTypes.SetEntryData ( nPos, pTypeData ); - } - } - } - maLbDocTypes.SelectEntryPos ( 0 ); - - LeaveWait(); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkNewDocTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - // get data from dialog-controls - aStrURL = maCbbPath.GetText(); - INetURLObject aURL; - if ( ImplGetURLObject( aStrURL, maCbbPath.GetBaseURL(), aURL ) ) - { - aStrURL = aURL.GetMainURL( INetURLObject::NO_DECODE ); - } - - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkNewDocTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkNewDocTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkNewDocTp::SetInitFocus() -{ - maCbbPath.GrabFocus(); -} - -/************************************************************************* -|* -|* Ask page whether an insert is possible -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkNewDocTp::AskApply() -{ - INetURLObject aINetURLObject; - sal_Bool bRet = ImplGetURLObject( maCbbPath.GetText(), maCbbPath.GetBaseURL(), aINetURLObject ); - if ( !bRet ) - { - WarningBox aWarning( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) ); - aWarning.Execute(); - } - return bRet; -} - -/************************************************************************* -|* -|* Any action to do after apply-button is pressed -|* -\************************************************************************/ - -void SvxHyperlinkNewDocTp::DoApply () -{ - EnterWait(); - - // get data from dialog-controls - String aStrNewName = maCbbPath.GetText(); - - if ( aStrNewName == aEmptyStr ) - aStrNewName = maStrInitURL; - - /////////////////////////////////////////////////////// - // create a real URL-String - - INetURLObject aURL; - if ( ImplGetURLObject( aStrNewName, maCbbPath.GetBaseURL(), aURL ) ) - { - - /////////////////////////////////////////////////////// - // create Document - - aStrNewName = aURL.GetURLPath( INetURLObject::NO_DECODE ); - SfxViewFrame *pViewFrame = NULL; - try - { - bool bCreate = true; - - // check if file exists, warn before we overwrite it - { - com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler; - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler ); - - sal_Bool bOk = pIStm && ( pIStm->GetError() == 0); - - if( pIStm ) - delete pIStm; - - if( bOk ) - { - WarningBox aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) ); - bCreate = aWarning.Execute() == BUTTON_YES; - } - } - - if( bCreate ) - { - // current document - SfxViewFrame* pCurrentDocFrame = SfxViewFrame::Current(); - - if ( aStrNewName != aEmptyStr ) - { - // get private-url - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - if( nPos == LISTBOX_ENTRY_NOTFOUND ) - nPos=0; - String aStrDocName ( ( ( DocumentTypeData* ) - maLbDocTypes.GetEntryData( nPos ) )->aStrURL ); - - // create items - SfxStringItem aName( SID_FILE_NAME, aStrDocName ); - SfxStringItem aReferer( SID_REFERER, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) ); - SfxStringItem aFrame( SID_TARGETNAME, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_blank" ) ) ); - - String aStrFlags ( sal_Unicode('S') ); - if ( maRbtEditLater.IsChecked() ) - { - aStrFlags += sal_Unicode('H'); - } - SfxStringItem aFlags (SID_OPTIONS, aStrFlags); - - // open url - const SfxPoolItem* pReturn = GetDispatcher()->Execute( SID_OPENDOC, - SFX_CALLMODE_SYNCHRON, - &aName, &aFlags, - &aFrame, &aReferer, 0L ); - - // save new doc - const SfxViewFrameItem *pItem = PTR_CAST( SfxViewFrameItem, pReturn ); // SJ: pReturn is NULL if the Hyperlink - if ( pItem ) // creation is cancelled #106216# - { - pViewFrame = pItem->GetFrame(); - if (pViewFrame) - { - SfxStringItem aNewName( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - pViewFrame->GetDispatcher()->Execute( SID_SAVEASDOC, - SFX_CALLMODE_SYNCHRON, - &aNewName, 0L ); - - } - } - } - - if ( maRbtEditNow.IsChecked() && pCurrentDocFrame ) - { - pCurrentDocFrame->ToTop(); - } - } - } - catch (const uno::Exception&) - { - } - - if ( pViewFrame && maRbtEditLater.IsChecked() ) - { - SfxObjectShell* pObjShell = pViewFrame->GetObjectShell(); - pObjShell->DoClose(); - } - } - - LeaveWait(); -} - -/************************************************************************* -|* -|* Click on imagebutton : new -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkNewDocTp, ClickNewHdl_Impl, void *, EMPTYARG ) -{ - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - uno::Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); - - String aStrURL; - String aTempStrURL( maCbbPath.GetText() ); - utl::LocalFileHelper::ConvertSystemPathToURL( aTempStrURL, maCbbPath.GetBaseURL(), aStrURL ); - - String aStrPath = aStrURL; - sal_Bool bZeroPath = ( aStrPath.Len() == 0 ); - sal_Bool bHandleFileName = bZeroPath; // when path has length of 0, then the rest should always be handled - // as file name, otherwise we do not yet know - - if( bZeroPath ) - aStrPath = SvtPathOptions().GetWorkPath(); - else if( !::utl::UCBContentHelper::IsFolder( aStrURL ) ) - bHandleFileName = sal_True; - - xFolderPicker->setDisplayDirectory( aStrPath ); - DisableClose( sal_True ); - sal_Int16 nResult = xFolderPicker->execute(); - DisableClose( sal_False ); - if( ExecutableDialogResults::OK == nResult ) - { - sal_Char const sSlash[] = "/"; - - INetURLObject aURL( aStrURL, INET_PROT_FILE ); - String aStrName; - if( bHandleFileName ) - aStrName = bZeroPath? aTempStrURL : String(aURL.getName()); - - maCbbPath.SetBaseURL( xFolderPicker->getDirectory() ); - String aStrTmp( xFolderPicker->getDirectory() ); - - if( aStrTmp.GetChar( aStrTmp.Len() - 1 ) != sSlash[0] ) - aStrTmp.AppendAscii( sSlash ); - - // append old file name - if( bHandleFileName ) - aStrTmp += aStrName; - - INetURLObject aNewURL( aStrTmp ); - - if( aStrName.Len() > 0 && aNewURL.getExtension().getLength() > 0 && - maLbDocTypes.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - // get private-url - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - aNewURL.setExtension( ( ( DocumentTypeData* ) maLbDocTypes.GetEntryData( nPos ) )->aStrExt ); - } - - if( aNewURL.GetProtocol() == INET_PROT_FILE ) - { - utl::LocalFileHelper::ConvertURLToSystemPath( aNewURL.GetMainURL( INetURLObject::NO_DECODE ), aStrTmp ); - } - else - { - aStrTmp = aNewURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - } - - maCbbPath.SetText ( aStrTmp ); - } - return( 0L ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx deleted file mode 100644 index dfa73b4e3..000000000 --- a/cui/source/dialogs/hldoctp.cxx +++ /dev/null @@ -1,376 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cuihyperdlg.hxx" -#include <unotools/localfilehelper.hxx> -#include <sfx2/filedlghelper.hxx> -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#include "hldoctp.hxx" -#include "hyperdlg.hrc" -#include "hlmarkwn_def.hxx" - -sal_Char const sHash[] = "#"; -sal_Char const sFileScheme[] = INET_FILE_SCHEME; -sal_Char const sNewsSRVScheme[] = "news://"; - // TODO news:// is nonsense -sal_Char const sHTTPScheme[] = INET_HTTP_SCHEME; - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkDocTp::SvxHyperlinkDocTp ( Window *pParent, const SfxItemSet& rItemSet) - : SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_DOCUMENT ), rItemSet ), - maGrpDocument ( this, CUI_RES (GRP_DOCUMENT) ), - maFtPath ( this, CUI_RES (FT_PATH_DOC) ), - maCbbPath ( this, INET_PROT_FILE ), - maBtFileopen ( this, CUI_RES (BTN_FILEOPEN) ), - maGrpTarget ( this, CUI_RES (GRP_TARGET) ), - maFtTarget ( this, CUI_RES (FT_TARGET_DOC) ), - maEdTarget ( this, CUI_RES (ED_TARGET_DOC) ), - maFtURL ( this, CUI_RES (FT_URL) ), - maFtFullURL ( this, CUI_RES (FT_FULL_URL) ), - maBtBrowse ( this, CUI_RES (BTN_BROWSE) ), - mbMarkWndOpen ( sal_False ) -{ - // Disable display of bitmap names. - maBtBrowse.EnableTextDisplay (sal_False); - maBtFileopen.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2, 15 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbPath.Show(); - String aFileScheme( INET_FILE_SCHEME, RTL_TEXTENCODING_ASCII_US ); - maCbbPath.SetBaseURL(aFileScheme); - maCbbPath.SetHelpId( HID_HYPERDLG_DOC_PATH ); - - SetExchangeSupport (); - - // overload handlers - maBtFileopen.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickFileopenHdl_Impl ) ); - maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickTargetHdl_Impl ) ); - maCbbPath.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedPathHdl_Impl ) ); - maEdTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedTargetHdl_Impl ) ); - - maCbbPath.SetLoseFocusHdl( LINK ( this, SvxHyperlinkDocTp, LostFocusPathHdl_Impl ) ); - - maBtBrowse.SetAccessibleRelationMemberOf( &maGrpTarget ); - maBtBrowse.SetAccessibleRelationLabeledBy( &maFtTarget ); - maBtFileopen.SetAccessibleRelationMemberOf( &maGrpDocument ); - maBtFileopen.SetAccessibleRelationLabeledBy( &maFtPath ); - maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) ); -} - -SvxHyperlinkDocTp::~SvxHyperlinkDocTp () -{ -} - -/************************************************************************* -|* -|* Fill all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::FillDlgFields ( String& aStrURL ) -{ - INetURLObject aURL ( aStrURL ); - - String aStrMark; - xub_StrLen nPos = aStrURL.SearchAscii( sHash ); - // path - maCbbPath.SetText ( aStrURL.Copy( 0, ( nPos == STRING_NOTFOUND ? aStrURL.Len() : nPos ) ) ); - - // set target in document at editfield - if ( nPos != STRING_NOTFOUND && nPos<aStrURL.Len()-1 ) - aStrMark = aStrURL.Copy( nPos+1, aStrURL.Len() ); - maEdTarget.SetText ( aStrMark ); - - ModifiedPathHdl_Impl ( NULL ); -} - -/************************************************************************* -|* -|* retrieve current url-string -|* -|************************************************************************/ - -String SvxHyperlinkDocTp::GetCurrentURL () -{ - // get data from dialog-controls - String aStrURL; - String aStrPath ( maCbbPath.GetText() ); - const String aBaseURL ( maCbbPath.GetBaseURL() ); - String aStrMark( maEdTarget.GetText() ); - - if ( aStrPath != aEmptyStr ) - { - INetURLObject aURL( aStrPath ); - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) // maybe the path is already a valid - aStrURL = aStrPath; // hyperlink, then we can use this path directly - else - utl::LocalFileHelper::ConvertSystemPathToURL( aStrPath, aBaseURL, aStrURL ); - - //#105788# always create a URL even if it is not valid - if( aStrURL == aEmptyStr ) - aStrURL = aStrPath; - } - - if( aStrMark != aEmptyStr ) - { - aStrURL.AppendAscii( sHash ); - aStrURL += aStrMark; - } - - return aStrURL; -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - // get data from standard-fields - aStrURL = GetCurrentURL(); - - if( aStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) - aStrURL=aEmptyStr; - - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkDocTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkDocTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::SetInitFocus() -{ - maCbbPath.GrabFocus(); -} - -/************************************************************************* -|* -|* Click on imagebutton : fileopen -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ClickFileopenHdl_Impl, void *, EMPTYARG ) -{ - // Open Fileopen-Dialog - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0, - GetParent() ); - String aOldURL( GetCurrentURL() ); - if( aOldURL.EqualsIgnoreCaseAscii( sFileScheme, 0, sizeof( sFileScheme ) - 1 ) ) - { - aDlg.SetDisplayDirectory( aOldURL ); - } - - DisableClose( sal_True ); - ErrCode nError = aDlg.Execute(); - DisableClose( sal_False ); - - if ( ERRCODE_NONE == nError ) - { - String aURL( aDlg.GetPath() ); - String aPath; - - utl::LocalFileHelper::ConvertURLToSystemPath( aURL, aPath ); - - maCbbPath.SetBaseURL( aURL ); - maCbbPath.SetText( aPath ); - - if ( aOldURL != GetCurrentURL() ) - ModifiedPathHdl_Impl (NULL); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on imagebutton : target -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ClickTargetHdl_Impl, void *, EMPTYARG ) -{ - if ( GetPathType ( maStrURL ) == Type_ExistsFile || - maStrURL == aEmptyStr || - maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) || - maStrURL.SearchAscii( sHash ) == 0 ) - { - mpMarkWnd->SetError( LERR_NOERROR ); - - EnterWait(); - - if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) - mpMarkWnd->RefreshTree ( aEmptyStr ); - else - mpMarkWnd->RefreshTree ( maStrURL ); - - LeaveWait(); - } - else - mpMarkWnd->SetError( LERR_DOCNOTOPEN ); - - ShowMarkWnd (); - - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of combobox "Path" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ModifiedPathHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - maTimer.SetTimeout( 2500 ); - maTimer.Start(); - - maFtFullURL.SetText( maStrURL ); - - return( 0L ); -} - -/************************************************************************* -|* -|* If path-field was modify, to browse the new doc after timeout -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, EMPTYARG ) -{ - if ( IsMarkWndVisible() && ( GetPathType( maStrURL )==Type_ExistsFile || - maStrURL == aEmptyStr || - maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) ) - { - EnterWait(); - - if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) - mpMarkWnd->RefreshTree ( aEmptyStr ); - else - mpMarkWnd->RefreshTree ( maStrURL ); - - LeaveWait(); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of editfield "Target" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - if ( IsMarkWndVisible() ) - mpMarkWnd->SelectEntry ( maEdTarget.GetText() ); - - maFtFullURL.SetText( maStrURL ); - - return( 0L ); -} - -/************************************************************************* -|* -|* editfield "Target" lost focus -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, LostFocusPathHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - maFtFullURL.SetText( maStrURL ); - - return (0L); -} - -/************************************************************************* -|* -|* Get String from Bookmark-Wnd -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::SetMarkStr ( String& aStrMark ) -{ - maEdTarget.SetText ( aStrMark ); - - ModifiedTargetHdl_Impl ( NULL ); -} - -/************************************************************************* -|* -|* retrieve kind of pathstr -|* -|************************************************************************/ - -SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( String& aStrPath ) -{ - INetURLObject aURL( aStrPath, INET_PROT_FILE ); - - if( aURL.HasError() ) - return Type_Invalid; - else - return Type_ExistsFile; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx deleted file mode 100644 index 4926b6699..000000000 --- a/cui/source/dialogs/hlinettp.cxx +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <unotools/pathoptions.hxx> -#include <unotools/useroptions.hxx> -#include <svl/adrparse.hxx> - -#include "hlinettp.hxx" -#include "hyperdlg.hrc" -#include "hlmarkwn_def.hxx" - -sal_Char const sAnonymous[] = "anonymous"; -sal_Char const sHTTPScheme[] = INET_HTTP_SCHEME; -sal_Char const sHTTPSScheme[] = INET_HTTPS_SCHEME; -sal_Char const sFTPScheme[] = INET_FTP_SCHEME; - -/************************************************************************* -|* -|* Constructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent, - const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_INTERNET ), - rItemSet ) , - maGrpLinkTyp ( this, CUI_RES (GRP_LINKTYPE) ), - maRbtLinktypInternet ( this, CUI_RES (RB_LINKTYP_INTERNET) ), - maRbtLinktypFTP ( this, CUI_RES (RB_LINKTYP_FTP) ), - maFtTarget ( this, CUI_RES (FT_TARGET_HTML) ), - maCbbTarget ( this, INET_PROT_HTTP ), - maBtBrowse ( this, CUI_RES (BTN_BROWSE) ), - maFtLogin ( this, CUI_RES (FT_LOGIN) ), - maEdLogin ( this, CUI_RES (ED_LOGIN) ), - maBtTarget ( this, CUI_RES (BTN_TARGET) ), - maFtPassword ( this, CUI_RES (FT_PASSWD) ), - maEdPassword ( this, CUI_RES (ED_PASSWD) ), - maCbAnonymous ( this, CUI_RES (CBX_ANONYMOUS) ), - mbMarkWndOpen ( sal_False ) -{ - // Disable display of bitmap names. - maBtBrowse.EnableTextDisplay (sal_False); - maBtTarget.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbTarget.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbTarget.Show(); - maCbbTarget.SetHelpId( HID_HYPERDLG_INET_PATH ); - - SetExchangeSupport (); - - /////////////////////////////////////// - // set defaults - maRbtLinktypInternet.Check (); - maFtLogin.Show( sal_False ); - maFtPassword.Show( sal_False ); - maEdLogin.Show( sal_False ); - maEdPassword.Show( sal_False ); - maCbAnonymous.Show( sal_False ); - maBtTarget.Enable( sal_False ); - maBtBrowse.Enable( sal_True ); - - /////////////////////////////////////// - // overload handlers - Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) ); - maRbtLinktypInternet.SetClickHdl( aLink ); - maRbtLinktypFTP.SetClickHdl ( aLink ); - maCbAnonymous.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) ); - maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickBrowseHdl_Impl ) ); - maBtTarget.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickTargetHdl_Impl ) ); - maEdLogin.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) ); - maCbbTarget.SetLoseFocusHdl ( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) ); - maCbbTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) ); - maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) ); - - maFtTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maCbbTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtTarget.SetAccessibleRelationLabeledBy( &maFtTarget ); - maBtBrowse.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtBrowse.SetAccessibleRelationLabeledBy( &maFtTarget ); -} - -SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp () -{ -} - -/************************************************************************* -|* -|* Fill the all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL ) -{ - INetURLObject aURL( aStrURL ); - String aStrScheme = GetSchemeFromURL( aStrURL ); - - // set additional controls for FTP: Username / Password - if ( aStrScheme.SearchAscii( sFTPScheme ) == 0 ) - { - if ( String(aURL.GetUser()).ToLowerAscii().SearchAscii ( sAnonymous ) == 0 ) - setAnonymousFTPUser(); - else - setFTPUser(aURL.GetUser(), aURL.GetPass()); - - //do not show password and user in url - if(aURL.GetUser().getLength()!=0 || aURL.GetPass().getLength()!=0 ) - aURL.SetUserAndPass(aEmptyStr,aEmptyStr); - } - - // set URL-field - // Show the scheme, #72740 - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - maCbbTarget.SetText( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - else - maCbbTarget.SetText( aStrURL ); // #77696# - - SetScheme( aStrScheme ); -} - -void SvxHyperlinkInternetTp::setAnonymousFTPUser() -{ - maEdLogin.SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM ( sAnonymous ) ) ); - SvAddressParser aAddress( SvtUserOptions().GetEmail() ); - maEdPassword.SetText( aAddress.Count() ? aAddress.GetEmailAddress(0) : String() ); - - maFtLogin.Disable (); - maFtPassword.Disable (); - maEdLogin.Disable (); - maEdPassword.Disable (); - maCbAnonymous.Check(); -} - -void SvxHyperlinkInternetTp::setFTPUser(const String& rUser, const String& rPassword) -{ - maEdLogin.SetText ( rUser ); - maEdPassword.SetText ( rPassword ); - - maFtLogin.Enable (); - maFtPassword.Enable (); - maEdLogin.Enable (); - maEdPassword.Enable (); - maCbAnonymous.Check(sal_False); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrURL = CreateAbsoluteURL(); - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -String SvxHyperlinkInternetTp::CreateAbsoluteURL() const -{ - String aStrURL = maCbbTarget.GetText(); - String aScheme = GetSchemeFromURL(aStrURL); - - INetURLObject aURL(aStrURL); - - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - aURL.SetSmartProtocol( GetSmartProtocolFromButtons() ); - aURL.SetSmartURL(aStrURL); - } - - // username and password for ftp-url - if( aURL.GetProtocol() == INET_PROT_FTP && maEdLogin.GetText().Len()!=0 ) - aURL.SetUserAndPass ( maEdLogin.GetText(), maEdPassword.GetText() ); - - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - else //#105788# always create a URL even if it is not valid - return aStrURL; -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkInternetTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkInternetTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetInitFocus() -{ - maCbbTarget.GrabFocus(); -} - -/************************************************************************* -|* -|* Contents of editfield "Target" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromURL( maCbbTarget.GetText() ); - if(aScheme.Len()!=0) - SetScheme( aScheme ); - - // start timer - maTimer.SetTimeout( 2500 ); - maTimer.Start(); - - return( 0L ); -} - -/************************************************************************* -|* -|* If target-field was modify, to browse the new doc after timeout -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, EMPTYARG ) -{ - RefreshMarkWindow(); - return( 0L ); -} - -/************************************************************************* -|* -|* Contents of editfield "Login" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, void *, EMPTYARG ) -{ - String aStrLogin ( maEdLogin.GetText() ); - if ( aStrLogin.EqualsIgnoreCaseAscii( sAnonymous ) ) - { - maCbAnonymous.Check(); - ClickAnonymousHdl_Impl(NULL); - } - - return( 0L ); -} - -/************************************************************************* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) -{ - //if aScheme is empty or unknown the default beaviour is like it where HTTP - - sal_Bool bFTP = aScheme.SearchAscii( sFTPScheme ) == 0; - sal_Bool bInternet = !(bFTP); - - //update protocol button selection: - maRbtLinktypFTP.Check(bFTP); - maRbtLinktypInternet.Check(bInternet); - - //update target: - RemoveImproperProtocol(aScheme); - maCbbTarget.SetSmartProtocol( GetSmartProtocolFromButtons() ); - - //show/hide special fields for FTP: - maFtLogin.Show( bFTP ); - maFtPassword.Show( bFTP ); - maEdLogin.Show( bFTP ); - maEdPassword.Show( bFTP ); - maCbAnonymous.Show( bFTP ); - - //update 'link target in document'-window and opening-button - if( aScheme.SearchAscii( sHTTPScheme ) == 0 || aScheme.Len() == 0 ) - { - maBtTarget.Enable(); - if ( mbMarkWndOpen ) - ShowMarkWnd (); - } - else - { - //disable for https and ftp - maBtTarget.Disable(); - if ( mbMarkWndOpen ) - HideMarkWnd (); - } -} - -/************************************************************************* -|* -|* Remove protocol if it does not fit to the current button selection -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::RemoveImproperProtocol(const String& aProperScheme) -{ - String aStrURL ( maCbbTarget.GetText() ); - if ( aStrURL != aEmptyStr ) - { - String aStrScheme = GetSchemeFromURL( aStrURL ); - if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme ) - { - aStrURL.Erase ( 0, aStrScheme.Len() ); - maCbbTarget.SetText ( aStrURL ); - } - } -} - -String SvxHyperlinkInternetTp::GetSchemeFromButtons() const -{ - if( maRbtLinktypFTP.IsChecked() ) - { - return String::CreateFromAscii( INET_FTP_SCHEME ); - } - return String::CreateFromAscii( INET_HTTP_SCHEME ); -} - -INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const -{ - if( maRbtLinktypFTP.IsChecked() ) - { - return INET_PROT_FTP; - } - return INET_PROT_HTTP; -} - -/************************************************************************* -|* -|* Click on Radiobutton : Internet or FTP -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, void*, EMPTYARG ) -{ - String aScheme = GetSchemeFromButtons(); - SetScheme( aScheme ); - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Checkbox : Anonymous user -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, void *, EMPTYARG ) -{ - // disable login-editfields if checked - if ( maCbAnonymous.IsChecked() ) - { - if ( maEdLogin.GetText().ToLowerAscii().SearchAscii ( sAnonymous ) == 0 ) - { - maStrOldUser = aEmptyStr; - maStrOldPassword = aEmptyStr; - } - else - { - maStrOldUser = maEdLogin.GetText(); - maStrOldPassword = maEdPassword.GetText(); - } - - setAnonymousFTPUser(); - } - else - setFTPUser(maStrOldUser, maStrOldPassword); - - return( 0L ); -} - -/************************************************************************* -|* -|* Combobox Target lost the focus -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, void *, EMPTYARG ) -{ - RefreshMarkWindow(); - return (0L); -} - -/************************************************************************* -|* -|* Click on imagebutton : Browse -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickBrowseHdl_Impl, void *, EMPTYARG ) -{ - ///////////////////////////////////////////////// - // Open URL if available - - SfxStringItem aName( SID_FILE_NAME, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "http://" ) ) ); - SfxStringItem aRefererItem( SID_REFERER, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) ); - SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_True ); - SfxBoolItem aSilent( SID_SILENT, sal_True ); - SfxBoolItem aReadOnly( SID_DOC_READONLY, sal_True ); - - SfxBoolItem aBrowse( SID_BROWSE, sal_True ); - - const SfxPoolItem *ppItems[] = { &aName, &aNewView, &aSilent, &aReadOnly, &aRefererItem, &aBrowse, NULL }; - (((SvxHpLinkDlg*)mpDialog)->GetBindings())->Execute( SID_OPENDOC, ppItems, 0, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on imagebutton : Target -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickTargetHdl_Impl, void *, EMPTYARG ) -{ - RefreshMarkWindow(); - ShowMarkWnd (); - mbMarkWndOpen = IsMarkWndVisible (); - - return( 0L ); -} - -void SvxHyperlinkInternetTp::RefreshMarkWindow() -{ - if ( maRbtLinktypInternet.IsChecked() && IsMarkWndVisible() ) - { - EnterWait(); - String aStrURL( CreateAbsoluteURL() ); - if ( aStrURL != aEmptyStr ) - mpMarkWnd->RefreshTree ( aStrURL ); - else - mpMarkWnd->SetError( LERR_DOCNOTOPEN ); - LeaveWait(); - } - -} - -/************************************************************************* -|* -|* Get String from Bookmark-Wnd -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetMarkStr ( String& aStrMark ) -{ - String aStrURL ( maCbbTarget.GetText() ); - - const sal_Unicode sUHash = '#'; - xub_StrLen nPos = aStrURL.SearchBackward( sUHash ); - - if( nPos != STRING_NOTFOUND ) - aStrURL.Erase ( nPos ); - - aStrURL += sUHash; - aStrURL += aStrMark; - - maCbbTarget.SetText ( aStrURL ); -} - -/************************************************************************* -|* -|* Enable Browse-Button in subject to the office is in onlinemode -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetOnlineMode( sal_Bool /*bEnable*/ ) -{ - // State of target-button in subject to the current url-string - // ( Can't display any targets in an document, if there is no - // valid url to a document ) - String aStrCurrentTarget( maCbbTarget.GetText() ); - aStrCurrentTarget.EraseTrailingChars(); - - if( aStrCurrentTarget == aEmptyStr || - aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPScheme ) || - aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPSScheme ) ) - maBtTarget.Enable( sal_False ); - else - maBtTarget.Enable( sal_True ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx deleted file mode 100644 index 09f064938..000000000 --- a/cui/source/dialogs/hlmailtp.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <sfx2/request.hxx> - -#include <comphelper/processfactory.hxx> -#include <sfx2/viewfrm.hxx> -#include <unotools/pathoptions.hxx> -#include <unotools/moduleoptions.hxx> - -#include "hlmailtp.hxx" -#include "hyperdlg.hrc" - -using namespace ::rtl; -using namespace ::com::sun::star; - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkMailTp::SvxHyperlinkMailTp ( Window *pParent, const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_MAIL ), - rItemSet ), - maGrpMailNews ( this, CUI_RES (GRP_MAILNEWS) ), - maRbtMail ( this, CUI_RES (RB_LINKTYP_MAIL) ), - maRbtNews ( this, CUI_RES (RB_LINKTYP_NEWS) ), - maFtReceiver ( this, CUI_RES (FT_RECEIVER) ), - maCbbReceiver ( this, INET_PROT_MAILTO ), - maBtAdrBook ( this, CUI_RES (BTN_ADRESSBOOK) ), - maFtSubject ( this, CUI_RES (FT_SUBJECT) ), - maEdSubject ( this, CUI_RES (ED_SUBJECT) ) -{ - // Disable display of bitmap names. - maBtAdrBook.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbReceiver.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - - maCbbReceiver.Show(); - maCbbReceiver.SetHelpId( HID_HYPERDLG_MAIL_PATH ); - - SetExchangeSupport (); - - // set defaults - maRbtMail.Check (); - - // overload handlers - maRbtMail.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) ); - maRbtNews.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) ); - maBtAdrBook.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) ); - maCbbReceiver.SetModifyHdl ( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) ); - - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - maBtAdrBook.Hide(); - - maBtAdrBook.SetAccessibleRelationMemberOf( &maGrpMailNews ); - maBtAdrBook.SetAccessibleRelationLabeledBy( &maFtReceiver ); -} - -SvxHyperlinkMailTp::~SvxHyperlinkMailTp () -{ -} - -/************************************************************************* -|* -|* Fill the all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::FillDlgFields ( String& aStrURL ) -{ - const sal_Char sMailtoScheme[] = INET_MAILTO_SCHEME; - - INetURLObject aURL( aStrURL ); - String aStrScheme = GetSchemeFromURL( aStrURL ); - - // set URL-field and additional controls - String aStrURLc ( aStrURL ); - // set additional controls for EMail: - if ( aStrScheme.SearchAscii( sMailtoScheme ) == 0 ) - { - // Find mail-subject - String aStrSubject, aStrTmp ( aStrURLc ); - - const sal_Char sSubject[] = "subject"; - xub_StrLen nPos = aStrTmp.ToLowerAscii().SearchAscii( sSubject, 0 ); - nPos = aStrTmp.Search( sal_Unicode( '=' ), nPos ); - - if ( nPos != STRING_NOTFOUND ) - aStrSubject = aStrURLc.Copy( nPos+1, aStrURLc.Len() ); - - nPos = aStrURLc.Search ( sal_Unicode( '?' ), 0); - - aStrURLc = aStrURLc.Copy( 0, ( nPos == STRING_NOTFOUND ? - aStrURLc.Len() : nPos ) ); - - maEdSubject.SetText ( aStrSubject ); - } - else - { - maEdSubject.SetText (aEmptyStr); - } - - maCbbReceiver.SetText ( aStrURLc ); - - SetScheme( aStrScheme ); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrURL = CreateAbsoluteURL(); - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -String SvxHyperlinkMailTp::CreateAbsoluteURL() const -{ - String aStrURL = maCbbReceiver.GetText(); - INetURLObject aURL(aStrURL); - - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - aURL.SetSmartProtocol( GetSmartProtocolFromButtons() ); - aURL.SetSmartURL(aStrURL); - } - - // subject for EMail-url - if( aURL.GetProtocol() == INET_PROT_MAILTO ) - { - if ( maEdSubject.GetText() != aEmptyStr ) - { - String aQuery = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "subject=" ) ); - aQuery.Append( maEdSubject.GetText() ); - aURL.SetParam(aQuery); - } - } - - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - else //#105788# always create a URL even if it is not valid - return aStrURL; -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkMailTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkMailTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::SetInitFocus() -{ - maCbbReceiver.GrabFocus(); -} - -/************************************************************************* -|************************************************************************/ - -void SvxHyperlinkMailTp::SetScheme( const String& aScheme ) -{ - //if aScheme is empty or unknown the default beaviour is like it where MAIL - const sal_Char sNewsScheme[] = INET_NEWS_SCHEME; - - sal_Bool bMail = aScheme.SearchAscii( sNewsScheme ) != 0; - - //update protocol button selection: - maRbtMail.Check(bMail); - maRbtNews.Check(!bMail); - - //update target: - RemoveImproperProtocol(aScheme); - maCbbReceiver.SetSmartProtocol( GetSmartProtocolFromButtons() ); - - //show/hide special fields for MAIL: - maFtSubject.Enable(bMail); - maEdSubject.Enable(bMail); -} - -/************************************************************************* -|* -|* Remove protocol if it does not fit to the current button selection -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::RemoveImproperProtocol(const String& aProperScheme) -{ - String aStrURL ( maCbbReceiver.GetText() ); - if ( aStrURL != aEmptyStr ) - { - String aStrScheme = GetSchemeFromURL( aStrURL ); - if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme ) - { - aStrURL.Erase ( 0, aStrScheme.Len() ); - maCbbReceiver.SetText ( aStrURL ); - } - } -} - -String SvxHyperlinkMailTp::GetSchemeFromButtons() const -{ - if( maRbtNews.IsChecked() ) - { - return String::CreateFromAscii( INET_NEWS_SCHEME ); - } - return String::CreateFromAscii( INET_MAILTO_SCHEME ); -} - -INetProtocol SvxHyperlinkMailTp::GetSmartProtocolFromButtons() const -{ - if( maRbtNews.IsChecked() ) - { - return INET_PROT_NEWS; - } - return INET_PROT_MAILTO; -} - -/************************************************************************* -|* -|* Click on radiobutton : Type EMail -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, Click_SmartProtocol_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromButtons(); - SetScheme( aScheme ); - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of editfield "receiver" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromURL( maCbbReceiver.GetText() ); - if(aScheme.Len()!=0) - SetScheme( aScheme ); - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on imagebutton : addressbook -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, void *, EMPTYARG ) -{ - SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - if( pViewFrame ) - { - SfxItemPool &rPool = pViewFrame->GetPool(); - SfxRequest aReq(SID_VIEW_DATA_SOURCE_BROWSER, 0, rPool); - pViewFrame->ExecuteSlot( aReq, sal_True ); - } - - - return( 0L ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx deleted file mode 100644 index 27845339b..000000000 --- a/cui/source/dialogs/hlmarkwn.cxx +++ /dev/null @@ -1,521 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <vcl/wrkwin.hxx> -#include <dialmgr.hxx> -#include <sfx2/docfile.hxx> -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> - -// UNO-Stuff -#include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/XBitmap.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/document/XLinkTargetSupplier.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -#include <toolkit/unohlp.hxx> - -#include <cuires.hrc> -#include "hlmarkwn.hrc" -#include "hlmarkwn.hxx" -#include "hltpbase.hxx" - -using namespace ::com::sun::star; -using namespace ::rtl; - -/************************************************************************* -|* -|* Userdata-struct for tree-entries -|* -|************************************************************************/ - -struct TargetData -{ - OUString aUStrLinkname; - sal_Bool bIsTarget; - - TargetData ( OUString aUStrLName, sal_Bool bTarget ) - : bIsTarget ( bTarget ) - { - if ( bIsTarget ) - aUStrLinkname = aUStrLName; - } -}; - - -//######################################################################## -//# # -//# Tree-Window # -//# # -//######################################################################## - -SvxHlmarkTreeLBox::SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId ) -: SvTreeListBox ( pParent, rResId ), - mpParentWnd ( (SvxHlinkDlgMarkWnd*) pParent ) -{ - SetNodeDefaultImages(); -} - -void SvxHlmarkTreeLBox::Paint( const Rectangle& rRect ) -{ - if( mpParentWnd->mnError == LERR_NOERROR ) - { - SvTreeListBox::Paint(rRect); - } - else - { - Erase(); - - Rectangle aDrawRect( Point( 0, 0 ), GetSizePixel() ); - - String aStrMessage; - - switch( mpParentWnd->mnError ) - { - case LERR_NOENTRIES : - aStrMessage = CUI_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES ); - break; - case LERR_DOCNOTOPEN : - aStrMessage = CUI_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN ); - break; - } - - DrawText( aDrawRect, aStrMessage, TEXT_DRAW_LEFT | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - } - -} - -//######################################################################## -//# # -//# Window-Class # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent ) -: ModalDialog( (Window*)pParent, CUI_RES ( RID_SVXFLOAT_HYPERLINK_MARKWND ) ), - maBtApply( this, CUI_RES (BT_APPLY) ), - maBtClose( this, CUI_RES (BT_CLOSE) ), - maLbTree ( this, CUI_RES (TLB_MARK) ), - mbUserMoved ( sal_False ), - mbFirst ( sal_True ), - mpParent ( pParent ), - mnError ( LERR_NOERROR ) -{ - FreeResource(); - - maBtApply.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) ); - maBtClose.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl ) ); - maLbTree.SetDoubleClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) ); - - // Tree-ListBox mit Linien versehen - maLbTree.SetStyle( maLbTree.GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | - WB_HASBUTTONS | //WB_HASLINESATROOT | - WB_HSCROLL | WB_HASBUTTONSATROOT ); - - maLbTree.SetAccessibleName(String(CUI_RES(STR_MARK_TREE))); - -} - -SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd() -{ - ClearTree(); -} - -/************************************************************************* -|* -|* Set an errorstatus -|* -|************************************************************************/ - -sal_uInt16 SvxHlinkDlgMarkWnd::SetError( sal_uInt16 nError) -{ - sal_uInt16 nOldError = mnError; - mnError = nError; - - if( mnError != LERR_NOERROR ) - ClearTree(); - - maLbTree.Invalidate(); - - return nOldError; -} - -/************************************************************************* -|* -|* Move window -|* -|************************************************************************/ - -sal_Bool SvxHlinkDlgMarkWnd::MoveTo ( Point aNewPos ) -{ - if ( !mbUserMoved ) - { - sal_Bool bOldStatus = mbUserMoved; - SetPosPixel ( aNewPos ); - mbUserMoved = bOldStatus; - } - - return mbUserMoved; -} - -void SvxHlinkDlgMarkWnd::Move () -{ - Window::Move(); - - if ( IsReallyVisible() ) - mbUserMoved = sal_True; -} - -sal_Bool SvxHlinkDlgMarkWnd::ConnectToDialog( sal_Bool bDoit ) -{ - sal_Bool bOldStatus = mbUserMoved; - - mbUserMoved = !bDoit; - - return bOldStatus; -} - -/************************************************************************* -|* -|* Interface to refresh tree -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) -{ - String aEmptyStr; - OUString aUStrURL; - - EnterWait(); - - ClearTree(); - - xub_StrLen nPos = aStrURL.Search ( sal_Unicode('#') ); - - if( nPos != 0 ) - aUStrURL = ::rtl::OUString( aStrURL ); - - if( !RefreshFromDoc ( aUStrURL ) ) - maLbTree.Invalidate(); - - if ( nPos != STRING_NOTFOUND ) - { - String aStrMark = aStrURL.Copy ( nPos+1 ); - SelectEntry ( aStrMark ); - } - - LeaveWait(); - - maStrLastURL = aStrURL; -} - -/************************************************************************* -|* -|* get links from document -|* -|************************************************************************/ - -sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL ) -{ - mnError = LERR_NOERROR; - - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY ); - if( xDesktop.is() ) - { - uno::Reference< lang::XComponent > xComp; - - if( aURL.getLength() ) - { - // load from url - uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY ); - if( xLoader.is() ) - { - try - { - uno::Sequence< beans::PropertyValue > aArg(1); - aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" )); - aArg.getArray()[0].Value <<= (sal_Bool) sal_True; - xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg ); - } - catch( const io::IOException& ) - { - - } - catch( const lang::IllegalArgumentException& ) - { - - } - } - } - else - { - // the component with user focus ( current document ) - xComp = xDesktop->getCurrentComponent(); - } - - if( xComp.is() ) - { - uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY ); - - if( xLTS.is() ) - { - if( FillTree( xLTS->getLinks() ) == 0 ) - mnError = LERR_NOENTRIES; - } - else - mnError = LERR_DOCNOTOPEN; - - if ( aURL.getLength() ) - xComp->dispose(); - } - else - { - if( aURL.getLength() ) - mnError=LERR_DOCNOTOPEN; - } - } - } - return (mnError==0); -} -/************************************************************************* -|* -|* Fill Tree-Control -|* -|************************************************************************/ - -int SvxHlinkDlgMarkWnd::FillTree( uno::Reference< container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry ) -{ - int nEntries=0; - const uno::Sequence< OUString > aNames( xLinks->getElementNames() ); - const sal_uLong nLinks = aNames.getLength(); - const OUString* pNames = aNames.getConstArray(); - - Color aMaskColor( COL_LIGHTMAGENTA ); - const OUString aProp_LinkDisplayName( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayName" ) ); - const OUString aProp_LinkTarget( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.LinkTarget" ) ); - const OUString aProp_LinkDisplayBitmap( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayBitmap" ) ); - for( sal_uLong i = 0; i < nLinks; i++ ) - { - uno::Any aAny; - OUString aLink( *pNames++ ); - - sal_Bool bError = sal_False; - try - { - aAny = xLinks->getByName( aLink ); - } - catch(const uno::Exception&) - { - // if the name of the target was invalid (like empty headings) - // no object can be provided - bError = sal_True; - } - if(bError) - continue; - - uno::Reference< beans::XPropertySet > xTarget; - - if( aAny >>= xTarget ) - { - try - { - // get name to display - aAny = xTarget->getPropertyValue( aProp_LinkDisplayName ); - OUString aDisplayName; - aAny >>= aDisplayName; - String aStrDisplayname ( aDisplayName ); - - // is it a target ? - uno::Reference< lang::XServiceInfo > xSI( xTarget, uno::UNO_QUERY ); - sal_Bool bIsTarget = xSI->supportsService( aProp_LinkTarget ); - - // create userdata - TargetData *pData = new TargetData ( aLink, bIsTarget ); - - SvLBoxEntry* pEntry; - - try - { - // get bitmap for the tree-entry - uno::Reference< awt::XBitmap > aXBitmap( xTarget->getPropertyValue( aProp_LinkDisplayBitmap ), uno::UNO_QUERY ); - if( aXBitmap.is() ) - { - Image aBmp( VCLUnoHelper::GetBitmap( aXBitmap ).GetBitmap(), aMaskColor ); - // insert Displayname into treelist with bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - aBmp, aBmp, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - else - { - // insert Displayname into treelist without bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - } - catch(const com::sun::star::uno::Exception&) - { - // insert Displayname into treelist without bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - - uno::Reference< document::XLinkTargetSupplier > xLTS( xTarget, uno::UNO_QUERY ); - if( xLTS.is() ) - nEntries += FillTree( xLTS->getLinks(), pEntry ); - } - catch(const com::sun::star::uno::Exception&) - { - } - } - } - - return nEntries; -} - -/************************************************************************* -|* -|* Clear Tree -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::ClearTree() -{ - SvLBoxEntry* pEntry = maLbTree.First(); - - while ( pEntry ) - { - TargetData* pUserData = ( TargetData * ) pEntry->GetUserData(); - delete pUserData; - - pEntry = maLbTree.Next( pEntry ); - } - - maLbTree.Clear(); -} - -/************************************************************************* -|* -|* Find Entry for Strng -|* -|************************************************************************/ - -SvLBoxEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) -{ - sal_Bool bFound=sal_False; - SvLBoxEntry* pEntry = maLbTree.First(); - - while ( pEntry && !bFound ) - { - TargetData* pUserData = ( TargetData * ) pEntry->GetUserData (); - if ( aStrName == String( pUserData->aUStrLinkname ) ) - bFound = sal_True; - else - pEntry = maLbTree.Next( pEntry ); - } - - return pEntry; -} - -/************************************************************************* -|* -|* Select Entry -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::SelectEntry ( String aStrMark ) -{ - SvLBoxEntry* pEntry = FindEntry ( aStrMark ); - if ( pEntry ) - { - maLbTree.Select ( pEntry ); - maLbTree.MakeVisible ( pEntry ); - } -} - -/************************************************************************* -|* -|* Click on Apply-Button / Doubleclick on item in tree -|* -|************************************************************************/ - -IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, void *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = maLbTree.GetCurEntry(); - - if ( pEntry ) - { - TargetData *pData = ( TargetData * )pEntry->GetUserData(); - - if ( pData->bIsTarget ) - { - String aStrMark ( pData->aUStrLinkname ); - mpParent->SetMarkStr ( aStrMark ); - } - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Close-Button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, void *, EMPTYARG ) -{ - Close(); - - return( 0L ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmarkwn.hrc b/cui/source/dialogs/hlmarkwn.hrc deleted file mode 100644 index 53614b36f..000000000 --- a/cui/source/dialogs/hlmarkwn.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define BT_APPLY 1 -#define BT_CLOSE 2 -#define TLB_MARK 3 -// IAccessibility2 implementation 2009. ------ -#define STR_MARK_TREE 5000 -// ------ IAccessibility2 implementation 2009. - diff --git a/cui/source/dialogs/hlmarkwn.src b/cui/source/dialogs/hlmarkwn.src deleted file mode 100644 index 8f901a429..000000000 --- a/cui/source/dialogs/hlmarkwn.src +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <cuires.hrc> -#include "helpid.hrc" -#include "hlmarkwn.hrc" - -ModalDialog RID_SVXFLOAT_HYPERLINK_MARKWND -{ - HelpID = HID_HYPERLINK_MARKWND; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ;//????? - Sizeable = FALSE ; - Border = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 109 , 185 ) ; - Text [ en-US ] = "Target in Document" ; - PushButton BT_APPLY - { - HelpId = HID_HYPERLINK_MARKWND_APPLY; - Pos = MAP_APPFONT ( 3 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "Apply" ; - }; - PushButton BT_CLOSE - { - HelpId = HID_HYPERLINK_MARKWND_CLOSE; - Pos = MAP_APPFONT ( 56 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Close" ; - }; - Control TLB_MARK - { - HelpId = HID_HYPERLINK_MARKWND_TREE; - Border = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 103 , 162 ) ; - TabStop = TRUE ; - }; -}; - -String RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES -{ - Text [ en-US ] = "Targets do not exist in the document." ; -}; - -String RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN -{ - Text [ en-US ] = "Couldn't open the document." ; -}; - -String STR_MARK_TREE -{ - Text [ en-US ] = "Mark Tree" ; -}; - diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx deleted file mode 100644 index 963bb2aea..000000000 --- a/cui/source/dialogs/hltpbase.cxx +++ /dev/null @@ -1,739 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/frame.hxx> -#include <sfx2/viewfrm.hxx> -#include <sot/formats.hxx> -#include <sfx2/sfxsids.hrc> -#include <svl/macitem.hxx> -#include <ucbhelper/content.hxx> -#include <unotools/localfilehelper.hxx> -#include "hyperdlg.hrc" -#include "cuihyperdlg.hxx" -#include "hltpbase.hxx" -#include "macroass.hxx" -#include <svx/svxdlg.hxx> -#include <cuires.hrc> - -using namespace ::ucbhelper; - -//######################################################################## -//# # -//# ComboBox-Control, which is filled with all current framenames # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxFramesComboBox::SvxFramesComboBox ( Window* pParent, const ResId& rResId, - SfxDispatcher* pDispatch ) -: ComboBox (pParent, rResId) -{ - TargetList* pList = new TargetList; - SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; - SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetTopFrame() : 0; - if ( pFrame ) - { - pFrame->GetTargetList(*pList); - if( !pList->empty() ) - { - size_t nCount = pList->size(); - size_t i; - for ( i = 0; i < nCount; i++ ) - { - InsertEntry( *pList->at( i ) ); - } - for ( i = nCount; i; ) - { - delete pList->at( --i ); - } - } - delete pList; - } -} - -SvxFramesComboBox::~SvxFramesComboBox () -{ -} -//######################################################################## -//# # -//# ComboBox-Control for URL's with History and Autocompletion # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperURLBox::SvxHyperURLBox( Window* pParent, INetProtocol eSmart, sal_Bool bAddresses ) -: SvtURLBox ( pParent, eSmart ), - DropTargetHelper ( this ), - mbAccessAddress (bAddresses) -{ -} - -sal_Int8 SvxHyperURLBox::AcceptDrop( const AcceptDropEvent& /* rEvt */ ) -{ - return( IsDropFormatSupported( FORMAT_STRING ) ? DND_ACTION_COPY : DND_ACTION_NONE ); -} - -sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt ) -{ - TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); - String aString; - sal_Int8 nRet = DND_ACTION_NONE; - - if( aDataHelper.GetString( FORMAT_STRING, aString ) ) - { - SetText( aString ); - nRet = DND_ACTION_COPY; - } - - return nRet; -} - -void SvxHyperURLBox::Select() -{ - SvtURLBox::Select(); -} -void SvxHyperURLBox::Modify() -{ - SvtURLBox::Modify(); -} -long SvxHyperURLBox::Notify( NotifyEvent& rNEvt ) -{ - return SvtURLBox::Notify( rNEvt ); -} -long SvxHyperURLBox::PreNotify( NotifyEvent& rNEvt ) -{ - return SvtURLBox::PreNotify( rNEvt ); -} - -//######################################################################## -//# # -//# Hyperlink-Dialog: Tabpages-Baseclass # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Con/Destructor, Initialize -|* -\************************************************************************/ - -SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( Window *pParent, - const ResId &rResId, - const SfxItemSet& rItemSet ) -: IconChoicePage ( pParent, rResId, rItemSet ), - mpGrpMore ( NULL ), - mpFtFrame ( NULL ), - mpCbbFrame ( NULL ), - mpFtForm ( NULL ), - mpLbForm ( NULL ), - mpFtIndication ( NULL ), - mpEdIndication ( NULL ), - mpFtText ( NULL ), - mpEdText ( NULL ), - mpBtScript ( NULL ), - mbIsCloseDisabled ( sal_False ), - mpDialog ( pParent ), - mbStdControlsInit ( sal_False ), - aEmptyStr() -{ - // create bookmark-window - mpMarkWnd = new SvxHlinkDlgMarkWnd ( this ); -} - -SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase () -{ - maTimer.Stop(); - - if ( mbStdControlsInit ) - { - delete mpGrpMore; - delete mpFtFrame; - delete mpCbbFrame; - delete mpFtForm; - delete mpLbForm; - delete mpFtIndication; - delete mpEdIndication; - delete mpFtText; - delete mpEdText ; - delete mpBtScript; - } - - delete mpMarkWnd; -} - -void SvxHyperlinkTabPageBase::ActivatePage() -{ - TabPage::ActivatePage(); -} - -void SvxHyperlinkTabPageBase::DeactivatePage() -{ - TabPage::DeactivatePage(); -} - -sal_Bool SvxHyperlinkTabPageBase::QueryClose() -{ - return !mbIsCloseDisabled; -} - -void SvxHyperlinkTabPageBase::InitStdControls () -{ - if ( !mbStdControlsInit ) - { - mpGrpMore = new FixedLine ( this, ResId (GRP_MORE, *m_pResMgr) ); - mpFtFrame = new FixedText ( this, ResId (FT_FRAME, *m_pResMgr) ); - mpCbbFrame = new SvxFramesComboBox ( this, ResId (CB_FRAME, *m_pResMgr), GetDispatcher() ); - mpFtForm = new FixedText ( this, ResId (FT_FORM, *m_pResMgr) ); - mpLbForm = new ListBox ( this, ResId (LB_FORM, *m_pResMgr) ); - mpFtIndication= new FixedText ( this, ResId (FT_INDICATION, *m_pResMgr) ); - mpEdIndication= new Edit ( this, ResId (ED_INDICATION, *m_pResMgr) ); - mpFtText = new FixedText ( this, ResId (FT_TEXT, *m_pResMgr) ); - mpEdText = new Edit ( this, ResId (ED_TEXT, *m_pResMgr) ); - mpBtScript = new ImageButton ( this, ResId (BTN_SCRIPT, *m_pResMgr) ); - - mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) ); - mpBtScript->EnableTextDisplay (sal_False); - - mpBtScript->SetAccessibleRelationMemberOf( mpGrpMore ); - mpBtScript->SetAccessibleRelationLabeledBy( mpFtForm ); - } - - mbStdControlsInit = sal_True; -} - -/************************************************************************* -|* -|* Move Extra-Window -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::MoveToExtraWnd( Point aNewPos, sal_Bool bDisConnectDlg ) -{ - sal_Bool bReturn = mpMarkWnd->MoveTo ( aNewPos ); - - if( bDisConnectDlg ) - mpMarkWnd->ConnectToDialog( sal_False ); - - return ( !bReturn && IsMarkWndVisible() ); -} - -/************************************************************************* -|* -|* Show Extra-Window -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::ShowMarkWnd () -{ - ( ( Window* ) mpMarkWnd )->Show(); - - // Size of dialog-window in screen pixels - Rectangle aDlgRect( mpDialog->GetWindowExtentsRelative( NULL ) ); - Point aDlgPos ( aDlgRect.TopLeft() ); - Size aDlgSize ( mpDialog->GetSizePixel () ); - - // Absolute size of the screen - Rectangle aScreen( mpDialog->GetDesktopRectPixel() ); - - // Size of Extrawindow - Size aExtraWndSize( mpMarkWnd->GetSizePixel () ); - - // mpMarkWnd is a child of mpDialog, so coordinates for positioning must be relative to mpDialog - if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > aScreen.Right() ) - { - if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 ) - { - // Pos Extrawindow anywhere - MoveToExtraWnd( Point(10,10) ); // very unlikely - mpMarkWnd->ConnectToDialog( sal_False ); - } - else - { - // Pos Extrawindow on the left side of Dialog - MoveToExtraWnd( Point(0,0) - Point( long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) ); - } - } - else - { - // Pos Extrawindow on the right side of Dialog - MoveToExtraWnd ( Point( long(1.05*aDlgSize.getWidth()), 0 ) ); - } - - // Set size of Extra-Window - mpMarkWnd->SetSizePixel( Size( aExtraWndSize.Width(), aDlgSize.Height() ) ); -} - -/************************************************************************* -|* -|* Fill Dialogfields -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem ) -{ - // Frame - sal_uInt16 nPos = mpCbbFrame->GetEntryPos ( pHyperlinkItem->GetTargetFrame() ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND) - mpCbbFrame->SetText ( pHyperlinkItem->GetTargetFrame() ); - - // Form - String aStrFormText = CUI_RESSTR( RID_SVXSTR_HYPERDLG_FROM_TEXT ); - String aStrFormButton = CUI_RESSTR( RID_SVXSTR_HYPERDLG_FORM_BUTTON ); - - if( pHyperlinkItem->GetInsertMode() & HLINK_HTMLMODE ) - { - mpLbForm->Clear(); - mpLbForm->InsertEntry( aStrFormText ); - mpLbForm->SelectEntryPos ( 0 ); - } - else - { - mpLbForm->Clear(); - mpLbForm->InsertEntry( aStrFormText ); - mpLbForm->InsertEntry( aStrFormButton ); - mpLbForm->SelectEntryPos ( pHyperlinkItem->GetInsertMode() == HLINK_BUTTON ? 1 : 0 ); - } - - // URL - mpEdIndication->SetText ( pHyperlinkItem->GetName() ); - - // Name - mpEdText->SetText ( pHyperlinkItem->GetIntName() ); - - // Script-button - if ( !pHyperlinkItem->GetMacroEvents() ) - mpBtScript->Disable(); - else - mpBtScript->Enable(); -} - -/************************************************************************* -|* -|* Any action to do after apply-button is pressed -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::DoApply () -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* Ask page whether an insert is possible -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::AskApply () -{ - // default-implementation - return sal_True; -} - -/************************************************************************* -|* -|* This method would be called from bookmark-window to set new mark-string -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::SetMarkStr ( String& /*aStrMark*/ ) -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* This method will be called from the dialog-class if the state off -|* the online-mode has changed. -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::SetOnlineMode( sal_Bool /*bEnable*/ ) -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::SetInitFocus() -{ - GrabFocus(); -} - -/************************************************************************* -|* -|* Ask dialog whether the curretn doc is a HTML-doc -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::IsHTMLDoc() const -{ - return ((SvxHpLinkDlg*)mpDialog)->IsHTMLDoc(); -} - -/************************************************************************* -|* -|* retrieve dispatcher -|* -|************************************************************************/ - -SfxDispatcher* SvxHyperlinkTabPageBase::GetDispatcher() const -{ - return ((SvxHpLinkDlg*)mpDialog)->GetDispatcher(); -} - -/************************************************************************* -|* -|* Click on imagebutton : Script -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, void *, EMPTYARG ) -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem->GetMacroEvents() ) - { - // get macros from itemset - const SvxMacroTableDtor* pMacroTbl = pHyperlinkItem->GetMacroTbl(); - SvxMacroItem aItem ( GetWhich(SID_ATTR_MACROITEM) ); - if( pMacroTbl ) - aItem.SetMacroTable( *pMacroTbl ); - - // create empty itemset for macro-dlg - SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), - SID_ATTR_MACROITEM, - SID_ATTR_MACROITEM ); - pItemSet->Put ( aItem, SID_ATTR_MACROITEM ); - - /* disable HyperLinkDlg for input while the MacroAssignDlg is working - because if no JAVA is installed an error box occurs and then it is possible - to close the HyperLinkDlg before its child (MacroAssignDlg) -> GPF - */ - sal_Bool bIsInputEnabled = GetParent()->IsInputEnabled(); - if ( bIsInputEnabled ) - GetParent()->EnableInput( sal_False ); - SfxMacroAssignDlg aDlg( this, mxDocumentFrame, *pItemSet ); - - // add events - SfxMacroTabPage *pMacroPage = (SfxMacroTabPage*) aDlg.GetTabPage(); - - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOVER_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT1) ), - SFX_EVENT_MOUSEOVER_OBJECT ); - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSECLICK_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT2) ), - SFX_EVENT_MOUSECLICK_OBJECT); - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOUT_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT3) ), - SFX_EVENT_MOUSEOUT_OBJECT); - - if ( bIsInputEnabled ) - GetParent()->EnableInput( sal_True ); - // execute dlg - DisableClose( sal_True ); - short nRet = aDlg.Execute(); - DisableClose( sal_False ); - if ( RET_OK == nRet ) - { - const SfxItemSet* pOutSet = aDlg.GetOutputItemSet(); - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, sal_False, &pItem )) - { - pHyperlinkItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() ); - } - } - delete pItemSet; - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Get Macro-Infos -|* -|************************************************************************/ - -sal_uInt16 SvxHyperlinkTabPageBase::GetMacroEvents() -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - return pHyperlinkItem->GetMacroEvents(); -} - -SvxMacroTableDtor* SvxHyperlinkTabPageBase::GetMacroTable() -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - return ( (SvxMacroTableDtor*)pHyperlinkItem->GetMacroTbl() ); -} - -/************************************************************************* -|* -|* Does the given file exists ? -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::FileExists( const INetURLObject& rURL ) -{ - sal_Bool bRet = sal_False; - - if( rURL.GetFull().getLength() > 0 ) - { - try - { - Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - ::rtl::OUString aTitle; - - aCnt.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) ) >>= aTitle; - bRet = ( aTitle.getLength() > 0 ); - } - catch( ... ) - { - OSL_FAIL( "FileExists: ucb error" ); - } - } - - return bRet; -} - -/************************************************************************* -|* -|* try to detect the current protocol that is used in aStrURL -|* -|************************************************************************/ - -String SvxHyperlinkTabPageBase::GetSchemeFromURL( String aStrURL ) -{ - String aStrScheme; - - INetURLObject aURL( aStrURL ); - INetProtocol aProtocol = aURL.GetProtocol(); - - // #77696# - // our new INetUrlObject now has the ability - // to detect if an Url is valid or not :-( - if ( aProtocol == INET_PROT_NOT_VALID ) - { - if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTP_SCHEME, 0, 7 ) ) - { - aStrScheme = String::CreateFromAscii( INET_HTTP_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTPS_SCHEME, 0, 8 ) ) - { - aStrScheme = String::CreateFromAscii( INET_HTTPS_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_FTP_SCHEME, 0, 6 ) ) - { - aStrScheme = String::CreateFromAscii( INET_FTP_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_MAILTO_SCHEME, 0, 7 ) ) - { - aStrScheme = String::CreateFromAscii( INET_MAILTO_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_NEWS_SCHEME, 0, 5 ) ) - { - aStrScheme = String::CreateFromAscii( INET_NEWS_SCHEME ); - } - } - else - aStrScheme = INetURLObject::GetScheme( aProtocol ); - return aStrScheme; -} - - -void SvxHyperlinkTabPageBase::GetDataFromCommonFields( String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrIntName = mpEdText->GetText(); - aStrName = mpEdIndication->GetText(); - aStrFrame = mpCbbFrame->GetText(); - eMode = (SvxLinkInsertMode) (mpLbForm->GetSelectEntryPos()+1); - if( IsHTMLDoc() ) - eMode = (SvxLinkInsertMode) ( sal_uInt16(eMode) | HLINK_HTMLMODE ); -} - -/************************************************************************* -|* -|* reset dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet) -{ - /////////////////////////////////////// - // Set dialog-fields from create-itemset - maStrInitURL = aEmptyStr; - - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - rItemSet.GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem ) - { - // set dialog-fields - FillStandardDlgFields (pHyperlinkItem); - - // set all other fields - FillDlgFields ( (String&)pHyperlinkItem->GetURL() ); - - // Store initial URL - maStrInitURL = pHyperlinkItem->GetURL(); - } -} - -/************************************************************************* -|* -|* Fill output-ItemSet -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::FillItemSet( SfxItemSet& rOut) -{ - String aStrURL, aStrName, aStrIntName, aStrFrame; - SvxLinkInsertMode eMode; - - GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode); - if ( !aStrName.Len() ) //automatically create a visible name if the link is created without name - aStrName = CreateUiNameFromURL(aStrURL); - - sal_uInt16 nEvents = GetMacroEvents(); - SvxMacroTableDtor* pTable = GetMacroTable(); - - SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK, aStrName, aStrURL, aStrFrame, - aStrIntName, eMode, nEvents, pTable ); - rOut.Put (aItem); - - return sal_True; -} - -String SvxHyperlinkTabPageBase::CreateUiNameFromURL( const String& aStrURL ) -{ - String aStrUiURL; - INetURLObject aURLObj( aStrURL ); - - switch(aURLObj.GetProtocol()) - { - case INET_PROT_FILE: - utl::LocalFileHelper::ConvertURLToSystemPath( aURLObj.GetMainURL(INetURLObject::NO_DECODE), aStrUiURL ); - break; - case INET_PROT_FTP : - { - //remove password from name - INetURLObject aTmpURL(aURLObj); - aTmpURL.SetPass(aEmptyStr); - aStrUiURL = aTmpURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - } - break; - default : - { - aStrUiURL = aURLObj.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS); - } - } - if(!aStrUiURL.Len()) - return aStrURL; - return aStrUiURL; -} - -/************************************************************************* -|* -|* Activate / Deactivate Tabpage -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::ActivatePage( const SfxItemSet& rItemSet ) -{ - /////////////////////////////////////// - // Set dialog-fields from input-itemset - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - rItemSet.GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem ) - { - // standard-fields - FillStandardDlgFields (pHyperlinkItem); - } - - // show mark-window if it was open before - if ( ShouldOpenMarkWnd () ) - ShowMarkWnd (); -} - -int SvxHyperlinkTabPageBase::DeactivatePage( SfxItemSet* _pSet) -{ - // hide mark-wnd - SetMarkWndShouldOpen( IsMarkWndVisible () ); - HideMarkWnd (); - - // retrieve data of dialog - String aStrURL, aStrName, aStrIntName, aStrFrame; - SvxLinkInsertMode eMode; - - GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode); - - sal_uInt16 nEvents = GetMacroEvents(); - SvxMacroTableDtor* pTable = GetMacroTable(); - - if( _pSet ) - { - SvxHyperlinkItem aItem( SID_HYPERLINK_GETLINK, aStrName, aStrURL, aStrFrame, - aStrIntName, eMode, nEvents, pTable ); - _pSet->Put( aItem ); - } - - return( LEAVE_PAGE ); -} - -sal_Bool SvxHyperlinkTabPageBase::ShouldOpenMarkWnd() -{ - return sal_False; -} - -void SvxHyperlinkTabPageBase::SetMarkWndShouldOpen(sal_Bool) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hyperdlg.hrc b/cui/source/dialogs/hyperdlg.hrc deleted file mode 100644 index 7c2c08109..000000000 --- a/cui/source/dialogs/hyperdlg.hrc +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* Tabpage : Hyperlink - Internet */ - -#define GRP_LINKTYPE 1 -#define RB_LINKTYP_INTERNET 2 -#define RB_LINKTYP_FTP 3 -#define FT_TARGET_HTML 5 -#define CB_TARGET_HTML 6 -#define FT_LOGIN 7 -#define ED_LOGIN 8 -#define FT_PASSWD 9 -#define ED_PASSWD 10 -#define CBX_ANONYMOUS 11 -#define BTN_BROWSE 12 -#define BTN_TARGET 13 - -/* Tabpage : Hyperlink - Mail & News */ - -#define GRP_MAILNEWS 1 -#define RB_LINKTYP_MAIL 2 -#define RB_LINKTYP_NEWS 3 -#define FT_RECEIVER 4 -#define CB_RECEIVER 5 -#define FT_SUBJECT 6 -#define ED_SUBJECT 7 -#define BTN_ADRESSBOOK 8 - -/* Tabpage : Hyperlink - Document */ - -#define GRP_DOCUMENT 1 -#define FT_PATH_DOC 2 -#define CB_PATH_DOC 3 -#define BTN_FILEOPEN 4 -#define GRP_TARGET 5 -#define FT_TARGET_DOC 6 -#define ED_TARGET_DOC 7 -#define FT_URL 8 -#define FT_FULL_URL 9 - -/* Tabpage : Hyperlink - New document */ - -#define GRP_NEWDOCUMENT 1 -#define RB_EDITNOW 2 -#define RB_EDITLATER 3 -#define FT_PATH_NEWDOC 4 -#define ED_PATH_NEWDOC 5 -#define FT_DOCUMENT_TYPES 6 -#define LB_DOCUMENT_TYPES 7 -#define BTN_CREATE 8 - -/* Tabpage-section : Hyperlink - more justifications */ - -#define GRP_MORE 30 -#define FT_FRAME 31 -#define CB_FRAME 32 -#define FT_FORM 33 -#define LB_FORM 34 -#define FT_INDICATION 35 -#define ED_INDICATION 36 -#define FT_TEXT 37 -#define ED_TEXT 38 -#define BTN_SCRIPT 39 - -#define COL_OLD 54 -#define COL_2 63 -#define COL_DIFF (COL_2 - COL_OLD) diff --git a/cui/source/dialogs/hyperdlg.src b/cui/source/dialogs/hyperdlg.src deleted file mode 100644 index d52257bc2..000000000 --- a/cui/source/dialogs/hyperdlg.src +++ /dev/null @@ -1,830 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svtools/controldims.hrc> -#include <cuires.hrc> -#include "helpid.hrc" -#include "hyperdlg.hrc" - -#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }; -#define HYPERDLG_IMGBUTTON_HEIGHT RSC_CD_PUSHBUTTON_HEIGHT+2 - -/************************************************************************* -| -| Tabpage : Internet -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_INTERNET -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_INTERNET; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_LINKTYPE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Hyperlink type" ; - }; - RadioButton RB_LINKTYP_INTERNET - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_INTERNET:RB_LINKTYP_INTERNET"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 57, 10 ); - Text [ en-US ] = "~Web"; - }; - RadioButton RB_LINKTYP_FTP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_INTERNET:RB_LINKTYP_FTP"; - Pos = MAP_APPFONT( 114 + COL_DIFF, 13 ); - Size = MAP_APPFONT( 56 - COL_DIFF, 10 ); - Text [ en-US ] = "~FTP"; - }; - FixedText FT_TARGET_HTML - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF, 8 ) ; - Text [ en-US ] = "Tar~get" ; - }; - FixedText FT_LOGIN - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Login name" ; - }; - Edit ED_LOGIN - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_LOGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ; - }; - FixedText FT_PASSWD - { - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Password" ; - }; - Edit ED_PASSWD - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_PASSWD"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 59 ) ; - Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ; - PassWord = TRUE ; - }; - CheckBox CBX_ANONYMOUS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_HYPERLINK_INTERNET:CBX_ANONYMOUS"; - Pos = MAP_APPFONT ( COL_2 , 75 ) ; - Size = MAP_APPFONT ( 89 - COL_DIFF , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Anonymous ~user" ; - }; - ImageButton BTN_BROWSE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_INTERNET:BTN_BROWSE"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - Text [ en-US ] = "WWW Browser"; - - QuickHelpText [ en-US ] = "Open web browser, copy an URL, and paste it to Target field" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "browse.bmp" ; }; - MASKCOLOR - }; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_INTERNET:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 8 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_INTERNET:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_INTERNET:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : Mail & News -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_MAIL -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_MAIL; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_MAILNEWS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Mail & news" ; - }; - RadioButton RB_LINKTYP_MAIL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_MAIL:RB_LINKTYP_MAIL"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 56 - COL_DIFF, 10 ); - Text [ en-US ] = "~E-mail"; - }; - RadioButton RB_LINKTYP_NEWS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_MAIL:RB_LINKTYP_NEWS"; - Pos = MAP_APPFONT( 113, 13 ); - Size = MAP_APPFONT( 56, 10 ); - Text [ en-US ] = "~News"; - }; - FixedText FT_RECEIVER - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Re~ceiver" ; - }; - FixedText FT_SUBJECT - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Subject" ; - }; - Edit ED_SUBJECT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_SUBJECT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_ADRESSBOOK - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_MAIL:BTN_ADRESSBOOK"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "adrbook.bmp" ; }; - MASKCOLOR - }; - - Text [ en-US ] = "Data Sources..."; - QuickHelpText [ en-US ] = "Data Sources..." ; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_MAIL:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_MAIL:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_MAIL:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : Documents -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_DOCUMENT -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_DOCUMENT; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_DOCUMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Document" ; - }; - FixedText FT_PATH_DOC - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Path" ; - }; - ImageButton BTN_FILEOPEN - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_FILEOPEN"; - Pos = MAP_APPFONT ( 235, 14 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Open File" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "fileopen.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Open File"; - }; - FixedLine GRP_TARGET - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Target in document" ; - }; - FixedText FT_TARGET_DOC - { - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Targ~et" ; - }; - Edit ED_TARGET_DOC - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_TARGET_DOC"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 52 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 12 , 70 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "URL" ; - }; - FixedText FT_FULL_URL - { - Pos = MAP_APPFONT ( COL_2 , 70 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - Text [ en-US ] = "Test text" ; - }; - ImageButton BTN_BROWSE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_BROWSE"; - Pos = MAP_APPFONT ( 235, 51 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Target in Document" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "target.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Target in Document"; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_DOCUMENT:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_DOCUMENT:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : New Documents -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_NEWDOCUMENT -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_NEWDOCUMENT; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_NEWDOCUMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "New document" ; - }; - RadioButton RB_EDITNOW - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:RB_EDITNOW"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 85 - COL_DIFF, 10 ); - Text [ en-US ] = "Edit ~now"; - }; - RadioButton RB_EDITLATER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:RB_EDITLATER"; - Pos = MAP_APPFONT( 142, 13 ); - Size = MAP_APPFONT( 84, 10 ); - Text [ en-US ] = "Edit ~later"; - }; - FixedText FT_PATH_NEWDOC - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~File" ; - }; - Edit ED_PATH_NEWDOC - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_PATH_NEWDOC"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 25 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - FixedText FT_DOCUMENT_TYPES - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "File ~type" ; - }; - ListBox LB_DOCUMENT_TYPES - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:LB_DOCUMENT_TYPES"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 40 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - }; - ImageButton BTN_CREATE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:BTN_CREATE"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - QuickHelpText [ en-US ] = "Select Path" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "newdoc.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Select Path"; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage-Dialog : Hyperlinks -| -*************************************************************************/ -ModalDialog RID_SVXDLG_NEWHYPERLINK -{ - HelpID = CMD_SID_HYPERLINK_DIALOG; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 325 , 185 ) ; - Text [ en-US ] = "Hyperlink" ; - Moveable = TRUE ; -}; - -/************************************************************************* -| -| Tabpage-Dialog : Hyperlinks -| -*************************************************************************/ - -String RID_SVXSTR_HYPDLG_APPLYBUT -{ - Text [ en-US ] = "Apply" ; -}; -String RID_SVXSTR_HYPDLG_CLOSEBUT -{ - Text [ en-US ] = "Close" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT1 -{ - Text [ en-US ] = "Mouse over object" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT2 -{ - Text [ en-US ] = "Trigger hyperlink" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT3 -{ - Text [ en-US ] = "Mouse leaves object" ; -}; - -String RID_SVXSTR_HYPDLG_NOVALIDFILENAME -{ - Text [ en-US ] = "Please type in a valid file name." ; -}; - -String RID_SVXSTR_HYPERDLG_HLINETTP -{ - Text [ en-US ] = "Internet" ; -}; -String RID_SVXSTR_HYPERDLG_HLINETTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to a Web page or FTP server connection." ; -}; - -String RID_SVXSTR_HYPERDLG_HLMAILTP -{ - Text [ en-US ] = "Mail & News" ; -}; -String RID_SVXSTR_HYPERDLG_HLMAILTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to an e-mail address or newsgroup." ; -}; - -String RID_SVXSTR_HYPERDLG_HLDOCTP -{ - Text [ en-US ] = "Document" ; -}; -String RID_SVXSTR_HYPERDLG_HLDOCTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to an existing document or a target within a document." ; -}; - -String RID_SVXSTR_HYPERDLG_HLDOCNTP -{ - Text [ en-US ] = "New Document" ; -}; -String RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP -{ - Text [ en-US ] = "This is where you create a new document to which the new link points." ; -}; - -String RID_SVXSTR_HYPERDLG_FORM_BUTTON -{ - Text [ en-US ] = "Button" ; -}; - -String RID_SVXSTR_HYPERDLG_FROM_TEXT -{ - Text [ en-US ] = "Text" ; -}; - -String RID_SVXSTR_HYPERDLG_QUERYOVERWRITE -{ - Text [ en-US ] = "The file already exists. Overwrite?" ; -}; - -Image RID_SVXBMP_HLINETTP -{ - ImageBitmap = Bitmap { File = "hlinettp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLMAILTP -{ - ImageBitmap = Bitmap { File = "hlmailtp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLDOCTP -{ - ImageBitmap = Bitmap { File = "hldoctp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLDOCNTP -{ - ImageBitmap = Bitmap { File = "hldocntp.bmp" ; }; - MASKCOLOR -}; diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx deleted file mode 100644 index c9c5c2d82..000000000 --- a/cui/source/dialogs/hyphen.cxx +++ /dev/null @@ -1,653 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hyphen.hxx" -#include "hyphen.hrc" -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include <editeng/splwrap.hxx> -#include <editeng/svxenum.hxx> -#include <editeng/unolingu.hxx> -#include <svtools/langtab.hxx> -#include <svx/dialmgr.hxx> -#include <svx/dlgutil.hxx> -#include <tools/shl.hxx> -#include <vcl/msgbox.hxx> - -#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> - -using namespace ::com::sun::star; - - -#define HYPH_POS_CHAR '=' -#define CONTINUE_HYPH USHRT_MAX - -#define CUR_HYPH_POS_CHAR '-' - - -// class HyphenEdit_Impl ------------------------------------------------------- - -class HyphenEdit_Impl : public Edit -{ -public: - HyphenEdit_Impl( Window* pParent, const ResId& rResId ); - -protected: - virtual void KeyInput( const KeyEvent &rKEvt ); -}; - - -HyphenEdit_Impl::HyphenEdit_Impl( Window* pParent, const ResId& rResId ) : - Edit( pParent, rResId ) -{ -} - - -void HyphenEdit_Impl::KeyInput( const KeyEvent& rKEvt ) -{ - sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); - - switch ( nCode ) - { - case KEY_LEFT: - ( (SvxHyphenWordDialog*)GetParent() )->SelLeft(); - break; - - case KEY_RIGHT: - ( (SvxHyphenWordDialog*)GetParent() )->SelRight(); - break; - - case KEY_TAB: - case KEY_ESCAPE: - case KEY_RETURN: - Edit::KeyInput(rKEvt); - break; - default: - Control::KeyInput( rKEvt ); // An den Dialog weiterleiten - break; - } -} - - -// struct SvxHyphenWordDialog_Impl --------------------------------------------- - -struct SvxHyphenWordDialog_Impl -{ - SvxHyphenWordDialog * m_pDialog; - - FixedText aWordFT; - HyphenEdit_Impl aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - PushButton aContBtn; - PushButton aDelBtn; - FixedLine aFLBottom; - HelpButton aHelpBtn; - PushButton aHyphAll; - CancelButton aCancelBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - uno::Reference< linguistic2::XHyphenator > xHyphenator; - uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; - String aEditWord; // aEditWord and aWordEdit.GetText() differ only by the character for the current selected hyphenation position - String aActWord; // actual word to be hyphenated - LanguageType nActLanguage; // and its language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Int32 nHyphenationPositionsOffset; - sal_Bool bBusy; - - - void EnableLRBtn_Impl(); - String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); - - void InitControls_Impl(); - void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); - void SelLeft_Impl(); - void SelRight_Impl(); - - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); - DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( ContinueHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); - DECL_LINK( HyphenateAllHdl_Impl, Button* ); - DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( GetFocusHdl_Impl, Edit* ); - - - SvxHyphenWordDialog_Impl( - SvxHyphenWordDialog * pDialog, - const String &rWord, - LanguageType nLang, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ); - ~SvxHyphenWordDialog_Impl(); -}; - - -SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( - SvxHyphenWordDialog * pDialog, - const String &rWord, - LanguageType nLang, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - - m_pDialog ( pDialog ), - aWordFT ( pDialog, CUI_RES( FT_WORD ) ), - aWordEdit ( pDialog, CUI_RES( ED_WORD ) ), - aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), - aRightBtn ( pDialog, CUI_RES( BTN_RIGHT ) ), - aOkBtn ( pDialog, CUI_RES( BTN_HYPH_CUT ) ), - aContBtn ( pDialog, CUI_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( pDialog, CUI_RES( BTN_HYPH_DELETE ) ), - aFLBottom ( pDialog, CUI_RES( FL_BOTTOM ) ), - aHelpBtn ( pDialog, CUI_RES( BTN_HYPH_HELP ) ), - aHyphAll ( pDialog, CUI_RES( BTN_HYPH_ALL ) ), - aCancelBtn ( pDialog, CUI_RES( BTN_HYPH_CANCEL ) ), - aLabel ( pDialog->GetText() ), - pHyphWrapper ( NULL ), - xHyphenator ( NULL ), - xPossHyph ( NULL ), - aActWord ( ), - nActLanguage ( LANGUAGE_NONE ), - nMaxHyphenationPos ( 0 ), - nHyphPos ( 0 ), - nOldPos ( 0 ), - nHyphenationPositionsOffset( 0 ), - bBusy ( sal_False ) -{ - aActWord = rWord; - nActLanguage = nLang; - xHyphenator = xHyphen; - pHyphWrapper = pWrapper; - - uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ? - pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY ); - DBG_ASSERT( xHyphWord.is(), "hyphenation result missing" ); - if (xHyphWord.is()) - { - DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" ); - DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" ); - nMaxHyphenationPos = xHyphWord->getHyphenationPos(); - } - - InitControls_Impl(); - aWordEdit.GrabFocus(); - - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Right_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CutHdl_Impl ) ); - aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, ContinueHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, DeleteHdl_Impl ) ); - aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl ) ); - aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CancelHdl_Impl ) ); - aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog_Impl, GetFocusHdl_Impl ) ); -} - - -SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() -{ -} - - -void SvxHyphenWordDialog_Impl::EnableLRBtn_Impl() -{ - String aTxt( aEditWord ); - xub_StrLen nLen = aTxt.Len(); - xub_StrLen i; - - aRightBtn.Disable(); - for ( i = nOldPos + 2; i < nLen; ++i ) - { - if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) - { - aRightBtn.Enable(); - break; - } - } - - DBG_ASSERT(nOldPos < aTxt.Len(), "nOldPos out of range"); - if (nOldPos >= aTxt.Len()) - nOldPos = aTxt.Len() - 1; - aLeftBtn.Disable(); - for ( i = nOldPos; i-- > 0; ) - { - if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) - { - aLeftBtn.Enable(); - break; - } - } -} - - -String SvxHyphenWordDialog_Impl::EraseUnusableHyphens_Impl( - uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 _nMaxHyphenationPos ) -{ - // returns a String showing only those hyphen positions which will result - // in a line break if hyphenation is done there - // 1) we will need to discard all hyphenation positions at th end that - // will not result in a line break where the text to the left still fits - // on the line. - // 2) since as from OOo 3.2 '-' are part of a word an thus text like - // 'multi-line-editor' is regarded as single word we also need to discard those - // hyphenation positions to the left of the rightmost '-' that is still left of - // the rightmost valid hyphenation position according to 1) - // - // Example: - // If the possible hyphenation position in 'multi-line-editor' are to eb marked - // by '=' then the text will look like this 'mul=ti-line-ed=it=or'. - // If now the first line is only large enough for 'multi-line-edi' we need to discard - // the last possible hyphnation point because of 1). The the right most valid - // hyphenation position is "ed=itor". The first '-' left of this position is - // "line-ed", thus because of 2) we now need to discard all possible hyphneation - // positions to the left of that as well. Thus in the end leaving us with just - // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation - // position for the user too choose from. However ALL the '-' characters in the word - // will ALWAYS be valid implicit hyphenation positions for the core to choose from! - // And thus even if this word is skipped in the hyphenation dialog it will still be broken - // right after 'multi-line-' (actually it might already be broken up that way before - // the hyphenation dialog is called!). - // Thus rule 2) just eliminates those positions which will not be used by the core at all - // even if the user were to select one of them. - - String aTxt; - DBG_ASSERT(rxPossHyph.is(), "missing possible hyphens"); - if (rxPossHyph.is()) - { - DBG_ASSERT( aActWord == String( rxPossHyph->getWord() ), "word mismatch" ); - - aTxt = String( rxPossHyph->getPossibleHyphens() ); - - nHyphenationPositionsOffset = 0; - uno::Sequence< sal_Int16 > aHyphenationPositions( - rxPossHyph->getHyphenationPositions() ); - sal_Int32 nLen = aHyphenationPositions.getLength(); - const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); - - // find position nIdx after which all hyphen positions are unusable - xub_StrLen nIdx = STRING_NOTFOUND; - xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; - if (nLen) - { - xub_StrLen nStart = 0; - for (sal_Int32 i = 0; i < nLen; ++i) - { - if (pHyphenationPos[i] > _nMaxHyphenationPos) - break; - else - { - // find corresponding hyphen pos in string - nPos = aTxt.Search( sal_Unicode( HYPH_POS_CHAR ), nStart ); - - if (nStart == STRING_NOTFOUND) - break; - else - { - nIdx = nPos; - nStart = nPos + 1; - } - } - } - } - DBG_ASSERT(nIdx != STRING_NOTFOUND, "no usable hyphenation position"); - - // 1) remove all not usable hyphenation positions from the end of the string - nPos = nIdx == STRING_NOTFOUND ? 0 : nIdx + 1; - nPos1 = nPos; //save for later use in 2) below - const String aTmp( sal_Unicode( HYPH_POS_CHAR ) ); - const String aEmpty; - while (nPos != STRING_NOTFOUND) - nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); - - // 2) remove all hyphenation positions from the start that are not considered by the core - const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); - nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default - if (nPos2 != STRING_NOTFOUND) - { - String aLeft( aSearchRange.Copy( 0, nPos2 ) ); - nPos = 0; - while (nPos != STRING_NOTFOUND) - { - nPos = aLeft.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); - if (nPos != STRING_NOTFOUND) - ++nHyphenationPositionsOffset; - } - aTxt.Replace( 0, nPos2, aLeft ); - } - } - return aTxt; -} - - -void SvxHyphenWordDialog_Impl::InitControls_Impl() -{ - xPossHyph = NULL; - if (xHyphenator.is()) - { - lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); - xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - uno::Sequence< beans::PropertyValue >() ); - if (xPossHyph.is()) - aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); - } - aWordEdit.SetText( aEditWord ); - - nOldPos = aEditWord.Len(); - SelLeft_Impl(); - EnableLRBtn_Impl(); -} - - -void SvxHyphenWordDialog_Impl::ContinueHyph_Impl( sal_uInt16 nInsPos ) -{ - if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) - { - if (nInsPos) - { - String aTmp( aEditWord ); - DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); - - sal_Int16 nIdxPos = -1; - for (sal_uInt16 i = 0; i <= nInsPos; ++i) - { - if (HYPH_POS_CHAR == aTmp.GetChar( i )) - nIdxPos++; - } - // take the possible hyphenation positions that got removed from the - // start of the wor dinot account: - nIdxPos += nHyphenationPositionsOffset; - - uno::Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); - sal_Int32 nLen = aSeq.getLength(); - DBG_ASSERT(nLen, "empty sequence"); - DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range"); - if (nLen && 0 <= nIdxPos && nIdxPos < nLen) - { - nInsPos = aSeq.getConstArray()[ nIdxPos ]; - pHyphWrapper->InsertHyphen( nInsPos ); - } - } - else - { - //! calling with 0 as argument will remove hyphens! - pHyphWrapper->InsertHyphen( nInsPos ); - } - } - - if ( pHyphWrapper->FindSpellError() ) - { - uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), uno::UNO_QUERY ); - - // adapt actual word and language to new found hyphenation result - if(xHyphWord.is()) - { - aActWord = String( xHyphWord->getWord() ); - nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); - nMaxHyphenationPos = xHyphWord->getHyphenationPos(); - InitControls_Impl(); - m_pDialog->SetWindowTitle( nActLanguage ); - } - } - else - m_pDialog->EndDialog( RET_OK ); -} - - -sal_uInt16 SvxHyphenWordDialog_Impl::GetHyphIndex_Impl() -{ - sal_uInt16 nPos = 0; - String aTxt( aWordEdit.GetText() ); - - for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) - { - sal_Unicode cChar = aTxt.GetChar( i ); - if ( cChar == CUR_HYPH_POS_CHAR ) - break; - if ( cChar != HYPH_POS_CHAR ) - nPos++; - } - return nPos; -} - - -void SvxHyphenWordDialog_Impl::SelLeft_Impl() -{ - DBG_ASSERT( nOldPos > 0, "invalid hyphenation position" ); - if (nOldPos > 0) - { - String aTxt( aEditWord ); - for ( xub_StrLen i = nOldPos - 1; i > 0; --i) - { - DBG_ASSERT(i <= aTxt.Len(), "index out of range"); - if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) - { - aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); - - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); - } -} - - -void SvxHyphenWordDialog_Impl::SelRight_Impl() -{ - String aTxt( aEditWord ); - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) - { - if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) - { - aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); - - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, CutHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl( /*nHyphPos*/nOldPos ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) -{ - if( !bBusy ) - { - try - { - uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); - const rtl::OUString aName( RTL_CONSTASCII_USTRINGPARAM( "IsHyphAuto" ) ); - uno::Any aAny; - - aAny <<= sal_True; - xProp->setPropertyValue( aName, aAny ); - - bBusy = sal_True; - ContinueHyph_Impl( /*nHyphPos*/nOldPos ); - bBusy = sal_False; - - aAny <<= sal_False; - xProp->setPropertyValue( aName, aAny ); - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "Hyphenate All failed" ); - } - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, DeleteHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, ContinueHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl( CONTINUE_HYPH ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, CancelHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - pHyphWrapper->SpellEnd(); - m_pDialog->EndDialog( RET_CANCEL ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, Left_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - SelLeft_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, Right_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - SelRight_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, GetFocusHdl_Impl, Edit *, EMPTYARG ) -{ - aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); - return 0; -} - - -// class SvxHyphenWordDialog --------------------------------------------- - -SvxHyphenWordDialog::SvxHyphenWordDialog( - const String &rWord, LanguageType nLang, - Window* pParent, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ) -{ - m_pImpl = std::auto_ptr< SvxHyphenWordDialog_Impl >( - new SvxHyphenWordDialog_Impl( this, rWord, nLang, xHyphen, pWrapper ) ); - - FreeResource(); - - SetWindowTitle( nLang ); - - // disable controls if service is not available - if (!m_pImpl->xHyphenator.is()) - Enable( sal_False ); -} - - -SvxHyphenWordDialog::~SvxHyphenWordDialog() -{ -} - - -void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) -{ - String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); - String aTmp( m_pImpl->aLabel ); - aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - aTmp.Append( aLangStr ); - aTmp.Append( sal_Unicode( ')' ) ); - SetText( aTmp ); -} - - -void SvxHyphenWordDialog::SelLeft() -{ - m_pImpl->SelRight_Impl(); -} - - -void SvxHyphenWordDialog::SelRight() -{ - m_pImpl->SelLeft_Impl(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hyphen.hrc b/cui/source/dialogs/hyphen.hrc deleted file mode 100644 index ba195caeb..000000000 --- a/cui/source/dialogs/hyphen.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_HYPHEN_HRC -#define _SVX_HYPHEN_HRC - -// defines ------------------------------------------------------------------ - -#define ED_WORD 10 -#define BTN_LEFT 11 -#define BTN_RIGHT 12 -#define FT_WORD 13 -#define FL_BOTTOM 14 - -#define BTN_HYPH_CONTINUE 20 -#define BTN_HYPH_DELETE 21 -#define BTN_HYPH_CUT 22 -#define BTN_HYPH_CANCEL 23 -#define BTN_HYPH_HELP 24 -#define BTN_HYPH_ALL 25 - -#endif - diff --git a/cui/source/dialogs/hyphen.src b/cui/source/dialogs/hyphen.src deleted file mode 100644 index a34a3d862..000000000 --- a/cui/source/dialogs/hyphen.src +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "cuires.hrc" -#include "hyphen.hrc" - -String RID_SVXSTR_HMERR_CHECKINSTALL -{ - Text [ en-US ] = "is not available for spellchecking\nPlease check your installation and install the desired language\n" ; -}; - - // RID_SVXDLG_HYPHENATE -------------------------------------------------- -ModalDialog RID_SVXDLG_HYPHENATE -{ - HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 200 , 111 ) ; - OutputSize = TRUE ; - SvLook = TRUE ; - Text [ en-US ] = "Hyphenation" ; - Moveable = TRUE ; - - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 5 , 5 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; - }; - Edit ED_WORD - { - HelpID = "cui:Edit:RID_SVXDLG_HYPHENATE:ED_WORD"; - BORDER = TRUE ; - Pos = MAP_APPFONT ( 5 , 17 ) ; - Size = MAP_APPFONT ( 132 , 12 ) ; - TABSTOP = TRUE ; - LEFT = TRUE ; - }; - ImageButton BTN_LEFT - { - HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_LEFT"; - Pos = MAP_APPFONT ( 56 , 33 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - SYMBOL = IMAGEBUTTON_ARROW_LEFT ; - }; - ImageButton BTN_RIGHT - { - HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_RIGHT"; - Pos = MAP_APPFONT ( 75 , 33 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - Symbol = IMAGEBUTTON_ARROW_RIGHT ; - }; - OKButton BTN_HYPH_CUT - { - Pos = MAP_APPFONT ( 144 , 17 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "H~yphenate" ; - TABSTOP = TRUE ; - DEFBUTTON = TRUE ; - }; - PushButton BTN_HYPH_CONTINUE - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_CONTINUE"; - Pos = MAP_APPFONT ( 144 , 35 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Skip" ; - TABSTOP = TRUE ; - }; - PushButton BTN_HYPH_DELETE - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_DELETE"; - Pos = MAP_APPFONT ( 144 , 52 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Remove" ; - TABSTOP = TRUE ; - }; - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 0 , 81 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - }; - HelpButton BTN_HYPH_HELP - { - Pos = MAP_APPFONT ( 5 , 93 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - }; - PushButton BTN_HYPH_ALL - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_ALL"; - Pos = MAP_APPFONT ( 63 , 93 ) ; - Size = MAP_APPFONT ( 74 , 14 ) ; - Text [ en-US ] = "Hyphenate ~All" ; - TABSTOP = TRUE ; - }; - CancelButton BTN_HYPH_CANCEL - { - Pos = MAP_APPFONT ( 144 , 93 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Close"; - TABSTOP = TRUE ; - }; -}; diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx deleted file mode 100644 index f5846d340..000000000 --- a/cui/source/dialogs/iconcdlg.cxx +++ /dev/null @@ -1,1266 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/app.hxx> -#include <tools/rc.h> -#include <tools/shl.hxx> - -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> -#include <dialmgr.hxx> - -#include "iconcdlg.hxx" - -#include "helpid.hrc" -#include <cuires.hrc> -#include <unotools/viewoptions.hxx> -#include <svtools/apearcfg.hxx> -#include <vcl/mnemonic.hxx> -#include <vcl/i18nhelp.hxx> - -using ::std::vector; - -int SAL_CALL IconcDlgCmpUS_Impl( const void* p1, const void* p2 ) -{ - return *(sal_uInt16*)p1 - *(sal_uInt16*)p2; -} - -// some stuff for easier changes for SvtViewOptions -static const sal_Char* pViewOptDataName = "dialog data"; -#define VIEWOPT_DATANAME ::rtl::OUString::createFromAscii( pViewOptDataName ) - -static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData ) -{ - rOpt.SetUserItem( VIEWOPT_DATANAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( rData ) ) ); -} - -static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) -{ - ::com::sun::star::uno::Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) ); - ::rtl::OUString aUserData; - aAny >>= aUserData; - - return String( aUserData ); -} - - -//##################################################################### -// -// Class IconChoicePage -// -//##################################################################### - -/********************************************************************** -| -| Ctor / Dtor -| -\**********************************************************************/ - -IconChoicePage::IconChoicePage( Window *pParent, const ResId &rResId, - const SfxItemSet &rAttrSet ) -: TabPage ( pParent, rResId ), - pSet ( &rAttrSet ), - bHasExchangeSupport ( sal_False ), - pDialog ( NULL ), - bStandard ( sal_False ) -{ - SetStyle ( GetStyle() | WB_DIALOGCONTROL | WB_HIDE ); -} - -// ----------------------------------------------------------------------- - -IconChoicePage::~IconChoicePage() -{ -} - -/********************************************************************** -| -| Activate / Deaktivate -| -\**********************************************************************/ - -void IconChoicePage::ActivatePage( const SfxItemSet& ) -{ -} - -// ----------------------------------------------------------------------- - -int IconChoicePage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} - -/********************************************************************** -| -| ... -| -\**********************************************************************/ - -void IconChoicePage::FillUserData() -{ -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoicePage::IsReadOnly() const -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoicePage::QueryClose() -{ - return sal_True; -} - -/********************************************************************** -| -| window-methods -| -\**********************************************************************/ - -void IconChoicePage::ImplInitSettings() -{ - Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( sal_True ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( sal_True ); - SetBackground(); - } - else - { - EnableChildTransparentMode( sal_False ); - SetParentClipMode( 0 ); - SetPaintTransparent( sal_False ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } -} - -// ----------------------------------------------------------------------- - -void IconChoicePage::StateChanged( StateChangedType nType ) -{ - Window::StateChanged( nType ); - - if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - { - ImplInitSettings(); - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - ImplInitSettings(); - Invalidate(); - } -} - -//##################################################################### -// -// Class IconChoiceDialog -// -//##################################################################### - -/********************************************************************** -| -| Ctor / Dtor -| -\**********************************************************************/ - -IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId, - const EIconChoicePos ePos, - const SfxItemSet *pItemSet ) -: ModalDialog ( pParent, rResId ), - meChoicePos ( ePos ), - maIconCtrl ( this, WB_3DLOOK | WB_ICON | WB_BORDER | - WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | - WB_NODRAGSELECTION | WB_TABSTOP ), - mnCurrentPageId ( USHRT_MAX ), - - aOKBtn ( this, WB_DEFBUTTON ), - aCancelBtn ( this, WB_DEFBUTTON ), - aHelpBtn ( this ), - aResetBtn ( this ), - pSet ( pItemSet ), - pOutSet ( NULL ), - pExampleSet ( NULL ), - pRanges ( NULL ), - nResId ( rResId.GetId() ), - - bHideResetBtn ( sal_False ), - bModal ( sal_False ), - bInOK ( sal_False ), - bModified ( sal_False ), - bItemsReset ( sal_False ) -{ - - maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN ); - SetCtrlPos ( meChoicePos ); - maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) ); - maIconCtrl.Show(); - maIconCtrl.SetChoiceWithCursor ( sal_True ); - maIconCtrl.SetSelectionMode( SINGLE_SELECTION ); - maIconCtrl.SetHelpId( HID_ICCDIALOG_CHOICECTRL ); - - // ItemSet - if ( pSet ) - { - pExampleSet = new SfxItemSet( *pSet ); - pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - } - - // Buttons - aOKBtn.SetClickHdl ( LINK( this, IconChoiceDialog, OkHdl ) ); - aOKBtn.SetHelpId( HID_ICCDIALOG_OK_BTN ); - aCancelBtn.SetHelpId( HID_ICCDIALOG_CANCEL_BTN ); - aResetBtn.SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) ); - aResetBtn.SetText( CUI_RESSTR(RID_SVXSTR_ICONCHOICEDLG_RESETBUT) ); - aResetBtn.SetHelpId( HID_ICCDIALOG_RESET_BTN ); - aOKBtn.Show(); - aCancelBtn.Show(); - aHelpBtn.Show(); - aResetBtn.Show(); - - SetPosSizeCtrls ( sal_True ); -} - -// ----------------------------------------------------------------------- - -IconChoiceDialog ::~IconChoiceDialog () -{ - // save configuration at INI-Manager - // and remove pages - SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); - aTabDlgOpt.SetWindowState(::rtl::OStringToOUString(GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US)); - aTabDlgOpt.SetPageID( mnCurrentPageId ); - - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[ i ]; - - if ( pData->pPage ) - { - pData->pPage->FillUserData(); - String aPageData(pData->pPage->GetUserData()); - if ( aPageData.Len() ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - - SetViewOptUserItem( aTabPageOpt, aPageData ); - } - - if ( pData->bOnDemand ) - delete (SfxItemSet*)&pData->pPage->GetItemSet(); - delete pData->pPage; - } - delete pData; - } - - // remove Userdata from Icons - for ( sal_uLong i=0; i < maIconCtrl.GetEntryCount(); i++) - { - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); - delete pUserData; - } - - // - if ( pRanges ) - delete pRanges; - if ( pOutSet ) - delete pOutSet; -} - -/********************************************************************** -| -| add new page -| -\**********************************************************************/ - -SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( - sal_uInt16 nId, - const String& rIconText, - const Image& rChoiceIcon, - CreatePage pCreateFunc /* != 0 */, - GetPageRanges pRangesFunc /* darf 0 sein */, - sal_Bool bItemsOnDemand, - sal_uLong /*nPos*/ -) -{ - IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc, - pRangesFunc, - bItemsOnDemand ); - maPageList.push_back( pData ); - - pData->fnGetRanges = pRangesFunc; - pData->bOnDemand = bItemsOnDemand; - - sal_uInt16 *pId = new sal_uInt16 ( nId ); - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon ); - pEntry->SetUserData ( (void*) pId ); - return pEntry; -} - -/********************************************************************** -| -| remove page -| -\**********************************************************************/ - -void IconChoiceDialog::RemoveTabPage( sal_uInt16 nId ) -{ - IconChoicePageData* pData = GetPageData ( nId ); - - // remove page from list - if ( pData ) - { - for ( vector< IconChoicePageData* >::iterator i = maPageList.begin(); i < maPageList.end(); ++i ) - { - if ( *i == pData ) - { - maPageList.erase( i ); - break; - } - } - - // save settings - if ( pData->pPage ) - { - pData->pPage->FillUserData(); - String aPageData(pData->pPage->GetUserData()); - if ( aPageData.Len() ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - - SetViewOptUserItem( aTabPageOpt, aPageData ); - } - } - - if ( pData->bOnDemand ) - delete ( SfxItemSet * )&( pData->pPage->GetItemSet() ); - - delete pData->pPage; - delete pData; - } - - // remove Icon - bool bFound = false; - for ( sal_uLong i=0; i<maIconCtrl.GetEntryCount() && !bFound; i++) - { - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); - - if ( *pUserData == nId ) - { - delete pUserData; - maIconCtrl.RemoveEntry ( pEntry ); - bFound = true; - } - } - - // was it the current page ? - if ( nId == mnCurrentPageId ) - { - mnCurrentPageId = maPageList.front()->nId; - } - - Invalidate (); -} - -/********************************************************************** -| -| Paint-method -| -\**********************************************************************/ - -void IconChoiceDialog::Paint( const Rectangle& rRect ) -{ - Dialog::Paint ( rRect ); - - for ( size_t i = 0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - - if ( pData->nId == mnCurrentPageId ) - { - ShowPageImpl ( pData ); - } - else - { - HidePageImpl ( pData ); - } - } -} - -EIconChoicePos IconChoiceDialog::SetCtrlPos( const EIconChoicePos& rPos ) -{ - WinBits aWinBits = maIconCtrl.GetStyle (); - - switch ( meChoicePos ) - { - case PosLeft : - aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL; - aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL; - break; - case PosRight : - aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL; - aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL; - break; - case PosTop : - aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL; - aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL; - break; - case PosBottom : - aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL; - aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL; - break; - }; - maIconCtrl.SetStyle ( aWinBits ); - - SetPosSizeCtrls(); - - - EIconChoicePos eOldPos = meChoicePos; - meChoicePos = rPos; - - return eOldPos; -} - -/********************************************************************** -| -| Show / Hide page or button -| -\**********************************************************************/ - -void IconChoiceDialog::ShowPageImpl ( IconChoicePageData* pData ) -{ - if ( pData->pPage ) - pData->pPage->Show(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::HidePageImpl ( IconChoicePageData* pData ) -{ - if ( pData->pPage ) - pData->pPage->Hide(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::RemoveResetButton() -{ - aResetBtn.Hide(); - bHideResetBtn = true; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::ShowPage( sal_uInt16 nId ) -{ - bool bInvalidate = GetCurPageId() != nId; - SetCurPageId( nId ); - ActivatePageImpl( ); - if(bInvalidate) - Invalidate(); -} - -/********************************************************************** -| -| Resize Dialog -| -\**********************************************************************/ - -#define ICONCTRL_WIDTH_PIXEL 110 -#define ICONCTRL_HEIGHT_PIXEL 75 -#define MINSIZE_BUTTON_WIDTH 70 -#define MINSIZE_BUTTON_HEIGHT 22 - -void IconChoiceDialog::Resize() -{ - Dialog::Resize (); - - if ( IsReallyVisible() ) - { - SetPosSizeCtrls (); - } -} - -void IconChoiceDialog::SetPosSizeCtrls ( sal_Bool bInit ) -{ - const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); - Size aOutSize ( GetOutputSizePixel() ); - - //////////////////////////////////////// - // Button-Defaults - // - Size aDefaultButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); - - // Reset-Button - Size aResetButtonSize ( bInit ? aDefaultButtonSize : - aResetBtn.GetSizePixel () ); - - //////////////////////////////////////// - // IconChoiceCtrl resizen & positionieren - // - SvtTabAppearanceCfg aCfg; - const long nDefaultWidth = (aCfg.GetScaleFactor() * ICONCTRL_WIDTH_PIXEL) / 100; - const long nDefaultHeight = (aCfg.GetScaleFactor() * ICONCTRL_HEIGHT_PIXEL) / 100; - - Size aNewIconCtrlSize ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - Point aIconCtrlPos; - switch ( meChoicePos ) - { - case PosLeft : - aIconCtrlPos = aCtrlOffset; - aNewIconCtrlSize = Size ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - break; - case PosRight : - aIconCtrlPos = Point ( aOutSize.Width() - nDefaultWidth - - aCtrlOffset.X(), aCtrlOffset.X() ); - aNewIconCtrlSize = Size ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - break; - case PosTop : - aIconCtrlPos = aCtrlOffset; - aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()), - nDefaultHeight ); - break; - case PosBottom : - aIconCtrlPos = Point ( aCtrlOffset.X(), aOutSize.Height() - - aResetButtonSize.Height() - (2*aCtrlOffset.X()) - - nDefaultHeight ); - aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()), - nDefaultHeight ); - break; - }; - maIconCtrl.SetPosSizePixel ( aIconCtrlPos, aNewIconCtrlSize ); - maIconCtrl.ArrangeIcons(); - - //////////////////////////////////////// - // Pages resizen & positionieren - // - for ( size_t i = 0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - - Point aNewPagePos; - Size aNewPageSize; - switch ( meChoicePos ) - { - case PosLeft : - aNewPagePos = Point ( aNewIconCtrlSize.Width() + (2*CTRLS_OFFSET), - CTRLS_OFFSET ); - aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() - - (3*CTRLS_OFFSET), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*CTRLS_OFFSET) ); - break; - case PosRight : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosTop : - aNewPagePos = Point ( aCtrlOffset.X(), aNewIconCtrlSize.Height() + - (2*aCtrlOffset.X()) ); - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) ); - break; - case PosBottom : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) ); - break; - }; - - if ( pData->pPage ) - pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize ); - } - - //////////////////////////////////////// - // Buttons positionieren - // - sal_uLong nXOffset=0; - if ( meChoicePos == PosRight ) - nXOffset = aNewIconCtrlSize.Width()+(2*aCtrlOffset.X()); - - aResetBtn.SetPosSizePixel ( Point( aOutSize.Width() - nXOffset - - aResetButtonSize.Width()-aCtrlOffset.X(), - aOutSize.Height()-aResetButtonSize.Height()- - aCtrlOffset.X() ), - aResetButtonSize ); - // Help-Button - Size aHelpButtonSize ( bInit ? aDefaultButtonSize : - aHelpBtn.GetSizePixel () ); - aHelpBtn.SetPosSizePixel ( Point( aOutSize.Width()-aResetButtonSize.Width()- - aHelpButtonSize.Width()- nXOffset - - (2*aCtrlOffset.X()), - aOutSize.Height()-aHelpButtonSize.Height()- - aCtrlOffset.X() ), - aHelpButtonSize ); - // Cancel-Button - Size aCancelButtonSize ( bInit ? aDefaultButtonSize : - aCancelBtn.GetSizePixel () ); - aCancelBtn.SetPosSizePixel ( Point( aOutSize.Width()-aCancelButtonSize.Width()- - aResetButtonSize.Width()-aHelpButtonSize.Width()- - (3*aCtrlOffset.X()) - nXOffset, - aOutSize.Height()-aCancelButtonSize.Height()- - aCtrlOffset.X() ), - aCancelButtonSize ); - // OK-Button - Size aOKButtonSize ( bInit ? aDefaultButtonSize : aOKBtn.GetSizePixel () ); - aOKBtn.SetPosSizePixel ( Point( aOutSize.Width()-aOKButtonSize.Width()- - aCancelButtonSize.Width()-aResetButtonSize.Width()- - aHelpButtonSize.Width()-(4*aCtrlOffset.X())- nXOffset, - aOutSize.Height()-aOKButtonSize.Height()-aCtrlOffset.X() ), - aOKButtonSize ); - - Invalidate(); -} - -void IconChoiceDialog::SetPosSizePages ( sal_uInt16 nId ) -{ - const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); - IconChoicePageData* pData = GetPageData ( nId ); - - if ( pData->pPage ) - { - Size aOutSize ( GetOutputSizePixel() ); - Size aIconCtrlSize ( maIconCtrl.GetSizePixel() ); - - Point aNewPagePos; - Size aNewPageSize; - switch ( meChoicePos ) - { - case PosLeft : - aNewPagePos = Point ( aIconCtrlSize.Width() + (2*aCtrlOffset.X()), - aCtrlOffset.X() ); - aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosRight : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosTop : - aNewPagePos = Point ( aCtrlOffset.X(), aIconCtrlSize.Height() + - (2*aCtrlOffset.X()) ); - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) ); - break; - case PosBottom : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) ); - break; - }; - - pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize ); - } -} - -/********************************************************************** -| -| select a page -| -\**********************************************************************/ - -IMPL_LINK ( IconChoiceDialog , ChosePageHdl_Impl, void *, EMPTYARG ) -{ - sal_uLong nPos; - - SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos ); - if ( !pEntry ) - pEntry = maIconCtrl.GetCursor( ); - - sal_uInt16 *pId = (sal_uInt16*)pEntry->GetUserData (); - - if( *pId != mnCurrentPageId ) - { - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - if ( pData->pPage ) - DeActivatePageImpl(); - - SetCurPageId ( *pId ); - - ActivatePageImpl(); - Invalidate(); - } - - return 0L; -} - -/********************************************************************** -| -| Button-handler -| -\**********************************************************************/ - -IMPL_LINK( IconChoiceDialog, OkHdl, Button *, EMPTYARG ) -{ - bInOK = sal_True; - - if ( OK_Impl() ) - { - if ( bModal ) - EndDialog( Ok() ); - else - { - Ok(); - Close(); - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( IconChoiceDialog, ResetHdl, Button *, EMPTYARG ) -{ - ResetPageImpl (); - - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - DBG_ASSERT( pData, "Id nicht bekannt" ); - - if ( pData->bOnDemand ) - { - // CSet auf AIS hat hier Probleme, daher getrennt - const SfxItemSet* _pSet = &( pData->pPage->GetItemSet() ); - pData->pPage->Reset( *(SfxItemSet*)_pSet ); - } - else - pData->pPage->Reset( *pSet ); - - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( IconChoiceDialog, CancelHdl, Button*, EMPTYARG ) -{ - Close(); - - return 0; -} - -/********************************************************************** -| -| call page -| -\**********************************************************************/ - -void IconChoiceDialog::ActivatePageImpl () -{ - DBG_ASSERT( !maPageList.empty(), "keine Pages angemeldet" ); - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - DBG_ASSERT( pData, "Id nicht bekannt" ); - bool bReadOnly = false; - if ( pData ) - { - if ( !pData->pPage ) - { - const SfxItemSet* pTmpSet = 0; - - if ( pSet ) - { - if ( bItemsReset && pSet->GetParent() ) - pTmpSet = pSet->GetParent(); - else - pTmpSet = pSet; - } - - if ( pTmpSet && !pData->bOnDemand ) - pData->pPage = (pData->fnCreatePage)( this, *pTmpSet ); - else - pData->pPage = (pData->fnCreatePage)( this, *CreateInputItemSet( mnCurrentPageId ) ); - - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - pData->pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) ); - SetPosSizePages ( pData->nId ); - - if ( pData->bOnDemand ) - pData->pPage->Reset( (SfxItemSet &)pData->pPage->GetItemSet() ); - else - pData->pPage->Reset( *pSet ); - - PageCreated( mnCurrentPageId, *pData->pPage ); - } - else if ( pData->bRefresh ) - { - pData->pPage->Reset( *pSet ); - } - - pData->bRefresh = sal_False; - - if ( pExampleSet ) - pData->pPage->ActivatePage( *pExampleSet ); - SetHelpId( pData->pPage->GetHelpId() ); - bReadOnly = pData->pPage->IsReadOnly(); - } - - - if ( bReadOnly || bHideResetBtn ) - aResetBtn.Hide(); - else - aResetBtn.Show(); - -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoiceDialog::DeActivatePageImpl () -{ - IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); - - int nRet = IconChoicePage::LEAVE_PAGE; - - if ( pData ) - { - IconChoicePage * pPage = pData->pPage; - - if ( !pExampleSet && pPage->HasExchangeSupport() && pSet ) - pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pSet ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pPage->HasExchangeSupport() ) - nRet = pPage->DeactivatePage( &aTmp ); - - if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE && - aTmp.Count() ) - { - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - } - else - { - if ( pPage->HasExchangeSupport() ) //!!! - { - if ( !pExampleSet ) - { - SfxItemPool* pPool = pPage->GetItemSet().GetPool(); - pExampleSet = - new SfxItemSet( *pPool, GetInputRanges( *pPool ) ); - } - nRet = pPage->DeactivatePage( pExampleSet ); - } - else - nRet = pPage->DeactivatePage( NULL ); - } - - if ( nRet & IconChoicePage::REFRESH_SET ) - { - pSet = GetRefreshedSet(); - DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" ); - // alle Pages als neu zu initialsieren flaggen - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pObj = maPageList[ i ]; - if ( pObj->pPage != pPage ) // eigene Page nicht mehr refreshen - pObj->bRefresh = sal_True; - else - pObj->bRefresh = sal_False; - } - } - } - - if ( nRet & IconChoicePage::LEAVE_PAGE ) - return sal_True; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::ResetPageImpl () -{ - IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); - - DBG_ASSERT( pData, "Id nicht bekannt" ); - - if ( pData->bOnDemand ) - { - // CSet auf AIS hat hier Probleme, daher getrennt - const SfxItemSet* _pSet = &pData->pPage->GetItemSet(); - pData->pPage->Reset( *(SfxItemSet*)_pSet ); - } - else - pData->pPage->Reset( *pSet ); -} - -/********************************************************************** -| -| handling itemsets -| -\**********************************************************************/ - -const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) -{ - if ( pSet ) - { - DBG_ERRORFILE( "Set bereits vorhanden!" ); - return pSet->GetRanges(); - } - - if ( pRanges ) - return pRanges; - SvUShorts aUS( 16, 16 ); - - size_t nCount = maPageList.size(); - for ( size_t i = 0; i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[ i ]; - if ( pData->fnGetRanges ) - { - const sal_uInt16* pTmpRanges = (pData->fnGetRanges)(); - const sal_uInt16* pIter = pTmpRanges; - - sal_uInt16 nLen; - for( nLen = 0; *pIter; ++nLen, ++pIter ) - ; - aUS.Insert( pTmpRanges, nLen, aUS.Count() ); - } - } - - // remove double Id's -#ifndef TF_POOLABLE - if ( rPool.HasMap() ) -#endif - { - nCount = aUS.Count(); - for ( size_t i = 0; i < nCount; ++i ) - aUS[i] = rPool.GetWhich( aUS[i] ); - } - - // sortieren - if ( aUS.Count() > 1 ) - { -#if defined __SUNPRO_CC -#pragma disable_warn -#endif - qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(sal_uInt16), IconcDlgCmpUS_Impl ); -#if defined __SUNPRO_CC -#pragma enable_warn -#endif - } - - pRanges = new sal_uInt16[aUS.Count() + 1]; - memcpy(pRanges, aUS.GetData(), sizeof(sal_uInt16) * aUS.Count()); - pRanges[aUS.Count()] = 0; - - return pRanges; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet ) -{ - bool bSet = ( pSet != NULL ); - - pSet = pInSet; - - if ( !bSet && !pExampleSet && !pOutSet ) - { - pExampleSet = new SfxItemSet( *pSet ); - pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - } -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& /*rPage*/ ) -{ - // not interested in -} - -// ----------------------------------------------------------------------- - -SfxItemSet* IconChoiceDialog::CreateInputItemSet( sal_uInt16 ) -{ - DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" ); - - return 0; -} - -/********************************************************************** -| -| start dialog -| -\**********************************************************************/ - -short IconChoiceDialog::Execute() -{ - if ( maPageList.empty() ) - return RET_CANCEL; - - Start_Impl(); - - return Dialog::Execute(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::Start( sal_Bool bShow ) -{ - - aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) ); - bModal = sal_False; - - Start_Impl(); - - if ( bShow ) - Window::Show(); - -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoiceDialog::QueryClose() -{ - sal_Bool bRet = sal_True; - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[i ]; - if ( pData->pPage && !pData->pPage->QueryClose() ) - { - bRet = sal_False; - break; - } - } - return bRet; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::Start_Impl() -{ - Point aPos; - sal_uInt16 nActPage; - - if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX ) - nActPage = maPageList.front()->nId; - else - nActPage = mnCurrentPageId; - - // Konfiguration vorhanden? - SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); - - if ( aTabDlgOpt.Exists() ) - { - // ggf. Position aus Konfig - SetWindowState(rtl::OUStringToOString(aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US)); - - // initiale TabPage aus Programm/Hilfe/Konfig - nActPage = (sal_uInt16)aTabDlgOpt.GetPageID(); - - if ( USHRT_MAX != mnCurrentPageId ) - nActPage = mnCurrentPageId; - - if ( GetPageData ( nActPage ) == NULL ) - nActPage = maPageList.front()->nId; - } - else if ( USHRT_MAX != mnCurrentPageId && GetPageData ( mnCurrentPageId ) != NULL ) - nActPage = mnCurrentPageId; - - mnCurrentPageId = nActPage; - - FocusOnIcon( mnCurrentPageId ); - - ActivatePageImpl(); -} - -// ----------------------------------------------------------------------- - -const SfxItemSet* IconChoiceDialog::GetRefreshedSet() -{ - DBG_ERRORFILE( "GetRefreshedSet nicht implementiert" ); - return 0; -} - -/********************************************************************** -| -| tool-methods -| -\**********************************************************************/ - -IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId ) -{ - IconChoicePageData *pRet = NULL; - for ( size_t i=0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - if ( pData->nId == nId ) - { - pRet = pData; - break; - } - } - return pRet; -} - -/********************************************************************** -| -| OK-Status -| -\**********************************************************************/ - -sal_Bool IconChoiceDialog::OK_Impl() -{ - IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage; - - bool bEnd = !pPage; - if ( pPage ) - { - int nRet = IconChoicePage::LEAVE_PAGE; - if ( pSet ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - sal_Bool bRet = sal_False; - - if ( pPage->HasExchangeSupport() ) - nRet = pPage->DeactivatePage( &aTmp ); - - if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE - && aTmp.Count() ) - { - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - else if ( bRet ) - bModified |= sal_True; - } - else - nRet = pPage->DeactivatePage( NULL ); - bEnd = nRet; - } - - return bEnd; -} - -// ----------------------------------------------------------------------- - -short IconChoiceDialog::Ok() -{ - bInOK = sal_True; - - if ( !pOutSet ) - { - if ( !pExampleSet && pSet ) - pOutSet = pSet->Clone( sal_False ); // ohne Items - else if ( pExampleSet ) - pOutSet = new SfxItemSet( *pExampleSet ); - } - sal_Bool _bModified = sal_False; - - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = GetPageData ( i ); - - IconChoicePage* pPage = pData->pPage; - - if ( pPage ) - { - if ( pData->bOnDemand ) - { - SfxItemSet& rSet = (SfxItemSet&)pPage->GetItemSet(); - rSet.ClearItem(); - _bModified |= pPage->FillItemSet( rSet ); - } - else if ( pSet && !pPage->HasExchangeSupport() ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pPage->FillItemSet( aTmp ) ) - { - _bModified |= sal_True; - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - } - } - } - - if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) ) - _bModified |= sal_True; - - return _bModified ? RET_OK : RET_CANCEL; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId ) -{ - // set focus to icon for the current visible page - for ( sal_uInt16 i=0; i<maIconCtrl.GetEntryCount(); i++) - { - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); - - if ( pUserData && *pUserData == nId ) - { - maIconCtrl.SetCursor( pEntry ); - break; - } - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/iconcdlg.src b/cui/source/dialogs/iconcdlg.src deleted file mode 100644 index 6bcca8ba2..000000000 --- a/cui/source/dialogs/iconcdlg.src +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <cuires.hrc> - -String RID_SVXSTR_ICONCHOICEDLG_RESETBUT -{ - Text [ en-US ] = "~Back" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx deleted file mode 100644 index a9eb0dcd4..000000000 --- a/cui/source/dialogs/insdlg.cxx +++ /dev/null @@ -1,1050 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/XFilePicker.hpp> -#include <com/sun/star/ui/dialogs/XFilterManager.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/embed/EmbedStates.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/embed/XInsertObjectDialog.hpp> -#include <com/sun/star/ucb/CommandAbortedException.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> - -#include "insdlg.hxx" -#include <dialmgr.hxx> -#include <svtools/sores.hxx> - -#include <stdio.h> -#include <tools/urlobj.hxx> -#include <tools/debug.hxx> -#include <svl/urihelper.hxx> -#include <svtools/svmedit.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <sot/clsids.hxx> -#include <sfx2/frmdescr.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/filedlghelper.hxx> -#include <svl/ownlist.hxx> -#include <comphelper/seqstream.hxx> - -#include "svuidlg.hrc" - -#include <osl/file.hxx> - -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <unotools/processfactory.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::ui::dialogs; -using ::rtl::OUString; - -#define _SVSTDARR_STRINGSDTOR -#include <svl/svstdarr.hxx> - - -static String impl_getSvtResString( sal_uInt32 nId ) -{ - String aRet; - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); - if( pMgr ) - { - aRet = String( ResId( nId, *pMgr ) ); - delete pMgr; - } - return aRet; -} - -sal_Bool InsertObjectDialog_Impl::IsCreateNew() const -{ - return sal_False; -} - -uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* /*pGraphicMediaType*/ ) -{ - return uno::Reference< io::XInputStream >(); -} - -InsertObjectDialog_Impl::InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) - : ModalDialog( pParent, rResId ) - , m_xStorage( xStorage ) - , aCnt( m_xStorage ) -{ -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvInsertOleDlg, DoubleClickHdl, ListBox *, EMPTYARG ) -{ - EndDialog( RET_OK ); - return 0; -} -IMPL_LINK_INLINE_END( SvInsertOleDlg, DoubleClickHdl, ListBox *, pListBox ) - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvInsertOleDlg, BrowseHdl, PushButton *, EMPTYARG ) -{ - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add filter - try - { - xFilterMgr->appendFilter( - OUString(), - OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) - ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - INetURLObject aObj( aPathSeq[0] ); - aEdFilepath.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvInsertOleDlg, RadioHdl, RadioButton *, EMPTYARG ) -{ - if ( aRbNewObject.IsChecked() ) - { - aLbObjecttype.Show(); - aEdFilepath.Hide(); - aBtnFilepath.Hide(); - aCbFilelink.Hide(); - aGbObject.SetText( _aOldStr ); - } - else - { - aCbFilelink.Show(); - aLbObjecttype.Hide(); - aEdFilepath.Show(); - aBtnFilepath.Show(); - aCbFilelink.Show(); - aGbObject.SetText( aStrFile ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -void SvInsertOleDlg::SelectDefault() -{ - aLbObjecttype.SelectEntryPos( 0 ); -} - -// ----------------------------------------------------------------------- -SvInsertOleDlg::SvInsertOleDlg -( - Window* pParent, - const Reference < embed::XStorage >& xStorage, - const SvObjectServerList* pServers -) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OLEOBJECT ), xStorage ), - aRbNewObject( this, CUI_RES( RB_NEW_OBJECT ) ), - aRbObjectFromfile( this, CUI_RES( RB_OBJECT_FROMFILE ) ), - aGbObject( this, CUI_RES( GB_OBJECT ) ), - aLbObjecttype( this, CUI_RES( LB_OBJECTTYPE ) ), - aEdFilepath( this, CUI_RES( ED_FILEPATH ) ), - aBtnFilepath( this, CUI_RES( BTN_FILEPATH ) ), - aCbFilelink( this, CUI_RES( CB_FILELINK ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aStrFile( CUI_RES( STR_FILE ) ), - m_pServers( pServers ) -{ - FreeResource(); - _aOldStr = aGbObject.GetText(); - aLbObjecttype.SetDoubleClickHdl( LINK( this, SvInsertOleDlg, DoubleClickHdl ) ); - aBtnFilepath.SetClickHdl( LINK( this, SvInsertOleDlg, BrowseHdl ) ); - Link aLink( LINK( this, SvInsertOleDlg, RadioHdl ) ); - aRbNewObject.SetClickHdl( aLink ); - aRbObjectFromfile.SetClickHdl( aLink ); - aRbNewObject.Check( sal_True ); - RadioHdl( NULL ); - aBtnFilepath.SetAccessibleRelationMemberOf(&aGbObject); -} - -short SvInsertOleDlg::Execute() -{ - short nRet = RET_OK; - SvObjectServerList aObjS; - if ( !m_pServers ) - { - // if no list was provided, take the complete one - aObjS.FillInsertObjects(); - m_pServers = &aObjS; - } - - // fill listbox and select default - ListBox& rBox = GetObjectTypes(); - rBox.SetUpdateMode( sal_False ); - for ( sal_uLong i = 0; i < m_pServers->Count(); i++ ) - rBox.InsertEntry( (*m_pServers)[i].GetHumanName() ); - rBox.SetUpdateMode( sal_True ); - SelectDefault(); - ::rtl::OUString aName; - - DBG_ASSERT( m_xStorage.is(), "No storage!"); - if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK ) - { - String aFileName; - sal_Bool bLink = sal_False; - sal_Bool bCreateNew = IsCreateNew(); - if ( bCreateNew ) - { - // create and insert new embedded object - String aServerName = rBox.GetSelectEntry(); - const SvObjectServer* pS = m_pServers->Get( aServerName ); - if ( pS ) - { - if( pS->GetClassName() == SvGlobalName( SO3_OUT_CLASSID ) ) - { - try - { - uno::Reference < embed::XInsertObjectDialog > xDialogCreator( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ), - uno::UNO_QUERY ); - - if ( xDialogCreator.is() ) - { - aName = aCnt.CreateUniqueObjectName(); - embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog( - m_xStorage, - aName, - uno::Sequence < beans::PropertyValue >() ); - - OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" ); - m_xObj = aNewInf.Object; - for ( sal_Int32 nInd = 0; nInd < aNewInf.Options.getLength(); nInd++ ) - if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Icon" ) ) ) ) - { - aNewInf.Options[nInd].Value >>= m_aIconMetaFile; - } - else if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconFormat" ) ) ) ) - { - datatransfer::DataFlavor aFlavor; - if ( aNewInf.Options[nInd].Value >>= aFlavor ) - m_aIconMediaType = aFlavor.MimeType; - } - - } - } - catch( ucb::CommandAbortedException& ) - { - // the user has pressed cancel - } - catch( uno::Exception& ) - { - // TODO: Error handling - } - } - else - { - // create object with desired ClassId - m_xObj = aCnt.CreateEmbeddedObject( pS->GetClassName().GetByteSequence(), aName ); - } - - if ( !m_xObj.is() ) - { - if( aFileName.Len() ) // from OLE Dialog - { - // Objekt konnte nicht aus Datei erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) ); - aErr.SearchAndReplace( String( '%' ), aFileName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - else - { - // Objekt konnte nicht erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE ) ); - aErr.SearchAndReplace( String( '%' ), aServerName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - } - } - else - { - aFileName = GetFilePath(); - INetURLObject aURL; - aURL.SetSmartProtocol( INET_PROT_FILE ); - aURL.SetSmartURL( aFileName ); - aFileName = aURL.GetMainURL( INetURLObject::NO_DECODE ); - bLink = IsLinked(); - - if ( aFileName.Len() ) - { - // create MediaDescriptor for file to create object from - uno::Sequence < beans::PropertyValue > aMedium( 2 ); - aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); - aMedium[0].Value <<= ::rtl::OUString( aFileName ); - - uno::Reference< task::XInteractionHandler > xInteraction; - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - xInteraction = uno::Reference< task::XInteractionHandler >( - xFactory->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - uno::UNO_QUERY_THROW ); - - if ( xInteraction.is() ) - { - aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); - aMedium[1].Value <<= xInteraction; - } - else - { - OSL_FAIL( "Can not get InteractionHandler!\n" ); - aMedium.realloc( 1 ); - } - - // create object from media descriptor - if ( bLink ) - m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName ); - else - m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName ); - } - - if ( !m_xObj.is() ) - { - // Objekt konnte nicht aus Datei erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) ); - aErr.SearchAndReplace( String( '%' ), aFileName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - } - - m_pServers = 0; - return nRet; -} - -uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ) -{ - if ( m_aIconMetaFile.getLength() ) - { - if ( pGraphicMediaType ) - *pGraphicMediaType = m_aIconMediaType; - - return uno::Reference< io::XInputStream >( new ::comphelper::SequenceInputStream( m_aIconMetaFile ) ); - } - - return uno::Reference< io::XInputStream >(); -} - -IMPL_LINK( SvInsertPlugInDialog, BrowseHdl, PushButton *, EMPTYARG ) -{ - Sequence< OUString > aFilterNames, aFilterTypes; - void fillNetscapePluginFilters( Sequence< OUString >& rNames, Sequence< OUString >& rTypes ); - fillNetscapePluginFilters( aFilterNames, aFilterTypes ); - - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add the filters - try - { - const OUString* pNames = aFilterNames.getConstArray(); - const OUString* pTypes = aFilterTypes.getConstArray(); - for( int i = 0; i < aFilterNames.getLength(); i++ ) - xFilterMgr->appendFilter( pNames[i], pTypes[i] ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - INetURLObject aObj( aPathSeq[0] ); - aEdFileurl.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -SvInsertPlugInDialog::SvInsertPlugInDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_PLUGIN ), xStorage ), - aGbFileurl( this, CUI_RES( GB_FILEURL ) ), - aEdFileurl( this, CUI_RES( ED_FILEURL ) ), - aBtnFileurl( this, CUI_RES( BTN_FILEURL ) ), - aGbPluginsOptions( this, CUI_RES( GB_PLUGINS_OPTIONS ) ), - aEdPluginsOptions( this, CUI_RES( ED_PLUGINS_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - FreeResource(); - aBtnFileurl.SetClickHdl( LINK( this, SvInsertPlugInDialog, BrowseHdl ) ); -} - -SvInsertPlugInDialog::~SvInsertPlugInDialog() -{ - delete m_pURL; -} - -// ----------------------------------------------------------------------- - -static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence ) -{ - sal_uInt16 nEaten; - SvCommandList aLst; - aLst.AppendCommands( aCommands, &nEaten ); - - const size_t nCount = aLst.size(); - aCommandSequence.realloc( nCount ); - for( size_t nIndex = 0; nIndex < nCount; nIndex++ ) - { - aCommandSequence[nIndex].Name = aLst[ nIndex ].GetCommand(); - aCommandSequence[nIndex].Handle = -1; - aCommandSequence[nIndex].Value = makeAny( OUString( aLst[ nIndex ].GetArgument() ) ); - aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; - } -} - -short SvInsertPlugInDialog::Execute() -{ - short nRet = RET_OK; - m_aCommands.Erase(); - DBG_ASSERT( m_xStorage.is(), "No storage!"); - if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK ) - { - if ( !m_pURL ) - m_pURL = new INetURLObject(); - else - *m_pURL = INetURLObject(); - - m_aCommands = GetPlugInOptions(); - String aURL = GetPlugInFile(); - - // URL can be a valid and absolute URL or a system file name - m_pURL->SetSmartProtocol( INET_PROT_FILE ); - if ( !aURL.Len() || m_pURL->SetSmartURL( aURL ) ) - { - // create a plugin object - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_PLUGIN_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - } - - if ( m_xObj.is() ) - { - // set properties from dialog - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - uno::Reference < beans::XPropertySet > xSet( m_xObj->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginURL") ), - makeAny( ::rtl::OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - uno::Sequence< beans::PropertyValue > aCommandSequence; - Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginCommands") ), makeAny( aCommandSequence ) ); - } - } - else - { - // PlugIn konnte nicht erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN ) ); - aErr.SearchAndReplace( String( '%' ), aURL ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - - return nRet; -} - -// class SvInsertAppletDlg ----------------------------------------------- - -IMPL_LINK( SvInsertAppletDialog, BrowseHdl, PushButton *, EMPTYARG ) -{ - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add filter - try - { - xFilterMgr->appendFilter( - OUString( RTL_CONSTASCII_USTRINGPARAM( "Applet" ) ), - OUString( RTL_CONSTASCII_USTRINGPARAM( "*.class" ) ) - ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - - INetURLObject aObj( aPathSeq[0] ); - aEdClassfile.SetText( aObj.getName() ); - aObj.removeSegment(); - aEdClasslocation.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), xStorage ), - aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ), - aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ), - aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ), - aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ), - aBtnClass( this, CUI_RES( BTN_CLASS ) ), - aGbClass( this, CUI_RES( GB_CLASS ) ), - aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ), - aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - FreeResource(); - aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) ); -} - -SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XEmbeddedObject >& xObj ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), uno::Reference < embed::XStorage >() ), - aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ), - aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ), - aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ), - aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ), - aBtnClass( this, CUI_RES( BTN_CLASS ) ), - aGbClass( this, CUI_RES( GB_CLASS ) ), - aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ), - aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - m_xObj = xObj; - FreeResource(); - aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) ); -} - - -SvInsertAppletDialog::~SvInsertAppletDialog() -{ - delete m_pURL; -} - -short SvInsertAppletDialog::Execute() -{ - short nRet = RET_OK; - m_aClass.Erase(); - m_aCommands.Erase(); - - sal_Bool bOK = sal_False; - uno::Reference < beans::XPropertySet > xSet; - if ( m_xObj.is() ) - { - try - { - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - ::rtl::OUString aStr; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCode") ) ); - if ( aAny >>= aStr ) - SetClass( aStr ); - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCodeBase") ) ); - if ( aAny >>= aStr ) - SetClassLocation( aStr ); - uno::Sequence< beans::PropertyValue > aCommands; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCommands") ) ); - if ( aAny >>= aCommands ) - { - SvCommandList aList; - aList.FillFromSequence( aCommands ); - SetAppletOptions( aList.GetCommands() ); - } - - String aText( CUI_RES( STR_EDIT_APPLET ) ); - SetText( aText ); - bOK = sal_True; - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No Applet!" ); - } - } - else - { - DBG_ASSERT( m_xStorage.is(), "No storage!"); - bOK = m_xStorage.is(); - } - - if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK ) - { - if ( !m_xObj.is() ) - { - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_APPLET_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - } - - if ( m_xObj.is() ) - { - try - { - sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE; - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - String aClassLocation = GetClassLocation(); - - // Hack, aFileName wird auch fuer Class benutzt - m_aClass = GetClass(); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCode") ), makeAny( ::rtl::OUString( m_aClass ) ) ); - - ::rtl::OUString tmp = aClassLocation; - ::osl::File::getFileURLFromSystemPath(tmp, tmp); - aClassLocation = tmp; - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCodeBase") ), makeAny( tmp ) ); - m_aCommands = GetAppletOptions(); - - uno::Sequence< beans::PropertyValue > aCommandSequence; - Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCommands") ), makeAny( aCommandSequence ) ); - - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE ); - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No Applet!" ); - } - } - } - - return nRet; -} - -SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), xStorage ) - , aFTName ( this, CUI_RES( FT_FRAMENAME ) ) - , aEDName ( this, CUI_RES( ED_FRAMENAME ) ) - , aFTURL ( this, CUI_RES( FT_URL ) ) - , aEDURL ( this, CUI_RES( ED_URL ) ) - , aBTOpen ( this, CUI_RES(BT_FILEOPEN ) ) - - , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) ) - , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) ) - , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) ) - , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) ) - , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) ) - , aFLFrameBorder( this, CUI_RES( GB_BORDER ) ) - , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) ) - , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) ) - , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) ) - , aFLMargin( this, CUI_RES( GB_MARGIN ) ) - , aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) ) - , aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) ) - , aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) ) - , aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) ) - , aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aOKButton1( this, CUI_RES( 1 ) ) - , aCancelButton1( this, CUI_RES( 1 ) ) - , aHelpButton1( this, CUI_RES( 1 ) ) -{ - FreeResource(); - - aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT); - aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT); - - Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) ); - aCBMarginWidthDefault.SetClickHdl( aLink ); - aCBMarginHeightDefault.SetClickHdl( aLink ); - - aCBMarginWidthDefault.Check(); - aCBMarginHeightDefault.Check(); - aRBScrollingAuto.Check(); - aRBFrameBorderOn.Check(); - - aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) ); -} - -SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, const uno::Reference < embed::XEmbeddedObject >& xObj ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), uno::Reference < embed::XStorage >() ) - , aFTName ( this, CUI_RES( FT_FRAMENAME ) ) - , aEDName ( this, CUI_RES( ED_FRAMENAME ) ) - , aFTURL ( this, CUI_RES( FT_URL ) ) - , aEDURL ( this, CUI_RES( ED_URL ) ) - , aBTOpen ( this, CUI_RES(BT_FILEOPEN ) ) - - , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) ) - , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) ) - , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) ) - , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) ) - - , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) ) - , aFLFrameBorder( this, CUI_RES( GB_BORDER ) ) - , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) ) - , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) ) - - , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) ) - , aFLMargin( this, CUI_RES( GB_MARGIN ) ) - , aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) ) - , aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) ) - , aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) ) - , aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) ) - , aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aOKButton1( this, CUI_RES( 1 ) ) - , aCancelButton1( this, CUI_RES( 1 ) ) - , aHelpButton1( this, CUI_RES( 1 ) ) -{ - FreeResource(); - - m_xObj = xObj; - - aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT); - aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT); - - Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) ); - aCBMarginWidthDefault.SetClickHdl( aLink ); - aCBMarginHeightDefault.SetClickHdl( aLink ); - - aCBMarginWidthDefault.Check(); - aCBMarginHeightDefault.Check(); - aRBScrollingAuto.Check(); - aRBFrameBorderOn.Check(); - - aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) ); -} - -short SfxInsertFloatingFrameDialog::Execute() -{ - short nRet = RET_OK; - sal_Bool bOK = sal_False; - uno::Reference < beans::XPropertySet > xSet; - if ( m_xObj.is() ) - { - try - { - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - ::rtl::OUString aStr; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL") ) ); - if ( aAny >>= aStr ) - aEDURL.SetText( aStr ); - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName") ) ); - if ( aAny >>= aStr ) - aEDName.SetText( aStr ); - - sal_Int32 nSize = SIZE_NOT_SET; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth") ) ); - aAny >>= nSize; - - if ( nSize == SIZE_NOT_SET ) - { - aCBMarginWidthDefault.Check( sal_True ); - aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) ); - aFTMarginWidth.Enable( sal_False ); - aNMMarginWidth.Enable( sal_False ); - } - else - aNMMarginWidth.SetText( String::CreateFromInt32( nSize ) ); - - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight") ) ); - aAny >>= nSize; - - if ( nSize == SIZE_NOT_SET ) - { - aCBMarginHeightDefault.Check( sal_True ); - aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) ); - aFTMarginHeight.Enable( sal_False ); - aNMMarginHeight.Enable( sal_False ); - } - else - aNMMarginHeight.SetText( String::CreateFromInt32( nSize ) ); - - sal_Bool bScrollOn = sal_False; - sal_Bool bScrollOff = sal_False; - sal_Bool bScrollAuto = sal_False; - - sal_Bool bSet = sal_False; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll") ) ); - aAny >>= bSet; - if ( !bSet ) - { - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode") ) ); - aAny >>= bSet; - bScrollOn = bSet; - bScrollOff = !bSet; - } - else - bScrollAuto = sal_True; - - aRBScrollingOn.Check( bScrollOn ); - aRBScrollingOff.Check( bScrollOff ); - aRBScrollingAuto.Check( bScrollAuto ); - - bSet = sal_False; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoBorder") ) ); - aAny >>= bSet; - if ( !bSet ) - { - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder") ) ); - aAny >>= bSet; - aRBFrameBorderOn.Check( bSet ); - aRBFrameBorderOff.Check( !bSet ); - } - - SetUpdateMode( sal_True ); - bOK = sal_True; - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No IFrame!" ); - } - } - else - { - DBG_ASSERT( m_xStorage.is(), "No storage!"); - bOK = m_xStorage.is(); - } - - if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK ) - { - ::rtl::OUString aURL; - if ( aEDURL.GetText().Len() ) - { - // URL can be a valid and absolute URL or a system file name - INetURLObject aObj; - aObj.SetSmartProtocol( INET_PROT_FILE ); - if ( aObj.SetSmartURL( aEDURL.GetText() ) ) - aURL = aObj.GetMainURL( INetURLObject::NO_DECODE ); - } - - if ( !m_xObj.is() && aURL.getLength() ) - { - // create the object - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_IFRAME_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - } - - if ( m_xObj.is() ) - { - try - { - sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE; - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - ::rtl::OUString aName = aEDName.GetText(); - ScrollingMode eScroll = ScrollingNo; - if ( aRBScrollingOn.IsChecked() ) - eScroll = ScrollingYes; - if ( aRBScrollingOff.IsChecked() ) - eScroll = ScrollingNo; - if ( aRBScrollingAuto.IsChecked() ) - eScroll = ScrollingAuto; - - sal_Bool bHasBorder = aRBFrameBorderOn.IsChecked(); - - long lMarginWidth; - if ( !aCBMarginWidthDefault.IsChecked() ) - lMarginWidth = (long) aNMMarginWidth.GetText().ToInt32(); - else - lMarginWidth = SIZE_NOT_SET; - - long lMarginHeight; - if ( !aCBMarginHeightDefault.IsChecked() ) - lMarginHeight = (long) aNMMarginHeight.GetText().ToInt32(); - else - lMarginHeight = SIZE_NOT_SET; - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL") ), makeAny( aURL ) ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName") ), makeAny( aName ) ); - - if ( eScroll == ScrollingAuto ) - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll") ), - makeAny( sal_True ) ); - else - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode") ), - makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder") ), - makeAny( bHasBorder ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth") ), - makeAny( sal_Int32( lMarginWidth ) ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight") ), - makeAny( sal_Int32( lMarginHeight ) ) ); - - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE ); - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No IFrame!" ); - } - } - } - - return nRet; -} - -//------------------------------------------------------------------------------ - -IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox*, pCB ) -{ - if ( pCB == &pThis->aCBMarginWidthDefault ) - { - if ( pCB->IsChecked() ) - pThis->aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) ); - pThis->aFTMarginWidth.Enable( !pCB->IsChecked() ); - pThis->aNMMarginWidth.Enable( !pCB->IsChecked() ); - } - - if ( pCB == &pThis->aCBMarginHeightDefault ) - { - if ( pCB->IsChecked() ) - pThis->aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) ); - pThis->aFTMarginHeight.Enable( !pCB->IsChecked() ); - pThis->aNMMarginHeight.Enable( !pCB->IsChecked() ); - } - - return 0L; -} - -//------------------------------------------------------------------------------ - -IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton*, EMPTYARG ) -{ - Window* pOldParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pThis ); - - // create the file dialog - sfx2::FileDialogHelper aFileDlg( WB_OPEN | SFXWB_PASSWORD, String() ); - - // set the title - aFileDlg.SetTitle( OUString( String( CUI_RES( MD_INSERT_OBJECT_IFRAME ) ) ) ); - - // show the dialog - if ( aFileDlg.Execute() == ERRCODE_NONE ) - pThis->aEDURL.SetText( - INetURLObject( aFileDlg.GetPath() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); - - Application::SetDefDialogParent( pOldParent ); - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx deleted file mode 100644 index d514ef431..000000000 --- a/cui/source/dialogs/insrc.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <dialmgr.hxx> -#include <svx/svxdlg.hxx> -#include <cuires.hrc> -#include "insrc.hxx" -#include "insrc.hrc" - -bool SvxInsRowColDlg::isInsertBefore() const -{ - return !aAfterBtn.IsChecked(); -} - -sal_uInt16 SvxInsRowColDlg::getInsertCount() const -{ - return static_cast< sal_uInt16 >( aCountEdit.GetValue() ); -} - -SvxInsRowColDlg::SvxInsRowColDlg(Window* pParent, bool bCol, const rtl::OString& sHelpId ) - : ModalDialog( pParent, CUI_RES(DLG_INS_ROW_COL) ), - aCount( this, CUI_RES( FT_COUNT ) ), - aCountEdit( this, CUI_RES( ED_COUNT ) ), - aInsFL( this, CUI_RES( FL_INS ) ), - aBeforeBtn( this, CUI_RES( CB_POS_BEFORE ) ), - aAfterBtn( this, CUI_RES( CB_POS_AFTER ) ), - aPosFL( this, CUI_RES( FL_POS ) ), - aRow(CUI_RES(STR_ROW)), - aCol(CUI_RES(STR_COL)), - aOKBtn( this, CUI_RES( BT_OK ) ), - aCancelBtn( this, CUI_RES( BT_CANCEL ) ), - aHelpBtn( this, CUI_RES( BT_HELP ) ), - bColumn( bCol ) -{ - FreeResource(); - String aTmp( GetText() ); - if( bColumn ) - { - aTmp += aCol; - } - else - { - aTmp += aRow; - } - SetText( aTmp ); - SetHelpId( sHelpId ); -} - -short SvxInsRowColDlg::Execute(void) -{ - return ModalDialog::Execute(); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/insrc.hrc b/cui/source/dialogs/insrc.hrc deleted file mode 100644 index 0c780df36..000000000 --- a/cui/source/dialogs/insrc.hrc +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FT_COUNT 1 -#define ED_COUNT 2 -#define FL_INS 3 - -#define CB_POS_BEFORE 10 -#define CB_POS_AFTER 11 -#define FL_POS 12 - -#define STR_ROW 20 -#define STR_COL 21 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 diff --git a/cui/source/dialogs/insrc.src b/cui/source/dialogs/insrc.src deleted file mode 100644 index 4ba5ebf1e..000000000 --- a/cui/source/dialogs/insrc.src +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <cuires.hrc> -#include "insrc.hrc" - -ModalDialog DLG_INS_ROW_COL -{ - HelpID = "cui:ModalDialog:DLG_INS_ROW_COL"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 136 , 84 ) ; - Text [ en-US ] = "Insert" ; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 80 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 80 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 80 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - RadioButton CB_POS_BEFORE - { - HelpID = "cui:RadioButton:DLG_INS_ROW_COL:CB_POS_BEFORE"; - Pos = MAP_APPFONT ( 12 , 49 ) ; - Size = MAP_APPFONT ( 56 , 10 ) ; - Text [ en-US ] = "~Before" ; - TabStop = TRUE ; - }; - RadioButton CB_POS_AFTER - { - HelpID = "cui:RadioButton:DLG_INS_ROW_COL:CB_POS_AFTER"; - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 56 , 10 ) ; - Text [ en-US ] = "A~fter" ; - TabStop = TRUE ; - Check = TRUE ; - }; - NumericField ED_COUNT - { - HelpID = "cui:NumericField:DLG_INS_ROW_COL:ED_COUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 44 , 14 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Value = 1 ; - First = 1 ; - Last = 5 ; - }; - FixedLine FL_INS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 68 , 8 ) ; - Text [ en-US ] = "Insert" ; - }; - FixedLine FL_POS - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 68 , 8 ) ; - Text [ en-US ] = "Position"; - }; - FixedText FT_COUNT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "~Number" ; - Left = TRUE ; - }; - String STR_ROW - { - Text [ en-US ] = " Rows" ; - }; - String STR_COL - { - Text [ en-US ] = " Columns" ; - }; -}; diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx deleted file mode 100644 index 22bd58b02..000000000 --- a/cui/source/dialogs/linkdlg.cxx +++ /dev/null @@ -1,702 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <linkdlg.hxx> -#include <vcl/svapp.hxx> -#include "helpid.hrc" - -#include <tools/urlobj.hxx> -#include <svtools/svmedit.hxx> -#include <svtools/filedlg.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/timer.hxx> -#include <svtools/svtabbx.hxx> - -#include <svuidlg.hrc> -#include <sfx2/linkmgr.hxx> -#include <sfx2/linksrc.hxx> -#include <svtools/soerr.hxx> -#include <sfx2/lnkbase.hxx> -#include <sfx2/objsh.hxx> - -#include <dialmgr.hxx> - -#define _SVSTDARR_USHORTS -#include <svl/svstdarr.hxx> - -#define MAX_FILENAME 18 -#define MAX_LINKNAME 18 -#define MAX_TYPENAME 15 -#define MAX_UPDATENAME 10 - -#define FILEOBJECT ( OBJECT_CLIENT_FILE & ~OBJECT_CLIENT_SO ) - -using namespace sfx2; - -SV_DECL_IMPL_REF_LIST(SvBaseLink,SvBaseLink*) - -// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert -static long nTabs[] = - { 4, // Number of Tabs - 0, 77, 144, 209 - }; - - -SvBaseLinksDlg::SvBaseLinksDlg( Window * pParent, LinkManager* pMgr, sal_Bool bHtml ) - : ModalDialog( pParent, CUI_RES( MD_UPDATE_BASELINKS ) ), - aFtFiles( this, CUI_RES( FT_FILES ) ), - aFtLinks( this, CUI_RES( FT_LINKS ) ), - aFtType( this, CUI_RES( FT_TYPE ) ), - aFtStatus( this, CUI_RES( FT_STATUS ) ), - aTbLinks( this, CUI_RES(TB_LINKS ) ), - aFtFiles2( this, CUI_RES( FT_FILES2 ) ), - aFtFullFileName( this, CUI_RES( FT_FULL_FILE_NAME ) ), - aFtSource2( this, CUI_RES( FT_SOURCE2 ) ), - aFtFullSourceName( this, CUI_RES( FT_FULL_SOURCE_NAME ) ), - aFtType2( this, CUI_RES( FT_TYPE2 ) ), - aFtFullTypeName( this, CUI_RES( FT_FULL_TYPE_NAME ) ), - aFtUpdate( this, CUI_RES( FT_UPDATE ) ), - aRbAutomatic( this, CUI_RES( RB_AUTOMATIC ) ), - aRbManual( this, CUI_RES( RB_MANUAL ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aPbUpdateNow( this, CUI_RES( PB_UPDATE_NOW ) ), - aPbOpenSource( this, CUI_RES( PB_OPEN_SOURCE ) ), - aPbChangeSource( this, CUI_RES( PB_CHANGE_SOURCE ) ), - aPbBreakLink( this, CUI_RES( PB_BREAK_LINK ) ), - aStrAutolink( CUI_RES( STR_AUTOLINK ) ), - aStrManuallink( CUI_RES( STR_MANUALLINK ) ), - aStrBrokenlink( CUI_RES( STR_BROKENLINK ) ), - aStrGraphiclink( CUI_RES( STR_GRAPHICLINK ) ), - aStrButtonclose( CUI_RES( STR_BUTTONCLOSE ) ), - aStrCloselinkmsg( CUI_RES( STR_CLOSELINKMSG ) ), - aStrCloselinkmsgMulti( CUI_RES( STR_CLOSELINKMSG_MULTI ) ), - aStrWaitinglink( CUI_RES( STR_WAITINGLINK ) ), - pLinkMgr( NULL ), - bHtmlMode(bHtml) -{ - FreeResource(); - - aTbLinks.SetHelpId(HID_LINKDLG_TABLB); - aTbLinks.SetSelectionMode( MULTIPLE_SELECTION ); - aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT ); - aTbLinks.Resize(); // OS: Hack fuer richtige Selektion - - // UpdateTimer fuer DDE-/Grf-Links, auf die gewarted wird - aUpdateTimer.SetTimeoutHdl( LINK( this, SvBaseLinksDlg, UpdateWaitingHdl ) ); - aUpdateTimer.SetTimeout( 1000 ); - //IAccessibility2 Implementation 2009----- - // Set the ZOrder, and accessible name to the dialog's title - aTbLinks.SetZOrder(0, WINDOW_ZORDER_FIRST); - aTbLinks.SetAccessibleName(this->GetText()); - aTbLinks.SetAccessibleRelationLabeledBy(&aFtFiles); - //-----IAccessibility2 Implementation 2009 - - OpenSource().Hide(); - - Links().SetSelectHdl( LINK( this, SvBaseLinksDlg, LinksSelectHdl ) ); - Links().SetDoubleClickHdl( LINK( this, SvBaseLinksDlg, LinksDoubleClickHdl ) ); - Automatic().SetClickHdl( LINK( this, SvBaseLinksDlg, AutomaticClickHdl ) ); - Manual().SetClickHdl( LINK( this, SvBaseLinksDlg, ManualClickHdl ) ); - UpdateNow().SetClickHdl( LINK( this, SvBaseLinksDlg, UpdateNowClickHdl ) ); - ChangeSource().SetClickHdl( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) ); - if(!bHtmlMode) - BreakLink().SetClickHdl( LINK( this, SvBaseLinksDlg, BreakLinkClickHdl ) ); - else - BreakLink().Hide(); - - SetManager( pMgr ); -} - -SvBaseLinksDlg::~SvBaseLinksDlg() -{ -} - -/************************************************************************* -|* SvBaseLinksDlg::Handler() -*************************************************************************/ -IMPL_LINK( SvBaseLinksDlg, LinksSelectHdl, SvTabListBox *, pSvTabListBox ) -{ - sal_uInt16 nSelectionCount = pSvTabListBox ? - (sal_uInt16)pSvTabListBox->GetSelectionCount() : 0; - if(nSelectionCount > 1) - { - //bei Mehrfachselektion ggf. alte Eintraege deselektieren - SvLBoxEntry* pEntry = 0; - SvBaseLink* pLink = 0; - pEntry = pSvTabListBox->GetHdlEntry(); - pLink = (SvBaseLink*)pEntry->GetUserData(); - sal_uInt16 nObjectType = pLink->GetObjType(); - if((OBJECT_CLIENT_FILE & nObjectType) != OBJECT_CLIENT_FILE) - { - pSvTabListBox->SelectAll(sal_False); - pSvTabListBox->Select(pEntry); - nSelectionCount = 1; - } - else - { - for( sal_uInt16 i = 0; i < nSelectionCount; i++) - { - pEntry = i == 0 ? pSvTabListBox->FirstSelected() : - pSvTabListBox->NextSelected(pEntry); - DBG_ASSERT(pEntry, "Wo ist der Entry?"); - pLink = (SvBaseLink*)pEntry->GetUserData(); - DBG_ASSERT(pLink, "Wo ist der Link?"); - if( (OBJECT_CLIENT_FILE & pLink->GetObjType()) != OBJECT_CLIENT_FILE ) - pSvTabListBox->Select( pEntry, sal_False ); - - } - } - - UpdateNow().Enable(); - - Automatic().Disable(); - Manual().Check(); - Manual().Disable(); - } - else - { - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( !pLink ) - return 0; - - UpdateNow().Enable(); - - String sType, sLink; - String *pLinkNm = &sLink, *pFilter = 0; - - if( FILEOBJECT & pLink->GetObjType() ) - { - Automatic().Disable(); - Manual().Check(); - Manual().Disable(); - if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) - pLinkNm = 0, pFilter = &sLink; - } - else - { - Automatic().Enable(); - Manual().Enable(); - - if( LINKUPDATE_ALWAYS == pLink->GetUpdateMode() ) - Automatic().Check(); - else - Manual().Check(); - } - - String aFileName; - pLinkMgr->GetDisplayNames( pLink, &sType, &aFileName, pLinkNm, pFilter ); - aFileName = INetURLObject::decode(aFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); - FileName().SetText( aFileName ); - SourceName().SetText( sLink ); - TypeName().SetText( sType ); - } - return 0; -} - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox ) -{ - (void)pSvTabListBox; - - ChangeSourceClickHdl( 0 ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox ) - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton ) -{ - (void)pRadioButton; - - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && - LINKUPDATE_ALWAYS != pLink->GetUpdateMode() ) - SetType( *pLink, nPos, LINKUPDATE_ALWAYS ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton ) - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton ) -{ - (void)pRadioButton; - - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && - LINKUPDATE_ONCALL != pLink->GetUpdateMode()) - SetType( *pLink, nPos, LINKUPDATE_ONCALL ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton ) - -IMPL_LINK( SvBaseLinksDlg, UpdateNowClickHdl, PushButton *, EMPTYARG ) -{ - SvTabListBox& rListBox = Links(); - sal_uInt16 nSelCnt = (sal_uInt16)rListBox.GetSelectionCount(); - if( 255 < nSelCnt ) - nSelCnt = 255; - - std::vector< SvBaseLink* > aLnkArr; - std::vector< sal_uInt16 > aPosArr; - - SvLBoxEntry* pE = rListBox.FirstSelected(); - while( pE ) - { - sal_uInt16 nFndPos = (sal_uInt16)rListBox.GetModel()->GetAbsPos( pE ); - if( LISTBOX_ENTRY_NOTFOUND != nFndPos ) - { - aLnkArr.push_back( static_cast< SvBaseLink* >( pE->GetUserData() ) ); - aPosArr.push_back( nFndPos ); - } - pE = rListBox.NextSelected( pE ); - } - - if( !aLnkArr.empty() ) - { - for( sal_uInt16 n = 0; n < aLnkArr.size(); ++n ) - { - SvBaseLinkRef xLink = aLnkArr[ n ]; - - // suche erstmal im Array nach dem Eintrag - for( sal_uInt16 i = 0; i < pLinkMgr->GetLinks().Count(); ++i ) - if( &xLink == *pLinkMgr->GetLinks()[ i ] ) - { - xLink->SetUseCache( sal_False ); - SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() ); - xLink->SetUseCache( sal_True ); - break; - } - } - - // falls jemand der Meinung ist, seine Links auszutauschen (SD) - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - - - if( 0 == (pE = rListBox.GetEntry( aPosArr[ 0 ] )) || - pE->GetUserData() != aLnkArr[ 0 ] ) - { - // suche mal den Link - pE = rListBox.First(); - while( pE ) - { - if( pE->GetUserData() == aLnkArr[ 0 ] ) - break; - pE = rListBox.Next( pE ); - } - - if( !pE ) - pE = rListBox.FirstSelected(); - } - - if( pE ) - { - SvLBoxEntry* pSelEntry = rListBox.FirstSelected(); - if( pE != pSelEntry ) - rListBox.Select( pSelEntry, sal_False ); - rListBox.Select( pE ); - rListBox.MakeVisible( pE ); - } - - pNewMgr->CloseCachedComps(); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, ChangeSourceClickHdl, PushButton *, pPushButton ) -{ - (void)pPushButton; - - sal_uInt16 nSelectionCount = (sal_uInt16)Links().GetSelectionCount(); - if(nSelectionCount > 1) - { - PathDialog aPathDlg( this ); - String sType, sFile, sLinkName; - String sFilter; - SvLBoxEntry* pEntry = Links().FirstSelected(); - SvBaseLink* pLink = (SvBaseLink*)pEntry->GetUserData(); - pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, 0, 0 ); - INetURLObject aUrl(sFile); - if(aUrl.GetProtocol() == INET_PROT_FILE) - { - rtl::OUString sOldPath(aUrl.PathToFileName()); - sal_Int32 nLen = aUrl.GetName().getLength(); - sOldPath = sOldPath.copy(0, sOldPath.getLength() - nLen); - aPathDlg.SetPath(sOldPath); - } - if(aPathDlg.Execute() == RET_OK) - { - String aPath = aPathDlg.GetPath(); - - for( sal_uInt16 i = 0; i < nSelectionCount; i++) - { - pEntry = i==0 ? - Links().FirstSelected() : - Links().NextSelected( pEntry ); - DBG_ASSERT(pEntry,"Wo ist der Entry"); - pLink = (SvBaseLink*)pEntry->GetUserData(); - DBG_ASSERT(pLink,"Wo ist der Link"); - pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, &sLinkName, &sFilter ); - INetURLObject aUrl_(sFile); - INetURLObject aUrl2(aPath, INET_PROT_FILE); - aUrl2.insertName( aUrl_.getName() ); - String sNewLinkName; - MakeLnkName( sNewLinkName, 0 , - aUrl2.GetMainURL(INetURLObject::DECODE_TO_IURI), sLinkName, &sFilter); - pLink->SetLinkSourceName( sNewLinkName ); - pLink->Update(); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - } - } - else - { - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if ( pLink && (pLink->GetLinkSourceName().Len() != 0) ) - pLink->Edit( this, LINK( this, SvBaseLinksDlg, EndEditHdl ) ); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton ) -{ - (void)pPushButton; - - sal_Bool bModified = sal_False; - if(Links().GetSelectionCount() <= 1) - { - sal_uInt16 nPos; - SvBaseLinkRef xLink = GetSelEntry( &nPos ); - if( !xLink.Is() ) - return 0; - - QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() ); - - if( RET_YES == aBox.Execute() ) - { - Links().GetModel()->Remove( Links().GetEntry( nPos ) ); - - // falls Object noch vorhanden, dann das schliessen - sal_Bool bNewLnkMgr = OBJECT_CLIENT_FILE == xLink->GetObjType(); - - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); - - // falls einer vergessen hat sich auszutragen - if( xLink.Is() ) - pLinkMgr->Remove( &xLink ); - - if( bNewLnkMgr ) - { - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - - SvLBoxEntry* pEntry = Links().GetEntry( nPos ? --nPos : 0 ); - if( pEntry ) - Links().SetCurEntry( pEntry ); - } - bModified = sal_True; - } - } - else - { - QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() ); - - if( RET_YES == aBox.Execute() ) - { - - SvBaseLinkMemberList aLinkList; - SvLBoxEntry* pEntry = Links().FirstSelected(); - while ( pEntry ) - { - void * pUD = pEntry->GetUserData(); - if( pUD ) - aLinkList.Append( (SvBaseLink*)pUD ); - pEntry = Links().NextSelected(pEntry); - } - Links().RemoveSelection(); - for( sal_uLong i = 0; i < aLinkList.Count(); i++ ) - { - SvBaseLinkRef xLink = aLinkList.GetObject( i ); - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); - - // falls einer vergessen hat sich auszutragen - pLinkMgr->Remove( &xLink ); - bModified = sal_True; - } - //Danach alle selektierten Eintraege entfernen - } - } - if(bModified) - { - if( !Links().GetEntryCount() ) - { - // Der letzte macht das Licht aus - Automatic().Disable(); - Manual().Disable(); - UpdateNow().Disable(); - ChangeSource().Disable(); - BreakLink().Disable(); - - String aEmpty; - SourceName().SetText( aEmpty ); - TypeName().SetText( aEmpty ); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, pTimer ) -{ - (void)pTimer; - - Links().SetUpdateMode(sal_False); - for( sal_uLong nPos = Links().GetEntryCount(); nPos; ) - { - SvLBoxEntry* pBox = Links().GetEntry( --nPos ); - SvBaseLinkRef xLink( (SvBaseLink*)pBox->GetUserData() ); - if( xLink.Is() ) - { - String sCur( ImplGetStateStr( *xLink ) ), - sOld( Links().GetEntryText( pBox, 3 ) ); - if( sCur != sOld ) - Links().SetEntryText( sCur, pBox, 3 ); - } - } - Links().SetUpdateMode(sal_True); - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink*, _pLink ) -{ - sal_uInt16 nPos; - GetSelEntry( &nPos ); - - if( _pLink && _pLink->WasLastEditOK() ) - { - // StarImpress/Draw tauschen die LinkObjecte selbst aus! - // also suche den Link im Manager, wenn der nicht mehr existiert, - // dann setze fuelle die Liste komplett neu. Ansonsten braucht - // nur der editierte Linkt aktualisiert werden. - sal_Bool bLinkFnd = sal_False; - for( sal_uInt16 n = pLinkMgr->GetLinks().Count(); n; ) - if( _pLink == &(*pLinkMgr->GetLinks()[ --n ]) ) - { - bLinkFnd = sal_True; - break; - } - - if( bLinkFnd ) - { - Links().SetUpdateMode(sal_False); - Links().GetModel()->Remove( Links().GetEntry( nPos ) ); - SvLBoxEntry* pToUnselect = Links().FirstSelected(); - InsertEntry( *_pLink, nPos, sal_True ); - if(pToUnselect) - Links().Select(pToUnselect, sal_False); - Links().SetUpdateMode(sal_True); - } - else - { - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - } - return 0; -} - -String SvBaseLinksDlg::ImplGetStateStr( const SvBaseLink& rLnk ) -{ - String sRet; - if( !rLnk.GetObj() ) - sRet = Brokenlink(); - else if( rLnk.GetObj()->IsPending() ) - { - sRet = Waitinglink(); - StartUpdateTimer(); - } - else if( LINKUPDATE_ALWAYS == rLnk.GetUpdateMode() ) - sRet = Autolink(); - else - sRet = Manuallink(); - - return sRet; -} - -void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr ) -{ - if( pLinkMgr == pNewMgr ) - return; - - if( pNewMgr ) - // Update muss vor Clear gestoppt werden - Links().SetUpdateMode( sal_False ); - - Links().Clear(); - pLinkMgr = pNewMgr; - - if( pLinkMgr ) - { - SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks(); - for( sal_uInt16 n = 0; n < rLnks.Count(); ++n ) - { - SvBaseLinkRef* pLinkRef = rLnks[ n ]; - if( !pLinkRef->Is() ) - { - rLnks.Remove( n, 1 ); - --n; - continue; - } - if( (*pLinkRef)->IsVisible() ) - InsertEntry( **pLinkRef ); - } - - if( rLnks.Count() ) - { - SvLBoxEntry* pEntry = Links().GetEntry( 0 ); - Links().SetCurEntry( pEntry ); - Links().Select( pEntry ); - LinksSelectHdl( 0 ); - } - Links().SetUpdateMode( sal_True ); - Links().Invalidate(); - } -} - - -void SvBaseLinksDlg::InsertEntry( const SvBaseLink& rLink, sal_uInt16 nPos, sal_Bool bSelect ) -{ - String aEntry, sFileNm, sLinkNm, sTypeNm, sFilter; - - pLinkMgr->GetDisplayNames( (SvBaseLink*)&rLink, &sTypeNm, &sFileNm, &sLinkNm, &sFilter ); - - // GetTab(0) gibt die Position der von der TabListBox automatisch eingefuegten - // Bitmap. Die Breite der ersten Textspalte ergibt sich deshalb aus Tab(2)-Tab(1) - long nWidthPixel = Links().GetLogicTab( 2 ) - Links().GetLogicTab( 1 ); - nWidthPixel -= SV_TAB_BORDER; - XubString aTxt = Links().GetEllipsisString( sFileNm, nWidthPixel, TEXT_DRAW_PATHELLIPSIS ); - INetURLObject aPath( sFileNm, INET_PROT_FILE ); - String aFileName = aPath.getName(); - aFileName = INetURLObject::decode(aFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); - - if( aFileName.Len() > aTxt.Len() ) - aTxt = aFileName; - else if( aTxt.Search( aFileName, aTxt.Len() - aFileName.Len() ) == STRING_NOTFOUND ) - // filename not in string - aTxt = aFileName; - - aEntry = aTxt; - aEntry += '\t'; - if( OBJECT_CLIENT_GRF == rLink.GetObjType() ) - aEntry += sFilter; - else - aEntry += sLinkNm; - aEntry += '\t'; - aEntry += sTypeNm; - aEntry += '\t'; - aEntry += ImplGetStateStr( rLink ); - - SvLBoxEntry * pE = Links().InsertEntryToColumn( aEntry, nPos ); - pE->SetUserData( (void*)&rLink ); - if(bSelect) - Links().Select(pE); -} - -SvBaseLink* SvBaseLinksDlg::GetSelEntry( sal_uInt16* pPos ) -{ - SvLBoxEntry* pE = Links().FirstSelected(); - sal_uInt16 nPos; - if( pE && LISTBOX_ENTRY_NOTFOUND != - ( nPos = (sal_uInt16)Links().GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - - if( pPos ) - *pPos = nPos; - return (SvBaseLink*)pE->GetUserData(); - } - return 0; -} - -void SvBaseLinksDlg::SetType( SvBaseLink& rLink, - sal_uInt16 nSelPos, - sal_uInt16 nType ) -{ - rLink.SetUpdateMode( nType ); - rLink.Update(); - SvLBoxEntry* pBox = Links().GetEntry( nSelPos ); - Links().SetEntryText( ImplGetStateStr( rLink ), pBox, 3 ); - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); -} - -void SvBaseLinksDlg::SetActLink( SvBaseLink * pLink ) -{ - if( pLinkMgr ) - { - const SvBaseLinks& rLnks = pLinkMgr->GetLinks(); - sal_uInt16 nSelect = 0; - for( sal_uInt16 n = 0; n < rLnks.Count(); ++n ) - { - SvBaseLinkRef* pLinkRef = rLnks[ n ]; - // #109573# only visible links have been inserted into the TreeListBox, - // invisible ones have to be skipped here - if( (*pLinkRef)->IsVisible() ) - { - if( pLink == *pLinkRef ) - { - Links().Select( Links().GetEntry( nSelect ) ); - LinksSelectHdl( 0 ); - return ; - } - nSelect++; - } - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx deleted file mode 100644 index cc76430f7..000000000 --- a/cui/source/dialogs/multifil.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include <tools/shl.hxx> -#include <vcl/msgbox.hxx> -#include <sfx2/filedlghelper.hxx> - -#include <tools/urlobj.hxx> - -#include "multipat.hxx" -#include "multifil.hxx" -#include <dialmgr.hxx> - -#include "multipat.hrc" -#include <cuires.hrc> - -// #97807# ------------- -#include <com/sun/star/ucb/XContentProvider.hpp> -#include <ucbhelper/contentbroker.hxx> - -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -using namespace com::sun::star::ucb; -using namespace com::sun::star::uno; - -// class SvxMultiFileDialog ---------------------------------------------- - -IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn ) -{ - sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); - - if ( IsClassPathMode() ) - { - aDlg.SetTitle( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE ) ); - aDlg.AddFilter( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") ); - } - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - // #97807# URL content comparison of entries ----------- - INetURLObject aFile( aDlg.GetPath() ); - String sInsFile = aFile.getFSysPath( INetURLObject::FSYS_DETECT ); - ::ucbhelper::Content aContent( aFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() ); - Reference< XContent > xContent = aContent.get(); - OSL_ENSURE( xContent.is(), "AddHdl_Impl: invalid content interface!" ); - Reference< XContentIdentifier > xID = xContent->getIdentifier(); - OSL_ENSURE( xID.is(), "AddHdl_Impl: invalid ID interface!" ); - // ensure the content of files are valid - - sal_uInt16 nCount = aPathLB.GetEntryCount(); - sal_Bool bDuplicated = sal_False; - try - { - if( nCount > 0 ) // start comparison - { - sal_uInt16 i; - ::ucbhelper::Content & VContent = aContent; // temporary Content reference - Reference< XContent > xVContent; - Reference< XContentIdentifier > xVID; - for( i = 0; i < nCount; i++ ) - { - String sVFile = aPathLB.GetEntry( i ); - std::map< String, ::ucbhelper::Content >::iterator aCur = aFileContentMap.find( sVFile ); - if( aCur == aFileContentMap.end() ) // look for File Content in aFileContentMap, but not find it. - { - INetURLObject aVFile( sVFile, INetURLObject::FSYS_DETECT ); - aFileContentMap[sVFile] = ::ucbhelper::Content( aVFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() ); - VContent = aFileContentMap.find( sVFile )->second; - } - else - VContent = aCur->second; - xVContent = VContent.get(); - OSL_ENSURE( xVContent.is(), "AddHdl_Impl: invalid content interface!" ); - xVID = xVContent->getIdentifier(); - OSL_ENSURE( xVID.is(), "AddHdl_Impl: invalid ID interface!" ); - if ( xID.is() && xVID.is() ) - { - // get a generic content provider - ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); - Reference< XContentProvider > xProvider; - if ( pBroker ) - xProvider = pBroker->getContentProviderInterface(); - if ( xProvider.is() ) - { - if ( 0 == xProvider->compareContentIds( xID, xVID ) ) - { - bDuplicated = sal_True; - break; - } - } - } - } - } // end of if the entries are more than zero. - } // end of try(} - catch( const Exception& ) // catch every exception of comparison - { - OSL_FAIL( "AddHdl_Impl: caught an unexpected exception!" ); - } - - if ( bDuplicated ) // #97807# -------------------- - { - String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsFile ); - InfoBox( pBtn, sMsg ).Execute(); - } - else - { - sal_uInt16 nPos = aPathLB.InsertEntry( sInsFile, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*) new String( sInsFile ) ); - } - - } // end of if ( aDlg.Execute() == ERRCODE_NONE ) - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiFileDialog, DelHdl_Impl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nPos = aPathLB.GetSelectEntryPos(); - aPathLB.RemoveEntry( nPos ); - sal_uInt16 nCnt = aPathLB.GetEntryCount(); - - if ( nCnt ) - { - nCnt--; - - if ( nPos > nCnt ) - nPos = nCnt; - aPathLB.SelectEntryPos( nPos ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -SvxMultiFileDialog::SvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed ) : - - SvxMultiPathDialog( pParent, bEmptyAllowed ) - -{ - aAddBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, AddHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, DelHdl_Impl ) ); - SetText( CUI_RES( RID_SVXSTR_FILE_TITLE ) ); - aPathFL.SetText( CUI_RES( RID_SVXSTR_FILE_HEADLINE ) ); - aDelBtn.Enable(); -} - -// ----------------------------------------------------------------------- - -SvxMultiFileDialog::~SvxMultiFileDialog() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx deleted file mode 100644 index 025d6d31e..000000000 --- a/cui/source/dialogs/multipat.cxx +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include <tools/debug.hxx> -#include <tools/urlobj.hxx> -#include <vcl/msgbox.hxx> -#include <sfx2/filedlghelper.hxx> - -#include "multipat.hxx" -#include <dialmgr.hxx> - -#include "multipat.hrc" -#include <cuires.hrc> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> - -#include <unotools/localfilehelper.hxx> -#include <unotools/pathoptions.hxx> - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - -// struct MultiPath_Impl ------------------------------------------------- - -struct MultiPath_Impl -{ - sal_Bool bEmptyAllowed; - sal_Bool bIsClassPathMode; - bool bIsRadioButtonMode; - - MultiPath_Impl( sal_Bool bAllowed ) : - bEmptyAllowed( bAllowed ), bIsClassPathMode( sal_False ), bIsRadioButtonMode( false ) {} -}; - -// class SvxMultiPathDialog ---------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, SelectHdl_Impl, void *, EMPTYARG ) -{ - sal_uLong nCount = pImpl->bIsRadioButtonMode ? aRadioLB.GetEntryCount() : aPathLB.GetEntryCount(); - bool bIsSelected = pImpl->bIsRadioButtonMode - ? aRadioLB.FirstSelected() != NULL - : aPathLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND; - sal_Bool bEnable = ( pImpl->bEmptyAllowed || nCount > 1 ); - aDelBtn.Enable( bEnable && bIsSelected ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, CheckHdl_Impl, svx::SvxRadioButtonListBox *, pBox ) -{ - SvLBoxEntry* pEntry = - pBox ? pBox->GetEntry( pBox->GetCurMousePoint() ) : aRadioLB.FirstSelected(); - if ( pEntry ) - aRadioLB.HandleEntryChecked( pEntry ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, AddHdl_Impl, PushButton *, EMPTYARG ) -{ - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); - - if ( xFolderPicker->execute() == ExecutableDialogResults::OK ) - { - INetURLObject aPath( xFolderPicker->getDirectory() ); - aPath.removeFinalSlash(); - String aURL = aPath.GetMainURL( INetURLObject::NO_DECODE ); - String sInsPath; - ::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, sInsPath ); - - if ( pImpl->bIsRadioButtonMode ) - { - sal_uLong nPos = aRadioLB.GetEntryPos( sInsPath, 1 ); - if ( 0xffffffff == nPos ) //See svtools/source/contnr/svtabbx.cxx SvTabListBox::GetEntryPos - { - String sNewEntry( '\t' ); - sNewEntry += sInsPath; - SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sNewEntry ); - String* pData = new String( aURL ); - pEntry->SetUserData( pData ); - } - else - { - String sMsg( CUI_RES( RID_MULTIPATH_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsPath ); - InfoBox( this, sMsg ).Execute(); - } - } - else - { - if ( LISTBOX_ENTRY_NOTFOUND != aPathLB.GetEntryPos( sInsPath ) ) - { - String sMsg( CUI_RES( RID_MULTIPATH_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsPath ); - InfoBox( this, sMsg ).Execute(); - } - else - { - sal_uInt16 nPos = aPathLB.InsertEntry( sInsPath, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*)new String( aURL ) ); - } - } - SelectHdl_Impl( NULL ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, DelHdl_Impl, PushButton *, EMPTYARG ) -{ - if ( pImpl->bIsRadioButtonMode ) - { - SvLBoxEntry* pEntry = aRadioLB.FirstSelected(); - delete (String*)pEntry->GetUserData(); - bool bChecked = aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED; - sal_uLong nPos = aRadioLB.GetEntryPos( pEntry ); - aRadioLB.RemoveEntry( pEntry ); - sal_uLong nCnt = aRadioLB.GetEntryCount(); - if ( nCnt ) - { - nCnt--; - if ( nPos > nCnt ) - nPos = nCnt; - pEntry = aRadioLB.GetEntry( nPos ); - if ( bChecked ) - { - aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - aRadioLB.HandleEntryChecked( pEntry ); - } - else - aRadioLB.Select( pEntry ); - } - } - else - { - sal_uInt16 nPos = aPathLB.GetSelectEntryPos(); - aPathLB.RemoveEntry( nPos ); - sal_uInt16 nCnt = aPathLB.GetEntryCount(); - - if ( nCnt ) - { - nCnt--; - - if ( nPos > nCnt ) - nPos = nCnt; - aPathLB.SelectEntryPos( nPos ); - } - } - SelectHdl_Impl( NULL ); - return 0; -} - -// ----------------------------------------------------------------------- - -SvxMultiPathDialog::SvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_MULTIPATH ) ), - - aPathFL ( this, CUI_RES( FL_MULTIPATH) ), - aPathLB ( this, CUI_RES( LB_MULTIPATH ) ), - m_aRadioLBContainer(this, CUI_RES(LB_RADIOBUTTON)), - aRadioLB(m_aRadioLBContainer), - aRadioFT ( this, CUI_RES( FT_RADIOBUTTON ) ), - aAddBtn ( this, CUI_RES( BTN_ADD_MULTIPATH ) ), - aDelBtn ( this, CUI_RES( BTN_DEL_MULTIPATH ) ), - aOKBtn ( this, CUI_RES( BTN_MULTIPATH_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_MULTIPATH_CANCEL ) ), - aHelpButton ( this, CUI_RES( BTN_MULTIPATH_HELP ) ), - pImpl ( new MultiPath_Impl( bEmptyAllowed ) ) - -{ - static long aStaticTabs[]= { 2, 0, 12 }; - aRadioLB.SvxSimpleTable::SetTabs( aStaticTabs ); - String sHeader( CUI_RES( STR_HEADER_PATHS ) ); - aRadioLB.SetQuickHelpText( sHeader ); - sHeader.Insert( '\t', 0 ); - aRadioLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT ); - - FreeResource(); - - aPathLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) ); - aRadioLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) ); - aRadioLB.SetCheckButtonHdl( LINK( this, SvxMultiPathDialog, CheckHdl_Impl ) ); - aAddBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, AddHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, DelHdl_Impl ) ); - - SelectHdl_Impl( NULL ); - - aAddBtn.SetAccessibleRelationMemberOf(&aPathLB); - aDelBtn.SetAccessibleRelationMemberOf(&aPathLB); -} - -// ----------------------------------------------------------------------- - -SvxMultiPathDialog::~SvxMultiPathDialog() -{ - sal_uInt16 nPos = aPathLB.GetEntryCount(); - while ( nPos-- ) - delete (String*)aPathLB.GetEntryData(nPos); - nPos = (sal_uInt16)aRadioLB.GetEntryCount(); - while ( nPos-- ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry( nPos ); - delete (String*)pEntry->GetUserData(); - } - delete pImpl; -} - -// ----------------------------------------------------------------------- - -String SvxMultiPathDialog::GetPath() const -{ - String sNewPath; - sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER; - - if ( pImpl->bIsRadioButtonMode ) - { - String sWritable; - for ( sal_uInt16 i = 0; i < aRadioLB.GetEntryCount(); ++i ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry(i); - if ( aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) - sWritable = *(String*)pEntry->GetUserData(); - else - { - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += *(String*)pEntry->GetUserData(); - } - } - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += sWritable; - } - else - { - for ( sal_uInt16 i = 0; i < aPathLB.GetEntryCount(); ++i ) - { - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += *(String*)aPathLB.GetEntryData(i); - } - } - return sNewPath; -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::SetPath( const String& rPath ) -{ - sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER; - sal_uInt16 nPos, nCount = rPath.GetTokenCount( cDelim ); - - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - String sPath = rPath.GetToken( i, cDelim ); - String sSystemPath; - sal_Bool bIsSystemPath = - ::utl::LocalFileHelper::ConvertURLToSystemPath( sPath, sSystemPath ); - - if ( pImpl->bIsRadioButtonMode ) - { - String sEntry( '\t' ); - sEntry += (bIsSystemPath ? sSystemPath : sPath); - SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sEntry ); - String* pURL = new String( sPath ); - pEntry->SetUserData( pURL ); - } - else - { - if ( bIsSystemPath ) - nPos = aPathLB.InsertEntry( sSystemPath, LISTBOX_APPEND ); - else - nPos = aPathLB.InsertEntry( sPath, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*)new String( sPath ) ); - } - } - - if ( pImpl->bIsRadioButtonMode && nCount > 0 ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry( nCount - 1 ); - if ( pEntry ) - { - aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - aRadioLB.HandleEntryChecked( pEntry ); - } - } - - SelectHdl_Impl( NULL ); -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::SetClassPathMode() -{ - pImpl->bIsClassPathMode = sal_True; - SetText( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE )); - aPathFL.SetText( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxMultiPathDialog::IsClassPathMode() const -{ - return pImpl->bIsClassPathMode; -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::EnableRadioButtonMode() -{ - pImpl->bIsRadioButtonMode = true; - - aPathFL.Hide(); - aPathLB.Hide(); - - aRadioLB.ShowTable(); - aRadioFT.Show(); - - Point aNewPos = aAddBtn.GetPosPixel(); - long nDelta = aNewPos.Y() - aRadioLB.GetPosPixel().Y(); - aNewPos.Y() -= nDelta; - aAddBtn.SetPosPixel( aNewPos ); - aNewPos = aDelBtn.GetPosPixel(); - aNewPos.Y() -= nDelta; - aDelBtn.SetPosPixel( aNewPos ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multipat.hrc b/cui/source/dialogs/multipat.hrc deleted file mode 100644 index 8d9a19fbe..000000000 --- a/cui/source/dialogs/multipat.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_MULTIPAT_HRC -#define _SVX_MULTIPAT_HRC - -// defines --------------------------------------------------------------- - -#define FL_MULTIPATH 10 -#define LB_MULTIPATH 11 -#define LB_RADIOBUTTON 12 -#define FT_RADIOBUTTON 13 -#define BTN_ADD_MULTIPATH 14 -#define BTN_DEL_MULTIPATH 15 -#define BTN_MULTIPATH_OK 16 -#define BTN_MULTIPATH_CANCEL 17 -#define BTN_MULTIPATH_HELP 18 -#define STR_HEADER_PATHS 19 - -#endif - diff --git a/cui/source/dialogs/multipat.src b/cui/source/dialogs/multipat.src deleted file mode 100644 index ffcd7020a..000000000 --- a/cui/source/dialogs/multipat.src +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "multipat.hrc" -#include "helpid.hrc" -#include <cuires.hrc> - -// RID_SVXDLG_MULTIPATH -------------------------------------------------- - -ModalDialog RID_SVXDLG_MULTIPATH -{ - HelpId = HID_MULTIPATH ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 120 ) ; - Text [ en-US ] = "Select Paths" ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedLine FL_MULTIPATH - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Paths" ; - }; - ListBox LB_MULTIPATH - { - HelpID = "cui:ListBox:RID_SVXDLG_MULTIPATH:LB_MULTIPATH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 189 , 80 ) ; - AutoHScroll = TRUE ; - }; - Control LB_RADIOBUTTON - { - HelpId = HID_OPTIONS_MULTIPATH_LIST ; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 195 , 77 ) ; - }; - FixedText FT_RADIOBUTTON - { - Hide = TRUE ; - NoLabel = TRUE ; - Pos = MAP_APPFONT ( 6 , 86 ); - Size = MAP_APPFONT ( 195 , 8 ); - Text [ en-US ] = "Mark the default path for new files."; - }; - PushButton BTN_ADD_MULTIPATH - { - HelpID = "cui:PushButton:RID_SVXDLG_MULTIPATH:BTN_ADD_MULTIPATH"; - Pos = MAP_APPFONT ( 204 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - }; - PushButton BTN_DEL_MULTIPATH - { - HelpID = "cui:PushButton:RID_SVXDLG_MULTIPATH:BTN_DEL_MULTIPATH"; - Pos = MAP_APPFONT ( 204 , 31 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - }; - OKButton BTN_MULTIPATH_OK - { - Pos = MAP_APPFONT ( 95 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton BTN_MULTIPATH_CANCEL - { - Pos = MAP_APPFONT ( 148 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_MULTIPATH_HELP - { - Pos = MAP_APPFONT ( 204 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String STR_HEADER_PATHS - { - Text [ en-US ] = "Path list" ; - }; -}; -String RID_MULTIPATH_DBL_ERR -{ - Text [ en-US ] = "The path %1 already exists." ; -}; -String RID_SVXSTR_FILE_TITLE -{ - Text [ en-US ] = "Select files" ; -}; -String RID_SVXSTR_FILE_HEADLINE -{ - Text [ en-US ] = "Files" ; -}; -String RID_SVXSTR_ARCHIVE_TITLE -{ - Text [ en-US ] = "Select Archives" ; -}; -String RID_SVXSTR_ARCHIVE_HEADLINE -{ - Text [ en-US ] = "Archives" ; -}; -String RID_SVXSTR_MULTIFILE_DBL_ERR -{ - Text [ en-US ] = "The file %1 already exists." ; -}; diff --git a/cui/source/dialogs/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx deleted file mode 100644 index b387b4f87..000000000 --- a/cui/source/dialogs/newtabledlg.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "cuires.hrc" -#include "dialmgr.hxx" -#include "newtabledlg.hxx" -#include "newtabledlg.hrc" - -SvxNewTableDialog::SvxNewTableDialog( Window* pParent ) -: ModalDialog( pParent, CUI_RES( RID_SVX_NEWTABLE_DLG ) ) -, maFtColumns( this, CUI_RES( FT_COLUMNS ) ) -, maNumColumns( this, CUI_RES( NF_COLUMNS ) ) -, maFtRows( this, CUI_RES( FT_ROWS ) ) -, maNumRows( this, CUI_RES( NF_ROWS ) ) -, maFlSep( this, CUI_RES( FL_SEP ) ) -, maHelpButton( this, CUI_RES( BTN_HELP ) ) -, maOkButton( this, CUI_RES( BTN_OK ) ) -, maCancelButton( this, CUI_RES( BTN_CANCEL ) ) -{ - maNumRows.SetValue(2); - maNumColumns.SetValue(5); - FreeResource(); -} - -short SvxNewTableDialog::Execute(void) -{ - return ModalDialog::Execute(); -} - -void SvxNewTableDialog::Apply(void) -{ -} - -sal_Int32 SvxNewTableDialog::getRows() const -{ - return sal::static_int_cast< sal_Int32 >( maNumRows.GetValue() ); -} - -sal_Int32 SvxNewTableDialog::getColumns() const -{ - return sal::static_int_cast< sal_Int32 >( maNumColumns.GetValue() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/newtabledlg.hrc b/cui/source/dialogs/newtabledlg.hrc deleted file mode 100644 index b75c16a86..000000000 --- a/cui/source/dialogs/newtabledlg.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FT_COLUMNS 1 -#define NF_COLUMNS 2 -#define FT_ROWS 3 -#define NF_ROWS 4 -#define FL_SEP 5 -#define BTN_HELP 6 -#define BTN_OK 7 -#define BTN_CANCEL 8 diff --git a/cui/source/dialogs/newtabledlg.src b/cui/source/dialogs/newtabledlg.src deleted file mode 100644 index fb87f2567..000000000 --- a/cui/source/dialogs/newtabledlg.src +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "newtabledlg.hrc" -#include "cuires.hrc" - -ModalDialog RID_SVX_NEWTABLE_DLG -{ - HelpID = "cui:ModalDialog:RID_SVX_NEWTABLE_DLG"; - OutputSize = TRUE; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 181 , 6+15+15+15+14+6 ) ; - Text [ en-US ] = "Insert Table" ; - - FixedText FT_COLUMNS - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Number of columns:" ; - }; - NumericField NF_COLUMNS - { - HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_COLUMNS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 6 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 75 ; - SpinSize = 1 ; - StrictFormat = TRUE ; - }; - FixedText FT_ROWS - { - Pos = MAP_APPFONT ( 6 , 8+15 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Number of rows:" ; - }; - NumericField NF_ROWS - { - HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_ROWS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 6+15 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 75 ; - SpinSize = 1 ; - StrictFormat = TRUE ; - }; - FixedLine FL_SEP - { - Pos = MAP_APPFONT ( 0 , 6+15+15 ) ; - Size = MAP_APPFONT ( 181 , 12 ) ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 69 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 125 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx deleted file mode 100644 index 1634739b0..000000000 --- a/cui/source/dialogs/passwdomdlg.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "passwdomdlg.hrc" -#include "passwdomdlg.hxx" - -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include <sfx2/tabdlg.hxx> -#include <tools/debug.hxx> -#include <vcl/fixed.hxx> -#include <vcl/edit.hxx> -#include <vcl/button.hxx> -#include <vcl/morebtn.hxx> -#include <vcl/settings.hxx> -#include <vcl/msgbox.hxx> - - -////////////////////////////////////////////////////////////////////// - -class PasswordReenterEdit_Impl : public Edit -{ - String m_aDefaultTxt; - - // disallow use of copy c-tor and assignment operator - PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & ); - PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & ); - -public: - PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ); - virtual ~PasswordReenterEdit_Impl(); - - // Edit - virtual void Paint( const Rectangle& rRect ); -}; - - -PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) : - Edit( pParent, rResId ) -{ -} - - -PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl() -{ -} - - -void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect ) -{ - if (GetText().Len() == 0) - { - Push( PUSH_TEXTCOLOR ); - SetTextColor( Color( COL_GRAY ) ); - DrawText( Point(), m_aDefaultTxt ); - - Pop(); - } - else - Edit::Paint( rRect ); -} - - -////////////////////////////////////////////////////////////////////// - -struct PasswordToOpenModifyDialog_Impl -{ - PasswordToOpenModifyDialog * m_pParent; - - FixedLine m_aFileEncryptionFL; - FixedText m_aPasswdToOpenFT; - Edit m_aPasswdToOpenED; - FixedText m_aReenterPasswdToOpenFT; - PasswordReenterEdit_Impl m_aReenterPasswdToOpenED; - FixedText m_aPasswdNoteFT; - FixedLine m_aButtonsFL; - MoreButton m_aMoreFewerOptionsBTN; - OKButton m_aOk; - CancelButton m_aCancel; - FixedLine m_aFileSharingOptionsFL; - CheckBox m_aOpenReadonlyCB; - FixedText m_aPasswdToModifyFT; - Edit m_aPasswdToModifyED; - FixedText m_aReenterPasswdToModifyFT; - PasswordReenterEdit_Impl m_aReenterPasswdToModifyED; - - String m_aOneMismatch; - String m_aTwoMismatch; - String m_aInvalidStateForOkButton; - String m_aInvalidStateForOkButton_v2; - - bool m_bIsPasswordToModify; - - - DECL_LINK( OkBtnClickHdl, OKButton * ); - - PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent, - sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); - ~PasswordToOpenModifyDialog_Impl(); -}; - - -PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( - PasswordToOpenModifyDialog * pParent, - sal_uInt16 nMinPasswdLen, - sal_uInt16 nMaxPasswdLen, - bool bIsPasswordToModify ) : - m_pParent( pParent ), - m_aFileEncryptionFL ( pParent, CUI_RES( FL_FILE_ENCRYPTION ) ), - m_aPasswdToOpenFT ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ), - m_aPasswdToOpenED ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ), - m_aReenterPasswdToOpenFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ), - m_aReenterPasswdToOpenED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ) ), - m_aPasswdNoteFT ( pParent, CUI_RES( FT_PASSWD_NOTE ) ), - m_aButtonsFL ( pParent, CUI_RES( FL_BUTTONS ) ), - m_aMoreFewerOptionsBTN ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ), - m_aOk ( pParent, CUI_RES( BTN_OK ) ), - m_aCancel ( pParent, CUI_RES( BTN_CANCEL ) ), - m_aFileSharingOptionsFL ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ), - m_aOpenReadonlyCB ( pParent, CUI_RES( CB_OPEN_READONLY ) ), - m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ), - m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ), - m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ), - m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ), - m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ), - m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ), - m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ), - m_aInvalidStateForOkButton_v2( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON_V2 ) ), - m_bIsPasswordToModify( bIsPasswordToModify ) -{ - m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) ); - m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) ); - - m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) ); - - if (nMaxPasswdLen) - { - m_aPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); - m_aReenterPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); - m_aPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); - m_aReenterPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); - } - - (void) nMinPasswdLen; // currently not supported - - m_aPasswdToOpenED.GrabFocus(); - - m_aMoreFewerOptionsBTN.Enable( bIsPasswordToModify ); - if (!bIsPasswordToModify) - m_aMoreFewerOptionsBTN.Hide( sal_True ); -} - - -PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl() -{ -} - -IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ ) -{ - bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() && - m_aPasswdToOpenED.GetText().Len() == 0 && - m_aPasswdToModifyED.GetText().Len() == 0; - if (bInvalidState) - { - ErrorBox aErrorBox( m_pParent, WB_OK, - m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2 ); - aErrorBox.Execute(); - } - else // check for mismatched passwords... - { - const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); - const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); - const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); - if (nMismatch > 0) - { - ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch ); - aErrorBox.Execute(); - - Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED; - PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED; - String aEmpty; - if (nMismatch == 1) - { - rEdit.SetText( aEmpty ); - rRepeatEdit.SetText( aEmpty ); - } - else if (nMismatch == 2) - { - m_aPasswdToOpenED.SetText( aEmpty ); - m_aReenterPasswdToOpenED.SetText( aEmpty ); - m_aPasswdToModifyED.SetText( aEmpty ); - m_aReenterPasswdToModifyED.SetText( aEmpty ); - } - rEdit.GrabFocus(); - } - else - { - m_pParent->EndDialog( RET_OK ); - } - } - - return 0; -} - -////////////////////////////////////////////////////////////////////// - - -PasswordToOpenModifyDialog::PasswordToOpenModifyDialog( - Window * pParent, - sal_uInt16 nMinPasswdLen, - sal_uInt16 nMaxPasswdLen, - bool bIsPasswordToModify ) : - SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) ) -{ - m_pImpl = std::auto_ptr< PasswordToOpenModifyDialog_Impl >( - new PasswordToOpenModifyDialog_Impl( this, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ) ); - - FreeResource(); -} - - -PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog() -{ -} - - -String PasswordToOpenModifyDialog::GetPasswordToOpen() const -{ - const bool bPasswdOk = - m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 && - m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText(); - return bPasswdOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String(); -} - - -String PasswordToOpenModifyDialog::GetPasswordToModify() const -{ - const bool bPasswdOk = - m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 && - m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText(); - return bPasswdOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String(); -} - - -bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const -{ - return m_pImpl->m_aOpenReadonlyCB.IsChecked(); -} - - -////////////////////////////////////////////////////////////////////// - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc deleted file mode 100755 index bdbbcdc5a..000000000 --- a/cui/source/dialogs/passwdomdlg.hrc +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_PASSWDOMDLG_HRC_ -#define _CUI_PASSWDOMDLG_HRC_ - -#define FL_FILE_ENCRYPTION 10 -#define FT_PASSWD_TO_OPEN 11 -#define ED_PASSWD_TO_OPEN 12 -#define FT_REENTER_PASSWD_TO_OPEN 13 -#define ED_REENTER_PASSWD_TO_OPEN 14 -#define IMG_PASSWD_MATCH 15 -#define IMG_PASSWD_MATCH_HC 16 -#define FT_PASSWD_NOTE 17 -#define FL_BUTTONS 18 -#define BTN_MORE_FEWER_OPTIONS 19 -#define BTN_OK 20 -#define BTN_CANCEL 21 -#define FL_FILE_SHARING_OPTIONS 22 -#define FT_PASSWD_TO_MODIFY 23 -#define ED_PASSWD_TO_MODIFY 24 -#define FT_REENTER_PASSWD_TO_MODIFY 25 -#define ED_REENTER_PASSWD_TO_MODIFY 26 -#define FI_PASSWD_TO_OPEN_MATCH 27 -#define FI_PASSWD_TO_MODIFY_MATCH 28 -#define CB_OPEN_READONLY 29 - -#define STR_MORE_OPTIONS 51 -#define STR_FEWER_OPTIONS 52 -#define STR_PASSWD_MUST_BE_CONFIRMED 53 -#define STR_ONE_PASSWORD_MISMATCH 54 -#define STR_TWO_PASSWORDS_MISMATCH 55 -#define STR_INVALID_STATE_FOR_OK_BUTTON 56 -#define STR_INVALID_STATE_FOR_OK_BUTTON_V2 57 - -#endif diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src deleted file mode 100644 index 532284f7b..000000000 --- a/cui/source/dialogs/passwdomdlg.src +++ /dev/null @@ -1,203 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <cuires.hrc> -#include "passwdomdlg.hrc" -#include "helpid.hrc" - - -ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY -{ - Size = MAP_APPFONT( 171, 150 ); - Text [ en-US ] = "Set Password"; - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY; - Border = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - - FixedLine FL_FILE_ENCRYPTION - { - Pos = MAP_APPFONT( 3, 3 ); - Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File encryption password"; - }; - - FixedText FT_PASSWD_TO_OPEN - { - Pos = MAP_APPFONT( 6, 17 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "~Enter password to open"; - WordBreak = TRUE; - }; - - Edit ED_PASSWD_TO_OPEN - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN; - Pos = MAP_APPFONT( 6, 28 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_REENTER_PASSWD_TO_OPEN - { - Pos = MAP_APPFONT( 6, 45 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Confirm password"; - WordBreak = TRUE; - }; - - Edit ED_REENTER_PASSWD_TO_OPEN - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN; - Pos = MAP_APPFONT( 6, 56 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_PASSWD_NOTE - { - Pos = MAP_APPFONT( 6, 80 ); - Size = MAP_APPFONT( 159, 4*8 ); // some extra space for translation in other languages - Text [ en-US ] = "Note: After a password has been set, the document will only open with "\ - "the password. Should you lose the password, there will be no way to "\ - "recover the document. Please also note that this password is case-sensitive."; - WordBreak = TRUE; - }; - - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT( 0, 117 ); - Size = MAP_APPFONT( 171, 8 ); - }; - - MoreButton BTN_MORE_FEWER_OPTIONS - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE; - Pos = MAP_APPFONT( 6 , 130 ) ; - Size = MAP_APPFONT( 50 , 14 ) ; - Delta = 92 ; - MapUnit = MAP_APPFONT ; - State = FALSE ; - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT( 62, 130 ); - Size = MAP_APPFONT( 50, 14 ); - DefButton = TRUE ; - }; - - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT( 115, 130 ); - Size = MAP_APPFONT( 50, 14 ); - }; - - FixedLine FL_FILE_SHARING_OPTIONS - { - Pos = MAP_APPFONT( 3, 154 ); - Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File sharing password"; - }; - - CheckBox CB_OPEN_READONLY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY; - Pos = MAP_APPFONT( 6, 170 ); - Size = MAP_APPFONT( 159, 8 ); - - Text [ en-US ] = "Open file read-only"; - }; - - FixedText FT_PASSWD_TO_MODIFY - { - Pos = MAP_APPFONT( 6, 186 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Enter password to allow editing"; - WordBreak = TRUE; - }; - - Edit ED_PASSWD_TO_MODIFY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY; - Pos = MAP_APPFONT( 6, 196 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_REENTER_PASSWD_TO_MODIFY - { - Pos = MAP_APPFONT( 6, 214 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Confirm password"; - WordBreak = TRUE; - }; - - Edit ED_REENTER_PASSWD_TO_MODIFY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY; - Pos = MAP_APPFONT( 6, 224 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - String STR_PASSWD_MUST_BE_CONFIRMED - { - Text [ en-US ] = "Password must be confirmed" ; - }; - - String STR_MORE_OPTIONS - { - Text [ en-US ] = "More ~Options" ; - }; - - String STR_FEWER_OPTIONS - { - Text [ en-US ] = "Fewer ~Options" ; - }; - - String STR_ONE_PASSWORD_MISMATCH - { - Text [ en-US ] = "The confirmation password did not match the password. Set the password again by entering the same password in both boxes." ; - }; - - String STR_TWO_PASSWORDS_MISMATCH - { - Text [ en-US ] = "The confirmation passwords did not match the original passwords. Set the passwords again." ; - }; - - String STR_INVALID_STATE_FOR_OK_BUTTON - { - Text [ en-US ] = "Please enter a password to open or to modify, or check the open read-only option to continue." ; - }; -}; diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx deleted file mode 100644 index c96c3f6ec..000000000 --- a/cui/source/dialogs/pastedlg.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/embed/Aspects.hpp> - -#include <pastedlg.hxx> -#include <svtools/svmedit.hxx> -#include <svtools/insdlg.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include "svuidlg.hrc" -#include <sot/formats.hxx> -#include <sot/stg.hxx> -#include <svtools/sores.hxx> -#include <vcl/svapp.hxx> - -#include <dialmgr.hxx> - -SvPasteObjectDialog::SvPasteObjectDialog( Window* pParent ) - - : ModalDialog( pParent, CUI_RES( MD_PASTE_OBJECT ) ), - aFtSource( this, CUI_RES( FT_SOURCE ) ), - aFtObjectSource( this, CUI_RES( FT_OBJECT_SOURCE ) ), - aRbPaste( this, CUI_RES( RB_PASTE ) ), - aRbPasteLink( this, CUI_RES( RB_PASTE_LINK ) ), - aCbDisplayAsIcon( this, CUI_RES( CB_DISPLAY_AS_ICON ) ), - aPbChangeIcon( this, CUI_RES( PB_CHANGE_ICON ) ), - aFlChoice( this, CUI_RES( FL_CHOICE ) ), - aLbInsertList( this, CUI_RES( LB_INSERT_LIST ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aSObject( CUI_RES( S_OBJECT ) ) -{ - FreeResource(); - SetHelpId( HID_PASTE_DLG ); - SetUniqueId( HID_PASTE_DLG ); - - Font aFont = aFtObjectSource.GetFont(); - aFont.SetWeight( WEIGHT_LIGHT ); - aFtObjectSource.SetFont( aFont ); - aOKButton1.Disable(); - - ObjectLB().SetSelectHdl( LINK( this, SvPasteObjectDialog, SelectHdl ) ); - ObjectLB().SetDoubleClickHdl( LINK( this, SvPasteObjectDialog, DoubleClickHdl ) ); - SetDefault(); - - aLbInsertList.SetAccessibleName(aFlChoice.GetText()); -} - -void SvPasteObjectDialog::SelectObject() -{ - if ( aLbInsertList.GetEntryCount() && - !aRbPaste.IsVisible() && !aRbPasteLink.IsVisible() ) - { - aLbInsertList.SelectEntryPos(0); - SelectHdl( &aLbInsertList ); - } -} - -IMPL_LINK( SvPasteObjectDialog, SelectHdl, ListBox *, pListBox ) -{ - (void)pListBox; - - if ( !aOKButton1.IsEnabled() ) - aOKButton1.Enable(); - return 0; -} - -IMPL_LINK_INLINE_START( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox ) -{ - (void)pListBox; - - EndDialog( RET_OK ); - return 0; -} -IMPL_LINK_INLINE_END( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox ) - -void SvPasteObjectDialog::SetDefault() -{ - bLink = sal_False; - nAspect = (sal_uInt16)::com::sun::star::embed::Aspects::MSOLE_CONTENT; -} - -SvPasteObjectDialog::~SvPasteObjectDialog() -{ - void * pStr = aSupplementTable.First(); - while( pStr ) - { - delete (String *)pStr; - pStr = aSupplementTable.Next(); - } -} - -/************************************************************************* -|* SvPasteObjectDialog::Insert() -*************************************************************************/ -void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName ) -{ - String * pStr = new String( rFormatName ); - if( !aSupplementTable.Insert( nFormat, pStr ) ) - delete pStr; -} - -sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper, - const DataFlavorExVector* pFormats, - const TransferableObjectDescriptor* ) -{ - //TODO/LATER: why is the Descriptor never used?! - TransferableObjectDescriptor aDesc; - if( rHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) ) - ((TransferableDataHelper&)rHelper).GetTransferableObjectDescriptor( - SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc ); - if ( !pFormats ) - pFormats = &rHelper.GetDataFlavorExVector(); - - //Dialogbox erzeugen und fuellen - String aSourceName, aTypeName; - sal_uLong nSelFormat = 0; - SvGlobalName aEmptyNm; - - ObjectLB().SetUpdateMode( sal_False ); - - DataFlavorExVector::iterator aIter( ((DataFlavorExVector&)*pFormats).begin() ), - aEnd( ((DataFlavorExVector&)*pFormats).end() ); - while( aIter != aEnd ) - { - ::com::sun::star::datatransfer::DataFlavor aFlavor( *aIter ); - SotFormatStringId nFormat = (*aIter++).mnSotId; - - String* pName = (String*) aSupplementTable.Get( nFormat ); - String aName; - - // if there is an "Embed Source" or and "Embedded Object" on the - // Clipboard we read the Description and the Source of this object - // from an accompanied "Object Descriptor" format on the clipboard - // Remember: these formats mostly appear together on the clipboard - if ( !pName ) - { - SvPasteObjectHelper::GetEmbeddedName(rHelper,aName,aSourceName,nFormat); - if ( aName.Len() ) - pName = &aName; - } - - - if( pName ) - { - aName = *pName; - - if( SOT_FORMATSTR_ID_EMBED_SOURCE == nFormat ) - { - if( aDesc.maClassName != aEmptyNm ) { - aSourceName = aDesc.maDisplayName; - - if( aDesc.maClassName == aObjClassName ) - aName = aObjName; - else - aName = aTypeName = aDesc.maTypeName; - } - } - else if( SOT_FORMATSTR_ID_LINK_SOURCE == nFormat ) - { - PasteLink().Enable(); - continue; - } - else if( !aName.Len() ) - aName = SvPasteObjectHelper::GetSotFormatUIName( nFormat ); - - if( LISTBOX_ENTRY_NOTFOUND == ObjectLB().GetEntryPos( aName ) ) - ObjectLB().SetEntryData( - ObjectLB().InsertEntry( aName ), (void*) nFormat ); - } - } - - if( !aTypeName.Len() && !aSourceName.Len() ) - { - if( aDesc.maClassName != aEmptyNm ) - { - aSourceName = aDesc.maDisplayName; - aTypeName = aDesc.maTypeName; - } - - if( !aTypeName.Len() && !aSourceName.Len() ) - { - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); - // global resource from svtools (former so3 resource) - if( pMgr ) - aSourceName = String( ResId( STR_UNKNOWN_SOURCE, *pMgr ) ); - delete pMgr; - } - } - - ObjectLB().SetUpdateMode( sal_True ); - SelectObject(); - - if( aSourceName.Len() ) - { - if( aTypeName.Len() ) - aTypeName += '\n'; - - aTypeName += aSourceName; - aTypeName.ConvertLineEnd(); - } - - ObjectSource().SetText( aTypeName ); - - SetDefault(); - - if( Dialog::Execute() == RET_OK ) - { - bLink = PasteLink().IsChecked(); - - if( AsIconBox().IsChecked() ) - nAspect = (sal_uInt16)com::sun::star::embed::Aspects::MSOLE_ICON; - - nSelFormat = (sal_uLong)ObjectLB().GetEntryData( ObjectLB().GetSelectEntryPos() ); - } - - return nSelFormat; -} - -void SvPasteObjectDialog::SetObjName( const SvGlobalName & rClass, const String & rObjName ) -{ - aObjClassName = rClass; - aObjName = rObjName; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx deleted file mode 100644 index 407a0c29d..000000000 --- a/cui/source/dialogs/plfilter.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <set> -#include <map> -#include <unotools/processfactory.hxx> - -#include <tools/debug.hxx> -#include <vcl/stdtext.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/plugin/PluginDescription.hpp> -#include <com/sun/star/plugin/XPluginManager.hpp> - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::plugin; - -struct ltstr -{ - bool operator()( const String& s1, const String& s2 ) const - { - return ( s1.CompareTo( s2 ) == COMPARE_LESS ); - } -}; - -typedef set< String, ltstr > StrSet; -typedef map< String, StrSet, ltstr > FilterMap; - - -//================================================================================================== -void fillNetscapePluginFilters( Sequence< rtl::OUString >& rPluginNames, Sequence< rtl::OUString >& rPluginTypes ) -{ - Reference< XMultiServiceFactory > xMan( ::utl::getProcessServiceFactory() ); - Reference< XPluginManager > xPMgr( xMan->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginManager") ) ), UNO_QUERY ); - - if ( xPMgr.is() ) - { - FilterMap aMap; - - // mimetypes zusammenfassen: eine description, mehrere extensions - - Sequence<PluginDescription > aDescriptions( xPMgr->getPluginDescriptions() ); - const PluginDescription * pDescriptions = aDescriptions.getConstArray(); - for ( sal_uInt32 nPos = aDescriptions.getLength(); nPos--; ) - { - const PluginDescription & rDescr = pDescriptions[nPos]; - - StrSet& rTypes = aMap[ rDescr.Description ]; - String aExtension( rDescr.Extension ); - - for ( sal_uInt16 nCnt = aExtension.GetTokenCount( ';' ); nCnt--; ) - { - // no default plugins anymore - String aExt( aExtension.GetToken( nCnt, ';' ) ); - if ( aExt.CompareToAscii( "*.*" ) != COMPARE_EQUAL ) - rTypes.insert( aExt ); - } - } - - rPluginNames = Sequence< rtl::OUString >( aMap.size() ); - rPluginTypes = Sequence< rtl::OUString >( aMap.size() ); - rtl::OUString* pPluginNames = rPluginNames.getArray(); - rtl::OUString* pPluginTypes = rPluginTypes.getArray(); - int nIndex = 0; - for ( FilterMap::iterator iPos = aMap.begin(); iPos != aMap.end(); ++iPos ) - { - String aText( (*iPos).first ); - String aType; - StrSet& rTypes = (*iPos).second; - StrSet::iterator i = rTypes.begin(); - while ( i != rTypes.end() ) - { - aType += (*i); - ++i; - if ( i != rTypes.end() ) - aType += ';'; - } - - if ( aType.Len() ) - { - aText += String::CreateFromAscii( " (" ); - aText += aType; - aText += ')'; - pPluginNames[nIndex] = aText; - pPluginTypes[nIndex] = aType; - nIndex++; - } - } - rPluginNames.realloc( nIndex ); - rPluginTypes.realloc( nIndex ); - } - else - ShowServiceNotAvailableError( NULL, - String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.plugin.PluginManager" ) ), sal_True ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx deleted file mode 100644 index 7c152bcdd..000000000 --- a/cui/source/dialogs/postdlg.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include <tools/shl.hxx> -#include <tools/date.hxx> -#include <tools/time.hxx> -#include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> -#include <svl/itempool.hxx> -#include <svl/itemset.hxx> -#include <unotools/useroptions.hxx> -#include <unotools/localedatawrapper.hxx> -#include <comphelper/processfactory.hxx> -#include <svx/svxids.hrc> // SID_ATTR_... -#include <svx/dialogs.hrc> // RID_SVXDLG_POSTIT - -#define _SVX_POSTDLG_CXX - -#include <cuires.hrc> -#include "postdlg.hrc" -#include <svx/postattr.hxx> -#include "postdlg.hxx" -#include <dialmgr.hxx> - -#include "helpid.hrc" - -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_POSTIT_AUTHOR, - SID_ATTR_POSTIT_TEXT, - 0 -}; - -// class SvxPostItDialog ------------------------------------------------- - -SvxPostItDialog::SvxPostItDialog( Window* pParent, - const SfxItemSet& rCoreSet, - sal_Bool bPrevNext, - sal_Bool bRedline ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_POSTIT ) ), - - aPostItFL ( this, CUI_RES( FL_POSTIT ) ), - aLastEditLabelFT( this, CUI_RES( FT_LASTEDITLABEL ) ), - aLastEditFT ( this, CUI_RES( FT_LASTEDIT ) ), - aEditFT ( this, CUI_RES( FT_EDIT ) ), - aEditED ( this, CUI_RES( ED_EDIT ) ), - aAuthorFT ( this, CUI_RES( FT_AUTHOR) ), - aAuthorBtn ( this, CUI_RES( BTN_AUTHOR ) ), - aOKBtn ( this, CUI_RES( BTN_POST_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_POST_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_POST_HELP ) ), - aPrevBtn ( this, CUI_RES( BTN_PREV ) ), - aNextBtn ( this, CUI_RES( BTN_NEXT ) ), - - rSet ( rCoreSet ), - pOutSet ( 0 ) - -{ - if (bRedline) // HelpIDs fuer Redlining - { - SetHelpId(HID_REDLINING_DLG); - aEditED.SetHelpId(HID_REDLINING_EDIT); - aPrevBtn.SetHelpId(HID_REDLINING_PREV); - aNextBtn.SetHelpId(HID_REDLINING_NEXT); - } - - aPrevBtn.SetClickHdl( LINK( this, SvxPostItDialog, PrevHdl ) ); - aNextBtn.SetClickHdl( LINK( this, SvxPostItDialog, NextHdl ) ); - aAuthorBtn.SetClickHdl( LINK( this, SvxPostItDialog, Stamp ) ); - aOKBtn.SetClickHdl( LINK( this, SvxPostItDialog, OKHdl ) ); - - Font aFont( aEditED.GetFont() ); - aFont.SetWeight( WEIGHT_LIGHT ); - aEditED.SetFont( aFont ); - - sal_Bool bNew = sal_True; - sal_uInt16 nWhich = 0; - - if ( !bPrevNext ) - { - aPrevBtn.Hide(); - aNextBtn.Hide(); - } - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ); - String aAuthorStr, aDateStr, aTextStr; - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - bNew = sal_False; - const SvxPostItAuthorItem& rAuthor = - (const SvxPostItAuthorItem&)rSet.Get( nWhich ); - aAuthorStr = rAuthor.GetValue(); - } - else - aAuthorStr = SvtUserOptions().GetID(); - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ); - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - const SvxPostItDateItem& rDate = - (const SvxPostItDateItem&)rSet.Get( nWhich ); - aDateStr = rDate.GetValue(); - } - else - { - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - aDateStr = aLocaleWrapper.getDate( Date() ); - } - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ); - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - const SvxPostItTextItem& rText = - (const SvxPostItTextItem&)rSet.Get( nWhich ); - aTextStr = rText.GetValue(); - } - - ShowLastAuthor(aAuthorStr, aDateStr); - aEditED.SetText( aTextStr.ConvertLineEnd() ); - - if ( !bNew ) - SetText( CUI_RESSTR( STR_NOTIZ_EDIT ) ); - else - // neu anlegen - SetText( CUI_RESSTR( STR_NOTIZ_INSERT ) ); - - FreeResource(); - - aEditED.SetAccessibleRelationLabeledBy(&aEditFT); - aEditED.SetAccessibleRelationMemberOf(&aPostItFL); - aAuthorBtn.SetAccessibleRelationMemberOf(&aPostItFL); -} - -// ----------------------------------------------------------------------- - -SvxPostItDialog::~SvxPostItDialog() -{ - delete pOutSet; - pOutSet = 0; -} - -// ----------------------------------------------------------------------- - -void SvxPostItDialog::ShowLastAuthor(const String& rAuthor, const String& rDate) -{ - String sTxt( rAuthor ); - sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - sTxt += rDate; - aLastEditFT.SetText( sTxt ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxPostItDialog::GetRanges() -{ - return pRanges; -} - -// ----------------------------------------------------------------------- - -void SvxPostItDialog::EnableTravel(sal_Bool bNext, sal_Bool bPrev) -{ - aPrevBtn.Enable(bPrev); - aNextBtn.Enable(bNext); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPostItDialog, PrevHdl, Button *, EMPTYARG ) -{ - aPrevHdlLink.Call( this ); - return 0; -} -IMPL_LINK_INLINE_END( SvxPostItDialog, PrevHdl, Button *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPostItDialog, NextHdl, Button *, EMPTYARG ) -{ - aNextHdlLink.Call( this ); - return 0; -} -IMPL_LINK_INLINE_END( SvxPostItDialog, NextHdl, Button *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPostItDialog, Stamp, Button *, EMPTYARG ) -{ - Date aDate; - Time aTime; - String aTmp( SvtUserOptions().GetID() ); - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - String aStr( aEditED.GetText() ); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) ); - - if ( aTmp.Len() > 0 ) - { - aStr += aTmp; - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - } - aStr += aLocaleWrapper.getDate(aDate); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - aStr += aLocaleWrapper.getTime(aTime, sal_False, sal_False); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ----\n" ) ); - - - aEditED.SetText( aStr.ConvertLineEnd() ); - xub_StrLen nLen = aStr.Len(); - aEditED.GrabFocus(); - aEditED.SetSelection( Selection( nLen, nLen ) ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPostItDialog, OKHdl, Button *, EMPTYARG ) -{ - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - pOutSet = new SfxItemSet( rSet ); - pOutSet->Put( SvxPostItAuthorItem( SvtUserOptions().GetID(), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) ); - pOutSet->Put( SvxPostItDateItem( aLocaleWrapper.getDate( Date() ), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ) ) ); - pOutSet->Put( SvxPostItTextItem( aEditED.GetText(), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ) ) ); - EndDialog( RET_OK ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/postdlg.hrc b/cui/source/dialogs/postdlg.hrc deleted file mode 100644 index e8d1ee737..000000000 --- a/cui/source/dialogs/postdlg.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_POSTDLG_HRC -#define _SVX_POSTDLG_HRC - -// defines ------------------------------------------------------------------ - -#define FT_LASTEDITLABEL 10 -#define FT_LASTEDIT 11 -#define FT_EDIT 12 -#define ED_EDIT 13 -#define FL_POSTIT 14 -#define BTN_PREV 15 -#define BTN_NEXT 16 -#define BTN_AUTHOR 17 -#define FT_AUTHOR 18 - -#define STR_NOTIZ_EDIT 20 -#define STR_NOTIZ_INSERT 21 - -#define BTN_POST_OK 30 -#define BTN_POST_CANCEL 31 -#define BTN_POST_HELP 32 - - -#endif diff --git a/cui/source/dialogs/postdlg.src b/cui/source/dialogs/postdlg.src deleted file mode 100644 index 4bfba6ec6..000000000 --- a/cui/source/dialogs/postdlg.src +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include <cuires.hrc> -#include "postdlg.hrc" -#include "helpid.hrc" -#include <svx/dialogs.hrc> // for RID_SVXDLG_POSTIT - - // RID_SVXDLG_POSTIT ----------------------------------------------------- -ModalDialog RID_SVXDLG_POSTIT -{ - HelpId = HID_POSTIT_DIALOG ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 198 , 134 ) ; - Text [ en-US ] = "Note" ; - Moveable = TRUE ; - FixedText FT_LASTEDITLABEL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "Author" ; - Left = TRUE ; - }; - FixedText FT_LASTEDIT - { - Pos = MAP_APPFONT ( 48 , 14 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Left = TRUE ; - }; - FixedText FT_EDIT - { - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "~Text" ; - Left = TRUE ; - }; - MultiLineEdit ED_EDIT - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_POSTIT:ED_EDIT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 38 ) ; - Size = MAP_APPFONT ( 123 , 72 ) ; - Left = TRUE ; - VScroll = TRUE ; - HScroll = TRUE ; - IgnoreTab = TRUE ; - }; - FixedLine FL_POSTIT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 129 , 8 ) ; - Text [ en-US ] = "Contents" ; - }; - OKButton BTN_POST_OK - { - Pos = MAP_APPFONT ( 141 , 6 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_POST_CANCEL - { - Pos = MAP_APPFONT ( 141 , 23 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - HelpButton BTN_POST_HELP - { - Pos = MAP_APPFONT ( 141 , 40 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - ImageButton BTN_PREV - { - HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_PREV"; - Pos = MAP_APPFONT ( 141 , 60 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_LEFT ; - }; - ImageButton BTN_NEXT - { - HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_NEXT"; - Pos = MAP_APPFONT ( 167 , 60 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_RIGHT ; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT ( 12 , 116 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Insert"; - }; - PushButton BTN_AUTHOR - { - HelpID = "cui:PushButton:RID_SVXDLG_POSTIT:BTN_AUTHOR"; - Pos = MAP_APPFONT ( 75 , 114 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Author" ; - }; - // lokale Strings - String STR_NOTIZ_EDIT - { - Text [ en-US ] = "Edit Note" ; - }; - String STR_NOTIZ_INSERT - { - Text [ en-US ] = "Insert note" ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx deleted file mode 100644 index 182e5bb02..000000000 --- a/cui/source/dialogs/scriptdlg.cxx +++ /dev/null @@ -1,1575 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/********************************************************************** - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <memory> - -#include <sfx2/objsh.hxx> -#include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> -#include <osl/mutex.hxx> - -#include <cuires.hrc> -#include "scriptdlg.hrc" -#include "scriptdlg.hxx" -#include <dialmgr.hxx> -#include "selector.hxx" - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> -#include <com/sun/star/script/provider/XScriptProvider.hpp> -#include <com/sun/star/script/browse/BrowseNodeTypes.hpp> -#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> -#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> -#include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp> -#include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp> -#include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/script/XInvocation.hpp> -#include <com/sun/star/document/XEmbeddedScripts.hpp> - -#include <cppuhelper/implbase1.hxx> -#include <comphelper/documentinfo.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/broadcasthelper.hxx> -#include <comphelper/propertycontainer.hxx> -#include <comphelper/proparrhlp.hxx> - -#include <basic/sbx.hxx> -#include <svtools/imagemgr.hxx> -#include <tools/urlobj.hxx> -#include <vector> -#include <algorithm> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::script; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; - -void ShowErrorDialog( const Any& aException ) -{ - SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException ); - pDlg->Execute(); - delete pDlg; -} - -SFTreeListBox::SFTreeListBox( Window* pParent, const ResId& rResId ) : - SvTreeListBox( pParent, ResId( rResId.GetId(),*rResId.GetResMgr() ) ), - m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())), - m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())), - m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())), - m_docImage(ResId(IMG_DOCUMENT,*rResId.GetResMgr())), - m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))), - m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr()))) -{ - FreeResource(); - SetSelectionMode( SINGLE_SELECTION ); - - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HIDESELECTION | - WB_HASLINES | WB_HASLINESATROOT ); - SetNodeDefaultImages(); - - nMode = 0xFF; // Alles -} - -SFTreeListBox::~SFTreeListBox() -{ - deleteAllTree(); -} - -void SFTreeListBox::delUserData( SvLBoxEntry* pEntry ) -{ - if ( pEntry ) - { - - String text = GetEntryText( pEntry ); - SFEntry* pUserData = (SFEntry*)pEntry->GetUserData(); - if ( pUserData ) - { - delete pUserData; - // TBD seem to get a Select event on node that is remove ( below ) - // so need to be able to detect that this node is not to be - // processed in order to do this, setting userData to NULL ( must - // be a better way to do this ) - pUserData = 0; - pEntry->SetUserData( pUserData ); - } - } -} - -void SFTreeListBox::deleteTree( SvLBoxEntry* pEntry ) -{ - - delUserData( pEntry ); - pEntry = FirstChild( pEntry ); - while ( pEntry ) - { - SvLBoxEntry* pNextEntry = NextSibling( pEntry ); - deleteTree( pEntry ); - GetModel()->Remove( pEntry ); - pEntry = pNextEntry; - } -} - -void SFTreeListBox::deleteAllTree() -{ - SvLBoxEntry* pEntry = GetEntry( 0 ); - - // TBD - below is a candidate for a destroyAllTrees method - if ( pEntry ) - { - while ( pEntry ) - { - String text = GetEntryText( pEntry ); - SvLBoxEntry* pNextEntry = NextSibling( pEntry ) ; - deleteTree( pEntry ); - GetModel()->Remove( pEntry ); - pEntry = pNextEntry; - } - } -} - -void SFTreeListBox::Init( const ::rtl::OUString& language ) -{ - SetUpdateMode( sal_False ); - - deleteAllTree(); - - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext > xCtx; - - Sequence< Reference< browse::XBrowseNode > > children; - - ::rtl::OUString userStr( RTL_CONSTASCII_USTRINGPARAM("user") ); - ::rtl::OUString shareStr( RTL_CONSTASCII_USTRINGPARAM("share") ); - - ::rtl::OUString singleton( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.browse.theBrowseNodeFactory" ) ); - - try - { - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - - xCtx.set( xProps->getPropertyValue( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW ); - - Reference< browse::XBrowseNodeFactory > xFac( - xCtx->getValueByName( singleton ), UNO_QUERY_THROW ); - - rootNode.set( xFac->createView( - browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) ); - - if ( rootNode.is() && rootNode->hasChildNodes() == sal_True ) - { - children = rootNode->getChildNodes(); - } - } - catch( Exception& e ) - { - OSL_TRACE("Exception getting root browse node from factory: %s", - ::rtl::OUStringToOString( - e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - // TODO exception handling - } - - Reference<XModel> xDocumentModel; - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - bool app = false; - ::rtl::OUString uiName = children[ n ]->getName(); - ::rtl::OUString factoryURL; - if ( uiName.equals( userStr ) || uiName.equals( shareStr ) ) - { - app = true; - if ( uiName.equals( userStr ) ) - { - uiName = m_sMyMacros; - } - else - { - uiName = m_sProdMacros; - } - } - else - { - xDocumentModel.set(getDocumentModel(xCtx, uiName ), UNO_QUERY); - - if ( xDocumentModel.is() ) - { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( xCtx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager") ), xCtx ), - UNO_QUERY_THROW ); - - Reference<container::XNameAccess> xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); - // get the long name of the document: - Sequence<beans::PropertyValue> moduleDescr; - try{ - ::rtl::OUString appModule = xModuleManager->identify( xDocumentModel ); - xModuleConfig->getByName(appModule) >>= moduleDescr; - } catch(const uno::Exception&) - {} - - beans::PropertyValue const * pmoduleDescr = - moduleDescr.getConstArray(); - for ( sal_Int32 pos = moduleDescr.getLength(); pos--; ) - { - if (pmoduleDescr[ pos ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "ooSetupFactoryEmptyDocumentURL") )) - { - pmoduleDescr[ pos ].Value >>= factoryURL; - break; - } - } - } - } - - ::rtl::OUString lang( language ); - Reference< browse::XBrowseNode > langEntries = - getLangNodeFromRootNode( children[ n ], lang ); - - insertEntry( uiName, app ? IMG_HARDDISK : IMG_DOCUMENT, - 0, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL ); - } - - SetUpdateMode( sal_True ); -} - -Reference< XInterface > -SFTreeListBox::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName ) -{ - Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), xCtx ), - UNO_QUERY ); - - Reference< container::XEnumerationAccess > componentsAccess = - desktop->getComponents(); - Reference< container::XEnumeration > components = - componentsAccess->createEnumeration(); - while (components->hasMoreElements()) - { - Reference< frame::XModel > model( - components->nextElement(), UNO_QUERY ); - if ( model.is() ) - { - ::rtl::OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model ); - if( sTdocUrl.equals( docName ) ) - { - xModel = model; - break; - } - } - } - return xModel; -} - -Reference< browse::XBrowseNode > -SFTreeListBox::getLangNodeFromRootNode( Reference< browse::XBrowseNode >& rootNode, ::rtl::OUString& language ) -{ - Reference< browse::XBrowseNode > langNode; - - try - { - Sequence < Reference< browse::XBrowseNode > > children = rootNode->getChildNodes(); - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - if ( children[ n ]->getName().equals( language ) ) - { - langNode = children[ n ]; - break; - } - } - } - catch ( Exception& ) - { - // if getChildNodes() throws an exception we just return - // the empty Reference - } - return langNode; -} - -void SFTreeListBox:: RequestSubEntries( SvLBoxEntry* pRootEntry, Reference< ::com::sun::star::script::browse::XBrowseNode >& node, - Reference< XModel >& model ) -{ - if (! node.is() ) - { - return; - } - - Sequence< Reference< browse::XBrowseNode > > children; - try - { - children = node->getChildNodes(); - } - catch ( Exception& ) - { - // if we catch an exception in getChildNodes then no entries are added - } - - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - ::rtl::OUString name( children[ n ]->getName() ); - if ( children[ n ]->getType() != browse::BrowseNodeTypes::SCRIPT) - { - insertEntry( name, IMG_LIB, pRootEntry, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, children[ n ],model ))); - } - else - { - if ( children[ n ]->getType() == browse::BrowseNodeTypes::SCRIPT ) - { - insertEntry( name, IMG_MACRO, pRootEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, children[ n ],model ))); - - } - } - } -} - -long SFTreeListBox::ExpandingHdl() -{ - return sal_True; -} - -void SFTreeListBox::ExpandAllTrees() -{ -} - -SvLBoxEntry * SFTreeListBox::insertEntry( - String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent, - bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData, ::rtl::OUString factoryURL ) -{ - SvLBoxEntry * p; - if( nBitmap == IMG_DOCUMENT && factoryURL.getLength() > 0 ) - { - Image aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL), false ); - p = InsertEntry( - rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release()); // XXX possible leak - } - else - { - p = insertEntry( rText, nBitmap, pParent, bChildrenOnDemand, aUserData ); - } - return p; -} - -SvLBoxEntry * SFTreeListBox::insertEntry( - String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent, - bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData ) -{ - Image aImage; - if( nBitmap == IMG_HARDDISK ) - { - aImage = m_hdImage; - } - else if( nBitmap == IMG_LIB ) - { - aImage = m_libImage; - } - else if( nBitmap == IMG_MACRO ) - { - aImage = m_macImage; - } - else if( nBitmap == IMG_DOCUMENT ) - { - aImage = m_docImage; - } - SvLBoxEntry * p = InsertEntry( - rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release()); // XXX possible leak - return p; -} - -void SFTreeListBox::RequestingChilds( SvLBoxEntry* pEntry ) -{ - SFEntry* userData = 0; - if ( !pEntry ) - { - return; - } - userData = (SFEntry*)pEntry->GetUserData(); - - Reference< browse::XBrowseNode > node; - Reference< XModel > model; - if ( userData && !userData->isLoaded() ) - { - node = userData->GetNode(); - model = userData->GetModel(); - RequestSubEntries( pEntry, node, model ); - userData->setLoaded(); - } -} - -void SFTreeListBox::ExpandedHdl() -{ -} - -// ---------------------------------------------------------------------------- -// InputDialog ------------------------------------------------------------ -// ---------------------------------------------------------------------------- -InputDialog::InputDialog(Window * pParent, sal_uInt16 nMode ) - : ModalDialog( pParent, CUI_RES( RID_DLG_NEWLIB ) ), - aText( this, CUI_RES( FT_NEWLIB ) ), - aEdit( this, CUI_RES( ED_LIBNAME ) ), - aOKButton( this, CUI_RES( PB_OK ) ), - aCancelButton( this, CUI_RES( PB_CANCEL ) ) -{ - aEdit.GrabFocus(); - if ( nMode == INPUTMODE_NEWLIB ) - { - SetText( String( CUI_RES( STR_NEWLIB ) ) ); - } - else if ( nMode == INPUTMODE_NEWMACRO ) - { - SetText( String( CUI_RES( STR_NEWMACRO ) ) ); - aText.SetText( String( CUI_RES( STR_FT_NEWMACRO ) ) ); - } - else if ( nMode == INPUTMODE_RENAME ) - { - SetText( String( CUI_RES( STR_RENAME ) ) ); - aText.SetText( String( CUI_RES( STR_FT_RENAME ) ) ); - } - FreeResource(); - - // some resizing so that the text fits - Point point, newPoint; - Size siz, newSiz; - long gap; - - sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | - TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK; - - // get dimensions of dialog instructions control - point = aText.GetPosPixel(); - siz = aText.GetSizePixel(); - - // get dimensions occupied by text in the control - Rectangle rect = - GetTextRect( Rectangle( point, siz ), aText.GetText(), style ); - newSiz = rect.GetSize(); - - // the gap is the difference between the text width and its control width - gap = siz.Height() - newSiz.Height(); - - //resize the text field - newSiz = Size( siz.Width(), siz.Height() - gap ); - aText.SetSizePixel( newSiz ); - - //move the OK & cancel buttons - point = aEdit.GetPosPixel(); - newPoint = Point( point.X(), point.Y() - gap ); - aEdit.SetPosPixel( newPoint ); - -} - -InputDialog::~InputDialog() -{ -} -// ---------------------------------------------------------------------------- -// ScriptOrgDialog ------------------------------------------------------------ -// ---------------------------------------------------------------------------- -SvxScriptOrgDialog::SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language ) - : SfxModalDialog( pParent, CUI_RES( RID_DLG_SCRIPTORGANIZER ) ), - aScriptsTxt( this, CUI_RES( SF_TXT_SCRIPTS ) ), - aScriptsBox( this, CUI_RES( SF_CTRL_SCRIPTSBOX ) ), - aRunButton( this, CUI_RES( SF_PB_RUN ) ), - aCloseButton( this, CUI_RES( SF_PB_CLOSE ) ), - aCreateButton( this, CUI_RES( SF_PB_CREATE ) ), - aEditButton( this, CUI_RES( SF_PB_EDIT ) ), - aRenameButton(this, CUI_RES( SF_PB_RENAME ) ), - aDelButton( this, CUI_RES( SF_PB_DEL ) ), - aHelpButton( this, CUI_RES( SF_PB_HELP ) ), - m_sLanguage( language ), - m_delErrStr( CUI_RES( RID_SVXSTR_DELFAILED ) ), - m_delErrTitleStr( CUI_RES( RID_SVXSTR_DELFAILED_TITLE ) ), - m_delQueryStr( CUI_RES( RID_SVXSTR_DELQUERY ) ), - m_delQueryTitleStr( CUI_RES( RID_SVXSTR_DELQUERY_TITLE ) ) , - m_createErrStr( CUI_RES ( RID_SVXSTR_CREATEFAILED ) ), - m_createDupStr( CUI_RES ( RID_SVXSTR_CREATEFAILEDDUP ) ), - m_createErrTitleStr( CUI_RES( RID_SVXSTR_CREATEFAILED_TITLE ) ), - m_renameErrStr( CUI_RES ( RID_SVXSTR_RENAMEFAILED ) ), - m_renameErrTitleStr( CUI_RES( RID_SVXSTR_RENAMEFAILED_TITLE ) ) -{ - - // must be a neater way to deal with the strings than as above - // append the language to the dialog title - String winTitle( GetText() ); - winTitle.SearchAndReplace( String::CreateFromAscii( "%MACROLANG" ), language.pData->buffer ); - SetText( winTitle ); - - aScriptsBox.SetSelectHdl( LINK( this, SvxScriptOrgDialog, ScriptSelectHdl ) ); - aRunButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aCloseButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aRenameButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aEditButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aDelButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aCreateButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - - aRunButton.Disable(); - aRenameButton.Disable(); - aEditButton.Disable(); - aDelButton.Disable(); - aCreateButton.Disable(); - - aScriptsBox.Init( m_sLanguage ); - RestorePreviousSelection(); - FreeResource(); -} - -SvxScriptOrgDialog::~SvxScriptOrgDialog() -{ - // clear the SelectHdl so that it isn't called during the dtor - aScriptsBox.SetSelectHdl( Link() ); -}; - -short SvxScriptOrgDialog::Execute() -{ - - SfxObjectShell *pDoc = SfxObjectShell::GetFirst(); - - // force load of MSPs for all documents - while ( pDoc ) - { - Reference< provider::XScriptProviderSupplier > xSPS = - Reference< provider::XScriptProviderSupplier > - ( pDoc->GetModel(), UNO_QUERY ); - if ( xSPS.is() ) - { - Reference< provider::XScriptProvider > ScriptProvider = - xSPS->getScriptProvider(); - } - - pDoc = SfxObjectShell::GetNext(*pDoc); - } - aScriptsBox.ExpandAllTrees(); - - Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = ModalDialog::Execute(); - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; -} - -void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode >& node ) -{ - if ( node.is() ) - { - if ( node->getType() == browse::BrowseNodeTypes::SCRIPT) - { - aRunButton.Enable(); - } - else - { - aRunButton.Disable(); - } - Reference< beans::XPropertySet > xProps( node, UNO_QUERY ); - - if ( !xProps.is() ) - { - aEditButton.Disable(); - aDelButton.Disable(); - aCreateButton.Disable(); - aRunButton.Disable(); - return; - } - - ::rtl::OUString sName; - sName = String::CreateFromAscii("Editable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aEditButton.Enable(); - } - else - { - aEditButton.Disable(); - } - - sName = String::CreateFromAscii("Deletable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aDelButton.Enable(); - } - else - { - aDelButton.Disable(); - } - - sName = String::CreateFromAscii("Creatable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aCreateButton.Enable(); - } - else - { - aCreateButton.Disable(); - } - - sName = String::CreateFromAscii("Renamable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aRenameButton.Enable(); - } - else - { - aRenameButton.Disable(); - } - } - else - { - // no node info available, disable all configurable actions - aDelButton.Disable(); - aCreateButton.Disable(); - aEditButton.Disable(); - aRunButton.Disable(); - aRenameButton.Disable(); - } -} - -IMPL_LINK_INLINE_START( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) -{ - return 0; -} - -IMPL_LINK_INLINE_END( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) - -IMPL_LINK( SvxScriptOrgDialog, ScriptSelectHdl, SvTreeListBox *, pBox ) -{ - if ( !pBox->IsSelected( pBox->GetHdlEntry() ) ) - { - return 0; - } - - SvLBoxEntry* pEntry = pBox->GetHdlEntry(); - - SFEntry* userData = 0; - if ( !pEntry ) - { - return 0; - } - userData = (SFEntry*)pEntry->GetUserData(); - - Reference< browse::XBrowseNode > node; - if ( userData ) - { - node = userData->GetNode(); - CheckButtons( node ); - } - - return 0; -} - -IMPL_LINK( SvxScriptOrgDialog, ButtonHdl, Button *, pButton ) -{ - if ( pButton == &aCloseButton ) - { - StoreCurrentSelection(); - EndDialog( 0 ); - } - if ( pButton == &aEditButton || - pButton == &aCreateButton || - pButton == &aDelButton || - pButton == &aRunButton || - pButton == &aRenameButton ) - - { - if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) ) - { - SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry(); - SFEntry* userData = 0; - if ( !pEntry ) - { - return 0; - } - userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - Reference< browse::XBrowseNode > node; - Reference< XModel > xModel; - - node = userData->GetNode(); - xModel = userData->GetModel(); - - if ( !node.is() ) - { - return 0; - } - - if ( pButton == &aRunButton ) - { - ::rtl::OUString tmpString; - Reference< beans::XPropertySet > xProp( node, UNO_QUERY ); - Reference< provider::XScriptProvider > mspNode; - if( !xProp.is() ) - { - return 0; - } - - if ( xModel.is() ) - { - Reference< XEmbeddedScripts > xEmbeddedScripts( xModel, UNO_QUERY); - if( !xEmbeddedScripts.is() ) - { - return 0; - } - - if (!xEmbeddedScripts->getAllowMacroExecution()) - { - // Please FIXME: Show a message box if AllowMacroExecution is false - return 0; - } - } - - - SvLBoxEntry* pParent = aScriptsBox.GetParent( pEntry ); - while ( pParent && !mspNode.is() ) - { - SFEntry* mspUserData = (SFEntry*)pParent->GetUserData(); - mspNode.set( mspUserData->GetNode() , UNO_QUERY ); - pParent = aScriptsBox.GetParent( pParent ); - } - xProp->getPropertyValue( String::CreateFromAscii("URI" ) ) >>= tmpString; - const String scriptURL( tmpString ); - - if ( mspNode.is() ) - { - try - { - Reference< provider::XScript > xScript( - mspNode->getScript( scriptURL ), UNO_QUERY_THROW ); - - const Sequence< Any > args(0); - Any aRet; - Sequence< sal_Int16 > outIndex; - Sequence< Any > outArgs( 0 ); - aRet = xScript->invoke( args, outIndex, outArgs ); - } - catch ( reflection::InvocationTargetException& ite ) - { - ::com::sun::star::uno::Any a = makeAny(ite); - ShowErrorDialog(a); - } - catch ( provider::ScriptFrameworkErrorException& ite ) - { - ::com::sun::star::uno::Any a = makeAny(ite); - ShowErrorDialog(a); - } - catch ( RuntimeException& re ) - { - ::com::sun::star::uno::Any a = makeAny(re); - ShowErrorDialog(a); - } - catch ( Exception& e ) - { - ::com::sun::star::uno::Any a = makeAny(e); - ShowErrorDialog(a); - } - } - StoreCurrentSelection(); - EndDialog( 0 ); - } - else if ( pButton == &aEditButton ) - { - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - if ( xInv.is() ) - { - StoreCurrentSelection(); - EndDialog( 0 ); - Sequence< Any > args(0); - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - // ISSUE need code to run script here - xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Editable" ) ), args, outIndex, outArgs ); - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - } - } - } - else if ( pButton == &aCreateButton ) - { - createEntry( pEntry ); - } - else if ( pButton == &aDelButton ) - { - deleteEntry( pEntry ); - } - else if ( pButton == &aRenameButton ) - { - renameEntry( pEntry ); - } - } - } - } - return 0; -} - -Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode( SvLBoxEntry* pEntry ) -{ - Reference< browse::XBrowseNode > node; - if ( pEntry ) - { - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - node = userData->GetNode(); - } - } - - return node; -} - -Reference< XModel > SvxScriptOrgDialog::getModel( SvLBoxEntry* pEntry ) -{ - Reference< XModel > model; - if ( pEntry ) - { - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - model = userData->GetModel(); - } - } - - return model; -} - -void SvxScriptOrgDialog::createEntry( SvLBoxEntry* pEntry ) -{ - - Reference< browse::XBrowseNode > aChildNode; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - - if ( xInv.is() ) - { - ::rtl::OUString aNewName; - ::rtl::OUString aNewStdName; - sal_uInt16 nMode = INPUTMODE_NEWLIB; - if( aScriptsBox.GetModel()->GetDepth( pEntry ) == 0 ) - { - aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Library") ) ; - } - else - { - aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Macro") ) ; - nMode = INPUTMODE_NEWMACRO; - } - //do we need L10N for this? ie somethng like: - //String aNewStdName( ResId( STR_STDMODULENAME ) ); - sal_Bool bValid = sal_False; - sal_uInt16 i = 1; - - Sequence< Reference< browse::XBrowseNode > > childNodes; - // no children => ok to create Parcel1 or Script1 without checking - try - { - if( node->hasChildNodes() == sal_False ) - { - aNewName = aNewStdName; - aNewName += String::CreateFromInt32( i ); - bValid = sal_True; - } - else - { - childNodes = node->getChildNodes(); - } - } - catch ( Exception& ) - { - // ignore, will continue on with empty sequence - } - - ::rtl::OUString extn; - while ( !bValid ) - { - aNewName = aNewStdName; - aNewName += String::CreateFromInt32( i ); - sal_Bool bFound = sal_False; - if(childNodes.getLength() > 0 ) - { - ::rtl::OUString nodeName = childNodes[0]->getName(); - sal_Int32 extnPos = nodeName.lastIndexOf( '.' ); - if(extnPos>0) - extn = nodeName.copy(extnPos); - } - for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) - { - if ( (aNewName+extn).equals( childNodes[index]->getName() ) ) - { - bFound = sal_True; - break; - } - } - if( bFound ) - { - i++; - } - else - { - bValid = sal_True; - } - } - - std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) ); - xNewDlg->SetObjectName( aNewName ); - - do - { - if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() ) - { - ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName(); - bValid = sal_True; - for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) - { - if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) ) - { - bValid = sal_False; - String aError( m_createErrStr ); - aError.Append( m_createDupStr ); - ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_createErrTitleStr ); - aErrorBox.Execute(); - xNewDlg->SetObjectName( aNewName ); - break; - } - } - if( bValid ) - aNewName = aUserSuppliedName; - } - else - { - // user hit cancel or hit OK with nothing in the editbox - - return; - } - } - while ( !bValid ); - - // open up parent node (which ensures it's loaded) - aScriptsBox.RequestingChilds( pEntry ); - - Sequence< Any > args( 1 ); - args[ 0 ] <<= aNewName; - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creatable") ), args, outIndex, outArgs ); - Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY ); - aChildNode = newNode; - - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to Create %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - if ( aChildNode.is() ) - { - String aChildName = aChildNode->getName(); - SvLBoxEntry* pNewEntry = NULL; - - - ::rtl::OUString name( aChildName ); - Reference<XModel> xDocumentModel = getModel( pEntry ); - - // ISSUE do we need to remove all entries for parent - // to achieve sort? Just need to determine position - // SvTreeListBox::InsertEntry can take position arg - // -- Basic doesn't do this on create. - // Suppose we could avoid this too. -> created nodes are - // not in alphabetical order - if ( aChildNode->getType() == browse::BrowseNodeTypes::SCRIPT ) - { - pNewEntry = aScriptsBox.insertEntry( aChildName, - IMG_MACRO, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ) ); - - } - else - { - pNewEntry = aScriptsBox.insertEntry( aChildName, - IMG_LIB, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ) ); - // If the Parent is not loaded then set to - // loaded, this will prevent RequestingChilds ( called - // from vcl via RequestingChilds ) from - // creating new ( duplicate ) children - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData && !userData->isLoaded() ) - { - userData->setLoaded(); - } - } - aScriptsBox.SetCurEntry( pNewEntry ); - aScriptsBox.Select( aScriptsBox.GetCurEntry() ); - - } - else - { - //ISSUE L10N & message from exception? - String aError( m_createErrStr ); - ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_createErrTitleStr ); - aErrorBox.Execute(); - } -} - -void SvxScriptOrgDialog::renameEntry( SvLBoxEntry* pEntry ) -{ - - Reference< browse::XBrowseNode > aChildNode; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - - if ( xInv.is() ) - { - ::rtl::OUString aNewName = node->getName(); - sal_Int32 extnPos = aNewName.lastIndexOf( '.' ); - ::rtl::OUString extn; - if(extnPos>0) - { - extn = aNewName.copy(extnPos); - aNewName = aNewName.copy(0,extnPos); - } - sal_uInt16 nMode = INPUTMODE_RENAME; - - std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) ); - xNewDlg->SetObjectName( aNewName ); - - sal_Bool bValid; - do - { - if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() ) - { - ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName(); - bValid = sal_True; - if( bValid ) - aNewName = aUserSuppliedName; - } - else - { - // user hit cancel or hit OK with nothing in the editbox - return; - } - } - while ( !bValid ); - - Sequence< Any > args( 1 ); - args[ 0 ] <<= aNewName; - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Renamable") ), args, outIndex, outArgs ); - Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY ); - aChildNode = newNode; - - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to Rename %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - if ( aChildNode.is() ) - { - aScriptsBox.SetEntryText( pEntry, aChildNode->getName() ); - aScriptsBox.SetCurEntry( pEntry ); - aScriptsBox.Select( aScriptsBox.GetCurEntry() ); - - } - else - { - //ISSUE L10N & message from exception? - String aError( m_renameErrStr ); - ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_renameErrTitleStr ); - aErrorBox.Execute(); - } -} -void SvxScriptOrgDialog::deleteEntry( SvLBoxEntry* pEntry ) -{ - sal_Bool result = sal_False; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - // ISSUE L10N string & can we centre list? - String aQuery( m_delQueryStr ); - aQuery.Append( getListOfChildren( node, 0 ) ); - QueryBox aQueryBox( static_cast<Window*>(this), WB_YES_NO | WB_DEF_YES, aQuery ); - aQueryBox.SetText( m_delQueryTitleStr ); - if ( aQueryBox.Execute() == RET_NO ) - { - return; - } - - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - if ( xInv.is() ) - { - Sequence< Any > args( 0 ); - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deletable") ), args, outIndex, outArgs ); - aResult >>= result; // or do we just assume true if no exception ? - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to delete %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - - if ( result == sal_True ) - { - aScriptsBox.deleteTree( pEntry ); - aScriptsBox.GetModel()->Remove( pEntry ); - } - else - { - //ISSUE L10N & message from exception? - ErrorBox aErrorBox( static_cast<Window*>(this), WB_OK | RET_OK, m_delErrStr ); - aErrorBox.SetText( m_delErrTitleStr ); - aErrorBox.Execute(); - } - -} - -sal_Bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet >& xProps, - ::rtl::OUString& propName ) -{ - sal_Bool result = false; - try - { - sal_Bool bTemp = sal_False; - xProps->getPropertyValue( propName ) >>= bTemp; - result = ( bTemp == sal_True ); - } - catch ( Exception& ) - { - return result; - } - return result; -} - -String SvxScriptOrgDialog::getListOfChildren( Reference< browse::XBrowseNode > node, int depth ) -{ - String result; - result.Append( String::CreateFromAscii( "\n" ) ); - for( int i=0;i<=depth;i++ ) - { - result.Append( String::CreateFromAscii( "\t" ) ); - } - result.Append( String( node->getName() ) ); - - try - { - if ( node->hasChildNodes() == sal_True ) - { - Sequence< Reference< browse::XBrowseNode > > children - = node->getChildNodes(); - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - result.Append( getListOfChildren( children[ n ] , depth+1 ) ); - } - } - } - catch ( Exception& ) - { - // ignore, will return an empty string - } - - return result; -} - -Selection_hash SvxScriptOrgDialog::m_lastSelection; - -void SvxScriptOrgDialog::StoreCurrentSelection() -{ - String aDescription; - if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) ) - { - SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry(); - while( pEntry ) - { - aDescription.Insert( aScriptsBox.GetEntryText( pEntry ), 0 ); - pEntry = aScriptsBox.GetParent( pEntry ); - if ( pEntry ) - aDescription.Insert( ';', 0 ); - } - ::rtl::OUString sDesc( aDescription ); - m_lastSelection[ m_sLanguage ] = sDesc; - } -} - -void SvxScriptOrgDialog::RestorePreviousSelection() -{ - String aStoredEntry = String( m_lastSelection[ m_sLanguage ] ); - if( aStoredEntry.Len() <= 0 ) - return; - SvLBoxEntry* pEntry = 0; - sal_uInt16 nIndex = 0; - while ( nIndex != STRING_NOTFOUND ) - { - String aTmp( aStoredEntry.GetToken( 0, ';', nIndex ) ); - SvLBoxEntry* pTmpEntry = aScriptsBox.FirstChild( pEntry ); - ::rtl::OUString debugStr(aTmp); - while ( pTmpEntry ) - { - debugStr = ::rtl::OUString(aScriptsBox.GetEntryText( pTmpEntry )); - if ( aScriptsBox.GetEntryText( pTmpEntry ) == aTmp ) - { - pEntry = pTmpEntry; - break; - } - pTmpEntry = aScriptsBox.NextSibling( pTmpEntry ); - } - if ( !pTmpEntry ) - break; - aScriptsBox.RequestingChilds( pEntry ); - } - aScriptsBox.SetCurEntry( pEntry ); -} - -::rtl::OUString ReplaceString( - const ::rtl::OUString& source, - const ::rtl::OUString& token, - const ::rtl::OUString& value ) -{ - sal_Int32 pos = source.indexOf( token ); - - if ( pos != -1 && value.getLength() != 0 ) - { - return source.replaceAt( pos, token.getLength(), value ); - } - else - { - return source; - } -} - -::rtl::OUString FormatErrorString( - const ::rtl::OUString& unformatted, - const ::rtl::OUString& language, - const ::rtl::OUString& script, - const ::rtl::OUString& line, - const ::rtl::OUString& type, - const ::rtl::OUString& message ) -{ - ::rtl::OUString result = unformatted.copy( 0 ); - - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language ); - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%SCRIPTNAME") ), script ); - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LINENUMBER") ), line ); - - if ( type.getLength() != 0 ) - { - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") ); - result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_TYPE_LABEL))); - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ); - result += type; - } - - if ( message.getLength() != 0 ) - { - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") ); - result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_MESSAGE_LABEL))); - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ); - result += message; - } - - return result; -} - -::rtl::OUString GetErrorMessage( - const provider::ScriptErrorRaisedException& eScriptError ) -{ - ::rtl::OUString unformatted = String( CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) ); - - ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - ::rtl::OUString language = unknown; - ::rtl::OUString script = unknown; - ::rtl::OUString line = unknown; - ::rtl::OUString type = ::rtl::OUString(); - ::rtl::OUString message = eScriptError.Message; - - if ( eScriptError.language.getLength() != 0 ) - { - language = eScriptError.language; - } - - if ( eScriptError.scriptName.getLength() != 0 ) - { - script = eScriptError.scriptName; - } - - if ( eScriptError.Message.getLength() != 0 ) - { - message = eScriptError.Message; - } - if ( eScriptError.lineNum != -1 ) - { - line = ::rtl::OUString::valueOf( eScriptError.lineNum ); - unformatted = String( - CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) ); - } - else - { - unformatted = String( - CUI_RES( RID_SVXSTR_ERROR_RUNNING ) ); - } - - return FormatErrorString( - unformatted, language, script, line, type, message ); -} - -::rtl::OUString GetErrorMessage( - const provider::ScriptExceptionRaisedException& eScriptException ) -{ - ::rtl::OUString unformatted = - String( CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) ); - - ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - ::rtl::OUString language = unknown; - ::rtl::OUString script = unknown; - ::rtl::OUString line = unknown; - ::rtl::OUString type = unknown; - ::rtl::OUString message = eScriptException.Message; - - if ( eScriptException.language.getLength() != 0 ) - { - language = eScriptException.language; - } - if ( eScriptException.scriptName.getLength() != 0 ) - { - script = eScriptException.scriptName; - } - - if ( eScriptException.Message.getLength() != 0 ) - { - message = eScriptException.Message; - } - - if ( eScriptException.lineNum != -1 ) - { - line = ::rtl::OUString::valueOf( eScriptException.lineNum ); - unformatted = String( - CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) ); - } - else - { - unformatted = String( - CUI_RES( RID_SVXSTR_EXCEPTION_RUNNING ) ); - } - - if ( eScriptException.exceptionType.getLength() != 0 ) - { - type = eScriptException.exceptionType; - } - - return FormatErrorString( - unformatted, language, script, line, type, message ); - -} -::rtl::OUString GetErrorMessage( - const provider::ScriptFrameworkErrorException& sError ) -{ - ::rtl::OUString unformatted = String( - CUI_RES( RID_SVXSTR_FRAMEWORK_ERROR_RUNNING ) ); - - ::rtl::OUString language( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - - ::rtl::OUString script( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - - ::rtl::OUString message; - - if ( sError.scriptName.getLength() > 0 ) - { - script = sError.scriptName; - } - if ( sError.language.getLength() > 0 ) - { - language = sError.language; - } - if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED ) - { - message = String( - CUI_RES( RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED ) ); - message = ReplaceString( - message, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language ); - - } - else - { - message = sError.Message; - } - return FormatErrorString( - unformatted, language, script, ::rtl::OUString(), ::rtl::OUString(), message ); -} - -::rtl::OUString GetErrorMessage( const RuntimeException& re ) -{ - Type t = ::getCppuType( &re ); - ::rtl::OUString message = t.getTypeName(); - message += re.Message; - - return message; -} - -::rtl::OUString GetErrorMessage( const Exception& e ) -{ - Type t = ::getCppuType( &e ); - ::rtl::OUString message = t.getTypeName(); - message += e.Message; - - return message; -} - -::rtl::OUString GetErrorMessage( const com::sun::star::uno::Any& aException ) -{ - ::rtl::OUString exType; - if ( aException.getValueType() == - ::getCppuType( (const reflection::InvocationTargetException* ) NULL ) ) - { - reflection::InvocationTargetException ite; - aException >>= ite; - if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptErrorRaisedException* ) NULL ) ) - { - // Error raised by script - provider::ScriptErrorRaisedException scriptError; - ite.TargetException >>= scriptError; - return GetErrorMessage( scriptError ); - } - else if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptExceptionRaisedException* ) NULL ) ) - { - // Exception raised by script - provider::ScriptExceptionRaisedException scriptException; - ite.TargetException >>= scriptException; - return GetErrorMessage( scriptException ); - } - else - { - // Unknown error, shouldn't happen - // OSL_ASSERT(...) - } - - } - else if ( aException.getValueType() == ::getCppuType( ( const provider::ScriptFrameworkErrorException* ) NULL ) ) - { - // A Script Framework error has occurred - provider::ScriptFrameworkErrorException sfe; - aException >>= sfe; - return GetErrorMessage( sfe ); - - } - // unknown exception - Exception e; - RuntimeException rte; - if ( aException >>= rte ) - { - return GetErrorMessage( rte ); - } - - aException >>= e; - return GetErrorMessage( e ); - -} - -SvxScriptErrorDialog::SvxScriptErrorDialog( - Window* , ::com::sun::star::uno::Any aException ) - : m_sMessage() -{ - SolarMutexGuard aGuard; - m_sMessage = GetErrorMessage( aException ); -} - -SvxScriptErrorDialog::~SvxScriptErrorDialog() -{ -} - -short SvxScriptErrorDialog::Execute() -{ - // Show Error dialog asynchronously - // - // Pass a copy of the message to the ShowDialog method as the - // SvxScriptErrorDialog may be deleted before ShowDialog is called - Application::PostUserEvent( - LINK( this, SvxScriptErrorDialog, ShowDialog ), - new rtl::OUString( m_sMessage ) ); - - return 0; -} - -IMPL_LINK( SvxScriptErrorDialog, ShowDialog, ::rtl::OUString*, pMessage ) -{ - ::rtl::OUString message; - - if ( pMessage && pMessage->getLength() != 0 ) - { - message = *pMessage; - } - else - { - message = String( CUI_RES( RID_SVXSTR_ERROR_TITLE ) ); - } - - MessBox* pBox = new WarningBox( NULL, WB_OK, message ); - pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) ); - pBox->Execute(); - - if ( pBox ) delete pBox; - if ( pMessage ) delete pMessage; - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/scriptdlg.hrc b/cui/source/dialogs/scriptdlg.hrc deleted file mode 100644 index 5b217bbe9..000000000 --- a/cui/source/dialogs/scriptdlg.hrc +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SCRIPTDLG_HRC -#define _SCRIPTDLG_HRC - -#include <svl/solar.hrc> - -#define SCRIPTDLG_OFFSET 400 - -// ScriptOrgDialog -#define SF_TXT_SCRIPTS 1 -#define SF_CTRL_SCRIPTSBOX 2 -#define SF_PB_RUN 3 -#define SF_PB_CLOSE 4 -#define SF_PB_CREATE 5 -#define SF_PB_EDIT 6 -#define SF_PB_RENAME 7 -#define SF_PB_DEL 8 -#define SF_PB_HELP 9 - -#define IMG_HARDDISK 1 -#define IMG_LIB 3 -#define IMG_MACRO 5 -#define IMG_DOCUMENT 7 - -#define RID_IMGLST_OBJECTS ( RID_BASICIDE_START + 7 ) -#define RID_IMGLST_OBJECTS_HC (RID_BASICIDE_START + 13) - -// NewObjectDialog -#define FT_NEWLIB 10 -#define STR_FT_NEWMACRO 11 -#define STR_NEWLIB 12 -#define STR_NEWMACRO 13 -#define ED_LIBNAME 14 -#define PB_OK 15 -#define PB_CANCEL 16 -#define DLG_NEWLIB 17 -#define STR_FT_RENAME 18 -#define STR_RENAME 19 - -// Others -/* -Please be aware that these strings are global resources, don't use self-defined values! -You have to use the RID_SVXSTART macro do avoid ID clashes with other resource files. Sfx2 delivers -some of its own resource files to svx - where they are added to svx resource file!! -*/ - -#define STR_MYMACROS 32 -#define STR_PRODMACROS 33 - - -#endif // _SCRIPTDLG_HRC diff --git a/cui/source/dialogs/scriptdlg.src b/cui/source/dialogs/scriptdlg.src deleted file mode 100644 index 0c58be37e..000000000 --- a/cui/source/dialogs/scriptdlg.src +++ /dev/null @@ -1,294 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <cuires.hrc> -#include "scriptdlg.hrc" -#include "helpid.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -ModalDialog RID_DLG_SCRIPTORGANIZER -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 210 , 165 ) ; - Moveable = TRUE ; - Text [ en-US ] = "%MACROLANG Macros"; - Closeable = TRUE ; - HelpId = HID_SCRIPTORG_DIALOG; - FixedText SF_TXT_SCRIPTS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Macros" ; - }; - - Control SF_CTRL_SCRIPTSBOX - { - HelpId = HID_SCRIPTSBOX ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 16 ) ; - Size = MAP_APPFONT ( 130 , 144 ) ; - TabStop = TRUE ; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_DOCUMENT - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - }; - - PushButton SF_PB_RUN - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_RUN"; - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE; - Text [ en-US ] = "R~un" ; - }; - CancelButton SF_PB_CLOSE - { - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Close" ; - }; - - PushButton SF_PB_CREATE - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_CREATE"; - Size = MAP_APPFONT ( 60 , 14 ) ; - Pos = MAP_APPFONT ( 144 , 60 ) ; - Text [ en-US ] = "~Create..." ; - TabStop = TRUE ; - }; - PushButton SF_PB_EDIT - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_EDIT"; - Size = MAP_APPFONT ( 60 , 14 ) ; - Pos = MAP_APPFONT ( 144 , 77 ) ; - Text [ en-US ] = "~Edit" ; - TabStop = TRUE ; - }; - PushButton SF_PB_RENAME - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_RENAME"; - Pos = MAP_APPFONT ( 144 , 94 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Rename..." ; - }; - PushButton SF_PB_DEL - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_DEL"; - Pos = MAP_APPFONT ( 144 , 114 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - HelpButton SF_PB_HELP - { - Pos = MAP_APPFONT ( 144 , 131 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - -}; -ModalDialog RID_DLG_NEWLIB -{ - HelpID = "cui:ModalDialog:RID_DLG_NEWLIB"; - Text [ en-US ] = "Create Library" ; - Size = MAP_APPFONT ( 160 , 50 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 104 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 104 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_NEWLIB - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 50 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "Enter the name for the new library." ; - }; - Edit ED_LIBNAME - { - HelpID = "cui:Edit:RID_DLG_NEWLIB:ED_LIBNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 59 ) ; - Size = MAP_APPFONT ( 92 , 12 ) ; - TabStop = TRUE ; - }; - String STR_NEWLIB - { - Text [ en-US ] = "Create Library" ; - }; - String STR_NEWMACRO - { - Text [ en-US ] = "Create Macro" ; - }; - String STR_FT_NEWMACRO - { - Text [ en-US ] = "Enter the name for the new macro." ; - }; - String STR_RENAME - { - Text [ en-US ] = "Rename" ; - }; - String STR_FT_RENAME - { - Text [ en-US ] = "Enter the new name for the selected object." ; - }; -}; -String RID_SVXSTR_DELQUERY -{ - Text [ en-US ] = "Do you want to delete the following object?"; -}; -String RID_SVXSTR_DELQUERY_TITLE -{ - Text [ en-US ] = "Confirm Deletion"; -}; -String RID_SVXSTR_DELFAILED -{ - Text [ en-US ] = "The selected object could not be deleted."; -}; -String RID_SVXSTR_DELFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to delete this object."; -}; -String RID_SVXSTR_DELFAILED_TITLE -{ - Text [ en-US ] = "Error Deleting Object"; -}; -String RID_SVXSTR_CREATEFAILED -{ - Text [ en-US ] = "The object could not be created."; -}; -String RID_SVXSTR_CREATEFAILEDDUP -{ - Text [ en-US ] = " Object with the same name already exists."; -}; -String RID_SVXSTR_CREATEFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to create this object."; -}; -String RID_SVXSTR_CREATEFAILED_TITLE -{ - Text [ en-US ] = "Error Creating Object"; -}; -String RID_SVXSTR_RENAMEFAILED -{ - Text [ en-US ] = "The object could not be renamed."; -}; -String RID_SVXSTR_RENAMEFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to rename this object."; -}; -String RID_SVXSTR_RENAMEFAILED_TITLE -{ - Text [ en-US ] = "Error Renaming Object"; -}; - -String RID_SVXSTR_ERROR_TITLE -{ - Text [ en-US ] = "%PRODUCTNAME Error"; -}; - -String RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED -{ - Text [ en-US ] = "The scripting language %LANGUAGENAME is not supported."; -}; -String RID_SVXSTR_ERROR_RUNNING -{ - Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_EXCEPTION_RUNNING -{ - Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_ERROR_AT_LINE -{ - Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_EXCEPTION_AT_LINE -{ - Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_FRAMEWORK_ERROR_RUNNING -{ - Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_FRAMEWORK_ERROR_AT_LINE -{ - Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_ERROR_TYPE_LABEL -{ - Text [ en-US ] = "Type:"; -}; - -String RID_SVXSTR_ERROR_MESSAGE_LABEL -{ - Text [ en-US ] = "Message:"; -}; diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx deleted file mode 100644 index 39914e70f..000000000 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svl/cjkoptions.hxx> -#include <svx/flagsdef.hxx> -#include "cuires.hrc" -#include "sdrcelldlg.hxx" -#include "dialmgr.hxx" -#include "cuitabarea.hxx" -#include "svx/svdmodel.hxx" -#include "border.hxx" -#include <svx/dialogs.hrc> // RID_SVXPAGE_... - -SvxFormatCellsDialog::SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel ) -: SfxTabDialog ( pParent, CUI_RES( RID_SVX_FORMAT_CELLS_DLG ), pAttr ) -, mrOutAttrs ( *pAttr ) -, mpColorTab ( pModel->GetColorTable() ) -, mpGradientList ( pModel->GetGradientList() ) -, mpHatchingList ( pModel->GetHatchList() ) -, mpBitmapList ( pModel->GetBitmapList() ) - -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_CHAR_NAME ); - AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); - AddTabPage( RID_SVXPAGE_BORDER ); - AddTabPage( RID_SVXPAGE_AREA ); -} - -SvxFormatCellsDialog::~SvxFormatCellsDialog() -{ -} - -void SvxFormatCellsDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - switch( nId ) - { - case RID_SVXPAGE_AREA: - ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); - ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); - ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); - ( (SvxAreaTabPage&) rPage ).SetPageType( PT_AREA ); - ( (SvxAreaTabPage&) rPage ).SetDlgType( 1 ); - ( (SvxAreaTabPage&) rPage ).SetPos( 0 ); - ( (SvxAreaTabPage&) rPage ).Construct(); - ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs ); - - break; - - default: - SfxTabDialog::PageCreated( nId, rPage ); - break; - } -} - -void SvxFormatCellsDialog::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/sdrcelldlg.src b/cui/source/dialogs/sdrcelldlg.src deleted file mode 100644 index f608da587..000000000 --- a/cui/source/dialogs/sdrcelldlg.src +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <cuires.hrc> -#include <svx/dialogs.hrc> - -TabDialog RID_SVX_FORMAT_CELLS_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 289 , 176 ) ; - Text [ de ] = "Zellen formatieren" ; - Text [ en-US ] = "Format Cells" ; - Moveable = TRUE ; - Closeable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , 135 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_CHAR_NAME ; - PageResID = RID_SVXPAGE_CHAR_NAME ; - Text [ de ] = "Schrift" ; - Text [ en-US ] = "Font" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_EFFECTS ; - PageResID = RID_SVXPAGE_CHAR_EFFECTS ; - Text [ de ] = "Schrifteffekt" ; - Text [ en-US ] = "Font Effects" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_BORDER; - PageResID = RID_SVXPAGE_BORDER; - Text [ de ] = "Umrandung" ; - Text [ en-US ] = "Borders" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_AREA; - PageResID = RID_SVXPAGE_AREA; - Text [ de ] = "Hintergrund"; - Text [ en-US ] = "Background"; - Text [ x-comment ] = " "; - }; - }; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 6 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 60 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 114 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton 1 - { - Pos = MAP_APPFONT ( 169 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ de ] = "Zurück" ; - Text [ en-US ] = "Return" ; - TabStop = TRUE ; - Text [ x-comment ] = " "; - }; - Text [ x-comment ] = " "; -}; diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx deleted file mode 100644 index 83938ff7a..000000000 --- a/cui/source/dialogs/showcols.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "showcols.hxx" -#include "fmsearch.hrc" - -#include <tools/shl.hxx> -#include <dialmgr.hxx> -#include <vcl/msgbox.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <comphelper/extract.hxx> -#include <comphelper/types.hxx> - -#define CUIFM_PROP_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Hidden" ) ) -#define CUIFM_PROP_LABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) - -//========================================================================== -// FmShowColsDialog -//========================================================================== -DBG_NAME(FmShowColsDialog) -//-------------------------------------------------------------------------- -FmShowColsDialog::FmShowColsDialog(Window* pParent) - :ModalDialog(pParent, CUI_RES(RID_SVX_DLG_SHOWGRIDCOLUMNS)) - ,m_aList(this, CUI_RES(1)) - ,m_aLabel(this, CUI_RES(1)) - ,m_aOK(this, CUI_RES(1)) - ,m_aCancel(this, CUI_RES(1)) -{ - DBG_CTOR(FmShowColsDialog,NULL); - m_aList.EnableMultiSelection(sal_True); - m_aOK.SetClickHdl( LINK( this, FmShowColsDialog, OnClickedOk ) ); - - FreeResource(); -} - -//-------------------------------------------------------------------------- -FmShowColsDialog::~FmShowColsDialog() -{ - DBG_DTOR(FmShowColsDialog,NULL); -} - -//-------------------------------------------------------------------------- -IMPL_LINK( FmShowColsDialog, OnClickedOk, Button*, EMPTYARG ) -{ - DBG_ASSERT(m_xColumns.is(), "FmShowColsDialog::OnClickedOk : you should call SetColumns before executing the dialog !"); - if (m_xColumns.is()) - { - ::com::sun::star::uno::Any aCol; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; - for (sal_uInt16 i=0; i<m_aList.GetSelectEntryCount(); ++i) - { - m_xColumns->getByIndex(sal::static_int_cast<sal_Int32>(reinterpret_cast<sal_uIntPtr>(m_aList.GetEntryData(m_aList.GetSelectEntryPos(i))))) >>= xCol; - if (xCol.is()) - { - try - { - xCol->setPropertyValue(CUIFM_PROP_HIDDEN, ::cppu::bool2any(sal_False)); - } - catch(...) - { - OSL_FAIL("FmShowColsDialog::OnClickedOk Exception occurred!"); - } - } - } - } - - EndDialog(RET_OK); - return 0L; -} - -//-------------------------------------------------------------------------- -void FmShowColsDialog::SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols) -{ - DBG_ASSERT(xCols.is(), "FmShowColsDialog::SetColumns : invalid columns !"); - if (!xCols.is()) - return; - m_xColumns = xCols.get(); - - m_aList.Clear(); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurCol; - String sCurName; - for (sal_uInt16 i=0; i<xCols->getCount(); ++i) - { - sCurName.Erase(); - ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); - sal_Bool bIsHidden = sal_False; - try - { - ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(CUIFM_PROP_HIDDEN); - bIsHidden = ::comphelper::getBOOL(aHidden); - - ::rtl::OUString sName; - xCurCol->getPropertyValue(CUIFM_PROP_LABEL) >>= sName; - sCurName = sName; - } - catch(...) - { - OSL_FAIL("FmShowColsDialog::SetColumns Exception occurred!"); - } - - // if the col is hidden, put it into the list - if (bIsHidden) - m_aList.SetEntryData( m_aList.InsertEntry(sCurName), reinterpret_cast<void*>((sal_Int64)i) ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/showcols.src b/cui/source/dialogs/showcols.src deleted file mode 100644 index 98ae449e6..000000000 --- a/cui/source/dialogs/showcols.src +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "fmsearch.hrc" - -ModalDialog RID_SVX_DLG_SHOWGRIDCOLUMNS -{ - HelpID = "cui:ModalDialog:RID_SVX_DLG_SHOWGRIDCOLUMNS"; - OutputSize = TRUE; - SVLook = TRUE ; - Size = MAP_APPFONT( 200, 117 ); - Moveable = TRUE; - Closeable = TRUE; - - FixedText 1 - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 188, 30 ); - WordBreak = TRUE; - Text [ en-US ] = "The following columns are currently hidden. Please mark the fields you want to show and choose OK."; - }; - - ListBox 1 - { - HelpID = "cui:ListBox:RID_SVX_DLG_SHOWGRIDCOLUMNS:1"; - Border = TRUE; - Pos = MAP_APPFONT( 6, 39 ); - Size = MAP_APPFONT( 188, 55 ); - TabStop = TRUE; - DropDown = FALSE; - AutoHScroll = TRUE; - VScroll = TRUE; - }; - - OKButton 1 - { - Pos = MAP_APPFONT( 6, 97 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE ; - }; - - CancelButton 1 - { - Pos = MAP_APPFONT( 144, 97 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; - Text [ en-US ] = "Show columns"; -}; diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx deleted file mode 100644 index 8b408bf71..000000000 --- a/cui/source/dialogs/splitcelldlg.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/dispatch.hxx> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include "dialmgr.hxx" -#include "splitcelldlg.hxx" -#include "cuires.hrc" -#include "splitcelldlg.hrc" - -SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal ) -: SvxStandardDialog(pParent, CUI_RES(RID_SVX_SPLITCELLDLG)) -, maCountFL(this, CUI_RES(FL_COUNT)) -, maCountLbl(this, CUI_RES(FT_COUNT)) -, maCountEdit(this, CUI_RES(ED_COUNT)) -, maDirFL(this, CUI_RES(FL_DIR)) -, maHorzBox(this, CUI_RES(RB_HORZ)) -, maVertBox(this, CUI_RES(RB_VERT)) -, maPropCB(this, CUI_RES(CB_PROP)) -, maOKBtn(this, CUI_RES(BT_OK)) -, maCancelBtn(this, CUI_RES(BT_CANCEL)) -, maHelpBtn( this, CUI_RES( BT_HELP ) ) -, mnMaxVertical( nMaxVertical ) -, mnMaxHorizontal( nMaxHorizontal ) -{ - FreeResource(); - maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - - if( mnMaxVertical < 2 ) - maVertBox.Enable(sal_False); - - //exchange the meaning of horizontal and vertical for vertical text - if(bIsTableVertical) - { - Image aTmpImg(maHorzBox.GetModeRadioImage()); - String sTmp(maHorzBox.GetText()); - maHorzBox.SetText(maVertBox.GetText()); - maHorzBox.SetModeRadioImage(maVertBox.GetModeRadioImage()); - maVertBox.SetText(sTmp); - maVertBox.SetModeRadioImage(aTmpImg); - } -} - -SvxSplitTableDlg::~SvxSplitTableDlg() -{ -} - -IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton ) -{ - const bool bIsVert = pButton == &maVertBox ; - long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal; - maPropCB.Enable(!bIsVert); - maCountEdit.SetMax( nMax ); - return 0; -} - -bool SvxSplitTableDlg::IsHorizontal() const -{ - return maHorzBox.IsChecked(); -} - -bool SvxSplitTableDlg::IsProportional() const -{ - return maPropCB.IsChecked() && maHorzBox.IsChecked(); -} - -long SvxSplitTableDlg::GetCount() const -{ - return sal::static_int_cast<long>( maCountEdit.GetValue() ); -} - -short SvxSplitTableDlg::Execute() -{ - return SvxStandardDialog::Execute(); -} - -void SvxSplitTableDlg::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/splitcelldlg.hrc b/cui/source/dialogs/splitcelldlg.hrc deleted file mode 100644 index c1db00201..000000000 --- a/cui/source/dialogs/splitcelldlg.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FT_COUNT 1 -#define ED_COUNT 2 -#define FL_COUNT 3 - -#define RB_HORZ 10 -#define CB_PROP 11 -#define RB_VERT 12 -#define FL_DIR 12 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 diff --git a/cui/source/dialogs/splitcelldlg.src b/cui/source/dialogs/splitcelldlg.src deleted file mode 100644 index 6fb9a990a..000000000 --- a/cui/source/dialogs/splitcelldlg.src +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <cuires.hrc> -#include "splitcelldlg.hrc" - -ModalDialog RID_SVX_SPLITCELLDLG -{ - HelpID = "cui:ModalDialog:RID_SVX_SPLITCELLDLG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 108 ) ; - Text [ en-US ] = "Split Cells" ; - Moveable = TRUE ; - - OKButton BT_OK - { - Pos = MAP_APPFONT ( 115 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 115 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 115 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_COUNT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "~Split cell into" ; - Left = TRUE ; - }; - NumericField ED_COUNT - { - HelpID = "cui:NumericField:RID_SVX_SPLITCELLDLG:ED_COUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 14 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 20 ; - First = 2 ; - Last = 5 ; - }; - FixedLine FL_COUNT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 103 , 8 ) ; - Text [ en-US ] = "Split" ; - }; - ImageRadioButton RB_HORZ - { - HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_HORZ"; - Pos = MAP_APPFONT ( 12 , 47 ) ; - Size = MAP_APPFONT ( 90 , 18 ) ; - Group = TRUE; - Text [ en-US ] = "H~orizontally" ; - RadioButtonImage = Image - { - ImageBitmap = Bitmap { File = "zetlhor2.bmp" ; }; - }; - TabStop = TRUE ; - Check = TRUE ; - }; - CheckBox CB_PROP - { - HelpID = "cui:CheckBox:RID_SVX_SPLITCELLDLG:CB_PROP"; - Pos = MAP_APPFONT ( 18 , 68 ) ; - Size = MAP_APPFONT ( 91 , 12 ) ; - Text [ en-US ] = "~Into equal proportions"; - }; - ImageRadioButton RB_VERT - { - HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_VERT"; - Pos = MAP_APPFONT ( 12 , 84 ) ; - Size = MAP_APPFONT ( 90 , 18 ) ; - Text [ en-US ] = "~Vertically" ; - RadioButtonImage = Image - { - ImageBitmap = Bitmap { File = "zetlver2.bmp" ; }; - }; - TabStop = TRUE ; - }; - FixedLine FL_DIR - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 103 , 8 ) ; - Text [ en-US ] = "Direction" ; - }; -}; diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx deleted file mode 100644 index b67fdadfc..000000000 --- a/cui/source/dialogs/srchxtra.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "srchxtra.hxx" -#include <tools/rcid.h> -#include <vcl/msgbox.hxx> -#include <svl/cjkoptions.hxx> -#include <svl/whiter.hxx> -#include <sfx2/objsh.hxx> -#include <cuires.hrc> -#include "srchxtra.hrc" -#include <svx/svxitems.hrc> // RID_ATTR_BEGIN -#include <svx/dialmgr.hxx> // item resources -#include <editeng/flstitem.hxx> -#include "chardlg.hxx" -#include "paragrph.hxx" -#include <dialmgr.hxx> -#include "backgrnd.hxx" -#include <svx/dialogs.hrc> // RID_SVXPAGE_... -#include <tools/resary.hxx> -#include <rtl/strbuf.hxx> - -// class SvxSearchFormatDialog ------------------------------------------- - -SvxSearchFormatDialog::SvxSearchFormatDialog( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHFORMAT ), &rSet ), - - pFontList( NULL ) - -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_CHAR_NAME, SvxCharNamePage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_EFFECTS, SvxCharEffectsPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_POSITION, SvxCharPositionPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_TWOLINES, SvxCharTwoLinesPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_STD_PARAGRAPH, SvxStdParagraphTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH, SvxParaAlignTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_EXT_PARAGRAPH, SvxExtParagraphTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_PARA_ASIAN, SvxAsianTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 ); - - // remove asian tabpages if necessary - SvtCJKOptions aCJKOptions; - if ( !aCJKOptions.IsDoubleLinesEnabled() ) - RemoveTabPage( RID_SVXPAGE_CHAR_TWOLINES ); - if ( !aCJKOptions.IsAsianTypographyEnabled() ) - RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); -} - -// ----------------------------------------------------------------------- - -SvxSearchFormatDialog::~SvxSearchFormatDialog() -{ - delete pFontList; -} - -// ----------------------------------------------------------------------- - -void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) -{ - switch ( nId ) - { - case RID_SVXPAGE_CHAR_NAME: - { - const FontList* pAppFontList = 0; - SfxObjectShell* pSh = SfxObjectShell::Current(); - - if ( pSh ) - { - const SvxFontListItem* pFLItem = (const SvxFontListItem*) - pSh->GetItem( SID_ATTR_CHAR_FONTLIST ); - if ( pFLItem ) - pAppFontList = pFLItem->GetFontList(); - } - - const FontList* pList = pAppFontList; - - if ( !pList ) - { - if ( !pFontList ) - pFontList = new FontList( this ); - pList = pFontList; - } - - if ( pList ) - ( (SvxCharNamePage&)rPage ). - SetFontList( SvxFontListItem( pList, SID_ATTR_CHAR_FONTLIST ) ); - ( (SvxCharNamePage&)rPage ).EnableSearchMode(); - break; - } - - case RID_SVXPAGE_STD_PARAGRAPH: - ( (SvxStdParagraphTabPage&)rPage ).EnableAutoFirstLine(); - break; - - case RID_SVXPAGE_ALIGN_PARAGRAPH: - ( (SvxParaAlignTabPage&)rPage ).EnableJustifyExt(); - break; - case RID_SVXPAGE_BACKGROUND : - ( (SvxBackgroundTabPage&)rPage ).ShowParaControl(sal_True); - break; - } -} - -// class SvxSearchFormatDialog ------------------------------------------- - -SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent, - SearchAttrItemList& rLst, - const sal_uInt16* pWhRanges ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHATTR ) ), - - aAttrFL ( this, CUI_RES( FL_ATTR ) ), - aAttrLB ( this, CUI_RES( LB_ATTR ) ), - aOKBtn ( this, CUI_RES( BTN_ATTR_OK ) ), - aEscBtn ( this, CUI_RES( BTN_ATTR_CANCEL ) ), - aHelpBtn( this, CUI_RES( BTN_ATTR_HELP ) ), - - rList( rLst ) - -{ - FreeResource(); - - aAttrLB.SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); - aAttrLB.GetModel()->SetSortMode( SortAscending ); - - aOKBtn.SetClickHdl( LINK( this, SvxSearchAttributeDialog, OKHdl ) ); - - SfxObjectShell* pSh = SfxObjectShell::Current(); - DBG_ASSERT( pSh, "No DocShell" ); - - ResStringArray aAttrNames( SVX_RES( RID_ATTR_NAMES ) ); - SfxItemPool& rPool = pSh->GetPool(); - SfxItemSet aSet( rPool, pWhRanges ); - SfxWhichIter aIter( aSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); - - while ( nWhich ) - { - sal_uInt16 nSlot = rPool.GetSlotId( nWhich ); - if ( nSlot >= SID_SVX_START ) - { - sal_Bool bChecked = sal_False, bFound = sal_False; - for ( sal_uInt16 i = 0; !bFound && i < rList.Count(); ++i ) - { - if ( nSlot == rList[i].nSlot ) - { - bFound = sal_True; - if ( IsInvalidItem( rList[i].pItem ) ) - bChecked = sal_True; - } - } - - // item resources are in svx - sal_uInt32 nId = aAttrNames.FindIndex( nSlot ); - SvLBoxEntry* pEntry = NULL; - if ( RESARRAY_INDEX_NOTFOUND != nId ) - pEntry = aAttrLB.SvTreeListBox::InsertEntry( aAttrNames.GetString(nId) ); - else - { - rtl::OStringBuffer sError( - RTL_CONSTASCII_STRINGPARAM("no resource for slot id\nslot = ")); - sError.append(static_cast<sal_Int32>(nSlot)); - DBG_ERRORFILE(sError.getStr()); - } - - if ( pEntry ) - { - aAttrLB.SetCheckButtonState( pEntry, bChecked ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData( (void*)(sal_uLong)nSlot ); - } - } - nWhich = aIter.NextWhich(); - } - - aAttrLB.SetHighlightRange(); - aAttrLB.SelectEntryPos( 0 ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchAttributeDialog, OKHdl, Button *, EMPTYARG ) -{ - SearchAttrItem aInvalidItem; - aInvalidItem.pItem = (SfxPoolItem*)-1; - - for ( sal_uInt16 i = 0; i < aAttrLB.GetEntryCount(); ++i ) - { - sal_uInt16 nSlot = (sal_uInt16)(sal_uLong)aAttrLB.GetEntryData(i); - sal_Bool bChecked = aAttrLB.IsChecked(i); - - sal_uInt16 j; - for ( j = rList.Count(); j; ) - { - SearchAttrItem& rItem = rList[ --j ]; - if( rItem.nSlot == nSlot ) - { - if( bChecked ) - { - if( !IsInvalidItem( rItem.pItem ) ) - delete rItem.pItem; - rItem.pItem = (SfxPoolItem*)-1; - } - else if( IsInvalidItem( rItem.pItem ) ) - rItem.pItem = 0; - j = 1; - break; - } - } - - if ( !j && bChecked ) - { - aInvalidItem.nSlot = nSlot; - rList.Insert( aInvalidItem ); - } - } - - // remove invalid items (pItem == NULL) - for ( sal_uInt16 n = rList.Count(); n; ) - if ( !rList[ --n ].pItem ) - rList.Remove( n ); - - EndDialog( RET_OK ); - return 0; -} - -// class SvxSearchSimilarityDialog --------------------------------------- - -SvxSearchSimilarityDialog::SvxSearchSimilarityDialog -( - Window* pParent, - sal_Bool bRelax, - sal_uInt16 nOther, - sal_uInt16 nShorter, - sal_uInt16 nLonger -) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHSIMILARITY ) ), - - aFixedLine ( this, CUI_RES( FL_SIMILARITY ) ), - aOtherTxt ( this, CUI_RES( FT_OTHER ) ), - aOtherFld ( this, CUI_RES( NF_OTHER ) ), - aLongerTxt ( this, CUI_RES( FT_LONGER ) ), - aLongerFld ( this, CUI_RES( NF_LONGER ) ), - aShorterTxt ( this, CUI_RES( FT_SHORTER ) ), - aShorterFld ( this, CUI_RES( NF_SHORTER ) ), - aRelaxBox ( this, CUI_RES( CB_RELAX ) ), - - aOKBtn ( this, CUI_RES( BTN_ATTR_OK ) ), - aEscBtn ( this, CUI_RES( BTN_ATTR_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_ATTR_HELP ) ) - -{ - FreeResource(); - - aOtherFld.SetValue( nOther ); - aShorterFld.SetValue( nShorter ); - aLongerFld.SetValue( nLonger ); - aRelaxBox.Check( bRelax ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/srchxtra.hrc b/cui/source/dialogs/srchxtra.hrc deleted file mode 100644 index da89b470a..000000000 --- a/cui/source/dialogs/srchxtra.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SRCHXTRA_HRC -#define _SVX_SRCHXTRA_HRC - -// defines ------------------------------------------------------------------ - -#define BTN_ATTR_OK 10 -#define BTN_ATTR_CANCEL 11 -#define BTN_ATTR_HELP 12 -#define LB_ATTR 13 -#define FL_ATTR 14 - -#define CB_RELAX 15 -#define FT_OTHER 16 -#define NF_OTHER 17 -#define FT_SHORTER 18 -#define NF_SHORTER 19 -#define FT_LONGER 20 -#define NF_LONGER 21 -#define FL_SIMILARITY 22 - -#endif diff --git a/cui/source/dialogs/srchxtra.src b/cui/source/dialogs/srchxtra.src deleted file mode 100644 index 15d9ac703..000000000 --- a/cui/source/dialogs/srchxtra.src +++ /dev/null @@ -1,283 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include <cuires.hrc> -#include "srchxtra.hrc" -#include <svx/dialogs.hrc> - - // RID_SVXDLG_SEARCHFORMAT ----------------------------------------------- -TabDialog RID_SVXDLG_SEARCHFORMAT -{ - OutputSize = TRUE ; - SvLook = TRUE ; - Text [ en-US ] = "Text Format" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_CHAR_NAME ; - Text [ en-US ] = "Font" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_EFFECTS ; - Text [ en-US ] = "Font Effects" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_POSITION ; - Text [ en-US ] = "Position" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_TWOLINES ; - Text [ en-US ] = "Asian Layout" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_STD_PARAGRAPH ; - Text [ en-US ] = "Indents & Spacing" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; - Text [ en-US ] = "Alignment" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_EXT_PARAGRAPH ; - Text [ en-US ] = "Text Flow" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PARA_ASIAN; - Text [ en-US ] = "Asian Typography"; - }; - PageItem - { - Identifier = RID_SVXPAGE_BACKGROUND; - Text [ en-US ] = "Background" ; - }; - }; - }; -}; - // RID_SVXDLG_SEARCHATTRIBUTE -------------------------------------------- -ModalDialog RID_SVXDLG_SEARCHATTR -{ - HelpId = HID_SEARCHATTR ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 194 , 128 ) ; - Text [ en-US ] = "Attributes" ; - Moveable = TRUE ; - Control LB_ATTR - { - HelpId = HID_SEARCHATTR_CTL_ATTR ; - ClipChildren = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 120 , 108 ) ; - }; - FixedText FL_ATTR - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 124 , 8 ) ; - Text [ en-US ] = "~Options" ; - }; - OKButton BTN_ATTR_OK - { - Pos = MAP_APPFONT ( 136 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ATTR_CANCEL - { - Pos = MAP_APPFONT ( 136 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_ATTR_HELP - { - Pos = MAP_APPFONT ( 136 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - // RID_SVXDLG_SEARCHSIMILARITY ------------------------------------------- -ModalDialog RID_SVXDLG_SEARCHSIMILARITY -{ - HelpId = HID_SEARCHSIMILARITY ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 76 ) ; - Text [ en-US ] = "Similarity Search" ; - Moveable = TRUE ; - FixedText FT_OTHER - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Exchange characters" ; - }; - NumericField NF_OTHER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_OTHER"; - Pos = MAP_APPFONT ( 86 , 14 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - FixedText FT_LONGER - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Add characters" ; - }; - NumericField NF_LONGER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_LONGER"; - Pos = MAP_APPFONT ( 86 , 28 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - FixedText FT_SHORTER - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Remove characters" ; - }; - NumericField NF_SHORTER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_SHORTER"; - Pos = MAP_APPFONT ( 86 , 44 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - CheckBox CB_RELAX - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHSIMILARITY:CB_RELAX"; - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - Text [ en-US ] = "~Combine" ; - TabStop = TRUE ; - }; - FixedLine FL_SIMILARITY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Settings" ; - }; - OKButton BTN_ATTR_OK - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ATTR_CANCEL - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_ATTR_HELP - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/svuidlg.hrc b/cui/source/dialogs/svuidlg.hrc deleted file mode 100644 index 38b89df77..000000000 --- a/cui/source/dialogs/svuidlg.hrc +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svl/solar.hrc> -#include <helpid.hrc> - -#define TB_LINKS 32014 - -// gemeinsame Id's -#define CB_DISPLAY_AS_ICON 12 -#define FI_DISPLAY 13 -#define PB_CHANGE_ICON 14 - -#define STR_AUTOLINK 32006 -#define STR_MANUALLINK 32007 -#define STR_BROKENLINK 32008 -#define STR_GRAPHICLINK 32009 -#define STR_BUTTONCLOSE 32010 -#define STR_CLOSELINKMSG 32011 -#define STR_CLOSELINKMSG_MULTI 32024 -#define STR_WAITINGLINK 32028 -#define STR_EDIT_APPLET 32029 - - -#define FL_CHOICE 15 -#define LB_INSERT_LIST 7 - -#define MD_PASTE_OBJECT 32001 -#define S_OBJECT 1 -#define RB_PASTE 20 -#define RB_PASTE_LINK 21 -#define FT_OBJECT_SOURCE 22 -#define FT_SOURCE 23 - -#define MD_UPDATE_BASELINKS 32002 -#define LB_LINKS 30 -#define FT_FILES 31 -#define FT_LINKS 32 -#define FT_TYPE 33 -#define FT_STATUS 34 -#define PB_UPDATE_NOW 35 -#define PB_OPEN_SOURCE 36 -#define PB_CHANGE_SOURCE 37 -#define PB_BREAK_LINK 38 -#define FT_SOURCE2 39 -#define FT_TYPE2 40 -#define FT_UPDATE 41 -#define RB_AUTOMATIC 42 -#define RB_MANUAL 43 -#define FT_FULL_SOURCE_NAME 44 -#define FT_FULL_TYPE_NAME 45 -#define GB_LINK 46 -#define FT_FILES2 47 -#define FT_FULL_FILE_NAME 48 - -#define MD_LINKEDIT 32004 -#define ED_FULL_SOURCE_NAME 1 - -#define ED_FILEPATH 10 -#define BTN_FILEPATH 11 -#define CB_FILELINK 12 - -#define MD_INSERT_OBJECT_PLUGIN 32008 -#define ED_FILEURL 10 -#define BTN_FILEURL 11 -#define GB_FILEURL 12 -#define ED_PLUGINS_OPTIONS 20 -#define GB_PLUGINS_OPTIONS 21 - -#define MD_INSERT_OBJECT_APPLET 32009 -#define FT_CLASSFILE 10 -#define ED_CLASSFILE 11 -#define FT_CLASSLOCATION 12 -#define ED_CLASSLOCATION 12 -#define BTN_CLASS 13 -#define GB_CLASS 14 -#define ED_APPLET_OPTIONS 20 -#define GB_APPLET_OPTIONS 21 - -#define MD_INSERT_OLEOBJECT 32010 -#define RB_NEW_OBJECT 10 -#define RB_OBJECT_FROMFILE 11 -#define LB_OBJECTTYPE 12 -#define GB_OBJECT 13 -#define STR_FILE 14 - -#define MD_INSERT_OBJECT_IFRAME 32011 -#define FT_FRAMENAME 3 -#define ED_FRAMENAME 4 -#define FT_URL 5 -#define ED_URL 6 -#define BT_FILEOPEN 7 -#define NM_MARGINHEIGHT 8 -#define FT_MARGINHEIGHT 9 -#define NM_MARGINWIDTH 10 -#define FT_MARGINWIDTH 11 -#define GB_MARGIN 12 -#define RB_SCROLLINGON 13 -#define RB_SCROLLINGOFF 14 -#define RB_SCROLLINGAUTO 15 -#define GB_SCROLLING 16 -#define GB_BORDER 17 -#define RB_FRMBORDER_ON 18 -#define RB_FRMBORDER_INHERIT 19 -#define RB_FRMBORDER_OFF 20 -#define CB_MARGINWIDTHDEFAULT 21 -#define CB_MARGINHEIGHTDEFAULT 22 -#define FL_SEP_LEFT 46 -#define FL_SEP_RIGHT 47 - diff --git a/cui/source/dialogs/svuidlg.src b/cui/source/dialogs/svuidlg.src deleted file mode 100644 index fa6b49be1..000000000 --- a/cui/source/dialogs/svuidlg.src +++ /dev/null @@ -1,741 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svtools/controldims.hrc> -#include "svuidlg.hrc" - -ModalDialog MD_PASTE_OBJECT -{ - HelpID = "cui:ModalDialog:MD_PASTE_OBJECT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 282 , 135 ) ; // 12 under listbox - Text [ en-US ] = "Paste Special" ; - FixedText FT_SOURCE - { - Pos = MAP_APPFONT ( 6 , 11 ) ; - Size = MAP_APPFONT ( 30 , 10 ) ; - Text [ en-US ] = "Source:" ; - }; - FixedText FT_OBJECT_SOURCE - { - Pos = MAP_APPFONT ( 42 , 11 ) ; - Size = MAP_APPFONT ( 166 , 20 ) ; - WordBreak = TRUE ; - }; - RadioButton RB_PASTE - { - HelpID = "cui:RadioButton:MD_PASTE_OBJECT:RB_PASTE"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "~Insert as" ; - Check = TRUE ; - }; - RadioButton RB_PASTE_LINK - { - HelpID = "cui:RadioButton:MD_PASTE_OBJECT:RB_PASTE_LINK"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 78 , 48 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Link to" ; - }; - ListBox LB_INSERT_LIST - { - HelpID = "cui:ListBox:MD_PASTE_OBJECT:LB_INSERT_LIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 49 ) ; - Size = MAP_APPFONT ( 202 , 74 ) ; - }; - CheckBox CB_DISPLAY_AS_ICON - { - HelpID = "cui:CheckBox:MD_PASTE_OBJECT:CB_DISPLAY_AS_ICON"; - Hide = TRUE ; - Disable = TRUE ; - Pos = MAP_APPFONT ( 150 , 62 ) ; - Size = MAP_APPFONT ( 64 , 10 ) ; - Text [ en-US ] = "~As icon" ; - }; - PushButton PB_CHANGE_ICON - { - HelpID = "cui:PushButton:MD_PASTE_OBJECT:PB_CHANGE_ICON"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 150 , 111 ) ; - Size = MAP_APPFONT ( 64 , 14 ) ; - Text [ en-US ] = "~Other Icon..." ; - }; - FixedLine FL_CHOICE - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 214 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Selection" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 226 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 226 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 226 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String S_OBJECT - { - Text [ en-US ] = "Object" ; - }; -}; -ModalDialog MD_UPDATE_BASELINKS -{ - HelpID = "cui:ModalDialog:MD_UPDATE_BASELINKS"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 337 , 166 ) ; - Text [ en-US ] = "Edit Links" ; - Moveable = TRUE ; - FixedText FT_FILES - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "Source file" ; - }; - FixedText FT_LINKS - { - Pos = MAP_APPFONT ( 83 , 6 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Element:" ; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 150 , 6 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "Type" ; - }; - FixedText FT_STATUS - { - Pos = MAP_APPFONT ( 215 , 6 ) ; - Size = MAP_APPFONT ( 55 , 10 ) ; - Text [ en-US ] = "Status" ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 270 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Close" ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 270 , 26 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - PushButton PB_UPDATE_NOW - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_UPDATE_NOW"; - Pos = MAP_APPFONT ( 270 , 43 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Update" ; - }; - PushButton PB_OPEN_SOURCE - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_OPEN_SOURCE"; - Pos = MAP_APPFONT ( 270 , 60 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Open" ; - }; - PushButton PB_CHANGE_SOURCE - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_CHANGE_SOURCE"; - Pos = MAP_APPFONT ( 270 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - }; - PushButton PB_BREAK_LINK - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_BREAK_LINK"; - Pos = MAP_APPFONT ( 270 , 94 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Break Link" ; - }; - FixedText FT_FILES2 - { - Pos = MAP_APPFONT ( 6 , 111 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Source file" ; - }; - FixedText FT_SOURCE2 - { - Pos = MAP_APPFONT ( 6 , 124 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Element:" ; - }; - FixedText FT_TYPE2 - { - Pos = MAP_APPFONT ( 6 , 137 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Type:" ; - }; - FixedText FT_UPDATE - { - Pos = MAP_APPFONT ( 6 , 150 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Update:" ; - }; - RadioButton RB_AUTOMATIC - { - HelpID = "cui:RadioButton:MD_UPDATE_BASELINKS:RB_AUTOMATIC"; - Pos = MAP_APPFONT ( 70 , 150 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Automatic" ; - }; - RadioButton RB_MANUAL - { - HelpID = "cui:RadioButton:MD_UPDATE_BASELINKS:RB_MANUAL"; - Pos = MAP_APPFONT ( 133 , 150 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "Ma~nual" ; - }; - FixedText FT_FULL_FILE_NAME - { - Pos = MAP_APPFONT ( 70 , 111 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - FixedText FT_FULL_SOURCE_NAME - { - Pos = MAP_APPFONT ( 70 , 124 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - FixedText FT_FULL_TYPE_NAME - { - Pos = MAP_APPFONT ( 70 , 137 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - String STR_AUTOLINK - { - Text [ en-US ] = "Automatic" ; - }; - String STR_MANUALLINK - { - Text [ en-US ] = "Manual" ; - }; - String STR_BROKENLINK - { - Text [ en-US ] = "Not available" ; - }; - String STR_GRAPHICLINK - { - Text [ en-US ] = "Graphic" ; - }; - String STR_BUTTONCLOSE - { - Text [ en-US ] = "~Close" ; - }; - String STR_CLOSELINKMSG - { - Text [ en-US ] = "Are you sure you want to remove the selected link?" ; - }; - String STR_CLOSELINKMSG_MULTI - { - Text [ en-US ] = "Are you sure you want to remove the selected link?" ; - }; - String STR_WAITINGLINK - { - Text [ en-US ] = "Waiting"; - }; -}; -ModalDialog MD_LINKEDIT -{ - HelpID = "cui:ModalDialog:MD_LINKEDIT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 222 , 58 ) ; - Text [ en-US ] = "Modify Link" ; - Moveable = TRUE ; - OKButton 1 - { - Pos = MAP_APPFONT ( 165 , 5 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 165 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedText FT_FULL_TYPE_NAME - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 5 , 5 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - }; - FixedText 2 - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 5 , 20 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "Exchange source:" ; - }; - Edit ED_FULL_SOURCE_NAME - { - HelpID = "cui:Edit:MD_LINKEDIT:ED_FULL_SOURCE_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 5 , 35 ) ; - Size = MAP_APPFONT ( 155 , 12 ) ; - Text [ en-US ] = "Edit" ; - }; -}; -ModalDialog MD_INSERT_OLEOBJECT -{ - HelpID = "cui:ModalDialog:MD_INSERT_OLEOBJECT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 105 ) ; - Moveable = TRUE ; - RadioButton RB_NEW_OBJECT - { - HelpID = "cui:RadioButton:MD_INSERT_OLEOBJECT:RB_NEW_OBJECT"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - Text [ en-US ] = "~Create new" ; - }; - RadioButton RB_OBJECT_FROMFILE - { - HelpID = "cui:RadioButton:MD_INSERT_OLEOBJECT:RB_OBJECT_FROMFILE"; - Pos = MAP_APPFONT ( 90 , 6 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - Text [ en-US ] = "Create from ~file" ; - }; - ListBox LB_OBJECTTYPE - { - HelpID = "cui:ListBox:MD_INSERT_OLEOBJECT:LB_OBJECTTYPE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 204 , 60 ) ; - }; - Edit ED_FILEPATH - { - HelpID = "cui:Edit:MD_INSERT_OLEOBJECT:ED_FILEPATH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_FILEPATH - { - HelpID = "cui:PushButton:MD_INSERT_OLEOBJECT:BTN_FILEPATH"; - Pos = MAP_APPFONT ( 166 , 48 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Search..." ; - }; - CheckBox CB_FILELINK - { - HelpID = "cui:CheckBox:MD_INSERT_OLEOBJECT:CB_FILELINK"; - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 138 , 10 ) ; - Text [ en-US ] = "~Link to file" ; - }; - FixedLine GB_OBJECT - { - Pos = MAP_APPFONT ( 6 , 22 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Object type" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - TabStop = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - String STR_FILE - { - Text [ en-US ] = "File" ; - }; - Text [ en-US ] = "Insert OLE Object" ; -}; -ModalDialog MD_INSERT_OBJECT_PLUGIN -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_PLUGIN"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 123 ) ; - Moveable = TRUE ; - Edit ED_FILEURL - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_PLUGIN:ED_FILEURL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_FILEURL - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_PLUGIN:BTN_FILEURL"; - Pos = MAP_APPFONT ( 166 , 29 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Browse..." ; - }; - FixedLine GB_FILEURL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "File / URL" ; - }; - MultiLineEdit ED_PLUGINS_OPTIONS - { - HelpID = "cui:MultiLineEdit:MD_INSERT_OBJECT_PLUGIN:ED_PLUGINS_OPTIONS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 204 , 45 ) ; - VScroll = TRUE ; - IgnoreTab = TRUE; - }; - FixedLine GB_PLUGINS_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 55 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - Text [ en-US ] = "Insert Plug-in" ; -}; -ModalDialog MD_INSERT_OBJECT_APPLET -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_APPLET"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 164 ) ; - Moveable = TRUE ; - FixedText FT_CLASSFILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 204 , 10 ) ; - Text [ en-US ] = "~Class" ; - }; - Edit ED_CLASSFILE - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_APPLET:ED_CLASSFILE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - FixedText FT_CLASSLOCATION - { - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 204 , 10 ) ; - Text [ en-US ] = "Class ~Location" ; - }; - Edit ED_CLASSLOCATION - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_APPLET:ED_CLASSLOCATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_CLASS - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_APPLET:BTN_CLASS"; - Pos = MAP_APPFONT ( 166 , 70 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Search..." ; - }; - FixedLine GB_CLASS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "File" ; - }; - MultiLineEdit ED_APPLET_OPTIONS - { - HelpID = "cui:MultiLineEdit:MD_INSERT_OBJECT_APPLET:ED_APPLET_OPTIONS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 204 , 45 ) ; - VScroll = TRUE ; - IgnoreTab = TRUE; - }; - FixedLine GB_APPLET_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 96 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - Text [ en-US ] = "Insert Applet" ; -}; -Control TB_LINKS -{ - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 21 ) ; - Size = MAP_APPFONT ( 257 , 87 ) ; - TabStop = TRUE ; - ClipChildren = TRUE ; -}; - -ModalDialog MD_INSERT_OBJECT_IFRAME -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_IFRAME"; - Size = MAP_APPFONT ( 302 , 98 ) ; - Hide = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Floating Frame Properties" ; - OKButton 1 - { - Pos = MAP_APPFONT ( 246 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 246 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 246 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedText FT_FRAMENAME - { - Pos = MAP_APPFONT ( 6 , 7 ) ; - Size = MAP_APPFONT ( 36 , 10 ) ; - Text [ en-US ] = "~Name" ; - }; - Edit ED_FRAMENAME - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_IFRAME:ED_FRAMENAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 45 , 6 ) ; - Size = MAP_APPFONT ( 178 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 6 , 25 ) ; - Size = MAP_APPFONT ( 36 , 10 ) ; - Text [ en-US ] = "~Contents" ; - }; - Edit ED_URL - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_IFRAME:ED_URL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 45 , 24 ) ; - Size = MAP_APPFONT ( 178 , 12 ) ; - TabStop = TRUE ; - }; - PushButton BT_FILEOPEN - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_IFRAME:BT_FILEOPEN"; - Pos = MAP_APPFONT ( 226 , 24 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "~..." ; - TabStop = TRUE ; - }; - RadioButton RB_SCROLLINGON - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGON"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "~On" ; - }; - RadioButton RB_SCROLLINGOFF - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGOFF"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "O~ff" ; - }; - RadioButton RB_SCROLLINGAUTO - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGAUTO"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 79 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "Au~tomatic" ; - }; - FixedLine GB_SCROLLING - { - Pos = MAP_APPFONT ( 6 , 42 ) ; - Size = MAP_APPFONT ( 63 , 8 ) ; - Text [ en-US ] = "Scroll bar" ; - }; - RadioButton RB_FRMBORDER_ON - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_FRMBORDER_ON"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 81 , 53 ) ; - Size = MAP_APPFONT ( 42 , 10 ) ; - Text [ en-US ] = "On" ; - }; - RadioButton RB_FRMBORDER_OFF - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_FRMBORDER_OFF"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 81 , 66 ) ; - Size = MAP_APPFONT ( 42 , 10 ) ; - Text [ en-US ] = "Off" ; - }; - FixedLine FL_SEP_LEFT - { - Pos = MAP_APPFONT ( 70 , 51 ) ; - Size = MAP_APPFONT ( 4 , 38 ) ; - }; - FixedLine GB_BORDER - { - Pos = MAP_APPFONT ( 75 , 42 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Border" ; - }; - FixedText FT_MARGINWIDTH - { - Pos = MAP_APPFONT ( 136 , 56 ) ; - Size = MAP_APPFONT ( 28 , 10 ) ; - Text [ en-US ] = "~Width" ; - }; - NumericField NM_MARGINWIDTH - { - HelpID = "cui:NumericField:MD_INSERT_OBJECT_IFRAME:NM_MARGINWIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 167 , 54 ) ; - Size = MAP_APPFONT ( 20 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 99 ; - Last = 10 ; - SpinSize = 1 ; - }; - CheckBox CB_MARGINWIDTHDEFAULT - { - HelpID = "cui:CheckBox:MD_INSERT_OBJECT_IFRAME:CB_MARGINWIDTHDEFAULT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 190 , 56 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Default" ; - }; - FixedText FT_MARGINHEIGHT - { - Pos = MAP_APPFONT ( 136 , 74 ) ; - Size = MAP_APPFONT ( 28 , 10 ) ; - Text [ en-US ] = "H~eight" ; - }; - NumericField NM_MARGINHEIGHT - { - HelpID = "cui:NumericField:MD_INSERT_OBJECT_IFRAME:NM_MARGINHEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 167 , 72 ) ; - Size = MAP_APPFONT ( 20 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 99 ; - Last = 10 ; - SpinSize = 1 ; - }; - CheckBox CB_MARGINHEIGHTDEFAULT - { - HelpID = "cui:CheckBox:MD_INSERT_OBJECT_IFRAME:CB_MARGINHEIGHTDEFAULT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 190 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Defa~ult" ; - }; - FixedLine FL_SEP_RIGHT - { - Pos = MAP_APPFONT ( 125 , 51 ) ; - Size = MAP_APPFONT ( 4 , 38 ) ; - }; - FixedLine GB_MARGIN - { - Pos = MAP_APPFONT ( 130 , 42 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Spacing to contents" ; - }; -}; - -String MD_INSERT_OBJECT_IFRAME -{ - Text [ en-US ] = "Select File for Floating Frame" ; -}; - -String STR_EDIT_APPLET -{ - Text [ en-US ] = "Edit Applet" ; -}; - diff --git a/cui/source/dialogs/tbxform.src b/cui/source/dialogs/tbxform.src deleted file mode 100644 index 8af5e3b0b..000000000 --- a/cui/source/dialogs/tbxform.src +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "fmsearch.hrc" - -ModalDialog RID_SVX_DLG_INPUTRECORDNO -{ - HelpID = "cui:ModalDialog:RID_SVX_DLG_INPUTRECORDNO"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 130 , 45 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Record Number"; - - FixedText 1 - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 70 , 12 ) ; - Text [ en-US ] = "go to record"; - }; - NumericField 1 - { - HelpID = "cui:NumericField:RID_SVX_DLG_INPUTRECORDNO:1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 6 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 6 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 74 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx deleted file mode 100644 index c74432556..000000000 --- a/cui/source/dialogs/thesdlg.cxx +++ /dev/null @@ -1,694 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "thesdlg.hrc" -#include "thesdlg.hxx" -#include "thesdlg_impl.hxx" -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include <tools/shl.hxx> -#include <svl/lngmisc.hxx> -#include <svtools/filter.hxx> -#include <svtools/svlbitm.hxx> -#include <svtools/svtreebx.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <thesdlg.hxx> -#include <svx/dlgutil.hxx> -#include <svx/dialmgr.hxx> -#include <svx/svxerr.hxx> -#include <editeng/unolingu.hxx> -#include <svx/langbox.hxx> -#include <svtools/langtab.hxx> -#include <unotools/lingucfg.hxx> -#include <i18npool/mslangid.hxx> -#include <comphelper/processfactory.hxx> -#include <osl/file.hxx> -#include <svl/lngmisc.hxx> - -#include <stack> -#include <algorithm> - -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XMeaning.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> - -using namespace ::com::sun::star; -using ::rtl::OUString; - -#define A2S(x) String::CreateFromAscii( x ) - -// class LookUpComboBox_Impl -------------------------------------------------- - -LookUpComboBox_Impl::LookUpComboBox_Impl( - Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : - ComboBox (pParent, rResId), - m_rDialogImpl( rImpl ) -{ - m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); - m_aModifyTimer.SetTimeout( 500 ); - - EnableAutocomplete( sal_False ); -} - -LookUpComboBox_Impl::~LookUpComboBox_Impl() -{ -} - -void LookUpComboBox_Impl::Modify() -{ - m_aModifyTimer.Start(); -} - -IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) -{ - m_rDialogImpl.LookUp( GetText() ); - m_aModifyTimer.Stop(); - return 0; -} - -// class ReplaceEdit_Impl -------------------------------------------------- - -ReplaceEdit_Impl::ReplaceEdit_Impl( Window *pParent, const ResId &rResId ) - : Edit(pParent, rResId) - , m_pBtn(NULL) -{ -} - -ReplaceEdit_Impl::~ReplaceEdit_Impl() -{ -} - -void ReplaceEdit_Impl::Modify() -{ - if (m_pBtn) - m_pBtn->Enable( GetText().Len() > 0 ); -} - -void ReplaceEdit_Impl::SetText( const XubString& rStr ) -{ - Edit::SetText( rStr ); - Modify(); -} - -void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) -{ - Edit::SetText( rStr, rNewSelection ); - Modify(); -} - -// class ThesaurusAlternativesCtrl_Impl ---------------------------------- - -AlternativesString_Impl::AlternativesString_Impl( - ThesaurusAlternativesCtrl_Impl &rControl, - SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : - - SvLBoxString( pEntry, nFlags, rStr ), - m_rControlImpl( rControl ) -{ -} - -void AlternativesString_Impl::Paint( - const Point& rPos, - SvLBox& rDev, sal_uInt16, - SvLBoxEntry* pEntry ) -{ - AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); - Point aPos( rPos ); - Font aOldFont( rDev.GetFont()); - if (pData && pData->IsHeader()) - { - Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - rDev.SetFont( aFont ); - aPos.X() = 0; - } - else - aPos.X() += 5; - rDev.DrawText( aPos, GetText() ); - rDev.SetFont( aOldFont ); -} - -ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( - Window* pParent, - SvxThesaurusDialog_Impl &rImpl ) : - SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), - m_rDialogImpl( rImpl ) -{ - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); - SetHighlightRange(); -} - -ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() -{ - ClearExtraData(); -} - -void ThesaurusAlternativesCtrl_Impl::ClearExtraData() -{ - UserDataMap_t aEmpty; - m_aUserData.swap( aEmpty ); -} - -void ThesaurusAlternativesCtrl_Impl::SetExtraData( - const SvLBoxEntry *pEntry, - const AlternativesExtraData &rData ) -{ - if (!pEntry) - return; - - UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); - if (aIt != m_aUserData.end()) - aIt->second = rData; - else - m_aUserData[ pEntry ] = rData; -} - -AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( - const SvLBoxEntry *pEntry ) -{ - AlternativesExtraData *pRes = NULL; - UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); - if (aIt != m_aUserData.end()) - pRes = &aIt->second; - return pRes; -} - -SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - String aText; - if (bIsHeader && nVal >= 0) - { - aText = String::CreateFromInt32( nVal ); - aText += A2S( ". " ); - } - pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column - aText += rText; - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash - pEntry->AddItem( new AlternativesString_Impl( *this, pEntry, 0, aText ) ); - - SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) ); - GetModel()->Insert( pEntry ); - - if (bIsHeader) - GetViewDataEntry( pEntry )->SetSelectable( false ); - - return pEntry; -} - -void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) -{ - const KeyCode& rKey = rKEvt.GetKeyCode(); - - if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) - GetParent()->KeyInput( rKEvt ); // parent will close dialog... - else if (rKey.GetCode() == KEY_SPACE) - m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry - else if (GetEntryCount()) - SvxCheckListBox::KeyInput( rKEvt ); -} - -void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) -{ - if (!m_rDialogImpl.m_bWordFound) - { - Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); - aTextSize = LogicToPixel( aTextSize ); - Point aPos; - aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; - aPos.Y() += GetSizePixel().Height() / 2; - aPos = PixelToLogic( aPos ); - DrawText( aPos, m_rDialogImpl.aErrStr ); - - } - else - SvxCheckListBox::Paint( rRect ); -} - -// struct SvxThesaurusDialog_Impl ---------------------------------------- - -SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : - m_pDialog ( pDialog ), - aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), - aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), - aWordText ( pDialog, CUI_RES( FT_WORD ) ), - aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), - m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), - m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), - aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), - aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), - aFL ( pDialog, CUI_RES( FL_VAR ) ), - aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), - aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), - aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), - aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), - aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), - aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), - xThesaurus ( NULL ), - aLookUpText (), - nLookUpLanguage ( LANGUAGE_NONE ), - m_bWordFound( false ) -{ - // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog - - aReplaceEdit.SetButton( &aReplaceBtn ); - - aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); - aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); - aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); - m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); - m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); - - Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); -} - -SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() -{ - delete aLangMBtn.GetPopupMenu(); -} - -uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( - OUString& rTerm, - const lang::Locale& rLocale, - const beans::PropertyValues& rProperties ) - throw(lang::IllegalArgumentException, uno::RuntimeException) -{ - uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( - xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); - - // text with '.' at the end? - if (0 == aMeanings.getLength() && rTerm.getLength() && - rTerm.getStr()[ rTerm.getLength() - 1 ] == '.') - { - // try again without trailing '.' chars. It may be a word at the - // end of a sentence and not an abbreviation... - String aTxt( rTerm ); - aTxt.EraseTrailingChars( '.' ); - aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); - if (aMeanings.getLength()) - { - rTerm = aTxt; - } - } - - return aMeanings; -} - -bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() -{ - lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); - uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( - aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); - const sal_Int32 nMeanings = aMeanings.getLength(); - const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); - - m_pAlternativesCT->SetUpdateMode( sal_False ); - - // clear old user data of control before creating new ones via AddEntry below - m_pAlternativesCT->ClearExtraData(); - - m_pAlternativesCT->Clear(); - for (sal_Int32 i = 0; i < nMeanings; ++i) - { - OUString rMeaningTxt = pMeanings[i]->getMeaning(); - uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); - const sal_Int32 nSynonyms = aSynonyms.getLength(); - const OUString *pSynonyms = aSynonyms.getConstArray(); - DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); - DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); - - m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); - for (sal_Int32 k = 0; k < nSynonyms; ++k) - m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); - } - - m_pAlternativesCT->SetUpdateMode( sal_True ); - - return nMeanings > 0; -} - -void SvxThesaurusDialog_Impl::LookUp( const String &rText ) -{ - if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same - aWordCB.SetText( rText ); - LookUp_Impl(); -} - -IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) -{ - if (pBtn && aLookUpHistory.size() >= 2) - { - aLookUpHistory.pop(); // remove current look up word from stack - aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word - aLookUpHistory.pop(); - LookUp_Impl(); - } - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) -{ - PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); - if (pMenu && pBtn) - { - sal_uInt16 nItem = pBtn->GetCurItemId(); - String aLangText( pMenu->GetItemText( nItem ) ); - LanguageType nLang = SvtLanguageTable().GetType( aLangText ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - nLookUpLanguage = nLang; - m_pDialog->SetWindowTitle( nLang ); - UpdateVendorImage(); - LookUp_Impl(); - } - return 0; -} - -void SvxThesaurusDialog_Impl::LookUp_Impl() -{ - String aText( aWordCB.GetText() ); - - aLookUpText = OUString( aText ); - if (aLookUpText.getLength() > 0 && - (aLookUpHistory.empty() || aLookUpText != aLookUpHistory.top())) - aLookUpHistory.push( aLookUpText ); - - m_bWordFound = UpdateAlternativesBox_Impl(); - m_pAlternativesCT->Enable( m_bWordFound ); - - if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - aWordCB.InsertEntry( aText ); - - aReplaceEdit.SetText( String() ); - aLeftBtn.Enable( aLookUpHistory.size() > 1 ); -} - -IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) -{ - if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys - { - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - String aStr( pBox->GetEntry( nPos ) ); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - aWordCB.SetText( aStr ); - LookUp_Impl(); - } - - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) -{ - SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; - if (pEntry) - { - AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); - String aStr; - if (pData && !pData->IsHeader()) - { - aStr = pData->GetText(); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - } - aReplaceEdit.SetText( aStr ); - } - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) -{ - SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; - if (pEntry) - { - AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); - String aStr; - if (pData && !pData->IsHeader()) - { - aStr = pData->GetText(); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - } - - aWordCB.SetText( aStr ); - if (aStr.Len() > 0) - LookUp_Impl(); - } - - //! workaround to set the selection since calling SelectEntryPos within - //! the double click handler does not work - Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); - return 0; -} - -IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) -{ - (void) pThis; - if (pBox && pBox->GetEntryCount() >= 2) - pBox->SelectEntryPos( 1 ); // pos 0 is a 'header' that is not selectable - return 0; -} - -//////////////////////////////////////////////////////////// - -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - - Graphic aGraphic; - const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} - -static String lcl_GetThesImplName( const lang::Locale &rLocale ) -{ - String aRes; - - uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; - try - { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); - - DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); - if (xLngMgr.is()) - { - uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.Thesaurus")), rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - } - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "failed to get thesaurus" ); - } - - return aRes; -} - -void SvxThesaurusDialog_Impl::UpdateVendorImage() -{ - m_pDialog->SetUpdateMode( sal_False ); - - SvtLinguConfig aCfg; - if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) - { - Image aImage; - String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); - OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName ) ); - if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) - aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); - else - aImage = aVendorDefaultImage; - aVendorImageFI.SetImage( aImage ); - } - - m_pDialog->SetUpdateMode( sal_True ); -} - -IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) -{ - pThis->m_pDialog->SetUpdateMode( sal_False ); - - SvtLinguConfig aCfg; - if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) - { - Image aImage( pThis->aVendorDefaultImage ); - pThis->aVendorImageFI.SetImage( aImage ); - pThis->aVendorImageFI.Show(); - - // move down visible controls according to the vendor images height - Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); - Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); - if (aImageSize.Height()) - { - aVendorSize.Height() = aImageSize.Height(); - if(aVendorSize.Width() < aImageSize.Width()) - aVendorSize.Width() = aImageSize.Width(); - pThis->aVendorImageFI.SetSizePixel( aVendorSize ); - } - const sal_Int32 nDiff = aVendorSize.Height(); - pThis->aVendorImageFI.SetSizePixel( aVendorSize ); - Control* aControls[] = { - &pThis->aLeftBtn, - &pThis->aWordText, - &pThis->aWordCB, - &pThis->m_aAlternativesText, - pThis->m_pAlternativesCT.get(), - &pThis->aReplaceText, - &pThis->aReplaceEdit, - &pThis->aFL, - &pThis->aHelpBtn, - &pThis->aLangMBtn, - &pThis->aReplaceBtn, - &pThis->aCancelBtn, - 0 - }; - sal_Int32 nControl = 0; - while (aControls[nControl]) - { - Point aPos = aControls[nControl]->GetPosPixel(); - aPos.Y() += nDiff; - aControls[nControl]->SetPosPixel(aPos); - ++nControl; - } - Size aDlgSize = pThis->m_pDialog->GetSizePixel(); - aDlgSize.Height() += nDiff; - pThis->m_pDialog->SetSizePixel( aDlgSize ); - pThis->m_pDialog->Invalidate(); - } - - pThis->UpdateVendorImage(); - pThis->m_pDialog->SetUpdateMode( sal_True ); - - return 0; -}; - -// class SvxThesaurusDialog ---------------------------------------------- - -SvxThesaurusDialog::SvxThesaurusDialog( - Window* pParent, - uno::Reference< linguistic2::XThesaurus > xThes, - const String &rWord, - LanguageType nLanguage ) : - - SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) -{ - m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); - - m_pImpl->xThesaurus = xThes; - m_pImpl->aLookUpText = OUString( rWord ); - m_pImpl->nLookUpLanguage = nLanguage; - if (rWord.Len() > 0) - m_pImpl->aLookUpHistory.push( rWord ); - - FreeResource(); - - OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - String aTmp2( aTmp ); - m_pImpl->aReplaceEdit.SetText( aTmp2 ); - m_pImpl->aWordCB.InsertEntry( aTmp2 ); - - m_pImpl->LookUp( aTmp2 ); - m_pImpl->m_pAlternativesCT->GrabFocus(); - m_pImpl->aLeftBtn.Enable( sal_False ); - - // fill language menu button list - SvtLanguageTable aLangTab; - uno::Sequence< lang::Locale > aLocales; - if (m_pImpl->xThesaurus.is()) - aLocales = m_pImpl->xThesaurus->getLocales(); - const sal_Int32 nLocales = aLocales.getLength(); - const lang::Locale *pLocales = aLocales.getConstArray(); - delete m_pImpl->aLangMBtn.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); - std::vector< OUString > aLangVec; - for (sal_Int32 i = 0; i < nLocales; ++i ) - { - const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - aLangVec.push_back( aLangTab.GetString( nLang ) ); - } - std::sort( aLangVec.begin(), aLangVec.end() ); - for (size_t i = 0; i < aLangVec.size(); ++i) - pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 - m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); - - SetWindowTitle( nLanguage ); - - // disable controls if service is missing - if (!m_pImpl->xThesaurus.is()) - Enable( sal_False ); -} - -SvxThesaurusDialog::~SvxThesaurusDialog() -{ -} - -void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) -{ - // Sprache anpassen - String aStr( GetText() ); - aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); - aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); - aStr += SvtLanguageTable().GetLanguageString( nLanguage ); - aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // set window title -} - -String SvxThesaurusDialog::GetWord() -{ - return m_pImpl->aReplaceEdit.GetText(); -} - -sal_uInt16 SvxThesaurusDialog::GetLanguage() const -{ - return m_pImpl->nLookUpLanguage; -} - -void SvxThesaurusDialog::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc deleted file mode 100644 index 091838e64..000000000 --- a/cui/source/dialogs/thesdlg.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_THESDLG_HRC -#define _SVX_THESDLG_HRC - -// defines --------------------------------------------------------------- - -#define BTN_LEFT 9 -#define BTN_THES_OK 10 -#define BTN_THES_CANCEL 11 -#define MB_LANGUAGE 12 -#define BTN_THES_HELP 13 -#define FT_WORD 15 -#define CB_WORD 16 -#define FT_REPL 21 -#define ED_REPL 22 -#define FL_VAR 23 -#define FT_THES_ALTERNATIVES 24 -#define CT_THES_ALTERNATIVES 25 -#define IMG_VENDOR 26 -#define IMG_DEFAULT_VENDOR 27 - -#define STR_ERR_TEXTNOTFOUND 101 - -#endif diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src deleted file mode 100644 index 67fdced0f..000000000 --- a/cui/source/dialogs/thesdlg.src +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cuires.hrc" -#include "thesdlg.hrc" -#include "helpid.hrc" -#include <svx/svxids.hrc> // SID_THESAURUS - - - // RID_SVXDLG_THES ------------------------------------------------------- -ModalDialog RID_SVXDLG_THESAURUS -{ - HelpId = CMD_SID_THESAURUS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 235, 230 ) ; - Text [ en-US ] = "Thesaurus" ; - SvLook = TRUE ; - Moveable = TRUE ; - - FixedImage IMG_VENDOR - { - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime - Hide = TRUE; - }; - - ImageButton BTN_LEFT - { - HelpID = "cui:ImageButton:RID_SVXDLG_THESAURUS:BTN_LEFT"; - Pos = MAP_APPFONT ( 5 , 15 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - SYMBOL = IMAGEBUTTON_ARROW_LEFT ; - }; - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 24 , 5 ) ; - Size = MAP_APPFONT ( 143 , 8 ) ; - Text [ en-US ] = "~Current word" ; - LEFT = TRUE ; - }; - ComboBox CB_WORD - { - HelpID = "cui:ComboBox:RID_SVXDLG_THESAURUS:CB_WORD"; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 24 , 16 ) ; - Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines - }; - MenuButton MB_LANGUAGE - { - HelpID = "cui:MenuButton:RID_SVXDLG_THESAURUS:MB_LANGUAGE"; - Pos = MAP_APPFONT ( 170 , 16 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language" ; - }; - - FixedText FT_THES_ALTERNATIVES - { - Pos = MAP_APPFONT ( 5 , 33 ) ; - Size = MAP_APPFONT ( 255 , 8 ) ; - Text [ en-US ] = "~Alternatives" ; - LEFT = TRUE ; - }; - Control CT_THES_ALTERNATIVES - { - HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control - Pos = MAP_APPFONT ( 5 , 45 ) ; - Size = MAP_APPFONT ( 225 , 121 ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - FixedText FT_REPL - { - Pos = MAP_APPFONT ( 5 , 173 ) ; - Size = MAP_APPFONT ( 255 , 8 ) ; - Text [ en-US ] = "~Replace with" ; - LEFT = TRUE ; - }; - Edit ED_REPL - { - HelpID = "cui:Edit:RID_SVXDLG_THESAURUS:ED_REPL"; - BORDER = TRUE ; - Pos = MAP_APPFONT ( 5 , 184 ) ; - Size = MAP_APPFONT ( 225 , 12 ) ; - LEFT = TRUE ; - }; - FixedLine FL_VAR - { - Pos = MAP_APPFONT ( 0 , 200 ) ; - Size = MAP_APPFONT ( 235 , 8 ) ; - }; - - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 5 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 105 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Replace" ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL - { - Pos = MAP_APPFONT ( 170 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - - String STR_ERR_TEXTNOTFOUND - { - Text [ en-US ] = "No alternatives found." ; - }; - - Image IMG_DEFAULT_VENDOR - { - ImageBitmap = Bitmap { File = "vendor01.png"; }; - }; -}; - diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx deleted file mode 100644 index a985b2e8c..000000000 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_THESDLG_IMPL_HXX -#define _SVX_THESDLG_IMPL_HXX - -#include "thesdlg.hxx" - -#include <svtools/ehdl.hxx> -#include <svx/checklbx.hxx> -#include <vcl/button.hxx> -#include <vcl/combobox.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/image.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/menubtn.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> -#include <vcl/timer.hxx> -#include <vcl/wrkwin.hxx> - -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XMeaning.hpp> - -#include <stack> -#include <map> -#include <algorithm> - -using namespace ::com::sun::star; -using ::rtl::OUString; - -class SvLBoxEntry; -class ThesaurusAlternativesCtrl_Impl; - - -// class LookUpComboBox_Impl -------------------------------------------------- - -class LookUpComboBox_Impl : public ComboBox -{ - Timer m_aModifyTimer; - Selection m_aSelection; - Button * m_pBtn; - SvxThesaurusDialog_Impl & m_rDialogImpl; - - // disable copy c-tor and assignment operator - LookUpComboBox_Impl( const LookUpComboBox_Impl & ); - LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); - -public: - LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); - virtual ~LookUpComboBox_Impl(); - - DECL_LINK( ModifyTimer_Hdl, Timer * ); - - void SetButton( Button *pBtn ) { m_pBtn = pBtn; } - - // ComboBox - virtual void Modify(); -}; - -// class ReplaceEdit_Impl -------------------------------------------------- - -class ReplaceEdit_Impl : public Edit -{ - Button * m_pBtn; - - // disable copy c-tor and assignment operator - ReplaceEdit_Impl( const ReplaceEdit_Impl & ); - ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); - -public: - ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); - virtual ~ReplaceEdit_Impl(); - - void SetButton( Button *pBtn ) { m_pBtn = pBtn; } - - // Edit - virtual void Modify(); - virtual void SetText( const XubString& rStr ); - virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); -}; - -// class ThesaurusAlternativesCtrl_Impl ---------------------------------- - -class AlternativesExtraData -{ - String sText; - bool bHeader; - -public: - AlternativesExtraData() : bHeader( false ) {} - AlternativesExtraData( const String &rText, bool bIsHeader ) : - sText(rText), - bHeader(bIsHeader) - { - } - - bool IsHeader() const { return bHeader; } - const String& GetText() const { return sText; } -}; - - -class AlternativesString_Impl : public SvLBoxString -{ - ThesaurusAlternativesCtrl_Impl & m_rControlImpl; -public: - - AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl, - SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ); - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry); -}; - - -class ThesaurusAlternativesCtrl_Impl : - public SvxCheckListBox -{ - SvxThesaurusDialog_Impl & m_rDialogImpl; - - typedef std::map< const SvLBoxEntry *, AlternativesExtraData > UserDataMap_t; - UserDataMap_t m_aUserData; - - // disable copy c-tor and assignment operator - ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); - ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); - -public: - ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); - virtual ~ThesaurusAlternativesCtrl_Impl(); - - - SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); - - void ClearExtraData(); - void SetExtraData( const SvLBoxEntry *pEntry, const AlternativesExtraData &rData ); - AlternativesExtraData * GetExtraData( const SvLBoxEntry *pEntry ); - - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); -}; - - -// struct SvxThesaurusDialog_Impl ---------------------------------------- - -struct SvxThesaurusDialog_Impl -{ - SvxThesaurusDialog * m_pDialog; - - FixedImage aVendorImageFI; - ImageButton aLeftBtn; - FixedText aWordText; - LookUpComboBox_Impl aWordCB; - FixedText m_aAlternativesText; - boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; - FixedText aReplaceText; - ReplaceEdit_Impl aReplaceEdit; - FixedLine aFL; - HelpButton aHelpBtn; - MenuButton aLangMBtn; - OKButton aReplaceBtn; - CancelButton aCancelBtn; - - String aErrStr; - Image aVendorDefaultImage; - - uno::Reference< linguistic2::XThesaurus > xThesaurus; - OUString aLookUpText; - LanguageType nLookUpLanguage; - std::stack< OUString > aLookUpHistory; - bool m_bWordFound; - - - // Handler - DECL_LINK( LeftBtnHdl_Impl, Button * ); - DECL_LINK( LanguageHdl_Impl, MenuButton * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( WordSelectHdl_Impl, ComboBox * ); - DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); - DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); - - DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); - DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); - - - SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ); - ~SvxThesaurusDialog_Impl(); - - uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL - queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); - - bool UpdateAlternativesBox_Impl(); - void UpdateVendorImage(); - void LookUp( const String &rText ); - void LookUp_Impl(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/winpluginlib.cxx b/cui/source/dialogs/winpluginlib.cxx deleted file mode 100644 index 40b6e4154..000000000 --- a/cui/source/dialogs/winpluginlib.cxx +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include <windows.h> -#if defined _MSC_VER -#pragma warning(pop) -#endif -#include <winreg.h> -#include <shlwapi.h> -#include <stdio.h> - -#define SO_PATH_SIZE 4096 -#define MOZ_PLUGIN_DLL_NAME "npsopluginmi.dll" -extern "C" { -int lc_isInstalled(const char* realFilePath) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - char sSoPath[SO_PATH_SIZE]; - char sPluginPath[SO_PATH_SIZE]; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - if( ret == ERROR_FILE_NOT_FOUND) - return 1; - else - return -1; - } - ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hStarOffice); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - if( ret == ERROR_FILE_NOT_FOUND) - return 1; - else - return -1; - } - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - DWORD dType = REG_SZ; - DWORD dSize = SO_PATH_SIZE; - ret = RegQueryValueEx (hStarOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize); - if(ret == ERROR_SUCCESS){ - if(strcmp(sPluginPath, sSoPath) == 0) - ret = 0; - else - ret = 1; - } - else - ret = -1; - } - else - ret = -1; - RegCloseKey(hStarOffice); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - return ret; -} - -int lc_uninstallPlugin(const char*) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - - ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ|KEY_WRITE, &hStarOffice); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - RegCloseKey(hStarOffice); - ret = SHDeleteKey(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0"); - if(ret != ERROR_SUCCESS){ - ret = -1; - } - RegFlushKey(hMozillaPlugins); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - return ret; -} - -int lc_installPlugin(const char* realFilePath) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - char sSoPath[SO_PATH_SIZE]; - DWORD sState; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCreateKeyEx(hKeySoftware, - "MozillaPlugins", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hMozillaPlugins, - &sState); - } - - ret = RegCreateKeyEx(hMozillaPlugins, - "@sun.com/npsopluginmi;version=1.0", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hStarOffice, - &sState); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - return -1; - } - - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - ret = RegSetValueEx( hStarOffice, "Path", 0, REG_SZ, (LPBYTE) sSoPath, strlen(sSoPath) + 1); - if(ret == ERROR_SUCCESS) - ret = 0; - else - ret = -1; - } - else - ret = -1; - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - RegCloseKey(hStarOffice); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - RegFlushKey(HKEY_LOCAL_MACHINE); - - return ret; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx deleted file mode 100644 index 92c544cea..000000000 --- a/cui/source/dialogs/zoom.cxx +++ /dev/null @@ -1,497 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include <tools/shl.hxx> -#include <svl/itemset.hxx> -#include <svl/itempool.hxx> -#include <sfx2/objsh.hxx> -#include <vcl/msgbox.hxx> - -#define _SVX_ZOOM_CXX - -#include <cuires.hrc> -#include "zoom.hrc" - -#include "zoom.hxx" -#include <svx/zoomitem.hxx> -#include <svx/viewlayoutitem.hxx> -#include <dialmgr.hxx> -#include <svx/zoom_def.hxx> -#include <svx/dialogs.hrc> // RID_SVXDLG_ZOOM -#include <layout/layout-pre.hxx> - -#if ENABLE_LAYOUT -#undef CUI_RES -#define CUI_RES(x) #x -#undef SfxModalDialog -#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id ) -#endif /* ENABLE_LAYOUT */ - -// static ---------------------------------------------------------------- - -#define SPECIAL_FACTOR ((sal_uInt16)0xFFFF) - -// class SvxZoomDialog --------------------------------------------------- - -sal_uInt16 SvxZoomDialog::GetFactor() const -{ - if ( a100Btn.IsChecked() ) - return 100; - if ( aUserBtn.IsChecked() ) - return (sal_uInt16)aUserEdit.GetValue(); - else - return SPECIAL_FACTOR; -} - -// ----------------------------------------------------------------------- - -void SvxZoomDialog::SetFactor( sal_uInt16 nNewFactor, sal_uInt16 nBtnId ) -{ - aUserEdit.Disable(); - - if ( !nBtnId ) - { - if ( nNewFactor == 100 ) - { - a100Btn.Check(); - a100Btn.GrabFocus(); - } - else - { - aUserBtn.Check(); - aUserEdit.Enable(); - aUserEdit.SetValue( (long)nNewFactor ); - aUserEdit.GrabFocus(); - } - } - else - { - aUserEdit.SetValue( (long)nNewFactor ); - - if ( ZOOMBTN_OPTIMAL == nBtnId ) - { - aOptimalBtn.Check(); - aOptimalBtn.GrabFocus(); - } - else if ( ZOOMBTN_PAGEWIDTH == nBtnId ) - { - aPageWidthBtn.Check(); - aPageWidthBtn.GrabFocus(); - } - else if ( ZOOMBTN_WHOLEPAGE == nBtnId ) - { - aWholePageBtn.Check(); - aWholePageBtn.GrabFocus(); - } - } -} - -// ----------------------------------------------------------------------- - -void SvxZoomDialog::HideButton( sal_uInt16 nBtnId ) -{ - switch ( nBtnId ) - { - case ZOOMBTN_OPTIMAL: // Optimal-Button - aOptimalBtn.Hide(); - break; - - case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button - aPageWidthBtn.Hide(); - break; - - case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button - aWholePageBtn.Hide(); - break; - - default: - OSL_FAIL( "Falsche Button-Nummer!!!" ); - } -} - -// ----------------------------------------------------------------------- - -void SvxZoomDialog::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) -{ - DBG_ASSERT( nMin < nMax, "invalid limits" ); - aUserEdit.SetMin( nMin ); - aUserEdit.SetFirst( nMin ); - aUserEdit.SetMax( nMax ); - aUserEdit.SetLast( nMax ); -} - -// ----------------------------------------------------------------------- - -SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_ZOOM ) ), - - aZoomFl ( this, CUI_RES( FL_ZOOM ) ), - aOptimalBtn ( this, CUI_RES( BTN_OPTIMAL ) ), - aWholePageBtn ( this, CUI_RES( BTN_WHOLE_PAGE ) ), - aPageWidthBtn ( this, CUI_RES( BTN_PAGE_WIDTH ) ), - a100Btn ( this, CUI_RES( BTN_100 ) ), - aUserBtn ( this, CUI_RES( BTN_USER ) ), - aUserEdit ( this, CUI_RES( ED_USER ) ), - - aViewLayoutFl ( this, CUI_RES( FL_VIEWLAYOUT ) ), - aAutomaticBtn ( this, CUI_RES( BTN_AUTOMATIC ) ), - aSingleBtn ( this, CUI_RES( BTN_SINGLE ) ), - aColumnsBtn ( this, CUI_RES( BTN_COLUMNS ) ), - aColumnsEdit ( this, CUI_RES( ED_COLUMNS ) ), - aBookModeChk ( this, CUI_RES( CHK_BOOK ) ), - - aBottomFl ( this, CUI_RES( FL_BOTTOM ) ), - aOKBtn ( this, CUI_RES( BTN_ZOOM_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_ZOOM_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_ZOOM_HELP ) ), - - rSet ( rCoreSet ), - pOutSet ( NULL ), - bModified ( sal_False ) - -{ -#if ENABLE_LAYOUT - SetHelpId (".uno:Zoom"); -#endif /* ENABLE_LAYOUT */ - Link aLink = LINK( this, SvxZoomDialog, UserHdl ); - a100Btn.SetClickHdl( aLink ); - aOptimalBtn.SetClickHdl( aLink ); - aPageWidthBtn.SetClickHdl( aLink ); - aWholePageBtn.SetClickHdl( aLink ); - aUserBtn.SetClickHdl( aLink ); - - Link aViewLayoutLink = LINK( this, SvxZoomDialog, ViewLayoutUserHdl ); - aAutomaticBtn.SetClickHdl( aViewLayoutLink ); - aSingleBtn.SetClickHdl( aViewLayoutLink ); - aColumnsBtn.SetClickHdl( aViewLayoutLink ); - - Link aViewLayoutSpinLink = LINK( this, SvxZoomDialog, ViewLayoutSpinHdl ); - aColumnsEdit.SetModifyHdl( aViewLayoutSpinLink ); - - Link aViewLayoutCheckLink = LINK( this, SvxZoomDialog, ViewLayoutCheckHdl ); - aBookModeChk.SetClickHdl( aViewLayoutCheckLink ); - - aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) ); - aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) ); - - // Default-Werte - sal_uInt16 nValue = 100; - sal_uInt16 nMin = 10; - sal_uInt16 nMax = 1000; - - // ggf. erst den alten Wert besorgen - const SfxUInt16Item* pOldUserItem = 0; - SfxObjectShell* pSh = SfxObjectShell::Current(); - - if ( pSh ) - pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER ); - - if ( pOldUserItem ) - nValue = pOldUserItem->GetValue(); - - // UserEdit initialisieren - if ( nMin > nValue ) - nMin = nValue; - if ( nMax < nValue ) - nMax = nValue; - aUserEdit.SetMin( nMin ); - aUserEdit.SetFirst( nMin ); - aUserEdit.SetMax( nMax ); - aUserEdit.SetLast( nMax ); - aUserEdit.SetValue( nValue ); - - aUserEdit.SetAccessibleRelationLabeledBy( &aUserBtn ); - aUserEdit.SetAccessibleName(aUserBtn.GetText()); - aColumnsEdit.SetAccessibleRelationLabeledBy(&aColumnsBtn); - aColumnsEdit.SetAccessibleName(aColumnsBtn.GetText()); - aColumnsEdit.SetAccessibleRelationMemberOf(&aColumnsBtn); - aBookModeChk.SetAccessibleRelationLabeledBy(&aColumnsBtn); - aBookModeChk.SetAccessibleRelationMemberOf(&aColumnsBtn); - - const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); - - if ( rItem.ISA(SvxZoomItem) ) - { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem; - const sal_uInt16 nZoom = rZoomItem.GetValue(); - const SvxZoomType eType = rZoomItem.GetType(); - const sal_uInt16 nValSet = rZoomItem.GetValueSet(); - sal_uInt16 nBtnId = 0; - - switch ( eType ) - { - case SVX_ZOOM_OPTIMAL: - nBtnId = ZOOMBTN_OPTIMAL; - break; - case SVX_ZOOM_PAGEWIDTH: - nBtnId = ZOOMBTN_PAGEWIDTH; - break; - case SVX_ZOOM_WHOLEPAGE: - nBtnId = ZOOMBTN_WHOLEPAGE; - break; - case SVX_ZOOM_PERCENT: - break; - case SVX_ZOOM_PAGEWIDTH_NOBORDER: - break; - } - - if ( !(SVX_ZOOM_ENABLE_100 & nValSet) ) - a100Btn.Disable(); - if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) ) - aOptimalBtn.Disable(); - if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) ) - aPageWidthBtn.Disable(); - if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) ) - aWholePageBtn.Disable(); - SetFactor( nZoom, nBtnId ); - } - else - { - const sal_uInt16 nZoom = ( (const SfxUInt16Item&)rItem ).GetValue(); - SetFactor( nZoom ); - } - - const SfxPoolItem* pViewLayoutItem = 0; - if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, sal_False, &pViewLayoutItem ) ) - { - const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->GetValue(); - const bool bBookMode = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->IsBookMode(); - - if ( 0 == nColumns ) - { - aAutomaticBtn.Check(); - aColumnsEdit.SetValue( 2 ); - aColumnsEdit.Disable(); - aBookModeChk.Disable(); - } - else if ( 1 == nColumns) - { - aSingleBtn.Check(); - aColumnsEdit.SetValue( 2 ); - aColumnsEdit.Disable(); - aBookModeChk.Disable(); - } - else - { - aColumnsBtn.Check(); - if ( !bBookMode ) - { - aColumnsEdit.SetValue( nColumns ); - if ( 0 != nColumns % 2 ) - aBookModeChk.Disable(); - } - else - { - aColumnsEdit.SetValue( nColumns ); - aBookModeChk.Check(); - } - } - } - else - { - // hide view layout related controls: - aViewLayoutFl.Disable(); - aAutomaticBtn.Disable(); - aSingleBtn.Disable(); - aColumnsBtn.Disable(); - aColumnsEdit.Disable(); - aBookModeChk.Disable(); - } - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxZoomDialog::~SvxZoomDialog() -{ - delete pOutSet; - pOutSet = 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn ) -{ - bModified |= sal_True; - - if ( pBtn == &aUserBtn ) - { - aUserEdit.Enable(); - aUserEdit.GrabFocus(); - } - else - aUserEdit.Disable(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, SpinHdl, MetricField *, EMPTYARG ) -{ - if ( !aUserBtn.IsChecked() ) - return 0; - bModified |= sal_True; - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn ) -{ - bModified |= sal_True; - - if ( pBtn == &aAutomaticBtn ) - { - aColumnsEdit.Disable(); - aBookModeChk.Disable(); - } - else if ( pBtn == &aSingleBtn ) - { - aColumnsEdit.Disable(); - aBookModeChk.Disable(); - } - else if ( pBtn == &aColumnsBtn ) - { - aColumnsEdit.Enable(); - aColumnsEdit.GrabFocus(); - if ( 0 == aColumnsEdit.GetValue() % 2 ) - aBookModeChk.Enable(); - } - else - { - OSL_FAIL( "Wrong Button" ); - return 0; - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, ViewLayoutSpinHdl, MetricField *, pEdt ) -{ - if ( pEdt == &aColumnsEdit && !aColumnsBtn.IsChecked() ) - return 0; - - if ( 0 == aColumnsEdit.GetValue() % 2 ) - aBookModeChk.Enable(); - else - { - aBookModeChk.Check( sal_False ); - aBookModeChk.Disable(); - } - - bModified |= sal_True; - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk ) -{ - if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() ) - return 0; - - bModified |= sal_True; - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn ) -{ - if ( bModified || &aOKBtn != pBtn ) - { - SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); - SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) ); - - if ( &aOKBtn == pBtn ) - { - sal_uInt16 nFactor = GetFactor(); - - if ( SPECIAL_FACTOR == nFactor ) - { - if ( aOptimalBtn.IsChecked() ) - aZoomItem.SetType( SVX_ZOOM_OPTIMAL ); - else if ( aPageWidthBtn.IsChecked() ) - aZoomItem.SetType( SVX_ZOOM_PAGEWIDTH ); - else if ( aWholePageBtn.IsChecked() ) - aZoomItem.SetType( SVX_ZOOM_WHOLEPAGE ); - } - else - aZoomItem.SetValue( nFactor ); - - if ( aAutomaticBtn.IsChecked() ) - { - aViewLayoutItem.SetValue( 0 ); - aViewLayoutItem.SetBookMode( false ); - } - if ( aSingleBtn.IsChecked() ) - { - aViewLayoutItem.SetValue( 1 ); - aViewLayoutItem.SetBookMode( false ); - } - else if ( aColumnsBtn.IsChecked() ) - { - aViewLayoutItem.SetValue( static_cast<sal_uInt16>(aColumnsEdit.GetValue()) ); - aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() ); - } - } - else - { - OSL_FAIL( "Wrong Button" ); - return 0; - } - pOutSet = new SfxItemSet( rSet ); - pOutSet->Put( aZoomItem ); - - // don't set attribute in case the whole viewlayout stuff is disabled: - if ( aViewLayoutFl.IsEnabled() ) - pOutSet->Put( aViewLayoutItem ); - - // Wert aus dem UserEdit "uber den Dialog hinaus merken - SfxObjectShell* pSh = SfxObjectShell::Current(); - - if ( pSh ) - pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER, - (sal_uInt16)aUserEdit.GetValue() ) ); - EndDialog( RET_OK ); - } - else - EndDialog( RET_CANCEL ); - return 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/zoom.hrc b/cui/source/dialogs/zoom.hrc deleted file mode 100644 index dbb901f3e..000000000 --- a/cui/source/dialogs/zoom.hrc +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_ZOOM_HRC -#define _SVX_ZOOM_HRC - -// defines ------------------------------------------------------------------ - -#define FL_ZOOM 14 -#define BTN_OPTIMAL 15 -#define BTN_WHOLE_PAGE 16 -#define BTN_PAGE_WIDTH 17 -#define BTN_100 18 -#define BTN_USER 19 -#define ED_USER 20 - -#define FL_VIEWLAYOUT 21 -#define BTN_AUTOMATIC 22 -#define BTN_SINGLE 23 -#define BTN_COLUMNS 24 -#define ED_COLUMNS 25 -#define CHK_BOOK 26 - -#define FL_BOTTOM 27 -#define BTN_ZOOM_OK 28 -#define BTN_ZOOM_CANCEL 29 -#define BTN_ZOOM_HELP 30 - -#endif diff --git a/cui/source/dialogs/zoom.src b/cui/source/dialogs/zoom.src deleted file mode 100644 index 02448648a..000000000 --- a/cui/source/dialogs/zoom.src +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include <cuires.hrc> -#include "zoom.hrc" -#include <svx/dialogs.hrc> // for RID_SVXDLG_ZOOM -#include "helpid.hrc" - - // RID_SVXDLG_ZOOM ------------------------------------------------------- -ModalDialog RID_SVXDLG_ZOOM -{ - HelpId = CMD_SID_ATTR_ZOOM; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 242 , 112 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Zoom & View Layout"; - FixedLine FL_ZOOM - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "Zoom factor"; - }; - RadioButton BTN_OPTIMAL - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_OPTIMAL"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "~Optimal" ; - }; - RadioButton BTN_WHOLE_PAGE - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_WHOLE_PAGE"; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "~Fit width and height" ; - }; - RadioButton BTN_PAGE_WIDTH - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_PAGE_WIDTH"; - Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 105, 10 ) ; - Text [ en-US ] = "Fit ~width" ; - }; - RadioButton BTN_100 - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_100"; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 105, 10 ) ; - Text = "~100 %" ; - }; - RadioButton BTN_USER - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_USER"; - Pos = MAP_APPFONT ( 12 , 67 ) ; - Size = MAP_APPFONT ( 72 , 10 ) ; - Text [ en-US ] = "~Variable" ; - }; - MetricField ED_USER - { - HelpID = "cui:MetricField:RID_SVXDLG_ZOOM:ED_USER"; - Pos = MAP_APPFONT ( 86 , 66 ) ; - Size = MAP_APPFONT ( 32 , 12 ) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 1 ; - }; - FixedLine FL_VIEWLAYOUT - { - Pos = MAP_APPFONT ( 124 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "View layout"; - }; - RadioButton BTN_AUTOMATIC - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_AUTOMATIC"; - Pos = MAP_APPFONT ( 130 , 14 ) ; - Size = MAP_APPFONT ( 106 , 10 ) ; - Text [ en-US ] = "~Automatic" ; - }; - RadioButton BTN_SINGLE - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_SINGLE"; - Pos = MAP_APPFONT ( 130, 27 ) ; - Size = MAP_APPFONT ( 106, 10 ) ; - Text [ en-US ] = "~Single page" ; - }; - RadioButton BTN_COLUMNS - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_COLUMNS"; - Pos = MAP_APPFONT ( 130, 41 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "~Columns" ; - }; - MetricField ED_COLUMNS - { - HelpID = "cui:MetricField:RID_SVXDLG_ZOOM:ED_COLUMNS"; - Pos = MAP_APPFONT ( 209 , 40 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - SpinSize = 1 ; - Minimum = 1; - Maximum = 999; - }; - CheckBox CHK_BOOK - { - HelpID = "cui:CheckBox:RID_SVXDLG_ZOOM:CHK_BOOK"; - Pos = MAP_APPFONT ( 136 , 55 ) ; - Size = MAP_APPFONT ( 85 , 10 ) ; - Text [ en-US ] = "~Book mode" ; - }; - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 6 , 81 ) ; - Size = MAP_APPFONT ( 230 , 8 ) ; - }; - OKButton BTN_ZOOM_OK - { - Pos = MAP_APPFONT ( 77 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ZOOM_CANCEL - { - Pos = MAP_APPFONT ( 130 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_ZOOM_HELP - { - Pos = MAP_APPFONT ( 186 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -// ********************************************************************** EOF |