summaryrefslogtreecommitdiff
path: root/cui/source/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r--cui/source/dialogs/SpellAttrib.cxx175
-rw-r--r--cui/source/dialogs/SpellAttrib.hxx176
-rw-r--r--cui/source/dialogs/SpellDialog.cxx2155
-rw-r--r--cui/source/dialogs/SpellDialog.hrc58
-rw-r--r--cui/source/dialogs/SpellDialog.src245
-rw-r--r--cui/source/dialogs/charmap.hrc54
-rw-r--r--cui/source/dialogs/charmap.src162
-rw-r--r--cui/source/dialogs/commonlingui.cxx292
-rw-r--r--cui/source/dialogs/commonlingui.hxx174
-rw-r--r--cui/source/dialogs/commonlingui.src156
-rw-r--r--cui/source/dialogs/cuicharmap.cxx589
-rw-r--r--cui/source/dialogs/cuifmsearch.cxx968
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx1272
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx759
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx417
-rwxr-xr-xcui/source/dialogs/cuiimapdlg.hrc47
-rwxr-xr-xcui/source/dialogs/cuiimapdlg.src151
-rw-r--r--cui/source/dialogs/cuiimapwnd.cxx100
-rw-r--r--cui/source/dialogs/cuitbxform.cxx68
-rw-r--r--cui/source/dialogs/dlgname.cxx239
-rw-r--r--cui/source/dialogs/dlgname.hrc49
-rw-r--r--cui/source/dialogs/dlgname.src272
-rw-r--r--cui/source/dialogs/fmsearch.hrc89
-rw-r--r--cui/source/dialogs/fmsearch.src332
-rw-r--r--cui/source/dialogs/gallery.src482
-rw-r--r--cui/source/dialogs/grfflt.hrc83
-rw-r--r--cui/source/dialogs/grfflt.src457
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx1913
-rw-r--r--cui/source/dialogs/hangulhanjadlg.hrc200
-rw-r--r--cui/source/dialogs/hangulhanjadlg.src431
-rw-r--r--cui/source/dialogs/hldocntp.cxx521
-rw-r--r--cui/source/dialogs/hldoctp.cxx383
-rw-r--r--cui/source/dialogs/hlinettp.cxx547
-rw-r--r--cui/source/dialogs/hlmailtp.cxx364
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx546
-rw-r--r--cui/source/dialogs/hlmarkwn.hrc37
-rw-r--r--cui/source/dialogs/hlmarkwn.src98
-rw-r--r--cui/source/dialogs/hltpbase.cxx873
-rw-r--r--cui/source/dialogs/hyperdlg.hrc103
-rw-r--r--cui/source/dialogs/hyperdlg.src971
-rw-r--r--cui/source/dialogs/iconcdlg.cxx1438
-rw-r--r--cui/source/dialogs/iconcdlg.src63
-rw-r--r--cui/source/dialogs/insdlg.cxx1060
-rw-r--r--cui/source/dialogs/insrc.cxx85
-rw-r--r--cui/source/dialogs/insrc.hrc43
-rw-r--r--cui/source/dialogs/insrc.src118
-rw-r--r--cui/source/dialogs/linkdlg.cxx716
-rwxr-xr-xcui/source/dialogs/makefile.mk118
-rw-r--r--cui/source/dialogs/multifil.cxx187
-rw-r--r--cui/source/dialogs/multipat.cxx363
-rw-r--r--cui/source/dialogs/multipat.hrc47
-rw-r--r--cui/source/dialogs/multipat.src153
-rw-r--r--cui/source/dialogs/newtabledlg.cxx74
-rw-r--r--cui/source/dialogs/newtabledlg.hrc38
-rw-r--r--cui/source/dialogs/newtabledlg.src138
-rw-r--r--cui/source/dialogs/pastedlg.cxx310
-rw-r--r--cui/source/dialogs/plfilter.cxx129
-rw-r--r--cui/source/dialogs/postdlg.cxx262
-rw-r--r--cui/source/dialogs/postdlg.hrc54
-rw-r--r--cui/source/dialogs/postdlg.src160
-rw-r--r--cui/source/dialogs/scriptdlg.cxx1694
-rw-r--r--cui/source/dialogs/scriptdlg.hrc83
-rw-r--r--cui/source/dialogs/scriptdlg.src310
-rw-r--r--cui/source/dialogs/sdrcelldlg.cxx104
-rw-r--r--cui/source/dialogs/sdrcelldlg.src144
-rw-r--r--cui/source/dialogs/showcols.cxx141
-rw-r--r--cui/source/dialogs/showcols.src105
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx114
-rw-r--r--cui/source/dialogs/splitcelldlg.hrc45
-rw-r--r--cui/source/dialogs/splitcelldlg.src135
-rw-r--r--cui/source/dialogs/srchxtra.cxx294
-rw-r--r--cui/source/dialogs/srchxtra.hrc54
-rw-r--r--cui/source/dialogs/srchxtra.src282
-rw-r--r--cui/source/dialogs/svuidlg.hrc137
-rw-r--r--cui/source/dialogs/svuidlg.src711
-rw-r--r--cui/source/dialogs/tbxform.src67
-rw-r--r--cui/source/dialogs/winpluginlib.cpp233
-rw-r--r--cui/source/dialogs/zoom.cxx537
-rw-r--r--cui/source/dialogs/zoom.hrc56
-rw-r--r--cui/source/dialogs/zoom.src160
80 files changed, 27970 insertions, 0 deletions
diff --git a/cui/source/dialogs/SpellAttrib.cxx b/cui/source/dialogs/SpellAttrib.cxx
new file mode 100644
index 000000000000..9c26dc321f7b
--- /dev/null
+++ b/cui/source/dialogs/SpellAttrib.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SpellAttrib.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <SpellAttrib.hxx>
+#include <vcl/font.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+using namespace svx;
+using namespace com::sun::star::linguistic2;
+using namespace com::sun::star::uno;
+
+/*-- 26.06.2008 10:41:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) :
+ TextAttrib(TEXTATTR_SPELL_ERROR),
+ m_aSpellErrorDescription( rDesc )
+{
+}
+
+/*-- 10.09.2003 12:54:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_ERROR),
+ m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription )
+{
+}
+/*-- 10.09.2003 12:54:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellErrorAttrib::~SpellErrorAttrib()
+{
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellErrorAttrib::SetFont( Font& ) const
+{
+ //this attribute doesn't have a visual effect
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellErrorAttrib::Clone() const
+{
+ return new SpellErrorAttrib(*this);
+}
+/*-- 10.09.2003 12:54:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription;
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) :
+ TextAttrib(TEXTATTR_SPELL_LANGUAGE),
+ m_eLanguage(eLang)
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_LANGUAGE),
+ m_eLanguage(rAttr.m_eLanguage)
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellLanguageAttrib::~SpellLanguageAttrib()
+{
+}
+/*-- 10.09.2003 14:27:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellLanguageAttrib::SetFont( Font& ) const
+{
+ //no visual effect
+}
+/*-- 10.09.2003 14:27:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellLanguageAttrib::Clone() const
+{
+ return new SpellLanguageAttrib(*this);
+}
+/*-- 10.09.2003 14:27:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage;
+}
+/*-- 31.10.2003 16:07:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) :
+ TextAttrib(TEXTATTR_SPELL_BACKGROUND),
+ m_aBackgroundColor(rCol)
+{
+}
+/*-- 31.10.2003 16:07:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) :
+ TextAttrib(TEXTATTR_SPELL_BACKGROUND),
+ m_aBackgroundColor(rAttr.m_aBackgroundColor)
+{
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellBackgroundAttrib::~SpellBackgroundAttrib()
+{
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellBackgroundAttrib::SetFont( Font& rFont ) const
+{
+ rFont.SetFillColor(m_aBackgroundColor);
+}
+/*-- 31.10.2003 16:07:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TextAttrib* SpellBackgroundAttrib::Clone() const
+{
+ return new SpellBackgroundAttrib(*this);
+}
+/*-- 31.10.2003 16:07:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return Which() == rAttr.Which() &&
+ m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor;
+}
+
diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx
new file mode 100644
index 000000000000..ac2bb278c594
--- /dev/null
+++ b/cui/source/dialogs/SpellAttrib.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SpellAttrib.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SPELL_ATTRIB
+#define _SVX_SPELL_ATTRIB
+
+#include <svtools/txtattr.hxx>
+#include <i18npool/lang.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <tools/color.hxx>
+//namespace com{ namespace sun{ namespace star{ namespace linguistic2{
+// class XSpellAlternatives;
+//}}}}
+
+#define TEXTATTR_SPELL_ERROR (TEXTATTR_USER_START + 1)
+#define TEXTATTR_SPELL_LANGUAGE (TEXTATTR_USER_START + 2)
+#define TEXTATTR_SPELL_BACKGROUND (TEXTATTR_USER_START + 3)
+
+namespace svx{
+struct SpellErrorDescription
+{
+ bool bIsGrammarError;
+ ::rtl::OUString sErrorText;
+ ::rtl::OUString sDialogTitle;
+ ::rtl::OUString sExplanation;
+ ::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSuggestions;
+ ::rtl::OUString sRuleId;
+
+ SpellErrorDescription() :
+ bIsGrammarError( false ){}
+
+ SpellErrorDescription( bool bGrammar,
+ const ::rtl::OUString& rText,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker,
+ const ::rtl::OUString& rServiceName,
+ const ::rtl::OUString* pDialogTitle = 0,
+ const ::rtl::OUString* pExplanation = 0,
+ const ::rtl::OUString* pRuleId = 0 ) :
+ bIsGrammarError( bGrammar ),
+ sErrorText( rText ),
+ aLocale( rLocale ),
+ xGrammarChecker( rxGrammarChecker ),
+ sServiceName( rServiceName ),
+ aSuggestions( rSuggestions )
+ {
+ if( pDialogTitle )
+ sDialogTitle = *pDialogTitle;
+ if( pExplanation )
+ sExplanation = *pExplanation;
+ if( pRuleId )
+ sRuleId = *pRuleId;
+ };
+
+ int operator==( const SpellErrorDescription& rDesc ) const
+ {
+ return bIsGrammarError == rDesc.bIsGrammarError &&
+ sErrorText.equals( rDesc.sErrorText ) &&
+ aLocale.Language.equals( rDesc.aLocale.Language ) &&
+ aLocale.Country.equals( rDesc.aLocale.Country ) &&
+ aLocale.Variant.equals( rDesc.aLocale.Variant ) &&
+ aSuggestions == rDesc.aSuggestions &&
+ xGrammarChecker == rDesc.xGrammarChecker &&
+ sDialogTitle.equals( rDesc.sDialogTitle ) &&
+ sExplanation.equals( rDesc.sExplanation ) &&
+ sRuleId == rDesc.sRuleId;
+ }
+};
+/* -----------------10.09.2003 14:23-----------------
+
+ --------------------------------------------------*/
+class SpellErrorAttrib : public TextAttrib
+{
+public:
+
+private:
+ //com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> m_xAlternatives;
+ SpellErrorDescription m_aSpellErrorDescription;
+
+ //not accessible
+ SpellErrorAttrib();
+public:
+// SpellErrorAttrib(com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> xAlternatives);
+ SpellErrorAttrib( const SpellErrorDescription& );
+ SpellErrorAttrib( const SpellErrorAttrib& rAttr );
+ ~SpellErrorAttrib();
+
+ const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; }
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+/* -----------------10.09.2003 14:23-----------------
+
+ --------------------------------------------------*/
+class SpellLanguageAttrib : public TextAttrib
+{
+ LanguageType m_eLanguage;
+
+ //not accessible
+ SpellLanguageAttrib();
+
+public:
+ SpellLanguageAttrib(LanguageType eLanguage);
+ SpellLanguageAttrib( const SpellLanguageAttrib& rAttr );
+ ~SpellLanguageAttrib();
+
+ LanguageType GetLanguage() const {return m_eLanguage;}
+ void SetLanguage(LanguageType eLang)
+ {m_eLanguage = eLang;}
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+/* -----------------31.10.2003 16:01-----------------
+
+ --------------------------------------------------*/
+class SpellBackgroundAttrib : public TextAttrib
+{
+ Color m_aBackgroundColor;
+
+ //not accessible
+ SpellBackgroundAttrib();
+
+public:
+ SpellBackgroundAttrib(const Color& rCol);
+ SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr );
+ ~SpellBackgroundAttrib();
+
+ const Color& GetColor() const { return m_aBackgroundColor;}
+ void SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;}
+
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+}//namespace svx
+#endif
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
new file mode 100644
index 000000000000..0e69585a4ff4
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -0,0 +1,2155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SpellDialog.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// 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 <svx/unolingu.hxx>
+#include <svx/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 <svx/impgrf.hxx>
+#include <cuires.hrc>
+#include <helpid.hrc>
+#include "SpellDialog.hrc"
+#include <svx/optitems.hxx>
+#include <svx/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"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::linguistic2;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+// struct SpellDialog_Impl ---------------------------------------------
+
+struct SpellDialog_Impl
+{
+ Sequence< Reference< XDictionary > > aDics;
+};
+// -----------------------------------------------------------------------
+//#define VENDOR_IMAGE_HEIGHT 44 //as specified
+
+#define SPELLUNDO_CHANGE_LANGUAGE (TEXTUNDO_USER + 1)
+#define SPELLUNDO_CHANGE_TEXTENGINE (TEXTUNDO_USER + 2)
+#define SPELLUNDO_CHANGE_NEXTERROR (TEXTUNDO_USER + 3)
+#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (TEXTUNDO_USER + 4)
+#define SPELLUNDO_CHANGE_GROUP (TEXTUNDO_USER + 5) //undo list
+#define SPELLUNDO_MOVE_ERROREND (TEXTUNDO_USER + 6)
+#define SPELLUNDO_UNDO_EDIT_MODE (TEXTUNDO_USER + 7)
+#define SPELLUNDO_ADD_IGNORE_RULE (TEXTUNDO_USER + 8)
+
+namespace svx{
+class SpellUndoAction_Impl : public SfxUndoAction
+{
+ USHORT m_nId;
+ const Link& m_rActionLink;
+ //undo of button enabling
+ bool m_bEnableChangePB;
+ bool m_bEnableChangeAllPB;
+ //undo of MarkNextError - used in change and change all, ignore and ignore all
+ long m_nNewErrorStart;
+ long m_nNewErrorEnd;
+ long m_nOldErrorStart;
+ long m_nOldErrorEnd;
+ bool m_bIsErrorLanguageSelected;
+ ::rtl::OUString m_sRuleId;
+ //undo of AddToDictionary
+ Reference<XDictionary> m_xDictionary;
+ ::rtl::OUString m_sAddedWord;
+ //move end of error - ::ChangeMarkedWord()
+ long m_nOffset;
+
+public:
+ SpellUndoAction_Impl(USHORT nId, const Link& rActionLink) :
+ m_nId(nId),
+ m_rActionLink( rActionLink),
+ m_bEnableChangePB(false),
+ m_bEnableChangeAllPB(false),
+ m_nNewErrorStart(-1),
+ m_nNewErrorEnd(-1),
+ m_nOldErrorStart(-1),
+ m_nOldErrorEnd(-1),
+ m_bIsErrorLanguageSelected(false),
+ m_nOffset(0)
+ {}
+
+ ~SpellUndoAction_Impl();
+
+ virtual void Undo();
+ virtual USHORT GetId() const;
+
+ void SetEnableChangePB(){m_bEnableChangePB = true;}
+ bool IsEnableChangePB(){return m_bEnableChangePB;}
+
+ void SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;}
+ bool IsEnableChangeAllPB(){return m_bEnableChangeAllPB;}
+
+ void SetErrorMove(long nNewStart, long nNewEnd, long nOldStart, long nOldEnd)
+ {
+ m_nNewErrorStart = nNewStart;
+ m_nNewErrorEnd = nNewEnd;
+ m_nOldErrorStart = nOldStart;
+ m_nOldErrorEnd = nOldEnd;
+ }
+ long GetNewErrorStart() { return m_nNewErrorStart;}
+ long GetNewErrorEnd() { return m_nNewErrorEnd;}
+ long GetOldErrorStart() { return m_nOldErrorStart;}
+ long GetOldErrorEnd() { return m_nOldErrorEnd;}
+
+ void SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;}
+ bool IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;}
+
+
+ void SetDictionary(Reference<XDictionary> xDict) { m_xDictionary = xDict; }
+ Reference<XDictionary> GetDictionary() const {return m_xDictionary;}
+ void SetAddedWord(const ::rtl::OUString& rWord) {m_sAddedWord = rWord;}
+ const ::rtl::OUString& GetAddedWord() const { return m_sAddedWord;}
+
+ void SetOffset(long nSet) {m_nOffset = nSet;}
+ long GetOffset() const {return m_nOffset;}
+
+ void SetErrorType( const ::rtl::OUString& rId ) { m_sRuleId = rId; }
+ const ::rtl::OUString& GetErrorType() const { return m_sRuleId; }
+
+};
+}//namespace svx
+using namespace ::svx;
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellUndoAction_Impl::~SpellUndoAction_Impl()
+{
+}
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellUndoAction_Impl::Undo()
+{
+ m_rActionLink.Call(this);
+}
+/*-- 06.11.2003 12:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SpellUndoAction_Impl::GetId()const
+{
+ return m_nId;
+}
+
+// class SvxSpellCheckDialog ---------------------------------------------
+
+SpellDialog::SpellDialog(
+ SpellDialogChildWindow* pChildWindow,
+ Window * pParent,
+ SfxBindings* _pBindings)
+ : SfxModelessDialog (_pBindings,
+ pChildWindow,
+ pParent,
+ 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 ) ),
+ aVendorImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ),
+
+ 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, FALSE, FALSE, TRUE );
+
+ // get current language
+ UpdateBoxes_Impl();
+
+ // fill dictionary PopupMenu
+ InitUserDicts();
+
+ aSentenceED.ClearModifyFlag();
+ SvxGetChangeAllList()->clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SpellDialog::UpdateBoxes_Impl()
+{
+ sal_Int32 i;
+ aSuggestionLB.Clear();
+
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+
+ LanguageType nAltLanguage = LANGUAGE_NONE;
+ //String aAltWord;
+ Sequence< ::rtl::OUString > aNewWords;
+ bool bIsGrammarError = false;
+ if( pSpellErrorDescription )
+ {
+ nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale );
+ //aAltWord = String( xAlt->getWord() );
+ aNewWords = pSpellErrorDescription->aSuggestions;
+ bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
+ aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation );
+ }
+ if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() )
+ {
+ // use this function to apply the correct image to be used...
+ SetTitle_Impl( nAltLanguage );
+ // then change the title to the one to be actually used
+ SetText( pSpellErrorDescription->sDialogTitle );
+ }
+ else
+ SetTitle_Impl( nAltLanguage );
+ SetSelectedLang_Impl( nAltLanguage );
+
+
+ // Alternativen eintragen
+ const ::rtl::OUString *pNewWords = aNewWords.getConstArray();
+ const sal_Int32 nSize = aNewWords.getLength();
+ for ( i = 0; i < nSize; ++i )
+ {
+ String aTmp( pNewWords[i] );
+ if ( LISTBOX_ENTRY_NOTFOUND == aSuggestionLB.GetEntryPos( aTmp ) )
+ {
+ aSuggestionLB.InsertEntry( aTmp );
+ aSuggestionLB.SetEntryFlags(aSuggestionLB.GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE);
+ }
+ }
+ if(!nSize)
+ aSuggestionLB.InsertEntry( aNoSuggestionsST );
+ aAutoCorrPB.Enable( nSize > 0 );
+ //aSentenceED.GrabFocus();
+
+ aSuggestionFT.Enable(nSize > 0);
+ aSuggestionLB.Enable(nSize > 0);
+ if( nSize )
+ {
+ aSuggestionLB.SelectEntryPos(0);
+ }
+ aChangePB.Enable( nSize > 0);
+ aChangeAllPB.Enable(nSize > 0);
+ bool bShowChangeAll = !bIsGrammarError;
+ aChangeAllPB.Show( bShowChangeAll );
+ aExplainPB.Show( !bShowChangeAll );
+ aLanguageLB.Enable( bShowChangeAll );
+ aIgnoreAllPB.Show( bShowChangeAll );
+ aAddToDictMB.Show( bShowChangeAll );
+ aIgnoreRulePB.Show( !bShowChangeAll );
+ aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength());
+ aExplainPB.Enable( aExplainPB.HasExplanation() );
+ aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
+
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
+{
+ //initially or after the last error of a sentence MarkNextError will fail
+ //then GetNextSentence() has to be called followed again by MarkNextError()
+ //MarkNextError is not initally called if the UndoEdit mode is active
+ bool bNextSentence = false;
+ if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) ||
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError()))
+ {
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription )
+ {
+ UpdateBoxes_Impl();
+ Control* aControls[] =
+ {
+ &aNotInDictFT,
+ &aSentenceED,
+ &aLanguageFT,
+ 0
+ };
+ sal_Int32 nIdx = 0;
+ do
+ {
+ aControls[nIdx]->Enable(sal_True);
+ }
+ while(aControls[++nIdx]);
+
+
+ }
+ if( bNextSentence )
+ {
+ //remove undo if a new sentence is active
+ aSentenceED.ResetUndo();
+ aUndoPB.Enable(FALSE);
+ }
+ }
+}
+/* -----------------10.09.2003 14:04-----------------
+ Initialize, asynchronous to prevent virtial calls
+ from a constructor
+ --------------------------------------------------*/
+IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
+{
+ pThis->SetUpdateMode( sal_False );
+ //show or hide AutoCorrect depending on the modules abilities
+ pThis->aAutoCorrPB.Show(pThis->rParent.HasAutoCorrection());
+ pThis->SpellContinue_Impl();
+ pThis->aSentenceED.ResetUndo();
+ pThis->aUndoPB.Enable(FALSE);
+
+ pThis->LockFocusChanges(true);
+ if( pThis->aChangePB.IsEnabled() )
+ pThis->aChangePB.GrabFocus();
+ else if( pThis->aIgnorePB.IsEnabled() )
+ pThis->aIgnorePB.GrabFocus();
+ else if( pThis->aClosePB.IsEnabled() )
+ pThis->aClosePB.GrabFocus();
+ pThis->LockFocusChanges(false);
+ //show grammar CheckBox depending on the modules abilities
+ bool bHasGrammarChecking = pThis->rParent.HasGrammarChecking();
+ pThis->aCheckGrammarCB.Show( bHasGrammarChecking );
+ if( !bHasGrammarChecking )
+ {
+ //resize the dialog to hide the hidden area of the CheckBox
+ Size aBackSize = pThis->aBackgroundGB.GetSizePixel();
+ sal_Int32 nDiff = pThis->aBackgroundGB.GetPosPixel().Y() + aBackSize.Height()
+ - pThis->aCheckGrammarCB.GetPosPixel().Y();
+ aBackSize.Height() -= nDiff;
+ pThis->aBackgroundGB.SetSizePixel(aBackSize);
+ Button* aButtons[] = { &pThis->aHelpPB, &pThis->aOptionsPB, &pThis->aUndoPB, &pThis->aClosePB, 0 };
+ sal_Int32 nButton = 0;
+ while( aButtons[nButton])
+ {
+ Point aPos = aButtons[nButton]->GetPosPixel();
+ aPos.Y() -= nDiff;
+ aButtons[nButton]->SetPosPixel(aPos);
+ ++nButton;
+ }
+ Size aDlgSize = pThis->GetSizePixel();
+ aDlgSize.Height() -= nDiff;
+ pThis->SetSizePixel( aDlgSize );
+ }
+ else
+ {
+ if( SvtLinguConfig().HasAnyVendorImages() )
+ {
+ pThis->aVendorImageFI.Show();
+ Size aVendorSize = pThis->aVendorImageFI.GetSizePixel();
+ Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel();
+ if( aImageSize.Height() )
+ {
+ aVendorSize.Height() = aImageSize.Height();
+ if(aVendorSize.Width() < aImageSize.Width())
+ aVendorSize.Width() = aImageSize.Width();
+ pThis->aVendorImageFI.SetSizePixel( aVendorSize );
+ }
+ //aVendorSize.Height() = nDiff;
+ sal_Int32 nDiff = aVendorSize.Height();
+ pThis->aVendorImageFI.SetSizePixel(aVendorSize);
+ Control* aControls[] = {
+ &pThis->aLanguageFT,
+ &pThis->aLanguageLB,
+ &pThis->aNotInDictFT,
+ &pThis->aSentenceED,
+ &pThis->aSuggestionFT,
+ &pThis->aSuggestionLB,
+ &pThis->aIgnorePB,
+ &pThis->aIgnoreAllPB,
+ &pThis->aIgnoreRulePB,
+ &pThis->aAddToDictMB,
+ &pThis->aChangePB,
+ &pThis->aChangeAllPB,
+ &pThis->aExplainPB,
+ &pThis->aAutoCorrPB,
+ &pThis->aCheckGrammarCB,
+ &pThis->aHelpPB,
+ &pThis->aOptionsPB,
+ &pThis->aUndoPB,
+ &pThis->aClosePB,
+ &pThis->aBackgroundGB,
+ 0
+ };
+ sal_Int32 nControl = 0;
+ while( aControls[nControl])
+ {
+ Point aPos = aControls[nControl]->GetPosPixel();
+ aPos.Y() += nDiff;
+ aControls[nControl]->SetPosPixel(aPos);
+ ++nControl;
+ }
+ Size aDlgSize = pThis->GetSizePixel();
+ aDlgSize.Height() += nDiff;
+ pThis->SetSizePixel( aDlgSize );
+ pThis->Invalidate();
+ }
+ }
+ pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() );
+ pThis->SetUpdateMode( sal_True );
+ pThis->Show();
+ return 0;
+};
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn )
+{
+ if (&aOptionsPB == pBtn)
+ StartSpellOptDlg_Impl();
+ else if(&aAutoCorrPB == pBtn)
+ {
+ //get the currently selected wrong word
+ String sCurrentErrorText = aSentenceED.GetErrorText();
+ //get the wrong word from the XSpellAlternative
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription )
+ {
+ String sWrong(pSpellErrorDescription->sErrorText);
+ //if the word has not been edited in the MultiLineEdit then
+ //the current suggestion should be used
+ //if it's not the 'no suggestions' entry
+ if(sWrong == sCurrentErrorText &&
+ aSuggestionLB.IsEnabled() && aSuggestionLB.GetSelectEntryCount() > 0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ {
+ sCurrentErrorText = aSuggestionLB.GetSelectEntry();
+ }
+ if(sWrong != sCurrentErrorText)
+ {
+ SvxPrepareAutoCorrect( sWrong, sCurrentErrorText );
+ LanguageType eLang = GetSelectedLang_Impl();
+ rParent.AddAutoCorrection( sWrong, sCurrentErrorText, eLang );
+ }
+ }
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( SpellDialog, CheckGrammarHdl, CheckBox*, pBox )
+{
+ rParent.SetGrammarChecking( pBox->IsChecked() );
+ Impl_Restore();
+ return 0;
+}
+
+void SpellDialog::StartSpellOptDlg_Impl()
+{
+ sal_uInt16 aSpellInfos[] =
+ {
+ SID_ATTR_SPELL,SID_ATTR_SPELL,
+ SID_SPELL_MODIFIED, SID_SPELL_MODIFIED,
+ SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
+ 0
+ };
+ SfxItemSet aSet( SFX_APP()->GetPool(), aSpellInfos);
+ aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
+ SfxSingleTabDialog* pDlg =
+ new SfxSingleTabDialog( this, aSet, RID_SFXPAGE_LINGU );
+ SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg, aSet );
+ ( (SvxLinguTabPage*)pPage )->HideGroups( GROUP_MODULES );
+ pDlg->SetTabPage( pPage );
+ if(RET_OK == pDlg->Execute())
+ {
+
+ // Benutzerb"ucher anzeigen
+ InitUserDicts();
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if(pOutSet)
+ OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet);
+ }
+ delete pDlg;
+
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ChangeHdl, Button *, EMPTYARG )
+{
+ if(aSentenceED.IsUndoEditMode())
+ {
+ SpellContinue_Impl();
+ }
+ else
+ {
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ String aString = aSentenceED.GetErrorText();
+ //dots are sometimes part of the spelled word but they are not necessarily part of the replacement
+ bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.';
+ if(aSuggestionLB.IsEnabled() &&
+ aSuggestionLB.GetSelectEntryCount()>0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ aString = aSuggestionLB.GetSelectEntry();
+ if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.'))
+ aString += '.';
+
+ aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl());
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ }
+ if(!aChangePB.IsEnabled())
+ aIgnorePB.GrabFocus();
+ return 1;
+}
+
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ // change the current word first
+ String aString = aSentenceED.GetErrorText();
+ if(aSuggestionLB.IsEnabled() &&
+ aSuggestionLB.GetSelectEntryCount()>0 &&
+ aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
+ aString = aSuggestionLB.GetSelectEntry();
+
+ LanguageType eLang = GetSelectedLang_Impl();
+
+ // add new word to ChangeAll list
+ String aOldWord( aSentenceED.GetErrorText() );
+ SvxPrepareAutoCorrect( aOldWord, aString );
+ Reference<XDictionary> aXDictionary( SvxGetChangeAllList(), UNO_QUERY );
+ sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
+ aOldWord , sal_True,
+ aString, eLang );
+
+ if(nAdded == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(aXDictionary);
+ pAction->SetAddedWord(aOldWord);
+ aSentenceED.AddUndoAction(pAction);
+ }
+
+ aSentenceED.ChangeMarkedWord(aString, eLang);
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 1;
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ // add word to IgnoreAll list
+ Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY );
+ //in case the error has been changed manually it has to be restored
+ aSentenceED.RestoreCurrentError();
+ if( pButton == &aIgnoreRulePB )
+ {
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ try
+ {
+ if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() )
+ {
+ pSpellErrorDescription->xGrammarChecker->ignoreRule( pSpellErrorDescription->sRuleId,
+ pSpellErrorDescription->aLocale );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ String sErrorText(aSentenceED.GetErrorText());
+ sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
+ sErrorText, sal_False,
+ ::rtl::OUString(), LANGUAGE_NONE );
+ if(nAdded == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(aXDictionary);
+ pAction->SetAddedWord(sErrorText);
+ aSentenceED.AddUndoAction(pAction);
+ }
+ }
+
+ SpellContinue_Impl();
+ bModified = false;
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 1;
+}
+/*-- 06.11.2003 11:24:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SpellDialog, UndoHdl, Button*, EMPTYARG )
+{
+ aSentenceED.Undo();
+ if(!aSentenceED.GetUndoActionCount())
+ aUndoPB.Enable(FALSE);
+ return 0;
+}
+/*-- 06.11.2003 12:19:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction )
+{
+ switch(pAction->GetId())
+ {
+ case SPELLUNDO_CHANGE_TEXTENGINE:
+ {
+ if(pAction->IsEnableChangePB())
+ aChangePB.Enable(FALSE);
+ if(pAction->IsEnableChangeAllPB())
+ aChangeAllPB.Enable(FALSE);
+ }
+ break;
+ case SPELLUNDO_CHANGE_NEXTERROR:
+ {
+ aSentenceED.MoveErrorMarkTo((USHORT)pAction->GetOldErrorStart(), (USHORT)pAction->GetOldErrorEnd(), false);
+ if(pAction->IsErrorLanguageSelected())
+ {
+ UpdateBoxes_Impl();
+ }
+ }
+ break;
+ case SPELLUNDO_CHANGE_ADD_TO_DICTIONARY:
+ {
+ if(pAction->GetDictionary().is())
+ pAction->GetDictionary()->remove(pAction->GetAddedWord());
+ }
+ break;
+ case SPELLUNDO_MOVE_ERROREND :
+ {
+ if(pAction->GetOffset() != 0)
+ aSentenceED.MoveErrorEnd(pAction->GetOffset());
+ }
+ break;
+ case SPELLUNDO_UNDO_EDIT_MODE :
+ {
+ //refill the dialog with the currently spelled sentence - throw away all changes
+ SpellContinue_Impl(true);
+ }
+ break;
+ case SPELLUNDO_ADD_IGNORE_RULE:
+ //undo of ignored rules is not supported
+ break;
+ }
+
+ return 0;
+}
+// -----------------------------------------------------------------------
+void SpellDialog::Impl_Restore()
+{
+ //clear the "ChangeAllList"
+ SvxGetChangeAllList()->clear();
+ //get a new sentence
+ aSentenceED.SetText(rtl::OUString());
+ aSentenceED.ResetModified();
+ SpellContinue_Impl();
+ aIgnorePB.SetText(aIgnoreOnceST);
+}
+
+IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG )
+{
+ if(aIgnorePB.GetText() == aResumeST)
+ {
+ Impl_Restore();
+ }
+ else
+ {
+ //in case the error has been changed manually it has to be restored
+ aSentenceED.RestoreCurrentError();
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true));
+ aSentenceED.ResetModified();
+
+ // the word is being ignored
+ SpellContinue_Impl();
+ bModified = false;
+ }
+ return 1;
+}
+
+
+// -----------------------------------------------------------------------
+
+sal_Bool SpellDialog::Close()
+{
+ GetBindings().GetDispatcher()->
+ Execute(rParent.GetType(),
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ return sal_True;
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SetSelectedLang_Impl( LanguageType nLang )
+{
+ aLanguageLB.SelectLanguage( nLang );
+}
+
+// -----------------------------------------------------------------------
+
+LanguageType SpellDialog::GetSelectedLang_Impl() const
+{
+ INT16 nLang = aLanguageLB.GetSelectLanguage();
+ return nLang;
+}
+/* -----------------28.10.2003 14:27-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox)
+{
+ //if currently an error is selected then search for alternatives for
+ //this word and fill the alternatives ListBox accordingly
+ String sError = aSentenceED.GetErrorText();
+ aSuggestionLB.Clear();
+ if(sError.Len())
+ {
+ LanguageType eLanguage = pBox->GetSelectLanguage();
+ Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage,
+ Sequence< PropertyValue >() );
+ if( xAlt.is() )
+ aSentenceED.SetAlternatives( xAlt );
+ else
+ {
+ aSentenceED.ChangeMarkedWord( sError, eLanguage );
+ SpellContinue_Impl();
+ }
+
+ aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink));
+ }
+ SpellDialog::UpdateBoxes_Impl();
+ return 0;
+}
+// -----------------------------------------------------------------------
+
+void SpellDialog::SetLanguage( sal_uInt16 nLang )
+
+/* [Beschreibung]
+
+ wenn die Sprache im Thesaurus umgestellt wurde,
+ muss auch hier die Sprache umgestellt werden.
+*/
+
+{
+ SetTitle_Impl( nLang );
+
+ // den richtigen Eintrag finden, da sortiert
+ aLanguageLB.SelectLanguage( nLang );
+}
+/*-- 16.06.2008 11:27:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl )
+{
+ Image aRes;
+ ::rtl::OUString aTmp;
+ osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
+ Graphic aGraphic;
+ const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
+ if( GRFILTER_OK == LoadGraphic( aTmp, aFilterName, aGraphic ) )
+ {
+ aRes = Image( aGraphic.GetBitmapEx() );
+ }
+ return aRes;
+}
+void SpellDialog::SetTitle_Impl(LanguageType nLang)
+{
+ String sTitle( m_sTitleSpelling );
+ if( rParent.HasGrammarChecking() )
+ {
+ String sVendor;
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ ::rtl::OUString sSuggestionImageUrl =
+ SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast );
+ aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) );
+ uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY );
+ if( xDisplayName.is() )
+ sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale );
+ }
+ else
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage );
+ }
+
+ if( sVendor.Len() )
+ {
+ sTitle = m_sTitleSpellingGrammarVendor;
+ sTitle.SearchAndReplaceAscii( "$VendorName", sVendor );
+ }
+ else
+ {
+ //bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ sTitle = m_sTitleSpellingGrammar;
+ }
+ }
+ sTitle.SearchAndReplaceAscii( "$LANGUAGE ($LOCATION)", ::GetLanguageString(nLang) );
+ SetText( sTitle );
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialog::InitUserDicts()
+{
+ sal_uInt16 nLang = aLanguageLB.GetSelectLanguage();
+
+ const Reference< XDictionary > *pDic = 0;
+
+ // get list of dictionaries
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ // add active, positive dictionary to dic-list (if not already done).
+ // This is to ensure that there is at least on dictionary to which
+ // words could be added.
+ Reference< XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) );
+ if (xDic.is())
+ xDic->setActive( sal_True );
+
+ pImpl->aDics = xDicList->getDictionaries();
+ }
+
+ // Benutzerbuecher anzeigen
+ const sal_Int32 nSize = pImpl->aDics.getLength();
+ pDic = pImpl->aDics.getConstArray();
+ sal_Int32 i;
+ delete aAddToDictMB.GetPopupMenu();
+ PopupMenu* pMenu = new PopupMenu;
+ for (i = 0; i < nSize; ++i )
+ {
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
+ if (!xDic.is() || SvxGetIgnoreAllList() == xDic)
+ continue;
+
+ // add only active and not read-only dictionaries to list
+ // from which to choose from
+ Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( xDic->isActive() && (!xStor.is() || !xStor->isReadonly()) )
+ {
+ sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+ pMenu->InsertItem( (USHORT)i + 1, ::GetDicInfoStr( xDic->getName(),
+ SvxLocaleToLanguage( xDic->getLocale() ), bNegativ ) );
+ }
+ }
+ aAddToDictMB.SetPopupMenu(pMenu);
+
+ aAddToDictMB.Disable();
+
+ sal_uInt16 k;
+ for ( k = 0; k < pMenu->GetItemCount(); ++k )
+ {
+ sal_uInt16 nId = pMenu->GetItemId(k) - 1;
+ sal_Bool bFound = sal_False;
+
+ const sal_uInt16 nDicLang = SvxLocaleToLanguage( pDic[nId]->getLocale() );
+ const sal_Bool bDicNegativ =
+ pDic[nId]->getDictionaryType() == DictionaryType_NEGATIVE;
+ // Stimmt die Sprache "uberein, dann enable
+ if ((nDicLang == nLang || nDicLang == LANGUAGE_NONE) && !bDicNegativ)
+ bFound = sal_True;
+
+ if (bFound)
+ {
+ aAddToDictMB.Enable();
+ break;
+ }
+ }
+}
+/*-- 20.10.2003 15:31:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton )
+{
+ aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
+ USHORT nItem = pButton->GetCurItemId();
+
+ //GetErrorText() returns the current error even if the text is already
+ //manually changed
+ String sNewWord= aSentenceED.GetErrorText();
+
+ Reference< XDictionary > xDic( pImpl->aDics.getConstArray()[ nItem - 1 ], UNO_QUERY );
+ sal_Int16 nAddRes = DIC_ERR_UNKNOWN;
+ if (xDic.is())
+ {
+ String sTmpTxt( sNewWord );
+ sal_Bool bNegEntry = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+ nAddRes = linguistic::AddEntryToDic( xDic, sTmpTxt, bNegEntry,
+ ::rtl::OUString(), LANGUAGE_NONE );
+
+ if(nAddRes == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(xDic);
+ pAction->SetAddedWord(sTmpTxt);
+ aSentenceED.AddUndoAction(pAction);
+ }
+ // failed because there is already an entry?
+ if (DIC_ERR_NONE != nAddRes && xDic->getEntry( sTmpTxt ).is())
+ nAddRes = DIC_ERR_NONE;
+ }
+ if (DIC_ERR_NONE != nAddRes)
+ {
+ SvxDicError( this, nAddRes );
+ return 0; // Nicht weitermachen
+ }
+ // nach dem Aufnehmen ggf. '='-Zeichen entfernen
+ sNewWord.EraseAllChars( sal_Unicode( '=' ) );
+
+ // go on
+ SpellContinue_Impl();
+ aSentenceED.UndoActionEnd( SPELLUNDO_CHANGE_GROUP );
+ return 0;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd)
+{
+ if (&aSentenceED == pEd)
+ {
+ bModified = true;
+ aSuggestionLB.SetNoSelection();
+ aSuggestionLB.Disable();
+ String sNewText( aSentenceED.GetText() );
+ aAutoCorrPB.Enable( sNewText != aSentenceED.GetText() );
+ SpellUndoAction_Impl* pSpellAction = new SpellUndoAction_Impl(SPELLUNDO_CHANGE_TEXTENGINE, aDialogUndoLink);
+ if(!aChangeAllPB.IsEnabled())
+ {
+ aChangeAllPB.Enable();
+ pSpellAction->SetEnableChangeAllPB();
+ }
+ if(!aChangePB.IsEnabled())
+ {
+ aChangePB.Enable();
+ pSpellAction->SetEnableChangePB();
+ }
+ aSentenceED.AddUndoAction(pSpellAction);
+ }
+ return 0;
+};
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG )
+{
+ //apply changes first - if there are any
+ if(aSentenceED.IsModified())
+ {
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
+ }
+ Close();
+ return 0;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialog::Paint( const Rectangle& rRect )
+{
+ ModelessDialog::Paint(rRect );
+ Rectangle aRect(aBackgroundGB.GetPosPixel(), aBackgroundGB.GetSizePixel());
+ DecorationView aDecoView( this );
+ aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL);
+}
+/*-- 28.10.2003 13:26:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long SpellDialog::Notify( NotifyEvent& rNEvt )
+{
+ /* #i38338#
+ * FIXME: LoseFocus and GetFocus are signals from vcl that
+ * a window actually got/lost the focus, it never should be
+ * forwarded from another window, that is simply wrong.
+ * FIXME: overloading the virtual methods GetFocus and LoseFocus
+ * in SpellDialogChildWindow by making them pure is at least questionable.
+ * The only sensible thing would be to call the new Method differently,
+ * e.g. DialogGot/LostFocus or so.
+ */
+ if( IsVisible() && !bFocusLocked )
+ {
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ //notify the child window of the focus change
+ rParent.GetFocus();
+ }
+ else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ //notify the child window of the focus change
+ rParent.LoseFocus();
+ }
+ }
+ return SfxModelessDialog::Notify(rNEvt);
+}
+/* -----------------10.09.2003 08:26-----------------
+
+ --------------------------------------------------*/
+void SpellDialog::InvalidateDialog()
+{
+ if( bFocusLocked )
+ return;
+ aIgnorePB.SetText(aResumeST);
+ Window* aDisableArr[] =
+ {
+ &aNotInDictFT,
+ &aSentenceED,
+ &aSuggestionFT,
+ &aSuggestionLB,
+ &aLanguageFT,
+ &aLanguageLB,
+ &aIgnoreAllPB,
+ &aIgnoreRulePB,
+ &aAddToDictMB,
+ &aChangePB,
+ &aChangeAllPB,
+ &aAutoCorrPB,
+ &aUndoPB,
+ 0
+ };
+ sal_Int16 i = 0;
+ while(aDisableArr[i])
+ {
+ aDisableArr[i]->Enable(FALSE);
+ i++;
+ }
+ SfxModelessDialog::Deactivate();
+}
+
+/*-- 10.09.2003 08:35:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
+{
+ bool bRet = false;
+ if(!bUseSavedSentence && aSentenceED.IsModified())
+ {
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
+ }
+ aSentenceED.ResetModified();
+ SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence();
+ if(!bUseSavedSentence)
+ m_aSavedSentence = aSentence;
+ bool bHasReplaced = false;
+ while(aSentence.size())
+ {
+ //apply all changes that are already part of the "ChangeAllList"
+ //returns true if the list still contains errors after the changes have been applied
+
+ if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced))
+ {
+ rParent.ApplyChangedSentence(aSentence);
+ aSentence = rParent.GetNextWrongSentence();
+ }
+ else
+ break;
+ }
+
+ if(aSentence.size())
+ {
+ SpellPortions::iterator aStart = aSentence.begin();
+ rtl::OUString sText;
+ while(aStart != aSentence.end())
+ {
+ // hidden text has to be ignored
+ if(!aStart->bIsHidden)
+ sText += aStart->sText;
+ aStart++;
+ }
+ aSentenceED.SetText(sText);
+ aStart = aSentence.begin();
+ sal_Int32 nStartPosition = 0;
+ sal_Int32 nEndPosition = 0;
+
+ while(aStart != aSentence.end())
+ {
+ // hidden text has to be ignored
+ if(!aStart->bIsHidden)
+ {
+ nEndPosition += aStart->sText.getLength();
+ if(aStart->xAlternatives.is())
+ {
+ uno::Reference< container::XNamed > xNamed( aStart->xAlternatives, uno::UNO_QUERY );
+ ::rtl::OUString sServiceName;
+ if( xNamed.is() )
+ sServiceName = xNamed->getName();
+ SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(),
+ aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName);
+ aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ }
+ else if(aStart->bIsGrammarError )
+ {
+ uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY );
+ SpellErrorDescription aDesc( true,
+ aStart->sText,
+ SvxCreateLocale( aStart->eLanguage ),
+ aStart->aGrammarError.aSuggestions,
+ aStart->xGrammarChecker,
+ xInfo->getImplementationName(),
+ &aStart->sDialogTitle,
+ &aStart->aGrammarError.aFullComment,
+ &aStart->aGrammarError.aRuleIdentifier );
+ aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ }
+ if(aStart->bIsField)
+ aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
+ nStartPosition = nEndPosition;
+ }
+ aStart++;
+ }
+ //the edit field needs to be modified to apply the change from the ApplyChangeAllList
+ if(!bHasReplaced)
+ aSentenceED.ClearModifyFlag();
+ aSentenceED.ResetUndo();
+ aUndoPB.Enable(FALSE);
+ bRet = nStartPosition > 0;
+ }
+ return bRet;
+}
+/*-- 12.11.2003 15:21:25---------------------------------------------------
+ replace errrors that have a replacement in the ChangeAllList
+ returns false if the result doesn't contain errors after the replacement
+ -----------------------------------------------------------------------*/
+bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasReplaced)
+{
+ bHasReplaced = false;
+ bool bRet = true;
+ SpellPortions::iterator aStart = rSentence.begin();
+ Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY );
+ if(!xChangeAll->getCount())
+ return bRet;
+ bRet = false;
+ while(aStart != rSentence.end())
+ {
+ if(aStart->xAlternatives.is())
+ {
+ Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry( aStart->sText );
+ if(xEntry.is())
+ {
+ aStart->sText = xEntry->getReplacementText();
+ aStart->xAlternatives = 0;
+ bHasReplaced = true;
+ }
+ else
+ bRet = true;
+ }
+ else if( aStart->bIsGrammarError )
+ bRet = true;
+ aStart++;
+ }
+ return bRet;
+}
+/*-- 10.09.2003 10:40:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) :
+ MultiLineEdit( pParent, rResId ),
+ m_nErrorStart(0),
+ m_nErrorEnd(0),
+ m_bIsUndoEditMode(false)
+{
+ DisableSelectionOnFocus();
+}
+/*-- 10.09.2003 10:40:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
+{
+}
+/*-- 20.10.2003 13:42:34---------------------------------------------------
+ The selection before inputting a key may have a range or not
+ and it may be inside or outside of field or error attributes.
+ A range may include the attribute partially, completely or together
+ with surrounding text. It may also contain more than one attribute
+ or no attribute at all.
+ Depending on this starting conditions some actions are necessary:
+ Attempts to delete a field are only allowed if the selection is the same
+ as the field's selection. Otherwise the field has to be selected and the key
+ input action has to be skipped.
+ Input of text at the start of the field requires the field attribute to be
+ corrected - it is not allowed to grow.
+
+ In case of errors the appending of text should grow the error attribute because
+ that is what the user usually wants to do.
+
+ Backspace at the start of the attribute requires to find out if a field ends
+ directly in front of the cursor position. In case of a field this attribute has to be
+ selected otherwise the key input method is allowed.
+
+ All changes outside of the error attributes switch the dialog mode to a "Undo edit" state that
+ removes all visible attributes and switches off further attribute checks.
+ Undo in this restarts the dialog with a current sentence newly presented.
+ All changes to the sentence are undone including the ones before the "Undo edit state" has been reached
+
+ We end up with 9 types of selection
+ 1 (LEFT_NO) - no range, start of attribute - can also be 3 at the same time
+ 2 (INSIDE_NO) - no range, inside of attribute
+ 3 (RIGHT_NO) - no range, end of attribute - can also be 1 at the same time
+ 4 (FULL) - range, same as attribute
+ 5 (INSIDE_YES) - range, inside of the attribute
+ 6 (BRACE)- range, from outside of the attribute to the inside or
+ including the complete attribute and something outside,
+ maybe more than one attribute
+ 7 (OUTSIDE_NO) - no range, not at an attribute
+ 8 (OUTSIDE_YES) - range, completely outside of all attributes
+
+ What has to be done depending on the attribute type involved
+ possible actions: UE - Undo edit mode
+ CO - Continue, no additional action is required
+ FS - Field has to be completely selected
+ EX - The attribute has to be expanded to include the added text
+
+ 1 - backspace delete any other
+ UE on field FS on error CO on field FS on error CO
+
+ 2 - on field FS on error C
+ 3 - backspace delete any other
+ on field FS on error CO UE on field UE on error EX
+
+ if 1 and 3 happen to apply both then backspace and other handling is 1 delete is 3
+
+ 4 - on field UE and on error CO
+ 5 - on field FS and on error CO
+ 6 - on field FS and on error UE
+ 7 - UE
+ 8 - UE
+ -----------------------------------------------------------------------*/
+#define INVALID 0
+#define LEFT_NO 1
+#define INSIDE_NO 2
+#define RIGHT_NO 3
+#define FULL 4
+#define INSIDE_YES 5
+#define BRACE 6
+#define OUTSIDE_NO 7
+#define OUTSIDE_YES 8
+
+#define ACTION_UNDOEDIT 0
+#define ACTION_CONTINUE 1
+#define ACTION_SELECTFIELD 2
+#define ACTION_EXPAND 3
+
+long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ bool bChange = false;
+ const TextCharAttrib* pErrorAttrib = 0;
+ if(rNEvt.GetType() == EVENT_KEYINPUT)
+ {
+ const KeyEvent& rKeyEvt = *rNEvt.GetKeyEvent();
+ bChange = TextEngine::DoesKeyChangeText( rKeyEvt );
+ if(bChange && !IsUndoEditMode() &&
+ rKeyEvt.GetKeyCode().GetCode() != KEY_TAB)
+ {
+ TextEngine* pTextEngine = GetTextEngine();
+ TextView* pTextView = pTextEngine->GetActiveView();
+ const TextSelection& rCurrentSelection = pTextView->GetSelection();
+ //determine if the selection contains a field
+ bool bHasField = false;
+ bool bHasError = false;
+ bool bHasFieldLeft = false;
+ bool bHasErrorLeft = false;
+// bool bInsideAttr = false;
+
+ bool bHasRange = rCurrentSelection.HasRange();
+ sal_uInt8 nSelectionType = 0; // invalid type!
+
+ TextPaM aCursor(rCurrentSelection.GetStart());
+ const TextCharAttrib* pBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ const TextCharAttrib* pErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ const TextCharAttrib* pBackAttrLeft = 0;
+ const TextCharAttrib* pErrorAttrLeft = 0;
+
+ bHasField = pBackAttr != 0 && (bHasRange || pBackAttr->GetEnd() > aCursor.GetIndex());
+ bHasError = pErrorAttr != 0 && (bHasRange || pErrorAttr->GetEnd() > aCursor.GetIndex());
+ if(bHasRange)
+ {
+ if(pBackAttr &&
+ pBackAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() &&
+ pBackAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex())
+ {
+ nSelectionType = FULL;
+ }
+ else if(pErrorAttr &&
+ pErrorAttr->GetStart() <= rCurrentSelection.GetStart().GetIndex() &&
+ pErrorAttr->GetEnd() >= rCurrentSelection.GetEnd().GetIndex())
+ {
+ nSelectionType = INSIDE_YES;
+ }
+ else
+ {
+ nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO;
+ while(aCursor.GetIndex() < rCurrentSelection.GetEnd().GetIndex())
+ {
+ ++aCursor.GetIndex();
+ const TextCharAttrib* pIntBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ const TextCharAttrib* pIntErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ //if any attr has been found then BRACE
+ if(pIntBackAttr || pIntErrorAttr)
+ nSelectionType = BRACE;
+ //the field has to be selected
+ if(pIntBackAttr && !pBackAttr)
+ pBackAttr = pIntBackAttr;
+ bHasField |= pIntBackAttr != 0;
+ }
+ }
+ }
+ else
+ {
+ //no range selection: then 1 2 3 and 8 are possible
+ const TextCharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr;
+ if(pCurAttr)
+ {
+ nSelectionType = pCurAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() ?
+ LEFT_NO : pCurAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO;
+ }
+ else
+ nSelectionType = OUTSIDE_NO;
+
+ bHasFieldLeft = pBackAttr && pBackAttr->GetEnd() == aCursor.GetIndex();
+ if(bHasFieldLeft)
+ {
+ pBackAttrLeft = pBackAttr;
+ pBackAttr = 0;
+ }
+ bHasErrorLeft = pErrorAttr && pErrorAttr->GetEnd() == aCursor.GetIndex();
+ if(bHasErrorLeft)
+ {
+ pErrorAttrLeft = pErrorAttr;
+ pErrorAttr = 0;
+ }
+
+ //check previous position if this exists
+ //that is a redundant in the case the the attribute found above already is on the left cursor side
+ //but it's o.k. for two errors/fields side by side
+ if(aCursor.GetIndex())
+ {
+ --aCursor.GetIndex();
+ pBackAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
+ pErrorAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
+ bHasFieldLeft = pBackAttrLeft !=0;
+ bHasErrorLeft = pErrorAttrLeft != 0;
+// bInsideAttr = (bHasField || bHasError) && (bHasFieldLeft || bHasErrorLeft);
+ ++aCursor.GetIndex();
+ }
+ }
+ //Here we have to determine if the error found is the one currently active
+ bool bIsErrorActive = (pErrorAttr && pErrorAttr->GetStart() == m_nErrorStart) ||
+ (pErrorAttrLeft && pErrorAttrLeft->GetStart() == m_nErrorStart);
+
+ DBG_ASSERT(nSelectionType != INVALID, "selection type not set!");
+
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ bool bDelete = rKeyCode.GetCode() == KEY_DELETE;
+ bool bBackspace = rKeyCode.GetCode() == KEY_BACKSPACE;
+
+ sal_Int8 nAction = ACTION_CONTINUE;
+// nAction = ACTION_UNDOEDIT
+// nAction = ACTION_SELECTFIELD
+// nAction = ACTION_EXPAND
+ switch(nSelectionType)
+ {
+// 1 - backspace delete any other
+// UE on field FS on error CO on field FS on error CO
+ case LEFT_NO :
+ if(bBackspace)
+ {
+ nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;
+ //to force the use of pBackAttrLeft
+ pBackAttr = 0;
+ }
+ else if(bDelete)
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ else
+ nAction = bHasError && !aCursor.GetIndex() ? ACTION_CONTINUE :
+ bHasError ? ACTION_EXPAND : bHasErrorLeft ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ break;
+// 2 - on field FS on error C
+ case INSIDE_NO :
+ nAction = bHasField ? ACTION_SELECTFIELD :
+ bIsErrorActive ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ break;
+// 3 - backspace delete any other
+// on field FS on error CO UE on field UE on error EX
+ case RIGHT_NO :
+ if(bBackspace)
+ nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ else if(bDelete)
+ nAction = bHasFieldLeft && bHasError ? ACTION_CONTINUE : ACTION_UNDOEDIT;
+ else
+ nAction = bHasFieldLeft && bHasError ? ACTION_EXPAND :
+ bHasError ? ACTION_CONTINUE : bHasErrorLeft ? ACTION_EXPAND :ACTION_UNDOEDIT;
+ break;
+// 4 - on field UE and on error CO
+ case FULL :
+ nAction = bHasField ? ACTION_UNDOEDIT : ACTION_CONTINUE;
+ break;
+// 5 - on field FS and on error CO
+ case INSIDE_YES :
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE;
+ break;
+// 6 - on field FS and on error UE
+ case BRACE :
+ nAction = bHasField ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;;
+ break;
+// 7 - UE
+// 8 - UE
+ case OUTSIDE_NO :
+ case OUTSIDE_YES:
+ nAction = ACTION_UNDOEDIT;
+ break;
+ }
+ //save the current paragraph
+ USHORT nCurrentLen = GetText().Len();
+ if(nAction != ACTION_SELECTFIELD)
+ pTextView->GetWindow()->KeyInput(rKeyEvt);
+ else
+ {
+ const TextCharAttrib* pCharAttr = pBackAttr ? pBackAttr : pBackAttrLeft;
+ if(pCharAttr)
+ {
+ TextPaM aStart(0, pCharAttr->GetStart());
+ TextPaM aEnd(0, pCharAttr->GetEnd());
+ TextSelection aNewSel(aStart, aEnd);
+ pTextView->SetSelection( aNewSel);
+ }
+ }
+ if(nAction == ACTION_EXPAND)
+ {
+ DBG_ASSERT(pErrorAttrLeft || pErrorAttr, "where is the error");
+ //text has been added on the right and only the 'error attribute has to be corrected
+ if(pErrorAttrLeft)
+ {
+ TextAttrib* pNewError = pErrorAttrLeft->GetAttr().Clone();
+ USHORT nStart = pErrorAttrLeft->GetStart();
+ USHORT nEnd = pErrorAttrLeft->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttrLeft );
+ SetAttrib( *pNewError, 0, nStart, ++nEnd );
+ //only active errors move the mark
+ if(bIsErrorActive)
+ {
+ bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError;
+ MoveErrorMarkTo(nStart, nEnd, bGrammar);
+ }
+ delete pNewError;
+ }
+ //text has been added on the left then the error attribute has to be expanded and the
+ //field attribute on the right - if any - has to be contracted
+ else if(pErrorAttr)
+ {
+ //determine the change
+ USHORT nAddedChars = GetText().Len() - nCurrentLen;
+
+ TextAttrib* pNewError = pErrorAttr->GetAttr().Clone();
+ USHORT nStart = pErrorAttr->GetStart();
+ USHORT nEnd = pErrorAttr->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttr );
+ nStart = nStart - (USHORT)nAddedChars;
+ SetAttrib( *pNewError, 0, nStart - nAddedChars, nEnd );
+ //only if the error is active the mark is moved here
+ if(bIsErrorActive)
+ {
+ bool bGrammar = static_cast<const SpellErrorAttrib&>(*pNewError).GetErrorDescription().bIsGrammarError;
+ MoveErrorMarkTo(nStart, nEnd, bGrammar);
+ }
+ delete pNewError;
+
+ if(pBackAttrLeft)
+ {
+ TextAttrib* pNewBack = pBackAttrLeft->GetAttr().Clone();
+ USHORT _nStart = pBackAttrLeft->GetStart();
+ USHORT _nEnd = pBackAttrLeft->GetEnd();
+ pTextEngine->RemoveAttrib( 0, *pBackAttrLeft );
+ SetAttrib( *pNewBack, 0, _nStart, _nEnd - nAddedChars);
+ delete pNewBack;
+ }
+ }
+ }
+ else if(nAction == ACTION_UNDOEDIT)
+ {
+ SetUndoEditMode(true);
+ }
+ //make sure the error positions are correct after text changes
+ //the old attribute may have been deleted
+ //all changes inside of the current error leave the error attribute at the current
+ //start position
+ if(!IsUndoEditMode() && bIsErrorActive)
+ {
+ const TextCharAttrib* pFontColor = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_FONTCOLOR );
+ pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR );
+ if(pFontColor && pErrorAttrib )
+ {
+ m_nErrorStart = pFontColor->GetStart();
+ m_nErrorEnd = pFontColor->GetEnd();
+ if(pErrorAttrib->GetStart() != m_nErrorStart || pErrorAttrib->GetEnd() != m_nErrorEnd)
+ {
+ TextAttrib* pNewError = pErrorAttrib->GetAttr().Clone();
+ pTextEngine->RemoveAttrib( 0, *pErrorAttr );
+ SetAttrib( *pNewError, 0, m_nErrorStart, m_nErrorEnd );
+ delete pNewError;
+ }
+ }
+ }
+ //this is not a modification anymore
+ if(nAction != ACTION_SELECTFIELD && !m_bIsUndoEditMode)
+ CallModifyLink();
+ }
+ else
+ bChange = false;
+ }
+ long nRet = bChange ? 1 : MultiLineEdit::PreNotify(rNEvt);
+ return nRet;
+}
+/*-- 10.09.2003 13:38:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SentenceEditWindow_Impl::MarkNextError()
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ USHORT nTextLen = pTextEngine->GetTextLen(0);
+ if(m_nErrorEnd >= nTextLen - 1)
+ return false;
+ //if it's not already modified the modified flag has to be reset at the and of the marking
+ bool bModified = IsModified();
+ bool bRet = false;
+ const USHORT nOldErrorStart = m_nErrorStart;
+ const USHORT nOldErrorEnd = m_nErrorEnd;
+
+ //create a cursor behind the end of the last error
+ //- or at 0 at the start of the sentence
+ TextPaM aCursor(0, m_nErrorEnd ? m_nErrorEnd + 1 : 0);
+ //search for SpellErrorAttrib
+
+ const TextCharAttrib* pNextError = 0;
+ //iterate over the text and search for the next error that maybe has
+ //to be replace by a ChangeAllList replacement
+ bool bGrammarError = false;
+ while(aCursor.GetIndex() < nTextLen)
+ {
+ while(aCursor.GetIndex() < nTextLen &&
+ 0 == (pNextError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR)))
+ {
+ ++aCursor.GetIndex();
+ }
+ // maybe the error found here is already in the ChangeAllList and has to be replaced
+
+ Reference<XDictionary> xChangeAll( SvxGetChangeAllList(), UNO_QUERY );
+ Reference<XDictionaryEntry> xEntry;
+
+// Reference <XSpellAlternatives> xAlternatives;
+ const SpellErrorDescription* pSpellErrorDescription = 0;
+ if(pNextError)
+ {
+ pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pNextError->GetAttr()).GetErrorDescription();
+ bGrammarError = pSpellErrorDescription->bIsGrammarError;
+ }
+ if(xChangeAll->getCount() && pSpellErrorDescription &&
+ (xEntry = xChangeAll->getEntry( pSpellErrorDescription->sErrorText )).is())
+ {
+ m_nErrorStart = pNextError->GetStart();
+ m_nErrorEnd = pNextError->GetEnd();
+ ChangeMarkedWord(xEntry->getReplacementText(),
+ SvxLocaleToLanguage( pSpellErrorDescription->aLocale ));
+ aCursor.GetIndex() = aCursor.GetIndex() + (USHORT)(xEntry->getReplacementText().getLength());
+ }
+ else
+ break;
+ }
+
+ //if an attrib has been found search for the end of the error string
+ if(aCursor.GetIndex() < nTextLen)
+ {
+ m_nErrorStart = aCursor.GetIndex();
+ m_nErrorEnd = pNextError->GetEnd();
+ MoveErrorMarkTo(m_nErrorStart, m_nErrorEnd, bGrammarError);
+ bRet = true;
+ //add an undo action
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_NEXTERROR, GetSpellDialog()->aDialogUndoLink);
+ pAction->SetErrorMove(m_nErrorStart, m_nErrorEnd, nOldErrorStart, nOldErrorEnd);
+ const SpellErrorAttrib* pOldAttrib = static_cast<const SpellErrorAttrib*>(
+ pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR ));
+ pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() &&
+ SvxLocaleToLanguage( pOldAttrib->GetErrorDescription().aLocale) ==
+ GetSpellDialog()->aLanguageLB.GetSelectLanguage());
+ AddUndoAction(pAction);
+ }
+ else
+ m_nErrorStart = m_nErrorEnd = nTextLen;
+ if( !bModified )
+ ClearModifyFlag();
+ SpellDialog* pSpellDialog = GetSpellDialog();
+ pSpellDialog->aIgnorePB.Enable(bRet);
+ pSpellDialog->aIgnoreAllPB.Enable(bRet);
+ pSpellDialog->aAutoCorrPB.Enable(bRet);
+ pSpellDialog->aAddToDictMB.Enable(bRet);
+ return bRet;
+}
+
+/*-- 06.11.2003 13:30:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::MoveErrorMarkTo(USHORT nStart, USHORT nEnd, bool bGrammarError)
+{
+ TextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE );
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE );
+ pTextEngine->SetAttrib( TextAttribFontWeight(WEIGHT_BOLD), 0, nStart, nEnd );
+ pTextEngine->SetAttrib( TextAttribFontColor(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED), 0, nStart, nEnd );
+ m_nErrorStart = nStart;
+ m_nErrorEnd = nEnd;
+}
+
+/*-- 17.09.2003 10:13:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage)
+{
+ //calculate length changes
+ long nDiffLen = rNewWord.Len() - m_nErrorEnd + m_nErrorStart;
+ TextSelection aSel(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd));
+ //Remove spell errror attribute
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR );
+ DBG_ASSERT(pErrorAttrib, "no error attribute found");
+// Reference <XSpellAlternatives> xAlternatives;
+ const SpellErrorDescription* pSpellErrorDescription = 0;
+ if(pErrorAttrib)
+ {
+ pTextEngine->RemoveAttrib(0, *pErrorAttrib);
+ pSpellErrorDescription = &static_cast<const SpellErrorAttrib&>(pErrorAttrib->GetAttr()).GetErrorDescription();
+ }
+ const TextCharAttrib* pBackAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_BACKGROUND );
+ pTextEngine->ReplaceText( aSel, rNewWord );
+ //
+ if(!m_nErrorStart)
+ {
+ //attributes following an error at the start of the text are not moved but expanded from the
+ //text engine - this is done to keep full-paragraph-attributes
+ //in the current case that handling is not desired
+ const TextCharAttrib* pLangAttrib =
+ pTextEngine->FindCharAttrib(
+ TextPaM(0, m_nErrorEnd), TEXTATTR_SPELL_LANGUAGE );
+ USHORT nTextLen = pTextEngine->GetTextLen( 0 );
+ if(pLangAttrib && !pLangAttrib->GetStart() && pLangAttrib->GetEnd() ==
+ nTextLen)
+ {
+ SpellLanguageAttrib aNewLangAttrib( static_cast<const SpellLanguageAttrib&>(pLangAttrib->GetAttr()).GetLanguage());
+ pTextEngine->RemoveAttrib(0, *pLangAttrib);
+ pTextEngine->SetAttrib( aNewLangAttrib, 0, (USHORT)(m_nErrorEnd + nDiffLen) , nTextLen );
+ }
+ }
+ // undo expanded attributes!
+ if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen)
+ {
+ TextAttrib* pNewBackground = pBackAttrib->GetAttr().Clone();
+ USHORT nStart = pBackAttrib->GetStart();
+ pTextEngine->RemoveAttrib(0, *pBackAttrib);
+ pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart);
+ delete pNewBackground;
+ }
+ pTextEngine->SetModified(TRUE);
+
+ //adjust end position
+ long nEndTemp = m_nErrorEnd;
+ nEndTemp += nDiffLen;
+ m_nErrorEnd = (USHORT)nEndTemp;
+
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_MOVE_ERROREND, GetSpellDialog()->aDialogUndoLink);
+ pAction->SetOffset(nDiffLen);
+ AddUndoAction(pAction);
+ if(pSpellErrorDescription)
+ SetAttrib( SpellErrorAttrib(*pSpellErrorDescription), 0, m_nErrorStart, m_nErrorEnd );
+ SetAttrib( SpellLanguageAttrib(eLanguage), 0, m_nErrorStart, m_nErrorEnd );
+ pTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+}
+/* -----------------08.10.2003 13:18-----------------
+
+ --------------------------------------------------*/
+String SentenceEditWindow_Impl::GetErrorText() const
+{
+ return GetTextEngine()->GetText(TextSelection(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd) ));
+}
+/*-- 26.06.2008 10:54:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SpellErrorDescription* SentenceEditWindow_Impl::GetAlternatives()
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR));
+ return pAttrib ? &pAttrib->GetErrorDescription() : 0;
+}
+/*-- 06.09.2004 10:50:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::RestoreCurrentError()
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ const SpellErrorAttrib* pAttrib = static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR));
+ if( pAttrib )
+ {
+ const SpellErrorDescription& rDesc = pAttrib->GetErrorDescription();
+ if( !rDesc.sErrorText.equals( GetErrorText() ) )
+ ChangeMarkedWord(rDesc.sErrorText, SvxLocaleToLanguage( rDesc.aLocale ));
+ }
+}
+/*-- 28.10.2003 14:44:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetAlternatives( Reference< XSpellAlternatives> xAlt )
+{
+ TextPaM aCursor(0, m_nErrorStart);
+ DBG_ASSERT(static_cast<const SpellErrorAttrib*>(
+ GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)), "no error set?");
+
+ ::rtl::OUString aWord;
+ lang::Locale aLocale;
+ uno::Sequence< ::rtl::OUString > aAlts;
+ ::rtl::OUString sServiceName;
+ if (xAlt.is())
+ {
+ aWord = xAlt->getWord();
+ aLocale = xAlt->getLocale();
+ aAlts = xAlt->getAlternatives();
+ uno::Reference< container::XNamed > xNamed( xAlt, uno::UNO_QUERY );
+ if (xNamed.is())
+ sServiceName = xNamed->getName();
+ }
+ SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0, sServiceName);
+ GetTextEngine()->SetAttrib( SpellErrorAttrib(aDesc), 0, m_nErrorStart, m_nErrorEnd );
+}
+
+/*-- 10.09.2003 14:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd )
+{
+ GetTextEngine()->SetAttrib(rAttr, nPara, nStart, nEnd);
+}
+/*-- 10.09.2003 14:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetText( const String& rStr )
+{
+ m_nErrorStart = m_nErrorEnd = 0;
+ GetTextEngine()->SetText(rStr);
+// InitScrollBars();
+}
+/*-- 08.10.2003 14:35:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct LanguagePosition_Impl
+{
+ USHORT nPosition;
+ LanguageType eLanguage;
+
+ LanguagePosition_Impl(USHORT nPos, LanguageType eLang) :
+ nPosition(nPos),
+ eLanguage(eLang)
+ {}
+};
+typedef std::vector<LanguagePosition_Impl> LanguagePositions_Impl;
+
+void lcl_InsertBreakPosition_Impl(
+ LanguagePositions_Impl& rBreakPositions, USHORT nInsert, LanguageType eLanguage)
+{
+ LanguagePositions_Impl::iterator aStart = rBreakPositions.begin();
+ while(aStart != rBreakPositions.end())
+ {
+ if(aStart->nPosition == nInsert)
+ {
+ //the language of following starts has to overwrite
+ //the one of previous ends
+ aStart->eLanguage = eLanguage;
+ return;
+ }
+ else if(aStart->nPosition > nInsert)
+ {
+
+ rBreakPositions.insert(aStart, LanguagePosition_Impl(nInsert, eLanguage));
+ return;
+ }
+ else
+ ++aStart;
+ }
+ rBreakPositions.push_back(LanguagePosition_Impl(nInsert, eLanguage));
+}
+/*-- 17.09.2003 14:26:59---------------------------------------------------
+ Returns the text in spell portions. Each portion contains text with an
+ equal language and attribute. The spell alternatives are empty.
+ -----------------------------------------------------------------------*/
+svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnoreFlag ) const
+{
+ svx::SpellPortions aRet;
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ const USHORT nTextLen = pTextEngine->GetTextLen(0);
+ if(nTextLen)
+ {
+ TextPaM aCursor(0, 0);
+ LanguagePositions_Impl aBreakPositions;
+ const TextCharAttrib* pLastLang = 0;
+ const TextCharAttrib* pLastError = 0;
+ LanguageType eLang = LANGUAGE_DONTKNOW;
+ const TextCharAttrib* pError = 0;
+ while(aCursor.GetIndex() < nTextLen)
+ {
+ const TextCharAttrib* pLang = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_LANGUAGE);
+ if(pLang && pLang != pLastLang)
+ {
+ eLang = static_cast<const SpellLanguageAttrib&>(pLang->GetAttr()).GetLanguage();
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetStart(), eLang);
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetEnd(), eLang);
+ pLastLang = pLang;
+ }
+ pError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR);
+ if(pError && pLastError != pError)
+ {
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetStart(), eLang);
+ lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetEnd(), eLang);
+ pLastError = pError;
+
+ }
+ aCursor.GetIndex()++;
+ }
+ //
+ if(nTextLen && aBreakPositions.empty())
+ {
+ //if all content has been overwritten the attributes may have been removed, too
+ svx::SpellPortion aPortion1;
+ aPortion1.eLanguage = GetSpellDialog()->GetSelectedLang_Impl();
+ aPortion1.sText = pTextEngine->GetText(
+ TextSelection(TextPaM(0, 0), TextPaM(0, nTextLen)));
+
+ aRet.push_back(aPortion1);
+
+ }
+ else if(!aBreakPositions.empty())
+ {
+ LanguagePositions_Impl::iterator aStart = aBreakPositions.begin();
+ //start should always be Null
+ eLang = aStart->eLanguage;
+ USHORT nStart = aStart->nPosition;
+ DBG_ASSERT(!nStart, "invalid start position - language attribute missing?");
+ ++aStart;
+
+ while(aStart != aBreakPositions.end())
+ {
+ svx::SpellPortion aPortion1;
+ aPortion1.eLanguage = eLang;
+ aPortion1.sText = pTextEngine->GetText(
+ TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition)));
+ if( bSetIgnoreFlag && m_nErrorStart == nStart )
+ {
+ aPortion1.bIgnoreThisError = true;
+ }
+ aRet.push_back(aPortion1);
+ nStart = aStart->nPosition;
+ eLang = aStart->eLanguage;
+ ++aStart;
+ }
+ }
+
+ // quick partly fix of #i71318. Correct fix needs to patch the TextEngine itself...
+ // this one will only prevent text from disappearing. It may to not have the
+ // correct language and will probably not spell checked...
+ ULONG nPara = pTextEngine->GetParagraphCount();
+ if (nPara > 1)
+ {
+ String aLeftOverText;
+ for (ULONG i = 1; i < nPara; ++i)
+ {
+ aLeftOverText.AppendAscii( "\x0a" ); // the manual line break...
+ aLeftOverText += pTextEngine->GetText(i);
+ }
+ if (pError)
+ { // we need to add a new portion containing the left-over text
+ svx::SpellPortion aPortion2;
+ aPortion2.eLanguage = eLang;
+ aPortion2.sText = aLeftOverText;
+ aRet.push_back( aPortion2 );
+ }
+ else
+ { // we just need to append the left-over text to the last portion (which had no errors)
+ aRet[ aRet.size() - 1 ].sText += aLeftOverText;
+ }
+ }
+ }
+ return aRet;
+}
+
+/*-- 06.11.2003 11:30:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::Undo()
+{
+ SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager();
+ DBG_ASSERT(GetUndoActionCount(), "no undo actions available" );
+ if(!GetUndoActionCount())
+ return;
+ bool bSaveUndoEdit = IsUndoEditMode();
+ USHORT nId;
+ //if the undo edit mode is active then undo all changes until the UNDO_EDIT_MODE action has been found
+ do
+ {
+ nId = rUndoMgr.GetUndoActionId();
+ rUndoMgr.Undo();
+ }while(bSaveUndoEdit && SPELLUNDO_UNDO_EDIT_MODE != nId && GetUndoActionCount());
+
+ if(bSaveUndoEdit || SPELLUNDO_CHANGE_GROUP == nId)
+ GetSpellDialog()->UpdateBoxes_Impl();
+}
+/*-- 06.11.2003 11:30:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::ResetUndo()
+{
+ GetTextEngine()->ResetUndo();
+}
+/*-- 06.11.2003 12:30:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg )
+{
+ SfxUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager();
+ rUndoMgr.AddUndoAction(pAction, bTryMerg);
+ GetSpellDialog()->aUndoPB.Enable();
+}
+/*-- 06.11.2003 12:38:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SentenceEditWindow_Impl::GetUndoActionCount()
+{
+ return GetTextEngine()->GetUndoManager().GetUndoActionCount();
+}
+
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::UndoActionStart( USHORT nId )
+{
+ GetTextEngine()->UndoActionStart(nId);
+}
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::UndoActionEnd( USHORT nId )
+{
+ GetTextEngine()->UndoActionEnd(nId);
+}
+/*-- 12.11.2003 12:12:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset)
+{
+ if(nOffset > 0)
+ m_nErrorEnd = m_nErrorEnd - (USHORT)nOffset;
+ else
+ m_nErrorEnd = m_nErrorEnd -(USHORT)- nOffset;
+}
+/*-- 13.11.2003 15:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
+{
+ DBG_ASSERT(!bSet || m_bIsUndoEditMode != bSet, "SetUndoEditMode with equal values?");
+ m_bIsUndoEditMode = bSet;
+ //disable all buttons except the Change
+ SpellDialog* pSpellDialog = GetSpellDialog();
+ Control* aControls[] =
+ {
+ &pSpellDialog->aChangeAllPB,
+ &pSpellDialog->aExplainPB,
+ &pSpellDialog->aIgnoreAllPB,
+ &pSpellDialog->aIgnoreRulePB,
+ &pSpellDialog->aIgnorePB,
+ &pSpellDialog->aSuggestionLB,
+ &pSpellDialog->aSuggestionFT,
+ &pSpellDialog->aLanguageFT,
+ &pSpellDialog->aLanguageLB,
+ &pSpellDialog->aAddToDictMB,
+ &pSpellDialog->aAutoCorrPB,
+ 0
+ };
+ sal_Int32 nIdx = 0;
+ do
+ {
+ aControls[nIdx]->Enable(sal_False);
+ }
+ while(aControls[++nIdx]);
+
+ //remove error marks
+ TextEngine* pTextEngine = GetTextEngine();
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTCOLOR, TRUE );
+ pTextEngine->RemoveAttribs( 0, (USHORT)TEXTATTR_FONTWEIGHT, TRUE );
+
+ //put the appropriate action on the Undo-stack
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_UNDO_EDIT_MODE, GetSpellDialog()->aDialogUndoLink);
+ AddUndoAction(pAction);
+ pSpellDialog->aChangePB.Enable();
+}
+
+/*-- 30.06.2008 14:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ExplainButton::~ExplainButton()
+{
+}
+/*-- 30.06.2008 14:15:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ExplainButton::RequestHelp( const HelpEvent& )
+{
+ Help::ShowBalloon( this, GetPosPixel(), m_sExplanation );
+}
+
+void ExplainButton::Click()
+{
+ RequestHelp( HelpEvent() );
+}
diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc
new file mode 100644
index 000000000000..f571525a25db
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SpellDialog.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_SUGGESTION 31
+#define LB_SUGGESTION 32
+#define FT_NOTINDICT 33
+#define ED_NEWWORD 34
+#define FT_LANGUAGE 35
+#define LB_LANGUAGE 36
+#define PB_IGNORE 37
+#define PB_IGNOREALL 38
+#define MB_ADDTODICT 39
+#define PB_CHANGE 40
+#define PB_CHANGEALL 41
+#define PB_AUTOCORR 42
+#define GB_BACKGROUND 43
+#define PB_OPTIONS 44
+#define PB_HELP 45
+#define PB_UNDO 46
+#define PB_CLOSE 47
+#define ST_NOSUGGESTIONS 48
+#define ST_RESUME 50
+#define ST_SPELLING 51
+#define ST_SPELLING_AND_GRAMMAR 52
+#define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53
+#define CB_CHECK_GRAMMAR 54
+#define PB_EXPLAIN 55
+#define IMG_VENDOR 56
+#define IMG_DEFAULT_VENDOR 57
+#define IMG_DEFAULT_VENDOR_HC 58
+#define PB_IGNORERULE 59
diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src
new file mode 100644
index 000000000000..61ef8b4e6ab2
--- /dev/null
+++ b/cui/source/dialogs/SpellDialog.src
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SpellDialog.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <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
+ {
+ Pos = MAP_APPFONT( 110, 6 );
+ Size = MAP_APPFONT( 93, 55 );
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_NOTINDICT
+ {
+ Pos = MAP_APPFONT( 6, 26 );
+ Size = MAP_APPFONT( 120, 8 );
+ Text [ en-US ] = "~Not in dictionary" ;
+ };
+
+ MultiLineEdit ED_NEWWORD
+ {
+ Pos = MAP_APPFONT( 6, 37 );
+ Size = MAP_APPFONT( 197, 48 );
+ Border = TRUE;
+ VScroll = TRUE;
+ IgnoreTab = TRUE;
+ };
+
+ FixedText FT_SUGGESTION
+ {
+ Pos = MAP_APPFONT( 6, 88 );
+ Size = MAP_APPFONT( 120, 8 );
+ Text [ en-US ] = "~Suggestions" ;
+ };
+ ListBox LB_SUGGESTION
+ {
+ Pos = MAP_APPFONT( 6, 99 );
+ Size = MAP_APPFONT( 197, 48 );
+ Border = TRUE;
+ };
+
+ CheckBox CB_CHECK_GRAMMAR
+ {
+ Pos = MAP_APPFONT( 6, 153 );
+ Size = MAP_APPFONT( 100, 10 );
+ Text [ en-US ] = "Check ~grammar" ;
+ Hide = TRUE;
+ };
+
+ PushButton PB_IGNORE
+ {
+ Pos = MAP_APPFONT( 209, 37 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Ignore Once" ;
+ };
+
+ PushButton PB_IGNOREALL
+ {
+ Pos = MAP_APPFONT( 209, 54 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "I~gnore All" ;
+ };
+ PushButton PB_IGNORERULE
+ {
+ Pos = MAP_APPFONT( 209, 54 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "I~gnore Rule" ;
+ Hide = TRUE;
+ };
+ MenuButton MB_ADDTODICT
+ {
+ Pos = MAP_APPFONT( 209, 71 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Add" ;
+ };
+
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT( 209, 99 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Change" ;
+ DefButton = TRUE ;
+ };
+
+ PushButton PB_CHANGEALL
+ {
+ Pos = MAP_APPFONT( 209, 117 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "Change A~ll" ;
+ };
+ PushButton PB_EXPLAIN
+ {
+ Pos = MAP_APPFONT( 209, 117 );
+ Size = MAP_APPFONT( 55, 14 );
+ Hide = TRUE;
+ Text [ en-US ] = "~Explain..." ;
+ };
+ PushButton PB_AUTOCORR
+ {
+ Pos = MAP_APPFONT( 209, 134 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "AutoCor~rect" ;
+ };
+ GroupBox GB_BACKGROUND
+ {
+ Pos = MAP_APPFONT( 1, 21 );
+ Size = MAP_APPFONT( 268, 146 );
+ Hide=TRUE;
+ };
+
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT( 6, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ };
+ PushButton PB_OPTIONS
+ {
+ Pos = MAP_APPFONT( 87, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "O~ptions..." ;
+ };
+ PushButton PB_UNDO
+ {
+ Pos = MAP_APPFONT( 148, 170 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "~Undo" ;
+ };
+
+ PushButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( 209 , 170 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cl~ose" ;
+ };
+ String ST_RESUME
+ {
+ Text[ en-US ] = "Resu~me";
+ };
+ String ST_NOSUGGESTIONS
+ {
+ Text [en-US] = "(no suggestions)";
+ };
+ String ST_SPELLING
+ {
+ Text[ en-US ] = "Spelling: $LANGUAGE ($LOCATION)";
+ };
+ String ST_SPELLING_AND_GRAMMAR
+ {
+ Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION)";
+ };
+ String ST_SPELLING_AND_GRAMMAR_VENDORNAME
+ {
+ Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]";
+ };
+ Image IMG_DEFAULT_VENDOR
+ {
+ ImageBitmap = Bitmap { File = "vendor01.png"; };
+ };
+ Image IMG_DEFAULT_VENDOR_HC
+ {
+ ImageBitmap = Bitmap { File = "vendor01h.png"; };
+ };
+
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/charmap.hrc b/cui/source/dialogs/charmap.hrc
new file mode 100644
index 000000000000..49dae5c98f06
--- /dev/null
+++ b/cui/source/dialogs/charmap.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: charmap.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..c8b1030cb328
--- /dev/null
+++ b/cui/source/dialogs/charmap.src
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: charmap.src,v $
+ * $Revision: 1.57 $
+ *
+ * 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 = SID_CHARMAP ;
+ SvLook = TRUE ;
+ Text [ en-US ] = "Special Characters";
+/* Size = MAP_APPFONT ( 297 , 169 ) ; */
+ 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
+ {
+ 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
+ {
+ 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 ( 190 , 16 ) ; */
+ 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
+ {
+ Pos = MAP_APPFONT ( 242 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete";
+ };
+/*
+ PushButton BT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 242 , 140 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Assign shortcut...";
+ };
+ FixedText FT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 156 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Shortcut key: ";
+ };
+ Control CT_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 60 , 156 ) ;
+ Size = MAP_APPFONT ( 160 , 8 ) ;
+ };
+*/
+};
+
+// ********************************************************************** EOF
diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx
new file mode 100644
index 000000000000..4f2ab5677b63
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.cxx
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commonlingui.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "commonlingui.hxx"
+
+#include <cuires.hrc>
+#include <dialmgr.hxx>
+#include <vcl/decoview.hxx>
+
+#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();
+}
+
+//-----------------------------------------------------------------------------
+__EXPORT 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();
+
+#ifdef FS_PRIV_DEBUG
+ SetType( WINDOW_TABPAGE );
+#endif
+
+ 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
+}
+
+// -----------------------------------------------------------------------
+String SvxCommonLinguisticControl::GetNewEditWord()
+{
+ return aNewWordED.GetText();
+}
+
+// -----------------------------------------------------------------------
+void SvxCommonLinguisticControl::SetNewEditWord( const String& _rNew )
+{
+ aNewWordED.SetText( _rNew );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::UpdateIgnoreHelp( )
+{
+
+ String aInfoStr( RTL_CONSTASCII_USTRINGPARAM( ": " ) );
+ aInfoStr.Append( GetCurrentText() );
+
+ String aString = GetNonMnemonicString( aIgnoreAllBtn.GetText() );
+ aString.Append( aInfoStr );
+ aIgnoreAllBtn.SetQuickHelpText( aString );
+
+ aString = GetNonMnemonicString( aIgnoreBtn.GetText() );
+ aString.Append( aInfoStr );
+ aIgnoreBtn.SetQuickHelpText( aString );
+}
+
+//-----------------------------------------------------------------------------
+void SvxCommonLinguisticControl::UpdateChangesHelp( const String& _rNewText )
+{
+ String aInfoStr( RTL_CONSTASCII_USTRINGPARAM( ": " ) );
+ aInfoStr.Append( GetCurrentText() );
+ aInfoStr.Append( String( RTL_CONSTASCII_USTRINGPARAM( " -> " ) ) );
+ aInfoStr.Append( _rNewText );
+ // TODO: shouldn't this be part of the resources, for proper localization?
+
+ String aString = GetNonMnemonicString( aChangeAllBtn.GetText() );
+ aString.Append( aInfoStr );
+ aChangeAllBtn.SetQuickHelpText( aString );
+
+ aString = GetNonMnemonicString( aChangeBtn.GetText() );
+ aString.Append( aInfoStr );
+ aChangeBtn.SetQuickHelpText( aString );
+}
+
+//-----------------------------------------------------------------------------
+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 < sizeof( pResize ) / sizeof( pResize[0] ); ++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 < sizeof( pMoveDown ) / sizeof( pMoveDown[0] ); ++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 < sizeof( pMoveRight ) / sizeof( pMoveRight[0] ); ++i )
+ {
+ aPos = pMoveRight[i]->GetPosPixel();
+ aPos.X() += _nX;
+ pMoveRight[i]->SetPosPixel( aPos );
+ }
+ }
+}
diff --git a/cui/source/dialogs/commonlingui.hxx b/cui/source/dialogs/commonlingui.hxx
new file mode 100644
index 000000000000..d1781e83348f
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commonlingui.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_COMMON_LINGUI_HXX
+#define SVX_COMMON_LINGUI_HXX
+
+#include <vcl/ctrl.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/edit.hxx>
+#include <svx/svxbox.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#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(); }
+
+ // updates the help texts for the "change" and "change all" buttons according to the currently
+ // entered texts
+ void UpdateChangesHelp( const String& _rNewText );
+ inline void UpdateChangesHelp( ) { UpdateChangesHelp( GetWordInputControl().GetText() ); }
+
+ // updates the help texts for the "ignore" and "always ignore" buttons according to the currently
+ // entered texts
+ void UpdateIgnoreHelp( );
+
+ String GetNewEditWord();
+ void SetNewEditWord( const String& _rNew );
+};
+
+
+
+#endif // SVX_COMMON_LINGUI_HXX
diff --git a/cui/source/dialogs/commonlingui.src b/cui/source/dialogs/commonlingui.src
new file mode 100644
index 000000000000..1a58a9ef7fa8
--- /dev/null
+++ b/cui/source/dialogs/commonlingui.src
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commonlingui.src,v $
+ * $Revision: 1.16 $
+ *
+ * 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
new file mode 100644
index 000000000000..83dc06e606a3
--- /dev/null
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -0,0 +1,589 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// 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 <vcl/msgbox.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itempool.hxx>
+
+#include <rtl/textenc.h>
+#include <svx/ucsubset.hxx>
+
+#include <cuires.hrc>
+#include <dialmgr.hxx>
+#include "cuicharmap.hxx"
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/app.hxx>
+#include <svx/fontitem.hxx>
+#include "charmap.hrc"
+#include "macroass.hxx"
+
+// class SvxCharacterMap =================================================
+
+SvxCharacterMap::SvxCharacterMap( Window* pParent, BOOL bOne, const SfxItemSet* pSet ) :
+ SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_CHARMAP ) ),
+ mpCharMapData( 0 )
+{
+ SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, FALSE );
+ if ( pItem )
+ bOne = pItem->GetValue();
+
+ mpCharMapData = new SvxCharMapData( this, bOne, &CUI_MGR() );
+
+ SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, FALSE );
+ if ( pCharItem )
+ SetChar( pCharItem->GetValue() );
+
+ SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, FALSE );
+ if ( pDisableItem && pDisableItem->GetValue() )
+ DisableFontSelection();
+
+ SFX_ITEMSET_ARG( pSet, pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ SFX_ITEMSET_ARG( pSet, pFontNameItem, SfxStringItem, SID_FONT_NAME, 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, 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( 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, BOOL bOne_, ResMgr* pResContext )
+: mpDialog( pDialog ),
+ aShowSet ( pDialog, ResId( CT_SHOWSET, *pResContext ) ),
+ aShowText ( pDialog, ResId( CT_SHOWTEXT, *pResContext ) ),
+// aShowShortcut ( pDialog, ResId( CT_ASSIGN, *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 ) ),
+// aAssignBtn ( pDialog, ResId( BT_ASSIGN, *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 ), TRUE ),
+ aCharCodeText ( pDialog, ResId( FT_CHARCODE, *pResContext ) ),
+// aAssignText ( pDialog, ResId( FT_ASSIGN, *pResContext ) ),
+ bOne( bOne_ ),
+ pSubsetMap( NULL )
+{
+ aFont = pDialog->GetFont();
+ aFont.SetTransparent( 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;
+ USHORT nPos = aFontLB.InsertEntry( aFontName );
+ aFontLB.SetEntryData( nPos, (void*)(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
+ FASTBOOL 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 = 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 ) );
+// aAssignBtn.SetClickHdl( LINK( this, SvxCharMapData, AssignHdl ) );
+
+ if( SvxShowCharSet::getSelectedChar() == ' ')
+ aOKBtn.Disable();
+ else
+ aOKBtn.Enable();
+
+ // left align aShowText field
+ int nLeftEdge = aSymbolText.GetPosPixel().X();
+ nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() );
+ Size aNewSize = aShowText.GetOutputSizePixel();
+ 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( TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = aFontLB.GetSelectEntryPos(),
+ nFont = (USHORT)(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;
+
+ 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 )) )
+ {
+ USHORT 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 = FALSE;
+ }
+
+ aSubsetText.Show( bNeedSubset);
+ aSubsetLB.Show( bNeedSubset);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxCharMapData, SubsetSelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT 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( 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;
+}
+
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+
+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, FALSE, &pItem ) )
+ {
+ // show assigned shortcut
+ }
+ }
+
+ delete pDlg;
+
+ return 0;
+}
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
new file mode 100644
index 000000000000..7411224a0f93
--- /dev/null
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -0,0 +1,968 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuifmsearch.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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>
+
+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, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), 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
+ // 04.12.2001 - 91973 - fs@openoffice.org
+ 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, sizeof(pFieldsToMove)/sizeof(pFieldsToMove[0]), 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)
+{
+ // die Initialisierung all der 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));
+
+ // die Listboxen fuellen
+ // die Methoden des Feldvergleiches
+ USHORT nResIds[] = {
+ RID_STR_SEARCH_ANYWHERE,
+ RID_STR_SEARCH_BEGINNING,
+ RID_STR_SEARCH_END,
+ RID_STR_SEARCH_WHOLE
+ };
+ for ( size_t i=0; i<sizeof(nResIds)/sizeof(nResIds[0]); ++i )
+ m_lbPosition.InsertEntry( String( CUI_RES( nResIds[i] ) ) );
+ m_lbPosition.SelectEntryPos(MATCHING_ANYWHERE);
+
+ // die Feld-Listbox
+ for (USHORT i=0; i<strVisibleFields.GetTokenCount(';'); ++i)
+ m_lbField.InsertEntry(strVisibleFields.GetToken(i, ';'));
+
+
+ m_pConfig = new FmSearchConfigItem;
+ LoadParams();
+
+ m_cmbSearchText.SetText(sInitialText);
+ // wenn die Edit-Zeile den Text veraendert hat (weil er zum Beispiel Steuerzeichen enthielt, wie das bei Memofeldern der Fall
+ // sein kann), nehme ich einen leeren UniString
+ UniString sRealSetText = m_cmbSearchText.GetText();
+ if (!sRealSetText.Equals(sInitialText))
+ m_cmbSearchText.SetText(UniString());
+ LINK(this, FmSearchDialog, OnSearchTextModified).Call(&m_cmbSearchText);
+
+ // initial die ganzen UI-Elemente fuer die Suche an
+ 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()
+{
+ // Wenn der Close-Button disabled ist und man im Dialog ESC drueckt, dann wird irgendwo vom Frame trotzdem Close aufgerufen,
+ // was ich allerdings nicht will, wenn ich gerade mitten in einer (eventuell in einem extra Thread laufenden) Suche bin
+ 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
+ // die Feldlistbox entsprechend en- oder disablen
+ 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() );
+ //CHINA001 SvxJSearchOptionsDialog aDlg( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS, m_pSearchEngine->GetTransliterationFlags() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ aDlg->Execute(); //CHINA001 aDlg.Execute();
+
+
+ INT32 nFlags = aDlg->GetTransliterationFlags(); //CHINA001 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; //add for CHINA001
+ }
+ }
+
+ 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<sizeof(pBoxes)/sizeof(CheckBox*); ++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
+ // 104332 - 2002-10-17 - fs@openoffice.org
+ 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
+ // 07.12.2001 - 95246 - fs@openoffice.org
+ 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
+ // 104332 - 2002-10-17 - fs@openoffice.org
+ 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<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++i)
+ {
+ pAffectedControls[i]->SetUpdateMode(bEnable);
+ pAffectedControls[i]->EnablePaint(bEnable);
+ }
+ else
+ for (sal_uInt32 i=0; i<sizeof(pAffectedControls)/sizeof(pAffectedControls[0]); ++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)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ // 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();
+ }
+ // KEIN 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 );
+}
+
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
new file mode 100644
index 000000000000..426d6fef86ea
--- /dev/null
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -0,0 +1,1272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuigaldlg.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <algorithm>
+#include <ucbhelper/content.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/opengrf.hxx>
+#include <svx/impgrf.hxx>
+#include <svx/gallery1.hxx>
+#include <svx/galtheme.hxx>
+#include "cuigaldlg.hxx"
+#include <svl/pickerhelper.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"
+
+// --------------
+// - 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( ( (FilterEntry*) mpBrowser->aFilterEntryList.GetObject( 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,
+ BOOL bRecursive )
+{
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ 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::createFromAscii( "IsFolder" );
+ aProps.getArray()[ 1 ] = OUString::createFromAscii( "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, 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() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ mpBrowser->aFoundList.Insert(
+ new String( aFoundURL.GetMainURL( INetURLObject::NO_DECODE ) ),
+ LIST_APPEND );
+ mpBrowser->aLbxFound.InsertEntry(
+ GetReducedString( aFoundURL, 50 ),
+ (USHORT) mpBrowser->aFoundList.Count() - 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()
+{
+ DBG_ERROR( "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, List& rTakenList ) :
+ mpProgress ( pProgess ),
+ mpBrowser ( pBrowser ),
+ mrTakenList ( rTakenList )
+{
+}
+
+// ------------------------------------------------------------------------
+
+TakeThread::~TakeThread()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void SAL_CALL TakeThread::run()
+{
+ String aName;
+ INetURLObject aURL;
+ USHORT nEntries;
+ GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme;
+ USHORT nPos;
+ GalleryProgress* pStatusProgress;
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ pStatusProgress = new GalleryProgress;
+ nEntries = mpBrowser->bTakeAll ? mpBrowser->aLbxFound.GetEntryCount() : mpBrowser->aLbxFound.GetSelectEntryCount();
+ pThm->LockBroadcaster();
+ }
+
+ for( USHORT i = 0; i < nEntries && schedule(); i++ )
+ {
+ // kompletten Filenamen aus FoundList holen
+ if( mpBrowser->bTakeAll )
+ aURL = INetURLObject(*mpBrowser->aFoundList.GetObject( nPos = i ));
+ else
+ aURL = INetURLObject(*mpBrowser->aFoundList.GetObject( nPos = mpBrowser->aLbxFound.GetSelectEntryPos( i ) ));
+
+ // Position in Taken-Liste uebernehmen
+ mrTakenList.Insert( (void*) (ULONG)nPos, LIST_APPEND );
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ mpProgress->SetFile( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+ pStatusProgress->Update( i, nEntries - 1 );
+ mpProgress->Sync();
+ pThm->InsertURL( aURL );
+ }
+ }
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ 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::bit_vector aRemoveEntries( mpBrowser->aFoundList.Count(), false );
+ ::std::vector< String > aRemainingVector;
+ sal_uInt32 i, nCount;
+
+ GetParent()->EnterWait();
+ mpBrowser->aLbxFound.SetUpdateMode( FALSE );
+ mpBrowser->aLbxFound.SetNoSelection();
+
+ // mark all taken positions in aRemoveEntries
+ for( i = 0UL, nCount = maTakenList.Count(); i < nCount; ++i )
+ aRemoveEntries[ (ULONG) maTakenList.GetObject( i ) ] = true;
+
+ maTakenList.Clear();
+
+ // refill found list
+ for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
+ if( !aRemoveEntries[ i ] )
+ aRemainingVector.push_back( *mpBrowser->aFoundList.GetObject( i ) );
+
+ for( String* pStr = mpBrowser->aFoundList.First(); pStr; pStr = mpBrowser->aFoundList.Next() )
+ delete pStr;
+
+ mpBrowser->aFoundList.Clear();
+
+ for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
+ mpBrowser->aFoundList.Insert( new String( aRemainingVector[ i ] ), LIST_APPEND );
+
+ 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( TRUE );
+ mpBrowser->SelectFoundHdl( NULL );
+ GetParent()->LeaveWait();
+
+ EndDialog( RET_OK );
+ delete this;
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+short TakeProgress::Execute()
+{
+ DBG_ERROR( "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( (USHORT) pThm->GetId() );
+ aLbResName.GrabFocus();
+
+ aBtnOk.SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryIdDialog, ClickOkHdl, void*, EMPTYARG )
+{
+ Gallery* pGal = pThm->GetParent();
+ const ULONG nId = GetId();
+ BOOL bDifferentThemeExists = FALSE;
+
+ for( 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 = 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( USHORT 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();
+}
+
+// ------------------------------------------------------------------------
+
+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( CUI_RES( RID_SVXSTR_GALLERYPROPS_GALTHEME ) );
+ 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 LocaleDataWrapper& aLocaleData = SvtSysLocale().GetLocaleData();
+
+ // ChangeDate/Time
+ aAccess = aLocaleData.getDate( pData->aThemeChangeDate );
+ aAccess += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ aAccess += aLocaleData.getTime( pData->aThemeChangeTime );
+ aFtMSShowChangeDate.SetText( aAccess );
+
+ // Image setzen
+ USHORT 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 ) );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TPGalleryThemeGeneral::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ pData->aEditedTitle = aEdtMSName.GetText();
+ return 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 ),
+ aBtnSearch ( this, CUI_RES(BTN_SEARCH ) ),
+ aBtnTake ( this, CUI_RES(BTN_TAKE ) ),
+ aBtnTakeAll ( this, CUI_RES(BTN_TAKEALL ) ),
+ aCbxPreview ( this, CUI_RES(CBX_PREVIEW ) ),
+ aCbbFileType ( this, CUI_RES(CBB_FILETYPE ) ),
+ aLbxFound ( this, CUI_RES(LBX_FOUND ) ),
+ aFtFileType ( this, CUI_RES(FT_FILETYPE ) ),
+ aWndPreview ( this, CUI_RES( WND_BRSPRV ) ),
+ nCurFilterPos (0),
+ nFirstExtFilterPos (0),
+ bEntriesFound (FALSE),
+ bInputAllowed (TRUE),
+ bSearchRecursive (FALSE),
+ xDialogListener ( new ::svt::DialogClosedListener() )
+{
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, TPGalleryThemeProperties, DialogClosedHdl ) );
+}
+
+// ------------------------------------------------------------------------
+
+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( String* pStr = aFoundList.First(); pStr; pStr = aFoundList.Next() )
+ delete pStr;
+
+ for( void* pEntry = aFilterEntryList.First(); pEntry; pEntry = aFilterEntryList.Next() )
+ delete (FilterEntry*) pEntry;
+}
+
+// ------------------------------------------------------------------------
+
+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* pFilter = GetGrfFilter();
+ String aExt;
+ String aName;
+ FilterEntry* pFilterEntry;
+ FilterEntry* pTestEntry;
+ sal_uInt16 i, nKeyCount;
+ BOOL bInList;
+
+ // graphic filters
+ for( i = 0, nKeyCount = pFilter->GetImportFormatCount(); i < nKeyCount; i++ )
+ {
+ aExt = pFilter->GetImportFormatShortName( i );
+ aName = pFilter->GetImportFormatName( i );
+ pTestEntry = (FilterEntry*) aFilterEntryList.First();
+ bInList = FALSE;
+
+ String aExtensions;
+ int j = 0;
+ String sWildcard;
+ while( TRUE )
+ {
+ sWildcard = pFilter->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 = TRUE;
+ break;
+ }
+ pTestEntry = (FilterEntry*) aFilterEntryList.Next();
+ }
+ if ( !bInList )
+ {
+ pFilterEntry = new FilterEntry;
+ pFilterEntry->aFilterName = aExt;
+ aFilterEntryList.Insert( pFilterEntry, aCbbFileType.InsertEntry( aName ) );
+ }
+ }
+
+ // 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 ) );
+ aFilterEntryList.Insert( pFilterEntry, nFirstExtFilterPos );
+ }
+ }
+
+ // 'All' filters
+ String aExtensions;
+
+ // graphic filters
+ for ( i = 0; i < nKeyCount; ++i )
+ {
+ int j = 0;
+ String sWildcard;
+ while( TRUE )
+ {
+ sWildcard = pFilter->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(WIN) || 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 );
+ aFilterEntryList.Insert(pFilterEntry, aCbbFileType. InsertEntry( pFilterEntry->aFilterName, 0 ) );
+
+ 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( String* pStr = aFoundList.First(); pStr; pStr = aFoundList.Next() )
+ delete pStr;
+
+ 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::createFromAscii( "com.sun.star.ui.dialogs.FolderPicker" )), UNO_QUERY );
+
+ if ( xFolderPicker.is() )
+ {
+// svt::SetDialogHelpId( xFolderPicker, HID_GALLERY_NEWTHEME_FINDFILES );
+ 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(IllegalArgumentException)
+ {
+#ifdef DBG_UTIL
+ DBG_ERROR( "Folder picker failed with illegal arguments" );
+#endif
+ }
+ }
+
+ 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.GetObject( aLbxFound.GetEntryPos( aString ) ) );
+ bInputAllowed = 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 = 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.SetDialogHelpId( HID_GALLERY_NEWTHEME_ADDFILES );
+ aDlg.EnableLink(sal_False);
+ aDlg.AsLink(sal_False);
+
+ if( !aDlg.Execute() )
+ pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) );
+ }
+ else
+ {
+ bTakeAll = FALSE;
+ TakeFiles();
+ }
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, ClickTakeAllHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ aPreviewTimer.Stop();
+ bTakeAll = TRUE;
+ TakeFiles();
+ }
+
+ return 0L;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( TPGalleryThemeProperties, SelectFoundHdl, void *, EMPTYARG )
+{
+ if( bInputAllowed )
+ {
+ BOOL bPreviewPossible = FALSE;
+
+ aPreviewTimer.Stop();
+
+ if( bEntriesFound )
+ {
+ if( aLbxFound.GetSelectEntryCount() == 1 )
+ {
+ aCbxPreview.Enable();
+ bPreviewPossible = TRUE;
+ }
+ else
+ aCbxPreview.Disable();
+
+ if( aFoundList.Count() )
+ 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.Count() )
+ {
+ aLbxFound.SelectEntryPos( 0 );
+ aBtnTakeAll.Enable();
+ aCbxPreview.Enable();
+ bEntriesFound = TRUE;
+ }
+ else
+ {
+ aLbxFound.InsertEntry( String( CUI_RES( RID_SVXSTR_GALLERY_NOFILES ) ) );
+ aBtnTakeAll.Disable();
+ aCbxPreview.Disable();
+ bEntriesFound = 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;
+}
+
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
new file mode 100644
index 000000000000..be2b401320fd
--- /dev/null
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -0,0 +1,759 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuigrfflt.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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_...
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+/*
+ULONG SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+{
+ const Graphic& rGraphic = rFilterObject.GetGraphic();
+ ULONG nRet;
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
+ Window* pWindow = ( pViewFrame && pViewFrame->GetViewShell() ) ? pViewFrame->GetViewShell()->GetWindow() : NULL;
+ Graphic aGraphic;
+
+ switch( rReq.GetSlot() )
+ {
+ case( SID_GRFFILTER_INVERT ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Invert() )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Invert() )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SMOOTH ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SHARPEN ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_REMOVENOISE ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOBEL ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_MOSAIC ):
+ {
+ GraphicFilterMosaic aDlg( pWindow, rGraphic, 4, 4, FALSE );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_EMBOSS ):
+ {
+ GraphicFilterEmboss aDlg( pWindow, rGraphic, RP_MM );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_POSTER ):
+ {
+ GraphicFilterPoster aDlg( pWindow, rGraphic, 16 );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_POPART ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( TRUE );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( FALSE );
+ }
+ break;
+
+ case( SID_GRFFILTER_SEPIA ):
+ {
+ GraphicFilterSepia aDlg( pWindow, rGraphic, 10 );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOLARIZE ):
+ {
+ GraphicFilterSolarize aDlg( pWindow, rGraphic, 128, FALSE );
+
+ if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ }
+ break;
+
+ default:
+ {
+ DBG_ERROR( "SvxGraphicFilter: selected filter slot not yet implemented" );
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_SLOT;
+ }
+ break;
+ }
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ rFilterObject.SetGraphic( aGraphic );
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ }
+ }
+ else
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGraphicFilter::DisableGraphicFilterSlots( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER ) )
+ rSet.DisableItem( SID_GRFFILTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_INVERT ) )
+ rSet.DisableItem( SID_GRFFILTER_INVERT );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SMOOTH ) )
+ rSet.DisableItem( SID_GRFFILTER_SMOOTH );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SHARPEN ) )
+ rSet.DisableItem( SID_GRFFILTER_SHARPEN );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_REMOVENOISE ) )
+ rSet.DisableItem( SID_GRFFILTER_REMOVENOISE );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOBEL ) )
+ rSet.DisableItem( SID_GRFFILTER_SOBEL );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_MOSAIC ) )
+ rSet.DisableItem( SID_GRFFILTER_MOSAIC );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_EMBOSS ) )
+ rSet.DisableItem( SID_GRFFILTER_EMBOSS );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POSTER ) )
+ rSet.DisableItem( SID_GRFFILTER_POSTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POPART ) )
+ rSet.DisableItem( SID_GRFFILTER_POPART );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SEPIA ) )
+ rSet.DisableItem( SID_GRFFILTER_SEPIA );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOLARIZE ) )
+ rSet.DisableItem( SID_GRFFILTER_SOLARIZE );
+};
+*/
+// --------------------------------------
+// - 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 ) ),
+ maFlParameter ( this, CUI_RES( FL_PARAMETER ) ),
+ maBtnOK ( this, CUI_RES( BTN_OK ) ),
+ maBtnCancel ( this, CUI_RES( BTN_CANCEL ) ),
+ maBtnHelp ( this, CUI_RES( BTN_HELP ) )
+{
+ 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,
+ USHORT nTileWidth, USHORT nTileHeight, 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();
+}
+
+// -----------------------------------------------------------------------------
+
+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,
+ BYTE cGreyThreshold, 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,
+ USHORT 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,
+ USHORT 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 USHORT 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;
+ USHORT nAzim, nElev;
+
+ switch( maCtlLight.GetActualRP() )
+ {
+ default: DBG_ERROR("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;
+}
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
new file mode 100644
index 000000000000..a73cc0007a6f
--- /dev/null
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuihyperdlg.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// 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( USHORT _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg )
+: SfxControllerItem ( _nId, rBindings )
+ ,aOnlineForwarder ( SID_INTERNET_ONLINE , *this )
+ ,aRdOnlyForwarder ( SID_READONLY_MODE, *this )
+{
+ pParent = pDlg;
+}
+
+void SvxHlinkCtrl::StateChanged( USHORT 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() == 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 )
+{
+ mbGrabFocus = sal_True;
+ // insert pages
+ Image aImage;
+ Image aImageHC;
+ String aStrTitle;
+ SvxIconChoiceCtrlEntry* pEntry = NULL;
+
+ aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
+ aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) );
+ aImageHC = Image( CUI_RES ( RID_SVXBMP_HLINETTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, aImageHC, 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 ) );
+ aImageHC = Image( CUI_RES ( RID_SVXBMP_HLMAILTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, aImageHC, 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 ) );
+ aImageHC = Image( CUI_RES ( RID_SVXBMP_HLDOCTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, aImageHC, 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 ) );
+ aImageHC = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP_H ) );
+ pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, aImageHC, SvxHyperlinkNewDocTp::Create );
+ pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
+
+ // all tab pages set -> create mnemonics
+ // CreateIconTextAutoMnemonics(); #99671# not useful, because this is not what user expects when using mnemonics on the pages
+
+ // 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 (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
+|*
+|************************************************************************/
+
+BOOL SvxHpLinkDlg::Close()
+{
+ GetDispatcher()->Execute( SID_HYPERLINK_DIALOG,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ return 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() );
+
+ 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()) ), 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();
+}
+
+/*long SvxHpLinkDlg::PreNotify( NotifyEvent& rNEvt )
+{
+ long nRet = 0;
+
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ DBG_ASSERT( rNEvt.GetKeyEvent(), "-SvxHpLinkDlg::PreNotify(): no KeyEvent for key event?!" );
+
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ if( KEY_MOD2 == pKEvt->GetKeyCode().GetModifier() && pKEvt->GetCharCode() && HandleShortCutKey( *pKEvt ) )
+ nRet = 1;
+ }
+
+ if( !nRet )
+ nRet = IconChoiceDialog::PreNotify( rNEvt );
+
+ return nRet;
+}*/
+
+/*************************************************************************
+|*
+|* 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
+|*
+|************************************************************************/
+
+USHORT SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem )
+{
+ USHORT 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 :
+ case INET_PROT_TELNET :
+ 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( USHORT /*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 );
+}
diff --git a/cui/source/dialogs/cuiimapdlg.hrc b/cui/source/dialogs/cuiimapdlg.hrc
new file mode 100755
index 000000000000..9424d94c1f05
--- /dev/null
+++ b/cui/source/dialogs/cuiimapdlg.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: imapdlg.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <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
new file mode 100755
index 000000000000..de41ca0d1d55
--- /dev/null
+++ b/cui/source/dialogs/cuiimapdlg.src
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: imapdlg.src,v $
+ * $Revision: 1.53 $
+ *
+ * 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
+{
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..841b9ca59b78
--- /dev/null
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuiimapwnd.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <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( String* pStr = rTargetList.First(); pStr; pStr = rTargetList.Next() )
+ maCbbTargets.InsertEntry( *pStr );
+
+ if( !rTarget.Len() )
+ maCbbTargets.SetText( String::CreateFromAscii( "_self" ) );
+ else
+ maCbbTargets.SetText( rTarget );
+}
diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx
new file mode 100644
index 000000000000..1ca37f425a10
--- /dev/null
+++ b/cui/source/dialogs/cuitbxform.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuitbxform.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#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(TRUE);
+ m_aRecordNo.SetDecimalDigits(0);
+
+ FreeResource();
+}
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
new file mode 100644
index 000000000000..8cf36980decf
--- /dev/null
+++ b/cui/source/dialogs/dlgname.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlgname.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/ref.hxx>
+#include <tools/list.hxx>
+#include <tools/shl.hxx>
+#include <tools/debug.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <cuires.hrc>
+
+#include "dlgname.hxx"
+#include "defdlgname.hxx" //CHINA001
+#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 );
+ }
+}
+
+/* -----------------------------27.02.2002 15:22------------------------------
+
+ ---------------------------------------------------------------------------*/
+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( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case MESS_BTN_1:
+ aBtn1.SetText( rNewTxt );
+ break;
+
+ case MESS_BTN_2:
+ aBtn2.SetText( rNewTxt );
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Button-Nummer!!!" );
+ }
+}
+
+
diff --git a/cui/source/dialogs/dlgname.hrc b/cui/source/dialogs/dlgname.hrc
new file mode 100644
index 000000000000..787a5b9bd6df
--- /dev/null
+++ b/cui/source/dialogs/dlgname.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlgname.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..93a2e5979671
--- /dev/null
+++ b/cui/source/dialogs/dlgname.src
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dlgname.src,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include ------------------------------------------------------------------
+
+#include <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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 25 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 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
new file mode 100644
index 000000000000..579602ec2b5f
--- /dev/null
+++ b/cui/source/dialogs/fmsearch.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fmsearch.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _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
new file mode 100644
index 000000000000..83b04a138b0d
--- /dev/null
+++ b/cui/source/dialogs/fmsearch.src
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fmsearch.src,v $
+ * $Revision: 1.59 $
+ *
+ * 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
+ {
+ Pos = MAP_APPFONT( 12, 23 );
+ Size = MAP_APPFONT( 50, 10 );
+ Group = TRUE;
+ Text [ en-US ] = "~Text";
+ };
+ RadioButton RB_SEARCHFORNULL
+ {
+ Pos = MAP_APPFONT( 12, 36 );
+ Size = MAP_APPFONT( 207, 10 );
+ Text [ en-US ] = "Field content is ~NULL";
+ };
+ RadioButton 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
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT( 105, 209 );
+ Size = MAP_APPFONT( 85, 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Match character width" ;
+ };
+ CheckBox CB_SOUNDSLIKECJK
+ {
+ Pos = MAP_APPFONT( 190, 209 );
+ Size = MAP_APPFONT( 84, 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sounds like (Japanese)";
+ };
+ PushButton 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
new file mode 100644
index 000000000000..e4db69f6f73d
--- /dev/null
+++ b/cui/source/dialogs/gallery.src
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gallery.src,v $
+ * $Revision: 1.79 $
+ *
+ * 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 57 , 6 ) ;
+ Size = MAP_APPFONT ( 121 , 69 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE;
+ AutoHScroll = TRUE ;
+ };
+ MultiListBox LBX_FOUND
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 172 , 156 ) ;
+ TabStop = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ PushButton BTN_SEARCH
+ {
+ Pos = MAP_APPFONT ( 184 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Find Files..." ;
+ };
+ PushButton BTN_TAKE
+ {
+ Pos = MAP_APPFONT ( 184 , 24 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Add" ;
+ };
+ PushButton BTN_TAKEALL
+ {
+ Pos = MAP_APPFONT ( 184 , 42 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~dd All" ;
+ };
+ CheckBox 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
+ {
+ Pos = MAP_APPFONT ( 220 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Maddin1" ;
+ };
+ PushButton 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
+{
+ 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
+ {
+ 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_GALLERYPROPS_GALTHEME
+{
+ Text [ en-US ] = "Gallery Theme" ;
+};
+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
new file mode 100644
index 000000000000..b04d025d4d13
--- /dev/null
+++ b/cui/source/dialogs/grfflt.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: grfflt.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..c01dc4060b6c
--- /dev/null
+++ b/cui/source/dialogs/grfflt.src
@@ -0,0 +1,457 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: grfflt.src,v $
+ * $Revision: 1.45 $
+ *
+ * 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 = 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
+ {
+ 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 = " 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
+ {
+ 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 = " 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
+ {
+ 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 = 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
+ {
+ 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
+ {
+ 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 = 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
+ {
+ 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 = 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
+ {
+ 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
+{
+ Pos = MAP_APPFONT ( 0, 0 ) ;
+ Size = MAP_APPFONT ( 0, 0 ) ;
+};
+
+ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS
+{
+ HelpID = 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
new file mode 100644
index 000000000000..afef3c1edb5f
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -0,0 +1,1913 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hangulhanjadlg.cxx,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "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 HangulHanjaConversion
+#define LINE_CNT static_cast< USHORT >(2)
+
+//.............................................................................
+namespace svx
+{
+//.............................................................................
+/*
+ using HangulHanjaConversion::eSimpleConversion;
+ using HangulHanjaConversion::eHangulBracketed;
+ using HangulHanjaConversion::eHanjaBracketed;
+ using HangulHanjaConversion::eRubyHanjaAbove;
+ using HangulHanjaConversion::eRubyHanjaBelow;
+ using HangulHanjaConversion::eRubyHangulAbove;
+ using HangulHanjaConversion::eRubyHangulBelow;
+*/
+ 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, USHORT _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, USHORT _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
+ USHORT 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
+ USHORT 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();
+ USHORT nItemId = rUDEvt.GetItemId();
+
+ String sText = *static_cast< String* >( GetItemData( nItemId ) );
+ pDev->DrawText( aRect, sText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER );
+ }
+
+ void SuggestionSet::ClearSet()
+ {
+ USHORT 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_STRINGPARAM("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();
+ 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)
+ {
+ USHORT nPos = m_aListBox.GetSelectEntryPos();
+ m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ }
+ else
+ {
+ USHORT 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 )
+ {
+ USHORT 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( USHORT nPos )
+ {
+ m_aListBox.SelectEntryPos( nPos );
+ m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+ }
+ USHORT SuggestionDisplay::GetEntryCount() const
+ {
+ return m_aListBox.GetEntryCount();
+ }
+ XubString SuggestionDisplay::GetEntry( USHORT 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();
+// m_pPlayground->EnableButton( SvxCommonLinguisticControl::eOptions, true );
+
+ if ( HangulHanjaConversion::eHangulToHanja == _ePrimaryDirection )
+ {
+// m_aHanjaOnly.Enable( sal_False );
+ m_pIgnoreNonPrimary = &m_aHangulOnly;
+ }
+ else
+ {
+// m_aHangulOnly.Enable( sal_False );
+ m_pIgnoreNonPrimary = &m_aHanjaOnly;
+ }
+// m_pIgnoreNonPrimary->Check();
+
+ // 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::SetOptionsHdl( const Link& _rHdl )
+ {
+ m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions, _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)
+ {
+ BOOL bBoxChecked = pBox->IsChecked();
+ if (bBoxChecked)
+ pOtherBox->Check( 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 );
+ }
+
+ //-------------------------------------------------------------------------
+ sal_Bool HangulHanjaConversionDialog::GetByCharacter( ) const
+ {
+ return m_aReplaceByChar.IsChecked();
+ }
+ //-------------------------------------------------------------------------
+ void HangulHanjaConversionDialog::SetConversionDirectionState(
+ sal_Bool _bTryBothDirections,
+ HHC::ConversionDirection _ePrimaryConversionDirection )
+ {
+ // default state: try both direction
+ m_aHangulOnly.Check( FALSE );
+ m_aHangulOnly.Enable( TRUE );
+ m_aHanjaOnly.Check( FALSE );
+ m_aHanjaOnly.Enable( TRUE );
+
+ if (!_bTryBothDirections)
+ {
+ CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja?
+ &m_aHangulOnly : &m_aHanjaOnly;
+ pBox->Check( sal_True );
+ OnConversionDirectionClicked( pBox );
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ sal_Bool HangulHanjaConversionDialog::GetUseBothDirections( ) const
+ {
+// DBG_ASSERT( m_pIgnoreNonPrimary, "HangulHanjaConversionDialog::GetUseBothDirections: where's the check box pointer?" );
+// return m_pIgnoreNonPrimary ? !m_pIgnoreNonPrimary->IsChecked( ) : sal_True;
+ 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:
+ DBG_ERROR( "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;
+
+ DBG_ERROR( "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 )
+ {
+ USHORT 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.SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE );
+ m_aDictsLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aDictsLB.SetHighlightRange();
+// m_aDictsLB.SetHelpId( xxx );
+ 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();
+ USHORT nMod = rKeyCode.GetModifier();
+ USHORT 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();
+ sal_uInt32 n = 0;
+ if( nCnt )
+ {
+ if( !m_pSuggestions )
+ m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS );
+
+ const OUString* pSugg = aEntries.getConstArray();
+ 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( USHORT( _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
+//.............................................................................
diff --git a/cui/source/dialogs/hangulhanjadlg.hrc b/cui/source/dialogs/hangulhanjadlg.hrc
new file mode 100644
index 000000000000..882d12a4c997
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.hrc
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hangulhanjadlg.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_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
new file mode 100644
index 000000000000..93d58755b14b
--- /dev/null
+++ b/cui/source/dialogs/hangulhanjadlg.src
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hangulhanjadlg.src,v $
+ * $Revision: 1.17 $
+ *
+ * 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT( 51, 81 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Group = TRUE;
+
+ Text [ en-US ] = "~Hangul/Hanja";
+ };
+
+ RadioButton 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
+ {
+ Pos = MAP_APPFONT( 177, 81 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Text [ en-US ] = "Hang~ul (Hanja)";
+ };
+
+ RadioButton 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT( 51, 134 );
+ Size = MAP_APPFONT( 60, 8 );
+
+ Text [ en-US ] = "Hangul ~only";
+ };
+
+ CheckBox 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..0a2dfa9955f5
--- /dev/null
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hldocntp.cxx,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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 )
+ {
+ USHORT 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.SetModeImage( Image( CUI_RES( IMG_CREATE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtCreate.EnableTextDisplay (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());
+// maCbbPath.SetHelpId( HID_HYPERDLG_DOC_PATH );
+
+ // set defaults
+ maRbtEditNow.Check();
+
+ maBtCreate.SetClickHdl ( LINK ( this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl ) );
+
+ FillDocumentList ();
+}
+
+SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
+{
+ for ( USHORT 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::ReadURLFile( const String& rFile, String& rTitle, String& rURL, sal_Int32& rIconId, BOOL* pShowAsFolder )
+{
+ // Open file
+ Config aCfg( rFile );
+ aCfg.SetGroup( INTERNETSHORTCUT_ID_TAG );
+
+ // read URL
+ rURL = aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_URL_TAG) ), RTL_TEXTENCODING_ASCII_US );
+ SvtPathOptions aPathOpt;
+ rURL = aPathOpt.SubstituteVariable( rURL );
+
+ // read target
+ if ( pShowAsFolder )
+ {
+ String aTemp( aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_TARGET_TAG ) ), RTL_TEXTENCODING_ASCII_US ) );
+ *pShowAsFolder = aTemp == String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_FOLDER_TAG ) );
+ }
+
+ // read image-ID
+ String aStrIconId( aCfg.ReadKey( ByteString( RTL_CONSTASCII_STRINGPARAM( INTERNETSHORTCUT_ICONID_TAG ) ), RTL_TEXTENCODING_ASCII_US ) );
+ rIconId = aStrIconId.ToInt32();
+
+ // read title
+ String aLangStr = aPathOpt.SubstituteVariable( DEFINE_CONST_UNICODE("$(vlang)") );
+ ByteString aLang( aLangStr, RTL_TEXTENCODING_UTF8 );
+ ByteString aGroup = INTERNETSHORTCUT_ID_TAG;
+ ( ( aGroup += '-' ) += aLang ) += ".W";
+ aCfg.SetGroup( aGroup );
+ rTitle = String( aCfg.ReadKey( INTERNETSHORTCUT_TITLE_TAG ), RTL_TEXTENCODING_UTF7 );
+}
+
+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.equalsAscii( "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
+|*
+\************************************************************************/
+
+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
+ USHORT 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" ) ) );
+ //SfxBoolItem aFrame( SID_OPEN_NEW_VIEW, TRUE );
+
+ 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)
+ {
+ //SfxViewFrame *pViewFrame = pFrame->GetCurrentViewFrame();
+ 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( 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;
+ BOOL bZeroPath = ( aStrPath.Len() == 0 );
+ 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 = 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
+ USHORT 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 );
+}
+
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
new file mode 100644
index 000000000000..1f4689c33fff
--- /dev/null
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hldoctp.cxx,v $
+ * $Revision: 1.28 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "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" //ADD CHINA001
+
+sal_Char __READONLY_DATA sHash[] = "#";
+sal_Char __READONLY_DATA sFileScheme[] = INET_FILE_SCHEME;
+sal_Char __READONLY_DATA sPortalFileScheme[] = "vnd.sun.star.wfs://";
+sal_Char __READONLY_DATA sNewsSRVScheme[] = "news://";
+ // TODO news:// is nonsense
+sal_Char __READONLY_DATA 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 ( FALSE )
+{
+ // Set HC bitmaps and disable display of bitmap names.
+ maBtBrowse.SetModeImage( Image( CUI_RES( IMG_BROWSE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtBrowse.EnableTextDisplay (FALSE);
+ maBtFileopen.SetModeImage( Image( CUI_RES( IMG_FILEOPEN_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtFileopen.EnableTextDisplay (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 ) );
+
+ 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.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ 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 ) ||
+ aOldURL.EqualsIgnoreCaseAscii( sPortalFileScheme, 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.EqualsIgnoreCaseAscii( sPortalFileScheme ) ||
+ maStrURL.SearchAscii( sHash ) == 0 )
+ {
+ mpMarkWnd->SetError( LERR_NOERROR );
+
+ EnterWait();
+
+ if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ||
+ maStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ 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 ) ||
+ maStrURL.EqualsIgnoreCaseAscii( sPortalFileScheme ) )
+ 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;
+}
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
new file mode 100644
index 000000000000..ef0a330f00ef
--- /dev/null
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hlinettp.cxx,v $
+ * $Revision: 1.30 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <unotools/pathoptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <svl/adrparse.hxx>
+
+#include "hlinettp.hxx"
+#include "hyperdlg.hrc"
+#include "hlmarkwn_def.hxx" //ADD CHINA001
+
+#define STD_DOC_SUBPATH "internal"
+#define STD_DOC_NAME "url_transfer.htm"
+
+sal_Char __READONLY_DATA sAnonymous[] = "anonymous";
+sal_Char __READONLY_DATA sHTTPScheme[] = INET_HTTP_SCHEME;
+sal_Char __READONLY_DATA sHTTPSScheme[] = INET_HTTPS_SCHEME;
+sal_Char __READONLY_DATA sFTPScheme[] = INET_FTP_SCHEME;
+sal_Char __READONLY_DATA sTelnetScheme[] = INET_TELNET_SCHEME;
+
+/*************************************************************************
+|*
+|* Contructor / 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) ),
+ maRbtLinktypTelnet ( this, CUI_RES (RB_LINKTYP_TELNET) ),
+ maFtTarget ( this, CUI_RES (FT_TARGET_HTML) ),
+ maCbbTarget ( this, INET_PROT_HTTP ),
+ maFtLogin ( this, CUI_RES (FT_LOGIN) ),
+ maEdLogin ( this, CUI_RES (ED_LOGIN) ),
+ maFtPassword ( this, CUI_RES (FT_PASSWD) ),
+ maEdPassword ( this, CUI_RES (ED_PASSWD) ),
+ maCbAnonymous ( this, CUI_RES (CBX_ANONYMOUS) ),
+ maBtBrowse ( this, CUI_RES (BTN_BROWSE) ),
+ maBtTarget ( this, CUI_RES (BTN_TARGET) ),
+ mbMarkWndOpen ( FALSE )
+{
+ // Set HC bitmaps and display display of bitmap names.
+ maBtBrowse.SetModeImage( Image( CUI_RES( IMG_BROWSE_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtBrowse.EnableTextDisplay (FALSE);
+ maBtTarget.SetModeImage( Image( CUI_RES( IMG_TARGET_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtTarget.EnableTextDisplay (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 );
+
+ // Find Path to Std-Doc
+ String aStrBasePaths( SvtPathOptions().GetTemplatePath() );
+ for( xub_StrLen n = 0; n < aStrBasePaths.GetTokenCount(); n++ )
+ {
+ INetURLObject aURL( aStrBasePaths.GetToken( n ) );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_SUBPATH ) ) );
+ aURL.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( STD_DOC_NAME ) ) );
+ if ( FileExists( aURL ) )
+ {
+ maStrStdDocURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ break;
+ }
+ }
+ SetExchangeSupport ();
+
+ ///////////////////////////////////////
+ // set defaults
+ maRbtLinktypInternet.Check ();
+ maFtLogin.Show( FALSE );
+ maFtPassword.Show( FALSE );
+ maEdLogin.Show( FALSE );
+ maEdPassword.Show( FALSE );
+ maCbAnonymous.Show( FALSE );
+ maBtTarget.Enable( FALSE );
+ maBtBrowse.Enable( maStrStdDocURL != aEmptyStr );
+
+ ///////////////////////////////////////
+ // overload handlers
+ Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
+ maRbtLinktypInternet.SetClickHdl( aLink );
+ maRbtLinktypFTP.SetClickHdl ( aLink );
+ maRbtLinktypTelnet.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 ) );
+}
+
+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(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();
+}
+
+/*************************************************************************
+|*
+|* Contens of editfield "Taregt" 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 afeter timeout
+|*
+|************************************************************************/
+
+IMPL_LINK ( SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, EMPTYARG )
+{
+ RefreshMarkWindow();
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Contens 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
+
+ BOOL bFTP = aScheme.SearchAscii( sFTPScheme ) == 0;
+ BOOL bTelnet = FALSE;
+ if( !bFTP )
+ bTelnet = aScheme.SearchAscii( sTelnetScheme ) == 0;
+ BOOL bInternet = !(bFTP || bTelnet);
+
+ //update protocol button selection:
+ maRbtLinktypFTP.Check(bFTP);
+ maRbtLinktypTelnet.Check(bTelnet);
+ 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, ftp and telnet
+ 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 );
+ }
+ else if( maRbtLinktypTelnet.IsChecked() )
+ {
+ return String::CreateFromAscii( INET_TELNET_SCHEME );
+ }
+ return String::CreateFromAscii( INET_HTTP_SCHEME );
+}
+
+INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
+{
+ if( maRbtLinktypFTP.IsChecked() )
+ {
+ return INET_PROT_FTP;
+ }
+ else if( maRbtLinktypTelnet.IsChecked() )
+ {
+ return INET_PROT_TELNET;
+ }
+ return INET_PROT_HTTP;
+}
+
+/*************************************************************************
+|*
+|* Click on Radiobutton : Internet, FTP or Telnet
+|*
+|************************************************************************/
+
+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, maStrStdDocURL );
+ SfxStringItem aRefererItem( SID_REFERER, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) );
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, TRUE );
+ SfxBoolItem aSilent( SID_SILENT, TRUE );
+ SfxBoolItem aReadOnly( SID_DOC_READONLY, TRUE );
+
+ SfxBoolItem aBrowse( SID_BROWSE, 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( 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( FALSE );
+ else
+ maBtTarget.Enable( TRUE );
+}
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
new file mode 100644
index 000000000000..389fb20bf48b
--- /dev/null
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hlmailtp.cxx,v $
+ * $Revision: 1.23 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <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) )
+{
+ // Set HC bitmaps and disable display of bitmap names.
+ maBtAdrBook.SetModeImage( Image( CUI_RES( IMG_ADRESSBOOK_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ maBtAdrBook.EnableTextDisplay (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();
+}
+
+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;
+
+ 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 );
+ }
+
+
+/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame()->GetFrameInterface(), uno::UNO_QUERY );
+ if ( xProv.is() )
+ {
+!!! (pb) we need a new config item here
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+ if( !aProp.GetIniManager() )
+ return ( 0L );
+
+ String aAddressBook = aProp.GetIniManager()->Get( SFX_KEY_ADDRESSBOOK );
+ INetURLObject aObj;
+ aObj.SetSmartProtocol( INET_PROT_FILE );
+ aObj.SetURL( aAddressBook.GetToken( 0, sal_Unicode( ';' ) ) );
+
+ String aMark( RTL_CONSTASCII_USTRINGPARAM( "db:Table;" ) );
+ aMark += aAddressBook.GetToken( 1, sal_Unicode( ';' ) );
+ aObj.SetMark( aMark );
+
+ util::URL aURL;
+ aURL.Complete = ::rtl::OUString( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ uno::Reference< util::XURLTransformer > xTrans( xFactory->createInstance
+ ( OUString::createFromAscii( "com.sun.star.util.URLTransformer" ) ),
+ uno::UNO_QUERY);
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > aDisp = xProv->queryDispatch( aURL,
+ OUString::createFromAscii( "_beamer" ),
+ frame::FrameSearchFlag::GLOBAL |
+ frame::FrameSearchFlag::CREATE );
+ if ( aDisp.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ beans::PropertyValue* pArg = aArgs.getArray();
+ pArg[0].Name = DEFINE_CONST_UNICODE("Referer");
+ pArg[0].Value = uno::makeAny( OUString( DEFINE_CONST_UNICODE("private:user") ) );
+ aDisp->dispatch( aURL, aArgs );
+ }
+ }
+ }
+*/
+
+ return( 0L );
+}
+
+
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
new file mode 100644
index 000000000000..f5005dbedfd7
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hlmarkwn.cxx,v $
+ * $Revision: 1.19.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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/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;
+ BOOL bIsTarget;
+
+ TargetData ( OUString aUStrLName, 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 ( FALSE ),
+ mbFirst ( 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.SetWindowBits( WinBits( WB_TABSTOP | WB_BORDER | WB_HASLINES |
+ WB_HASBUTTONS | //WB_HASLINESATROOT |
+ WB_HSCROLL | WB_HASBUTTONSATROOT ) );
+}
+
+SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd()
+{
+ ClearTree();
+}
+
+/*************************************************************************
+|*
+|* Set an errorstatus
+|*
+|************************************************************************/
+
+USHORT SvxHlinkDlgMarkWnd::SetError( USHORT nError)
+{
+ USHORT nOldError = mnError;
+ mnError = nError;
+
+ if( mnError != LERR_NOERROR )
+ ClearTree();
+
+ maLbTree.Invalidate();
+
+ return nOldError;
+}
+
+/*************************************************************************
+|*
+|* Move window
+|*
+|************************************************************************/
+
+BOOL SvxHlinkDlgMarkWnd::MoveTo ( Point aNewPos )
+{
+ if ( !mbUserMoved )
+ {
+ BOOL bOldStatus = mbUserMoved;
+ SetPosPixel ( aNewPos );
+ mbUserMoved = bOldStatus;
+ }
+
+ return mbUserMoved;
+}
+
+void SvxHlinkDlgMarkWnd::Move ()
+{
+ Window::Move();
+
+ if ( IsReallyVisible() )
+ mbUserMoved = TRUE;
+}
+
+BOOL SvxHlinkDlgMarkWnd::ConnectToDialog( BOOL bDoit )
+{
+ 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
+|*
+|************************************************************************/
+
+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::createFromAscii( "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::createFromAscii( "Hidden" );
+ aArg.getArray()[0].Value <<= (sal_Bool) TRUE;
+ xComp = xLoader->loadComponentFromURL( aURL, OUString::createFromAscii( "_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);
+}
+/*
+void SvxHlinkDlgMarkWnd::Error(int nNr)
+{
+ switch(nNr)
+ {
+ case 0:
+ {
+ Rectangle aDrawRect( Point( 0, 0 ), maLbTree.GetSizePixel() );
+ //maLbTree.SetTextColor( Color(COL_BLACK) );
+ //maLbTree.DrawText( aDrawRect, "Keine Ziele im Dokument vorhanden.", TEXT_DRAW_LEFT);// | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ maLbTree.DrawText( Point(0,0), "Keine Ziele im Dokument vorhanden.");
+ maLbTree.DrawLine(aDrawRect.TopLeft(), aDrawRect.BottomRight() );
+ }
+ break;
+ case 1:
+ Rectangle aDrawRect( Point( 0, 0 ), maLbTree.GetSizePixel() );
+ maLbTree.DrawText( aDrawRect, "Das Dokument konnte nicht ge�ffnet werden.", TEXT_DRAW_LEFT | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
+ break;
+ }
+}
+*/
+/*************************************************************************
+|*
+|* Fill Tree-Control
+|*
+|************************************************************************/
+
+int SvxHlinkDlgMarkWnd::FillTree( uno::Reference< container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry )
+{
+ int nEntries=0;
+ const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
+ const 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( ULONG i = 0; i < nLinks; i++ )
+ {
+ uno::Any aAny;
+ OUString aLink( *pNames++ );
+
+ BOOL bError = 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 = 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 );
+ 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,
+ FALSE, LIST_APPEND,
+ (void*)pData );
+ maLbTree.SetExpandedEntryBmp( pEntry, aBmp, BMP_COLOR_HIGHCONTRAST );
+ maLbTree.SetCollapsedEntryBmp( pEntry, aBmp, BMP_COLOR_HIGHCONTRAST );
+ nEntries++;
+ }
+ else
+ {
+ // insert Displayname into treelist without bitmaps
+ pEntry = maLbTree.InsertEntry ( aStrDisplayname,
+ pParentEntry,
+ FALSE, LIST_APPEND,
+ (void*)pData );
+ nEntries++;
+ }
+ }
+ catch(const com::sun::star::uno::Exception&)
+ {
+ // insert Displayname into treelist without bitmaps
+ pEntry = maLbTree.InsertEntry ( aStrDisplayname,
+ pParentEntry,
+ 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 )
+{
+ BOOL bFound=FALSE;
+ SvLBoxEntry* pEntry = maLbTree.First();
+
+ while ( pEntry && !bFound )
+ {
+ TargetData* pUserData = ( TargetData * ) pEntry->GetUserData ();
+ if ( aStrName == String( pUserData->aUStrLinkname ) )
+ bFound = 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 );
+}
+
+
diff --git a/cui/source/dialogs/hlmarkwn.hrc b/cui/source/dialogs/hlmarkwn.hrc
new file mode 100644
index 000000000000..d79da8b38dd6
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hlmarkwn.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+
+//#define HYPERLINK_BMP_EXPAND 301
+//#define HYPERLINK_BMP_COLLAPSE 302
+
diff --git a/cui/source/dialogs/hlmarkwn.src b/cui/source/dialogs/hlmarkwn.src
new file mode 100644
index 000000000000..48bf6d40fcb6
--- /dev/null
+++ b/cui/source/dialogs/hlmarkwn.src
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hlmarkwn.src,v $
+ * $Revision: 1.27 $
+ *
+ * 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." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
new file mode 100644
index 000000000000..8ee78806ab0e
--- /dev/null
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hltpbase.cxx,v $
+ * $Revision: 1.37.216.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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" //CHINA001
+#include "hltpbase.hxx"
+#include "macroass.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <cuires.hrc> //CHINA001
+
+using namespace ::ucbhelper;
+
+//########################################################################
+//# #
+//# ComboBox-Control, wich 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);
+ USHORT nCount = (USHORT)pList->Count();
+ if( nCount )
+ {
+ USHORT i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ InsertEntry(*pList->GetObject(i));
+ }
+ for ( i = nCount; i; i-- )
+ {
+ delete pList->GetObject( i - 1 );
+ }
+ }
+ delete pList;
+ }
+}
+
+SvxFramesComboBox::~SvxFramesComboBox ()
+{
+}
+//########################################################################
+//# #
+//# ComboBox-Control for URL's with History and Autocompletion #
+//# #
+//########################################################################
+
+/*************************************************************************
+|*
+|* Contructor / Destructor
+|*
+|************************************************************************/
+
+SvxHyperURLBox::SvxHyperURLBox( Window* pParent, INetProtocol eSmart, 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;
+}
+
+/*
+Diese Methode parsed eine EMailadresse aus einem D&D-DataObjekt aus der Adre�datenbank heraus
+
+#ifndef _OFF_OFADBMGR_HXX
+#include <offmgr/ofadbmgr.hxx>
+#endif
+#ifndef _SFX_APP_HXX
+#include <offmgr/app.hxx>
+#endif
+#ifndef _SDB_SDBCURS_HXX
+#include <sdb/sdbcurs.hxx>
+#endif
+
+#define DB_DD_DELIM ((char)11)
+
+String SvxHyperURLBox::GetAllEmailNamesFromDragItem( USHORT nItem )
+{
+#if !defined( ICC ) && !defined( SOLARIS )
+ String aAddress;
+
+ if ( DragServer::HasFormat( nItem, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) )
+ {
+ ULONG nLen = DragServer::GetDataLen( nItem, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) - 1;
+ USHORT i = 0;
+ String aTxt;
+ char *pTxt = aTxt.AllocStrBuf( (USHORT)nLen );
+ DragServer::PasteData( nItem, pTxt, nLen, SOT_FORMATSTR_ID_SBA_DATAEXCHANGE );
+ String aDBName = aTxt.GetToken( i++, DB_DD_DELIM );
+ String aTableName = aTxt.GetToken( i++, DB_DD_DELIM );
+ i++; // Format"anderung
+ String aStatement = aTxt.GetToken( i++, DB_DD_DELIM );
+ if ( !aStatement )
+ {
+ aDBName += DB_DELIM;
+ aDBName += aTableName;
+ }
+ else
+ {
+ // use here another delimiter, because the OfaDBMgr uses two
+ // delimiters ( (char)11 and ; )
+ aDBName += ';';
+ aDBName += aStatement;
+ }
+ SbaSelectionListRef pSelectionList;
+ pSelectionList.Clear();
+ pSelectionList = new SbaSelectionList;
+ USHORT nTokCnt = aTxt.GetTokenCount( DB_DD_DELIM );
+
+ for ( ; i < nTokCnt; ++i )
+ pSelectionList->Insert(
+ (void*)(USHORT)aTxt.GetToken( i, DB_DD_DELIM ), LIST_APPEND );
+
+ OfaDBMgr* pDBMgr = SFX_APP()->GetOfaDBMgr();
+ BOOL bBasic = DBMGR_STD;
+
+ if ( !pDBMgr->OpenDB( bBasic, aDBName ) )
+ return aAddress;
+
+ OfaDBParam& rParam = pDBMgr->GetDBData( bBasic );
+ pDBMgr->ChangeStatement( bBasic, aStatement );
+ rParam.pSelectionList->Clear();
+
+ if ( pSelectionList.Is() &&
+ (long)pSelectionList->GetObject(0) != -1L )
+ *rParam.pSelectionList = *pSelectionList;
+
+ if ( !pDBMgr->ToFirstSelectedRecord( bBasic ) )
+ {
+ pDBMgr->CloseAll();
+ return aAddress;
+ }
+
+ if ( pDBMgr->IsSuccessful( bBasic ) )
+ {
+ // Spaltenk"opfe
+ SbaDBDataDefRef aDBDef = pDBMgr->OpenColumnNames( bBasic );
+
+ if ( aDBDef.Is() )
+ {
+ SbaColumn* pCol = aDBDef->GetColumn("EMAIL");
+ ULONG nPos = 0;
+
+ if ( pCol )
+ nPos = aDBDef->GetOriginalColumns().GetPos( pCol ) + 1;
+ for ( i = 0 ; nPos && i < pSelectionList->Count(); ++i )
+ {
+ ULONG nIndex = (ULONG)pSelectionList->GetObject(i);
+
+ // N"achsten zu lesenden Datensatz ansteuern
+
+ BOOL bEnd = rParam.GetCursor()->IsOffRange();
+
+ if ( !bEnd )
+ {
+ const ODbRowRef aRow =
+ pDBMgr->GetSelectedRecord( bBasic, i );
+
+ if ( aRow.Is() )
+ {
+ aAddress += pDBMgr->
+ ImportDBField( (USHORT)nPos, &aDBDef, aRow.getBodyPtr() );
+ aAddress += ',';
+ }
+ else
+ {
+ aAddress.Erase();
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ }
+ pDBMgr->CloseAll();
+ }
+ aAddress.EraseTrailingChars( ',' );
+ return aAddress;
+#else
+ return String();
+#endif
+}
+*/
+
+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 ( 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->SetModeImage( Image( ResId( IMG_SCRIPT_HC, *m_pResMgr ) ), BMP_COLOR_HIGHCONTRAST );
+ mpBtScript->EnableTextDisplay (FALSE);
+ }
+
+ mbStdControlsInit = TRUE;
+}
+
+/*************************************************************************
+|*
+|* Move Extra-Window
+|*
+\************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::MoveToExtraWnd( Point aNewPos, BOOL bDisConnectDlg )
+{
+ BOOL bReturn = mpMarkWnd->MoveTo ( aNewPos );
+
+ if( bDisConnectDlg )
+ mpMarkWnd->ConnectToDialog( 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( 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
+ USHORT 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
+|*
+\************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::AskApply ()
+{
+ // default-implementation
+ return 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( BOOL /*bEnable*/ )
+{
+ // default-implemtation : do nothing
+}
+
+/*************************************************************************
+|*
+|* Set initial focus
+|*
+|************************************************************************/
+
+void SvxHyperlinkTabPageBase::SetInitFocus()
+{
+ GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* Ask dialog whether the curretn doc is a HTML-doc
+|*
+|************************************************************************/
+
+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 );
+
+ // --> PB 2006-01-13 #123474#
+ /* 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
+ */
+ BOOL bIsInputEnabled = GetParent()->IsInputEnabled();
+ if ( bIsInputEnabled )
+ GetParent()->EnableInput( 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);
+
+ // --> PB 2006-01-13 #123474#
+ if ( bIsInputEnabled )
+ GetParent()->EnableInput( 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, FALSE, &pItem ))
+ {
+ pHyperlinkItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() );
+ }
+ }
+ delete pItemSet;
+ }
+
+ return( 0L );
+}
+
+/*************************************************************************
+|*
+|* Get Macro-Infos
+|*
+|************************************************************************/
+
+USHORT 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 ?
+|*
+|************************************************************************/
+
+BOOL SvxHyperlinkTabPageBase::FileExists( const INetURLObject& rURL )
+{
+ BOOL bRet = 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::createFromAscii( "Title" ) ) >>= aTitle;
+ bRet = ( aTitle.getLength() > 0 );
+ }
+ catch( ... )
+ {
+ DBG_ERROR( "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 if ( aStrURL.EqualsIgnoreCaseAscii( INET_TELNET_SCHEME, 0, 9 ) )
+ {
+ aStrScheme = String::CreateFromAscii( INET_TELNET_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) ( 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
+|*
+|************************************************************************/
+
+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);
+
+ USHORT nEvents = GetMacroEvents();
+ SvxMacroTableDtor* pTable = GetMacroTable();
+
+ SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK, aStrName, aStrURL, aStrFrame,
+ aStrIntName, eMode, nEvents, pTable );
+ rOut.Put (aItem);
+
+ return 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);
+
+ USHORT 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 );
+}
+
+BOOL SvxHyperlinkTabPageBase::ShouldOpenMarkWnd()
+{
+ return FALSE;
+}
+
+void SvxHyperlinkTabPageBase::SetMarkWndShouldOpen(BOOL)
+{
+}
diff --git a/cui/source/dialogs/hyperdlg.hrc b/cui/source/dialogs/hyperdlg.hrc
new file mode 100644
index 000000000000..69dae5d1ce57
--- /dev/null
+++ b/cui/source/dialogs/hyperdlg.hrc
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hyperdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* Tabpage : Hyperlink - Internet */
+
+#define GRP_LINKTYPE 1
+#define RB_LINKTYP_INTERNET 2
+#define RB_LINKTYP_FTP 3
+#define RB_LINKTYP_TELNET 4
+#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
+#define IMG_BROWSE_HC 14
+#define IMG_TARGET_HC 15
+
+/* 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
+#define IMG_ADRESSBOOK_HC 9
+
+/* 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
+#define IMG_FILEOPEN_HC 10
+
+/* 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
+#define IMG_CREATE_HC 9
+
+/* 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 IMG_SCRIPT_HC 40
+
+#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
new file mode 100644
index 000000000000..4811fa4662e6
--- /dev/null
+++ b/cui/source/dialogs/hyperdlg.src
@@ -0,0 +1,971 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: hyperdlg.src,v $
+ * $Revision: 1.78 $
+ *
+ * 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
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 57, 10 );
+ Text [ en-US ] = "~Web";
+ };
+ RadioButton RB_LINKTYP_FTP
+ {
+ Pos = MAP_APPFONT( 114 + COL_DIFF, 13 );
+ Size = MAP_APPFONT( 56 - COL_DIFF, 10 );
+ Text [ en-US ] = "~FTP";
+ };
+ RadioButton RB_LINKTYP_TELNET
+ {
+ Pos = MAP_APPFONT( 173, 13 );
+ Size = MAP_APPFONT( 56, 10 );
+ Text [ en-US ] = "~Telnet";
+ };
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 59 ) ;
+ Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ;
+ PassWord = TRUE ;
+ };
+ CheckBox 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
+ {
+ 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 ] = "WWW Browser" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "browse.bmp" ; };
+ MASKCOLOR
+ };
+ };
+ Image IMG_BROWSE_HC
+ {
+ ImageBitmap = Bitmap { File = "browse_hc.bmp" ; };
+ MASKCOLOR
+ };
+ ImageButton BTN_TARGET
+ {
+ Pos = MAP_APPFONT ( 235, 40+2 ) ;
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Target in Document";
+
+ QuickHelpText [ en-US ] = "Target in Document" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "target.bmp" ; };
+ MASKCOLOR
+ };
+ };
+ Image IMG_TARGET_HC
+ {
+ ImageBitmap = Bitmap { File = "target_hc.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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton 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";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| 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
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 56 - COL_DIFF, 10 );
+ Text [ en-US ] = "~E-mail";
+ };
+ RadioButton 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 42 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ;
+ };
+ ImageButton 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..." ;
+ };
+ Image IMG_ADRESSBOOK_HC
+ {
+ ImageBitmap = Bitmap { File = "adrbook_hc.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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton 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";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| 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
+ {
+ 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";
+ };
+ Image IMG_FILEOPEN_HC
+ {
+ ImageBitmap = Bitmap { File = "fileopen_hc.bmp" ; };
+ MASKCOLOR
+ };
+
+ 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
+ {
+ 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
+ {
+ 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";
+ };
+ Image IMG_BROWSE_HC
+ {
+ ImageBitmap = Bitmap { File = "target_hc.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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton 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";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| 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
+ {
+ Pos = MAP_APPFONT( COL_2, 13 );
+ Size = MAP_APPFONT( 85 - COL_DIFF, 10 );
+ Text [ en-US ] = "Edit ~now";
+ };
+ RadioButton 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 42 ) ;
+ Size = MAP_APPFONT ( 176 - COL_DIFF , 40 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ ImageButton 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";
+ };
+ Image IMG_CREATE_HC
+ {
+ ImageBitmap = Bitmap { File = "newdoc_hc.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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , 139 ) ;
+ Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ;
+ };
+ ImageButton 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";
+ };
+ Image IMG_SCRIPT_HC
+ {
+ ImageBitmap = Bitmap { File = "script_hc.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+/*************************************************************************
+|
+| Tabpage-Dialog : Hyperlinks
+|
+*************************************************************************/
+ModalDialog RID_SVXDLG_NEWHYPERLINK
+{
+ HelpID = 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, FTP server or Telnet 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
+};
+
+Image RID_SVXBMP_HLINETTP_H
+{
+ ImageBitmap = Bitmap { File = "hlinettp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLMAILTP_H
+{
+ ImageBitmap = Bitmap { File = "hlmailtp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCTP_H
+{
+ ImageBitmap = Bitmap { File = "hldoctp_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXBMP_HLDOCNTP_H
+{
+ ImageBitmap = Bitmap { File = "hldocntp_h.bmp" ; };
+ MASKCOLOR
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
new file mode 100644
index 000000000000..95f49308acb4
--- /dev/null
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -0,0 +1,1438 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iconcdlg.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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>
+
+#ifdef WNT
+int __cdecl IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#else
+#if defined(OS2) && defined(ICC)
+int _Optlink IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#else
+int IconcDlgCmpUS_Impl( const void* p1, const void* p2 )
+#endif
+#endif
+{
+ return *(USHORT*)p1 - *(USHORT*)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 ( FALSE ),
+ pDialog ( NULL ),
+ bStandard ( 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()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IconChoicePage::IsReadOnly() const
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool IconChoicePage::QueryClose()
+{
+ return sal_True;
+}
+
+/**********************************************************************
+|
+| handling itemsets
+|
+\**********************************************************************/
+
+const SfxPoolItem* IconChoicePage::GetItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ const SfxItemPool* pPool = rSet.GetPool();
+ USHORT nWh = pPool->GetWhich( nSlot );
+ const SfxPoolItem* pItem = 0;
+ rSet.GetItemState( nWh, TRUE, &pItem );
+
+ if ( !pItem && nWh != nSlot )
+ pItem = &pPool->GetDefaultItem( nWh );
+
+ return pItem;
+}
+
+// -----------------------------------------------------------------------
+
+const SfxPoolItem* IconChoicePage::GetOldItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ const SfxItemSet& rOldSet = GetItemSet();
+ USHORT nWh = GetWhich( nSlot );
+ const SfxPoolItem* pItem = 0;
+
+ if ( bStandard && rOldSet.GetParent() )
+ pItem = GetItem( *rOldSet.GetParent(), nSlot );
+ else if ( rSet.GetParent() && SFX_ITEM_DONTCARE == rSet.GetItemState( nWh ) )
+ pItem = GetItem( *rSet.GetParent(), nSlot );
+ else
+ pItem = GetItem( rOldSet, nSlot );
+
+ return pItem;
+}
+
+// -----------------------------------------------------------------------
+
+const SfxPoolItem* IconChoicePage::GetExchangeItem( const SfxItemSet& rSet,
+ USHORT nSlot )
+{
+ if ( pDialog && !pDialog->IsInOK() && pDialog->GetExampleSet() )
+ return GetItem( *pDialog->GetExampleSet(), nSlot );
+ else
+ return GetOldItem( rSet, nSlot );
+}
+
+/**********************************************************************
+|
+| window-methods
+|
+\**********************************************************************/
+
+void IconChoicePage::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( 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 )//, BOOL bEditFmt, const String *pUserButtonText = 0 )
+: ModalDialog ( pParent, rResId ),
+ meChoicePos ( ePos ),
+ maIconCtrl ( this, WB_3DLOOK | WB_ICON | WB_BORDER |
+ WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
+ /* WB_NOSELECTION | */ 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 ( FALSE ),
+ bModal ( FALSE ),
+ bInOK ( FALSE ),
+ bModified ( FALSE ),
+ bItemsReset ( FALSE )
+{
+ // IconChoiceCtrl-Settings
+ //maIconCtrl.SetBackground ( Wallpaper( Color (146, 146, 186) ) );
+
+ maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | /* WB_NOSELECTION | */ WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN );
+ SetCtrlPos ( meChoicePos );
+ maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) );
+ maIconCtrl.Show();
+ maIconCtrl.SetChoiceWithCursor ( 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 ( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+/*
+IconChoiceDialog ::IconChoiceDialog ( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId,
+ const SfxItemSet * = 0, BOOL bEditFmt = FALSE,
+ const String *pUserButtonText = 0 )
+: meChoicePos ( PosLeft ), // Default erst ma Links
+ maIconCtrl ( this, Die_Winbits ),
+ aOKBtn ( this ),
+ pUserBtn ( pUserButtonText? new PushButton(this): 0 ),
+ aCancelBtn ( this ),
+ aHelpBtn ( this ),
+ aResetBtn ( this ),
+ aBaseFmtBtn ( this ),
+ mnCurrentPageId ( 0 )
+{
+ FreeResource();
+}
+*/
+
+// -----------------------------------------------------------------------
+
+IconChoiceDialog ::~IconChoiceDialog ()
+{
+ ULONG i;
+
+ // save configuration at INI-Manager
+ // and remove pages
+ SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
+ aTabDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ aTabDlgOpt.SetPageID( mnCurrentPageId );
+
+ const ULONG nCount = maPageList.Count();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject(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 Pagelist
+/* for ( i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ if ( pData->bOnDemand )
+ delete ( SfxItemSet * )&( pData->pPage->GetItemSet() );
+
+ delete pData->pPage;
+ delete pData;
+ }*/
+
+ // remove Userdata from Icons
+ for ( i=0; i<maIconCtrl.GetEntryCount(); i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+ delete pUserData;
+ }
+
+ //
+ if ( pRanges )
+ delete pRanges;
+ if ( pOutSet )
+ delete pOutSet;
+}
+
+/**********************************************************************
+|
+| add new page
+|
+\**********************************************************************/
+
+SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( USHORT nId, const String& rIconText,
+ const Image& rChoiceIcon,
+ CreatePage pCreateFunc /* != 0 */,
+ GetPageRanges pRangesFunc /* darf 0 sein */,
+ BOOL bItemsOnDemand, ULONG /*nPos*/ )
+{
+ IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc,
+ pRangesFunc,
+ bItemsOnDemand );
+ maPageList.Insert ( pData, LIST_APPEND );
+
+ pData->fnGetRanges = pRangesFunc;
+ pData->bOnDemand = bItemsOnDemand;
+
+ USHORT *pId = new USHORT ( nId );
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon );
+ pEntry->SetUserData ( (void*) pId );
+ return pEntry;
+}
+
+SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( USHORT nId, const String& rIconText,
+ const Image& rChoiceIcon,
+ const Image& rChoiceIconHC,
+ CreatePage pCreateFunc /* != 0 */,
+ GetPageRanges pRangesFunc /* darf 0 sein */,
+ BOOL bItemsOnDemand, ULONG /*nPos*/ )
+{
+ IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc,
+ pRangesFunc,
+ bItemsOnDemand );
+ maPageList.Insert ( pData, LIST_APPEND );
+
+ pData->fnGetRanges = pRangesFunc;
+ pData->bOnDemand = bItemsOnDemand;
+
+ USHORT *pId = new USHORT ( nId );
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon, rChoiceIconHC );
+ pEntry->SetUserData ( (void*) pId );
+ return pEntry;
+}
+
+/**********************************************************************
+|
+| remove page
+|
+\**********************************************************************/
+
+void IconChoiceDialog::RemoveTabPage( USHORT nId )
+{
+ IconChoicePageData* pData = GetPageData ( nId );
+
+ // remove page from list
+ if ( pData )
+ {
+ maPageList.Remove ( pData );
+
+ // 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 ( ULONG i=0; i<maIconCtrl.GetEntryCount() && !bFound; i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+
+ if ( *pUserData == nId )
+ {
+ delete pUserData;
+ maIconCtrl.RemoveEntry ( pEntry );
+ bFound = TRUE;
+ }
+ }
+
+ // was it the current page ?
+ if ( nId == mnCurrentPageId )
+ {
+ mnCurrentPageId = maPageList.First()->nId;
+ }
+
+ Invalidate ();
+}
+
+/**********************************************************************
+|
+| Paint-method
+|
+\**********************************************************************/
+
+void IconChoiceDialog::Paint( const Rectangle& rRect )
+{
+ Dialog::Paint ( rRect );
+
+ for ( ULONG i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( 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;
+}
+
+void IconChoiceDialog::SetCtrlColor ( const Color& rColor )
+{
+ Wallpaper aWallpaper ( rColor );
+ maIconCtrl.SetBackground( aWallpaper );
+ maIconCtrl.SetFontColorToBackground ();
+}
+
+/**********************************************************************
+|
+| 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( USHORT 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 ( 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 ( ULONG i=0; i<maPageList.Count(); i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( 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
+ //
+ 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 ( USHORT 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 )
+{
+ ULONG nPos;
+
+ SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos );
+ if ( !pEntry )
+ pEntry = maIconCtrl.GetCursor( );
+
+ USHORT *pId = (USHORT*)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 = 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.Count(), "keine Pages angemeldet" );
+ IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ DBG_ASSERT( pData, "Id nicht bekannt" );
+ 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 = FALSE;
+
+ if ( pExampleSet )
+ pData->pPage->ActivatePage( *pExampleSet );
+ }
+
+ SetHelpId( pData->pPage->GetHelpId() );
+
+ BOOL bReadOnly = pData->pPage->IsReadOnly();
+ if ( bReadOnly || bHideResetBtn )
+ aResetBtn.Hide();
+ else
+ aResetBtn.Show();
+
+}
+
+// -----------------------------------------------------------------------
+
+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
+ const ULONG nCount = maPageList.Count();
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pObj = (IconChoicePageData*)maPageList.GetObject(i);
+
+ if ( pObj->pPage != pPage ) // eigene Page nicht mehr refreshen
+ pObj->bRefresh = TRUE;
+ else
+ pObj->bRefresh = FALSE;
+ }
+ }
+ }
+
+ if ( nRet & IconChoicePage::LEAVE_PAGE )
+ return TRUE;
+ else
+ return 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 USHORT* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool )
+{
+ if ( pSet )
+ {
+ DBG_ERRORFILE( "Set bereits vorhanden!" );
+ return pSet->GetRanges();
+ }
+
+ if ( pRanges )
+ return pRanges;
+ SvUShorts aUS( 16, 16 );
+ ULONG nCount = maPageList.Count();
+
+ USHORT i;
+ for ( i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject (i);
+
+ if ( pData->fnGetRanges )
+ {
+ const USHORT* pTmpRanges = (pData->fnGetRanges)();
+ const USHORT* pIter = pTmpRanges;
+
+ USHORT 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 ( 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(USHORT), IconcDlgCmpUS_Impl );
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#endif
+ }
+
+ pRanges = new USHORT[aUS.Count() + 1];
+ memcpy(pRanges, aUS.GetData(), sizeof(USHORT) * aUS.Count());
+ pRanges[aUS.Count()] = 0;
+
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet )
+{
+ FASTBOOL bSet = ( pSet != NULL );
+
+ pSet = pInSet;
+
+ if ( !bSet && !pExampleSet && !pOutSet )
+ {
+ pExampleSet = new SfxItemSet( *pSet );
+ pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// Liefert die Pages, die ihre Sets onDemand liefern, das OutputItemSet.
+const SfxItemSet* IconChoiceDialog::GetOutputItemSet ( USHORT nId )
+{
+ IconChoicePageData * pData = GetPageData ( nId );
+ DBG_ASSERT( pData, "TabPage nicht gefunden" );
+
+ if ( pData )
+ {
+ if ( !pData->pPage )
+ return NULL;
+
+ if ( pData->bOnDemand )
+ return &pData->pPage->GetItemSet();
+
+ return pOutSet;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+int IconChoiceDialog::FillOutputItemSet()
+{
+ int nRet = IconChoicePage::LEAVE_PAGE;
+ if ( OK_Impl() )
+ Ok();
+ else
+ nRet = IconChoicePage::KEEP_PAGE;
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::PageCreated( USHORT /*nId*/, IconChoicePage& /*rPage*/ )
+{
+ // not interested in
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemSet* IconChoiceDialog::CreateInputItemSet( USHORT )
+{
+ DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" );
+
+ return 0;
+}
+
+/**********************************************************************
+|
+| start dialog
+|
+\**********************************************************************/
+
+short IconChoiceDialog::Execute()
+{
+ if ( !maPageList.Count() )
+ return RET_CANCEL;
+
+ Start_Impl();
+
+ return Dialog::Execute();
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::Start( BOOL bShow )
+{
+
+ aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) );
+ bModal = FALSE;
+
+ Start_Impl();
+
+ if ( bShow )
+ Window::Show();
+
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool IconChoiceDialog::QueryClose()
+{
+ sal_Bool bRet = sal_True;
+ const ULONG nCount = maPageList.Count();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ IconChoicePageData* pData = maPageList.GetObject(i);
+ if ( pData->pPage && !pData->pPage->QueryClose() )
+ {
+ bRet = sal_False;
+ break;
+ }
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::Start_Impl()
+{
+ Point aPos;
+ USHORT nActPage;
+
+ if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX )
+ nActPage = maPageList.GetObject(0)->nId;//First()->nId;
+ else
+ nActPage = mnCurrentPageId;
+
+ // Konfiguration vorhanden?
+ SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) );
+
+ if ( aTabDlgOpt.Exists() )
+ {
+ // ggf. Position aus Konfig
+ SetWindowState( ByteString( aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+
+ // initiale TabPage aus Programm/Hilfe/Konfig
+ nActPage = (USHORT)aTabDlgOpt.GetPageID();
+
+ if ( USHRT_MAX != mnCurrentPageId )
+ nActPage = mnCurrentPageId;
+
+ if ( GetPageData ( nActPage ) == NULL )
+ nActPage = ( (IconChoicePageData*)maPageList.GetObject(0) )->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 ( USHORT nId )
+{
+ IconChoicePageData *pRet = NULL;
+ BOOL bFound = FALSE;
+
+ for ( ULONG i=0; i<maPageList.Count() && !bFound; i++ )
+ {
+ IconChoicePageData* pData = (IconChoicePageData*)maPageList.GetObject ( i );
+
+ if ( pData->nId == nId )
+ {
+ pRet = pData;
+ }
+ }
+
+ return pRet;
+}
+
+/**********************************************************************
+|
+| OK-Status
+|
+\**********************************************************************/
+
+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() );
+ BOOL bRet = 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 |= TRUE;
+ }
+ else
+ nRet = pPage->DeactivatePage( NULL );
+ bEnd = nRet;
+ }
+
+ return bEnd;
+}
+
+// -----------------------------------------------------------------------
+
+short IconChoiceDialog::Ok()
+{
+ bInOK = TRUE;
+
+ if ( !pOutSet )
+ {
+ if ( !pExampleSet && pSet )
+ pOutSet = pSet->Clone( FALSE ); // ohne Items
+ else if ( pExampleSet )
+ pOutSet = new SfxItemSet( *pExampleSet );
+ }
+ BOOL _bModified = FALSE;
+
+ const ULONG nCount = maPageList.Count();
+
+ for ( USHORT i = 0; 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 |= TRUE;
+ pExampleSet->Put( aTmp );
+ pOutSet->Put( aTmp );
+ }
+ }
+ }
+ }
+
+ if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) )
+ _bModified |= TRUE;
+
+ return _bModified ? RET_OK : RET_CANCEL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IconChoiceDialog::IsInOK() const
+{
+ return bInOK;
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::FocusOnIcon( USHORT nId )
+{
+ // set focus to icon for the current visible page
+ for ( USHORT i=0; i<maIconCtrl.GetEntryCount(); i++)
+ {
+ SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
+ USHORT* pUserData = (USHORT*) pEntry->GetUserData();
+
+ if ( pUserData && *pUserData == nId )
+ {
+ maIconCtrl.SetCursor( pEntry );
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void IconChoiceDialog::CreateIconTextAutoMnemonics( void )
+{
+ maIconCtrl.CreateAutoMnemonics();
+}
diff --git a/cui/source/dialogs/iconcdlg.src b/cui/source/dialogs/iconcdlg.src
new file mode 100644
index 000000000000..83c8b8825aaf
--- /dev/null
+++ b/cui/source/dialogs/iconcdlg.src
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iconcdlg.src,v $
+ * $Revision: 1.19 $
+ *
+ * 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
new file mode 100644
index 000000000000..3bbcf25643e0
--- /dev/null
+++ b/cui/source/dialogs/insdlg.cxx
@@ -0,0 +1,1060 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insdlg.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <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;
+}
+
+BOOL InsertObjectDialog_Impl::IsCreateNew() const
+{
+ return 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 );
+}
+
+void SvInsertOleDlg::FillObjectServerList( SvObjectServerList* pList )
+{
+ pList->FillInsertObjects();
+}
+
+// -----------------------------------------------------------------------
+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 ) ),
+ aLbObjecttype( this, CUI_RES( LB_OBJECTTYPE ) ),
+ aEdFilepath( this, CUI_RES( ED_FILEPATH ) ),
+ aBtnFilepath( this, CUI_RES( BTN_FILEPATH ) ),
+ aCbFilelink( this, CUI_RES( CB_FILELINK ) ),
+ aGbObject( this, CUI_RES( GB_OBJECT ) ),
+ 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( TRUE );
+ RadioHdl( NULL );
+}
+
+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( FALSE );
+ for ( ULONG i = 0; i < m_pServers->Count(); i++ )
+ rBox.InsertEntry( (*m_pServers)[i].GetHumanName() );
+ rBox.SetUpdateMode( TRUE );
+ SelectDefault();
+ ::rtl::OUString aName;
+
+ DBG_ASSERT( m_xStorage.is(), "No storage!");
+ if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK )
+ {
+ String aFileName;
+ BOOL bLink = FALSE;
+ 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_ASSERT( "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 ),
+ aEdFileurl( this, CUI_RES( ED_FILEURL ) ),
+ aBtnFileurl( this, CUI_RES( BTN_FILEURL ) ),
+ aGbFileurl( this, CUI_RES( GB_FILEURL ) ),
+ aEdPluginsOptions( this, CUI_RES( ED_PLUGINS_OPTIONS ) ),
+ aGbPluginsOptions( this, CUI_RES( GB_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 )
+{
+ USHORT nEaten;
+ SvCommandList aLst;
+ aLst.AppendCommands( aCommands, &nEaten );
+
+ const sal_Int32 nCount = aLst.Count();
+ aCommandSequence.realloc( nCount );
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const SvCommand& rCommand = aLst[ nIndex ];
+
+ aCommandSequence[nIndex].Name = rCommand.GetCommand();
+ aCommandSequence[nIndex].Handle = -1;
+ aCommandSequence[nIndex].Value = makeAny( OUString( rCommand.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::createFromAscii("PluginURL"),
+ makeAny( ::rtl::OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) );
+ uno::Sequence< beans::PropertyValue > aCommandSequence;
+ Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("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();
+
+ BOOL bOK = 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::createFromAscii("AppletCode") );
+ if ( aAny >>= aStr )
+ SetClass( aStr );
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase") );
+ if ( aAny >>= aStr )
+ SetClassLocation( aStr );
+ uno::Sequence< beans::PropertyValue > aCommands;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands") );
+ if ( aAny >>= aCommands )
+ {
+ SvCommandList aList;
+ aList.FillFromSequence( aCommands );
+ SetAppletOptions( aList.GetCommands() );
+ }
+
+ String aText( CUI_RES( STR_EDIT_APPLET ) );
+ SetText( aText );
+ bOK = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "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
+ {
+ 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::createFromAscii("AppletCode"), makeAny( ::rtl::OUString( m_aClass ) ) );
+
+ ::rtl::OUString tmp = aClassLocation;
+ ::osl::File::getFileURLFromSystemPath(tmp, tmp);
+ aClassLocation = tmp;
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase"), makeAny( tmp ) );
+ m_aCommands = GetAppletOptions();
+
+ uno::Sequence< beans::PropertyValue > aCommandSequence;
+ Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands"), makeAny( aCommandSequence ) );
+
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "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 ) )
+ , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) )
+ , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) )
+ , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) )
+ , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) )
+ , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) )
+ , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) )
+ , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) )
+ , aFLFrameBorder( this, CUI_RES( GB_BORDER ) )
+ , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) )
+ , 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 ) )
+ , aFLMargin( this, CUI_RES( GB_MARGIN ) )
+ , 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 ) )
+ , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) )
+ , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) )
+ , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) )
+ , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) )
+ , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) )
+ , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) )
+ , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) )
+ , aFLFrameBorder( this, CUI_RES( GB_BORDER ) )
+ , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) )
+ , 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 ) )
+ , aFLMargin( this, CUI_RES( GB_MARGIN ) )
+ , 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;
+ BOOL bOK = 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::createFromAscii("FrameURL") );
+ if ( aAny >>= aStr )
+ aEDURL.SetText( aStr );
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
+ if ( aAny >>= aStr )
+ aEDName.SetText( aStr );
+
+ sal_Int32 nSize = SIZE_NOT_SET;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") );
+ aAny >>= nSize;
+
+ if ( nSize == SIZE_NOT_SET )
+ {
+ aCBMarginWidthDefault.Check( TRUE );
+ aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) );
+ aFTMarginWidth.Enable( FALSE );
+ aNMMarginWidth.Enable( FALSE );
+ }
+ else
+ aNMMarginWidth.SetText( String::CreateFromInt32( nSize ) );
+
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") );
+ aAny >>= nSize;
+
+ if ( nSize == SIZE_NOT_SET )
+ {
+ aCBMarginHeightDefault.Check( TRUE );
+ aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) );
+ aFTMarginHeight.Enable( FALSE );
+ aNMMarginHeight.Enable( FALSE );
+ }
+ else
+ aNMMarginHeight.SetText( String::CreateFromInt32( nSize ) );
+
+ BOOL bScrollOn = FALSE;
+ BOOL bScrollOff = FALSE;
+ BOOL bScrollAuto = FALSE;
+
+ sal_Bool bSet = sal_False;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") );
+ aAny >>= bSet;
+ if ( !bSet )
+ {
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") );
+ aAny >>= bSet;
+ bScrollOn = bSet;
+ bScrollOff = !bSet;
+ }
+ else
+ bScrollAuto = TRUE;
+
+ aRBScrollingOn.Check( bScrollOn );
+ aRBScrollingOff.Check( bScrollOff );
+ aRBScrollingAuto.Check( bScrollAuto );
+
+ bSet = sal_False;
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") );
+ aAny >>= bSet;
+ if ( !bSet )
+ {
+ aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") );
+ aAny >>= bSet;
+ aRBFrameBorderOn.Check( bSet );
+ aRBFrameBorderOff.Check( !bSet );
+ }
+
+ SetUpdateMode( TRUE );
+ bOK = TRUE;
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "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
+ {
+ 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::createFromAscii("FrameURL"), makeAny( aURL ) );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), makeAny( aName ) );
+
+ if ( eScroll == ScrollingAuto )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"),
+ makeAny( sal_True ) );
+ else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"),
+ makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
+
+ //if ( aFrmDescr.IsFrameBorderSet() )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"),
+ makeAny( bHasBorder ) );
+ /*else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"),
+ makeAny( sal_True ) );*/
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"),
+ makeAny( sal_Int32( lMarginWidth ) ) );
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"),
+ makeAny( sal_Int32( lMarginHeight ) ) );
+
+ if ( bIPActive )
+ m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "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;
+}
+
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx
new file mode 100644
index 000000000000..270a36202c90
--- /dev/null
+++ b/cui/source/dialogs/insrc.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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, ULONG nHelpId )
+ : 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( nHelpId );
+}
+
+short SvxInsRowColDlg::Execute(void)
+{
+ return ModalDialog::Execute();
+}
+
+
+
diff --git a/cui/source/dialogs/insrc.hrc b/cui/source/dialogs/insrc.hrc
new file mode 100644
index 000000000000..e07c7cb2f1d5
--- /dev/null
+++ b/cui/source/dialogs/insrc.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..7d6845c32910
--- /dev/null
+++ b/cui/source/dialogs/insrc.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: insrc.src,v $
+ * $Revision: 1.32 $
+ *
+ * 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
+{
+ 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
+ {
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ Text [ en-US ] = "~Before" ;
+ TabStop = TRUE ;
+ };
+ RadioButton 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
+ {
+ 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
new file mode 100644
index 000000000000..106e3b898243
--- /dev/null
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -0,0 +1,716 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: linkdlg.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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, SvLinkManager* pMgr, 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 ) ),
+ 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 ) ),
+ aFtFiles2( this, CUI_RES( FT_FILES2 ) ),
+ aFtSource2( this, CUI_RES( FT_SOURCE2 ) ),
+ aFtType2( this, CUI_RES( FT_TYPE2 ) ),
+ aFtUpdate( this, CUI_RES( FT_UPDATE ) ),
+ aRbAutomatic( this, CUI_RES( RB_AUTOMATIC ) ),
+ aRbManual( this, CUI_RES( RB_MANUAL ) ),
+ aFtFullFileName( this, CUI_RES( FT_FULL_FILE_NAME ) ),
+ aFtFullSourceName( this, CUI_RES( FT_FULL_SOURCE_NAME ) ),
+ aFtFullTypeName( this, CUI_RES( FT_FULL_TYPE_NAME ) ),
+ 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),
+ aTbLinks( this, CUI_RES(TB_LINKS ) )
+{
+ FreeResource();
+
+ aTbLinks.SetHelpId(HID_LINKDLG_TABLB);
+ aTbLinks.SetSelectionMode( MULTIPLE_SELECTION );
+ aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT );
+ aTbLinks.Resize(); // OS: Hack fuer richtige Selektion
+
+ //JP 24.02.99: UpdateTimer fuer DDE-/Grf-Links, auf die gewarted wird
+ aUpdateTimer.SetTimeoutHdl( LINK( this, SvBaseLinksDlg, UpdateWaitingHdl ) );
+ aUpdateTimer.SetTimeout( 1000 );
+
+ 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 ) );
+// OpenSource().SetClickHdl( LINK( this, SvBaseLinksDlg, OpenSourceClickHdl ) );
+ ChangeSource().SetClickHdl( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) );
+ if(!bHtmlMode)
+ BreakLink().SetClickHdl( LINK( this, SvBaseLinksDlg, BreakLinkClickHdl ) );
+ else
+ BreakLink().Hide();
+
+ SetManager( pMgr );
+}
+
+SvBaseLinksDlg::~SvBaseLinksDlg()
+{
+}
+
+/*************************************************************************
+|* SvBaseLinksDlg::Handler()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.06.94
+|* Letzte Aenderung JP 30.05.95
+*************************************************************************/
+IMPL_LINK( SvBaseLinksDlg, LinksSelectHdl, SvTabListBox *, pSvTabListBox )
+{
+ USHORT nSelectionCount = pSvTabListBox ?
+ (USHORT)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();
+ USHORT nObjectType = pLink->GetObjType();
+ if((OBJECT_CLIENT_FILE & nObjectType) != OBJECT_CLIENT_FILE)
+ {
+ pSvTabListBox->SelectAll(FALSE);
+ pSvTabListBox->Select(pEntry);
+ nSelectionCount = 1;
+ }
+ else
+ {
+ for( USHORT 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, FALSE );
+
+ }
+ }
+
+ UpdateNow().Enable();
+
+ Automatic().Disable();
+ Manual().Check();
+ Manual().Disable();
+ }
+ else
+ {
+ USHORT 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;
+
+ USHORT 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;
+
+ USHORT 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();
+ USHORT nSelCnt = (USHORT)rListBox.GetSelectionCount();
+ if( 255 < nSelCnt )
+ nSelCnt = 255;
+
+ std::vector< SvBaseLink* > aLnkArr;
+ std::vector< USHORT > aPosArr;
+
+ SvLBoxEntry* pE = rListBox.FirstSelected();
+ while( pE )
+ {
+ USHORT nFndPos = (USHORT)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( USHORT n = 0; n < aLnkArr.size(); ++n )
+ {
+ SvBaseLinkRef xLink = aLnkArr[ n ];
+
+ // suche erstmal im Array nach dem Eintrag
+ for( USHORT i = 0; i < pLinkMgr->GetLinks().Count(); ++i )
+ if( &xLink == *pLinkMgr->GetLinks()[ i ] )
+ {
+ xLink->SetUseCache( FALSE );
+ SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() );
+ xLink->SetUseCache( TRUE );
+ break;
+ }
+ }
+
+ // falls jemand der Meinung ist, seine Links auszutauschen (SD)
+ SvLinkManager* 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, FALSE );
+ rListBox.Select( pE );
+ rListBox.MakeVisible( pE );
+ }
+ }
+ return 0;
+}
+
+/*
+IMPL_LINK_INLINE_START( SvBaseLinksDlg, OpenSourceClickHdl, PushButton *, pPushButton )
+{
+ DBG_ASSERT( !this, "Open noch nicht impl." );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvBaseLinksDlg, OpenSourceClickHdl, PushButton *, pPushButton )
+*/
+
+IMPL_LINK( SvBaseLinksDlg, ChangeSourceClickHdl, PushButton *, pPushButton )
+{
+ (void)pPushButton;
+
+ USHORT nSelectionCount = (USHORT)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( USHORT 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();
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+ }
+ }
+ else
+ {
+ USHORT 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;
+
+ BOOL bModified = FALSE;
+ if(Links().GetSelectionCount() <= 1)
+ {
+ USHORT 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
+ 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 )
+ {
+ SvLinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = 0;
+ SetManager( pNewMgr );
+
+ SvLBoxEntry* pEntry = Links().GetEntry( nPos ? --nPos : 0 );
+ if( pEntry )
+ Links().SetCurEntry( pEntry );
+ }
+ bModified = 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( 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 = TRUE;
+ }
+ //Danach alle selektierten Eintraege entfernen
+ }
+ }
+ if(bModified)
+ {
+ if( !Links().GetEntryCount() )
+ {
+ // Der letzte macht das Licht aus
+ Automatic().Disable();
+ Manual().Disable();
+ UpdateNow().Disable();
+// OpenSource().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;
+// for( SvLBoxEntry* pBox = Links().First(); pBox;
+// pBox = Links().Next( pBox ))
+
+ Links().SetUpdateMode(FALSE);
+ for( 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(TRUE);
+ return 0;
+}
+
+IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink*, _pLink )
+{
+ USHORT nPos;
+ GetSelEntry( &nPos );
+
+ if( _pLink && _pLink->WasLastEditOK() )
+ {
+ // JP 09.01.98:
+ // 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.
+ BOOL bLinkFnd = FALSE;
+ for( USHORT n = pLinkMgr->GetLinks().Count(); n; )
+ if( _pLink == &(*pLinkMgr->GetLinks()[ --n ]) )
+ {
+ bLinkFnd = TRUE;
+ break;
+ }
+
+ if( bLinkFnd )
+ {
+ Links().SetUpdateMode(FALSE);
+ Links().GetModel()->Remove( Links().GetEntry( nPos ) );
+ SvLBoxEntry* pToUnselect = Links().FirstSelected();
+ InsertEntry( *_pLink, nPos, sal_True );
+ if(pToUnselect)
+ Links().Select(pToUnselect, FALSE);
+ Links().SetUpdateMode(TRUE);
+ }
+ else
+ {
+ SvLinkManager* 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( SvLinkManager* pNewMgr )
+{
+ if( pLinkMgr == pNewMgr )
+ return;
+
+ if( pNewMgr )
+ // Update muss vor Clear gestoppt werden
+ Links().SetUpdateMode( FALSE );
+
+ Links().Clear();
+ pLinkMgr = pNewMgr;
+
+ if( pLinkMgr )
+ {
+ SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks();
+ for( USHORT 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( TRUE );
+ Links().Invalidate();
+ }
+}
+
+
+void SvBaseLinksDlg::InsertEntry( const SvBaseLink& rLink, USHORT 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( USHORT* pPos )
+{
+ SvLBoxEntry* pE = Links().FirstSelected();
+ USHORT nPos;
+ if( pE && LISTBOX_ENTRY_NOTFOUND !=
+ ( nPos = (USHORT)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,
+ USHORT nSelPos,
+ USHORT 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();
+ USHORT nSelect = 0;
+ for( USHORT 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++;
+ }
+ }
+ }
+}
+
diff --git a/cui/source/dialogs/makefile.mk b/cui/source/dialogs/makefile.mk
new file mode 100755
index 000000000000..f7d597a219a1
--- /dev/null
+++ b/cui/source/dialogs/makefile.mk
@@ -0,0 +1,118 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=dialogs
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=dialogs
+SRC1FILES = \
+ charmap.src \
+ commonlingui.src \
+ cuiimapdlg.src \
+ dlgname.src \
+ fmsearch.src \
+ gallery.src \
+ grfflt.src \
+ hangulhanjadlg.src \
+ hlmarkwn.src \
+ hyperdlg.src \
+ iconcdlg.src \
+ insrc.src \
+ multipat.src \
+ newtabledlg.src \
+ postdlg.src \
+ scriptdlg.src \
+ sdrcelldlg.src \
+ showcols.src \
+ SpellDialog.src \
+ splitcelldlg.src \
+ srchxtra.src \
+ svuidlg.src \
+ tbxform.src \
+ zoom.src \
+
+
+SLOFILES+=\
+ $(SLO)$/commonlingui.obj \
+ $(SLO)$/cuicharmap.obj \
+ $(SLO)$/cuifmsearch.obj \
+ $(SLO)$/cuigaldlg.obj \
+ $(SLO)$/cuigrfflt.obj \
+ $(SLO)$/cuihyperdlg.obj \
+ $(SLO)$/cuiimapwnd.obj \
+ $(SLO)$/cuitbxform.obj \
+ $(SLO)$/dlgname.obj \
+ $(SLO)$/hangulhanjadlg.obj \
+ $(SLO)$/hldocntp.obj \
+ $(SLO)$/hldoctp.obj \
+ $(SLO)$/hlinettp.obj \
+ $(SLO)$/hlmailtp.obj \
+ $(SLO)$/hlmarkwn.obj \
+ $(SLO)$/hltpbase.obj \
+ $(SLO)$/iconcdlg.obj \
+ $(SLO)$/insdlg.obj \
+ $(SLO)$/insrc.obj \
+ $(SLO)$/linkdlg.obj \
+ $(SLO)$/multifil.obj \
+ $(SLO)$/multipat.obj \
+ $(SLO)$/newtabledlg.obj \
+ $(SLO)$/pastedlg.obj \
+ $(SLO)$/plfilter.obj \
+ $(SLO)$/postdlg.obj \
+ $(SLO)$/scriptdlg.obj \
+ $(SLO)$/sdrcelldlg.obj \
+ $(SLO)$/showcols.obj \
+ $(SLO)$/SpellAttrib.obj \
+ $(SLO)$/SpellDialog.obj \
+ $(SLO)$/splitcelldlg.obj \
+ $(SLO)$/srchxtra.obj \
+ $(SLO)$/zoom.obj \
+
+
+.IF "$(GUI)"=="WNT"
+SLOFILES+=$(SLO)$/winpluginlib.obj
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx
new file mode 100644
index 000000000000..8f5eadae306a
--- /dev/null
+++ b/cui/source/dialogs/multifil.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: multifil.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// 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
+
+ USHORT nCount = aPathLB.GetEntryCount();
+ BOOL bDuplicated = FALSE;
+ try
+ {
+ if( nCount > 0 ) // start comparison
+ {
+ USHORT 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 = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ } // end of if the entries are more than zero.
+ } // end of try(}
+ catch( const Exception& ) // catch every exception of comparison
+ {
+ OSL_ENSURE( sal_False, "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
+ {
+ USHORT 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 )
+{
+ USHORT nPos = aPathLB.GetSelectEntryPos();
+ aPathLB.RemoveEntry( nPos );
+ USHORT nCnt = aPathLB.GetEntryCount();
+
+ if ( nCnt )
+ {
+ nCnt--;
+
+ if ( nPos > nCnt )
+ nPos = nCnt;
+ aPathLB.SelectEntryPos( nPos );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiFileDialog::SvxMultiFileDialog( Window* pParent, 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()
+{
+}
+
+
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
new file mode 100644
index 000000000000..6d55f4de9f35
--- /dev/null
+++ b/cui/source/dialogs/multipat.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: multipat.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <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
+{
+ BOOL bEmptyAllowed;
+ BOOL bIsClassPathMode;
+ bool bIsRadioButtonMode;
+
+ MultiPath_Impl( BOOL bAllowed ) :
+ bEmptyAllowed( bAllowed ), bIsClassPathMode( FALSE ), bIsRadioButtonMode( false ) {}
+};
+
+// class SvxMultiPathDialog ----------------------------------------------
+
+IMPL_LINK( SvxMultiPathDialog, SelectHdl_Impl, void *, EMPTYARG )
+{
+ ULONG nCount = pImpl->bIsRadioButtonMode ? aRadioLB.GetEntryCount() : aPathLB.GetEntryCount();
+ bool bIsSelected = pImpl->bIsRadioButtonMode
+ ? aRadioLB.FirstSelected() != NULL
+ : aPathLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
+ 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 )
+ {
+ 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
+ {
+ USHORT 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;
+ ULONG nPos = aRadioLB.GetEntryPos( pEntry );
+ aRadioLB.RemoveEntry( pEntry );
+ 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
+ {
+ USHORT nPos = aPathLB.GetSelectEntryPos();
+ aPathLB.RemoveEntry( nPos );
+ USHORT nCnt = aPathLB.GetEntryCount();
+
+ if ( nCnt )
+ {
+ nCnt--;
+
+ if ( nPos > nCnt )
+ nPos = nCnt;
+ aPathLB.SelectEntryPos( nPos );
+ }
+ }
+ SelectHdl_Impl( NULL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiPathDialog::SvxMultiPathDialog( Window* pParent, BOOL bEmptyAllowed ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_MULTIPATH ) ),
+
+ aPathFL ( this, CUI_RES( FL_MULTIPATH) ),
+ aPathLB ( this, CUI_RES( LB_MULTIPATH ) ),
+ aRadioLB ( this, CUI_RES( LB_RADIOBUTTON ) ),
+ 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 );
+}
+
+// -----------------------------------------------------------------------
+
+SvxMultiPathDialog::~SvxMultiPathDialog()
+{
+ USHORT nPos = aPathLB.GetEntryCount();
+ while ( nPos-- )
+ delete (String*)aPathLB.GetEntryData(nPos);
+ nPos = (USHORT)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 ( USHORT 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 ( USHORT 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;
+ USHORT nPos, nCount = rPath.GetTokenCount( cDelim );
+
+ for ( USHORT 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 = 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 );
+}
+
diff --git a/cui/source/dialogs/multipat.hrc b/cui/source/dialogs/multipat.hrc
new file mode 100644
index 000000000000..6ef22855ff8b
--- /dev/null
+++ b/cui/source/dialogs/multipat.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: multipat.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_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
new file mode 100644
index 000000000000..64dc9b412311
--- /dev/null
+++ b/cui/source/dialogs/multipat.src
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: multipat.src,v $
+ * $Revision: 1.42 $
+ *
+ * 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 204 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ PushButton 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
new file mode 100644
index 000000000000..6309de2c3b7d
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: newtabledlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "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() );
+}
diff --git a/cui/source/dialogs/newtabledlg.hrc b/cui/source/dialogs/newtabledlg.hrc
new file mode 100644
index 000000000000..b17631658341
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: newtabledlg.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * 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
new file mode 100644
index 000000000000..e02338d6085e
--- /dev/null
+++ b/cui/source/dialogs/newtabledlg.src
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: newtabledlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+{
+ 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
+ {
+ 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
+ {
+ 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/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
new file mode 100644
index 000000000000..e0892bfca427
--- /dev/null
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pastedlg.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#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 ) ),
+ aLbInsertList( this, CUI_RES( LB_INSERT_LIST ) ),
+ aCbDisplayAsIcon( this, CUI_RES( CB_DISPLAY_AS_ICON ) ),
+ aPbChangeIcon( this, CUI_RES( PB_CHANGE_ICON ) ),
+ aFlChoice( this, CUI_RES( FL_CHOICE ) ),
+ 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();
+}
+
+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 = FALSE;
+ nAspect = (USHORT)::com::sun::star::embed::Aspects::MSOLE_CONTENT;
+}
+
+SvPasteObjectDialog::~SvPasteObjectDialog()
+{
+ void * pStr = aSupplementTable.First();
+ while( pStr )
+ {
+ delete (String *)pStr;
+ pStr = aSupplementTable.Next();
+ }
+}
+
+/*************************************************************************
+|* SvPasteObjectDialog::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.06.94
+|* Letzte Aenderung KA 16.03.2001
+*************************************************************************/
+void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName )
+{
+ String * pStr = new String( rFormatName );
+ if( !aSupplementTable.Insert( nFormat, pStr ) )
+ delete pStr;
+}
+
+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;
+ ULONG nSelFormat = 0;
+ SvGlobalName aEmptyNm;
+
+ ObjectLB().SetUpdateMode( 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;
+
+#ifdef WNT
+/*
+ if( !pName &&
+ ( nFormat == SOT_FORMATSTR_ID_EMBED_SOURCE_OLE || nFormat == SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) )
+ {
+ BOOL IsClipboardObject_Impl( SotDataObject * );
+ if( IsClipboardObject_Impl( pDataObj ) )
+ {
+ IDataObject * pDO = NULL;
+ OleGetClipboard( &pDO );
+ if( pDO )
+ {
+ FORMATETC fe;
+ STGMEDIUM stm;
+ (fe).cfFormat=RegisterClipboardFormat( "Object Descriptor" );
+ (fe).dwAspect=DVASPECT_CONTENT;
+ (fe).ptd=NULL;
+ (fe).tymed=TYMED_HGLOBAL;
+ (fe).lindex=-1;
+
+ if (SUCCEEDED(pDO->GetData(&fe, &stm)))
+ {
+ LPOBJECTDESCRIPTOR pOD=(LPOBJECTDESCRIPTOR)GlobalLock(stm.hGlobal);
+ if( pOD->dwFullUserTypeName )
+ {
+ OLECHAR * pN = (OLECHAR *)(((BYTE *)pOD) + pOD->dwFullUserTypeName);
+ aName.Append( pN );
+ pName = &aName;
+ // set format to ole object
+ nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE;
+ }
+ if( pOD->dwSrcOfCopy )
+ {
+ OLECHAR * pN = (OLECHAR *)(((BYTE *)pOD) + pOD->dwSrcOfCopy);
+ aSourceName.Append( *pN++ );
+ }
+ else
+ aSourceName = String( ResId( STR_UNKNOWN_SOURCE, SOAPP->GetResMgr() ) );
+ GlobalUnlock(stm.hGlobal);
+ ReleaseStgMedium(&stm);
+ }
+ }
+ }
+ }
+*/
+#endif
+
+ // 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( 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 = (USHORT)com::sun::star::embed::Aspects::MSOLE_ICON;
+
+ nSelFormat = (ULONG)ObjectLB().GetEntryData( ObjectLB().GetSelectEntryPos() );
+ }
+
+ return nSelFormat;
+}
+
+void SvPasteObjectDialog::SetObjName( const SvGlobalName & rClass, const String & rObjName )
+{
+ aObjClassName = rClass;
+ aObjName = rObjName;
+}
+
diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx
new file mode 100644
index 000000000000..d09cc00d2a34
--- /dev/null
+++ b/cui/source/dialogs/plfilter.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: plfilter.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#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::createFromAscii("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 ( UINT32 nPos = aDescriptions.getLength(); nPos--; )
+ {
+ const PluginDescription & rDescr = pDescriptions[nPos];
+
+ StrSet& rTypes = aMap[ rDescr.Description ];
+ String aExtension( rDescr.Extension );
+
+ for ( USHORT 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" ) ), TRUE );
+}
+
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
new file mode 100644
index 000000000000..e695aaafa420
--- /dev/null
+++ b/cui/source/dialogs/postdlg.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postdlg.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// 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 USHORT pRanges[] =
+{
+ SID_ATTR_POSTIT_AUTHOR,
+ SID_ATTR_POSTIT_TEXT,
+ 0
+};
+
+// class SvxPostItDialog -------------------------------------------------
+
+SvxPostItDialog::SvxPostItDialog( Window* pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bPrevNext,
+ 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 );
+
+ BOOL bNew = TRUE;
+ USHORT nWhich = 0;
+
+ if ( !bPrevNext )
+ {
+ aPrevBtn.Hide();
+ aNextBtn.Hide();
+ }
+
+ nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR );
+ String aAuthorStr, aDateStr, aTextStr;
+
+ if ( rSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE )
+ {
+ bNew = 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, 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, 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();
+}
+
+// -----------------------------------------------------------------------
+
+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 );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxPostItDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPostItDialog::EnableTravel(BOOL bNext, 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, FALSE, 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;
+}
+
diff --git a/cui/source/dialogs/postdlg.hrc b/cui/source/dialogs/postdlg.hrc
new file mode 100644
index 000000000000..b2b615647438
--- /dev/null
+++ b/cui/source/dialogs/postdlg.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postdlg.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_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
new file mode 100644
index 000000000000..02face52b1b5
--- /dev/null
+++ b/cui/source/dialogs/postdlg.src
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postdlg.src,v $
+ * $Revision: 1.27 $
+ *
+ * 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 <svx/dialogs.hrc> // for RID_SVXDLG_POSTIT
+
+ // RID_SVXDLG_POSTIT -----------------------------------------------------
+ModalDialog RID_SVXDLG_POSTIT
+{
+ HelpId = SID_POSTIT ;
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 141 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton 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
+ {
+ 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
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Notiz einfügen : Notiz einf³gen */
+ /* ### ACHTUNG: Neuer Text in Resource? Notiz einfügen : Notiz einf³gen */
+ Text [ en-US ] = "Insert note" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
new file mode 100644
index 000000000000..d68792732d7e
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -0,0 +1,1694 @@
+/**********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: scriptdlg.cxx,v $
+ * $Revision: 1.26 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <memory>
+
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <vos/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/XInvocation.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_hdImage_hc(ResId(IMG_HARDDISK_HC,*rResId.GetResMgr())),
+ m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())),
+ m_libImage_hc(ResId(IMG_LIB_HC,*rResId.GetResMgr())),
+ m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())),
+ m_macImage_hc(ResId(IMG_MACRO_HC,*rResId.GetResMgr())),
+ m_docImage(ResId(IMG_DOCUMENT,*rResId.GetResMgr())),
+ m_docImage_hc(ResId(IMG_DOCUMENT_HC,*rResId.GetResMgr())),
+ m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))),
+ m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr())))
+{
+ FreeResource();
+ SetSelectionMode( SINGLE_SELECTION );
+
+ SetWindowBits( 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( FALSE );
+
+ deleteAllTree();
+
+ Reference< browse::XBrowseNode > rootNode;
+ Reference< XComponentContext > xCtx;
+
+ Sequence< Reference< browse::XBrowseNode > > children;
+
+ ::rtl::OUString userStr = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString shareStr = ::rtl::OUString::createFromAscii("share");
+
+ ::rtl::OUString singleton = ::rtl::OUString::createFromAscii(
+ "/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::createFromAscii("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 );
+
+ /*SvLBoxEntry* pBasicManagerRootEntry =*/
+ insertEntry( uiName, app ? IMG_HARDDISK : IMG_DOCUMENT,
+ 0, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL );
+ }
+
+ SetUpdateMode( 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::createFromAscii("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 )));
+
+ }
+ }
+ }
+}
+
+void SFTreeListBox::UpdateEntries()
+{
+}
+
+SvLBoxEntry* SFTreeListBox::FindEntry( SvLBoxEntry* , const String& , BYTE )
+{
+ return 0;
+}
+
+long SFTreeListBox::ExpandingHdl()
+{
+ return TRUE;
+}
+
+void SFTreeListBox::ExpandAllTrees()
+{
+}
+
+SvLBoxEntry * SFTreeListBox::insertEntry(
+ String const & rText, USHORT 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,
+ BMP_COLOR_NORMAL );
+ Image aHCImage = SvFileInformationManager::GetFileImage(
+ INetURLObject(factoryURL), false,
+ BMP_COLOR_HIGHCONTRAST );
+ p = InsertEntry(
+ rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
+ aUserData.release()); // XXX possible leak
+ SetExpandedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ }
+ else
+ {
+ p = insertEntry( rText, nBitmap, pParent, bChildrenOnDemand, aUserData );
+ }
+ return p;
+}
+
+SvLBoxEntry * SFTreeListBox::insertEntry(
+ String const & rText, USHORT nBitmap, SvLBoxEntry * pParent,
+ bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData )
+{
+ Image aHCImage, aImage;
+ if( nBitmap == IMG_HARDDISK )
+ {
+ aImage = m_hdImage;
+ aHCImage = m_hdImage_hc;
+ }
+ else if( nBitmap == IMG_LIB )
+ {
+ aImage = m_libImage;
+ aHCImage = m_libImage_hc;
+ }
+ else if( nBitmap == IMG_MACRO )
+ {
+ aImage = m_macImage;
+ aHCImage = m_macImage_hc;
+ }
+ else if( nBitmap == IMG_DOCUMENT )
+ {
+ aImage = m_docImage;
+ aHCImage = m_docImage_hc;
+ }
+ SvLBoxEntry * p = InsertEntry(
+ rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND,
+ aUserData.release()); // XXX possible leak
+ SetExpandedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(p, aHCImage, BMP_COLOR_HIGHCONTRAST);
+ return p;
+}
+
+void __EXPORT 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 __EXPORT SFTreeListBox::ExpandedHdl()
+{
+/* SvLBoxEntry* pEntry = GetHdlEntry();
+ DBG_ASSERT( pEntry, "Was wurde zugeklappt?" );
+
+ if ( !IsExpanded( pEntry ) && pEntry->HasChildsOnDemand() )
+ {
+ SvLBoxEntry* pChild = FirstChild( pEntry );
+ while ( pChild )
+ {
+ GetModel()->Remove( pChild ); // Ruft auch den DTOR
+ pChild = FirstChild( pEntry );
+ }
+ }*/
+}
+
+// ----------------------------------------------------------------------------
+// InputDialog ------------------------------------------------------------
+// ----------------------------------------------------------------------------
+InputDialog::InputDialog(Window * pParent, USHORT 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;
+
+ USHORT 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();
+}
+
+__EXPORT 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::EnableButton( Button& , BOOL )
+{
+}
+
+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::createFromAscii( "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;
+}
+
+Reference< XInterface >
+SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName )
+{
+ Reference< XInterface > xModel;
+ Reference< lang::XMultiComponentFactory > mcf =
+ xCtx->getServiceManager();
+ Reference< frame::XDesktop > desktop (
+ mcf->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii("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;
+}
+
+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;
+ USHORT nMode = INPUTMODE_NEWLIB;
+ if( aScriptsBox.GetModel()->GetDepth( pEntry ) == 0 )
+ {
+ aNewStdName = ::rtl::OUString::createFromAscii( "Library" ) ;
+ }
+ else
+ {
+ aNewStdName = ::rtl::OUString::createFromAscii( "Macro" ) ;
+ nMode = INPUTMODE_NEWMACRO;
+ }
+ //do we need L10N for this? ie somethng like:
+ //String aNewStdName( ResId( STR_STDMODULENAME ) );
+ BOOL bValid = FALSE;
+ USHORT 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 = 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 );
+ BOOL bFound = 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 = TRUE;
+ break;
+ }
+ }
+ if( bFound )
+ {
+ i++;
+ }
+ else
+ {
+ bValid = 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 = TRUE;
+ for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
+ {
+ if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) )
+ {
+ bValid = 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::createFromAscii( "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);
+ }
+ USHORT nMode = INPUTMODE_RENAME;
+
+ std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast<Window*>(this), nMode ) );
+ xNewDlg->SetObjectName( aNewName );
+
+ BOOL bValid;
+ do
+ {
+ if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() )
+ {
+ ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName();
+ bValid = TRUE;
+ /*
+ for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
+ {
+ if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) )
+ {
+ bValid = 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 );
+
+ Sequence< Any > args( 1 );
+ args[ 0 ] <<= aNewName;
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ Any aResult;
+ aResult = xInv->invoke( ::rtl::OUString::createFromAscii( "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::createFromAscii( "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();
+ }
+
+}
+
+BOOL SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet >& xProps,
+ ::rtl::OUString& propName )
+{
+ 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;
+ USHORT 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 );
+}
+
+BOOL SFTreeListBox::dialogSort1( Reference< browse::XBrowseNode > node1,
+ Reference< browse::XBrowseNode > node2 )
+{
+ ::rtl::OUString userStr = ::rtl::OUString::createFromAscii("user");
+ ::rtl::OUString shareStr = ::rtl::OUString::createFromAscii("share");
+ if( node1->getName().equals( userStr ) )
+ return true;
+ if( node2->getName().equals( userStr ) )
+ return false;
+ if( node1->getName().equals( shareStr ) )
+ return true;
+ if( node2->getName().equals( shareStr ) )
+ return false;
+ return dialogSort2( node1, node2 );
+}
+
+BOOL SFTreeListBox::dialogSort2( Reference< browse::XBrowseNode > node1,
+ Reference< browse::XBrowseNode > node2 )
+{
+ return ( node1->getName().compareTo( node2->getName() ) < 0 );
+}
+
+::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::createFromAscii( "%LANGUAGENAME" ), language );
+ result = ReplaceString(
+ result, ::rtl::OUString::createFromAscii( "%SCRIPTNAME" ), script );
+ result = ReplaceString(
+ result, ::rtl::OUString::createFromAscii( "%LINENUMBER" ), line );
+
+ if ( type.getLength() != 0 )
+ {
+ result += ::rtl::OUString::createFromAscii( "\n\n" );
+ result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_TYPE_LABEL)));
+ result += ::rtl::OUString::createFromAscii( " " );
+ result += type;
+ }
+
+ if ( message.getLength() != 0 )
+ {
+ result += ::rtl::OUString::createFromAscii( "\n\n" );
+ result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_MESSAGE_LABEL)));
+ result += ::rtl::OUString::createFromAscii( " " );
+ 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::OUString::createFromAscii( "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::OUString::createFromAscii( "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::OUString::createFromAscii( "UNKNOWN" );
+
+ ::rtl::OUString script =
+ ::rtl::OUString::createFromAscii( "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::createFromAscii( "%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 occured
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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;
+}
diff --git a/cui/source/dialogs/scriptdlg.hrc b/cui/source/dialogs/scriptdlg.hrc
new file mode 100644
index 000000000000..0079037c7680
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: scriptdlg.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#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_HARDDISK_HC 2
+#define IMG_LIB 3
+#define IMG_LIB_HC 4
+#define IMG_MACRO 5
+#define IMG_MACRO_HC 6
+#define IMG_DOCUMENT 7
+#define IMG_DOCUMENT_HC 8
+
+#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
new file mode 100644
index 000000000000..cceca0bc64ff
--- /dev/null
+++ b/cui/source/dialogs/scriptdlg.src
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: scriptdlg.src,v $
+ * $Revision: 1.13 $
+ *
+ * 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_HARDDISK_HC
+ {
+ ImageBitmap = Bitmap { File = "harddisk_16_h.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_LIB
+ {
+ ImageBitmap = Bitmap { File = "im30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_LIB_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30820.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO
+ {
+ ImageBitmap = Bitmap { File = "im30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_MACRO_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30821.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOCUMENT
+ {
+ ImageBitmap = Bitmap { File = "im30826.png"; };
+ MASKCOLOR
+ };
+ Image IMG_DOCUMENT_HC
+ {
+ ImageBitmap = Bitmap { File = "imh30826.png"; };
+ MASKCOLOR
+ };
+ String STR_MYMACROS
+ {
+ Text [ en-US ] = "My Macros";
+ };
+ String STR_PRODMACROS
+ {
+ Text [ en-US ] = "%PRODUCTNAME Macros";
+ };
+ };
+
+ PushButton 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
+ {
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Pos = MAP_APPFONT ( 144 , 60 ) ;
+ Text [ en-US ] = "~Create..." ;
+ TabStop = TRUE ;
+ };
+ PushButton SF_PB_EDIT
+ {
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Pos = MAP_APPFONT ( 144 , 77 ) ;
+ Text [ en-US ] = "~Edit" ;
+ TabStop = TRUE ;
+ };
+ PushButton SF_PB_RENAME
+ {
+ Pos = MAP_APPFONT ( 144 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Rename..." ;
+ };
+ PushButton 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
+{
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..a5f8e074758e
--- /dev/null
+++ b/cui/source/dialogs/sdrcelldlg.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrcelldlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <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 );
+
+/*
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN);
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+*/
+}
+
+SvxFormatCellsDialog::~SvxFormatCellsDialog()
+{
+}
+
+void SvxFormatCellsDialog::PageCreated( USHORT 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 ).SetAreaTP( &mbAreaTP );
+// ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState );
+// ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState );
+// ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState );
+// ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState );
+ ( (SvxAreaTabPage&) rPage ).Construct();
+ // ActivatePage() wird das erste mal nicht gerufen
+ ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs );
+
+ break;
+
+ default:
+ SfxTabDialog::PageCreated( nId, rPage );
+ break;
+ }
+}
+
+void SvxFormatCellsDialog::Apply()
+{
+}
diff --git a/cui/source/dialogs/sdrcelldlg.src b/cui/source/dialogs/sdrcelldlg.src
new file mode 100644
index 000000000000..0c721bc11d2b
--- /dev/null
+++ b/cui/source/dialogs/sdrcelldlg.src
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdrcelldlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zurück : Zur³ck */
+ 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
new file mode 100644
index 000000000000..4b3930a692c1
--- /dev/null
+++ b/cui/source/dialogs/showcols.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: showcols.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "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
+ {
+ //CHINA001 xCol->setPropertyValue(::svxform::FM_PROP_HIDDEN, ::cppu::bool2any(sal_False));
+ xCol->setPropertyValue(CUIFM_PROP_HIDDEN, ::cppu::bool2any(sal_False));
+ }
+ catch(...)
+ {
+ DBG_ERROR("FmShowColsDialog::OnClickedOk Exception occured!");
+ }
+ }
+ }
+ }
+
+ 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
+ {
+ //CHINA001 ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(::svxform::FM_PROP_HIDDEN);
+ ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(CUIFM_PROP_HIDDEN);
+ bIsHidden = ::comphelper::getBOOL(aHidden);
+
+ ::rtl::OUString sName;
+ //CHINA001 xCurCol->getPropertyValue(::svxform::FM_PROP_LABEL) >>= sName;
+
+ xCurCol->getPropertyValue(CUIFM_PROP_LABEL) >>= sName;
+ sCurName = (const sal_Unicode*)sName;
+ }
+ catch(...)
+ {
+ DBG_ERROR("FmShowColsDialog::SetColumns Exception occured!");
+ }
+
+ // 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) );
+ }
+}
+
diff --git a/cui/source/dialogs/showcols.src b/cui/source/dialogs/showcols.src
new file mode 100644
index 000000000000..f22c0e0e3557
--- /dev/null
+++ b/cui/source/dialogs/showcols.src
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: showcols.src,v $
+ * $Revision: 1.28 $
+ *
+ * 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
+{
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..c6c1f173322c
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: splitcelldlg.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <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))
+, maCountLbl(this, CUI_RES(FT_COUNT))
+, maCountEdit(this, CUI_RES(ED_COUNT))
+, maCountFL(this, CUI_RES(FL_COUNT))
+, maHorzBox(this, CUI_RES(RB_HORZ))
+, maVertBox(this, CUI_RES(RB_VERT))
+, maPropCB(this, CUI_RES(CB_PROP))
+, maDirFL(this, CUI_RES(FL_DIR))
+, maOKBtn(this, CUI_RES(BT_OK))
+, maCancelBtn(this, CUI_RES(BT_CANCEL))
+, maHelpBtn( this, CUI_RES( BT_HELP ) )
+, mnMaxVertical( nMaxVertical )
+, mnMaxHorizontal( nMaxHorizontal )
+{
+ maVertBox.SetModeRadioImage(Image(CUI_RES(BMP_SPLIT_VERT)), BMP_COLOR_HIGHCONTRAST);
+ maHorzBox.SetModeRadioImage(Image(CUI_RES(BMP_SPLIT_HORZ)), BMP_COLOR_HIGHCONTRAST);
+ FreeResource();
+ maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+ maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+ maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+
+ if( mnMaxVertical < 2 )
+ maVertBox.Enable(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()
+{
+}
diff --git a/cui/source/dialogs/splitcelldlg.hrc b/cui/source/dialogs/splitcelldlg.hrc
new file mode 100644
index 000000000000..cab8b4ed02ad
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: splitcelldlg.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * 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 BMP_SPLIT_VERT 13
+#define BMP_SPLIT_HORZ 14
+
+#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
new file mode 100644
index 000000000000..f33243450e07
--- /dev/null
+++ b/cui/source/dialogs/splitcelldlg.src
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: splitcelldlg.src,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+{
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 18 , 68 ) ;
+ Size = MAP_APPFONT ( 91 , 12 ) ;
+ Text [ en-US ] = "~Into equal proportions";
+ };
+ Image BMP_SPLIT_VERT
+ {
+ ImageBitmap = Bitmap { File = "zetlver2_h.bmp" ; };
+ };
+ Image BMP_SPLIT_HORZ
+ {
+ ImageBitmap = Bitmap { File = "zetlhor2_h.bmp" ; };
+ };
+ ImageRadioButton 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
new file mode 100644
index 000000000000..5b28029920cc
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: srchxtra.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "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 <svx/flstitem.hxx>
+#include "chardlg.hxx"
+#include "paragrph.hxx"
+#include <dialmgr.hxx>
+#include "backgrnd.hxx"
+#include <svx/dialogs.hrc> // RID_SVXPAGE_...
+
+// 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( USHORT 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(TRUE);
+ break;
+ }
+}
+
+// class SvxSearchFormatDialog -------------------------------------------
+
+SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent,
+ SearchAttrItemList& rLst,
+ const USHORT* 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.SetWindowBits( 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" );
+
+ SfxItemPool& rPool = pSh->GetPool();
+ SfxItemSet aSet( rPool, pWhRanges );
+ SfxWhichIter aIter( aSet );
+ USHORT nWhich = aIter.FirstWhich();
+
+ while ( nWhich )
+ {
+ USHORT nSlot = rPool.GetSlotId( nWhich );
+ if ( nSlot >= SID_SVX_START )
+ {
+ BOOL bChecked = FALSE, bFound = FALSE;
+ for ( USHORT i = 0; !bFound && i < rList.Count(); ++i )
+ {
+ if ( nSlot == rList[i].nSlot )
+ {
+ bFound = TRUE;
+ if ( IsInvalidItem( rList[i].pItem ) )
+ bChecked = TRUE;
+ }
+ }
+
+ // item resources are in svx
+ USHORT nResId = nSlot - SID_SVX_START + RID_ATTR_BEGIN;
+ SvLBoxEntry* pEntry = NULL;
+ ResId aId( nResId, DIALOG_MGR() );
+ aId.SetRT( RSC_STRING );
+ if ( DIALOG_MGR().IsAvailable( aId ) )
+ pEntry = aAttrLB.SvTreeListBox::InsertEntry( CUI_RESSTR( nResId ) );
+ else
+ {
+ ByteString sError( "no resource for slot id\nslot = " );
+ sError += ByteString::CreateFromInt32( nSlot );
+ sError += ByteString( "\nresid = " );
+ sError += ByteString::CreateFromInt32( nResId );
+ DBG_ERRORFILE( sError.GetBuffer() );
+ }
+
+ if ( pEntry )
+ {
+ aAttrLB.SetCheckButtonState( pEntry, bChecked ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED );
+ pEntry->SetUserData( (void*)(ULONG)nSlot );
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+
+ aAttrLB.SetHighlightRange();
+ aAttrLB.SelectEntryPos( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchAttributeDialog, OKHdl, Button *, EMPTYARG )
+{
+ SearchAttrItem aInvalidItem;
+ aInvalidItem.pItem = (SfxPoolItem*)-1;
+
+ for ( USHORT i = 0; i < aAttrLB.GetEntryCount(); ++i )
+ {
+ USHORT nSlot = (USHORT)(ULONG)aAttrLB.GetEntryData(i);
+ BOOL bChecked = aAttrLB.IsChecked(i);
+
+ USHORT 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 ( USHORT n = rList.Count(); n; )
+ if ( !rList[ --n ].pItem )
+ rList.Remove( n );
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// class SvxSearchSimilarityDialog ---------------------------------------
+
+SvxSearchSimilarityDialog::SvxSearchSimilarityDialog
+(
+ Window* pParent,
+ BOOL bRelax,
+ USHORT nOther,
+ USHORT nShorter,
+ USHORT 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 );
+}
+
diff --git a/cui/source/dialogs/srchxtra.hrc b/cui/source/dialogs/srchxtra.hrc
new file mode 100644
index 000000000000..870303efd72c
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: srchxtra.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..bde692af7447
--- /dev/null
+++ b/cui/source/dialogs/srchxtra.src
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: srchxtra.src,v $
+ * $Revision: 1.52 $
+ *
+ * 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..ba3602fb18bd
--- /dev/null
+++ b/cui/source/dialogs/svuidlg.hrc
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svuidlg.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * 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
new file mode 100644
index 000000000000..cc8f2db676ae
--- /dev/null
+++ b/cui/source/dialogs/svuidlg.src
@@ -0,0 +1,711 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: svuidlg.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svtools/controldims.hrc>
+#include "svuidlg.hrc"
+
+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
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "~Insert as" ;
+ Check = TRUE ;
+ };
+ RadioButton RB_PASTE_LINK
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 78 , 48 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Link to" ;
+ };
+ ListBox LB_INSERT_LIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 202 , 74 ) ;
+ };
+ CheckBox CB_DISPLAY_AS_ICON
+ {
+ Hide = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 150 , 62 ) ;
+ Size = MAP_APPFONT ( 64 , 10 ) ;
+ Text [ en-US ] = "~As icon" ;
+ };
+ /*
+ FixedIcon FI_DISPLAY
+ {
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 167 , 75 ) ;
+ Size = MAP_APPFONT ( 30 , 30 ) ;
+ };
+*/
+ PushButton 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
+{
+ 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 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Element: : Verknüpfungen */
+ 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
+ {
+ Pos = MAP_APPFONT ( 270 , 43 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Update" ;
+ };
+ PushButton PB_OPEN_SOURCE
+ {
+ Pos = MAP_APPFONT ( 270 , 60 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Open" ;
+ };
+ PushButton PB_CHANGE_SOURCE
+ {
+ Pos = MAP_APPFONT ( 270 , 77 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Modify..." ;
+ };
+ PushButton 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
+ {
+ Pos = MAP_APPFONT ( 70 , 150 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton RB_MANUAL
+ {
+ Pos = MAP_APPFONT ( 133 , 150 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Manuell : Ma~nuell */
+ 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
+{
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 5 , 35 ) ;
+ Size = MAP_APPFONT ( 155 , 12 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+};
+ModalDialog MD_INSERT_OLEOBJECT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 284 , 105 ) ;
+ Moveable = TRUE ;
+ RadioButton RB_NEW_OBJECT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 81 , 10 ) ;
+ Text [ en-US ] = "~Create new" ;
+ };
+ RadioButton RB_OBJECT_FROMFILE
+ {
+ Pos = MAP_APPFONT ( 90 , 6 ) ;
+ Size = MAP_APPFONT ( 81 , 10 ) ;
+ Text [ en-US ] = "Create from ~file" ;
+ };
+ ListBox LB_OBJECTTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 204 , 60 ) ;
+ };
+ Edit ED_FILEPATH
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton BTN_FILEPATH
+ {
+ Pos = MAP_APPFONT ( 166 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Search..." ;
+ };
+ CheckBox 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
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 284 , 123 ) ;
+ Moveable = TRUE ;
+ Edit ED_FILEURL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton 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
+ {
+ 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
+{
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 55 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ };
+ PushButton 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
+ {
+ 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
+{
+ 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
+ {
+ 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
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 45 , 24 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BT_FILEOPEN
+ {
+ Pos = MAP_APPFONT ( 226 , 24 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_SCROLLINGON
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "~On" ;
+ };
+ RadioButton RB_SCROLLINGOFF
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "O~ff" ;
+ };
+ RadioButton 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
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 53 ) ;
+ Size = MAP_APPFONT ( 42 , 10 ) ;
+ Text [ en-US ] = "On" ;
+ };
+ RadioButton 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..e19818d51072
--- /dev/null
+++ b/cui/source/dialogs/tbxform.src
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tbxform.src,v $
+ * $Revision: 1.31 $
+ *
+ * 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
+{
+ 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
+ {
+ 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/winpluginlib.cpp b/cui/source/dialogs/winpluginlib.cpp
new file mode 100644
index 000000000000..0b1fced85b40
--- /dev/null
+++ b/cui/source/dialogs/winpluginlib.cpp
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: winpluginlib.cpp,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#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;
+ }
+ //ret = GetCurrentDirectory( SO_PATH_SIZE, sSoPath);
+ //ret = GetEnvironmentVariable("prog", sSoPath, SO_PATH_SIZE);
+ // 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;
+ }
+
+ //ret = GetCurrentDirectory( SO_PATH_SIZE, sSoPath);
+ // 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;
+}
+}
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
new file mode 100644
index 000000000000..1330f48818f6
--- /dev/null
+++ b/cui/source/dialogs/zoom.cxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: zoom.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <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 ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_ZOOM,
+ SID_ATTR_ZOOM,
+ 0
+};
+
+#define SPECIAL_FACTOR ((USHORT)0xFFFF)
+
+// class SvxZoomDialog ---------------------------------------------------
+
+USHORT SvxZoomDialog::GetFactor() const
+{
+ if ( a100Btn.IsChecked() )
+ return 100;
+ if ( aUserBtn.IsChecked() )
+ return (USHORT)aUserEdit.GetValue();
+ else
+ return SPECIAL_FACTOR;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetFactor( USHORT nNewFactor, USHORT 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::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.SetText( rNewTxt );
+ break;
+
+ default:
+ DBG_ERROR( "wrong button number" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::HideButton( USHORT 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:
+ DBG_ERROR( "Falsche Button-Nummer!!!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetLimits( USHORT nMin, USHORT nMax )
+{
+ DBG_ASSERT( nMin < nMax, "invalid limits" );
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetSpinSize( USHORT nNewSpin )
+{
+ aUserEdit.SetSpinSize( nNewSpin );
+}
+
+// -----------------------------------------------------------------------
+
+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 ( FALSE )
+
+{
+#if ENABLE_LAYOUT
+ SetHelpId (SID_ATTR_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
+ USHORT nValue = 100;
+ USHORT nMin = 10;
+ USHORT 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 );
+
+ const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+
+ if ( rItem.ISA(SvxZoomItem) )
+ {
+ const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem;
+ const USHORT nZoom = rZoomItem.GetValue();
+ const SvxZoomType eType = rZoomItem.GetType();
+ const USHORT nValSet = rZoomItem.GetValueSet();
+ USHORT 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 USHORT nZoom = ( (const SfxUInt16Item&)rItem ).GetValue();
+ SetFactor( nZoom );
+ }
+
+ const SfxPoolItem* pViewLayoutItem = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, FALSE, &pViewLayoutItem ) )
+ {
+ const USHORT 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;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxZoomDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn )
+{
+ bModified |= 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 |= TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn )
+{
+ bModified |= 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
+ {
+ DBG_ERROR( "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 |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk )
+{
+ if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ bModified |= 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 )
+ {
+ USHORT 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<USHORT>(aColumnsEdit.GetValue()) );
+ aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "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,
+ (UINT16)aUserEdit.GetValue() ) );
+ EndDialog( RET_OK );
+ }
+ else
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+
diff --git a/cui/source/dialogs/zoom.hrc b/cui/source/dialogs/zoom.hrc
new file mode 100644
index 000000000000..70e488c2893e
--- /dev/null
+++ b/cui/source/dialogs/zoom.hrc
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: zoom.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_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
new file mode 100644
index 000000000000..a27c41d7e1cc
--- /dev/null
+++ b/cui/source/dialogs/zoom.src
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: zoom.src,v $
+ * $Revision: 1.31 $
+ *
+ * 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
+
+ // RID_SVXDLG_ZOOM -------------------------------------------------------
+ModalDialog RID_SVXDLG_ZOOM
+{
+ HelpId = 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
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "~Optimal" ;
+ };
+ RadioButton BTN_WHOLE_PAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "~Fit width and height" ;
+ };
+ RadioButton BTN_PAGE_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text [ en-US ] = "Fit ~width" ;
+ };
+ RadioButton BTN_100
+ {
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text = "~100 %" ;
+ };
+ RadioButton BTN_USER
+ {
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ Text [ en-US ] = "~Variable" ;
+ };
+ MetricField 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
+ {
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton BTN_SINGLE
+ {
+ Pos = MAP_APPFONT ( 130, 27 ) ;
+ Size = MAP_APPFONT ( 106, 10 ) ;
+ Text [ en-US ] = "~Single page" ;
+ };
+ RadioButton BTN_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 130, 41 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "~Columns" ;
+ };
+ MetricField 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
+ {
+ 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
+