diff options
Diffstat (limited to 'binfilter/bf_sfx2')
99 files changed, 30991 insertions, 0 deletions
diff --git a/binfilter/bf_sfx2/source/appl/appimp.hxx b/binfilter/bf_sfx2/source/appl/appimp.hxx new file mode 100644 index 000000000000..a53fbd423552 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/appimp.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXAPPIMP_HXX +#define _SFXAPPIMP_HXX + +#include <tools/time.hxx> +#include <tools/string.hxx> +class MenuBar; +class UniqueIndex; +class BasicManager; +class Timer; +namespace binfilter { + +class SfxTbxCtrlFactArr_Impl; +class SfxStbCtrlFactArr_Impl; +class SfxMenuCtrlFactArr_Impl; +class SfxViewFrameArr_Impl; +class SfxViewShellArr_Impl; +class SfxObjectShellArr_Impl; +class IntroWindow_Impl; +class SfxTemplateDialog; +class SfxDialogLibraryContainer; +class SfxScriptLibraryContainer; +class SfxBasicTestWin; + +struct SfxApplication_Impl +{ + Time aAutoSaveTime; + String aMemExceptionString; + String aResWarningString; + String aResExceptionString; + String aSysResExceptionString; + String aDoubleExceptionString; + String aBasicSourceName; + SfxTbxCtrlFactArr_Impl* pTbxCtrlFac; + SfxStbCtrlFactArr_Impl* pStbCtrlFac; + SfxMenuCtrlFactArr_Impl* pMenuCtrlFac; + SfxViewFrameArr_Impl* pViewFrames; + SfxViewShellArr_Impl* pViewShells; + SfxObjectShellArr_Impl* pObjShells; + MenuBar* pEmptyMenu; // dummy for no-menu + IntroWindow_Impl* pIntro; + UniqueIndex* pEventHdl; // Hook-Liste fuer UserEvents + SfxTemplateDialog* pTemplateDlg; + SfxScriptLibraryContainer* pBasicLibContainer; + SfxDialogLibraryContainer* pDialogLibContainer; + SfxBasicTestWin* pBasicTestWin; + Timer* pAutoSaveTimer; + USHORT nDocNo; // Laufende Doc-Nummer (AutoName) + USHORT nWarnLevel; + BOOL bConfigLoaded:1; + BOOL bAutoSaveNow:1; // ist TRUE, wenn der Timer abgelaufen ist, wenn die App nicht aktiv war +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/imestatuswindow.hxx b/binfilter/bf_sfx2/source/appl/imestatuswindow.hxx new file mode 100644 index 000000000000..1d2de0e5c731 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/imestatuswindow.hxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if !defined INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX +#define INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX + +#include "com/sun/star/beans/XPropertyChangeListener.hpp" +#include "cppuhelper/implbase1.hxx" + +namespace com { namespace sun { namespace star { + namespace beans { class XPropertySet; } + namespace lang { class XMultiServiceFactory; } +} } } +namespace binfilter { + +class SfxApplication; + +namespace sfx2 { namespace appl { + +// The MS compiler needs this typedef work-around to accept the using +// declarations within ImeStatusWindow: +typedef cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener > +ImeStatusWindow_Impl; + +/** Control the behavior of any (platform-dependent) IME status windows. + + The decision of whether a status window shall be displayed or not can be + stored permanently in the configuration (under key + org.openoffice.office.Common/I18N/InputMethod/ShowStatusWindow; if that + entry is nil, VCL is asked for a default). + */ +class ImeStatusWindow: private ImeStatusWindow_Impl +{ +public: + ImeStatusWindow(SfxApplication & rApplication, + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > const & + rServiceFactory); + + /** Set up VCL according to the configuration. + + Is it not strictly required that this method is called exactly once + (though that will be the typical use). + + Must only be called with the Solar mutex locked. + */ + void init(); + + // At least the Solaris "CC: Forte Developer 7 C++ 5.4 2002/03/09" compiler + // does not accept the following using-declarations for virtual functions, + // so use (deprecated) access declarations instead: + /*using*/ ImeStatusWindow_Impl::acquire; + /*using*/ ImeStatusWindow_Impl::release; + using ImeStatusWindow_Impl::operator new; + using ImeStatusWindow_Impl::operator delete; + +private: + ImeStatusWindow(ImeStatusWindow &); // not implemented + void operator =(ImeStatusWindow); // not implemented + + virtual ~ImeStatusWindow(); + + virtual void SAL_CALL + disposing(::com::sun::star::lang::EventObject const & rSource) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL + propertyChange(::com::sun::star::beans::PropertyChangeEvent const & rEvent) + throw (::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getConfig(); + + SfxApplication & m_rApplication; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xServiceFactory; + + osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xConfig; + bool m_bDisposed; +}; + +} } + +}//end of namespace binfilter +#endif // INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/makefile.mk b/binfilter/bf_sfx2/source/appl/makefile.mk new file mode 100644 index 000000000000..145e05107de2 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/makefile.mk @@ -0,0 +1,85 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_appl + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# w.g. compilerbugs +.IF "$(GUI)"=="WNT" +.IF "$(COM)"!="GCC" +CFLAGS+=-Od +.ENDIF +.ENDIF + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_appuno.obj \ + $(SLO)$/sfx2_appmain.obj \ + $(SLO)$/sfx2_appopen.obj \ + $(SLO)$/sfx2_appinit.obj \ + $(SLO)$/sfx2_appmisc.obj \ + $(SLO)$/sfx2_appcfg.obj \ + $(SLO)$/sfx2_appquit.obj \ + $(SLO)$/sfx2_appdata.obj \ + $(SLO)$/sfx2_app.obj \ + $(SLO)$/sfx2_appbas.obj \ + $(SLO)$/sfx2_appdde.obj \ + $(SLO)$/sfx2_sfxdll.obj \ + $(SLO)$/sfx2_module.obj \ + $(SLO)$/sfx2_dlgcont.obj \ + $(SLO)$/sfx2_namecont.obj \ + $(SLO)$/sfx2_scriptcont.obj \ + $(SLO)$/sfx2_imestatuswindow.obj + +EXCEPTIONSFILES=\ + $(SLO)$/sfx2_appopen.obj \ + $(SLO)$/sfx2_appmain.obj \ + $(SLO)$/sfx2_appmisc.obj \ + $(SLO)$/sfx2_appinit.obj \ + $(SLO)$/sfx2_appcfg.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/appl/sfx2_app.cxx b/binfilter/bf_sfx2/source/appl/sfx2_app.cxx new file mode 100644 index 000000000000..f75bb1d1d5af --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_app.cxx @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if defined UNX +#include <limits.h> +#else // UNX +#include <stdlib.h> +#define PATH_MAX _MAX_PATH +#endif // UNX + +#include <bf_svtools/svdde.hxx> +#include <tools/urlobj.hxx> + +#define _SVSTDARR_STRINGSDTOR + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <rtl/logfile.hxx> + +#include "appuno.hxx" +#include "progress.hxx" +#include "docfac.hxx" +#include "cfgmgr.hxx" +#include "fltfnc.hxx" + +#include "app.hxx" +#include "appdata.hxx" +#include "interno.hxx" +#include "event.hxx" +#include "appimp.hxx" +#include "imestatuswindow.hxx" +#include "docfilt.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +#include "bf_so3/staticbaseurl.hxx" +#include <bf_so3/ipenv.hxx> + +namespace binfilter { + +// Static member +SfxApplication* SfxApplication::pApp = NULL; + +/*N*/ SfxApplication* SfxApplication::GetOrCreate() +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); +/*N*/ +/*N*/ // SFX on demand +/*N*/ if ( !pApp ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference < ::com::sun::star::lang::XInitialization > +/*N*/ xWrp(::legacy_binfilters::getLegacyProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.office.OfficeWrapper")), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ xWrp->initialize( ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any >() ); +/*N*/ } +/*N*/ +/*N*/ return pApp; +/*N*/ } + +/*N*/ void SfxApplication::SetApp( SfxApplication* pSfxApp ) +/*N*/ { +/*N*/ static ::osl::Mutex aProtector; +/*N*/ ::osl::MutexGuard aGuard( aProtector ); +/*N*/ +/*N*/ DBG_ASSERT( !pApp, "SfxApplication already created!" ); +/*N*/ if ( pApp ) +/*?*/ DELETEZ( pApp ); +/*N*/ +/*N*/ pApp = pSfxApp; +/*N*/ +/*N*/ // at the moment a bug may occur when Initialize_Impl returns FALSE, but this is only temporary because all code that may cause such a +/*N*/ // fault will be moved outside the SFX +/*N*/ pApp->Initialize_Impl(); +/*N*/ } + +/*N*/ SfxApplication::SfxApplication() +/*N*/ : _nFeatures( ULONG_MAX ) +/*N*/ , pImp( 0 ) +/*N*/ , pAppData_Impl( 0 ) +/*N*/ , pCfgMgr( 0 ) +/*N*/ , bInInit( sal_False ) +/*N*/ , bInExit( sal_False ) +/*N*/ , bDowning( sal_True ) +/*N*/ , bCreatedExternal( sal_False ) +/*N*/ , pOptions( 0 ) +/*N*/ { +/*N*/ +/*N*/ pImp = new SfxApplication_Impl; +/*N*/ pImp->bConfigLoaded = sal_False; +/*N*/ pImp->pEmptyMenu = 0; +/*N*/ pImp->nDocNo = 0; +/*N*/ pImp->pIntro = 0; +/*N*/ pImp->pObjShells = 0; +/*N*/ pImp->bAutoSaveNow = sal_False; +/*N*/ pImp->pBasicLibContainer = 0; +/*N*/ pImp->pDialogLibContainer = 0; +/*N*/ pImp->pBasicTestWin = 0; +/*N*/ pImp->nWarnLevel = 0; +/*N*/ pImp->pAutoSaveTimer = 0; +/*N*/ // Create instance of SvtSysLocale _after_ setting the locale at the application, +/*N*/ // so that it can initialize itself correctly. +/*N*/ +/*N*/ pAppData_Impl = new SfxAppData_Impl( this ); +/*N*/ pAppData_Impl->m_xImeStatusWindow->init(); +/*N*/ pApp->PreInit(); +/*N*/ +/*N*/ pCfgMgr = new SfxConfigManager; +/*N*/ } + +/*N*/ SfxApplication::~SfxApplication() +/*N*/ { +/*N*/ if ( !bDowning ) +/*?*/ Deinitialize(); +/*N*/ +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); +/*N*/ +/*N*/ // better call SvFactory::DeInit, because this will remove ALL factories, +/*N*/ // but it will fail because the ConfigManager has a storage that is a SvObject +/*N*/ SfxObjectFactory::RemoveAll_Impl(); +/*N*/ +/*N*/ // UCB_Helper::Deinitialize(); +/*N*/ +/*N*/ delete pCfgMgr; +/*N*/ delete pImp; +/*N*/ delete pAppData_Impl; +/*N*/ pApp = 0; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ const SfxFilter* SfxApplication::GetFilter +/*N*/ ( +/*N*/ const SfxObjectFactory &rFact, +/*N*/ const String &rFilterName +/*N*/ ) const +/*N*/ { +/*N*/ DBG_ASSERT( rFilterName.Search( ':' ) == STRING_NOTFOUND, +/*N*/ "SfxApplication::GetFilter erwartet unqualifizierte Namen" ); +/*N*/ return rFact.GetFilterContainer()->GetFilter4FilterName(rFilterName); +/*N*/ } + +//--------------------------------------------------------------------- + +/*N*/ ResMgr* SfxApplication::CreateResManager( const char *pPrefix ) +/*N*/ { +/*N*/ String aMgrName = String::CreateFromAscii( pPrefix ); +/*N*/ return ResMgr::CreateResMgr(U2S(aMgrName)); +/*N*/ } + +//------------------------------------------------------------------------ + +/*N*/ void SfxApplication::ReleaseIndex(sal_uInt16 i) +/*N*/ { +/*N*/ pAppData_Impl->aIndexBitSet.ReleaseIndex(i-1); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ SfxObjectShellArr_Impl& SfxApplication::GetObjectShells_Impl() const +/*N*/ { +/*N*/ return *pImp->pObjShells; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_app.src b/binfilter/bf_sfx2/source/appl/sfx2_app.src new file mode 100644 index 000000000000..a73e37cfeb5c --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_app.src @@ -0,0 +1,2377 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + + // include ------------------------------------------------------------------ + +#include "sfx.hrc" +#include "app.hrc" +#include "helpid.hrc" + +InfoBox RID_DOCALREADYLOADED_DLG +{ + Message [ de ] = "Das Dokument war bereits geladen und wurde aktiviert." ; + Message [ en-US ] = "Document already open." ; + Message [ x-comment ] = " "; + Message[ pt ] = "O documento já se encontra aberto e foi activado."; + Message[ ru ] = "Документ уже открыт."; + Message[ el ] = "Το ÎγγÏαφο είχε ήδη φοÏτωθεί και ενεÏγοποιήθηκε."; + Message[ nl ] = "Document is reeds geladen en geactiveerd."; + Message[ fr ] = "Document déjà chargé et activé."; + Message[ es ] = "El documento ya está cargado y activado."; + Message[ fi ] = "Asiakirja on jo avattu."; + Message[ ca ] = "Document ja obert."; + Message[ it ] = "Documento già aperto ed attivato."; + Message[ sk ] = "Dokument je už otvorený."; + Message[ da ] = "Dokumentet var allerede indlæst og blev aktiveret."; + Message[ sv ] = "Dokumentet var redan laddat och har aktiverats."; + Message[ pl ] = "Dokument jest już otwarty."; + Message[ pt-BR ] = "O documento já está aberto e ativado."; + Message[ th ] = "เปิดเà¸à¸à¸ªà¸²à¸£à¹à¸¥à¹‰à¸§"; + Message[ ja ] = "ドã‚ュメントã¯ã™ã§ã«èªã¿è¾¼ã¾ã‚Œã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«ãªã£ã¦ã„ã¾ã™ã€‚"; + Message[ ko ] = "문서는 로드 ë° í™œì„±í™”ë˜ì—ˆìŠµë‹ˆë‹¤."; + Message[ zh-CN ] = "å·²ç»è£…入这个文件并处于使用状æ€ã€‚"; + Message[ zh-TW ] = "已經載入這個檔案並處於使用狀態。"; + Message[ tr ] = "Belge zaten yüklü ve açık."; + Message[ hi-IN ] = "लेखपतà¥à¤° पहिले से ही खà¥à¤²à¤¾ है ।"; + Message[ ar ] = "المل٠كان Ù…Øملاً بالÙعل وتم تنشيطه."; + Message[ he ] = "‮המסמך כבר פתוח.‬"; +}; + +ErrorBox RID_CANTLOADDOC_DLG +{ + Message [ de ] = "Das Dokument kann nicht geladen werden." ; + Message [ en-US ] = "Cannot open document." ; + Message [ x-comment ] = " "; + Message[ pt ] = "ImpossÃvel abrir o documento."; + Message[ ru ] = "Ðевозможно открыть документ."; + Message[ el ] = "Δεν είναι δυνατόν να ανοιχθεί το ÎγγÏαφο."; + Message[ nl ] = "Het document kan niet worden geopend."; + Message[ fr ] = "Impossible de charger le document."; + Message[ es ] = "No es posible cargar el documento."; + Message[ fi ] = "Asiakirjan avaaminen ei onnistu."; + Message[ ca ] = "No es pot obrir el document."; + Message[ it ] = "Impossibile aprire il documento."; + Message[ sk ] = "Dokument nie je možné otvoriÅ¥"; + Message[ da ] = "Det er ikke muligt at indlæse dokumentet."; + Message[ sv ] = "Dokumentet kan inte laddas."; + Message[ pl ] = "Nie można otworzyć dokumentu."; + Message[ pt-BR ] = "Não é possÃvel abrir o documento."; + Message[ th ] = "ไม่สามารถเปิดเà¸à¸à¸ªà¸²à¸£à¹„ด้"; + Message[ ja ] = "ドã‚ュメントã¯èªã¿è¾¼ã¿ã§ãã¾ã›ã‚“。"; + Message[ ko ] = "문서를 ë¡œë“œí• ìˆ˜ 없습니다."; + Message[ zh-CN ] = "æ— æ³•è£…å…¥è¿™ä¸ªæ–‡æ¡£ã€‚"; + Message[ zh-TW ] = "無法載入這個文件。"; + Message[ tr ] = "Belge yüklenemiyor."; + Message[ hi-IN ] = "लेखपतà¥à¤° को नहीं खोल सकते है ।"; + Message[ ar ] = "لا يمكن تØميل المستند."; + Message[ he ] = "â€®×œ× × ×™×ª×Ÿ לפתוח ×ת המסמך.‬"; +}; + +ErrorBox MSG_ERR_READ_CFG +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Fehler beim Lesen der Konfiguration." ; + Message [ en-US ] = "Error reading configuration file." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Erro durante a leitura do ficheiro de configuração."; + Message[ ru ] = "Ошибка Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ñ„Ð°Ð¹Ð»Ð° конфигурации."; + Message[ el ] = "Σφάλμα κατά την ανάγνωση του αÏχείου διαμόÏφωσης"; + Message[ nl ] = "Fout bij lezen van configuratiebestand."; + Message[ fr ] = "Erreur de lecture de la configuration."; + Message[ es ] = "Error al leer el archivo de configuración."; + Message[ fi ] = "Kokoonpanotiedoston lukemisessa on ilmennyt virhe."; + Message[ ca ] = "S'ha produït un error al llegir el fitxer de configuració."; + Message[ it ] = "Errore durante la lettura del file di configurazione."; + Message[ sk ] = "Chyba pri ÄÃtanàz konfiguraÄnéÂho súboru."; + Message[ da ] = "Fejl under læsning af konfiguration."; + Message[ sv ] = "Fel vid läsning av konfiguration."; + Message[ pl ] = "BÅ‚Ä…d odczytu pliku konfiguracyjnego."; + Message[ pt-BR ] = "Ocorreu um erro ao ler o arquivo de configuração."; + Message[ th ] = "à¸à¹ˆà¸²à¸™à¹à¸Ÿà¹‰à¸¡à¹‚ครงà¹à¸šà¸šà¸œà¸´à¸”พลาด"; + Message[ ja ] = "è¨å®šãƒ•ã‚¡ã‚¤ãƒ«èªã¿å–ã‚Šã®éš›ã®ã‚¨ãƒ©ãƒ¼ã€‚"; + Message[ ko ] = "구성 파ì¼ì„ ì½ë˜ 중 오류"; + Message[ zh-CN ] = "在读å–é…置文件时å‘生错误。"; + Message[ zh-TW ] = "在讀å–é…置檔案時發生錯誤。"; + Message[ tr ] = "Konfigürasyon dosyası okunurken hata oluÅŸtu."; + Message[ hi-IN ] = "Error reading configuration file."; + Message[ ar ] = "Øدث خطأ أثناء قراءة مل٠التكوين."; + Message[ he ] = "‮×רעה שגי××” בעת קרי×ת קובץ התצורה.‬"; +}; + +ErrorBox MSG_ERR_WRITE_CFG +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Fehler beim Schreiben der Konfiguration." ; + Message [ en-US ] = "Error writing configuration file." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Erro ao gravar o ficheiro de configuração."; + Message[ ru ] = "Ошибка запиÑи файла конфигурации."; + Message[ el ] = "Σφάλμα κατά την εγγÏαφή του αÏχείου διαμόÏφωσης."; + Message[ nl ] = "Fout bij schrijven van configuratiebestand."; + Message[ fr ] = "Erreur lors de l'écriture du fichier de configuration."; + Message[ es ] = "Error al escribir el archivo de configuración."; + Message[ fi ] = "Kokoonpanotiedostoon kirjoittamisessa on ilmennyt virhe."; + Message[ ca ] = "S'ha produït un error en escriure al fitxer de configuració."; + Message[ it ] = "Errore durante la scrittura del file di configurazione."; + Message[ sk ] = "Chyba pri zápise do konfiguraÄného súboru."; + Message[ da ] = "Fejl under skrivning af konfiguration."; + Message[ sv ] = "Fel vid skrivning av konfigurationsfil."; + Message[ pl ] = "BÅ‚Ä…d zapisu pliku konfiguracyjnego."; + Message[ pt-BR ] = "Ocorreu um erro ao gravar o arquivo de configuração."; + Message[ th ] = "เขียนà¹à¸Ÿà¹‰à¸¡à¹‚ครงà¹à¸šà¸šà¸œà¸´à¸”พลาด"; + Message[ ja ] = "è¨å®šã‚’èªã¿è¾¼ã‚€éš›ã®ã‚¨ãƒ©ãƒ¼ã€‚"; + Message[ ko ] = "구성 파ì¼ì„ ì“°ë˜ ì¤‘ 오류"; + Message[ zh-CN ] = "在写入é…置文件时å‘出错误。"; + Message[ zh-TW ] = "在寫入é…置檔案時發出錯誤。"; + Message[ tr ] = "Konfigürasyon dosyasına yazılırken hata oluÅŸtu."; + Message[ hi-IN ] = "रूप-रेखा फाइल को लिखने के समय गलती ।"; + Message[ ar ] = "Øدث خطأ أثناء كتابة مل٠التكوين."; + Message[ he ] = "‮×רעה שגי××” בעת כתיבה לקובץ התצורה.‬"; +}; + +ErrorBox MSG_ERR_OPEN_CFG +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Fehler beim Öffnen der Konfiguration." ; + Message [ en-US ] = "Error opening configuration file." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Erro ao abrir o ficheiro de configuração."; + Message[ ru ] = "Ошибка Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ñ„Ð°Ð¹Ð»Ð° конфигурации."; + Message[ el ] = "Σφάλμα κατά το άνοιγμα του αÏχείου διαμόÏφωσης."; + Message[ nl ] = "Fout bij openen van configuratiebestand."; + Message[ fr ] = "Erreur lors de l'ouverture du fichier de configuration."; + Message[ es ] = "Error al abrir el archivo de configuración."; + Message[ fi ] = "Kokoonpanotiedoston avaamisessa on ilmennyt virhe."; + Message[ ca ] = "S'ha produït un error al obrir el fitxer de configuració."; + Message[ it ] = "Errore durante l'apertura del file di configurazione."; + Message[ sk ] = "Chyba pri otváranàkonfiguraÄného súboru."; + Message[ da ] = "Fejl ved Ã¥bning af konfiguration."; + Message[ sv ] = "Fel vid öppning av konfiguration."; + Message[ pl ] = "BÅ‚Ä…d otwierania pliku konfiguracji."; + Message[ pt-BR ] = "Ocorreu um erro ao abrir o arquivo de configuração."; + Message[ th ] = "เปิดà¹à¸Ÿà¹‰à¸¡à¹‚ครงà¹à¸šà¸šà¸œà¸´à¸”พลาด"; + Message[ ja ] = "è¨å®šã‚’é–‹ãéš›ã®ã‚¨ãƒ©ãƒ¼ï½¡"; + Message[ ko ] = "구성 파ì¼ì„ ì—´ë˜ ì¤‘ 오류"; + Message[ zh-CN ] = "在打开é…置文件时å‘生错误。"; + Message[ zh-TW ] = "在開啟é…置檔時發生錯誤。"; + Message[ tr ] = "Konfigürasyon dosyası açılırken hata oluÅŸtu."; + Message[ hi-IN ] = "रूप-रेखा फाइल को खोलने के समय गलती ।"; + Message[ ar ] = "Øدث خطأ أثناء ÙØªØ Ù…Ù„Ù Ø§Ù„ØªÙƒÙˆÙŠÙ†."; + Message[ he ] = "‮שגי××” בעת פתיחת קובץ התצורה.‬"; +}; + +ErrorBox MSG_ERR_FILETYPE_CFG +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Datei ist keine Konfigurationsdatei." ; + Message [ en-US ] = "File is not a configuration file." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Este ficheiro não é um ficheiro de configuração."; + Message[ ru ] = "Файл не ÑвлÑетÑÑ Ñ„Ð°Ð¹Ð»Ð¾Ð¼ конфигурации."; + Message[ el ] = "Το αÏχείο δεν είναι αÏχείο διαμόÏφωσης."; + Message[ nl ] = "Dit bestand is geen configuratiebestand."; + Message[ fr ] = "Ce fichier n'est pas un fichier de configuration."; + Message[ es ] = "El archivo no es un archivo de configuración."; + Message[ fi ] = "Tiedosto ei ole kokoonpanotiedosto."; + Message[ ca ] = "Aquest no és un fitxer de configuració."; + Message[ it ] = "Il file non è un file di configurazione."; + Message[ sk ] = "Súbor nie je konfiguraÄným súborom."; + Message[ da ] = "Filen er ikke en konfigurationsfil."; + Message[ sv ] = "Filen är inte en konfigurationsfil."; + Message[ pl ] = "Nie jest to plik konfiguracyjny."; + Message[ pt-BR ] = "O arquivo não é um arquivo de configuração."; + Message[ th ] = "à¹à¸Ÿà¹‰à¸¡à¹„ม่เป็นà¹à¸Ÿà¹‰à¸¡à¹‚ครงà¹à¸šà¸š"; + Message[ ja ] = "ファイルã¯è¨å®šãƒ•ã‚¡ã‚¤ãƒ«ã§ã¯ã‚ã‚Šã¾ã›ã‚“。"; + Message[ ko ] = "구성 파ì¼ì´ 아닙니다."; + Message[ zh-CN ] = "文件ä¸æ˜¯é…置文件。"; + Message[ zh-TW ] = "檔案ä¸æ˜¯é…置檔案。"; + Message[ tr ] = "Dosya, konfigürasyon dosyası deÄŸil."; + Message[ hi-IN ] = "फाइल रूप-रेखा फाइल नहीं है ।"; + Message[ ar ] = "هذا المل٠ليس مل٠تكوين."; + Message[ he ] = "‮הקובץ ××™× ×• קובץ תצורה.‬"; +}; + +ErrorBox MSG_ERR_VERSION_CFG +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Konfigurationsdatei hat falsche Version." ; + Message [ en-US ] = "Configuration file contains the wrong version." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Versão errada do ficheiro de configuração."; + Message[ ru ] = "Файл конфигурации Ñодержит неправильную верÑию."; + Message[ el ] = "Λάθος Îκδοση του αÏχείο διαμόÏφωσης."; + Message[ nl ] = "Foutieve versie van configuratiebestand."; + Message[ fr ] = "Version incorrecte du fichier de configuration."; + Message[ es ] = "El archivo de configuración tiene una versión falsa."; + Message[ fi ] = "Kokoonpanotiedostossa on väärä versio."; + Message[ ca ] = "El fitxer de configuració té una versió falsa."; + Message[ it ] = "Il file di configurazione è di versione errata."; + Message[ sk ] = "KonfiguraÄný súbor obsahuje Å¡patnú verziu."; + Message[ da ] = "Konfigurationsfilen indeholder forkert version."; + Message[ sv ] = "Konfigurationsfil har fel version."; + Message[ pl ] = "Plik konfiguracyjny ma nieprawidÅ‚owÄ… wersjÄ™."; + Message[ pt-BR ] = "Versão incorreta do arquivo de configuração."; + Message[ th ] = "à¹à¸Ÿà¹‰à¸¡à¹‚ครงà¹à¸šà¸šà¸¡à¸µà¹€à¸§à¸à¸£à¹Œà¸Šà¸±à¹ˆà¸™à¹„ม่ถูà¸à¸•à¹‰à¸à¸‡"; + Message[ ja ] = "è¨å®šãƒ•ã‚¡ã‚¤ãƒ«ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒæ£ã—ãã‚ã‚Šã¾ã›ã‚“。"; + Message[ ko ] = "구성 파ì¼ì˜ ë²„ì „ì´ í‹€ë¦½ë‹ˆë‹¤."; + Message[ zh-CN ] = "é…置文件版本错误。"; + Message[ zh-TW ] = "é…置檔案版本錯誤。"; + Message[ tr ] = "Konfigürasyon dosyasının sürümü yanlış."; + Message[ hi-IN ] = "रूप-रेखा फाइल में गलत अनà¥à¤µà¤¾à¤¦ है ।"; + Message[ ar ] = "إصدار خاطئ لمل٠التكوين."; + Message[ he ] = "‮קובץ התצורה מכיל גרסה ×œ× × ×›×•× ×”.‬"; +}; + +ErrorBox MSG_ERR_WRITE_SBL +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Fehler beim Schreiben der BASIC-Bibliothek in\n'@'." ; + Message [ en-US ] = "Error recording BASIC library in\n'@'." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Erro ao gravar a biblioteca BASIC em \n'@'."; + Message[ ru ] = "Ошибка запиÑи библиотеки BASIC в \n'@'."; + Message[ el ] = "Σφάλμα κατά την εγγÏαφή της βιβλιοθήκης BASIC στο\n'@'."; + Message[ nl ] = "Fout bij schrijven van BASIC-bibliotheek in\n'@'."; + Message[ fr ] = "Erreur lors de l'écriture de la bibliothèque BASIC dans \n'@'."; + Message[ es ] = "Error al escribir la biblioteca BASIC en\n'@'."; + Message[ fi ] = "On ilmennyt virhe tallennettaessa BASIC-kirjastoa kohteessa \n'@'."; + Message[ ca ] = "S'ha produït un error al escriure la biblioteca BASIC a\n'@'."; + Message[ it ] = "Errore durante la scrittura della libreria BASIC nel file\n'@'."; + Message[ sk ] = "Chyba pri zaznamenávanà BASIC knižnice do\n'@'."; + Message[ da ] = "Fejl under skrivning af BASIC-biblioteket til \n'@'."; + Message[ sv ] = "Fel vid skrivning av BASIC-bibliotek i\n'@'."; + Message[ pl ] = "BÅ‚Ä…d zapisu biblioteki BASIC w\n'@'."; + Message[ pt-BR ] = "Ocorreu um erro ao gravar a biblioteca BASIC em \n'@'."; + Message[ th ] = "บันทึà¸à¸„ลัง BASIC ใน\n'@' ผิดพลาด"; + Message[ ja ] = "BASIC ライブラリをèªã¿è¾¼ã‚€éš›ã®ã‚¨ãƒ©ãƒ¼ï½¡\nèªã¿è¾¼ã¿å…ˆ:'@'"; + Message[ ko ] = "BASIC ë¼ì´ë¸ŒëŸ¬ë¦¬\n'@'ì— ì“°ê¸°ì‹œì— ì˜¤ë¥˜ ."; + Message[ zh-CN ] = "BASIC 库在写入\n'@' æ—¶å‘生错误。"; + Message[ zh-TW ] = "BASIC 庫在寫入\n'@' 時發生錯誤。"; + Message[ tr ] = "BASIC kitaplığı, \n'@' içine kaydedilirken hata oluÅŸtu."; + Message[ hi-IN ] = "'@'\n में BASIC को रेकोरà¥à¤¡à¤¿à¤¨à¥à¤— करने के समय गलती ।"; + Message[ ar ] = "Øدث خطأ أثناء كتابة مكتبة BASIC ÙÙŠ\n'@'."; + Message[ he ] = "‮שגו××” בעת הקלטת ספרית הבייסיק ב \n'@'.‬"; +}; + +ErrorBox MSG_SIGNAL +{ + BUTTONS = WB_YES_NO ; + DEFBUTTON = WB_DEF_YES ; + Message [ de ] = "Es ist ein unerwarter Anwendungsfehler aufgetreten!\nSie können jetzt auf eigene Gefahr hin versuchen,\nalle offenen Dokumente zu sichern!\n\nSoll versucht werden, Ihre Arbeit zu sichern, bevor die Applikation beendet wird?" ; + Message [ en-US ] = "An unexpected program error has occurred.\n\nDo you want to try to save your changes in all open documents before the program is terminated?" ; + Message [ x-comment ] = " "; + Message[ pt ] = "Surgiu um erro de programa inesperado!\n\nPoderá agora, sob o seu próprio risco, \ntentar guardar todos os documentos abertos.\nTentar guardar o seu trabalho antes que a aplicação seja fechada?"; + Message[ ru ] = "ÐÐµÐ¾Ð¶Ð¸Ð´Ð°Ð½Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°. Сохранить вÑе \nоткрытые документы прежде чем программа будет закрыта?"; + Message[ el ] = "ΠαÏουσιάστηκε μη αναμενόμενο σφάλμα Ï€ÏογÏάμματος.\n\nΘÎλετε να δοκιμάσετε να αποθηκεÏσετε τις αλλαγÎÏ‚ σας σε όλα τα ανοικτά ÎγγÏαφα Ï€Ïιν τον τεÏματισμό του Ï€ÏογÏάμματος;"; + Message[ nl ] = "Er is een onverwachte programmafout opgetreden!\nU kunt nu op eigen risico proberen\nalle geopende documenten op te slaan!\n\nWilt u proberen uw werk op te slaan voordat de toepassing wordt beëindigd?"; + Message[ fr ] = "Erreur d'application inattendue !\nVous pouvez tout de même essayer\nd'enregistrer les documents ouverts !\n\nEnregistrer votre travail avant fermeture de l'application ?"; + Message[ es ] = "¡Se ha producido un error inesperado de la aplicación!\nUsted puede ahora, a riesgo propio, intentar\nsalvar todos los documentos abiertos!\n\n¿Desea guardar su trabajo antes de cerrar la aplicación?"; + Message[ fi ] = "On ilmennyt odottamaton ohjelmavirhe.\n\nHaluatko yrittää tallentaa kaikkien avointen asiakirjojen muutokset ennen kuin ohjelma lopetetaan?"; + Message[ ca ] = "S'ha produït un error inesperat a l'aplicació!\nAra podeu, assumint el risc, intentar\nsalvar tots els documents oberts!\n\nVoleu desar la feina abans de tancar l'aplicació?"; + Message[ it ] = "Nell'applicazione si è verificato un errore inatteso!\nAdesso potete provare, a proprio rischio, di\nsalvare tutti i documenti aperti!\n\nVolete che si provi a salvare il lavoro prima di chiudere l'applicazione?"; + Message[ sk ] = "V programe nastala neoÄakávaná chyba.\n\n Prajete si skúsiÅ¥ uložiÅ¥ zmeny vo vÅ¡etkých otvorených dokumentoch pred ukonÄenÃm programu?"; + Message[ da ] = "Der opstod en uventet programfejl\nDu kan pÃ¥ eget ansvar prøve pÃ¥ at\ngemme alle Ã¥bne dokumenter!\n\nVil du prøve pÃ¥ at gemme dine dokumenter, før programmet afsluttes?"; + Message[ sv ] = "Ett oväntat programfel har uppstÃ¥tt!\nDu kan nu pÃ¥ eget bevÃ¥g försöka\nspara alla öppna dokument!\n\nVill du försöka spara alla ändringar i dokumenten innan programmet avslutas?"; + Message[ pl ] = "WystÄ…piÅ‚ nieoczekiwany bÅ‚Ä…d w programie.\nCzy przed zakoÅ„czeniem programu chcesz spróbować zapisać zmiany we wszystkich otwartych dokumentach?"; + Message[ pt-BR ] = "Ocorreu um erro de programa inesperado!\n\nDeseja tentar salvar as mudanças nos documentos abertos antes do programa encerrar?"; + Message[ th ] = "เà¸à¸´à¸”ข้à¸à¸œà¸´à¸”พลาดที่ไม่คาดคิดà¸à¸±à¸šà¹‚ปรà¹à¸à¸£à¸¡ \n\nคุณต้à¸à¸‡à¸à¸²à¸£à¸šà¸±à¸™à¸—ึà¸à¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡à¹ƒà¸™à¹€à¸à¸à¸ªà¸²à¸£à¸—ี่ nเปิดà¸à¸¢à¸¹à¹ˆà¸—ั้งหมดà¸à¹ˆà¸à¸™à¹‚ปรà¹à¸à¸£à¸¡à¸–ูà¸à¸¢à¸à¹€à¸¥à¸´à¸à¸«à¸£à¸·à¸à¹„ม่?"; + Message[ ja ] = "予期ã—ãªã„プãƒã‚°ãƒ©ãƒ エラーãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚\nリスクã¯ã‚ã‚Šã¾ã™ãŒ\né–‹ã‹ã‚Œã¦ã„るドã‚ュメントをã™ã¹ã¦ä¿å˜ã—ã¾ã™ã€‚\n\nアプリケーションを終了ã™ã‚‹å‰ã«ã€ä½œæ¥ä¸ã®ãƒ‰ã‚ュメントをä¿å˜ã—ã¾ã™ã‹ã€‚"; + Message[ ko ] = "예기치 ì•Šì€ ì‘ìš© 프로그램 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤.\n사용ìžì—게 위험 ë¶€ë‹´ì´ ìžˆì§€ë§Œ ì—´ë ¤ìžˆëŠ” ëª¨ë“ ë¬¸ì„œì˜ ì €ìž¥ì„ ì‹œë„í•´ ë³¼ 수 있습니다!\n\n ì‘ìš© í”„ë¡œê·¸ëž¨ì„ ì¢…ë£Œí•˜ê¸° ì „ì— ìž‘ì—… ë‚´ìš©ì„ ì €ìž¥í•˜ê² ìŠµë‹ˆê¹Œ?"; + Message[ zh-CN ] = "å‘生了一个æ„外的程åºé”™è¯¯ï¼\n您现在å¯ä»¥å°è¯•ä¿å˜æ‰€æœ‰è¢«æ‰“开的文件ï¼\n您è¦åœ¨å…³é—这个应用程åºä¹‹å‰ä¿å˜æ‰€æœ‰çš„文件å—?"; + Message[ zh-TW ] = "發生了一個æ„外的程å¼éŒ¯èª¤ï¼\n您ç¾åœ¨å¯ä»¥å˜—試ä¿å˜æ‰€æœ‰è¢«é–‹å•Ÿçš„檔案ï¼\n您è¦åœ¨é—œé–‰é€™å€‹æ‡‰ç”¨ç¨‹å¼ä¹‹å‰å„²å˜æ‰€æœ‰çš„檔案?"; + Message[ tr ] = "Beklenmeyen bir program hatası oluÅŸtu!\nÅžu an açık olan tüm belgeleri\nkaydetmeyi deneyebilirsiniz!\n\nUygulama kapatılmadan önce belgeleriniz kaydedilmeye çalışılsın mı?"; + Message[ hi-IN ] = "पà¥à¤°à¥‹à¤—à¥à¤°à¤¾à¤®à¥ में आकसà¥à¤®à¤¿à¤• गलती घटित हà¥à¤† ।\n\nआप पà¥à¤°à¥‹à¤—à¥à¤°à¤¾à¤®à¥ को अंत करने से पहिले सब खà¥à¤²à¤¾ हà¥à¤† लेखपतà¥à¤°à¥‹à¤‚ में परिवरà¥à¤¤à¤¨à¥‹à¤‚ को संचित करना चाहते है ?"; + Message[ ar ] = "Øدث خطأ تطبيق غير متوقع!\nيمكنك الآن، على مسئوليتك الخاصة، Ù…Øاولة ØÙظ \nكل المستندات المÙتوØØ©!\n\nهل تريد Ù…Øاولة ØÙظ عملك، قبل إنهاء التطبيق؟"; + Message[ he ] = "‮×רעה שגי××” בלתי צפויה ×‘×ª×•×›× ×™×ª.\n\n×”×× ×œ× ×¡×•×ª לשמור ×ת ×”×©×™× ×•×™× ×‘×›×œ ×”×ž×¡×ž×›×™× ×”×¤×ª×•×—×™× ×œ×¤× ×™ סגירת ×”×ª×•×›× ×™×ª?‬"; +}; + +ErrorBox MSG_ERR_WEBBROWSER_NOT_STARTED +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Beim Starten des Web-Browsers ist ein Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen von %PRODUCTNAME unter 'Extras - Optionen - %PRODUCTNAME - Hilfsprogramme' und die Einstellungen Ihres Web-Browsers." ; + Message [ en-US ] = "An error occurred in starting the web browser. Please check the %PRODUCTNAME settings under 'Tools - Options - %PRODUCTNAME - External Programs' and the settings for your web browser."; + Message[ pt ] = "An error occurred in starting a webbrowser.\nPlease check the %PRODUCTNAME and webbrowser settings."; + Message[ ru ] = "Ошибка запуÑка веб-браузера.\nПроверьте наÑтройки %PRODUCTNAME и веб-браузера."; + Message[ el ] = "ΠαÏουσιάστηκε σφάλμα κατά την εκκίνηση του Ï€ÏογÏάμματος πεÏιήγησης στο web.\nΕλÎγξτε τις Ïυθμίσεις του %PRODUCTNAME και του Ï€ÏογÏάμματος πεÏιήγησης στο web."; + Message[ nl ] = "Fout bij starten van webbrowser.\nControleer de instellingen van %PRODUCTNAME en van de webbrowser."; + Message[ fr ] = "Erreur lors du lancement du navigateur Web. Vérifiez les paramètres de %PRODUCTNAME sous 'Outils - Options - %PRODUCTNAME - Programmes auxiliaires', ainsi que ceux du navigateur Web."; + Message[ es ] = "Se ha producido un error al iniciar el navegador web. Compruebe la configuración de %PRODUCTNAME en 'Herramientas - Opciones - %PRODUCTNAME - Programas auxiliares' asà como la del navegador web. "; + Message[ fi ] = "Web-selaimen käynnistyksessä tapahtui virhe.\nTarkista %PRODUCTNAMEn ja Web-selaimen asetukset."; + Message[ ca ] = "An error occurred in starting a webbrowser.\nPlease check the %PRODUCTNAME and webbrowser settings."; + Message[ it ] = "Si è verificato un errore durante l'avvio del browser Web. Verificate le impostazioni di %PRODUCTNAME al menu 'Strumenti - Opzioni - %PRODUCTNAME - Programmi ausiliari' e le impostazioni del browser Web."; + Message[ sk ] = "Pri spúšťanà webového prehliadaÄa nastala chyba.\nProsÃm skontrolujte nastavenia %PRODUCTNAME a webového prehliadaÄa."; + Message[ da ] = "Fejl ved start af webbrowseren.\nKontroller indstillingerne for %PRODUCTNAME og for webbrowseren."; + Message[ sv ] = "Det uppstod ett fel när webbläsaren skulle startas. Kontrollera inställningarna i %PRODUCTNAME under 'Verktyg - Alternativ - %PRODUCTNAME - Hjälpprogram' och inställningarna i din webbläsare."; + Message[ pl ] = "WystÄ…piÅ‚ bÅ‚Ä…d podczas uruchamiania przeglÄ…darki stron WWW.\nSprawdź ustawienia programu %PRODUCTNAME i przeglÄ…darki."; + Message[ pt-BR ] = "Ocorreu um erro ao iniciar o navegador da web.\nPor favor, verifique as configurações do %PRODUCTNAME em 'Ferramentas - Opções - %PRODUCTNAME - Programas externos' o navegador da web."; + Message[ th ] = "An error occurred in starting the web browser. Please check the %PRODUCTNAME settings under 'Tools - Options - %PRODUCTNAME - External Programs' and the settings for your web browser."; + Message[ ja ] = "webブラウザã®èµ·å‹•æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚ツール → オプション → %PRODUCTNAME → ヘルププãƒã‚°ãƒ©ãƒ 㧠%PRODUCTNAME ã®è¨å®šã¨ãŠä½¿ã„ã® webブラウザã®è¨å®šã‚’確èªã—ã¦ãã ã•ã„。"; + Message[ ko ] = "웹 브ë¼ìš°ì €ë¥¼ 시작하는 ë™ì•ˆ 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤. %PRODUCTNAME ì˜ 'ë„구 - 옵션 - %PRODUCTNAME - ë³´ì¡° í”„ë¡œê·¸ëž¨ì˜ ì„¤ì • ë° ì›¹ 브ë¼ìš°ì € ì„¤ì •ì„ ìž¬ê²€í•´ë³´ì‹ì‹œì˜¤."; + Message[ zh-CN ] = "å¯åŠ¨æµè§ˆå™¨æ—¶å‘生一个错误。\n请通过èœå•\"工具\"-\"选项\"-\"%PRODUCTNAME -辅助程åº\"æ¥æ£€æŸ¥ %PRODUCTNAME 的设定åŠæµè§ˆå™¨çš„设定。"; + Message[ zh-TW ] = "å•Ÿå‹• Web ç€è¦½å™¨æ™‚發生一個錯誤。\nè«‹é€éŽã€Œå·¥å…·ã€-「é¸é …ã€-「%PRODUCTNAME 輔助程å¼ã€ä¾†æª¢æŸ¥ %PRODUCTNAME çš„è¨å®šåŠç€è¦½å™¨çš„è¨å®šã€‚"; + Message[ tr ] = "Web tarayıcısını baÅŸlatırken bir hata oluÅŸtu.\nLütfen, %PRODUCTNAME ve web tarayıcınızın ayarlarını kontrol ediniz."; + Message[ hi-IN ] = "An error occurred in starting the web browser. Please check the %PRODUCTNAME settings under 'Tools - Options - %PRODUCTNAME - External Programs' and the settings for your web browser."; + Message[ ar ] = "An error occurred in starting a webbrowser.\nPlease check the %PRODUCTNAME and webbrowser settings."; + Message[ he ] = "‮×רעה שגי××” בעת ×יתחול הדפדפן. × × ×œ×‘×“×•×§ הגדרות ב \"כלי×\" > \"×פשרויות\" > %PRODUCTNAME > \"×ª×•×›× ×™×•×ª ×—×™×¦×•× ×™×•×ª\", ×•×’× ×”×”×’×“×¨×•×ª של הדפדפן עצמו.‬"; +}; + +ErrorBox MSG_ERR_EXTERNAL_APP_NOT_FOUND +{ + BUTTONS = WB_OK; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Es konnte keine zugehörige externe Applikation für den angewählten Dateitypen gefunden werden.\nBitte überprüfen Sie die Einstellungen von %PRODUCTNAME." ; + Message [ en-US ] = "No corresponding external application could be found for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ pt ] = "An error occurred in starting the external application for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ ru ] = "Ð”Ð»Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ типа файлов не найдено ÑоответÑтвующих внешних приложений.\nПроверьте наÑтройки %PRODUCTNAME."; + Message[ el ] = "Δεν ήταν δυνατή η εÏÏεση αντίστοιχης εξωτεÏικής εφαÏμογής για τον καθοÏισμÎνο Ï„Ïπο αÏχείου.\nΕλÎγξτε τις Ïυθμίσεις του %PRODUCTNAME."; + Message[ nl ] = "Er is geen bijbehorende externe toepassing voor de geselecteerde bestandstypen gevonden.\nControleer de instellingen van %PRODUCTNAME."; + Message[ fr ] = "Impossible de détecter une application externe correspondant au type de fichier spécifié.\nVérifiez le paramétrage de %PRODUCTNAME."; + Message[ es ] = "No se pudo encontrar ninguna aplicación exterior correspondiente al tipo de archivo seleccionado.\nCompruebe la configuración del %PRODUCTNAME."; + Message[ fi ] = "Annetulle tiedostotyypille ei löytynyt vastaavaa ulkoista sovellusta.\nTarkista %PRODUCTNAME-asetukset."; + Message[ ca ] = "An error occurred in starting the external application for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ it ] = "Impossibile trovare le applicazioni esterne per il tipo di file selezionato.\\Verificate le impostazioni di %PRODUCTNAME."; + Message[ sk ] = "Pre zadaný typ súboru nebola nájdená žiadna vhodná externá aplikácia.\nProsÃm skontrolujte nastavenie %PRODUCTNAME."; + Message[ da ] = "Der kunne ikke findes nogen tilhørende ekstern applikation til den valgte filtype.\nKontroller indstillingerne for %PRODUCTNAME."; + Message[ sv ] = "Det gick inte att hitta nÃ¥got tillhörande externt program för den valda filtypen.\nKontrollera inställningarna i %PRODUCTNAME."; + Message[ pl ] = "Nie znaleziono aplikacji zewnÄ™trznej, odpowiadajÄ…cej podanemu typowi pliku.\nSprawdź ustawienia programu %PRODUCTNAME."; + Message[ pt-BR ] = "Não foi encontrado nenhuma aplicação externa associada ao tipo de arquivo selecionado.\nPor favor, verifique a configuração do %PRODUCTNAME."; + Message[ th ] = "No corresponding external application could be found for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ ja ] = "é¸æŠžã—ãŸãƒ•ã‚¡ã‚¤ãƒ«ã®ç¨®é¡žã‚’é–‹ã外部アプリケーションãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚\n%PRODUCTNAME è¨å®šã‚’ã‚‚ã†ä¸€åº¦ç¢ºèªã—ã¦ãã ã•ã„。"; + Message[ ko ] = "ì§€ì •í•˜ì‹ íŒŒì¼ í˜•ì‹ì— 해당하는 ì‘ìš© í”„ë¡œê·¸ëž¨ì„ ì°¾ì§€ 못했습니다.\n%PRODUCTNAMEì˜ ì„¤ì •ì„ í™•ì¸í•´ë³´ì‹ì‹œì˜¤."; + Message[ zh-CN ] = "没有找到用于打开指定文件类型的外æ¥çš„应用程åºã€‚\n请您检查 %PRODUCTNAME 的设定。"; + Message[ zh-TW ] = "沒有找到用於開啟指定檔案類型的外來的應用程å¼ã€‚\n請檢查 %PRODUCTNAME çš„è¨å®šã€‚"; + Message[ tr ] = "Seçilen dosya tipine göre çalıştırılacak dış bir program bulunamadı.\\Lütfen, %PRODUCTNAME ayarlarını kontrol ediniz."; + Message[ hi-IN ] = "No corresponding external application could be found for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ ar ] = "An error occurred in starting the external application for the given file type.\nPlease check the %PRODUCTNAME settings."; + Message[ he ] = "â€®×œ× × ×™×ª×Ÿ ל×תר ×™×™×©×•× ×”×ž×ª××™× ×œ×¡×•×’ קובץ ×–×”.\n× × ×œ×‘×“×•×§ ב×פשרויות %PRODUCTNAME.‬"; +}; + +Resource SID_UNKNOWN +{ + String 1 "-" ; +}; + +Resource BMP_SFX_COLOR +{ + ExtraData = + { + SID_NEWDOC; // 043 + SID_OPENDOC; // 044 + SID_CLOSEDOC; // 045 + SID_RELOAD; // 046 + SID_SAVEASDOC; // 047 + SID_PRINTDOC; // 051 + SID_SETUPPRINTER; // 053 + SID_QUITAPP; // 054 + SID_UNDO; // 055 + SID_REDO; // 056 + SID_REPEAT; // 057 + SID_CUT; // 058 + SID_COPY; // 059 + SID_PASTE; // 060 + SID_DELETE; // 061 + SID_SELECTALL; // 062 + SID_SAVEDOC; // 063 vormals 046 + SID_EXITANDRETURN; // 064 vormals 054 + SID_RECORDMACRO; // 095 + SID_EDITMACRO; // 096 + SID_HELPMENU; // 098 + SID_CONFIG; // 123 + SID_CONFIGTOOLBOX; // 124 + 0; + }; +}; + +Resource BMP_SFX_MONO +{ + ExtraData = + { + SID_NEWDOC; // 043 + SID_OPENDOC; // 044 + SID_CLOSEDOC; // 045 + SID_RELOAD; // 046 + SID_SAVEASDOC; // 047 + SID_PRINTDOC; // 051 + SID_SETUPPRINTER; // 053 + SID_QUITAPP; // 054 + SID_UNDO; // 055 + SID_REDO; // 056 + SID_REPEAT; // 057 + SID_CUT; // 058 + SID_COPY; // 059 + SID_PASTE; // 060 + SID_DELETE; // 061 + SID_SELECTALL; // 062 + SID_SAVEDOC; // 063 vormals 046 + SID_EXITANDRETURN; // 064 vormals 054 + SID_RECORDMACRO; // 095 + SID_EDITMACRO; // 096 + SID_HELPMENU; // 098 + SID_CONFIG; // 123 + SID_CONFIGTOOLBOX; // 124 + 0; + }; +}; + +WarningBox RID_WARN_POST_MAILTO +{ + BUTTONS = WB_OK_CANCEL ; + DEFBUTTON = WB_DEF_OK ; + Message [ de ] = "Ein Formular soll per E-Mail versendet werden.\nDadurch wird dem Empfänger Ihre E-Mail-Adresse bekannt." ; + Message [ en-US ] = "A form is to be sent by e-mail.\nThis means that the receiver will get to see your e-mail address." ; + Message [ x-comment ] = " "; + Message[ pt ] = "O formulário será enviado por e-mail.\nO seu endereço electrónico será fornecido ao destinatário."; + Message[ ru ] = "Форма будет отправлена по Ñлектронной почте.\nПолучатель узнает ваш Ð°Ð´Ñ€ÐµÑ Ñлектронной почты."; + Message[ el ] = "Î Ïόκειται να αποσταλλεί μια φόÏμα μÎσω e-mail.\nÎ ÏοσÎξτε ότι σε αυτή τη πεÏίπτωση γνωστοποιείται η διεÏθυνση σας στον παÏαλήπτη"; + Message[ nl ] = "Een formulier moet per e-mail gestuurd worden.\nDaardoor wordt uw e-mailadres bij de ontvanger bekend."; + Message[ fr ] = "Vous voulez envoyer un formulaire par e-mail.\nVous communiquerez ainsi votre adresse e-mail au destinataire."; + Message[ es ] = "Se debe enviar un formulario por correo electrónico.\nCon ello se dará a conocer al destinatario su dirección electrónica."; + Message[ fi ] = "Lomake lähetetään sähköpostitse.\nSähköpostiosoitteesi tulee lähettäjän tietoon."; + Message[ ca ] = "S'ha d'enviar un formulari per correu electrònic.\nAmb això el destinatari podrà saber la vostra direcció de correu electrònic."; + Message[ it ] = "Un formulario deve essere inviato via eMail.\nIn tal modo il destinatario verrà a conoscenza dell'indirizzo eMail dell'utente."; + Message[ sk ] = "Formulár bude odoslaný ako e-mail.\nTo znamená, že adresát sa dozvie vaÅ¡u e-mail adresu."; + Message[ da ] = "Du vil sende en formular via e-mail.\nBemærk at modtageren herved fÃ¥r din e-mail-adresse."; + Message[ sv ] = "Ett formulär skall skickas per e-post.\nDetta innebär att mottagaren fÃ¥r reda pÃ¥ din e-postadress."; + Message[ pl ] = "Formularz ma zostać wysÅ‚any pocztÄ… e-mail.\nSpowoduje to, że adresat pozna twój adres e-mail."; + Message[ pt-BR ] = "Será enviado um formulário pelo e-mail.\nO seu endereço de e-mail será fornecido ao destinatário."; + Message[ th ] = "ส่งฟà¸à¸£à¹Œà¸¡à¹‚ดยà¸à¸µà¹€à¸¡à¸¥à¹Œ\nนี้หมายถึงว่าผู้รับจะได้เห็นที่à¸à¸¢à¸¹à¹ˆà¸à¸µà¹€à¸¡à¸¥à¹Œà¸‚à¸à¸‡à¸„ุณ"; + Message[ ja ] = "フォーム㯠E-mail ã§é€ä¿¡ã—ã¦ãã ã•ã„。\nãã†ã™ã‚‹ã“ã¨ã§ãƒ¦ãƒ¼ã‚¶ãƒ¼ã® E-mail アドレスãŒå—信者ã«ä¼ã‚ã‚Šã¾ã™ã€‚"; + Message[ ko ] = "ì–‘ì‹ì„ ì „ìž ë©”ì¼ë¡œ 보냅니다 .\n그러면 받는 ì‚¬ëžŒì€ ì‚¬ìš©ìžì˜ ì „ìž ë©”ì¼ ì£¼ì†Œë¥¼ 보게ë©ë‹ˆë‹¤."; + Message[ zh-CN ] = "应该借助电å邮件寄å‘表å•ã€‚\nè¿™æ ·æ‚¨çš„ç”µå邮件地å€ä¹Ÿå°±ä¼ 递给了收件人。"; + Message[ zh-TW ] = "應該é€éŽé›»å郵件寄發表單。\n這樣您的電å郵件地å€ä¹Ÿå°±å‚³éžçµ¦äº†æ”¶ä»¶è€…。"; + Message[ tr ] = "E-posta ile form gönderilecek.\nBu ÅŸekilde alıcı e-posta adresinizi de görecektir."; + Message[ hi-IN ] = "इ-मेइल दà¥à¤µà¤¾à¤°à¤¾ फ़ॉरà¥à¤®à¥ को à¤à¥‡à¤œà¤¨à¤¾ है ।\nइसका अरà¥à¤¥ है कि पà¥à¤°à¤¾à¤¤à¤¿à¤—à¥à¤°à¤¾à¤¹à¤• आपका इ-मेइल पता देख सकता है ।"; + Message[ ar ] = "ينبغي إرسال استمارة بالبريد الإلكتروني.\nبهذه الطريقة سو٠يعر٠المستلم عنوان البريد الإلكتروني الخاص بك."; + Message[ he ] = "‮פעולה זו תחשף ×ת כתובת הדו×ר של המשתמש.‬\n‮הטופס ישלח בדו×ר ××œ×§×˜×¨×•× ×™.‬"; +}; + + + +String GID_INTERN +{ + Text [ de ] = "Intern" ; + Text [ en-US ] = "Internal" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Interno"; + Text[ ru ] = "Внутренний"; + Text[ el ] = "ΕσωτεÏικά"; + Text[ nl ] = "Intern"; + Text[ fr ] = "Interne"; + Text[ es ] = "Interno"; + Text[ fi ] = "Sisäinen"; + Text[ ca ] = "Intern"; + Text[ it ] = "Interno"; + Text[ sk ] = "Interný"; + Text[ da ] = "Intern"; + Text[ sv ] = "Internt"; + Text[ pl ] = "WewnÄ™trzny"; + Text[ pt-BR ] = "Interno"; + Text[ th ] = "ภายใน"; + Text[ ja ] = "内部"; + Text[ ko ] = "내부"; + Text[ zh-CN ] = "内部"; + Text[ zh-TW ] = "內部"; + Text[ tr ] = "İç"; + Text[ hi-IN ] = "à¤à¥€à¤¤à¤°à¥€"; + Text[ ar ] = "داخلي"; + Text[ he ] = "â€®×¤× ×™×ž×™â€¬"; +}; + +String GID_APPLICATION +{ + Text [ de ] = "Applikation" ; + Text [ en-US ] = "Application" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Aplicação"; + Text[ ru ] = "Приложение"; + Text[ el ] = "ΕφαÏμογή"; + Text[ nl ] = "Toepassing"; + Text[ fr ] = "Application"; + Text[ es ] = "Aplicación"; + Text[ fi ] = "Sovellus"; + Text[ ca ] = "Aplicació"; + Text[ it ] = "Applicazione"; + Text[ sk ] = "Aplikácia"; + Text[ da ] = "Applikation"; + Text[ sv ] = "Tillämpning"; + Text[ pl ] = "Aplikacja"; + Text[ pt-BR ] = "Aplicação"; + Text[ th ] = "โปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œ"; + Text[ ja ] = "アプリケーション"; + Text[ ko ] = "ì‘ìš© 프로그램"; + Text[ zh-CN ] = "应用程åº"; + Text[ zh-TW ] = "應用程å¼"; + Text[ tr ] = "Uygulama"; + Text[ hi-IN ] = "कारà¥à¤¯à¤•à¥à¤°à¤®"; + Text[ ar ] = "تطبيق"; + Text[ he ] = "‮פעולה‬"; +}; + +String GID_VIEW +{ + Text [ de ] = "Ansicht" ; + Text [ en-US ] = "View" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Visualizar"; + Text[ ru ] = "Вид"; + Text[ el ] = "Î Ïοβολή"; + Text[ nl ] = "Beeld"; + Text[ fr ] = "Affichage"; + Text[ es ] = "Ver"; + Text[ fi ] = "Näytä"; + Text[ ca ] = "Veure"; + Text[ it ] = "Visualizza"; + Text[ sk ] = "~ZobraziÅ¥"; + Text[ da ] = "Vis"; + Text[ sv ] = "Vy"; + Text[ pl ] = "Widok"; + Text[ pt-BR ] = "Vista"; + Text[ th ] = "มุมมà¸à¸‡"; + Text[ ja ] = "表示"; + Text[ ko ] = "보기"; + Text[ zh-CN ] = "视图"; + Text[ zh-TW ] = "檢視"; + Text[ tr ] = "Görünüm"; + Text[ hi-IN ] = "पूरà¥à¤µà¤¦à¥ƒà¤¶à¥à¤¯"; + Text[ ar ] = "عرض"; + Text[ he ] = "‮תצוגה‬"; +}; + +String GID_DOCUMENT +{ + Text [ de ] = "Dokumente" ; + Text [ en-US ] = "Documents" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Documentos"; + Text[ ru ] = "Документы"; + Text[ el ] = "ΈγγÏαφα"; + Text[ nl ] = "Documenten"; + Text[ fr ] = "Documents"; + Text[ es ] = "Documentos"; + Text[ fi ] = "Asiakirjat"; + Text[ ca ] = "Documents"; + Text[ it ] = "Documenti"; + Text[ sk ] = "Dokumenty"; + Text[ da ] = "Dokumenter"; + Text[ sv ] = "Dokument"; + Text[ pl ] = "Dokumenty"; + Text[ pt-BR ] = "Documentos"; + Text[ th ] = "เà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメント"; + Text[ ko ] = "문서"; + Text[ zh-CN ] = "文档"; + Text[ zh-TW ] = "文件"; + Text[ tr ] = "Belge"; + Text[ hi-IN ] = "लेखपतà¥à¤°à¥‡à¤‚"; + Text[ ar ] = "مستندات"; + Text[ he ] = "‮מסמכי×‬"; +}; + +String GID_EDIT +{ + Text [ de ] = "Bearbeiten" ; + Text [ en-US ] = "Edit" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Editar"; + Text[ ru ] = "Изменить"; + Text[ el ] = "ΕπεξεÏγασία"; + Text[ nl ] = "Bewerken"; + Text[ fr ] = "Édition"; + Text[ es ] = "Editar"; + Text[ fi ] = "Muokkaa"; + Text[ ca ] = "Edita"; + Text[ it ] = "Modifica"; + Text[ sk ] = "UpraviÅ¥"; + Text[ da ] = "Rediger"; + Text[ sv ] = "Redigera"; + Text[ pl ] = "Edytuj"; + Text[ pt-BR ] = "Editar"; + Text[ th ] = "à¹à¸à¹‰à¹„ข"; + Text[ ja ] = "編集"; + Text[ ko ] = "편집"; + Text[ zh-CN ] = "编辑"; + Text[ zh-TW ] = "編輯"; + Text[ tr ] = "Düzenle"; + Text[ hi-IN ] = "संपादन"; + Text[ ar ] = "تØرير"; + Text[ he ] = "‮עריכה‬"; +}; + +String GID_MACRO +{ + Text [ de ] = "BASIC" ; + Text [ en-US ] = "BASIC" ; + Text [ x-comment ] = " "; + Text[ pt ] = "BASIC"; + Text[ ru ] = "BASIC"; + Text[ el ] = "BASIC"; + Text[ nl ] = "BASIC"; + Text[ fr ] = "BASIC"; + Text[ es ] = "BASIC"; + Text[ fi ] = "BASIC"; + Text[ ca ] = "BASIC"; + Text[ it ] = "BASIC"; + Text[ sk ] = "BASIC"; + Text[ da ] = "BASIC"; + Text[ sv ] = "BASIC"; + Text[ pl ] = "BASIC"; + Text[ pt-BR ] = "BASIC"; + Text[ th ] = "BASIC"; + Text[ ja ] = "BASIC"; + Text[ ko ] = "BASIC"; + Text[ zh-CN ] = "BASIC"; + Text[ zh-TW ] = "BASIC"; + Text[ tr ] = "BASIC"; + Text[ hi-IN ] = "BASIC"; + Text[ ar ] = "BASIC"; + Text[ he ] = "‮בייסיק‬"; +}; + +String GID_OPTIONS +{ + Text [ de ] = "Extras" ; + Text [ en-US ] = "Options" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Ferramentas"; + Text[ ru ] = "Параметры"; + Text[ el ] = "ΕÏγαλεία"; + Text[ nl ] = "Extra"; + Text[ fr ] = "Options"; + Text[ es ] = "Opciones"; + Text[ fi ] = "Asetukset"; + Text[ ca ] = "Opcions"; + Text[ it ] = "Varie"; + Text[ sk ] = "Nastavenia"; + Text[ da ] = "Funktioner"; + Text[ sv ] = "Verktyg"; + Text[ pl ] = "Opcje"; + Text[ pt-BR ] = "Opções"; + Text[ th ] = "ตัวเลืà¸à¸"; + Text[ ja ] = "ツール"; + Text[ ko ] = "옵션"; + Text[ zh-CN ] = "其它"; + Text[ zh-TW ] = "其它"; + Text[ tr ] = "Araçlar"; + Text[ hi-IN ] = "विकलà¥à¤ª"; + Text[ ar ] = "خيارات"; + Text[ he ] = "‮×פשרויות‬"; +}; + +String GID_MATH +{ + Text [ de ] = "Math" ; + Text [ en-US ] = "Math" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Math"; + Text[ ru ] = "Math"; + Text[ el ] = "Math"; + Text[ nl ] = "Math"; + Text[ fr ] = "Math"; + Text[ es ] = "Math"; + Text[ fi ] = "Math"; + Text[ ca ] = "Math"; + Text[ it ] = "Math"; + Text[ sk ] = "Matematika"; + Text[ da ] = "Math"; + Text[ sv ] = "Math"; + Text[ pl ] = "Math"; + Text[ pt-BR ] = "Math"; + Text[ th ] = "คณิตศาสตร์"; + Text[ ja ] = "æ•°å¦"; + Text[ ko ] = "Math"; + Text[ zh-CN ] = "Math"; + Text[ zh-TW ] = "數å¸"; + Text[ tr ] = "Math"; + Text[ hi-IN ] = "गणित"; + Text[ ar ] = "Math"; + Text[ he ] = "â€®× ×•×¡×—×ות‬"; +}; + +String GID_NAVIGATOR +{ + Text [ de ] = "Navigieren" ; + Text [ en-US ] = "Navigate" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Navegar"; + Text[ ru ] = "ÐавигациÑ"; + Text[ el ] = "ΠεÏιήγηση"; + Text[ nl ] = "Navigeren"; + Text[ fr ] = "Navigation"; + Text[ es ] = "Navegar"; + Text[ fi ] = "Siirry"; + Text[ ca ] = "Navega"; + Text[ it ] = "Naviga"; + Text[ sk ] = "PreviesÅ¥"; + Text[ da ] = "Naviger"; + Text[ sv ] = "Navigera"; + Text[ pl ] = "Nawigacja"; + Text[ pt-BR ] = "Navegar"; + Text[ th ] = "นำทาง"; + Text[ ja ] = "ナビゲート"; + Text[ ko ] = "íƒìƒ‰"; + Text[ zh-CN ] = "æµè§ˆ"; + Text[ zh-TW ] = "ç€è¦½"; + Text[ tr ] = "DolaÅŸ"; + Text[ hi-IN ] = "नाविगेट"; + Text[ ar ] = "ملاØØ©"; + Text[ he ] = "â€®× ×™×•×•×˜â€¬"; +}; + +String GID_INSERT +{ + Text [ de ] = "Einfügen" ; + Text [ en-US ] = "Insert" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Inserir"; + Text[ ru ] = "Ð’Ñтавить"; + Text[ el ] = "Εισαγωγή"; + Text[ nl ] = "Invoegen"; + Text[ fr ] = "Insérer"; + Text[ es ] = "Insertar"; + Text[ fi ] = "Lisää"; + Text[ ca ] = "Insereix"; + Text[ it ] = "Inserisci"; + Text[ sk ] = "VložiÅ¥"; + Text[ da ] = "Indsæt"; + Text[ sv ] = "Infoga"; + Text[ pl ] = "Wstaw"; + Text[ pt-BR ] = "Inserir"; + Text[ th ] = "à¹à¸—รà¸"; + Text[ ja ] = "挿入"; + Text[ ko ] = "삽입"; + Text[ zh-CN ] = "æ’å…¥"; + Text[ zh-TW ] = "æ’å…¥"; + Text[ tr ] = "Ekle"; + Text[ hi-IN ] = "जोड़ो"; + Text[ ar ] = "إدراج"; + Text[ he ] = "‮הוספה‬"; +}; + +String GID_FORMAT +{ + Text [ de ] = "Format" ; + Text [ en-US ] = "Format" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Formato"; + Text[ ru ] = "Формат"; + Text[ el ] = "ΜοÏφή"; + Text[ nl ] = "Formaat"; + Text[ fr ] = "Format"; + Text[ es ] = "Formato"; + Text[ fi ] = "Muoto"; + Text[ ca ] = "Formata"; + Text[ it ] = "Formato"; + Text[ sk ] = "Formát"; + Text[ da ] = "Format"; + Text[ sv ] = "Format"; + Text[ pl ] = "Format"; + Text[ pt-BR ] = "Formato"; + Text[ th ] = "รูปà¹à¸šà¸š"; + Text[ ja ] = "書å¼"; + Text[ ko ] = "ì„œì‹"; + Text[ zh-CN ] = "æ ¼å¼"; + Text[ zh-TW ] = "æ ¼å¼"; + Text[ tr ] = "Format"; + Text[ hi-IN ] = "रचना"; + Text[ ar ] = "تنسيق"; + Text[ he ] = "‮עיצוב‬"; +}; + +String GID_TEMPLATE +{ + Text [ de ] = "Vorlagen" ; + Text [ en-US ] = "Templates" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Modelos"; + Text[ ru ] = "Шаблоны"; + Text[ el ] = "Î Ïότυπα"; + Text[ nl ] = "Sjablonen"; + Text[ fr ] = "Modèles"; + Text[ es ] = "Plantillas"; + Text[ fi ] = "Mallit"; + Text[ ca ] = "Plantilles"; + Text[ it ] = "Modelli"; + Text[ sk ] = "Å ablóny"; + Text[ da ] = "Skabeloner"; + Text[ sv ] = "Mallar"; + Text[ pl ] = "Szablony"; + Text[ pt-BR ] = "Modelos"; + Text[ th ] = "à¹à¸¡à¹ˆà¹à¸šà¸š"; + Text[ ja ] = "テンプレートã¨ã‚¹ã‚¿ã‚¤ãƒ«"; + Text[ ko ] = "ì„œì‹ íŒŒì¼"; + Text[ zh-CN ] = "æ ·å¼"; + Text[ zh-TW ] = "樣å¼"; + Text[ tr ] = "Åžablon"; + Text[ hi-IN ] = "नमूनें"; + Text[ ar ] = "قوالب"; + Text[ he ] = "â€®×ª×‘× ×™×•×ªâ€¬"; +}; + + +String GID_FRAME +{ + Text [ de ] = "Rahmen" ; + Text [ en-US ] = "Frame" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Moldura"; + Text[ ru ] = "Рамка"; + Text[ el ] = "ΠεÏίγÏαμμα"; + Text[ nl ] = "Kader"; + Text[ fr ] = "Cadre"; + Text[ es ] = "Marco"; + Text[ fi ] = "Kehys"; + Text[ ca ] = "Marc"; + Text[ it ] = "Cornice"; + Text[ sk ] = "RámÄek"; + Text[ da ] = "Ramme"; + Text[ sv ] = "Ram"; + Text[ pl ] = "Ramka"; + Text[ pt-BR ] = "Molduras"; + Text[ th ] = "à¸à¸£à¸à¸š"; + Text[ ja ] = "æž "; + Text[ ko ] = "í”„ë ˆìž„"; + Text[ zh-CN ] = "框"; + Text[ zh-TW ] = "框"; + Text[ tr ] = "Çerçeve"; + Text[ hi-IN ] = "फà¥à¤°à¥‡à¤®à¥"; + Text[ ar ] = "كادر"; + Text[ he ] = "‮מסגרת‬"; +}; + +String GID_GRAPHIC +{ + Text [ de ] = "Grafik" ; + Text [ en-US ] = "Graphic" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Imagem"; + Text[ ru ] = "ГрафичеÑкий объект"; + Text[ el ] = "ΓÏαφικό"; + Text[ nl ] = "Afbeelding"; + Text[ fr ] = "Image"; + Text[ es ] = "Imagen"; + Text[ fi ] = "Grafiikka"; + Text[ ca ] = "Imatge"; + Text[ it ] = "Immagine"; + Text[ sk ] = "Obrázok"; + Text[ da ] = "Grafik"; + Text[ sv ] = "Grafik"; + Text[ pl ] = "Grafika"; + Text[ pt-BR ] = "Figura"; + Text[ th ] = "à¸à¸£à¸²à¸Ÿà¸´à¸„"; + Text[ ja ] = "図"; + Text[ ko ] = "그래픽"; + Text[ zh-CN ] = "图形"; + Text[ zh-TW ] = "圖形"; + Text[ tr ] = "Grafik"; + Text[ hi-IN ] = "सà¥à¤šà¤¿à¤¤à¥à¤°"; + Text[ ar ] = "صورة"; + Text[ he ] = "‮גרפיקה‬"; +}; + +String GID_TABLE +{ + Text [ de ] = "Tabelle" ; + Text [ en-US ] = "Table" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Tabela"; + Text[ ru ] = "Таблица"; + Text[ el ] = "Πίνακας"; + Text[ nl ] = "Tabel"; + Text[ fr ] = "Table"; + Text[ es ] = "Tabla"; + Text[ fi ] = "Taulukko"; + Text[ ca ] = "Taula"; + Text[ it ] = "Tabella"; + Text[ sk ] = "Tabuľka"; + Text[ da ] = "Tabel"; + Text[ sv ] = "Tabell"; + Text[ pl ] = "Tabela"; + Text[ pt-BR ] = "Tabela"; + Text[ th ] = "ตาราง"; + Text[ ja ] = "表"; + Text[ ko ] = "시트"; + Text[ zh-CN ] = "è¡¨æ ¼"; + Text[ zh-TW ] = "è¡¨æ ¼"; + Text[ tr ] = "Tablo"; + Text[ hi-IN ] = "सारणी"; + Text[ ar ] = "جدول"; + Text[ he ] = "‮טבלה‬"; +}; + +String GID_ENUMERATION +{ + Text [ de ] = "Nummerierung" ; + Text [ en-US ] = "Numbering" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Numeração"; + Text[ ru ] = "ÐумерациÑ"; + Text[ el ] = "ΑÏίθμηση"; + Text[ nl ] = "Nummering"; + Text[ fr ] = "Numérotation"; + Text[ es ] = "Numeración"; + Text[ fi ] = "Numerointi"; + Text[ ca ] = "Numeració"; + Text[ it ] = "Numerazione"; + Text[ sk ] = "ÄŒÃslovanie"; + Text[ da ] = "Nummerering"; + Text[ sv ] = "Numrering"; + Text[ pl ] = "Numeracja"; + Text[ pt-BR ] = "Numeração"; + Text[ th ] = "ลำดับเลข"; + Text[ ja ] = "番å·ä»˜ã‘"; + Text[ ko ] = "번호 매기기"; + Text[ zh-CN ] = "ç¼–å·"; + Text[ zh-TW ] = "編號"; + Text[ tr ] = "Numaralama"; + Text[ hi-IN ] = "संखà¥à¤¯à¤¾ देना"; + Text[ ar ] = "الترقيم"; + Text[ he ] = "‮מיספור‬"; +}; + +String GID_DATA +{ + Text [ de ] = "Daten" ; + Text [ en-US ] = "Data" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Dados"; + Text[ ru ] = "Данные"; + Text[ el ] = "ΔεδομÎνα"; + Text[ nl ] = "Gegevens"; + Text[ fr ] = "Données"; + Text[ es ] = "Datos"; + Text[ fi ] = "Tiedot"; + Text[ ca ] = "Dades"; + Text[ it ] = "Dati"; + Text[ sk ] = "Dáta"; + Text[ da ] = "Data"; + Text[ sv ] = "Data"; + Text[ pl ] = "Dane"; + Text[ pt-BR ] = "Dados"; + Text[ th ] = "ข้à¸à¸¡à¸¹à¸¥"; + Text[ ja ] = "データ"; + Text[ ko ] = "ë°ì´í„°"; + Text[ zh-CN ] = "æ•°æ®"; + Text[ zh-TW ] = "資料"; + Text[ tr ] = "Veri"; + Text[ hi-IN ] = "ड़ॉटा"; + Text[ ar ] = "بيانات"; + Text[ he ] = "â€®× ×ª×•× ×™×‬"; +}; + +String GID_SPECIAL +{ + Text [ de ] = "Sonderfunktionen" ; + Text [ en-US ] = "Special Functions" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Funções especiais"; + Text[ ru ] = "Специальные функции"; + Text[ el ] = "ΕιδικÎÏ‚ λειτουÏγίες"; + Text[ nl ] = "Speciale functies"; + Text[ fr ] = "Fonctions spéciales"; + Text[ es ] = "Funciones especiales"; + Text[ fi ] = "Erikoistoiminnot"; + Text[ ca ] = "Funcions especials"; + Text[ it ] = "Funzioni speciali"; + Text[ sk ] = "Å peciálne funkcie"; + Text[ da ] = "Specialfunktioner"; + Text[ sv ] = "Specialfunktioner"; + Text[ pl ] = "Funkcje specjalne"; + Text[ pt-BR ] = "Funções especiais"; + Text[ th ] = "ฟังà¸à¹Œà¸Šà¸±à¹ˆà¸™à¸žà¸´à¹€à¸¨à¸©"; + Text[ ja ] = "特殊機能"; + Text[ ko ] = "특수 함수"; + Text[ zh-CN ] = "特殊功能"; + Text[ zh-TW ] = "特殊功能"; + Text[ tr ] = "Özel iÅŸlevler"; + Text[ hi-IN ] = "विशेष फंकà¥à¤¶à¤¨à¥à¤¸"; + Text[ ar ] = "مهام خاصة"; + Text[ he ] = "â€®×ª×¤×§×•×“×™× ×ž×™×•×—×“×™×‬"; +}; + + + +String GID_EXPLORER +{ + Text [ de ] = "Explorer" ; + Text [ en-US ] = "Explorer" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Explorer"; + Text[ ru ] = "Проводник"; + Text[ el ] = "ΕξεÏευνητής"; + Text[ nl ] = "Explorer"; + Text[ fr ] = "Explorer"; + Text[ es ] = "Explorador"; + Text[ fi ] = "Resurssienhallinta"; + Text[ ca ] = "Explorador"; + Text[ it ] = "Explorer"; + Text[ sk ] = "PrieskumnÃk"; + Text[ da ] = "Explorer"; + Text[ sv ] = "Explorer"; + Text[ pl ] = "Eksplorator"; + Text[ pt-BR ] = "Explorer"; + Text[ th ] = "ตัวสำรวจ"; + Text[ ja ] = "エクスプãƒãƒ¼ãƒ©"; + Text[ ko ] = "íƒìƒ‰ê¸°"; + Text[ zh-CN ] = "资æºç®¡ç†å™¨"; + Text[ zh-TW ] = "檔案總管"; + Text[ tr ] = "Explorer"; + Text[ hi-IN ] = "à¤à¤•à¥à¤¸à¤ªà¥à¤²à¥‹à¤°à¤°"; + Text[ ar ] = "المستكشÙ"; + Text[ he ] = "‮סייר‬"; +}; + +String GID_CONNECTOR +{ + Text [ de ] = "Verbinder" ; + Text [ en-US ] = "Connector" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Conector"; + Text[ ru ] = "Ð¡Ð¾ÐµÐ´Ð¸Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð»Ð¸Ð½Ð¸Ñ"; + Text[ el ] = "ΣÏνδεση"; + Text[ nl ] = "Verbinding"; + Text[ fr ] = "Connecteur"; + Text[ es ] = "Conector"; + Text[ fi ] = "Yhdysviiva"; + Text[ ca ] = "Connectors"; + Text[ it ] = "Connettore"; + Text[ sk ] = "Spojnica"; + Text[ da ] = "Forbindelse"; + Text[ sv ] = "Förbindelse"; + Text[ pl ] = "ÅÄ…cznik"; + Text[ pt-BR ] = "Conector"; + Text[ th ] = "ตัวเชื่à¸à¸¡à¸•à¹ˆà¸"; + Text[ ja ] = "コãƒã‚¯ã‚¿"; + Text[ ko ] = "ì—°ê²°ìž"; + Text[ zh-CN ] = "连接符"; + Text[ zh-TW ] = "連接符"; + Text[ tr ] = "BaÄŸlayıcı"; + Text[ hi-IN ] = "कनेकà¥à¤Ÿà¤°"; + Text[ ar ] = "الرابط"; + Text[ he ] = "‮מחבר‬"; +}; + +String GID_MODIFY +{ + Text [ de ] = "Ändern" ; + Text [ en-US ] = "Modify" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Alterar"; + Text[ ru ] = "Изменить"; + Text[ el ] = "ΤÏοποποίηση"; + Text[ nl ] = "Wijzigen"; + Text[ fr ] = "Modifier"; + Text[ es ] = "Modificar"; + Text[ fi ] = "Muuta"; + Text[ ca ] = "Modifica"; + Text[ it ] = "Modifica"; + Text[ sk ] = "UpraviÅ¥"; + Text[ da ] = "Modificer"; + Text[ sv ] = "Ändra"; + Text[ pl ] = "Modyfikuj"; + Text[ pt-BR ] = "Alterar"; + Text[ th ] = "ดัดà¹à¸›à¸¥à¸‡"; + Text[ ja ] = "変更"; + Text[ ko ] = "ìˆ˜ì •"; + Text[ zh-CN ] = "更改"; + Text[ zh-TW ] = "修改"; + Text[ tr ] = "DeÄŸiÅŸtir"; + Text[ hi-IN ] = "सà¥à¤§à¤¾à¤°à¥‹"; + Text[ ar ] = "تعديل"; + Text[ he ] = "â€®×©×™× ×•×™â€¬"; +}; + +String GID_DRAWING +{ + Text [ de ] = "Zeichnen" ; + Text [ en-US ] = "Drawing" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Desenhar"; + Text[ ru ] = "РиÑование"; + Text[ el ] = "Σχεδίαση"; + Text[ nl ] = "Tekenen"; + Text[ fr ] = "Dessiner"; + Text[ es ] = "Dibujar"; + Text[ fi ] = "Piirros"; + Text[ ca ] = "Dibuix"; + Text[ it ] = "Disegna"; + Text[ sk ] = "Kresba"; + Text[ da ] = "Tegn"; + Text[ sv ] = "Rita"; + Text[ pl ] = "Rysunek"; + Text[ pt-BR ] = "Desenho"; + Text[ th ] = "วาดรูป"; + Text[ ja ] = "図形æç”»"; + Text[ ko ] = "그리기"; + Text[ zh-CN ] = "绘图"; + Text[ zh-TW ] = "繪圖"; + Text[ tr ] = "Çizim"; + Text[ hi-IN ] = "रेखाचितà¥à¤°"; + Text[ ar ] = "رسم"; + Text[ he ] = "‮סרטוט‬"; +}; + +String GID_CONTROLS +{ + Text [ de ] = "Kontrollelemente" ; + Text [ en-US ] = "Controls" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Controlos"; + Text[ ru ] = "Ðлементы управлениÑ"; + Text[ el ] = "Στοιχεία ελÎγχου"; + Text[ nl ] = "Controle-elementen"; + Text[ fr ] = "Éléments de contrôle"; + Text[ es ] = "Elementos de control"; + Text[ fi ] = "Ohjausobjektit"; + Text[ ca ] = "Controls"; + Text[ it ] = "Elementi di controllo"; + Text[ sk ] = "Ovládacie prvky"; + Text[ da ] = "Kontrolelementer"; + Text[ sv ] = "Kontrollelement"; + Text[ pl ] = "Formanty"; + Text[ pt-BR ] = "Controles"; + Text[ th ] = "ตัวควบคุม"; + Text[ ja ] = "コントãƒãƒ¼ãƒ«è¦ç´ "; + Text[ ko ] = "컨트롤"; + Text[ zh-CN ] = "控制"; + Text[ zh-TW ] = "æŽ§åˆ¶é …"; + Text[ tr ] = "Kumanda öğeleri"; + Text[ hi-IN ] = "नियंतà¥à¤°à¤£"; + Text[ ar ] = "عناصر تØكم"; + Text[ he ] = "‮פקדי×‬"; +}; + +TabDialog SID_OPTIONS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 244 , 155 ) ; + Text [ de ] = "Optionen" ; + Text [ en-US ] = "Options" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( 3 , 15 ) ; + Size = MAP_APPFONT ( 221 , 130 ) ; + PageList = + { + PageItem + { + Identifier = RID_SFXPAGE_GENERAL ; + Text [ de ] = "Allgemeines" ; + Text [ en-US ] = "General" ; + PageResID = 256 ; + Text [ x-comment ] = " "; + Text[ pt ] = "Geral"; + Text[ ru ] = "Общее"; + Text[ el ] = "Γενικά"; + Text[ nl ] = "Algemeen"; + Text[ fr ] = "En général"; + Text[ es ] = "General"; + Text[ fi ] = "Yleiset"; + Text[ ca ] = "General"; + Text[ it ] = "Generale"; + Text[ sk ] = "VÅ¡eobecný"; + Text[ da ] = "Generelt"; + Text[ sv ] = "Allmänt"; + Text[ pl ] = "Ogólne"; + Text[ pt-BR ] = "Geral"; + Text[ th ] = "ทั่วไป"; + Text[ ja ] = "全般"; + Text[ ko ] = "ì¼ë°˜"; + Text[ zh-CN ] = "常规"; + Text[ zh-TW ] = "一般"; + Text[ tr ] = "Genel"; + Text[ hi-IN ] = "सामानà¥à¤¯"; + Text[ ar ] = "عام"; + Text[ he ] = "‮כללי‬"; + }; + PageItem + { + Identifier = RID_SFXPAGE_SAVE ; + Text [ de ] = "Speichern" ; + Text [ en-US ] = "Save" ; + PageResID = 257 ; + Text [ x-comment ] = " "; + Text[ pt ] = "Guardar"; + Text[ ru ] = "Сохранить"; + Text[ el ] = "Αποθήκευση"; + Text[ nl ] = "Opslaan"; + Text[ fr ] = "Enregistrer"; + Text[ es ] = "Guardar"; + Text[ fi ] = "Tallenna"; + Text[ ca ] = "Desa"; + Text[ it ] = "Salva"; + Text[ sk ] = "UložiÅ¥"; + Text[ da ] = "Gem"; + Text[ sv ] = "Spara"; + Text[ pl ] = "Zapisz"; + Text[ pt-BR ] = "Salvar"; + Text[ th ] = "บันทึà¸"; + Text[ ja ] = "ä¿å˜"; + Text[ ko ] = "ì €ìž¥"; + Text[ zh-CN ] = "å˜ç›˜"; + Text[ zh-TW ] = "儲å˜"; + Text[ tr ] = "Kaydet"; + Text[ hi-IN ] = "संचित करो"; + Text[ ar ] = "ØÙظ"; + Text[ he ] = "‮שמירה‬"; + }; + PageItem + { + Text [ de ] = "Pfade" ; + Text [ en-US ] = "Paths" ; + PageResID = 258 ; + Text [ x-comment ] = " "; + Text[ pt ] = "Atalhos"; + Text[ ru ] = "Пути"; + Text[ el ] = "ΔιαδÏομÎÏ‚"; + Text[ nl ] = "Pad"; + Text[ fr ] = "Chemins"; + Text[ es ] = "Rutas"; + Text[ fi ] = "Polut"; + Text[ ca ] = "Camins"; + Text[ it ] = "Percorsi"; + Text[ sk ] = "Cesty"; + Text[ da ] = "Stier"; + Text[ sv ] = "Sökvägar"; + Text[ pl ] = "Åšcieżki"; + Text[ pt-BR ] = "Caminhos"; + Text[ th ] = "เส้นทาง"; + Text[ ja ] = "パス"; + Text[ ko ] = "경로"; + Text[ zh-CN ] = "路径"; + Text[ zh-TW ] = "路徑"; + Text[ tr ] = "Veri yolu"; + Text[ hi-IN ] = "मारà¥à¤—"; + Text[ ar ] = "مسارات"; + Text[ he ] = "‮מסלולי×‬"; + }; + PageItem + { + Identifier = RID_SFXPAGE_SPELL ; + Text [ de ] = "Rechtschreibprüfung" ; + Text [ en-US ] = "Spellcheck" ; + PageResID = 259 ; + Text [ x-comment ] = " "; + Text[ pt ] = "Verificar ortografia"; + Text[ ru ] = "Проверка орфографии"; + Text[ el ] = "ΟÏθογÏαφικός Îλεγχος"; + Text[ nl ] = "Spellingcontrole"; + Text[ fr ] = "Vérification orthographique"; + Text[ es ] = "Revisión ortográfica"; + Text[ fi ] = "Oikeinkirjoituksen tarkistus"; + Text[ ca ] = "Revisió ortogrà fica"; + Text[ it ] = "Controllo ortografico"; + Text[ sk ] = "Kontrola pravopisu"; + Text[ da ] = "Stavekontrol"; + Text[ sv ] = "Rättstavningskontroll"; + Text[ pl ] = "Sprawdzanie pisowni"; + Text[ pt-BR ] = "Verificação ortográfica"; + Text[ th ] = "ตรวจสà¸à¸šà¸à¸²à¸£à¸ªà¸°à¸à¸”"; + Text[ ja ] = "æ–‡ç« æ ¡æ£"; + Text[ ko ] = "맞춤법 검사"; + Text[ zh-CN ] = "拼写检查"; + Text[ zh-TW ] = "拼寫檢查"; + Text[ tr ] = "Yazım denetimi"; + Text[ hi-IN ] = "अकà¥à¤·à¤° की जाà¤à¤š"; + Text[ ar ] = "التدقيق الإملائي"; + Text[ he ] = "‮בדיקת ×יות‬"; + }; + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "Opções"; + Text[ ru ] = "Параметры"; + Text[ el ] = "ΕπιλογÎÏ‚"; + Text[ nl ] = "Opties"; + Text[ fr ] = "Options"; + Text[ es ] = "Opciones"; + Text[ fi ] = "Asetukset"; + Text[ ca ] = "Opcions"; + Text[ it ] = "Opzioni"; + Text[ sk ] = "Nastavenia"; + Text[ da ] = "Indstillinger"; + Text[ sv ] = "Alternativ"; + Text[ pl ] = "Opcje"; + Text[ pt-BR ] = "Opções"; + Text[ th ] = "ตัวเลืà¸à¸"; + Text[ ja ] = "オプション"; + Text[ ko ] = "옵션"; + Text[ zh-CN ] = "选项"; + Text[ zh-TW ] = "é¸é …"; + Text[ tr ] = "Seçenekler"; + Text[ hi-IN ] = "विकलà¥à¤ª"; + Text[ ar ] = "خيارات"; + Text[ he ] = "‮×פשרויות‬"; +}; + +InfoBox MSG_CANT_QUIT +{ + Message [ de ] = "Die Anwendung kann zur Zeit nicht beendet werden.\nBitte warten Sie das Ende aller Druckaufträge und/oder\nOLE-Aktivierungen ab und schließen Sie alle Dialoge." ; + Message [ en-US ] = "The application cannot be terminated at the moment.\nPlease wait until all print jobs and/or\nOLE actions have finished and close all dialogs." ; + Message [ x-comment ] = " "; + Message[ pt ] = "De momento é impossÃvel sair desta aplicação.\nAguarde a impressão de todos os documentos\n e/ou o fim das activações OLE e feche todos os diálogos."; + Message[ ru ] = "Выход из Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð² данный момент невозможен.\nПодождите Ð¾ÐºÐ¾Ð½Ñ‡Ð°Ð½Ð¸Ñ Ð²Ñех заданий печати и/или\n дейÑтвий OLE и закройте вÑе диалоги."; + Message[ el ] = "Î Ïος το παÏόν είναι αδÏνατον να τεÏματιστεί αυτή η εφαÏμογή.\nΠαÏακαλώ πεÏιμÎνετε μÎχÏι να εκτελεστοÏν όλες οι εÏγασίες εκτÏπωσης και/ή\nοι"; + Message[ nl ] = "De toepassing kan op dit moment niet worden beëindigd.\nWacht tot alle afdrukopdrachten en/of\nOLE-activiteiten zijn beëindigd en \nsluit alle dialoogvensters."; + Message[ fr ] = "Impossible de quitter l'application maintenant.\nVeuillez attendre la fin des activités d'impression et/ou des activations OLE\net fermez tous les dialogues."; + Message[ es ] = "La aplicación no se puede cerrar por el momento. \nPor favor espere hasta que finalice la impresión de\n todos los documentos y/o activaciones OLE\ny cierre todos los diálogos."; + Message[ fi ] = "Sovelluksen lopettaminen ei onnistu.\nOdota, että kaikki tulostustyöt ja/tai\nOLE-toiminnot ovat valmiit ja sulje kaikki valintaikkunat."; + Message[ ca ] = "L'aplicació no es pot tancar de moment. \nEspereu que s'acabi la impressió de\n tots els documents i/o activacions OLE\ni tanqueu tots els quadres de dià leg."; + Message[ it ] = "Impossibile uscire dall'applicazione in questo momento.\nAttendendete la concluisione della stampa e/o\n tutte le attivazioni OLE, quindi chiudete\ntutti i dialoghi."; + Message[ sk ] = "Aplikácia nemôže byÅ¥ práve teraz ukonÄená.\nProsÃm poÄkajte, až dobehnú vÅ¡etky tlaÄové úlohy a/alebo \nOLE akcie, a zavrite vÅ¡etky dialógové okná."; + Message[ da ] = "Det er for tiden ikke muligt at afslutte programmet.\nVent venligst til alle udskriftsjob og/eller \nOLE-handlinger er afslutte og luk sÃ¥ alle dialoger."; + Message[ sv ] = "Programmet kan inte avslutas för tillfället.\nVänta tills alla utskriftsuppdrag och/eller\nOLE-aktiveringar är utförda och stäng alla dialoger."; + Message[ pl ] = "Aplikacji nie można teraz zakoÅ„czyć.\nZaczekaj, aż zostanÄ… zakoÅ„czone zadania drukowania i/lub\nakcje OLE, a także zamknij wszystkie okna dialogowe."; + Message[ pt-BR ] = "Não é possÃvel sair do aplicativo neste momento.\nAguarde a impressão de todos os documentos\n e/ou o fim das ações OLE e feche todos as caixas de diálogos."; + Message[ th ] = "ไม่สามารถยà¸à¹€à¸¥à¸´à¸à¸”ปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œà¸‚ณะนี้ได้\nà¸à¸£à¸¸à¸“ารà¸à¸ˆà¸™à¸à¸§à¹ˆà¸²à¸ˆà¸°à¹€à¸ªà¸£à¹‡à¸ˆà¸ªà¸´à¹‰à¸™à¸‡à¸²à¸™à¸žà¸´à¸¡à¸žà¹Œà¸—ั้งหมดà¹à¸¥à¸°/หรืà¸\nà¸à¸²à¸£à¸à¸£à¸°à¸—ำ OLE à¹à¸¥à¸°à¸›à¸´à¸”ไดà¸à¸°à¸¥à¹‡à¸à¸à¸—ั้งหมดà¸à¹ˆà¸à¸™"; + Message[ ja ] = "ç¾åœ¨ãƒ—ãƒã‚°ãƒ©ãƒ ã¯çµ‚了ã§ãã¾ã›ã‚“。\nã™ã¹ã¦ã®å°åˆ·ã‚¸ãƒ§ãƒ–ã¾ãŸã¯\nOLE アクションã®çµ‚了を確èªã—ã¦ã‹ã‚‰ã€ã™ã¹ã¦ã®ãƒ€ã‚¤ã‚¢ãƒã‚°ã‚’é–‰ã˜ã¦ãã ã•ã„。"; + Message[ ko ] = "ì‘ìš© í”„ë¡œê·¸ëž¨ì„ í˜„ìž¬ ì¢…ë£Œí• ìˆ˜ 없습니다.\nì¸ì‡„ ìž‘ì—…ì´ ëª¨ë‘ ëë‚ ë•Œê¹Œì§€ ë˜ëŠ”\nOLEê°€ 활성화ë 때까지 ê¸°ë‹¤ë ¸ë‹¤ê°€ ëª¨ë“ ëŒ€í™” ìƒìžë¥¼ 닫으ì‹ì‹œì˜¤."; + Message[ zh-CN ] = "çŽ°åœ¨æ— æ³•ç»“æŸè¿™ä¸ªåº”用程åºã€‚\n请您ç¨ç‰ç›´åˆ°ç¨‹åºå®Œæˆæ‰€æœ‰æ‰“å°ä»»åŠ¡æˆ–OLEå¯åŠ¨çŠ¶æ€ç»“æŸï¼Œ\n然åŽå†å…³é—所有对è¯æ¡†ã€‚"; + Message[ zh-TW ] = "ç¾åœ¨ç„¡æ³•çµæŸé€™å€‹æ‡‰ç”¨ç¨‹å¼ã€‚\nè«‹ç‰å€™æ‰€æœ‰åˆ—å°ä»»å‹™æˆ–OLE使用狀態已經çµæŸï¹\n然後å†é—œé–‰æ‰€æœ‰çš„å°è©±æ–¹å¡Šã€‚"; + Message[ tr ] = "Åžu an uygulamadan çıkılamıyor.\nTüm yazdırma iÅŸlerinin ve/veya\nOLE iÅŸlemlerinin bitmesini bekleyip tüm pencereleri kapatın."; + Message[ hi-IN ] = "कारà¥à¤¯à¤•à¥à¤°à¤® को कà¥à¤·à¤£ मातà¥à¤° में अंत नहीं कर सकते है ।\nकृपया सब छपाई कारà¥à¤¯ और/अथवा\nOLE कारà¥à¤¯ समापà¥à¤¤ होने तक ठहरिठऔर सब डयलॉगों को बनà¥à¤¦ कीजिठ।"; + Message[ ar ] = "لا يمكن إنهاء التطبيق Øالياً.\nالرجاء الانتظار Øتى انتهاء كل مهام الطباعة، Ùˆ/أو\nتنشيطات OLEØŒ ثم قم بإغلاق كل مربعات الØوار."; + Message[ he ] = "â€®×œ× × ×™×ª×Ÿ לסגור ×ת ×”×™×™×©×•× ×›×¢×ª.\n× × ×œ×”×ž×ª×™×Ÿ עד שכל משימות ההדפסה וה OLE יסתיימו ולסגור ×ת כל תיבות הדו שיח.‬"; +}; + +QueryBox MSG_IS_SERVER +{ + Buttons = WB_YES_NO ; + DefButton = WB_DEF_NO ; + Message [ de ] = "Die Applikation ist noch als Objekt- oder Druck-Server aktiv.\nSoll sie trotzdem geschlossen werden?" ; + Message [ en-US ] = "This application is as object or print server active.\nDo you want to terminate anyway?" ; + Message [ x-comment ] = " "; + Message[ pt ] = "Esta aplicação está ainda activa como servidor de objecto ou da impressora.\nMesmo assim, finalizar?"; + Message[ ru ] = "Приложение еще активно как объект или Ñервер печати.\nЗакрыть его, неÑÐ¼Ð¾Ñ‚Ñ€Ñ Ð½Ð° Ñто?"; + Message[ el ] = "Η εφαÏμογή είναι ακόμη ενεÏγή ως διακομιστής αντικειμÎνου ή εκτÏπωσης.\nΘÎλετε να τεÏματιστεί;"; + Message[ nl ] = "Deze toepassing is nog actief als object- of afdrukserver.\nToch afsluiten?"; + Message[ fr ] = "Cette application est encore active en tant que serveur d'objets ou d'imprimante.\nInterrompre malgré tout ?"; + Message[ es ] = "Esta aplicación está aún activa como servidor de objeto o de impresión.\n¿Desea finalizarla?"; + Message[ fi ] = "Tämä sovellus on aktiivinen objekti- tai tulostuspalvelin.\nHaluatko lopettaa sovelluksen?"; + Message[ ca ] = "Aquesta aplicació encara està activa com a servidor d'objecte o d'impressió.\nVoleu tancar-la?"; + Message[ it ] = "Questa applicazione è un server attivo.\nTerminare in ogni caso?"; + Message[ sk ] = "Táto aplikácia práve pracuje s objektami alebo s tlaÄou.\nPrejete si ju i napriek tomu ukonÄiÅ¥?"; + Message[ da ] = "Denne applikation er stadig aktiv som objekt- eller printserver.\nSkal der lukkes alligevel?"; + Message[ sv ] = "Tillämpningen är fortfarande aktiv antingen som objekt- eller skrivarserver.\nVill du ändÃ¥ stänga den?"; + Message[ pl ] = "Aplikacja jest jeszcze aktywna jako obiekt lub serwer wydruku.\nCzy jÄ… mimo to zamknąć?"; + Message[ pt-BR ] = "Esta aplicação ainda está ativa como servidor de objeto ou da impressora.\nMesmo assim, deseja finalizar?"; + Message[ th ] = "โปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œà¸™à¸µà¹‰à¹€à¸›à¹‡à¸™à¸§à¸±à¸•à¸–ุหรืà¸à¹€à¸‹à¸´à¸£à¹Œà¸Ÿà¹€à¸§à¸à¸£à¹Œà¸à¸²à¸£à¸žà¸´à¸¡à¸žà¹Œà¸—ี่ทำงานà¸à¸¢à¸¹à¹ˆ\nคุณต้à¸à¸‡à¸à¸²à¸£à¸¢à¸à¹€à¸¥à¸´à¸à¸«à¸£à¸·à¸à¹„ม่?"; + Message[ ja ] = "アプリケーションã¯ç¾åœ¨ã‚ªãƒ–ジェクトサーãƒãƒ¼ã¾ãŸã¯ãƒ—リントサーãƒãƒ¼ã¨ã—ã¦ã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã§ã™ã€‚\né–‰ã˜ã¦ã‚‚よã‚ã—ã„ã§ã™ã‹?"; + Message[ ko ] = "개체 ë˜ëŠ” 프린터 서버로서 ì´ ì‘ìš© í”„ë¡œê·¸ëž¨ì´ ì•„ì§ ìž‘ë™ ì¤‘ìž…ë‹ˆë‹¤.\nê·¸ëž˜ë„ ë‹«ìœ¼ì‹œê² ìŠµë‹ˆê¹Œ?"; + Message[ zh-CN ] = "这个应用程åºä½œä¸ºå¯¹è±¡æˆ–打å°æœåŠ¡å™¨è¿˜å¤„于使用的状æ€ã€‚\n您还是è¦å…³é—它?"; + Message[ zh-TW ] = "這個應用程å¼ä½œç‚ºç‰©ä»¶æˆ–列å°ä¼ºæœå™¨é‚„處於使用狀態。\n您還是è¦é—œé–‰å®ƒï¼Ÿ"; + Message[ tr ] = "Uygulama ÅŸu an nesne ya da yazdırma sunucusu olarak çalışıyor.\nYine de kapatılsın mı?"; + Message[ hi-IN ] = "इस कारà¥à¤¯à¤•à¥à¤°à¤® वसà¥à¤¤à¥ की जैसे है अथवा छपाई सरà¥à¤µà¤° कà¥à¤°à¤¿à¤¯à¤¾à¤¶à¥€à¤² है ।\nआप किसी तरह अंत करना चाहते है?"; + Message[ ar ] = "ما زال هذا التطبيق نشطاً كمزوّد كائن أو مزود طباعة.\nهل تريد غلقه على الرغم من ذلك؟"; + Message[ he ] = "â€®×™×™×©×•× ×–×” פעיל בתור שרת הדפסות ×ו שרת עצמי×.\n×”×× ×œ×¡×’×•×¨ ×ותו בכל ×–×ת?‬"; +}; + + + + + +String STR_RESWARNING +{ + Text [ de ] = "Die Systemresourcen werden knapp. Bitte beenden Sie andere Applikationen oder schließen Sie einige Fenster, bevor Sie weiterarbeiten." ; + Text [ en-US ] = "Limited system resources. Please quit other applications or close some windows before continuing." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Recursos do sistema insuficientes. Por favor, saia dos outros programas ou feche algumas janelas antes de continuar."; + Text[ ru ] = "РеÑурÑÑ‹ ÑиÑтемы ограничены. Прежде чем продолжить работу, выйдите из других приложений или закройте некоторые окна."; + Text[ el ] = "Οι πόÏοι του συστήματος είναι ελάχιστοι. ΠαÏακαλώ τεÏματίστε άλλες εφαÏμογÎÏ‚ ή κλείστε μεÏικά παÏάθυÏα Ï€Ïιν συνεχίσετε."; + Text[ nl ] = "Onvoldoende systeemgeheugen beschikbaar. Sluit andere toepassingen af of sluit een aantal vensters voordat u uw werk voortzet."; + Text[ fr ] = "Ressources insuffisantes. Veuillez quitter les autres applications ou fermer certaines fenêtres avant de continuer."; + Text[ es ] = "No hay suficientes recursos del sistema. Por favor, elimine otras aplicaciones o cierre algunas ventanas antes de continuar."; + Text[ fi ] = "Järjestelmäresurssit ovat rajoitetut. Sulje muita sovelluksia tai ikkunoita ennen kuin jatkat."; + Text[ ca ] = "No hi ha prou recursos al sistema. Tanqueu altres aplicacions o finestres abans de continuar."; + Text[ it ] = "Risorse insufficienti. Uscire dalle altre applicazioni o chiudere alcune finestre prima di continuare."; + Text[ sk ] = "VyÄerpávajú sa systémové zdroje. ProsÃm ukonÄite iné aplikácie predtým, než budete pokraÄovaÅ¥."; + Text[ da ] = "Begrænsede systemressourcer. Afslut venligst andre applikationer eller luk nogle vinduer, før du fortsætter."; + Text[ sv ] = "Inte tillräckligt med systemresurser. Avsluta andra program eller stäng nÃ¥gra fönster innan du fortsätter."; + Text[ pl ] = "Zasoby systemu sÄ… ograniczone. Aby kontynuować, należy zamknąć inne aplikacje lub okna."; + Text[ pt-BR ] = "Não há recursos do sistema suficientes. Finalize os outros programas ou feche algumas janelas antes de continuar."; + Text[ th ] = "ทรัพยาà¸à¸£à¸£à¸°à¸šà¸šà¸ˆà¸³à¸à¸±à¸” à¸à¸£à¸¸à¸“าเลิà¸à¹‚ปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œà¸à¸·à¹ˆà¸™à¸«à¸£à¸·à¸à¸›à¸´à¸”บางหน้าต่างลงà¸à¹ˆà¸à¸™à¸—ำต่à¸"; + Text[ ja ] = "システムリソースãŒé™ç•Œã«è¿‘ã¥ã„ã¦ã„ã¾ã™ã€‚作æ¥ã‚’続ã‘ã‚‹å‰ã«ã€ä»–ã®ã‚¢ãƒ—リケーションを終了ã™ã‚‹ã‹ã€ã„ãã¤ã‹ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’é–‰ã˜ã¦ãã ã•ã„。"; + Text[ ko ] = "시스템 ìžì›ì´ 부족합니다. ê³„ì† ì§„í–‰í•˜ê¸° ì „ì— ë‹¤ë¥¸ ì‘ìš© í”„ë¡œê·¸ëž¨ì„ ì¤‘ì§€í•˜ê±°ë‚˜ ì—´ë ¤ìžˆëŠ” ì°½ì„ ë‹«ìœ¼ì‹ì‹œì˜¤."; + Text[ zh-CN ] = "系统资æºä¸è¶³ã€‚请您关é—其它的程åºæˆ–者关é—一些视窗,然åŽé‡æ–°å°è¯•æ‰§è¡Œå‘½ä»¤ã€‚"; + Text[ zh-TW ] = "系統資æºä¸è¶³ã€‚請關閉其它的程å¼æˆ–者關閉一些視窗ï¹ç„¶å¾Œé‡æ–°å˜—試執行指令。"; + Text[ tr ] = "Sistem kaynakları azalıyor. Çalışmaya devam etmeden önce diÄŸer uygulamaları ya da bir kaç pencere kapatın."; + Text[ hi-IN ] = "सिसà¥à¤Ÿà¤® साधन सीमित है । कृपया आगे जारी रखने से पहिले अनà¥à¤¯ कारà¥à¤¯à¤•à¥à¤°à¤®à¥‹à¤‚ को तà¥à¤¯à¤¾à¤— दीजिठअथवा कà¥à¤› विनà¥à¤¡à¥‹à¤‚ को बनà¥à¤¦ कीजिठ।"; + Text[ ar ] = "مصادر النص تتضاءل. الرجاء إنهاء تطبيقات أخرى، أو إغلاق بعض النواÙØ°ØŒ قبل مواصلة العمل."; + Text[ he ] = "‮מש×בי מערכת מוגבלי×. יש לסגור ×™×™×©×•×ž×™× ××—×¨×™× ×œ×¤× ×™ ביצוע פעולות × ×•×¡×¤×•×ª ×‘×™×™×©×•× ×–×”.‬"; +}; +String STR_RESEXCEPTION +{ + Text [ de ] = "Wichtige Programmteile nicht gefunden. Bitte überprüfen Sie Ihre Installation." ; + Text [ en-US ] = "There are files missing. Please check application setup." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Faltam alguns ficheiros importantes. Por favor, verifique a configuração do programa."; + Text[ ru ] = "ОтÑутÑтвуют файлы. Проверьте уÑтановку приложениÑ."; + Text[ el ] = "Δεν βÏÎθηκαν οÏισμÎνα σημαντικά τμήματα του Ï€ÏογÏάμματος. ΠαÏακαλώ ελÎγξτε την εγκατάστασή σας."; + Text[ nl ] = "Er ontbreken belangrijke programmaonderdelen. Controleer of de installatie correct is uitgevoerd."; + Text[ fr ] = "Certains fichiers sont manquants. Veuillez vérifier le paramétrage de l'application."; + Text[ es ] = "No se encuentran archivos importantes del programa. Compruebe la instalación."; + Text[ fi ] = "Tiedostoja puuttuu. Tarkista sovelluksen asennus."; + Text[ ca ] = "No es poden trobar fitxers importants del programa. Comproveu la instal.lació."; + Text[ it ] = "Mancano alcuni file. Verificare la configurazione dell'applicazione."; + Text[ sk ] = "Niektoré súbory nie je možné nájsÅ¥. ProsÃm skontrolujte nastavenie aplikácie."; + Text[ da ] = "Vigtige programdele blev ikke fundet. Kontroller venligst din installation."; + Text[ sv ] = "Viktiga programdelar hittades inte. Kontrollera din installation."; + Text[ pl ] = "Brakuje niektórych plików. Sprawdź instalacjÄ™ aplikacji."; + Text[ pt-BR ] = "Estão faltando arquivos. Verifique a configuração do aplicativo."; + Text[ th ] = "มีบางà¹à¸Ÿà¹‰à¸¡à¸•à¸à¸«à¸¥à¹ˆà¸™ à¸à¸£à¸¸à¸“าตรวจสà¸à¸šà¸à¸²à¸£à¸•à¸´à¸”ตั้งโปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œ"; + Text[ ja ] = "プãƒã‚°ãƒ©ãƒ ã®å¤§åˆ‡ãªéƒ¨åˆ†ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。インストールをãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„。"; + Text[ ko ] = "중요한 프로그램 ë¶€ë¶„ì„ ì°¾ì§€ 못했습니다. 설치를 검사하ì‹ì‹œì˜¤."; + Text[ zh-CN ] = "没有找到必è¦çš„程åºç»„件。请检查您的安装。"; + Text[ zh-TW ] = "沒有找到必è¦çš„程å¼å…ƒä»¶ã€‚請檢查您的安è£ã€‚"; + Text[ tr ] = "Önemli program öğeleri bulunamadı. Kurulumunuzu kontrol edin."; + Text[ hi-IN ] = "कà¥à¤› फाइलें अनà¥à¤ªà¤¸à¥à¤¥à¤¿à¤¤ है । कृपया कारà¥à¤¯à¤•à¥à¤°à¤® सेटप की जाà¤à¤š कीजिठ।"; + Text[ ar ] = "تعذر العثور على أجزاء هامة من البرنامج. الرجاء التØقق من صØØ© عملية التثبيت عندك."; + Text[ he ] = "â€®×§×‘×¦×™× ××—×“×™× ×œ× × ×ž×¦××™×. × × ×œ×‘×“×•×§ ×ת ×”×ª×§× ×ª היישו×.‬"; +}; + + +String STR_SYSRESEXCEPTION +{ + Text [ de ] = "Die Systemresourcen sind verbraucht. Bitte starten Sie die Anwendung neu." ; + Text [ en-US ] = "System resources exhausted. Please restart the application." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Recursos do sistema esgotados. Reinicie a aplicação."; + Text[ ru ] = "СиÑтемные реÑурÑÑ‹ иÑчерпаны. ПерезапуÑтите приложение."; + Text[ el ] = "Οι πόÏοι του συστήματος εξαντλήθηκαν. ΠαÏακαλώ επανεκκινήστε την εφαÏμογή."; + Text[ nl ] = "De systeemresources zijn verbruikt. Start de toepassing opnieuw."; + Text[ fr ] = "Les ressources du système sont épuisées. Veuillez relancer l'application ."; + Text[ es ] = "Los recursos del sistema se han acabado. Por favor reinicie la aplicación."; + Text[ fi ] = "Järjestelmäresurssit ovat lopussa. Aloita sovellus uudelleen."; + Text[ ca ] = "Els recursos del sistema s'han esgotat. Reinicieu l'aplicació."; + Text[ it ] = "Le risorse del sistema sono esaurite. Riavviare l'applicazione."; + Text[ sk ] = "Systémové zdroje boli vyÄerpané. ProsÃm spustite aplikáciu znova."; + Text[ da ] = "Systemressourcerne er opbrugt. Genstart venligst denne applikation."; + Text[ sv ] = "Inte tillräckligt med systemresurser. Starta om programmet."; + Text[ pl ] = "Zasoby systemu sÄ… wyczerpane. Uruchom ponownie aplikacjÄ™."; + Text[ pt-BR ] = "Os recursos do sistema estão esgotados. Por favor, reinicie a aplicação."; + Text[ th ] = "ใช้ทรัพยาà¸à¸£à¸£à¸°à¸šà¸šà¸«à¸¡à¸” à¸à¸£à¸¸à¸“าเริ่มโปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œà¹ƒà¸«à¸¡à¹ˆ"; + Text[ ja ] = "システムリソースãŒé™ç•Œã«é”ã—ã¾ã—ãŸã€‚アプリケーションを新ã—ãスタートã—ã¦ãã ã•ã„。"; + Text[ ko ] = "시스템 ìžì›ì´ 소모ë˜ì—ˆìŠµë‹ˆë‹¤. ì‘ìš© í”„ë¡œê·¸ëž¨ì„ ë‹¤ì‹œ 시작하ì‹ì‹œì˜¤."; + Text[ zh-CN ] = "系统资æºå·²ç»ç”¨å®Œã€‚请您é‡æ–°å¯åŠ¨åº”用程åºã€‚"; + Text[ zh-TW ] = "系統資æºå·²ç¶“用完。請您é‡æ–°å•Ÿå‹•æ‡‰ç”¨ç¨‹å¼ã€‚"; + Text[ tr ] = "Sistem kaynakları tükendi. Uygulamayı yeniden baÅŸlatınız."; + Text[ hi-IN ] = "सिसà¥à¤Ÿà¤® साधन निशà¥à¤¶à¥‡à¤·à¤¿à¤¤ है । कृपया कारà¥à¤¯à¤•à¥à¤°à¤® को पà¥à¤¨à¤ƒ पà¥à¤°à¤¾à¤°à¤‚ठकीजिठ।"; + Text[ ar ] = "تم استهلاك كل مصادر النظام. الرجاء بدء التطبيق من جديد."; + Text[ he ] = "‮מש×בי מערכת ×זלו. יש ל×תחל ×ת ×”×™×™×©×•× ×ž×—×“×©.‬"; +}; + +ErrorBox MSG_ERR_SOINIT +{ + Message [ de ] = "Fehler beim Initialisieren des Objekt-Systems." ; + Message [ en-US ] = "Error initializing object-system." ; + Message [ x-comment ] = " "; + Message[ pt ] = "Erro ao inicializar o sistema de objectos."; + Message[ ru ] = "Ошибка инициализации ÑиÑтемы объекта."; + Message[ el ] = "Σφάλμα κατά την αÏχικοποίηση του συστήματος αντικειμÎνων."; + Message[ nl ] = "Fout bij initialisatie van objectsysteem."; + Message[ fr ] = "Erreur lors de l'initialisation du système d'objets."; + Message[ es ] = "Error al inicializar el sistema objeto."; + Message[ fi ] = "Objektijärjestelmän alustamisessa on ilmennyt virhe."; + Message[ ca ] = "S'ha produït un error en inicialitzar el sistema d'objectes."; + Message[ it ] = "Errore durante l'inizializzazione del sistema oggetto."; + Message[ sk ] = "Chyba v inicializácii objektového systému."; + Message[ da ] = "Fejl ved initialisering af objekt-systemet."; + Message[ sv ] = "Fel vid initiering av objektsystem."; + Message[ pl ] = "BÅ‚Ä…d inicjalizacji systemu obiektów."; + Message[ pt-BR ] = "Erro ao inicializar o sistema de objetos."; + Message[ th ] = "à¸à¸²à¸£à¹€à¸£à¸´à¹ˆà¸¡à¸£à¸°à¸šà¸šà¸§à¸±à¸•à¸–ุผิดพลาด"; + Message[ ja ] = "オブジェクト システムã®åˆæœŸåŒ–ã®éš›ã®ã‚¨ãƒ©ãƒ¼ï½¡"; + Message[ ko ] = "개체 시스템 ì´ˆê¸°í™”ì‹œì— ì˜¤ë¥˜."; + Message[ zh-CN ] = "在åˆå§‹åŒ–对象系统时å‘生错误。"; + Message[ zh-TW ] = "在åˆå§‹åŒ–物件系統時發生錯誤。"; + Message[ tr ] = "Nesne sistemi baÅŸlatılırken hata oluÅŸtu."; + Message[ hi-IN ] = "वसà¥à¤¤à¥-सिसà¥à¤Ÿà¤® को इनिशà¥à¤¯à¤²à¥ˆà¤œà¤¼ करने के समय गलती ।"; + Message[ ar ] = "Øدث خطأ أثناء تهيئة نظام الكائنات."; + Message[ he ] = "‮שגי××” בעת ×יתחול מערכת העצמי×.‬"; +}; + + + + + + + + + + + +String RID_FULLSCREENTOOLBOX +{ + Text = "" ; + /* + Text [ de ] = "Gesamtbild"; + Text [ en-US ] = "Full screen"; +*/ +}; + +ToolBox RID_FULLSCREENTOOLBOX +{ + HelpId = HID_FULLSCREENTOOLBOX ; + ButtonType = BUTTON_SYMBOL ; + LineSpacing = TRUE ; + Border = TRUE ; + Scroll = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Sizeable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Customize = TRUE ; + FloatingMode = TRUE ; + Hide = TRUE ; + _FloatingPosMapMode = MAP_APPFONT ; + _FloatingPosX = -50 ; + _FloatingPosY = -70 ; + FloatingLines = 1 ; + HideWhenDeactivate = TRUE ; + Align = BOXALIGN_TOP ; + ItemList = + { + ToolBoxItem + { + Identifier = SID_WIN_FULLSCREEN ; + }; + }; +}; + +String STR_EVENT_STARTAPP +{ + Text [ de ] = "Programmstart" ; + Text [ en-US ] = "Start Application" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Iniciar programa"; + Text[ ru ] = "ЗапуÑтить приложение"; + Text[ el ] = "Εκκίνηση εφαÏμογής"; + Text[ nl ] = "Programma starten"; + Text[ fr ] = "Démarrage du programme"; + Text[ es ] = "Iniciar aplicación"; + Text[ fi ] = "Aloita sovellus"; + Text[ ca ] = "Iniciar l'aplicació"; + Text[ it ] = "Avvia applicazione"; + Text[ sk ] = "SpustiÅ¥ aplikáciu"; + Text[ da ] = "Programstart"; + Text[ sv ] = "Programstart"; + Text[ pl ] = "Uruchom aplikacjÄ™"; + Text[ pt-BR ] = "Iniciar programa"; + Text[ th ] = "เริ่มโปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œ"; + Text[ ja ] = "プãƒã‚°ãƒ©ãƒ 起動時"; + Text[ ko ] = "ì‘ìš© 프로그램 시작"; + Text[ zh-CN ] = "å¯åŠ¨ç¨‹åº"; + Text[ zh-TW ] = "啟動程å¼"; + Text[ tr ] = "Programı çalıştır"; + Text[ hi-IN ] = "कारà¥à¤¯à¤•à¥à¤°à¤® पà¥à¤°à¤¾à¤°à¤‚ठकरो"; + Text[ ar ] = "بدء البرنامج"; + Text[ he ] = "‮התחלת יישו×‬"; +}; + +String STR_EVENT_CLOSEAPP +{ + Text [ de ] = "Programmende" ; + Text [ en-US ] = "Close Application" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Sair do programa"; + Text[ ru ] = "Закрыть приложение"; + Text[ el ] = "ΤεÏματισμός Ï€ÏογÏάμματος"; + Text[ nl ] = "Programma beëindigen"; + Text[ fr ] = "Fermeture du programme"; + Text[ es ] = "Cerrar aplicación"; + Text[ fi ] = "Sulje sovellus"; + Text[ ca ] = "Tanca l'aplicació"; + Text[ it ] = "Chiudi applicazione"; + Text[ sk ] = "UkonÄiÅ¥ aplikáciu"; + Text[ da ] = "Luk programmet"; + Text[ sv ] = "Programslut"; + Text[ pl ] = "Zamknij aplikacjÄ™"; + Text[ pt-BR ] = "Sair do programa"; + Text[ th ] = "ปิดโปรà¹à¸à¸£à¸¡à¸›à¸£à¸°à¸¢à¸¸à¸à¸•à¹Œ"; + Text[ ja ] = "プãƒã‚°ãƒ©ãƒ 終了時"; + Text[ ko ] = "프로그램 닫기"; + Text[ zh-CN ] = "结æŸç¨‹åº"; + Text[ zh-TW ] = "çµæŸç¨‹å¼"; + Text[ tr ] = "Programdan çıkış"; + Text[ hi-IN ] = "कारà¥à¤¯à¤•à¥à¤°à¤® बनà¥à¤¦ करो"; + Text[ ar ] = "نهاية البرنامج"; + Text[ he ] = "‮יצי××” מיישו×‬"; +}; + +String STR_EVENT_CREATEDOC +{ + Text [ de ] = "Dokument erzeugen" ; + Text [ en-US ] = "Create Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Criar documento"; + Text[ ru ] = "Создать документ"; + Text[ el ] = "ΔημιουÏγία εγγÏάφου"; + Text[ nl ] = "Document maken"; + Text[ fr ] = "Créer un document"; + Text[ es ] = "Crear documento"; + Text[ fi ] = "Luo asiakirja"; + Text[ ca ] = "Crea un document"; + Text[ it ] = "Crea documento"; + Text[ sk ] = "VytvoriÅ¥ dokument"; + Text[ da ] = "Opret dokument"; + Text[ sv ] = "Skapa dokument"; + Text[ pl ] = "Utwórz dokument"; + Text[ pt-BR ] = "Criar documento"; + Text[ th ] = "สร้างเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®ä½œæˆæ™‚"; + Text[ ko ] = "문서 만들기"; + Text[ zh-CN ] = "建立文档"; + Text[ zh-TW ] = "製作文件"; + Text[ tr ] = "Belge oluÅŸtur"; + Text[ hi-IN ] = "लेखपतà¥à¤° उतà¥à¤ªà¤¨à¥à¤¨ करो"; + Text[ ar ] = "إنشاء مستند"; + Text[ he ] = "‮יצירת מסמך‬"; +}; + +String STR_EVENT_CLOSEDOC +{ + Text [ de ] = "Dokument wird geschlossen" ; + Text [ en-US ] = "Document is closing" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Fechar documento"; + Text[ ru ] = "Закрыть документ"; + Text[ el ] = "Κλείσιμο εγγÏάφου"; + Text[ nl ] = "Document sluiten"; + Text[ fr ] = "Fermeture du document"; + Text[ es ] = "El documento se va a cerrar."; + Text[ fi ] = "Sulje asiakirja"; + Text[ ca ] = "Tanca el document"; + Text[ it ] = "Il documento viene chiuso"; + Text[ sk ] = "Dokument sa zatvára"; + Text[ da ] = "Programmet lukkes"; + Text[ sv ] = "Dokumentet stängs"; + Text[ pl ] = "Zamknij dokument"; + Text[ pt-BR ] = "Fechar Documento"; + Text[ th ] = "ปิดเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントを閉ã˜ã‚‹æ™‚"; + Text[ ko ] = "문서를 닫는 중"; + Text[ zh-CN ] = "æ£åœ¨å…³é—文档"; + Text[ zh-TW ] = "æ£åœ¨é—œé–‰æ–‡ä»¶"; + Text[ tr ] = "Belgeyi kapat"; + Text[ hi-IN ] = "लेखपतà¥à¤° बनà¥à¤¦ करो"; + Text[ ar ] = "سو٠يتم إغلاق المستند"; + Text[ he ] = "‮סגירת מסמך‬"; +}; + +String STR_EVENT_PREPARECLOSEDOC +{ + Text [ de ] = "Dokument schließen" ; + Text [ en-US ] = "Close Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Fechar documento"; + Text[ ru ] = "Закрыть документ"; + Text[ el ] = "Κλείσιμο εγγÏάφου"; + Text[ nl ] = "Document sluiten"; + Text[ fr ] = "Fermer le document"; + Text[ es ] = "Cerrar el documento"; + Text[ fi ] = "Sulje asiakirja"; + Text[ ca ] = "Tanca el document"; + Text[ it ] = "Chiudi documento"; + Text[ sk ] = "ZatvoriÅ¥ dokument"; + Text[ da ] = "Luk dokument"; + Text[ sv ] = "Stäng dokument"; + Text[ pl ] = "Zamknij dokument"; + Text[ pt-BR ] = "Fechar Documento"; + Text[ th ] = "ปิดเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントを閉ã˜ãŸæ™‚"; + Text[ ko ] = "문서 닫기"; + Text[ zh-CN ] = "å…³é—文档"; + Text[ zh-TW ] = "關閉文件"; + Text[ tr ] = "Belgeyi kapat"; + Text[ hi-IN ] = "लेखपतà¥à¤° बनà¥à¤¦ करो"; + Text[ ar ] = "إغلاق المستند"; + Text[ he ] = "‮סגירת מסמך‬"; +}; + +String STR_EVENT_OPENDOC +{ + Text [ de ] = "Dokument öffnen" ; + Text [ en-US ] = "Open Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Abrir documento"; + Text[ ru ] = "Открыть документ"; + Text[ el ] = "Άνοιγμα εγγÏάφου"; + Text[ nl ] = "Document openen"; + Text[ fr ] = "Ouvrir un document"; + Text[ es ] = "Abrir documento"; + Text[ fi ] = "Avaa asiakirja"; + Text[ ca ] = "Obre el document"; + Text[ it ] = "Apri documento"; + Text[ sk ] = "OtvoriÅ¥ dokument"; + Text[ da ] = "Ã…bn dokument"; + Text[ sv ] = "Öppna dokument"; + Text[ pl ] = "Otwórz dokument"; + Text[ pt-BR ] = "Abrir documento"; + Text[ th ] = "เปิดเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントを開ã時"; + Text[ ko ] = "문서 열기"; + Text[ zh-CN ] = "打开文档"; + Text[ zh-TW ] = "開啟文件"; + Text[ tr ] = "Belge aç"; + Text[ hi-IN ] = "लेखपतà¥à¤° खोलो"; + Text[ ar ] = "ÙØªØ Ù…Ø³ØªÙ†Ø¯"; + Text[ he ] = "‮פתיחת מסך‬"; +}; + +String STR_EVENT_SAVEDOC +{ + Text [ de ] = "Dokument sichern" ; + Text [ en-US ] = "Save Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Guardar documento"; + Text[ ru ] = "Сохранить документ"; + Text[ el ] = "Αποθήκευση εγγÏάφου"; + Text[ nl ] = "Document opslaan"; + Text[ fr ] = "Enregistrer le document"; + Text[ es ] = "Guardar documento"; + Text[ fi ] = "Tallenna asiakirja"; + Text[ ca ] = "Desa el document"; + Text[ it ] = "Salva documento"; + Text[ sk ] = "UložiÅ¥ dokument"; + Text[ da ] = "Gem dokument"; + Text[ sv ] = "Spara dokument"; + Text[ pl ] = "Zapisz dokument"; + Text[ pt-BR ] = "Salvar documento"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®ä¿å˜æ™‚"; + Text[ ko ] = "문서 ì €ìž¥"; + Text[ zh-CN ] = "ä¿å˜æ–‡æ¡£"; + Text[ zh-TW ] = "ä¿å˜æ–‡ä»¶"; + Text[ tr ] = "Belgeyi kaydet"; + Text[ hi-IN ] = "लेखपतà¥à¤° संचित करो"; + Text[ ar ] = "ØÙظ المستند"; + Text[ he ] = "‮שמירת מסמך‬"; +}; + +String STR_EVENT_SAVEASDOC +{ + Text [ de ] = "Dokument sichern als" ; + Text [ en-US ] = "Save Document As" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Guardar como"; + Text[ ru ] = "Сохранить документ как"; + Text[ el ] = "Αποθήκευση εγγÏάφου ως"; + Text[ nl ] = "Document opslaan als"; + Text[ fr ] = "Enregistrer le document sous"; + Text[ es ] = "Guardar documento como"; + Text[ fi ] = "Tallenna asiakirja nimellä"; + Text[ ca ] = "Desa el document com a"; + Text[ it ] = "Salva documento con nome"; + Text[ sk ] = "UložiÅ¥ dokument ako"; + Text[ da ] = "Gem dokument som"; + Text[ sv ] = "Spara dokument som"; + Text[ pl ] = "Zapisz dokument jako"; + Text[ pt-BR ] = "Salvar documento como"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£à¹€à¸›à¹‡à¸™"; + Text[ ja ] = "ドã‚ュメントã«åå‰ã‚’付ã‘ã¦ä¿å˜ã™ã‚‹æ™‚"; + Text[ ko ] = "문서를 다른 ì´ë¦„으로 ì €ìž¥"; + Text[ zh-CN ] = "文档å¦å˜ä¸º"; + Text[ zh-TW ] = "å¦å˜æ–°æª”"; + Text[ tr ] = "Belgeyi farklı kaydet"; + Text[ hi-IN ] = "लेखपतà¥à¤° संचित करो जैसे"; + Text[ ar ] = "ØÙظ المستند كـ"; + Text[ he ] = "‮שמירת מסמך בש×‬"; +}; + +String STR_EVENT_SAVEDOCDONE +{ + Text [ de ] = "Dokument wurde gesichert" ; + Text [ en-US ] = "Document has been saved" ; + Text [ x-comment ] = " "; + Text[ pt ] = "O documento foi guardado"; + Text[ ru ] = "Документ Ñохранен"; + Text[ el ] = "Το ÎγγÏαφο αποθηκεÏτηκε"; + Text[ nl ] = "Document is opgeslagen"; + Text[ fr ] = "Le document a été enregistré"; + Text[ es ] = "El documento se guardó"; + Text[ fi ] = "Asiakirja on tallennettu"; + Text[ ca ] = "S'ha desat el document"; + Text[ it ] = "Il documento è stato salvato"; + Text[ sk ] = "Dokument bol uložený"; + Text[ da ] = "Dokumentet er blevet gemt"; + Text[ sv ] = "Dokument har sparats"; + Text[ pl ] = "Dokument zostaÅ‚ zapisany"; + Text[ pt-BR ] = "O documento foi salvo"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£à¹à¸¥à¹‰à¸§"; + Text[ ja ] = "ドã‚ュメントãŒä¿å˜ã•ã‚ŒãŸæ™‚"; + Text[ ko ] = "문서가 ì €ìž¥ë˜ì—ˆìŠµë‹ˆë‹¤."; + Text[ zh-CN ] = "文档已ç»å˜ç›˜"; + Text[ zh-TW ] = "文件已經儲å˜"; + Text[ tr ] = "Belge kaydedildi"; + Text[ hi-IN ] = "लेखपतà¥à¤° को संचित किया"; + Text[ ar ] = "تم ØÙظ المستند"; + Text[ he ] = "‮המסמך × ×©×ž×¨â€¬"; +}; + +String STR_EVENT_SAVEASDOCDONE +{ + Text [ de ] = "Dokument wurde gesichert als" ; + Text [ en-US ] = "Document has been saved as" ; + Text [ x-comment ] = " "; + Text[ pt ] = "O documento foi guardado como"; + Text[ ru ] = "Документ Ñохранен как"; + Text[ el ] = "Το ÎγγÏαφο αποθηκεÏτηκε ως"; + Text[ nl ] = "Document is opgeslagen als"; + Text[ fr ] = "Le document a été enregistré sous"; + Text[ es ] = "El documento se guardó como"; + Text[ fi ] = "Asiakirja on tallennettu nimellä"; + Text[ ca ] = "S'ha anomenat i desat el document"; + Text[ it ] = "Il documento è stato salvato con il nome"; + Text[ sk ] = "Dokument bol uložený ako"; + Text[ da ] = "Dokumentet er blevet gemt som"; + Text[ sv ] = "Dokument har sparats som"; + Text[ pl ] = "Dokument zostaÅ‚ zapisany jako"; + Text[ pt-BR ] = "O documento foi salvo como"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£à¹€à¸›à¹‡à¸™à¹à¸¥à¹‰à¸§"; + Text[ ja ] = "ドã‚ュメントã«åå‰ã‚’付ã‘ã¦ä¿å˜ã—ãŸæ™‚"; + Text[ ko ] = "문서가 다ìŒì˜ ì´ë¦„으로 ì €ìž¥ë˜ì—ˆìŠµë‹ˆë‹¤"; + Text[ zh-CN ] = "文档已ç»å˜ç›˜ä¸º"; + Text[ zh-TW ] = "文件已經儲å˜ç‚º"; + Text[ tr ] = "Belge farklı kaydedildi"; + Text[ hi-IN ] = "लेखपतà¥à¤° को संचित किया जैसे"; + Text[ ar ] = "تم ØÙظ المستند كـ"; + Text[ he ] = "‮המסמך × ×©×ž×¨ בש×‬"; +}; + +String STR_EVENT_ACTIVATEDOC +{ + Text [ de ] = "Dokument aktivieren" ; + Text [ en-US ] = "Activate Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Activar documento"; + Text[ ru ] = "Ðктивировать документ"; + Text[ el ] = "ΕνεÏγοποίηση εγγÏάφου"; + Text[ nl ] = "Document activeren"; + Text[ fr ] = "Activer le document"; + Text[ es ] = "Activar documento"; + Text[ fi ] = "Aktivoi asiakirja"; + Text[ ca ] = "Activa el document"; + Text[ it ] = "Attiva documento"; + Text[ sk ] = "AktivovaÅ¥ dokument"; + Text[ da ] = "Aktiver dokument"; + Text[ sv ] = "Aktivera dokument"; + Text[ pl ] = "Uaktywnij dokument"; + Text[ pt-BR ] = "Ativar documento"; + Text[ th ] = "เà¸à¸à¸ªà¸²à¸£à¸—ี่ใช้งานà¸à¸¢à¸¹à¹ˆ"; + Text[ ja ] = "ドã‚ュメントをアクティブã«ã—ãŸæ™‚"; + Text[ ko ] = "문서 활성화"; + Text[ zh-CN ] = "å¯åŠ¨æ–‡æ¡£"; + Text[ zh-TW ] = "啟動文件"; + Text[ tr ] = "Belgeyi etkinleÅŸtir"; + Text[ hi-IN ] = "लेखपतà¥à¤° संचालित करो"; + Text[ ar ] = "تنشيط المستند"; + Text[ he ] = "‮מסמך פעיל‬"; +}; + +String STR_EVENT_DEACTIVATEDOC +{ + Text [ de ] = "Dokument deaktivieren" ; + Text [ en-US ] = "Deactivate Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Desactivar documento"; + Text[ ru ] = "Деактивировать документ"; + Text[ el ] = "ΑπενεÏγοποίηση εγγÏάφου"; + Text[ nl ] = "Document deactiveren"; + Text[ fr ] = "Désactiver le document"; + Text[ es ] = "Desactivar documento"; + Text[ fi ] = "Poista asiakirja käytöstä"; + Text[ ca ] = "Desactiva el document"; + Text[ it ] = "Disattiva documento"; + Text[ sk ] = "DezaktivovaÅ¥ dokument"; + Text[ da ] = "Deaktiver dokument"; + Text[ sv ] = "Deaktivera dokument"; + Text[ pl ] = "Dezaktywuj dokument"; + Text[ pt-BR ] = "Desativar documento"; + Text[ th ] = "เà¸à¸à¸ªà¸²à¸£à¸—ี่ไม่ได้ใช้งาน"; + Text[ ja ] = "ドã‚ュメントをéžã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«ã—ãŸæ™‚"; + Text[ ko ] = "문서 비활성화"; + Text[ zh-CN ] = "å…³é—文档"; + Text[ zh-TW ] = "å…³é—文件"; + Text[ tr ] = "Belgeyi devreden çıkart"; + Text[ hi-IN ] = "लेखपतà¥à¤° निषà¥à¤•à¥à¤°à¤¿à¤¯ करो"; + Text[ ar ] = "إلغاء تنشيط المستند"; + Text[ he ] = "‮מסמך ×œ× ×¤×¢×™×œâ€¬"; +}; + +String STR_EVENT_PRINTDOC +{ + Text [ de ] = "Dokument drucken" ; + Text [ en-US ] = "Print Document" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Imprimir documento"; + Text[ ru ] = "Печатать документ"; + Text[ el ] = "ΕκτÏπωση εγγÏάφου"; + Text[ nl ] = "Document afdrukken"; + Text[ fr ] = "Imprimer le document"; + Text[ es ] = "Imprimir documento"; + Text[ fi ] = "Tulosta asiakirja"; + Text[ ca ] = "Imprimeix el document"; + Text[ it ] = "Stampa documento"; + Text[ sk ] = "TlaÄ dokumentu"; + Text[ da ] = "Udskriv dokument"; + Text[ sv ] = "Skriv ut dokument"; + Text[ pl ] = "Drukuj dokument"; + Text[ pt-BR ] = "Imprimir documento"; + Text[ th ] = "พิมพ์เà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®å°åˆ·æ™‚"; + Text[ ko ] = "문서 ì¸ì‡„"; + Text[ zh-CN ] = "打å°æ–‡æ¡£"; + Text[ zh-TW ] = "列å°æ–‡ä»¶"; + Text[ tr ] = "Belgeyi yazdır"; + Text[ hi-IN ] = "लेखपतà¥à¤° छपाई"; + Text[ ar ] = "طباعة المستند"; + Text[ he ] = "‮הדפסת מסמך‬"; +}; + +String STR_EVENT_MODIFYCHANGED +{ + Text [ de ] = "'Geändert'-Status wurde geändert" ; + Text [ en-US ] = "'Modified' status was changed" ; + Text[ pt ] = "'Modified' status was changed"; + Text[ ru ] = "'Modified' status was changed"; + Text[ el ] = "'Modified' status was changed"; + Text[ nl ] = "'Modified' status was changed"; + Text[ fr ] = "Le statut 'Modifié' a changé"; + Text[ es ] = "El estado 'Modificado el' ha cambiado."; + Text[ fi ] = "'Modified' status was changed"; + Text[ ca ] = "'Modified' status was changed"; + Text[ it ] = "Lo stato 'Modificato' è stato cambiato"; + Text[ sk ] = "'Modified' status bol zmenený"; + Text[ da ] = "'Modified' status was changed"; + Text[ sv ] = "Status 'Ändrad' har ändrats"; + Text[ pl ] = "'Modified' status was changed"; + Text[ pt-BR ] = "'Modified' status was changed"; + Text[ th ] = "'Modified' status was changed"; + Text[ ja ] = "「変更」ステータスã®å¤‰æ›´æ™‚"; + Text[ ko ] = "'ìˆ˜ì • ë‚ ì§œ'ì˜ ìƒíƒœê°€ 변경ë¨"; + Text[ zh-CN ] = "状æ€'已更改'å·²ç»æ›´æ”¹ã€‚"; + Text[ zh-TW ] = "狀態 [已變更] 已經變更。"; + Text[ tr ] = "'Modified' status was changed"; + Text[ hi-IN ] = "'Modified' status was changed"; + Text[ ar ] = "'Modified' status was changed"; + Text[ he ] = "'Modified' status was changed"; +}; + + + + + + + + + + + +String RID_STR_NOWELCOMESCREEN +{ + Text [ de ] = "Tipps nicht mehr anzeigen" ; + Text [ en-US ] = "Don't display tips" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Não mostrar sugestões"; + Text[ ru ] = "Ðе показывать вÑплывающие подÑказки"; + Text[ el ] = "Îα μην εμφανιστοÏν άλλες συμβουλÎÏ‚"; + Text[ nl ] = "Tips niet meer weergeven"; + Text[ fr ] = "Ne plus afficher les astuces"; + Text[ es ] = "No mostrar más las sugerencias"; + Text[ fi ] = "Älä näytä vihjeitä."; + Text[ ca ] = "No mostris els consells"; + Text[ it ] = "Non mostrare più i suggerimenti"; + Text[ sk ] = "NezobrazovaÅ¥ tipy"; + Text[ da ] = "Vis ikke flere tip"; + Text[ sv ] = "Visa inte tips mer"; + Text[ pl ] = "Nie wyÅ›wietlaj wskazówek"; + Text[ pt-BR ] = "Não exibir dicas"; + Text[ th ] = "à¸à¸¢à¹ˆà¸²à¹à¸ªà¸”งคำà¹à¸™à¸°à¸™à¸³"; + Text[ ja ] = "ヒントを表示ã—ãªã„"; + Text[ ko ] = "íŒ! 표시하지 ì•ŠìŒ"; + Text[ zh-CN ] = "ä¸å†æ˜¾ç¤ºæ示"; + Text[ zh-TW ] = "ä¸è¦å†é¡¯ç¤ºæ示"; + Text[ tr ] = "Öneri görüntüleme"; + Text[ hi-IN ] = "सà¥à¤à¤¾à¤µà¥‹à¤‚ को मत दिखाओ"; + Text[ ar ] = "عدم إظهار التلميØات مرة أخرى"; + Text[ he ] = "â€®×œ× ×œ×”×¦×™×’ טיפי×‬"; +}; + + + + + + //---------------------------------------------------------------------------- + +String RID_ENVTOOLBOX +{ + Text [ de ] = "Funktionsleiste" ; + Text [ en-US ] = "Function Bar" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Barra de funções"; + Text[ ru ] = "Панель функций"; + Text[ el ] = "ΓÏαμμή λειτουÏγιών"; + Text[ nl ] = "Werkbalk"; + Text[ fr ] = "Barre de fonctions"; + Text[ es ] = "Barra de funciones"; + Text[ fi ] = "Toimintorivi"; + Text[ ca ] = "Barra de funcions"; + Text[ it ] = "Barra delle funzioni"; + Text[ sk ] = "Panel funkciÃ"; + Text[ da ] = "Funktionslinje"; + Text[ sv ] = "Funktionslist"; + Text[ pl ] = "Pasek funkcji"; + Text[ pt-BR ] = "Barra de funções"; + Text[ th ] = "à¹à¸–บฟังà¸à¹Œà¸Šà¸±à¹ˆà¸™"; + Text[ ja ] = "ファンクションãƒãƒ¼"; + Text[ ko ] = "기능 모ìŒ"; + Text[ zh-CN ] = "功能æ "; + Text[ zh-TW ] = "功能列"; + Text[ tr ] = "Ä°ÅŸlev çubuÄŸu"; + Text[ hi-IN ] = "फंकà¥à¤¶à¤¨à¥ पटà¥à¤Ÿà¥€"; + Text[ ar ] = "شريط المهام"; + Text[ he ] = "‮סרגל פעולות × ×¤×•×¦×•×ªâ€¬"; +}; + +ToolBox RID_ENVTOOLBOX +{ + HelpId = RID_ENVTOOLBOX ; + ButtonType = BUTTON_SYMBOL ; + LineSpacing = TRUE ; + Border = TRUE ; + Scroll = TRUE ; + SVLook = TRUE ; + Dockable = TRUE ; + Moveable = TRUE ; + Sizeable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Customize = TRUE ; + FloatingMode = FALSE ; + Hide = TRUE ; + HideWhenDeactivate = TRUE ; + Align = BOXALIGN_TOP ; + ItemList = + { + ToolBoxItem + { + Identifier = SID_OPENURL ; + }; + ToolBoxItem + { + Identifier = SID_BROWSE_STOP ; + Hide = TRUE; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_NEWDOCDIRECT ; + DropDown = TRUE; + }; + ToolBoxItem + { + Identifier = SID_NEWDOC ; + Hide = TRUE; + }; + ToolBoxItem + { + Identifier = SID_OPENDOC ; + }; + ToolBoxItem + { + Identifier = SID_SAVEDOC ; + }; + ToolBoxItem + { + Identifier = SID_SAVEASDOC ; + Hide = TRUE; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_EDITDOC ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_DIRECTEXPORTDOCASPDF ; + }; + ToolBoxItem + { + Identifier = SID_PRINTDOCDIRECT ; + }; + ToolBoxItem + { + Identifier = FN_FAX ; + Hide = TRUE; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_CUT ; + }; + ToolBoxItem + { + Identifier = SID_COPY ; + }; + ToolBoxItem + { + Identifier = SID_PASTE ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_UNDO ; + }; + ToolBoxItem + { + Identifier = SID_REDO ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_NAVIGATOR ; + }; + ToolBoxItem + { + Identifier = SID_STYLE_DESIGNER ; + }; + ToolBoxItem + { + Identifier = SID_HYPERLINK_DIALOG ; + }; + ToolBoxItem + { + Identifier = SID_HYPERLINK_INSERT ; + Hide = TRUE; + }; + ToolBoxItem + { + Identifier = SID_WIN_FULLSCREEN ; + Hide = TRUE; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_RECORDMACRO; + Hide = TRUE; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_GALLERY ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_CLOSEDOC; + Hide = TRUE; + }; + }; +}; + + // Image-Listen ---------------------------------------------------------- + +#define IMAGE_ID_LIST\ + IdList = {\ + SID_OPENURL;\ + SID_BROWSE_BACKWARD;\ + SID_BROWSE_FORWARD;\ + SID_BROWSE_STOP;\ + SID_BROWSE_HOME;\ + SID_RELOAD;\ + SID_EDITDOC;\ + SID_SAVEDOC;\ + SID_CREATELINK;\ + SID_PRINTDOCDIRECT;\ + SID_CUT;\ + SID_COPY;\ + SID_UNDO;\ + SID_REDO;\ + SID_EXPLORER;\ + SID_NAVIGATOR;\ + SID_STYLE_DESIGNER;\ + SID_AUTOBROWSE;\ + SID_EXPLORER_CREATEFOLDER;\ + SID_EXPLORER_CREATEBOOKMARK;\ + SID_EXPLORER_CREATEWORKPLACE;\ + SID_EXPLORER_CREATELINK;\ + SID_EXPLORER_CREATEMAILINTRAY;\ + SID_EXPLORER_CREATENEWSSERVER;\ + SID_EXPLORER_CREATEFTPSERVER;\ + SID_EXPLORER_CREATEDATABASE;\ + SID_PROPERTIES;\ + SID_EXPLORER_MAKEROOT;\ + SID_EXPLORER_MAKEBMKDIR;\ + SID_EXPLORER_PREVLEVEL;\ + SID_EXPLORER_IMPORTBOOKMARKS;\ + SID_EDIT_FRAMESET;\ + SID_SPLIT_HORIZONTAL;\ + SID_SPLIT_VERTICAL;\ + SID_SPLIT_PARENT_HORIZONTAL;\ + SID_SPLIT_PARENT_VERTICAL;\ + SID_MODIFY_FRAME;\ + SID_EXPLORER_SEARCHORIGINAL;\ + SID_EXPLORER_DETAILS;\ + SID_EXPLORER_ICONS;\ + };\ + IdCount = {\ + 40;\ + }; + +#ifndef IMAGE_STDBTN_COLOR +#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } +#endif + +ImageList RID_DEFAULTIMAGELIST_SC +{ + Prefix = "sc"; + MaskColor = IMAGE_STDBTN_COLOR ; + IMAGE_ID_LIST +}; + +ImageList RID_DEFAULTIMAGELIST_LC +{ + Prefix = "lc"; + MaskColor = IMAGE_STDBTN_COLOR ; + IMAGE_ID_LIST +}; + + + + + + + + + + + + + +WarningBox RID_SECURITY_WARNING_HYPERLINK +{ + HelpId = HID_WARNING_SECURITY_HYPERLINK; + Buttons = WB_YES_NO ; + DefButton = WB_DEF_NO ; + Message [ de ] = "Dieser Hyperlink wird \"%s\" öffnen. Wollen Sie fortfahren?" ; + Message [ en-US ] = "This hyperlink is going to open \"%s\". Do you want to proceed?" ; + Message[ pt ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ ru ] = "Ðта гиперÑÑылка открывает %s. Продолжить?"; + Message[ el ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ nl ] = "Met deze hyperlink wordt \"%s\" geopend. Wilt u doorgaan?"; + Message[ fr ] = "Cet hyperlien ouvre \"%s\". Continuer ?"; + Message[ es ] = "Este hiperenlace abrirá \"%s\". ¿Desea continuar?"; + Message[ fi ] = "Tämä hyperlinkki avaa kohteen \"%s\". Haluatko jatkaa?"; + Message[ ca ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ it ] = "Questo hyperlink apre \"%s\". Volete procedere?"; + Message[ sk ] = "Tento odkaz otvorà \"%s\". Chcete pokraÄovaÅ¥?"; + Message[ da ] = "\"Dette hyperlink Ã¥bner \"\"%s\"\". Vil du fortsætte?\""; + Message[ sv ] = "Den här hyperlänken kommer att öppna \"%s\". Vill du fortsätta?"; + Message[ pl ] = "Użycie tego hiperÅ‚Ä…cza spowoduje otwarcie \"%s\". Czy chcesz kontynuować?"; + Message[ pt-BR ] = "Este hiperlink abrirá \"%s\". Deseja continuar?"; + Message[ th ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ ja ] = "ã“ã®ãƒã‚¤ãƒ‘ーリンクを \"%s\" ã§é–‹ãã¾ã™ã€‚続行ã—ã¾ã™ã‹ã€‚"; + Message[ ko ] = "ì´ í•˜ì´í¼ë§í¬ë¥¼ 통해 \"%s\"ì´(ê°€) ì—°ê²°ë©ë‹ˆë‹¤. ê³„ì† ì§„í–‰í•˜ì‹œê² ìŠµë‹ˆê¹Œ?"; + Message[ zh-CN ] = "这个超链接将会打开 \"%s\" 。è¦ç»§ç»å—?"; + Message[ zh-TW ] = "這個超連çµå°‡æœƒé–‹å•Ÿ \"%s\" 。您è¦ç¹¼çºŒå—Žï¼Ÿ"; + Message[ tr ] = "Bu baÄŸlantı \"%s\" adresini açacaktır. Devam etmek istiyor musunuz?"; + Message[ hi-IN ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ ar ] = "This hyperlink is going to open \"%s\". Do you want to proceed?"; + Message[ he ] = "‮קישור ×–×” פותח \"%s\". ×”×× ×œ×”×ž×©×™×š?‬"; +}; + + +ErrorBox RID_INVALID_URL_MSG +{ + Buttons = WB_OK ; + Message [ de ] = "Der URL ist ungültig." ; + Message [ en-US ] = "The URL is not valid." ; + Message[ pt ] = "The URL is not valid."; + Message[ ru ] = "The URL is not valid."; + Message[ el ] = "The URL is not valid."; + Message[ nl ] = "The URL is not valid."; + Message[ fr ] = "URL non valide"; + Message[ es ] = "URL no válido."; + Message[ fi ] = "The URL is not valid."; + Message[ ca ] = "The URL is not valid."; + Message[ it ] = "URL non valido."; + Message[ sk ] = "URL je neplatné."; + Message[ da ] = "The URL is not valid."; + Message[ sv ] = "URL:en är ogiltig."; + Message[ pl ] = "The URL is not valid."; + Message[ pt-BR ] = "A URL não é válida"; + Message[ th ] = "The URL is not valid."; + Message[ ja ] = "無効㪠URL ã§ã™ã€‚"; + Message[ ko ] = "ì´ URLì€ ìœ íš¨í•˜ì§€ 않습니다."; + Message[ zh-CN ] = "这个 URL æ— æ•ˆã€‚"; + Message[ zh-TW ] = "URL 無效。"; + Message[ tr ] = "Bu geçersiz bir URL."; + Message[ hi-IN ] = "The URL is not valid."; + Message[ ar ] = "The URL is not valid."; + Message[ he ] = "Der URL ist ungültig."; +}; + diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appbas.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appbas.cxx new file mode 100644 index 000000000000..7be16a3c351e --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appbas.cxx @@ -0,0 +1,261 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/uno/Reference.h> + +#include <tools/urlobj.hxx> +#include <bf_svtools/rectitem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> + +#include <bf_svtools/stritem.hxx> + + +#include <bf_svtools/pathoptions.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "docinf.hxx" +#include "appuno.hxx" +#include "objsh.hxx" +#include "app.hxx" +#include "appdata.hxx" +#include "appimp.hxx" +#include "dlgcont.hxx" + +#include "bf_basic/basmgr.hxx" + +#include "scriptcont.hxx" + +#define ITEMID_SEARCH SID_SEARCH_ITEM + + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +#include "bf_so3/staticbaseurl.hxx" + +namespace binfilter { + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::script; + +//-------------------------------------------------------------------- + +namespace +{ + static BasicManager*& lcl_getAppBasicManager() + { + static BasicManager* s_pAppBasicManager = NULL; + return s_pAppBasicManager; + } +} + +//======================================================================== + +StarBASIC* SfxApplication::GetBasic_Impl() const +{ + BasicManager* pBasMgr = lcl_getAppBasicManager(); + return pBasMgr ? pBasMgr->GetLib(0) : NULL; +} + +//========================================================================= + +BasicManager* SfxApplication::GetBasicManager() +{ + if ( pAppData_Impl->nBasicCallLevel == 0 ) + // sicherheitshalber + EnterBasicCall(); + + BasicManager*& pBasMgr = lcl_getAppBasicManager(); + if ( !pBasMgr ) + { + // Directory bestimmen + SvtPathOptions aPathCFG; + String aAppBasicDir( aPathCFG.GetBasicPath() ); + if ( !aAppBasicDir.Len() ) + aPathCFG.SetBasicPath( String::CreateFromAscii("$(prog)") ); + + // #58293# soffice.new nur im ::com::sun::star::sdbcx::User-Dir suchen => erstes Verzeichnis + String aAppFirstBasicDir = aAppBasicDir.GetToken(1); + + // Basic erzeugen und laden + // MT: #47347# AppBasicDir ist jetzt ein PATH! + INetURLObject aAppBasic( SvtPathOptions().SubstituteVariable( String::CreateFromAscii("$(progurl)") ) ); + aAppBasic.insertName( Application::GetAppName() ); + + pBasMgr = new BasicManager( new StarBASIC, &aAppBasicDir ); + + // Als Destination das erste Dir im Pfad: + String aFileName( aAppBasic.getName() ); + aAppBasic = INetURLObject( aAppBasicDir.GetToken(1) ); + DBG_ASSERT( aAppBasic.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); + aAppBasic.insertName( aFileName ); + pBasMgr->SetStorageName( aAppBasic.PathToFileName() ); + + // globale Variablen + StarBASIC *pBas = pBasMgr->GetLib(0); + sal_Bool bBasicWasModified = pBas->IsModified(); + + // Basic container + SfxScriptLibraryContainer* pBasicCont = new SfxScriptLibraryContainer + ( DEFINE_CONST_UNICODE( "StarBasic" ), pBasMgr ); + pBasicCont->acquire(); // Hold via UNO + Reference< XLibraryContainer > xBasicCont = static_cast< XLibraryContainer* >( pBasicCont ); +// pAppData_Impl->pBasicLibContainer = pBasicCont; + pBasicCont->setBasicManager( pBasMgr ); + + // Dialog container + SfxDialogLibraryContainer* pDialogCont = new SfxDialogLibraryContainer( NULL ); + pDialogCont->acquire(); // Hold via UNO + Reference< XLibraryContainer > xDialogCont = static_cast< XLibraryContainer* >( pDialogCont ); +// pAppData_Impl->pDialogLibContainer = pDialogCont; + + LibraryContainerInfo* pInfo = new LibraryContainerInfo + ( xBasicCont, xDialogCont, static_cast< OldBasicPassword* >( pBasicCont ) ); + pBasMgr->SetLibraryContainerInfo( pInfo ); + + // Konstanten +//ASDBG RegisterBasicConstants( "so", aConstants, sizeof(aConstants)/sizeof(SfxConstant) ); + + // Durch MakeVariable wird das Basic modifiziert. + if ( !bBasicWasModified ) + pBas->SetModified( sal_False ); + } + + return pBasMgr; +} + +//-------------------------------------------------------------------- + +/*N*/ StarBASIC* SfxApplication::GetBasic() +/*N*/ { +/*N*/ return GetBasicManager()->GetLib(0); +/*N*/ } + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- + +/*N*/ void SfxApplication::EnterBasicCall() +/*N*/ { +/*N*/ if ( 1 == ++pAppData_Impl->nBasicCallLevel ) +/*N*/ { +/*N*/ DBG_TRACE( "SfxShellObject: BASIC-on-demand" ); +/*N*/ +/*N*/ // das kann l"anger dauern, da Progress nicht geht, wenigstens Sanduhr +/*N*/ //(mba)/task SfxWaitCursor aWait; +/*N*/ +/*N*/ // zuerst das BASIC laden +/*N*/ GetBasic(); +/* + // als erstes SfxShellObject das SbxObject der SfxApplication erzeugen + SbxObject *pSbx = GetSbxObject(); + DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject for SfxApplication" ); + + // die SbxObjects aller Module erzeugen + SfxModuleArr_Impl& rArr = GetModules_Impl(); + for ( sal_uInt16 n = 0; n < rArr.Count(); ++n ) + { + SfxModule *pMod = rArr.GetObject(n); + if ( pMod->IsLoaded() ) + { + pSbx = pMod->GetSbxObject(); + DBG_ASSERT( pSbx, "SfxModule: can't create SbxObject" ); + } + } + + // die SbxObjects aller Tasks erzeugen + for ( SfxTask *pTask = SfxTask::GetFirst(); pTask; pTask = SfxTask::GetNext( *pTask ) ) + pTask->GetSbxObject(); + + // die SbxObjects aller SfxObjectShells erzeugen (ggf. Frame-los!) + for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst( NULL, sal_False ); + pObjSh; + pObjSh = SfxObjectShell::GetNext(*pObjSh, NULL, sal_False) ) + { + // kein IP-Object oder wenn doch dann initialisiert? + SvStorageRef aStorage; + if ( !pObjSh->IsHandsOff() ) + aStorage = pObjSh->GetStorage(); + if ( !pObjSh->GetInPlaceObject() || aStorage.Is() ) + { + DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for %s", + pObjSh->SfxShell::GetName().GetBuffer() ) ); + pSbx = pObjSh->GetSbxObject(); + DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" ); + } + } + + // die SbxObjects der SfxShells auf den Stacks der Frames erzeugen + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,0,sal_False); + pFrame; + pFrame = SfxViewFrame::GetNext(*pFrame,0,0,sal_False) ) + { + // den Dispatcher des Frames rausholen + SfxDispatcher *pDispat = pFrame->GetDispatcher(); + pDispat->Flush(); + + // "uber alle SfxShells auf dem Stack des Dispatchers iterieren + // Frame selbst wird ausgespart, da er indirekt angezogen wird, + // sofern er ein Dokument enth"alt. + for ( sal_uInt16 nStackIdx = pDispat->GetShellLevel(*pFrame); + 0 != nStackIdx; + --nStackIdx ) + { + DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for level %u", nStackIdx-1 ); ) + pSbx = pDispat->GetShell(nStackIdx - 1)->GetSbxObject(); + DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" ); + } + + if ( !pFrame->GetObjectShell() ) + { + DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for empty frame" ); ) + pSbx = pFrame->GetSbxObject(); + DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" ); + } + } +*/ + // Factories anmelden +// SbxBase::AddFactory( new SfxSbxObjectFactory_Impl ); +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxApplication::LeaveBasicCall() +/*N*/ { +/*N*/ --pAppData_Impl->nBasicCallLevel; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appcfg.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appcfg.cxx new file mode 100644 index 000000000000..ec92f57d90d5 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appcfg.cxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +#include <stdlib.h> + +#include <tools/config.hxx> +#include <vcl/sound.hxx> +#include <vcl/msgbox.hxx> + +#include <tools/string.hxx> + +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/aeitem.hxx> +#include <bf_svtools/slstitm.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/szitem.hxx> +#include <bf_svtools/undo.hxx> + +#define _SVSTDARR_STRINGS +#include <bf_svtools/svstdarr.hxx> + +#include <bf_svtools/ttprops.hxx> +#include <sfxsids.hrc> +#include <sot/exchange.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include <bf_svtools/isethint.hxx> + +#include <unotools/configmgr.hxx> +#include <tools/urlobj.hxx> +#include <tools/wldcrd.hxx> +#include <bf_svtools/saveopt.hxx> +#include <bf_svtools/helpopt.hxx> +#include <bf_svtools/undoopt.hxx> +#include <bf_svtools/securityoptions.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/inetoptions.hxx> +#include <bf_svtools/miscopt.hxx> +#include <vcl/toolbox.hxx> +#include <unotools/localfilehelper.hxx> +#include <comphelper/processfactory.hxx> +#include <rtl/ustrbuf.hxx> + +#include "docfile.hxx" +#include "sfxtypes.hxx" +#include "objsh.hxx" +#include "objshimp.hxx" +#include "request.hxx" +#include "evntconf.hxx" +#include "cfgmgr.hxx" +#include "docinf.hxx" +#include "appdata.hxx" +#include "misccfg.hxx" +#include "appimp.hxx" +#include "helper.hxx" // SfxContentHelper::... +#include "app.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::beans; + +//-------------------------------------------------------------------- + +/*N*/ SfxEventConfiguration* SfxApplication::GetEventConfig() const +/*N*/ { +/*N*/ if (!pAppData_Impl->pEventConfig) +/*N*/ pAppData_Impl->pEventConfig = new SfxEventConfiguration; +/*N*/ return pAppData_Impl->pEventConfig; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSynchron ) +/*N*/ { +/*N*/ DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!"); +/*N*/ +/*N*/ SfxObjectShell *pDoc = rEventHint.GetObjShell(); +/*N*/ if ( pDoc ) +/*N*/ { +/*N*/ if ( pDoc->IsPreview() ) +/*N*/ return; +/*N*/ SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_HIDDEN, sal_False ); +/*N*/ if ( pItem && pItem->GetValue() ) +/*N*/ bSynchron = TRUE; +/*N*/ } +/*N*/ +/*N*/ { +/*N*/ Broadcast(rEventHint); +/*N*/ if ( pDoc ) +/*N*/ pDoc->Broadcast( rEventHint ); +/*N*/ } +/*N*/ } + +/*N*/ SfxMiscCfg* SfxApplication::GetMiscConfig() +/*N*/ { +/*N*/ if ( !pAppData_Impl->pMiscConfig ) +/*N*/ pAppData_Impl->pMiscConfig = new SfxMiscCfg; +/*N*/ +/*N*/ return pAppData_Impl->pMiscConfig; +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appdata.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appdata.cxx new file mode 100644 index 000000000000..f44c29dffefd --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appdata.cxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <tools/config.hxx> + +#define _SVSTDARR_STRINGS +#include <bf_svtools/svstdarr.hxx> + +#include "app.hxx" +#include "appdata.hxx" +#include "doctempl.hxx" +#include "docfile.hxx" +#include "imestatuswindow.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +/*N*/ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : +/*N*/ pProgress(0), +/*N*/ pPool(0), +/*N*/ pEventConfig(0), +/*N*/ nBasicCallLevel(0), +/*N*/ nRescheduleLocks(0), +/*N*/ nInReschedule(0), +/*N*/ pInitLinkList(0), + pSfxFrameObjectFactoryPtr(0), + pThisDocument(0), +/*N*/ pMatcher( 0 ), +/*N*/ pCancelMgr( 0 ), +/*N*/ pMiscConfig(0), +/*N*/ bInQuit(sal_False), +/*N*/ bInException( sal_False ), +/*N*/ m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow( +/*N*/ *pApp, ::legacy_binfilters::getLegacyProcessServiceFactory())) +/*N*/ { +/*N*/ } + +/*N*/ SfxAppData_Impl::~SfxAppData_Impl() +/*N*/ { +/*N*/ delete pCancelMgr; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appdde.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appdde.cxx new file mode 100644 index 000000000000..4740dd6c02b0 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appdde.cxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/svdde.hxx> +#include <tools/urlobj.hxx> +#include <bf_svtools/pathoptions.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "app.hxx" +#include "appdata.hxx" +#include "objsh.hxx" +#include "sfxsids.hrc" + +#include <bf_sfx2/sfxuno.hxx> + +namespace binfilter { + +//======================================================================== + +/*?*/ long SfxObjectShell::DdeExecute +/*?*/ ( +/*?*/ const String& rCmd // in unserer BASIC-Syntax formuliert +/*?*/ ) + +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------- + +/*?*/ long SfxObjectShell::DdeGetData +/*?*/ ( +/*?*/ const String& rItem, // das anzusprechende Item +/*?*/ const String& rMimeType, // in: Format +/*?*/ ::com::sun::star::uno::Any & rValue // out: angeforderte Daten +/*?*/ ) +{DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------- + +/*?*/ long SfxObjectShell::DdeSetData +/*?*/ ( +/*?*/ const String& rItem, // das anzusprechende Item +/*?*/ const String& rMimeType, // in: Format +/*?*/ const ::com::sun::star::uno::Any & rValue // out: angeforderte Daten +/*?*/ ) +/*?*/ +/* [Beschreibung] + + Diese Methode kann vom Applikationsentwickler "uberladen werden, + um an seine SfxObjectShell-Subklasse gerichtete DDE-Daten + zu empfangen. + + Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. +*/ +/*?*/ +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------- + +/*?*/ ::binfilter::SvLinkSource* SfxObjectShell::DdeCreateLinkSource +/*?*/ ( +/*?*/ const String& rItem // das zu erzeugende Item +/*?*/ ) + +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------- +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appinit.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appinit.cxx new file mode 100644 index 000000000000..6cdf2ff07cd9 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appinit.cxx @@ -0,0 +1,210 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "app.hxx" + +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/frame/XDesktop.hpp> + +#include <bf_svtools/svtools.hrc> +#include <bf_svtools/saveopt.hxx> +#include <bf_svtools/localisationoptions.hxx> + +#include <tools/config.hxx> +#include <tools/resary.hxx> + +#include <bf_so3/soerr.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_so3/inetbnd.hxx> +#include <vcl/msgbox.hxx> +#include <bf_svtools/ehdl.hxx> +#include <comphelper/processfactory.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/security.hxx> +#include <ucbhelper/configurationkeys.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/historyoptions.hxx> +#include <bf_svtools/moduleoptions.hxx> + +#include <rtl/logfile.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "appimp.hxx" +#include "appdata.hxx" +#include "arrdecl.hxx" +#include "cfgmgr.hxx" +#include "docfac.hxx" +#include "evntconf.hxx" +#include "frameobj.hxx" +#include "interno.hxx" +#include "macrconf.hxx" +#include "plugobj.hxx" +#include "progress.hxx" +#include "sfxtypes.hxx" + +#include <bf_svtools/imgdef.hxx> + +#include "eacopier.hxx" +#include "nochaos.hxx" +#include "fcontnr.hxx" +#include "helper.hxx" // SfxContentHelper::Kill() + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#include <osl/mutex.hxx> + +#include <cppuhelper/implbase1.hxx> + +namespace binfilter { + +#ifdef UNX +#define stricmp(a,b) strcmp(a,b) +#endif + +#ifdef MAC +int svstricmp( const char* pStr1, const char* pStr2); +#define stricmp svstricmp +#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; + +void doFirstTimeInit(); + +class SfxTerminateListener_Impl : public ::cppu::WeakImplHelper1< XTerminateListener > +{ +public: + virtual void SAL_CALL queryTermination( const EventObject& aEvent ) throw( TerminationVetoException, RuntimeException ); + virtual void SAL_CALL notifyTermination( const EventObject& aEvent ) throw( RuntimeException ); + virtual void SAL_CALL disposing( const EventObject& Source ) throw( RuntimeException ); +}; + +/*N*/ void SAL_CALL SfxTerminateListener_Impl::disposing( const EventObject& Source ) throw( RuntimeException ) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SfxTerminateListener_Impl::queryTermination( const EventObject& aEvent ) throw(TerminationVetoException, RuntimeException ) +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& aEvent ) throw(RuntimeException ) +/*N*/ { +/*N*/ Reference< XDesktop > xDesktop( aEvent.Source, UNO_QUERY ); +/*N*/ if( xDesktop.is() == sal_True ) +/*N*/ xDesktop->removeTerminateListener( this ); +/*N*/ +/*N*/ SolarMutexGuard aGuard; +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) ); +/*N*/ pApp->NotifyEvent(SfxEventHint( SFX_EVENT_CLOSEAPP) ); +/*N*/ pApp->Deinitialize(); +/*N*/ Application::Quit(); +/*N*/ } + +//==================================================================== + +//==================================================================== + +/*N*/ FASTBOOL SfxApplication::Initialize_Impl() +/*N*/ { +/*N*/ +/*N*/ Reference < XDesktop > xDesktop ( ::legacy_binfilters::getLegacyProcessServiceFactory()->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") ), UNO_QUERY ); +/*N*/ xDesktop->addTerminateListener( new SfxTerminateListener_Impl() ); +/*N*/ +/*N*/ // StarObjects initialisieren +/*N*/ SvFactory::Init(); +/*N*/ +/*N*/ // Factory f"ur das SfxFrameObject anlegen; da der Pointer in den AppDaten +/*N*/ // liegt, dieser aber nicht exportierbar ist, mu\s ein exportierbarer +/*N*/ // Wrapper angelegt werden +/*N*/ pAppData_Impl->pSfxFrameObjectFactoryPtr = new SfxFrameObjectFactoryPtr; +/*N*/ pAppData_Impl->pSfxFrameObjectFactoryPtr->pSfxFrameObjectFactory = SfxFrameObject::ClassFactory(); +/*N*/ SvBindStatusCallback::SetProgressCallback( STATIC_LINK( 0, SfxProgress, DefaultBindingProgress ) ); +/*N*/ +/*N*/ pImp->pEventHdl = new UniqueIndex( 1, 4, 4 ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ // Der SimplerErrorHandler dient Debugzwecken. In der Product werden +/*N*/ // nichtgehandelte Fehler durch Errorcode 1 an SFX gegeben. +/*N*/ new SimpleErrorHandler; +/*N*/ #endif +/*N*/ new SfxErrorHandler(RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1); +/*N*/ new SfxErrorHandler( +/*N*/ RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END); +/*N*/ new SfxErrorHandler( +/*N*/ (RID_SJ_START +1), ERRCODE_AREA_JAVA, ERRCODE_AREA_JAVA_END); +/*N*/ new SfxErrorHandler( +/*N*/ RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END ); +/*N*/ +/*N*/ ///////////////////////////////////////////////////////////////// +/*N*/ +/*N*/ pImp->pObjShells = new SfxObjectShellArr_Impl; +/*N*/ +/*N*/ // SolarMutexGuard aGuard; +/*N*/ +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_STARTAPP, String(), String::CreateFromAscii("OnStartApp") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEAPP, String(), String::CreateFromAscii("OnCloseApp") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_CREATEDOC, String(), String::CreateFromAscii("OnNew") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_OPENDOC, String(), String::CreateFromAscii("OnLoad") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOC, String(), String::CreateFromAscii("OnSaveAs") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOCDONE, String(), String::CreateFromAscii("OnSaveAsDone") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOC, String(), String::CreateFromAscii("OnSave") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOCDONE, String(), String::CreateFromAscii("OnSaveDone") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_PREPARECLOSEDOC, String(), String::CreateFromAscii("OnPrepareUnload") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEDOC, String(), String::CreateFromAscii("OnUnload") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_ACTIVATEDOC, String(), String::CreateFromAscii("OnFocus") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_DEACTIVATEDOC, String(), String::CreateFromAscii("OnUnfocus") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_PRINTDOC, String(), String::CreateFromAscii("OnPrint") ); +/*N*/ SfxEventConfiguration::RegisterEvent(SFX_EVENT_MODIFYCHANGED, String(), String::CreateFromAscii("OnModifyChanged") ); +/*N*/ +/*N*/ // Subklasse initialisieren +/*N*/ bDowning = sal_False; +/*N*/ bInInit = sal_True; +/*N*/ Init(); +/*N*/ +/*N*/ // get CHAOS item pool... +/*N*/ pAppData_Impl->pPool = NoChaos::GetItemPool(); +/*N*/ SetPool( pAppData_Impl->pPool ); +/*N*/ +/*N*/ bInInit = sal_False; +/*N*/ if ( bDowning ) +/*N*/ return sal_False; +/*N*/ +/*N*/ return sal_True; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appmain.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appmain.cxx new file mode 100644 index 000000000000..8eb0837fd035 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appmain.cxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//#define TF_NEWDESKTOP + +#define _SDINTERN_HXX + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <tools/urlobj.hxx> +#include <bf_svtools/cstitem.hxx> +#include <tools/config.hxx> +#include <bf_svtools/ehdl.hxx> +#include <bf_svtools/startoptions.hxx> +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/urihelper.hxx> +#include <bf_svtools/helpopt.hxx> + +#include "appimp.hxx" +#include "sfxtypes.hxx" +#include "appdata.hxx" +#include "docfac.hxx" +#include "app.hxx" +#include "interno.hxx" +#include "fcontnr.hxx" +#include "cfgmgr.hxx" +#include "appuno.hxx" +#include "objuno.hxx" +#include "docfile.hxx" + +#ifdef WNT +#include <tools/svwin.h> +#endif +namespace binfilter { + +#ifdef UNX +#define stricmp(a,b) strcmp(a,b) +#endif + + +//=================================================================== + +/*DBG_NAME(SfxAppMainIntro) +DBG_NAME(SfxAppMainSO_Init) +DBG_NAME(SfxAppMainAppRes) +DBG_NAME(SfxAppMainInit0) +DBG_NAME(SfxAppMainCreateAppWin) +DBG_NAME(SfxAppMainInit1) +DBG_NAME(SfxAppMainCfgMgr) +DBG_NAME(SfxAppMainInitController) +DBG_NAME(SfxAppMainInitException) +DBG_NAME(SfxAppMainRegisterIF) +DBG_NAME(SfxAppMainInit) +DBG_NAME(SfxAppMainLoadBasMgr) +DBG_NAME(SfxAppMainSbxInit)*/ +/*DBG_NAME(SfxAppMainInitDispatcher) +DBG_NAME(SfxAppMainLoadConfig) +DBG_NAME(SfxAppMainInitAppWin) +DBG_NAME(SfxAppMainAppEvents)*/ + +//=================================================================== + +#define SFX_TEMPNAMEBASE_DIR "soffice.tmp" +#define SFX_KEY_TEMPNAMEBASE "Temp-Dir" + +//=================================================================== + +#ifdef _MSC_VER +#pragma code_seg("STATICS") +#endif +static SfxVoidItem aStaticDefault(1); +#ifdef _MSC_VER +#pragma code_seg() +#endif + +static SfxPoolItem* aStaticDefaults[1] = +{ + &aStaticDefault +}; + +#ifdef TF_POOLABLE +static SfxItemInfo __READONLY_DATA aItemInfos[] = +{ + { 0, 0 } +}; +#endif + +//=================================================================== + +typedef Link* LinkPtr; +SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4)//STRIP008 ; + +/*N*/ TYPEINIT1(SfxSysChangeHint, SfxHint); +/*N*/ TYPEINIT2(SfxApplication,SfxShell,SfxBroadcaster); + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +/*N*/ void SfxApplication::Init +/*N*/ ( +/*N*/ ) +/*N*/ +/* [Beschreibung] + + Diese virtuelle Methode wird vom SFx aus Application:a:Main() gerufen, + bevor Execute() ausgef"uhrt wird und + - das Intro bereits angezeigt ist, + - das Applikationsfenster exisitiert, aber noch hidden ist, + - die Bindings bereits existieren (Controller sind anmeldbar), + - der Ini- und Config-Manager bereits existiert, + - die Standard-Controller bereits exisitieren, + - die SFx-Shells ihre Interfaces bereits registriert haben. + + [Querverweise] + <SfxApplication::Exit()> + <SfxApplication::OpenClients()> +*/ +/*N*/ { +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxApplication::Exit() +/*N*/ +/* [Beschreibung] + + Diese virtuelle Methode wird vom SFx aus Application::Main() gerufen, + nachdem Execute() beendet ist und + - die Konfiguration (SfxConfigManager) bereits gespeichert wurde, + - die Fensterpostionen etc. in den SfxIniManager geschrieben wurden, + - das Applikationsfenster noch existiert, aber hidden ist + - s"amtliche Dokumente und deren Views bereits geschlossen sind. + - Dispatcher, Bindings etc. bereits zerst"ort sind + + [Querverweise] + <SfxApplication::Init(int,char*[])> +*/ +/*N*/ +/*N*/ { +/*N*/ } + +//--------------------------------------------------------------------------- + +/*N*/ void SfxApplication::PreInit( ) +/*N*/ { +/*N*/ } + + +void SfxApplication::Main( ) +{ +} + +//------------------------------------------------------------------------- + +/*N*/ SfxFilterMatcher& SfxApplication::GetFilterMatcher() +/*N*/ { +/*N*/ if( !pAppData_Impl->pMatcher ) +/*N*/ { +/*N*/ pAppData_Impl->pMatcher = new SfxFilterMatcher( TRUE ); +/*N*/ ::binfilter::SetMaybeFileHdl( STATIC_LINK( +/*N*/ pAppData_Impl->pMatcher, SfxFilterMatcher, MaybeFileHdl_Impl ) ); +/*N*/ } +/*N*/ return *pAppData_Impl->pMatcher; +/*N*/ } + +//------------------------------------------------------------------------- + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appmisc.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appmisc.cxx new file mode 100644 index 000000000000..380b7922eb06 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appmisc.cxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <vcl/status.hxx> +#include <vcl/msgbox.hxx> +#include <bf_svtools/whiter.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/filter.hxx> +#include <bf_svtools/internaloptions.hxx> +#include <bf_svtools/pathoptions.hxx> + +#include <com/sun/star/registry/InvalidRegistryException.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/uno/Reference.h> +#include <tools/config.hxx> +#include <tools/rcid.h> +#include <osl/mutex.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include <unotools/configmgr.hxx> +#include <com/sun/star/frame/XDesktop.hpp> + +#include <unotools/ucbstreamhelper.hxx> +#include <framework/menuconfiguration.hxx> +#include <comphelper/processfactory.hxx> +#include <unotools/localfilehelper.hxx> +#include <unotools/bootstrap.hxx> +#include <bf_svtools/moduleoptions.hxx> +#include <osl/file.hxx> + +#include "app.hxx" +#include "appdata.hxx" +#include "cfgmgr.hxx" + +#include <bf_svtools/imgdef.hxx> + +#include "docfac.hxx" +#include "docfile.hxx" +#include "docfilt.hxx" +#include "request.hxx" +#include "fcontnr.hxx" +#include "sfx.hrc" +#include "module.hxx" +#include "openflag.hxx" +#include "appimp.hxx" +#include "helper.hxx" // SfxContentHelper::Kill() + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; + +//=================================================================== +namespace binfilter { + + +/*N*/ SfxProgress* SfxApplication::GetProgress() const +/*N*/ { +/*N*/ return pAppData_Impl->pProgress; +/*N*/ } + +/*N*/ SfxCancelManager *SfxApplication::GetCancelManager() const +/*N*/ { +/*N*/ if ( !pAppData_Impl->pCancelMgr ) +/*N*/ { +/*N*/ pAppData_Impl->pCancelMgr = new SfxCancelManager; +/*N*/ } +/*N*/ return pAppData_Impl->pCancelMgr; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appopen.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appopen.cxx new file mode 100644 index 000000000000..e1db24dc30aa --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appopen.cxx @@ -0,0 +1,182 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/document/UpdateDocMode.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_so3/svstor.hxx> +#include <doctempl.hxx> +#include <bf_svtools/sfxecode.hxx> + +#include <bf_svtools/ehdl.hxx> +#include "bf_basic/sbxobj.hxx" +#include <bf_svtools/urihelper.hxx> +#include <unotools/localfilehelper.hxx> + +#include <bf_svtools/itemset.hxx> + +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/moduleoptions.hxx> +#include <bf_svtools/templdlg.hxx> +#include <osl/file.hxx> +#include <bf_svtools/extendedsecurityoptions.hxx> +#include <bf_svtools/docpasswdrequest.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "app.hxx" +#include "appdata.hxx" +#include "cfgmgr.hxx" +#include "docfile.hxx" +#include "docinf.hxx" +#include "fcontnr.hxx" +#include "objitem.hxx" +#include "objsh.hxx" +#include "objshimp.hxx" +#include "openflag.hxx" +#include "referers.hxx" +#include "request.hxx" +#include "appimp.hxx" +#include "appuno.hxx" +#include "docfac.hxx" +#include "sfxsids.hrc" + +#define _SVSTDARR_STRINGSDTOR +#include <bf_svtools/svstdarr.hxx> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::system; +using namespace ::com::sun::star::task; +using namespace ::cppu; +//using namespace sfx2; + +//-------------------------------------------------------------------- + +/*N*/ sal_uInt32 CheckPasswd_Impl +/*N*/ ( +/*N*/ //Window *pWin, // Parent des Dialogs +/*N*/ SfxObjectShell* pDoc, +/*N*/ SfxItemPool &rPool, // Pool, falls ein Set erzeugt werden mus +/*N*/ SfxMedium *pFile // das Medium, dessen Passwort gfs. erfragt werden soll +/*N*/ ) + +/* [Beschreibung] + + Zu einem Medium das Passwort erfragen; funktioniert nur, wenn es sich + um einen Storage handelt. + Wenn in der Documentinfo das Passwort-Flag gesetzt ist, wird + das Passwort vom Benutzer per Dialog erfragt und an dem Set + des Mediums gesetzt; das Set wird, wenn nicht vorhanden, erzeugt. + +*/ + +/*N*/ { +/*N*/ ULONG nRet=0; +/*N*/ if( ( !pFile->GetFilter() || pFile->GetFilter()->UsesStorage() ) ) +/*N*/ { +/*N*/ SvStorageRef aRef = pFile->GetStorage(); +/*N*/ if(aRef.Is()) +/*N*/ { +/*N*/ sal_Bool bIsEncrypted = sal_False; +/*N*/ ::com::sun::star::uno::Any aAny; +/*N*/ if ( aRef->GetProperty( ::rtl::OUString::createFromAscii("HasEncryptedEntries"), aAny ) ) +/*N*/ aAny >>= bIsEncrypted; +/*N*/ else +/*N*/ { +/*N*/ SfxDocumentInfo aInfo; +/*N*/ bIsEncrypted = ( aInfo.Load(aRef) && aInfo.IsPasswd() ); +/*N*/ } +/*N*/ +/*N*/ if ( bIsEncrypted ) +/*N*/ { + nRet = ERRCODE_SFX_CANTGETPASSWD; + SfxItemSet *pSet = pFile->GetItemSet(); + if( pSet ) + { + Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler; + + SFX_ITEMSET_ARG( pSet, pxInteractionItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False ); + if( pxInteractionItem && ( pxInteractionItem->GetValue() >>= xInteractionHandler ) + && xInteractionHandler.is() ) + { + RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( + ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER, + INetURLObject( pFile->GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) ); + + Reference< XInteractionRequest > rRequest( pPasswordRequest ); + xInteractionHandler->handle( rRequest ); + + if ( pPasswordRequest->isPassword() ) + { + pSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + nRet = ERRCODE_NONE; + } + else + nRet = ERRCODE_IO_ABORT; + } + } +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ return nRet; +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appquit.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appquit.cxx new file mode 100644 index 000000000000..edb8304b6010 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appquit.cxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "bf_basic/basmgr.hxx" + +#ifdef WIN +#define _TL_LANG_SPECIAL +#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <com/sun/star/lang/XTypeProvider.hpp> + +#include "appdata.hxx" +#include "plugobj.hxx" +#include "arrdecl.hxx" +#include "macrconf.hxx" + +#include <bf_svtools/imgdef.hxx> + +#include "frameobj.hxx" +#include "docfile.hxx" +#include "sfxtypes.hxx" +#include "appimp.hxx" +#include "fcontnr.hxx" +#include "nochaos.hxx" +#include "doctempl.hxx" +#include "dlgcont.hxx" +#include "scriptcont.hxx" +#include "misccfg.hxx" +#include "docfac.hxx" + +namespace binfilter { + +DECLARE_LIST( SfxFrameWindowFactoryArray_Impl, SfxFrameWindowFactory* ) +SV_DECL_PTRARR(SfxInitLinkList, Link*, 2, 2)//STRIP008 ; + +//------------------------------------------------------------------------- + +/*?*/ void SfxApplication::Deinitialize() +/*?*/ { +/*?*/ if ( bDowning ) +/*?*/ return; +/*?*/ +/*?*/ StarBASIC::Stop(); +/*?*/ +/*?*/ bDowning = TRUE; // wegen Timer aus DecAliveCount und QueryExit +/*?*/ +/*?*/ bDowning = FALSE; +/*?*/ DBG_ASSERT( !SfxObjectShell::GetFirst(), +/*?*/ "existing SfxObjectShell after Execute" ); +/*?*/ bDowning = TRUE; +/*?*/ +/*?*/ // call derived application-exit +/*?*/ bInExit = TRUE; +/*?*/ Exit(); +/*?*/ +/*?*/ // Controller u."a. freigeben +/*?*/ // dabei sollten auch restliche Komponenten ( Beamer! ) verschwinden +/*?*/ SfxObjectFactory::ClearAll_Impl(); +// pBasMgr = NULL; +/*?*/ if( pImp->pBasicLibContainer ) +/*?*/ pImp->pBasicLibContainer->release(); +/*?*/ if( pImp->pDialogLibContainer ) +/*?*/ pImp->pDialogLibContainer->release(); +/*?*/ +/*?*/ bInExit = FALSE; +/*?*/ +/*?*/ // ab hier d"urfen keine SvObjects mehr existieren +/*?*/ DELETEX(pAppData_Impl->pMatcher); +/*?*/ DELETEX(pAppData_Impl->pSfxFrameObjectFactoryPtr); +/*?*/ +/*?*/ DELETEX(pAppData_Impl->pEventConfig); +/*?*/ DELETEX(pAppData_Impl->pMiscConfig); +/*?*/ SfxMacroConfig::Release_Impl(); +/*?*/ DELETEX(pAppData_Impl->pInitLinkList); +/*?*/ +/*?*/ DELETEX(pImp->pEventHdl); +/*?*/ DELETEX(pImp->pObjShells); +/*?*/ +/*?*/ NoChaos::ReleaseItemPool(); +/*?*/ pAppData_Impl->pPool = NULL; +/*?*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_appuno.cxx b/binfilter/bf_sfx2/source/appl/sfx2_appuno.cxx new file mode 100644 index 000000000000..cb5ff8e52c4b --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_appuno.cxx @@ -0,0 +1,1034 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1300) +#pragma warning( disable : 4290 ) +#endif + +#include "appuno.hxx" + +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/rectitem.hxx> +#include <tools/urlobj.hxx> +#include <bf_basic/sbmeth.hxx> +#include <bf_basic/basmgr.hxx> +#include <bf_basic/sbxcore.hxx> +#include <bf_basic/sbx.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> + +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/document/FilterOptionsRequest.hpp> +#include <com/sun/star/document/BrokenPackageRequest.hpp> + +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::document; + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "app.hxx" +#include "sfxsids.hrc" +#include "objuno.hxx" +#include "fltoptint.hxx" +#include "brokenpackageint.hxx" +#include "eventsupplier.hxx" +#include "namecont.hxx" +#include "dlgcont.hxx" +#include "scriptcont.hxx" + +namespace binfilter { + +TYPEINIT1(SfxUsrAnyItem, SfxPoolItem); + +/*N*/ SfxUsrAnyItem::SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny ) +/*N*/ : SfxPoolItem( nWhich ) +/*N*/ { +/*N*/ aValue = rAny; +/*N*/ } + +/*N*/ int SfxUsrAnyItem::operator==( const SfxPoolItem &rItem ) const +/*N*/ { +/*N*/ // return rItem.ISA( SfxUsrAnyItem ) && ((SfxUsrAnyItem&)rItem).aValue == aValue; +/*N*/ return sal_False; +/*N*/ } + + +/*N*/ SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const +/*N*/ { +/*N*/ return new SfxUsrAnyItem( Which(), aValue ); +/*N*/ } + +#define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" + +static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); +static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); +static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); +static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); +static const String sViewId = String::CreateFromAscii( "ViewId" ); +static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); +static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); +static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); +static const String sFrameName = String::CreateFromAscii( "FrameName" ); +static const String sMediaType = String::CreateFromAscii( "MediaType" ); +static const String sPostData = String::CreateFromAscii( "PostData" ); +static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); +static const String sInputStream = String::CreateFromAscii( "InputStream" ); +static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); +static const String sHidden = String::CreateFromAscii( "Hidden" ); +static const String sPreview = String::CreateFromAscii( "Preview" ); +static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); +static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); +static const String sSilent = String::CreateFromAscii( "Silent" ); +static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); +static const String sFileName = String::CreateFromAscii( "FileName" ); +static const String sOrigURL = String::CreateFromAscii( "OriginalURL" ); +static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); +static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); +static const String sModel = String::CreateFromAscii( "Model" ); +static const String sFrame = String::CreateFromAscii( "Frame" ); +static const String sViewData = String::CreateFromAscii( "ViewData" ); +static const String sFilterData = String::CreateFromAscii( "FilterData" ); +static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); +static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); +static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); +static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); +static const String sMinimized = String::CreateFromAscii( "Minimized" ); +static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); +static const String sWindowState = String::CreateFromAscii( "WindowState" ); +static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); +static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); +static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); +static const String sURL = String::CreateFromAscii( "URL" ); +static const String sFilterName = String::CreateFromAscii( "FilterName" ); +static const String sOpenFlags = String::CreateFromAscii( "OpenFlags" ); +static const String sPassword = String::CreateFromAscii( "Password" ); +static const String sReferer = String::CreateFromAscii( "Referer" ); +static const String sFilterOptions = String::CreateFromAscii( "FilterOptions" ); +static const String sVersionComment = String::CreateFromAscii( "VersionComment" ); +static const String sVersionAuthor = String::CreateFromAscii( "VersionAuthor" ); +static const String sVersion = String::CreateFromAscii( "Version" ); +static const String sOverwrite = String::CreateFromAscii( "Overwrite" ); +static const String sUnpacked = String::CreateFromAscii( "Unpacked" ); + +/*N*/ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet ) +/*N*/ { +/*N*/ sal_Int32 nCount = rArgs.getLength(); +/*N*/ const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray(); +/*N*/ if ( nCount ) +/*N*/ { +/*N*/ if ( nSlotId == SID_OPENDOC || nSlotId == SID_SAVEASDOC ) +/*N*/ { +/*N*/ for ( sal_uInt16 n=0; n<nCount; n++ ) +/*N*/ { +/*N*/ const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; +/*N*/ String aName = rProp.Name; +/*N*/ if ( aName == sURL ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for FileName" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sFilterName ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for FilterName" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_FILTER_NAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sOpenFlags ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for OpenFlags" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_OPTIONS, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sPassword ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for Password" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_PASSWORD, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sReferer ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for Referer" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_REFERER, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sFilterOptions ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for FilterOptions" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sVersionComment ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for Comment" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_DOCINFO_COMMENTS, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sVersionAuthor ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for Author" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_DOCINFO_AUTHOR, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sVersion ) +/*N*/ { +/*N*/ sal_Int16 nVal = -1; +/*N*/ sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); +/*N*/ DBG_ASSERT( bOK, "invalid type for Version" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxInt16Item( SID_VERSION, nVal ) ); +/*N*/ } +/*N*/ else if ( aName == sOverwrite ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Overwrite" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_OVERWRITE, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sUnpacked ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Unpacked" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_UNPACK, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sModel ) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); +/*N*/ else if ( aName == sStatusInd ) +/*N*/ { +/*N*/ Reference< ::com::sun::star::task::XStatusIndicator > xVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); +/*N*/ DBG_ASSERT( bOK, "invalid type for StatusIndicator" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sInteractionHdl ) +/*N*/ { +/*N*/ Reference< ::com::sun::star::task::XInteractionHandler > xVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); +/*N*/ DBG_ASSERT( bOK, "invalid type for InteractionHandler" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sViewData ) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); +/*N*/ else if ( aName == sFilterData ) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); +/*N*/ else if ( aName == sInputStream ) +/*N*/ { +/*N*/ Reference< XInputStream > xVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); +/*N*/ DBG_ASSERT( bOK, "invalid type for InputStream" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sUCBContent ) +/*N*/ { +/*N*/ Reference< XContent > xVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); +/*N*/ DBG_ASSERT( bOK, "invalid type for UCBContent" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sOutputStream ) +/*N*/ { +/*N*/ Reference< XOutputStream > xVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); +/*N*/ DBG_ASSERT( bOK, "invalid type for OutputStream" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sPostData ) +/*N*/ { +/*N*/ Reference< XInputStream > xVal; +/*N*/ sal_Bool bOK = (rProp.Value >>= xVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for PostData" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) ); +/*N*/ } +/*N*/ else if ( aName == sAsTemplate ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for AsTemplate" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sOpenNewView ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for OpenNewView" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sViewId ) +/*N*/ { +/*N*/ sal_Int16 nVal = -1; +/*N*/ sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); +/*N*/ DBG_ASSERT( bOK, "invalid type for ViewId" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) ); +/*N*/ } +/*N*/ else if ( aName == sPluginMode ) +/*N*/ { +/*N*/ sal_Int16 nVal = -1; +/*N*/ sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); +/*N*/ DBG_ASSERT( bOK, "invalid type for PluginMode" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) ); +/*N*/ } +/*N*/ else if ( aName == sReadOnly ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for ReadOnly" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sStartPresentation ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for StartPresentation" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sSelectionOnly ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for SelectionOnly" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sHidden ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Hidden" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sMinimized ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Minimized" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_MINIMIZEWINS, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sSilent ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Silent" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_SILENT, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sPreview ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for Preview" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sViewOnly ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for ViewOnly" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sDontEdit ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for ViewOnly" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sFileName ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for FileName" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sOrigURL ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for OrigURL" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_ORIGURL, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sSalvageURL ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = (rProp.Value >>= sVal); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for SalvageURL" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sFrameName ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = (rProp.Value >>= sVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for FrameName" ); +/*N*/ if (bOK && sVal.getLength()) +/*N*/ rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sMediaType ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for MediaType" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sWindowState ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for WindowState" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sTemplateName ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for TemplateName" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sTemplateRegionName ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sJumpMark ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for JumpMark" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sCharacterSet ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for CharacterSet" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_CHARSET, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sFilterFlags ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for FilterFlags" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); +/*N*/ } +/*N*/ else if ( aName == sMacroExecMode ) +/*N*/ { +/*N*/ sal_Int16 nVal =-1; +/*N*/ sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); +/*N*/ DBG_ASSERT( bOK, "invalid type for MacroExecMode" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) ); +/*N*/ } +/*N*/ else if ( aName == sUpdateDocMode ) +/*N*/ { +/*N*/ sal_Int16 nVal =-1; +/*N*/ sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); +/*N*/ DBG_ASSERT( bOK, "invalid type for UpdateDocMode" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) ); +/*N*/ } +/*N*/ else if ( aName == sRepairPackage ) +/*N*/ { +/*N*/ sal_Bool bVal = sal_False; +/*N*/ sal_Bool bOK = (rProp.Value >>= bVal); +/*N*/ DBG_ASSERT( bOK, "invalid type for RepairPackage" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) ); +/*N*/ } +/*N*/ else if ( aName == sDocumentTitle ) +/*N*/ { +/*N*/ ::rtl::OUString sVal; +/*N*/ sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); +/*N*/ DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" ); +/*N*/ if (bOK) +/*N*/ rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) ); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ) +/*N*/ { +/*N*/ // find number of properties to avoid permanent reallocations in the sequence +/*N*/ sal_Int32 nProps=0; +/*N*/ +/*N*/ // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To) +/*N*/ if ( nSlotId == SID_OPENDOC || nSlotId == SID_SAVEASDOC ) +/*N*/ { +/*N*/ sal_Int32 nAdditional=0; +/*N*/ if ( rSet.GetItemState( SID_FILTER_NAME ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_OPTIONS ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_PASSWORD ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_REFERER ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_FILE_FILTEROPTIONS ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_COMMENTS ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_AUTHOR ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_VERSION ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_OVERWRITE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_UNPACK ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_FILE_NAME ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_ORIGURL ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_WIN_POSSIZE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_MINIMIZEWINS ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET ) +/*N*/ nAdditional++; +/*N*/ +/*N*/ // consider additional arguments +/*N*/ nProps += nAdditional; +/*N*/ } +/*N*/ +/*N*/ if ( !nProps ) +/*N*/ return; +/*N*/ +/*N*/ // convert every item into a property +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps ); +/*N*/ ::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray(); +/*N*/ nProps = 0; +/*N*/ +/*N*/ if ( nSlotId == SID_OPENDOC || nSlotId == SID_SAVEASDOC ) +/*N*/ { +/*N*/ const SfxPoolItem *pItem=0; + +/*N*/ if ( rSet.GetItemState( SID_FILE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sURL; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); + } +/*N*/ if ( rSet.GetItemState( SID_FILTER_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sFilterName; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_OPTIONS, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sOpenFlags; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_PASSWORD, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sPassword; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_REFERER, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sReferer; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_FILE_FILTEROPTIONS, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sFilterOptions; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_COMMENTS, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sVersionComment; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_AUTHOR, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sVersionAuthor; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_VERSION, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sVersion; +/*N*/ pValue[nProps++].Value <<= (sal_Int16)((SfxInt16Item*)pItem)->GetValue(); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_OVERWRITE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sOverwrite; +/*N*/ pValue[nProps++].Value <<= (sal_Bool) ((SfxBoolItem*)pItem)->GetValue(); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_UNPACK, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sUnpacked; +/*N*/ pValue[nProps++].Value <<= (sal_Bool) ((SfxBoolItem*)pItem)->GetValue(); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sStatusInd; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sInteractionHdl; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sViewData; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sFilterData; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sModel; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sUCBContent; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sInputStream; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sOutputStream; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sPostData; +/*N*/ pValue[nProps++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sAsTemplate; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sOpenNewView; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sViewId; +/*N*/ pValue[nProps++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sPluginMode; +/*N*/ pValue[nProps++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sReadOnly; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sStartPresentation; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sSelectionOnly; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sHidden; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_MINIMIZEWINS, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sMinimized; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sSilent; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sPreview; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sViewOnly; +/*N*/ pValue[nProps++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() )); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sDontEdit; +/*N*/ pValue[nProps++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() )); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sFrameName; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_ORIGURL, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sOrigURL; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sSalvageURL; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sMediaType; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sWindowState; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sTemplateName; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sTemplateRegionName; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sJumpMark; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ +/*N*/ if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sCharacterSet; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sMacroExecMode; +/*N*/ pValue[nProps++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sUpdateDocMode; +/*N*/ pValue[nProps++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sRepairPackage; +/*N*/ pValue[nProps++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); +/*N*/ } +/*N*/ if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET ) +/*N*/ { +/*N*/ pValue[nProps].Name = sDocumentTitle; +/*N*/ pValue[nProps++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rArgs = aSequ; +/*N*/ } + +// ----------------------------------------------------------------------- + +extern "C" { + +/*N*/ +/*N*/ sal_Bool SAL_CALL sfx2_component_writeInfo( void* pServiceManager , +/*N*/ void* pRegistryKey ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pRegistryKey ) ) ; +/*N*/ +/*N*/ // Eigentliche Implementierung und ihre Services registrieren +/*N*/ ::rtl::OUString aImpl; +/*N*/ ::rtl::OUString aTempStr; +/*N*/ ::rtl::OUString aKeyStr; +/*N*/ Reference< XRegistryKey > xNewKey; +/*N*/ Reference< XRegistryKey > xLoaderKey; +/*N*/ +/*N*/ // global app event broadcaster +/*N*/ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); +/*N*/ aImpl += SfxGlobalEvents_Impl::impl_getStaticImplementationName(); +/*N*/ +/*N*/ aTempStr = aImpl; +/*N*/ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); +/*N*/ xNewKey = xKey->createKey( aTempStr ); +/*N*/ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster") ); +/*N*/ +/*N*/ // standalone document info +/*N*/ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); +/*N*/ aImpl += SfxStandaloneDocumentInfoObject::impl_getStaticImplementationName(); +/*N*/ +/*N*/ aTempStr = aImpl; +/*N*/ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); +/*N*/ xNewKey = xKey->createKey( aTempStr ); +/*N*/ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.StandaloneDocumentInfo") ); +/*N*/ +/*N*/ // script library container service +/*N*/ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); +/*N*/ aImpl += SfxScriptLibraryContainer::impl_getStaticImplementationName(); +/*N*/ +/*N*/ aTempStr = aImpl; +/*N*/ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); +/*N*/ xNewKey = xKey->createKey( aTempStr ); +/*N*/ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.script.ScriptLibraryContainer") ); +/*N*/ +/*N*/ // dialog library container service +/*N*/ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); +/*N*/ aImpl += SfxDialogLibraryContainer::impl_getStaticImplementationName(); +/*N*/ +/*N*/ aTempStr = aImpl; +/*N*/ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); +/*N*/ xNewKey = xKey->createKey( aTempStr ); +/*N*/ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.script.DialogLibraryContainer") ); +/*N*/ +/*N*/ return sal_True; +/*N*/ } +/*N*/ +/*N*/ void* SAL_CALL sfx2_component_getFactory( const sal_Char* pImplementationName , +/*N*/ void* pServiceManager , +/*N*/ void* pRegistryKey ) +/*N*/ { +/*N*/ // Set default return value for this operation - if it failed. +/*N*/ void* pReturn = NULL ; +/*N*/ +/*N*/ if ( +/*N*/ ( pImplementationName != NULL ) && +/*N*/ ( pServiceManager != NULL ) +/*N*/ ) +/*N*/ { +/*N*/ // Define variables which are used in following macros. +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager( reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ) ; + + //============================================================================= + // Add new macro line to handle new service. + // + // !!! ATTENTION !!! + // Write no ";" at end of line and dont forget "else" ! (see macro) + //============================================================================= +/*N*/ IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl ) +/*N*/ IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject ) +/*N*/ IF_NAME_CREATECOMPONENTFACTORY( SfxScriptLibraryContainer ) +/*N*/ IF_NAME_CREATECOMPONENTFACTORY( SfxDialogLibraryContainer ) +/*N*/ // Factory is valid - service was found. +/*N*/ if ( xFactory.is() ) +/*N*/ { +/*N*/ xFactory->acquire(); +/*N*/ pReturn = xFactory.get(); +/*N*/ } +/*N*/ } +/*N*/ // Return with result of this operation. +/*N*/ return pReturn ; +/*N*/ } +} // extern "C" + +//========================================================================= + +/*N*/ void SAL_CALL FilterOptionsContinuation::setFilterOptions( +/*N*/ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps ) +/*N*/ throw (::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ rProperties = rProps; +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL +/*N*/ FilterOptionsContinuation::getFilterOptions() +/*N*/ throw (::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ return rProperties; +/*N*/ } +/*N*/ +/*N*/ //========================================================================= +/*N*/ +/*N*/ RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel, +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties ) +/*N*/ { +/*N*/ ::rtl::OUString temp; +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; +/*N*/ ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp, +/*N*/ temp2, +/*N*/ rModel, +/*N*/ rProperties ); +/*N*/ +/*N*/ m_aRequest <<= aOptionsRequest; +/*N*/ +/*N*/ m_pAbort = new ContinuationAbort; +/*N*/ m_pOptions = new FilterOptionsContinuation; +/*N*/ +/*N*/ m_lContinuations.realloc( 2 ); +/*N*/ m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); +/*N*/ m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions ); +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest() +/*N*/ throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return m_aRequest; +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > +/*N*/ SAL_CALL RequestFilterOptions::getContinuations() +/*N*/ throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return m_lContinuations; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_dlgcont.cxx b/binfilter/bf_sfx2/source/appl/sfx2_dlgcont.cxx new file mode 100644 index 000000000000..fb2ec1ee7ee7 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_dlgcont.cxx @@ -0,0 +1,245 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#include "dlgcont.hxx" + + +#include <xmlscript/xmldlg_imexp.hxx> + + +#include <bf_sfx2/sfxuno.hxx> + +namespace binfilter { + +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::script; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star; +using namespace cppu; +using namespace rtl; +using namespace osl; + + +//============================================================================ +// Implementation class SfxDialogLibraryContainer + +/*N*/ sal_Bool SfxDialogLibraryContainer::init +/*N*/ ( const ::rtl::OUString& aInitialisationParam, SotStorage* pStor ) +/*N*/ { +/*N*/ return SfxLibraryContainer_Impl::init( +/*N*/ aInitialisationParam, +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("dialog") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("dialogs") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("xdl") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("Dialogs") ), +/*N*/ pStor ); +/*N*/ } + +// Ctor for service +// Ctor for service +SfxDialogLibraryContainer::SfxDialogLibraryContainer( void ) +{ + // all initialisation has to be done + // by calling XInitialization::initialize +} + +/*N*/ SfxDialogLibraryContainer::SfxDialogLibraryContainer( SotStorage* pStor ) +/*N*/ { +/*N*/ OUString aInitialisationParam; +/*N*/ init( aInitialisationParam, pStor ); +/*N*/ } + +// Methods to get library instances of the correct type +/*N*/ SfxLibrary_Impl* SfxDialogLibraryContainer::implCreateLibrary( void ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pRet = (SfxLibrary_Impl*) new SfxDialogLibrary( mxMSF, mxSFI ); +/*N*/ return pRet; +/*N*/ } + +/*N*/ SfxLibrary_Impl* SfxDialogLibraryContainer::implCreateLibraryLink +/*N*/ ( const OUString& aLibInfoFileURL, const OUString& StorageURL, sal_Bool ReadOnly ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pRet = +/*N*/ (SfxLibrary_Impl*) new SfxDialogLibrary +/*N*/ ( mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly ); +/*N*/ return pRet; +/*N*/ } + +/*N*/ Any SAL_CALL SfxDialogLibraryContainer::createEmptyLibraryElement( void ) +/*N*/ { +/*N*/ Reference< XInputStreamProvider > xISP; +/*N*/ Any aRetAny; +/*N*/ aRetAny <<= xISP; +/*N*/ return aRetAny; +/*N*/ } + +/*?*/ sal_Bool SAL_CALL SfxDialogLibraryContainer::isLibraryElementValid( Any aElement ) +/*?*/ { + Reference< XInputStreamProvider > xISP; + aElement >>= xISP; + sal_Bool bRet = xISP.is(); + return bRet; + +/*?*/ } + +/*?*/ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement +/*?*/ ( +/*?*/ Any aElement, +/*?*/ const OUString& aElementName, +/*?*/ Reference< XOutputStream > xOutput +/*?*/ ) +/*?*/ throw(Exception) +/*?*/ { + Reference< XInputStreamProvider > xISP; + aElement >>= xISP; + if( !xISP.is() ) + return; + + Reference< XInputStream > xInput( xISP->createInputStream() ); + Sequence< sal_Int8 > bytes; + sal_Int32 nRead = xInput->readBytes( bytes, xInput->available() ); + for (;;) + { + if( nRead ) + xOutput->writeBytes( bytes ); + + nRead = xInput->readBytes( bytes, 1024 ); + if (! nRead) + break; + } + xInput->closeInput(); +/*?*/ } + + +/*?*/ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement +/*?*/ ( const OUString& aFile, SotStorageStreamRef xElementStream ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); Any aAny; return aAny;//STRIP001 +/*?*/ } + +/*?*/ void SAL_CALL SfxDialogLibraryContainer::importFromOldStorage( const ::rtl::OUString& aFile ) +/*?*/ { +/*?*/ // Nothing to do here, old dialogs cannot be imported +/*?*/ } + + + +//============================================================================ +// Methods XInitialization +/*?*/ void SAL_CALL SfxDialogLibraryContainer::initialize( const Sequence< Any >& aArguments ) +/*?*/ throw (::com::sun::star::uno::Exception, +/*?*/ ::com::sun::star::uno::RuntimeException) +/*?*/ { + sal_Int32 nArgCount = aArguments.getLength(); + OSL_ENSURE( nArgCount, "SfxDialogLibraryContainer::initialize() called with no arguments\n" ); + + OUString aInitialisationParam; + if( nArgCount ) + { + const Any* pArgs = aArguments.getConstArray(); + pArgs[0] >>= aInitialisationParam; + OSL_ENSURE( aInitialisationParam.getLength(), + "SfxDialogLibraryContainer::initialize() called with empty url\n" ); + } + + init( aInitialisationParam ); +/*?*/ } + + +//============================================================================ +// Service +/*N*/ SFX_IMPL_SINGLEFACTORY( SfxDialogLibraryContainer ) + +Sequence< OUString > SfxDialogLibraryContainer::impl_getStaticSupportedServiceNames() +{ + static Sequence< OUString > seqServiceNames( 1 ); + static sal_Bool bNeedsInit = sal_True; + + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( bNeedsInit ) + { + OUString* pSeq = seqServiceNames.getArray(); + pSeq[0] = OUString::createFromAscii( "com.sun.star.script.DialogLibraryContainer" ); + bNeedsInit = sal_False; + } + return seqServiceNames; +} + +OUString SfxDialogLibraryContainer::impl_getStaticImplementationName() +{ + static OUString aImplName; + static sal_Bool bNeedsInit = sal_True; + + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( bNeedsInit ) + { + aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.DialogLibraryContainer" ); + bNeedsInit = sal_False; + } + return aImplName; +} + +Reference< XInterface > SAL_CALL SfxDialogLibraryContainer::impl_createInstance + ( const Reference< XMultiServiceFactory >& xServiceManager ) + throw( Exception ) +{ + Reference< XInterface > xRet = + static_cast< XInterface* >( static_cast< OWeakObject* >(new SfxDialogLibraryContainer()) ); + return xRet; +} + +//============================================================================ +// Implementation class SfxDialogLibrary + +// Ctor +/*N*/ SfxDialogLibrary::SfxDialogLibrary( Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI ) +/*N*/ : SfxLibrary_Impl( getCppuType( (const Reference< XInputStreamProvider > *)0 ), xMSF, xSFI ) +/*N*/ { +/*N*/ } + +/*N*/ SfxDialogLibrary::SfxDialogLibrary( Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI, +/*N*/ const OUString& aLibInfoFileURL, +/*N*/ const OUString& aStorageURL, +/*N*/ sal_Bool ReadOnly ) +/*N*/ : SfxLibrary_Impl( getCppuType( (const Reference< XInputStreamProvider > *)0 ), +/*N*/ xMSF, xSFI, aLibInfoFileURL, aStorageURL, ReadOnly) +/*N*/ { +/*N*/ } + +//============================================================================ + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_imestatuswindow.cxx b/binfilter/bf_sfx2/source/appl/sfx2_imestatuswindow.cxx new file mode 100644 index 000000000000..dae1a170ee56 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_imestatuswindow.cxx @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "imestatuswindow.hxx" + +#include "app.hxx" +#include "sfxsids.hrc" + +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/util/XChangesBatch.hpp" +#include "osl/diagnose.h" +#include "rtl/ustring.h" +#include "sal/types.h" +#include "osl/mutex.hxx" + +namespace binfilter { + +namespace css = ::com::sun::star; + +using sfx2::appl::ImeStatusWindow; + +ImeStatusWindow::ImeStatusWindow( + SfxApplication & rApplication, + css::uno::Reference< css::lang::XMultiServiceFactory > const & + rServiceFactory): + m_rApplication(rApplication), + m_xServiceFactory(rServiceFactory), + m_bDisposed(false) +{} + +void ImeStatusWindow::init() +{ + if (Application::CanToggleImeStatusWindow()) + try + { + sal_Bool bShow; + if (getConfig()->getPropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "ShowStatusWindow"))) + >>= bShow) + Application::ShowImeStatusWindow(bShow); + } + catch (css::uno::Exception &) + { + OSL_ENSURE(false, "com.sun.star.uno.Exception"); + // Degrade gracefully and use the VCL-supplied default if no + // configuration is available. + } +} + +ImeStatusWindow::~ImeStatusWindow() +{ + if (m_xConfig.is()) + // We should never get here, but just in case... + try + { + m_xConfig->removePropertyChangeListener( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowStatusWindow")), + this); + } + catch (css::uno::Exception &) + { + OSL_ENSURE(false, "com.sun.star.uno.RuntimeException"); + } +} + +void SAL_CALL ImeStatusWindow::disposing(css::lang::EventObject const & rSource) + throw (css::uno::RuntimeException) +{ + osl::MutexGuard aGuard(m_aMutex); + m_xConfig = 0; + m_bDisposed = true; +} + +void SAL_CALL +ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & rEvent) + throw (css::uno::RuntimeException) +{ +} + +css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig() +{ + css::uno::Reference< css::beans::XPropertySet > xConfig; + bool bAdd = false; + { + osl::MutexGuard aGuard(m_aMutex); + if (!m_xConfig.is()) + { + if (m_bDisposed) + throw css::lang::DisposedException(); + if (!m_xServiceFactory.is()) + throw css::uno::RuntimeException( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "null ::legacy_binfilters::getLegacyProcessServiceFactory()")), + 0); + css::uno::Reference< css::lang::XMultiServiceFactory > xProvider( + m_xServiceFactory->createInstance( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider"))), + css::uno::UNO_QUERY); + if (!xProvider.is()) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "null com.sun.star.configuration." + "ConfigurationProvider")), + 0); + css::beans::PropertyValue aArg( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1, + css::uno::makeAny( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/org.openoffice.Office.Common/I18N/InputMethod"))), + css::beans::PropertyState_DIRECT_VALUE); + css::uno::Sequence< css::uno::Any > aArgs(1); + aArgs[0] <<= aArg; + m_xConfig + = css::uno::Reference< css::beans::XPropertySet >( + xProvider->createInstanceWithArguments( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationUpdateAccess")), + aArgs), + css::uno::UNO_QUERY); + if (!m_xConfig.is()) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "null com.sun.star.configuration." + "ConfigurationUpdateAccess")), + 0); + bAdd = true; + } + xConfig = m_xConfig; + } + if (bAdd) + // Exceptions here could be handled individually, to support graceful + // degradation (no update notification mechanism in this case---but also + // no dispose notifications): + xConfig->addPropertyChangeListener( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowStatusWindow")), + this); + return xConfig; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_minbox.src b/binfilter/bf_sfx2/source/appl/sfx2_minbox.src new file mode 100644 index 000000000000..d26dab7baaa9 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_minbox.src @@ -0,0 +1,272 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + + + + + + + + + + + + + + + + + // pragma ------------------------------------------------------------------- + + + + // include ------------------------------------------------------------------ + +#include "app.hrc" +#include "minbox.hrc" + + // QueryBoxen --------------------------------------------------------------- + +QueryBox RID_DELETE_MAIL_QBX +{ + Buttons = WB_YES_NO ; + DefButton = WB_DEF_NO ; + /* ### ACHTUNG: Neuer Text in Resource? Sind Sie sicher, daß Sie diese Mail löschen wollen? : Sind Sie sicher, da˜ Sie diese Mail l÷schen wollen? */ + /* ### ACHTUNG: Neuer Text in Resource? Sind Sie sicher, daß Sie diese Mail löschen wollen? : Sind Sie sicher, da˜ Sie diese Mail l÷schen wollen? */ + Message [ de ] = "Sind Sie sicher, dass Sie diese Mail löschen wollen?" ; + Message [ en-US ] = "Are you sure you want to delete this message?" ; + Message [ x-comment ] = " "; + Message[ pt ] = "Deseja realmente eliminar esta mensagem?"; + Message[ ru ] = "Ð’Ñ‹ дейÑтвительно хотите удалить Ñто Ñообщение?"; + Message[ el ] = "ΘÎλετε Ï€Ïαγματικά να διαγÏάψετε το μήνυμα αυτό;"; + Message[ nl ] = "Weet u zeker dat u deze mail wilt wissen?"; + Message[ fr ] = "Êtes vous sûr de vouloir supprimer ce message ?"; + Message[ es ] = "¿Desea realmente borrar este mensaje?"; + Message[ fi ] = "Haluatko varmasti poistaa tämän viestin?"; + Message[ ca ] = "Realment voleu suprimir aquest missatge?"; + Message[ it ] = "Volete eliminare questa mail?"; + Message[ sk ] = "Ste si istý, že chcete zmazaÅ¥ túto správu?"; + Message[ da ] = "Er du sikker pÃ¥, at du vil slette denne meddelelse?"; + Message[ sv ] = "Är du säker pÃ¥ att du vill radera det här e-brevet?"; + Message[ pl ] = "Czy na pewno chcesz usunąć tÄ™ wiadomość?"; + Message[ pt-BR ] = "Deseja realmente excluir esta mensagem?"; + Message[ th ] = "คุณà¹à¸™à¹ˆà¹ƒà¸ˆà¸«à¸£à¸·à¸à¹„ม่ที่จะลบข้à¸à¸„วามนี้?"; + Message[ ja ] = "ã“ã®ãƒ¡ãƒ¼ãƒ«ã‚’本当ã«å‰Šé™¤ã—ã¾ã™ã‹ã€‚"; + Message[ ko ] = "ì´ ë©”ì¼ì„ ì •ë§ë¡œ ì‚ì œí•˜ê² ìŠµë‹ˆê¹Œ?"; + Message[ zh-CN ] = "真的è¦åˆ 除这个电å邮件?"; + Message[ zh-TW ] = "您真è¦åˆªé™¤é€™å€‹éƒµä»¶ï¼Ÿ"; + Message[ tr ] = "Bu e-posta iletisini gerçekten silmek istiyor musunuz?"; + Message[ hi-IN ] = "आप सचमà¥à¤š में इस संदेश को मिटाना चाहते है?"; + Message[ ar ] = "هل تريد بالÙعل Øذ٠هذه الرسالة؟"; + Message[ he ] = "‮ה×× ×‘×מת למחוק הודעה זו?‬"; +}; + + // RID_MAIL_INBOX -------------------------------------------------------- + +DockingWindow RID_MAIL_INBOX +{ + // HelpId = SID_MAIL_INBOX; + Border = TRUE ; + Closeable = TRUE ; + Moveable = TRUE ; + Zoomable = TRUE ; + Sizeable = TRUE ; + Dockable = TRUE ; + EnableResizing = TRUE ; + OutputSize = TRUE ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 308 , 118 ) ; + Text [ de ] = "Eingangskorb" ; + Text [ en-US ] = "Inbox" ; + PushButton BTN_MAILINBOX_OPEN + { + Pos = MAP_APPFONT ( 252 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Öffnen... : Íffnen... */ + /* ### ACHTUNG: Neuer Text in Resource? Öffnen... : Íffnen... */ + Text [ de ] = "Öffnen..." ; + Text [ en-US ] = "Open..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Abrir..."; + Text[ ru ] = "Открыть..."; + Text[ el ] = "Άνοιγμα..."; + Text[ nl ] = "Openen..."; + Text[ fr ] = "Ouvrir..."; + Text[ es ] = "Abrir..."; + Text[ fi ] = "Avaa..."; + Text[ ca ] = "Obre..."; + Text[ it ] = "Apri..."; + Text[ sk ] = "OtvoriÅ¥..."; + Text[ da ] = "Ã…bn..."; + Text[ sv ] = "Öppna..."; + Text[ pl ] = "Otwórz..."; + Text[ pt-BR ] = "Abrir..."; + Text[ th ] = "เปิด..."; + Text[ ja ] = "é–‹ã..."; + Text[ ko ] = "열기..."; + Text[ zh-CN ] = "打开..."; + Text[ zh-TW ] = "開啟舊檔..."; + Text[ tr ] = "Aç..."; + Text[ hi-IN ] = "खोलो..."; + Text[ ar ] = "ÙتØ..."; + Text[ he ] = "‮פתיחה...‬"; + }; + PushButton BTN_MAILINBOX_DELETE + { + Pos = MAP_APPFONT ( 252 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Löschen : L÷schen */ + /* ### ACHTUNG: Neuer Text in Resource? Löschen : L÷schen */ + Text [ de ] = "Löschen" ; + Text [ en-US ] = "Delete" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Eliminar"; + Text[ ru ] = "Удалить"; + Text[ el ] = "ΔιαγÏαφή"; + Text[ nl ] = "Wissen"; + Text[ fr ] = "Supprimer"; + Text[ es ] = "Borrar"; + Text[ fi ] = "Poista"; + Text[ ca ] = "Suprimeix"; + Text[ it ] = "Elimina"; + Text[ sk ] = "ZmazaÅ¥"; + Text[ da ] = "Slet"; + Text[ sv ] = "Radera"; + Text[ pl ] = "UsuÅ„"; + Text[ pt-BR ] = "Excluir"; + Text[ th ] = "ลบ"; + Text[ ja ] = "削除"; + Text[ ko ] = "ì‚ì œ"; + Text[ zh-CN ] = "åˆ é™¤"; + Text[ zh-TW ] = "刪除"; + Text[ tr ] = "Sil"; + Text[ hi-IN ] = "मिटाओ"; + Text[ ar ] = "ØØ°Ù"; + Text[ he ] = "‮מחיקה‬"; + }; + PushButton BTN_MAILINBOX_CLOSE + { + Pos = MAP_APPFONT ( 252 , 40 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */ + /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */ + Text [ de ] = "Schließen" ; + Text [ en-US ] = "Close" ; + DefButton = TRUE ; + Text [ x-comment ] = " "; + Text[ pt ] = "Fechar"; + Text[ ru ] = "Закрыть"; + Text[ el ] = "Κλείσιμο"; + Text[ nl ] = "Sluiten"; + Text[ fr ] = "Fermer"; + Text[ es ] = "Cerrar"; + Text[ fi ] = "Sulje"; + Text[ ca ] = "Tanca"; + Text[ it ] = "Chiudi"; + Text[ sk ] = "ZavrieÅ¥"; + Text[ da ] = "Luk"; + Text[ sv ] = "Stäng"; + Text[ pl ] = "Zamknij"; + Text[ pt-BR ] = "Fechar"; + Text[ th ] = "ปิด"; + Text[ ja ] = "é–‰ã˜ã‚‹"; + Text[ ko ] = "닫기"; + Text[ zh-CN ] = "å…³é—"; + Text[ zh-TW ] = "關閉"; + Text[ tr ] = "Kapat"; + Text[ hi-IN ] = "बनà¥à¤¦ करो"; + Text[ ar ] = "إغلاق"; + Text[ he ] = "‮סגירה‬"; + }; + Control CTRL_MAILINBOX_BROWSER + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 240 , 105 ) ; + Border = TRUE ; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "Caixa de recepção"; + Text[ ru ] = "ВходÑщие"; + Text[ el ] = "Καλάθι εισεÏχόμενα"; + Text[ nl ] = "Postvak IN"; + Text[ fr ] = "Boîte de réception"; + Text[ es ] = "Carpeta de entrada"; + Text[ fi ] = "Saapuneet"; + Text[ ca ] = "Carpeta de entrada"; + Text[ it ] = "Posta in arrivo"; + Text[ sk ] = "DoÅ¡lá poÅ¡ta"; + Text[ da ] = "Indbakke"; + Text[ sv ] = "Inkorg"; + Text[ pl ] = "Skrzynka odbiorcza"; + Text[ pt-BR ] = "Caixa de entrada"; + Text[ th ] = "à¸à¸¥à¹ˆà¸à¸‡à¸‚าเข้า"; + Text[ ja ] = "å—信トレー"; + Text[ ko ] = "ë°›ì€ íŽ¸ì§€í•¨"; + Text[ zh-CN ] = "收件箱"; + Text[ zh-TW ] = "收件匣"; + Text[ tr ] = "Gelen kutusu"; + Text[ hi-IN ] = "इनबॉकà¥à¤¸"; + Text[ ar ] = "سلة الوارد"; + Text[ he ] = "â€®×ª× ×“×•×ר × ×›× ×¡â€¬"; +}; + + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binfilter/bf_sfx2/source/appl/sfx2_module.cxx b/binfilter/bf_sfx2/source/appl/sfx2_module.cxx new file mode 100644 index 000000000000..c059e4de895a --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_module.cxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <stdio.h> +#include <tools/rcid.h> + +#include <cstdarg> +#include "app.hxx" +#include "arrdecl.hxx" +#include "docfac.hxx" +#include "module.hxx" + +namespace binfilter { + +static SfxModuleArr_Impl* pModules=0; + +/*N*/ TYPEINIT1(SfxModule, SfxShell); + +/*?*/ BOOL SfxModule::QueryUnload() +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +/*?*/ SfxModule* SfxModule::Load() +/*?*/ { +/*?*/ return 0; +/*?*/ } + +/*?*/ void SfxModule::Free() +/*?*/ { +/*?*/ } + + +/*N*/ ResMgr* SfxModule::GetResMgr() +/*N*/ { +/*N*/ return pResMgr; +/*N*/ } + +//==================================================================== +/*N*/ SfxModule::SfxModule( ResMgr* pMgrP, BOOL bDummyP, +/*N*/ SfxObjectFactory* pFactoryP, ... ) +/*N*/ : pResMgr( pMgrP ), bDummy( bDummyP ) +/*N*/ { +/*N*/ if( !bDummy ) +/*N*/ { +/*N*/ SfxApplication *pApp = SFX_APP(); +/*N*/ SfxModuleArr_Impl& rArr = GetModules_Impl(); +/*N*/ SfxModule* pPtr = (SfxModule*)this; +/*N*/ rArr.C40_INSERT( SfxModule, pPtr, rArr.Count() ); +/*N*/ SetPool( &pApp->GetPool() ); +/*N*/ } +/*N*/ std::va_list pVarArgs; +/*N*/ va_start( pVarArgs, pFactoryP ); +/*N*/ for ( SfxObjectFactory *pArg = pFactoryP; pArg; +/*N*/ pArg = va_arg( pVarArgs, SfxObjectFactory* ) ) +/*N*/ pArg->SetModule_Impl( this ); +/*N*/ va_end(pVarArgs); +/*N*/ } + +/*N*/ SfxModule::~SfxModule() +/*N*/ { +/*N*/ if( !bDummy ) +/*N*/ { +/*N*/ if ( SFX_APP()->Get_Impl() ) +/*N*/ { +/*N*/ // Das Modul wird noch vor dem DeInitialize zerst"ort, also auis dem Array entfernen +/*N*/ SfxModuleArr_Impl& rArr = GetModules_Impl(); +/*N*/ for( USHORT nPos = rArr.Count(); nPos--; ) +/*N*/ { +/*N*/ if( rArr[ nPos ] == this ) +/*N*/ { +/*N*/ rArr.Remove( nPos ); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ delete pResMgr; +/*N*/ } +/*N*/ } + +/*N*/ SfxModuleArr_Impl& SfxModule::GetModules_Impl() +/*N*/ { +/*N*/ if( !pModules ) +/*N*/ pModules = new SfxModuleArr_Impl; +/*N*/ return *pModules; +/*N*/ }; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_namecont.cxx b/binfilter/bf_sfx2/source/appl/sfx2_namecont.cxx new file mode 100644 index 000000000000..b53a3266f92e --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_namecont.cxx @@ -0,0 +1,1797 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#include <rtl/uri.hxx> + + +#include "namecont.hxx" + +#include <tools/urlobj.hxx> +#include <unotools/streamwrap.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/ehdl.hxx> +#include "bf_basic/basmgr.hxx" + +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/DeploymentException.hpp> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::script; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star; +using namespace cppu; +using namespace rtl; +using namespace osl; + + +//============================================================================ +// Implementation class NameContainer_Impl + +namespace SfxContainer_Impl +{ + +// Methods XElementAccess +/*?*/ Type NameContainer_Impl::getElementType() +/*?*/ throw(RuntimeException) +/*?*/ { + return mType; +/*?*/ } + +/*N*/ sal_Bool NameContainer_Impl::hasElements() +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ sal_Bool bRet = (mnElementCount > 0); +/*N*/ return bRet; +/*N*/ } + +// Methods XNameAccess +/*N*/ Any NameContainer_Impl::getByName( const OUString& aName ) +/*N*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ NameContainerNameMap::iterator aIt = mHashMap.find( aName ); +/*N*/ if( aIt == mHashMap.end() ) +/*N*/ { +/*?*/ throw NoSuchElementException(); +/*N*/ } +/*N*/ sal_Int32 iHashResult = (*aIt).second; +/*N*/ Any aRetAny = mValues.getConstArray()[ iHashResult ]; +/*N*/ return aRetAny; +/*N*/ } + +/*N*/ Sequence< OUString > NameContainer_Impl::getElementNames() +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ return mNames; +/*N*/ } + +/*N*/ sal_Bool NameContainer_Impl::hasByName( const OUString& aName ) +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ NameContainerNameMap::iterator aIt = mHashMap.find( aName ); +/*N*/ sal_Bool bRet = ( aIt != mHashMap.end() ); +/*N*/ return bRet; +/*N*/ } + + +// Methods XNameReplace +/*N*/ void NameContainer_Impl::replaceByName( const OUString& aName, const Any& aElement ) +/*N*/ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ Type aAnyType = aElement.getValueType(); +/*N*/ if( mType != aAnyType ) +/*?*/ throw IllegalArgumentException(); +/*N*/ +/*N*/ NameContainerNameMap::iterator aIt = mHashMap.find( aName ); +/*N*/ if( aIt == mHashMap.end() ) +/*N*/ { +/*?*/ throw NoSuchElementException(); +/*N*/ } +/*N*/ sal_Int32 iHashResult = (*aIt).second; +/*N*/ Any aOldElement = mValues.getConstArray()[ iHashResult ]; +/*N*/ mValues.getArray()[ iHashResult ] = aElement; +/*N*/ +/*N*/ +/*N*/ // Fire event +/*N*/ ContainerEvent aEvent; +/*N*/ aEvent.Source = mpxEventSource; +/*N*/ aEvent.Accessor <<= aName; +/*N*/ aEvent.Element = aElement; +/*N*/ aEvent.ReplacedElement = aOldElement; +/*N*/ +/*N*/ OInterfaceIteratorHelper aIterator( maListenerContainer ); +/*N*/ while( aIterator.hasMoreElements() ) +/*N*/ { +/*?*/ Reference< XInterface > xIface = aIterator.next(); +/*?*/ Reference< XContainerListener > xListener( xIface, UNO_QUERY ); +/*?*/ try +/*?*/ { +/*?*/ xListener->elementReplaced( aEvent ); +/*?*/ } +/*?*/ catch(RuntimeException&) +/*?*/ { +/*?*/ aIterator.remove(); +/*?*/ } +/*N*/ } +/*N*/ } + + +// Methods XNameContainer +/*N*/ void NameContainer_Impl::insertByName( const OUString& aName, const Any& aElement ) +/*N*/ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ Type aAnyType = aElement.getValueType(); +/*N*/ if( mType != aAnyType ) +/*?*/ throw IllegalArgumentException(); +/*N*/ +/*N*/ NameContainerNameMap::iterator aIt = mHashMap.find( aName ); +/*N*/ if( aIt != mHashMap.end() ) +/*N*/ { +/*?*/ throw ElementExistException(); +/*N*/ } +/*N*/ +/*N*/ sal_Int32 nCount = mNames.getLength(); +/*N*/ mNames.realloc( nCount + 1 ); +/*N*/ mValues.realloc( nCount + 1 ); +/*N*/ mNames.getArray()[ nCount ] = aName; +/*N*/ mValues.getArray()[ nCount ] = aElement; +/*N*/ +/*N*/ mHashMap[ aName ] = nCount; +/*N*/ mnElementCount++; +/*N*/ +/*N*/ +/*N*/ // Fire event +/*N*/ ContainerEvent aEvent; +/*N*/ aEvent.Source = mpxEventSource; +/*N*/ aEvent.Accessor <<= aName; +/*N*/ aEvent.Element = aElement; +/*N*/ +/*N*/ OInterfaceIteratorHelper aIterator( maListenerContainer ); +/*N*/ while( aIterator.hasMoreElements() ) +/*N*/ { +/*N*/ Reference< XInterface > xIface = aIterator.next(); +/*N*/ Reference< XContainerListener > xListener( xIface, UNO_QUERY ); +/*N*/ try +/*N*/ { +/*N*/ xListener->elementInserted( aEvent ); +/*N*/ } +/*N*/ catch(RuntimeException&) +/*N*/ { +/*?*/ aIterator.remove(); +/*N*/ } +/*N*/ } +/*N*/ } + +/*?*/ void NameContainer_Impl::removeByName( const OUString& Name ) +/*?*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + + +// Methods XContainer +/*N*/ void SAL_CALL NameContainer_Impl::addContainerListener( const Reference< XContainerListener >& xListener ) +/*N*/ throw (RuntimeException) +/*N*/ { +/*N*/ if( !xListener.is() ) +/*?*/ throw RuntimeException(); +/*N*/ Reference< XInterface > xIface( xListener, UNO_QUERY ); +/*N*/ maListenerContainer.addInterface( xIface ); +/*N*/ } + +/*?*/ void SAL_CALL NameContainer_Impl::removeContainerListener( const Reference< XContainerListener >& xListener ) +/*?*/ throw (RuntimeException) +/*?*/ { + if( !xListener.is() ) + throw RuntimeException(); + Reference< XInterface > xIface( xListener, UNO_QUERY ); + maListenerContainer.removeInterface( xIface ); +/*?*/ } + +} // namespace SfxContainer_Impl + + +//============================================================================ + +// Implementation class SfxLibraryContainer_Impl + +// Ctor +/*N*/ SfxLibraryContainer_Impl::SfxLibraryContainer_Impl( void ) +/*N*/ : maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) ) +/*N*/ , mbModified( sal_False ) +/*N*/ , mbOldInfoFormat( sal_False ) +/*N*/ , mpBasMgr( NULL ) +/*N*/ , mbOwnBasMgr( sal_False ) +/*N*/ { +/*N*/ mxMSF = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*N*/ if( !mxMSF.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't get ProcessServiceFactory\n" ); +/*N*/ } +/*N*/ +/*N*/ mxSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance +/*N*/ ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY ); +/*N*/ if( !mxSFI.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't create SimpleFileAccess component\n" ); +/*N*/ } + mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance + ( OUString::createFromAscii( "com.sun.star.util.PathSubstitution" ) ), UNO_QUERY ); + OSL_ENSURE( mxStringSubstitution.is(), "### couln't create PathSubstitution component\n" ); +/*N*/ } + +/*N*/ SfxLibraryContainer_Impl::~SfxLibraryContainer_Impl() +/*N*/ { +/*N*/ if( mbOwnBasMgr ) +/*?*/ BasicManager::LegacyDeleteBasicManager( mpBasMgr ); +/*N*/ } + + +/*?*/ static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj, +/*?*/ const INetURLObject& rTargetFolderInetObj, +/*?*/ const OUString& rCheckFileName, +/*?*/ const OUString& rCheckExtension, +/*?*/ Reference< XSimpleFileAccess > xSFI ) +/*?*/ { + INetURLObject aTargetFolderInetObj( rTargetFolderInetObj ); + aTargetFolderInetObj.insertName( rCheckFileName, sal_True, INetURLObject::LAST_SEGMENT, + sal_True, INetURLObject::ENCODE_ALL ); + aTargetFolderInetObj.setExtension( rCheckExtension ); + OUString aTargetFile = aTargetFolderInetObj.GetMainURL( INetURLObject::NO_DECODE ); + if( !xSFI->exists( aTargetFile ) ) + { + INetURLObject aSourceFolderInetObj( rSourceFolderInetObj ); + aSourceFolderInetObj.insertName( rCheckFileName, sal_True, INetURLObject::LAST_SEGMENT, + sal_True, INetURLObject::ENCODE_ALL ); + aSourceFolderInetObj.setExtension( rCheckExtension ); + OUString aSourceFile = aSourceFolderInetObj.GetMainURL( INetURLObject::NO_DECODE ); + xSFI->copy( aSourceFile, aTargetFile ); + } +/*?*/ } + +/*N*/ sal_Bool SfxLibraryContainer_Impl::init( +/*N*/ const OUString& aInitialisationParam, +/*N*/ const OUString& aInfoFileName, +/*N*/ const OUString& aOldInfoFileName, +/*N*/ const OUString& aLibElementFileExtension, +/*N*/ const OUString& aLibrariesDir, +/*N*/ SotStorageRef xStorage ) +/*N*/ { +/*N*/ maInitialisationParam = aInitialisationParam; +/*N*/ maInfoFileName = aInfoFileName; +/*N*/ maOldInfoFileName = aOldInfoFileName; +/*N*/ maLibElementFileExtension = aLibElementFileExtension; +/*N*/ maLibrariesDir = aLibrariesDir; +/*N*/ +/*N*/ meInitMode = DEFAULT; +/*N*/ INetURLObject aInitUrlInetObj( maInitialisationParam ); +/*N*/ OUString aInitFileName = aInitUrlInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ if( aInitFileName.getLength() ) +/*N*/ { +/*N*/ // We need a BasicManager to avoid problems +/*?*/ StarBASIC* pBas = new StarBASIC(); +/*?*/ mpBasMgr = new BasicManager( pBas ); +/*?*/ mbOwnBasMgr = sal_True; +/*?*/ +/*?*/ OUString aExtension = aInitUrlInetObj.getExtension(); +/*?*/ if( aExtension.compareToAscii( "xlc" ) == COMPARE_EQUAL ) +/*?*/ { +/*?*/ meInitMode = CONTAINER_INIT_FILE; +/*?*/ INetURLObject aLibPathInetObj( aInitUrlInetObj ); +/*?*/ aLibPathInetObj.removeSegment(); +/*?*/ maLibraryPath = aLibPathInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*?*/ } +/*?*/ else if( aExtension.compareToAscii( "xlb" ) == COMPARE_EQUAL ) +/*?*/ { +/*?*/ meInitMode = LIBRARY_INIT_FILE; +/*?*/ SotStorageRef xDummyStor; +/*?*/ ::xmlscript::LibDescriptor aLibDesc; +/*?*/ sal_Bool bReadIndexFile = implLoadLibraryIndexFile( NULL, aLibDesc, xDummyStor, aInitFileName ); +/*?*/ return bReadIndexFile; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // Decide between old and new document +/*?*/ sal_Bool bOldStorage = SotStorage::IsOLEStorage( aInitFileName ); +/*?*/ if( bOldStorage ) +/*?*/ { +/*?*/ meInitMode = OLD_BASIC_STORAGE; +/*?*/ importFromOldStorage( aInitFileName ); +/*?*/ return sal_True; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ meInitMode = OFFICE_DOCUMENT; +/*?*/ xStorage = new SotStorage( sal_True, aInitFileName ); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Default pathes +/*N*/ maLibraryPath = SvtPathOptions().GetBasicPath(); +/*N*/ } +/*N*/ +/*N*/ Reference< XParser > xParser( mxMSF->createInstance( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); +/*N*/ if( !xParser.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't create sax parser component\n" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ Reference< XInputStream > xInput; +/*N*/ +/*N*/ mxStorage = xStorage; +/*N*/ sal_Bool bStorage = mxStorage.Is(); +/*N*/ SotStorageRef xLibrariesStor; +/*N*/ SotStorageStreamRef xStream; +/*N*/ String aFileName; +/*N*/ +/*N*/ int nPassCount = 1; +/*N*/ if( !bStorage && meInitMode == DEFAULT ) +/*N*/ nPassCount = 2; +/*N*/ for( int nPass = 0 ; nPass < nPassCount ; nPass++ ) +/*N*/ { +/*N*/ if( bStorage ) +/*N*/ { +/*N*/ OSL_ENSURE( meInitMode == DEFAULT || meInitMode == OFFICE_DOCUMENT, +/*N*/ "### Wrong InitMode for document\n" ); +/*N*/ +/*N*/ xLibrariesStor = xStorage->OpenSotStorage( maLibrariesDir, STREAM_READ | STREAM_NOCREATE ); +/*N*/ if( xLibrariesStor.Is() && xLibrariesStor->GetError() == ERRCODE_NONE ) +/*N*/ { +/*?*/ aFileName = maInfoFileName; +/*?*/ aFileName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); +/*?*/ +/*?*/ xStream = xLibrariesStor->OpenSotStream( aFileName, STREAM_READ | STREAM_NOCREATE ); +/*?*/ if( xStream->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ mbOldInfoFormat = true; +/*?*/ +/*?*/ // Check old version +/*?*/ aFileName = maOldInfoFileName; +/*?*/ aFileName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") ); +/*?*/ xStream = xLibrariesStor->OpenSotStream( aFileName, STREAM_READ ); +/*?*/ +/*?*/ if( xStream->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ // Check for EA2 document version with wrong extensions +/*?*/ aFileName = maOldInfoFileName; +/*?*/ aFileName += String( RTL_CONSTASCII_USTRINGPARAM(".xli") ); +/*?*/ xStream = xLibrariesStor->OpenSotStream( aFileName, STREAM_READ ); +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ if( xStream->GetError() == ERRCODE_NONE ) +/*N*/ { +/*N*/ xInput = new ::utl::OInputStreamWrapper( *xStream ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ INetURLObject* pLibInfoInetObj = NULL; +/*N*/ if( meInitMode == CONTAINER_INIT_FILE ) +/*N*/ { +/*?*/ aFileName = aInitFileName; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( nPass == 1 ) +/*N*/ pLibInfoInetObj = new INetURLObject( String(maLibraryPath).GetToken(0) ); +/*N*/ else +/*N*/ pLibInfoInetObj = new INetURLObject( String(maLibraryPath).GetToken(1) ); +/*N*/ pLibInfoInetObj->insertName( maInfoFileName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ pLibInfoInetObj->setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlc") ) ); +/*N*/ aFileName = pLibInfoInetObj->GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ xInput = mxSFI->openFileRead( aFileName ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ xInput.clear(); +/*N*/ if( nPass == 0 ) +/*N*/ { +//*N*/ SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFileName ); +//*N*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*N*/ ErrorHandler::HandleError( nErrorCode ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Old variant? +/*N*/ if( !xInput.is() && nPass == 0 ) +/*?*/ { +/*?*/ INetURLObject aLibInfoInetObj( String(maLibraryPath).GetToken(1) ); +/*?*/ aLibInfoInetObj.insertName( maOldInfoFileName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*?*/ aLibInfoInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xli") ) ); +/*?*/ aFileName = aLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*?*/ +/*?*/ try +/*?*/ { +/*?*/ xInput = mxSFI->openFileRead( aFileName ); +/*?*/ mbOldInfoFormat = true; +/*?*/ } +/*?*/ catch( Exception& ) +/*?*/ { +/*?*/ xInput.clear(); +//*?*/ SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFileName ); +//*?*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*?*/ ErrorHandler::HandleError( nErrorCode ); +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ delete pLibInfoInetObj; +/*N*/ } +/*N*/ +/*N*/ if( xInput.is() ) +/*N*/ { +/*N*/ InputSource source; +/*N*/ source.aInputStream = xInput; +/*N*/ source.sSystemId = aFileName; +/*N*/ +/*N*/ // start parsing +/*N*/ ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray(); +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ xParser->setDocumentHandler( ::xmlscript::importLibraryContainer( pLibArray ) ); +/*N*/ xParser->parseStream( source ); +/*N*/ } +/*N*/ catch ( xml::sax::SAXException& e ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ catch ( io::IOException& e ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ sal_Int32 nLibCount = pLibArray->mnLibCount; +/*N*/ for( sal_Int32 i = 0 ; i < nLibCount ; i++ ) +/*N*/ { +/*N*/ ::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[i]; +/*N*/ +/*N*/ // Check storage URL +/*N*/ OUString aStorageURL = rLib.aStorageURL; +/*N*/ if( !bStorage && !aStorageURL.getLength() && nPass == 0 ) +/*N*/ { +/*N*/ String aLibraryPath; +/*N*/ if( meInitMode == CONTAINER_INIT_FILE ) +/*N*/ aLibraryPath = maLibraryPath; +/*N*/ else +/*N*/ aLibraryPath = String(maLibraryPath).GetToken(1); +/*N*/ INetURLObject aInetObj( aLibraryPath ); +/*N*/ +/*N*/ aInetObj.insertName( rLib.aName, sal_True, INetURLObject::LAST_SEGMENT, +/*N*/ sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ if( mxSFI->isFolder( aLibDirPath ) ) +/*N*/ { +/*N*/ rLib.aStorageURL = aLibDirPath; +/*N*/ mbModified = sal_True; +/*N*/ } +/*N*/ else if( rLib.bLink ) +/*N*/ { +/*N*/ // Check "share" path +/*N*/ INetURLObject aShareInetObj( String(maLibraryPath).GetToken(0) ); +/*N*/ aShareInetObj.insertName( rLib.aName, sal_True, INetURLObject::LAST_SEGMENT, +/*N*/ sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ OUString aShareLibDirPath = aShareInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ if( mxSFI->isFolder( aShareLibDirPath ) ) +/*N*/ { +/*N*/ rLib.aStorageURL = aShareLibDirPath; +/*N*/ mbModified = sal_True; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ OUString aLibName = rLib.aName; +/*N*/ +/*N*/ // If the same library name is used by the shared and the +/*N*/ // user lib container index files the user file wins +/*N*/ if( nPass == 1 && hasByName( aLibName ) ) +/*N*/ continue; +/*N*/ +/*N*/ SfxLibrary_Impl* pImplLib; +/*N*/ if( rLib.bLink ) +/*N*/ { +/*N*/ Reference< XNameAccess > xLib = +/*N*/ createLibraryLink( aLibName, rLib.aStorageURL, rLib.bReadOnly ); +/*N*/ pImplLib = static_cast< SfxLibrary_Impl* >( xLib.get() ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ Reference< XNameContainer > xLib = createLibrary( aLibName ); +/*N*/ pImplLib = static_cast< SfxLibrary_Impl* >( xLib.get() ); +/*N*/ pImplLib->mbLoaded = sal_False; +/*N*/ pImplLib->mbReadOnly = rLib.bReadOnly; +/*N*/ if( !bStorage ) +/*N*/ checkStorageURL( rLib.aStorageURL, pImplLib->maLibInfoFileURL, +/*N*/ pImplLib->maStorageURL, pImplLib->maUnexpandedStorageURL ); +/*N*/ } +/*N*/ +/*N*/ // Read library info files +/*N*/ if( !mbOldInfoFormat ) +/*N*/ { +/*N*/ SotStorageRef xLibraryStor; +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ xLibraryStor = xLibrariesStor->OpenSotStorage( rLib.aName, STREAM_READ | STREAM_NOCREATE ); +/*?*/ if( !xLibraryStor.Is() || xLibraryStor->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ OSL_ENSURE( 0, "### couln't open sub storage for library\n" ); +/*?*/ xLibraryStor = NULL; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Link is already initialised in createLibraryLink() +/*N*/ if( !pImplLib->mbInitialised && (!bStorage || xLibraryStor.Is()) ) +/*N*/ { +/*N*/ OUString aIndexFileName; +/*N*/ sal_Bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, aIndexFileName ); +/*N*/ if( bLoaded && aLibName != rLib.aName ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "Different library names in library" +/*N*/ " container and library info files!\n" ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if( !bStorage ) +/*N*/ { +/*N*/ // Write new index file immediately because otherwise +/*N*/ // the library elements will be lost when storing into +/*N*/ // the new info format + SotStorageRef xStorage; + implStoreLibraryIndexFile( pImplLib, rLib, xStorage ); +/*N*/ } +/*N*/ +/*N*/ implImportLibDescriptor( pImplLib, rLib ); +/*N*/ +/*N*/ if( nPass == 1 ) +/*N*/ { +/*?*/ pImplLib->mbSharedIndexFile = sal_True; +/*?*/ pImplLib->mbReadOnly = sal_True; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Keep flag for documents to force writing the new index files +/*N*/ if( !bStorage ) +/*N*/ mbOldInfoFormat = sal_False; +/*N*/ +/*N*/ delete pLibArray; +/*N*/ } +/*N*/ // Only in the first pass it's an error when no index file is found +/*N*/ else if( nPass == 0 ) +/*N*/ { +/*N*/ return sal_False; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // #56666, upgrade installation 6.0 -> 6.1 +/*N*/ if( meInitMode == DEFAULT ) +/*N*/ { +/*N*/ INetURLObject aUserBasicInetObj( String(maLibraryPath).GetToken(1) ); +/*N*/ OUString aStandardStr( RTL_CONSTASCII_USTRINGPARAM("Standard") ); +/*N*/ +/*N*/ static char str60FolderName_1[] = "__basic_60"; +/*N*/ static char str60FolderName_2[] = "__basic_60_2"; +/*N*/ INetURLObject aUserBasic60InetObj_1( aUserBasicInetObj ); +/*N*/ aUserBasic60InetObj_1.removeSegment(); +/*N*/ INetURLObject aUserBasic60InetObj_2 = aUserBasic60InetObj_1; +/*N*/ aUserBasic60InetObj_1.Append( str60FolderName_1 ); +/*N*/ aUserBasic60InetObj_2.Append( str60FolderName_2 ); +/*N*/ +/*N*/ INetURLObject aUserBasic60InetObj = aUserBasic60InetObj_1; +/*N*/ String aFolder60 = aUserBasic60InetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ bool bSecondTime = false; +/*N*/ if( mxSFI->isFolder( aFolder60 ) ) +/*N*/ { +/*?*/ // #110101 Check if Standard folder exists and is complete +/*?*/ INetURLObject aUserBasicStandardInetObj( aUserBasicInetObj ); +/*?*/ aUserBasicStandardInetObj.insertName( aStandardStr, sal_True, INetURLObject::LAST_SEGMENT, +/*?*/ sal_True, INetURLObject::ENCODE_ALL ); +/*?*/ INetURLObject aUserBasic60StandardInetObj( aUserBasic60InetObj ); +/*?*/ aUserBasic60StandardInetObj.insertName( aStandardStr, sal_True, INetURLObject::LAST_SEGMENT, +/*?*/ sal_True, INetURLObject::ENCODE_ALL ); +/*?*/ OUString aStandardFolder60 = aUserBasic60StandardInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*?*/ if( mxSFI->isFolder( aStandardFolder60 ) ) +/*?*/ { +/*?*/ OUString aXlbExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlb") ) ); +/*?*/ OUString aCheckFileName; +/*?*/ +/*?*/ // Check if script.xlb exists +/*?*/ aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("script") ); +/*?*/ checkAndCopyFileImpl( aUserBasicStandardInetObj, +/*?*/ aUserBasic60StandardInetObj, +/*?*/ aCheckFileName, aXlbExtension, mxSFI ); +/*?*/ +/*?*/ // Check if dialog.xlb exists +/*?*/ aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("dialog") ); +/*?*/ checkAndCopyFileImpl( aUserBasicStandardInetObj, +/*?*/ aUserBasic60StandardInetObj, +/*?*/ aCheckFileName, aXlbExtension, mxSFI ); +/*?*/ +/*?*/ // Check if module1.xba exists +/*?*/ OUString aXbaExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xba") ) ); +/*?*/ aCheckFileName = OUString( RTL_CONSTASCII_USTRINGPARAM("Module1") ); +/*?*/ checkAndCopyFileImpl( aUserBasicStandardInetObj, +/*?*/ aUserBasic60StandardInetObj, +/*?*/ aCheckFileName, aXbaExtension, mxSFI ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ String aStandardFolder = aUserBasicStandardInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*?*/ mxSFI->copy( aStandardFolder, aStandardFolder60 ); +/*?*/ } +/*?*/ +/*?*/ String aCopyToFolder60 = aUserBasic60InetObj_2.GetMainURL( INetURLObject::NO_DECODE ); +/*?*/ mxSFI->copy( aFolder60, aCopyToFolder60 ); +/*?*/ } +/*N*/ else +/*?*/ { +/*?*/ bSecondTime = true; +/*?*/ aUserBasic60InetObj = aUserBasic60InetObj_2; +/*?*/ aFolder60 = aUserBasic60InetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ if( mxSFI->isFolder( aFolder60 ) ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ return sal_True; +/*N*/ } + +// Handle maLibInfoFileURL and maStorageURL correctly +/*N*/ void SfxLibraryContainer_Impl::checkStorageURL( const OUString& aSourceURL, +/*N*/ OUString& aLibInfoFileURL, OUString& aStorageURL, OUString& aUnexpandedStorageURL ) +/*N*/ { +/*N*/ OUString aExpandedSourceURL = expand_url( aSourceURL ); +/*N*/ if( aExpandedSourceURL != aSourceURL ) +/*?*/ aUnexpandedStorageURL = aSourceURL; +/*N*/ +/*N*/ INetURLObject aInetObj( aExpandedSourceURL ); +/*N*/ OUString aExtension = aInetObj.getExtension(); +/*N*/ if( aExtension.compareToAscii( "xlb" ) == COMPARE_EQUAL ) +/*N*/ { +/*N*/ // URL to xlb file +/*?*/ aLibInfoFileURL = aExpandedSourceURL; +/*?*/ aInetObj.removeSegment(); +/*?*/ aStorageURL = aInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // URL to library folder +/*N*/ aStorageURL = aExpandedSourceURL; +/*N*/ aInetObj.insertName( maInfoFileName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ aInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlb") ) ); +/*N*/ aLibInfoFileURL = aInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ } + +/*N*/ SfxLibrary_Impl* SfxLibraryContainer_Impl::getImplLib( const String& rLibraryName ) +/*N*/ { +/*N*/ Any aLibAny = maNameContainer.getByName( rLibraryName ) ; +/*N*/ Reference< XNameAccess > xNameAccess; +/*N*/ aLibAny >>= xNameAccess; +/*N*/ SfxLibrary_Impl* pImplLib = static_cast< SfxLibrary_Impl* >( xNameAccess.get() ); +/*N*/ return pImplLib; +/*N*/ } + + +// Storing with password encryption + +// Empty implementation, avoids unneccesary implementation in dlgcont.cxx +/*?*/ sal_Bool SfxLibraryContainer_Impl::implStorePasswordLibrary( SfxLibrary_Impl* pLib, +/*?*/ const OUString& aName, SotStorageRef xStorage ) +/*?*/ { +/*?*/ return sal_False; +/*?*/ } + +/*?*/ sal_Bool SfxLibraryContainer_Impl::implLoadPasswordLibrary +/*?*/ ( SfxLibrary_Impl* pLib, const OUString& Name, sal_Bool bVerifyPasswordOnly ) +/*?*/ throw(WrappedTargetException, RuntimeException) +/*?*/ { +/*?*/ return sal_True; +/*?*/ } + + +#define EXPAND_PROTOCOL "vnd.sun.star.expand" +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + +/*N*/ OUString SfxLibraryContainer_Impl::createAppLibraryFolder +/*N*/ ( SfxLibrary_Impl* pLib, const OUString& aName ) +/*N*/ { +/*N*/ OUString aLibDirPath = pLib->maStorageURL; +/*N*/ if( !aLibDirPath.getLength() ) +/*N*/ { +/*?*/ INetURLObject aInetObj( String(maLibraryPath).GetToken(1) ); +/*?*/ aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*?*/ checkStorageURL( aInetObj.GetMainURL( INetURLObject::NO_DECODE ), pLib->maLibInfoFileURL, +/*?*/ pLib->maStorageURL, pLib->maUnexpandedStorageURL ); +/*?*/ aLibDirPath = pLib->maStorageURL; +/*N*/ } +/*N*/ +/*N*/ if( !mxSFI->isFolder( aLibDirPath ) ) +/*N*/ { +/*N*/ try +/*N*/ { +/*?*/ mxSFI->createFolder( aLibDirPath ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ {} +/*N*/ } +/*N*/ +/*N*/ return aLibDirPath; +/*N*/ } + +// Storing +void SfxLibraryContainer_Impl::implStoreLibrary( SfxLibrary_Impl* pLib, + const OUString& aName, SotStorageRef xStorage ) +{ + sal_Bool bLink = pLib->mbLink; + sal_Bool bStorage = xStorage.Is() && !bLink; + + Sequence< OUString > aElementNames = pLib->getElementNames(); + sal_Int32 nNameCount = aElementNames.getLength(); + const OUString* pNames = aElementNames.getConstArray(); + OUString aLibDirPath; + + if( bStorage ) + { + for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + { + OUString aElementName = pNames[ i ]; + + OUString aStreamName = aElementName; + aStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") ); + + Any aElement = pLib->getByName( aElementName ); + if( isLibraryElementValid( aElement ) ) + { + SotStorageStreamRef xElementStream = xStorage->OpenSotStream + ( aStreamName, STREAM_WRITE | STREAM_SHARE_DENYWRITE ); + + if( xElementStream->GetError() == ERRCODE_NONE ) + { + String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) ); + OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); + Any aAny; + aAny <<= aMime; + xElementStream->SetProperty( aPropName, aAny ); + + // #87671 Allow encryption + aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") ); + aAny <<= sal_True; + xElementStream->SetProperty( aPropName, aAny ); + + Reference< XOutputStream > xOutput = + new utl::OOutputStreamWrapper( *xElementStream ); + writeLibraryElement( aElement, aElementName, xOutput ); + xOutput->closeOutput(); + + xElementStream->Commit(); + } + } + } + } + else + { + try + { + // Get Output stream + aLibDirPath = createAppLibraryFolder( pLib, aName ); + + for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + { + OUString aElementName = pNames[ i ]; + + INetURLObject aElementInetObj( aLibDirPath ); + aElementInetObj.insertName( aElementName, sal_False, + INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); + aElementInetObj.setExtension( maLibElementFileExtension ); + String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) ); + + Any aElement = pLib->getByName( aElementName ); + if( isLibraryElementValid( aElement ) ) + { + // TODO: Check modified + try + { + if( mxSFI->exists( aElementPath ) ) + mxSFI->kill( aElementPath ); + Reference< XOutputStream > xOutput = mxSFI->openFileWrite( aElementPath ); + writeLibraryElement( aElement, aElementName, xOutput ); + xOutput->closeOutput(); + } + catch( Exception& ) + { + SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aElementPath ); + ULONG nErrorCode = ERRCODE_IO_GENERAL; + ErrorHandler::HandleError( nErrorCode ); + } + } + } + } + catch( Exception& ) + //catch( Exception& e ) + { + // TODO + //throw e; + } + } +} + +void SfxLibraryContainer_Impl::implStoreLibraryIndexFile( SfxLibrary_Impl* pLib, + const ::xmlscript::LibDescriptor& rLib, SotStorageRef xStorage ) +{ + // Create sax writer + Reference< XExtendedDocumentHandler > xHandler( + mxMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY ); + if( !xHandler.is() ) + { + OSL_ENSURE( 0, "### couln't create sax-writer component\n" ); + return; + } + + sal_Bool bLink = pLib->mbLink; + sal_Bool bStorage = xStorage.Is() && !bLink; + + // Write info file + Reference< XOutputStream > xOut; + SotStorageStreamRef xInfoStream; + if( bStorage ) + { + OUString aStreamName( maInfoFileName ); + aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lb.xml") ); + + xInfoStream = xStorage->OpenSotStream( aStreamName, + STREAM_WRITE | STREAM_SHARE_DENYWRITE ); + + if( xInfoStream->GetError() == ERRCODE_NONE ) + { + String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) ); + OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); + Any aAny; + aAny <<= aMime; + xInfoStream->SetProperty( aPropName, aAny ); + + // #87671 Allow encryption + aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") ); + aAny <<= sal_True; + xInfoStream->SetProperty( aPropName, aAny ); + + xOut = new utl::OOutputStreamWrapper( *xInfoStream ); + } + } + else + { + // Create Output stream + createAppLibraryFolder( pLib, rLib.aName ); + String aLibInfoPath = pLib->maLibInfoFileURL; + + try + { + if( mxSFI->exists( aLibInfoPath ) ) + mxSFI->kill( aLibInfoPath ); + xOut = mxSFI->openFileWrite( aLibInfoPath ); + } + catch( Exception& ) + { + SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath ); + ULONG nErrorCode = ERRCODE_IO_GENERAL; + ErrorHandler::HandleError( nErrorCode ); + } + + } + if( !xOut.is() ) + { + OSL_ENSURE( 0, "### couln't open output stream\n" ); + return; + } + + Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY ); + xSource->setOutputStream( xOut ); + + xmlscript::exportLibrary( xHandler, rLib ); + + if( xInfoStream.Is() ) + xInfoStream->Commit(); +} + + +/*N*/ sal_Bool SfxLibraryContainer_Impl::implLoadLibraryIndexFile( SfxLibrary_Impl* pLib, +/*N*/ ::xmlscript::LibDescriptor& rLib, SotStorageRef xStorage, const OUString& aIndexFileName ) +/*N*/ { +/*N*/ Reference< XParser > xParser( mxMSF->createInstance( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); +/*N*/ if( !xParser.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't create sax parser component\n" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ sal_Bool bLink = sal_False; +/*N*/ sal_Bool bStorage = sal_False; +/*N*/ if( pLib ) +/*N*/ { +/*N*/ bLink = pLib->mbLink; +/*N*/ bStorage = xStorage.Is() && !bLink; +/*N*/ } +/*N*/ +/*N*/ // Read info file +/*N*/ Reference< XInputStream > xInput; +/*N*/ SotStorageStreamRef xInfoStream; +/*N*/ String aLibInfoPath; +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ aLibInfoPath = maInfoFileName; +/*?*/ aLibInfoPath += String( RTL_CONSTASCII_USTRINGPARAM("-lb.xml") ); +/*?*/ +/*?*/ xInfoStream = xStorage->OpenSotStream( aLibInfoPath, STREAM_READ ); +/*?*/ if( xInfoStream->GetError() == ERRCODE_NONE ) +/*?*/ { +/*?*/ xInput = new ::utl::OInputStreamWrapper( *xInfoStream ); +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Create Input stream +/*N*/ String aLibInfoPath; +/*N*/ +/*N*/ if( pLib ) +/*N*/ { +/*N*/ createAppLibraryFolder( pLib, rLib.aName ); +/*N*/ aLibInfoPath = pLib->maLibInfoFileURL; +/*N*/ } +/*N*/ else +/*?*/ aLibInfoPath = aIndexFileName; +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ xInput = mxSFI->openFileRead( aLibInfoPath ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ xInput.clear(); +//*N*/ SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath ); +//*N*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*N*/ ErrorHandler::HandleError( nErrorCode ); +/*N*/ } +/*N*/ } +/*N*/ if( !xInput.is() ) +/*N*/ { +/*N*/ // OSL_ENSURE( 0, "### couln't open input stream\n" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ InputSource source; +/*N*/ source.aInputStream = xInput; +/*N*/ source.sSystemId = aLibInfoPath; +/*N*/ +/*N*/ // start parsing +/*N*/ try { +/*N*/ xParser->setDocumentHandler( ::xmlscript::importLibrary( rLib ) ); +/*N*/ xParser->parseStream( source ); +/*N*/ } +/*N*/ catch( Exception& e ) +/*N*/ { +/*N*/ // throw WrappedTargetException( OUString::createFromAscii( "parsing error!\n" ), +/*N*/ // Reference< XInterface >(), +/*N*/ // makeAny( e ) ); +/*N*/ OSL_ENSURE( 0, "Parsing error\n" ); +//*N*/ SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath ); +//*N*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*N*/ ErrorHandler::HandleError( nErrorCode ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ if( !pLib ) +/*N*/ { +/*?*/ Reference< XNameContainer > xLib = createLibrary( rLib.aName ); +/*?*/ pLib = static_cast< SfxLibrary_Impl* >( xLib.get() ); +/*?*/ pLib->mbLoaded = sal_False; +/*?*/ rLib.aStorageURL = aIndexFileName; +/*?*/ checkStorageURL( rLib.aStorageURL, pLib->maLibInfoFileURL, pLib->maStorageURL, +/*?*/ pLib->maUnexpandedStorageURL ); +/*?*/ +/*?*/ implImportLibDescriptor( pLib, rLib ); +/*N*/ } +/*N*/ +/*N*/ return sal_True; +/*N*/ } + +/*N*/ void SfxLibraryContainer_Impl::implImportLibDescriptor +/*N*/ ( SfxLibrary_Impl* pLib, ::xmlscript::LibDescriptor& rLib ) +/*N*/ { +/*N*/ if( !pLib->mbInitialised ) +/*N*/ { +/*N*/ sal_Int32 nElementCount = rLib.aElementNames.getLength(); +/*N*/ const OUString* pElementNames = rLib.aElementNames.getConstArray(); +/*N*/ Any aDummyElement = createEmptyLibraryElement(); +/*N*/ for( sal_Int32 i = 0 ; i < nElementCount ; i++ ) +/*N*/ { +/*N*/ pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement ); +/*N*/ } +/*N*/ pLib->mbPasswordProtected = rLib.bPasswordProtected; +/*N*/ pLib->mbReadOnly = rLib.bReadOnly; +/*N*/ pLib->mbModified = sal_False; +/*N*/ +/*N*/ pLib->mbInitialised = sal_True; +/*N*/ } +/*N*/ } + + +/*N*/ void SfxLibraryContainer_Impl::storeLibraries( sal_Bool bComplete ) +/*N*/ { +/*N*/ SotStorageRef xStorage; +/*N*/ storeLibraries_Impl( xStorage, bComplete ); +/*N*/ } + +/*N*/ void SfxLibraryContainer_Impl::storeLibrariesToStorage( SotStorageRef xStorage ) +/*N*/ { +/*N*/ sal_Bool bComplete = sal_True; +/*N*/ storeLibraries_Impl( xStorage, bComplete ); +/*N*/ } + +// Methods of new XLibraryStorage interface? +/*N*/ void SfxLibraryContainer_Impl::storeLibraries_Impl( SotStorageRef xStorage, sal_Bool bComplete ) +/*N*/ { +/*N*/ Sequence< OUString > aNames = maNameContainer.getElementNames(); +/*N*/ const OUString* pNames = aNames.getConstArray(); +/*N*/ sal_Int32 i, nNameCount = aNames.getLength(); +/*N*/ +/*N*/ // Don't count libs from shared index file +/*N*/ sal_Int32 nLibsToSave = nNameCount; +/*N*/ for( i = 0 ; i < nNameCount ; i++ ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pImplLib = getImplLib( pNames[ i ] ); +/*N*/ if( pImplLib->mbSharedIndexFile ) +/*N*/ nLibsToSave--; +/*N*/ } +/*N*/ if( !nLibsToSave ) +/*N*/ return; +/*N*/ +/*N*/ ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave ); +/*N*/ +/*N*/ // Write to storage? +/*N*/ sal_Bool bStorage = xStorage.Is(); +/*N*/ SotStorageRef xLibrariesStor; +/*N*/ SotStorageRef xSourceLibrariesStor; +/*N*/ if( bStorage ) +/*N*/ { +/*N*/ // Don't write if only empty standard lib exists +/*N*/ if( nNameCount == 1 ) +/*N*/ { +/*N*/ // Must be standard lib +/*N*/ Any aLibAny = maNameContainer.getByName( pNames[0] ); +/*N*/ Reference< XNameAccess > xNameAccess; +/*N*/ aLibAny >>= xNameAccess; +/*N*/ if( !xNameAccess->hasElements() ) +/*N*/ return; +/*N*/ } +/*N*/ +/*?*/ xLibrariesStor = xStorage->OpenUCBStorage( maLibrariesDir, STREAM_WRITE ); +/*?*/ if( !xLibrariesStor.Is() || xLibrariesStor->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ OSL_ENSURE( 0, "### couln't create libraries sub storage\n" ); +/*?*/ return; +/*?*/ } +/*?*/ +/*?*/ xSourceLibrariesStor = mxStorage->OpenSotStorage( maLibrariesDir, STREAM_READ | STREAM_NOCREATE ); +/*?*/ if( !xSourceLibrariesStor.Is() || xSourceLibrariesStor->GetError() != ERRCODE_NONE ) +/*?*/ xSourceLibrariesStor = NULL; +/*N*/ } +/*N*/ +/*N*/ int iArray = 0; +/*N*/ for( i = 0 ; i < nNameCount ; i++ ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pImplLib = getImplLib( pNames[ i ] ); +/*N*/ if( pImplLib->mbSharedIndexFile ) +/*N*/ continue; +/*N*/ ::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[iArray]; +/*N*/ rLib.aName = pNames[ i ]; +/*N*/ iArray++; +/*N*/ +/*N*/ rLib.bLink = pImplLib->mbLink; +/*N*/ rLib.aStorageURL = ( pImplLib->maUnexpandedStorageURL.getLength() ) ? +/*N*/ pImplLib->maUnexpandedStorageURL : pImplLib->maLibInfoFileURL; +/*N*/ rLib.bReadOnly = pImplLib->mbReadOnly; +/*N*/ rLib.bPasswordProtected = pImplLib->mbPasswordProtected; +/*N*/ rLib.aElementNames = pImplLib->getElementNames(); +/*N*/ +/*N*/ if( pImplLib->mbModified || bComplete ) +/*N*/ { +/*N*/ // Can we copy the storage? + if( !mbOldInfoFormat && !pImplLib->mbModified && xSourceLibrariesStor.Is() ) + { + BOOL bRet = xSourceLibrariesStor->CopyTo + ( rLib.aName, xLibrariesStor, rLib.aName ); + } + else + { + SotStorageRef xLibraryStor; + if( bStorage ) + { + xLibraryStor = xLibrariesStor->OpenUCBStorage( rLib.aName, STREAM_WRITE ); + if( !xLibraryStor.Is() || xLibraryStor->GetError() != ERRCODE_NONE ) + { + OSL_ENSURE( 0, "### couln't create sub storage for library\n" ); + return; + } + } + + // Maybe lib is not loaded?! + if( bComplete ) + loadLibrary( rLib.aName ); + + if( pImplLib->mbPasswordProtected ) + implStorePasswordLibrary( pImplLib, rLib.aName, xLibraryStor ); + // TODO: Check return value + else + implStoreLibrary( pImplLib, rLib.aName, xLibraryStor ); + + implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor ); + if( bStorage ) + { + xLibraryStor->Commit(); + } + } +/*?*/ +/*?*/ mbModified = sal_True; +/*?*/ pImplLib->mbModified = sal_False; +/*N*/ } +/*N*/ +/*N*/ // For container info ReadOnly refers to mbReadOnlyLink +/*N*/ rLib.bReadOnly = pImplLib->mbReadOnlyLink; +/*N*/ } +/*N*/ +/*N*/ if( !mbOldInfoFormat && !mbModified ) +/*N*/ return; +/*N*/ mbModified = sal_False; +/*N*/ mbOldInfoFormat = sal_False; +/*N*/ +/*N*/ // Write library container info +/*N*/ // Create sax writer +/*N*/ Reference< XExtendedDocumentHandler > xHandler( +/*N*/ mxMSF->createInstance( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY ); +/*N*/ if( !xHandler.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't create sax-writer component\n" ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ // Write info file +/*N*/ Reference< XOutputStream > xOut; +/*N*/ SotStorageStreamRef xInfoStream; +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ OUString aStreamName( maInfoFileName ); +/*?*/ aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); +/*?*/ +/*?*/ xInfoStream = xLibrariesStor->OpenSotStream( aStreamName, +/*?*/ STREAM_WRITE | STREAM_SHARE_DENYWRITE ); +/*?*/ +/*?*/ if( xInfoStream->GetError() == ERRCODE_NONE ) +/*?*/ { +/*?*/ String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) ); +/*?*/ OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); +/*?*/ Any aAny; +/*?*/ aAny <<= aMime; +/*?*/ xInfoStream->SetProperty( aPropName, aAny ); +/*?*/ +/*?*/ // #87671 Allow encryption +/*?*/ aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") ); +/*?*/ aAny <<= sal_True; +/*?*/ xInfoStream->SetProperty( aPropName, aAny ); +/*?*/ +/*?*/ xOut = new ::utl::OOutputStreamWrapper( *xInfoStream ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Create Output stream +/*N*/ INetURLObject aLibInfoInetObj( String(maLibraryPath).GetToken(1) ); +/*N*/ aLibInfoInetObj.insertName( maInfoFileName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ aLibInfoInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("xlc") ) ); +/*N*/ String aLibInfoPath( aLibInfoInetObj.GetMainURL( INetURLObject::NO_DECODE ) ); +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ if( mxSFI->exists( aLibInfoPath ) ) +/*N*/ mxSFI->kill( aLibInfoPath ); +/*N*/ xOut = mxSFI->openFileWrite( aLibInfoPath ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*?*/ xOut.clear(); +//*?*/ SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath ); +//*?*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*?*/ ErrorHandler::HandleError( nErrorCode ); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ if( !xOut.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't open output stream\n" ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY ); +/*N*/ xSource->setOutputStream( xOut ); +/*N*/ +/*N*/ xmlscript::exportLibraryContainer( xHandler, pLibArray ); +/*N*/ if( xInfoStream.Is() ) +/*?*/ xInfoStream->Commit(); +/*N*/ if( xLibrariesStor.Is() ) +/*?*/ xLibrariesStor->Commit(); +/*N*/ +/*N*/ delete pLibArray; +/*N*/ } + + +// Methods XElementAccess +/*?*/ Type SfxLibraryContainer_Impl::getElementType() +/*?*/ throw(RuntimeException) +/*?*/ { + return maNameContainer.getElementType(); +/*?*/ } + +/*?*/ sal_Bool SfxLibraryContainer_Impl::hasElements() +/*?*/ throw(RuntimeException) +/*?*/ { + sal_Bool bRet = maNameContainer.hasElements(); + return bRet; +/*?*/ } + +// Methods XNameAccess +/*N*/ Any SfxLibraryContainer_Impl::getByName( const OUString& aName ) +/*N*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ Any aRetAny = maNameContainer.getByName( aName ) ; +/*N*/ return aRetAny; +/*N*/ } + +/*N*/ Sequence< OUString > SfxLibraryContainer_Impl::getElementNames() +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ return maNameContainer.getElementNames(); +/*N*/ } + +/*N*/ sal_Bool SfxLibraryContainer_Impl::hasByName( const OUString& aName ) +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ sal_Bool bRet = maNameContainer.hasByName( aName ) ; +/*N*/ return bRet; +/*N*/ } + +// Methods XLibraryContainer +/*N*/ Reference< XNameContainer > SAL_CALL SfxLibraryContainer_Impl::createLibrary( const OUString& Name ) +/*N*/ throw(IllegalArgumentException, ElementExistException, RuntimeException) +/*N*/ { +/*N*/ SfxLibrary_Impl* pNewLib = implCreateLibrary(); +/*N*/ pNewLib->maLibElementFileExtension = maLibElementFileExtension; +/*N*/ Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib ); +/*N*/ Any aElement; +/*N*/ aElement <<= xNameAccess; +/*N*/ maNameContainer.insertByName( Name, aElement ); +/*N*/ mbModified = sal_True; +/*N*/ Reference< XNameContainer > xRet( xNameAccess, UNO_QUERY ); +/*N*/ return xRet; +/*N*/ } + +/*N*/ Reference< XNameAccess > SAL_CALL SfxLibraryContainer_Impl::createLibraryLink +/*N*/ ( const OUString& Name, const OUString& StorageURL, sal_Bool ReadOnly ) +/*N*/ throw(IllegalArgumentException, ElementExistException, RuntimeException) +/*N*/ { +/*N*/ // TODO: Check other reasons to force ReadOnly status +/*N*/ //if( !ReadOnly ) +/*N*/ //{ +/*N*/ //} +/*N*/ +/*N*/ OUString aLibInfoFileURL; +/*N*/ OUString aLibDirURL; +/*N*/ OUString aUnexpandedStorageURL; +/*N*/ checkStorageURL( StorageURL, aLibInfoFileURL, aLibDirURL, aUnexpandedStorageURL ); +/*N*/ +/*N*/ +/*N*/ SfxLibrary_Impl* pNewLib = implCreateLibraryLink( aLibInfoFileURL, aLibDirURL, ReadOnly ); +/*N*/ pNewLib->maLibElementFileExtension = maLibElementFileExtension; +/*N*/ pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL; +/*N*/ +/*N*/ OUString aInitFileName; +/*N*/ SotStorageRef xDummyStor; +/*N*/ ::xmlscript::LibDescriptor aLibDesc; +/*N*/ sal_Bool bReadIndexFile = implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, aInitFileName ); +/*N*/ implImportLibDescriptor( pNewLib, aLibDesc ); +/*N*/ +/*N*/ Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib ); +/*N*/ Any aElement; +/*N*/ aElement <<= xRet; +/*N*/ maNameContainer.insertByName( Name, aElement ); +/*N*/ mbModified = sal_True; +/*N*/ return xRet; +/*N*/ } + +/*?*/ void SAL_CALL SfxLibraryContainer_Impl::removeLibrary( const OUString& Name ) +/*?*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +/*N*/ sal_Bool SAL_CALL SfxLibraryContainer_Impl::isLibraryLoaded( const OUString& Name ) +/*N*/ throw(NoSuchElementException, RuntimeException) +/*N*/ { +/*N*/ SfxLibrary_Impl* pImplLib = getImplLib( Name ); +/*N*/ sal_Bool bRet = pImplLib->mbLoaded; +/*N*/ return bRet; +/*N*/ } + + +/*N*/ void SAL_CALL SfxLibraryContainer_Impl::loadLibrary( const OUString& Name ) +/*N*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ Any aLibAny = maNameContainer.getByName( Name ) ; +/*N*/ Reference< XNameAccess > xNameAccess; +/*N*/ aLibAny >>= xNameAccess; +/*N*/ SfxLibrary_Impl* pImplLib = static_cast< SfxLibrary_Impl* >( xNameAccess.get() ); +/*N*/ +/*N*/ sal_Bool bLoaded = pImplLib->mbLoaded; +/*N*/ pImplLib->mbLoaded = sal_True; +/*N*/ if( !bLoaded && xNameAccess->hasElements() ) +/*N*/ { +/*N*/ if( pImplLib->mbPasswordProtected ) +/*N*/ { +/*N*/ implLoadPasswordLibrary( pImplLib, Name ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ sal_Bool bLink = pImplLib->mbLink; +/*N*/ sal_Bool bStorage = mxStorage.Is() && !bLink; +/*N*/ +/*N*/ SotStorageRef xLibrariesStor; +/*N*/ SotStorageRef xLibraryStor; +/*N*/ SotStorageStreamRef xElementStream; +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ xLibrariesStor = mxStorage->OpenSotStorage( maLibrariesDir, STREAM_READ | STREAM_NOCREATE ); +/*?*/ if( xLibrariesStor.Is() && xLibrariesStor->GetError() == ERRCODE_NONE ) +/*?*/ { +/*?*/ xLibraryStor = xLibrariesStor->OpenSotStorage( Name, STREAM_READ | STREAM_NOCREATE ); +/*?*/ } +/*?*/ if( !xLibraryStor.Is() || xLibraryStor->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ OSL_ENSURE( 0, "### couln't open sub storage for library\n" ); +/*?*/ return; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ Sequence< OUString > aNames = pImplLib->getElementNames(); +/*N*/ sal_Int32 nNameCount = aNames.getLength(); +/*N*/ const OUString* pNames = aNames.getConstArray(); +/*N*/ for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) +/*N*/ { +/*N*/ OUString aElementName = pNames[ i ]; +/*N*/ +/*N*/ OUString aFile; +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ aFile = aElementName; +/*?*/ aFile += String( RTL_CONSTASCII_USTRINGPARAM(".xml") ); +/*?*/ +/*?*/ xElementStream = xLibraryStor->OpenSotStream( aFile, STREAM_READ ); +/*?*/ if( xElementStream->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ // Check for EA2 document version with wrong extensions +/*?*/ aFile = aElementName; +/*?*/ aFile += String( RTL_CONSTASCII_USTRINGPARAM(".") ); +/*?*/ aFile += maLibElementFileExtension; +/*?*/ xElementStream = xLibraryStor->OpenSotStream( aFile, STREAM_READ ); +/*?*/ } +/*?*/ +/*?*/ if( !xElementStream.Is() || xElementStream->GetError() != ERRCODE_NONE ) +/*?*/ { +/*?*/ OSL_ENSURE( 0, "### couln't open library element stream\n" ); +/*?*/ return; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ String aLibDirPath = pImplLib->maStorageURL; +/*N*/ INetURLObject aElementInetObj( aLibDirPath ); +/*N*/ aElementInetObj.insertName( aElementName, sal_False, +/*N*/ INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); +/*N*/ aElementInetObj.setExtension( maLibElementFileExtension ); +/*N*/ aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ } +/*N*/ +/*N*/ Any aAny = importLibraryElement( aFile, xElementStream ); +/*N*/ if( pImplLib->hasByName( aElementName ) ) +/*N*/ { +/*N*/ if( aAny.hasValue() ) +/*N*/ pImplLib->maNameContainer.replaceByName( aElementName, aAny ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pImplLib->maNameContainer.insertByName( aElementName, aAny ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pImplLib->mbModified = sal_False; +/*N*/ } +/*N*/ } + +// Methods XLibraryContainer2 +sal_Bool SAL_CALL SfxLibraryContainer_Impl::isLibraryLink( const OUString& Name ) + throw (NoSuchElementException, RuntimeException) +{ + SfxLibrary_Impl* pImplLib = getImplLib( Name ); + sal_Bool bRet = pImplLib->mbLink; + return bRet; +} + +/*?*/ OUString SAL_CALL SfxLibraryContainer_Impl::getLibraryLinkURL( const OUString& Name ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); OUString aRetStr;return aRetStr;//STRIP001 +/*?*/ } + +sal_Bool SAL_CALL SfxLibraryContainer_Impl::isLibraryReadOnly( const OUString& Name ) + throw (NoSuchElementException, RuntimeException) +{ + SfxLibrary_Impl* pImplLib = getImplLib( Name ); + sal_Bool bRet = pImplLib->mbReadOnly || (pImplLib->mbLink && pImplLib->mbReadOnlyLink); + return bRet; +} + +/*?*/ void SAL_CALL SfxLibraryContainer_Impl::setLibraryReadOnly( const OUString& Name, sal_Bool bReadOnly ) +/*?*/ throw (NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } + +/*?*/ void SAL_CALL SfxLibraryContainer_Impl::renameLibrary( const OUString& Name, const OUString& NewName ) +/*?*/ throw (NoSuchElementException, ElementExistException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } + + +// Methods XLibraryContainerPassword +/*?*/ sal_Bool SAL_CALL SfxLibraryContainer_Impl::isLibraryPasswordProtected( const OUString& Name ) +/*?*/ throw (NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +/*?*/ sal_Bool SAL_CALL SfxLibraryContainer_Impl::isLibraryPasswordVerified( const OUString& Name ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL; +/*?*/ } + +/*?*/ sal_Bool SAL_CALL SfxLibraryContainer_Impl::verifyLibraryPassword +/*?*/ ( const OUString& Name, const OUString& Password ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL; +/*?*/ } + +/*?*/ void SAL_CALL SfxLibraryContainer_Impl::changeLibraryPassword( const OUString& Name, +/*?*/ const OUString& OldPassword, const OUString& NewPassword ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); +/*?*/ } + +// Methods XContainer +/*N*/ void SAL_CALL SfxLibraryContainer_Impl::addContainerListener( const Reference< XContainerListener >& xListener ) +/*N*/ throw (RuntimeException) +/*N*/ { +/*N*/ maNameContainer.setEventSource( static_cast< XInterface* >( (OWeakObject*)this ) ); +/*N*/ maNameContainer.addContainerListener( xListener ); +/*N*/ } + +/*N*/ void SAL_CALL SfxLibraryContainer_Impl::removeContainerListener( const Reference< XContainerListener >& xListener ) +/*N*/ throw (RuntimeException) +/*N*/ { +/*N*/ maNameContainer.removeContainerListener( xListener ); +/*N*/ } + + +/*N*/ OUString SfxLibraryContainer_Impl::expand_url( const OUString& url ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ if (0 == url.compareToAscii( RTL_CONSTASCII_STRINGPARAM(EXPAND_PROTOCOL ":") )) +/*?*/ { +/*?*/ if( !mxMacroExpander.is() ) +/*?*/ { +/*?*/ Reference< XPropertySet > xProps( mxMSF, UNO_QUERY ); +/*?*/ OSL_ASSERT( xProps.is() ); +/*?*/ if( xProps.is() ) +/*?*/ { +/*?*/ Reference< XComponentContext > xContext; +/*?*/ xProps->getPropertyValue( +/*?*/ OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; +/*?*/ OSL_ASSERT( xContext.is() ); +/*?*/ if( xContext.is() ) +/*?*/ { +/*?*/ Reference< util::XMacroExpander > xExpander; +/*?*/ xContext->getValueByName( +/*?*/ OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander; +/*?*/ if(! xExpander.is()) +/*?*/ { +/*?*/ throw DeploymentException( +/*?*/ OUSTR("no macro expander singleton available!"), Reference< XInterface >() ); +/*?*/ } +/*?*/ MutexGuard guard( Mutex::getGlobalMutex() ); +/*?*/ if( !mxMacroExpander.is() ) +/*?*/ { +/*?*/ mxMacroExpander = xExpander; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if( !mxMacroExpander.is() ) +/*?*/ return url; +/*?*/ +/*?*/ // cut protocol +/*?*/ OUString macro( url.copy( sizeof (EXPAND_PROTOCOL ":") -1 ) ); +/*?*/ // decode uric class chars +/*?*/ macro = Uri::decode( macro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); +/*?*/ // expand macro string +/*?*/ OUString ret( mxMacroExpander->expandMacros( macro ) ); +/*?*/ return ret; +/*?*/ } + else if( mxStringSubstitution.is() ) + { + return mxStringSubstitution->substituteVariables( url, false ); + } +/*N*/ else +/*N*/ { +/*N*/ return url; +/*N*/ } +/*N*/ } + + +//============================================================================ + +// Implementation class SfxLibrary_Impl + +// Ctor +/*N*/ SfxLibrary_Impl::SfxLibrary_Impl( Type aType, +/*N*/ Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI ) +/*N*/ : OComponentHelper( m_mutex ) +/*N*/ , mxMSF( xMSF ) +/*N*/ , mxSFI( xSFI ) +/*N*/ , maNameContainer( aType ) +/*N*/ , mbLoaded( sal_True ) +/*N*/ , mbModified( sal_True ) +/*N*/ , mbInitialised( sal_False ) +/*N*/ , mbLink( sal_False ) +/*N*/ , mbReadOnly( sal_False ) +/*N*/ , mbReadOnlyLink( sal_False ) +/*N*/ , mbPasswordProtected( sal_False ) +/*N*/ , mbPasswordVerified( sal_False ) +/*N*/ , mbDoc50Password( sal_False ) +/*N*/ , mbSharedIndexFile( sal_False ) +/*N*/ { +/*N*/ } + +/*N*/ SfxLibrary_Impl::SfxLibrary_Impl( Type aType, +/*N*/ Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI , +/*N*/ const OUString& aLibInfoFileURL, +/*N*/ const OUString& aStorageURL, sal_Bool ReadOnly ) +/*N*/ : OComponentHelper( m_mutex ) +/*N*/ , mxMSF( xMSF ) +/*N*/ , mxSFI( xSFI ) +/*N*/ , maNameContainer( aType ) +/*N*/ , mbLoaded( sal_False ) +/*N*/ , mbModified( sal_True ) +/*N*/ , mbInitialised( sal_False ) +/*N*/ , maLibInfoFileURL( aLibInfoFileURL ) +/*N*/ , maStorageURL( aStorageURL ) +/*N*/ , mbLink( sal_True ) +/*N*/ , mbReadOnly( sal_False ) +/*N*/ , mbReadOnlyLink( ReadOnly ) +/*N*/ , mbPasswordProtected( sal_False ) +/*N*/ , mbPasswordVerified( sal_False ) +/*N*/ , mbDoc50Password( sal_False ) +/*N*/ , mbSharedIndexFile( sal_False ) +/*N*/ { +/*N*/ } + + +// Methods XInterface +/*N*/ Any SAL_CALL SfxLibrary_Impl::queryInterface( const Type& rType ) +/*N*/ throw( RuntimeException ) +/*N*/ { +/*N*/ Any aRet; + + /* + if( mbReadOnly ) + { + aRet = Any( ::cppu::queryInterface( rType, + static_cast< XContainer * >( this ), + static_cast< XNameAccess * >( this ) ) ); + } + else + { + */ +/*N*/ aRet = Any( ::cppu::queryInterface( rType, +/*N*/ static_cast< XContainer * >( this ), +/*N*/ static_cast< XNameContainer * >( this ), +/*N*/ static_cast< XNameAccess * >( this ) ) ); +/*N*/ //} +/*N*/ if( !aRet.hasValue() ) +/*N*/ aRet = OComponentHelper::queryInterface( rType ); +/*N*/ return aRet; +/*N*/ } + +// Methods XElementAccess +/*?*/ Type SfxLibrary_Impl::getElementType() +/*?*/ throw(RuntimeException) +/*?*/ { + return maNameContainer.getElementType(); +/*?*/ } + +/*N*/ sal_Bool SfxLibrary_Impl::hasElements() +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ sal_Bool bRet = maNameContainer.hasElements(); +/*N*/ return bRet; +/*N*/ } + +// Methods XNameAccess +Any SfxLibrary_Impl::getByName( const OUString& aName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) +{ + Any aRetAny; + if ( !mbPasswordProtected || mbPasswordVerified ) + aRetAny = maNameContainer.getByName( aName ); + return aRetAny; +} + +/*N*/ Sequence< OUString > SfxLibrary_Impl::getElementNames() +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ return maNameContainer.getElementNames(); +/*N*/ } + +/*N*/ sal_Bool SfxLibrary_Impl::hasByName( const OUString& aName ) +/*N*/ throw(RuntimeException) +/*N*/ { +/*N*/ sal_Bool bRet = maNameContainer.hasByName( aName ); +/*N*/ return bRet; +/*N*/ } + +// Methods XNameReplace +/*?*/ void SfxLibrary_Impl::replaceByName( const OUString& aName, const Any& aElement ) +/*?*/ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + + +// Methods XNameContainer +/*N*/ void SfxLibrary_Impl::insertByName( const OUString& aName, const Any& aElement ) +/*N*/ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) +/*N*/ { +/*N*/ if( mbReadOnly || (mbLink && mbReadOnlyLink) ) +/*N*/ throw RuntimeException(); +/*N*/ +/*N*/ maNameContainer.insertByName( aName, aElement ); +/*N*/ mbModified = sal_True; +/*N*/ } + +/*?*/ void SfxLibrary_Impl::removeByName( const OUString& Name ) +/*?*/ throw(NoSuchElementException, WrappedTargetException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +// XTypeProvider +/*?*/ Sequence< Type > SfxLibrary_Impl::getTypes() +/*?*/ throw( RuntimeException ) +/*?*/ { + static OTypeCollection * s_pTypes_NameContainer = 0; + static OTypeCollection * s_pTypes_NameAccess = 0; + { + if( !s_pTypes_NameContainer ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !s_pTypes_NameContainer ) + { + static OTypeCollection s_aTypes_NameContainer( + ::getCppuType( (const Reference< XNameContainer > *)0 ), + ::getCppuType( (const Reference< XContainer > *)0 ), + OComponentHelper::getTypes() ); + s_pTypes_NameContainer = &s_aTypes_NameContainer; + } + } + return s_pTypes_NameContainer->getTypes(); + } + +/*?*/ } + + +/*?*/ Sequence< sal_Int8 > SfxLibrary_Impl::getImplementationId() +/*?*/ throw( RuntimeException ) +/*?*/ { + static OImplementationId * s_pId_NameContainer = 0; + static OImplementationId * s_pId_NameAccess = 0; + { + if( !s_pId_NameContainer ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !s_pId_NameContainer ) + { + static OImplementationId s_aId_NameContainer; + s_pId_NameContainer = &s_aId_NameContainer; + } + } + return s_pId_NameContainer->getImplementationId(); + } + +/*?*/ } + + +//============================================================================ + +// Methods XContainer +/*N*/ void SAL_CALL SfxLibrary_Impl::addContainerListener( const Reference< XContainerListener >& xListener ) +/*N*/ throw (RuntimeException) +/*N*/ { +/*N*/ maNameContainer.setEventSource( static_cast< XInterface* >( (OWeakObject*)this ) ); +/*N*/ maNameContainer.addContainerListener( xListener ); +/*N*/ } + +/*?*/ void SAL_CALL SfxLibrary_Impl::removeContainerListener( const Reference< XContainerListener >& xListener ) +/*?*/ throw (RuntimeException) +/*?*/ { + maNameContainer.removeContainerListener( xListener ); +/*?*/ } + +//============================================================================ + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_scriptcont.cxx b/binfilter/bf_sfx2/source/appl/sfx2_scriptcont.cxx new file mode 100644 index 000000000000..12313d80516d --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_scriptcont.cxx @@ -0,0 +1,470 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/xml/sax/XParser.hpp> + +#include <com/sun/star/io/XActiveDataSource.hpp> + +#include <bf_sfx2/sfxuno.hxx> + +#include "namecont.hxx" + +#include "bf_basic/basmgr.hxx" + +#include "scriptcont.hxx" + +#include <unotools/streamwrap.hxx> +#include <rtl/digest.h> + +// For password functionality + + +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/ehdl.hxx> +#include "bf_basic/basmgr.hxx" +#include <xmlscript/xmlmod_imexp.hxx> +#include <app.hxx> +namespace binfilter { + + +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::script; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star; +using namespace cppu; +using namespace rtl; +using namespace osl; + + +//============================================================================ +// Implementation class SfxScriptLibraryContainer + +/*N*/ sal_Bool SfxScriptLibraryContainer::init +/*N*/ ( const ::rtl::OUString& aInitialisationParam, +/*N*/ const ::rtl::OUString& aScriptLanguage, +/*N*/ BasicManager* pBasMgr, SotStorage* pStor ) +/*N*/ { +/*N*/ maScriptLanguage = aScriptLanguage; +/*N*/ mpBasMgr = pBasMgr; +/*N*/ return SfxLibraryContainer_Impl::init( +/*N*/ aInitialisationParam, +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("script") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("script") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("xba") ), +/*N*/ OUString ( RTL_CONSTASCII_USTRINGPARAM("Basic") ), +/*N*/ pStor ); +/*N*/ } + +// OldBasicPassword interface +void SfxScriptLibraryContainer::setLibraryPassword( + const String& rLibraryName, const String& rPassword ) +{ + try + { + SfxLibrary_Impl* pImplLib = getImplLib( rLibraryName ); + if ( rPassword.Len() ) + { + pImplLib->mbDoc50Password = sal_True; + pImplLib->mbPasswordProtected = sal_True; + pImplLib->maPassword = rPassword; + } + } + catch( NoSuchElementException& ) {} +} + +/*N*/ String SfxScriptLibraryContainer::getLibraryPassword( const String& rLibraryName ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pImplLib = getImplLib( rLibraryName ); +/*N*/ String aPassword; +/*N*/ if( pImplLib->mbPasswordVerified ) +/*?*/ aPassword = pImplLib->maPassword; +/*N*/ return aPassword; +/*N*/ } + +/*?*/ void SfxScriptLibraryContainer::clearLibraryPassword( const String& rLibraryName ) +/*?*/ { + try + { + SfxLibrary_Impl* pImplLib = getImplLib( rLibraryName ); + pImplLib->mbDoc50Password = sal_False; + pImplLib->mbPasswordProtected = sal_False; + pImplLib->maPassword = OUString(); + } + catch( NoSuchElementException& ) {} + +/*?*/ } + +/*N*/ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryName ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pImplLib = getImplLib( rLibraryName ); +/*N*/ return pImplLib->mbPasswordProtected; +/*N*/ } + + +// Ctor for service +/*N*/ SfxScriptLibraryContainer::SfxScriptLibraryContainer( void ) +/*N*/ { +/*N*/ // all initialisation has to be done +/*N*/ // by calling XInitialization::initialize +/*N*/ } + +/*N*/ SfxScriptLibraryContainer:: SfxScriptLibraryContainer +/*N*/ ( const ::rtl::OUString& aScriptLanguage, BasicManager* pBasMgr, SotStorage* pStor ) +/*N*/ { +/*N*/ OUString aInitialisationParam; +/*N*/ init( aInitialisationParam, aScriptLanguage, pBasMgr, pStor ); +/*N*/ } + +// Methods to get library instances of the correct type +/*N*/ SfxLibrary_Impl* SfxScriptLibraryContainer::implCreateLibrary( void ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pRet = (SfxLibrary_Impl*) new SfxScriptLibrary( mxMSF, mxSFI ); +/*N*/ return pRet; +/*N*/ } + +/*N*/ SfxLibrary_Impl* SfxScriptLibraryContainer::implCreateLibraryLink +/*N*/ ( const OUString& aLibInfoFileURL, const OUString& StorageURL, sal_Bool ReadOnly ) +/*N*/ { +/*N*/ SfxLibrary_Impl* pRet = +/*N*/ (SfxLibrary_Impl*) new SfxScriptLibrary +/*N*/ ( mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly ); +/*N*/ return pRet; +/*N*/ } + +/*N*/ Any SAL_CALL SfxScriptLibraryContainer::createEmptyLibraryElement( void ) +/*N*/ { +/*N*/ OUString aMod; +/*N*/ Any aRetAny; +/*N*/ aRetAny <<= aMod; +/*N*/ return aRetAny; +/*N*/ } + +/*?*/ sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryElementValid( Any aElement ) +/*?*/ { + OUString aMod; + aElement >>= aMod; + sal_Bool bRet = (aMod.getLength() > 0); + return bRet; +/*?*/ } + +/*?*/ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement +/*?*/ ( +/*?*/ Any aElement, +/*?*/ const OUString& aElementName, +/*?*/ Reference< XOutputStream > xOutput +/*?*/ ) +/*?*/ throw(Exception) +/*?*/ { + // Create sax writer + Reference< XExtendedDocumentHandler > xHandler( + mxMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY ); + if( !xHandler.is() ) + { + OSL_ENSURE( 0, "### couln't create sax-writer component\n" ); + return; + } + + Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY ); + xSource->setOutputStream( xOutput ); + + xmlscript::ModuleDescriptor aMod; + aMod.aName = aElementName; + aMod.aLanguage = maScriptLanguage; + aElement >>= aMod.aCode; + xmlscript::exportScriptModule( xHandler, aMod ); +/*?*/ } + + +/*N*/ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement +/*N*/ ( const OUString& aFile, SotStorageStreamRef xElementStream ) +/*N*/ { +/*N*/ Any aRetAny; +/*N*/ +/*N*/ Reference< XParser > xParser( mxMSF->createInstance( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY ); +/*N*/ if( !xParser.is() ) +/*N*/ { +/*N*/ OSL_ENSURE( 0, "### couln't create sax parser component\n" ); +/*N*/ return aRetAny; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ // Read from storage? +/*N*/ sal_Bool bStorage = xElementStream.Is(); +/*N*/ Reference< XInputStream > xInput; +/*N*/ +/*N*/ if( bStorage ) +/*N*/ { +/*?*/ xInput = new ::utl::OInputStreamWrapper( *xElementStream ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ xInput = mxSFI->openFileRead( aFile ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ //catch( Exception& e ) +/*N*/ { +/*N*/ // TODO: +/*N*/ //throw WrappedTargetException( e ); +/*N*/ } +/*N*/ } +/*N*/ if( !xInput.is() ) +/*N*/ return aRetAny; +/*N*/ +/*N*/ InputSource source; +/*N*/ source.aInputStream = xInput; +/*N*/ source.sSystemId = aFile; +/*N*/ +/*N*/ // start parsing +/*N*/ xmlscript::ModuleDescriptor aMod; +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ xParser->setDocumentHandler( ::xmlscript::importScriptModule( aMod ) ); +/*N*/ xParser->parseStream( source ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +//*N*/ SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFile ); +//*N*/ ULONG nErrorCode = ERRCODE_IO_GENERAL; +//*N*/ ErrorHandler::HandleError( nErrorCode ); +/*N*/ } +/*N*/ +/*N*/ aRetAny <<= aMod.aCode; +/*N*/ +/*N*/ // TODO: Check language +/*N*/ // aMod.aLanguage +/*N*/ // aMod.aName ignored +/*N*/ +/*N*/ return aRetAny; +/*N*/ } + + +/*?*/ void SAL_CALL SfxScriptLibraryContainer::importFromOldStorage( const ::rtl::OUString& aFile ) +/*?*/ { + DBG_ERROR("Strip"); +/*?*/ } + + +// Storing with password encryption + +// Methods XLibraryContainerPassword +sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryPasswordProtected( const OUString& Name ) + throw (NoSuchElementException, RuntimeException) +{ + SfxLibrary_Impl* pImplLib = getImplLib( Name ); + sal_Bool bRet = pImplLib->mbPasswordProtected; + return bRet; +} + +sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryPasswordVerified( const OUString& Name ) + throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +{ + SfxLibrary_Impl* pImplLib = getImplLib( Name ); + if( !pImplLib->mbPasswordProtected ) + throw IllegalArgumentException(); + sal_Bool bRet = pImplLib->mbPasswordVerified; + return bRet; +} + +/*?*/ sal_Bool SAL_CALL SfxScriptLibraryContainer::verifyLibraryPassword +/*?*/ ( const OUString& Name, const OUString& Password ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ { + SfxLibrary_Impl* pImplLib = getImplLib( Name ); + if( !pImplLib->mbPasswordProtected || pImplLib->mbPasswordVerified ) + throw IllegalArgumentException(); + + // Test password + sal_Bool bSuccess = sal_False; + if( pImplLib->mbDoc50Password ) + { + bSuccess = ( Password == pImplLib->maPassword ); + if( bSuccess ) + pImplLib->mbPasswordVerified = sal_True; + } + else + { + pImplLib->maPassword = Password; + bSuccess = implLoadPasswordLibrary( pImplLib, Name, sal_True ); + if( bSuccess ) + { + // The library gets modified by verifiying the password, because other- + // wise for saving the storage would be copied and that doesn't work + // with mtg's storages when the password is verified + pImplLib->mbModified = sal_True; + pImplLib->mbPasswordVerified = sal_True; + + // Reload library to get source + if( pImplLib->mbLoaded ) + implLoadPasswordLibrary( pImplLib, Name ); + } + } + return bSuccess; +/*?*/ } + +/*?*/ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString& Name, +/*?*/ const OUString& OldPassword, const OUString& NewPassword ) +/*?*/ throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + + + + +// Impl methods +/*?*/ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary_Impl* pLib, +/*?*/ const ::rtl::OUString& aName, SotStorageRef xStorage ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +/*?*/ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary +/*?*/ ( SfxLibrary_Impl* pLib, const OUString& Name, sal_Bool bVerifyPasswordOnly ) +/*?*/ throw(WrappedTargetException, RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + + +//============================================================================ +// Methods XInitialization +/*?*/ void SAL_CALL SfxScriptLibraryContainer::initialize( const Sequence< Any >& aArguments ) +/*?*/ throw (::com::sun::star::uno::Exception, +/*?*/ ::com::sun::star::uno::RuntimeException) +/*?*/ { + sal_Int32 nArgCount = aArguments.getLength(); + OSL_ENSURE( nArgCount, "SfxDialogLibraryContainer::initialize() called with no arguments\n" ); + + OUString aInitialisationParam; + OUString aScriptLanguage; + if( nArgCount ) + { + const Any* pArgs = aArguments.getConstArray(); + pArgs[0] >>= aInitialisationParam; + OSL_ENSURE( aInitialisationParam.getLength(), + "SfxDialogLibraryContainer::initialize() called with empty url\n" ); + + if( nArgCount > 1 ) + pArgs[1] >>= aInitialisationParam; + else + aScriptLanguage = OUString::createFromAscii( "StarBasic" ); + } + + init( aInitialisationParam, aScriptLanguage ); + +/*?*/ } + + +//============================================================================ +// Service +/*N*/ SFX_IMPL_SINGLEFACTORY( SfxScriptLibraryContainer ) + +/*N*/ Sequence< OUString > SfxScriptLibraryContainer::impl_getStaticSupportedServiceNames() +/*N*/ { +/*N*/ static Sequence< OUString > seqServiceNames( 1 ); +/*N*/ static sal_Bool bNeedsInit = sal_True; +/*N*/ +/*N*/ MutexGuard aGuard( Mutex::getGlobalMutex() ); +/*N*/ if( bNeedsInit ) +/*N*/ { +/*N*/ OUString* pSeq = seqServiceNames.getArray(); +/*N*/ pSeq[0] = OUString::createFromAscii( "com.sun.star.script.ScriptLibraryContainer" ); +/*N*/ bNeedsInit = sal_False; +/*N*/ } +/*N*/ return seqServiceNames; +/*N*/ } + +/*N*/ OUString SfxScriptLibraryContainer::impl_getStaticImplementationName() +/*N*/ { +/*N*/ static OUString aImplName; +/*N*/ static sal_Bool bNeedsInit = sal_True; +/*N*/ +/*N*/ MutexGuard aGuard( Mutex::getGlobalMutex() ); +/*N*/ if( bNeedsInit ) +/*N*/ { +/*N*/ aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.ScriptLibraryContainer" ); +/*N*/ bNeedsInit = sal_False; +/*N*/ } +/*N*/ return aImplName; +/*N*/ } + +/*N*/ Reference< XInterface > SAL_CALL SfxScriptLibraryContainer::impl_createInstance +/*N*/ ( const Reference< XMultiServiceFactory >& xServiceManager ) +/*N*/ throw( Exception ) +/*N*/ { +/*N*/ Reference< XInterface > xRet = +/*N*/ static_cast< XInterface* >( static_cast< OWeakObject* >(new SfxScriptLibraryContainer()) ); +/*N*/ return xRet; +/*N*/ } +//============================================================================ + +/*N*/ void SAL_CALL SfxScriptLibraryContainer::storeLibraries( sal_Bool bComplete ) +/*N*/ { +/*N*/ SfxLibraryContainer_Impl::storeLibraries( bComplete ); +/*N*/ } + +/*N*/ void SAL_CALL SfxScriptLibraryContainer::storeLibrariesToStorage( SotStorageRef xStorage ) +/*N*/ { +/*N*/ SfxLibraryContainer_Impl::storeLibrariesToStorage( xStorage ); +/*N*/ } + + +//============================================================================ +// Implementation class SfxScriptLibrary + +// Ctor +/*N*/ SfxScriptLibrary::SfxScriptLibrary( Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI ) +/*N*/ : SfxLibrary_Impl( getCppuType( (const OUString *)0 ), xMSF, xSFI ) +/*N*/ , mbLoadedSource( sal_False ) +/*N*/ , mbLoadedBinary( sal_False ) +/*N*/ { +/*N*/ } + +/*N*/ SfxScriptLibrary::SfxScriptLibrary( Reference< XMultiServiceFactory > xMSF, +/*N*/ Reference< XSimpleFileAccess > xSFI, +/*N*/ const OUString& aLibInfoFileURL, +/*N*/ const OUString& aStorageURL, +/*N*/ sal_Bool ReadOnly ) +/*N*/ : SfxLibrary_Impl( getCppuType( (const OUString *)0 ), xMSF, xSFI, +/*N*/ aLibInfoFileURL, aStorageURL, ReadOnly) +/*N*/ , mbLoadedSource( sal_False ) +/*N*/ , mbLoadedBinary( sal_False ) +/*N*/ { +/*N*/ } + +//============================================================================ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/appl/sfx2_sfx.src b/binfilter/bf_sfx2/source/appl/sfx2_sfx.src new file mode 100644 index 000000000000..ab78f299232b --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_sfx.src @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + +#include "sfx.hrc" + +String STR_NONAME +{ + Text [ de ] = "Unbenannt" ; + Text [ en-US ] = "Untitled" ; + Text[ pt ] = "Sem nome"; + Text[ ru ] = "Документ"; + Text[ el ] = "Δίχως όνομα"; + Text[ nl ] = "naamloos"; + Text[ fr ] = "Sans nom"; + Text[ es ] = "Sin nombre"; + Text[ fi ] = "Nimetön"; + Text[ ca ] = "Sense nom"; + Text[ it ] = "Senza nome"; + Text[ sk ] = "Bez_názvu"; + Text[ da ] = "ikke-navngivet"; + Text[ sv ] = "Namnlös"; + Text[ pl ] = "Bez tytuÅ‚u"; + Text[ pt-BR ] = "Sem nome"; + Text[ th ] = "ไม่มีชื่à¸"; + Text[ ja ] = "ç„¡é¡Œ"; + Text[ ko ] = "ì œëª© ì—†ìŒ"; + Text[ zh-CN ] = "未命å"; + Text[ zh-TW ] = "未命å"; + Text[ tr ] = "Ä°simsiz"; + Text[ hi-IN ] = "नाम रहित"; + Text[ ar ] = "بدون عنوان"; + Text[ he ] = "â€®×œ×œ× ×›×•×ª×¨×ªâ€¬"; +}; + + +String STR_CLOSE +{ + Text [ de ] = "Schließen" ; + Text [ en-US ] = "Close" ; + Text[ pt ] = "Fechar"; + Text[ ru ] = "Закрыть"; + Text[ el ] = "Κλείσιμο"; + Text[ nl ] = "Sluiten"; + Text[ fr ] = "Fermer"; + Text[ es ] = "Cerrar"; + Text[ fi ] = "Sulje"; + Text[ ca ] = "Tanca"; + Text[ it ] = "Chiudi"; + Text[ sk ] = "ZavrieÅ¥"; + Text[ da ] = "Luk"; + Text[ sv ] = "Stäng"; + Text[ pl ] = "Zamknij"; + Text[ pt-BR ] = "Fechar"; + Text[ th ] = "ปิด"; + Text[ ja ] = "é–‰ã˜ã‚‹"; + Text[ ko ] = "닫기"; + Text[ zh-CN ] = "å…³é—"; + Text[ zh-TW ] = "關閉"; + Text[ tr ] = "Kapat"; + Text[ hi-IN ] = "बनà¥à¤¦ करो"; + Text[ ar ] = "إغلاق"; + Text[ he ] = "‮סגירה‬"; +}; + + + + + + + +String STR_STANDARD +{ + Text [ de ] = "Standard" ; + Text [ en-US ] = "Standard" ; + Text[ pt ] = "Padrão"; + Text[ ru ] = "По умолчанию"; + Text[ el ] = "Î Ïοεπιλογή"; + Text[ nl ] = "Standaard"; + Text[ fr ] = "Par défaut"; + Text[ es ] = "Predeterminado"; + Text[ fi ] = "Vakio"; + Text[ ca ] = "Predeterminat"; + Text[ it ] = "Standard"; + Text[ sk ] = "Å tandardný"; + Text[ da ] = "Standard"; + Text[ sv ] = "Standard"; + Text[ pl ] = "Standardowy"; + Text[ pt-BR ] = "Padrão"; + Text[ th ] = "มาตรà¸à¸²à¸™"; + Text[ ja ] = "標準"; + Text[ ko ] = "표준"; + Text[ zh-CN ] = "æ ‡å‡†"; + Text[ zh-TW ] = "標準"; + Text[ tr ] = "Standart"; + Text[ hi-IN ] = "सà¥à¤Ÿà¤¾à¤¨à¥à¤¡à¤¾à¤°à¥à¤¡"; + Text[ ar ] = "قياسي"; + Text[ he ] = "‮רגיל‬"; +}; + + + +String STR_HUMAN_APPNAME +{ + Text = "%PRODUCTNAME" ; +}; + + + + + + +String STR_UNDO +{ + /* ### ACHTUNG: Neuer Text in Resource? Rückgängig: : R³ckgõngig: */ + Text [ de ] = "Rückgängig: " ; + Text [ en-US ] = "Undo: " ; + Text[ pt ] = "Anular: "; + Text[ ru ] = "Отменить: "; + Text[ el ] = "Αναί~Ïεση: "; + Text[ nl ] = "Ongedaan maken:"; + Text[ fr ] = "Annuler : "; + Text[ es ] = "Deshacer: "; + Text[ fi ] = "Kumoa: "; + Text[ ca ] = "Desfés: "; + Text[ it ] = "Annulla "; + Text[ sk ] = "Späť: "; + Text[ da ] = "Fortryd: "; + Text[ sv ] = "Ã…ngra: "; + Text[ pl ] = "Co~fnij: "; + Text[ pt-BR ] = "~Desfazer: "; + Text[ th ] = "เลิà¸à¸—ำ: "; + Text[ ja ] = "å…ƒã«æˆ»ã™: "; + Text[ ko ] = "실행 취소: "; + Text[ zh-CN ] = "撤消命令: "; + Text[ zh-TW ] = "復原:"; + Text[ tr ] = "Geri al: "; + Text[ hi-IN ] = "अनावृतà¥à¤¤à¤¿: "; + Text[ ar ] = "تراجع: "; + Text[ he ] = "‮ביטול פעולה:‬"; +}; + +String STR_REDO +{ + Text [ de ] = "Wiederherstellen: " ; + Text [ en-US ] = "Re~do: " ; + Text[ pt ] = "Restaurar: "; + Text[ ru ] = "Вернуть: "; + Text[ el ] = "ΕπανεκτÎλεση: "; + Text[ nl ] = "Herstellen:"; + Text[ fr ] = "Restaurer : "; + Text[ es ] = "Restaurar: "; + Text[ fi ] = "Tois~ta: "; + Text[ ca ] = "Restaurar: "; + Text[ it ] = "Ripristina: "; + Text[ sk ] = "Z~novu: "; + Text[ da ] = "Gendan: "; + Text[ sv ] = "Ã…terställ: "; + Text[ pl ] = "Ponów: "; + Text[ pt-BR ] = "Re~fazer: "; + Text[ th ] = "~ทำซ้ำ: "; + Text[ ja ] = "ã‚„ã‚Šç›´ã—(~D):"; + Text[ ko ] = "다시 실행(~D):"; + Text[ zh-CN ] = "æ¢å¤æ’¤æ¶ˆå‘½ä»¤ (~D)"; + Text[ zh-TW ] = "æ¢å¾©æ’¤æ¶ˆæŒ‡ä»¤(~D):"; + Text[ tr ] = "~Yinele: "; + Text[ hi-IN ] = "फ़िर से ~करो: "; + Text[ ar ] = "إعادة: "; + Text[ he ] = "‮שחזור פעולה:‬"; +}; + +String STR_REPEAT +{ + Text [ de ] = "Letzter ~Befehl: " ; + Text [ en-US ] = "~Repeat: " ; + Text[ pt ] = "~Repetir: "; + Text[ ru ] = "Повторить: "; + Text[ el ] = "Επανάληψη: "; + Text[ nl ] = "~Herhalen:"; + Text[ fr ] = "~Répéter : "; + Text[ es ] = "~Repetir: "; + Text[ fi ] = "~Toista: "; + Text[ ca ] = "~Repeteix: "; + Text[ it ] = "Ultimo ~comando: "; + Text[ sk ] = "Opako~vaÅ¥: "; + Text[ da ] = "Sidste ~kommado: "; + Text[ sv ] = "Senaste ~kommando: "; + Text[ pl ] = "Powtó~rz: "; + Text[ pt-BR ] = "~Repetir: "; + Text[ th ] = "~ซ้ำ: "; + Text[ ja ] = "ç¹°ã‚Šè¿”ã—(~R):"; + Text[ ko ] = "반복(~R):"; + Text[ zh-CN ] = "上一个命令(~R)"; + Text[ zh-TW ] = "上一個指令(~R)"; + Text[ tr ] = "Son ~komutu yinele: "; + Text[ hi-IN ] = "~दà¥à¤¹à¤°à¤¾à¤¨à¤¾: "; + Text[ ar ] = "الأمر الأخير: "; + Text[ he ] = "‮בצוע חוזר:‬"; +}; + + +QueryBox MSG_QUERY_LASTVERSION +{ + Buttons = WB_YES_NO ; + DefButton = WB_DEF_NO ; + /* ### ACHTUNG: Neuer Text in Resource? Alle Änderungen aufheben? : Alle Žnderungen aufheben? */ + Message [ de ] = "Alle Änderungen aufheben?" ; + Message [ en-US ] = "Cancel all changes?" ; + Message[ pt ] = "Cancelar todas as modificações?"; + Message[ ru ] = "Отменить вÑе изменениÑ?"; + Message[ el ] = "ΑκÏÏωση όλων των αλλαγών;"; + Message[ nl ] = "Alle wijzigingen ongedaan maken?"; + Message[ fr ] = "Annuler toutes les modifications ?"; + Message[ es ] = "¿Cancelar todos los cambios?"; + Message[ fi ] = "Peruutetaanko kaikki muutokset?"; + Message[ ca ] = "Cancel.la tots els canvis?"; + Message[ it ] = "Volete annullare tutte le modifiche?"; + Message[ sk ] = "ZruÅ¡iÅ¥ vÅ¡etky zmeny?"; + Message[ da ] = "Vil du annullere alle ændringer?"; + Message[ sv ] = "Ã…ngra alla ändringar?"; + Message[ pl ] = "Anulować wszystkie zmiany?"; + Message[ pt-BR ] = "Cancelar todas as alterações?"; + Message[ th ] = "ยà¸à¹€à¸¥à¸´à¸à¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡à¸«à¸£à¸·à¸à¹„ม่?"; + Message[ ja ] = "ã™ã¹ã¦ã®å¤‰æ›´ã‚’解除ã—ã¾ã™ã‹ã€‚"; + Message[ ko ] = "ëª¨ë“ ë³€ê²½ ë‚´ìš©ì„ ì·¨ì†Œí•˜ì‹œê² ìŠµë‹ˆê¹Œ?"; + Message[ zh-CN ] = "è¦å–消更改?"; + Message[ zh-TW ] = "å–消所有的變更?"; + Message[ tr ] = "Tüm deÄŸiÅŸiklikleri iptal et?"; + Message[ hi-IN ] = "सब परिवरà¥à¤¤à¤¨à¥‹à¤‚ को रदà¥à¤¦ करना है?"; + Message[ ar ] = "هل تريد رÙض كل التغييرات؟"; + Message[ he ] = "‮ה×× ×œ×‘×˜×œ כל ×”×©×™× ×•×™×™×?‬"; +}; + diff --git a/binfilter/bf_sfx2/source/appl/sfx2_sfxdll.cxx b/binfilter/bf_sfx2/source/appl/sfx2_sfxdll.cxx new file mode 100644 index 000000000000..4109b6d49b38 --- /dev/null +++ b/binfilter/bf_sfx2/source/appl/sfx2_sfxdll.cxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef WIN +#include <svwin.h> +#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#ifdef WIN +namespace binfilter { + +// Statische DLL-Verwaltungs-Variablen +static HINSTANCE hDLLInst = 0; + +//========================================================================== + +/*N*/ extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +/*N*/ { +/*N*/ #ifndef WNT +/*N*/ if ( nHeap ) +/*N*/ UnlockData( 0 ); +/*N*/ #endif +/*N*/ +/*N*/ hDLLInst = hDLL; +/*N*/ +/*N*/ return TRUE; +/*N*/ } + + +//-------------------------------------------------------------------------- + +/*N*/ extern "C" int CALLBACK WEP( int ) +/*N*/ { +/*N*/ return 1; +/*N*/ } + + + +//========================================================================== +} +#endif + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/etcp.h b/binfilter/bf_sfx2/source/bastyp/etcp.h new file mode 100644 index 000000000000..df69b844b753 --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/etcp.h @@ -0,0 +1,519 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + + + +#ifndef UCHAR +typedef unsigned char UCHAR; +#endif + +#ifndef USHORT +typedef unsigned short USHORT; +#endif + + + +/* max filename length (bytes): don't change */ + +#define ETCP_MAX_FILENAME_LENGTH 255 + + + +/* VB file attributes */ + +#define ETCP_ATTR_NORMAL 0 /* normal file */ +#define ETCP_ATTR_READONLY 1 /* read-only */ +#define ETCP_ATTR_HIDDEN 2 /* hidden */ +#define ETCP_ATTR_SYSTEM 4 /* system */ +#define ETCP_ATTR_VOLUME 8 /* disk volume label */ +#define ETCP_ATTR_DIRECTORY 16 /* subdirectory */ +#define ETCP_ATTR_ARCHIVE 32 /* archive */ + + + +/* Archive type constants. */ + +#define ETCP_ARCHIVE_UNKNOWN 0 /* unknown */ +#define ETCP_ARCHIVE_ZIP 1 /* .ZIP archive, PK format */ +#define ETCP_ARCHIVE_ZIP_ETMV 2 /* .ZIP multi-volume archive, EllTech format */ +#define ETCP_ARCHIVE_ZIP_PKMV 3 /* .ZIP multi-volume archive, PK format */ +#define ETCP_ARCHIVE_ZIP_IMMV 4 /* .ZIP multi-volume archive, Inner Media format */ +#define ETCP_ARCHIVE_LZH 5 /* .LZH archive (LHA/LHARC format) */ +#define ETCP_ARCHIVE_ARJ 6 /* .ARJ archive */ +#define ETCP_ARCHIVE_ZOO 7 /* .ZOO archive */ +#define ETCP_ARCHIVE_ARC 8 /* .ARC archive */ +#define ETCP_ARCHIVE_ZIP_EXE 13 /* .EXE archive, PKZIP self-extracting format */ + + + +/* If the user status routine decides to let us handle it after all... */ + +#define ETCP_YOU_DO_IT -10000 + + + +/* Status display constants. */ + +#define ETCP_OPERATION_ZIP 0 /* zipping */ +#define ETCP_OPERATION_UNZIP 1 /* unzipping */ +#define ETCP_OPERATION_DELETE 2 /* deleting */ +#define ETCP_OPERATION_TEST 3 /* testing */ + + + +/* Status display message type constants. */ + +#define ETCP_MESSAGETYPE_ERROR 0 /* error */ +#define ETCP_MESSAGETYPE_QUERY 1 /* query */ +#define ETCP_MESSAGETYPE_STATUS 2 /* status or progress report */ + + + +/* Status Operation and MhZip .Action constants */ + +#define ETCP_ACTION_NONE 0 +#define ETCP_ACTION_EXAMINE 1 /* directory services */ +#define ETCP_ACTION_ADD 2 /* add files to an archive */ +#define ETCP_ACTION_UPDATE 3 /* update an archive */ +#define ETCP_ACTION_FRESHEN 4 /* freshen an archive */ +#define ETCP_ACTION_DELETE 5 /* delete files from an archive */ +#define ETCP_ACTION_EXTRACT 6 /* extract files from an archive */ +#define ETCP_ACTION_TEST 7 /* test archive files without extracting */ + +/* Constants for query codes (MhZip_Prompt event) and CPrint callbacks */ + +#define ETCP_QUERY_INSERT_DISK 1 /* insert a specific disk # in a MV set */ +#define ETCP_QUERY_OVERWRITE 2 /* overwrite confirmation */ +#define ETCP_QUERY_INSERT_LAST 3 /* insert the last disk in a PK-compatible MV set */ + +/* MhZip .OverWrite property constants */ + +#define ETCP_OVERWRITE_PROMPT 0 +#define ETCP_OVERWRITE_ALWAYS 1 +#define ETCP_OVERWRITE_NEVER 2 + +/* MhZip .EntryTypes property constants */ + +#define ETCP_ENTRIES_FILES 0 +#define ETCP_ENTRIES_DIRVOL 1 +#define ETCP_ENTRIES_ALL 2 + +/* MhZip .ExtractFreshen property constants */ + +#define ETCP_EXFR_ALL 0 +#define ETCP_EXFR_NEWEREXISTS 1 +#define ETCP_EXFR_NEWER 2 + +/* MhZip .FileArchiveBit property constants */ + +#define ETCP_FAB_IGNORE 0 +#define ETCP_FAB_ONLYIFSET 1 +#define ETCP_FAB_ALLRESET 2 +#define ETCP_FAB_ONLYIFSETRESET 3 + +/* MhZip .IncludeHidSys property constants */ + +#define ETCP_HIDSYS_EXCLUDE 0 +#define ETCP_HIDSYS_HIDDEN 1 +#define ETCP_HIDSYS_SYSTEM 2 +#define ETCP_HIDSYS_BOTH 3 + +/* MhZip .StorePath property constants */ + +#define ETCP_PATHS_NONE 0 +#define ETCP_PATH_RECURSED 1 +#define ETCP_PATH_SPECIFIEDRECURSED 2 + +/* MhZip .ZipFileDate property constants */ +#define ETCP_ZIPDATE_CURRENT 0 +#define ETCP_ZIPDATE_ORIGINAL 1 +#define ETCP_ZIPDATE_LATEST 2 + +/* constants for error codes */ + +#define ETCP_ERR_NOT_ENOUGH_MEMORY 108 /* not enough memory */ +#define ETCP_ERR_INVALID_HANDLE 106 /* invalid (file or archive) handle */ +#define ETCP_ERR_ACCESS_DENIED 105 /* access denied (file error of some sort) */ +#define ETCP_ERR_PATH_NOT_FOUND 103 /* path not found (or unable to create subdirectory) */ +#define ETCP_ERR_FILE_NOT_FOUND 102 /* file not found */ +#define ETCP_ERR_NO_PROBLEM 0 /* (no error) */ +#define ETCP_ERR_UNKNOWN_ARCHIVE_TYPE -1 /* not a .ZIP archive */ +#define ETCP_ERR_INVALID_ARCHIVE_DIR -2 /* error in archive directory */ +#define ETCP_ERR_UNKNOWN_METHOD -3 /* unknown compression method */ +#define ETCP_ERR_USER_ABORT -4 /* the user wants to cancel */ +#define ETCP_ERR_NO_FILES_FOUND -7 /* no (more) matching files */ +#define ETCP_ERR_INCOMPLETE -8 /* unable to complete request */ +#define ETCP_ERR_INVALID_SWITCH -9 /* invalid switch option */ +#define ETCP_ERR_DISK_FULL -10 /* write error (disk full?) */ +#define ETCP_ERR_READ_PAST_END -11 /* read error (read past end?) */ +#define ETCP_ERR_INVALID_OFFSET -12 /* invalid starting offset for EtUnZipPtr */ +#define ETCP_ERR_OVERFLOW -18 /* overflow (integer > 32767 or string too long) */ +#define ETCP_ERR_NOTHING_TO_DO -19 /* no action specified [might want to respond by popping up help] */ +#define ETCP_ERR_SWITCH_CONFLICT -20 /* conflicting switches were specified */ +#define ETCP_ERR_TOO_MANY_FILES -21 /* too many files to process (more than 65535 or too many for multi-vol dir) */ +#define ETCP_ERR_INVALID_DATE -22 /* invalid date specified */ +#define ETCP_ERR_BAD_FILE_MODE -23 /* invalid file mode specified */ +#define ETCP_ERR_BAD_PASSWORD -24 /* incorrect password */ +#define ETCP_ERR_BAD_CRC -25 /* computed CRC doesn't match recorded CRC */ +#define ETCP_ERR_NOT_WITH_MV -26 /* function not supported for multi-volume or alien archives */ +#define ETCP_ERR_CANT_CONTINUE -27 /* can't continue (.ZIP was modified between Et4ZipFindNext calls) */ +#define ETCP_ERR_NOT_REMOVABLE -28 /* selected multi-volume format requires removable disks for target files */ + + + +/* constants for .ZIP file open mode */ + +#define ETCP_OPEN_ANY 0 /* open for r/w; create if need be */ +#define ETCP_OPEN_READONLY 1 /* open for read (only) */ +#define ETCP_OPEN_READWRITE 2 /* open for read/write */ +#define ETCP_OPEN_CREATE 3 /* create; open for read/write */ + + + +/* Constants for zip method specification. These are not the same as the numbers used in the .ZIP + * itself-- the problem being that the .ZIP methods are partially given by numbers, and partially + * by assorted flags, which is a nuisance to handle. Internally, we use these single well-defined + * constants instead, and convert back and forth when dealing with the .ZIP file headers directly. */ + +#define ETCP_METHOD_NONE 0 +#define ETCP_METHOD_DEFLATE0 1 +#define ETCP_METHOD_DEFLATE1 2 +#define ETCP_METHOD_DEFLATE2 3 +#define ETCP_METHOD_DEFLATE3 4 +#define ETCP_METHOD_SCRUNCH 5 +#define ETCP_METHOD_IMPLODE 6 +#define ETCP_METHOD_HUFFMAN 7 +#define ETCP_METHOD_MASH 8 +#define ETCP_METHOD_SHRINK 9 + + + +typedef struct tagCENTRALDIRREC +{ + DWORD cdrSignature; /* signature/I.D. */ + USHORT cdrCreationOS; /* PK version used to create archive */ + USHORT cdrExtractVer; /* PK version needed to extract file */ + USHORT cdrGenPurFlag; /* misc flags */ + short cdrMethod; /* compression method */ + USHORT cdrFTime; /* file time, in DOS format */ + USHORT cdrFDate; /* file date, in DOS format */ + long cdrCRC32; /* CRC of file */ + long cdrCompSize; /* compressed size of file */ + long cdrUncompSize; /* uncompressed size of file */ + USHORT cdrFileNameLen; /* length of file name */ + USHORT cdrExtraFieldLen; /* length of extra field */ + USHORT cdrCommentLen; /* length of file comment */ + USHORT cdrDiskNumStart; /* starting disk number [0..n] */ + USHORT cdrIntFileAttr; /* internal file attribute (.ZIP internal attr) */ + DWORD cdrExtFileAttr; /* external file attribute (includes DOS attr) */ + long cdrLocalHeader; /* file pointer to local header structure */ +} CENTRALDIRREC, FAR * lpCENTRALDIRREC; + +typedef struct tagENDOFCENTRALDIRREC +{ + DWORD ecdSignature; /* signature/I.D. */ + USHORT ecdDiskNum; /* current disk number [0..n] */ + USHORT ecdDiskWCD; /* disk # with start of central dir */ + USHORT ecdNumThisDisk; /* # of entries in central dir on this disk */ + USHORT ecdTotalCD; /* total # of entries in central dir */ + long ecdCDSize; /* size of central dir (bytes) */ + long ecdCDOffset; /* offset of central dir on 1st disk with same */ + USHORT ecdCommentLen; /* strlen of zip file comment */ +} ENDOFCENTRALDIRREC, FAR * lpENDOFCENTRALDIRREC; + +typedef struct tagCOMPINFO +{ + UCHAR ciZipFileName[ETCP_MAX_FILENAME_LENGTH]; /* name of .ZIP file being processed */ + UCHAR ciFileName[ETCP_MAX_FILENAME_LENGTH]; /* name of the file being processed (added to .ZIP, deleted from .ZIP, or whatever) */ + short ciOperation; /* operation: 0 zip, 1 unzip, 2 delete, 3 test */ + long ciTotalSize; /* total number of bytes to process */ + long ciCurrentByte; /* current byte being processed */ + long ciCompSize; /* compressed size */ + short ciMethod; /* compression method */ + short ciPass; /* pass number [1..n] */ + long ciPassSize; /* total bytes this pass */ + short ciMessageType; /* message type (status, error, query) */ + short ciMessageCode; /* message number (if error message) */ + short ciDiskNumber; /* disk number (for multi-volume query) */ +} COMPINFO; + +typedef struct tagMORECOMPINFO +{ + USHORT ciFDate; // file date, in DOS format + USHORT ciFTime; // file time, in DOS format + // There may be additional data added on to the end of this structure in the future... +} MORECOMPINFO, FAR * lpMORECOMPINFO; + + + +/* prototypes */ + +short FAR PASCAL Et4AddUnZipPathFilter (LPSTR sOldPath, LPSTR sNewPath); + +void FAR PASCAL Et4Cancel (); + +void FAR PASCAL Et4CompressDosDate (short wMonth, short wDay, short wYear, + USHORT FAR * wDate); + +void FAR PASCAL Et4CompressDosTime (short wHour, short wMinute, short wSecond, + USHORT FAR * wTime); + +void FAR PASCAL Et4CPrintHook (FARPROC CPrintRoutine); + +short FAR PASCAL Et4CrLfToLf (LPSTR sInFile, LPSTR sOutFile); + +short FAR PASCAL Et4DirExist (LPSTR sDirName); + +short FAR PASCAL Et4DosGetFileTime (LPSTR sFileName, USHORT FAR * lpwDate, + USHORT FAR * lpwTime); + +short FAR PASCAL Et4DosSetFileTime (LPSTR sFileName, USHORT wDate, + USHORT wTime); + +void FAR PASCAL Et4ExpandDosDate (USHORT wDate, short FAR * wMonth, + short FAR * wDay, short FAR * wYear); + +void FAR PASCAL Et4ExpandDosTime (USHORT wTime, short FAR * wHour, + short FAR * wMinute, short FAR * wSecond); + +short FAR PASCAL Et4ExtendedCPrintInfo (short wcbBuffer, void * lpBuffer); + +short FAR PASCAL Et4GetCPrint (); + +short FAR PASCAL Et4GetDoEvents (); + +short FAR PASCAL Et4GetParsePlace (); + +short FAR PASCAL Et4GetParseType (); + +short FAR PASCAL Et4IdentifyFile (LPSTR sZipFile, short FAR * wArchiveType); + +short FAR PASCAL Et4LfToCrLf (LPSTR sInFile, LPSTR sOutFile, short fCtrlZ); + +short FAR PASCAL Et4MakeSFX (LPSTR sZipFile, LPSTR sSfxFile, short iOverwrite, + short iEncryptedOk, short iDestPathDialog, short iStartDialog, + short iEndDialog, LPSTR sAutoExecFile); + +short FAR PASCAL Et4QUnZip (LPSTR sZipFile, LPSTR sDestination, + LPSTR sFileSpec, LPSTR sSwitches); + +short FAR PASCAL Et4QZip (LPSTR sZipFile, LPSTR sFileSpec, LPSTR sSwitches); + +void FAR PASCAL Et4SetCPrint (short StatusDisplay); + +void FAR PASCAL Et4SetDoEvents (short DoEvents); + +void FAR PASCAL Et4SetParseType (short wChoice); + +short FAR PASCAL Et4UnZip (HFILE FAR * hZipFile, LPSTR sDestination, + LPSTR asFileSpec, LPSTR asExcludeSpec, LPSTR sSwitches); + +short FAR PASCAL Et4UnZipPtr (HFILE hZipFile, UCHAR FAR * dPtr, + long dStartingOffset, long dcbBytesWanted, LPSTR sInternalName, + LPSTR sSwitches); + +short FAR PASCAL Et4Zip (HFILE FAR * hZipFile, LPSTR asFileSpec, + LPSTR asExcludeSpec, LPSTR sSwitches); + +void FAR PASCAL Et4ZipClose (HFILE FAR * hZipFile); + +short FAR PASCAL Et4ZipComment (HFILE hZipFile, LPSTR sComment, + UINT wMaxCommentLen); + +short FAR PASCAL Et4ZipCount (HFILE hZipFile, UINT FAR * wFileCount); + +short FAR PASCAL Et4ZipCreateMV (LPSTR sZipFile, USHORT wZipType, + DWORD dcbFirstDisk, DWORD dcbNextDisk, HFILE FAR * hZipFile); + +short FAR PASCAL Et4ZipFindFirst (HFILE hZipFile, CENTRALDIRREC FAR * cdr, + LPSTR sFile, LPSTR sExtraField, USHORT MaxExtraFieldLen, LPSTR sComment, + USHORT MaxCommentLen); + +short FAR PASCAL Et4ZipFindNext (HFILE hZipFile, CENTRALDIRREC FAR * cdr, + LPSTR sFile, LPSTR sExtraField, USHORT MaxExtraFieldLen, LPSTR sComment, + USHORT MaxCommentLen); + +short FAR PASCAL Et4ZipNewComment (HFILE hZipFile, LPSTR sComment); + +short FAR PASCAL Et4ZipNewFileComment (HFILE FAR * hZipFile, LPSTR sFileName, + LPSTR sFileComment); + +short FAR PASCAL Et4ZipOpen (LPSTR sZipFile, USHORT wFileMode, + HFILE FAR * hZipFile); + +short FAR PASCAL Et4ZipPercent (long dcbUncompressedSize, + long dcbCompressedSize); + +short FAR PASCAL Et4ZipPtr (HFILE FAR * hZipFile, UCHAR FAR * dPtr, + long dcbBytesLeft, LPSTR sInternalName, LPSTR sSwitches); + + + +/* prototypes for low-level compression routines */ + +long WINAPI EtCompress (UCHAR FAR * SrcPtr, long SrcLen, + UCHAR FAR * DestPtr, long DestLen, int CompSpeed); + +long WINAPI EtCRC32A (UCHAR FAR * SrcPtr, long Bytes, long StartingCRC); + +void WINAPI EtDecryptData (void FAR * DataPtr, long DataSize); + +short WINAPI EtDeflate (short MaxCompares, short StaticFlag, + UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, BOOL EndOfInput, + UCHAR FAR * Ptr1, UCHAR FAR * Ptr2, UCHAR FAR * Ptr3); + +void WINAPI EtDeflateBufSize (long FAR * BufSize1, long FAR * BufSize2, + long FAR * BufSize3); + +void WINAPI EtDeflateInit (UCHAR FAR * BufPtr1, UCHAR FAR * BufPtr2, + UCHAR FAR * BufPtr3); + +void WINAPI EtEncryptData (void FAR * DataPtr, long DataSize); + +short WINAPI EtHuffman (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtHuffmanBufSize (); + +void WINAPI EtHuffmanInit (UCHAR FAR * BufPtr); + +short WINAPI EtHuffmanScan (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtHuffmanUCBufSize (); + +short WINAPI EtHuffmanUC (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +void WINAPI EtHuffmanUCInit (UCHAR FAR * BufPtr); + +short WINAPI EtImplode (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtImplodeBufSize (); + +void WINAPI EtImplodeInit (UCHAR FAR * BufPtr); + +short WINAPI EtImplodeScan (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +short WINAPI EtImplodeUC (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtImplodeUCBufSize (); + +void WINAPI EtImplodeUCParams (short ThreeTrees, short EightKWindow); + +void WINAPI EtImplodeUCInit (UCHAR FAR * BufPtr); + +short WINAPI EtInflateUC (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtInflateUCBufSize (); + +void WINAPI EtInflateUCInit (UCHAR FAR * BufPtr); + +void WINAPI EtInitHeader (void FAR * HeaderPtr, long FileCRC32); + +void WINAPI EtInitKeys (UCHAR FAR * PassPtr, short PassSize); + +short WINAPI EtMash (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtMashBufSize (); + +void WINAPI EtMashInit (); + +void WINAPI EtMashParams (); + +short WINAPI EtMashUC (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtMashUCBufSize (); + +void WINAPI EtMashUCInit (UCHAR FAR * BufPtr); + +void WINAPI EtMashUCParams (short MaxBits, short RleFirst); + +short WINAPI EtScrunch (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtScrunchBufSize (); + +void WINAPI EtScrunchInit (UCHAR FAR * BufPtr); + +short WINAPI EtScrunchUC (UCHAR FAR * InBufPtr, long InStart, + long FAR * InSize, UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtScrunchUCBufSize (); + +void WINAPI EtScrunchUCInit (UCHAR FAR * BufPtr); + +short WINAPI EtShrink (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtShrinkBufSize (); + +void WINAPI EtShrinkInit (UCHAR FAR * BufPtr); + +short WINAPI EtShrinkUC (UCHAR FAR * InBufPtr, long InStart, long FAR * InSize, + UCHAR FAR * OutBufPtr, long OutStart, long FAR * OutSize, + UCHAR FAR * IntVarPtr, BOOL EndOfInput); + +long WINAPI EtShrinkUCBufSize (); + +void WINAPI EtShrinkUCInit (UCHAR FAR * BufPtr); + +long WINAPI EtUnCompress (UCHAR FAR * StrPtr, long SrcLen, + UCHAR FAR * DestPtr, long DestLen); + + + +#ifdef __cplusplus +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/fltlst.hxx b/binfilter/bf_sfx2/source/bastyp/fltlst.hxx new file mode 100644 index 000000000000..3f864a03ec88 --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/fltlst.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_FLTLST_HXX +#define _SFX_FLTLST_HXX + +//***************************************************************************************************************** +// includes +//***************************************************************************************************************** +#include <fcontnr.hxx> + +#include <cppuhelper/implbase1.hxx> + +#include <rtl/ustring.hxx> + +#include <osl/mutex.hxx> + +#include <com/sun/star/uno/Reference.hxx> + +#include <com/sun/star/util/XFlushable.hpp> + +#include <com/sun/star/util/XFlushListener.hpp> + +#include <com/sun/star/document/XEventListener.hpp> + +#include <com/sun/star/lang/EventObject.hpp> + +#include <com/sun/star/uno/RuntimeException.hpp> +namespace binfilter { + +//***************************************************************************************************************** +// declarations +//***************************************************************************************************************** +class SfxFilterListener : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XFlushListener > +{ + // member + private: + ::osl::Mutex m_aMutex ; + ::rtl::OUString m_sFactory ; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushable > m_xTypeCache ; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushable > m_xFilterCache; + SfxFilterContainer* m_pContainer ; + + // c++ interface + public: + SfxFilterListener( const ::rtl::OUString& sFactory , + SfxFilterContainer* pContainer ); + ~SfxFilterListener( ); + + // uno interface + public: + // XFlushListener + virtual void SAL_CALL flushed( const ::com::sun::star::lang::EventObject& aSource ) throw( ::com::sun::star::uno::RuntimeException ); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aSource ) throw( ::com::sun::star::uno::RuntimeException ); + +}; // SfxFilterListener + +}//end of namespace binfilter +#endif // _SFX_FLTLST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/l2s.hxx b/binfilter/bf_sfx2/source/bastyp/l2s.hxx new file mode 100644 index 000000000000..dbf9b7ad28b6 --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/l2s.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXL2L_HXX +#define _SFXL2L_HXX +namespace binfilter { + +inline int L2S( StreamOpenMode eMode ) +{ + int nMode = 0; + switch ( eMode ) + { + case BF_READ: nMode = O_RDONLY; break; + case BF_WRITE: nMode = O_RDWR; break; + case BF_CREATE: nMode = O_CREAT; break; + case BF_TRUNC: nMode = O_TRUNC; break; + } + return nMode; +} + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/makefile.mk b/binfilter/bf_sfx2/source/bastyp/makefile.mk new file mode 100644 index 000000000000..595512031c91 --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_bastyp + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/sfx2_misc.obj \ + $(SLO)$/sfx2_progress.obj \ + $(SLO)$/sfx2_bitset.obj \ + $(SLO)$/sfx2_minarray.obj \ + $(SLO)$/sfx2_fltfnc.obj \ + $(SLO)$/sfx2_fltlst.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_bitset.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_bitset.cxx new file mode 100644 index 000000000000..bd9178b2f8ed --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_bitset.cxx @@ -0,0 +1,273 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/debug.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "bitset.hxx" + +#include <string.h> // memset(), memcpy() +#include <limits.h> // USHRT_MAX +namespace binfilter { + +//==================================================================== +// add nOffset to each bit-value in the set + +/*N*/ BitSet BitSet::operator<<( USHORT nOffset ) const +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ // create a work-copy, return it if nothing to shift +/*N*/ BitSet aSet(*this); +/*N*/ if ( nOffset == 0 ) +/*N*/ return aSet; +/*N*/ +/*N*/ // compute the shiftment in long-words and bits +/*N*/ USHORT nBlockDiff = nOffset / 32; +/*N*/ ULONG nBitValDiff = nOffset % 32; +/*N*/ +/*N*/ // compute the new number of bits +/*N*/ for ( USHORT nBlock = 0; nBlock < nBlockDiff; ++nBlock ) +/*?*/ aSet.nCount -= CountBits( *(aSet.pBitmap+nBlock) ); +/*N*/ aSet.nCount -= CountBits( *(aSet.pBitmap+nBlockDiff) >> (32-nBitValDiff) ); +/*N*/ +/*N*/ // shift complete long-words +/*N*/ USHORT nTarget, nSource; +/*N*/ for ( nTarget = 0, nSource = nBlockDiff; +/*N*/ (nSource+1) < aSet.nBlocks; +/*N*/ ++nTarget, ++nSource ) +/*N*/ *(aSet.pBitmap+nTarget) = +/*N*/ ( *(aSet.pBitmap+nSource) << nBitValDiff ) | +/*N*/ ( *(aSet.pBitmap+nSource+1) >> (32-nBitValDiff) ); +/*N*/ +/*N*/ // shift the remainder (if in total minor 32 bits, only this) +/*N*/ *(aSet.pBitmap+nTarget) = *(aSet.pBitmap+nSource) << nBitValDiff; +/*N*/ +/*N*/ // determine the last used block +/*N*/ while ( *(aSet.pBitmap+nTarget) == 0 ) +/*N*/ --nTarget; +/*N*/ +/*N*/ // shorten the block-array +/*N*/ if ( nTarget < aSet.nBlocks ) +/*N*/ { +/*N*/ ULONG* pNewMap = new ULONG[nTarget]; +/*N*/ memcpy( pNewMap, aSet.pBitmap, 4 * nTarget ); +/*N*/ delete [] aSet.pBitmap; +/*N*/ aSet.pBitmap = pNewMap; +/*N*/ aSet.nBlocks = nTarget; +/*N*/ } +/*N*/ +/*N*/ return aSet; +/*N*/ } + +//-------------------------------------------------------------------- + +// substracts nOffset from each bit-value in the set + + +//-------------------------------------------------------------------- + +// internal code for operator= and copy-ctor + +/*N*/ void BitSet::CopyFrom( const BitSet& rSet ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ nCount = rSet.nCount; +/*N*/ nBlocks = rSet.nBlocks; +/*N*/ if ( rSet.nBlocks ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ pBitmap = new ULONG[nBlocks]; +/*N*/ memcpy( pBitmap, rSet.pBitmap, 4 * nBlocks ); +/*N*/ } +/*N*/ else +/*N*/ pBitmap = 0; +/*N*/ } + +//-------------------------------------------------------------------- + +// creates an empty bitset + +/*N*/ BitSet::BitSet() +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ nCount = 0; +/*N*/ nBlocks = 0; +/*N*/ pBitmap = 0; +/*N*/ } + +//-------------------------------------------------------------------- + +// creates a copy of bitset rOrig + +/*N*/ BitSet::BitSet( const BitSet& rOrig ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ CopyFrom(rOrig); +/*N*/ } + +//-------------------------------------------------------------------- + +// creates a bitset from an array + + +//-------------------------------------------------------------------- + +// frees the storage + +/*N*/ BitSet::~BitSet() +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ delete [] pBitmap; +/*N*/ } + +//-------------------------------------------------------------------- + +// creates a bitmap with all bits in rRange set + + +//-------------------------------------------------------------------- + +// assignment from another bitset + + +//-------------------------------------------------------------------- + +// assignment from a single bit + + +//-------------------------------------------------------------------- + +// creates the asymetric difference with another bitset + +/*N*/ BitSet& BitSet::operator-=(USHORT nBit) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ USHORT nBlock = nBit / 32; +/*N*/ ULONG nBitVal = 1L << (nBit % 32); +/*N*/ +/*N*/ if ( nBlock >= nBlocks ) +/*N*/ return *this; +/*N*/ +/*N*/ if ( (*(pBitmap+nBlock) & nBitVal) ) +/*N*/ { +/*N*/ *(pBitmap+nBlock) &= ~nBitVal; +/*N*/ --nCount; +/*N*/ } +/*N*/ +/*N*/ return *this; +/*N*/ } + +//-------------------------------------------------------------------- + +// unites with the bits of rSet + +/*N*/ BitSet& BitSet::operator|=( const BitSet& rSet ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ USHORT nMax = Min(nBlocks, rSet.nBlocks); +/*N*/ +/*N*/ // expand the bitmap +/*N*/ if ( nBlocks < rSet.nBlocks ) +/*N*/ { +/*N*/ ULONG *pNewMap = new ULONG[rSet.nBlocks]; +/*N*/ memset( pNewMap + nBlocks, 0, 4 * (rSet.nBlocks - nBlocks) ); +/*N*/ +/*N*/ if ( pBitmap ) +/*N*/ { +/*?*/ memcpy( pNewMap, pBitmap, 4 * nBlocks ); +/*?*/ delete [] pBitmap; +/*N*/ } +/*N*/ pBitmap = pNewMap; +/*N*/ nBlocks = rSet.nBlocks; +/*N*/ } +/*N*/ +/*N*/ // add the bits blocks by block +/*N*/ for ( USHORT nBlock = 0; nBlock < nMax; ++nBlock ) +/*N*/ { +/*N*/ // compute numberof additional bits +/*?*/ ULONG nDiff = ~*(pBitmap+nBlock) & *(rSet.pBitmap+nBlock); +/*?*/ nCount += CountBits(nDiff); +/*?*/ +/*?*/ *(pBitmap+nBlock) |= *(rSet.pBitmap+nBlock); +/*N*/ } +/*N*/ +/*N*/ return *this; +/*N*/ } + +//-------------------------------------------------------------------- + +// unites with a single bit + +/*N*/ BitSet& BitSet::operator|=( USHORT nBit ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ USHORT nBlock = nBit / 32; +/*N*/ ULONG nBitVal = 1L << (nBit % 32); +/*N*/ +/*N*/ if ( nBlock >= nBlocks ) +/*N*/ { +/*N*/ ULONG *pNewMap = new ULONG[nBlock+1]; +/*N*/ memset( pNewMap + nBlocks, 0, 4 * (nBlock - nBlocks + 1) ); +/*N*/ +/*N*/ if ( pBitmap ) +/*N*/ { +/*N*/ memcpy( pNewMap, pBitmap, 4 * nBlocks ); +/*N*/ delete [] pBitmap; +/*N*/ } +/*N*/ pBitmap = pNewMap; +/*N*/ nBlocks = nBlock+1; +/*N*/ } +/*N*/ +/*N*/ if ( (*(pBitmap+nBlock) & nBitVal) == 0 ) +/*N*/ { +/*N*/ *(pBitmap+nBlock) |= nBitVal; +/*N*/ ++nCount; +/*N*/ } +/*N*/ +/*N*/ return *this; +/*N*/ } + +// counts the number of 1-bits in the parameter + +/*N*/ USHORT BitSet::CountBits( ULONG nBits ) +/*N*/ { +/*N*/ USHORT nCount = 0; +/*N*/ int nBit = 32; +/*N*/ while ( nBit-- && nBits ) +/*?*/ { if ( ( (long)nBits ) < 0 ) +/*?*/ ++nCount; +/*?*/ nBits = nBits << 1; +/*N*/ } +/*N*/ return nCount; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_fltfnc.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_fltfnc.cxx new file mode 100644 index 000000000000..07fb77eff5d2 --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_fltfnc.cxx @@ -0,0 +1,1382 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#include <sot/exchange.hxx> +#include "bf_basic/sbxmeth.hxx" +#include <rtl/ustrbuf.hxx> +#include <bf_svtools/stritem.hxx> + +#include <sal/types.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/ucb/XContent.hpp> + + +#include <rtl/logfile.hxx> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::rtl; + +#include <bf_svtools/ctypeitm.hxx> +#include <bf_svtools/sfxecode.hxx> + +#include <bf_svtools/syslocale.hxx> + +#include <tools/urlobj.hxx> + +#include "docfile.hxx" +#include "sfxsids.hrc" +#include "fltlst.hxx" + +#include "request.hxx" +#include "arrdecl.hxx" +#include "app.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +#define SFX_STR_OVERRIDE "Override" + +#ifndef ERRCODE_SFX_RESTART +#define ERRCODE_SFX_RESTART 0 +#endif + +struct FlagMapping_Impl +{ + const char* pName; + SfxFilterFlags nValue; +}; + +//---------------------------------------------------------------- +/*N*/ inline String ToUpper_Impl( const String &rStr ) +/*N*/ { +/*N*/ return SvtSysLocale().GetCharClass().upper( rStr ); +/*N*/ } + +//---------------------------------------------------------------- +class SfxFilterContainer_Impl +{ +public: + SfxFilterContainer_Impl() : bLoadPending( sal_False ) {} + SfxFilterList_Impl aList; + String aName; + sal_Bool bLoadPending; + SfxFilterContainerFlags eFlags; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xCacheSync; // listener on framework::FilterCache to synchronize our two caches! + +}; + + +//---------------------------------------------------------------- + +/*N*/ SfxFilterContainer::SfxFilterContainer( const String& rName ) +/*N*/ { +/*N*/ pImpl = new SfxFilterContainer_Impl; +/*N*/ pImpl->eFlags = 0; +/*N*/ pImpl->aName = rName; +/*N*/ +/*N*/ // Start synchronize listener for framework::FilterCache changes ... +/*N*/ // But don't do it for basic factory - they has no filters! +/*N*/ if( rName.EqualsAscii("sbasic") == sal_False ) +/*N*/ { +/*N*/ SfxFilterListener* pListener = new SfxFilterListener( rName, this ); +/*N*/ pImpl->xCacheSync = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( static_cast< ::com::sun::star::util::XFlushListener* >(pListener), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ } +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ SfxFilterContainer::~SfxFilterContainer() +/*N*/ { +/*N*/ // Let synchronize listener die - we don't need it any longer! +/*N*/ pImpl->xCacheSync = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(); +/*N*/ +/*N*/ SfxFilterList_Impl& rList = pImpl->aList; +/*N*/ sal_uInt16 nCount = (sal_uInt16 )rList.Count(); +/*N*/ for( sal_uInt16 n = 0; n<nCount; n++ ) +/*N*/ delete rList.GetObject( n ); +/*N*/ delete pImpl; +/*N*/ } + +/*N*/ SfxFilterContainerFlags SfxFilterContainer::GetFlags() const +/*N*/ { +/*N*/ return pImpl->eFlags; +/*N*/ } + +/*N*/ void SfxFilterContainer::SetFlags( SfxFilterContainerFlags eFlags ) +/*N*/ { +/*N*/ pImpl->eFlags = eFlags; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ const SfxFilter* SfxFilterContainer::GetFilter4Protocol( +/*N*/ SfxMedium& rMed, SfxFilterFlags nMust, SfxFilterFlags nDont ) const +/* [Beschreibung] + + Gibt den Filter zu einem bestimmten Protokoll zurueck. Diese Methode + darf sich nicht auf Inhalte beziehen, sondern soll allein anhand von + Protokoll / ::com::sun::star::util::URL einen Filter auswaehlen. + In der Basisimplementierung werden einige Protokolle direkt auf + GetFilter4FilterName abgebildet, man zur Integration des Filters + in die Filterdetection einfach einen Filter des Protokollnames anlegen + kann. + */ +/*N*/ { +/*N*/ const INetURLObject& rObj = rMed.GetURLObject(); +/*N*/ String aName = rMed.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ // Hier noch pruefen, ob das Doc im Browser dargestellt werden soll +/*N*/ SFX_ITEMSET_ARG( rMed.GetItemSet(), pTargetItem, SfxStringItem, +/*N*/ SID_TARGETNAME, sal_False); +/*N*/ if( pTargetItem && pTargetItem->GetValue().EqualsAscii("_beamer") ) +/*N*/ return 0; +/*N*/ return GetFilter4Protocol( aName, nMust, nDont ); +/*N*/ } + +/*N*/ const SfxFilter* SfxFilterContainer::GetFilter4Protocol( const String& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const +/*N*/ { +/*N*/ String aName( rName ); +/*N*/ aName.ToLowerAscii(); +/*N*/ sal_uInt16 nCount = ( sal_uInt16 ) pImpl->aList.Count(); +/*N*/ for( sal_uInt16 n = 0; n < nCount; n++ ) +/*N*/ { +/*N*/ const SfxFilter* pFilter = pImpl->aList.GetObject( n ); +/*N*/ SfxFilterFlags nFlags = pFilter->GetFilterFlags(); +/*N*/ String aString( pFilter->GetURLPattern()); +/*N*/ if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && +/*N*/ WildCard(aString ).Matches( aName ) ) +/*N*/ return pFilter; +/*N*/ } +/*N*/ return 0; +/*N*/ } + +//---------------------------------------------------------------- + +/*?*/ ULONG SfxFilterContainer::Execute( SfxMedium& rMedium, SfxFrame*& pFrame) const +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +//---------------------------------------------------------------- + +/*N*/ sal_uInt16 SfxFilterContainer::GetFilterCount() const +/*N*/ { +/*N*/ // Dazu muessen die Filter geladen werden +/*N*/ return (sal_uInt16) pImpl->aList.Count(); +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ const SfxFilter* SfxFilterContainer::GetFilter( sal_uInt16 nPos ) const +/*N*/ { +/*N*/ return pImpl->aList.GetObject( nPos ); +/*N*/ } + +//---------------------------------------------------------------- +/* [Beschreibung] + + Da die meisten GetFilter4xxx Routinen in einem Container einfach eine + Abfrage ueber alle enthaltenen Filter durchlaufen, sind diese in + einem Makro kodiert. + + nMust sind die Flags, die gesetzt sein muessen, damit der Filter + in Betracht gezogen wird, nDont duerfen nicht gesetzt sein. + */ + +#define IMPL_CONTAINER_LOOP( aMethod, aArgType, aTest ) \ +/*?*/ const SfxFilter* SfxFilterContainer::aMethod( \ +/*?*/ aArgType aArg, SfxFilterFlags nMust, SfxFilterFlags nDont ) const \ +/*?*/ { \ +/*?*/ const SfxFilter* pFirstFilter=0; \ +/*?*/ sal_uInt16 nCount = ( sal_uInt16 ) pImpl->aList.Count(); \ +/*?*/ for( sal_uInt16 n = 0; n < nCount; n++ ) \ +/*?*/ { \ +/*?*/ const SfxFilter* pFilter = pImpl->aList.GetObject( n ); \ +/*?*/ SfxFilterFlags nFlags = pFilter->GetFilterFlags(); \ +/*?*/ if ( (nFlags & nMust) == nMust && \ +/*?*/ !(nFlags & nDont ) && aTest ) \ +/*?*/ { \ +/*?*/ if ( pFilter->GetFilterFlags() & SFX_FILTER_PREFERED ) \ +/*?*/ return pFilter; \ +/*?*/ else if ( !pFirstFilter ) \ +/*?*/ pFirstFilter = pFilter; \ +/*?*/ } \ +/*?*/ } \ +/*?*/ return pFirstFilter; \ +/*?*/ } + +/* [Beschreibung] + + Ermitelt einen Filter nach seinem Namen. Dieser enthaelt vorangestellt + den Namen des Containers, falls er nicht im DefaultContainer steckt. + */ + +/*N*/ IMPL_CONTAINER_LOOP( GetFilter, const String&, +/*N*/ ( pFilter->GetFilterNameWithPrefix().CompareIgnoreCaseToAscii( aArg ) == COMPARE_EQUAL || +/*N*/ pFilter->GetFilterName().CompareIgnoreCaseToAscii( aArg ) == COMPARE_EQUAL ) ) + +/* [Beschreibung] + Ermitelt einen Filter nach seinem Mimetypen. + */ +/*?*/ IMPL_CONTAINER_LOOP( +/*?*/ GetFilter4Mime, const String&, +/*?*/ pFilter->GetMimeType().CompareIgnoreCaseToAscii( aArg ) == COMPARE_EQUAL ) + +/* [Beschreibung] + Ermitelt einen Filter nach seinem FilterNamen. Dies ist der Name ohne + vorangestellten Containernamen. + */ +/*N*/ IMPL_CONTAINER_LOOP( +/*N*/ GetFilter4FilterName, const String&, +/*N*/ pFilter->GetFilterName().CompareIgnoreCaseToAscii(aArg ) == COMPARE_EQUAL ) + +/* [Beschreibung] + Ermitelt einen Filter nach seiner ClipboardID. Diese steckt im Storage. + */ +/*N*/ IMPL_CONTAINER_LOOP( +/*N*/ GetFilter4ClipBoardId, ULONG, aArg && pFilter->GetFormat() == aArg ) + +#ifdef MAC +#define CONDITION \ + String( aArg ).Erase( 5 ) == String( pFilter->GetTypeName() ).Erase( 5 ) +#else +#define CONDITION \ + aArg == pFilter->GetTypeName() +#endif +/* [Beschreibung] + Ermitelt einen Filter nach seinen Extended Attributes. + Nur auf MAC und OS/2 von Interesse. + */ +/*N*/ IMPL_CONTAINER_LOOP( +/*N*/ GetFilter4EA, const String&, CONDITION ) +#undef CONDITION + +/* [Beschreibung] + Ermitelt einen Filter nach seiner Extension. + (2Ah = '*') + */ +/*N*/ IMPL_CONTAINER_LOOP( +/*N*/ GetFilter4Extension, const String&, +/*N*/ pFilter->GetWildcard() != String() && pFilter->GetWildcard() != DEFINE_CONST_UNICODE("*.*") && pFilter->GetWildcard() != '*' && +/*N*/ WildCard( ToUpper_Impl( pFilter->GetWildcard()() ), ';' ) == ToUpper_Impl( aArg )) + + +//---------------------------------------------------------------- + +/*N*/ const String SfxFilterContainer::GetName() const +/*N*/ { +/*N*/ return pImpl->aName; +/*N*/ } + +//---------------------------------------------------------------- + + +//---------------------------------------------------------------- + +/*N*/ void SfxFilterContainer::AddFilter( SfxFilter* pFilter, sal_uInt16 nPos ) +/*N*/ { +/* [Beschreibung] + + Fuegt einen Filter in einen Container ein. + */ +/*N*/ if ( !pFilter->GetFilterName().Len() || +/*N*/ !GetFilter4FilterName( pFilter->GetFilterName() )) +/*N*/ pImpl->aList.Insert( pFilter, nPos ); +/*N*/ #if defined(DBG_UTIL) +/*N*/ else +/*N*/ delete pFilter; +/*N*/ #endif +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxFilterContainer::LoadFilters( +/*N*/ const String& rGroup, // ConfigGruppe, aus der gelesen werden soll +/*N*/ sal_Bool bInstallIni, // Falls sal_True aus install.ini lesen, +/*N*/ // sonst soffice3.ini +/*N*/ SfxFilterFlags nOrFlags, // Flags zusaetzlich zu denen in der Ini +/*N*/ SfxFilterFlags nNotFlags ) // Flags, die nicht aus der ini genommen werden +/* [Beschreibung] + + Stoesst das Laden eines FilterContainers an. Das eigentliche + Laden erfolgt im LateInitHandler bzw. in ForceFilterLoad_Impl, + falls vor LateInit auf den FilterContainer zugegriffen wird. */ +/*N*/ { +/*N*/ } + +//---------------------------------------------------------------- + + +//------------------------------------------------------------------------- + +/*?*/ ULONG SfxFilterContainer::GetFilter4Content( +/*?*/ SfxMedium& rMedium, const SfxFilter** ppFilter, +/*?*/ SfxFilterFlags, SfxFilterFlags ) const +/*?*/ { +/*?*/ return 0; +/*?*/ } + +//---------------------------------------------------------------- + +/*N*/ SfxFactoryFilterContainer::SfxFactoryFilterContainer( +/*N*/ const String& rName, const SfxObjectFactory& rFactP ) +/*N*/ : SfxFilterContainer( rName ), rFact( rFactP ), pFunc(0) +/* [Beschreibung] + + Im SfxFactoryFilterContainer befinden sich die Filter einer + SfxObjectFactory. Wird kein DetectFilter registriert, so wird + fuer die DefaultFactory <SfxApplication::DetectFilter> genommen + */ +/*N*/ { +/*N*/ //Defaults in den Container der DefaultFactory laden +/*N*/ SetFlags( GetFlags() | SFX_FILTER_CONTAINER_FACTORY ); +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ ULONG SfxFactoryFilterContainer::GetFilter4Content( +/*N*/ SfxMedium& rMedium, const SfxFilter** ppFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pTargetItem, SfxStringItem, +/*N*/ SID_TARGETNAME, sal_False); +/*N*/ +/*N*/ if ( *ppFilter && ( (*ppFilter)->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) +/*N*/ return 0; +/*N*/ +/*N*/ if( pFunc ) +/*N*/ { +/*N*/ ULONG nErr = (*pFunc)(rMedium, ppFilter, nMust, nDont); +/*N*/ DBG_ASSERT( !*ppFilter || +/*N*/ (((*ppFilter)->GetFilterFlags() & nMust ) == nMust && +/*N*/ ((*ppFilter)->GetFilterFlags() & nDont ) == 0 ), +/*N*/ "DetectFilter Spec nicht eingehalten" ); +/*N*/ return nErr; +/*N*/ } +/* + else + { + DBG_ASSERT( !GetFilterCount(), "No DetectFilter function set!" ); + return 0; + } +*/ +/*N*/ return 0; +/*N*/ } + +//---------------------------------------------------------------- + +DECLARE_LIST( SfxFContainerList_Impl, SfxFilterContainer * )//STRIP008 ; + +class SfxFilterMatcher_Impl +{ +public: + sal_uInt16 nAkt; + SfxFContainerList_Impl aList; + sal_Bool bDeleteContainers; +}; + +/*?*/ SfxFilterContainer* SfxFilterMatcher::GetContainer( const String &rName ) const +/*STRIP003*/{ // DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*STRIP003*/ SfxFContainerList_Impl& rList = pImpl->aList; +/*STRIP003*/ sal_uInt16 nCount = (sal_uInt16) rList.Count(); +/*STRIP003*/ for( sal_uInt16 n = 0; n < nCount; n++ ) +/*STRIP003*/ if( rList.GetObject( n )->GetName() == rName ) +/*STRIP003*/ return rList.GetObject( n ); +/*STRIP003*/ return 0; +/*?*/ } + +//---------------------------------------------------------------- + +/*N*/ SfxFilterMatcher::SfxFilterMatcher( SfxFilterContainer* pCont) +/*N*/ { +/*N*/ pImpl = new SfxFilterMatcher_Impl; +/*N*/ pImpl->bDeleteContainers = sal_False; +/*N*/ AddContainer( pCont ); +/*N*/ } + +//---------------------------------------------------------------- + + +/*N*/ SfxFilterMatcher::SfxFilterMatcher(sal_Bool bDeleteContainers) +/*N*/ { +/*N*/ pImpl = new SfxFilterMatcher_Impl; +/*N*/ pImpl->bDeleteContainers = bDeleteContainers; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ SfxFilterMatcher::~SfxFilterMatcher() +/*N*/ { +/*N*/ if ( pImpl->bDeleteContainers ) +/*N*/ { +/*N*/ for ( sal_uInt32 n = pImpl->aList.Count(); n--; ) +/*N*/ { +/*N*/ SfxFilterContainer *pFCont = pImpl->aList.Remove(n); +/*N*/ delete pFCont; +/*N*/ } +/*N*/ } +/*N*/ delete pImpl; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxFilterMatcher::AddContainer( SfxFilterContainer* pC ) +/*N*/ { +/*N*/ pImpl->aList.Insert( pC, pImpl->aList.Count() ); +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ ULONG SfxFilterMatcher::GuessFilterIgnoringContent( +/*N*/ SfxMedium& rMedium, const SfxFilter**ppFilter, +/*N*/ SfxFilterFlags nMust, SfxFilterFlags nDont ) const +/*N*/ { +/*N*/ String aFileName = rMedium.GetName(); +/*N*/ ULONG nErr = ERRCODE_NONE; +/*N*/ const SfxFilter* pFilter = *ppFilter; +/*N*/ const INetURLObject& rObj = rMedium.GetURLObject(); +/*N*/ +/*N*/ if( !pFilter ) +/*N*/ pFilter = SFX_APP()->GetFilterMatcher().GetFilter4Protocol( rMedium ); +/*N*/ +/*N*/ sal_Bool bCheckExternBrowser = sal_False; +/*N*/ if( !pFilter ) +/*N*/ { +/*N*/ // Falls Medium Remote, Zunaechst ueber Mimetypen pruefen ( nicht bei ExternBrowser, sofern dabei angeladen wird ) +/*N*/ if( !pFilter && rMedium.SupportsMIME_Impl() && ( !bCheckExternBrowser || rObj.GetProtocol() != INET_PROT_HTTP && rObj.GetProtocol() != INET_PROT_HTTPS ) ) +/*N*/ { +/*N*/ // Mime Typen holen +/*N*/ String aMime; +/*N*/ nErr = rMedium.GetMIMEAndRedirect( aMime ); +/*N*/ nErr = ERRCODE_TOERROR( nErr ); +/*N*/ if ( nErr == ERRCODE_IO_PENDING ) +/*N*/ return nErr; +/*N*/ else if( !nErr && aMime.Len() ) +/*N*/ { +/*?*/ if ( aMime.EqualsAscii(CONTENT_TYPE_STR_X_CNT_HTTPFILE) ) +/*?*/ // FilterDetection nur "uber den Content +/*?*/ return ERRCODE_NONE; +/*?*/ else +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pFilter = GetFilter4Mime( aMime, nMust, nDont ); +/*?*/ +/*?*/ if ( pFilter && aMime.EqualsAscii(CONTENT_TYPE_STR_APP_OCTSTREAM) ) +/*?*/ { +/*?*/ // Damit eigene Formate wie sdw auch bei falsch konfiguriertem Server erkannt werden, bevor +/*?*/ // wir GetInStream rufen +/*?*/ const SfxFilter* pMimeFilter = pFilter; +/*?*/ pFilter = GetFilter4Extension( rMedium.GetURLObject().GetName(), nMust, nDont ); +/*?*/ if( pFilter ) +/*?*/ nErr = ERRCODE_NONE; +/*?*/ else +/*?*/ pFilter = pMimeFilter; +/*?*/ } +/*?*/ +/*?*/ // Bei MIME Typen keinen Storage anfordern +/*?*/ if( !nErr && rMedium.SupportsMIME_Impl() && pFilter && !pFilter->UsesStorage() ) +/*?*/ { +/*?*/ rMedium.GetInStream(); +/*?*/ nErr = rMedium.GetError(); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if( nErr ) +/*N*/ { +/*?*/ if ( nErr == ERRCODE_SFX_CONSULTUSER ) +/*?*/ *ppFilter = pFilter; +/*?*/ return nErr; +/*N*/ } +/*N*/ else if ( pFilter && aMime.EqualsAscii(CONTENT_TYPE_STR_TEXT_HTML) ) +/*N*/ { +/*N*/ // MIME ist vertrauenswuerdig ( !? ) +/*N*/ nErr = ERRCODE_SFX_NEVERCHECKCONTENT; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( !pFilter && rMedium.IsDownloadDone_Impl() ) +/*N*/ { +/*N*/ // dann ueber Storage CLSID +/*N*/ // Remote macht das keinen Sinn, wenn der Download noch la"uft +/*N*/ SvStorageRef aStor = rMedium.GetStorage(); +/*N*/ if ( aStor.Is() ) +/*N*/ pFilter = GetFilter4ClipBoardId( aStor->GetFormat(), nMust, nDont ); +/*N*/ } +/*N*/ +/*N*/ // Zu allerletzt ueber Extension mappen +/*N*/ if( !pFilter ) +/*N*/ { +/*N*/ pFilter = GetFilter4Extension( rMedium.GetURLObject().GetName(), nMust, nDont ); +/*N*/ if( !pFilter || pFilter->GetWildcard()==DEFINE_CONST_UNICODE("*.*") || pFilter->GetWildcard() == '*' ) +/*N*/ pFilter = 0; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ *ppFilter = pFilter; +/*N*/ return nErr; +/*N*/ } + +//---------------------------------------------------------------- + +#define CHECKERROR() \ +if( nErr == 1 || nErr == USHRT_MAX || nErr == ULONG_MAX ) \ +{ \ + ByteString aText = "Fehler in FilterDetection: Returnwert ";\ + aText += ByteString::CreateFromInt32(nErr); \ + if( pFilter ) \ + { \ + aText += ' '; \ + aText += ByteString(U2S(pFilter->GetFilterName())); \ + } \ + DBG_ERROR( aText.GetBuffer() ); \ + nErr = ERRCODE_ABORT; \ +} + +//---------------------------------------------------------------- + +/*N*/ ULONG SfxFilterMatcher::GuessFilter( +/*N*/ SfxMedium& rMedium, const SfxFilter**ppFilter, +/*N*/ SfxFilterFlags nMust, SfxFilterFlags nDont ) const +/*N*/ { +/*N*/ const SfxFilter* pOldFilter = *ppFilter; +/*N*/ const SfxFilter* pFilter = pOldFilter; +/*N*/ +/*N*/ sal_Bool bConsultUser = sal_False; +/*N*/ sal_Bool bSupportsMime = rMedium.SupportsMIME_Impl(); +/*N*/ +/*N*/ // Zunaechst, falls Filter mitkommt einmal testen, ob dieser in Ordnung ist. +/*N*/ ErrCode nErr = ERRCODE_NONE; +/*N*/ if( pFilter && ( pFilter->GetFilterContainer()->GetFlags() & SFX_FILTER_CONTAINER_FACTORY ) ) +/*N*/ { +/*?*/ rMedium.StartDownload(); +/*?*/ if ( !rMedium.IsDownloadDone_Impl() ) +/*?*/ { +/*?*/ if ( pFilter->GetFilterFlags() & SFX_FILTER_ASYNC ) +/*?*/ { +/*?*/ // kurzzeitig auf synchron schalten solange die Apps sich weigern asynchron +/*?*/ // zu detecten +/*?*/ rMedium.ForceSynchronStream_Impl( sal_True ); +/*?*/ if ( !rMedium.GetInStream() ) +/*?*/ { +/*?*/ ErrCode e = rMedium.GetErrorCode(); +/*?*/ if ( e == ERRCODE_NONE ) +/*?*/ { +/*?*/ *ppFilter = pFilter; +/*?*/ return ERRCODE_IO_PENDING; +/*?*/ } +/*?*/ else +/*?*/ return e; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ *ppFilter = pFilter; +/*?*/ return ERRCODE_IO_PENDING; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if( bSupportsMime && !pFilter->UsesStorage() ) +/*?*/ rMedium.GetInStream(); +/*?*/ +/*?*/ nErr = pFilter->GetFilterContainer()->GetFilter4Content( rMedium, &pFilter, nMust, nDont ); +/*?*/ CHECKERROR(); +/*?*/ +/*?*/ rMedium.ForceSynchronStream_Impl( sal_False ); +/*?*/ +/*?*/ // ABORT bedeutet Filter ungueltig +/*?*/ if( nErr && (nErr != ERRCODE_ABORT && nErr != ERRCODE_SFX_FORCEQUIET ) ) +/*?*/ return nErr; +/*?*/ +/*?*/ // War der Filter ungueltig oder wurde ein anderer zurueckgegeben, +/*?*/ // so detecten wir selbst (wg. redirection) +/*?*/ if( nErr == ERRCODE_ABORT && pFilter ) +/*?*/ bConsultUser = sal_True; +/*?*/ +/*?*/ if( nErr != ERRCODE_SFX_FORCEQUIET && pOldFilter && pFilter != pOldFilter ) +/*N*/ pFilter = 0; +/*N*/ } +/*N*/ +/*N*/ if( !pFilter ) +/*N*/ { +/*N*/ bConsultUser = sal_False; +/*N*/ //DV !!!! don't close InStream when using the new medium +/*N*/ // rMedium.CloseInStream(); +/*N*/ +/*N*/ // Als erstes Protocol, MIME-Type, Extension etc. probieren +/*N*/ nErr = GuessFilterIgnoringContent( rMedium, &pFilter, nMust, nDont ); +/*N*/ if ( nErr == ERRCODE_IO_PENDING ) +/*N*/ { +/*?*/ *ppFilter = pFilter; +/*?*/ return nErr; +/*N*/ } +/*N*/ +/*N*/ if ( pFilter && nErr == ERRCODE_SFX_CONSULTUSER ) +/*?*/ *ppFilter = pFilter; +/*N*/ +/*N*/ if( nErr && nErr != ERRCODE_ABORT && nErr != ERRCODE_SFX_FORCEQUIET && nErr != ERRCODE_SFX_NEVERCHECKCONTENT ) +/*N*/ return nErr; +/*N*/ +/*N*/ if( nErr == ERRCODE_ABORT ) +/*N*/ pFilter = 0; +/*N*/ +/*N*/ // Jetzt wird geprueft, ob das Modul auch einverstanden ist; ist das nicht der Fall, wird auf +/*N*/ // jeden Fall auf ConsultUser umgeschaltet +/*N*/ if( pFilter ) +/*N*/ { +/*N*/ if( nErr == ERRCODE_SFX_NEVERCHECKCONTENT ) +/*N*/ nErr = ERRCODE_NONE; +/*N*/ else if( pFilter->GetFilterContainer()->GetFlags() & SFX_FILTER_CONTAINER_FACTORY ) +/*N*/ { +/*N*/ rMedium.StartDownload(); +/*N*/ if ( !rMedium.IsDownloadDone_Impl() ) +/*N*/ { +/*?*/ if ( !pFilter->UsesStorage() && rMedium.GetInStream() && ( pFilter->GetFilterFlags() & SFX_FILTER_ASYNC ) ) +/*?*/ // kurzzeitig auf synchron schalten solange die Apps sich weigern asynchron +/*?*/ // zu detecten +/*?*/ rMedium.ForceSynchronStream_Impl( sal_True ); +/*?*/ else +/*?*/ { +/*?*/ *ppFilter = pFilter; +/*?*/ return ERRCODE_IO_PENDING; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ const SfxFilter* pTmpFilter = pFilter; +/*N*/ nErr = pFilter->GetFilterContainer()->GetFilter4Content( rMedium, &pFilter, nMust, nDont ); +/*N*/ CHECKERROR(); +/*N*/ +/*N*/ rMedium.ForceSynchronStream_Impl( sal_False ); +/*N*/ +/*N*/ // ABORT bedeutet Filter ungueltig +/*N*/ if( nErr && (nErr != ERRCODE_ABORT && nErr != ERRCODE_SFX_FORCEQUIET ) ) +/*N*/ return nErr; +/*N*/ +/*N*/ if( nErr == ERRCODE_ABORT && pFilter ) +/*N*/ pFilter = 0; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Jetzt einmal drueberiterieren und nur die perfekten Filter nehmen +/*N*/ if( !pFilter ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ // Letzte Moeglichkeit ist die Befragung aller ObjectFactories. +/*N*/ if( !pFilter ) +/*N*/ { +/*N*/ // Achtung: hier k"onnte auch asynchron detected werden! +/*?*/ if ( !rMedium.IsDownloadDone_Impl() ) +/*?*/ return ERRCODE_IO_PENDING; +/*?*/ +/*?*/ //DV !!!! don't close InStream when using the new Medium +/*?*/ //rMedium.CloseInStream(); +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ *ppFilter = pFilter; +/*N*/ +/*N*/ if ( ( ( pOldFilter && pOldFilter!=pFilter && +/*N*/ ( !pOldFilter->IsOwnTemplateFormat() || !pFilter->IsOwnFormat() ) ) ) && +/*N*/ nErr != ERRCODE_SFX_FORCEQUIET || bConsultUser ) +/*N*/ return ERRCODE_SFX_CONSULTUSER; +/*N*/ +/*N*/ if( !pOldFilter ) +/*N*/ pOldFilter = pFilter; +/*N*/ +/*N*/ // Checken, ob Daten vorliegen. Dies verhindert Fehler, die in +/*N*/ // GetFilter4Content auftreten und die Auswahlbox hochbringen. +/*N*/ ErrCode nMediumError = rMedium.GetErrorCode(); +/*N*/ if( nMediumError ) +/*N*/ return nMediumError; +/*N*/ +/*N*/ *ppFilter = pFilter; +/*N*/ if ( ( nErr || +/*N*/ ( pOldFilter && pOldFilter!=pFilter +/*N*/ && ( !pOldFilter->IsOwnTemplateFormat() || +/*N*/ !pFilter->IsOwnFormat() ) )) +/*N*/ && nErr != ERRCODE_SFX_FORCEQUIET ) +/*N*/ nErr = ERRCODE_SFX_CONSULTUSER; +/*N*/ +/*N*/ if( nErr == ERRCODE_SFX_FORCEQUIET ) +/*N*/ nErr = 0; +/*N*/ return nErr; +/*N*/ }; + +//---------------------------------------------------------------- + + + +//---------------------------------------------------------------- + + +//---------------------------------------------------------------- + +/*STRIP003*/ ULONG SfxFilterMatcher::GetFilter4Content( +/*STRIP003*/ SfxMedium& rMedium, const SfxFilter** ppFilter, SfxFilterFlags nMust, SfxFilterFlags nDont, sal_Bool bOnlyGoodOnes ) const +/*STRIP003*/ { +/*STRIP003*/ ULONG nErr = ERRCODE_NONE; +/*STRIP003*/ SfxFContainerList_Impl& rList = pImpl->aList; +/*STRIP003*/ sal_uInt16 nCount = (sal_uInt16)rList.Count(); +/*STRIP003*/ for( sal_uInt16 n = 0; n<nCount; n++ ) +/*STRIP003*/ { +/*STRIP003*/ const SfxFilter* pFilter = 0; +/*STRIP003*/ nErr = rList.GetObject( n )->GetFilter4Content( +/*STRIP003*/ rMedium, &pFilter, nMust, nDont ); +/*STRIP003*/ CHECKERROR(); +/*STRIP003*/ if( rMedium.GetError() != ERRCODE_NONE ) +/*STRIP003*/ { +/*STRIP003*/ pFilter = 0; +/*STRIP003*/ return rMedium.GetError(); +/*STRIP003*/ } +/*STRIP003*/ if( nErr == ERRCODE_ABORT && bOnlyGoodOnes ) pFilter = 0; +/*STRIP003*/ if( pFilter ) +/*STRIP003*/ { +/*STRIP003*/ *ppFilter = pFilter; +/*STRIP003*/ return nErr; +/*STRIP003*/ } +/*STRIP003*/ } +/*STRIP003*/ return 0; +/*STRIP003*/ } + +#define IMPL_LOOP( Type, ArgType ) \ +const SfxFilter* SfxFilterMatcher::Type( \ + ArgType rStr, SfxFilterFlags nMust, SfxFilterFlags nDont ) const \ +{ \ + const SfxFilter* pFirstFilter = 0; \ + SfxFContainerList_Impl& rList = pImpl->aList; \ + sal_uInt16 nCount = (sal_uInt16)rList.Count(); \ + for( sal_uInt16 n = 0; n<nCount; n++ ) \ + { \ + const SfxFilter* pFilter = \ + rList.GetObject( n )->Type(rStr, nMust, nDont ); \ + if( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PREFERED ) ) \ + return pFilter; \ + else if ( !pFirstFilter ) \ + pFirstFilter = pFilter; \ + } \ + return pFirstFilter; \ +} + +/*N*/ IMPL_LOOP( GetFilter4Extension, const String& ) +/*N*/ IMPL_LOOP( GetFilter4Protocol, SfxMedium& ) +/*N*/ IMPL_LOOP( GetFilter4ClipBoardId, ULONG ) +/*N*/ IMPL_LOOP( GetFilter4FilterName, const String& ) + +//---------------------------------------------------------------- + + +//---------------------------------------------------------------- + +/*?*/ IMPL_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String*, pString ) +/*?*/ { +/*N*/ const SfxFilter* pFilter = +/*N*/ pThis->GetFilter4Extension( *pString, SFX_FILTER_IMPORT ); +/*N*/ if( pFilter && !pFilter->GetWildcard().Matches( String() ) && +/*N*/ pFilter->GetWildcard() != DEFINE_CONST_UNICODE("*.*") && pFilter->GetWildcard() != '*' ) +/*N*/ return sal_True; +/*N*/ return sal_False; +/*?*/ } + +/*--------------------------------------------------------------- + helper to build own formated string from given stringlist by + using given seperator + ---------------------------------------------------------------*/ +/*N*/ ::rtl::OUString implc_convertStringlistToString( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& lList , +/*N*/ const sal_Unicode& cSeperator, +/*N*/ const ::rtl::OUString& sPrefix ) +/*N*/ { +/*N*/ ::rtl::OUStringBuffer sString ( 1000 ) ; +/*N*/ sal_Int32 nCount = lList.getLength(); +/*N*/ sal_Int32 nItem = 0 ; +/*N*/ for( nItem=0; nItem<nCount; ++nItem ) +/*N*/ { +/*N*/ if( sPrefix.getLength() > 0 ) +/*N*/ { +/*N*/ sString.append( sPrefix ); +/*N*/ } +/*N*/ sString.append( lList[nItem] ); +/*N*/ if( nItem+1<nCount ) +/*N*/ { +/*N*/ sString.append( cSeperator ); +/*N*/ } +/*N*/ } +/*N*/ return sString.makeStringAndClear(); +/*N*/ } + +// com.sun.star.sheet.SpreadsheetDocument +#define NNUMFILTERNAMESFORSPREADSHEETDOCUMENT (8) +static const sal_Char* sFilterNamesForSpreadsheetDocument[NNUMFILTERNAMESFORSPREADSHEETDOCUMENT] = +{ + "StarOffice XML (Calc)", + "StarCalc 1.0", + "StarCalc 3.0", + "StarCalc 3.0 Vorlage/Template", + "StarCalc 4.0", + "StarCalc 4.0 Vorlage/Template", + "StarCalc 5.0", + "StarCalc 5.0 Vorlage/Template" +}; + +// com.sun.star.chart.ChartDocument +#define SFILTERNAMESFORCHARTDOCUMENT (4) +static const sal_Char* sFilterNamesForChartDocument[SFILTERNAMESFORCHARTDOCUMENT] = +{ + "StarOffice XML (Chart)", + "StarChart 3.0", + "StarChart 4.0", + "StarChart 5.0" +}; + +// com.sun.star.drawing.DrawingDocument +#define SFILTERNAMESFORDRAWINGDOCUMENT (5) +static const sal_Char* sFilterNamesForDrawingDocument[SFILTERNAMESFORDRAWINGDOCUMENT] = +{ + "StarOffice XML (Draw)", + "StarDraw 3.0", + "StarDraw 3.0 Vorlage", + "StarDraw 5.0", + "StarDraw 5.0 Vorlage" +}; + +// com.sun.star.presentation.PresentationDocument +#define SFILTERNAMESFORPRESENTATIONDOCUMENT (10) +static const sal_Char* sFilterNamesForPresentationDocument[SFILTERNAMESFORPRESENTATIONDOCUMENT] = +{ + "StarOffice XML (Impress)", + "StarDraw 3.0 (StarImpress)", + "StarDraw 3.0 Vorlage (StarImpress)", + "StarDraw 5.0 (StarImpress)", + "StarDraw 5.0 Vorlage (StarImpress)", + "StarImpress 4.0", + "StarImpress 4.0 Vorlage", + "StarImpress 5.0", + "StarImpress 5.0 (packed)", + "StarImpress 5.0 Vorlage" +}; + +// com.sun.star.formula.FormulaProperties +#define SFILTERNAMESFORFORMULAPROPERTIES (5) +static const sal_Char* sFilterNamesForFormulaProperties[SFILTERNAMESFORFORMULAPROPERTIES] = +{ + "StarOffice XML (Math)", + "StarMath 2.0", + "StarMath 3.0", + "StarMath 4.0", + "StarMath 5.0" +}; + +// com.sun.star.text.GlobalDocument +#define SFILTERNAMESFORGLOBALDOCUMENT (6) +static const sal_Char* sFilterNamesForGlobalDocument[SFILTERNAMESFORGLOBALDOCUMENT] = +{ + "StarOffice XML (Writer)", + "StarWriter 3.0 (StarWriter/GlobalDocument)", + "StarWriter 4.0 (StarWriter/GlobalDocument)", + "StarWriter 4.0/GlobalDocument", + "StarWriter 5.0 (StarWriter/GlobalDocument)", + "StarWriter 5.0/GlobalDocument" +}; +// com.sun.star.text.WebDocument +#define SFILTERNAMESFORWEBDOCUMENT 6 +static const sal_Char* sFilterNamesForWebDocument[SFILTERNAMESFORWEBDOCUMENT] = +{ + "StarOffice XML (Writer)", + "StarWriter 3.0 (StarWriter/Web)", + "StarWriter/Web 4.0 Vorlage/Template", + "StarWriter 4.0 (StarWriter/Web)", + "StarWriter/Web 5.0 Vorlage/Template", + "StarWriter 5.0 (StarWriter/Web)" +}; +// com.sun.star.text.TextDocument +#define SFILTERNAMESFORTEXTDOCUMENT (123) +static const sal_Char* sFilterNamesForTextDocument[SFILTERNAMESFORTEXTDOCUMENT] = +{ + "StarOffice XML (Writer)", + "StarWriter DOS", + "Lotus 1-2-3 1.0 (DOS) (StarWriter)", + "Lotus 1-2-3 1.0 (WIN) (StarWriter)", + "MS Excel 4.0 (StarWriter)", + "MS Excel 5.0 (StarWriter)", + "MS Excel 95 (StarWriter)", + "StarWriter 1.0", + "StarWriter 2.0", + "StarWriter 3.0", + "StarWriter 3.0 Vorlage/Template", + "StarWriter 4.0", + "StarWriter 4.0 Vorlage/Template", + "StarWriter 5.0", + "StarWriter 5.0 Vorlage/Template", + "Ami Pro 1.x-3.1 (W4W)", + "CTOS DEF (W4W)", + "Claris Works (W4W)", + "DCA Revisable Form Text (W4W)", + "DCA with Display Write 5 (W4W)", + "DCA/FFT-Final Form Text (W4W)", + "DEC DX (W4W)", + "DEC WPS-PLUS (W4W)", + "DataGeneral CEO Write (W4W)", + "DisplayWrite 2.0-4.x (W4W)", + "DisplayWrite 5.x (W4W)", + "EBCDIC (W4W)", + "Enable (W4W)", + "Frame Maker MIF 3.0 (W4W)", + "Frame Maker MIF 4.0 (W4W)", + "Frame Maker MIF 5.0 (W4W)", + "Frame Work III (W4W)", + "Frame Work IV (W4W)", + "HP AdvanceWrite Plus (W4W)", + "ICL Office Power 6 (W4W)", + "ICL Office Power 7 (W4W)", + "Interleaf (W4W)", + "Interleaf 5 - 6 (W4W)", + "Legacy Winstar onGO (W4W)", + "Lotus Manuscript (W4W)", + "MASS 11 Rel. 8.0-8.3 (W4W)", + "MASS 11 Rel. 8.5-9.0 (W4W)", + "MS MacWord 3.0 (W4W)", + "MS MacWord 4.0 (W4W)", + "MS MacWord 5.x (W4W)", + "MS WinWord 1.x (W4W)", + "MS WinWord 2.x (W4W)", + "MS Word 3.x (W4W)", + "MS Word 4.x (W4W)", + "MS Word 5.x (W4W)", + "MS Word 6.x (W4W)", + "MS Works 2.0 DOS (W4W)", + "MS Works 3.0 Win (W4W)", + "MS Works 4.0 Mac (W4W)", + "Mac Write 4.x 5.0 (W4W)", + "Mac Write II (W4W)", + "Mac Write Pro (W4W)", + "MultiMate 3.3 (W4W)", + "MultiMate 4 (W4W)", + "MultiMate Adv. 3.6 (W4W)", + "MultiMate Adv. II 3.7 (W4W)", + "NAVY DIF (W4W)", + "OfficeWriter 4.0 (W4W)", + "OfficeWriter 5.0 (W4W)", + "OfficeWriter 6.x (W4W)", + "PFS First Choice 1.0 (W4W)", + "PFS First Choice 2.0 (W4W)", + "PFS First Choice 3.0 (W4W)", + "PFS Write (W4W)", + "Peach Text (W4W)", + "Professional Write 1.0 (W4W)", + "Professional Write 2.x (W4W)", + "Professional Write Plus (W4W)", + "Q&A Write 1.0-3.0 (W4W)", + "Q&A Write 4.0 (W4W)", + "Rapid File 1.0 (W4W)", + "Rapid File 1.2 (W4W)", + "Samna Word IV-IV Plus (W4W)", + "Total Word (W4W)", + "Uniplex V7-V8 (W4W)", + "Uniplex onGO (W4W)", + "VolksWriter 3 and 4 (W4W)", + "VolksWriter Deluxe (W4W)", + "WITA (W4W)", + "Wang II SWP (W4W)", + "Wang PC (W4W)", + "Wang WP Plus (W4W)", + "Win Write 3.x (W4W)", + "WiziWord 3.0 (W4W)", + "WordPerfect (Win) 5.1-5.2 (W4W)", + "WordPerfect (Win) 6.0 (W4W)", + "WordPerfect (Win) 6.1 (W4W)", + "WordPerfect (Win) 7.0 (W4W)", + "WordPerfect 4.1 (W4W)", + "WordPerfect 4.2 (W4W)", + "WordPerfect 5.0 (W4W)", + "WordPerfect 5.1 (W4W)", + "WordPerfect 6.0 (W4W)", + "WordPerfect 6.1 (W4W)", + "WordPerfect Mac 1 (W4W)", + "WordPerfect Mac 2 (W4W)", + "WordPerfect Mac 3 (W4W)", + "WordStar (Win) 1.x-2.0 (W4W)", + "WordStar 2000 Rel. 3.0 (W4W)", + "WordStar 2000 Rel. 3.5 (W4W)", + "WordStar 3.3x (W4W)", + "WordStar 3.45 (W4W)", + "WordStar 4.0 (W4W)", + "WordStar 5.0 (W4W)", + "WordStar 5.5 (W4W)", + "WordStar 6.0 (W4W)", + "WordStar 7.0 (W4W)", + "WriteNow 3.0 (Macintosh) (W4W)", + "Writing Assistant (W4W)", + "XEROX XIF 5.0 (Illustrator) (W4W)", + "XEROX XIF 5.0 (W4W)", + "XEROX XIF 6.0 (Color Bitmap) (W4W)", + "XEROX XIF 6.0 (Res Graphic) (W4W)", + "XyWrite (Win) 1.0 (W4W)", + "XyWrite III ( W4W)", + "XyWrite III+ ( W4W)", + "XyWrite IV (W4W)", + "XyWrite Sig. (Win) (W4W)" +}; + +/*N*/ void SfxFilterContainer::ReadExternalFilters( const String& rDocServiceName ) +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT( aMeasure, "sfx2 (as96863) ::SfxFilterContainer::ReadExternalFilters" ); +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ // get the FilterFactory service to access the registered filters ... and types! +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager =::legacy_binfilters::getLegacyProcessServiceFactory();//STRIP002 ::comphelper::getProcessServiceFactory(); +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG ; +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xTypeCFG ; +/*N*/ if( xServiceManager.is() == sal_True ) +/*N*/ { +/*N*/ xFilterCFG = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >( xServiceManager->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ xTypeCFG = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >( xServiceManager->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.TypeDetection" ) ), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ } +/*N*/ +/*N*/ if( +/*N*/ ( xFilterCFG.is() == sal_True ) && +/*N*/ ( xTypeCFG.is() == sal_True ) +/*N*/ ) +/*N*/ { +/*N*/ // select right query to get right set of filters for search modul +///*N*/ ::rtl::OUString sQuery; +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.text.TextDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_writer:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.text.WebDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_web:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.text.GlobalDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_global:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.chart.ChartDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_chart:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.sheet.SpreadsheetDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_calc:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.presentation.PresentationDocument") == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_impress:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.drawing.DrawingDocument" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_draw:sort_prop=uiname:use_order:default_first" ); else +///*N*/ if( rDocServiceName.EqualsAscii("com.sun.star.formula.FormulaProperties" ) == TRUE ) sQuery = DEFINE_CONST_UNICODE("_query_math:sort_prop=uiname:use_order:default_first" ); +///*N*/ +///*N*/ DBG_ASSERT( !(sQuery.getLength()<1), "SfxFilterContainer::ReadExternalFilters()\nCouldn't find right filter query for given modul! Filters will be ignored ...\n" ); + + // select right query to get right set of filters for search modul + ::std::vector< ::rtl::OUString > aFilterNameList; + + if(rDocServiceName.EqualsAscii("com.sun.star.text.TextDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORTEXTDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForTextDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.text.WebDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORWEBDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForWebDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.text.GlobalDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORGLOBALDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForGlobalDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.chart.ChartDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORCHARTDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForChartDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.sheet.SpreadsheetDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < NNUMFILTERNAMESFORSPREADSHEETDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForSpreadsheetDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.presentation.PresentationDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORPRESENTATIONDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForPresentationDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.drawing.DrawingDocument") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORDRAWINGDOCUMENT; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForDrawingDocument[a] )); + } + else if(rDocServiceName.EqualsAscii("com.sun.star.formula.FormulaProperties") == TRUE) + { + for(sal_uInt32 a(0L); a < SFILTERNAMESFORFORMULAPROPERTIES; a++) + aFilterNameList.push_back( OUString::createFromAscii( sFilterNamesForFormulaProperties[a] )); + } + +/*N*/ if( aFilterNameList.size() ) //sQuery.getLength() > 0 ) +/*N*/ { +/*N*/ // get all internal filter names, which are match given doc service name (modul) +/*N*/ //::com::sun::star::uno::Sequence< ::rtl::OUString > lFilterNames; +/*N*/ ::com::sun::star::uno::Any aResult; +/*N*/ +/*N*/ //aResult = xFilterCFG->getByName( sQuery ); +///*N*/ if(sFilterNameArray) // aResult >>= lFilterNames ) +///*N*/ { +/*N*/ // If list of filters already exist ... +/*N*/ // ReadExternalFilters must work in update mode. +/*N*/ // Best way seams to mark all filters NOT_INSTALLED +/*N*/ // and change it back for all valid filters afterwards. +///*N*/ BOOL bUpdated = FALSE; +///*N*/ if( pImpl->aList.Count() > 0 ) +///*N*/ { +///*?*/ bUpdated = TRUE; +///*?*/ SfxFilterList_Impl& rList = pImpl->aList; +///*?*/ USHORT nCount = (USHORT)rList.Count(); +///*?*/ SfxFilter* pFilter; +///*?*/ for (USHORT f=0; f<nCount; ++f) +///*?*/ { +///*?*/ pFilter = NULL; +///*?*/ pFilter = rList.GetObject(f); +///*?*/ pFilter->nFormatType |= SFX_FILTER_NOTINSTALLED; +///*?*/ } +///*N*/ } +/*N*/ +/*N*/ // get all properties of filters ... put it into the filter container +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > lFilterProperties ; +///*N*/ sal_Int32 nFilterCount = lFilterNames.getLength(); +///*N*/ sal_Int32 nFilter = 0 ; +/*N*/ +/*N*/ for(sal_uInt32 nFilter(0L); nFilter < aFilterNameList.size(); nFilter++) // nFilter=0; nFilter<nFilterCount; ++nFilter ) +/*N*/ { +/*N*/ // Try to get filter .. but look for any exceptions! +/*N*/ // May be filter was deleted by another thread ... +/*N*/ ::rtl::OUString sFilterName(aFilterNameList[nFilter]); //::rtl::OUString sFilterName = lFilterNames[nFilter]; +/*N*/ try +/*N*/ { +/*N*/ aResult = xFilterCFG->getByName( sFilterName ); +/*N*/ } +/*N*/ catch( ::com::sun::star::container::NoSuchElementException& ) +/*N*/ { +/*?*/ aResult = ::com::sun::star::uno::Any(); +/*N*/ } +/*N*/ +/*N*/ if( aResult >>= lFilterProperties ) +/*N*/ { +/*N*/ // collect informations to add filter to container +/*N*/ // (attention: some informations aren't available on filter directly ... you must search for corresponding type too!) +/*N*/ sal_Int32 nFlags = 0 ; +/*N*/ sal_Int32 nClipboardId = 0 ; +/*N*/ sal_Int32 nDocumentIconId = 0 ; +/*N*/ sal_Int32 nFormatVersion = 0 ; +/*N*/ ::rtl::OUString sMimeType ; +/*N*/ ::rtl::OUString sType ; +/*N*/ ::rtl::OUString sUIName ; +/*N*/ ::rtl::OUString sHumanName ; +/*N*/ ::rtl::OUString sDefaultTemplate ; +/*N*/ ::rtl::OUString sUserData ; +/*N*/ ::rtl::OUString sExtension ; +/*N*/ +/*N*/ // first get directly available properties +/*N*/ sal_Int32 nFilterPropertyCount = lFilterProperties.getLength(); +/*N*/ sal_Int32 nFilterProperty = 0 ; +/*N*/ for( nFilterProperty=0; nFilterProperty<nFilterPropertyCount; ++nFilterProperty ) +/*N*/ { +/*N*/ if( lFilterProperties[nFilterProperty].Name.compareToAscii( "FileFormatVersion" ) == 0 ) +/*N*/ { +/*N*/ lFilterProperties[nFilterProperty].Value >>= nFormatVersion; +/*N*/ } +/*N*/ else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "TemplateName" ) == 0 ) +/*N*/ { +/*N*/ lFilterProperties[nFilterProperty].Value >>= sDefaultTemplate; +/*N*/ } +/*N*/ else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "Flags" ) == 0 ) +/*N*/ { +/*N*/ lFilterProperties[nFilterProperty].Value >>= nFlags; +/*N*/ } +/*N*/ else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "UIName" ) == 0 ) +/*N*/ { +/*N*/ lFilterProperties[nFilterProperty].Value >>= sUIName; +/*N*/ } +/*N*/ else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "UserData" ) == 0 ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Sequence< ::rtl::OUString > lUserData; +/*N*/ lFilterProperties[nFilterProperty].Value >>= lUserData; +/*N*/ sUserData = implc_convertStringlistToString( lUserData, ',', ::rtl::OUString() ); +/*N*/ } +/*N*/ else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "Type" ) == 0 ) +/*N*/ { +/*N*/ lFilterProperties[nFilterProperty].Value >>= sType; +/*N*/ // Try to get filter .. but look for any exceptions! +/*N*/ // May be filter was deleted by another thread ... +/*N*/ try +/*N*/ { +/*N*/ aResult = xTypeCFG->getByName( sType ); +/*N*/ } +/*N*/ catch( ::com::sun::star::container::NoSuchElementException& ) +/*N*/ { +/*?*/ aResult = ::com::sun::star::uno::Any(); +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > lTypeProperties; +/*N*/ if( aResult >>= lTypeProperties ) +/*N*/ { +/*N*/ // get indirect available properties then (types) +/*N*/ sal_Int32 nTypePropertyCount = lTypeProperties.getLength(); +/*N*/ sal_Int32 nTypeProperty = 0 ; +/*N*/ for( nTypeProperty=0; nTypeProperty<nTypePropertyCount; ++nTypeProperty ) +/*N*/ { +/*N*/ if( lTypeProperties[nTypeProperty].Name.compareToAscii( "ClipboardFormat" ) == 0 ) +/*N*/ { +/*N*/ lTypeProperties[nTypeProperty].Value >>= sHumanName; +/*N*/ } +/*N*/ else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "DocumentIconID" ) == 0 ) +/*N*/ { +/*N*/ lTypeProperties[nTypeProperty].Value >>= nDocumentIconId; +/*N*/ } +/*N*/ else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "MediaType" ) == 0 ) +/*N*/ { +/*N*/ lTypeProperties[nTypeProperty].Value >>= sMimeType; +/*N*/ } +/*N*/ else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "Extensions" ) == 0 ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Sequence< ::rtl::OUString > lExtensions; +/*N*/ lTypeProperties[nTypeProperty].Value >>= lExtensions; +/*N*/ sExtension = implc_convertStringlistToString( lExtensions, ';', DEFINE_CONST_UNICODE("*.") ); +/*N*/ } +/*N*/ else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "URLPattern" ) == 0 ) +/*N*/ { +/*N*/ lTypeProperties[nTypeProperty].Value >>= nFormatVersion; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ // old formats are found ... using HumanPresentableName! +/*N*/ if( sHumanName.getLength() ) +/*N*/ { +/*N*/ nClipboardId = SotExchange::RegisterFormatName( sHumanName ); +/*N*/ +//STRIP007 /*N*/ /*remove the bugid 100570*/ // #100570# For external filters ignore clipboard IDs +//STRIP007 /*N*/ if((nFlags & SFX_FILTER_STARONEFILTER) == SFX_FILTER_STARONEFILTER) +//STRIP007 /*N*/ { +//STRIP007 /*?*/ nClipboardId = 0; +//STRIP007 /*N*/ } +/*N*/ } +/*N*/ // register SfxFilter +/*N*/ // first erase module name from old filter names! +/*N*/ // e.g: "scalc: DIF" => "DIF" +/*N*/ sal_Int32 nStartRealName = sFilterName.indexOf( DEFINE_CONST_UNICODE(": "), 0 ); +/*N*/ if( nStartRealName != -1 ) +/*N*/ { +/*?*/ DBG_ERROR("Old format, not supported!"); +/*?*/ sFilterName = sFilterName.copy( nStartRealName+2 ); +/*N*/ } +/*N*/ +/*N*/ USHORT nCachePos = 0; +/*N*/ if (!((nFlags & SFX_FILTER_DEFAULT) == SFX_FILTER_DEFAULT)) +/*N*/ nCachePos = GetFilterCount(); +/*N*/ +/*N*/ SfxFilter* pFilter = this->GetFilter4FilterName(sFilterName,0,0); +/*N*/ const SfxFilter* pCheck = this->GetFilter4FilterName(sFilterName,0,0); +/*N*/ BOOL bNew = FALSE; +/*N*/ if (!pFilter) +/*N*/ { + if ( nFormatVersion == 6200 ) + nFlags = nFlags - 1; // only export! + +/*N*/ bNew = TRUE; +/*N*/ pFilter = new SfxFilter( sFilterName , +/*N*/ sExtension , +/*N*/ nFlags , +/*N*/ nClipboardId , +/*N*/ sType , +/*N*/ sType , +/*N*/ (USHORT)nDocumentIconId , +/*N*/ sMimeType , +/*N*/ this , +/*N*/ sUserData ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pFilter->aName = sFilterName; +/*?*/ pFilter->aWildCard = WildCard(sExtension, ';'); +/*?*/ pFilter->nFormatType = nFlags; +/*?*/ pFilter->lFormat = nClipboardId; +/*?*/ pFilter->aMacType = sType; +/*?*/ pFilter->aTypeName = sType; +/*?*/ pFilter->nDocIcon = (USHORT)nDocumentIconId; +/*?*/ pFilter->aMimeType = sMimeType; +/*?*/ pFilter->pContainer = this; +/*?*/ pFilter->aUserData = sUserData; +/*?*/ } + +/*N*/ +/*N*/ // Don't forget to set right UIName! +/*N*/ // Otherwise internal name is used as fallback ... +/*N*/ pFilter->SetUIName( sUIName ); +/*N*/ pFilter->SetDefaultTemplate( sDefaultTemplate ); +/*N*/ if( nFormatVersion ) +/*N*/ { +/*N*/ pFilter->SetVersion( nFormatVersion ); +/*N*/ } + +/*N*/ if (bNew) +/*N*/ AddFilter(pFilter, nCachePos); +/*N*/ } +/*N*/ } +/*N*/ +///*N*/ // In case we updated an already filled cache, it was to complicated to +///*N*/ // look for right place of the default filter! +///*N*/ // It seams to be easiear to step over the whole container twice and +///*N*/ // correct it now ... +///*N*/ if (bUpdated) +///*N*/ { +///*?*/ SfxFilterList_Impl& rList = pImpl->aList; +///*?*/ SfxFilter* pOldDefault = rList.First(); +///*?*/ SfxFilter* pNewDefault = NULL ; +///*?*/ sal_Int32 nNewPos = 0 ; +///*?*/ +///*?*/ if ((pOldDefault->nFormatType & SFX_FILTER_DEFAULT) != SFX_FILTER_DEFAULT) +///*?*/ { +///*?*/ USHORT nCount = (USHORT)rList.Count(); +///*?*/ SfxFilter* pFilter; +///*?*/ for (USHORT f=0; f<nCount; ++f) +///*?*/ { +///*?*/ pFilter = NULL; +///*?*/ pFilter = rList.GetObject(f); +///*?*/ if ((pFilter->nFormatType & SFX_FILTER_DEFAULT) == SFX_FILTER_DEFAULT) +///*?*/ { +///*?*/ pNewDefault = pFilter; +///*?*/ nNewPos = f; +///*?*/ break; +///*?*/ } +///*?*/ } +///*?*/ +///*?*/ if (nNewPos>0 && pNewDefault) +///*?*/ { +///*?*/ rList.Remove( pNewDefault ); +///*?*/ rList.Remove( pOldDefault ); +///*?*/ rList.Insert( pNewDefault, (ULONG)0 ); +///*?*/ rList.Insert( pOldDefault, (ULONG)nNewPos ); +///*?*/ } +///*N*/ } +///*N*/ } +///*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ catch( ::com::sun::star::uno::Exception& ) +/*N*/ { +/*N*/ DBG_ASSERT( sal_False, "SfxFilterContainer::ReadExternalFilter()\nException detected. Possible not all filters could be cached.\n" ); +/*N*/ } +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_fltlst.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_fltlst.cxx new file mode 100644 index 000000000000..ed0f970ba2bd --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_fltlst.cxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "fltlst.hxx" + +//***************************************************************************************************************** +// includes +//***************************************************************************************************************** + + + +#include "sfxuno.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +//***************************************************************************************************************** +// namespaces +//***************************************************************************************************************** +using namespace ::com::sun::star; + +//***************************************************************************************************************** +// definitions +//***************************************************************************************************************** + +/*-************************************************************************************************************//** + @short ctor + @descr These initialize an instance of a SfxFilterListener class. Created object listen automaticly + on right FilterFactory-Service for all changes and synchronize right SfxFilterContainer with + corresponding framework-cache. + We use given "sFactory" value to decide which query must be used to fill "pContainer" with new values. + Given "pContainer" hold us alive as uno reference and we use it to syschronize it with framework caches. + We will die, if he die! see dtor for further informations. + + @seealso dtor + @seealso class framework::FilterCache + @seealso service ::document::FilterFactory + + @param "sFactory" , short name of module which contains filter container + @param "pContainer", pointer to filter container which will be informed + @return - + + @onerror We show some assertions in non product version. + Otherwise we do nothing! + @threadsafe yes + + @last_change 17.10.2001 10:27 +*//*-*************************************************************************************************************/ +/*N*/ SfxFilterListener::SfxFilterListener( const ::rtl::OUString& sFactory , +/*N*/ SfxFilterContainer* pContainer ) +/*N*/ : m_aMutex ( ) +/*N*/ , m_pContainer( pContainer ) +/*N*/ { +/*N*/ // search for right factory long name by using given shortname. +/*N*/ // These value is neccessary for "ReadExternalFilter()" call during our "flushed()" function. +/*N*/ m_sFactory = ::rtl::OUString(); +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("swriter") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.text.TextDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("swriter/web") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.text.WebDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("swriter/GlobalDocument") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.text.GlobalDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("schart") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.chart.ChartDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("scalc") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.sheet.SpreadsheetDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("sdraw") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.drawing.DrawingDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("simpress") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.presentation.PresentationDocument"); +/*N*/ else +/*N*/ if( sFactory == DEFINE_CONST_OUSTRING("smath") ) +/*N*/ m_sFactory = DEFINE_CONST_OUSTRING("com.sun.star.formula.FormulaProperties"); +/*N*/ +/*N*/ OSL_ENSURE( !(m_sFactory.getLength()<1), "SfxFilterListener::SfxFilterListener()\nUnknown factory found! Can't listen for nothing ...\n" ); +/*N*/ +/*N*/ // Start listening on framework filter cache only, if factory is valid! +/*N*/ if( m_sFactory.getLength() > 0 ) +/*N*/ { +/*N*/ uno::Reference< lang::XMultiServiceFactory > xSmgr = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*N*/ if( xSmgr.is() == sal_True ) +/*N*/ { +/*N*/ uno::Reference< util::XFlushable > xNotifier( xSmgr->createInstance( DEFINE_CONST_OUSTRING("com.sun.star.document.FilterFactory") ), uno::UNO_QUERY ); +/*N*/ if( xNotifier.is() == sal_True ) +/*N*/ { +/*N*/ m_xFilterCache = xNotifier; +/*N*/ m_xFilterCache->addFlushListener( this ); +/*N*/ } +/*N*/ +/*N*/ xNotifier = uno::Reference< util::XFlushable >( xSmgr->createInstance( DEFINE_CONST_OUSTRING("com.sun.star.document.TypeDetection") ), uno::UNO_QUERY ); +/*N*/ if( xNotifier.is() == sal_True ) +/*N*/ { +/*N*/ m_xTypeCache = xNotifier; +/*N*/ m_xTypeCache->addFlushListener( this ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*?*/ SfxFilterListener::~SfxFilterListener() +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } + +/*?*/ void SAL_CALL SfxFilterListener::flushed( const lang::EventObject& aSource ) throw( uno::RuntimeException ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 +/*?*/ } + +/*?*/ void SAL_CALL SfxFilterListener::disposing( const lang::EventObject& aSource ) throw( uno::RuntimeException ) +/*?*/ {{DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 +/*?*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_minarray.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_minarray.cxx new file mode 100644 index 000000000000..40cc898d3c9e --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_minarray.cxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "minarray.hxx" +namespace binfilter { + +// ----------------------------------------------------------------------- + +/*N*/ SfxPtrArr::SfxPtrArr( BYTE nInitSize, BYTE nGrowSize ): +/*N*/ nUsed( 0 ), +/*N*/ nGrow( nGrowSize ? nGrowSize : 1 ), +/*N*/ nUnused( nInitSize ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ USHORT nMSCBug = nInitSize; +/*N*/ +/*N*/ if ( nMSCBug > 0 ) +/*N*/ pData = new void*[nMSCBug]; +/*N*/ else +/*N*/ pData = 0; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SfxPtrArr::SfxPtrArr( const SfxPtrArr& rOrig ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ nUsed = rOrig.nUsed; +/*N*/ nGrow = rOrig.nGrow; +/*N*/ nUnused = rOrig.nUnused; +/*N*/ +/*N*/ if ( rOrig.pData != 0 ) +/*N*/ { +/*N*/ pData = new void*[nUsed+nUnused]; +/*N*/ memcpy( pData, rOrig.pData, nUsed*sizeof(void*) ); +/*N*/ } +/*N*/ else +/*?*/ pData = 0; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SfxPtrArr::~SfxPtrArr() +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ delete [] pData; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ USHORT SfxPtrArr::Remove( USHORT nPos, USHORT nLen ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ // nLen adjustieren, damit nicht ueber das Ende hinaus geloescht wird +/*N*/ nLen = Min( (USHORT)(nUsed-nPos), nLen ); +/*N*/ +/*N*/ // einfache Aufgaben erfordern einfache Loesungen! +/*N*/ if ( nLen == 0 ) +/*N*/ return 0; +/*N*/ +/*N*/ // bleibt vielleicht keiner uebrig +/*N*/ if ( (nUsed-nLen) == 0 ) +/*N*/ { +/*N*/ delete [] pData; +/*N*/ pData = 0; +/*N*/ nUsed = 0; +/*N*/ nUnused = 0; +/*N*/ return nLen; +/*N*/ } +/*N*/ +/*N*/ // feststellen, ob das Array dadurch physikalisch schrumpft... +/*N*/ if ( (nUnused+nLen) >= nGrow ) +/*N*/ { +/*N*/ // auf die naechste Grow-Grenze aufgerundet verkleinern +/*N*/ USHORT nNewUsed = nUsed-nLen; +/*N*/ USHORT nNewSize = (nNewUsed+nGrow-1)/nGrow; nNewSize *= nGrow; +/*N*/ DBG_ASSERT( nNewUsed <= nNewSize && nNewUsed+nGrow > nNewSize, +/*N*/ "shrink size computation failed" ); +/*N*/ void** pNewData = new void*[nNewSize]; +/*N*/ if ( nPos > 0 ) +/*N*/ { +/*N*/ DBG_ASSERT( nPos <= nNewSize, "" ); +/*N*/ memmove( pNewData, pData, sizeof(void*)*nPos ); +/*N*/ } +/*N*/ if ( nNewUsed != nPos ) +/*N*/ memmove( pNewData+nPos, pData+nPos+nLen, +/*N*/ sizeof(void*)*(nNewUsed-nPos) ); +/*N*/ delete [] pData; +/*N*/ pData = pNewData; +/*N*/ nUsed = nNewUsed; +/*N*/ nUnused = nNewSize - nNewUsed; +/*N*/ return nLen; +/*N*/ } +/*N*/ +/*N*/ // in allen anderen Faellen nur zusammenschieben +/*N*/ if ( nUsed-nPos-nLen > 0 ) +/*N*/ memmove( pData+nPos, pData+nPos+nLen, (nUsed-nPos-nLen)*sizeof(void*) ); +/*N*/ nUsed -= nLen; +/*N*/ nUnused += nLen; +/*N*/ return nLen; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ BOOL SfxPtrArr::Remove( void* aElem ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ // einfache Aufgaben ... +/*N*/ if ( nUsed == 0 ) +/*N*/ return FALSE; +/*N*/ +/*N*/ // rueckwaerts, da meist der letzte zuerst wieder entfernt wird +/*N*/ void* *pIter = pData + nUsed - 1; +/*N*/ for ( USHORT n = 0; n < nUsed; ++n, --pIter ) +/*N*/ if ( *pIter == aElem ) +/*N*/ { +/*N*/ Remove(nUsed-n-1, 1); +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*?*/ BOOL SfxPtrArr::Replace( void* aOldElem, void* aNewElem ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxPtrArr::Insert( USHORT nPos, void* rElem ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ DBG_ASSERT( (nUsed+1) < ( USHRT_MAX / sizeof(void*) ), "array too large" ); +/*N*/ // musz das Array umkopiert werden? +/*N*/ if ( nUnused == 0 ) +/*N*/ { +/*N*/ // auf die naechste Grow-Grenze aufgerundet vergroeszern +/*N*/ USHORT nNewSize = nUsed+nGrow; +/*N*/ void** pNewData = new void*[nNewSize]; +/*N*/ +/*N*/ if ( pData ) +/*N*/ { +/*N*/ DBG_ASSERT( nUsed < nNewSize, "" ); +/*N*/ memmove( pNewData, pData, sizeof(void*)*nUsed ); +/*N*/ delete [] pData; +/*N*/ } +/*N*/ nUnused = nNewSize-nUsed; +/*N*/ pData = pNewData; +/*N*/ } +/*N*/ +/*N*/ // jetzt den hinteren Teil verschieben +/*N*/ if ( nPos < nUsed ) +/*N*/ memmove( pData+nPos+1, pData+nPos, (nUsed-nPos)*sizeof(void*) ); +/*N*/ +/*N*/ // jetzt in den freien Raum schreiben +/*N*/ memmove( pData+nPos, &rElem, sizeof(void*) ); +/*N*/ nUsed += 1; +/*N*/ nUnused -= 1; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_misc.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_misc.cxx new file mode 100644 index 000000000000..511345b2e11b --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_misc.cxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "sfxtypes.hxx" +namespace binfilter { + +//-------------------------------------------------------------------- + +#if defined(DBG_UTIL) && ( defined(WNT) || defined(OS2) ) +unsigned SfxStack::nLevel = 0; +#endif + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/bastyp/sfx2_progress.cxx b/binfilter/bf_sfx2/source/bastyp/sfx2_progress.cxx new file mode 100644 index 000000000000..deee51db01ae --- /dev/null +++ b/binfilter/bf_sfx2/source/bastyp/sfx2_progress.cxx @@ -0,0 +1,495 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "progress.hxx" + +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svtools/eitem.hxx> + +#include "appdata.hxx" +#include "app.hxx" +#include "request.hxx" +#include "sfxtypes.hxx" +#include "docfile.hxx" +#include "sfxsids.hrc" +#include "objsh.hxx" +#include "appuno.hxx" + +#include <time.h> + +namespace binfilter { + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::task; + + + + +struct SfxProgress_Impl : public SfxCancellable +{ + Reference < XStatusIndicator > xStatusInd; + String aText, aStateText; + ULONG nMax; + clock_t nCreate; + clock_t nNextReschedule; + BOOL bLocked, bAllDocs; + BOOL bWaitMode; + BOOL bAllowRescheduling; + BOOL bRunning; + BOOL bIsStatusText; + + SfxProgress* pActiveProgress; + SfxObjectShellRef xObjSh; + + SfxProgress_Impl( const String& ); + void Enable_Impl( BOOL ); + +}; + +//======================================================================== + +#define TIMEOUT_PROGRESS 5L /* 10th s */ +#define MAXPERCENT_PROGRESS 33 + +#define TIMEOUT_RESCHEDULE 10L /* 10th s */ +#define MAXPERCENT_RESCHEDULE 50 + +#define Progress + +#define aTypeLibInfo aProgressTypeLibImpl + +//======================================================================== +//#if (_MSC_VER < 1300) +inline ULONG Get10ThSec() +{ +#if defined (MSC) && defined (WIN) + ULONG n10Ticks = 10 * (ULONG)GetTickCount(); +#else + ULONG n10Ticks = 10 * (ULONG)clock(); +#endif + + return n10Ticks / CLOCKS_PER_SEC; +} +//#else +//extern ULONG Get10ThSec(); +//#endif +// ----------------------------------------------------------------------- + +/*N*/ void SfxProgress_Impl::Enable_Impl( BOOL bEnable ) +/*N*/ { +/*N*/ SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh; +/*N*/ +/*N*/ if ( pDoc ) +/*N*/ { +/*N*/ } +/*N*/ else +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 SFX_APP()->LockDispatcher( !bEnable ); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SfxProgress_Impl::SfxProgress_Impl( const String &rTitle ) +/*N*/ : SfxCancellable( SFX_APP()->GetCancelManager(), rTitle ), +/*N*/ pActiveProgress( 0 ) +/*N*/ { +/*N*/ SFX_APP()->GetCancelManager()->RemoveCancellable(this); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SfxProgress::SfxProgress +/*N*/ ( +/*N*/ SfxObjectShell* pObjSh, /* SfxObjectShell, an der die Aktion ausgef"uhrt + wird. Kann NULL sein, dann wird die Applikation + verwendet */ +/*N*/ +/*N*/ const String& rText, /* Text, der in der Statuszeile vor den Statusmonitor + erscheint */ +/*N*/ +/*N*/ ULONG nRange, /* Maximalwert des Bereiches */ +/*N*/ +/*N*/ BOOL bAll /* alle Dokumente oder nur das Dokument des ViewFrames + disablen (FALSE) */ +/*N*/ ,BOOL bWait /* initial den Wait-Pointer aktivieren (TRUE) */ +/*N*/ ) + +/* [Beschreibung] + + Der Konstruktor der Klasse SfxProgress schaltet den als Parameter + "ubergebenen SfxObjectShell und SfxViewFrames, welche dieses Dokument + anzeigen in einen Progress-Mode. D.h. solange eine dieser SfxViewFrame + Instanzen aktiv ist, ist der dazugeh"orige SfxDispatcher und das + dazugeh"orige Window disabled. In der Statuszeile wird ein Balken zur + Fortschritts-Anzeige angezeigt. +*/ + +/*N*/ : nVal(0), +/*N*/ bSuspended(TRUE), +/*N*/ pImp( new SfxProgress_Impl( rText ) ) +/*N*/ { +/*N*/ pImp->bRunning = TRUE; +/*N*/ pImp->bAllowRescheduling = Application::IsInExecute();; +/*N*/ +/*N*/ +/*N*/ pImp->xObjSh = pObjSh; +/*N*/ pImp->aText = rText; +/*N*/ pImp->nMax = nRange; +/*N*/ pImp->bLocked = FALSE; +/*N*/ pImp->bWaitMode = bWait; +/*N*/ pImp->bIsStatusText = FALSE; +/*N*/ pImp->nCreate = Get10ThSec(); +/*N*/ pImp->nNextReschedule = pImp->nCreate; +/*N*/ DBG( DbgOutf( "SfxProgress: created for '%s' at %luds", +/*N*/ rText.GetBuffer(), pImp->nCreate ) ); +/*N*/ pImp->bAllDocs = bAll; +/*N*/ +/*N*/ pImp->pActiveProgress = GetActiveProgress( pObjSh ); +/*N*/ if ( pObjSh ) +/*N*/ pObjSh->SetProgress_Impl(this); +/*N*/ else if( !pImp->pActiveProgress ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 SFX_APP()->SetProgress_Impl(this); +/*N*/ Resume(); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SfxProgress::~SfxProgress() + +/* [Beschreibung] + + Der Destruktor der Klasse SfxProgress restauriert den alten Zustand; + die Dokumente werden wieder freigeschaltet und die Statuszeile zeigt + wieder Items an. +*/ + +/*N*/ { +/*N*/ Stop(); +/*N*/ if ( pImp->xStatusInd.is() ) +/*?*/ pImp->xStatusInd->end(); +/*N*/ +/*N*/ if( pImp->bIsStatusText == TRUE ) +/*?*/ GetpApp()->HideStatusText( ); +/*N*/ SfxObjectShell* pDoc = pImp->xObjSh; +/*N*/ delete pImp; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxProgress::Stop() + +/* [Beschreibung] + + Vorzeitiges Beenden des <SfxProgress>. +*/ + +/*N*/ { +/*N*/ if( pImp->pActiveProgress ) +/*N*/ { +/*?*/ if ( pImp->xObjSh.Is() && pImp->xObjSh->GetProgress() == this ) +/*?*/ pImp->xObjSh->SetProgress_Impl(0); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ if ( !pImp->bRunning ) +/*N*/ return; +/*N*/ pImp->bRunning = FALSE; +/*N*/ DBG( DbgOutf( "SfxProgress: destroyed at %luds", Get10ThSec() ) ); +/*N*/ +/*N*/ Suspend(); +/*N*/ if ( pImp->xObjSh.Is() ) +/*N*/ pImp->xObjSh->SetProgress_Impl(0); +/*N*/ else +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 SFX_APP()->SetProgress_Impl(0); +/*N*/ if ( pImp->bLocked ) +/*N*/ pImp->Enable_Impl(TRUE); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*?*/ void SfxProgress::SetText +/*?*/ ( +/*?*/ const String& rText /* neuer Text */ +/*?*/ ) + +/* [Beschreibung] + + "Andert den Text, der links neben dem Fortschritts-Balken + angezeigt wird. +*/ + +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +// ----------------------------------------------------------------------- + + + +// ----------------------------------------------------------------------- + +// muss in AppDaten +static ULONG nLastTime = 0; + + +// ----------------------------------------------------------------------- + +/*N*/ IMPL_STATIC_LINK( SfxProgress, DefaultBindingProgress, SvProgressArg*, pArg ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return 0; +/*N*/ } + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + +/*N*/ BOOL SfxProgress::SetState +/*N*/ ( +/*N*/ ULONG nNewVal, /* neuer Wert f"ur die Fortschritts-Anzeige */ +/*N*/ +/*N*/ ULONG nNewRange /* neuer Maximalwert, 0 f"ur Beibehaltung des alten */ +/*N*/ ) +/* [Beschreibung] + + Setzen des aktuellen Status; nach einem zeitlichen Versatz + wird Reschedule aufgerufen. + + + [R"uckgabewert] + + BOOL TRUE + Fortfahren mit der Aktion + + FALSE + Abbrechen der Aktion +*/ + +/*N*/ { +/*N*/ // wurde via Stop-Button angehalten? +/*N*/ if ( pImp->IsCancelled() ) +/*N*/ return FALSE; +/*N*/ +/*N*/ if( pImp->pActiveProgress ) return TRUE; +/*N*/ +/*N*/ // neuen Wert "ubernehmen +/*N*/ BOOL bOver=FALSE; +/*N*/ nVal = nNewVal; +/*N*/ +/*N*/ // neuer Range? +/*N*/ if ( nNewRange && nNewRange != pImp->nMax ) +/*N*/ { +/*?*/ DBG( DbgOutf( "SfxProgress: range changed from %lu to %lu", +/*?*/ pImp->nMax, nNewRange ) ); +/*?*/ pImp->nMax = nNewRange; +/*?*/ bOver = TRUE; +/*N*/ } +/*N*/ +/*N*/ if ( !pImp->xStatusInd.is() ) +/*N*/ { +/*N*/ // get the active ViewFrame of the document this progress is working on +/*N*/ // if it doesn't work on a document, take the current ViewFrame +/*N*/ SfxObjectShell* pObjSh = pImp->xObjSh; +/*N*/ { +/*N*/ // don't show status indicator for hidden documents +/*N*/ SfxMedium* pMedium = pObjSh->GetMedium(); +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, FALSE ); +/*N*/ if ( !pHiddenItem || !pHiddenItem->GetValue() ) +/*N*/ { +/*N*/ // not in a view, perhaps it's just loading +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, FALSE ); +/*N*/ Reference< XStatusIndicator > xInd; +/*N*/ if ( pIndicatorItem && (pIndicatorItem->GetValue()>>=xInd) ) +/*?*/ pImp->xStatusInd = xInd; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pImp->xStatusInd.is() ) +/*N*/ { +/*?*/ pImp->xStatusInd->start( pImp->aText, pImp->nMax ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // schon ein StbManager? +/*N*/ if ( pImp->xStatusInd.is() ) +/*N*/ { +/*?*/ pImp->xStatusInd->setValue( nNewVal ); +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxProgress::Resume() + +/* [Beschreibung] + + Nimmt die Anzeige des Status nach einer Unterbrechung wieder auf. + + [Querverweise] + <SfxProgress::Suspend()> +*/ + +/*N*/ { +/*N*/ if( pImp->pActiveProgress ) return; +/*N*/ if ( bSuspended ) +/*N*/ { +/*N*/ DBG( DbgOutf( "SfxProgress: resumed" ) ); +/*N*/ if ( pImp->xStatusInd.is() ) +/*N*/ { +/*?*/ pImp->xStatusInd->start( pImp->aText, pImp->nMax ); +/*?*/ pImp->xStatusInd->setValue( nVal ); +/*N*/ } +/*N*/ bSuspended = FALSE; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxProgress::Suspend() + +/* [Beschreibung] + + Unterbricht die Anzeige des Status + + [Querverweise] + <SfxProgress::Resume()> +*/ + +/*N*/ { +/*N*/ if( pImp->pActiveProgress ) return; +/*N*/ if ( !bSuspended ) +/*N*/ { +/*N*/ DBG( DbgOutf( "SfxProgress: suspended" ) ); +/*N*/ bSuspended = TRUE; +/*N*/ if ( pImp->xStatusInd.is() ) +/*N*/ { +/*?*/ pImp->xStatusInd->reset(); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxProgress::Reschedule() + +/* [Beschreibung] + + Reschedule von au"sen rufbar + +*/ + +/*N*/ { +/*N*/ SFX_STACK(SfxProgress::Reschedule); +/*N*/ +/*N*/ if( pImp->pActiveProgress ) return; +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ if ( pImp->bLocked && 0 == pApp->Get_Impl()->nRescheduleLocks ) +/*N*/ { +/*N*/ SfxAppData_Impl *pAppData = pApp->Get_Impl(); +/*N*/ ++pAppData->nInReschedule; +/*N*/ Application::Reschedule(); +/*N*/ --pAppData->nInReschedule; +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + +/*N*/ SfxProgress* SfxProgress::GetActiveProgress +/*N*/ ( +/*N*/ SfxObjectShell* pDocSh /* <SfxObjectShell>, die nach einem laufenden + <SfxProgress> gefragt werden soll, oder + 0, wenn ein f"ur die gesamte Applikation + laufender SfxProgress erfragt werden soll. + Der Pointer braucht nur zum Zeitpunkt des + Aufrufs g"ultig zu sein. */ +/*N*/ ) +/*N*/ +/*N*/ /* [Beschreibung] + + Mit dieser Methode kann erfragt werden, ob und welcher <SfxProgress>- + f"ur eine bestimmte Instanz von SfxObjectShell oder gar die gesamte + Applikation zur Zeit aktiv ist. Dies kann z.B. zum Abfangen von + Time-Out-Events etc. verwendet werden. + + Anstelle eines Pointer auf den SfxProgress der SfxObjectShell wird + ggf. der auf den SfxProgress der Applikation geliefert, mit der + Abfrage 'SfxProgress::GetActiveProgress(pMyDocSh)' wird also + insofern vorhanden der SfxProgress von 'pMyDocSh' geliefert, + sonst der SfxProgress der Applikation bzw. ein 0-Pointer. + + + [Anmerkung] + + "auft kein SfxProgress an der Applikation und ebenfalls keiner an + der angegebenen SfxObjectShell, dann wird immer 0 zur"uckgeliefert, + auch wenn an einer anderen SfxObjectShell ein SfxProgress l"uft. + + + [Querverweise] + + <SfxApplication::GetProgress()const> + <SfxObjectShell::GetProgress()const> +*/ +/*N*/ +/*N*/ { +/*N*/ SfxProgress *pProgress = 0; +/*N*/ if ( pDocSh ) +/*N*/ pProgress = pDocSh->GetProgress(); +/*N*/ if ( !pProgress ) +/*N*/ pProgress = SFX_APP()->GetProgress(); +/*N*/ return pProgress; +/*N*/ } + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/config/cfgimpl.hxx b/binfilter/bf_sfx2/source/config/cfgimpl.hxx new file mode 100644 index 000000000000..e62d22befb66 --- /dev/null +++ b/binfilter/bf_sfx2/source/config/cfgimpl.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// include --------------------------------------------------------------- + +#include <tools/string.hxx> +#include <bf_svtools/svarray.hxx> + +#include "cfgitem.hxx" +class SotStorage; +class SvStream; +namespace binfilter { + +typedef SfxConfigItem* SfxConfigItemPtr; +SV_DECL_PTRARR( SfxConfigItems_Impl, SfxConfigItemPtr, 2, 2)//STRIP008 ; + +struct SfxConfigItem_Impl +{ + SotStorageRef xStorage; + String aName; // old 5.0 format data + String aStreamName; + SfxConfigItem* pCItem; + SfxConfigItems_Impl aItems; + USHORT nType; + BOOL bDefault; + + SfxConfigItem_Impl( SfxConfigItem* pConf = NULL ) + : pCItem( pConf ) + , nType( pConf ? pConf->GetType() : 0 ) + , bDefault( TRUE ) + {} +}; + +typedef SfxConfigItem_Impl* SfxConfigItemPtr_Impl; +SV_DECL_PTRARR( SfxConfigItemArr_Impl, SfxConfigItemPtr_Impl, 2, 2)//STRIP008 ; + +class SfxObjectShell; +class SfxIFConfig_Impl; +class SfxConfigManagerImExport_Impl +{ + SfxConfigItemArr_Impl* pItemArr; + SfxObjectShell* pObjShell; + SfxIFConfig_Impl* pIFaceConfig; + + BOOL ImportItem( SfxConfigItem_Impl* pItem, SvStream* pStream, SotStorage* pStor ); + +public: + SfxConfigManagerImExport_Impl( SfxObjectShell* pDoc, SfxConfigItemArr_Impl* pArr ) + : pItemArr( pArr ) + , pObjShell( pDoc ) + , pIFaceConfig( NULL ) + {} + + USHORT Import( SotStorage* pIn, SotStorage* pStor ); + USHORT Export( SotStorage* pStor, SotStorage* pOut ); + + static String GetStreamName( USHORT nType ); + static USHORT GetType( const String& rStreamName ); + static BOOL HasConfiguration( SotStorage& rStorage ); +}; + +}//end of namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/config/makefile.mk b/binfilter/bf_sfx2/source/config/makefile.mk new file mode 100644 index 000000000000..d67d96be8d82 --- /dev/null +++ b/binfilter/bf_sfx2/source/config/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_config + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_cfgmgr.obj \ + $(SLO)$/sfx2_cfgitem.obj \ + $(SLO)$/sfx2_misccfg.obj \ + $(SLO)$/sfx2_evntconf.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/config/sfx2_cfgitem.cxx b/binfilter/bf_sfx2/source/config/sfx2_cfgitem.cxx new file mode 100644 index 000000000000..ce5c455b6d6f --- /dev/null +++ b/binfilter/bf_sfx2/source/config/sfx2_cfgitem.cxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "cfgmgr.hxx" +#include "sfx.hrc" +#include "cfgimpl.hxx" +#include <tools/debug.hxx> +namespace binfilter { +// class SfxConfigItem --------------------------------------------------- + +/*N*/ SfxConfigItem::SfxConfigItem( USHORT nType, SfxConfigManager* pCfgMgr ) +/*N*/ : m_pCfgMgr( pCfgMgr ) +/*N*/ , m_nType( nType ) +/*N*/ , m_bDefault( TRUE ) +/*N*/ , m_bModified( FALSE ) +/*N*/ , m_bInitialized( FALSE ) +/*N*/ { +/*N*/ if ( pCfgMgr ) +/*N*/ pCfgMgr->AddConfigItem( *this ); +/*N*/ } + +/*N*/ SfxConfigItem::~SfxConfigItem() +/*N*/ { +/*N*/ if ( m_pCfgMgr ) +/*N*/ m_pCfgMgr->RemoveConfigItem( *this ); +/*N*/ } + +// ---------------------------------------------------------------------- +/*N*/ BOOL SfxConfigItem::Initialize() +/*N*/ { +/*N*/ BOOL bRet = TRUE; +/*N*/ if ( !m_pCfgMgr ) +/*N*/ UseDefault(); +/*N*/ else +/*N*/ bRet = m_pCfgMgr->LoadConfigItem( *this ); +/*N*/ m_bModified = FALSE; +/*N*/ m_bInitialized = TRUE; +/*N*/ return bRet; +/*N*/ } + +// ---------------------------------------------------------------------- +/*N*/ BOOL SfxConfigItem::StoreConfig() +/*N*/ { +/*N*/ BOOL bRet = FALSE; +/*N*/ if ( m_pCfgMgr && m_bModified ) +/*?*/ bRet = m_pCfgMgr->StoreConfigItem( *this ); +/*N*/ m_bModified = FALSE; +/*N*/ return bRet; +/*N*/ } + +// ------------------------------------------------------------------------ +/*N*/ void SfxConfigItem::SetDefault( BOOL bOn ) +/*N*/ { +/*N*/ if ( m_bInitialized && (!bOn || !m_bDefault) ) +/*?*/ SetModified( TRUE ); +/*N*/ m_bDefault = bOn; +/*N*/ } + +//------------------------------------------------------------------------- +/*N*/ void SfxConfigItem::SetModified( BOOL bMod ) +/*N*/ { +/*N*/ if ( m_bInitialized ) +/*N*/ { +/*N*/ m_bModified = bMod; +/*N*/ if ( bMod && m_pCfgMgr ) +/*?*/ m_pCfgMgr->SetModified( bMod ); +/*N*/ } +/*N*/ } + +/*?*/ BOOL SfxConfigItem::ReInitialize() +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE; //STRIP001 +/*?*/ } + +/*?*/ String SfxConfigItem::GetStreamName( USHORT nType ) +/*?*/ { +/*?*/ return String(); +/*?*/ } + +/*N*/ void SfxConfigItem::Connect( SfxConfigManager* pMgr ) +/*N*/ { +/*N*/ m_pCfgMgr = pMgr; pMgr->AddConfigItem(*this); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/config/sfx2_cfgmgr.cxx b/binfilter/bf_sfx2/source/config/sfx2_cfgmgr.cxx new file mode 100644 index 000000000000..ba5891b8b790 --- /dev/null +++ b/binfilter/bf_sfx2/source/config/sfx2_cfgmgr.cxx @@ -0,0 +1,590 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// include --------------------------------------------------------------- + +#include <stdio.h> + +#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> + +#include <ucbhelper/content.hxx> +#include <tools/urlobj.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <sot/storinfo.hxx> + +#ifndef _SVSTDARR_ULONGS_DECL +#define _SVSTDARR_ULONGS +#endif + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "cfgmgr.hxx" +#include "objsh.hxx" +#include "cfgimpl.hxx" +#include "docfile.hxx" +#include "evntconf.hxx" + +namespace binfilter { + +using namespace ::com::sun::star; + +static const char pStorageName[] = "Configurations"; + +/*N*/ DBG_NAME(SfxConfigManager) + +// ---------------------------------------------------------------------------- + +/*N*/ SfxConfigManager::SfxConfigManager( SotStorage* pStorage ) +/*N*/ : pObjShell( NULL ) +/*N*/ , nErrno( ERR_NO ) +/*N*/ , bModified( FALSE ) +/*N*/ { +/*N*/ DBG_CTOR(SfxConfigManager, 0); +/*N*/ +/*N*/ // configuration stored in any storage +/*N*/ pItemArr = new SfxConfigItemArr_Impl; +/*N*/ +/*N*/ if ( !pStorage ) +/*N*/ { +/*N*/ // default config manager +/*N*/ pStorage = new SotStorage( String() ); +/*N*/ } +/*N*/ +/*N*/ if ( !pStorage->IsOLEStorage() ) +/*N*/ { +/*N*/ // take the storage ( otherwise no configitems could be loaded ) +/*N*/ m_xStorage = pStorage; +/*N*/ +/*N*/ // any other configuration storage or document in 6.0 format +/*N*/ // read directory information +/*N*/ if ( !LoadConfiguration( *pStorage ) ) +/*N*/ nErrno = ERR_READ; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // any other configuration storage or document in 5.0 format +/*?*/ // create temporary storage for the converted data in 6.0 format +/*?*/ m_xStorage = new SotStorage( TRUE, String(), STREAM_STD_READWRITE, STORAGE_TRANSACTED ); +/*?*/ +/*?*/ // convert 5.0 configuration into own 6.0 storage +/*?*/ SfxConfigManagerImExport_Impl aImporter( pObjShell, pItemArr ); +/*?*/ nErrno = aImporter.Import( pStorage, m_xStorage ); +/*N*/ } +/*N*/ } + +/*N*/ SfxConfigManager::SfxConfigManager( SfxObjectShell& rShell ) +/*N*/ : pObjShell( &rShell ) +/*N*/ , nErrno( ERR_NO ) +/*N*/ , bModified( FALSE ) +/*N*/ { +/*N*/ DBG_CTOR(SfxConfigManager, 0); +/*N*/ +/*N*/ // configuration stored in a document or template +/*N*/ pItemArr = new SfxConfigItemArr_Impl; +/*N*/ +/*N*/ // create temporary storage +/*N*/ m_xStorage = new SotStorage( TRUE, String(), STREAM_STD_READWRITE, STORAGE_TRANSACTED ); +/*N*/ +/*N*/ SotStorageRef xStorage = pObjShell->GetStorage(); +/*N*/ if ( !xStorage->IsOLEStorage() ) +/*N*/ { +/*?*/ // use the configuration substorage of the document +/*?*/ SotStorageRef xCfgStorage = xStorage->OpenSotStorage( String::CreateFromAscii(pStorageName), STREAM_STD_READWRITE ); +/*?*/ +/*?*/ // copy data, using the original storage is only possible for SvPersist objects +/*?*/ // the retransfer of the data is organized by the document +/*?*/ xCfgStorage->CopyTo( m_xStorage ); +/*?*/ +/*?*/ // read directory information +/*?*/ if ( !LoadConfiguration( *m_xStorage ) ) +/*?*/ nErrno = ERR_READ; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // convert 5.0 configuration into own 6.0 storage +/*N*/ SfxConfigManagerImExport_Impl aImporter( pObjShell, pItemArr ); +/*N*/ nErrno = aImporter.Import( xStorage, m_xStorage ); +/*N*/ } +/*N*/ +/*N*/ rShell.SetConfigManager( this ); +/*N*/ } + +/*N*/ SfxConfigManager::~SfxConfigManager() +/*N*/ { +/*N*/ for( USHORT i = 0; i < pItemArr->Count(); ++i ) +/*N*/ { +/*N*/ SfxConfigItem_Impl* pItem = (*pItemArr)[i]; +/*N*/ if ( pItem->pCItem ) +/*N*/ { +/*?*/ DBG_ERROR("SfxConfigItem not removed!"); +/*?*/ pItem->pCItem->ReleaseConfigManager(); +/*N*/ } +/*N*/ delete pItem; +/*N*/ } +/*N*/ +/*N*/ delete pItemArr; +/*N*/ } + +// ------------------------------------------------------------------------ + +/*?*/ SotStorage* SfxConfigManager::GetConfigurationStorage( SotStorage* pDocStor ) +/*?*/ { +/*?*/ return pDocStor->OpenSotStorage( String::CreateFromAscii(pStorageName), STREAM_STD_READWRITE ); +/*?*/ } + +/*?*/ void SfxConfigManager::SetModified(BOOL bMod) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +/*N*/ BOOL SfxConfigManager::HasConfiguration( SotStorage& rStorage ) +/*N*/ { +/*N*/ if ( rStorage.IsOLEStorage() ) +/*N*/ { +/*N*/ return SfxConfigManagerImExport_Impl::HasConfiguration( rStorage ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ return rStorage.IsStorage( String::CreateFromAscii(pStorageName) ); +/*N*/ } +/*N*/ } + +// ---------------------------------------------------------------------------- + +/*N*/ BOOL SfxConfigManager::LoadConfiguration( SotStorage& rStorage ) +/*N*/ { +/*N*/ // for the case that there are several layers of configuration +/*N*/ USHORT nOldCount = pItemArr->Count(); +/*N*/ +/*N*/ SvStorageInfoList aList; +/*N*/ rStorage.FillInfoList( &aList ); +/*N*/ for( USHORT i = 0; i < aList.Count(); i++ ) +/*N*/ { +/*?*/ SvStorageInfo& rInfo = aList.GetObject( i ); +/*?*/ if ( rInfo.IsStream() ) +/*?*/ { +/*?*/ // get StreamName and ItemType +/*?*/ SfxConfigItem_Impl* pItem = NULL; +/*?*/ String aStreamName = rInfo.GetName(); +/*?*/ USHORT nType = SfxConfigManagerImExport_Impl::GetType( aStreamName ); +/*?*/ +/*?*/ // check items from upper layers if one of them is of the same type +/*?*/ for ( USHORT nPos=0; nPos<nOldCount; nPos++ ) +/*?*/ { +/*?*/ if ( (*pItemArr)[nPos]->nType == nType ) +/*?*/ { +/*?*/ pItem = (*pItemArr)[nPos]; +/*?*/ break; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if ( !pItem ) +/*?*/ { +/*?*/ // new item +/*?*/ pItem = new SfxConfigItem_Impl; +/*?*/ pItemArr->Insert( pItem, pItemArr->Count() ); +/*?*/ pItem->aStreamName = aStreamName; +/*?*/ pItem->nType = nType; +/*?*/ +/*?*/ // compatibility for 5.0 format +/*?*/ pItem->bDefault = FALSE; +/*?*/ } +/*?*/ +/*?*/ // every item will hold a reference to its storage +/*?*/ pItem->xStorage = &rStorage; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } + +/*N*/ BOOL SfxConfigManager::StoreConfiguration( SotStorage* pStorage ) +/*N*/ { +/*N*/ // What about the Modified flag ?! ( see also appmisc, config dialog, objcont! ) +/*N*/ BOOL bOwnSaveDone = FALSE; +/*N*/ BOOL bRet = TRUE; +/*N*/ if ( m_xStorage.Is() ) +/*N*/ { +/*N*/ // first update own storage +/*N*/ bRet = !bModified || StoreConfiguration_Impl( m_xStorage ) && m_xStorage->Commit(); +/*N*/ bOwnSaveDone = TRUE; +/*N*/ if ( !pStorage && pObjShell ) +/*N*/ { +/*?*/ // pStorage == NULL means : storage of document should be updated also +/*?*/ SotStorage* pDocumentStorage = pObjShell->GetStorage(); +/*?*/ if ( !pDocumentStorage->IsOLEStorage() ) +/*?*/ { +/*?*/ // use the configuration substorage of the document +/*?*/ SotStorageRef xCfgStorage = pDocumentStorage->OpenSotStorage( +/*?*/ String::CreateFromAscii(pStorageName), STREAM_STD_READWRITE, STORAGE_TRANSACTED ); +/*?*/ bRet = m_xStorage->CopyTo( xCfgStorage ) && xCfgStorage->Commit(); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // 5.0 format : store compact configuration stream +/*?*/ SfxConfigManagerImExport_Impl aExporter( pObjShell, pItemArr ); +/*?*/ nErrno = aExporter.Export( m_xStorage, pDocumentStorage ); +/*?*/ bRet = ( nErrno == ERR_NO ); +/*?*/ } +/*?*/ +/*?*/ if ( bRet ) +/*?*/ { +/*?*/ // can't commit changes if the documents' storage is under control of the document +/*?*/ if( pObjShell->GetCreateMode() == SFX_CREATE_MODE_ORGANIZER ) +/*?*/ bRet = pDocumentStorage->Commit(); +/*?*/ else +/*?*/ { +/*?*/ // The configuration will be stored together the document, so the modified flag +/*?*/ // must remain set! +/*?*/ return TRUE; +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if ( bRet && !pStorage || pStorage == (SotStorage*) m_xStorage ) +/*N*/ { +/*N*/ // only storing into own storage was requested +/*N*/ bModified = FALSE; +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ else +/*?*/ DBG_ASSERT( pStorage, "Can't save configuration!" ); +/*?*/ +/*?*/ if ( !bRet || !pStorage ) +/*?*/ return FALSE; +/*?*/ +/*?*/ // store also into storage passed as parameter, but don't commit the changes, because this will be done by the caller +/*?*/ if ( !pStorage->IsOLEStorage() ) +/*?*/ { +/*?*/ // 6.0 format +/*?*/ if ( bOwnSaveDone ) +/*?*/ { +/*?*/ // if own storage is updated, just copy it to the destination storage +/*?*/ bRet = m_xStorage->CopyTo( pStorage ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ bRet = StoreConfiguration_Impl( pStorage ); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // 5.0 format : store compact configuration stream +/*?*/ SfxConfigManagerImExport_Impl aExporter( pObjShell, pItemArr ); +/*?*/ nErrno = aExporter.Export( m_xStorage, pStorage ); +/*?*/ bRet = ( nErrno == ERR_NO ); +/*?*/ } +/*?*/ +/*?*/ bModified = !bRet; +/*?*/ return bRet; +/*N*/ } + +/*?*/ BOOL SfxConfigManager::StoreConfiguration_Impl( SotStorage* pStorage ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ BOOL bRet = TRUE; +/*?*/ return bRet; +/*?*/ } + +// ---------------------------------------------------------------------------- + +/*N*/ void SfxConfigManager::AddConfigItem( SfxConfigItem& rCItem ) +/*N*/ { +/*N*/ for( USHORT i = 0; i < pItemArr->Count(); ++i ) +/*N*/ { +/*N*/ SfxConfigItem_Impl* pItem = (*pItemArr)[i]; +/*N*/ if ( pItem->nType == rCItem.GetType() ) +/*N*/ { +/*N*/ if ( pItem->pCItem ) +/*N*/ { +/*N*/ SfxConfigItems_Impl& rItems = pItem->aItems; +/*N*/ USHORT nCount = rItems.Count(); +/*N*/ #ifdef DBG_UTIL +/*N*/ for ( USHORT nItem=0; nItem<nCount; nItem++ ) +/*N*/ if ( rItems[nItem] == &rCItem ) +/*N*/ DBG_ERROR("Item already inserted!"); +/*N*/ #endif +/*N*/ rItems.Insert( &rCItem, nCount ); +/*N*/ } +/*N*/ else +/*N*/ pItem->pCItem = &rCItem; +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ SfxConfigItem_Impl* pItem = new SfxConfigItem_Impl( &rCItem ); +/*N*/ pItemArr->Insert( pItem, pItemArr->Count() ); +/*N*/ pItem->bDefault = rCItem.IsDefault(); +/*N*/ pItem->aStreamName = SfxConfigManagerImExport_Impl::GetStreamName( pItem->nType ); +/*N*/ } + +/*N*/ void SfxConfigManager::RemoveConfigItem( SfxConfigItem& rCItem ) +/*N*/ { +/*N*/ for( USHORT i = 0; i < pItemArr->Count(); ++i ) +/*N*/ { +/*N*/ SfxConfigItem_Impl* pItem = (*pItemArr)[i]; +/*N*/ if ( pItem->nType == rCItem.GetType() ) +/*N*/ { +/*N*/ if ( pItem->pCItem == &rCItem ) +/*N*/ { +/*N*/ if ( pItem->aItems.Count() ) +/*N*/ { +/*?*/ pItem->pCItem = pItem->aItems[0]; +/*?*/ pItem->aItems.Remove( 0 ); +/*N*/ } +/*N*/ else +/*N*/ pItem->pCItem = NULL; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ USHORT nCount = pItem->aItems.Count(); +/*N*/ for ( USHORT nItem=0; nItem<nCount; nItem++ ) +/*N*/ if ( pItem->aItems[nItem] == &rCItem ) +/*N*/ { +/*N*/ pItem->aItems.Remove(nItem); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DBG_ERROR( "Item not registered!" ); +/*N*/ } + +/*N*/ BOOL SfxConfigManager::LoadConfigItem( SfxConfigItem& rCItem ) +/*N*/ { +/*N*/ DBG_ASSERT( m_xStorage.Is(), "No storage for configurations!" ); +/*N*/ +/*N*/ // search for item +/*N*/ for( USHORT i = 0; i < pItemArr->Count(); ++i ) +/*N*/ { +/*N*/ SfxConfigItem_Impl* pItem = (*pItemArr)[i]; +/*N*/ if ( pItem->nType == rCItem.GetType() ) +/*N*/ { +/*N*/ // update configuration befor using it +/*N*/ // find last modified item +/*N*/ SfxConfigItem* pCfgItem = NULL; +/*N*/ if ( pItem->pCItem && pItem->pCItem->IsModified() ) +/*N*/ pCfgItem = pItem->pCItem; +/*N*/ +/*N*/ USHORT nCount = pItem->aItems.Count(); +/*N*/ for ( USHORT nItem=0; nItem<nCount; nItem++ ) +/*N*/ if ( pItem->aItems[nItem]->IsModified() ) +/*N*/ pCfgItem = pItem->aItems[nItem]; +/*N*/ +/*N*/ if ( pCfgItem ) +/*?*/ pCfgItem->StoreConfig(); +/*N*/ +/*N*/ if ( pItem->bDefault ) +/*N*/ { +/*N*/ // no configuration in storage +/*N*/ rCItem.UseDefault(); +/*N*/ } +/*N*/ else if ( pItem->xStorage.Is() ) +/*N*/ { +/*N*/ // item configuration is in upper layer of configuration +/*N*/ if ( rCItem.Load( *pItem->xStorage ) != SfxConfigItem::ERR_OK ) +/*N*/ rCItem.UseDefault(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERROR("Item without Storage!"); +/*N*/ rCItem.UseDefault(); +/*N*/ return FALSE; +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DBG_ERROR("ItemType not registered!"); +/*N*/ return FALSE; +/*N*/ } + +/*?*/ BOOL SfxConfigManager::StoreConfigItem( SfxConfigItem& rCItem ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");return FALSE;//STRIP001 +/*?*/ } + +/*N*/ static const char pHeader[] = "Star Framework Config File"; +/*N*/ #define CFG_STREAM_BUFFER_SIZE 5000 +/*N*/ static const USHORT nVersion = 26; +/*N*/ static const char cCtrlZ = 26; +/*N*/ +/*N*/ static const USHORT nTypesCount = 82; + +/*N*/ BOOL SfxConfigManagerImExport_Impl::HasConfiguration( SotStorage& rStorage ) +/*N*/ { +/*N*/ return rStorage.IsStream( String::CreateFromAscii(pHeader) ); +/*N*/ } + +/*N*/ USHORT SfxConfigManagerImExport_Impl::Import( SotStorage* pInStorage, SotStorage* pStorage ) +/*N*/ { +/*N*/ SotStorageStreamRef aStr = +/*N*/ pInStorage->OpenSotStream( String::CreateFromAscii(pHeader), STREAM_STD_READ ); +/*N*/ if ( aStr->GetError() ) +/*N*/ return SfxConfigManager::ERR_OPEN; +/*N*/ +/*N*/ SvStream* pStream = aStr; +/*N*/ pStream->SetVersion( SOFFICE_FILEFORMAT_40 ); +/*N*/ pStream->SetBufferSize( CFG_STREAM_BUFFER_SIZE ); +/*N*/ pStream->Seek(0); +/*N*/ USHORT nRet = SfxConfigManager::ERR_NO; +/*N*/ +/*N*/ // check header +/*N*/ const unsigned nLen = strlen( pHeader ); +/*N*/ char *pBuf = new char[nLen+1]; +/*N*/ pStream->Read( pBuf, nLen ); +/*N*/ pBuf[nLen] = 0; +/*N*/ if( strcmp( pBuf, pHeader ) ) +/*N*/ { +/*N*/ delete[] pBuf; +/*?*/ return SfxConfigManager::ERR_FILETYPE; +/*N*/ } +/*N*/ +/*N*/ delete[] pBuf; +/*N*/ +/*N*/ // compare version +/*N*/ char c; +/*N*/ USHORT nFileVersion; +/*N*/ (*pStream) >> c; // skip ASCII 26 (CTRL-Z) +/*N*/ (*pStream) >> nFileVersion; +/*N*/ if( nFileVersion != nVersion ) +/*N*/ { +/*?*/ return SfxConfigManager::ERR_VERSION; +/*N*/ } +/*N*/ +/*N*/ // get position of directory +/*N*/ long lDirPos, lStart = pStream->Tell(); +/*N*/ (*pStream) >> lDirPos; +/*N*/ pStream->Seek(lDirPos); +/*N*/ +/*N*/ // get number of items +/*N*/ USHORT nCount; +/*N*/ (*pStream) >> nCount; +/*N*/ +/*N*/ // read in directory and convert items +/*N*/ for( USHORT i=0; i < nCount; ++i ) +/*N*/ { +/*N*/ SfxConfigItem_Impl* pItem = new SfxConfigItem_Impl; +/*N*/ pItemArr->Insert( pItem, pItemArr->Count() ); +/*N*/ +/*N*/ // retrieve type of item and human readable name +/*N*/ long lLength, lPos; // dummies +/*N*/ (*pStream) >> pItem->nType >> lPos >> lLength; +/*N*/ pItem->bDefault = ( lPos == -1L ); +/*N*/ pStream->ReadByteString( pItem->aName ); +/*N*/ if ( pStream->GetError() ) +/*N*/ { +/*?*/ pItem->bDefault = TRUE; +/*?*/ return SfxConfigManager::ERR_READ; +/*N*/ } +/*N*/ +/*N*/ // convert into new format +/*N*/ if ( !pItem->bDefault ) +/*N*/ { +/*N*/ // stream name for new format +/*N*/ pItem->aStreamName = GetStreamName( pItem->nType ); +/*N*/ if ( pItem->aStreamName.Len() ) +/*N*/ { +/*N*/ long lOldPos = pStream->Tell(); +/*N*/ pStream->Seek( lPos ); +/*N*/ +/*N*/ // check for correct type id, inequality is allowed for userdef toolboxes +/*N*/ USHORT nType; +/*N*/ (*pStream) >> nType; +/*N*/ BOOL bOk = ( nType == pItem->nType || +/*N*/ 1294 <= nType && nType <= 1301 && +/*N*/ 1294 <= pItem->nType && pItem->nType <= 1301 ); +/*N*/ +/*N*/ if ( !bOk || !ImportItem( pItem, pStream, pStorage ) ) +/*N*/ { +/*?*/ pItem->bDefault = TRUE; +/*?*/ nRet = SfxConfigManager::ERR_IMPORT; +/*N*/ } +/*N*/ +/*N*/ pStream->Seek( lOldPos ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERROR("Couldn't convert old configuration!"); +/*N*/ // force error message that saving this document would lose some configuration information +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( !pItem->aStreamName.Len() ) +/*N*/ { +/*N*/ // no real config item anymore +/*N*/ delete pItem; +/*N*/ pItemArr->Remove( pItemArr->Count() - 1 ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nRet; +/*N*/ } + +/*N*/ BOOL SfxConfigManagerImExport_Impl::ImportItem( SfxConfigItem_Impl* pItem, SvStream* pStream, SotStorage* pStor ) +/*N*/ { +/*N*/ BOOL bRet = TRUE; +/*N*/ if ( pItem->nType == SFX_ITEMTYPE_DOCEVENTCONFIG ) + { + BOOL bOK = SfxEventConfiguration::Import( *pStream, NULL, pObjShell ); + if ( bRet ) + bRet = bOK; + } + + return bRet; +/*N*/ } + +/*?*/ USHORT SfxConfigManagerImExport_Impl::Export( SotStorage* pStor, SotStorage *pOut ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +/*N*/ String SfxConfigManagerImExport_Impl::GetStreamName( USHORT nType ) +/*N*/ { +/*N*/ if ( 11 == nType ) +/*N*/ return String::CreateFromAscii( "eventbindings.xml" ); +/*?*/ +/*?*/ return String(); +/*N*/ } + +/*?*/ USHORT SfxConfigManagerImExport_Impl::GetType( const String& rStreamName ) +/*?*/ { +/*NBFF*/ ByteString aCmp( rStreamName, RTL_TEXTENCODING_ASCII_US ); +/*NBFF*/ +/*NBFF*/ if ( !strcmp( aCmp.GetBuffer(), "eventbindings.xml" ) ) +/*NBFF*/ return 11; +/*NBFF*/ +/*?*/ return 0; +/*?*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/config/sfx2_evntconf.cxx b/binfilter/bf_sfx2/source/config/sfx2_evntconf.cxx new file mode 100644 index 000000000000..f7e068f03d68 --- /dev/null +++ b/binfilter/bf_sfx2/source/config/sfx2_evntconf.cxx @@ -0,0 +1,619 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring.h> +#endif + + + +#include "macrconf.hxx" +#include "objsh.hxx" +#include "eventsupplier.hxx" + +#include "sfxsids.hrc" +#include "app.hxx" + + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +// ----------------------------------------------------------------------- + +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define XNAMEREPLACE ::com::sun::star::container::XNameReplace +#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier +#define ANY ::com::sun::star::uno::Any +#define REFERENCE ::com::sun::star::uno::Reference +#define SEQUENCE ::com::sun::star::uno::Sequence +#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY + +#define OUSTRING ::rtl::OUString + +// ----------------------------------------------------------------------- + +static const USHORT nCompatVersion = 3; +static const USHORT nOldVersion = 4; +static const USHORT nVersion = 5; + +/*N*/ TYPEINIT1(SfxEventHint, SfxHint); + +// class SfxEventList_Impl ----------------------------------------------- + +/*N*/ struct EventNames_Impl +/*N*/ { +/*N*/ USHORT mnId; +/*N*/ String maEventName; +/*N*/ String maUIName; +/*N*/ +/*N*/ EventNames_Impl( USHORT nId, +/*N*/ const String& rEventName, +/*N*/ const String& rUIName ) +/*N*/ : mnId( nId ) +/*N*/ , maEventName( rEventName ) +/*N*/ , maUIName( rUIName ) {} +/*N*/ }; + +/*?*/ DECLARE_LIST( SfxEventList_Impl, EventNames_Impl* )//STRIP008 ; +/*?*/ +/*?*/ SfxEventList_Impl *gp_Id_SortList = NULL; +/*?*/ SfxEventList_Impl *gp_Name_SortList = NULL; + +//========================================================================== + +/*N*/ SfxEventConfiguration::SfxEventConfiguration() +/*N*/ : pDocEventConfig( NULL ) +/*N*/ , pAppEventConfig( NULL ) +/*N*/ { +/*N*/ bIgnoreConfigure = sal_False; +/*N*/ +/*N*/ // Array zum Ermitteln der Bindungen +/*N*/ pEventArr = new SfxEventArr_Impl; +/*N*/ +/*N*/ // Einen default entry eingf"ugen +/*N*/ const SfxEvent_Impl *pEvent = new SfxEvent_Impl(String(), 0); +/*N*/ pEventArr->Insert(pEvent, 0); +/*N*/ } + +//========================================================================== + +/*N*/ SfxEventConfiguration::~SfxEventConfiguration() +/*N*/ { +/*N*/ for (USHORT n=0; n<pEventArr->Count(); n++) +/*N*/ delete (*pEventArr)[n]; +/*N*/ delete pEventArr; +/*N*/ delete pAppEventConfig; +/*N*/ +/*N*/ if ( gp_Id_SortList ) +/*N*/ { +/*N*/ EventNames_Impl* pData = gp_Id_SortList->First(); +/*N*/ while ( pData ) +/*N*/ { +/*N*/ delete pData; +/*N*/ pData = gp_Id_SortList->Next(); +/*N*/ } +/*N*/ delete gp_Id_SortList; +/*N*/ delete gp_Name_SortList; +/*N*/ +/*N*/ gp_Id_SortList = NULL; +/*N*/ gp_Name_SortList = NULL; +/*N*/ } +/*N*/ } + +//========================================================================== + +/*N*/ void SfxEventConfiguration::RegisterEvent(USHORT nId, const String& rName) +/*N*/ { +/*N*/ USHORT nCount = pEventArr->Count(); +/*N*/ const SfxEvent_Impl *pEvent = new SfxEvent_Impl(rName, nId); +/*N*/ pEventArr->Insert(pEvent, nCount); +/*N*/ } + +//========================================================================== + +/*N*/ SfxEventConfigItem_Impl::SfxEventConfigItem_Impl( USHORT nConfigId, +/*N*/ SfxEventConfiguration *pCfg, +/*N*/ SfxObjectShell *pObjSh) +/*N*/ : SfxConfigItem( nConfigId, pObjSh ? NULL : SFX_APP()->GetConfigManager_Impl() ) +/*N*/ , aMacroTable( 2, 2 ) +/*N*/ , pEvConfig( pCfg ) +/*N*/ , pObjShell( pObjSh ) +/*N*/ , bInitialized( FALSE ) +/*N*/ { +/*N*/ bInitialized = TRUE; +/*N*/ } + +/* +void SfxEventConfigItem_Impl::Init( SfxConfigManager *pMgr ) +{ + if ( GetConfigManager() == pMgr ) + Initialize(); + else + ReInitialize( pMgr ); +} +*/ + +//========================================================================== + +/*N*/ int SfxEventConfigItem_Impl::Load(SvStream& rStream) +/*N*/ { +/*N*/ USHORT nFileVersion; +/*N*/ rStream >> nFileVersion; +/*N*/ if ( nFileVersion < nCompatVersion || nFileVersion > nVersion ) +/*?*/ return SfxConfigItem::WARNING_VERSION; +/*N*/ +/*N*/ SvxMacroTableDtor aLocalMacroTable; +/*N*/ if ( nFileVersion <= nOldVersion ) +/*N*/ { +/*?*/ if ( nFileVersion > nCompatVersion ) +/*?*/ { +/*?*/ USHORT nWarn; +/*?*/ rStream >> nWarn; +/*?*/ bWarning = ( nWarn & 0x01 ) != 0; +/*?*/ bAlwaysWarning = ( nWarn & 0x02 ) != 0; +/*?*/ } +/*?*/ else +/*?*/ bWarning = bAlwaysWarning = FALSE; +/*?*/ +/*?*/ USHORT nCount, nEventCount = pEvConfig->GetEventCount(); +/*?*/ rStream >> nCount; +/*?*/ +/*?*/ USHORT i; +/*?*/ for (i=0; i<nCount; i++) +/*?*/ { +/*?*/ USHORT nId; +/*?*/ SfxMacroInfo aInfo( pObjShell ); +/*?*/ rStream >> nId >> aInfo; +/*?*/ +/*?*/ for (USHORT n=0; n<nEventCount; n++) +/*?*/ { +/*?*/ USHORT nEventId = (*pEvConfig->pEventArr)[n+1]->nEventId; +/*?*/ if ( nEventId == nId ) +/*?*/ { +/*?*/ SvxMacro *pMacro = new SvxMacro( aInfo.GetQualifiedName(), aInfo.GetBasicName(), STARBASIC ); +/*?*/ aLocalMacroTable.Insert( nEventId, pMacro ); +/*?*/ break; +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ USHORT nWarn; +/*N*/ rStream >> nWarn; +/*N*/ bWarning = ( nWarn & 0x01 ) != 0; +/*N*/ bAlwaysWarning = ( nWarn & 0x02 ) != 0; +/*N*/ aLocalMacroTable.Read( rStream ); +/*N*/ } +/*N*/ +/*N*/ if ( pObjShell && pEvConfig ) +/*N*/ pEvConfig->PropagateEvents_Impl( pObjShell, aLocalMacroTable ); +/*N*/ +/*N*/ return SfxConfigItem::ERR_OK; +/*N*/ } + +//========================================================================== + +/*?*/ String SfxEventConfigItem_Impl::GetStreamName() const +/*?*/ { +/*?*/ return SfxConfigItem::GetStreamName( GetType() ); +/*?*/ } + +//========================================================================== + +/*N*/ void SfxEventConfigItem_Impl::UseDefault() +/*N*/ { +/*N*/ bWarning = TRUE; +/*N*/ bAlwaysWarning = FALSE; +/*N*/ +/*N*/ aMacroTable.DelDtor(); +/*N*/ SetDefault( TRUE ); +/*N*/ pEvConfig->PropagateEvents_Impl( pObjShell, aMacroTable ); +/*N*/ } + +/*?*/ int SfxEventConfigItem_Impl::Load( SotStorage& rStorage ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } + +/*?*/ BOOL SfxEventConfigItem_Impl::Store( SotStorage& rStorage ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + + +//========================================================================== + +/*N*/ SfxEventConfigItem_Impl::~SfxEventConfigItem_Impl() +/*N*/ { +/*N*/ } + +//========================================================================== + +/*N*/ void SfxEventConfigItem_Impl::ConfigureEvent( USHORT nId, SvxMacro *pMacro ) +/*N*/ { +/*N*/ if ( aMacroTable.Seek( nId ) ) +/*N*/ { +/*?*/ if ( pMacro ) +/*?*/ aMacroTable.Replace( nId, pMacro ); +/*?*/ else +/*?*/ aMacroTable.Remove( nId ); +/*N*/ } +/*N*/ else if ( pMacro ) +/*N*/ aMacroTable.Insert( nId, pMacro ); +/*N*/ SetDefault(FALSE); +/*N*/ } + +//-------------------------------------------------------------------------- +/*N*/ void SfxEventConfiguration::PropagateEvents_Impl( SfxObjectShell *pDoc, +/*N*/ const SvxMacroTableDtor& rTable ) +/*N*/ { +/*N*/ REFERENCE< XEVENTSSUPPLIER > xSupplier; +/*N*/ if ( pDoc ) +/*N*/ { +/*N*/ xSupplier = REFERENCE< XEVENTSSUPPLIER >( pDoc->GetModel(), UNO_QUERY ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ xSupplier = REFERENCE< XEVENTSSUPPLIER > +/*N*/ ( ::legacy_binfilters::getLegacyProcessServiceFactory()->createInstance( +/*N*/ ::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), UNO_QUERY ); +/*N*/ } +/*N*/ +/*N*/ if ( xSupplier.is() ) +/*N*/ { +/*N*/ SvxMacro *pMacro; +/*N*/ ULONG nCount; +/*N*/ ULONG nID, i; +/*N*/ +/*N*/ REFERENCE< XNAMEREPLACE > xEvents = xSupplier->getEvents(); +/*N*/ +/*N*/ bIgnoreConfigure = sal_True; +/*N*/ +/*N*/ // Erase old values first, because we don't know anything about the +/*N*/ // changes here +/*N*/ +/*N*/ SEQUENCE < PROPERTYVALUE > aProperties; +/*N*/ SEQUENCE < OUSTRING > aEventNames = xEvents->getElementNames(); +/*N*/ OUSTRING* pNames = aEventNames.getArray(); +/*N*/ ANY aEmpty; +/*N*/ +/*N*/ aEmpty <<= aProperties; +/*N*/ nCount = aEventNames.getLength(); +/*N*/ +/*N*/ for ( i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ xEvents->replaceByName( pNames[i], aEmpty ); +/*N*/ } +/*N*/ catch( ::com::sun::star::lang::IllegalArgumentException ) +/*N*/ { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ); } +/*N*/ catch( ::com::sun::star::container::NoSuchElementException ) +/*N*/ { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ); } +/*N*/ } +/*N*/ +/*N*/ // now set the new values +/*N*/ +/*N*/ nCount = rTable.Count(); +/*N*/ +/*N*/ for ( i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ pMacro = rTable.GetObject( i ); +/*N*/ nID = rTable.GetObjectKey( i ); +/*N*/ OUSTRING aEventName = GetEventName_Impl( nID ); +/*N*/ +/*N*/ if ( aEventName.getLength() ) +/*N*/ { +/*N*/ ANY aEventData = CreateEventData_Impl( pMacro ); +/*N*/ try +/*N*/ { +/*N*/ xEvents->replaceByName( aEventName, aEventData ); +/*N*/ } +/*N*/ catch( ::com::sun::star::lang::IllegalArgumentException ) +/*N*/ { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ); } +/*N*/ catch( ::com::sun::star::container::NoSuchElementException ) +/*N*/ { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ); } +/*N*/ } +/*N*/ else +/*N*/ DBG_WARNING( "PropagateEvents_Impl: Got unkown event" ); +/*N*/ } +/*N*/ +/*N*/ bIgnoreConfigure = sal_False; +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------------- + +/*N*/ ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro ) +/*N*/ { +/* + This function converts a SvxMacro into an Any containing three + properties. These properties are EventType and Script. Possible + values for EventType ar StarBasic, JavaScript, ... + The Script property should contain the URL to the macro and looks + like "macro://./standard.module1.main()" +*/ +/*N*/ ANY aEventData; +/*N*/ +/*N*/ if ( pMacro ) +/*N*/ { +/*N*/ if ( pMacro->GetScriptType() == STARBASIC ) +/*N*/ { +/*N*/ SEQUENCE < PROPERTYVALUE > aProperties(3); +/*N*/ PROPERTYVALUE *pValues = aProperties.getArray(); +/*N*/ +/*N*/ OUSTRING aType = OUSTRING::createFromAscii( STAR_BASIC );; +/*N*/ OUSTRING aLib = pMacro->GetLibName(); +/*N*/ OUSTRING aMacro = pMacro->GetMacName(); +/*N*/ +/*N*/ pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); +/*N*/ pValues[ 0 ].Value <<= aType; +/*N*/ +/*N*/ pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_LIBRARY ); +/*N*/ pValues[ 1 ].Value <<= aLib; +/*N*/ +/*N*/ pValues[ 2 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME ); +/*N*/ pValues[ 2 ].Value <<= aMacro; +/*N*/ +/*N*/ aEventData <<= aProperties; +/*N*/ } +/*N*/ else if ( pMacro->GetScriptType() == EXTENDED_STYPE ) +/*N*/ { +/*?*/ SEQUENCE < PROPERTYVALUE > aProperties(2); +/*?*/ PROPERTYVALUE *pValues = aProperties.getArray(); +/*?*/ +/*?*/ OUSTRING aLib = pMacro->GetLibName(); +/*?*/ OUSTRING aMacro = pMacro->GetMacName(); +/*?*/ +/*?*/ pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); +/*?*/ pValues[ 0 ].Value <<= aLib; +/*?*/ +/*?*/ pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_SCRIPT ); +/*?*/ pValues[ 1 ].Value <<= aMacro; +/*?*/ +/*?*/ aEventData <<= aProperties; +/*N*/ } +/*N*/ else if ( pMacro->GetScriptType() == JAVASCRIPT ) +/*N*/ { +/*?*/ SEQUENCE < PROPERTYVALUE > aProperties(2); +/*?*/ PROPERTYVALUE *pValues = aProperties.getArray(); +/*?*/ +/*?*/ OUSTRING aMacro = pMacro->GetMacName(); +/*?*/ +/*?*/ pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); +/*?*/ pValues[ 0 ].Value <<= ::rtl::OUString::createFromAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT); +/*?*/ +/*?*/ pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME ); +/*?*/ pValues[ 1 ].Value <<= aMacro; +/*?*/ +/*?*/ aEventData <<= aProperties; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERRORFILE( "CreateEventData_Impl(): ScriptType not supported!"); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SEQUENCE < PROPERTYVALUE > aProperties; +/*N*/ aEventData <<= aProperties; +/*N*/ } +/*N*/ +/*N*/ return aEventData; +/*N*/ } + +// ------------------------------------------------------------------------------------------------------- +/*N*/ ULONG SfxEventConfiguration::GetPos_Impl( USHORT nId, sal_Bool &rFound ) +/*N*/ { +/*N*/ rFound = sal_False; +/*N*/ +/*N*/ if ( ! gp_Id_SortList->Count() ) +/*N*/ return 0; +/*N*/ +/*N*/ // use binary search to find the correct position +/*N*/ // in the list +/*N*/ +/*N*/ int nCompVal = 1; +/*N*/ long nStart = 0; +/*N*/ long nEnd = gp_Id_SortList->Count() - 1; +/*N*/ long nMid; +/*N*/ +/*N*/ EventNames_Impl* pMid; +/*N*/ +/*N*/ rFound = sal_False; +/*N*/ +/*N*/ while ( nCompVal && ( nStart <= nEnd ) ) +/*N*/ { +/*N*/ nMid = ( nEnd - nStart ) / 2 + nStart; +/*N*/ pMid = gp_Id_SortList->GetObject( (USHORT) nMid ); +/*N*/ +/*N*/ nCompVal = pMid->mnId - nId; +/*N*/ +/*N*/ if ( nCompVal < 0 ) // pMid < pData +/*N*/ nStart = nMid + 1; +/*N*/ else +/*N*/ nEnd = nMid - 1; +/*N*/ } +/*N*/ +/*N*/ if ( nCompVal == 0 ) +/*N*/ { +/*N*/ rFound = sal_True; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if ( nCompVal < 0 ) // pMid < pData +/*N*/ nMid++; +/*N*/ } +/*N*/ +/*N*/ return (USHORT) nMid; +/*N*/ } + +// ------------------------------------------------------------------------------------------------------- +/*N*/ ULONG SfxEventConfiguration::GetPos_Impl( const String& rName, sal_Bool &rFound ) +/*N*/ { +/*N*/ rFound = sal_False; +/*N*/ +/*N*/ if ( ! gp_Name_SortList->Count() ) +/*N*/ return 0; +/*N*/ +/*N*/ // use binary search to find the correct position +/*N*/ // in the list +/*N*/ +/*N*/ int nCompVal = 1; +/*N*/ long nStart = 0; +/*N*/ long nEnd = gp_Name_SortList->Count() - 1; +/*N*/ long nMid; +/*N*/ +/*N*/ EventNames_Impl* pMid; +/*N*/ +/*N*/ rFound = sal_False; +/*N*/ +/*N*/ while ( nCompVal && ( nStart <= nEnd ) ) +/*N*/ { +/*N*/ nMid = ( nEnd - nStart ) / 2 + nStart; +/*N*/ pMid = gp_Name_SortList->GetObject( (USHORT) nMid ); +/*N*/ +/*N*/ nCompVal = rName.CompareTo( pMid->maEventName ); +/*N*/ +/*N*/ if ( nCompVal < 0 ) // pMid < pData +/*N*/ nStart = nMid + 1; +/*N*/ else +/*N*/ nEnd = nMid - 1; +/*N*/ } +/*N*/ +/*N*/ if ( nCompVal == 0 ) +/*N*/ { +/*N*/ rFound = sal_True; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if ( nCompVal < 0 ) // pMid < pData +/*N*/ nMid++; +/*N*/ } +/*N*/ +/*N*/ return (USHORT) nMid; +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*N*/ OUSTRING SfxEventConfiguration::GetEventName_Impl( ULONG nID ) +/*N*/ { +/*N*/ OUSTRING aRet; +/*N*/ +/*N*/ if ( gp_Id_SortList ) +/*N*/ { +/*N*/ sal_Bool bFound; +/*N*/ ULONG nPos = GetPos_Impl( (USHORT) nID, bFound ); +/*N*/ +/*N*/ if ( bFound ) +/*N*/ { +/*N*/ EventNames_Impl *pData = gp_Id_SortList->GetObject( nPos ); +/*N*/ aRet = pData->maEventName; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return aRet; +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*N*/ ULONG SfxEventConfiguration::GetEventId_Impl( const OUSTRING& rEventName ) +/*N*/ { +/*N*/ ULONG nRet = 0; +/*N*/ +/*N*/ if ( gp_Name_SortList ) +/*N*/ { +/*N*/ sal_Bool bFound; +/*N*/ ULONG nPos = GetPos_Impl( rEventName, bFound ); +/*N*/ +/*N*/ if ( bFound ) +/*N*/ { +/*N*/ EventNames_Impl *pData = gp_Name_SortList->GetObject( nPos ); +/*N*/ nRet = pData->mnId; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nRet; +/*N*/ } + +// ------------------------------------------------------------------------------------------------------- +/*N*/ void SfxEventConfiguration::RegisterEvent( USHORT nId, +/*N*/ const String& rUIName, +/*N*/ const String& rMacroName ) +/*N*/ { +/*N*/ if ( ! gp_Id_SortList ) +/*N*/ { +/*N*/ gp_Id_SortList = new SfxEventList_Impl; +/*N*/ gp_Name_SortList = new SfxEventList_Impl; +/*N*/ } +/*N*/ +/*N*/ sal_Bool bFound = sal_False; +/*N*/ ULONG nPos = GetPos_Impl( nId, bFound ); +/*N*/ +/*N*/ if ( bFound ) +/*N*/ { +/*?*/ DBG_ERRORFILE( "RegisterEvent: Event already registered?" ); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ EventNames_Impl *pData; +/*N*/ +/*N*/ pData = new EventNames_Impl( nId, rMacroName, rUIName ); +/*N*/ gp_Id_SortList->Insert( pData, nPos ); +/*N*/ +/*N*/ nPos = GetPos_Impl( rMacroName, bFound ); +/*N*/ DBG_ASSERT( !bFound, "RegisterEvent: Name in List, but ID not?" ); +/*N*/ +/*N*/ gp_Name_SortList->Insert( pData, nPos ); +/*N*/ +/*N*/ SFX_APP()->GetEventConfig()->RegisterEvent( nId, rUIName ); +/*N*/ } + +/*N*/ BOOL SfxEventConfiguration::Import( SvStream& rInStream, SvStream* pOutStream, SfxObjectShell* pDoc ) +/*N*/ { +/*N*/ if ( pDoc ) +/*N*/ { +/*N*/ // load events, they are automatically propagated to the document +/*N*/ DBG_ASSERT( !pOutStream, "DocEventConfig must not be converted!" ); +/*N*/ SfxEventConfigItem_Impl* pCfg = pDoc->GetEventConfig_Impl( TRUE ); +/*N*/ if ( pCfg ) +/*N*/ return ( pCfg->Load( rInStream ) == SfxConfigItem::ERR_OK ); +/*N*/ DBG_ERROR("Couldn't create EventConfiguration!"); +/*N*/ return FALSE; +/*N*/ } +/*?*/ +/*?*/ DBG_ERROR( "No OutStream!" ); +/*?*/ return FALSE; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/config/sfx2_misccfg.cxx b/binfilter/bf_sfx2/source/config/sfx2_misccfg.cxx new file mode 100644 index 000000000000..6d9fca705325 --- /dev/null +++ b/binfilter/bf_sfx2/source/config/sfx2_misccfg.cxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svtools/zforlist.hxx> + +#include <tools/debug.hxx> +#include "misccfg.hxx" +namespace binfilter { + +#define DEFAULT_TAB 2000 + +#define DEF_INCH 2540L +#define DEF_RELTWIP 1440L + +using namespace rtl; +using namespace ::com::sun::star::uno; + +#define C2U(cChar) OUString::createFromAscii(cChar) +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +/*N*/ SfxMiscCfg::SfxMiscCfg() : +/*N*/ ConfigItem(C2U("Office.Common") ), +/*N*/ nYear2000( SvNumberFormatter::GetYear2000Default() ), +/*N*/ bNotFound (FALSE), +/*N*/ bPaperSize(FALSE), +/*N*/ bPaperOrientation (FALSE) +/*N*/ { +/*N*/ Load(); +/*N*/ } +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +/*N*/ SfxMiscCfg::~SfxMiscCfg() +/*N*/ { +/*N*/ } +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +/*N*/ const Sequence<OUString>& SfxMiscCfg::GetPropertyNames() +/*N*/ { +/*N*/ static Sequence<OUString> aNames; +/*N*/ if(!aNames.getLength()) +/*N*/ { +/*N*/ static const char* aPropNames[] = +/*N*/ { +/*N*/ "Print/Warning/PaperSize", // 0 +/*N*/ "Print/Warning/PaperOrientation", // 1 +/*N*/ "Print/Warning/NotFound", // 2 +/*N*/ "DateFormat/TwoDigitYear", // 3 +/*N*/ }; +/*N*/ const int nCount = 4; +/*N*/ aNames.realloc(nCount); +/*N*/ OUString* pNames = aNames.getArray(); +/*N*/ for(int i = 0; i < nCount; i++) +/*N*/ pNames[i] = OUString::createFromAscii(aPropNames[i]); +/*N*/ } +/*N*/ return aNames; +/*N*/ } +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +/*N*/ void SfxMiscCfg::Load() +/*N*/ { +/*N*/ const Sequence<OUString>& aNames = GetPropertyNames(); +/*N*/ Sequence<Any> aValues = GetProperties(aNames); +/*N*/ EnableNotification(aNames); +/*N*/ const Any* pValues = aValues.getConstArray(); +/*N*/ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); +/*N*/ if(aValues.getLength() == aNames.getLength()) +/*N*/ { +/*N*/ for(int nProp = 0; nProp < aNames.getLength(); nProp++) +/*N*/ { +/*N*/ if(pValues[nProp].hasValue()) +/*N*/ { +/*N*/ switch(nProp) +/*N*/ { +/*N*/ case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize", +/*N*/ case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation", +/*N*/ case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound", +/*N*/ case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear", +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +/*?*/ void SfxMiscCfg::Notify( const ::com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames) +/*?*/ { +/*?*/ Load(); +/*?*/ } +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +/*?*/ void SfxMiscCfg::Commit() +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/control/makefile.mk b/binfilter/bf_sfx2/source/control/makefile.mk new file mode 100644 index 000000000000..b3ad2bc885b3 --- /dev/null +++ b/binfilter/bf_sfx2/source/control/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_control + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# w.g. compilerbugs +.IF "$(GUI)"=="WNT" +.IF "$(COM)"!="GCC" +CFLAGS+=-Od +.ENDIF +.ENDIF + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_request.obj \ + $(SLO)$/sfx2_shell.obj \ + $(SLO)$/sfx2_srchitem.obj \ + $(SLO)$/sfx2_macrconf.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/control/sfx2_macrconf.cxx b/binfilter/bf_sfx2/source/control/sfx2_macrconf.cxx new file mode 100644 index 000000000000..18e435d4f900 --- /dev/null +++ b/binfilter/bf_sfx2/source/control/sfx2_macrconf.cxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "macrconf.hxx" +#include "sfx.hrc" +#include "app.hxx" +#include "objshimp.hxx" + +namespace binfilter { + +static const sal_uInt16 nCompatVersion = 2; +static const sal_uInt16 nVersion = 3; + +// Static member +SfxMacroConfig* SfxMacroConfig::pMacroConfig = NULL; + +/*N*/ void SfxMacroConfig::Release_Impl() +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); +/*N*/ DELETEZ( pMacroConfig ); +/*N*/ } + +//========================================================================== + +/*?*/ struct SfxMacroConfig_Impl +/*?*/ { +/*?*/ SfxMacroInfoArr_Impl aArr; +/*?*/ sal_uInt32 nEventId; +/*?*/ sal_Bool bWaitingForCallback; +/*?*/ +/*?*/ SfxMacroConfig_Impl() +/*?*/ : nEventId( 0 ) +/*?*/ , bWaitingForCallback( sal_False ) +/*?*/ {} +/*?*/ }; + +//========================================================================== + +/*?*/ SfxMacroInfo::SfxMacroInfo( SfxObjectShell *pDoc ) : +/*?*/ bAppBasic(pDoc == NULL), +/*?*/ nSlotId(0), +/*?*/ nRefCnt(0), +/*?*/ pHelpText(0) +/*?*/ {} + +//========================================================================== + +/*?*/ SfxMacroInfo::~SfxMacroInfo() +/*?*/ { +/*?*/ delete pHelpText; +/*?*/ } + +//========================================================================== + +/*?*/ sal_Bool SfxMacroInfo::operator==(const SfxMacroInfo& rOther) const +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +//========================================================================== + +/*?*/ String SfxMacroInfo::GetQualifiedName() const +/*?*/ {DBG_BF_ASSERT(0, "STRIP");return String(); +/*?*/ } + +//========================================================================== + +/*?*/ String SfxMacroInfo::GetBasicName() const +/*?*/ {DBG_BF_ASSERT(0, "STRIP");return String();//STRIP001 +/*?*/ } + +//========================================================================== + +/*?*/ SvStream& operator >> (SvStream& rStream, SfxMacroInfo& rInfo) +/*?*/ { +/*?*/ sal_uInt16 nAppBasic, nFileVersion; +/*?*/ String aDocName; +/*?*/ +/*?*/ rStream >> nFileVersion; +/*?*/ if ( nVersion < nCompatVersion ) +/*?*/ { +/*?*/ // In der 1.Version ohne Versionskennung +/*?*/ nAppBasic = nVersion; +/*?*/ nFileVersion = 1; +/*?*/ rStream.ReadByteString(aDocName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.ReadByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.ReadByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.ReadByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ String aInput; +/*?*/ rStream >> nAppBasic; +/*?*/ rStream.ReadByteString(aDocName,RTL_TEXTENCODING_UTF8); // Vorsicht: kann bei AppName Unsinn sein! +/*?*/ rStream.ReadByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.ReadByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.ReadByteString(aInput,RTL_TEXTENCODING_UTF8); +/*?*/ +/*?*/ if ( nFileVersion == nCompatVersion ) +/*?*/ rInfo.aMethodName = aInput; +/*?*/ else +/*?*/ { +/*?*/ sal_uInt16 nCount = aInput.GetTokenCount('.'); +/*?*/ rInfo.aMethodName = aInput.GetToken( nCount-1, '.' ); +/*?*/ if ( nCount > 1 ) +/*?*/ rInfo.aModuleName = aInput.GetToken( nCount-2, '.' ); +/*?*/ if ( nCount > 2 ) +/*?*/ rInfo.aLibName = aInput.GetToken( 0, '.' ); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ rInfo.bAppBasic = (sal_Bool) nAppBasic; +/*?*/ return rStream; +/*?*/ } + +//========================================================================== + +/*?*/ SvStream& operator << (SvStream& rStream, const SfxMacroInfo& rInfo) +/*?*/ { +/*?*/ if ( rInfo.bAppBasic ) +/*?*/ { +/*?*/ rStream << nVersion +/*?*/ << (sal_uInt16) rInfo.bAppBasic; +/*?*/ rStream.WriteByteString(rInfo.GetBasicName(),RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ rStream << nVersion +/*?*/ << (sal_uInt16) rInfo.bAppBasic; +/*?*/ rStream.WriteByteString(SFX_APP()->GetName(),RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8); +/*?*/ rStream.WriteByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8); +/*?*/ } +/*?*/ +/*?*/ return rStream; +/*?*/ } + +//========================================================================== + +/*?*/ SfxMacroConfig::~SfxMacroConfig() +/*?*/ { +/*?*/ if ( pImp->nEventId ) +/*?*/ Application::RemoveUserEvent( pImp->nEventId ); +/*?*/ delete pImp; +/*?*/ } + +//========================================================================== + +/*?*/ IMPL_LINK( SfxMacroConfig, CallbackHdl_Impl, SfxMacroConfig*, pConfig ) +/*?*/ { + DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pImp->bWaitingForCallback = sal_False; +/*?*/ return 0; +/*?*/ } + +/*?*/ IMPL_LINK( SfxMacroConfig, EventHdl_Impl, SfxMacroInfo*, pInfo ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ pImp->nEventId = 0; +/*?*/ return 0; +/*?*/ } + +/*?*/ ErrCode SfxMacroConfig::Call( SbxObject* pVCtrl, +/*?*/ const String& rCode, BasicManager* pMgr, SbxArray *pArgs, SbxValue *pRet ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*?*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/control/sfx2_request.cxx b/binfilter/bf_sfx2/source/control/sfx2_request.cxx new file mode 100644 index 000000000000..9e931cab45f0 --- /dev/null +++ b/binfilter/bf_sfx2/source/control/sfx2_request.cxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/itemset.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "request.hxx" + +namespace binfilter { + +/*N*/ const SfxPoolItem* SfxRequest::GetItem +/*N*/ ( +/*N*/ const SfxItemSet* pArgs, +/*N*/ USHORT nSlotId, // Slot-Id oder Which-Id des Parameters +/*N*/ FASTBOOL bDeep, // FALSE: nicht in Parent-ItemSets suchen +/*N*/ TypeId aType // != 0: RTTI Pruefung mit Assertion +/*N*/ ) +/*N*/ { +/*N*/ if ( pArgs ) +/*N*/ { +/*N*/ // ggf. in Which-Id umrechnen +/*N*/ USHORT nWhich = pArgs->GetPool()->GetWhich(nSlotId); +/*N*/ +/*N*/ // ist das Item gesetzt oder bei bDeep==TRUE verf"ugbar? +/*N*/ const SfxPoolItem *pItem = 0; +/*N*/ if ( ( bDeep ? SFX_ITEM_AVAILABLE : SFX_ITEM_SET ) +/*N*/ <= pArgs->GetItemState( nWhich, bDeep, &pItem ) ) +/*N*/ { +/*N*/ // stimmt der Typ "uberein? +/*N*/ if ( !pItem || pItem->IsA(aType) ) +/*N*/ return pItem; +/*N*/ +/*N*/ // Item da aber falsch => Programmierfehler +/*N*/ DBG_ERROR( "invalid argument type" ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // keine Parameter, nicht gefunden oder falschen Typ gefunden +/*N*/ return 0; +/*N*/ } +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/control/sfx2_shell.cxx b/binfilter/bf_sfx2/source/control/sfx2_shell.cxx new file mode 100644 index 000000000000..e0fca281eaeb --- /dev/null +++ b/binfilter/bf_sfx2/source/control/sfx2_shell.cxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/itempool.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "app.hxx" + +namespace binfilter { + +//==================================================================== + +/*N*/ TYPEINIT0(SfxShell); + +//==================================================================== +/*N*/ SV_IMPL_PTRARR( SfxItemPtrArray, SfxPoolItemPtr); + +/*N*/ struct SfxShell_Impl: public SfxBroadcaster +/*N*/ { +/*N*/ String aObjectName;// Name des Sbx-Objects +/*N*/ SfxItemArray_Impl aItems; // Datenaustausch auf Item-Basis +/*N*/ }; + +/*N*/ SfxShell::SfxShell() +/*N*/ : pPool(0), +/*N*/ pImp(0) +/*N*/ { +/*N*/ pImp = new SfxShell_Impl; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ SfxShell::~SfxShell() +/*N*/ { +/*N*/ delete pImp; +/*N*/ } +//-------------------------------------------------------------------- + +/*N*/ const SfxPoolItem* SfxShell::GetItem +/*N*/ ( +/*N*/ USHORT nSlotId // Slot-Id des zu erfragenden <SfxPoolItem>s +/*N*/ ) const +/*N*/ { +/*N*/ for ( USHORT nPos = 0; nPos < pImp->aItems.Count(); ++nPos ) +/*N*/ if ( pImp->aItems.GetObject(nPos)->Which() == nSlotId ) +/*N*/ return pImp->aItems.GetObject(nPos); +/*N*/ return 0; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxShell::RemoveItem +/*N*/ ( +/*N*/ USHORT nSlotId // Slot-Id des zu l"oschenden <SfxPoolItem>s +/*N*/ ) +/*N*/ { +/*N*/ for ( USHORT nPos = 0; nPos < pImp->aItems.Count(); ++nPos ) +/*?*/ if ( pImp->aItems.GetObject(nPos)->Which() == nSlotId ) +/*?*/ { +/*?*/ // Item entfernen und l"oschen +/*?*/ SfxPoolItem *pItem = pImp->aItems.GetObject(nPos); +/*?*/ delete pItem; +/*?*/ pImp->aItems.Remove(nPos); +/*?*/ +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxShell::PutItem +/*N*/ ( +/*N*/ const SfxPoolItem& rItem /* Instanz, von der eine Kopie erstellt wird, + die in der SfxShell in einer Liste + gespeichert wird. */ +/*N*/ ) +/*N*/ { +/*N*/ DBG_ASSERT( !rItem.ISA(SfxSetItem), "SetItems aren't allowed here" ); +/*N*/ DBG_ASSERT( SfxItemPool::IsSlot( rItem.Which() ), +/*N*/ "items with Which-Ids aren't allowed here" ); +/*N*/ +/*N*/ // MSC auf WNT/W95 machte hier Mist, Vorsicht bei Umstellungen +/*N*/ const SfxPoolItem *pItem = rItem.Clone(); +/*N*/ SfxPoolItemHint aItemHint( (SfxPoolItem*) pItem ); +/*N*/ const USHORT nWhich = rItem.Which(); +/*N*/ SfxPoolItem **ppLoopItem = (SfxPoolItem**) pImp->aItems.GetData(); +/*N*/ USHORT nPos; +/*N*/ for ( nPos = 0; nPos < pImp->aItems.Count(); ++nPos, ++ppLoopItem ) +/*N*/ { +/*N*/ if ( (*ppLoopItem)->Which() == nWhich ) +/*N*/ { +/*N*/ // Item austauschen +/*N*/ delete *ppLoopItem; +/*N*/ pImp->aItems.Remove(nPos); +/*N*/ pImp->aItems.Insert( (SfxPoolItemPtr) pItem, nPos ); +/*N*/ +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Broadcast( aItemHint ); +/*N*/ pImp->aItems.Insert((SfxPoolItemPtr)pItem, nPos ); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx b/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx new file mode 100644 index 000000000000..4dc3a331ed60 --- /dev/null +++ b/binfilter/bf_sfx2/source/control/sfx2_srchitem.cxx @@ -0,0 +1,283 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// include --------------------------------------------------------------- + +#include "bf_basic/sbxvar.hxx" +#include <bf_svtools/searchopt.hxx> +#include <sal/macros.h> + +#include <bf_svtools/memberid.hrc> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#define _SVX_SRCHITEM_CXX + +#include "sfxsids.hrc" +#define ITEMID_SEARCH SID_SEARCH_ITEM +#include "srchitem.hxx" + +namespace binfilter { + +//using namespace uno; +using namespace rtl; +using namespace utl; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::i18n; +using namespace ::com::sun::star::uno; + +#define CFG_ROOT_NODE "Office.Common/SearchOptions" + +// STATIC DATA ----------------------------------------------------------- + +/*N*/ TYPEINIT1_AUTOFACTORY(SvxSearchItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +/*N*/ static Sequence< OUString > lcl_GetNotifyNames() +/*N*/ { +/*N*/ // names of transliteration relevant properties +/*N*/ static const char* aTranslitNames[] = +/*N*/ { +/*N*/ "IsMatchCase", // 0 +/*N*/ "Japanese/IsMatchFullHalfWidthForms", // 1 +/*N*/ "Japanese/IsMatchHiraganaKatakana", // 2 +/*N*/ "Japanese/IsMatchContractions", // 3 +/*N*/ "Japanese/IsMatchMinusDashCho-on", // 4 +/*N*/ "Japanese/IsMatchRepeatCharMarks", // 5 +/*N*/ "Japanese/IsMatchVariantFormKanji", // 6 +/*N*/ "Japanese/IsMatchOldKanaForms", // 7 +/*N*/ "Japanese/IsMatch_DiZi_DuZu", // 8 +/*N*/ "Japanese/IsMatch_BaVa_HaFa", // 9 +/*N*/ "Japanese/IsMatch_TsiThiChi_DhiZi", // 10 +/*N*/ "Japanese/IsMatch_HyuIyu_ByuVyu", // 11 +/*N*/ "Japanese/IsMatch_SeShe_ZeJe", // 12 +/*N*/ "Japanese/IsMatch_IaIya", // 13 +/*N*/ "Japanese/IsMatch_KiKu", // 14 +/*N*/ "Japanese/IsIgnorePunctuation", // 15 +/*N*/ "Japanese/IsIgnoreWhitespace", // 16 +/*N*/ "Japanese/IsIgnoreProlongedSoundMark", // 17 +/*N*/ "Japanese/IsIgnoreMiddleDot" // 18 +/*N*/ }; +/*N*/ +/*N*/ const int nCount = SAL_N_ELEMENTS( aTranslitNames ); +/*N*/ Sequence< OUString > aNames( nCount ); +/*N*/ OUString* pNames = aNames.getArray(); +/*N*/ for (INT32 i = 0; i < nCount; ++i) +/*N*/ pNames[i] = OUString::createFromAscii( aTranslitNames[i] ); +/*N*/ +/*N*/ return aNames; +/*N*/ } + +// ----------------------------------------------------------------------- +/*N*/ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : +/*N*/ +/*N*/ SfxPoolItem( nId ), +/*N*/ ConfigItem( OUString::createFromAscii( CFG_ROOT_NODE ) ), +/*N*/ +/*N*/ aSearchOpt ( SearchAlgorithms_ABSOLUTE, +/*N*/ SearchFlags::LEV_RELAXED, +/*N*/ OUString(), +/*N*/ OUString(), +/*N*/ Locale(), +/*N*/ 2, 2, 2, +/*N*/ TransliterationModules_IGNORE_CASE ), +/*N*/ nCommand ( 0 ), +/*N*/ bBackward ( sal_False ), +/*N*/ bPattern ( sal_False ), +/*N*/ bContent ( sal_False ), +/*N*/ eFamily ( SFX_STYLE_FAMILY_PARA ), +/*N*/ bRowDirection ( sal_True ), +/*N*/ bAllTables ( sal_False ), +/*N*/ nCellType ( SVX_SEARCHIN_FORMULA ), +/*N*/ nAppFlag ( SVX_SEARCHAPP_WRITER ), +/*N*/ bAsianOptions ( FALSE ) +/*N*/ { +/*N*/ EnableNotification( lcl_GetNotifyNames() ); +/*N*/ +/*N*/ SvtSearchOptions aOpt; +/*N*/ +/*N*/ bBackward = aOpt.IsBackwards(); +/*N*/ bAsianOptions = aOpt.IsUseAsianOptions(); +/*N*/ +/*N*/ if (aOpt.IsUseRegularExpression()) +/*N*/ aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; +/*N*/ if (aOpt.IsSimilaritySearch()) +/*N*/ aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; +/*N*/ if (aOpt.IsWholeWordsOnly()) +/*N*/ aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; +/*N*/ +/*N*/ INT32 &rFlags = aSearchOpt.transliterateFlags; +/*N*/ +/*N*/ if (!aOpt.IsMatchCase()) +/*N*/ rFlags |= TransliterationModules_IGNORE_CASE; +/*N*/ if ( aOpt.IsMatchFullHalfWidthForms()) +/*N*/ rFlags |= TransliterationModules_IGNORE_WIDTH; +/*N*/ if ( aOpt.IsMatchHiraganaKatakana()) +/*N*/ rFlags |= TransliterationModules_IGNORE_KANA; +/*N*/ if ( aOpt.IsMatchContractions()) +/*N*/ rFlags |= TransliterationModules_ignoreSize_ja_JP; +/*N*/ if ( aOpt.IsMatchMinusDashChoon()) +/*N*/ rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; +/*N*/ if ( aOpt.IsMatchRepeatCharMarks()) +/*N*/ rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; +/*N*/ if ( aOpt.IsMatchVariantFormKanji()) +/*N*/ rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; +/*N*/ if ( aOpt.IsMatchOldKanaForms()) +/*N*/ rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; +/*N*/ if ( aOpt.IsMatchDiziDuzu()) +/*N*/ rFlags |= TransliterationModules_ignoreZiZu_ja_JP; +/*N*/ if ( aOpt.IsMatchBavaHafa()) +/*N*/ rFlags |= TransliterationModules_ignoreBaFa_ja_JP; +/*N*/ if ( aOpt.IsMatchTsithichiDhizi()) +/*N*/ rFlags |= TransliterationModules_ignoreTiJi_ja_JP; +/*N*/ if ( aOpt.IsMatchHyuiyuByuvyu()) +/*N*/ rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; +/*N*/ if ( aOpt.IsMatchSesheZeje()) +/*N*/ rFlags |= TransliterationModules_ignoreSeZe_ja_JP; +/*N*/ if ( aOpt.IsMatchIaiya()) +/*N*/ rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; +/*N*/ if ( aOpt.IsMatchKiku()) +/*N*/ rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; +/*N*/ if ( aOpt.IsIgnorePunctuation()) +/*N*/ rFlags |= TransliterationModules_ignoreSeparator_ja_JP; +/*N*/ if ( aOpt.IsIgnoreWhitespace()) +/*N*/ rFlags |= TransliterationModules_ignoreSpace_ja_JP; +/*N*/ if ( aOpt.IsIgnoreProlongedSoundMark()) +/*N*/ rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; +/*N*/ if ( aOpt.IsIgnoreMiddleDot()) +/*N*/ rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) : +/*N*/ +/*N*/ SfxPoolItem ( rItem ), +/*N*/ ConfigItem( OUString::createFromAscii( CFG_ROOT_NODE ) ), +/*N*/ +/*N*/ aSearchOpt ( rItem.aSearchOpt ), +/*N*/ nCommand ( rItem.nCommand ), +/*N*/ bBackward ( rItem.bBackward ), +/*N*/ bPattern ( rItem.bPattern ), +/*N*/ bContent ( rItem.bContent ), +/*N*/ eFamily ( rItem.eFamily ), +/*N*/ bRowDirection ( rItem.bRowDirection ), +/*N*/ bAllTables ( rItem.bAllTables ), +/*N*/ nCellType ( rItem.nCellType ), +/*N*/ nAppFlag ( rItem.nAppFlag ), +/*N*/ bAsianOptions ( rItem.bAsianOptions ) +/*N*/ { +/*N*/ EnableNotification( lcl_GetNotifyNames() ); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ SvxSearchItem::~SvxSearchItem() +/*N*/ { +/*N*/ } + +// ----------------------------------------------------------------------- +/*N*/ SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *pPool) const +/*N*/ { +/*N*/ return new SvxSearchItem(*this); +/*N*/ } + +// ----------------------------------------------------------------------- + +//! used below +/*N*/ static BOOL operator == ( const SearchOptions& rItem1, const SearchOptions& rItem2 ) +/*N*/ { +/*N*/ return rItem1.algorithmType == rItem2.algorithmType && +/*N*/ rItem1.searchFlag == rItem2.searchFlag && +/*N*/ rItem1.searchString == rItem2.searchString && +/*N*/ rItem1.replaceString == rItem2.replaceString && +/*N*/ //rItem1.Locale == rItem2.Locale && +/*N*/ rItem1.changedChars == rItem2.changedChars && +/*N*/ rItem1.deletedChars == rItem2.deletedChars && +/*N*/ rItem1.insertedChars == rItem2.insertedChars && +/*N*/ rItem1.transliterateFlags == rItem2.transliterateFlags; +/*N*/ } + + +/*N*/ int SvxSearchItem::operator==( const SfxPoolItem& rItem ) const +/*N*/ { +/*N*/ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" ); +/*N*/ const SvxSearchItem &rSItem = (SvxSearchItem &) rItem; +/*N*/ return ( nCommand == rSItem.nCommand ) && +/*N*/ ( bBackward == rSItem.bBackward ) && +/*N*/ ( bPattern == rSItem.bPattern ) && +/*N*/ ( bContent == rSItem.bContent ) && +/*N*/ ( eFamily == rSItem.eFamily ) && +/*N*/ ( bRowDirection == rSItem.bRowDirection ) && +/*N*/ ( bAllTables == rSItem.bAllTables ) && +/*N*/ ( nCellType == rSItem.nCellType ) && +/*N*/ ( nAppFlag == rSItem.nAppFlag ) && +/*N*/ ( bAsianOptions == rSItem.bAsianOptions ) && +/*N*/ ( aSearchOpt == rSItem.aSearchOpt ); +/*N*/ } + + +//------------------------------------------------------------------------ + +/*N*/ SfxItemPresentation SvxSearchItem::GetPresentation +/*N*/ ( +/*N*/ SfxItemPresentation ePres, +/*N*/ SfxMapUnit eCoreUnit, +/*N*/ SfxMapUnit ePresUnit, +/*N*/ XubString& rText, +/*N*/ const ::IntlWrapper * +/*N*/ ) const +/*N*/ { +/*N*/ return SFX_ITEM_PRESENTATION_NONE; +/*N*/ } + +/*N*/ void SvxSearchItem::Notify( const Sequence< OUString > &rPropertyNames ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ bool SvxSearchItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return true; +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ bool SvxSearchItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return true; +/*N*/ } + +void SvxSearchItem::Commit() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/makefile.mk b/binfilter/bf_sfx2/source/doc/makefile.mk new file mode 100644 index 000000000000..82f693569349 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_doc + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/timestamp.obj \ + $(SLO)$/sfx2_docfile.obj \ + $(SLO)$/sfx2_objuno.obj \ + $(SLO)$/sfx2_frmdescr.obj \ + $(SLO)$/sfx2_docinf.obj \ + $(SLO)$/sfx2_interno.obj \ + $(SLO)$/sfx2_objxtor.obj \ + $(SLO)$/sfx2_objmisc.obj \ + $(SLO)$/sfx2_objstor.obj \ + $(SLO)$/sfx2_objcont.obj \ + $(SLO)$/sfx2_objserv.obj \ + $(SLO)$/sfx2_objitem.obj \ + $(SLO)$/sfx2_docfac.obj \ + $(SLO)$/sfx2_docfilt.obj \ + $(SLO)$/sfx2_frameobj.obj \ + $(SLO)$/sfx2_sfxbasemodel.obj \ + $(SLO)$/sfx2_xmlversion.obj + +EXCEPTIONSFILES=\ + $(SLO)$/sfx2_objuno.obj \ + $(SLO)$/sfx2_objcont.obj \ + $(SLO)$/sfx2_docfac.obj \ + $(SLO)$/sfx2_docfile.obj \ + $(SLO)$/sfx2_doctempl.obj \ + $(SLO)$/sfx2_doctemplates.obj \ + $(SLO)$/sfx2_sfxbasemodel.obj \ + $(SLO)$/sfx2_objxtor.obj \ + $(SLO)$/sfx2_objstor.obj \ + $(SLO)$/sfx2_xmlversion.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/binfilter/bf_sfx2/source/doc/sfx2_dinfobj.cxx b/binfilter/bf_sfx2/source/doc/sfx2_dinfobj.cxx new file mode 100644 index 000000000000..9d87f63b79d6 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_dinfobj.cxx @@ -0,0 +1,233 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "app.hxx" +#include "objface.hxx" +#include "sfxsids.hrc" +#include "docinf.hxx" +#include "docfile.hxx" +#include "openflag.hxx" +#include "dinfobj.hxx" +#include "fcontnr.hxx" + +#include "bf_basic/sbx.hxx" +//======================================================================== + +#define DocumentInfo +namespace binfilter { +#include "sfxslots.hxx" + +#define aTypeLibInfo aDocumentInfoTypeLibImpl + +//========================================================================= + +SfxDocumentInfoObject_Impl::SfxDocumentInfoObject_Impl() +: SvDispatch( DEFINE_CONST_UNICODE( "DocumentInfo" ) ), + pMedium(0) +{ + // Sbx-Flags + SetType( SbxOBJECT ); + SetFlag( SBX_FIXED ); + SetFlag( SBX_DONTSTORE ); + ResetFlag( SBX_WRITE ); +} + +//-------------------------------------------------------------------- + +SfxDocumentInfoObject_Impl::~SfxDocumentInfoObject_Impl() +{ + delete pMedium; +} + +//-------------------------------------------------------------------- + +SvGlobalName SfxDocumentInfoObject_Impl::GetTypeName() const +{ + SvGlobalName aName; + aName.MakeId( String::CreateFromAscii( aTypeLibInfo.pShellUId ) ); + return aName; +} + +//-------------------------------------------------------------------- + +BOOL SfxDocumentInfoObject_Impl::FillTypeLibInfo( String * pName, + USHORT * pMajor, USHORT * pMinor ) const +{ + *pName = String::CreateFromAscii( aTypeLibInfo.pTypeLibName ); + *pMajor = aTypeLibInfo.nMajorVer; + *pMinor = aTypeLibInfo.nMinorVer; + return TRUE; +} + +//------------------------------------------------------------------------ + +void SfxDocumentInfoObject_Impl::Notify( SfxBroadcaster& rBC, + const SfxHint& rHint ) + +/* [Beschreibung] + + Diese Klasse ist nicht von SfxShellObject abgeleitet, da keine + SfxShell die Verarbeitung "ubernimmt. Das Ansprechen der Properties + und Methoden arbeitet daher auch via Notify(). +*/ + +{ + // vor Selbstzerst"orung sch"utzen + DBG_ASSERT( GetRefCount() != SV_NO_DELETE_REFCOUNT, + "notify on unreferenced object => dying!!!" ) + SbxObjectRef xSelfRef( this ); + + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + // Art des Hint und SID auswerten + ULONG nHint = pHint ? pHint->GetId() : 0; + SbxVariable* pVar = pHint->GetVar(); + BOOL bRead = BOOL( nHint == SBX_HINT_DATAWANTED && + pVar->GetClass() == SbxCLASS_PROPERTY ); + BOOL bWrite = BOOL( nHint == SBX_HINT_DATACHANGED && + pVar->GetClass() == SbxCLASS_PROPERTY ); + BOOL bCall = BOOL( nHint == SBX_HINT_DATAWANTED && + pVar->GetClass() == SbxCLASS_METHOD ); + INT16 nSID = (INT16) ( pVar->GetUserData() & 0xFFFF ); + + // Methode Load? + if ( bCall && ( SID_DOCINFO_LOAD == nSID ) ) + { + // ggf. altes Medium freigeben + if ( pMedium ) + DELETEZ(pMedium); + + // 1. Parameter ist Dateiname + SbxArray *pArgs = pVar->GetParameters(); + if ( !pArgs ) + { + // Parameter fehlt + pVar->PutBool( FALSE ); + return; + } + + // Medium erstellen + String aName( pArgs->Get(1)->GetString() ); + pMedium = new SfxMedium( aName, SFX_STREAM_READWRITE, TRUE ); + if ( !pMedium->GetStorage() ) + { + // Datei existiert nicht oder ist kein Storage + pVar->PutBool( FALSE ); + return; + } + + // Storage "offnen + SvStorageRef xStor = pMedium->GetStorage(); + if ( !xStor.Is() || SVSTREAM_OK != pMedium->GetError() ) + { + // Fallback auf r/o + delete pMedium; + pMedium = new SfxMedium( aName, SFX_STREAM_READONLY, TRUE ); + xStor = pMedium->GetStorage(); + + // konnte jetzt ge"offnet werden? + if ( !xStor.Is() || SVSTREAM_OK != pMedium->GetError() ) + { + pVar->PutBool( FALSE ); + return; + } + } + + // Filter-Detection wegen FileFormat-Version + const SfxFilter *pFilter = 0; + if ( 0 != SFX_APP()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter ) || + !pFilter ) + { + // unbekannted Dateiformat + pVar->PutBool( FALSE ); + return; + } + + xStor->SetVersion( pFilter->GetVersion() ); + + // DocInfo laden + BOOL bOK = aDocInfo().Load( xStor ); + pVar->PutBool( bOK ); + if ( bOK ) + aDocInfo.SetValue( aName ); + return; + } + + // Methode Save? + else if ( bCall && ( SID_DOCINFO_SAVE == nSID ) ) + { + // existiert ein Medium? + if ( !pMedium ) + { + // ohne Medium kein Speichern + pVar->PutBool( FALSE ); + return; + } + + // ggf. Filter-Detection wegen FileFormat-Version + const SfxFilter *pFilter = 0; + SFX_APP()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter ); + + // Storage "offnen + SvStorageRef xStor = pMedium->GetStorage(); + xStor->SetVersion( pFilter + ? pFilter->GetVersion() + : SOFFICE_FILEFORMAT_CURRENT ); + // DocInfo speichern + BOOL bOK = aDocInfo().Save( xStor ) && xStor->Commit(); + pVar->PutBool( bOK ); + return; + } + + // Property auslesen? + else if ( bRead && ( SID_DOCINFO == nSID ) ) + { + aDocInfo.FillVariable( *pVar, SFX_MAPUNIT_MM, SFX_MAPUNIT_MM ); + return; + } + + // Property setzen? + else if ( bWrite && SID_DOCINFO == nSID ) + { + aDocInfo.SetVariable( *pVar, SFX_MAPUNIT_MM, SFX_MAPUNIT_MM ); + return; + } + } + + SvDispatch::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docfac.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docfac.cxx new file mode 100644 index 000000000000..5a1601f7c3dd --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_docfac.cxx @@ -0,0 +1,325 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/registry/MergeConflictException.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#include <comphelper/processfactory.hxx> + +#include <bf_so3/embobj.hxx> + +#include <tools/config.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/moduleoptions.hxx> +#include <tools/urlobj.hxx> +#include <unotools/ucbstreamhelper.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "sfx.hrc" +#include "docfilt.hxx" +#include "docfac.hxx" +#include "fltfnc.hxx" +#include "appdata.hxx" +#include "arrdecl.hxx" +#include "app.hxx" +#include "module.hxx" +#include <sfxuno.hxx> + +//added by jmeng for include sleep() function for i31251 +#if ( defined UNX ) || ( defined OS2 ) //Unix +#include <unistd.h> +#endif +namespace binfilter { + +//======================================================================== + +DECL_PTRARRAY( SfxViewFactoryArr_Impl, SfxViewFactory*, 2, 2 ) //STRIP008; + +//======================================================================== + +/*N*/ DBG_NAME(SfxObjectFactory) +/*N*/ TYPEINIT1(SfxObjectFactory,SvFactory); + +/*N*/ static SfxObjectFactoryArr_Impl* pObjFac = 0; + +//======================================================================== + +/*N*/ struct SfxObjectFactory_Impl +/*N*/ { +/*N*/ SfxFilterArr_Impl aFilterArr; // Liste von <SFxFilter>n +/*N*/ ::rtl::OUString aServiceName; +/*N*/ sal_Bool bInitFactoryCalled; +/*N*/ SfxVoidFunc pInitFactory; +/*N*/ SfxFactoryFilterContainer* pFilterContainer; +/*N*/ SfxModule* pModule; +/*N*/ String aStandardTemplate; +/*N*/ sal_Bool bTemplateInitialized; +/*N*/ sal_uInt16 nCreateNewSlotId; +/*N*/ +/*N*/ SfxObjectFactory_Impl() : +/*N*/ bInitFactoryCalled ( sal_False ), +/*N*/ pInitFactory ( NULL ), +/*N*/ pFilterContainer ( NULL ), +/*N*/ pModule ( NULL ), +/*N*/ bTemplateInitialized( sal_False ), +/*N*/ nCreateNewSlotId ( 0 ) {} +/*N*/ +/*N*/ ~SfxObjectFactory_Impl() +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ void ClearAccMgr() +/*N*/ { +/*N*/ } +/*N*/ }; + +//======================================================================== + +/*N*/ SfxFactoryFilterContainer* SfxObjectFactory::GetFilterContainer( +/*N*/ sal_Bool bForceLoad ) const +/*N*/ { +/*N*/ if( bForceLoad ) +/*N*/ ((SfxObjectFactory *)this)->DoInitFactory(); +/*N*/ return pImpl->pFilterContainer; +/*N*/ } + +/*N*/ void SfxObjectFactory::RegisterInitFactory(SfxVoidFunc pFunc) +/*N*/ { +/*N*/ pImpl->pInitFactory = pFunc; +/*N*/ DoInitFactory(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectFactory::DoInitFactory() +/*N*/ { +/*N*/ if(!pImpl->bInitFactoryCalled) +/*N*/ { +/*N*/ pImpl->bInitFactoryCalled = sal_True; +/*N*/ // FilterContainer Landen +/*N*/ GetFilterCount( ); +/*N*/ (*pImpl->pInitFactory)(); +/*N*/ +/*N*/ // There are no filters for "dummy" factory! +/*N*/ if( pImpl->aServiceName.compareToAscii("dummy") != 0 ) +/*N*/ { +/*N*/ DBG_ASSERT( pImpl->aServiceName.getLength(), "No service name - no filters!" ); +/*N*/ SfxFilterContainer *pCont = GetFilterContainer(); +/*N*/ pCont->ReadExternalFilters( pImpl->aServiceName ); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ sal_uInt16 SfxObjectFactory::GetFilterCount() const +/*N*/ { +/*N*/ ((SfxObjectFactory *)this)->DoInitFactory(); +/*N*/ return pImpl->pFilterContainer->GetFilterCount(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ const SfxFilter* SfxObjectFactory::GetFilter(sal_uInt16 i) const +/*N*/ { +/*N*/ ((SfxObjectFactory *)this)->DoInitFactory(); +/*N*/ return pImpl->pFilterContainer->GetFilter( i ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxObjectShell *SfxObjectFactory::CreateObject(SfxObjectCreateMode eMode) const +/*N*/ { +/*N*/ DBG_CHKTHIS(SfxObjectFactory, 0); +/*N*/ return (*fnCreate)(eMode); +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ void SfxObjectFactory::Construct +/*N*/ ( +/*N*/ sal_uInt16 nFactoryId, +/*N*/ SfxObjectCtor fnCreateFnc, +/*N*/ SfxObjectShellFlags nFlagsP, +/*N*/ const char* pName +/*N*/ ) +/*N*/ { +/*N*/ DBG_CHKTHIS(SfxObjectFactory, 0); +/*N*/ +/*N*/ nFlags = nFlagsP; +/*N*/ fnCreate = fnCreateFnc; +/*N*/ nId = nFactoryId; +/*N*/ // pIniMgr = 0; +/*N*/ pShortName = pName; +/*N*/ pImpl->pFilterContainer = new SfxFactoryFilterContainer( +/*N*/ String::CreateFromAscii( pName ), *this ); +/*N*/ SFX_APP()->GetFilterMatcher().AddContainer( pImpl->pFilterContainer ); +/*N*/ if( !(nFlagsP & SFXOBJECTSHELL_DONTLOADFILTERS) ) +/*N*/ pImpl->pFilterContainer->LoadFilters( String::CreateFromAscii( pName ) ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxObjectFactory::SfxObjectFactory +/*N*/ ( +/*N*/ const SvGlobalName& rName, +/*N*/ const String& rClassName, +/*N*/ CreateInstanceType funcCIT +/*N*/ ) +/*N*/ : SvFactory( rName, rClassName, funcCIT ), +/*N*/ fnCreate( 0 ), +/*N*/ nId( 0 ), +/*N*/ // pIniMgr( 0 ), +/*N*/ pShortName( 0 ), +/*N*/ pImpl( new SfxObjectFactory_Impl ) +/*N*/ { +/*N*/ DBG_CTOR(SfxObjectFactory, 0); +/*N*/ +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ RegisterObjectFactory_Impl(*this); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxObjectFactory::~SfxObjectFactory() +/*N*/ { +/*N*/ DBG_DTOR(SfxObjectFactory, 0); +/*N*/ +/*N*/ const sal_uInt16 nCount = pImpl->aFilterArr.Count(); +/*N*/ for ( sal_uInt16 i = 0; i < nCount; ++i ) +/*?*/ delete pImpl->aFilterArr[i]; +/*N*/ delete pImpl; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectFactory::RemoveAll_Impl() +/*N*/ { +/*N*/ for( USHORT n=0; n<pObjFac->Count(); ) +/*N*/ { +/*N*/ SfxObjectFactoryPtr pFac = pObjFac->GetObject(n); +/*N*/ pObjFac->Remove( n ); +/*N*/ delete pFac; +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +/*?*/ void SfxObjectFactory::ClearAll_Impl() +/*?*/ { +/*?*/ for( USHORT n=0; n<pObjFac->Count(); n++ ) +/*?*/ { +/*?*/ // Clear accelerator manager as it uses the same global SfxMacroConfig object as +/*?*/ // the application class does. This can lead to problems by using a newly created +/*?*/ // SfxMacroConfig object that doesn't have any macros inside => an assertion occur! +/*?*/ SfxObjectFactoryPtr pFac = pObjFac->GetObject(n); +/*?*/ pFac->pImpl->ClearAccMgr(); +/*?*/ } +/*?*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectFactory::SetModule_Impl( SfxModule *pMod ) +/*N*/ { +/*N*/ pImpl->pModule = pMod; +/*N*/ } + +/*?*/ const SfxObjectFactory* SfxObjectFactory::GetFactory( const String& rFactoryURL ) +/*?*/ { // #dochnoetig# DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*N*/ const SfxObjectFactory* pFactory = 0; +/*N*/ String aFact( rFactoryURL ); +/*N*/ String aPrefix( DEFINE_CONST_UNICODE( "private:factory/" ) ); +/*N*/ if ( aPrefix.Len() == aFact.Match( aPrefix ) ) +/*N*/ // Aufruf m"oglich mit z.B. "swriter" oder "private:factory/swriter" +/*N*/ aFact.Erase( 0, aPrefix.Len() ); +/*N*/ sal_uInt16 nPos = aFact.Search( '?' ); +/*N*/ +/*N*/ // Etwaige Parameter abschneiden +/*N*/ aFact.Erase( nPos, aFact.Len() ); +/*N*/ +/*N*/ SfxApplication *pApp = SFX_APP(); +/*N*/ +/*N*/ // "swriter4" durch "swriter" ersetzen, zum Vergleichen uppercase verwenden +/*N*/ WildCard aSearchedFac( aFact.EraseAllChars('4').ToUpperAscii() ); +/*N*/ for( sal_uInt16 n = GetObjectFactoryCount_Impl(); !pFactory && n--; ) +/*N*/ { +/*N*/ pFactory = &GetObjectFactory_Impl( n ); +/*N*/ String aCompareTo = String::CreateFromAscii( pFactory->GetShortName() ); +/*N*/ aCompareTo.ToUpperAscii(); +/*N*/ if( !aSearchedFac.Matches( aCompareTo ) ) +/*N*/ pFactory = 0; +/*N*/ } +/*N*/ +/*N*/ return pFactory; +/*?*/ } + +/*N*/ void SfxObjectFactory::SetDocumentServiceName( const ::rtl::OUString& rServiceName ) +/*N*/ { +/*N*/ pImpl->aServiceName = rServiceName; +/*N*/ } + +/*N*/ const ::rtl::OUString& SfxObjectFactory::GetDocumentServiceName() const +/*N*/ { +/*N*/ return pImpl->aServiceName; +/*N*/ } + +/*N*/ void SfxObjectFactory::RegisterObjectFactory_Impl( SfxObjectFactory &rFac ) +/*N*/ { +/*N*/ SfxObjectFactory *pFac = &rFac; +/*N*/ GetObjFacArray_Impl().Insert( pFac, GetObjFacArray_Impl().Count() ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ USHORT SfxObjectFactory::GetObjectFactoryCount_Impl() +/*N*/ { +/*N*/ return GetObjFacArray_Impl().Count(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ const SfxObjectFactory &SfxObjectFactory::GetObjectFactory_Impl(USHORT i) +/*N*/ { +/*N*/ return *GetObjFacArray_Impl()[i]; +/*N*/ } + +/*N*/ const SfxObjectFactory& SfxObjectFactory::GetDefaultFactory() +/*N*/ { +/*N*/ const SfxObjectFactory &rFactory = GetObjectFactory_Impl(0); +/*N*/ return rFactory; +/*N*/ } + +/*N*/ SfxObjectFactoryArr_Impl& SfxObjectFactory::GetObjFacArray_Impl() +/*N*/ { +/*N*/ if ( !pObjFac ) +/*N*/ pObjFac = new SfxObjectFactoryArr_Impl; +/*N*/ return *pObjFac; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx new file mode 100644 index 000000000000..85a991d5a0f0 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx @@ -0,0 +1,1927 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "docfile.hxx" + +#include <uno/mapping.hxx> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/ucb/XContent.hpp> + +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> +#include <com/sun/star/ucb/CommandFailedException.hpp> +#include <com/sun/star/ucb/CommandAbortedException.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/ucb/XProgressHandler.hpp> +#include <com/sun/star/ucb/XCommandInfo.hpp> +#include <com/sun/star/util/XArchiver.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XStreamListener.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ucb/InsertCommandArgument.hpp> +#include <com/sun/star/ucb/NameClash.hpp> +#include <com/sun/star/ucb/TransferInfo.hpp> +#include <com/sun/star/ucb/OpenCommandArgument2.hpp> +#include <com/sun/star/ucb/OpenMode.hpp> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <tools/zcodec.hxx> +#include <tools/cachestr.hxx> +#include <tools/urlobj.hxx> +#include <unotools/tempfile.hxx> +#include <comphelper/processfactory.hxx> +#include <unotools/streamhelper.hxx> +#include <unotools/localedatawrapper.hxx> +#include <vcl/msgbox.hxx> +#include <bf_so3/svstor.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/lckbitem.hxx> +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/itemset.hxx> +#include <bf_svtools/intitem.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase1.hxx> + +#define _SVSTDARR_ULONGS +#define _SVSTDARR_STRINGSDTOR +#include <bf_svtools/svstdarr.hxx> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <comphelper/processfactory.hxx> +#include <bf_so3/transbnd.hxx> // SvKeyValueIterator +#include <tools/urlobj.hxx> +#include <tools/inetmime.hxx> +#include <unotools/ucblockbytes.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svtools/asynclink.hxx> +#include <bf_svtools/inettype.hxx> +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/commandenvironment.hxx> +#include <unotools/localfilehelper.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/ucbhelper.hxx> +#include <unotools/progresshandlerwrap.hxx> +#include <ucbhelper/content.hxx> +#include <sot/stg.hxx> + +#include "helper.hxx" +#include "request.hxx" // SFX_ITEMSET_SET +#include "app.hxx" // GetFilterMatcher +#include "appuno.hxx" // LoadTargetFrame +#include "fltfnc.hxx" // SfxFilterMatcher +#include "docfilt.hxx" // SfxFilter +#include "objsh.hxx" // CheckOpenMode +#include "docfac.hxx" // GetFilterContainer +#include "openflag.hxx" // SFX_STREAM_READONLY etc. +#include "sfxsids.hrc" + +#include "xmlversion.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +#define MAX_REDIRECT 5 + +/*N*/ class SfxLockBytesHandler_Impl : public ::utl::UcbLockBytesHandler +/*N*/ { +/*N*/ ULONG m_nAcquireCount; +/*N*/ SfxMedium* m_pMedium; +/*N*/ ::osl::Mutex m_aMutex; +/*N*/ public: +/*N*/ SfxLockBytesHandler_Impl( SfxMedium* pMedium ) +/*N*/ : m_pMedium( pMedium ) +/*N*/ , m_nAcquireCount( 0 ) +/*N*/ {} +/*N*/ +/*N*/ virtual void Handle( ::utl::UcbLockBytesHandler::LoadHandlerItem nWhich, ::utl::UcbLockBytesRef xLockBytes ); +/*N*/ ::osl::Mutex& GetMutex() +/*N*/ { return m_aMutex; } +/*N*/ void ReleaseMedium() +/*N*/ { m_pMedium = NULL; } +/*N*/ }; + +/*?*/ SV_DECL_IMPL_REF( SfxLockBytesHandler_Impl ); + +/*N*/ void SfxLockBytesHandler_Impl::Handle( ::utl::UcbLockBytesHandler::LoadHandlerItem nWhich, ::utl::UcbLockBytesRef xLockBytes ) +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( m_aMutex ); +/*N*/ if ( IsActive() && xLockBytes.Is()&& m_pMedium ) +/*N*/ { +/*N*/ switch( nWhich ) +/*N*/ { +/*N*/ break; +/*N*/ case DATA_AVAILABLE : +/*?*/ m_pMedium->DataAvailable_Impl(); +/*N*/ break; +/*N*/ case DONE : +/*N*/ m_pMedium->Done_Impl( xLockBytes->GetError() ); +/*N*/ break; +/*N*/ case CANCEL : +/*?*/ m_pMedium->Cancel_Impl(); +/*N*/ break; +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ class UcbLockBytesCancellable_Impl : public SfxCancellable +/*N*/ { +/*N*/ ::utl::UcbLockBytesRef xLockBytes; +/*N*/ +/*N*/ public: +/*N*/ UcbLockBytesCancellable_Impl( const ::utl::UcbLockBytesRef& rLockBytes, SfxCancelManager* pManager, const String& rTitle ) +/*N*/ : SfxCancellable( pManager, rTitle ) +/*N*/ , xLockBytes( rLockBytes ) +/*N*/ {} + +/*N*/ virtual void Cancel(); +/*N*/ }; + +/*N*/ void UcbLockBytesCancellable_Impl::Cancel() +/*N*/ { +/*N*/ xLockBytes->Cancel(); +/*N*/ } + +/*N*/ class SfxMediumHandler_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionHandler > +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInter; +/*N*/ +/*N*/ public: +/*N*/ virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest ) +/*N*/ throw( ::com::sun::star::uno::RuntimeException ); +/*N*/ +/*N*/ SfxMediumHandler_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > xInteraction ) +/*N*/ : m_xInter( xInteraction ) +/*N*/ {} +/*N*/ +/*N*/ ~SfxMediumHandler_Impl(); +/*N*/ }; + +/*N*/ SfxMediumHandler_Impl::~SfxMediumHandler_Impl() +/*N*/ { +/*N*/ } + +/*N*/ void SAL_CALL SfxMediumHandler_Impl::handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest ) +/*N*/ throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*?*/ String ConvertDateTime_Impl(const SfxStamp &rTime, const LocaleDataWrapper& rWrapper); + +//---------------------------------------------------------------- +/*N*/ SfxPoolCancelManager::SfxPoolCancelManager( SfxCancelManager* pParent, const String& rName ) +/*N*/ : SfxCancelManager( pParent ), +/*N*/ SfxCancellable( pParent ? pParent : this, rName ), +/*N*/ wParent( pParent ) +/*N*/ { +/*N*/ if( pParent ) +/*N*/ { +/*N*/ StartListening( *this ); +/*N*/ SetManager( 0 ); +/*N*/ } +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ SfxPoolCancelManager::~SfxPoolCancelManager() +/*N*/ { +/*N*/ for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) +/*N*/ { +/*N*/ // nicht an Parent uebernehmen! +/*?*/ SfxCancellable* pCbl = GetCancellable( nPos ); +/*?*/ if ( pCbl ) +/*?*/ pCbl->SetManager( 0 ); +/*N*/ } +/*N*/ } + + +//---------------------------------------------------------------- +/*N*/ void SfxPoolCancelManager::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +/*N*/ { +/*N*/ if( !GetCancellableCount() ) SetManager( 0 ); +/*N*/ else if( !GetManager() ) +/*N*/ { +/*N*/ if( !wParent.Is() ) wParent = SFX_APP()->GetCancelManager(); +/*N*/ SetManager( wParent ); +/*N*/ } +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ void SfxPoolCancelManager::Cancel() +/*N*/ { +/*N*/ SfxPoolCancelManagerRef xThis = this; +/*N*/ for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) +/*N*/ { +/*?*/ SfxCancellable* pCbl = GetCancellable( nPos ); +/*?*/ // Wenn wir nicht im Button stehen +/*?*/ if( pCbl && pCbl != this ) +/*?*/ pCbl->Cancel(); +/*?*/ if( GetCancellableCount() < nPos ) +/*?*/ nPos = GetCancellableCount(); +/*N*/ } +/*N*/ } + +//---------------------------------------------------------------- +/*?*/ class SfxMedium_Impl : public SvCompatWeakBase +/*?*/ { +/*?*/ public: +/*?*/ ::ucbhelper::Content aContent; +/*?*/ String aBaseURL; +/*?*/ sal_Bool bUpdatePickList : 1; +/*?*/ sal_Bool bIsTemp : 1; +/*?*/ sal_Bool bUsesCache : 1; +/*?*/ sal_Bool bForceSynchron : 1; +/*?*/ sal_Bool bDontCreateCancellable : 1; +/*?*/ sal_Bool bDownloadDone : 1; +/*?*/ sal_Bool bDontCallDoneLinkOnSharingError : 1; +/*?*/ sal_Bool bStreamReady: 1; +/*?*/ sal_Bool bIsStorage: 1; +/*?*/ sal_Bool bUseInteractionHandler: 1; +/*?*/ sal_Bool bAllowDefaultIntHdl: 1; +/*?*/ sal_Bool bIsDiskSpannedJAR: 1; +/*?*/ sal_Bool bIsCharsetInitialized: 1; +/*?*/ +/*?*/ sal_uInt16 nPrio; +/*?*/ +/*?*/ SfxPoolCancelManagerRef xCancelManager; +/*?*/ UcbLockBytesCancellable_Impl* pCancellable; +/*?*/ SfxMedium* pAntiImpl; +/*?*/ +/*?*/ long nFileVersion; +/*?*/ +/*?*/ const SfxFilter* pOrigFilter; +/*?*/ String aOrigURL; +/*?*/ String aPreRedirectionURL; +/*?*/ String aReferer; +/*?*/ DateTime aExpireTime; +/*?*/ SvKeyValueIteratorRef xAttributes; +/*?*/ SvRefBaseRef xLoadRef; +/*?*/ + AsynchronLink aDoneLink; + AsynchronLink aAvailableLink; +/*?*/ SfxLockBytesHandler_ImplRef aHandler; +/*?*/ +/*?*/ SfxVersionTableDtor* pVersions; +/*?*/ ::utl::TempFile* pTempDir; +/*?*/ ::utl::TempFile* pTempFile; +/*?*/ +/*?*/ Reference < XInputStream > xInputStream; +/*?*/ ::utl::UcbLockBytesRef xLockBytes; +/*?*/ +/*?*/ sal_uInt32 nLastStorageError; +/*?*/ ::rtl::OUString aCharset; +/*?*/ +/*?*/ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > xInteraction; +/*?*/ +/*?*/ sal_Bool m_bRemoveBackup; +/*?*/ ::rtl::OUString m_aBackupURL; +/*?*/ +/*?*/ SfxPoolCancelManager* GetCancelManager(); +/*?*/ +/*?*/ SfxMedium_Impl( SfxMedium* pAntiImplP ); +/*?*/ ~SfxMedium_Impl(); +/*?*/ }; + +/*N*/ void SfxMedium::Done_Impl( ErrCode nError ) +/*N*/ { +/*N*/ DELETEZ( pImp->pCancellable ); +/*N*/ pImp->bDownloadDone = sal_True; +/*N*/ SetError( nError ); +/*N*/ if ( pImp->xLockBytes.Is() ) +/*N*/ pImp->xInputStream = pImp->xLockBytes->getInputStream(); +/*N*/ +/*N*/ if ( ( !nError || !pImp->bDontCallDoneLinkOnSharingError ) && ( pImp->bStreamReady || !pInStream ) ) +/*N*/ { +/*N*/ pImp->aDoneLink.ClearPendingCall(); +/*N*/ pImp->aDoneLink.Call( (void*) nError ); +/*N*/ } +/*N*/ } + +/*N*/ void SfxMedium::DataAvailable_Impl() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ void SfxMedium::Cancel_Impl() +/*N*/ { +/*N*/ SetError( ERRCODE_IO_GENERAL ); +/*N*/ } + +/*N*/ SfxPoolCancelManager* SfxMedium_Impl::GetCancelManager() +/*N*/ { +/*N*/ if( !xCancelManager.Is() ) +/*N*/ { +/*N*/ if( !bDontCreateCancellable ) +/*N*/ xCancelManager = new SfxPoolCancelManager( +/*N*/ SFX_APP()->GetCancelManager(), +/*N*/ pAntiImpl->GetURLObject().GetURLNoPass() ); +/*N*/ else +/*?*/ xCancelManager = new SfxPoolCancelManager( +/*?*/ 0, pAntiImpl->GetURLObject().GetURLNoPass() ); +/*N*/ } +/*N*/ return xCancelManager; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) +/*N*/ : +/*N*/ SvCompatWeakBase( pAntiImplP ), +/*N*/ bUpdatePickList(sal_True), bIsTemp( sal_False ), pOrigFilter( 0 ), +/*N*/ bUsesCache(sal_True), pCancellable( 0 ), +/*N*/ nPrio( 99 ), aExpireTime( Date() + 10, Time() ), +/*N*/ bForceSynchron( sal_False ), bStreamReady( sal_False ), bIsStorage( sal_False ), +/*N*/ pAntiImpl( pAntiImplP ), +/*N*/ bDontCreateCancellable( sal_False ), pTempDir( NULL ), bIsDiskSpannedJAR( sal_False ), +/*N*/ bDownloadDone( sal_True ), bDontCallDoneLinkOnSharingError( sal_False ),nFileVersion( 0 ), +/*N*/ pTempFile( NULL ), +/*N*/ nLastStorageError( 0 ), +/*N*/ bIsCharsetInitialized( sal_False ), +/*N*/ bUseInteractionHandler( sal_True ), +/*N*/ bAllowDefaultIntHdl( sal_False ), +/*N*/ m_bRemoveBackup( sal_False ) +/*N*/ { +/*N*/ aHandler = new SfxLockBytesHandler_Impl( pAntiImpl ); +/*N*/ aDoneLink.CreateMutex(); +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SfxMedium_Impl::~SfxMedium_Impl() +/*N*/ { +/*N*/ delete pCancellable; +/*N*/ +/*N*/ if ( aHandler.Is() ) +/*N*/ aHandler->Activate( sal_False ); +/*N*/ +/*N*/ aDoneLink.ClearPendingCall(); +/*N*/ aAvailableLink.ClearPendingCall(); +/*N*/ +/*N*/ delete pVersions; +/*N*/ +/*N*/ if ( pTempFile ) +/*N*/ delete pTempFile; +/*N*/ +/*N*/ if ( pTempDir ) +/*?*/ delete pTempDir; +/*N*/ } + +//================================================================ + +/*?*/ #define IMPL_CTOR() \ +/*?*/ eError( SVSTREAM_OK ), \ +/*?*/ \ +/*?*/ bDirect( sal_False ), \ +/*?*/ bTriedStorage( sal_False ), \ +/*?*/ bSetFilter( sal_False ), \ +/*?*/ \ +/*?*/ nStorOpenMode( SFX_STREAM_READWRITE ), \ +/*?*/ pInStream(0), \ +/*?*/ pOutStream( 0 ) + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::ResetError() +/*N*/ { +/*N*/ eError = SVSTREAM_OK; +/*N*/ if( aStorage.Is() ) +/*N*/ aStorage->ResetError(); +/*N*/ if( pInStream ) +/*N*/ pInStream->ResetError(); +/*N*/ if( pOutStream ) +/*?*/ pOutStream->ResetError(); +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_uInt32 SfxMedium::GetLastStorageCreationState() +/*N*/ { +/*N*/ return pImp->nLastStorageError; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_uInt32 SfxMedium::GetErrorCode() const +/*N*/ { +/*N*/ sal_uInt32 lError=eError; +/*N*/ if(!lError && pInStream) +/*N*/ lError=pInStream->GetErrorCode(); +/*N*/ if(!lError && pOutStream) +/*?*/ lError=pOutStream->GetErrorCode(); +/*N*/ if(!lError && aStorage.Is()) +/*N*/ lError=aStorage->GetErrorCode(); +/*N*/ return lError; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ long SfxMedium::GetFileVersion() const +/*N*/ { +/*N*/ if ( !pImp->nFileVersion && pFilter ) +/*N*/ return pFilter->GetVersion(); +/*N*/ else +/*?*/ return pImp->nFileVersion; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ Reference < XContent > SfxMedium::GetContent() const +/*N*/ { +/*N*/ if ( !pImp->aContent.get().is() ) +/*N*/ { +/*N*/ Reference < ::com::sun::star::ucb::XContent > xContent; +/*N*/ Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; +/*N*/ SFX_ITEMSET_ARG( pSet, pItem, SfxUnoAnyItem, SID_CONTENT, sal_False); +/*N*/ if ( pItem ) +/*?*/ pItem->GetValue() >>= xContent; +/*N*/ +/*N*/ if ( xContent.is() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*?*/ pImp->aContent = ::ucbhelper::Content( xContent, xEnv ); +/*N*/ } +/*N*/ catch ( Exception& ) +/*N*/ { +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ String aURL; +/*N*/ if ( aName.Len() ) +/*N*/ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ); +/*N*/ else if ( aLogicName.Len() ) +/*N*/ aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ if ( aURL.Len() ) +/*N*/ ::ucbhelper::Content::create( aURL, xEnv, pImp->aContent ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pImp->aContent.get(); +/*N*/ } + +/*N*/ const String& SfxMedium::GetBaseURL() +/*N*/ { +/*N*/ if ( !pImp->aBaseURL.Len() && GetContent().is() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI" )) ); +/*N*/ ::rtl::OUString aStr; +/*N*/ if ( ( aAny >>= aStr ) && aStr.getLength() ) +/*N*/ pImp->aBaseURL = aStr; +/*N*/ } +/*N*/ catch ( ::com::sun::star::uno::Exception& ) +/*N*/ { +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( !pImp->aBaseURL.Len() ) +/*N*/ pImp->aBaseURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ return pImp->aBaseURL; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SvStream* SfxMedium::GetInStream() +/*N*/ { +/*N*/ if ( pInStream ) +/*N*/ return pInStream; +/*N*/ +/*N*/ if ( pImp->pTempFile || pImp->pTempDir ) +/*N*/ { +/*?*/ pInStream = new SvFileStream( aName, nStorOpenMode ); +/*?*/ +/*?*/ eError = pInStream->GetError(); +/*?*/ +/*?*/ if( !eError && (nStorOpenMode & STREAM_WRITE) +/*?*/ && ! pInStream->IsWritable() ) +/*?*/ { +/*?*/ eError = ERRCODE_IO_ACCESSDENIED; +/*?*/ delete pInStream; +/*?*/ pInStream = NULL; +/*?*/ } +/*?*/ else +/*?*/ return pInStream; +/*N*/ } +/*N*/ +/*N*/ GetMedium_Impl(); +/*N*/ +/*N*/ if ( !pInStream && eError == ERRCODE_IO_PENDING ) +/*?*/ eError = SVSTREAM_OK; +/*N*/ +/*N*/ return pInStream; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::CloseInStream() +/*N*/ { +/*N*/ CloseInStream_Impl(); +/*N*/ } + +/*N*/ void SfxMedium::CloseInStream_Impl() +/*N*/ { +/*N*/ // if there is a storage based on the InStream, we have to +/*N*/ // close the storage, too, because otherwise the storage +/*N*/ // would use an invalid ( deleted ) stream. +/*N*/ if ( pInStream && aStorage.Is() ) +/*N*/ { +/*?*/ const SvStream *pStorage = aStorage->GetSvStream(); +/*?*/ if ( pStorage == pInStream ) +/*?*/ { +/*?*/ CloseStorage(); +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ DELETEZ( pInStream ); +/*N*/ pImp->xInputStream = Reference < XInputStream >(); +/*N*/ pImp->xLockBytes.Clear(); +/*N*/ if ( pSet ) +/*N*/ pSet->ClearItem( SID_INPUTSTREAM ); +/*N*/ +/*N*/ DELETEZ( pImp->pCancellable ); +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SvStream* SfxMedium::GetOutStream() +/*N*/ { +/*N*/ if ( !pOutStream ) +/*N*/ { +/*N*/ // Create a temp. file if there is none because we always +/*N*/ // need one. +/*N*/ if ( !pImp->pTempFile ) +/*?*/ CreateTempFile(); +/*N*/ +/*N*/ if ( pImp->pTempFile ) +/*N*/ { +/*N*/ pOutStream = new SvFileStream( aName, STREAM_STD_READWRITE ); +/*N*/ CloseStorage(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pOutStream; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_Bool SfxMedium::CloseOutStream() +/*N*/ { +/*N*/ CloseOutStream_Impl(); +/*N*/ return sal_True; +/*N*/ } + +/*N*/ sal_Bool SfxMedium::CloseOutStream_Impl() +/*N*/ { +/*N*/ if ( pOutStream ) +/*N*/ { +/*N*/ // if there is a storage based on the OutStream, we have to +/*N*/ // close the storage, too, because otherwise the storage +/*N*/ // would use an invalid ( deleted ) stream. +/*N*/ if ( aStorage.Is() ) +/*N*/ { +/*?*/ const SvStream *pStorage = aStorage->GetSvStream(); +/*?*/ if ( pStorage == pOutStream ) +/*?*/ CloseStorage(); +/*N*/ } +/*N*/ +/*N*/ delete pOutStream; +/*N*/ pOutStream = NULL; +/*N*/ } +/*N*/ +/*N*/ return sal_True; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ const String& SfxMedium::GetPhysicalName() const +/*N*/ { +/*N*/ if ( !aName.Len() && aLogicName.Len() ) +/*N*/ (( SfxMedium*)this)->CreateFileStream(); +/*N*/ +/*N*/ // return the name then +/*N*/ return aName; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::CreateFileStream() +/*N*/ { +/*N*/ ForceSynchronStream_Impl( TRUE ); +/*N*/ GetInStream(); +/*N*/ if( pInStream ) +/*N*/ { +/*N*/ if ( !pImp->pTempFile ) +/*N*/ CreateTempFile(); +/*N*/ pImp->bIsTemp = sal_True; +/*N*/ CloseInStream_Impl(); +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_Bool SfxMedium::Commit() +/*N*/ { +/*N*/ if( aStorage.Is() ) +/*N*/ { +/*N*/ // StorageStream immer direkt +/*N*/ if( !aStorage->Commit() ) +/*?*/ eError = aStorage->GetError(); +/*N*/ } +/*N*/ else if( pOutStream ) +/*?*/ pOutStream->Flush(); +/*N*/ else if( pInStream ) +/*?*/ pInStream->Flush(); +/*N*/ +/*N*/ if ( ( GetError() == SVSTREAM_OK ) && pImp->pTempFile ) +/*N*/ Transfer_Impl(); +/*N*/ +/*N*/ ClearBackup_Impl(); +/*N*/ +/*N*/ return GetError() == SVSTREAM_OK; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_Bool SfxMedium::IsStorage() +/*N*/ { +/*N*/ if ( aStorage.Is() ) +/*?*/ return TRUE; +/*N*/ +/*N*/ if ( bTriedStorage ) +/*?*/ return pImp->bIsStorage; +/*N*/ +/*N*/ if ( pImp->pTempFile ) +/*N*/ { +/*?*/ String aURL; +#ifdef DBG_UTIL +/*?*/ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ) ) +/*?*/ DBG_ERROR("Physical name not convertable!"); +#endif +/*?*/ pImp->bIsStorage = SotStorage::IsStorageFile( aURL ); +/*?*/ if ( !pImp->bIsStorage ) +/*?*/ bTriedStorage = TRUE; +/*N*/ } +/*N*/ else if ( GetInStream() ) +/*N*/ { +/*?*/ pImp->bIsStorage = SotStorage::IsStorageFile( pInStream ); +/*?*/ if ( !pInStream->GetError() && !pImp->bIsStorage ) +/*?*/ bTriedStorage = TRUE; +/*N*/ } +/*N*/ +/*N*/ return pImp->bIsStorage; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ sal_Bool SfxMedium::TryStorage() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*N*/ } + + +//------------------------------------------------------------------ +/*N*/ SvStorage* SfxMedium::GetOutputStorage( BOOL bUCBStorage ) +/*N*/ { +/*N*/ // if the medium was constructed with a SvStorage: use this one, not a temp. storage +/*N*/ if ( aStorage.Is() && !aLogicName.Len() ) +/*N*/ return aStorage; +/*N*/ +/*N*/ if ( !pImp->pTempFile ) +/*N*/ CreateTempFile(); +/*N*/ return GetStorage_Impl( bUCBStorage ); +/*N*/ } + +/*N*/ SvStorage* SfxMedium::GetStorage() +/*N*/ { +/*N*/ return GetStorage_Impl( pFilter && SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion() ); +/*N*/ } + +/*N*/ SvStorage* SfxMedium::GetStorage_Impl( BOOL bUCBStorage ) +/*N*/ { +/*N*/ if ( aStorage.Is() || bTriedStorage ) +/*N*/ return aStorage; +/*N*/ +/*N*/ String aStorageName; +/*N*/ if ( pImp->pTempFile || pImp->pTempDir ) +/*N*/ { +/*N*/ // open storage with the URL of the tempfile +/*N*/ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aStorageName ) ) +/*N*/ { +/*?*/ DBG_ERROR("Physical name not convertable!"); +/*N*/ } +/*N*/ CloseOutStream(); +/*N*/ aStorage = new SvStorage( bUCBStorage, aStorageName, nStorOpenMode, bDirect ? 0 : STORAGE_TRANSACTED ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if ( aName.Len() ) +/*N*/ { +/*N*/ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aStorageName ) ) +/*N*/ { +/*?*/ DBG_ERROR("Physical name not convertable!"); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ aStorageName = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); +/*N*/ +/*N*/ GetInStream(); +/*N*/ if ( pInStream ) +/*N*/ { +/*?*/ pInStream->GetLockBytes()->SetSynchronMode( sal_True ); +/*?*/ if( UCBStorage::IsDiskSpannedFile( pInStream ) ) +/*?*/ { +/*?*/ // packed remote files can't be opened outside the storage, so they must be reopened +/*?*/ // inside the storage even if it is expensive +/*?*/ pImp->bIsDiskSpannedJAR = TRUE; +/*?*/ CloseInStream(); +/*?*/ aStorage = new SvStorage( TRUE, aStorageName, nStorOpenMode, bDirect ? 0 : STORAGE_TRANSACTED ); +/*?*/ SfxFilterFlags nMust = SFX_FILTER_IMPORT, nDont = SFX_FILTER_NOTINSTALLED | SFX_FILTER_STARONEFILTER; +/*?*/ SetFilter( SFX_APP()->GetFilterMatcher().GetFilter4ClipBoardId( aStorage->GetFormat(), nMust, nDont ) ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // download the stream ( or at least start the download ) +/*N*/ if ( !pImp->aDoneLink.IsSet() ) +/*N*/ DownLoad(); +/*N*/ +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False); +/*N*/ if ( pItem && pItem->GetValue() ) +/*N*/ { +/*N*/ // CreateTempFile(); +/*?*/ Reference< ::com::sun::star::ucb::XProgressHandler > xProgressHandler; +/*?*/ Reference< ::com::sun::star::task::XStatusIndicator > xStatusIndicator; +/*?*/ SFX_ITEMSET_ARG( GetItemSet(), pxProgressItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False ); +/*?*/ if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) ) +/*?*/ xProgressHandler = Reference< ::com::sun::star::ucb::XProgressHandler >( +/*?*/ new ::utl::ProgressHandlerWrap( xStatusIndicator ) ); +/*?*/ +/*?*/ INetURLObject aObj( aName ); +/*?*/ if ( aObj.GetProtocol() == INET_PROT_NOT_VALID ) +/*?*/ { +/*?*/ String aURL; +/*?*/ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ); +/*?*/ aObj.SetURL( aURL ); +/*?*/ } +/*?*/ +/*?*/ UCBStorage* pUCBStorage = new UCBStorage( aObj.GetMainURL( INetURLObject::NO_DECODE ), +/*?*/ nStorOpenMode, +/*?*/ bDirect ? 0 : STORAGE_TRANSACTED, +/*?*/ sal_True, +/*?*/ sal_True, +/*?*/ xProgressHandler ); +/*?*/ +/*?*/ aStorage = new SvStorage( pUCBStorage ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( SotStorage::IsStorageFile( pInStream ) ) +/*N*/ { +/*N*/ /* if ( IsReadOnly() && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) + { + CreateTempFile(); + aStorage = new SvStorage( bUCBStorage, aName, nStorOpenMode, bDirect ? 0 : STORAGE_TRANSACTED ); + } + else */ +/*N*/ { +/*N*/ if ( bUCBStorage && !UCBStorage::IsStorageFile( pInStream ) ) +/*N*/ return NULL; +/*N*/ +/*N*/ // create a storage on the stream +/*N*/ aStorage = new SvStorage( pInStream, sal_False ); +/*N*/ if ( !aStorage->GetName().Len() ) +/*N*/ aStorage->SetName( aStorageName ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ return NULL; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ return NULL; +/*N*/ } +/*N*/ +/*N*/ if( ( pImp->nLastStorageError = GetError() ) != SVSTREAM_OK ) +/*N*/ { +/*N*/ aStorage.Clear(); +/*N*/ if ( pInStream ) +/*N*/ pInStream->Seek(0); +/*N*/ return NULL; +/*N*/ } +/*N*/ +/*N*/ bTriedStorage = sal_True; +/*N*/ +/*N*/ if ( aStorage->GetError() == SVSTREAM_OK ) +/*N*/ GetVersionList(); +/*N*/ +/*N*/ // ???? wird das noch gebraucht? +/*N*/ // GetMedium_Impl(); +/*N*/ // if ( !aStorage.Is() ) +/*N*/ // CreateFileStream(); +/*N*/ +/*N*/ SFX_ITEMSET_ARG( pSet, pVersion, SfxInt16Item, SID_VERSION, sal_False); +/*N*/ +/*N*/ BOOL bResetStorage = FALSE; +/*N*/ if ( pVersion && pVersion->GetValue() ) +/*N*/ { +/*N*/ // Alle verf"ugbaren Versionen einlesen +/*N*/ if ( pImp->pVersions ) +/*N*/ { +/*?*/ // Die zum Kommentar passende Version suchen +/*?*/ // Die Versionen sind von 1 an durchnumeriert, mit negativen +/*?*/ // Versionsnummern werden die Versionen von der aktuellen aus +/*?*/ // r"uckw"arts gez"ahlt +/*?*/ short nVersion = pVersion ? pVersion->GetValue() : 0; +/*?*/ if ( nVersion<0 ) +/*?*/ nVersion = ( (short) pImp->pVersions->Count() ) + nVersion; +/*?*/ else if ( nVersion ) +/*?*/ nVersion--; +/*?*/ +/*?*/ SfxVersionInfo* pInfo = nVersion>=0 ? pImp->pVersions->GetObject( nVersion ) : NULL; +/*?*/ if ( pInfo ) +/*?*/ { +/*?*/ String aVersionStream = pInfo->aName; +/*?*/ +/*?*/ // SubStorage f"ur alle Versionen "offnen +/*?*/ SvStorageRef aSub = +/*?*/ aStorage->OpenStorage( DEFINE_CONST_UNICODE( "Versions" ), SFX_STREAM_READONLY | STREAM_NOCREATE ); +/*?*/ +/*?*/ DBG_ASSERT( aSub.Is() && !aSub->GetError(), "Versionsliste, aber keine Versionen!" ); +/*?*/ +/*?*/ // Dort ist die Version als gepackter Stream gespeichert +/*?*/ SvStorageStreamRef aStream = +/*?*/ aSub->OpenStream( aVersionStream, SFX_STREAM_READONLY ); +/*?*/ +/*?*/ if ( aStream.Is() && aStream->GetError() == SVSTREAM_OK ) +/*?*/ { +/*?*/ // Stream ins TempDir auspacken +/*?*/ ::utl::TempFile aTempFile; +/*?*/ String aTmpName = aTempFile.GetURL(); +/*?*/ SvFileStream aTmpStream( aTmpName, SFX_STREAM_READWRITE ); +/*?*/ +/*?*/ // The new file format uses UCB storages instead of OLE storages. +/*?*/ // These storages aren't compressed. +/*?*/ if ( !aSub->IsOLEStorage() ) +/*?*/ { +/*?*/ *aStream >> aTmpStream; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ ZCodec aCodec; +/*?*/ aCodec.BeginCompression(); +/*?*/ aCodec.Decompress( *aStream, aTmpStream ); +/*?*/ aCodec.EndCompression(); +/*?*/ } +/*?*/ aTmpStream.Close(); +/*?*/ +/*?*/ // Datei als Storage "offnen +/*?*/ nStorOpenMode = SFX_STREAM_READONLY; +/*?*/ aStorage = new SvStorage( aTmpName, nStorOpenMode ); +/*?*/ +/*?*/ String aTemp; +/*?*/ ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpName, aTemp ); +/*?*/ SetPhysicalName_Impl( aTemp ); +/*?*/ +/*?*/ pImp->bIsTemp = sal_True; +/*?*/ GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); +/*?*/ DELETEZ( pImp->pVersions ); +/*?*/ } +/*?*/ else +/*?*/ bResetStorage = TRUE; +/*?*/ } +/*?*/ else +/*?*/ bResetStorage = TRUE; +/*?*/ } +/*?*/ else +/*?*/ bResetStorage = TRUE; +/*N*/ } +/*N*/ +/*N*/ if ( aStorage.Is() ) +/*N*/ { +/*N*/ if( ( pImp->nLastStorageError = aStorage->GetError() ) != SVSTREAM_OK ) +/*N*/ bResetStorage = TRUE; +/*N*/ else if ( GetFilter() ) +/*N*/ aStorage->SetVersion( GetFilter()->GetVersion() ); +/*N*/ } +/*N*/ +/*N*/ if ( bResetStorage ) +/*N*/ { +/*?*/ aStorage.Clear(); +/*?*/ if ( pInStream ) +/*?*/ pInStream->Seek( 0L ); +/*N*/ } +/*N*/ +/*N*/ pImp->bIsStorage = aStorage.Is(); +/*N*/ return aStorage; +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::CloseStorage() +/*N*/ { +/*N*/ aStorage.Clear(); +/*N*/ bTriedStorage = sal_False; +/*N*/ pImp->bIsStorage = sal_False; +/*N*/ } + +//------------------------------------------------------------------ +/*?*/ void SfxMedium::SetOpenMode( StreamMode nStorOpen, +/*?*/ sal_Bool bDirectP, +/*?*/ sal_Bool bDontClose ) +/*?*/ { +/*?*/ if ( nStorOpenMode != nStorOpen ) +/*?*/ { +/*?*/ nStorOpenMode = nStorOpen; +/*?*/ +/*?*/ if( !bDontClose ) +/*?*/ Close(); +/*?*/ } +/*?*/ +/*?*/ bDirect = bDirectP; +/*?*/ bSetFilter = sal_False; +/*?*/ } + + + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::Transfer_Impl() +/*N*/ { +/*N*/ if( pImp->pTempFile && ( !eError || eError & ERRCODE_WARNING_MASK ) ) +/*N*/ { +/*N*/ Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; +/*N*/ Reference< XOutputStream > rOutStream; +/*N*/ +/*N*/ // in case an output stream is provided from outside and the URL is correct +/*N*/ // commit to the stream +/*N*/ if( aLogicName.CompareToAscii( "private:stream", 14 ) == COMPARE_EQUAL ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, sal_False); +/*N*/ if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) ) +/*N*/ { +/*N*/ // write directly to the stream +/*N*/ Close(); +/*N*/ +/*N*/ INetURLObject aSource( pImp->pTempFile->GetURL() ); +/*N*/ ::ucbhelper::Content aTempCont; +/*N*/ if( ::ucbhelper::Content::create( aSource.GetMainURL( INetURLObject::NO_DECODE ), xEnv, aTempCont ) ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ sal_Int32 nRead; +/*N*/ sal_Int32 nBufferSize = 32767; +/*N*/ Sequence < sal_Int8 > aSequence ( nBufferSize ); +/*N*/ Reference< XInputStream > aTempInput = aTempCont.openStream(); +/*N*/ +/*N*/ do +/*N*/ { +/*N*/ nRead = aTempInput->readBytes ( aSequence, nBufferSize ); +/*N*/ if ( nRead < nBufferSize ) +/*N*/ { +/*N*/ Sequence < sal_Int8 > aTempBuf ( aSequence.getConstArray(), nRead ); +/*N*/ rOutStream->writeBytes ( aTempBuf ); +/*N*/ } +/*N*/ else +/*N*/ rOutStream->writeBytes ( aSequence ); +/*N*/ } +/*N*/ while ( nRead == nBufferSize ); +/*N*/ +/*N*/ // remove temporary file +/*N*/ // pImp->pTempFile->EnableKillingFile( sal_True ); +/*N*/ // delete pImp->pTempFile; +/*N*/ // pImp->pTempFile = NULL; +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ {} +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERROR( "Illegal Output stream parameter!\n" ); +/*N*/ SetError( ERRCODE_IO_GENERAL ); +/*N*/ } +/*N*/ +/*N*/ // free the reference +/*N*/ pSet->ClearItem( SID_OUTPUTSTREAM ); +/*N*/ +/*N*/ return; +/*N*/ } +/*N*/ DBG_BF_ASSERT(0, "STRIP"); return;//STRIP001 +/*?*/ } +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::ClearBackup_Impl() +/*N*/ { +/*N*/ if( pImp->m_bRemoveBackup ) +/*N*/ { +#ifdef DBG_UTIL +/*?*/ if ( pImp->m_aBackupURL.getLength() ) +/*?*/ if ( !::utl::UCBContentHelper::Kill( pImp->m_aBackupURL ) ) +/*?*/ DBG_ERROR("Couldn't remove backup file!"); +#endif +/*?*/ pImp->m_bRemoveBackup = sal_False; +/*N*/ } +/*N*/ +/*N*/ pImp->m_aBackupURL = ::rtl::OUString(); +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ void SfxMedium::GetMedium_Impl() +/*N*/ { +/*N*/ if ( !pInStream ) +/*N*/ { +/*N*/ pImp->bDownloadDone = sal_False; +/*N*/ pImp->bStreamReady = sal_False; +/*N*/ Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +/*N*/ +/*N*/ ::utl::UcbLockBytesHandler* pHandler = pImp->aHandler; +/*N*/ INetProtocol eProt = GetURLObject().GetProtocol(); +/*N*/ if ( eProt != INET_PROT_HTTP && eProt != INET_PROT_FTP || aName.Len() ) +/*N*/ pHandler = NULL; +/*N*/ BOOL bSynchron = pImp->bForceSynchron || ! pImp->aDoneLink.IsSet(); +/*N*/ SFX_ITEMSET_ARG( pSet, pStreamItem, SfxUnoAnyItem, SID_INPUTSTREAM, sal_False); +/*N*/ if ( pStreamItem ) +/*N*/ { +/*N*/ if ( GetContent().is() && !IsReadOnly() ) +/*N*/ { +/*?*/ try +/*?*/ { +/*?*/ Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsReadOnly" )) ); +/*?*/ BOOL bReadonly; +/*?*/ if ( ( aAny >>= bReadonly ) && bReadonly ) +/*?*/ { +/*?*/ GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, sal_True)); +/*?*/ SetOpenMode(SFX_STREAM_READONLY, sal_False); +/*?*/ } +/*?*/ } +/*?*/ catch ( ::com::sun::star::uno::Exception& ) +/*?*/ { +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ Reference < ::com::sun::star::io::XInputStream > xStream; +/*N*/ if ( ( pStreamItem->GetValue() >>= xStream ) && xStream.is() ) +/*N*/ pImp->xLockBytes = ::utl::UcbLockBytes::CreateInputLockBytes( xStream ); +/*N*/ Done_Impl( pImp->xLockBytes.Is() ? pImp->xLockBytes->GetError() : ERRCODE_IO_NOTSUPPORTED ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pItem, SfxBoolItem, SID_DOC_READONLY, sal_False); +/*N*/ BOOL bAllowReadOnlyMode = pItem ? pItem->GetValue() : TRUE; +/*N*/ BOOL bIsWritable = ( nStorOpenMode & STREAM_WRITE ); +/*N*/ +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pPostDataItem, SfxUnoAnyItem, SID_POSTDATA, sal_False); +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pContentTypeItem, SfxStringItem, SID_CONTENT_TYPE, sal_False); +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pRefererItem, SfxStringItem, SID_REFERER, sal_False); +/*N*/ +/*N*/ ::rtl::OUString aReferer; +/*N*/ if ( pRefererItem ) +/*N*/ aReferer = pRefererItem->GetValue(); +/*N*/ +/*N*/ if ( pPostDataItem ) +/*N*/ { +/*?*/ DBG_ASSERT( bAllowReadOnlyMode, "Strange open mode!" ); +/*?*/ bIsWritable = FALSE; +/*?*/ GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, sal_True)); +/*?*/ SetOpenMode(SFX_STREAM_READONLY, sal_False); +/*?*/ +/*?*/ ::rtl::OUString aMimeType; +/*?*/ if ( pContentTypeItem ) +/*?*/ aMimeType = pContentTypeItem->GetValue(); +/*?*/ else +/*?*/ aMimeType = ::rtl::OUString::createFromAscii( "application/x-www-form-urlencoded" ); +/*?*/ +/*?*/ Reference < XInputStream > xPostData; +/*?*/ if ( pPostDataItem ) +/*?*/ { +/*?*/ Any aAny = pPostDataItem->GetValue(); +/*?*/ aAny >>= xPostData; +/*?*/ } +/*?*/ +/*?*/ pImp->xLockBytes = ::utl::UcbLockBytes::CreateLockBytes( +/*?*/ GetContent(), aReferer, aMimeType, xPostData, xInteractionHandler, pHandler ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // no callbacks for opening read/write because we might try readonly later +/*N*/ pImp->bDontCallDoneLinkOnSharingError = ( bIsWritable && bAllowReadOnlyMode ); +/*N*/ if ( pImp->bDontCallDoneLinkOnSharingError ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > aTempHandler = +/*N*/ new SfxMediumHandler_Impl( xInteractionHandler ); +/*N*/ pImp->xLockBytes = ::utl::UcbLockBytes::CreateLockBytes( +/*N*/ GetContent(), Sequence < PropertyValue >(), nStorOpenMode, aTempHandler ); +/*N*/ } +/*N*/ else +/*N*/ pImp->xLockBytes = ::utl::UcbLockBytes::CreateLockBytes( +/*N*/ GetContent(), Sequence < PropertyValue >(), nStorOpenMode, xInteractionHandler, bIsWritable ? NULL : pHandler ); +/*N*/ } +/*N*/ +/*N*/ if ( !pImp->xLockBytes.Is() ) +/*N*/ { +/*N*/ pImp->bDontCallDoneLinkOnSharingError = sal_False; +/*N*/ Done_Impl( ERRCODE_IO_NOTEXISTS ); +/*N*/ } +/*N*/ else if ( pImp->xLockBytes->GetError() == ERRCODE_IO_ACCESSDENIED && bIsWritable && bAllowReadOnlyMode || +/*N*/ pImp->xLockBytes->GetError() == ERRCODE_IO_NOTSUPPORTED && bIsWritable ) +/*N*/ { +/*?*/ if ( pImp->xLockBytes->GetError() == ERRCODE_IO_ACCESSDENIED ) +/*?*/ { +/*?*/ GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, sal_True)); +/*?*/ SetOpenMode(SFX_STREAM_READONLY, sal_False); +/*?*/ } +/*?*/ +/*?*/ ResetError(); +/*?*/ pImp->bDownloadDone = sal_False; +/*?*/ pImp->bDontCallDoneLinkOnSharingError = sal_False; +/*?*/ pImp->xLockBytes = ::utl::UcbLockBytes::CreateLockBytes( +/*?*/ GetContent(), Sequence < PropertyValue >(), SFX_STREAM_READONLY, xInteractionHandler, pHandler ); +/*?*/ +/*?*/ if ( !pHandler && !pImp->bDownloadDone ) +/*?*/ Done_Impl( pImp->xLockBytes->GetError() ); +/*?*/ } +/*?*/ else if ( !pHandler && !pImp->bDownloadDone ) +/*?*/ // opening readwrite is always done synchronously +/*?*/ Done_Impl( pImp->xLockBytes->GetError() ); +/*N*/ } +/*N*/ +/*N*/ if ( pImp->xLockBytes.Is() && !GetError() ) +/*N*/ { +/*N*/ if ( bSynchron ) +/*N*/ pImp->xLockBytes->SetSynchronMode( sal_True ); +/*N*/ if ( !pImp->bDownloadDone ) +/*?*/ pImp->pCancellable = new UcbLockBytesCancellable_Impl( pImp->xLockBytes, pImp->GetCancelManager(), +/*?*/ GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ); +/*N*/ pInStream = new SvStream( pImp->xLockBytes ); +/*N*/ pInStream->SetBufferSize( 4096 ); +/*N*/ pImp->bStreamReady = sal_True; +/*N*/ } +/*N*/ } + +/*N*/ // Download completion happened while pInStream was constructed +/*N*/ if ( pImp->bDownloadDone ) +/*N*/ Done_Impl( GetError() ); +/*N*/ +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SfxPoolCancelManager* SfxMedium::GetCancelManager_Impl() const +/*N*/ { +/*N*/ return pImp->GetCancelManager(); +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::SetCancelManager_Impl( SfxPoolCancelManager* pMgr ) +/*N*/ { +/*N*/ pImp->xCancelManager = pMgr; +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ void SfxMedium::CancelTransfers() +/*N*/ { +/*N*/ if( pImp->xCancelManager.Is() ) +/*N*/ pImp->xCancelManager->Cancel(); +/*N*/ } + +/*N*/ sal_Bool SfxMedium::IsRemote() +/*N*/ { +/*N*/ return bRemote; +/*N*/ } + +//------------------------------------------------------------------ + +/*N*/ void SfxMedium::SetUpdatePickList(sal_Bool bVal) +/*N*/ { +/*N*/ if(!pImp) +/*?*/ pImp = new SfxMedium_Impl( this ); +/*N*/ pImp->bUpdatePickList = bVal; +/*N*/ } +//------------------------------------------------------------------ + +/*N*/ void SfxMedium::SetDoneLink( const Link& rLink ) +/*N*/ { +/*N*/ pImp->aDoneLink = rLink; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetDataAvailableLink( const Link& rLink ) +/*N*/ { +/*N*/ pImp->aAvailableLink = rLink; +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ void SfxMedium::StartDownload() +/*N*/ { +/*N*/ GetInStream(); +/*N*/ } + +/*N*/ void SfxMedium::DownLoad( const Link& aLink ) +/*N*/ { +/*N*/ SetDoneLink( aLink ); +/*N*/ GetInStream(); +/*N*/ if ( pInStream && !aLink.IsSet() ) +/*N*/ { +/*N*/ while( !pImp->bDownloadDone ) +/*?*/ Application::Yield(); +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ void SfxMedium::Init_Impl() +/* [Beschreibung] + Setzt in den Logischen Namen eine gueltige ::com::sun::star::util::URL (Falls zuvor ein Filename + drin war) und setzt den physikalschen Namen auf den Filenamen, falls + vorhanden. + */ + +/*N*/ { +/*N*/ Reference< XOutputStream > rOutStream; +/*N*/ pImp->pVersions = NULL; +/*N*/ +/*N*/ SFX_ITEMSET_ARG( pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); +/*N*/ if( aLogicName.Len() ) +/*N*/ { +/*N*/ INetURLObject aUrl( aLogicName ); +/*N*/ INetProtocol eProt = aUrl.GetProtocol(); +/*N*/ if ( eProt == INET_PROT_NOT_VALID ) +/*N*/ { +/*?*/ DBG_ERROR ( "Unknown protocol!" ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // try to convert the URL into a physical name - but never change a physical name +/*N*/ // physical name may be set if the logical name is changed after construction +/*N*/ if ( !aName.Len() ) +/*N*/ ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aName ); +/*N*/ else +/*?*/ DBG_ASSERT( pSalvageItem, "Suspicious change of logical name!" ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pSalvageItem && pSalvageItem->GetValue().Len() ) +/*N*/ aLogicName = pSalvageItem->GetValue(); +/*N*/ +/*N*/ // in case output stream is by mistake here +/*N*/ // clear the reference +/*N*/ SFX_ITEMSET_ARG( pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, sal_False); +/*N*/ if( pOutStreamItem +/*N*/ && ( !( pOutStreamItem->GetValue() >>= rOutStream ) +/*N*/ || !aLogicName.CompareToAscii( "private:stream", 14 ) == COMPARE_EQUAL ) ) +/*N*/ { +/*?*/ pSet->ClearItem( SID_OUTPUTSTREAM ); +/*?*/ DBG_ERROR( "Unexpected Output stream parameter!\n" ); +/*N*/ } +/*N*/ +/*N*/ SetIsRemote_Impl(); +/*N*/ } + +//------------------------------------------------------------------ +/*N*/ SfxMedium::SfxMedium() +/*N*/ : IMPL_CTOR(), +/*N*/ bRoot( sal_False ), +/*N*/ pURLObj(0), +/*N*/ +/*N*/ pSet(0), +/*N*/ pImp(new SfxMedium_Impl( this )), +/*N*/ pFilter(0) +/*N*/ { +/*N*/ Init_Impl(); +/*N*/ } +//------------------------------------------------------------------ + +/*N*/ void SfxMedium::UseInteractionHandler( BOOL bUse ) +/*N*/ { +/*N*/ pImp->bAllowDefaultIntHdl = bUse; +/*N*/ } + +//------------------------------------------------------------------ + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > +/*N*/ SfxMedium::GetInteractionHandler() +/*N*/ { +/*N*/ // if interaction isnt allowed explicitly ... return empty reference! +/*N*/ if ( !pImp->bUseInteractionHandler ) +/*?*/ return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >(); +/*N*/ +/*N*/ // search a possible existing handler inside cached item set +/*N*/ if ( pSet ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > xHandler; +/*N*/ SFX_ITEMSET_ARG( pSet, pHandler, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False); +/*N*/ if ( pHandler && (pHandler->GetValue() >>= xHandler) && xHandler.is() ) +/*N*/ return xHandler; +/*N*/ } +/*N*/ +/*N*/ // if default interaction isnt allowed explicitly ... return empty reference! +/*N*/ if ( !pImp->bAllowDefaultIntHdl ) +/*N*/ return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >(); +/*N*/ +/*N*/ // otherwhise return cached default handler ... if it exist. +/*?*/ if ( pImp->xInteraction.is() ) +/*?*/ return pImp->xInteraction; +/*?*/ +/*?*/ // create default handler and cache it! +/*?*/ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*?*/ if ( xFactory.is() ) +/*?*/ { +/*?*/ pImp->xInteraction = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >( xFactory->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), ::com::sun::star::uno::UNO_QUERY ); +/*?*/ return pImp->xInteraction; +/*?*/ } +/*?*/ +/*?*/ return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >(); +/*N*/ } + +//------------------------------------------------------------------ + +/*N*/ void SfxMedium::SetFilter( const SfxObjectFactory& rFact, const String & rFilter ) +/*N*/ { +/*N*/ SetFilter( rFact.GetFilterContainer()->GetFilter(rFilter) ); +/*N*/ } +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetFilter( const SfxFilter* pFilterP, sal_Bool bResetOrig ) +/*N*/ { +/*N*/ pFilter = pFilterP; +/*N*/ pImp->nFileVersion = 0; +/*N*/ } +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::Close() +/*N*/ { +/*N*/ if ( aStorage.Is() ) +/*N*/ { +/*N*/ // don't close the streams if they belong to the +/*N*/ // storage +/*N*/ +/*N*/ const SvStream *pStream = aStorage->GetSvStream(); +/*N*/ if ( pStream && pStream == pInStream ) +/*N*/ { +/*N*/ pInStream = NULL; +/*N*/ pImp->xInputStream = Reference < XInputStream >(); +/*N*/ pImp->xLockBytes.Clear(); +/*N*/ if ( pSet ) +/*N*/ pSet->ClearItem( SID_INPUTSTREAM ); +/*N*/ aStorage->SetDeleteStream( TRUE ); +/*N*/ } +/*N*/ else if ( pStream && pStream == pOutStream ) +/*N*/ { +/*?*/ pOutStream = NULL; +/*?*/ aStorage->SetDeleteStream( TRUE ); +/*N*/ } +/*N*/ +/*N*/ CloseStorage(); +/*N*/ } +/*N*/ +/*N*/ if ( pInStream ) +/*N*/ CloseInStream_Impl(); +/*N*/ +/*N*/ if ( pOutStream ) +/*?*/ CloseOutStream_Impl(); +/*N*/ +/*N*/ if ( pSet ) +/*N*/ pSet->ClearItem( SID_CONTENT ); +/*N*/ +/*N*/ pImp->aContent = ::ucbhelper::Content(); +/*N*/ } + +//------------------------------------------------------------------ + + +/*N*/ void SfxMedium::SetIsRemote_Impl() +/*N*/ { +/*N*/ INetURLObject aObj( GetName() ); +/*N*/ switch( aObj.GetProtocol() ) +/*N*/ { +/*N*/ case INET_PROT_FTP: +/*N*/ case INET_PROT_HTTP: +/*N*/ case INET_PROT_HTTPS: +/*N*/ case INET_PROT_POP3: +/*N*/ case INET_PROT_NEWS: +/*N*/ case INET_PROT_IMAP: +/*N*/ // case INET_PROT_OUT: +/*N*/ case INET_PROT_VIM: +/*N*/ bRemote = TRUE; break; +/*N*/ default: +/*N*/ bRemote = ( GetName().CompareToAscii( "private:msgid", 13 ) == COMPARE_EQUAL ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // Da Dateien, die Remote geschrieben werden zur Uebertragung auch +/*N*/ // gelesen werden koennen muessen +/*N*/ if( bRemote ) +/*N*/ nStorOpenMode |= STREAM_READ; +/*N*/ } + + + + +//---------------------------------------------------------------- +/*N*/ const String& SfxMedium::GetOrigURL() const +/*N*/ { +/*N*/ return !pImp->aOrigURL.Len() ? (String &)aLogicName : pImp->aOrigURL; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetPhysicalName_Impl( const String& rNameP ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//---------------------------------------------------------------- + +//------------------------------------------------------------------ + +//------------------------------------------------------------------ +/*N*/ sal_Bool SfxMedium::IsTemporary() const +/*N*/ { +/*N*/ return pImp->bIsTemp; +/*N*/ } + +//------------------------------------------------------------------ + +/*N*/ void SfxMedium::ReOpen() +/*N*/ { +/*N*/ BOOL bUseInteractionHandler = pImp->bUseInteractionHandler; +/*N*/ pImp->bUseInteractionHandler = FALSE; +/*N*/ DBG_ASSERT( pFilter, "Kein Filter, aber ReOpen!" ); +/*N*/ if( pFilter ) +/*N*/ { +/*N*/ if( pFilter->UsesStorage() ) +/*N*/ GetStorage(); +/*N*/ else +/*N*/ GetInStream(); +/*N*/ } +/*N*/ +/*N*/ pImp->bUseInteractionHandler = bUseInteractionHandler; +/*N*/ } +//------------------------------------------------------------------ +/*N*/ SfxMedium::SfxMedium +/*N*/ ( +/*N*/ const String &rName, StreamMode nOpenMode, sal_Bool bDirectP, +/*N*/ const SfxFilter *pFlt, SfxItemSet *pInSet +/*N*/ ) +/*N*/ : IMPL_CTOR(), +/*N*/ bRoot( sal_False ), +/*N*/ pFilter(pFlt), +/*N*/ pURLObj(0), +/*N*/ pImp(new SfxMedium_Impl( this )), +/*N*/ pSet( pInSet ) +/*N*/ { +/*N*/ aLogicName = rName; +/*N*/ nStorOpenMode = nOpenMode; +/*N*/ bDirect = bDirectP; +/*N*/ Init_Impl(); +/*N*/ } +//------------------------------------------------------------------ + +/*N*/ SfxMedium::SfxMedium( SvStorage *pStorage, sal_Bool bRootP ) +/*N*/ : IMPL_CTOR(), +/*N*/ bRoot( bRootP ), +/*N*/ aStorage(pStorage), +/*N*/ pURLObj(0), +/*N*/ pImp( new SfxMedium_Impl( this )), +/*N*/ pSet(0) +/*N*/ { +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ sal_uInt32 nFormat = pStorage->GetFormat(); +/*N*/ if( !nFormat ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ if( aLogicName.Len() ) +/*N*/ DBG_ERROR( "Unbekanntes StorageFormat, versuche eigenes Format" ); +/*N*/ #endif +/*N*/ pFilter = SfxObjectFactory::GetDefaultFactory().GetFilterContainer()-> +/*N*/ GetFilter( 0 ); +/*N*/ } +/*N*/ else +/*N*/ pFilter = pApp->GetFilterMatcher().GetFilter4ClipBoardId( nFormat, 0, 0 ); +/*N*/ +/*N*/ Init_Impl(); +/*N*/ +/*N*/ if( !pFilter && nFormat ) +/*N*/ { +/*STRIP003*/ pApp->GetFilterMatcher().GetFilter4Content( *this, &pFilter ); // #91292# PowerPoint does not support an OleComp stream, +/*STRIP003*/ if ( !pFilter ) // so GetFilter4ClipBoardId is not able to detect the format, +/*STRIP003*/ { // for such cases we try to get the filter by GetFilter4Content +/*STRIP003*/ DBG_ERROR( "No Filter for storage found!" ); +/*STRIP003*/ pFilter = SfxObjectFactory::GetDefaultFactory().GetFilterContainer()->GetFilter( 0 ); +/*STRIP003*/ } +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------ + +/*N*/ SfxMedium::~SfxMedium() +/*N*/ { +/*N*/ /* Attention + Don't enable CancelTransfers() till you know that the writer/web has changed his asynchronous load + behaviour. Otherwhise may StyleSheets inside a html file will be loaded at the right time. + => further the help will be empty then ... #100490# + */ +/*N*/ //CancelTransfers(); +/*N*/ ::osl::ClearableMutexGuard aGuard( pImp->aHandler->GetMutex() ); +/*N*/ pImp->aHandler->ReleaseMedium(); +/*N*/ aGuard.clear(); +/*N*/ +/*N*/ Close(); +/*N*/ +/*N*/ delete pSet; +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ if( pImp->bIsTemp && aName.Len() ) +/*N*/ { +/*N*/ String aTemp; +/*N*/ if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aTemp )) +/*N*/ DBG_ERROR("Physical name not convertable!"); +/*N*/ +/*N*/ if ( !::utl::UCBContentHelper::Kill( aTemp ) ) +/*N*/ DBG_ERROR("Couldn't remove temporary file!"); +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ pFilter = 0; +/*N*/ +/*N*/ delete pURLObj; +/*N*/ delete pImp; +/*N*/ } +//------------------------------------------------------------------ + +/*N*/ const INetURLObject& SfxMedium::GetURLObject() const +/*N*/ { +/*N*/ if( !pURLObj ) +/*N*/ { +/*N*/ SfxMedium* pThis = const_cast < SfxMedium* > (this); +/*N*/ pThis->pURLObj = new INetURLObject( aLogicName ); +/*N*/ if ( pThis->pURLObj->HasMark() ) +/*N*/ (*pThis->pURLObj) = INetURLObject( aLogicName ).GetURLNoMark(); +/*N*/ } +/*N*/ +/*N*/ return *pURLObj; +/*N*/ } + +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +/*N*/ sal_uInt32 SfxMedium::GetMIMEAndRedirect( String &rName ) +/*N*/ { +/* dv !!!! not needed any longer ? + INetProtocol eProt = GetURLObject().GetProtocol(); + if( eProt == INET_PROT_FTP && SvBinding::ShouldUseFtpProxy( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + Any aAny( UCB_Helper::GetProperty( GetContent(), WID_FLAG_IS_FOLDER ) ); + sal_Bool bIsFolder = FALSE; + if ( ( aAny >>= bIsFolder ) && bIsFolder ) + return ERRCODE_NONE; + } + + GetMedium_Impl(); + if( !eError && pImp->xBinding.Is() ) + { + eError = pImp->xBinding->GetMimeType( rName ); + + // Wir koennen keine Parameter wie CharSets usw. + rName = rName.GetToken( 0, ';' ); + if( !eError ) + { + if( !pImp->aPreRedirectionURL.Len() ) + pImp->aPreRedirectionURL = aLogicName; + SetName( pImp->xBinding->GetRedirectedURL() ); + } + pImp->aExpireTime = pImp->xBinding->GetExpireDateTime(); + } + return eError; +*/ +/*N*/ return 0; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetUsesCache( sal_Bool bUse ) +/*N*/ { +/*N*/ pImp->bUsesCache = bUse; +/*N*/ } +//---------------------------------------------------------------- + +/*N*/ sal_Bool SfxMedium::UsesCache() const +/*N*/ { +/*N*/ return pImp->bUsesCache; +/*N*/ } +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetReferer( const String& rRefer ) +/*N*/ { +/*N*/ pImp->aReferer = rRefer; +/*N*/ } +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetTransferPriority( sal_uInt16 nPrio ) +/*N*/ { +/*N*/ pImp->nPrio = nPrio; +/*N*/ } +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::ForceSynchronStream_Impl( sal_Bool bForce ) +/*N*/ { +/*N*/ if( pInStream ) +/*N*/ { +/*N*/ SvLockBytes* pBytes = pInStream->GetLockBytes(); +/*N*/ if( pBytes ) +/*N*/ pBytes->SetSynchronMode( bForce ); +/*N*/ } +/*N*/ pImp->bForceSynchron = bForce; +/*N*/ } +//---------------------------------------------------------------- +/* Kann der URL ein MIME Type zugeordnent werden? */ +/*N*/ sal_Bool SfxMedium::SupportsMIME_Impl() const +/*N*/ { +/*N*/ INetProtocol eProt = GetURLObject().GetProtocol(); +/*N*/ if( eProt == INET_PROT_HTTPS || eProt == INET_PROT_HTTP ) +/*N*/ return sal_True; +/*N*/ +/*N*/ if( eProt == INET_PROT_NOT_VALID ) +/*N*/ return sal_False; +/*N*/ +/*N*/ if( eProt == INET_PROT_FTP ) +/*N*/ { +/*N*/ try +/*N*/ { +/*?*/ Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")) ); +/*?*/ sal_Bool bIsFolder = FALSE; +/*?*/ if ( ( aAny >>= bIsFolder ) && bIsFolder ) +/*?*/ return SvBinding::ShouldUseFtpProxy( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ); +/*?*/ } +/*?*/ catch ( ::com::sun::star::uno::Exception& ) +/*?*/ { +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ return sal_False; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ SfxItemSet* SfxMedium::GetItemSet() const +/*N*/ { +/*N*/ if( !pSet ) ((SfxMedium*)this)->pSet = +/*N*/ new SfxAllItemSet( SFX_APP()->GetPool() ); +/*N*/ return pSet; +/*N*/ } + +/*N*/ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl() +/*N*/ { +/*N*/ if( !pImp->xAttributes.Is() ) +/*N*/ { +/*N*/ pImp->xAttributes = SvKeyValueIteratorRef( new SvKeyValueIterator ); +/*N*/ +/*N*/ if ( GetContent().is() ) +/*N*/ { +/*?*/ pImp->bIsCharsetInitialized = sal_True; +/*?*/ +/*?*/ try +/*?*/ { +/*?*/ Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ); +/*?*/ ::rtl::OUString aContentType; +/*?*/ aAny >>= aContentType; +/*?*/ +/*?*/ pImp->xAttributes->Append( SvKeyValue( ::rtl::OUString::createFromAscii( "content-type" ), aContentType ) ); +/*?*/ } +/*?*/ catch ( ::com::sun::star::uno::Exception& ) +/*?*/ { +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ return pImp->xAttributes; +/*N*/ } +//---------------------------------------------------------------- + +/*N*/ SvCompatWeakHdl* SfxMedium::GetHdl() +/*N*/ { +/*N*/ return pImp->GetHdl(); +/*N*/ } + +/*N*/ sal_Bool SfxMedium::IsDownloadDone_Impl() +/*N*/ { +/*N*/ return pImp->bDownloadDone; +/*N*/ } + +//---------------------------------------------------------------- + +/*N*/ void SfxMedium::SetDontCreateCancellable( ) +/*N*/ { +/*N*/ pImp->bDontCreateCancellable = sal_True; +/*N*/ } + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SfxMedium::GetInputStream() +/*N*/ { +/*N*/ if ( !pImp->xInputStream.is() ) +/*N*/ { +/*N*/ // if pInStream is already opened then we have problem +/*N*/ // probably GetInStream should allways open pInStream based on xInputStream +/*N*/ GetMedium_Impl(); +/*N*/ } +/*N*/ +/*N*/ return pImp->xInputStream; +/*N*/ } + +/*N*/ const SfxVersionTableDtor* SfxMedium::GetVersionList() +/*N*/ { +/*N*/ if ( !pImp->pVersions && GetStorage() ) +/*N*/ { +/*N*/ if ( pImp->bIsDiskSpannedJAR ) +/*N*/ return NULL; +/*N*/ +/*N*/ SvStorageStreamRef aStream = +/*N*/ GetStorage()->OpenStream( DEFINE_CONST_UNICODE( "VersionList" ), SFX_STREAM_READONLY | STREAM_NOCREATE ); +/*N*/ if ( aStream.Is() && aStream->GetError() == SVSTREAM_OK ) +/*N*/ { +/*?*/ pImp->pVersions = new SfxVersionTableDtor; +/*?*/ pImp->pVersions->Read( *aStream ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SfxVersionTableDtor *pList = new SfxVersionTableDtor; +/*N*/ if ( SfxXMLVersList_Impl::ReadInfo( GetStorage(), pList ) ) +/*?*/ pImp->pVersions = pList; +/*N*/ else +/*N*/ delete pList; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pImp->pVersions; +/*N*/ } + + + + + + + +//---------------------------------------------------------------- +/*N*/ sal_Bool SfxMedium::IsReadOnly() +/*N*/ { +/*N*/ sal_Bool bReadOnly = !( GetOpenMode() & STREAM_WRITE ); +/*(dv) if ( bReadOnly && pURLObj && CntAnchor::IsViewURL( pURLObj->GetMainURL( INetURLObject::NO_DECODE ) ) ) + // Chaos-Storages sind niemals als readonly anzusehen! + return sal_False; +*/ +/*N*/ if ( !bReadOnly ) +/*N*/ { +/*N*/ // logisch readonly ge"offnet +/*N*/ SFX_ITEMSET_ARG( GetItemSet(), pItem, SfxBoolItem, SID_DOC_READONLY, sal_False); +/*N*/ if ( pItem ) +/*N*/ bReadOnly = pItem->GetValue(); +/*N*/ } +/*N*/ +/*N*/ return bReadOnly; +/*N*/ } + +//---------------------------------------------------------------- + +//---------------------------------------------------------------- +/*N*/ void SfxMedium::CreateTempFile() +/*N*/ { +/*N*/ if ( pImp->pTempFile ) +/*N*/ DELETEZ( pImp->pTempFile ); +/*N*/ +/*N*/ StreamMode nOpenMode = nStorOpenMode; +/*N*/ GetInStream(); +/*N*/ BOOL bCopy = ( nStorOpenMode == nOpenMode && ! ( nOpenMode & STREAM_TRUNC ) ); +/*N*/ nStorOpenMode = nOpenMode; +/*N*/ ResetError(); +/*N*/ +/*N*/ pImp->pTempFile = new ::utl::TempFile(); +/*N*/ pImp->pTempFile->EnableKillingFile( sal_True ); +/*N*/ aName = pImp->pTempFile->GetFileName(); +/*N*/ if ( !aName.Len() ) +/*N*/ { +/*N*/ SetError( ERRCODE_IO_CANTWRITE ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ if ( bCopy ) +/*N*/ { +/*N*/ GetOutStream(); +/*N*/ if ( pInStream && pOutStream ) +/*N*/ { +/*N*/ char *pBuf = new char [8192]; +/*N*/ sal_uInt32 nErr = ERRCODE_NONE; +/*N*/ +/*N*/ pInStream->Seek(0); +/*N*/ pOutStream->Seek(0); +/*N*/ +/*N*/ while( !pInStream->IsEof() && nErr == ERRCODE_NONE ) +/*N*/ { +/*N*/ sal_uInt32 nRead = pInStream->Read( pBuf, 8192 ); +/*N*/ nErr = pInStream->GetError(); +/*N*/ pOutStream->Write( pBuf, nRead ); +/*N*/ } +/*N*/ +/*N*/ delete[] pBuf; +/*N*/ CloseInStream(); +/*N*/ } +/*N*/ CloseOutStream_Impl(); +/*N*/ } +/*N*/ else +/*?*/ CloseInStream(); +/*N*/ +/*N*/ CloseStorage(); +/*N*/ } + +//---------------------------------------------------------------- +/*N*/ void SfxMedium::CreateTempFileNoCopy() +/*N*/ { +/*N*/ if ( pImp->pTempFile ) +/*N*/ delete pImp->pTempFile; +/*N*/ +/*N*/ pImp->pTempFile = new ::utl::TempFile(); +/*N*/ pImp->pTempFile->EnableKillingFile( sal_True ); +/*N*/ aName = pImp->pTempFile->GetFileName(); +/*N*/ if ( !aName.Len() ) +/*N*/ { +/*?*/ SetError( ERRCODE_IO_CANTWRITE ); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ CloseOutStream_Impl(); +/*N*/ CloseStorage(); +/*N*/ } + +//---------------------------------------------------------------- +#define nActVersion 1 + +/*?*/ SvStream& SfxVersionTableDtor::Read( SvStream& rStrm ) +/*?*/ { +/*?*/ sal_uInt16 nCount = 0, nVersion = 0; +/*?*/ +/*?*/ rStrm >> nVersion; +/*?*/ rStrm >> nCount; +/*?*/ +/*?*/ for( sal_uInt16 i=0; i<nCount; ++i ) +/*?*/ { +/*?*/ SfxVersionInfo *pNew = new SfxVersionInfo; +/*?*/ rStrm.ReadByteString( pNew->aComment, RTL_TEXTENCODING_UTF8 ); +/*?*/ rStrm.ReadByteString( pNew->aName, RTL_TEXTENCODING_UTF8 ); +/*?*/ pNew->aCreateStamp.Load( rStrm ); +/*?*/ Insert( pNew, LIST_APPEND ); +/*?*/ } +/*?*/ +/*?*/ return rStrm; +/*?*/ } + +/*N*/ void SfxVersionTableDtor::DelDtor() +/*N*/ { +/*N*/ SfxVersionInfo* pTmp = First(); +/*N*/ while( pTmp ) +/*N*/ { +/*?*/ delete pTmp; +/*?*/ pTmp = Next(); +/*N*/ } +/*N*/ Clear(); +/*N*/ } + + +//---------------------------------------------------------------- +//---------------------------------------------------------------- +//---------------------------------------------------------------- +/*?*/ SfxVersionInfo::SfxVersionInfo() +/*?*/ { +/*?*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docfilt.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docfilt.cxx new file mode 100644 index 000000000000..6464e55e36fa --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_docfilt.cxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// INCLUDE --------------------------------------------------------------- + +#ifdef SOLARIS +// HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8 +#include <ctime> +#endif + +#include <string> // HACK: prevent conflict between STLPORT and Workshop headers + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "fltfnc.hxx" +#include "sfxuno.hxx" + +namespace binfilter { + +// STATIC DATA ----------------------------------------------------------- + +/*N*/ DBG_NAME(SfxFilter) +/*N*/ +/*N*/ SfxFilter::SfxFilter( const String &rName, +/*N*/ const String &rWildCard, +/*N*/ SfxFilterFlags nType, +/*N*/ ULONG lFmt, +/*N*/ const String &rMacTyp, +/*N*/ const String &rTypNm, +/*N*/ sal_uInt16 nIcon, +/*N*/ const String &rMimeType, +/*N*/ const SfxFilterContainer* pContainerP, +/*N*/ const String &rUsrDat ): +/*N*/ lFormat(lFmt), +/*N*/ nFormatType(nType), +/*N*/ aWildCard(rWildCard, ';'), +/*N*/ aMacType(rMacTyp), +/*N*/ aTypeName(rTypNm), +/*N*/ nDocIcon(nIcon), +/*N*/ aUserData(rUsrDat), +/*N*/ aName( rName ), +/*N*/ aMimeType( rMimeType ), +/*N*/ aFilterName( rName ), +/*N*/ pContainer( pContainerP ) +/*N*/ { +/*N*/ InitMembers_Impl(); +/*N*/ pContainer = pContainerP; +/*N*/ aFilterName = rName; +/*N*/ aMimeType = rMimeType; +/*N*/ } + +/*N*/ void SfxFilter::InitMembers_Impl() +/*N*/ { +/*N*/ String aExts = GetWildcard()(); +/*N*/ String aShort, aLong; +/*N*/ String aRet; +/*N*/ sal_uInt16 nMaxLength = +/*N*/ #if defined( WIN ) || defined( OS2 ) +/*N*/ 3 +/*N*/ #else +/*N*/ USHRT_MAX +/*N*/ #endif +/*N*/ ; +/*N*/ String aTest; +/*N*/ sal_uInt16 nPos = 0; +/*N*/ while( ( aRet = aExts.GetToken( nPos++, ';' ) ).Len() ) +/*N*/ { +/*N*/ aTest = aRet; +/*N*/ aTest.SearchAndReplace( DEFINE_CONST_UNICODE( "*." ), String() ); +/*N*/ if( aTest.Len() <= nMaxLength ) +/*N*/ { +/*N*/ if( aShort.Len() ) aShort += ';'; +/*N*/ aShort += aRet; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( aLong.Len() ) aLong += ';'; +/*N*/ aLong += aRet; +/*N*/ } +/*N*/ } +/*N*/ if( aShort.Len() && aLong.Len() ) +/*N*/ { +/*N*/ aShort += ';'; +/*N*/ aShort += aLong; +/*N*/ } +/*N*/ aWildCard = aShort; +/*N*/ +/*N*/ nVersion = SOFFICE_FILEFORMAT_50; +/*N*/ bPlugDataSearched = 0; +/*N*/ pPlugData = 0; +/*N*/ aUIName = aFilterName; +/*N*/ } + +/*N*/ SfxFilter::~SfxFilter() +/*N*/ { +/*N*/ delete pPlugData; +/*N*/ } + +/*N*/ const String& SfxFilter::GetTypeName() const +/*N*/ { +/*N*/ return +/*N*/ #ifdef MAC +/*N*/ aMacType; +/*N*/ #else +/*N*/ aTypeName; +/*N*/ #endif +/*N*/ } + +/*N*/ String SfxFilter::GetFilterNameWithPrefix() const +/*N*/ { +/*N*/ String aName = pContainer->GetName(); +/*N*/ aName += DEFINE_CONST_UNICODE( ": " ); +/*N*/ aName += aFilterName; +/*N*/ return aName; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx new file mode 100644 index 000000000000..4a3dc7514165 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_docinf.cxx @@ -0,0 +1,1318 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/bigint.hxx> +#include <tools/urlobj.hxx> +#include <bf_svtools/saveopt.hxx> +#include <tools/tenccvt.hxx> +#include <bf_svtools/useroptions.hxx> +#include <sot/exchange.hxx> +#include "rtl/tencinfo.h" + +#include "fcontnr.hxx" +#include "openflag.hxx" +#include "app.hxx" +#include "docfile.hxx" +namespace binfilter { + +/*N*/ TYPEINIT1_AUTOFACTORY(SfxDocumentInfoItem, SfxStringItem); + +//------------------------------------------------------------------------ + +/*?*/ SfxDocumentInfoItem::SfxDocumentInfoItem() : +/*?*/ +/*?*/ SfxStringItem() +/*?*/ +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +//======================================================================== + +static const char __FAR_DATA pDocInfoSlot[] = "SfxDocumentInfo"; +static const char __FAR_DATA pPropSlot[] = "\005SummaryInformation"; +static const char __FAR_DATA pDocInfoHeader[] = "SfxDocumentInfo"; +#define VERSION 11 +#define STREAM_BUFFER_SIZE 2048 + +#define VT_I2 2 +#define VT_I4 3 +#define VT_LPSTR 30 +#define VT_LPWSTR 31 +#define VT_FILETIME 64 + +#define PID_TITLE 0x02 +#define PID_SUBJECT 0x03 +#define PID_AUTHOR 0x04 +#define PID_KEYWORDS 0x05 +#define PID_COMMENTS 0x06 +#define PID_TEMPLATE 0x07 +#define PID_LASTAUTHOR 0x08 +#define PID_REVNUMBER 0x09 +#define PID_EDITTIME 0x0a +#define PID_LASTPRINTED_DTM 0x0b +#define PID_CREATE_DTM 0x0c +#define PID_LASTSAVED_DTM 0x0d + +//========================================================================= + +/*N*/ IMPL_PTRHINT(SfxDocumentInfoHint, SfxDocumentInfo) + +//========================================================================= + +/*N*/ class SfxPSProperty_Impl +/*N*/ { +/*N*/ private: +/*N*/ UINT32 nId; +/*N*/ UINT32 nType; +/*N*/ +/*N*/ public: +/*N*/ SfxPSProperty_Impl( UINT32 nIdP, UINT32 nTypeP ) : nId( nIdP ), nType( nTypeP ) {} +/*N*/ virtual ~SfxPSProperty_Impl(); +/*N*/ +/*N*/ virtual ULONG Save( SvStream& rStream ) = 0; +/*N*/ virtual ULONG Load( SvStream& rStream ); +/*N*/ virtual ULONG Len() = 0; +/*N*/ +/*N*/ UINT32 GetId() const { return nId; } +/*N*/ UINT32 GetType() const { return nType; } +/*N*/ }; + +//------------------------------------------------------------------------- + +/*N*/ SfxPSProperty_Impl::~SfxPSProperty_Impl() +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSProperty_Impl::Load( SvStream& ) +/*N*/ { +/*N*/ return 0; +/*N*/ } + + +//========================================================================= + +/*N*/ class SfxPSCodePageProperty_Impl : public SfxPSProperty_Impl +/*N*/ { +/*N*/ private: +/*N*/ CharSet nEncoding; +/*N*/ +/*N*/ public: +/*N*/ SfxPSCodePageProperty_Impl( CharSet nCharSet ) : SfxPSProperty_Impl( 1, VT_I2 ), nEncoding( nCharSet ) {} +/*N*/ virtual ~SfxPSCodePageProperty_Impl() {} +/*N*/ +/*N*/ virtual ULONG Save( SvStream& rStream ); +/*N*/ virtual ULONG Len(); +/*N*/ }; + +/*N*/ ULONG SfxPSCodePageProperty_Impl::Save( SvStream& rStream ) +/*N*/ { +/*N*/ sal_uInt32 nCodePage = rtl_getWindowsCodePageFromTextEncoding(nEncoding); +/*N*/ if (nCodePage == 0) +/*N*/ nCodePage = 1252; +/*N*/ rStream << (UINT16)nCodePage; +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +/*N*/ ULONG SfxPSCodePageProperty_Impl::Len() +/*N*/ { +/*N*/ return sizeof( UINT16 ); +/*N*/ } + +//========================================================================= + +/*N*/ class SfxPSStringProperty_Impl : public SfxPSProperty_Impl +/*N*/ { +/*N*/ private: +/*N*/ String aString; +/*N*/ CharSet nEncoding; +/*N*/ BOOL bIsUniCode; +/*N*/ +/*N*/ public: +/*N*/ SfxPSStringProperty_Impl( UINT32 nIdP, const String& aStr ) : +/*N*/ aString(aStr), SfxPSProperty_Impl( nIdP, VT_LPSTR ), bIsUniCode(FALSE) +/*N*/ { +/*N*/ nEncoding = RTL_TEXTENCODING_UTF8; +/*N*/ } +/*N*/ +/*N*/ SfxPSStringProperty_Impl( UINT32 nIdP ) : +/*N*/ SfxPSProperty_Impl( nIdP, VT_LPSTR ), bIsUniCode(FALSE) +/*N*/ { +/*N*/ nEncoding = RTL_TEXTENCODING_UTF8; +/*N*/ } +/*N*/ +/*N*/ void SetIsUniCode() { bIsUniCode = TRUE; } +/*N*/ +/*N*/ virtual ULONG Save( SvStream& rStream ); +/*N*/ virtual ULONG Load( SvStream& rStream ); +/*N*/ virtual ULONG Len(); +/*N*/ +/*N*/ const String& GetString() { return aString; } +/*N*/ }; + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSStringProperty_Impl::Save( SvStream& rStream ) +/*N*/ { +/*N*/ // Now we always write property strings with UTF8 encoding, so we +/*N*/ // can ensure full unicode compatibility. The code page attribute is +/*N*/ // written with UTF8 set! +/*N*/ // Force nEncoding set to UTF8! +/*N*/ ByteString aTemp( aString, RTL_TEXTENCODING_UTF8 ); +/*N*/ nEncoding = RTL_TEXTENCODING_UTF8; +/*N*/ UINT32 nLen = aTemp.Len(); +/*N*/ rStream << (UINT32)( nLen + 1 ); +/*N*/ rStream.Write( aTemp.GetBuffer(), nLen ); +/*N*/ rStream << '\0'; +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSStringProperty_Impl::Load( SvStream& rStream ) +/*N*/ { +/*N*/ UINT32 nLen; +/*N*/ rStream >> nLen; +/*N*/ if ( nLen > 0 ) +/*N*/ { +/*N*/ if ( bIsUniCode ) +/*N*/ { +/*N*/ sal_Unicode* pString = new sal_Unicode[ nLen ]; +/*N*/ UINT32 i; for ( i = 0; i < nLen; i++ ) +/*N*/ rStream >> pString[ i ]; +/*N*/ if ( pString[ i - 1 ] == 0 ) +/*N*/ { +/*N*/ if ( nLen > 1 ) +/*N*/ aString = String( pString, (USHORT) nLen - 1 ); +/*N*/ else +/*N*/ aString = String(); +/*N*/ } +/*N*/ +/*N*/ delete[] pString; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ ByteString aTemp; +/*N*/ if ( nLen>1 ) +/*N*/ { +/*N*/ rStream.Read( aTemp.AllocBuffer( (xub_StrLen)( nLen - 1 ) ), nLen ); +/*N*/ aString = String( aTemp, nEncoding ); +/*N*/ } +/*N*/ else +/*N*/ aString = String(); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ aString.Erase(); +/*N*/ +/*N*/ USHORT nPos=0; +/*N*/ if ( (nPos = aString.Search( (sal_Unicode)'\0') ) != STRING_NOTFOUND ) +/*N*/ aString.Erase( nPos ); +/*N*/ +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSStringProperty_Impl::Len() +/*N*/ { +/*N*/ if ( bIsUniCode ) +/*N*/ return aString.Len() + 5; +/*N*/ else +/*N*/ { +/*N*/ // Non-unicode strings are always stored with UTF8 encoding +/*N*/ return ByteString( aString, RTL_TEXTENCODING_UTF8 ).Len() + 5; +/*N*/ } +/*N*/ } + +//========================================================================= + +/*N*/ class SfxDocumentInfo_Impl +/*N*/ { +/*N*/ public: +/*N*/ String aCopiesTo; +/*N*/ String aOriginal; +/*N*/ String aReferences; +/*N*/ String aRecipient; +/*N*/ String aReplyTo; +/*N*/ String aBlindCopies; +/*N*/ String aInReplyTo; +/*N*/ String aNewsgroups; +/*N*/ String aSpecialMimeType; +/*N*/ USHORT nPriority; +/*N*/ BOOL bUseUserData; +/*N*/ +/*N*/ SfxDocumentInfo_Impl() : nPriority( 0 ), bUseUserData( 1 ) {} +/*N*/ }; + +//========================================================================= + +/*N*/ class SfxPSUINT32Property_Impl : public SfxPSProperty_Impl +/*N*/ { +/*N*/ private: +/*N*/ UINT32 aInt; +/*N*/ +/*N*/ public: +/*N*/ SfxPSUINT32Property_Impl( UINT32 nIdP, UINT32 aIntP ) : +/*N*/ aInt( aIntP ), SfxPSProperty_Impl( nIdP, VT_I4 ) {} +/*N*/ +/*N*/ virtual ULONG Save( SvStream& rStream ); +/*N*/ virtual ULONG Len(); +/*N*/ }; + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSUINT32Property_Impl::Save( SvStream& rStream ) +/*N*/ { +/*N*/ rStream << aInt; +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSUINT32Property_Impl::Len() +/*N*/ { +/*N*/ return 4; +/*N*/ } + +//========================================================================= + +/*N*/ class SfxPSDateTimeProperty_Impl : public SfxPSProperty_Impl +/*N*/ { +/*N*/ private: +/*N*/ DateTime aDateTime; +/*N*/ +/*N*/ public: +/*N*/ SfxPSDateTimeProperty_Impl( UINT32 nIdP, const DateTime& rDateTime ) : +/*N*/ aDateTime( rDateTime ), SfxPSProperty_Impl( nIdP, VT_FILETIME ) {} +/*N*/ SfxPSDateTimeProperty_Impl( UINT32 nIdP ) : +/*N*/ SfxPSProperty_Impl( nIdP, VT_FILETIME ) {}; +/*N*/ +/*N*/ virtual ULONG Save( SvStream& rStream ); +/*N*/ virtual ULONG Load( SvStream& rStream ); +/*N*/ virtual ULONG Len(); +/*N*/ +/*N*/ const DateTime& GetDateTime() { return aDateTime; } +/*N*/ }; + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSDateTimeProperty_Impl::Save(SvStream &rStream) +/*N*/ { +/*N*/ // Nicht Valid ist das gleiche, wie bei MS, nur nicht konvertiert +/*N*/ if( aDateTime.IsValid() ) +/*N*/ aDateTime.ConvertToUTC(); +/*N*/ BigInt a100nPerSecond(10000000L); +/*N*/ BigInt a100nPerDay=a100nPerSecond*BigInt(60L*60*24); +/*N*/ USHORT nYears=aDateTime.GetYear()-1601; +/*N*/ long nDays= +/*N*/ nYears*365+nYears/4-nYears/100+nYears/400+ +/*N*/ aDateTime.GetDayOfYear()-1; +/*N*/ BigInt aTime= +/*N*/ a100nPerDay*BigInt(nDays)+a100nPerSecond* +/*N*/ BigInt((long)( aDateTime.GetSec() + +/*N*/ 60* aDateTime.GetMin() + +/*N*/ 60L*60* aDateTime.GetHour() )); +/*N*/ +/*N*/ BigInt aUlongMax(SAL_MAX_UINT32); +/*N*/ aUlongMax += 1; +/*N*/ +/*N*/ rStream<<rStream<<static_cast<sal_uInt32>(static_cast<ULONG>(aTime % aUlongMax)); +/*N*/ rStream<<rStream<<static_cast<sal_uInt32>(static_cast<ULONG>(aTime / aUlongMax)); +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ErrCode SfxPSDateTimeProperty_Impl::Load( SvStream& rStream ) +/*N*/ { +/*N*/ UINT32 nLow, nHigh; +/*N*/ rStream >> nLow; +/*N*/ rStream >> nHigh; +/*N*/ BigInt aUlongMax( SAL_MAX_UINT32 ); +/*N*/ aUlongMax += 1; +/*N*/ BigInt aTime = aUlongMax * BigInt( nHigh ); +/*N*/ aTime += nLow; +/*N*/ BigInt a100nPerSecond(10000000L); +/*N*/ BigInt a100nPerDay = a100nPerSecond*BigInt( 60L * 60 * 24 ); +/*N*/ ULONG nDays = aTime / a100nPerDay; +/*N*/ USHORT nYears = (USHORT) +/*N*/ (( nDays - ( nDays / ( 4 * 365 ) ) + ( nDays / ( 100 * 365 ) ) - +/*N*/ ( nDays / ( 400 * 365 ) ) ) / 365 ); +/*N*/ nDays -= nYears * 365 + nYears / 4 - nYears / 100 + nYears / 400; +/*N*/ USHORT nMonths = 0; +/*N*/ for( long nDaysCount = nDays; nDaysCount >= 0; ) +/*N*/ { +/*N*/ nDays = nDaysCount; +/*N*/ nMonths ++; +/*N*/ nDaysCount-= Date( 1, nMonths, 1601 + nYears ).GetDaysInMonth(); +/*N*/ } +/*N*/ Date _aDate( (USHORT)( nDays + 1 ), nMonths, nYears + 1601 ); +/*N*/ Time _aTime( ( aTime / ( a100nPerSecond * BigInt( 60 * 60 ) ) ) % +/*N*/ BigInt( 24 ), +/*N*/ ( aTime / ( a100nPerSecond * BigInt( 60 ) ) ) % +/*N*/ BigInt( 60 ), +/*N*/ ( aTime / ( a100nPerSecond ) ) % +/*N*/ BigInt( 60 ) ); +/*N*/ aDateTime = DateTime( _aDate, _aTime ); +/*N*/ aDateTime.ConvertToLocalTime(); +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSDateTimeProperty_Impl::Len() +/*N*/ { +/*N*/ return 8; +/*N*/ } + +//========================================================================= + +/*N*/ typedef SfxPSProperty_Impl *SfxPSPropertyPtr_Impl; +/*N*/ SV_DECL_PTRARR_DEL(SfxPSPropertyArr_Impl, SfxPSPropertyPtr_Impl, 10, 10)//STRIP008 ; +/*N*/ SV_IMPL_PTRARR(SfxPSPropertyArr_Impl, SfxPSPropertyPtr_Impl); + +/*N*/ struct SfxPSSection_Impl +/*N*/ { +/*N*/ SvGlobalName aId; +/*N*/ SfxPSPropertyArr_Impl aProperties; +/*N*/ ULONG Save(SvStream &rStream); +/*N*/ }; + +//========================================================================= + +/*N*/ class SfxPS_Impl +/*N*/ { +/*N*/ SfxPSSection_Impl aSection; +/*N*/ USHORT GetPos( UINT32 nId ); +/*N*/ +/*N*/ public: +/*N*/ +/*N*/ void SetSectionName(const SvGlobalName& aIdP); +/*N*/ void AddProperty( SfxPSProperty_Impl* pProp); +/*N*/ +/*N*/ ULONG Save(SvStream &rStream); +/*N*/ }; + + +/*N*/ USHORT SfxPS_Impl::GetPos( UINT32 nId ) +/*N*/ { +/*N*/ SfxPSPropertyArr_Impl& rProperties = aSection.aProperties; +/*N*/ USHORT nCount = rProperties.Count(); +/*N*/ for( USHORT n = 0 ; n < nCount; n++ ) +/*N*/ if( rProperties.GetObject( n )->GetId() == nId ) +/*N*/ return n; +/*N*/ return USHRT_MAX; +/*N*/ } + + +/*N*/ void SfxPS_Impl::AddProperty( SfxPSProperty_Impl* pProp) +/*N*/ { +/*N*/ USHORT nPos = GetPos( pProp->GetId() ); +/*N*/ if( nPos != USHRT_MAX ) +/*N*/ { +/*?*/ delete aSection.aProperties[ nPos ]; +/*?*/ aSection.aProperties.Remove( nPos ); +/*N*/ } +/*N*/ aSection.aProperties.Insert(pProp,0); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxPS_Impl::SetSectionName(const SvGlobalName& aIdP) +/*N*/ { +/*N*/ aSection.aId = aIdP; +/*N*/ } + + +/*N*/ ULONG SfxPS_Impl::Save(SvStream &rStream) +/*N*/ { +/*N*/ SvGlobalName aName; +/*N*/ rStream << (UINT16) 0xfffe // ByteOrder +/*N*/ << (UINT16) 0 // version +/*N*/ << (UINT16) 1 // Os MinorVersion +/*N*/ << (UINT16) // Os Type +/*N*/ #if defined(MAC) +/*N*/ 1 +/*N*/ #elif defined(WNT) +/*N*/ 2 +/*N*/ #else +/*N*/ 0 +/*N*/ #endif +/*N*/ << aName +/*N*/ << (UINT32)1; // Immer eine Section +/*N*/ return aSection.Save(rStream); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ ULONG SfxPSSection_Impl::Save(SvStream &rStream) +/*N*/ { +/*N*/ +/*N*/ //Nur eine Section schreiben: ( Use of more than 1 section is discouraged +/*N*/ //and will not be supported in future windows apis). +/*N*/ +/*N*/ ULONG nPos = rStream.Tell(); +/*N*/ nPos += 20; +/*N*/ rStream << aId << (UINT32)nPos; //Offset +/*N*/ +/*N*/ +/*N*/ //SectionHeader Schreiben +/*N*/ ULONG nLen=8; +/*N*/ USHORT n; +/*N*/ for(n=0;n<aProperties.Count();n++) +/*N*/ nLen+=(((aProperties[n]->Len() + 3) >> 2) << 2)+12; +/*N*/ rStream << (UINT32) nLen << (UINT32) aProperties.Count(); +/*N*/ +/*N*/ //PropertyId/Offsetpaare schreiben +/*N*/ +/*N*/ nLen=8+aProperties.Count()*8; +/*N*/ for(n=0;n<aProperties.Count();n++) +/*N*/ { +/*N*/ rStream << aProperties[n]->GetId() << (UINT32)nLen; +/*N*/ nLen+=(((aProperties[n]->Len() + 3) >> 2) << 2) + 4; +/*N*/ } +/*N*/ +/*N*/ //Inhalte schreiben +/*N*/ for(n=0;n<aProperties.Count();n++) +/*N*/ { +/*N*/ rStream << (UINT32) aProperties[n]->GetType(); +/*N*/ aProperties[n]->Save(rStream); +/*N*/ nLen=aProperties[n]->Len(); +/*N*/ while(nLen++%4) //Auffuellen auf DWORD Grenze +/*N*/ rStream << (UINT8) 0; +/*N*/ } +/*N*/ +/*N*/ return rStream.GetErrorCode(); +/*N*/ } + +//======================================================================== + +/*N*/ SvStream& PaddWithBlanks_Impl(SvStream &rStream, USHORT nCount) +/*N*/ { +/*N*/ for ( USHORT n = nCount; n; --n ) +/*N*/ rStream << ' '; +/*N*/ return rStream; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ inline SvStream& Skip(SvStream &rStream, USHORT nCount) +/*N*/ { +/*N*/ rStream.SeekRel(nCount); +/*N*/ return rStream; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ struct FileHeader +/*N*/ { +/*N*/ String aHeader; +/*N*/ USHORT nVersion; +/*N*/ BOOL bPasswd; +/*N*/ +/*N*/ FileHeader( const char* pHeader, USHORT nV, BOOL bPass ) : +/*N*/ nVersion( nV ), bPasswd( bPass ) { aHeader = String::CreateFromAscii( pHeader ); } +/*N*/ FileHeader( SvStream& rStream ); +/*N*/ +/*N*/ void Save( SvStream& rStream ) const; +/*N*/ }; + +//------------------------------------------------------------------------- + + +/*N*/ FileHeader::FileHeader( SvStream& rStream ) +/*N*/ { +/*N*/ BYTE b; +/*N*/ long nVer = rStream.GetVersion(); +/*N*/ rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); +/*N*/ rStream.ReadByteString( aHeader ); //(dv??) +/*N*/ rStream >> nVersion >> b; +/*N*/ rStream.SetVersion( nVer ); +/*N*/ bPasswd = (BOOL)b; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void FileHeader::Save( SvStream& rStream ) const +/*N*/ { +/*N*/ long nVer = rStream.GetVersion(); +/*N*/ rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); +/*N*/ rStream.WriteByteString( aHeader ); +/*N*/ rStream.SetVersion( nVer ); +/*N*/ rStream << nVersion; +/*N*/ rStream << (BYTE)bPasswd; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxDocUserKey::Load(SvStream &rStream) +/*N*/ { +/*N*/ rStream.ReadByteString( aTitle ); +/*N*/ Skip(rStream, SFXDOCUSERKEY_LENMAX - aTitle.Len()); +/*N*/ rStream.ReadByteString( aWord ); +/*N*/ Skip(rStream, SFXDOCUSERKEY_LENMAX - aWord.Len()); +/*N*/ return rStream.GetError() == SVSTREAM_OK; +/*N*/ } + + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxDocUserKey::Save(SvStream &rStream) const +/*N*/ { +/*N*/ DBG_ASSERT( aTitle.Len() <= SFXDOCUSERKEY_LENMAX, "length of user key title overflow" ); +/*N*/ DBG_ASSERT( aWord.Len() <= SFXDOCUSERKEY_LENMAX, "length of user key value overflow" ); +/*N*/ +/*N*/ // save the title of the user key +/*N*/ String aString = aTitle; +/*N*/ aString.Erase( SFXDOCUSERKEY_LENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCUSERKEY_LENMAX - aString.Len()); +/*N*/ +/*N*/ // save the value of the user key +/*N*/ aString = aWord; +/*N*/ aString.Erase( SFXDOCUSERKEY_LENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCUSERKEY_LENMAX - aString.Len()); +/*N*/ +/*N*/ return rStream.GetError() == SVSTREAM_OK; +/*N*/ } + +//------------------------------------------------------------------------- +/*N*/ SfxDocUserKey::SfxDocUserKey( const String& rTitle, const String& rWord ) : +/*N*/ aTitle( rTitle ), aWord( rWord ) +/*N*/ { +/*N*/ } +//------------------------------------------------------------------------ +/*N*/ const SfxDocUserKey& SfxDocUserKey::operator=(const SfxDocUserKey &rCopy) +/*N*/ { +/*N*/ aTitle = rCopy.aTitle; +/*N*/ aWord = rCopy.aWord; +/*N*/ return *this; +/*N*/ } +// SfxDocumentInfo ------------------------------------------------------- + +/*N*/ sal_Bool TestValidity_Impl( const String& rString, sal_Bool bURL ) +/*N*/ { +/*N*/ sal_Bool bRet = sal_True; +/*N*/ xub_StrLen nLen = rString.Len(); +/*N*/ if ( nLen >= 1024 && +/*N*/ ( !bURL || INetURLObject::CompareProtocolScheme( rString ) == INET_PROT_NOT_VALID ) ) +/*N*/ // !bURL == the default target has not so many characters +/*N*/ // bURL == the reload url must have a valid protocol +/*N*/ bRet = sal_False; +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/*N*/ BOOL SfxDocumentInfo::Load( SvStream& rStream ) +/*N*/ { +/*N*/ long d, t; +/*N*/ USHORT nUS; +/*N*/ BYTE nByte; +/*N*/ FileHeader aHeader(rStream); +/*N*/ if( ! aHeader.aHeader.EqualsAscii( pDocInfoHeader )) +/*N*/ { +/*N*/ rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); +/*N*/ return FALSE; +/*N*/ } +/*N*/ Free(); +/*N*/ bPasswd = aHeader.bPasswd; +/*N*/ rStream >> nUS; +/*N*/ //eFileCharSet = (CharSet)nUS; +/*N*/ eFileCharSet = GetSOLoadTextEncoding( nUS ); +/*N*/ +/*N*/ // Einstellen an den Streams +/*N*/ rStream.SetStreamCharSet(eFileCharSet); +/*N*/ +/*N*/ rStream >> nByte; +/*N*/ bPortableGraphics = nByte? 1: 0; +/*N*/ rStream >> nByte; +/*N*/ bQueryTemplate = nByte? 1: 0; +/*N*/ +/*N*/ aCreated.Load(rStream); +/*N*/ aChanged.Load(rStream); +/*N*/ aPrinted.Load(rStream); +/*N*/ +/*N*/ rStream.ReadByteString( aTitle ); +/*N*/ Skip(rStream, SFXDOCINFO_TITLELENMAX - aTitle.Len()); +/*N*/ rStream.ReadByteString( aTheme ); +/*N*/ Skip(rStream, SFXDOCINFO_THEMELENMAX - aTheme.Len()); +/*N*/ rStream.ReadByteString( aComment ); +/*N*/ Skip(rStream, SFXDOCINFO_COMMENTLENMAX- aComment.Len()); +/*N*/ rStream.ReadByteString( aKeywords ); +/*N*/ Skip(rStream, SFXDOCINFO_KEYWORDLENMAX - aKeywords.Len()); +/*N*/ +/*N*/ USHORT i; +/*N*/ for(i = 0; i < MAXDOCUSERKEYS; ++i) +/*N*/ aUserKeys[i].Load(rStream); +/*N*/ +/*N*/ rStream.ReadByteString( aTemplateName ); +/*N*/ rStream.ReadByteString( aTemplateFileName ); +/*N*/ rStream >> d >> t; +/*N*/ aTemplateDate = DateTime(Date(d), Time(t)); +/*N*/ +/*N*/ // wurde mal fuer MB in Panik eingebaut und dann doch nie benutzt :-) +/*N*/ if ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 ) +/*N*/ { +/*N*/ USHORT nMailAddr; +/*N*/ rStream >> nMailAddr; +/*N*/ for( i = 0; i < nMailAddr; i++ ) +/*N*/ { +/*N*/ String aDummyString; +/*N*/ USHORT nDummyFlags; +/*N*/ rStream.ReadByteString( aDummyString ); +/*N*/ rStream >> nDummyFlags; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rStream >> lTime; +/*N*/ if(aHeader.nVersion > 4) +/*N*/ rStream >> nDocNo; +/*N*/ else +/*N*/ nDocNo = 1; +/*N*/ rStream >> nUserDataSize; +/*N*/ if(nUserDataSize) { +/*N*/ pUserData = new char[nUserDataSize]; +/*N*/ rStream.Read(pUserData,nUserDataSize); +/*N*/ } +/*N*/ +/*N*/ BOOL bOK = (rStream.GetError() == SVSTREAM_OK); +/*N*/ nByte = 0; // wg.Kompatibilitaet; +/*N*/ rStream >> nByte; // evtl. nicht in DocInfo enthalten +/*N*/ bTemplateConfig = nByte ? 1 : 0; +/*N*/ if( aHeader.nVersion > 5 ) +/*N*/ { +/*N*/ rStream >> bReloadEnabled; +/*N*/ rStream.ReadByteString( aReloadURL ); +/*N*/ rStream >> nReloadSecs; +/*N*/ rStream.ReadByteString( aDefaultTarget ); +/*N*/ +/*N*/ if ( !TestValidity_Impl( aReloadURL, sal_True ) ) +/*N*/ { +/*N*/ // the reload url is invalid -> reset all reload attributes +/*N*/ bReloadEnabled = FALSE; +/*N*/ aReloadURL.Erase(); +/*N*/ nReloadSecs = 60; +/*N*/ aDefaultTarget.Erase(); +/*N*/ } +/*N*/ else if ( !TestValidity_Impl( aDefaultTarget, sal_False ) ) +/*N*/ // the default target is invalid -> reset it +/*N*/ aDefaultTarget.Erase(); +/*N*/ } +/*N*/ if ( aHeader.nVersion > 6 ) +/*N*/ { +/*N*/ rStream >> nByte; +/*N*/ bSaveGraphicsCompressed = nByte? 1: 0; +/*N*/ } +/*N*/ if ( aHeader.nVersion > 7 ) +/*N*/ { +/*N*/ rStream >> nByte; +/*N*/ bSaveOriginalGraphics = nByte? 1: 0; +/*N*/ } +/*N*/ if ( aHeader.nVersion > 8 ) +/*N*/ { +/*N*/ rStream >> nByte; +/*N*/ bSaveVersionOnClose = nByte? 1: 0; +/*N*/ +/*N*/ rStream.ReadByteString( pImp->aCopiesTo ); +/*N*/ rStream.ReadByteString( pImp->aOriginal ); +/*N*/ rStream.ReadByteString( pImp->aReferences ); +/*N*/ rStream.ReadByteString( pImp->aRecipient ); +/*N*/ rStream.ReadByteString( pImp->aReplyTo ); +/*N*/ rStream.ReadByteString( pImp->aBlindCopies ); +/*N*/ rStream.ReadByteString( pImp->aInReplyTo ); +/*N*/ rStream.ReadByteString( pImp->aNewsgroups ); +/*N*/ rStream >> pImp->nPriority; +/*N*/ } +/*N*/ if ( aHeader.nVersion > 9 ) +/*N*/ { +/*N*/ rStream.ReadByteString( pImp->aSpecialMimeType ); +/*N*/ } +/*N*/ if ( aHeader.nVersion > 10 ) +/*N*/ { +/*N*/ rStream >> nByte; +/*N*/ pImp->bUseUserData = nByte ? TRUE : FALSE; +/*N*/ } +/*N*/ return bOK; +/*N*/ } + +//------------------------------------------------------------------------- +/*N*/ BOOL SfxDocumentInfo::SavePropertySet( SvStorage *pStorage) const +/*N*/ { +/*N*/ SfxPS_Impl* pPS = new SfxPS_Impl; +/*N*/ SvStorageStreamRef aStrPropSet = pStorage->OpenStream( +/*N*/ String::CreateFromAscii( pPropSlot ), STREAM_TRUNC | STREAM_STD_WRITE ); +/*N*/ if ( !aStrPropSet.Is() ) +/*N*/ { +/*N*/ DBG_ERRORFILE( "can not open the property set" ); +/*N*/ return FALSE; +/*N*/ } +/*N*/ +/*N*/ pPS->SetSectionName( SvGlobalName( +/*N*/ 0xf29f85e0, 0x4ff9, 0x1068, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9 ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_TITLE, GetTitle() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_SUBJECT, GetTheme() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_KEYWORDS, GetKeywords() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_TEMPLATE, GetTemplateName() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_COMMENTS, GetComment() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_AUTHOR, GetCreated().GetName() ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( PID_LASTAUTHOR, GetChanged().GetName() ) ); +/*N*/ pPS->AddProperty( new SfxPSDateTimeProperty_Impl( PID_CREATE_DTM, GetCreated().GetTime() ) ); +/*N*/ pPS->AddProperty( new SfxPSDateTimeProperty_Impl( PID_LASTSAVED_DTM, GetChanged().GetTime() ) ); +/*N*/ if ( GetPrinted().GetTime() != GetCreated().GetTime() ) +/*N*/ pPS->AddProperty( new SfxPSDateTimeProperty_Impl( PID_LASTPRINTED_DTM, GetPrinted().GetTime() ) ); +/*N*/ DateTime aEditTime( Date( 1, 1, 1601 ), Time( GetTime() ) ); +/*N*/ aEditTime.ConvertToLocalTime(); +/*N*/ pPS->AddProperty( new SfxPSDateTimeProperty_Impl( PID_EDITTIME, aEditTime ) ); +/*N*/ pPS->AddProperty( new SfxPSStringProperty_Impl( +/*N*/ PID_REVNUMBER, String::CreateFromInt32( GetDocumentNumber() ) ) ); +/*N*/ pPS->AddProperty( new SfxPSCodePageProperty_Impl( RTL_TEXTENCODING_UTF8 )); +/*N*/ pPS->Save( *aStrPropSet ); +/*N*/ delete pPS; +/*N*/ return ( aStrPropSet->GetErrorCode() == 0 ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxDocumentInfo::Save( SvStream& rStream ) const +/*N*/ { +/*N*/ FileHeader aHeader(pDocInfoHeader, VERSION, bPasswd? 1: 0); +/*N*/ aHeader.Save(rStream); +/*N*/ CharSet eNewFileCharSet = GetSOStoreTextEncoding( eFileCharSet ); +/*N*/ rStream << (USHORT)eNewFileCharSet; +/*N*/ rStream.SetStreamCharSet(eNewFileCharSet); +/*N*/ rStream << (bPortableGraphics? (BYTE)1: (BYTE)0) +/*N*/ << (bQueryTemplate? (BYTE)1: (BYTE)0); +/*N*/ aCreated.Save(rStream); +/*N*/ aChanged.Save(rStream); +/*N*/ aPrinted.Save(rStream); +/*N*/ +/*N*/ DBG_ASSERT( aTitle.Len() <= SFXDOCINFO_TITLELENMAX , "length of title overflow" ); +/*N*/ DBG_ASSERT( aTheme.Len() <= SFXDOCINFO_THEMELENMAX , "length of theme overflow" ); +/*N*/ DBG_ASSERT( aComment.Len() <= SFXDOCINFO_COMMENTLENMAX , "length of description overflow" ); +/*N*/ DBG_ASSERT( aKeywords.Len() <= SFXDOCINFO_KEYWORDLENMAX , "length of keywords overflow" ); +/*N*/ +/*N*/ // save the title +/*N*/ String aString = aTitle; +/*N*/ aString.Erase( SFXDOCINFO_TITLELENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCINFO_TITLELENMAX - aString.Len()); +/*N*/ // save the theme +/*N*/ aString = aTheme; +/*N*/ aString.Erase( SFXDOCINFO_THEMELENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCINFO_THEMELENMAX - aString.Len()); +/*N*/ // save the description +/*N*/ aString = aComment; +/*N*/ aString.Erase( SFXDOCINFO_COMMENTLENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCINFO_COMMENTLENMAX - aString.Len()); +/*N*/ // save the keywords +/*N*/ aString = aKeywords; +/*N*/ aString.Erase( SFXDOCINFO_KEYWORDLENMAX ); +/*N*/ rStream.WriteByteString( aString ); +/*N*/ PaddWithBlanks_Impl(rStream, SFXDOCINFO_KEYWORDLENMAX - aString.Len()); +/*N*/ +/*N*/ for(USHORT i = 0; i < MAXDOCUSERKEYS; ++i) +/*N*/ aUserKeys[i].Save(rStream); +/*N*/ rStream.WriteByteString( aTemplateName ); +/*N*/ rStream.WriteByteString( aTemplateFileName ); +/*N*/ rStream << (long)aTemplateDate.GetDate() +/*N*/ << (long)aTemplateDate.GetTime(); +/*N*/ +/*N*/ // wurde mal fuer MB in Panik eingebaut und dann doch nie benutzt :-) +/*N*/ if ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 ) +/*N*/ rStream << (USHORT) 0; +/*N*/ +/*N*/ rStream << GetTime() << GetDocumentNumber(); +/*N*/ +/*N*/ rStream << nUserDataSize; +/*N*/ if(pUserData) +/*N*/ rStream.Write(pUserData, nUserDataSize); +/*N*/ rStream << (bTemplateConfig? (BYTE)1: (BYTE)0); +/*N*/ if( aHeader.nVersion > 5 ) +/*N*/ { +/*N*/ rStream << bReloadEnabled; +/*N*/ rStream.WriteByteString( aReloadURL ); +/*N*/ rStream << nReloadSecs; +/*N*/ rStream.WriteByteString( aDefaultTarget ); +/*N*/ } +/*N*/ if ( aHeader.nVersion > 6 ) +/*N*/ rStream << (bSaveGraphicsCompressed? (BYTE)1: (BYTE)0); +/*N*/ if ( aHeader.nVersion > 7 ) +/*N*/ rStream << (bSaveOriginalGraphics? (BYTE)1: (BYTE)0); +/*N*/ if ( aHeader.nVersion > 8 ) +/*N*/ { +/*N*/ rStream << (bSaveVersionOnClose? (BYTE)1: (BYTE)0); +/*N*/ rStream.WriteByteString( pImp->aCopiesTo ); +/*N*/ rStream.WriteByteString( pImp->aOriginal ); +/*N*/ rStream.WriteByteString( pImp->aReferences ); +/*N*/ rStream.WriteByteString( pImp->aRecipient ); +/*N*/ rStream.WriteByteString( pImp->aReplyTo ); +/*N*/ rStream.WriteByteString( pImp->aBlindCopies ); +/*N*/ rStream.WriteByteString( pImp->aInReplyTo ); +/*N*/ rStream.WriteByteString( pImp->aNewsgroups ); +/*N*/ rStream << pImp->nPriority; +/*N*/ } +/*N*/ if ( aHeader.nVersion > 9 ) +/*N*/ { +/*N*/ rStream.WriteByteString( pImp->aSpecialMimeType ); +/*N*/ } +/*N*/ if ( aHeader.nVersion > 10 ) +/*N*/ { +/*N*/ rStream << ( pImp->bUseUserData ? (BYTE)1: (BYTE)0 ); +/*N*/ } +/*N*/ +/*N*/ return rStream.GetError() == SVSTREAM_OK; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxDocumentInfo::Load(SvStorage* pStorage) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ if(!pStorage->IsStream( String::CreateFromAscii( pDocInfoSlot ))) +/*N*/ return FALSE; +/*N*/ #endif +/*N*/ if ( pStorage->GetVersion() >= SOFFICE_FILEFORMAT_60 ) +/*N*/ { +/*N*/ DBG_ERROR("This method only supports binary file format, use service StandaloneDocumentInfo!"); +/*N*/ return FALSE; +/*N*/ } +/*N*/ +/*N*/ SvStorageStreamRef aStr = pStorage->OpenStream( String::CreateFromAscii( pDocInfoSlot ),STREAM_STD_READ); +/*N*/ if(!aStr.Is()) +/*N*/ return FALSE; +/*N*/ aStr->SetVersion( pStorage->GetVersion() ); +/*N*/ aStr->SetBufferSize(STREAM_BUFFER_SIZE); +/*N*/ BOOL bRet = Load(*aStr); +/*N*/ if ( bRet ) +/*N*/ { +/*N*/ String aStr = SotExchange::GetFormatMimeType( pStorage->GetFormat() ); +/*N*/ USHORT nPos = aStr.Search(';'); +/*N*/ if ( nPos != STRING_NOTFOUND ) +/*N*/ pImp->aSpecialMimeType = aStr.Copy( 0, nPos ); +/*N*/ else +/*N*/ pImp->aSpecialMimeType = aStr; +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxDocumentInfo::Save(SvStorage* pStorage) const +/*N*/ { +/*N*/ SvStorageStreamRef aStr = pStorage->OpenStream( String::CreateFromAscii( pDocInfoSlot ), STREAM_TRUNC | STREAM_STD_READWRITE); +/*N*/ if(!aStr.Is()) +/*N*/ return FALSE; +/*N*/ aStr->SetVersion( pStorage->GetVersion() ); +/*N*/ aStr->SetBufferSize(STREAM_BUFFER_SIZE); +/*N*/ if(!Save(*aStr)) +/*N*/ return FALSE; +/*N*/ return SavePropertySet( pStorage ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ const SfxDocUserKey& SfxDocumentInfo::GetUserKey( USHORT n ) const +/*N*/ { +/*N*/ DBG_ASSERT( n < GetUserKeyCount(), "user key index overflow" ); +/*N*/ return aUserKeys[n]; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxDocumentInfo::SetUserKey( const SfxDocUserKey& rKey, USHORT n ) +/*N*/ { +/*N*/ DBG_ASSERT( n < GetUserKeyCount(), "user key index overflow" ); +/*N*/ aUserKeys[n] = rKey; +/*N*/ } + + +//------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfo::SfxDocumentInfo( const SfxDocumentInfo& rInf ): +/*N*/ nUserDataSize(0), +/*N*/ pUserData(0) +/*N*/ { +/*N*/ pImp = new SfxDocumentInfo_Impl; +/*N*/ bReadOnly = rInf.bReadOnly; +/*N*/ bReloadEnabled = FALSE; +/*N*/ nReloadSecs = 60; +/*N*/ *this = rInf; +/*N*/ } + +/*N*/ BOOL SfxDocumentInfo::IsReloadEnabled() const +/*N*/ { +/*N*/ return bReloadEnabled; +/*N*/ } + +/*?*/ void SfxDocumentInfo::EnableReload( BOOL bEnable ) +/*?*/ { +/*?*/ bReloadEnabled = bEnable; +/*?*/ } + +/*N*/ const String& SfxDocumentInfo::GetDefaultTarget() const +/*N*/ { +/*N*/ return aDefaultTarget; +/*N*/ } + +/*?*/ void SfxDocumentInfo::SetDefaultTarget( const String& rString ) +/*?*/ { +/*?*/ aDefaultTarget = rString; +/*?*/ } + +/*N*/ const String& SfxDocumentInfo::GetReloadURL() const +/*N*/ { +/*N*/ return aReloadURL; +/*N*/ } + +/*?*/ void SfxDocumentInfo::SetReloadURL( const String& rString ) +/*?*/ { +/*?*/ aReloadURL = rString; +/*?*/ } + +/*N*/ ULONG SfxDocumentInfo::GetReloadDelay() const +/*N*/ { +/*N*/ return nReloadSecs; +/*N*/ } + +/*N*/ void SfxDocumentInfo::SetReloadDelay( ULONG nSec ) +/*N*/ { +/*N*/ nReloadSecs = nSec; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ const SfxDocumentInfo& SfxDocumentInfo::operator=( const SfxDocumentInfo& rInf) +/*N*/ { +/*N*/ if( this == &rInf ) return *this; +/*N*/ +/*N*/ bReadOnly = rInf.bReadOnly; +/*N*/ bPasswd = rInf.bPasswd; +/*N*/ bPortableGraphics = rInf.bPortableGraphics; +/*N*/ bSaveGraphicsCompressed = rInf.bSaveGraphicsCompressed; +/*N*/ bSaveOriginalGraphics = rInf.bSaveOriginalGraphics; +/*N*/ bQueryTemplate = rInf.bQueryTemplate; +/*N*/ bTemplateConfig = rInf.bTemplateConfig; +/*N*/ eFileCharSet = rInf.eFileCharSet; +/*N*/ +/*N*/ aCreated = rInf.aCreated; +/*N*/ aChanged = rInf.aChanged; +/*N*/ aPrinted = rInf.aPrinted; +/*N*/ aTitle = rInf.aTitle; +/*N*/ aTheme = rInf.aTheme; +/*N*/ aComment = rInf.aComment; +/*N*/ aKeywords = rInf.aKeywords; +/*N*/ +/*N*/ for(USHORT i=0; i < MAXDOCUSERKEYS; ++i) +/*N*/ aUserKeys[i] = rInf.aUserKeys[i]; +/*N*/ +/*N*/ aTemplateName = rInf.aTemplateName; +/*N*/ aTemplateFileName = rInf.aTemplateFileName; +/*N*/ aTemplateDate = rInf.aTemplateDate; +/*N*/ +/*N*/ aDefaultTarget = rInf.GetDefaultTarget(); +/*N*/ aReloadURL = rInf.GetReloadURL(); +/*N*/ bReloadEnabled = rInf.IsReloadEnabled(); +/*N*/ nReloadSecs = rInf.GetReloadDelay(); +/*N*/ +/*N*/ Free(); +/*N*/ +/*N*/ nUserDataSize = rInf.nUserDataSize; +/*N*/ if(nUserDataSize) { +/*N*/ pUserData = new char[nUserDataSize]; +/*N*/ memcpy(pUserData, rInf.pUserData, nUserDataSize); +/*N*/ } +/*N*/ lTime = rInf.lTime; +/*N*/ nDocNo = rInf.nDocNo; +/*N*/ +/*N*/ bSaveVersionOnClose = rInf.bSaveVersionOnClose; +/*N*/ pImp->aCopiesTo = rInf.pImp->aCopiesTo; +/*N*/ pImp->aOriginal = rInf.pImp->aOriginal; +/*N*/ pImp->aReferences = rInf.pImp->aReferences; +/*N*/ pImp->aRecipient = rInf.pImp->aRecipient; +/*N*/ pImp->aReplyTo = rInf.pImp->aReplyTo; +/*N*/ pImp->aBlindCopies = rInf.pImp->aBlindCopies; +/*N*/ pImp->aInReplyTo = rInf.pImp->aInReplyTo; +/*N*/ pImp->aNewsgroups = rInf.pImp->aNewsgroups; +/*N*/ pImp->aSpecialMimeType = rInf.pImp->aSpecialMimeType; +/*N*/ pImp->nPriority = rInf.pImp->nPriority; +/*N*/ pImp->bUseUserData = rInf.pImp->bUseUserData; +/*N*/ +/*N*/ return *this; +/*N*/ } + +//------------------------------------------------------------------------- + +/*?*/ int SfxDocumentInfo::operator==( const SfxDocumentInfo& rCmp) const +/*?*/ { +/*?*/ if(eFileCharSet != rCmp.eFileCharSet || +/*?*/ bPasswd != rCmp.bPasswd || +/*?*/ bPortableGraphics != rCmp.bPortableGraphics || +/*?*/ bSaveGraphicsCompressed != rCmp.bSaveGraphicsCompressed || +/*?*/ bSaveOriginalGraphics != rCmp.bSaveOriginalGraphics || +/*?*/ bQueryTemplate != rCmp.bQueryTemplate || +/*?*/ bTemplateConfig != rCmp.bTemplateConfig || +/*?*/ aCreated != rCmp.aCreated || +/*?*/ aChanged != rCmp.aChanged || +/*?*/ aPrinted != rCmp.aPrinted || +/*?*/ aTitle != rCmp.aTitle || +/*?*/ aTheme != rCmp.aTheme || +/*?*/ aComment != rCmp.aComment || +/*?*/ aKeywords != rCmp.aKeywords || +/*?*/ aTemplateName != rCmp.aTemplateName || +/*?*/ aTemplateDate != rCmp.aTemplateDate || +/*?*/ IsReloadEnabled() != rCmp.IsReloadEnabled() || +/*?*/ GetReloadURL() != rCmp.GetReloadURL() || +/*?*/ GetReloadDelay() != rCmp.GetReloadDelay() || +/*?*/ GetDefaultTarget() != rCmp.GetDefaultTarget()) +/*?*/ return FALSE; +/*?*/ +/*?*/ for(USHORT i = 0; i < MAXDOCUSERKEYS; ++i) { +/*?*/ if(aUserKeys[i] != rCmp.aUserKeys[i]) +/*?*/ return FALSE; +/*?*/ } +/*?*/ if(nUserDataSize != rCmp.nUserDataSize) +/*?*/ return FALSE; +/*?*/ if(nUserDataSize) +/*?*/ return 0 == memcmp(pUserData, rCmp.pUserData, nUserDataSize); +/*?*/ +/*?*/ if ( pImp->aCopiesTo != rCmp.pImp->aCopiesTo || +/*?*/ pImp->aOriginal != rCmp.pImp->aOriginal || +/*?*/ pImp->aReferences != rCmp.pImp->aReferences || +/*?*/ pImp->aRecipient != rCmp.pImp->aRecipient || +/*?*/ pImp->aReplyTo != rCmp.pImp->aReplyTo || +/*?*/ pImp->aBlindCopies != rCmp.pImp->aBlindCopies || +/*?*/ pImp->aInReplyTo != rCmp.pImp->aInReplyTo || +/*?*/ pImp->aNewsgroups != rCmp.pImp->aNewsgroups || +/*?*/ pImp->aSpecialMimeType != rCmp.pImp->aSpecialMimeType || +/*?*/ pImp->nPriority != rCmp.pImp->nPriority || +/*?*/ pImp->bUseUserData != rCmp.pImp->bUseUserData || +/*?*/ bSaveVersionOnClose != rCmp.bSaveVersionOnClose ) +/*?*/ return FALSE; +/*?*/ +/*?*/ return TRUE; +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxDocumentInfo::Free() +/*N*/ { +/*N*/ delete []pUserData; +/*N*/ pUserData = 0; +/*N*/ nUserDataSize = 0; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ String SfxDocumentInfo::AdjustTextLen_Impl( const String& rText, USHORT nMax ) +/*N*/ { +/*N*/ String aRet = rText; +/*! pb: dont cut any longer because the new file format has no length limit + if ( aRet.Len() > nMax ) + aRet.Erase( nMax ); */ +/*N*/ return aRet; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfo::SfxDocumentInfo() : +/*N*/ bPasswd(FALSE), +/*N*/ bQueryTemplate(FALSE), +/*N*/ bTemplateConfig(FALSE), +/*N*/ eFileCharSet(gsl_getSystemTextEncoding()), +/*N*/ nUserDataSize(0), +/*N*/ pUserData(0), +/*N*/ lTime(0), +/*N*/ nDocNo(1), +/*N*/ aChanged( TIMESTAMP_INVALID_DATETIME ), +/*N*/ aPrinted( TIMESTAMP_INVALID_DATETIME ), +/*N*/ bSaveVersionOnClose( FALSE ) +/*N*/ { +/*N*/ pImp = new SfxDocumentInfo_Impl; +/*N*/ +/*N*/ bReadOnly = FALSE; +/*N*/ bReloadEnabled = FALSE; +/*N*/ nReloadSecs = 60; +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ bPortableGraphics = TRUE; +/*N*/ SvtSaveOptions aSaveOptions; +/*N*/ bSaveGraphicsCompressed = FALSE; +/*N*/ bSaveOriginalGraphics = FALSE; +/*N*/ +/*N*/ const String aInf( DEFINE_CONST_UNICODE( "Info " ) ); +/*N*/ for( USHORT i = 0; i < MAXDOCUSERKEYS; ++i ) { +/*N*/ aUserKeys[i].aTitle = aInf; +/*N*/ aUserKeys[i].aTitle += String::CreateFromInt32(i+1); +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfo::~SfxDocumentInfo() +/*N*/ { +/*N*/ Free(); +/*N*/ delete pImp; +/*N*/ } + +/*?*/ String SfxDocumentInfo::GetCopiesTo() const +/*?*/ { +/*?*/ return pImp->aCopiesTo; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetCopiesTo( const String& rStr ) +/*?*/ { +/*?*/ pImp->aCopiesTo = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetOriginal() const +/*?*/ { +/*?*/ return pImp->aOriginal; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetOriginal( const String& rStr ) +/*?*/ { +/*?*/ pImp->aOriginal = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetReferences() const +/*?*/ { +/*?*/ return pImp->aReferences; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetReferences( const String& rStr ) +/*?*/ { +/*?*/ pImp->aReferences = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetRecipient() const +/*?*/ { +/*?*/ return pImp->aRecipient; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetRecipient( const String& rStr ) +/*?*/ { +/*?*/ pImp->aRecipient = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetReplyTo() const +/*?*/ { +/*?*/ return pImp->aReplyTo; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetReplyTo( const String& rStr ) +/*?*/ { +/*?*/ pImp->aReplyTo = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetBlindCopies() const +/*?*/ { +/*?*/ return pImp->aBlindCopies; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetBlindCopies( const String& rStr ) +/*?*/ { +/*?*/ pImp->aBlindCopies = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetInReplyTo() const +/*?*/ { +/*?*/ return pImp->aInReplyTo; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetInReplyTo( const String& rStr ) +/*?*/ { +/*?*/ pImp->aInReplyTo = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetNewsgroups() const +/*?*/ { +/*?*/ return pImp->aNewsgroups; +/*?*/ } + +/*?*/ void SfxDocumentInfo::SetNewsgroups( const String& rStr ) +/*?*/ { +/*?*/ pImp->aNewsgroups = rStr; +/*?*/ } + +/*?*/ String SfxDocumentInfo::GetSpecialMimeType() const +/*?*/ { +/*?*/ return pImp->aSpecialMimeType; +/*?*/ } + +/*N*/ USHORT SfxDocumentInfo::GetPriority() const +/*N*/ { +/*N*/ return pImp->nPriority; +/*N*/ } + +/*N*/ void SfxDocumentInfo::SetPriority( USHORT nPrio ) +/*N*/ { +/*N*/ pImp->nPriority = nPrio; +/*N*/ } + +/*N*/ BOOL SfxDocumentInfo::IsUseUserData() const +/*N*/ { +/*N*/ return pImp->bUseUserData; +/*N*/ } + +/*N*/ void SfxDocumentInfo::SetUseUserData( BOOL bNew ) +/*N*/ { +/*N*/ pImp->bUseUserData = bNew; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SfxDocumentInfo::SetTitle( const String& rVal ) +/*N*/ { +/*N*/ aTitle = AdjustTextLen_Impl( rVal, SFXDOCINFO_TITLELENMAX ); +/*N*/ } +//------------------------------------------------------------------------ + +/*N*/ void SfxDocumentInfo::SetTheme( const String& rVal ) +/*N*/ { +/*N*/ aTheme = AdjustTextLen_Impl( rVal, SFXDOCINFO_THEMELENMAX ); +/*N*/ } +//------------------------------------------------------------------------ + +/*N*/ void SfxDocumentInfo::SetComment( const String& rVal ) +/*N*/ { +/*N*/ aComment = AdjustTextLen_Impl( rVal, SFXDOCINFO_COMMENTLENMAX ); +/*N*/ } +//------------------------------------------------------------------------ + +/*N*/ void SfxDocumentInfo::SetKeywords( const String& rVal ) +/*N*/ { +/*N*/ aKeywords = AdjustTextLen_Impl( rVal, SFXDOCINFO_KEYWORDLENMAX ); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_frameobj.cxx b/binfilter/bf_sfx2/source/doc/sfx2_frameobj.cxx new file mode 100644 index 000000000000..0c680d99ccef --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_frameobj.cxx @@ -0,0 +1,388 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <sot/clsids.hxx> +#include <bf_so3/ipwin.hxx> + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "frameobj.hxx" + +#include "frmdescr.hxx" + +#include <appdata.hxx> + +#include "app.hxx" + +#include "objsh.hxx" + +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + + + + + + + +/*N*/ struct SfxFrameObject_Impl +/* [Beschreibung] + + Impl-Struktur des SfxFrameObjects. +*/ +/*N*/ { +/*N*/ SfxFrameDescriptor* pFrmDescr; +/*N*/ Timer* pNewObjectTimer; +/*N*/ SfxObjectShellLock xDoc; +/*N*/ +/*N*/ SfxFrameObject_Impl() +/*N*/ : pFrmDescr( new SfxFrameDescriptor( NULL ) ) +/*N*/ , pNewObjectTimer( NULL ) +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ ~SfxFrameObject_Impl() +/*N*/ { +/*N*/ // Der Descriptor geh"ort dem Object, andere erhalten +/*N*/ // davon immer nur Clones +/*N*/ delete pFrmDescr; +/*N*/ } +/*N*/ }; + + + + + +//========================================================================= +/* [Beschreibung] + + Das Environment wird im <SfxFrameObject::InPlaceActivate()> angelegt. + Durch die Verbindung mit dem Container Environment kann "uber die + UI-Tools und Fenster verhandelt werden. + + [Querverweise] + + <SvInPlaceEnvironment>, <SvContainerEnvironment> +*/ + +//========================================================================= +/* [Beschreibung] + + Die angelegten Fenster werden zerst"ort. +*/ + + +//========================================================================= +//============== SfxFrameObject =========================================== +//========================================================================= +/*N*/ SO2_IMPL_BASIC_CLASS1_DLL( SfxFrameObject, SvFactory, SvInPlaceObject, +/*N*/ SvGlobalName( BF_SO3_IFRAME_CLASSID ) ) + +//========================================================================= +/*?*/ SfxFrameObject::SfxFrameObject() +/*?*/ : pImpl( new SfxFrameObject_Impl ) +/* [Beschreibung] + + Konstruktor der Klasse SfxFrameObject. Die Verbliste und das + Format werden global initialisiert. +*/ +/*?*/ { +/*?*/ } + +//========================================================================= +/*?*/ SfxFrameObject::~SfxFrameObject() +/* [Beschreibung] + + Destruktor der Klasse SfxFrameObject. +*/ +/*?*/ { +/*?*/ delete pImpl; +/*?*/ } + + +//========================================================================= +/* [Beschreibung] + + Wenn die Daten sich "andern, muss das Modify-Flag gesetzt werden. + Ausserdem m"ussen alle angemeldeten Advises benachrichtigt werden. + In Abh"angigkeit des Parameters wird angezeigt, dass sich auch + die View und das Mtf ge"andert hat. +*/ + +//========================================================================= +/* [Beschreibung] + + Mit dieser Methode werden Informationen "uber das Objekt angefordert. + Wird das Objekt gesichert, dann werden diese Informationen in den + Storage geschrieben. + + [Anmerkung] +*/ + +//========================================================================= +/* [Beschreibung] + + Die Verbindung zum Client wird ge"offnet oder geschlossen. + + [Querverweise] + + <SvEmbeddedObject::Open()> +*/ + +//========================================================================= +/* [Beschreibung] + + Das Objekt wird InPlace aktiviert oder deaktiviert. + + [Querverweise] + + <SvInPlaceObject::InPlaceActivate()> +*/ + +//========================================================================= +/* [Beschreibung] + + Es wird Versucht ein Applet zu starten. Es gibt nur die M"oglichkeit + InPlace zu aktivieren. Deshalb sind auch nur die Verben gestattet, + die dies ausl"osen. + + [R"uckgabewert] + + BOOL TRUE, es wurde InPlace aktiviert. + FALSE, es wurde nicht InPLace aktiviert. + + [Querverweise] + + <SvPseudoObject::Verb> +*/ + +//========================================================================= +/* [Beschreibung] + + Der sichtbare Ausschnitt beginnt immer an der Position (0, 0). +*/ + + +//========================================================================= +// aus PlugIn + +//========================================================================= +/* [Beschreibung] + + Ein Ausgabe ist nicht m"oglich und auch nicht n"otig. + und als Unterschrift der URL ausgegeben, + + [Querverweise] + + <SvEmbeddedObject::Draw> +*/ + +//========================================================================= +/* [Beschreibung] + + Nach dem Konstruktor muss diese Methode oder Load gerufen werden, + um das Objekt zu initialisieren. + <SvPersist::InitNew> + + [R"uckgabewert] + + BOOL TRUE, Initialisierung hat geklappt. + FALSE, Initialisierung hat nicht geklappt, das Objekt + muss sofort freigegeben werden. + + [Querverweise] + +*/ + +//========================================================================= +/*N*/ static const char * pDocName = "FloatingFrame"; +#define nVersion 3 + +/*N*/ BOOL SfxFrameObject::Load +/*N*/ ( +/*N*/ SvStorage * pStor /* Storage aus dem das Objekt geladen wird. */ +/*N*/ ) +/* [Beschreibung] + + Nach dem Konstruktor muss diese Methode oder InitNew gerufen werden, + um das Objekt zu initialisieren. + + [R"uckgabewert] + + BOOL TRUE, das Objekt wurde geladen. + FALSE, das Objekt wurde nicht geladen, es + muss sofort freigegeben werden. + + [Querverweise] + + <SvPersist::Load> +*/ +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return FALSE; +/*N*/ } + +//========================================================================= +/*N*/ BOOL SfxFrameObject::Save() +/* [Beschreibung] + + Der Inhalt des Objektes wird in den, in <SfxFrameObject::InitNew> + oder <SfxFrameObject::Load> "ubergebenen Storage, geschrieben. + + [R"uckgabewert] + + BOOL TRUE, das Objekt wurde geschreiben. + FALSE, das Objekt wurde nicht geschrieben. Es muss + die in der Klasse <SvPersist> beschrieben + Fehlerbehandlung erfolgen. + + [Querverweise] + + <SvPersist::Save> +*/ +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return FALSE; +/*N*/ } + +//========================================================================= +/*N*/ BOOL SfxFrameObject::SaveAs +/*N*/ ( +/*N*/ SvStorage *pStor /* Storage, in den der Inhalt des Objekte + geschrieben wird */ +/*N*/ ) +/* [Beschreibung] + + Der Inhalt des Objektes wird in pStor geschrieben. + + [Anmerkung] + + Der Storage wird nicht behalten. + + [R"uckgabewert] + + BOOL TRUE, das Objekt wurde geschreiben. + FALSE, das Objekt wurde nicht geschrieben. Es muss + die in der Klasse <SvPersist> beschrieben + Fehlerbehandlung erfolgen. + + [Querverweise] + + <SvPersist::SaveAs> +*/ +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ return FALSE; +/*N*/ } + +//========================================================================= +/* [Beschreibung] + + Ab diesen Zeitpunkt, bis zum <SfxFrameObject::SaveCompleted>, + darf auf den Storage im Objekt nicht zugegriffen werden. + + [Querverweise] + + <SvPersist::HandsOff> +*/ + +//========================================================================= +/*N*/ BOOL SfxFrameObject::SaveCompleted +/*N*/ ( +/*N*/ SvStorage * pStor /* Storage auf dem das Objekt arbeitet. Der kann + auch NULL sein. Dies Bedeutet, es wird auf + dem alten Storage weiter gearbeitet */ +/*N*/ ) +/* [Beschreibung] + + Nach dem Aufruf dieser Methode ist das Verhalten des Objektes + wieder definiert. + + [R"uckgabewert] + + BOOL TRUE, es kann auf dem neuen Storage gearbeitet werden. + FALSE, es kann nicht auf dem neuen Storage gearbeitet + werden + + [Querverweise] + + <SvPersist::SaveCompleted> +*/ +/*N*/ { +/*N*/ return SvInPlaceObject::SaveCompleted( pStor ); +/*N*/ } + +//========================================================================= +/* [Beschreibung] + + Da ein Applet immer aktiviert wird, es ein Link ist und er + keine UI-Tools braucht, muss dieser Status zur"uckgegeben werden. + + [R"uckgabewert] + + ULONG Es wird immer SVOBJ_MISCSTATUS_LINK, + SVOBJ_MISCSTATUS_INSIDEOUT und + SVOBJ_MISCSTATUS_ACTIVATEWHENVISIBLE zur"uckgegeben + + [Querverweise] + + <SvPseudoObject::GetMiscStatus()> +*/ + +//========================================================================= +/* [Beschreibung] + + Dieser Typ von Objekt ist immer ein Link. + + [R"uckgabewert] + + BOOL Immer TRUE. + + [Querverweise] + + <SvPseudoObject::IsLink()> +*/ + +/*?*/ void SfxFrameObject::SetFrameDescriptor( const SfxFrameDescriptor *pD ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +/*?*/ const SfxFrameDescriptor* SfxFrameObject::GetFrameDescriptor() const +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*?*/ } + + + +/*N*/ SfxFrameObjectFactoryPtr* SfxFrameObject::GetFactoryPtr() +/*N*/ { +/*N*/ return SFX_APP()->Get_Impl()->pSfxFrameObjectFactoryPtr; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_frmdescr.cxx b/binfilter/bf_sfx2/source/doc/sfx2_frmdescr.cxx new file mode 100644 index 000000000000..ba855a76c47d --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_frmdescr.cxx @@ -0,0 +1,179 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <vcl/splitwin.hxx> +#include <bf_svtools/itemset.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "frmdescr.hxx" +#include "app.hxx" +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +/*N*/ DBG_NAME(SfxFrameSetDescriptor) +/*N*/ DBG_NAME(SfxFrameDescriptor) + +#define VERSION (USHORT) 3 + +/*N*/ struct SfxFrameSetDescriptor_Impl +/*N*/ { +/*N*/ Wallpaper* pWallpaper; +/*N*/ Bitmap* pBitmap; +/*N*/ BOOL bNetscapeCompat; +/*N*/ }; + +/*N*/ struct SfxFrameDescriptor_Impl +/*N*/ { +/*N*/ Wallpaper* pWallpaper; +/*N*/ SfxItemSet* pArgs; +/*N*/ BOOL bEditable; +/*N*/ +/*N*/ SfxFrameDescriptor_Impl() : pWallpaper( NULL ), pArgs( NULL ), bEditable( TRUE ) {} +/*N*/ ~SfxFrameDescriptor_Impl() +/*N*/ { +/*N*/ delete pWallpaper; +/*N*/ delete pArgs; +/*N*/ } +/*N*/ }; + +/*N*/ SfxFrameDescriptor::SfxFrameDescriptor( SfxFrameSetDescriptor *pParSet ) : +/*N*/ aMargin( -1, -1 ), +/*N*/ nWidth( 0L ), +/*N*/ nItemId( 0 ), +/*N*/ pFrameSet( 0L ), +/*N*/ pParentFrameSet( pParSet ), +/*N*/ eScroll( ScrollingAuto ), +/*N*/ eSizeSelector( SIZE_ABS ), +/*N*/ nHasBorder( BORDER_YES ), +/*N*/ bResizeHorizontal( TRUE ), +/*N*/ bResizeVertical( TRUE ), +/*N*/ bHasUI( TRUE ), +/*N*/ bReadOnly( FALSE ) +/*N*/ { +/*N*/ DBG_CTOR(SfxFrameDescriptor, 0); +/*N*/ +/*N*/ pImp = new SfxFrameDescriptor_Impl; +/*N*/ if ( pParentFrameSet ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pParentFrameSet->InsertFrame( this ); +/*N*/ } + +/*N*/ SfxFrameDescriptor::~SfxFrameDescriptor() +/*N*/ { +/*N*/ DBG_DTOR(SfxFrameDescriptor, 0); +/*N*/ +/*N*/ if ( pFrameSet ) +/*N*/ delete pFrameSet; +/*N*/ if ( pParentFrameSet ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pParentFrameSet->RemoveFrame( this ); +/*N*/ delete pImp; +/*N*/ } + +/*?*/ void SfxFrameDescriptor::SetURL( const String& rURL ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +/*N*/ SfxFrameDescriptor* SfxFrameDescriptor::Clone( +/*N*/ SfxFrameSetDescriptor *pSet, BOOL bWithIds ) const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*N*/ } + +/*N*/ SfxFrameProperties& SfxFrameProperties::operator =( +/*N*/ const SfxFrameProperties &rProp ) +/*N*/ { +/*N*/ aURL = rProp.aURL; +/*N*/ aName = rProp.aName; +/*N*/ lMarginWidth = rProp.lMarginWidth; +/*N*/ lMarginHeight = rProp.lMarginHeight; +/*N*/ lSize = rProp.lSize; +/*N*/ lSetSize = rProp.lSetSize; +/*N*/ lFrameSpacing = rProp.lFrameSpacing; +/*N*/ lInheritedFrameSpacing = rProp.lInheritedFrameSpacing; +/*N*/ eScroll = rProp.eScroll; +/*N*/ eSizeSelector = rProp.eSizeSelector; +/*N*/ eSetSizeSelector = rProp.eSetSizeSelector; +/*N*/ bHasBorder = rProp.bHasBorder; +/*N*/ bBorderSet = rProp.bBorderSet; +/*N*/ bResizable = rProp.bResizable; +/*N*/ bSetResizable = rProp.bSetResizable; +/*N*/ bIsRootSet = rProp.bIsRootSet; +/*N*/ bIsInColSet = rProp.bIsInColSet; +/*N*/ bHasBorderInherited = rProp.bHasBorderInherited; +/*N*/ pFrame = rProp.pFrame->Clone(); +/*N*/ return *this; +/*N*/ } + +/*N*/ int SfxFrameProperties::operator ==( const SfxFrameProperties& rProp ) const +/*N*/ { +/*N*/ return aURL == rProp.aURL && aName == rProp.aName && lMarginWidth == rProp.lMarginWidth && lMarginHeight == rProp.lMarginHeight && +/*N*/ lSize == rProp.lSize && eScroll == rProp.eScroll && eSizeSelector == rProp.eSizeSelector && +/*N*/ lSetSize == rProp.lSetSize && lFrameSpacing == rProp.lFrameSpacing && eSetSizeSelector == rProp.eSetSizeSelector && +/*N*/ bHasBorder == rProp.bHasBorder && bBorderSet == rProp.bBorderSet && +/*N*/ bResizable == rProp.bResizable && bSetResizable == rProp.bSetResizable; +/*N*/ } + +/*?*/ TYPEINIT1(SfxFrameDescriptorItem, SfxPoolItem); + +/*?*/ SfxFrameDescriptorItem::~SfxFrameDescriptorItem() +/*?*/ {} + +/*?*/ int SfxFrameDescriptorItem::operator==( const SfxPoolItem& rAttr ) const +/*?*/ { +/*?*/ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); +/*?*/ +/*?*/ return aProperties == ((SfxFrameDescriptorItem&)rAttr).aProperties; +/*?*/ } + +// ----------------------------------------------------------------------- + +/*?*/ SfxPoolItem* SfxFrameDescriptorItem::Clone( SfxItemPool* ) const +/*?*/ { +/*?*/ return new SfxFrameDescriptorItem( *this ); +/*?*/ } + +//------------------------------------------------------------------------ + +/*?*/ SfxItemPresentation SfxFrameDescriptorItem::GetPresentation +/*?*/ ( +/*?*/ SfxItemPresentation ePres, +/*?*/ SfxMapUnit eCoreUnit, +/*?*/ SfxMapUnit ePresUnit, +/*?*/ XubString& rText, +/*?*/ const ::IntlWrapper * +/*?*/ ) const +/*?*/ { +/*?*/ rText.Erase(); +/*?*/ return SFX_ITEM_PRESENTATION_NONE; +/*?*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_interno.cxx b/binfilter/bf_sfx2/source/doc/sfx2_interno.cxx new file mode 100644 index 000000000000..b70a394b15c0 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_interno.cxx @@ -0,0 +1,273 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_so3/ipenv.hxx> +#include <bf_svtools/eitem.hxx> + +#define _SFX_INTERNO_CXX + + +#include <bf_svtools/imgdef.hxx> + +#include "request.hxx" +#include "docfac.hxx" +#include "interno.hxx" +#include "fltfnc.hxx" + +namespace binfilter { + +//------------------------------------------------------------------------- + +#define SVIPWINDOW(p) ((SvInPlaceWindow&)p->GetWindow()) + +//------------------------------------------------------------------------- +/*N*/ SV_IMPL_FACTORY(SfxInPlaceObjectFactory){}}; +/*N*/ TYPEINIT1(SfxInPlaceObjectFactory,SvFactory); +/*N*/ SO2_IMPL_CLASS1(SfxInPlaceObject,SfxInPlaceObjectFactory,SvInPlaceObject, +/*N*/ SvGlobalName(0x3C8A87D0L,0x9B53,0x11d3,0x9E,0xCE,0x00,0x50,0x04,0xD7,0x6C,0x4E))//STRIP002 SvGlobalName(0x3C8A87D0L,0x9B53,0x11d3,0x9E,0xCE,0x00,0x50,0x04,0xD7,0x6C,0x4D)) +/*?*/ void SfxInPlaceObject::TestMemberObjRef(BOOL){} +/*?*/ void SfxInPlaceObject::TestMemberInvariant(BOOL){} +/*?*/ ::IUnknown* SfxInPlaceObject::GetMemberInterface( const SvGlobalName & ){ return 0L; } + +/*N*/ SfxInPlaceObject::SfxInPlaceObject() +/*N*/ : pObjShell(0) +/*N*/ { +/*N*/ bTriggerLinkTimer = TRUE; +/*N*/ bDisableViewScaling = FALSE; +/*N*/ pNote = 0; +/*N*/ +/*N*/ SvVerbList* pVerbs = new SvVerbList; +/*N*/ SetVerbList( pVerbs, TRUE ); +/*N*/ } + +/*N*/ void SfxInPlaceObject::SetShell( SfxObjectShell *pObjSh ) +/*N*/ { +/*N*/ pObjShell = pObjSh; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxInPlaceObject::~SfxInPlaceObject() +/*N*/ { +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::FillClass( SvGlobalName * pClassName, +/*N*/ ULONG * pClipFormat, +/*N*/ String * pAppName, +/*N*/ String * pLongUserName, +/*N*/ String * pUserName, +/*N*/ long nVersion +/*N*/ ) const +/*N*/ { +/*N*/ SvPersist::FillClass( pClassName, pClipFormat, pAppName, +/*N*/ pLongUserName, pUserName, nVersion ); +/*N*/ DBG_ASSERT( pObjShell, +/*N*/ "SfxInPlaceObject::FillClass(): you must call SetShell() bevor" ); +/*N*/ SfxObjectFactory &rFact = pObjShell->GetFactory(); +/*N*/ +/*N*/ for( USHORT n = 0; n < rFact.GetFilterCount(); n++ ) +/*N*/ { +/*N*/ const SfxFilter * pFilter = rFact.GetFilter( n ); +/*N*/ +/*N*/ if ( pFilter->IsOwnFormat() && +/*N*/ pFilter->GetVersion() == (ULONG)nVersion ) +/*N*/ { +/*N*/ *pClassName = *GetSvFactory(); +/*N*/ *pClipFormat = pFilter->GetFormat(); +/*N*/ *pLongUserName = pFilter->GetFilterName(); +/*N*/ *pUserName = pFilter->GetFilterName(); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ *pAppName = String::CreateFromAscii("Office"); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::SetModified( BOOL bSet ) +/*N*/ { +/*N*/ if ( !bSet || !pObjShell->IsReadOnlyMedium() ) +/*N*/ { +/*N*/ SvInPlaceObject::SetModified( bSet ); +/*N*/ if( bSet && bTriggerLinkTimer && IsEnableSetModified() ) +/*N*/ { +/*N*/ ViewChanged( ASPECT_CONTENT ); +/*N*/ } +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::UpdateLinks() +/*N*/ { +/*N*/ SendViewChanged(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BOOL SfxInPlaceObject::InitNew( SvStorage * pStor) +/*N*/ { +/*N*/ if( SvInPlaceObject::InitNew( pStor ) ) +/*N*/ { +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BOOL SfxInPlaceObject::Load( SvStorage * pStor ) +/*N*/ { +/*N*/ if( SvInPlaceObject::Load( pStor ) ) +/*N*/ { +/*N*/ // Spaeter mal Childs on demand +/*N*/ // if( LoadChilds() ) +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BOOL SfxInPlaceObject::Save() +/*N*/ { +/*N*/ if( !SaveChilds() ) +/*N*/ return FALSE; +/*N*/ if( SvInPlaceObject::Save() ) +/*N*/ return pObjShell->SfxObjectShell::Save(); +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BOOL SfxInPlaceObject::SaveAs( SvStorage * pNewStor ) +/*N*/ { +/*N*/ if( !SaveAsChilds( pNewStor ) ) +/*N*/ return FALSE; +/*N*/ if( SvInPlaceObject::SaveAs( pNewStor ) ) +/*N*/ return pObjShell->SfxObjectShell::SaveAs(pNewStor); +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::HandsOff() +/*N*/ { +/*N*/ SvInPlaceObject::HandsOff(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BOOL SfxInPlaceObject::SaveCompleted( SvStorage * pStor ) +/*N*/ { +/*N*/ if( !SaveCompletedChilds( pStor ) ) +/*N*/ return FALSE; +/*N*/ if( SvInPlaceObject::SaveCompleted( pStor ) ) +/*N*/ { +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::SetVisArea( const Rectangle & rRect ) +/*N*/ { +/*N*/ if( GetVisArea() != rRect ) +/*N*/ { +/*N*/ Size aSize (GetVisArea().GetSize()); +/*N*/ // Groesse des Objects setzen +/*N*/ SvInPlaceObject::SetVisArea( rRect ); +/*N*/ +/*N*/ SetModified( TRUE ); +/*N*/ +/*N*/ if ( GetIPEnv() && GetIPEnv()->GetEditWin() ) +/*?*/ ViewChanged( ASPECT_CONTENT ); +/*N*/ +/*N*/ // OutPlace die Gr"o\se des MDI-Fensters anpassen +/*N*/ // Unbedingt den Gr"o\senvergleich machen, spart nicht nur Zeit, sondern +/*N*/ // vermeidet auch Rundungsfehler ! +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ ErrCode SfxInPlaceObject::Verb( long nVerb, SvEmbeddedClient *pCaller, +/*N*/ Window *pWindow, const Rectangle* pRect) +/*N*/ { + return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*?*/ BOOL SfxInPlaceObject::Verb( long nVerb, const Rectangle* pRect ) +/*?*/ { +/*?*/ return (BOOL)DoEmbed( TRUE ); +/*?*/ } + +//-------------------------------------------------------------------- + +/*?*/ void SfxInPlaceObject::Open( BOOL bOpen ) +/*?*/ { +/*?*/ SvInPlaceObject::Open( bOpen ); +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::InPlaceActivate( BOOL bActivate ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::Embed( BOOL bEmbed ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxInPlaceObject::DocumentNameChanged( const String & rDocName ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxForceLinkTimer_Impl::SfxForceLinkTimer_Impl( SfxObjectShell *pObj ) +/*N*/ { +/*N*/ pInObj = pObj->GetInPlaceObject(); +/*N*/ if( pInObj ) +/*N*/ { +/*N*/ pInObj->SetTriggerLinkTimer( FALSE ); +/*N*/ pInObj->UpdateLinks(); +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objcont.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objcont.cxx new file mode 100644 index 000000000000..a8b5d376df95 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objcont.cxx @@ -0,0 +1,515 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/uno/Reference.hxx> + +#include <com/sun/star/document/UpdateDocMode.hpp> + +#include <tools/cachestr.hxx> +#include <bf_svtools/style.hxx> + +#include <bf_sfx2/app.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/rectitem.hxx> +#include <bf_svtools/urihelper.hxx> +#include <comphelper/processfactory.hxx> + +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/ehdl.hxx> +#include <tools/datetime.hxx> +#include <math.h> + +#include <bf_svtools/saveopt.hxx> +#include <bf_svtools/useroptions.hxx> +#include <unotools/localfilehelper.hxx> +#include <bf_so3/svstor.hxx> + +#include "docinf.hxx" +#include "fltfnc.hxx" +#include "docfac.hxx" +#include "cfgmgr.hxx" +#include "objsh.hxx" +#include "objshimp.hxx" +#include "cfgitem.hxx" +#include "evntconf.hxx" +#include "interno.hxx" +#include "printer.hxx" +#include "doctempl.hxx" +#include "appdata.hxx" +#include "sfxbasemodel.hxx" + +#include <bf_svtools/imgdef.hxx> + +#include "docfile.hxx" +#include "objuno.hxx" +#include "request.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#include "bf_basic/basmgr.hxx" + +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +//==================================================================== + +#define SFX_WINDOWS_STREAM "SfxWindows" +#define SFX_PREVIEW_STREAM "SfxPreview" + +//==================================================================== + +/*?*/ GDIMetaFile* SfxObjectShell::GetPreviewMetaFile( sal_Bool bFullContent ) const +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*?*/ } + +/*N*/ FASTBOOL SfxObjectShell::SaveWindows_Impl( SvStorage &rStor ) const +/*N*/ { +/*N*/ return FALSE; +/*N*/ } + +//==================================================================== + + +//==================================================================== + +/*N*/ void SfxObjectShell::UpdateDocInfoForSave() +/*N*/ { +/*N*/ if( !pImp->bDoNotTouchDocInfo ) +/*N*/ { +/*N*/ SfxDocumentInfo &rDocInfo = GetDocInfo(); +/*N*/ rDocInfo.SetTemplateConfig( HasTemplateConfig() ); +/*N*/ +/*N*/ if ( IsModified() ) +/*N*/ { +/*N*/ // Keine Unterschiede mehr zwischen Save, SaveAs +/*N*/ String aUserName = SvtUserOptions().GetFullName(); +/*N*/ if ( !rDocInfo.IsUseUserData() ) +/*N*/ { +/*N*/ SfxStamp aCreated = rDocInfo.GetCreated(); +/*N*/ if ( aUserName == aCreated.GetName() ) +/*N*/ { +/*N*/ aCreated.SetName( String() ); +/*N*/ rDocInfo.SetCreated( aCreated ); +/*N*/ } +/*N*/ +/*N*/ SfxStamp aPrinted = rDocInfo.GetPrinted(); +/*N*/ if ( aUserName == aPrinted.GetName() ) +/*N*/ { +/*N*/ aPrinted.SetName( String() ); +/*N*/ rDocInfo.SetPrinted( aPrinted ); +/*N*/ } +/*N*/ +/*N*/ aUserName.Erase(); +/*N*/ } +/*N*/ +/*N*/ rDocInfo.SetChanged( aUserName ); +/*N*/ if ( !HasName() || pImp->bIsSaving ) +/*N*/ UpdateTime_Impl( rDocInfo ); +/*N*/ } +/*N*/ +/*N*/ if ( !pImp->bIsSaving ) +/*N*/ rDocInfo.SetPasswd( pImp->bPasswd ); +/*N*/ +/*N*/ Broadcast( SfxDocumentInfoHint( &rDocInfo ) ); +/*N*/ } +/*N*/ } + +// ----------------------------------------------------------------------- + +/*N*/ BOOL SfxObjectShell::SaveInfoAndConfig_Impl( SvStorageRef pNewStg ) +/*N*/ { +/*N*/ //Demnaechst mal gemeinsame Teile zusammenfassen +/*N*/ UpdateDocInfoForSave(); +/*N*/ +/*N*/ #if !defined( SFX_KEY_MAXPREVIEWSIZE ) && defined( TFPLUGCOMM ) +/*N*/ #define SFX_KEY_MAXPREVIEWSIZE SFX_KEY_ISFREE +/*N*/ #endif +/*N*/ +/*N*/ #ifdef MI_doch_wieder_die_alte_preview +/*N*/ String aMaxSize = SFX_INIMANAGER()->Get( SFX_KEY_MAXPREVIEWSIZE ); +/*N*/ ULONG nMaxSize = aMaxSize.Len() ? ULONG( aMaxSize ) : 50000; +/*N*/ #else +/*N*/ ULONG nMaxSize = 0L; +/*N*/ #endif +/*N*/ if( nMaxSize && !GetDocInfo().IsPasswd() && +/*N*/ SFX_CREATE_MODE_STANDARD == eCreateMode ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/*N*/ if( pImp->bIsSaving ) +/*N*/ { +/*N*/ //!! kein Aufruf der Basisklasse wegen doppeltem Aufruf in Persist +/*N*/ //if(!SfxObjectShell::Save()) +/*N*/ // return FALSE; +/*N*/ SvStorageRef aRef = GetMedium()->GetStorage(); +/*N*/ if ( aRef.Is() ) +/*N*/ { +/*N*/ SfxDocumentInfo& rDocInfo = GetDocInfo(); +/*N*/ rDocInfo.Save(pNewStg); +/*N*/ +/*N*/ // wenn es sich um ein Dokument lokales Basic handelt, dieses +/*N*/ // schreiben +/*N*/ if ( pImp->pBasicMgr ) +/*?*/ pImp->pBasicMgr->Store( + *pNewStg, + ::binfilter::StaticBaseUrl::GetBaseURL( + INetURLObject::NO_DECODE) ); +/*N*/ else +/*N*/ { +/*N*/ String aURL; +/*N*/ if( HasName() ) +/*N*/ aURL = GetMedium()->GetName(); +/*N*/ else +/*?*/ { +/*?*/ aURL = GetDocInfo().GetTemplateFileName(); +/*?*/ // Bei Templates keine URL... +/*?*/ aURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( aURL ); +/*N*/ } +/*N*/ #ifndef TFPLUGCOMM +/*N*/ BasicManager::CopyBasicData( + GetStorage(), aURL, + ::binfilter::StaticBaseUrl::GetBaseURL( + INetURLObject::NO_DECODE), + pNewStg ); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ // Windows-merken +/*N*/ if ( TRUE ) HACK(aus config) +/*N*/ SaveWindows_Impl( *pNewStg ); +/*N*/ +/*N*/ // Konfiguration schreiben +/*N*/ if ( GetConfigManager() ) +/*N*/ { +/* //!MBA + if ( rDocInfo.HasTemplateConfig() ) + { + const String aTemplFileName( rDocInfo.GetTemplateFileName() ); + if ( aTemplFileName.Len() ) + { + INetURLObject aURL( aTemplFileName ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL !" ); + + SvStorageRef aStor = new SvStorage( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( SVSTREAM_OK == aStor->GetError() ) + { + GetConfigManager()->StoreConfiguration(aStor); + if (aRef->IsStream(SfxConfigManager::GetStreamName())) + aRef->Remove(SfxConfigManager::GetStreamName()); + } + } + } + else + */ +/*N*/ { +//! MBA GetConfigManager()->SetModified( TRUE ); +/*?*/ GetConfigManager()->StoreConfiguration( pNewStg ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ return TRUE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ //!! kein Aufruf der Basisklasse wegen doppeltem Aufruf in Persist +/*N*/ //if(!SfxObjectShell::SaveAs(pNewStg)) +/*N*/ // return FALSE; +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ SfxMedium *pActMed = GetMedium(); +/*N*/ +/*N*/ // alte DocInfo laden +/*N*/ SfxDocumentInfo &rDocInfo = GetDocInfo(); +/*N*/ +/*N*/ // DocInfo speichern +/*N*/ rDocInfo.Save( pNewStg ); +/*N*/ +/*N*/ // wenn es sich um ein Dokument lokales Basic handelt, dieses schreiben +/*N*/ if ( pImp->pBasicMgr ) +/*N*/ pImp->pBasicMgr->Store( + *pNewStg, + ::binfilter::StaticBaseUrl::GetBaseURL(INetURLObject::NO_DECODE) ); +/*N*/ #ifndef MI_NONOS +/*N*/ else +/*N*/ { +/*?*/ String aURL; +/*?*/ if( HasName() ) +/*?*/ aURL = GetMedium()->GetName(); +/*?*/ else +/*?*/ { +/*?*/ aURL = GetDocInfo().GetTemplateFileName(); +/*?*/ // Bei Templates keine URL... +/*?*/ aURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( aURL ); +/*?*/ } +/*?*/ #ifndef TFPLUGCOMM +/*?*/ BasicManager::CopyBasicData( + GetStorage(), aURL, + ::binfilter::StaticBaseUrl::GetBaseURL(INetURLObject::NO_DECODE), + pNewStg ); +/*?*/ #endif +/*N*/ } +/*N*/ #endif +/*N*/ // Windows-merken +/*N*/ if ( TRUE ) HACK(aus config) +/*N*/ SaveWindows_Impl( *pNewStg ); +/*N*/ +/*N*/ // Konfiguration schreiben +/*N*/ if (GetConfigManager()) +/*N*/ { +/* //!MBA + if ( rDocInfo.HasTemplateConfig() ) + { + const String aTemplFileName( rDocInfo.GetTemplateFileName() ); + if ( aTemplFileName.Len() ) + { + INetURLObject aURL( aTemplFileName ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL !" ); + + SvStorageRef aStor = new SvStorage( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( SVSTREAM_OK == aStor->GetError() ) + { + GetConfigManager()->StoreConfiguration(aStor); + if (pNewStg->IsStream(SfxConfigManager::GetStreamName())) + pNewStg->Remove(SfxConfigManager::GetStreamName()); + } + } + } + else + */ +/*N*/ { +//!MBA GetConfigManager()->SetModified( TRUE ); +/*?*/ GetConfigManager()->StoreConfiguration(pNewStg); + } +/*N*/ } +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +// Bearbeitungszeit aktualisieren +/*N*/ SfxDocumentInfo& SfxObjectShell::UpdateTime_Impl(SfxDocumentInfo &rInfo) +/*N*/ { +/*N*/ // Get old time from documentinfo +/*N*/ Time aOldTime(rInfo.GetTime()); +/*N*/ +/*N*/ // Initialize some local member! Its neccessary for wollow operations! +/*N*/ DateTime aNow ; // Date and time at current moment +/*N*/ Time n24Time (24,0,0,0) ; // Time-value for 24 hours - see follow calculation +/*N*/ ULONG nDays = 0 ; // Count of days between now and last editing +/*N*/ Time nAddTime (0) ; // Value to add on aOldTime +/*N*/ +/*N*/ // Safe impossible cases! +/*N*/ // User has changed time to the past between last editing and now ... its not possible!!! +/*N*/ DBG_ASSERT( !(aNow.GetDate()<pImp->nTime.GetDate()), "Timestamp of last change is in the past ?!..." ); +/*N*/ +/*N*/ // Do the follow only, if user has NOT changed time to the past. +/*N*/ // Else add a time of 0 to aOldTime ... !!! +/*N*/ if (aNow.GetDate()>=pImp->nTime.GetDate()) +/*N*/ { +/*N*/ // Get count of days last editing. +/*N*/ nDays = aNow.GetSecFromDateTime(pImp->nTime.GetDate())/86400 ; +/*N*/ +/*N*/ if (nDays==0) +/*N*/ { +/*N*/ // If no day between now and last editing - calculate time directly. +/*N*/ nAddTime = (const Time&)aNow - (const Time&)pImp->nTime ; +/*N*/ } +/*N*/ else +/*N*/ // If time of working without save greater then 1 month (!) .... +/*N*/ // we add 0 to aOldTime! +/*N*/ if (nDays<=31) +/*N*/ { +/*N*/ // If 1 or up to 31 days between now and last editing - calculate time indirectly. +/*N*/ // nAddTime = (24h - nTime) + (nDays * 24h) + aNow +/*?*/ --nDays; +/*?*/ nAddTime = nDays*n24Time.GetTime() ; +/*?*/ nAddTime += n24Time-(const Time&)pImp->nTime ; +/*?*/ nAddTime += aNow ; +/*N*/ } +/*N*/ +/*N*/ aOldTime += nAddTime; +/*N*/ } +/*N*/ +/*N*/ rInfo.SetTime(aOldTime.GetTime()); +/*N*/ pImp->nTime = aNow; +/*N*/ rInfo.IncDocumentNumber(); +/*N*/ //! DocumentNummer +/*N*/ #if 0 +/*N*/ const String aDocNo(rInfo.GetUserKey(0).GetWord()); +/*N*/ const String aTitle(rInfo.GetUserKey(0).GetTitle()); +/*N*/ USHORT nNo = 1; +/*N*/ if ( aDocNo.Len() ) +/*N*/ { +/*N*/ nNo = (USHORT)aDocNo; +/*N*/ if(nNo) +/*N*/ ++nNo; +/*N*/ else +/*N*/ nNo = 1; +/*N*/ } +/*N*/ rInfo.SetUserKey(SfxDocUserKey(aTitle, nNo), 0); +/*N*/ #endif +/*N*/ return rInfo; +/*N*/ } + +//-------------------------------------------------------------------- + +/*?*/ SvEmbeddedInfoObject* SfxObjectShell::InsertObject +/*?*/ ( +/*?*/ SvEmbeddedObject* pObj, +/*?*/ const String& rName +/*?*/ ) + +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ SfxConfigManager* SfxObjectShell::GetConfigManager( BOOL bForceCreation ) +/*N*/ { +/*N*/ if ( !pImp->pCfgMgr ) +/*N*/ { +/*N*/ if ( bForceCreation || HasStorage() && SfxConfigManager::HasConfiguration( *GetStorage() ) ) +/*N*/ { +/*N*/ pImp->pCfgMgr = new SfxConfigManager( *this ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pImp->pCfgMgr; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetConfigManager(SfxConfigManager *pMgr) +/*N*/ { +/*N*/ // if ( pImp->pCfgMgr == SFX_CFGMANAGER() && pMgr) +/*N*/ // pMgr->Activate(pImp->pCfgMgr); +/*N*/ +/*N*/ if ( pImp->pCfgMgr && pImp->pCfgMgr != pMgr ) +/*?*/ delete pImp->pCfgMgr; +/*N*/ +/*N*/ pImp->pCfgMgr = pMgr; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ BOOL SfxObjectShell::HasTemplateConfig() const +/*N*/ { +/*N*/ //!MBA return pImp->bTemplateConfig; +/*N*/ return FALSE; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxStyleSheetBasePool* SfxObjectShell::GetStyleSheetPool() +/*N*/ { +/*N*/ return 0; +/*N*/ } + + +//-------------------------------------------------------------------- + +/*N*/ USHORT SfxObjectShell::GetContentCount(USHORT nIdx1, +/*N*/ USHORT nIdx2) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::GetContent(String &rText, +/*N*/ Bitmap &rClosedBitmap, +/*N*/ Bitmap &rOpenedBitmap, +/*N*/ BOOL &bCanDel, +/*N*/ USHORT i, +/*N*/ USHORT nIdx1, +/*N*/ USHORT nIdx2 ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::GetContent(String &rText, +/*N*/ Bitmap &rClosedBitmap, +/*N*/ Bitmap &rOpenedBitmap, +/*N*/ BmpColorMode eColorMode, +/*N*/ BOOL &bCanDel, +/*N*/ USHORT i, +/*N*/ USHORT nIdx1, +/*N*/ USHORT nIdx2 ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::LoadStyles +/*N*/ ( + SfxObjectShell &rSource /* die Dokument-Vorlage, aus der + die Styles geladen werden sollen */ +/*N*/ ) + +/* [Beschreibung] + + Diese Methode wird vom SFx gerufen, wenn aus einer Dokument-Vorlage + Styles nachgeladen werden sollen. Bestehende Styles soll dabei + "uberschrieben werden. Das Dokument mu"s daher neu formatiert werden. + Daher werden die Applikationen in der Regel diese Methode "uberladen + und in ihrer Implementierung die Implementierung der Basisklasse + rufen. +*/ + +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxEventConfigItem_Impl* SfxObjectShell::GetEventConfig_Impl( BOOL bForce ) +/*N*/ { +/*N*/ if ( bForce && !pImp->pEventConfig ) +/*N*/ { +/*N*/ pImp->pEventConfig = new SfxEventConfigItem_Impl( SFX_ITEMTYPE_DOCEVENTCONFIG, +/*N*/ SFX_APP()->GetEventConfig(), this ); +/*N*/ if (pImp->pCfgMgr) +/*N*/ pImp->pEventConfig->Connect( pImp->pCfgMgr ); +/*N*/ pImp->pEventConfig->Initialize(); +/*N*/ } +/*N*/ +/*N*/ return pImp->pEventConfig; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objitem.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objitem.cxx new file mode 100644 index 000000000000..ac060d2aa29a --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objitem.cxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "objsh.hxx" +#include "objitem.hxx" +namespace binfilter { + +//==================================================================== + +/*N*/ TYPEINIT1(SfxObjectShellItem,SfxPoolItem) +/*N*/ TYPEINIT1_AUTOFACTORY(SfxObjectItem,SfxPoolItem) + +//========================================================================= + +/*N*/ int SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const +/*N*/ { +/*N*/ return PTR_CAST(SfxObjectShellItem, &rItem)->pObjSh == pObjSh; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ String SfxObjectShellItem::GetValueText() const +/*N*/ { +/*N*/ return String(); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const +/*N*/ { +/*N*/ return new SfxObjectShellItem( Which(), pObjSh ); +/*N*/ } + +//========================================================================= + +/*N*/ SfxObjectItem::SfxObjectItem( USHORT nWhich, SfxShell *pSh ) +/*N*/ : SfxPoolItem( nWhich ), +/*N*/ _pSh( pSh ) +/*N*/ {} + +//-------------------------------------------------------------------- + +/*N*/ int SfxObjectItem::operator==( const SfxPoolItem &rItem ) const +/*N*/ { +/*N*/ SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem); +/*N*/ return pOther->_pSh == _pSh; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const +/*N*/ { +/*N*/ return new SfxObjectItem( Which(), _pSh ); +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objmisc.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objmisc.cxx new file mode 100644 index 000000000000..316d2ae143fd --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objmisc.cxx @@ -0,0 +1,958 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/inetmsg.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_so3/inetbnd.hxx> +#include <osl/mutex.hxx> +#include <bf_sfx2/app.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <com/sun/star/document/MacroExecMode.hpp> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/ucb/XContent.hpp> + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::document; + +#include "bf_basic/basmgr.hxx" +#include "bf_basic/sbx.hxx" + +#include <unotools/ucbhelper.hxx> +#include <bf_svtools/inettype.hxx> + +#include "request.hxx" +#include "docfile.hxx" +#include "interno.hxx" +#include "objshimp.hxx" +#include "fltfnc.hxx" +#include "sfx.hrc" +#include "macrconf.hxx" +#include "docfac.hxx" + +namespace binfilter { + +// class SfxHeaderAttributes_Impl ---------------------------------------- + +/*N*/ class SfxHeaderAttributes_Impl : public SvKeyValueIterator +/*N*/ { +/*N*/ private: +/*N*/ SfxObjectShell* pDoc; +/*N*/ SvKeyValueIteratorRef xIter; +/*N*/ sal_Bool bAlert; +/*N*/ +/*N*/ public: +/*N*/ SfxHeaderAttributes_Impl( SfxObjectShell* pSh ) : +/*N*/ pDoc( pSh ), SvKeyValueIterator(), +/*N*/ xIter( pSh->GetMedium()->GetHeaderAttributes_Impl() ), +/*N*/ bAlert( sal_False ) {} +/*N*/ +/*N*/ virtual sal_Bool GetFirst( SvKeyValue& rKV ) { return xIter->GetFirst( rKV ); } +/*N*/ virtual sal_Bool GetNext( SvKeyValue& rKV ) { return xIter->GetNext( rKV ); } +/*N*/ virtual void Append( const SvKeyValue& rKV ); +/*N*/ +/*N*/ void ClearForSourceView() { xIter = new SvKeyValueIterator; bAlert = sal_False; } +/*N*/ void SetAttributes(); +/*N*/ void SetAttribute( const SvKeyValue& rKV ); +/*N*/ }; + +//========================================================================= + +/*N*/ sal_uInt16 __READONLY_DATA aTitleMap_Impl[3][2] = +/*N*/ { +/*N*/ // local remote +/*N*/ /* SFX_TITLE_CAPTION */ { SFX_TITLE_FILENAME, SFX_TITLE_TITLE }, +/*N*/ #ifdef MAC +/*N*/ /* SFX_TITLE_PICKLIST */ { SFX_TITLE_FILENAME, SFX_TITLE_FULLNAME }, +/*N*/ #else +/*N*/ /* SFX_TITLE_PICKLIST */ { 32, SFX_TITLE_FULLNAME }, +/*N*/ #endif +/*N*/ /* SFX_TITLE_HISTORY */ { 32, SFX_TITLE_FULLNAME } +/*N*/ }; + +//========================================================================= + +/*?*/ void SfxObjectShell::AbortImport() +/*?*/ { +/*?*/ pImp->bIsAbortingImport = sal_True; +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsAbortingImport() const +/*N*/ { +/*N*/ return pImp->bIsAbortingImport; +/*N*/ } + +//------------------------------------------------------------------------- + + +//------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfo& SfxObjectShell::GetDocInfo() +/*N*/ { +/*N*/ if( !pImp->pDocInfo ) +/*N*/ { +/*N*/ pImp->pDocInfo = new SfxDocumentInfo; +/*N*/ pImp->pDocInfo->SetReadOnly( IsReadOnly() ); +/*N*/ } +/*N*/ +/*N*/ return *pImp->pDocInfo; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::FlushDocInfo() +/*N*/ { +/*N*/ SetModified(sal_True); +/*N*/ SfxDocumentInfo &rInfo = GetDocInfo(); +/*N*/ Broadcast( SfxDocumentInfoHint( &rInfo ) ); +/*N*/ SetAutoLoad( INetURLObject(rInfo.GetReloadURL()), +/*N*/ rInfo.GetReloadDelay() * 1000, rInfo.IsReloadEnabled() ); +/*N*/ +/*N*/ // bitte beachten: +/*N*/ // 1. Titel in DocInfo aber nicht am Doc (nach HTML-Import) +/*N*/ // => auch am Doc setzen +/*N*/ // 2. Titel in DocInfo leer (Briefumschlagsdruck) +/*N*/ // => nicht am Doc setzen, da sonst "unbenanntX" daraus wird +/*N*/ String aDocInfoTitle = GetDocInfo().GetTitle(); +/*N*/ if ( aDocInfoTitle.Len() ) +/*N*/ SetTitle( aDocInfoTitle ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetError(sal_uInt32 lErr) +/*N*/ { +/*N*/ if(pImp->lErr==ERRCODE_NONE) +/*N*/ pImp->lErr=lErr; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_uInt32 SfxObjectShell::GetError() const +/*N*/ { +/*N*/ return ERRCODE_TOERROR(GetErrorCode()); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_uInt32 SfxObjectShell::GetErrorCode() const +/*N*/ { +/*N*/ sal_uInt32 lError=pImp->lErr; +/*N*/ if(!lError && GetMedium()) +/*N*/ lError=GetMedium()->GetErrorCode(); +/*N*/ if(!lError && HasStorage()) +/*N*/ lError= GetStorage()->GetErrorCode(); +/*N*/ return lError; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::ResetError() +/*N*/ { +/*N*/ pImp->lErr=0; +/*N*/ SfxMedium * pMed = GetMedium(); +/*N*/ if( pMed ) +/*N*/ pMed->ResetError(); +/*N*/ SvStorage *pStor= HasStorage() ? GetStorage() : 0; +/*N*/ if( pStor ) +/*N*/ pStor->ResetError(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsTemplate() const +/*N*/ { +/*N*/ return pImp->bIsTemplate; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::ModifyChanged() + +/* [Beschreibung] + + Diese virtuelle Methode wird aus der virtuellen Basisklasse SvPersist + gerufen, wenn sich das Modified-Flag ge"andert hat. Diese Querverbindung + ist notwendig, da aus einem Zweig einer virtuellen Vererbung nicht + quer un den anderen gerufen werden kann. +*/ + +/*N*/ { +/*N*/ if ( pImp->bClosing ) +/*N*/ // SetModified aus dem dispose des Models! +/*N*/ return; +/*N*/ +/*N*/ {DBG_CHKTHIS(SfxObjectShell, 0);} +/*N*/ SfxObjectShell *pDoc; +/*N*/ for ( pDoc = SfxObjectShell::GetFirst(); pDoc; +/*N*/ pDoc = SfxObjectShell::GetNext(*pDoc) ) +/*N*/ if( pDoc->IsModified() ) +/*N*/ break; +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ pSfxApp->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, this ) ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxInPlaceObject* SfxObjectShell::GetInPlaceObject() const +/*N*/ { +/*N*/ if( !pImp->pInPlaceObj && !pImp->bSetInPlaceObj ) +/*N*/ { +/*N*/ // try to cast +/*N*/ SvInPlaceObjectRef xSvIP( (SfxObjectShell *)this ); +/*N*/ if ( xSvIP.Is() ) +/*N*/ pImp->pInPlaceObj = (SfxInPlaceObject*) &xSvIP; +/*N*/ pImp->bSetInPlaceObj = sal_True; +/*N*/ } +/*N*/ return pImp->pInPlaceObj; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsReadOnlyUI() const + +/* [Beschreibung] + + Liefert sal_True, wenn das Dokument fuer die UI wie r/o behandelt werden + soll. Dieses ist unabhaengig vom tatsaechlichen r/o, welches per + <IsReadOnly()> erfragbar ist. +*/ + +/*N*/ { +/*N*/ return pImp->bReadOnlyUI; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsReadOnlyMedium() const + +/* [Beschreibung] + + Liefert sal_True, wenn das Medium r/o ist bzw. r/o geoeffnet wurde. +*/ + +/*N*/ { +/*N*/ if ( !pMedium ) +/*N*/ return sal_True; +/*N*/ return pMedium->IsReadOnly(); +/*N*/ } + +//------------------------------------------------------------------------- + + +/* [Beschreibung] + + Schaltet das Dokument in einen r/o bzw. r/w Zustand ohne es neu + zu laden und ohne die Open-Modi des Mediums zu aendern. +*/ + + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsReadOnly() const +/*N*/ { +/*N*/ return pImp->bReadOnlyUI || IsReadOnlyMedium(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsInModalMode() const +/*N*/ { +/*N*/ return pImp->bModalMode || pImp->bRunningMacro; +/*N*/ } + +//------------------------------------------------------------------------- + +/*?*/ Size SfxObjectShell::GetFirstPageSize() +/*?*/ { +/*?*/ Size aRet; +/*?*/ SfxInPlaceObject *pIpObj = GetInPlaceObject(); +/*?*/ if ( pIpObj ) +/*?*/ aRet = pIpObj->GetVisArea(ASPECT_THUMBNAIL).GetSize(); +/*?*/ return aRet; +/*?*/ } + +//-------------------------------------------------------------------- +// changes the title of the document + +/*N*/ void SfxObjectShell::SetTitle +/*N*/ ( +/*N*/ const String& rTitle // der neue Titel des Dokuments +/*N*/ ) +/*N*/ { +/*N*/ DBG_CHKTHIS(SfxObjectShell, 0); +/*N*/ +/*N*/ // nix zu tun? +/*N*/ if ( ( HasName() && pImp->aTitle == rTitle ) || +/*N*/ ( !HasName() && GetTitle() == rTitle ) ) +/*N*/ return; +/*N*/ +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ +/*N*/ // ggf. die unbenannt-Nummer freigeben +/*N*/ if ( pImp->bIsNamedVisible && USHRT_MAX != pImp->nVisualDocumentNumber ) +/*N*/ { +/*?*/ pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); +/*?*/ pImp->bIsNamedVisible = 0; +/*N*/ } +/*N*/ +/*N*/ // Title setzen +/*N*/ pImp->aTitle = rTitle; +/*N*/ // Wieso denn in der DocInfo? +/*N*/ // GetDocInfo().SetTitle( rTitle ); +/*N*/ // FlushDocInfo(); +/*N*/ +/*N*/ // Benachrichtigungen +/*N*/ if ( GetMedium() ) +/*N*/ { +/*N*/ SfxShell::SetName( GetTitle(SFX_TITLE_APINAME) ); +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------- + +#if OSL_DEBUG_LEVEL > 1 +/*N*/ String X(const String &rRet) +/*N*/ { +/*N*/ if ( !rRet.Len() ) +/*N*/ return DEFINE_CONST_UNICODE( "-empty-" ); +/*N*/ return rRet; +/*N*/ } +#else +#define X(ret) ret +#endif + +//-------------------------------------------------------------------- +/*N*/ String SfxObjectShell::GetTitle +/*N*/ ( + sal_uInt16 nMaxLength /* 0 (default) + der Titel selbst, so wie er ist + + 1 (==SFX_TITLE_FILENAME) + liefert den logischen Dateinamen ohne Pfad + (unter WNT je nach Systemeinstellung ohne + Extension) + + 2 (==SFX_TITLE_FULLNAME) + liefert den mit komplettem logischen Dateinamen + mit Pfad (remote => ::com::sun::star::util::URL) + + 3 (==SFX_TITLE_APINAME) + liefert den logischen Dateinamen ohne Pfad + und Extension + + 4 (==SFX_TITLE_DETECT) + liefert den kompletten Titel, falls noch + nicht gesetzt wird aber aus DocInfo oder + dem Namen des Medium erzeugt + + 5 (==SFX_TITLE_CAPTION) + liefert den Titel so, wie MB ihn heute in + der CaptionBar anzeigen m"ochte + + 6 (==SFX_TITLE_PICKLIST) + liefert den Titel so, wie MB ihn heute in + der PickList anzeigen m"ochte + + 7 (==SFX_TITLE_HISTORY) + liefert den Titel so, wie MB ihn heute in + der History anzeigen m"ochte + + 10 bis USHRT_MAX + liefert maximal 'nMaxLength' Zeichen vom logischen + Dateinamen inkl. Pfad (remote => ::com::sun::star::util::URL) + */ +/*N*/ ) const + +/* [Beschreibung] + + Liefert den Titel bzw. logischen Dateinamen des Dokuments, je nach + 'nMaxLength'. + + Falls der Dateiname mit Pfad verwendet wird, wird die Namensk"urzung durch + Ersetzung eines oder mehrerer Directory-Namen durch "..." durchgef"uhrt, + URLs werden z.Zt. immer komplett geliefert. +*/ + +/*N*/ { +/*N*/ // if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +/*N*/ // return String(); +/*N*/ SfxMedium *pMed = GetMedium(); +/*N*/ +/*N*/ // Titel erzeugen? +/*N*/ if ( SFX_TITLE_DETECT == nMaxLength && !pImp->aTitle.Len() ) +/*N*/ { +/*N*/ static sal_Bool bRecur = sal_False; +/*N*/ if ( bRecur ) +/*N*/ return DEFINE_CONST_UNICODE( "-not available-" ); +/*N*/ bRecur = sal_True; +/*N*/ +/*N*/ String aTitle; +/*N*/ SfxObjectShell *pThis = (SfxObjectShell*) this; +/*N*/ +/*N*/ if ( pMed ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pMed->GetItemSet(), pNameItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); +/*N*/ if ( pNameItem ) +/*N*/ aTitle = pNameItem->GetValue(); +/*N*/ } +/*N*/ +/*N*/ if ( !aTitle.Len() ) +/*N*/ { +/*N*/ // evtl. ist Titel aus DocInfo verwendbar +/*N*/ aTitle = pThis->GetDocInfo().GetTitle(); +/*N*/ aTitle.EraseLeadingChars(); +/*N*/ aTitle.EraseTrailingChars(); +/*N*/ +/*N*/ if ( !aTitle.Len() ) +/*N*/ // sonst wie SFX_TITLE_FILENAME +/*N*/ aTitle = GetTitle( SFX_TITLE_FILENAME ); +/*N*/ } +/*N*/ +/*N*/ pThis->SetTitle( aTitle ); +/*N*/ bRecur = sal_False; +/*N*/ return X(aTitle); +/*N*/ } +/*N*/ else if (SFX_TITLE_APINAME == nMaxLength ) +/*N*/ return X(GetAPIName()); +/*N*/ +/*N*/ // Sonderfall Vorlagen: +/*N*/ if( IsTemplate() && pImp->aTitle.Len() && +/*N*/ ( nMaxLength == SFX_TITLE_CAPTION || nMaxLength == SFX_TITLE_PICKLIST ) ) +/*N*/ return X(pImp->aTitle); +/*N*/ +/*N*/ // Picklist/Caption wird gemappt +/*N*/ if ( pMed && ( nMaxLength == SFX_TITLE_CAPTION || nMaxLength == SFX_TITLE_PICKLIST ) ) +/*N*/ { +/*N*/ // Wenn ein spezieller Titel beim "Offnen mitgegebent wurde; +/*N*/ // wichtig bei URLs, die INET_PROT_FILE verwenden, denn bei denen +/*N*/ // wird der gesetzte Titel nicht beachtet. +/*N*/ // (s.u., Auswertung von aTitleMap_Impl) +/*N*/ SFX_ITEMSET_ARG( pMed->GetItemSet(), pNameItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); +/*N*/ if ( pNameItem ) +/*N*/ return X( pNameItem->GetValue() ); +/*N*/ } +/*N*/ +/*N*/ // noch unbenannt? +/*N*/ DBG_ASSERT( !HasName() || pMed, "HasName() aber kein Medium?!?" ); +/*N*/ if ( !HasName() || !pMed ) +/*N*/ { +/*N*/ // schon Titel gesezt? +/*N*/ if ( pImp->aTitle.Len() ) +/*N*/ return X(pImp->aTitle); +/*N*/ +/*N*/ String aNoName; +/*N*/ return X(aNoName); +/*N*/ } +/*N*/ +/*N*/ const INetURLObject& aURL = INetURLObject( pMed->GetName() ); +/*N*/ if ( nMaxLength >= SFX_TITLE_CAPTION && nMaxLength <= SFX_TITLE_HISTORY ) +/*N*/ { +/*N*/ sal_uInt16 nRemote; +/*N*/ if( !pMed || aURL.GetProtocol() == INET_PROT_FILE ) +/*N*/ nRemote = 0; +/*N*/ else +/*N*/ nRemote = 1; +/*N*/ nMaxLength = aTitleMap_Impl[nMaxLength-SFX_TITLE_CAPTION][nRemote]; +/*N*/ } +/*N*/ +/*N*/ // lokale Datei? +/*N*/ if ( aURL.GetProtocol() == INET_PROT_FILE ) +/*N*/ { +/*N*/ String aName( aURL.HasMark() ? INetURLObject( aURL.GetURLNoMark() ).PathToFileName() : aURL.PathToFileName() ); +/*N*/ +/*N*/ // if ( nMaxLength > SFX_TITLE_MAXLEN ) +/*N*/ // return X( DirEntry( aName ).GetFull( FSYS_STYLE_HOST, sal_False, nMaxLength ) ); +/*N*/ // else +/*N*/ if ( nMaxLength == SFX_TITLE_FULLNAME ) +/*N*/ return X( aName ); +/*N*/ +/*N*/ if ( !pImp->aTitle.Len() ) +/*N*/ { +/*N*/ if ( nMaxLength == SFX_TITLE_FILENAME ) +/*N*/ return X( aURL.getName( INetURLObject::LAST_SEGMENT, +/*N*/ true, INetURLObject::DECODE_WITH_CHARSET ) ); +/*N*/ +/*N*/ // sonst Titel aus Dateiname generieren +/*N*/ pImp->aTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, +/*N*/ true, INetURLObject::DECODE_WITH_CHARSET ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // ::com::sun::star::util::URL-Versionen +/*N*/ if ( nMaxLength >= SFX_TITLE_MAXLEN ) +/*N*/ { +/*N*/ String aComplete( pMed->GetName() ); +/*N*/ if( aComplete.Len() > nMaxLength ) +/*N*/ { +/*N*/ String aRet( DEFINE_CONST_UNICODE( "..." ) ); +/*N*/ aRet += aComplete.Copy( aComplete.Len() - nMaxLength + 3, nMaxLength - 3 ); +/*N*/ return X( aRet ); +/*N*/ } +/*N*/ else +/*N*/ return X( pMed->GetName() ); +/*N*/ } +/*N*/ else if ( nMaxLength == SFX_TITLE_FILENAME ) +/*N*/ { +/*N*/ String aName( aURL.GetLastName() ); +/*N*/ aName = INetURLObject::decode( aName, INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET ); +/*N*/ if( !aName.Len() ) +/*N*/ aName = aURL.GetURLNoPass(); +/*N*/ return X(aName); +/*N*/ } +/*N*/ else if ( nMaxLength == SFX_TITLE_FULLNAME ) +/*N*/ return X(aURL.GetMainURL( INetURLObject::DECODE_TO_IURI )); +/*N*/ +/*N*/ // ggf. Titel aus Dateiname generieren +/*N*/ if ( !pImp->aTitle.Len() ) +/*N*/ pImp->aTitle = aURL.GetBase(); +/*N*/ } +/*N*/ +/*N*/ // ganzer Titel +/*N*/ return X(pImp->aTitle); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::InvalidateName() + +/* [Beschreibung] + + Ermittelt den Titel des Dokuments neu aus 'unbenannt', DocInfo-Titel + bzw. Dateinamen. Wird nach Laden aus Template oder SaveAs ben"otigt. +*/ + +/*N*/ { +/*N*/ // Title neu erzeugen +/*N*/ pImp->aTitle.Erase(); +/*N*/ // pImp->nVisualDocumentNumber = USHRT_MAX; +/*N*/ GetTitle( SFX_TITLE_DETECT ); +/*N*/ SetName( GetTitle( SFX_TITLE_APINAME ) ); +/*N*/ +/*N*/ // Benachrichtigungen +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*?*/ void SfxObjectShell::MemoryError() +/*?*/ { +/*?*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxProgress* SfxObjectShell::GetProgress() const +/*N*/ { +/*N*/ return pImp->pProgress; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetProgress_Impl +/*N*/ ( +/*N*/ SfxProgress *pProgress /* zu startender <SfxProgress> oder 0, falls + der Progress zur"uckgesetzt werden soll */ +/*N*/ ) + +/* [Beschreibung] + + Interne Methode zum setzen oder zur"ucksetzen des Progress-Modes + f"ur diese SfxObjectShell. +*/ + +/*N*/ { +/*N*/ DBG_ASSERT( ( !pImp->pProgress && pProgress ) || +/*N*/ ( pImp->pProgress && !pProgress ), +/*N*/ "Progress activation/deacitivation mismatch" ); +/*N*/ pImp->pProgress = pProgress; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetActivateEvent_Impl(sal_uInt16 nId ) +/*N*/ { +/*N*/ if ( GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ) +/*N*/ pImp->nEventId = nId; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::RegisterTransfer( SfxMedium& rMedium ) +/* [Beschreibung ] + Alle Medien, die aufgesetzt werden, um Teile eines Dokumentes zu + laden, muessen an der zugehoerigen SfxObjectShell angemeldet + werden. So kann dokumentweise abgebrochen werden. */ +/*N*/ { +/*N*/ rMedium.SetCancelManager_Impl( GetMedium()->GetCancelManager_Impl() ); +/*N*/ if( IsReloading() ) +/*?*/ rMedium.SetUsesCache( sal_False ); +/*N*/ rMedium.SetReferer( GetMedium()->GetName() ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::PrepareReload( ) +/* [Beschreibung ] + Wird vor dem Reload gerufen und gibt die Moeglichkeit, + etwaige Caches zu leeren. */ +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsReloading() const +/* [Beschreibung ] + Wird beim Aufsetzen neuer Downloads abgefragt, um gegebenenfalls + am SfxMedium SetUsesCache( sal_False ) zu rufen. */ + +/*N*/ { +/*N*/ return !GetMedium()->UsesCache(); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetAutoLoad( +/*N*/ const INetURLObject& rUrl, sal_uInt32 nTime, sal_Bool bReload ) +/* [Beschreibung ] + Hiermit wird automatisches Laden der Url rUrl nTime + Millisekunden nach Aufruf von FinishedLoading angefordert. bReload + bestimmt, ob das Dokument aus dem Cache geladen werden soll oder + nicht. */ +/*N*/ { +/*N*/ if ( pImp->pReloadTimer ) +/*?*/ DELETEZ(pImp->pReloadTimer); +/*N*/ if ( bReload ) +/*N*/ { +/*N*/ pImp->pReloadTimer = new AutoReloadTimer_Impl( +/*N*/ rUrl.GetMainURL( INetURLObject::DECODE_TO_IURI ), +/*N*/ nTime, bReload, this ); +/*?*/ pImp->pReloadTimer->Start(); +/*N*/ } +/*N*/ } + +/*N*/ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) +/*N*/ { +/*N*/ sal_Bool bSetModifiedTRUE = sal_False; +/*N*/ if( ( nFlags & SFX_LOADED_MAINDOCUMENT ) && +/*N*/ !(pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT )) +/*N*/ { +/*N*/ ((SfxHeaderAttributes_Impl*)GetHeaderAttributes())->SetAttributes(); +/*N*/ pImp->bImportDone = sal_True; +/*N*/ const SfxFilter* pFilter = GetMedium()->GetFilter(); + // Salvage +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, +/*N*/ SfxStringItem, SID_DOC_SALVAGE, sal_False ); +/*N*/ if ( pSalvageItem ) +/*N*/ bSetModifiedTRUE = sal_True; +/*N*/ } +/*N*/ +/*N*/ if( ( nFlags & SFX_LOADED_IMAGES ) && +/*N*/ !(pImp->nLoadedFlags & SFX_LOADED_IMAGES ) ) +/*N*/ { +/*N*/ SfxDocumentInfo& rInfo = GetDocInfo(); +/*N*/ SetAutoLoad( INetURLObject(rInfo.GetReloadURL()), +/*N*/ rInfo.GetReloadDelay() * 1000, rInfo.IsReloadEnabled() ); +/*N*/ if( !bSetModifiedTRUE && IsEnableSetModified() ) +/*?*/ SetModified( sal_False ); +/*N*/ Invalidate( SID_SAVEASDOC ); +/*N*/ } +/*N*/ +/*N*/ pImp->nLoadedFlags |= nFlags; +/*N*/ +/*N*/ if( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT && +/*N*/ pImp->nLoadedFlags & SFX_LOADED_IMAGES ) +/*N*/ GetMedium()->SetUsesCache( sal_True ); +/*N*/ +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, +/*N*/ SfxBoolItem, SID_HIDDEN, sal_False ); +/*N*/ pImp->bHidden = sal_False; +/*N*/ if ( pHiddenItem ) +/*N*/ pImp->bHidden = pHiddenItem->GetValue(); +/*N*/ +/*N*/ if ( bSetModifiedTRUE ) +/*?*/ SetModified( sal_True ); +/*N*/ if ( pImp->nEventId ) +/*N*/ { +/*N*/ // Falls noch kein OnLoad ausgel"ost wurde, weil beim Erzeugen der ::com::sun::star::sdbcx::View der Frame nicht aktiv war, +/*N*/ // mu\s das jetzt nachgeholt werden, indem der Frame benachrichtigt wird. +/*N*/ Broadcast( SfxEventHint( SFX_EVENT_LOADFINISHED, this ) ); +/*N*/ +/*N*/ if ( pImp->bHidden ) +/*N*/ { +/*N*/ sal_uInt16 nId = pImp->nEventId; +/*N*/ pImp->nEventId = 0; +/*N*/ SFX_APP()->NotifyEvent(SfxEventHint( nId, this ), sal_False); +/*N*/ } +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsLoading() const +/* [Beschreibung ] + Wurde bereits FinishedLoading aufgerufeb? */ +/*N*/ { +/*N*/ return !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::CancelTransfers() +/* [Beschreibung ] + Hier koennen Transfers gecanceled werden, die nicht mit + RegisterTransfer registiert wurden */ +/*N*/ { +/*N*/ GetMedium()->CancelTransfers(); +/*N*/ if( ( pImp->nLoadedFlags & SFX_LOADED_ALL ) != SFX_LOADED_ALL ) +/*N*/ { +/*?*/ AbortImport(); +/*?*/ if( IsLoading() ) +/*?*/ FinishedLoading( SFX_LOADED_ALL ); + +/*N*/ } +/*N*/ } + +//------------------------------------------------------------------------- + +/*?*/ AutoReloadTimer_Impl::AutoReloadTimer_Impl( +/*?*/ const String& rURL, sal_uInt32 nTime, sal_Bool bReloadP, SfxObjectShell* pSh ) +/*?*/ : aUrl( rURL ), bReload( bReloadP ), pObjSh( pSh ) +/*?*/ { +/*?*/ SetTimeout( nTime ); +/*?*/ } + +//------------------------------------------------------------------------- + +/*?*/ void AutoReloadTimer_Impl::Timeout() +/*?*/ { +/*?*/ pObjSh->Get_Impl()->pReloadTimer = 0; +/*?*/ delete this; +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ ErrCode SfxObjectShell::CallBasic( const String& rMacro, +/*N*/ const String& rBasic, SbxObject* pVCtrl, SbxArray* pArgs, +/*N*/ SbxValue* pRet ) +/*N*/ { +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ if( pApp->GetName() != rBasic ) +/*N*/ { +/*N*/ AdjustMacroMode( String() ); +/*N*/ if( pImp->nMacroMode == MacroExecMode::NEVER_EXECUTE ) +/*N*/ return ERRCODE_IO_ACCESSDENIED; +/*N*/ } +/*?*/ +/*?*/ pApp->EnterBasicCall(); +/*?*/ BasicManager *pMgr = GetBasicManager(); +/*?*/ if( pApp->GetName() == rBasic ) +/*?*/ pMgr = pApp->GetBasicManager(); +/*?*/ ErrCode nRet = SfxMacroConfig::Call( pVCtrl, rMacro, pMgr, pArgs, pRet ); +/*?*/ pApp->LeaveBasicCall(); +/*?*/ return nRet; +/*N*/ } + +} //namespace binfilter +namespace binfilter {//STRIP009 +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetBaseURL( const String& rURL ) +/*N*/ { +/*N*/ pImp->aBaseURL = rURL; +/*N*/ } + +/*N*/ const String& SfxObjectShell::GetBaseURL() const +/*N*/ { +/*N*/ if ( pImp->aBaseURL.Len() ) +/*N*/ return pImp->aBaseURL; +/*N*/ else if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_PACKED ) ) +/*N*/ return pMedium->GetPhysicalName(); +/*N*/ else +/*N*/ return pMedium->GetBaseURL(); +/*N*/ } + +/*?*/ String SfxObjectShell::QueryTitle( SfxTitleQuery eType ) const +/*?*/ { +/*?*/ String aRet; +/*?*/ +/*?*/ switch( eType ) +/*?*/ { +/*?*/ case SFX_TITLE_QUERY_SAVE_NAME_PROPOSAL: +/*?*/ { +/*?*/ SfxMedium* pMed = GetMedium(); +/*?*/ const INetURLObject aObj( pMed->GetName() ); +/*?*/ aRet = aObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); +/*?*/ if ( !aRet.Len() ) +/*?*/ aRet = GetTitle( SFX_TITLE_CAPTION ); +/*?*/ break; +/*?*/ } +/*?*/ } +/*?*/ return aRet; +/*?*/ } + +/*N*/ void SfxHeaderAttributes_Impl::SetAttributes() +/*N*/ { +/*N*/ bAlert = sal_True; +/*N*/ SvKeyValue aPair; +/*N*/ for( sal_Bool bCont = xIter->GetFirst( aPair ); bCont; +/*N*/ bCont = xIter->GetNext( aPair ) ) +/*N*/ SetAttribute( aPair ); +/*N*/ } + +/*?*/ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) +/*?*/ { +/*?*/ String aValue = rKV.GetValue(); +/*?*/ if( rKV.GetKey().CompareIgnoreCaseToAscii( "refresh" ) == COMPARE_EQUAL && rKV.GetValue().Len() ) +/*?*/ { +/*?*/ sal_uInt32 nTime = aValue.GetToken( 0, ';' ).ToInt32() ; +/*?*/ String aURL = aValue.GetToken( 1, ';' ); +/*?*/ aURL.EraseTrailingChars().EraseLeadingChars(); +/*?*/ SfxDocumentInfo& rInfo = pDoc->GetDocInfo(); +/*?*/ if( aURL.Copy(0, 4).CompareIgnoreCaseToAscii( "url=" ) == COMPARE_EQUAL ) +/*?*/ { +/*?*/ INetURLObject aObj; +/*?*/ INetURLObject( pDoc->GetMedium()->GetName() ).GetNewAbsURL( aURL.Copy( 4 ), &aObj ); +/*?*/ rInfo.SetReloadURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); +/*?*/ } +/*?*/ rInfo.EnableReload( sal_True ); +/*?*/ rInfo.SetReloadDelay( nTime ); +/*?*/ pDoc->FlushDocInfo(); +/*?*/ } +/*?*/ else if( rKV.GetKey().CompareIgnoreCaseToAscii( "expires" ) == COMPARE_EQUAL ) +/*?*/ { +/*?*/ DateTime aDateTime; +/*?*/ if( INetRFC822Message::ParseDateField( rKV.GetValue(), aDateTime ) ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // DBG_ERROR( "Schlechtes ::com::sun::star::util::DateTime fuer Expired" ); +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDoc->GetMedium()->SetExpired_Impl( Date( 1, 1, 1970 ) ); +/*?*/ } +/*?*/ } +/*?*/ else if( rKV.GetKey().CompareIgnoreCaseToAscii( "content-type" ) == COMPARE_EQUAL ) +/*?*/ { +/*?*/ ::rtl::OString sContent = ::rtl::OUStringToOString( aValue, RTL_TEXTENCODING_ASCII_US ); +/*?*/ ByteString sType, sSubType; +/*?*/ INetContentTypeParameterList aParameters; +/*?*/ +/*?*/ if( INetContentTypes::parse( sContent, sType, sSubType, &aParameters ) ) +/*?*/ { +/*?*/ const INetContentTypeParameter * pCharset = aParameters.find("charset"); +/*?*/ if (pCharset != 0) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");}//STRIP001 pDoc->GetMedium()->SetCharset( pCharset->m_sValue ); +/*?*/ } +/*?*/ } +/*?*/ } + +/*?*/ void SfxHeaderAttributes_Impl::Append( const SvKeyValue& rKV ) +/*?*/ { +/*?*/ xIter->Append( rKV ); +/*?*/ if( bAlert ) SetAttribute( rKV ); +/*?*/ } + +/*N*/ SvKeyValueIterator* SfxObjectShell::GetHeaderAttributes() +/*N*/ { +/*N*/ if( !pImp->xHeaderAttributes.Is() ) +/*N*/ { +/*N*/ DBG_ASSERT( pMedium, "Kein Medium" ); +/*N*/ pImp->xHeaderAttributes = new SfxHeaderAttributes_Impl( this ); +/*N*/ } +/*N*/ return ( SvKeyValueIterator*) &pImp->xHeaderAttributes; +/*N*/ } + +/*N*/ sal_Bool SfxObjectShell::IsPreview() const +/*N*/ { +/*N*/ if ( !pMedium ) +/*?*/ return sal_False; +/*N*/ +/*N*/ sal_Bool bPreview = sal_False; +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFlags, SfxStringItem, SID_OPTIONS, sal_False); +/*N*/ if ( pFlags ) +/*N*/ { +/*?*/ // Werte auf einzelne Items verteilen +/*?*/ String aFileFlags = pFlags->GetValue(); +/*?*/ aFileFlags.ToUpperAscii(); +/*?*/ if ( STRING_NOTFOUND != aFileFlags.Search( 'B' ) ) +/*?*/ bPreview = sal_True; +/*?*/ } +/*N*/ +/*N*/ if ( !bPreview ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pItem, SfxBoolItem, SID_PREVIEW, sal_False); +/*N*/ if ( pItem ) +/*?*/ bPreview = pItem->GetValue(); +/*N*/ } +/*N*/ +/*N*/ return bPreview; +/*N*/ } + +/*N*/ void SfxObjectShell::SetWaitCursor( BOOL bSet ) const +/*N*/ { +/*N*/ } + +/*N*/ String SfxObjectShell::GetAPIName() const +/*N*/ { +/*N*/ INetURLObject aURL( GetMedium()->GetName() ); +/*N*/ String aName( aURL.GetBase() ); +/*N*/ if( !aName.Len() ) +/*N*/ aName = aURL.GetURLNoPass(); +/*N*/ if ( !aName.Len() ) +/*N*/ aName = GetTitle( SFX_TITLE_DETECT ); +/*N*/ return aName; +/*N*/ } + +/*N*/ void SfxObjectShell::Invalidate( USHORT nId ) +/*N*/ { +/*N*/ } + +// nMacroMode == -1 : uninitialized +// other values as in /com/sun/star/document/MacroExecMode.hxx + +void SfxObjectShell::AdjustMacroMode( const String& rScriptType ) +{ + // no macro execution at all in binfilter + pImp->nMacroMode = MacroExecMode::NEVER_EXECUTE; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objserv.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objserv.cxx new file mode 100644 index 000000000000..73b0f0b25fc3 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objserv.cxx @@ -0,0 +1,170 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/document/XExporter.hpp> +#include <tools/urlobj.hxx> +#include <bf_svtools/whiter.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/itemset.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "request.hxx" +#include "docfile.hxx" +#include "app.hxx" +#include "docinf.hxx" +#include "objshimp.hxx" +#include "interno.hxx" +#include "docfac.hxx" +#include "fcontnr.hxx" + +#include "bf_so3/staticbaseurl.hxx" + +namespace binfilter { + +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::task; + +//==================================================================== + +/*N*/ class SfxSaveAsContext_Impl +/*N*/ { +/*N*/ String& _rNewNameVar; +/*N*/ String _aNewName; +/*N*/ +/*N*/ public: +/*N*/ SfxSaveAsContext_Impl( String &rNewNameVar, +/*N*/ const String &rNewName ) +/*N*/ : _rNewNameVar( rNewNameVar ), +/*N*/ _aNewName( rNewName ) +/*N*/ { rNewNameVar = rNewName; } +/*N*/ ~SfxSaveAsContext_Impl() +/*N*/ { _rNewNameVar.Erase(); } +/*N*/ }; + +//==================================================================== + +/*N*/ BOOL ShallSetBaseURL_Impl( SfxMedium &rMed ); + +AsynchronLink* pPendingCloser = 0; + +//========================================================================= + + + +/*N*/ long SfxObjectShellClose_Impl( void* pObj, void* pArg ) +/*N*/ { +/*N*/ SfxObjectShell *pObjSh = (SfxObjectShell*) pArg; +/*N*/ if ( pObjSh->Get_Impl()->bHiddenLockedByAPI ) +/*N*/ { +/*N*/ pObjSh->Get_Impl()->bHiddenLockedByAPI = FALSE; +/*N*/ pObjSh->OwnerLock(FALSE); +/*N*/ } +/*N*/ else if ( !pObjSh->Get_Impl()->bClosing ) +/*N*/ // GCC stuerzt ab, wenn schon im dtor, also vorher Flag abfragen +/*?*/ pObjSh->DoClose(); +/*N*/ return 0; +/*N*/ } + +/*N*/ sal_Bool SfxObjectShell::APISaveAs_Impl +/*N*/ ( +/*N*/ const String& aFileName, +/*N*/ SfxItemSet* aParams +/*N*/ ) +/*N*/ { +/*N*/ BOOL bOk = sal_False; +/*N*/ +/*N*/ {DBG_CHKTHIS(SfxObjectShell, 0);} +/*N*/ +/*N*/ pImp->bSetStandardName=FALSE; +/*N*/ if ( GetMedium() ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( aParams, pSaveToItem, SfxBoolItem, SID_SAVETO, sal_False ); +/*N*/ sal_Bool bSaveTo = pSaveToItem && pSaveToItem->GetValue(); +/*N*/ +/*N*/ String aFilterName; +/*N*/ SFX_ITEMSET_ARG( aParams, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False ); +/*N*/ if( pFilterNameItem ) +/*N*/ aFilterName = pFilterNameItem->GetValue(); +/*N*/ +/*N*/ // in case no filter defined use default one +/*N*/ if( !aFilterName.Len() ) +/*N*/ { +/*N*/ sal_uInt16 nActFilt = 0; +/*N*/ const SfxFilter* pFilt = GetFactory().GetFilter( 0 ); for( ; +/*N*/ pFilt && ( !pFilt->CanExport() +/*N*/ || !bSaveTo && !pFilt->CanImport() // SaveAs case +/*N*/ || pFilt->IsInternal() ); +/*N*/ pFilt = GetFactory().GetFilter( ++nActFilt ) ); +/*N*/ +/*N*/ DBG_ASSERT( pFilt, "No default filter!\n" ); +/*N*/ +/*N*/ if( pFilt ) +/*N*/ aFilterName = pFilt->GetFilterName(); +/*N*/ +/*N*/ aParams->Put(SfxStringItem( SID_FILTER_NAME, aFilterName)); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ { +/*N*/ SfxObjectShellRef xLock( this ); // ??? +/*N*/ +/*N*/ // since saving a document modified its DocumentInfo, the current DocumentInfo must be saved on "SaveTo", because +/*N*/ // it must be restored after saving +/*N*/ SfxDocumentInfo aSavedInfo; +/*N*/ sal_Bool bCopyTo = bSaveTo || GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; +/*N*/ if ( bCopyTo ) +/*N*/ aSavedInfo = GetDocInfo(); +/*N*/ +/*N*/ bOk = CommonSaveAs_Impl( INetURLObject(aFileName), aFilterName, +/*N*/ aParams ); +/*N*/ +/*N*/ if ( bCopyTo ) +/*N*/ { +/*N*/ // restore DocumentInfo if only a copy was created +/*N*/ SfxDocumentInfo &rDocInfo = GetDocInfo(); +/*N*/ rDocInfo = aSavedInfo; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Picklisten-Eintrag verhindern +/*N*/ GetMedium()->SetUpdatePickList( FALSE ); +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objstor.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objstor.cxx new file mode 100644 index 000000000000..dfba43054cbb --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objstor.cxx @@ -0,0 +1,1751 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_so3/svstor.hxx> +#include <tools/zcodec.hxx> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/FilterOptionsRequest.hpp> +#include <com/sun/star/document/XInteractionFilterOptions.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> + +#include <com/sun/star/lang/XInitialization.hpp> + +#include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <com/sun/star/beans/XPropertyAccess.hpp> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <com/sun/star/container/XNameAccess.hpp> + +#include <comphelper/processfactory.hxx> + +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include <bf_svtools/itemset.hxx> + +#include <bf_svtools/sfxecode.hxx> + +#include <cppuhelper/weak.hxx> +#include <comphelper/processfactory.hxx> + +#include <comphelper/classids.hxx> +#include <tools/cachestr.hxx> +#include <bf_svtools/addxmltostorageoptions.hxx> +#include <unotools/streamwrap.hxx> + +#include <bf_svtools/saveopt.hxx> +#include <bf_svtools/useroptions.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <tools/urlobj.hxx> +#include <unotools/localfilehelper.hxx> +#include <unotools/ucbhelper.hxx> +#include <unotools/tempfile.hxx> +#include <ucbhelper/content.hxx> +#include <sot/storinfo.hxx> + +#include "objsh.hxx" +#include "request.hxx" +#include "docfile.hxx" +#include "fltfnc.hxx" +#include "docfilt.hxx" +#include "docinf.hxx" +#include "docfac.hxx" +#include "cfgmgr.hxx" +#include "objshimp.hxx" +#include "sfxtypes.hxx" +#include "appdata.hxx" +#include "sfxsids.hrc" +#include "interno.hxx" +#include "module.hxx" +#include "app.hxx" +#include "openflag.hxx" +#include "helper.hxx" +#include "dlgcont.hxx" +#include "appuno.hxx" + +#include "bf_basic/basmgr.hxx" + +#include "scriptcont.hxx" +#include "event.hxx" +#include "fltoptint.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +#define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) + + +extern sal_uInt32 CheckPasswd_Impl( SfxObjectShell*, SfxItemPool&, SfxMedium* ); + + +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::document; +using namespace ::rtl; +using namespace ::cppu; + +//========================================================================= + +/*N*/ sal_Bool ShallSetBaseURL_Impl( SfxMedium &rMed ) +/*N*/ { +/*N*/ SvtSaveOptions aOpt; +/*N*/ sal_Bool bIsRemote = rMed.IsRemote(); +/*N*/ return aOpt.IsSaveRelINet() && bIsRemote || aOpt.IsSaveRelFSys() && !bIsRemote; +/*N*/ } + +//========================================================================= + +/*N*/ sal_Bool SfxObjectShell::Save() +/*N*/ { +/*N*/ if( SOFFICE_FILEFORMAT_60 <= GetStorage()->GetVersion() ) +/*N*/ return sal_True; +/*N*/ else +/*N*/ return SaveInfoAndConfig_Impl( GetMedium()->GetStorage() ); +/*N*/ } + +//-------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::SaveAs( SvStorage* pNewStg ) +/*N*/ { +/*N*/ if( SOFFICE_FILEFORMAT_60 <= pNewStg->GetVersion() ) +/*N*/ return sal_True; +/*N*/ else +/*N*/ return SaveInfoAndConfig_Impl( pNewStg ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, String& rPasswd ) +/*N*/ { +/*N*/ const SfxPoolItem* pItem = NULL; +/*N*/ if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) ) +/*N*/ { +/*?*/ DBG_ASSERT( pItem->IsA( TYPE(SfxStringItem) ), "wrong item type" ); +/*?*/ rPasswd = ( (const SfxStringItem*)pItem )->GetValue(); +/*?*/ return sal_True; +/*N*/ } +/*N*/ return sal_False; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoInitNew( SvStorage * pStor ) + +/* [Beschreibung] + + Diese von SvPersist geerbte virtuelle Methode wird gerufen, um + die SfxObjectShell-Instanz aus einem Storage (pStor != 0) bzw. + (pStor == 0) ganz neu zu initialisieren. + + Wie alle Do...-Methoden liegt hier eine Steuerung vor, die eigentliche + Implementierung erfolgt, indem die ebenfalls virtuellen Methode + InitNew(SvStorate*) von der SfxObjectShell-Subclass implementiert wird. + + F"ur pStor == 0 wird ein die SfxObjectShell-Instanz mit einem leeren + SfxMedium verbunden, sonst mit einem SfxMedium, welches auf den + als Parameter "ubergeben SvStorage verweist. + + Erst nach InitNew() oder Load() ist das Objekt korrekt initialisiert. + + [R"uckgabewert] + sal_True Das Objekt wurde initialisiert. + sal_False Das Objekt konnte nicht initialisiert werden +*/ + +/*N*/ { +/*N*/ ModifyBlocker_Impl aBlock( this ); +/*N*/ if ( pStor ) +/*N*/ pMedium = new SfxMedium( pStor ); +/*N*/ else +/*N*/ { +/*N*/ bIsTmp = sal_True; +/*N*/ pMedium = new SfxMedium; +/*N*/ } +/*N*/ +/*N*/ if ( InitNew( pStor ) ) +/*N*/ { +/*N*/ // empty documents always get their macros from the user, so there is no reason to restrict access +/*N*/ pImp->nMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; +/*N*/ +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel ( GetModel(), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ if ( xModel.is() ) +/*N*/ { +/*N*/ SfxItemSet *pSet = GetMedium()->GetItemSet(); +/*N*/ pSet->Put( SfxStringItem( SID_FILTER_NAME, GetFactory().GetFilter(0)->GetFilterName() ) ); +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; +/*N*/ TransformItems( SID_OPENDOC, *pSet, aArgs ); +/*N*/ sal_Int32 nLength = aArgs.getLength(); +/*N*/ aArgs.realloc( nLength + 1 ); +/*N*/ aArgs[nLength].Name = DEFINE_CONST_UNICODE("Title"); +/*N*/ aArgs[nLength].Value <<= ::rtl::OUString( GetTitle( SFX_TITLE_DETECT ) ); +/*N*/ xModel->attachResource( ::rtl::OUString(), aArgs ); +/*N*/ } +/*N*/ +/*N*/ SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); +/*N*/ return sal_True; +/*N*/ } +/*N*/ return sal_False; +/*N*/ } + +//------------------------------------------------------------------------- + +void SfxObjectShell::DoHandsOffNoMediumClose() +/*N*/ { +/*N*/ const SfxFilter *pFilter = pMedium->GetFilter(); +/*N*/ if( !pFilter || pFilter->IsOwnFormat() || ( pFilter->GetFilterFlags() & SFX_FILTER_PACKED ) ) +/*N*/ HandsOff(); +/*N*/ +/*N*/ // Force document library containers to release storage +/*N*/ SotStorageRef xDummyStorage; +/*N*/ SfxDialogLibraryContainer* pDialogCont = pImp->pDialogLibContainer; +/*N*/ if( pDialogCont ) +/*N*/ pDialogCont->setStorage( xDummyStorage ); +/*N*/ +/*N*/ SfxScriptLibraryContainer* pBasicCont = pImp->pBasicLibContainer; +/*N*/ if( pBasicCont ) +/*N*/ pBasicCont->setStorage( xDummyStorage ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::DoHandsOff() + +/* [Beschreibung] + + Diese von SvPersist geerbte virtuelle Methode wird gerufen, um + das Objekt aufzufordern, den ihm zugeteilten SvStorage freizugeben, + insbesondere Substorages und Streams zu schlie"sen. + + Als Do...-Methode liegt hier nur die Steuerung. Der Implementierer + von Subclasses kann die ebenfalls virtuelle Methode HandsOff() + implementieren, um seine Substorages und Streams zu schlie"sen. + + Nach dem Aufruf dieser Methode, ist dem Objekt kein SfxMedium mehr + zugeordnet, bis SaveCompleted() durchlaufen ist. +*/ + +/*N*/ { +/*N*/ DoHandsOffNoMediumClose(); +/*N*/ pMedium->Close(); +/*N*/ // DELETEZ( pMedium ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*?*/ sal_Bool SfxObjectShell::DoLoad( +/*?*/ const String& rFileName, StreamMode nStreamMode, StorageMode nStorageMode) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ return sal_False; +/*?*/ } + + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoLoad( SvStorage * pStor ) + +/* [Beschreibung] + + Diese von SvPersist geerbte virtuelle Methode steuert das Laden + des Objektes aus einem Storage. Dabei wird der SvStorage zun"achst + in einem SfxMedium verpackt und SfxObjectShell::DoLoad(SfxMedium*) + mit diesem gerufen. + + [R"uckgabewert] + sal_True Das Objekt wurde initialisiert. + sal_False Das Objekt konnte nicht initialisiert werden +*/ + +/*N*/ { +/*N*/ pMedium = new SfxMedium( pStor ); +/*N*/ if ( DoLoad(pMedium) ) +/*N*/ { +/*N*/ if ( SFX_CREATE_MODE_EMBEDDED == eCreateMode ) +/*N*/ { +/*N*/ ModifyBlocker_Impl aBlock( this ); +/*N*/ // bei Embedded Objekten setzt sonst keiner den Namen +/*N*/ // DBG_ASSERT( pStor->GetName().Len(), +/*N*/ // "StorageName hat Laenge Null" ); +/*N*/ SetTitle( pStor->GetName() ); +/*N*/ } +/*N*/ return sal_True; +/*N*/ } +/*N*/ +/*N*/ return sal_False; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) + +/* [Beschreibung] + + Diese Methode steuert das Laden des Objektes aus dem von dem + "ubergebenen SfxMedium beschriebenen Medium. Hinterher ist das Objekt + mit diesem SfxMedium verbunden. + + Handelt es sich bei dem SfxMedium um einen Storage im eigenen Format, + wird die virtuelle Methode SvPersit::Load(SvStorage*) gerufen, welche + die Implementierer von Subclasses "uberladen m"ussen, um das Objekt + aus einem eigenen Storage zu laden (=> Swapping m"oeglich). + + Handelt es sich bei dem SfxMedium um einen Storage in einem fremden + Format, oder um ein Flat-File, dann wird die virtuelle Methode + <SfxObjectShell::ConvertFrom(SfxMedium*)> gerufen, welche die + Implementierer von Subclasses "uberladen m"ussen, um das Objekt + aus dem SfxMedium zu konvertieren. W"ahrend der Bearbeitung ist + das Objekt dann mit einem tempor"aren SvStorage verbunden. + + Erst nach InitNew() oder Load() ist das Objekt korrekt + initialisiert. + + [R"uckgabewert] + sal_True Das Objekt wurde geladen. + sal_False Das Objekt konnte nicht geladen werden +*/ + +/*N*/ { +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ ModifyBlocker_Impl aBlock( this ); +/*N*/ +/*N*/ pMedium = pMed; +/*N*/ sal_Bool bOk = sal_False; +/*N*/ const SfxFilter* pFilter = pMed->GetFilter(); +/*N*/ SfxItemSet* pSet = pMedium->GetItemSet(); +/*N*/ if( !pImp->nEventId ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( +/*N*/ pSet, pTemplateItem, SfxBoolItem, +/*N*/ SID_TEMPLATE, sal_False); +/*N*/ SetActivateEvent_Impl( +/*N*/ ( pTemplateItem && pTemplateItem->GetValue() ) +/*N*/ ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ SFX_ITEMSET_ARG( pSet, pBaseItem, SfxStringItem, +/*N*/ SID_BASEURL, sal_False); +/*N*/ String aBaseURL; +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); +/*N*/ if( pBaseItem ) +/*N*/ aBaseURL = pBaseItem->GetValue(); +/*N*/ else +/*N*/ { +/*N*/ if( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +/*N*/ { +/*N*/ aBaseURL = ::binfilter::StaticBaseUrl::GetBaseURL(); +/*N*/ SetBaseURL( aBaseURL ); +/*N*/ } +/*N*/ else if ( pSalvageItem ) +/*N*/ { +/*N*/ String aName( pMed->GetPhysicalName() ); +/*N*/ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aBaseURL ); +/*N*/ } +/*N*/ else +/*N*/ aBaseURL = pMed->GetBaseURL(); +/*N*/ } +/*N*/ +/*N*/ SfxApplication* pApp = SFX_APP(); +/*N*/ pImp->nLoadedFlags = 0; +/*N*/ sal_Bool bHasStorage = !pFilter || ( pFilter->IsOwnFormat() && pFilter->UsesStorage() ); +/*N*/ if ( !bHasStorage && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PACKED ) ) +/*N*/ { +/*N*/ bHasStorage = pMed->TryStorage(); +/*N*/ if ( bHasStorage ) +/*N*/ { +/*N*/ String aName( pMed->GetPhysicalName() ); +/*N*/ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aBaseURL ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pMedium->GetFilter() ) +/*N*/ { +/*N*/ sal_uInt32 nError = HandleFilter( pMedium, this ); +/*N*/ if ( nError != ERRCODE_NONE ) +/*N*/ SetError( nError ); +/*N*/ } +/*N*/ +/*N*/ if ( GetError() == ERRCODE_NONE && pMed->IsStorage() ) // STRIP003 && bHasStorage && ( !pFilter || !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) ) +/*N*/ { +/*N*/ SvStorageRef xStor( pMed->GetStorage() ); +/*N*/ if( pMed->GetLastStorageCreationState() == ERRCODE_NONE ) +/*N*/ { +/*N*/ DBG_ASSERT( pFilter, "No filter for storage found!" ); +/*N*/ if( xStor.Is() && !xStor->GetError() && pMed->GetFilter() && pMed->GetFilter()->GetVersion() < SOFFICE_FILEFORMAT_60 ) +/*N*/ { +/*N*/ // Undoobjekte aufraeumen, muss vor dem eigentlichen Laden erfolgen +/*N*/ SvEmbeddedObjectRef xThis = this; +/*N*/ SvPersistRef xPer; +/*N*/ if ( xThis.Is() ) +/*N*/ xPer = new SvEmbeddedObject; +/*N*/ else +/*?*/ xPer = new SvPersist; +/*N*/ +/*N*/ xPer->DoOwnerLoad(xStor); +/*N*/ xPer->CleanUp(); +/*N*/ xPer->DoSave(); +/*N*/ xPer->DoSaveCompleted( 0 ); +/*N*/ } +/*N*/ +/*N*/ if ( xStor.Is() ) +/*N*/ { +/*N*/ SvStorageInfoList aList; +/*N*/ xStor->FillInfoList( &aList ); +/*N*/ if ( !aList.Count() && !xStor->IsOLEStorage() ) +/*?*/ SetError( ERRCODE_IO_BROKENPACKAGE ); +/*N*/ else +/*N*/ { +/*N*/ BOOL bHasMacros = FALSE; +/*N*/ if ( xStor->IsOLEStorage() ) +/*N*/ bHasMacros = BasicManager::HasBasicWithModules( + *xStor, + ::binfilter::StaticBaseUrl::GetBaseURL( + INetURLObject::NO_DECODE) ); +/*N*/ else +/*?*/ bHasMacros = xStor->IsStorage( String::CreateFromAscii("Basic") ); +/*N*/ +/*N*/ if ( bHasMacros ) +/*N*/ AdjustMacroMode( String() ); +/*N*/ else +/*N*/ { +/*N*/ // if macros will be added by the user later, the security check is obsolete +/*N*/ pImp->nMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Load +/*N*/ if ( !GetError() ) +/*N*/ { +/*N*/ const String aOldURL( ::binfilter::StaticBaseUrl::GetBaseURL() ); +/*N*/ if( aBaseURL.Len() ) ::binfilter::StaticBaseUrl::SetBaseURL( aBaseURL ); +/*N*/ pImp->nLoadedFlags = 0; +/*N*/ bOk = xStor.Is() && LoadOwnFormat( *pMed ); +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*N*/ if ( bOk ) +/*N*/ { +/*N*/ GetDocInfo().Load(xStor); +/*N*/ bHasName = sal_True; +/*N*/ } +/*N*/ else +/*?*/ SetError( ERRCODE_ABORT ); +/*N*/ } +/*N*/ } +/*N*/ else +/*?*/ SetError( pMed->GetLastStorageCreationState() ); +/*N*/ } + else if ( GetError() == ERRCODE_NONE && InitNew(0) ) +/*?*/ { +/*?*/ // Name vor ConvertFrom setzen, damit GetSbxObject() schon funktioniert +/*?*/ bHasName = sal_True; +/*?*/ +/*?*/ // Importieren +/*?*/ const String aOldURL( ::binfilter::StaticBaseUrl::GetBaseURL() ); +/*?*/ if( aBaseURL.Len() ) ::binfilter::StaticBaseUrl::SetBaseURL( aBaseURL ); +/*?*/ if( !pMedium->GetFilter()->UsesStorage() ) +/*?*/ pMedium->GetInStream(); +/*?*/ else +/*?*/ pMedium->GetStorage(); +/*?*/ +/*?*/ pImp->nLoadedFlags = 0; +/*?*/ bOk = ConvertFrom(*pMedium); +/*?*/ +/*?*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*?*/ +/*?*/ if( bOk && pMedium->GetOpenMode() & STREAM_WRITE ) +/*?*/ //Medium offen halten um andere Zugriffe zu verhindern +/*?*/ { +/*?*/ if(pMedium->GetFilter() && pMedium->GetFilter()->UsesStorage()) +/*?*/ { +/*?*/ pMedium->GetStorage(); +/*?*/ if( pMedium->GetLastStorageCreationState() != ERRCODE_NONE ) +/*?*/ pMedium->SetError( pMedium->GetLastStorageCreationState() ); +/*?*/ } +/*?*/ else +/*?*/ pMedium->GetInStream(); +/*?*/ if(pMedium->GetError()) +/*?*/ bOk = sal_False; +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ if ( bOk ) +/*N*/ { +/*N*/ try +/*?*/ /*N*/ { +/*?*/ ::ucbhelper::Content aContent( pMedium->GetName(), ::com::sun::star::uno::Reference < XCommandEnvironment >() ); +/*?*/ ::com::sun::star::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); +/*?*/ if ( xProps.is() ) +/*?*/ { +/*?*/ ::rtl::OUString aAuthor( RTL_CONSTASCII_USTRINGPARAM("Author") ); +/*?*/ ::rtl::OUString aKeywords( RTL_CONSTASCII_USTRINGPARAM("Keywords") ); +/*?*/ ::rtl::OUString aSubject( RTL_CONSTASCII_USTRINGPARAM("Subject") ); +/*?*/ Any aAny; +/*?*/ ::rtl::OUString aValue; +/*?*/ SfxDocumentInfo& rInfo = GetDocInfo(); +/*?*/ if ( xProps->hasPropertyByName( aAuthor ) ) +/*?*/ { +/*?*/ aAny = aContent.getPropertyValue( aAuthor ); +/*?*/ if ( ( aAny >>= aValue ) ) +/*?*/ rInfo.SetCreated( SfxStamp( String( aValue ) ) ); +/*?*/ } +/*?*/ if ( xProps->hasPropertyByName( aKeywords ) ) +/*?*/ { +/*?*/ aAny = aContent.getPropertyValue( aKeywords ); +/*?*/ if ( ( aAny >>= aValue ) ) +/*?*/ rInfo.SetKeywords( aValue ); +/*?*/ } +/*?*/ if ( xProps->hasPropertyByName( aSubject ) ) +/*?*/ { +/*?*/ aAny = aContent.getPropertyValue( aSubject ); +/*?*/ if ( ( aAny >>= aValue ) ) +/*?*/ rInfo.SetTheme( aValue ); +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ ::rtl::OUString aTitle = GetTitle( SFX_TITLE_DETECT ); +/*N*/ +/*N*/ // Falls nicht asynchron geladen wird selbst FinishedLoading aufrufen +/*N*/ if ( !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) && +/*N*/ ( !pMedium->GetFilter() || +/*N*/ pMedium->GetFilter()->UsesStorage() || +/*N*/ !( pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_ASYNC ) ) ) +/*N*/ FinishedLoading( SFX_LOADED_MAINDOCUMENT ); +/*N*/ +/*N*/ if ( pSalvageItem ) +/*N*/ { +/*?*/ pImp->aTempName = pMedium->GetPhysicalName(); +/*?*/ pMedium->GetItemSet()->ClearItem( SID_DOC_SALVAGE ); +/*?*/ pMedium->GetItemSet()->ClearItem( SID_FILE_NAME ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pMedium->GetItemSet()->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); +/*N*/ pMedium->GetItemSet()->ClearItem( SID_DOCUMENT ); +/*N*/ } +/*N*/ +/*N*/ pMedium->GetItemSet()->ClearItem( SID_REFERER ); +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel ( GetModel(), ::com::sun::star::uno::UNO_QUERY ); +/*N*/ if ( xModel.is() ) +/*N*/ { +/*N*/ ::rtl::OUString aURL = GetMedium()->GetOrigURL(); +/*N*/ SfxItemSet *pSet = GetMedium()->GetItemSet(); +/*N*/ if ( !GetMedium()->IsReadOnly() ) +/*N*/ pSet->ClearItem( SID_INPUTSTREAM ); +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; +/*N*/ TransformItems( SID_OPENDOC, *pSet, aArgs ); +/*N*/ xModel->attachResource( aURL, aArgs ); +/*N*/ } +/*N*/ +/*N*/ if( IsOwnStorageFormat_Impl(*pMed) && pMed->GetFilter() ) +/*N*/ { +/*N*/ //???? dv DirEntry aDirEntry( pMed->GetPhysicalName() ); +/*N*/ //???? dv SetFileName( aDirEntry.GetFull() ); +/*N*/ } +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) ); +/*N*/ } +/*N*/ +/*N*/ if ( SFX_CREATE_MODE_EMBEDDED != eCreateMode ) +/*N*/ { +/*N*/ GetpApp()->HideStatusText(); +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + +/*N*/ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ) +/*N*/ { +/*N*/ sal_uInt32 nError = ERRCODE_NONE; +/*N*/ SfxItemSet* pSet = pMedium->GetItemSet(); +/*N*/ SFX_ITEMSET_ARG( pSet, pOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); +/*N*/ SFX_ITEMSET_ARG( pSet, pData, SfxUsrAnyItem, SID_FILTER_DATA, sal_False ); +/*N*/ if ( !pData && !pOptions ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< XMultiServiceFactory > xServiceManager = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*N*/ ::com::sun::star::uno::Reference< XNameAccess > xFilterCFG; +/*N*/ if( xServiceManager.is() ) +/*N*/ { +/*N*/ xFilterCFG = ::com::sun::star::uno::Reference< XNameAccess >( +/*N*/ xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), +/*N*/ UNO_QUERY ); +/*N*/ } +/*N*/ +/*N*/ if( xFilterCFG.is() ) +/*N*/ { +/*N*/ BOOL bAbort = FALSE; +/*N*/ try { +/*N*/ const SfxFilter* pFilter = pMedium->GetFilter(); +/*N*/ Sequence < PropertyValue > aProps; +/*N*/ Any aAny = xFilterCFG->getByName( pFilter->GetName() ); +/*N*/ if ( aAny >>= aProps ) +/*N*/ { +/*N*/ ::rtl::OUString aServiceName; +/*N*/ sal_Int32 nPropertyCount = aProps.getLength(); +/*N*/ for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty ) +/*N*/ if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii("UIComponent")) ) +/*N*/ { +/*N*/ ::rtl::OUString aServiceName; +/*N*/ aProps[nProperty].Value >>= aServiceName; +/*N*/ if( aServiceName.getLength() ) +/*?*/ { +/*?*/ ::com::sun::star::uno::Reference< XInteractionHandler > rHandler = pMedium->GetInteractionHandler(); +/*?*/ if( rHandler.is() ) +/*?*/ { +/*?*/ // we need some properties in the media descriptor, so we have to make sure that they are in +/*?*/ Any aAny; +/*?*/ aAny <<= pMedium->GetInputStream(); +/*?*/ if ( pSet->GetItemState( SID_INPUTSTREAM ) < SFX_ITEM_SET ) +/*?*/ pSet->Put( SfxUsrAnyItem( SID_INPUTSTREAM, aAny ) ); +/*?*/ if ( pSet->GetItemState( SID_FILE_NAME ) < SFX_ITEM_SET ) +/*?*/ pSet->Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) ); +/*?*/ if ( pSet->GetItemState( SID_FILTER_NAME ) < SFX_ITEM_SET ) +/*?*/ pSet->Put( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) ); +/*?*/ +/*?*/ Sequence< PropertyValue > rProperties; +/*?*/ TransformItems( SID_OPENDOC, *pSet, rProperties ); +/*?*/ RequestFilterOptions* pFORequest = new RequestFilterOptions( pDoc->GetModel(), rProperties ); +/*?*/ +/*?*/ ::com::sun::star::uno::Reference< XInteractionRequest > rRequest( pFORequest ); +/*?*/ rHandler->handle( rRequest ); +/*?*/ +/*?*/ if ( !pFORequest->isAbort() ) +/*?*/ { +/*?*/ SfxAllItemSet aNewParams( pDoc->GetPool() ); +/*?*/ TransformParameters( SID_OPENDOC, +/*?*/ pFORequest->getFilterOptions(), +/*?*/ aNewParams ); +/*?*/ +/*?*/ SFX_ITEMSET_ARG( &aNewParams, +/*?*/ pOptions, +/*?*/ SfxStringItem, +/*?*/ SID_FILE_FILTEROPTIONS, +/*?*/ sal_False ); +/*?*/ if ( pOptions ) +/*?*/ pSet->Put( *pOptions ); +/*?*/ +/*?*/ SFX_ITEMSET_ARG( &aNewParams, +/*?*/ pData, +/*?*/ SfxUsrAnyItem, +/*?*/ SID_FILTER_DATA, +/*?*/ sal_False ); +/*?*/ if ( pData ) +/*?*/ pSet->Put( *pData ); +/*?*/ } +/*?*/ else +/*?*/ bAbort = TRUE; +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( bAbort ) +/*N*/ { +/*N*/ // filter options were not entered +/*N*/ nError = ERRCODE_ABORT; +/*N*/ } +/*N*/ } +/*N*/ catch( NoSuchElementException& ) +/*N*/ { +/*N*/ // the filter name is unknown +/*N*/ nError = ERRCODE_IO_INVALIDPARAMETER; +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ nError = ERRCODE_ABORT; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nError; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsOwnStorageFormat_Impl(const SfxMedium &rMedium) const +/*N*/ { +/*N*/ return !rMedium.GetFilter() || // Embedded +/*N*/ ( rMedium.GetFilter()->IsOwnFormat() && +/*N*/ rMedium.GetFilter()->UsesStorage() ); +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoSave() +// DoSave wird nur noch ueber OLE aufgerufen. Sichern eigener Dokumente im SFX +// laeuft uber DoSave_Impl, um das Anlegen von Backups zu ermoeglichen. +// Save in eigenes Format jetzt auch wieder Hierueber +/*N*/ { +/*N*/ sal_Bool bOk = sal_False ; +/*N*/ { +/*N*/ ModifyBlocker_Impl aBlock( this ); +/*N*/ SfxForceLinkTimer_Impl aFLT( this ); +/*N*/ pImp->bIsSaving = sal_True; +/*N*/ String aPasswd; +/*N*/ if ( IsOwnStorageFormat_Impl( *GetMedium() ) && +/*N*/ GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) ) +/*N*/ GetMedium()->GetStorage()->SetKey( S2BS( aPasswd ) ); //!!! (pb) needs new implementation +/*N*/ GetStorage()->SetVersion( GetMedium()->GetFilter()->GetVersion() ); +/*N*/ bOk = Save(); +/*N*/ } + +//#88046 +// if ( bOk ) +// SetModified( sal_False ); +/*N*/ return bOk; +/*N*/ } + +/*N*/ void Lock_Impl( SfxObjectShell* pDoc, BOOL bLock ) +/*N*/ { +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::SaveTo_Impl +/*N*/ ( +/*N*/ SfxMedium &rMedium, // Medium, in das gespeichert werden soll +/*N*/ const SfxItemSet* pSet, +/*N*/ BOOL bPrepareForDirectAccess +/*N*/ ) + +/* [Beschreibung] + + Schreibt den aktuellen Inhalt in das Medium rMedium. + Ist das Zielmedium kein Storage, so wird ueber ein temporaeres + Medium gespeichert, sonst direkt, da das Medium transacted + geschaltet ist, wenn wir es selbst geoeffnet haben und falls wir + Server sind entweder der Container einen transacted Storage zur + Verfuegung stellt oder selbst einen temporaeren Storage erzeugt hat. +*/ + +/*N*/ { +/*N*/ SfxForceLinkTimer_Impl aFLT( this ); +/*N*/ EnableSetModified( FALSE ); +/*N*/ +/*N*/ const SfxFilter *pFilter = rMedium.GetFilter(); +/*N*/ if ( !pFilter ) +/*N*/ { +/*N*/ // if no filter was set, use the default filter +/*N*/ // this should be changed in the feature, it should be an error! +/*?*/ pFilter = GetFactory().GetFilter(0); +/*?*/ rMedium.SetFilter(pFilter); +/*N*/ } +/*N*/ +/*N*/ if( pFilter->UsesStorage() ) +/*N*/ // create an output storage in the correct format +/*N*/ rMedium.GetOutputStorage( SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion() ); +/*N*/ else +/*?*/ rMedium.GetOutStream(); +/*N*/ +/*N*/ if( rMedium.GetErrorCode() ) +/*N*/ return sal_False; +/*N*/ +/*N*/ sal_Bool bOldStat = pImp->bForbidReload; +/*N*/ pImp->bForbidReload = sal_True; +/*N*/ +/*N*/ // lock user interface while saving the document +/*N*/ Lock_Impl( this, sal_True ); +/*N*/ +/*N*/ sal_Bool bOk = sal_False; +/*N*/ if( sal_True ) // STRIP003 IsOwnStorageFormat_Impl(rMedium) && !(pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER)) +/*N*/ { +/*N*/ SvStorageRef aMedRef = rMedium.GetStorage(); +/*N*/ if ( !aMedRef.Is() ) +/*N*/ { +/*?*/ // no saving without storage, unlock UI and return +/*?*/ Lock_Impl( this, sal_False ); +/*?*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ // transfer password from the parameters to the storage +/*N*/ String aPasswd; +/*N*/ if ( GetPasswd_Impl( rMedium.GetItemSet(), aPasswd ) ) +/*N*/ aMedRef->SetKey( S2BS( aPasswd ) ); //!!! (pb) needs new implementation +/*N*/ +/*N*/ const SfxFilter* pFilter = rMedium.GetFilter(); +/*N*/ if( ((SvStorage *)aMedRef) == ((SvStorage *)GetStorage() ) ) +/*N*/ { +/*N*/ // target storage and object storage are identical, should never happen here +/*?*/ DBG_ERROR( "Saving storage without copy!"); +/*?*/ aMedRef->SetVersion( pFilter->GetVersion() ); +/*?*/ bOk = Save(); +/*N*/ } +/*N*/ else +/*N*/ // save to target +/*N*/ bOk = SaveAsOwnFormat( rMedium ); +/*N*/ +/*N*/ // look for a "version" parameter +/*N*/ const SfxStringItem *pVersionItem = pSet ? (const SfxStringItem*) +/*N*/ SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, sal_False, TYPE(SfxStringItem) ) : NULL; +/*N*/ +/*N*/ if ( pVersionItem ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ else if ( pImp->bIsSaving ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ } +//STRIP003/*N*/ else +//STRIP003/*N*/ { +//STRIP003/*?*/ // it's a "SaveAs" in an alien format +//STRIP003/*?*/ if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) +//STRIP003/*?*/ bOk = ExportTo( rMedium ); +//STRIP003/*?*/ else +//STRIP003/*?*/ bOk = ConvertTo( rMedium ); +//STRIP003/*?*/ +//STRIP003/*?*/ // after saving the document, the temporary object storage must be updated +//STRIP003/*?*/ // if the old object storage was not a temporary one, it will be updated also, because it will be used +//STRIP003/*?*/ // as a source for copying the objects into the new temporary storage that will be created below +//STRIP003/*?*/ // updating means: all child objects must be stored into it +//STRIP003/*?*/ // ( same as on loading, where these objects are copied to the temporary storage ) +//STRIP003/*?*/ // but don't commit these changes, because in the case when the old object storage is not a temporary one, +//STRIP003/*?*/ // all changes will be written into the original file ! +//STRIP003/*?*/ if( bOk ) +//STRIP003/*?*/ bOk = SaveChilds() && SaveCompletedChilds( NULL ); +//STRIP003/*N*/ } + + // SetModified must be enabled when SaveCompleted is called, otherwise the modified flag of child objects will not be cleared +/*N*/ EnableSetModified( sal_True ); +/*N*/ +/*N*/ sal_Bool bCopyTo = sal_False; +/*N*/ SfxItemSet *pMedSet = rMedium.GetItemSet(); +/*N*/ if( pMedSet ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pMedSet, pSaveToItem, SfxBoolItem, SID_SAVETO, sal_False ); +/*N*/ bCopyTo = GetCreateMode() == SFX_CREATE_MODE_EMBEDDED || +/*N*/ pSaveToItem && pSaveToItem->GetValue(); +/*N*/ } +/*N*/ +/*N*/ if( bOk ) +/*N*/ { +/*N*/ // remember new object storage, if it is a temporary one, because we will need it for a "SaveCompleted" later +/*N*/ SvStorageRef xNewTempRef; +/*N*/ if ( bOk && bPrepareForDirectAccess ) +/*N*/ { +/*N*/ // if the target medium is an alien format and the "old" medium was an own format, the object storage +/*N*/ // must be exchanged, because now we need a new temporary storage as object storage +/*N*/ BOOL bNeedsStorage = !bCopyTo && IsOwnStorageFormat_Impl(*pMedium) && !IsOwnStorageFormat_Impl(rMedium); +/*N*/ if ( bNeedsStorage ) +/*N*/ { +/*?*/ if( !pMedium->GetName().Len() ) +/*?*/ // if the old object storage was a temporary one too, we can continue with it +/*?*/ xNewTempRef = GetStorage(); +/*?*/ else +/*?*/ { +/*?*/ // copy storage of old medium to new temporary storage and take this over +/*?*/ if( ConnectTmpStorage_Impl( pMedium->GetStorage() ) ) +/*?*/ xNewTempRef = GetStorage(); +/*?*/ else +/*?*/ bOk = sal_False; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ // When the new medium ( rMedium ) has the same name as the current one, +/*N*/ // we need to call DoHandsOff() so Commit() can overwrite the old version +/*N*/ if ( bOk && pMedium && ( rMedium.GetName().EqualsIgnoreCaseAscii( pMedium->GetName() ) ) +/*N*/ && rMedium.GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL ) +/*?*/ DoHandsOff(); +/*N*/ } +/*N*/ +/*N*/ if ( bOk && pMedium && ( rMedium.GetName() == pMedium->GetName() ) ) +/*N*/ { +/*N*/ // before we overwrite the original file, we will make a backup if there is a demand for that +/*N*/ const sal_Bool bDoBackup = SvtSaveOptions().IsBackup(); +/*N*/ if ( bDoBackup ) +/*N*/ {{DBG_BF_ASSERT(0, "STRIP");}//STRIP001 +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( bOk ) +/*N*/ { +/*N*/ // transfer data to its destinated location +/*N*/ EnableSetModified( sal_False ); +/*N*/ RegisterTransfer( rMedium ); +/*N*/ bOk = rMedium.Commit(); +/*N*/ EnableSetModified( sal_True ); +/*N*/ +/*N*/ if ( bOk ) +/*N*/ { +/*N*/ // watch: if the document was successfully saved into an own format, no "SaveCompleted" was called, +/*N*/ // this must be done by the caller ( because they want to do different calls ) +/*N*/ if( xNewTempRef.Is() && xNewTempRef != GetStorage() ) +/*N*/ // if the new object storage is a temporary one, because the target format is an alien format +/*?*/ SaveCompleted( xNewTempRef ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ // if the storing process fails on medium commit step it means that +/*?*/ // the new medium should contain successfully written temporary representation +/*?*/ // of the document, so the docshell can just switch to new medium. +/*?*/ // it is reasonable in case an open document suddenly became unavailable. +/*?*/ +/*?*/ OUString aOrigName = pMedium ? OUString(pMedium->GetName()) : OUString(); +/*?*/ if ( aOrigName.getLength() && aOrigName.compareToAscii( "private:", 8 ) != COMPARE_EQUAL +/*?*/ && !::utl::UCBContentHelper::Exists( aOrigName ) ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");//STRIP001 +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // unlock user interface +/*N*/ Lock_Impl( this, sal_False ); +/*N*/ pImp->bForbidReload = bOldStat; +/*N*/ +/*N*/ if ( bOk ) +/*N*/ { +/*N*/ DBG_ASSERT( pFilter, "No filter after successful save?!" ); +/*N*/ if( pFilter ) +/*N*/ if( !bCopyTo && pFilter->IsAlienFormat() ) +/*N*/ // set flag, that the user will be warned for possible data loss on closing this document +/*N*/ pImp->bDidDangerousSave=sal_True; +/*N*/ else +/*?*/ pImp->bDidDangerousSave=sal_False; +/*N*/ +/*N*/ +/*N*/ try +/*N*/ { +/*?*/ ::ucbhelper::Content aContent( rMedium.GetName(), ::com::sun::star::uno::Reference < XCommandEnvironment >() ); +/*?*/ ::com::sun::star::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); +/*?*/ if ( xProps.is() ) +/*?*/ { +/*?*/ ::rtl::OUString aAuthor( RTL_CONSTASCII_USTRINGPARAM("Author") ); +/*?*/ ::rtl::OUString aKeywords( RTL_CONSTASCII_USTRINGPARAM("Keywords") ); +/*?*/ ::rtl::OUString aSubject( RTL_CONSTASCII_USTRINGPARAM("Subject") ); +/*?*/ Any aAny; +/*?*/ if ( xProps->hasPropertyByName( aAuthor ) ) +/*?*/ { +/*?*/ aAny <<= ::rtl::OUString( GetDocInfo().GetCreated().GetName() ); +/*?*/ aContent.setPropertyValue( aAuthor, aAny ); +/*?*/ } +/*?*/ if ( xProps->hasPropertyByName( aKeywords ) ) +/*?*/ { +/*?*/ aAny <<= ::rtl::OUString( GetDocInfo().GetKeywords() ); +/*?*/ aContent.setPropertyValue( aKeywords, aAny ); +/*?*/ } +/*?*/ if ( xProps->hasPropertyByName( aSubject ) ) +/*?*/ { +/*?*/ aAny <<= ::rtl::OUString( GetDocInfo().GetTheme() ); +/*?*/ aContent.setPropertyValue( aSubject, aAny ); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + +//------------------------------------------------------------------------ + +/*?*/ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( SvStorage* pStg) + +/* [Beschreibung] + + Arbeitet die Applikation auf einem temporaeren Storage, + so darf der temporaere Storage nicht aus dem SaveCompleted + genommen werden. Daher wird in diesem Fall schon hier an + den neuen Storage connected. SaveCompleted tut dann nichts. + + */ + +/*?*/ { +/*?*/ // wenn es kein temp. Storage ist, einen anlegen +/*?*/ SvStorageRef aTmpMed = new SvStorage( (pStg->GetVersion() >= SOFFICE_FILEFORMAT_60), String() ); +/*?*/ +/*?*/ // nach HandsOff muss der alte Storage wieder eingesetzt werden +/*?*/ if ( !pStg->CopyTo(aTmpMed) ) +/*?*/ { +/*?*/ SetError(aTmpMed->GetErrorCode()); +/*?*/ aTmpMed.Clear(); +/*?*/ return sal_False; +/*?*/ } +/*?*/ +/*?*/ SetError(GetMedium()->GetErrorCode()); +/*?*/ SaveCompleted(aTmpMed); // neuer temp. Storage; gibt alten frei +/*?*/ return sal_True; +/*?*/ } + + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoSaveAs( SvStorage * pNewStor ) +/*N*/ { +/*N*/ // DoSaveAs wird nur noch ueber OLE aufgerufen +/*N*/ sal_Bool bOk; +/*N*/ { +/*N*/ SfxForceLinkTimer_Impl aFLT( this ); +/*N*/ ModifyBlocker_Impl aBlock( this ); +/*N*/ //Abwehr gegen feindlich gesinnte Applikationen. +/*N*/ if ( !pNewStor->GetFormat() ) +/*N*/ SetupStorage( pNewStor ); +/*N*/ +/*N*/ pImp->bIsSaving = sal_False; +/*N*/ SfxMedium* pNewMed = new SfxMedium( pNewStor ); +/*N*/ const String aOldURL( ::binfilter::StaticBaseUrl::GetBaseURL() ); +/*N*/ +/*N*/ bOk = SaveAsOwnFormat( *pNewMed ); +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*N*/ delete pNewMed; +/*N*/ } +/*N*/ return bOk; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium * pNewMed ) +/*N*/ { + sal_Bool bOk = sal_True; + sal_Bool bMedChanged = pNewMed && pNewMed!=pMedium; +/* sal_Bool bCreatedTempStor = pNewMed && pMedium && + IsOwnStorageFormat_Impl(*pMedium) && + !IsOwnStorageFormat_Impl(*pNewMed) && + pMedium->GetName().Len(); +*/ +/*N*/ DBG_ASSERT( !pNewMed || pNewMed->GetError() == ERRCODE_NONE, "DoSaveCompleted: Medium has error!" ); +/*N*/ if ( bMedChanged ) +/*N*/ { +/*N*/ delete pMedium; +/*N*/ pMedium = pNewMed; +/*N*/ //MI? DELETEZ(pImp->pDocInfo); +/*N*/ } +/*N*/ +/*N*/ const SfxFilter *pFilter = pMedium ? pMedium->GetFilter() : 0; +/*N*/ if ( pNewMed ) +/*N*/ { +/*N*/ if( bMedChanged ) +/*N*/ { +/*N*/ if( pNewMed->GetName().Len() ) +/*N*/ bHasName = sal_True; +/*N*/ String aBase = GetBaseURL(); +/*N*/ if( Current() == this && aBase.Len() ) +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aBase ); +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) ); +/*N*/ } +/*N*/ +/*N*/ SvStorage *pStorage=NULL; +/*N*/ if ( !pFilter||sal_True ) //STRIP007 if ( !pFilter || pFilter->IsOwnFormat() ) +/*N*/ { +/*N*/ pStorage = pMedium->GetStorage(); +/*N*/ bOk = SaveCompleted( pStorage ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pStorage = GetStorage(); +/*?*/ if( pFilter->UsesStorage() ) +/*?*/ pMedium->GetStorage(); +/*?*/ else if( pMedium->GetOpenMode() & STREAM_WRITE ) +/*?*/ pMedium->GetInStream(); +/*N*/ } +/*N*/ +/*N*/ // Set storage in document library containers +/*N*/ SfxDialogLibraryContainer* pDialogCont = pImp->pDialogLibContainer; +/*N*/ if( pDialogCont ) +/*N*/ pDialogCont->setStorage( pStorage ); +/*N*/ +/*N*/ SfxScriptLibraryContainer* pBasicCont = pImp->pBasicLibContainer; +/*N*/ if( pBasicCont ) +/*N*/ pBasicCont->setStorage( pStorage ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( pMedium ) +/*N*/ { +/*N*/ const SfxFilter* pFilter = pMedium->GetFilter(); +/*N*/ if( pFilter && !pFilter->IsOwnFormat() && +/*N*/ (pMedium->GetOpenMode() & STREAM_WRITE )) +/*N*/ pMedium->ReOpen(); +/*N*/ else +/*N*/ SaveCompleted( 0 ); +/*N*/ } +/*N*/ // entweder Save oder ConvertTo +/*N*/ else +/*?*/ bOk = SaveCompleted( NULL ); +/*N*/ } +/*N*/ +/*N*/ if ( bOk && pNewMed ) +/*N*/ { +/*N*/ if( bMedChanged ) +/*N*/ { +/*N*/ // Titel neu setzen +/*N*/ if ( pNewMed->GetName().Len() && +/*N*/ SFX_CREATE_MODE_EMBEDDED != eCreateMode ) +/*N*/ InvalidateName(); +/*N*/ SetModified(sal_False); // nur bei gesetztem Medium zur"ucksetzen +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bOk; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::DoSaveCompleted( SvStorage * pNewStor ) +/*N*/ { +/*N*/ return DoSaveCompleted(pNewStor? new SfxMedium( pNewStor ): 0); +/*N*/ } + +//------------------------------------------------------------------------- + +/*?*/ sal_Bool SfxObjectShell::ConvertFrom +/*?*/ ( +/*?*/ SfxMedium& rMedium /* <SfxMedium>, welches die Quell-Datei beschreibt + (z.B. Dateiname, <SfxFilter>, Open-Modi etc.) */ +/*?*/ ) + +/* [Beschreibung] + + Diese Methode wird zum Laden von Dokumenten "uber alle Filter gerufen, + die nicht SFX_FILTER_OWN sind oder f"ur die kein Clipboard-Format + registriert wurde (also kein Storage-Format benutzen). Mit anderen Worten: + mit dieser Methode wird importiert. + + Das hier zu "offende File sollte "uber 'rMedium' ge"offnet werden, + um die richtigen Open-Modi zu gew"ahrleisten. Insbesondere wenn das + Format beibehalten wird (nur m"oglich bei SFX_FILTER_SIMULATE oder + SFX_FILTER_ONW) mu\s die Datei STREAM_SHARE_DENYWRITE ge"offnet werden. + + + [R"uckgabewert] + + sal_Bool sal_True + Das Dokument konnte geladen werden. + + sal_False + Das Dokument konnte nicht geladen werden, ein + Fehlercode ist mit <SvMedium::GetError()const> zu + erhalten. + + + [Beispiel] + + sal_Bool DocSh::ConvertFrom( SfxMedium &rMedium ) + { + SvStreamRef xStream = rMedium.GetInStream(); + if( xStream.is() ) + { + xStream->SetBufferSize(4096); + *xStream >> ...; + + // NICHT 'rMedium.CloseInStream()' rufen! File gelockt halten! + return SVSTREAM_OK == rMedium.GetError(); + } + + return sal_False; + } + + + [Querverweise] + + <SfxObjectShell::ConvertTo(SfxMedium&)> + <SFX_FILTER_REGISTRATION> +*/ +/*?*/ { +/*?*/ return sal_False; +/*?*/ } + +//------------------------------------------------------------------------- + +/*?*/ sal_Bool SfxObjectShell::ConvertTo +/*?*/ ( +/*?*/ SfxMedium& rMedium /* <SfxMedium>, welches die Ziel-Datei beschreibt + (z.B. Dateiname, <SfxFilter>, Open-Modi etc.) */ +/*?*/ ) + +/* [Beschreibung] + + Diese Methode wird zum Speichern von Dokumenten "uber alle Filter gerufen, + die nicht SFX_FILTER_OWN sind oder f"ur die kein Clipboard-Format + registriert wurde (also kein Storage-Format benutzen). Mit anderen Worten: + mit dieser Methode wird exportiert. + + Das hier zu "offende File sollte "uber 'rMedium' ge"offnet werden, + um die richtigen Open-Modi zu gew"ahrleisten. Insbesondere wenn das + Format beibehalten wird (nur m"oglich bei SFX_FILTER_SIMULATE oder + SFX_FILTER_ONW) mu\s die Datei auch nach dem Speichern im Modus + STREAM_SHARE_DENYWRITE ge"offnet bleiben. + + + [R"uckgabewert] + + sal_Bool sal_True + Das Dokument konnte gespeichert werden. + + sal_False + Das Dokument konnte nicht gespeichert werden, ein + Fehlercode ist mit <SvMedium::GetError()const> zu + erhalten. + + + [Beispiel] + + sal_Bool DocSh::ConvertTo( SfxMedium &rMedium ) + { + SvStreamRef xStream = rMedium.GetOutStream(); + if ( xStream.is() ) + { + xStream->SetBufferSize(4096); + *xStream << ...; + + rMedium.CloseOutStream(); // "offnet automatisch wieder den InStream + return SVSTREAM_OK == rMedium.GetError(); + } + return sal_False ; + } + + + [Querverweise] + + <SfxObjectShell::ConvertFrom(SfxMedium&)> + <SFX_FILTER_REGISTRATION> +*/ + +/*?*/ { +/*?*/ return sal_False; +/*?*/ } + +//------------------------------------------------------------------------- + + +/*?*/ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return sal_False; //STRIP001 +/*?*/ } + +//------------------------------------------------------------------------- + +/*?*/ sal_Bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return sal_False;//STRIP001 +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::CommonSaveAs_Impl +/*N*/ ( +/*N*/ const INetURLObject& aURL, +/*N*/ const String& aFilterName, +/*N*/ SfxItemSet* aParams +/*N*/ ) +/*N*/ { +/*N*/ SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_SAVEASDOC,this)); +/*N*/ BOOL bWasReadonly = IsReadOnly(); +/*N*/ +/*N*/ if( aURL.HasError() ) +/*N*/ { +/*N*/ SetError( ERRCODE_IO_INVALIDPARAMETER ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL!" ); +/*N*/ DBG_ASSERT( aParams->Count() != 0, "fehlerhafte Parameter"); +/*N*/ +/*N*/ SFX_ITEMSET_ARG( aParams, pSaveToItem, SfxBoolItem, SID_SAVETO, sal_False ); +/*N*/ sal_Bool bSaveTo = pSaveToItem ? pSaveToItem->GetValue() : sal_False; +/*N*/ +/*N*/ const SfxFilter* pFilter = GetFactory().GetFilterContainer()->GetFilter( aFilterName ); +/*N*/ if ( !pFilter +/*N*/ || !pFilter->CanExport() +/*N*/ || !bSaveTo && !pFilter->CanImport() ) +/*N*/ { +/*N*/ SetError( ERRCODE_IO_INVALIDPARAMETER ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ pImp->bPasswd = aParams && SFX_ITEM_SET == aParams->GetItemState(SID_PASSWORD); +/*N*/ +/*N*/ SfxMedium *pActMed = GetMedium(); +/*N*/ const INetURLObject aActName(pActMed->GetName()); +/*N*/ +/*N*/ if ( aURL == aActName +/*N*/ && aURL != INetURLObject( OUString::createFromAscii( "private:stream" ) ) ) +/*N*/ { +/*?*/ if ( IsReadOnly() ) +/*?*/ { +/*?*/ SetError(ERRCODE_SFX_DOCUMENTREADONLY); +/*?*/ return sal_False; +/*?*/ } +/*?*/ // gleicher Filter? -> Save() +/*?*/ const SfxFilter *pFilter = pActMed->GetFilter(); +/*?*/ if ( pFilter && pFilter->GetFilterName() == aFilterName ) +/*?*/ { +/*?*/ pImp->bIsSaving=sal_False; +/*?*/ if ( aParams ) +/*?*/ { +/*?*/ SfxItemSet* pSet = pMedium->GetItemSet(); +/*?*/ pSet->ClearItem( SID_PASSWORD ); +/*?*/ pSet->Put( *aParams ); +/*?*/ } +/*?*/ return DoSave_Impl(); +/*?*/ } +/*N*/ } + +/*N*/ if( SFX_ITEM_SET != aParams->GetItemState(SID_UNPACK) && SvtSaveOptions().IsSaveUnpacked() ) +/*N*/ aParams->Put( SfxBoolItem( SID_UNPACK, sal_False ) ); +/*N*/ +/*N*/ if ( PreDoSaveAs_Impl(aURL.GetMainURL( INetURLObject::NO_DECODE ),aFilterName,aParams)) +/*N*/ { +/*N*/ pImp->bWaitingForPicklist = sal_True; +/*N*/ if (!pImp->bSetStandardName) +/*N*/ pImp->bDidWarnFormat=sal_False; +/*N*/ +/*N*/ // Daten am Medium updaten +/*N*/ SfxItemSet *pSet = GetMedium()->GetItemSet(); +/*N*/ pSet->ClearItem( SID_INTERACTIONHANDLER ); +/*N*/ +/*N*/ if ( !bSaveTo ) +/*N*/ { +/*N*/ pSet->ClearItem( SID_REFERER ); +/*N*/ pSet->ClearItem( SID_POSTDATA ); +/*N*/ pSet->ClearItem( SID_TEMPLATE ); +/*N*/ pSet->ClearItem( SID_DOC_READONLY ); +/*N*/ pSet->ClearItem( SID_CONTENTTYPE ); +/*N*/ pSet->ClearItem( SID_CHARSET ); +/*N*/ pSet->ClearItem( SID_FILTER_NAME ); +/*N*/ pSet->ClearItem( SID_OPTIONS ); +/*N*/ //pSet->ClearItem( SID_FILE_FILTEROPTIONS ); +/*N*/ pSet->ClearItem( SID_VERSION ); +/*N*/ //pSet->ClearItem( SID_USE_FILTEROPTIONS ); +/*N*/ pSet->ClearItem( SID_EDITDOC ); +/*N*/ +/*N*/ SFX_ITEMSET_GET( (*aParams), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False ); +/*N*/ if ( pFilterItem ) +/*N*/ pSet->Put( *pFilterItem ); +/*N*/ +/*N*/ SFX_ITEMSET_GET( (*aParams), pOptionsItem, SfxStringItem, SID_OPTIONS, sal_False ); +/*N*/ if ( pOptionsItem ) +/*N*/ pSet->Put( *pOptionsItem ); +/*N*/ +/*N*/ SFX_ITEMSET_GET( (*aParams), pFilterOptItem, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); +/*N*/ if ( pFilterOptItem ) +/*N*/ pSet->Put( *pFilterOptItem ); +/*N*/ } +/*N*/ +/*N*/ SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_SAVEASDOCDONE,this)); +/*N*/ +/*N*/ if ( bWasReadonly && !bSaveTo ) +/*N*/ Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); +/*N*/ +/*N*/ return sal_True; +/*N*/ } +/*N*/ else +/*N*/ return sal_False; +/*N*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::PreDoSaveAs_Impl +/*N*/ ( +/*N*/ const String& rFileName, +/*N*/ const String& aFilterName, +/*N*/ SfxItemSet* pParams +/*N*/ ) +/*N*/ { +/*N*/ // copy all items stored in the itemset of the current medium +/*N*/ SfxAllItemSet* pMergedParams = new SfxAllItemSet( *pMedium->GetItemSet() ); +/*N*/ +/*N*/ // in "SaveAs" title and password will be cleared ( maybe the new itemset contains new values, otherwise they will be empty ) +/*N*/ pMergedParams->ClearItem( SID_PASSWORD ); +/*N*/ pMergedParams->ClearItem( SID_DOCINFO_TITLE ); +/*N*/ +/*N*/ pMergedParams->ClearItem( SID_INPUTSTREAM ); +/*N*/ pMergedParams->ClearItem( SID_CONTENT ); +/*N*/ +/*N*/ pMergedParams->ClearItem( SID_REPAIRPACKAGE ); +/*N*/ +/*N*/ // "SaveAs" will never store any version information - it's a complete new file ! +/*N*/ pMergedParams->ClearItem( SID_VERSION ); +/*N*/ +/*N*/ // merge the new parameters into the copy +/*N*/ // all values present in both itemsets will be overwritten by the new parameters +/*N*/ if( pParams ) +/*N*/ pMergedParams->Put( *pParams ); +/*N*/ //DELETEZ( pParams ); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ if ( pMergedParams->GetItemState( SID_DOC_SALVAGE) >= SFX_ITEM_SET ) +/*N*/ DBG_ERROR("Salvage item present in Itemset, check the parameters!"); +/*N*/ #endif +/*N*/ +/*N*/ // should be unneccessary - too hot to handle! +/*N*/ pMergedParams->ClearItem( SID_DOC_SALVAGE ); +/*N*/ +/*N*/ // take over the new merged itemset +/*N*/ pParams = pMergedParams; +/*N*/ +/*N*/ // create a medium for the target URL +/*N*/ SfxMedium *pNewFile = new SfxMedium( rFileName, STREAM_READWRITE | STREAM_SHARE_DENYWRITE, sal_False, 0, pParams ); +/*N*/ +/*N*/ // set filter; if no filter is given, take the default filter of the factory +/*N*/ if ( aFilterName.Len() ) +/*N*/ pNewFile->SetFilter( GetFactory(), aFilterName ); +/*N*/ else +/*N*/ pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetFilter(0) ); +/*N*/ +/*N*/ // saving is alway done using a temporary file +/*N*/ pNewFile->CreateTempFileNoCopy(); +/*N*/ if ( pNewFile->GetErrorCode() != ERRCODE_NONE ) +/*N*/ { +/*N*/ // creating temporary file failed ( f.e. floppy disk not inserted! ) +/*N*/ SetError( pNewFile->GetError() ); +/*N*/ delete pNewFile; +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ // check if a "SaveTo" is wanted, no "SaveAs" +/*N*/ SFX_ITEMSET_ARG( pParams, pSaveToItem, SfxBoolItem, SID_SAVETO, sal_False ); +/*N*/ sal_Bool bCopyTo = GetCreateMode() == SFX_CREATE_MODE_EMBEDDED || pSaveToItem && pSaveToItem->GetValue(); +/*N*/ +/*N*/ // some base URL stuff ( awful, but not avoidable ... ) +/*N*/ const String aOldURL( ::binfilter::StaticBaseUrl::GetBaseURL() ); +/*N*/ if( GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) +/*N*/ if ( ShallSetBaseURL_Impl(*pNewFile) ) +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( pNewFile->GetBaseURL() ); +/*N*/ else +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( String() ); +/*N*/ +/*N*/ // distinguish between "Save" and "SaveAs" +/*N*/ pImp-> bIsSaving = sal_False; +/*N*/ +/*N*/ sal_Bool bToOwnFormat = sal_True;//STRIP007 IsOwnStorageFormat_Impl(*pNewFile); +/*N*/ if ( bToOwnFormat ) +/*N*/ { +/*N*/ // If the filter is a "cross export" filter ( f.e. a filter for exporting an impress document from +/*N*/ // a draw document ), the ClassId of the destination storage is different from the ClassId of this +/*N*/ // document. It can be retrieved from the default filter for the desired target format +/*N*/ long nFormat = pNewFile->GetFilter()->GetFormat(); +/*N*/ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); +/*N*/ const SfxFilter *pFilt = rMatcher.GetFilter4ClipBoardId( nFormat ); +/*N*/ if ( pFilt ) +/*N*/ { +/*N*/ if ( pFilt->GetFilterContainer() != pNewFile->GetFilter()->GetFilterContainer() ) +/*N*/ pNewFile->GetStorage()->SetClass( SvFactory::GetServerName( nFormat ), nFormat, pFilt->GetTypeName() ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( GetMedium()->GetFilter() && ( GetMedium()->GetFilter()->GetFilterFlags() & SFX_FILTER_PACKED ) ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ // Save the document ( first as temporary file, then transfer to the target URL by committing the medium ) +/*N*/ sal_Bool bOk = sal_False; +/*N*/ if ( !pNewFile->GetErrorCode() && SaveTo_Impl( *pNewFile, NULL, sal_True ) ) +/*N*/ { +/*N*/ bOk = sal_True; +/*N*/ +/*N*/ // restore old BaseURL +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*N*/ +/*N*/ // transfer a possible error from the medium to the document +/*N*/ SetError( pNewFile->GetErrorCode() ); +/*N*/ +/*N*/ // notify the document that saving was done successfully +/*N*/ if ( bCopyTo ) +/*N*/ { +/*N*/ if ( IsHandsOff() ) +/*N*/ bOk = DoSaveCompleted( pMedium ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Muss !!! +/*N*/ if ( bToOwnFormat ) +/*N*/ SetFileName( pNewFile->GetPhysicalName() ); +/*N*/ +/*N*/ bOk = DoSaveCompleted( pNewFile ); +/*N*/ } +/*N*/ +/*N*/ if( bOk ) +/*N*/ { +/*N*/ if( !bCopyTo ) +/*N*/ SetModified( sal_False ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ASSERT( !bCopyTo, "Error while reconnecting to medium, can't be handled!"); +/*N*/ SetError( pNewFile->GetErrorCode() ); +/*N*/ +/*N*/ if ( !bCopyTo ) +/*N*/ { +/*N*/ // reconnect to the old medium +/*?*/ BOOL bRet = DoSaveCompleted( pMedium ); +/*?*/ DBG_ASSERT( bRet, "Error in DoSaveCompleted, can't be handled!"); +/*N*/ } +/*N*/ +/*N*/ DELETEZ( pNewFile ); +/*N*/ } +/*N*/ +/*N*/ String aPasswd; +/*N*/ if ( IsOwnStorageFormat_Impl( *GetMedium() ) && GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) ) +/*?*/ GetMedium()->GetStorage()->SetKey( S2BS( aPasswd ) ); //!!! (pb) needs new implementation +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*?*/ SetError( pNewFile->GetErrorCode() ); +/*?*/ +/*?*/ // reconnect to the old storage +/*?*/ if ( IsHandsOff() ) +/*?*/ DoSaveCompleted( pMedium ); +/*?*/ else +/*?*/ DoSaveCompleted( (SvStorage*)0 ); +/*?*/ +/*?*/ DELETEZ( pNewFile ); +/*N*/ } +/*N*/ +/*N*/ if( !bOk ) +/*?*/ SetModified( sal_True ); +/*N*/ +/*N*/ if ( bCopyTo ) +/*N*/ DELETEZ( pNewFile ); +/*N*/ +/*N*/ return bOk; +/*N*/ } + +//------------------------------------------------------------------------ + +/*?*/ sal_Bool SfxObjectShell::LoadFrom( SvStorage *pStor ) +/*?*/ { +/*?*/ GetConfigManager(); +/*?*/ GetDocInfo().Load(pStor); +/*?*/ return sal_True; +/*?*/ } + +//------------------------------------------------------------------------- + +/*N*/ sal_Bool SfxObjectShell::IsInformationLost() +/*N*/ { +/*N*/ const SfxFilter *pFilt = GetMedium()->GetFilter(); +/*N*/ if ( pFilt == GetFactory().GetFilterContainer()->GetFilter(0) ) +/*N*/ return sal_False; +/*N*/ return pFilt && pFilt->IsAlienFormat() && pImp->bDidDangerousSave && !(pFilt->GetFilterFlags() & SFX_FILTER_SILENTEXPORT); +/*N*/ } + +/*N*/ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) +/*N*/ { +/*N*/ SvStorageRef xStor = rMedium.GetStorage(); +/*N*/ if ( xStor.Is() ) +/*N*/ { +/*N*/ if ( rMedium.GetFileVersion() ) +/*N*/ xStor->SetVersion( rMedium.GetFileVersion() ); +/*N*/ +/*N*/ // Password +/*N*/ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False ); +/*N*/ if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) ) +/*N*/ { +/*N*/ String aPasswd; +/*N*/ if ( GetPasswd_Impl(pMedium->GetItemSet(), aPasswd) ) +/*N*/ xStor->SetKey( S2BS( aPasswd ) ); //!!! (pb) needs new implementation +/*N*/ +/*N*/ // load document + sal_Bool bRet = Load( xStor ); + if ( bRet ) + GetConfigManager( TRUE ); + return bRet; +/*N*/ } +/*N*/ return sal_False; +/*N*/ } +/*N*/ else +/*N*/ return sal_False; +/*N*/ } + +/*N*/ sal_Bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) +/*N*/ { +/*N*/ SvStorageRef xStor = rMedium.GetStorage(); +/*N*/ if( xStor.Is() ) +/*N*/ { +/*N*/ ULONG nVersion = rMedium.GetFilter()->GetVersion(); +/*N*/ xStor->SetVersion( nVersion ); +/*N*/ +/*N*/ // Initialize Basic +/*N*/ GetBasicManager(); +/*N*/ +/*N*/ // Save dialog container +/*N*/ if( nVersion >= 6200 ) +/*N*/ { +/*N*/ SfxDialogLibraryContainer* pDialogCont = pImp->pDialogLibContainer; +/*N*/ if( pDialogCont ) +/*N*/ pDialogCont->storeLibrariesToStorage( (SotStorage*)(SvStorage*)xStor ); +/*N*/ +/*N*/ SfxScriptLibraryContainer* pBasicCont = pImp->pBasicLibContainer; +/*N*/ if( pBasicCont ) +/*N*/ pBasicCont->storeLibrariesToStorage( (SotStorage*)(SvStorage*)xStor ); +/*N*/ +/*N*/ // Konfiguration schreiben +/*N*/ if ( GetConfigManager() ) +/*N*/ { +/* //!MBA + if ( rDocInfo.HasTemplateConfig() ) + { + const String aTemplFileName( rDocInfo.GetTemplateFileName() ); + if ( aTemplFileName.Len() ) + { + INetURLObject aURL( aTemplFileName ); + DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL !" ); + + SvStorageRef aStor = new SvStorage( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( SVSTREAM_OK == aStor->GetError() ) + { + GetConfigManager()->StoreConfiguration(aStor); + if (aRef->IsStream(SfxConfigManager::GetStreamName())) + aRef->Remove(SfxConfigManager::GetStreamName()); + } + } + } + else + */ +/*N*/ { +//! MBA GetConfigManager()->SetModified( sal_True ); +/*N*/ SotStorageRef xCfgStor = pImp->pCfgMgr->GetConfigurationStorage( xStor ); +/*N*/ if ( pImp->pCfgMgr->StoreConfiguration( xCfgStor ) ) +/*N*/ xCfgStor->Commit(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ const SfxFilter* pFilter = rMedium.GetFilter(); +/*N*/ return SaveAs( xStor ); +/*N*/ } +/*N*/ else return sal_False; +/*N*/ } + + +/*N*/ void SfxObjectShell::AddXMLAsZipToTheStorage( SvStorage& rRoot ) +/*N*/ { +/*N*/ static struct _ObjExpType { +/*N*/ sal_Bool (SvtAddXMLToStorageOptions:: *fnIsAdd)() const; +/*N*/ const sal_Char* pModuleNm; +/*N*/ // GlobalNameId +/*N*/ UINT32 n1; +/*N*/ USHORT n2, n3; +/*N*/ BYTE b8, b9, b10, b11, b12, b13, b14, b15; +/*N*/ } aArr[] = { +/*N*/ { &SvtAddXMLToStorageOptions::IsWriter_Add_XML_to_Storage, +/*N*/ "Writer", BF_SO3_SW_CLASSID_50 }, +/*N*/ { &SvtAddXMLToStorageOptions::IsCalc_Add_XML_to_Storage, +/*N*/ "Calc", BF_SO3_SC_CLASSID_50 }, +/*N*/ { &SvtAddXMLToStorageOptions::IsImpress_Add_XML_to_Storage, +/*N*/ "Impress", BF_SO3_SIMPRESS_CLASSID_50 }, +/*N*/ { &SvtAddXMLToStorageOptions::IsDraw_Add_XML_to_Storage, +/*N*/ "Draw", BF_SO3_SDRAW_CLASSID_50 }, +/*N*/ { 0 } +/*N*/ }; +/*N*/ +/*N*/ for( const _ObjExpType* pArr = aArr; pArr->fnIsAdd; ++pArr ) +/*N*/ { +/*N*/ SvGlobalName aGlbNm( pArr->n1, pArr->n2, pArr->n3, +/*N*/ pArr->b8, pArr->b9, pArr->b10, pArr->b11, +/*N*/ pArr->b12, pArr->b13, pArr->b14, pArr->b15 ); +/*N*/ if( *GetSvFactory() == aGlbNm ) +/*N*/ { +/*?*/ // 1. check if the option is set and unequal 0 or is not set +/*?*/ SvtAddXMLToStorageOptions aOpt; +/*?*/ if( (aOpt.*pArr->fnIsAdd)() ) +/*?*/ { +/*?*/ // the flag is set +/*?*/ String sStr; +/*?*/ sStr.AssignAscii( "StarOffice XML (" ); +/*?*/ sStr.AppendAscii( pArr->pModuleNm ); +/*?*/ sStr += ')'; +/*?*/ // 2. exist the XML filter? "StarOffice XML (<Application>)"? +/*?*/ const SfxFilter* pFilter = GetFactory().GetFilterContainer()-> +/*?*/ GetFilter4FilterName( sStr ); +/*?*/ if( pFilter ) +/*?*/ { +/*?*/ ::utl::TempFile aTempFile; +/*?*/ SfxMedium aTmpMed( aTempFile.GetURL(), STREAM_READ | STREAM_WRITE, sal_True ); +/*?*/ +/*?*/ aTmpMed.SetFilter( pFilter ); +/*?*/ +/*?*/ if( ConvertTo( aTmpMed ) ) +/*?*/ { +/*?*/ SvStorage* pXMLStor = aTmpMed.GetStorage(); +/*?*/ +/*?*/ if( pXMLStor ) +/*?*/ { +/*?*/ const String aContent( String::CreateFromAscii( "Content" ) ); +/*?*/ const String aContentXML( String::CreateFromAscii( "Content.xml" ) ); +/*?*/ const String aXMLFormatName( String::CreateFromAscii( "XMLFormat2" ) ); +/*?*/ String aContentName; +/*?*/ +/*?*/ if( pXMLStor->IsContained( aContentXML ) ) +/*?*/ aContentName = aContentXML; +/*?*/ else if( pXMLStor->IsContained( aContent ) ) +/*?*/ aContentName = aContent; +/*?*/ +/*?*/ if( aContentName.Len() ) +/*?*/ { +/*?*/ SvStorageStreamRef xOStm( rRoot.OpenStream( aXMLFormatName, STREAM_WRITE | STREAM_TRUNC ) ); +/*?*/ SvStorageStreamRef xIStm( pXMLStor->OpenStream( aContentName, STREAM_READ | STREAM_NOCREATE ) ); +/*?*/ +/*?*/ if( xOStm.Is() && xIStm.Is() ) +/*?*/ { +/*?*/ ZCodec aCodec; +/*?*/ +/*?*/ xIStm->Seek( 0 ); +/*?*/ aCodec.BeginCompression( ZCODEC_BEST_COMPRESSION ); +/*?*/ aCodec.Compress( *xIStm, *xOStm ); +/*?*/ aCodec.EndCompression(); +/*?*/ xOStm->Commit(); +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ // that's all +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objuno.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objuno.cxx new file mode 100644 index 000000000000..0874572b53fd --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objuno.cxx @@ -0,0 +1,961 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/io/IOException.hpp> + +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/document/XImporter.hpp> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> + +#include <tools/errcode.hxx> +#include <bf_so3/svstor.hxx> +#include <bf_svtools/cntwids.hrc> +#include <bf_svtools/itemset.hxx> +#include <bf_svtools/stritem.hxx> +#include <bf_svtools/intitem.hxx> +#include <bf_svtools/eitem.hxx> +#include <bf_svtools/adrparse.hxx> +#include <unotools/streamwrap.hxx> + +#include "objuno.hxx" +#include "sfx.hrc" +#include "sfxsids.hrc" +#include "printer.hxx" +#include "objsh.hxx" +#include "docinf.hxx" +#include "docfile.hxx" +#include "openflag.hxx" +#include "app.hxx" +#include "fcontnr.hxx" +#include "request.hxx" +#include "sfxuno.hxx" +#include "objshimp.hxx" + +#include <osl/mutex.hxx> +#include <osl/mutex.hxx> +namespace binfilter { + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; + +#define SfxIOException_Impl( nErr ) ::com::sun::star::io::IOException() + +//============================================================================= + +#define PROPERTY_UNBOUND 0 +#define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID + +/*N*/ SfxItemPropertyMap aDocInfoPropertyMap_Impl[] = +/*N*/ { +/*N*/ { "Author" , 6 , WID_FROM, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, +/*N*/ { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "BlindCopiesTo" , 13, WID_BCC, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "CopyTo" , 6 , WID_CC, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, +/*N*/ { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "EditingCycles" , 13, MID_DOCINFO_REVISION, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "EditingDuration" , 15, MID_DOCINFO_EDITTIME, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "InReplyTo" , 9 , WID_IN_REPLY_TO, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "IsEncrypted" , 11, MID_DOCINFO_ENCRYPTED, &::getBooleanCppuType(), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 }, +/*N*/ { "Keywords" , 8 , WID_KEYWORDS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "MIMEType" , 8 , WID_CONTENT_TYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 }, +/*N*/ { "ModifiedBy" , 10, MID_DOCINFO_MODIFICATIONAUTHOR, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "ModifyDate" , 10, WID_DATE_MODIFIED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, +/*N*/ { "Newsgroups" , 10, WID_NEWSGROUPS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Original" , 8 , WID_MESSAGE_ID, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "PrintDate" , 9 , MID_DOCINFO_PRINTDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, +/*N*/ { "PrintedBy" , 9 , MID_DOCINFO_PRINTEDBY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Priority" , 8 , WID_PRIORITY, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Recipient" , 9 , WID_TO, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "References" , 10, WID_REFERENCES, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "ReplyTo" , 7 , WID_REPLY_TO, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "SaveVersionOnClose", 18 , SID_VERSION, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Template" , 8 , MID_DOCINFO_TEMPLATE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "TemplateFileName", 16, SID_TEMPLATE_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "TemplateDate" , 12, MID_DOCINFO_TEMPLATEDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, +/*N*/ { "Theme" , 5 , MID_DOCINFO_SUBJECT, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ { "Title" , 5 , WID_TITLE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, +/*N*/ {0,0,0,0,0} +/*N*/ }; + +//----------------------------------------------------------------------------- +/*N*/ SFX_IMPL_XINTERFACE_5( SfxDocumentInfoObject, OWeakObject, ::com::sun::star::document::XDocumentInfo, ::com::sun::star::lang::XComponent, ::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XFastPropertySet, ::com::sun::star::beans::XPropertyAccess ) +/*N*/ SFX_IMPL_XTYPEPROVIDER_5( SfxDocumentInfoObject, ::com::sun::star::document::XDocumentInfo, ::com::sun::star::lang::XComponent, ::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XFastPropertySet, ::com::sun::star::beans::XPropertyAccess ) +/* +::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > SfxDocumentInfoObject::getStaticIdlClass() +{ + // Global Method, must be guarded (multithreading) + MutexGuard aGuard( Mutex::getGlobalMutex() ); + { + // use the standard class implementation of the usr library + static ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > xClass = + createStandardClass( + "com.sun.star.comp.sfx2.DocumentInfo", + OWeakObject::getStaticIdlClass(), + 4, + ::getCppuType((const ::com::sun::star::lang::XComponent*)0), + ::getCppuType((const ::com::sun::star::document::XDocumentInfo*)0), + ::getCppuType((const ::com::sun::star::beans::XPropertyAccess*)0), + ::getCppuType((const ::com::sun::star::beans::XPropertySet*)0), + ::getCppuType((const ::com::sun::star::beans::XFastPropertySet*)0) ); + + return xClass; + } +} +*/ +//----------------------------------------------------------------------------- +/*N*/ struct SfxDocumentInfoObject_Impl +/*N*/ { +/*N*/ SfxObjectShell* _pObjSh; +/*N*/ ::osl::Mutex _aMutex; +/*N*/ ::cppu::OInterfaceContainerHelper _aDisposeContainer; +/*N*/ +/*N*/ SfxDocumentInfoObject_Impl( SfxObjectShell* pObjSh ) +/*N*/ : _pObjSh( pObjSh ) +/*N*/ , _aDisposeContainer( _aMutex ) +/*N*/ { +/*N*/ } +/*N*/ }; + +//----------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfoObject::SfxDocumentInfoObject( sal_Bool bStandalone ) +/*N*/ : _aPropSet( aDocInfoPropertyMap_Impl ) +/*N*/ , _pInfo( NULL ) +/*N*/ , _pFilter( NULL ) +/*N*/ , _bStandalone( bStandalone ) +/*N*/ , _pImp( new SfxDocumentInfoObject_Impl( NULL ) ) +/*N*/ { + _pInfo = new SfxDocumentInfo; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfoObject::SfxDocumentInfoObject( SfxObjectShell *pObjSh ) +/*N*/ : _aPropSet( aDocInfoPropertyMap_Impl ) +/*N*/ , _pInfo( 0 ) +/*N*/ , _pFilter( NULL ) +/*N*/ , _bStandalone( sal_False ) +/*N*/ , _pImp( new SfxDocumentInfoObject_Impl( pObjSh ) ) +/*N*/ { +/*N*/ if ( pObjSh ) +/*N*/ { +/*N*/ SfxDocumentInfo &rDocInfo = pObjSh->GetDocInfo(); +/*N*/ _pInfo = &rDocInfo; +/*N*/ _pFilter = pObjSh->GetMedium()->GetFilter(); +/*N*/ _wModel = pObjSh->GetModel(); +/*N*/ } +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ SfxDocumentInfoObject::~SfxDocumentInfoObject() +/*N*/ { +/*N*/ if ( _bStandalone ) +/*N*/ delete _pInfo; +/*N*/ delete _pImp; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::dispose() throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ ::com::sun::star::lang::EventObject aEvent( (::cppu::OWeakObject *)this ); +/*N*/ _pImp->_aDisposeContainer.disposeAndClear( aEvent ); + +/* + _xCurrent = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > (); + for ( sal_uInt32 n = _aControllers.ge.getLength(); n; --n ) + SequenceRemoveElementAt( _aControllers, n-1 ); +*/ +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ _pImp->_aDisposeContainer.addInterface( aListener ); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ _pImp->_aDisposeContainer.removeInterface( aListener ); +/*N*/ } +//----------------------------------------------------------------------------- + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SfxDocumentInfoObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return _aPropSet.getPropertySetInfo(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( +/*N*/ aDocInfoPropertyMap_Impl, +/*N*/ aPropertyName ); +/*N*/ if ( pMap ) +/*N*/ setFastPropertyValue( pMap->nWID, aValue ); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::com::sun::star::uno::Any SAL_CALL SfxDocumentInfoObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( aDocInfoPropertyMap_Impl, +/*N*/ aPropertyName ); +/*N*/ if ( pMap ) +/*N*/ return getFastPropertyValue( pMap->nWID ); +/*N*/ else +/*N*/ return ::com::sun::star::uno::Any(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ {} + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ {} + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ {} + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ {} +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SfxDocumentInfoObject::getPropertyValues( void ) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = getPropertySetInfo(); +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps = xInfo->getProperties(); +/*N*/ +/*N*/ const ::com::sun::star::beans::Property* pProps = aProps.getConstArray(); +/*N*/ sal_uInt32 nCount = aProps.getLength(); +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >aSeq( nCount ); +/*N*/ ::com::sun::star::beans::PropertyValue* pValues = aSeq.getArray(); +/*N*/ +/*N*/ for ( sal_uInt32 n = 0; n < nCount; ++n ) +/*N*/ { +/*N*/ ::com::sun::star::beans::PropertyValue& rCurrValue = pValues[n]; +/*N*/ const ::com::sun::star::beans::Property& rCurrProp = pProps[n]; +/*N*/ +/*N*/ rCurrValue.Name = rCurrProp.Name; +/*N*/ rCurrValue.Handle = rCurrProp.Handle; +/*N*/ rCurrValue.Value = getPropertyValue( rCurrProp.Name ); +/*N*/ } +/*N*/ +/*N*/ return aSeq; +/*N*/ } +/*N*/ +/*N*/ void SAL_CALL SfxDocumentInfoObject::setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) +/*N*/ throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ const ::com::sun::star::beans::PropertyValue* pProps = aProps.getConstArray(); +/*N*/ sal_uInt32 nCount = aProps.getLength(); +/*N*/ +/*N*/ for ( sal_uInt32 n = 0; n < nCount; ++n ) +/*N*/ { +/*N*/ const ::com::sun::star::beans::PropertyValue& rProp = pProps[n]; +/*N*/ setPropertyValue( rProp.Name, rProp.Value ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ::com::sun::star::util::DateTime SfxDocumentInfoObject::impl_DateTime_Object2Struct( const ::DateTime& aDateTimeObject ) +/*N*/ { +/*N*/ // Attention! +/*N*/ // We can't use a DateTime-object as type of any property with new UNO! +/*N*/ // We must use a DateTime-struct and convert the values. +/*N*/ +/*N*/ ::com::sun::star::util::DateTime aDateTimeStruct ; // com/sun/star/util/DateTime !!! +/*N*/ +/*N*/ // ... and convert DateTime-object to struct ! (copy values) +/*N*/ aDateTimeStruct.HundredthSeconds = aDateTimeObject.Get100Sec () ; +/*N*/ aDateTimeStruct.Seconds = aDateTimeObject.GetSec () ; +/*N*/ aDateTimeStruct.Minutes = aDateTimeObject.GetMin () ; +/*N*/ aDateTimeStruct.Hours = aDateTimeObject.GetHour () ; +/*N*/ aDateTimeStruct.Day = aDateTimeObject.GetDay () ; +/*N*/ aDateTimeStruct.Month = aDateTimeObject.GetMonth () ; +/*N*/ aDateTimeStruct.Year = aDateTimeObject.GetYear () ; +/*N*/ +/*N*/ // Return ricght type with right values. +/*N*/ return aDateTimeStruct ; +/*N*/ } + +/*N*/ ::DateTime SfxDocumentInfoObject::impl_DateTime_Struct2Object ( const ::com::sun::star::util::DateTime& aDateTimeStruct ) +/*N*/ { +/*N*/ // Attention! +/*N*/ // We can't use a DateTime-object as type of any property with new UNO! +/*N*/ // We must use a DateTime-struct and convert the values. +/*N*/ +/*N*/ // Get values from DateTime-struct and create a date and time instance ... +/*N*/ ::Date aDate ( aDateTimeStruct.Day , aDateTimeStruct.Month , aDateTimeStruct.Year ) ; +/*N*/ ::Time aTime ( aDateTimeStruct.Hours, aDateTimeStruct.Minutes , aDateTimeStruct.Seconds, aDateTimeStruct.HundredthSeconds ) ; +/*N*/ +/*N*/ // ... to use it for creation of a DateTime-object ... +/*N*/ ::DateTime aDateTimeObject ( aDate, aTime ) ; +/*N*/ +/*N*/ // Return converted values. +/*N*/ return aDateTimeObject ; +/*N*/ } + + +/*N*/ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ sal_Bool bModified = sal_True; +/*N*/ +/*N*/ if ( aValue.getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) +/*N*/ { +/*N*/ ::rtl::OUString sTemp ; +/*N*/ aValue >>= sTemp ; +/*N*/ String aStrVal( sTemp ); +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case WID_FROM : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetCreated(); +/*N*/ if ( aStrVal.Len() > TIMESTAMP_MAXLENGTH ) +/*N*/ { +/*N*/ SvAddressParser aParser( aStrVal ); +/*N*/ if ( aParser.Count() > 0 ) +/*N*/ { +/*N*/ String aEmail = aParser.GetEmailAddress(0); +/*N*/ String aRealname = aParser.GetRealName(0); +/*N*/ +/*N*/ if ( aRealname.Len() <= TIMESTAMP_MAXLENGTH ) +/*N*/ aStrVal = aRealname; +/*N*/ else if ( aEmail.Len() <= TIMESTAMP_MAXLENGTH ) +/*N*/ aStrVal = aEmail; +/*N*/ } +/*N*/ } +/*N*/ _pInfo->SetCreated( SfxStamp( aStrVal, rStamp.GetTime() ) ); +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_PRINTEDBY: +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetPrinted(); +/*N*/ _pInfo->SetPrinted( SfxStamp( aStrVal, rStamp.GetTime() ) ); +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_MODIFICATIONAUTHOR: +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetChanged(); +/*N*/ _pInfo->SetChanged( SfxStamp( aStrVal, rStamp.GetTime() ) ); +/*N*/ break; +/*N*/ } +/*N*/ case WID_TITLE : +/*N*/ { +/*N*/ _pInfo->SetTitle( aStrVal ); +/*N*/ Reference < XModel > xModel( _wModel.get(), UNO_QUERY ); +/*N*/ if ( xModel.is() ) +/*N*/ { +/*N*/ _pImp->_pObjSh->InvalidateName(); +/*N*/ _pImp->_pObjSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_SUBJECT : +/*N*/ _pInfo->SetTheme( aStrVal ); +/*N*/ break; +/*N*/ case WID_KEYWORDS : +/*N*/ _pInfo->SetKeywords( aStrVal ); +/*N*/ break; +/*N*/ case WID_CC : +/*N*/ _pInfo->SetCopiesTo( aStrVal ); +/*N*/ break; +/*N*/ case WID_MESSAGE_ID : +/*N*/ _pInfo->SetOriginal( aStrVal ); +/*N*/ break; +/*N*/ case WID_REFERENCES : +/*N*/ _pInfo->SetReferences( aStrVal ); +/*N*/ break; +/*N*/ case WID_TO : +/*N*/ _pInfo->SetRecipient( aStrVal ); +/*N*/ break; +/*N*/ case WID_REPLY_TO : +/*N*/ _pInfo->SetReplyTo( aStrVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_TEMPLATE: +/*N*/ _pInfo->SetTemplateName( aStrVal ); +/*N*/ break; +/*N*/ case SID_TEMPLATE_NAME: +/*N*/ _pInfo->SetTemplateFileName( aStrVal ); +/*N*/ break; +/*N*/ case WID_BCC : +/*N*/ _pInfo->SetBlindCopies( aStrVal ); +/*N*/ break; +/*N*/ case WID_IN_REPLY_TO : +/*N*/ _pInfo->SetInReplyTo( aStrVal ); +/*N*/ break; +/*N*/ case WID_NEWSGROUPS : +/*N*/ _pInfo->SetNewsgroups( aStrVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_DESCRIPTION: +/*N*/ _pInfo->SetComment( aStrVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_AUTOLOADURL: +/*N*/ _pInfo->SetReloadURL( aStrVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_DEFAULTTARGET: +/*N*/ _pInfo->SetDefaultTarget( aStrVal ); +/*N*/ break; +/*N*/ default: +/*N*/ bModified = sal_False; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ else if ( aValue.getValueType() == ::getCppuType((const ::com::sun::star::util::DateTime*)0) ) +/*N*/ { +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case WID_DATE_CREATED : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetCreated(); +/*N*/ ::com::sun::star::util::DateTime aDateTime ; +/*N*/ aValue >>= aDateTime ; +/*N*/ _pInfo->SetCreated( SfxStamp( rStamp.GetName(), impl_DateTime_Struct2Object(aDateTime) ) ); +/*N*/ break; +/*N*/ } +/*N*/ case WID_DATE_MODIFIED : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetChanged(); +/*N*/ ::com::sun::star::util::DateTime aDateTime ; +/*N*/ aValue >>= aDateTime ; +/*N*/ _pInfo->SetChanged( SfxStamp( rStamp.GetName(), impl_DateTime_Struct2Object(aDateTime) ) ); +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_PRINTDATE : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetPrinted(); +/*N*/ ::com::sun::star::util::DateTime aDateTime ; +/*N*/ aValue >>= aDateTime ; +/*N*/ _pInfo->SetPrinted( SfxStamp( rStamp.GetName(), impl_DateTime_Struct2Object(aDateTime) ) ); +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_TEMPLATEDATE : +/*N*/ { +/*N*/ ::com::sun::star::util::DateTime aDateTime ; +/*N*/ aValue >>= aDateTime ; +/*N*/ _pInfo->SetTemplateDate( impl_DateTime_Struct2Object(aDateTime) ); +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ bModified = sal_False; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ else if ( aValue.getValueType() == ::getBooleanCppuType() ) +/*N*/ { +/*N*/ sal_Bool bBoolVal ; +/*N*/ aValue >>= bBoolVal ; +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case SID_VERSION : +/*N*/ _pInfo->SetSaveVersionOnClose( bBoolVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_AUTOLOADENABLED: +/*N*/ _pInfo->EnableReload( bBoolVal ); +/*N*/ break; +/*N*/ default: +/*N*/ bModified = sal_False; +/*N*/ } +/*N*/ } +/*N*/ else if ( aValue.getValueType() == ::getCppuType((const sal_Int32*)0) ) +/*N*/ { +/*N*/ long nIntVal ; +/*N*/ aValue >>= nIntVal ; +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case MID_DOCINFO_AUTOLOADSECS: +/*N*/ _pInfo->SetReloadDelay( nIntVal ); +/*N*/ break; +/*N*/ case MID_DOCINFO_EDITTIME: +/*N*/ _pInfo->SetTime( nIntVal ); +/*N*/ default: +/*N*/ bModified = sal_False; +/*N*/ } +/*N*/ } +/*N*/ else if ( aValue.getValueType() == ::getCppuType((const sal_Int16*)0) ) +/*N*/ { +/*N*/ short nIntVal ; +/*N*/ aValue >>= nIntVal ; +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case MID_DOCINFO_REVISION: +/*N*/ _pInfo->SetDocumentNumber( nIntVal ); +/*N*/ case WID_PRIORITY : +/*N*/ _pInfo->SetPriority( nIntVal ); +/*N*/ break; +/*N*/ default: +/*N*/ bModified = sal_False; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Reference < XModel > xModel( _wModel.get(), UNO_QUERY ); +/*N*/ if ( bModified && xModel.is() ) +/*N*/ _pImp->_pObjSh->FlushDocInfo(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::com::sun::star::uno::Any SAL_CALL SfxDocumentInfoObject::getFastPropertyValue(sal_Int32 nHandle) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ ::com::sun::star::uno::Any aValue; +/*N*/ if ( nHandle == WID_CONTENT_TYPE ) +/*N*/ { +/*N*/ if ( _pInfo->GetSpecialMimeType().Len() ) +/*N*/ { +/*N*/ ::rtl::OUString sTemp ( _pInfo->GetSpecialMimeType() ); +/*N*/ aValue <<= sTemp ; +/*N*/ } +/*N*/ else if ( _pFilter ) +/*N*/ { +/*N*/ ::rtl::OUString sTemp ( _pFilter->GetMimeType() ); +/*N*/ aValue <<= sTemp ; +/*N*/ } +/*N*/ else +/*N*/ aValue <<= ::rtl::OUString() ; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ switch ( nHandle ) +/*N*/ { +/*N*/ case SID_VERSION : +/*N*/ aValue <<= _pInfo->IsSaveVersionOnClose(); +/*N*/ break; +/*N*/ case MID_DOCINFO_REVISION : +/*N*/ aValue <<= _pInfo->GetDocumentNumber() ; +/*N*/ break; +/*N*/ case MID_DOCINFO_EDITTIME : +/*N*/ aValue <<= _pInfo->GetTime(); +/*N*/ break; +/*N*/ case WID_FROM : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetCreated(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= ::rtl::OUString( rStamp.GetName() ); +/*N*/ else +/*N*/ aValue <<= ::rtl::OUString() ; +/*N*/ break; +/*N*/ } +/*N*/ case WID_DATE_CREATED : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetCreated(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= impl_DateTime_Object2Struct(rStamp.GetTime()); +/*N*/ break; +/*N*/ } +/*N*/ case WID_TITLE : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetTitle() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_SUBJECT: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetTheme() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_MODIFICATIONAUTHOR: +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetChanged(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= ::rtl::OUString( rStamp.GetName() ); +/*N*/ else +/*N*/ aValue <<= ::rtl::OUString() ; +/*N*/ break; +/*N*/ } +/*N*/ case WID_DATE_MODIFIED : +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetChanged(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= impl_DateTime_Object2Struct(rStamp.GetTime()); +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_PRINTEDBY: +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetPrinted(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= ::rtl::OUString( rStamp.GetName() ); +/*N*/ else +/*N*/ aValue <<= ::rtl::OUString() ; +/*N*/ break; +/*N*/ } +/*N*/ case MID_DOCINFO_PRINTDATE: +/*N*/ { +/*N*/ const SfxStamp& rStamp = _pInfo->GetPrinted(); +/*N*/ if ( rStamp.IsValid() ) +/*N*/ aValue <<= impl_DateTime_Object2Struct(rStamp.GetTime()); +/*N*/ break; +/*N*/ } +/*N*/ case WID_KEYWORDS : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetKeywords() ); +/*N*/ break; +/*N*/ case WID_PRIORITY : +/*N*/ aValue <<= _pInfo->GetPriority() ; +/*N*/ break; +/*N*/ case WID_CC : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetCopiesTo() ); +/*N*/ break; +/*N*/ case WID_MESSAGE_ID : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetOriginal() ); +/*N*/ break; +/*N*/ case WID_REFERENCES : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetReferences() ); +/*N*/ break; +/*N*/ case WID_TO : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetRecipient() ); +/*N*/ break; +/*N*/ case WID_REPLY_TO : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetReplyTo() ); +/*N*/ break; +/*N*/ case WID_BCC : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetBlindCopies() ); +/*N*/ break; +/*N*/ case WID_IN_REPLY_TO : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetInReplyTo() ); +/*N*/ break; +/*N*/ case WID_NEWSGROUPS : +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetNewsgroups() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_DESCRIPTION: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetComment() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_TEMPLATE: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetTemplateName() ); +/*N*/ break; +/*N*/ case SID_TEMPLATE_NAME: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetTemplateFileName() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_TEMPLATEDATE: +/*N*/ aValue <<= impl_DateTime_Object2Struct(_pInfo->GetTemplateDate()); +/*N*/ break; +/*N*/ case MID_DOCINFO_AUTOLOADENABLED: +/*N*/ aValue <<= _pInfo->IsReloadEnabled() ; +/*N*/ break; +/*N*/ case MID_DOCINFO_AUTOLOADURL: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetReloadURL() ); +/*N*/ break; +/*N*/ case MID_DOCINFO_AUTOLOADSECS: +/*N*/ aValue <<= _pInfo->GetReloadDelay() ; +/*N*/ break; +/*N*/ case MID_DOCINFO_DEFAULTTARGET: +/*N*/ aValue <<= ::rtl::OUString( _pInfo->GetDefaultTarget() ); +/*N*/ break; +/*N*/ default: +/*N*/ aValue <<= ::rtl::OUString(); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return aValue; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ sal_Int16 SAL_CALL SfxDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ return _pInfo->GetUserKeyCount(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( nIndex < _pInfo->GetUserKeyCount() ) +/*N*/ return _pInfo->GetUserKey( nIndex ).GetTitle(); +/*N*/ else +/*N*/ return ::rtl::OUString(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::rtl::OUString SAL_CALL SfxDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( nIndex < _pInfo->GetUserKeyCount() ) +/*N*/ return _pInfo->GetUserKey( nIndex ).GetWord(); +/*N*/ else +/*N*/ return ::rtl::OUString(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( nIndex < _pInfo->GetUserKeyCount() ) +/*N*/ { +/*N*/ const SfxDocUserKey& rKey = _pInfo->GetUserKey( nIndex ); +/*N*/ _pInfo->SetUserKey( SfxDocUserKey( aName, rKey.GetWord() ), nIndex ); +/*N*/ Reference < XModel > xModel( _wModel.get(), UNO_QUERY ); +/*N*/ if ( xModel.is() ) +/*N*/ _pImp->_pObjSh->FlushDocInfo(); +/*N*/ } +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( nIndex < _pInfo->GetUserKeyCount() ) +/*N*/ { +/*N*/ const SfxDocUserKey& rKey = _pInfo->GetUserKey( nIndex ); +/*N*/ _pInfo->SetUserKey( SfxDocUserKey( rKey.GetTitle(), aValue ), nIndex ); +/*N*/ Reference < XModel > xModel( _wModel.get(), UNO_QUERY ); +/*N*/ if ( xModel.is() ) +/*N*/ _pImp->_pObjSh->FlushDocInfo(); +/*N*/ } +/*N*/ } + +//----------------------------------------------------------------------------- +/*N*/ SFX_IMPL_XINTERFACE_2( SfxStandaloneDocumentInfoObject, SfxDocumentInfoObject, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::document::XStandaloneDocumentInfo ) +/*N*/ SFX_IMPL_XTYPEPROVIDER_7( SfxStandaloneDocumentInfoObject, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::document::XDocumentInfo, ::com::sun::star::lang::XComponent, ::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XFastPropertySet, ::com::sun::star::beans::XPropertyAccess, ::com::sun::star::document::XStandaloneDocumentInfo ) +/*N*/ SFX_IMPL_XSERVICEINFO( SfxStandaloneDocumentInfoObject, "com.sun.star.document.BinaryStandaloneDocumentInfo", "com.sun.star.comp.sfx2.BinaryStandaloneDocumentInfo" ) +/*N*/ SFX_IMPL_SINGLEFACTORY( SfxStandaloneDocumentInfoObject ) +/*N*/ +/*N*/ SfxStandaloneDocumentInfoObject::SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) +/*N*/ : SfxDocumentInfoObject( sal_True ) +/*N*/ , _pMedium( NULL ) +/*N*/ , _xFactory( xFactory ) +/*N*/ { +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ SfxStandaloneDocumentInfoObject::~SfxStandaloneDocumentInfoObject() +/*N*/ { +/*N*/ delete _pMedium; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ SvStorage* SfxStandaloneDocumentInfoObject::GetStorage_Impl( const String& rName, sal_Bool bWrite ) +/*N*/ { +/*N*/ // Medium erstellen +/*N*/ if ( _pMedium ) +/*N*/ delete _pMedium; +/*N*/ +/*N*/ _pMedium = new SfxMedium( rName, bWrite ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY, sal_True ); +/*N*/ if ( !_pMedium->GetStorage() || SVSTREAM_OK != _pMedium->GetError() ) +/*N*/ // Datei existiert nicht oder ist kein Storage +/*N*/ return NULL; +/*N*/ +/*N*/ // Filter-Detection wegen FileFormat-Version +/*N*/ _pFilter = 0; +/*N*/ if ( 0 != SFX_APP()->GetFilterMatcher().GuessFilter( *_pMedium, &_pFilter ) +/*N*/ || !bWrite && !_pFilter ) +/*N*/ // unbekanntes Dateiformat +/*N*/ return NULL; +/*N*/ +/*N*/ // Storage "offnen +/*N*/ SvStorageRef xStor = _pMedium->GetStorage(); +/*N*/ DBG_ASSERT( xStor.Is(), "no storage" ); +/*N*/ xStor->SetVersion( _pFilter ? _pFilter->GetVersion() : SOFFICE_FILEFORMAT_CURRENT ); +/*N*/ return xStor; +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ sal_Int16 SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return SfxDocumentInfoObject::getUserFieldCount(); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return SfxDocumentInfoObject::getUserFieldName(nIndex); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ ::rtl::OUString SAL_CALL SfxStandaloneDocumentInfoObject::getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ return SfxDocumentInfoObject::getUserFieldValue(nIndex); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SfxDocumentInfoObject::setUserFieldName( nIndex, aName ); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxStandaloneDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException ) +/*N*/ { +/*N*/ SfxDocumentInfoObject::setUserFieldValue( nIndex, aValue ); +/*N*/ } +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxStandaloneDocumentInfoObject::loadFromURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ sal_Bool bOK = sal_False; +/*N*/ String aName( aURL ); +/*N*/ SvStorage* pStorage = GetStorage_Impl( aName, sal_False ); +/*N*/ if ( pStorage ) +/*N*/ { +/*N*/ if ( pStorage->GetVersion() >= SOFFICE_FILEFORMAT_60 ) +/*N*/ { +/*N*/ // import from XML meta data using SAX parser +/*N*/ uno::Reference< XInterface > xXMLParser = _xFactory->createInstance( +/*N*/ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" )) ); +/*N*/ if( xXMLParser.is() ) +/*N*/ { +/*N*/ // create input source for SAX parser +/*N*/ xml::sax::InputSource aParserInput; +/*N*/ aParserInput.sSystemId = aURL; +/*N*/ +/*N*/ SvStorageStreamRef xDocStream; +/*N*/ String sDocName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")) ); +/*N*/ if ( pStorage->IsStream(sDocName) ) +/*N*/ xDocStream = pStorage->OpenStream( sDocName, STREAM_READ | STREAM_NOCREATE ); +/*N*/ xDocStream->SetBufferSize( 16*1024 ); +/*N*/ aParserInput.aInputStream = new ::utl::OInputStreamWrapper( *xDocStream ); +/*N*/ +/*N*/ // create importer service +/*N*/ Reference < xml::sax::XDocumentHandler > xDocHandler( _xFactory->createInstanceWithArguments( +/*N*/ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.XMLMetaImporter")), +/*N*/ Sequence < Any >() ), UNO_QUERY ); +/*N*/ +/*N*/ // connect importer with this object +/*N*/ Reference < document::XImporter > xImporter( xDocHandler, UNO_QUERY ); +/*N*/ if ( xImporter.is() ) +/*N*/ xImporter->setTargetDocument( this ); +/*N*/ +/*N*/ // connect parser and filter +/*N*/ Reference < xml::sax::XParser > xParser( xXMLParser, UNO_QUERY ); +/*N*/ xParser->setDocumentHandler( xDocHandler ); +/*N*/ +/*N*/ // parse +/*N*/ try +/*N*/ { +/*N*/ xParser->parseStream( aParserInput ); +/*N*/ bOK = sal_True; +/*N*/ } +/*N*/ catch( ::com::sun::star::uno::Exception& ) +/*N*/ { +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ bOK = _pInfo->Load( pStorage ); +/*N*/ } +/*N*/ +/*N*/ DELETEZ( _pMedium ); +/*N*/ if ( !bOK ) +/*N*/ throw SfxIOException_Impl( ERRCODE_IO_CANTREAD ); +/*N*/ } + +//----------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxStandaloneDocumentInfoObject::storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ sal_Bool bOK = sal_False; +/*N*/ String aName( aURL ); +/*N*/ SvStorage* pStor = GetStorage_Impl( aName, sal_True ); +/*N*/ if ( pStor ) +/*N*/ { +/*N*/ // DocInfo speichern +/*N*/ bOK = _pInfo->Save( pStor ) && pStor->Commit(); +/*N*/ } +/*N*/ +/*N*/ DELETEZ( _pMedium ); +/*N*/ if ( !bOK ) +/*N*/ throw SfxIOException_Impl( ERRCODE_IO_CANTREAD ); +/*N*/ } + +Reference< XInterface > SAL_CALL bf_BinaryDocInfo_createInstance(const Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) + throw( Exception ) +{ + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxLegServFact; + if ( !mxLegServFact.is() ) + { + mxLegServFact = ::legacy_binfilters::getLegacyProcessServiceFactory(); + ::com::sun::star::uno::Reference < com::sun::star::lang::XComponent > xWrapper( mxLegServFact->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.OfficeWrapper" ))), UNO_QUERY ); + } + + return (cppu::OWeakObject*)new SfxStandaloneDocumentInfoObject(rSMgr); +} + + +//============================================================================= +/* ASMUSS +#ifdef TEST_CODE + // Testcode fuer DocumentInfoObject + // Einmal zum Holen + ::com::sun::star::uno::Reference< XServiceManager > xMan = getGlobalServiceManager(); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Uik > aIfaces( 2 ); + aIfaces.getArray()[0] = ::getCppuType((const Reference< ::com::sun::star::document::XDocumentInfo >*)0); + aIfaces.getArray()[1] = ::getCppuType((const Reference< ::com::sun::star::beans::XFastPropertySet >*)0); + ::com::sun::star::uno::Reference< XServiceProvider > xSSI = xMan->getServiceProvider( + "com.sun.star.document.DocumentInfo", aIfaces, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Uik >() ); +// automatisch auskommentiert - [getIdlClass(es) or queryInterface] - Bitte XTypeProvider benutzen! +// ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentInfo > xInfo = (::com::sun::star::document::XDocumentInfo*) xSSI->newInstance()->queryInterface( ::getCppuType((const Reference< ::com::sun::star::document::XDocumentInfo >*)0) ); + +// automatisch auskommentiert - [getIdlClass(es) or queryInterface] - Bitte XTypeProvider benutzen! +// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xProps = (::com::sun::star::beans::XFastPropertySet*) xInfo->queryInterface( ::getCppuType((const Reference< ::com::sun::star::beans::XFastPropertySet >*)0) ); + + + // Laden und Werte auslesen + xInfo->load( StringToOUString( aURL, CHARSET_SYSTEM ) ); + ::com::sun::star::uno::Any aValue = xProps->getFastPropertyValue( WID_FROM ); + String aAuthor = OUStringToString( aValue.getString(), CHARSET_SYSTEM ); +#endif +*/ + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_objxtor.cxx b/binfilter/bf_sfx2/source/doc/sfx2_objxtor.cxx new file mode 100644 index 000000000000..176560a46820 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_objxtor.cxx @@ -0,0 +1,614 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "arrdecl.hxx" + +#include <com/sun/star/util/XCloseable.hpp> + +#include <osl/mutex.hxx> + +#include <tools/resary.hxx> +#include <vcl/svapp.hxx> +#include <bf_svtools/eitem.hxx> +#include <tools/rtti.hxx> +#include <bf_svtools/lstner.hxx> + +#include "bf_basic/sbstar.hxx" +#include <bf_svtools/stritem.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include <bf_sfx2/app.hxx> + +#include "bf_basic/sbx.hxx" + +#include "objsh.hxx" + +#include <bf_svtools/sfxecode.hxx> +#include <bf_svtools/ehdl.hxx> +#include <bf_svtools/printwarningoptions.hxx> + +#include <bf_svtools/urihelper.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <unotools/localfilehelper.hxx> +#include <unotools/ucbhelper.hxx> +#include <bf_svtools/asynclink.hxx> + +#include "docfac.hxx" +#include "docfile.hxx" +#include "event.hxx" +#include "cfgmgr.hxx" +#include "interno.hxx" +#include "objshimp.hxx" +#include "appbas.hxx" +#include "sfxtypes.hxx" +#include "evntconf.hxx" +#include "request.hxx" +#include "docinf.hxx" +#include "objuno.hxx" +#include "appdata.hxx" +#include "appuno.hxx" +#include "sfxsids.hrc" +#include "dlgcont.hxx" + +#include "bf_basic/basmgr.hxx" + +#include "scriptcont.hxx" + +#include <bf_svtools/imgdef.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::script; + +#include <uno/mapping.hxx> + +//==================================================================== +#include "bf_so3/staticbaseurl.hxx" +namespace binfilter { + +/*N*/ DBG_NAME(SfxObjectShell) + +extern AsynchronLink* pPendingCloser; +static SfxObjectShell* pWorkingDoc = NULL; + +//========================================================================= + +/*N*/ TYPEINIT1(SfxObjectShell, SfxShell); + +//-------------------------------------------------------------------- + +/*N*/ SfxObjectShell_Impl::~SfxObjectShell_Impl() +/*N*/ { +/*N*/ if ( pPendingCloser == pCloser ) +/*N*/ pPendingCloser = 0; +/*N*/ delete pCloser; +/*N*/ } + +// initializes a document from a file-description + +/*N*/ SfxObjectShell::SfxObjectShell +/*N*/ ( +/*N*/ SfxObjectCreateMode eMode /* Zweck, zu dem die SfxObjectShell + erzeugt wird: +/*N*/ ) +/*N*/ : pImp( new SfxObjectShell_Impl ), +/*N*/ _pFactory( 0 ), +/*N*/ eCreateMode(eMode), +/*N*/ pStyleSheetPool(0), +/*N*/ pMedium(0) +/*N*/ { +/*N*/ DBG_CTOR(SfxObjectShell, 0); +/*N*/ +/*N*/ bHasName = sal_False; +/*N*/ SfxShell::SetName( GetTitle() ); +/*N*/ nViewNo = 0; + +/*N*/ SfxObjectShell *pThis = this; +/*N*/ SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); +/*N*/ rArr.C40_INSERT( SfxObjectShell, pThis, rArr.Count() ); +/*N*/ pImp->bInList = sal_True; +/*N*/ pImp->nLoadedFlags = SFX_LOADED_ALL; +/*N*/ } + +//-------------------------------------------------------------------- + +// virtual dtor of typical base-class SfxObjectShell + +/*N*/ SfxObjectShell::~SfxObjectShell() +/*N*/ { +/*N*/ DBG_DTOR(SfxObjectShell, 0); +/*N*/ +/*N*/ if ( IsEnableSetModified() ) +/*N*/ EnableSetModified( sal_False ); +/*N*/ +/*N*/ // Niemals GetInPlaceObject() aufrufen, der Zugriff auf den +/*N*/ // Ableitungszweig SfxInternObject ist wegen eines Compiler Bugs nicht +/*N*/ // erlaubt +/*N*/ SfxObjectShell::Close(); +/*N*/ pImp->xModel = NULL; +/*N*/ +/*N*/ String aPhysName; +/*N*/ if ( pMedium ) +/*N*/ aPhysName = pMedium->GetPhysicalName(); +/*N*/ +/*N*/ DELETEX(pImp->pCfgMgr); +/*N*/ DELETEX(pImp->pReloadTimer ); +/*N*/ +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ if ( USHRT_MAX != pImp->nVisualDocumentNumber ) +/*N*/ pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); +/*N*/ +/*N*/ // Basic-Manager zerst"oren +/*N*/ if ( pImp->pBasicMgr ) +/*N*/ BasicManager::LegacyDeleteBasicManager( pImp->pBasicMgr ); +/*N*/ if( pImp->pBasicLibContainer ) +/*N*/ pImp->pBasicLibContainer->release(); +/*N*/ if( pImp->pDialogLibContainer ) +/*N*/ pImp->pDialogLibContainer->release(); +/*N*/ +/*N*/ delete pImp->pDocInfo; +/*N*/ if ( pImp->xModel.is() ) +/*N*/ pImp->xModel = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > (); +/*N*/ +/*N*/ if ( pMedium && pMedium->IsTemporary() ) +/*N*/ HandsOff(); +/*N*/ +/*N*/ DELETEX( pMedium ); +/*N*/ +/*N*/ if ( pImp->aTempName.Len() ) +/*N*/ { +/*?*/ if ( aPhysName == pImp->aTempName && !IsHandsOff() ) +/*?*/ HandsOff(); +/*?*/ String aTmp; +/*?*/ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->aTempName, aTmp ); +/*?*/ ::utl::UCBContentHelper::Kill( aTmp ); +/*N*/ } +/*N*/ +/*N*/ delete pImp; +/*N*/ } + +//-------------------------------------------------------------------- + +/*?*/ SfxObjectFactory& SfxObjectShell::GetFactory() const +/*?*/ { +/*?*/ return *_pFactory; +/*?*/ } +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::ViewAssigned() + +/* [Beschreibung] + + Diese Methode wird gerufen, wenn eine ::com::sun::star::sdbcx::View zugewiesen wird. +*/ + +/*N*/ { +/*N*/ // Spaetestens jetzt die Factory initialisieren (wegen HelpFileName) +/*N*/ GetFactory().DoInitFactory(); +/*N*/ } + +//-------------------------------------------------------------------- +// closes the Object and all its views + +/*N*/ sal_Bool SfxObjectShell::Close() +/*N*/ { +/*N*/ {DBG_CHKTHIS(SfxObjectShell, 0);} +/*N*/ if ( !pImp->bClosing ) +/*N*/ { +/*N*/ // falls noch ein Progress l"auft, nicht schlie\sen +/*N*/ if ( !pImp->bDisposing && GetProgress() ) +/*N*/ return sal_False; +/*N*/ +/*N*/ pImp->bClosing = sal_True; +/*N*/ Reference< util::XCloseable > xCloseable( GetBaseModel(), UNO_QUERY ); +/*N*/ +/*N*/ if ( xCloseable.is() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ xCloseable->close( sal_True ); +/*N*/ } +/*N*/ catch( Exception& ) +/*N*/ { +/*N*/ pImp->bClosing = sal_False; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( pImp->bClosing ) +/*N*/ { +/*N*/ // aus Document-Liste austragen +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ SfxObjectShellArr_Impl &rDocs = pSfxApp->GetObjectShells_Impl(); +/*N*/ const SfxObjectShell *pThis = this; +/*N*/ sal_uInt16 nPos = rDocs.GetPos(pThis); +/*N*/ if ( nPos < rDocs.Count() ) +/*N*/ rDocs.Remove( nPos ); +/*N*/ pImp->bInList = sal_False; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return sal_True; +/*N*/ } + +//-------------------------------------------------------------------- + +// returns a pointer the first SfxDocument of specified type + +/*N*/ SfxObjectShell* SfxObjectShell::GetFirst +/*N*/ ( +/*N*/ const TypeId* pType , +/*N*/ sal_Bool bOnlyVisible +/*N*/ ) +/*N*/ { +/*N*/ SfxObjectShellArr_Impl &rDocs = SFX_APP()->GetObjectShells_Impl(); +/*N*/ +/*N*/ // seach for a SfxDocument of the specified type +/*N*/ for ( sal_uInt16 nPos = 0; nPos < rDocs.Count(); ++nPos ) +/*N*/ { +/*N*/ SfxObjectShell* pSh = rDocs.GetObject( nPos ); +/*N*/ if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() ) +/*N*/ continue; +/*N*/ +/*N*/ if ( ( !pType || pSh->IsA(*pType) ) && +/*N*/ ( !bOnlyVisible ) ) +/*N*/ return pSh; +/*N*/ } +/*N*/ +/*N*/ return 0; +/*N*/ } +//-------------------------------------------------------------------- + +// returns a pointer to the next SfxDocument of specified type behind *pDoc + +/*N*/ SfxObjectShell* SfxObjectShell::GetNext +/*N*/ ( +/*N*/ const SfxObjectShell& rPrev, +/*N*/ const TypeId* pType, +/*N*/ sal_Bool bOnlyVisible +/*N*/ ) +/*N*/ { +/*N*/ SfxObjectShellArr_Impl &rDocs = SFX_APP()->GetObjectShells_Impl(); +/*N*/ +/*N*/ // refind the specified predecessor +/*N*/ sal_uInt16 nPos; +/*N*/ for ( nPos = 0; nPos < rDocs.Count(); ++nPos ) +/*N*/ if ( rDocs.GetObject(nPos) == &rPrev ) +/*N*/ break; +/*N*/ +/*N*/ // search for the next SfxDocument of the specified type +/*N*/ for ( ++nPos; nPos < rDocs.Count(); ++nPos ) +/*N*/ { +/*N*/ SfxObjectShell* pSh = rDocs.GetObject( nPos ); +/*N*/ if ( bOnlyVisible && pSh->IsPreview() && pSh->IsReadOnly() ) +/*N*/ continue; +/*N*/ +/*N*/ if ( ( !pType || pSh->IsA(*pType) ) && +/*N*/ ( !bOnlyVisible ) ) +/*N*/ return pSh; +/*N*/ } +/*N*/ return 0; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxObjectShell* SfxObjectShell::Current() +/*N*/ { +/*N*/ return 0; +/*N*/ } + +//------------------------------------------------------------------------ + +/*N*/ struct BoolEnv_Impl +/*N*/ { +/*N*/ SfxObjectShell_Impl* pImp; +/*N*/ BoolEnv_Impl( SfxObjectShell_Impl* pImpP) : pImp( pImpP ) +/*N*/ { pImpP->bInPrepareClose = sal_True; } +/*N*/ ~BoolEnv_Impl() { pImp->bInPrepareClose = sal_False; } +/*N*/ }; + + +/*N*/ sal_uInt16 SfxObjectShell::PrepareClose +/*N*/ ( +/*N*/ sal_Bool bUI, // sal_True: Dialoge etc. erlaubt, sal_False: silent-mode +/*N*/ sal_Bool bForBrowsing +/*N*/ ) +/*N*/ { +/*N*/ if( pImp->bInPrepareClose || pImp->bPreparedForClose ) +/*N*/ return sal_True; +/*N*/ BoolEnv_Impl aBoolEnv( pImp ); +/*N*/ +/*N*/ // DocModalDialog? +/*N*/ if ( IsInModalMode() ) +/*N*/ return sal_False; +/*N*/ +/*N*/ if( GetInPlaceObject() && GetInPlaceObject()->GetClient()) +/*N*/ { +/*?*/ pImp->bPreparedForClose = sal_True; +/*?*/ return sal_True; +/*N*/ } +/*N*/ +/*N*/ // ggf. nachfragen, ob gespeichert werden soll +/*N*/ // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen +/*N*/ +/*N*/ SfxApplication *pSfxApp = SFX_APP(); +/*N*/ pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, this) ); +/*N*/ sal_Bool bClose = sal_False; +/*N*/ +/*N*/ // ggf. hinweisen, da\s unter Fremdformat gespeichert +/*N*/ if( pMedium ) +/*N*/ { +/*N*/ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIgnoreInformationLost, +/*N*/ SfxBoolItem, SID_DOC_IGNOREINFORMATIONLOST, sal_False); +/*N*/ if( pIgnoreInformationLost && pIgnoreInformationLost->GetValue() ) +/*N*/ bUI = sal_False; +/*N*/ } +/*N*/ if ( bUI && !bClose && IsInformationLost() ) +/*N*/ { +/*N*/ // minimierte restoren +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SfxFrame* pTop = pFrame->GetTopFrame(); +/*N*/ } +/*N*/ +/*N*/ pImp->bPreparedForClose = sal_True; +/*N*/ return sal_True; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ BasicManager* SfxObjectShell::GetBasicManager() const +/*N*/ { +/*N*/ return HasBasic() ? pImp->pBasicMgr : SFX_APP()->GetBasicManager(); +/*N*/ } + +/*N*/ sal_Bool SfxObjectShell::HasBasic() const +/*N*/ { +/*N*/ if ( !pImp->bBasicInitialized ) +/*N*/ { +/*N*/ String aName( GetMedium()->GetName() ); +/*N*/ ((SfxObjectShell*)this)->InitBasicManager_Impl( GetStorage(), aName.Len() ? &aName : NULL ); +/*N*/ } +/*N*/ return pImp->pBasicMgr != NULL; +/*N*/ } + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- + +Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer() +{ + if( !pImp->pBasicLibContainer ) + GetBasicManager(); + Reference< XLibraryContainer > xRet + = static_cast< XLibraryContainer* >( pImp->pBasicLibContainer ); + return xRet; +} + +//-------------------------------------------------------------------- + +/*N*/ StarBASIC* SfxObjectShell::GetBasic() const +/*N*/ { +/*N*/ return GetBasicManager()->GetLib(0); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::InitBasicManager_Impl +/*N*/ ( +/*N*/ SvStorage* pStor /* Storage, aus dem das Dokument geladen wird + (aus <SvPersist::Load()>) bzw. 0, falls es + sich um ein neues Dokument handelt + (aus <SvPersist::InitNew()>). */ +/*N*/ , const String* pName +) +/* [Beschreibung] + + Erzeugt einen Dokument-BasicManager und l"adt diesen ggf. (pStor != 0) + aus dem Storage. + + + [Anmerkung] + + Diese Methode mu"s aus den "Uberladungen von <SvPersist::Load()> (mit + dem pStor aus dem Parameter von Load()) sowie aus der "Uberladung + von <SvPersist::InitNew()> (mit pStor = 0) gerufen werden. +*/ + +/*N*/ { +/*N*/ StarBASIC *pAppBasic = SFX_APP()->GetBasic(); +/*N*/ DBG_ASSERT( !pImp->bBasicInitialized && !pImp->pBasicMgr, "Lokaler BasicManager bereits vorhanden"); +/*N*/ +/*N*/ pImp->bBasicInitialized = TRUE; +/*N*/ BasicManager* pBasicManager; +/*N*/ if ( pStor ) +/*N*/ { +/*N*/ String aOldURL = ::binfilter::StaticBaseUrl::GetBaseURL(); +/*N*/ String aNewURL; +/*N*/ if( HasName() ) +/*N*/ aNewURL = GetMedium()->GetName(); +/*N*/ else +/*N*/ { +/*N*/ aNewURL = GetDocInfo().GetTemplateFileName(); +/*N*/ // Bei Templates keine ::com::sun::star::util::URL... +/*N*/ aNewURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( aNewURL ); +/*N*/ } +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aNewURL ); +/*N*/ +/*N*/ // load BASIC-manager +//*N*/ SfxErrorContext aErrContext( ERRCTX_SFX_LOADBASIC, GetTitle() ); +/*N*/ String aAppBasicDir = SvtPathOptions().GetBasicPath(); +/*N*/ pImp->pBasicMgr = pBasicManager = new BasicManager( + *pStor, + ::binfilter::StaticBaseUrl::GetBaseURL(INetURLObject::NO_DECODE), + pAppBasic, &aAppBasicDir ); +/*N*/ +/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( aOldURL ); +/*N*/ } +/*N*/ +/*N*/ // not loaded? +/*N*/ if ( !pStor ) +/*N*/ { +/*?*/ // create new BASIC-manager +/*?*/ StarBASIC *pBas = new StarBASIC(pAppBasic); +/*?*/ pBas->SetFlag( SBX_EXTSEARCH ); +/*?*/ pImp->pBasicMgr = pBasicManager = new BasicManager( pBas ); +/*N*/ } +/*N*/ +/*N*/ // Basic container +/*N*/ SfxScriptLibraryContainer* pBasicCont = new SfxScriptLibraryContainer +/*N*/ ( DEFINE_CONST_UNICODE( "StarBasic" ), pBasicManager, pStor ); +/*N*/ pBasicCont->acquire(); // Hold via UNO +/*N*/ Reference< XLibraryContainer > xBasicCont = static_cast< XLibraryContainer* >( pBasicCont ); +/*N*/ pImp->pBasicLibContainer = pBasicCont; +/*N*/ +/*N*/ // Dialog container +/*N*/ SfxDialogLibraryContainer* pDialogCont = new SfxDialogLibraryContainer( pStor ); +/*N*/ pDialogCont->acquire(); // Hold via UNO +/*N*/ Reference< XLibraryContainer > xDialogCont = static_cast< XLibraryContainer* >( pDialogCont ); +/*N*/ pImp->pDialogLibContainer = pDialogCont; +/*N*/ +/*N*/ LibraryContainerInfo* pInfo = new LibraryContainerInfo +/*N*/ ( xBasicCont, xDialogCont, static_cast< OldBasicPassword* >( pBasicCont ) ); +/*N*/ pBasicManager->SetLibraryContainerInfo( pInfo ); +/*N*/ pBasicCont->setBasicManager( pBasicManager ); +/*N*/ +/*N*/ // damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen +/*N*/ StarBASIC *pBas = pImp->pBasicMgr->GetLib(0); +/*N*/ // Initialize Uno +/*N*/ //pBas->setRoot( GetModel() ); +/*N*/ sal_Bool bWasModified = pBas->IsModified(); +/*N*/ pBas->SetParent( pAppBasic ); +/*N*/ +/*N*/ // Properties im Doc-BASIC +/*N*/ // ThisComponent +/*?*/ // pBasicManager->InsertGlobalUNOConstant( "ThisComponent", makeAny( GetModel() ) ); +/*N*/ +/*N*/ // Standard lib name +/*N*/ ::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); +/*N*/ +/*N*/ // Basic container +/*N*/ if ( xBasicCont.is() && !xBasicCont->hasByName( aStdLibName ) ) +/*N*/ xBasicCont->createLibrary( aStdLibName ); // create Standard library +/*?*/ // pBasicManager->InsertGlobalUNOConstant( "BasicLibraries", makeAny( xBasicCont ) ); +/*N*/ +/*N*/ // Dialog container +/*N*/ if ( xDialogCont.is() && !xDialogCont->hasByName( aStdLibName ) ) +/*N*/ xDialogCont->createLibrary( aStdLibName ); // create Standard library +/*?*/ // pBasicManager->InsertGlobalUNOConstant( "DialogLibraries", makeAny( xDialogCont ) ); +/*N*/ +/*N*/ // Modify-Flag wird bei MakeVariable gesetzt +/*N*/ pBas->SetModified( bWasModified ); +/*N*/ } + + +//-------------------------------------------------------------------- + +/*?*/ sal_Bool SfxObjectShell::DoClose() +/*?*/ { +/*?*/ return Close(); +/*?*/ } + +//-------------------------------------------------------------------- + +/*?*/ SfxObjectShell* SfxObjectShell::GetObjectShell() +/*?*/ { +/*?*/ return this; +/*?*/ } + +//-------------------------------------------------------------------- + +/*N*/ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() +/*N*/ { +/*N*/ return GetEventNames_Impl(); +/*N*/ } +/*N*/ +/*N*/ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ SEQUENCE < OUSTRING > aSequence( 14 ); + OUSTRING* pNames = aSequence.getArray(); + sal_Int32 i=0; + pNames[i++] = ::rtl::OUString::createFromAscii("OnStartApp"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnCloseApp"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnNew"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnLoad"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnSaveAs"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnSaveAsDone"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnSave"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnSaveDone"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnPrepareUnload"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnUnload"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnFocus"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnUnfocus"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnPrint"); + pNames[i++] = ::rtl::OUString::createFromAscii("OnModifyChanged"); +/*N*/ return aSequence; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxObjectShell::SetModel( SfxBaseModel* pModel ) +/*N*/ { +/*N*/ if ( pImp->xModel.is() ) +/*N*/ DBG_WARNING( "Model already set!" ); +/*N*/ +/*N*/ pImp->xModel = pModel; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetModel() +/*N*/ { +/*N*/ return pImp->xModel; +/*N*/ } + +/*N*/ void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) +/*N*/ { +/*N*/ if ( pImp->xModel.is() && pModel ) +/*N*/ DBG_WARNING( "Model already set!" ); +/*N*/ +/*N*/ pImp->xModel = pModel; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() +/*N*/ { +/*N*/ return pImp->xModel; +/*N*/ } +/* -----------------------------10.09.2001 15:56------------------------------ + + ---------------------------------------------------------------------------*/ +/*N*/ void SfxObjectShell::SetAutoStyleFilterIndex(sal_uInt16 nSet) +/*N*/ { +/*N*/ pImp->nStyleFilter = nSet; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_plugobj.cxx b/binfilter/bf_sfx2/source/doc/sfx2_plugobj.cxx new file mode 100644 index 000000000000..d7dcff366e3b --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_plugobj.cxx @@ -0,0 +1,355 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_so3/ipwin.hxx> + +#include <bf_svtools/plugpool.hxx> +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "plugobj.hxx" + + +#include "frmenv.hxx" +#include "frmdescr.hxx" +#include "urlframe.hxx" +#include "viewfrm.hxx" +#include "viewsh.hxx" +#include "clientsh.hxx" + +#include <appdata.hxx> +namespace binfilter { + +class SfxPluginObjectEnv_Impl : public SvPlugInEnvironment, + public SfxReleasableFrame +{ + SfxPluginObject* pPluginObject; +public: + SfxPluginObjectEnv_Impl( SvContainerEnvironment*, SfxPluginObject*); + ~SfxPluginObjectEnv_Impl(); + + virtual BOOL MIMETypeDetected( const String& rMIME ); + virtual void ReleaseFrame(); +}; + +struct SfxPluginObject_Impl +/* [Beschreibung] + + Impl-Struktur des SfxPluginObjects. +*/ +{ + SfxPluginObjectEnv_Impl* pEnv; + SfxURLFrame* pFrame; + SfxFrameSetDescriptor* pSet; + + SfxPluginObject_Impl() + : pFrame( NULL ) + , pEnv( NULL ) + {} +}; + + +class SfxPluginObjectWindow_Impl : public Window +{ + SfxPluginObject* pObj; + +protected: + virtual void Resize(); + +public: + SfxPluginObjectWindow_Impl( SfxPluginObject *p, + Window *pParent, USHORT nBits ) + : Window( pParent, nBits ) + , pObj( p ) + {} +}; + + +void SfxPluginObjectWindow_Impl::Resize() +{ + // Die neue Fenstergr"o\se an den Frame weitergeben + if ( pObj->GetFrame() ) + pObj->GetFrame()->GetWindow().SetOutputSizePixel( GetOutputSizePixel() ); +} + +//========================================================================= +SfxPluginObjectEnv_Impl::SfxPluginObjectEnv_Impl +( + SvContainerEnvironment * pFrm, /* Das Callback Gegenst"uck zum + InPlace-Environment */ + SfxPluginObject * pObj /* Das zum Environment geh"orende + Objekt */ +) +/* [Beschreibung] + + Das Environment wird im <SfxPluginObject::InPlaceActivate()> angelegt. + Durch die Verbindung mit dem Container Environment kann "uber die + UI-Tools und Fenster verhandelt werden. + + [Querverweise] + + <SvInPlaceEnvironment>, <SvContainerEnvironment> +*/ + : SvPlugInEnvironment( pFrm, pObj ) + , pPluginObject( pObj ) +{ +} + +//========================================================================= +SfxPluginObjectEnv_Impl::~SfxPluginObjectEnv_Impl() +/* [Beschreibung] + + Die angelegten Fenster werden zerst"ort. +*/ +{ + if( IsStarPlug() ) + { + Window *pWin = GetEditWin(); + if( pWin ) + { + pWin->Hide(); + SetEditWin( NULL ); + delete pWin; + DeleteWindows(); + } + } +} + +void SfxPluginObjectEnv_Impl::ReleaseFrame() +{ + pPluginObject->ReleaseFrame_Impl(); +} + +//========================================================================= +//============== SfxPluginObject =========================================== +//========================================================================= +SO2_IMPL_BASIC_CLASS1_DLL( SfxPluginObject, SvFactory, SvPlugInObject, + SvGlobalName( 0x4caa7761, 0x6b8b, 0x11cf, + 0x89,0xca,0x0,0x80,0x29,0xe4,0xb0,0xb1 ) ) + +//========================================================================= +SfxPluginObject::SfxPluginObject() + : pImpl( new SfxPluginObject_Impl ) +/* [Beschreibung] + + Konstruktor der Klasse SfxPluginObject. Die Verbliste und das + Format werden global initialisiert. +*/ +{ + pImpl->pSet = new SfxFrameSetDescriptor; + + // Verben der Superklasse bekanntgeben, um GetVerbs nicht + // ueberlagern zu muessen + SvVerbList *pVerbs = new SvVerbList; + SetVerbList( pVerbs ); +} + +//========================================================================= +SfxPluginObject::~SfxPluginObject() +/* [Beschreibung] + + Destruktor der Klasse SfxPluginObject. +*/ +{ + delete pImpl; +} + + +BOOL SfxPluginObjectEnv_Impl::MIMETypeDetected( const String& rMIME ) +{ + BOOL bRet; + PlugInManager * pPlugInMgr = SvFactory::GetPlugInManager(); + PlugData* pPD = pPlugInMgr->GetPlugForMime( rMIME ); + if( !pPD ) pPD = pPlugInMgr->GetPlugForExtension( + pPluginObject->GetURL()->GetFileExtension() ); + if( pPD && !pPD->IsStarPlug() ) + { + bRet = SvPlugInEnvironment::MIMETypeDetected( rMIME ); + if( bRet ) + { + SvFactory::GetPlugInManager()->SetURLLoadHdl( + GetEditWin(), + STATIC_LINK( pPluginObject->GetFrame(), SfxFrame, + UrlLoadHdl ) ); + } + } + else + { + SvInPlaceWindow * pBW = GetBorderWin(); + // Eigentliches Fenster erzeugen + Window *pWin = new SfxPluginObjectWindow_Impl( + pPluginObject, pBW, WB_CLIPCHILDREN ); + SetEditWin( pWin ); + pWin->Show(); + + // Fenster zuordnen (fuers Resize) + pBW->SetObjWin( pWin ); + bRet = pPluginObject->ConstructFrame(); + } + + return bRet; +} + +//========================================================================= +BOOL SfxPluginObject::ConstructFrame() +/* [Beschreibung] + + Die Methode erzeugt den Frame. Es ist notwendig, da\s das Objekt + InPlace-Active ist. +*/ +{ + // Nur in SfxApps kann ein Frame aufgebaut werden + SfxInPlaceClientRef aClient = GetIPClient(); + if ( !aClient.Is() ) + return FALSE; + + // Der Frame erh"alt als Parent den ViewFrame seines Clients + SfxFrame *pParent = aClient->GetViewShell()->GetViewFrame()->GetFrame(); + SfxFrameDescriptor *pFD = new SfxFrameDescriptor( pImpl->pSet ); + pFD->SetURL( *GetURL() ); + + // Den URLFrame erzeugen, der l"adt dann asynchron das Dokument + pImpl->pFrame = new SfxURLFrame( pFD, pImpl->pEnv, pImpl->pEnv, pParent ); + + // Dieser Frame wird nicht "uber eine Id, sondern "uber seinen + // Objektnamen identifiziert; daher auf keinen Fall die Id setzen, + // wohl aber den IdName. + pImpl->pFrame->SetFrameIdName_Impl( GetParent()->Find(this)->GetObjName() ); + return TRUE; +} + +//========================================================================= +void SfxPluginObject::FillClass +( + SvGlobalName * pClassName, /* Der Typ der Klasse */ + ULONG * pFormat, /* Das Dateiformat in dem geschrieben wird */ + String * pAppName, /* Der Applikationsname */ + String * pFullTypeName, /* Der genaue Name des Typs */ + String * pShortTypeName /* Der kurze Name des Typs */ +) const +/* [Beschreibung] + + Mit dieser Methode werden Informationen "uber das Objekt angefordert. + Wird das Objekt gesichert, dann werden diese Informationen in den + Storage geschrieben. + + [Anmerkung] +*/ +{ + *pClassName = *GetSvFactory(); + *pFormat = 0; + *pAppName = "PlugIn"; + *pFullTypeName = "PlugIn"; + *pShortTypeName = "PlugIn"; +} + +//========================================================================= +void SfxPluginObject::FillRegInfo +( + SvEmbeddedRegistryInfo * pInfo /* In diese Objekt werden alle + relevaten Informationen eingetragen */ +) +/* [Beschreibung] + + Mit dieser Methode werden Informationen "uber das Objekt angefordert. + Diese Informationen werden dazu benutzt, um das Objekt in der + Registration DataBase von Windows anzumelden. + + [Anmerkung] +*/ +{ + SvInPlaceObject::FillRegInfo( pInfo ); // setzt alle anderen Werte + pInfo->aObjName = "PlugInObject"; + pInfo->nMajorVers = 1; + pInfo->nMinorVers = 0; + pInfo->aHumanAppName = "PlugIn"; + pInfo->aHumanShortTypeName = "PlugIn"; +} + + + +//========================================================================= +void SfxPluginObject::InPlaceActivate +( + BOOL bActivate /* TRUE, InPlace Aktivierung beginnt. + FALSE, InPlace Aktivierung endet. */ +) +/* [Beschreibung] + + Das Objekt wird InPlace aktiviert oder deaktiviert. + + [Querverweise] + + <SvInPlaceObject::InPlaceActivate()> +*/ +{ + if( bActivate ) + { + SvContainerEnvironment* pEnv = GetIPClient()->GetEnv(); + pImpl->pEnv = new SfxPluginObjectEnv_Impl( pEnv, this ); + + // wird in die Verwaltung eingesetzt + SetIPEnv( pImpl->pEnv ); + SvPlugInObject::InPlaceActivate( bActivate ); + } + else + { + // Wichtig: zuerst den Frame l"oschen, denn der benachrichtigt in + // seinem dtor das Environment, das aber im InPlaceDeactivate zerst"ort + // wird. Au\serdem wird dabei das parent window des URLFrames abger"aumt! + if ( pImpl->pFrame ) + { + // Frame hat sich noch nicht abgemeldet + pImpl->pFrame->DoClose(); + pImpl->pFrame = NULL; + } + + SvPlugInObject::InPlaceActivate( bActivate ); + } +} + +SfxFrame* SfxPluginObject::GetFrame() const +{ + return pImpl->pFrame; +} + +void SfxPluginObject::ReleaseFrame_Impl() +{ + pImpl->pFrame = NULL; +} + +SfxPluginObjectFactoryPtr* SfxPluginObject::GetFactoryPtr() +{ + return SFX_APP()->Get_Impl()->pSfxPluginObjectFactoryPtr; +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_sfxbasemodel.cxx b/binfilter/bf_sfx2/source/doc/sfx2_sfxbasemodel.cxx new file mode 100644 index 000000000000..3eee3608f984 --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_sfxbasemodel.cxx @@ -0,0 +1,1640 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//________________________________________________________________________________________________________ +// my own includes +//________________________________________________________________________________________________________ + +#include <sfxbasemodel.hxx> +#include <bf_sfx2/app.hxx> + +//________________________________________________________________________________________________________ +// include of other projects +//________________________________________________________________________________________________________ + +#include <com/sun/star/view/XPrintJob.hpp> + +#include <com/sun/star/view/XSelectionSupplier.hpp> + +#include <com/sun/star/awt/Size.hpp> + +#include <com/sun/star/lang/DisposedException.hpp> + +#include <com/sun/star/lang/IllegalArgumentException.hpp> + +#include <com/sun/star/frame/IllegalArgumentIOException.hpp> + +#include <com/sun/star/view/PaperFormat.hpp> + +#include <com/sun/star/view/PaperOrientation.hpp> + +#include <cppuhelper/interfacecontainer.hxx> + +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/container/XIndexContainer.hpp> + +#include <com/sun/star/ucb/NameClash.hpp> + +#include <uno/mapping.hxx> + +#include <bf_svtools/itemset.hxx> + +#include <bf_svtools/stritem.hxx> + +#include <bf_svtools/intitem.hxx> + +#include <bf_svtools/eitem.hxx> + +#include "bf_basic/sbx.hxx" + +#include <osl/file.hxx> + +#include <osl/thread.hxx> + +#include <tools/urlobj.hxx> + +#include <unotools/tempfile.hxx> + +#include <unotools/localfilehelper.hxx> + +#include <ucbhelper/content.hxx> + +#include <osl/mutex.hxx> +#include <vcl/salctype.hxx> + +//________________________________________________________________________________________________________ +// includes of my own project +//________________________________________________________________________________________________________ + +#include "appuno.hxx" + +#include <objshimp.hxx> + + +#include <docfile.hxx> + +#include <request.hxx> + +#include <objuno.hxx> + +#include <printer.hxx> + +#include <event.hxx> + +#include <eventsupplier.hxx> + +#include <evntconf.hxx> + +#include <interno.hxx> + +#include "sfx.hrc" + +#include "openflag.hxx" +#include "appdata.hxx" +#include "docfac.hxx" +#include "fcontnr.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#include <cppuhelper/typeprovider.hxx> + +#include "bf_basic/basmgr.hxx" + +namespace binfilter { + +//________________________________________________________________________________________________________ +// defines +//________________________________________________________________________________________________________ + +#define SfxIOException_Impl( nErr ) ::com::sun::star::io::IOException() + +#define XFRAME ::com::sun::star::frame::XFrame +#define XINTERFACE ::com::sun::star::uno::XInterface +#define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper +#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY +#define DISPOSEDEXCEPTION ::com::sun::star::lang::DisposedException +#define MAPPING ::com::sun::star::uno::Mapping +#define XSELECTIONSUPPLIER ::com::sun::star::view::XSelectionSupplier +#define ANY ::com::sun::star::uno::Any +#define ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException +#define ILLEGALARGUMENTIOEXCEPTION ::com::sun::star::frame::IllegalArgumentIOException +#define DOUBLEINITIALIZATIONEXCEPTION ::com::sun::star::frame::DoubleInitializationException +#define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper +#define OINTERFACEITERATORHELPER ::cppu::OInterfaceIteratorHelper +#define SIZE ::com::sun::star::awt::Size +#define PAPERFORMAT ::com::sun::star::view::PaperFormat +#define PAPERORIENTATION ::com::sun::star::view::PaperOrientation +#define OTYPECOLLECTION ::cppu::OTypeCollection +#define OIMPLEMENTATIONID ::cppu::OImplementationId +#define MUTEXGUARD ::osl::MutexGuard +#define XINDEXCONTAINER ::com::sun::star::container::XIndexContainer +#define UNSUPPORTEDFLAVOREXCEPTION ::com::sun::star::datatransfer::UnsupportedFlavorException +#define XPRINTJOBLISTENER ::com::sun::star::view::XPrintJobListener + +//________________________________________________________________________________________________________ +// namespaces +//________________________________________________________________________________________________________ + + +// Don't use using ... here, because there are at least two classes with the same name in use + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +//________________________________________________________________________________________________________ +// impl. declarations +//________________________________________________________________________________________________________ + +struct IMPL_SfxBaseModel_DataContainer +{ + SfxObjectShellRef m_pObjectShell ; + //SfxObjectShellLock m_pObjectShellLock ; + OUSTRING m_sURL ; + sal_uInt16 m_nControllerLockCount ; + OMULTITYPEINTERFACECONTAINERHELPER m_aInterfaceContainer ; + REFERENCE< XINTERFACE > m_xParent ; + REFERENCE< XCONTROLLER > m_xCurrent ; + REFERENCE< XDOCUMENTINFO > m_xDocumentInfo ; + REFERENCE< XSTARBASICACCESS > m_xStarBasicAccess ; + REFERENCE< XNAMEREPLACE > m_xEvents ; + SEQUENCE< PROPERTYVALUE> m_seqArguments ; + SEQUENCE< REFERENCE< XCONTROLLER > > m_seqControllers ; + REFERENCE< XINDEXACCESS > m_contViewData ; + sal_Bool m_bLoadDone ; + sal_Bool m_bLoadState ; + sal_Bool m_bClosed ; + sal_Bool m_bClosing ; + REFERENCE< ::com::sun::star::view::XPrintJob> m_xPrintJob ; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aPrintOptions; + + IMPL_SfxBaseModel_DataContainer( MUTEX& aMutex , + SfxObjectShell* pObjectShell ) + : m_pObjectShell ( pObjectShell ) +// , m_pObjectShellLock ( pObjectShell ) + , m_sURL ( String() ) + , m_nControllerLockCount ( 0 ) + , m_aInterfaceContainer ( aMutex ) + , m_bLoadDone ( sal_False ) + , m_bLoadState ( sal_False ) + , m_bClosed ( sal_False ) + , m_bClosing ( sal_False ) + { + } +} ; + +extern void* getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ); +extern void* getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, const Size& aMetaSize ); +extern SvMemoryStream* getMetaMemStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat ); +extern sal_Bool supportsMetaFileHandle_Impl(); + + +//________________________________________________________________________________________________________ +// constructor +//________________________________________________________________________________________________________ + +/*N*/ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell ) +/*N*/ : IMPL_SfxBaseModel_MutexContainer() +/*N*/ , m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) ) +/*N*/ { +/*N*/ if ( pObjectShell != NULL ) +/*N*/ { +/*N*/ StartListening( *pObjectShell ) ; +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// destructor +//________________________________________________________________________________________________________ + +/*N*/ SfxBaseModel::~SfxBaseModel() +/*N*/ { +/*N*/ } + +//________________________________________________________________________________________________________ +// XInterface +//________________________________________________________________________________________________________ + +/*N*/ ANY SAL_CALL SfxBaseModel::queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // Attention: +/*N*/ // Don't use mutex or guard in this method!!! Is a method of XInterface. +/*N*/ +/*N*/ // Ask for my own supported interfaces ... +/*N*/ ANY aReturn( ::cppu::queryInterface( rType , +/*N*/ static_cast< XTYPEPROVIDER* > ( this ) , +/*N*/ static_cast< XCHILD* > ( this ) , +/*N*/ static_cast< XDOCUMENTINFOSUPPLIER* > ( this ) , +/*N*/ static_cast< XEVENTLISTENER* > ( this ) , +/*N*/ static_cast< XMODEL* > ( this ) , +/*N*/ static_cast< XMODIFIABLE* > ( this ) , +/*N*/ static_cast< XCOMPONENT* > ( this ) , +/*N*/ static_cast< XPRINTABLE* > ( this ) , +/*N*/ static_cast< XSTARBASICACCESS* > ( this ) , +/*N*/ static_cast< XSTORABLE* > ( this ) , +/*N*/ static_cast< XLOADABLE* > ( this ) , +/*N*/ static_cast< XCLOSEABLE* > ( this ) ) ); +/*N*/ +/*N*/ if ( aReturn.hasValue() == sal_False ) +/*N*/ { +/*N*/ aReturn = ::cppu::queryInterface( rType , +/*N*/ static_cast< XMODIFYBROADCASTER* > ( this ) , +/*N*/ static_cast< XTRANSFERABLE* > ( this ) , +/*N*/ static_cast< XPRINTJOBBROADCASTER* > ( this ) , +/*N*/ static_cast< XCLOSEBROADCASTER* > ( this ) , +/*N*/ static_cast< XVIEWDATASUPPLIER* > ( this ) , +/*N*/ static_cast< XEVENTBROADCASTER* > ( this ) , +/*N*/ static_cast< XEVENTSSUPPLIER* > ( this ) ) ; +/*N*/ } +/*N*/ // If searched interface supported by this class ... +/*N*/ if ( aReturn.hasValue() == sal_True ) +/*N*/ { +/*N*/ // ... return this information. +/*N*/ return aReturn ; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Else; ... ask baseclass for interfaces! +/*N*/ return OWeakObject::queryInterface( rType ) ; +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// XInterface +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::acquire() throw( ) +/*N*/ { +/*N*/ // Attention: +/*N*/ // Don't use mutex or guard in this method!!! Is a method of XInterface. +/*N*/ +/*N*/ // Forward to baseclass +/*N*/ OWeakObject::acquire() ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XInterface +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::release() throw( ) +/*N*/ { +/*N*/ // Attention: +/*N*/ // Don't use mutex or guard in this method!!! Is a method of XInterface. +/*N*/ +/*N*/ // Forward to baseclass +/*N*/ OWeakObject::release() ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XTypeProvider +//________________________________________________________________________________________________________ + +/*N*/ SEQUENCE< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // Optimize this method ! +/*N*/ // We initialize a static variable only one time. And we don't must use a mutex at every call! +/*N*/ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! +/*N*/ static OTYPECOLLECTION* pTypeCollection = NULL ; +/*N*/ +/*N*/ if ( pTypeCollection == NULL ) +/*N*/ { +/*N*/ // Ready for multithreading; get global mutex for first call of this method only! see before +/*N*/ MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; +/*N*/ +/*N*/ // Control these pointer again ... it can be, that another instance will be faster then these! +/*N*/ if ( pTypeCollection == NULL ) +/*N*/ { +/*N*/ // Create a static typecollection ... +/*N*/ static OTYPECOLLECTION aTypeCollectionFirst( ::getCppuType(( const REFERENCE< XTYPEPROVIDER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XCHILD >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XDOCUMENTINFOSUPPLIER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XEVENTLISTENER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XMODEL >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XMODIFIABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XPRINTABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XSTORABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XLOADABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XCLOSEABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XSTARBASICACCESS >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XEVENTBROADCASTER >*)NULL ) ); +/*N*/ +/*N*/ static OTYPECOLLECTION aTypeCollection ( ::getCppuType(( const REFERENCE< XVIEWDATASUPPLIER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XTRANSFERABLE >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XPRINTJOBBROADCASTER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XEVENTSSUPPLIER >*)NULL ) , +/*N*/ ::getCppuType(( const REFERENCE< XCLOSEBROADCASTER >*)NULL ) , +/*N*/ aTypeCollectionFirst.getTypes() ); +/*N*/ +/*N*/ // ... and set his address to static pointer! +/*N*/ pTypeCollection = &aTypeCollection ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pTypeCollection->getTypes() ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XTypeProvider +//________________________________________________________________________________________________________ + +/*N*/ SEQUENCE< sal_Int8 > SAL_CALL SfxBaseModel::getImplementationId() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // Create one Id for all instances of this class. +/*N*/ // Use ethernet address to do this! (sal_True) +/*N*/ +/*N*/ // Optimize this method +/*N*/ // We initialize a static variable only one time. And we don't must use a mutex at every call! +/*N*/ // For the first call; pID is NULL - for the second call pID is different from NULL! +/*N*/ static OIMPLEMENTATIONID* pID = NULL ; +/*N*/ +/*N*/ if ( pID == NULL ) +/*N*/ { +/*N*/ // Ready for multithreading; get global mutex for first call of this method only! see before +/*N*/ MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; +/*N*/ +/*N*/ // Control these pointer again ... it can be, that another instance will be faster then these! +/*N*/ if ( pID == NULL ) +/*N*/ { +/*N*/ // Create a new static ID ... +/*N*/ static OIMPLEMENTATIONID aID( sal_False ) ; +/*N*/ // ... and set his address to static pointer! +/*N*/ pID = &aID ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pID->getImplementationId() ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XStarBasicAccess +//________________________________________________________________________________________________________ + +/*N*/ REFERENCE< XSTARBASICACCESS > implGetStarBasicAccess( SfxObjectShell* pObjectShell ) +/*N*/ { +/*N*/ REFERENCE< XSTARBASICACCESS > xRet; +/*N*/ if( pObjectShell ) +/*N*/ { +/*N*/ BasicManager* pMgr = pObjectShell->GetBasicManager(); +/*N*/ xRet = getStarBasicAccess( pMgr ); +/*N*/ } +/*N*/ return xRet; +/*N*/ } + +/*N*/ REFERENCE< XNAMECONTAINER > SAL_CALL SfxBaseModel::getLibraryContainer() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ REFERENCE< XSTARBASICACCESS >& rxAccess = m_pData->m_xStarBasicAccess; +/*N*/ if( !rxAccess.is() ) +/*N*/ rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); +/*N*/ +/*N*/ REFERENCE< XNAMECONTAINER > xRet; +/*N*/ if( rxAccess.is() ) +/*N*/ xRet = rxAccess->getLibraryContainer(); +/*N*/ return xRet; +/*N*/ } + +/**___________________________________________________________________________________________________ + @seealso XStarBasicAccess +*/ +/*N*/ void SAL_CALL SfxBaseModel::createLibrary( const OUSTRING& LibName, const OUSTRING& Password, +/*N*/ const OUSTRING& ExternalSourceURL, const OUSTRING& LinkTargetURL ) +/*N*/ throw(ELEMENTEXISTEXCEPTION, RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ REFERENCE< XSTARBASICACCESS >& rxAccess = m_pData->m_xStarBasicAccess; +/*N*/ if( !rxAccess.is() ) +/*N*/ rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); +/*N*/ +/*N*/ if( rxAccess.is() ) +/*N*/ rxAccess->createLibrary( LibName, Password, ExternalSourceURL, LinkTargetURL ); +/*N*/ } + +/**___________________________________________________________________________________________________ + @seealso XStarBasicAccess +*/ +/*N*/ void SAL_CALL SfxBaseModel::addModule( const OUSTRING& LibraryName, const OUSTRING& ModuleName, +/*N*/ const OUSTRING& Language, const OUSTRING& Source ) +/*N*/ throw( NOSUCHELEMENTEXCEPTION, RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ REFERENCE< XSTARBASICACCESS >& rxAccess = m_pData->m_xStarBasicAccess; +/*N*/ if( !rxAccess.is() ) +/*N*/ rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); +/*N*/ +/*N*/ if( rxAccess.is() ) +/*N*/ rxAccess->addModule( LibraryName, ModuleName, Language, Source ); +/*N*/ } + +/**___________________________________________________________________________________________________ + @seealso XStarBasicAccess +*/ +/*N*/ void SAL_CALL SfxBaseModel::addDialog( const OUSTRING& LibraryName, const OUSTRING& DialogName, +/*N*/ const ::com::sun::star::uno::Sequence< sal_Int8 >& Data ) +/*N*/ throw(NOSUCHELEMENTEXCEPTION, RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ REFERENCE< XSTARBASICACCESS >& rxAccess = m_pData->m_xStarBasicAccess; +/*N*/ if( !rxAccess.is() ) +/*N*/ rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); +/*N*/ +/*N*/ if( rxAccess.is() ) +/*N*/ rxAccess->addDialog( LibraryName, DialogName, Data ); +/*N*/ } + + +//________________________________________________________________________________________________________ +// XChild +//________________________________________________________________________________________________________ + +/*N*/ REFERENCE< XINTERFACE > SAL_CALL SfxBaseModel::getParent() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/* #77222# + AS->MBA: There is one view only at the moment. We don't must search for other parents in other frames ...!? + + if ( !m_pData->m_xParent.is() && m_pData->m_xCurrent.is() ) + { + // If no parent is set get the parent by view hierarchy + REFERENCE< XFRAME > xParentFrame( m_pData->m_xCurrent->getFrame()->getCreator(), UNO_QUERY ); + if ( xParentFrame.is() ) + { + REFERENCE< XCONTROLLER > xCtrl( xParentFrame->getController() ); + if ( xCtrl.is() ) + return xCtrl->getModel(); + } + } +*/ +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_xParent; +/*N*/ } + +//________________________________________________________________________________________________________ +// XChild +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::setParent(const REFERENCE< XINTERFACE >& Parent) throw(NOSUPPORTEXCEPTION, RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( Parent.is() && getParent().is() ) +/*N*/ // only set parent when no parent is available +/*N*/ throw NOSUPPORTEXCEPTION(); +/*N*/ +/*N*/ m_pData->m_xParent = Parent; +/*N*/ } + +//________________________________________________________________________________________________________ +// XChild +//________________________________________________________________________________________________________ + +/*N*/ long SfxObjectShellClose_Impl( void* pObj, void* pArg ); + +/*N*/ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ +/*N*/ // object already disposed? +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( !m_pData->m_bClosed ) +/*N*/ { +/*N*/ // gracefully accept wrong dispose calls instead of close call +/*N*/ // and try to make it work (may be really disposed later!) +/*N*/ try +/*N*/ { +/*N*/ close( sal_True ); +/*N*/ } +/*N*/ catch ( ::com::sun::star::util::CloseVetoException& ) +/*N*/ { +/*N*/ } +/*N*/ +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ EVENTOBJECT aEvent( (XMODEL *)this ); +/*N*/ m_pData->m_aInterfaceContainer.disposeAndClear( aEvent ); +/*N*/ +/*N*/ // is an object shell assigned? +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ // Rekursion vermeiden +/*N*/ SfxObjectShellRef pShell; +/*N*/ //SfxObjectShellLock pShellLock; +/*N*/ +/*N*/ { +/*N*/ // am I "ThisComponent" in AppBasic? +/*N*/ StarBASIC* pBas = SFX_APP()->GetBasic_Impl(); +/*N*/ if ( pBas && SFX_APP()->Get_Impl()->pThisDocument == m_pData->m_pObjectShell ) +/*N*/ { + DBG_ERROR( "SfxBaseModel::dispose: dead code!" ); +/*N*/ } +/*N*/ +/*N*/ pShell = m_pData->m_pObjectShell; +/*N*/ //pShellLock = m_pData->m_pObjectShellLock; +/*N*/ EndListening( *pShell ); +/*N*/ m_pData->m_pObjectShell = SfxObjectShellRef(); +/*N*/ //m_pData->m_pObjectShellLock = SfxObjectShellLock(); +/*N*/ } +/*N*/ +/*N*/ // Bei dispose keine Speichern-R"uckfrage +/*N*/ //if ( pShell->IsEnableSetModified() && !pShell->Get_Impl()->bClosing ) +/*N*/ // pShell->SetModified( sal_False ); +/*N*/ pShell->Get_Impl()->bDisposing = TRUE; +/*N*/ //pShellLock = SfxObjectShellLock(); +/*N*/ SfxObjectShellClose_Impl( 0, (void*) pShell ); +/*N*/ } +/*N*/ +/*N*/ m_pData->m_xCurrent = REFERENCE< XCONTROLLER > (); +/*N*/ m_pData->m_seqControllers = SEQUENCE< REFERENCE< XCONTROLLER > > () ; +/*N*/ +/*N*/ DELETEZ(m_pData); +/*N*/ } + +//________________________________________________________________________________________________________ +// XChild +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::addEventListener( const REFERENCE< XEVENTLISTENER >& aListener ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const REFERENCE< XEVENTLISTENER >*)0), aListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// XChild +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::removeEventListener( const REFERENCE< XEVENTLISTENER >& aListener ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XEVENTLISTENER >*)0), aListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// XDOCUMENTINFOSupplier +//________________________________________________________________________________________________________ + +/*N*/ REFERENCE< XDOCUMENTINFO > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( !m_pData->m_xDocumentInfo.is() && m_pData->m_pObjectShell.Is() ) +/*N*/ ((SfxBaseModel*)this)->m_pData->m_xDocumentInfo = new SfxDocumentInfoObject( m_pData->m_pObjectShell ) ; +/*N*/ +/*N*/ return m_pData->m_xDocumentInfo; +/*N*/ } + +//________________________________________________________________________________________________________ +// XEVENTLISTENER +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::disposing( const EVENTOBJECT& aObject ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ REFERENCE< XMODIFYLISTENER > xMod( aObject.Source, UNO_QUERY ); +/*N*/ REFERENCE< XEVENTLISTENER > xListener( aObject.Source, UNO_QUERY ); +/*N*/ REFERENCE< XDOCEVENTLISTENER > xDocListener( aObject.Source, UNO_QUERY ); +/*N*/ +/*N*/ if ( xMod.is() ) +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XMODIFYLISTENER >*)0), xMod ); +/*N*/ else if ( xListener.is() ) +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XEVENTLISTENER >*)0), xListener ); +/*N*/ else if ( xDocListener.is() ) +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0), xListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SAL_CALL SfxBaseModel::attachResource( const OUSTRING& rURL , +/*N*/ const SEQUENCE< PROPERTYVALUE >& rArgs ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) ) +/*N*/ { +/*N*/ // allows to set a windowless document to EMBEDDED state +/*N*/ // but _only_ before load() or initNew() methods +/*?*/ if ( m_pData->m_pObjectShell.Is() && !m_pData->m_pObjectShell->GetMedium() ) +/*?*/ { +/*?*/ sal_Bool bEmb; +/*?*/ if ( ( rArgs[0].Value >>= bEmb ) && bEmb ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");}//STRIP001 m_pData->m_pObjectShell->SetCreateMode_Impl( SFX_CREATE_MODE_EMBEDDED ); +/*?*/ } +/*N*/ +/*N*/ return sal_True; +/*N*/ } +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ m_pData->m_sURL = rURL; +/*N*/ m_pData->m_seqArguments = rArgs; +/*N*/ +/*N*/ sal_Int32 nNewLength = rArgs.getLength(); +/*N*/ for ( sal_Int32 nInd = 0; nInd < rArgs.getLength(); nInd++ ) +/*N*/ if ( rArgs[nInd].Name.equalsAscii( "WinExtent" ) ) +/*N*/ { +/*N*/ // the document should be resized +/*?*/ SfxInPlaceObject* pInPlaceObj = m_pData->m_pObjectShell->GetInPlaceObject(); +/*?*/ if ( pInPlaceObj ) +/*?*/ { +/*?*/ Sequence< sal_Int32 > aSize; +/*?*/ if ( ( rArgs[nInd].Value >>= aSize ) && aSize.getLength() == 4 ) +/*?*/ { +/*?*/ Rectangle aTmpRect( aSize[0], aSize[1], aSize[2], aSize[3] ); +/*?*/ aTmpRect = OutputDevice::LogicToLogic( aTmpRect, MAP_100TH_MM, pInPlaceObj->GetMapUnit() ); +/*?*/ +/*?*/ pInPlaceObj->SetVisArea( aTmpRect ); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if( m_pData->m_pObjectShell->GetMedium() ) +/*N*/ { +/*N*/ SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); +/*N*/ TransformParameters( SID_OPENDOC, rArgs, aSet ); +/*N*/ m_pData->m_pObjectShell->GetMedium()->GetItemSet()->Put( aSet ); +/*N*/ SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False ); +/*N*/ if ( pItem ) +/*N*/ m_pData->m_pObjectShell->GetMedium()->SetFilter( +/*N*/ m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter( pItem->GetValue() ) ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return sal_True ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ OUSTRING SAL_CALL SfxBaseModel::getURL() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_sURL ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ SEQUENCE< PROPERTYVALUE > SAL_CALL SfxBaseModel::getArgs() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ SEQUENCE< PROPERTYVALUE > seqArgsNew; +/*N*/ SEQUENCE< PROPERTYVALUE > seqArgsOld; +/*N*/ SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); +/*N*/ +/*N*/ // we need to know which properties are supported by the transformer +/*N*/ // hopefully it is a temporary solution, I guess nonconvertable properties +/*N*/ // should not be supported so then there will be only ItemSet from medium +/*N*/ +/*N*/ TransformItems( SID_OPENDOC, *(m_pData->m_pObjectShell->GetMedium()->GetItemSet()), seqArgsNew ); +/*N*/ TransformParameters( SID_OPENDOC, m_pData->m_seqArguments, aSet ); +/*N*/ TransformItems( SID_OPENDOC, aSet, seqArgsOld ); +/*N*/ +/*N*/ sal_Int32 nOrgLength = m_pData->m_seqArguments.getLength(); +/*N*/ sal_Int32 nOldLength = seqArgsOld.getLength(); +/*N*/ sal_Int32 nNewLength = seqArgsNew.getLength(); +/*N*/ +/*N*/ // "WinExtent" property should be updated always. +/*N*/ // We can store it now to overwrite an old value +/*N*/ // since it is not from ItemSet +/*N*/ SfxInPlaceObject* pInPlaceObj = m_pData->m_pObjectShell->GetInPlaceObject(); +/*N*/ if ( pInPlaceObj ) +/*N*/ { +/*N*/ Rectangle aTmpRect = pInPlaceObj->GetVisArea( ASPECT_CONTENT ); +/*N*/ aTmpRect = OutputDevice::LogicToLogic( aTmpRect, pInPlaceObj->GetMapUnit(), MAP_100TH_MM ); +/*N*/ +/*N*/ Sequence< sal_Int32 > aSize(4); +/*N*/ aSize[0] = aTmpRect.Left(); +/*N*/ aSize[1] = aTmpRect.Top(); +/*N*/ aSize[2] = aTmpRect.Right(); +/*N*/ aSize[3] = aTmpRect.Bottom(); +/*N*/ +/*N*/ seqArgsNew.realloc( ++nNewLength ); +/*N*/ seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString::createFromAscii( "WinExtent" ); +/*N*/ seqArgsNew[ nNewLength - 1 ].Value <<= aSize; +/*N*/ } +/*N*/ +/*N*/ for ( sal_Int32 nOrg = 0; nOrg < nOrgLength; nOrg++ ) +/*N*/ { +/*N*/ sal_Int32 nOldInd = 0; +/*N*/ while ( nOldInd < nOldLength ) +/*N*/ { +/*N*/ if ( m_pData->m_seqArguments[nOrg].Name.equals( seqArgsOld[nOldInd].Name ) ) +/*N*/ break; +/*N*/ nOldInd++; +/*N*/ } +/*N*/ +/*N*/ if ( nOldInd == nOldLength ) +/*N*/ { +/*N*/ // the entity with this name should be new for seqArgsNew +/*N*/ // since it is not supported by transformer +/*N*/ +/*N*/ seqArgsNew.realloc( ++nNewLength ); +/*N*/ seqArgsNew[ nNewLength - 1 ].Name = m_pData->m_seqArguments[nOrg].Name; +/*N*/ seqArgsNew[ nNewLength - 1 ].Value = m_pData->m_seqArguments[nOrg].Value; +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ m_pData->m_seqArguments = seqArgsNew; +/*N*/ } +/*N*/ +/*N*/ return m_pData->m_seqArguments ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::connectController( const REFERENCE< XCONTROLLER >& xController ) +/*N*/ throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); +/*N*/ SEQUENCE< REFERENCE< XCONTROLLER > > aNewSeq( nOldCount + 1 ); +/*N*/ for ( sal_uInt32 n = 0; n < nOldCount; n++ ) +/*N*/ aNewSeq.getArray()[n] = m_pData->m_seqControllers.getConstArray()[n]; +/*N*/ aNewSeq.getArray()[nOldCount] = xController; +/*N*/ m_pData->m_seqControllers = aNewSeq; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::disconnectController( const REFERENCE< XCONTROLLER >& xController ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); +/*N*/ if ( !nOldCount ) +/*N*/ return; +/*N*/ +/*N*/ SEQUENCE< REFERENCE< XCONTROLLER > > aNewSeq( nOldCount - 1 ); +/*N*/ for ( sal_uInt32 nOld = 0, nNew = 0; nOld < nOldCount; ++nOld ) +/*N*/ { +/*N*/ if ( xController != m_pData->m_seqControllers.getConstArray()[nOld] ) +/*N*/ { +/*N*/ aNewSeq.getArray()[nNew] = m_pData->m_seqControllers.getConstArray()[nOld]; +/*N*/ ++nNew; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ m_pData->m_seqControllers = aNewSeq; +/*N*/ +/*N*/ if ( xController == m_pData->m_xCurrent ) +/*N*/ m_pData->m_xCurrent = REFERENCE< XCONTROLLER > (); +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ ++m_pData->m_nControllerLockCount ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ --m_pData->m_nControllerLockCount ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ return ( m_pData->m_nControllerLockCount != 0 ) ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ REFERENCE< XCONTROLLER > SAL_CALL SfxBaseModel::getCurrentController() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ // get the last active controller of this model +/*N*/ if ( m_pData->m_xCurrent.is() ) +/*N*/ return m_pData->m_xCurrent; +/*N*/ +/*N*/ // get the first controller of this model +/*N*/ return m_pData->m_seqControllers.getLength() ? m_pData->m_seqControllers.getConstArray()[0] : m_pData->m_xCurrent; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::setCurrentController( const REFERENCE< XCONTROLLER >& xCurrentController ) +/*N*/ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ m_pData->m_xCurrent = xCurrentController; +/*N*/ } + +//________________________________________________________________________________________________________ +// XMODEL +//________________________________________________________________________________________________________ + +/*N*/ REFERENCE< XINTERFACE > SAL_CALL SfxBaseModel::getCurrentSelection() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ REFERENCE< XINTERFACE > xReturn; +/*N*/ REFERENCE< XCONTROLLER > xController = getCurrentController() ; +/*N*/ +/*N*/ if ( xController.is() ) +/*N*/ { +/*N*/ REFERENCE< XSELECTIONSUPPLIER > xDocView( xController, UNO_QUERY ); +/*N*/ if ( xDocView.is() ) +/*N*/ { +/*N*/ ANY xSel = xDocView->getSelection(); +/*N*/ // automatisch auskommentiert - Wird von UNO III nicht weiter unterstützt! +/*N*/ // return xSel.getReflection() == XINTERFACE_getReflection() +/*N*/ // return xSel.getValueType() == ::getCppuType((const XINTERFACE*)0) +/*N*/ // ? *(REFERENCE< XINTERFACE > *) xSel.get() : REFERENCE< XINTERFACE > (); +/*N*/ xSel >>= xReturn ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return xReturn ; +/*N*/ } + +//________________________________________________________________________________________________________ +// XModifiable +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsModified() : sal_False; +/*N*/ } + +//________________________________________________________________________________________________________ +// XModifiable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) +/*N*/ throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ m_pData->m_pObjectShell->SetModified(bModified); +/*N*/ } + +//________________________________________________________________________________________________________ +// XModifiable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::addModifyListener(const REFERENCE< XMODIFYLISTENER >& xListener) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const REFERENCE< XMODIFYLISTENER >*)0),xListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// XModifiable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::removeModifyListener(const REFERENCE< XMODIFYLISTENER >& xListener) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XMODIFYLISTENER >*)0), xListener ); +/*N*/ } + +//____________________________________________________________________________________________________ +// XCloseable +//____________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (CLOSEVETOEXCEPTION, RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( !m_pData || m_pData->m_bClosed || m_pData->m_bClosing ) +/*N*/ return; +/*N*/ +/*N*/ uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); +/*N*/ lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this)); +/*N*/ ::cppu::OInterfaceContainerHelper* pContainer = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) ); +/*N*/ if (pContainer!=NULL) +/*N*/ { +/*N*/ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); +/*N*/ while (pIterator.hasMoreElements()) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership ); +/*N*/ } +/*N*/ catch( uno::RuntimeException& ) +/*N*/ { +/*N*/ pIterator.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // no own objections against closing! +/*N*/ m_pData->m_bClosing = sal_True; +/*N*/ m_pData->m_pObjectShell->Broadcast( SfxSimpleHint(SFX_HINT_DEINITIALIZING) ); +/*N*/ pContainer = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) ); +/*N*/ if (pContainer!=NULL) +/*N*/ { +/*N*/ ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); +/*N*/ while (pCloseIterator.hasMoreElements()) +/*N*/ { +/*N*/ try +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP");//STRIP001 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource ); +/*?*/ } +/*?*/ catch( uno::RuntimeException& ) +/*?*/ { +/*?*/ pCloseIterator.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ m_pData->m_bClosed = sal_True; +/*N*/ m_pData->m_bClosing = sal_False; +/*N*/ +/*N*/ dispose(); +/*N*/ } + +//____________________________________________________________________________________________________ +// XCloseBroadcaster +//____________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::addCloseListener( const REFERENCE< XCLOSELISTENER >& xListener ) throw (RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const REFERENCE< XCLOSELISTENER >*)0), xListener ); +/*N*/ } + +//____________________________________________________________________________________________________ +// XCloseBroadcaster +//____________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::removeCloseListener( const REFERENCE< XCLOSELISTENER >& xListener ) throw (RUNTIMEEXCEPTION) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XCLOSELISTENER >*)0), xListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// XPrintable +//________________________________________________________________________________________________________ +/*?*/ void SAL_CALL SfxBaseModel::print(const SEQUENCE< PROPERTYVALUE >& rOptions) +/*?*/ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->HasName() : sal_False; +/*N*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ OUSTRING SAL_CALL SfxBaseModel::getLocation() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_pObjectShell.Is() ? OUSTRING(m_pData->m_pObjectShell->GetMedium()->GetName()) : m_pData->m_sURL; +/*N*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SAL_CALL SfxBaseModel::isReadonly() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsReadOnly() : sal_True; +/*N*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::store() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ if ( m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +/*N*/ { +/*N*/ if ( m_pData->m_pObjectShell->DoSave() ) +/*N*/ m_pData->m_pObjectShell->DoSaveCompleted(); +/*N*/ } +/*N*/ else +/*N*/ m_pData->m_pObjectShell->Save_Impl(); +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::storeAsURL( const OUSTRING& rURL , +/*N*/ const SEQUENCE< PROPERTYVALUE >& rArgs ) +/*N*/ throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ impl_store( m_pData->m_pObjectShell, rURL, rArgs, sal_False ); +/*N*/ +/*N*/ SEQUENCE< PROPERTYVALUE > aSequence ; +/*N*/ TransformItems( SID_OPENDOC, *m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence ); +/*N*/ attachResource( rURL, aSequence ); +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// XStorable +//________________________________________________________________________________________________________ + +/*N*/ void SAL_CALL SfxBaseModel::storeToURL( const OUSTRING& rURL , +/*N*/ const SEQUENCE< PROPERTYVALUE >& rArgs ) +/*N*/ throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ impl_store( m_pData->m_pObjectShell, rURL, rArgs, sal_True ); +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// XLoadable +//________________________________________________________________________________________________________ + +/*N #dochnoetig# */ void SAL_CALL SfxBaseModel::initNew() +/*N*/ throw (::com::sun::star::frame::DoubleInitializationException, +/*N*/ ::com::sun::star::io::IOException, +/*N*/ ::com::sun::star::uno::RuntimeException, +/*N*/ ::com::sun::star::uno::Exception) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ // the object shell should exist always +/*N*/ DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); +/*N*/ if ( m_pData->m_pObjectShell.Is() ) +/*N*/ { +/*N*/ if( m_pData->m_pObjectShell->GetMedium() ) +/*N*/ throw DOUBLEINITIALIZATIONEXCEPTION(); +/*N*/ +/*N*/ sal_Bool bRes = m_pData->m_pObjectShell->DoInitNew( NULL ); +/*N*/ sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetError() ? +/*N*/ m_pData->m_pObjectShell->GetError() : ERRCODE_IO_CANTCREATE; +/*N*/ m_pData->m_pObjectShell->ResetError(); +/*N*/ +/*N*/ if ( !bRes ) +/*N*/ { +/*N*/ throw SfxIOException_Impl( nErrCode ); +/*N*/ } +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// XLoadable +//________________________________________________________________________________________________________ + +/*N #dochnoetig# */ void SAL_CALL SfxBaseModel::load( const SEQUENCE< PROPERTYVALUE >& seqArguments ) +/*N*/ throw (::com::sun::star::frame::DoubleInitializationException, +/*N*/ ::com::sun::star::io::IOException, +/*N*/ ::com::sun::star::uno::RuntimeException, +/*N*/ ::com::sun::star::uno::Exception) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ // the object shell should exist always +/*N*/ DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); + if ( m_pData->m_pObjectShell.Is() ) + { + if( m_pData->m_pObjectShell->GetMedium() ) + throw DOUBLEINITIALIZATIONEXCEPTION(); + + SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() ); + TransformParameters( SID_OPENDOC, seqArguments, *pParams ); + + ::rtl::OUString aFilterName; + SFX_ITEMSET_ARG( pParams, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False ); + if( pFilterNameItem ) + aFilterName = pFilterNameItem->GetValue(); + + if( !aFilterName.getLength() ) + throw ILLEGALARGUMENTIOEXCEPTION(); + + const SfxFilter* pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName ); + BOOL bReadOnly = FALSE; + SFX_ITEMSET_ARG( pParams, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) + bReadOnly = TRUE; + SFX_ITEMSET_ARG( pParams, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE ); + SfxMedium* pMedium = new SfxMedium( pFileNameItem->GetValue(), bReadOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE, FALSE, pFilter, pParams ); + + // allow to use an interactionhandler (if there is one) + pMedium->UseInteractionHandler( TRUE ); + + // load document + sal_uInt32 nError = ERRCODE_NONE; + BOOL bOK = m_pData->m_pObjectShell->DoLoad(pMedium); + m_pData->m_pObjectShell->ResetError(); + nError = pMedium->GetError(); + if ( !nError && !bOK ) + nError = ERRCODE_IO_GENERAL; + + if ( nError ) + { + if ( m_pData->m_pObjectShell->GetMedium() != pMedium ) + { + // for whatever reason document now has another medium + DBG_ERROR("Document has rejected the medium?!"); + delete pMedium; + } + + throw SfxIOException_Impl( nError ? nError : ERRCODE_IO_CANTREAD ); + } + } +} + +//________________________________________________________________________________________________________ +// XTransferable +//________________________________________________________________________________________________________ + +/*?*/ ANY SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) +/*?*/ throw (::com::sun::star::datatransfer::UnsupportedFlavorException, +/*?*/ ::com::sun::star::io::IOException, +/*?*/ ::com::sun::star::uno::RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); ANY aAny; return aAny;//STRIP001 +/*?*/ } + +//________________________________________________________________________________________________________ +// XTransferable +//________________________________________________________________________________________________________ + + +/*?*/ SEQUENCE< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() +/*?*/ throw (::com::sun::star::uno::RuntimeException) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); SEQUENCE< DATAFLAVOR > aDATAFLAVOR(0); return aDATAFLAVOR;//STRIP001 +/*?*/ } + +//________________________________________________________________________________________________________ +// XTransferable +//________________________________________________________________________________________________________ + + + + +//-------------------------------------------------------------------------------------------------------- +// XEventsSupplier +//-------------------------------------------------------------------------------------------------------- + +/*N*/ REFERENCE< XNAMEREPLACE > SAL_CALL SfxBaseModel::getEvents() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ if ( ! m_pData->m_xEvents.is() ) +/*N*/ { +/*N*/ m_pData->m_xEvents = new SfxEvents_Impl( m_pData->m_pObjectShell, this ); +/*N*/ } +/*N*/ +/*N*/ return m_pData->m_xEvents; +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +// XEventBroadcaster +//-------------------------------------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxBaseModel::addEventListener( const REFERENCE< XDOCEVENTLISTENER >& aListener ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0), aListener ); +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +// XEventBroadcaster +//-------------------------------------------------------------------------------------------------------- + +/*N*/ void SAL_CALL SfxBaseModel::removeEventListener( const REFERENCE< XDOCEVENTLISTENER >& aListener ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0), aListener ); +/*N*/ } + +//________________________________________________________________________________________________________ +// SfxListener +//________________________________________________________________________________________________________ + +/*N*/ void addTitle_Impl( Sequence < ::com::sun::star::beans::PropertyValue >& rSeq, const ::rtl::OUString& rTitle ) +/*N*/ { +/*N*/ sal_Int32 nCount = rSeq.getLength(); +/*N*/ sal_Int32 nArg; for ( nArg=0; nArg<nCount; nArg++ ) +/*N*/ { +/*N*/ ::com::sun::star::beans::PropertyValue& rProp = rSeq[nArg]; +/*N*/ if ( rProp.Name.equalsAscii("Title") ) +/*N*/ { +/*N*/ rProp.Value <<= rTitle; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( nArg == nCount ) +/*N*/ { +/*N*/ rSeq.realloc( nCount+1 ); +/*N*/ rSeq[nCount].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ); +/*N*/ rSeq[nCount].Value <<= rTitle; +/*N*/ } +/*N*/ } + +/*N*/ void SfxBaseModel::Notify( SfxBroadcaster& rBC , +/*N*/ const SfxHint& rHint ) +/*N*/ { +/*N*/ if ( !m_pData ) +/*N*/ return; +/*N*/ +/*N*/ if ( &rBC == m_pData->m_pObjectShell ) +/*N*/ { +/*N*/ SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint ); +/*N*/ if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DOCCHANGED ) +/*N*/ changing(); +/*N*/ +/*N*/ SfxEventHint* pNamedHint = PTR_CAST( SfxEventHint, &rHint ); +/*N*/ if ( pNamedHint ) +/*N*/ { +/*N*/ if ( SFX_EVENT_SAVEASDOCDONE == pNamedHint->GetEventId() ) +/*N*/ { +/*N*/ m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName(); +/*N*/ SfxItemSet *pSet = m_pData->m_pObjectShell->GetMedium()->GetItemSet(); +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; +/*N*/ ::rtl::OUString aTitle = m_pData->m_pObjectShell->GetTitle(); +/*N*/ TransformItems( SID_SAVEASDOC, *pSet, aArgs ); +/*N*/ addTitle_Impl( aArgs, aTitle ); +/*N*/ attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), aArgs ); +/*N*/ } +/*N*/ +/*N*/ postEvent_Impl( *pNamedHint ); +/*N*/ } +/*N*/ +/*N*/ if ( pSimpleHint ) +/*N*/ { +/*N*/ if ( pSimpleHint->GetId() == SFX_HINT_TITLECHANGED ) +/*N*/ { +/*N*/ ::rtl::OUString aTitle = m_pData->m_pObjectShell->GetTitle(); +/*N*/ addTitle_Impl( m_pData->m_seqArguments, aTitle ); +/*N*/ } +/* + else if ( pSimpleHint->GetId() == SFX_HINT_DYING + || pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING ) + { + SfxObjectShellLock pShellLock = m_pData->m_pObjectShellLock; + m_pData->m_pObjectShellLock = SfxObjectShellLock(); + } +*/ +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// public impl. +//________________________________________________________________________________________________________ + +/*N*/ void SfxBaseModel::changing() +/*N*/ { +/*N*/ // object already disposed? +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ OINTERFACECONTAINERHELPER* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const REFERENCE< XMODIFYLISTENER >*)0) ); +/*N*/ if( pIC ) +/*N*/ +/*N*/ { +/*N*/ EVENTOBJECT aEvent( (XMODEL *)this ); +/*N*/ OINTERFACEITERATORHELPER aIt( *pIC ); +/*N*/ while( aIt.hasMoreElements() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); +/*N*/ } +/*N*/ catch( RUNTIMEEXCEPTION& ) +/*N*/ { +/*N*/ aIt.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +//________________________________________________________________________________________________________ +// public impl. +//________________________________________________________________________________________________________ + +/*N*/ SfxObjectShell* SfxBaseModel::GetObjectShell() const +/*N*/ { +/*N*/ return m_pData ? (SfxObjectShell*) m_pData->m_pObjectShell : 0; +/*N*/ } + +//________________________________________________________________________________________________________ +// public impl. +//________________________________________________________________________________________________________ + +/*N*/ sal_Bool SfxBaseModel::impl_isDisposed() const +/*N*/ { +/*N*/ return ( m_pData == NULL ) ; +/*N*/ } + +//________________________________________________________________________________________________________ +// private impl. +//________________________________________________________________________________________________________ + +/*N*/ void SfxBaseModel::impl_store( SfxObjectShell* pObjectShell , +/*N*/ const OUSTRING& sURL , +/*N*/ const SEQUENCE< PROPERTYVALUE >& seqArguments , +/*N*/ sal_Bool bSaveTo ) +/*N*/ { +/*N*/ if( !sURL.getLength() ) +/*N*/ throw ILLEGALARGUMENTIOEXCEPTION(); +/*N*/ +/*N*/ //sal_Bool aSaveAsTemplate = sal_False; +/*N*/ +/*N*/ SfxAllItemSet *aParams = new SfxAllItemSet( SFX_APP()->GetPool() ); +/*N*/ aParams->Put( SfxStringItem( SID_FILE_NAME, String(sURL) ) ); +/*N*/ if ( bSaveTo ) +/*N*/ aParams->Put( SfxBoolItem( SID_SAVETO, sal_True ) ); +/*N*/ +/*N*/ TransformParameters( SID_SAVEASDOC, seqArguments, *aParams ); +/*N*/ sal_Bool aRet = pObjectShell->APISaveAs_Impl( sURL, aParams ); +/*N*/ DELETEZ( aParams ); +/*N*/ +/*N*/ sal_uInt32 nErrCode = pObjectShell->GetError() ? pObjectShell->GetError() : ERRCODE_IO_CANTWRITE; +/*N*/ pObjectShell->ResetError(); +/*N*/ +/*N*/ if ( !aRet ) +/*N*/ { +/*N*/ throw SfxIOException_Impl( nErrCode ); +/*N*/ } +/*N*/ } +/*N*/ +//******************************************************************************************************** + +/*N*/ void SfxBaseModel::postEvent_Impl( const SfxEventHint& rHint ) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ OINTERFACECONTAINERHELPER* pIC = m_pData->m_aInterfaceContainer.getContainer( +/*N*/ ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0) ); +/*N*/ if( pIC ) +/*N*/ +/*N*/ { +/*N*/ OUSTRING aName = SfxEventConfiguration::GetEventName_Impl( rHint.GetEventId() ); +/*N*/ DOCEVENTOBJECT aEvent( (XMODEL *)this, aName ); +/*N*/ OINTERFACEITERATORHELPER aIt( *pIC ); +/*N*/ while( aIt.hasMoreElements() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ ((XDOCEVENTLISTENER *)aIt.next())->notifyEvent( aEvent ); +/*N*/ } +/*N*/ catch( RUNTIMEEXCEPTION& ) +/*N*/ { +/*N*/ aIt.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ REFERENCE < XINDEXACCESS > SAL_CALL SfxBaseModel::getViewData() throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ return REFERENCE < XINDEXACCESS >(); +/*N*/ +/*N*/ } + +/*N*/ void SAL_CALL SfxBaseModel::setViewData( const REFERENCE < XINDEXACCESS >& aData ) throw(::com::sun::star::uno::RuntimeException) +/*N*/ { +/*N*/ // object already disposed? +/*N*/ SolarMutexGuard aGuard; +/*N*/ if ( impl_isDisposed() ) +/*N*/ throw DISPOSEDEXCEPTION(); +/*N*/ +/*N*/ m_pData->m_contViewData = aData; +/*N*/ } + +/** calls all XEventListeners */ +/*N*/ void SfxBaseModel::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) const +/*N*/ { +/*N*/ // object already disposed? +/*N*/ if ( impl_isDisposed() ) +/*N*/ return; +/*N*/ +/*N*/ OINTERFACECONTAINERHELPER* pIC = m_pData->m_aInterfaceContainer.getContainer( +/*N*/ ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0) ); +/*N*/ if( pIC ) +/*N*/ +/*N*/ { +/*N*/ OINTERFACEITERATORHELPER aIt( *pIC ); +/*N*/ while( aIt.hasMoreElements() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ ((XDOCEVENTLISTENER *)aIt.next())->notifyEvent( aEvent ); +/*N*/ } +/*N*/ catch( RUNTIMEEXCEPTION& ) +/*N*/ { +/*N*/ aIt.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/** returns true if someone added a XEventListener to this XEventBroadcaster */ +/*N*/ sal_Bool SfxBaseModel::hasEventListeners() const +/*N*/ { +/*N*/ return !impl_isDisposed() && (NULL != m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const REFERENCE< XDOCEVENTLISTENER >*)0) ) ); +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx b/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx new file mode 100644 index 000000000000..09f0415ef6cd --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx @@ -0,0 +1,351 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/debug.hxx> + +#include <unotools/streamwrap.hxx> + +#include <xmlversion.hxx> + +#include <bf_xmloff/xmlmetae.hxx> + +#include <bf_xmloff/xmlkywd.hxx> + +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XOutputStream.hpp> + +#include <com/sun/star/util/DateTime.hpp> + +#include <com/sun/star/xml/sax/InputSource.hpp> +#include <com/sun/star/xml/sax/XParser.hpp> + +#include <docfile.hxx> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 + +#include <bf_xmloff/nmspmap.hxx> + +#include <bf_xmloff/xmlnmspe.hxx> + +namespace binfilter { + +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; + +using rtl::OUString; + +// ------------------------------------------------------------------------ + +sal_Char __FAR_DATA XMLN_VERSIONSLIST[] = "VersionList.xml"; + +// ------------------------------------------------------------------------ + +// #110680# +/*?*/ SfxXMLVersListImport_Impl::SfxXMLVersListImport_Impl( +/*?*/ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, +/*?*/ SfxVersionTableDtor *pVersions ) +/*?*/ : SvXMLImport(xServiceFactory), +/*?*/ mpVersions( pVersions ) +/*?*/ { +/*?*/ GetNamespaceMap().AddAtIndex( XML_NAMESPACE_FRAMEWORK_IDX, sXML_np_versions_list, +/*?*/ sXML_n_versions_list, XML_NAMESPACE_FRAMEWORK ); +/*?*/ } + +// ------------------------------------------------------------------------ +/*?*/ SfxXMLVersListImport_Impl::~SfxXMLVersListImport_Impl( void ) throw() +/*?*/ {} + +// ------------------------------------------------------------------------ +/*?*/ SvXMLImportContext *SfxXMLVersListImport_Impl::CreateContext( +/*?*/ sal_uInt16 nPrefix, +/*?*/ const OUString& rLocalName, +/*?*/ const Reference< XAttributeList > & xAttrList ) +/*?*/ { +/*?*/ SvXMLImportContext *pContext = 0; +/*?*/ +/*?*/ if ( XML_NAMESPACE_FRAMEWORK == nPrefix && +/*?*/ rLocalName.compareToAscii( sXML_version_list ) == 0 ) +/*?*/ { +/*?*/ pContext = new SfxXMLVersListContext_Impl( *this, nPrefix, rLocalName, xAttrList ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList ); +/*?*/ } +/*?*/ +/*?*/ return pContext; +/*?*/ } +/*?*/ + +// ------------------------------------------------------------------------ +// ------------------------------------------------------------------------ + +/*?*/ SfxXMLVersListContext_Impl::SfxXMLVersListContext_Impl( SfxXMLVersListImport_Impl& rImport, +/*?*/ sal_uInt16 nPrefix, +/*?*/ const OUString& rLocalName, +/*?*/ const Reference< XAttributeList > & xAttrList ) +/*?*/ : rLocalRef( rImport ) +/*?*/ , SvXMLImportContext( rImport, nPrefix, rLocalName ) +/*?*/ { +/*?*/ } + +// ------------------------------------------------------------------------ +/*?*/ SfxXMLVersListContext_Impl::~SfxXMLVersListContext_Impl( void ) +/*?*/ {} + +// ------------------------------------------------------------------------ +/*?*/ SvXMLImportContext *SfxXMLVersListContext_Impl::CreateChildContext( sal_uInt16 nPrefix, +/*?*/ const OUString& rLocalName, +/*?*/ const Reference< XAttributeList > & xAttrList ) +/*?*/ { +/*?*/ SvXMLImportContext *pContext = 0; +/*?*/ +/*?*/ if ( nPrefix == XML_NAMESPACE_FRAMEWORK && +/*?*/ rLocalName.compareToAscii( sXML_version_entry ) == 0) +/*?*/ { +/*?*/ pContext = new SfxXMLVersionContext_Impl( rLocalRef, nPrefix, rLocalName, xAttrList ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pContext = new SvXMLImportContext( rLocalRef, nPrefix, rLocalName ); +/*?*/ } +/*?*/ +/*?*/ return pContext; +/*?*/ } + +// ------------------------------------------------------------------------ +// ------------------------------------------------------------------------ + +/*?*/ SfxXMLVersionContext_Impl::SfxXMLVersionContext_Impl( SfxXMLVersListImport_Impl& rImport, +/*?*/ sal_uInt16 nPref, +/*?*/ const OUString& rLocalName, +/*?*/ const Reference< XAttributeList > & xAttrList ) +/*?*/ : rLocalRef( rImport ) +/*?*/ , SvXMLImportContext( rImport, nPref, rLocalName ) +/*?*/ { +/*?*/ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; +/*?*/ +/*?*/ if ( !nAttrCount ) +/*?*/ return; +/*?*/ +/*?*/ SfxVersionInfo *pInfo = new SfxVersionInfo; +/*?*/ +/*?*/ for ( sal_Int16 i=0; i < nAttrCount; i++ ) +/*?*/ { +/*?*/ OUString aLocalName; +/*?*/ const OUString& rAttrName = xAttrList->getNameByIndex( i ); +/*?*/ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); +/*?*/ +/*?*/ if ( XML_NAMESPACE_FRAMEWORK == nPrefix ) +/*?*/ { +/*?*/ if ( aLocalName.compareToAscii( sXML_title ) == 0 ) +/*?*/ { +/*?*/ const OUString& rAttrValue = xAttrList->getValueByIndex( i ); +/*?*/ pInfo->aName = rAttrValue; +/*?*/ } +/*?*/ else if ( aLocalName.compareToAscii( sXML_comment ) == 0 ) +/*?*/ { +/*?*/ const OUString& rAttrValue = xAttrList->getValueByIndex( i ); +/*?*/ pInfo->aComment = rAttrValue; +/*?*/ } +/*?*/ else if ( aLocalName.compareToAscii( sXML_creator ) == 0 ) +/*?*/ { +/*?*/ const OUString& rAttrValue = xAttrList->getValueByIndex( i ); +/*?*/ pInfo->aCreateStamp.SetName( rAttrValue ); +/*?*/ } +/*?*/ } +/*?*/ else if ( ( XML_NAMESPACE_DC == nPrefix ) && +/*?*/ ( aLocalName.compareToAscii( sXML_date_time ) == 0 ) ) +/*?*/ { +/*?*/ const OUString& rAttrValue = xAttrList->getValueByIndex( i ); +/*?*/ DateTime aTime; +/*?*/ if ( ParseISODateTimeString( rAttrValue, aTime ) ) +/*?*/ pInfo->aCreateStamp.SetTime( aTime ); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ SfxVersionTableDtor* pVersion = rLocalRef.GetList(); +/*?*/ pVersion->Insert( pInfo, LIST_APPEND ); +/*?*/ } + + +// ------------------------------------------------------------------------ +/*?*/ SfxXMLVersionContext_Impl::~SfxXMLVersionContext_Impl( void ) +/*?*/ {} + +// ------------------------------------------------------------------------ +// static +/*?*/ sal_Bool SfxXMLVersionContext_Impl::ParseISODateTimeString( +/*?*/ const ::rtl::OUString& rString, +/*?*/ DateTime& rDateTime ) +/*?*/ { +/*?*/ sal_Bool bSuccess = sal_True; +/*?*/ +/*?*/ OUString aDateStr, aTimeStr; +/*?*/ sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' ); +/*?*/ if ( nPos >= 0 ) +/*?*/ { +/*?*/ aDateStr = rString.copy( 0, nPos ); +/*?*/ aTimeStr = rString.copy( nPos + 1 ); +/*?*/ } +/*?*/ else +/*?*/ aDateStr = rString; // no separator: only date part +/*?*/ +/*?*/ sal_Int32 nYear = 0; +/*?*/ sal_Int32 nMonth = 1; +/*?*/ sal_Int32 nDay = 1; +/*?*/ sal_Int32 nHour = 0; +/*?*/ sal_Int32 nMin = 0; +/*?*/ sal_Int32 nSec = 0; +/*?*/ +/*?*/ const sal_Unicode* pStr = aDateStr.getStr(); +/*?*/ sal_Int32 nDateTokens = 1; +/*?*/ while ( *pStr ) +/*?*/ { +/*?*/ if ( *pStr == '-' ) +/*?*/ nDateTokens++; +/*?*/ pStr++; +/*?*/ } +/*?*/ if ( nDateTokens > 3 || aDateStr.getLength() == 0 ) +/*?*/ bSuccess = sal_False; +/*?*/ else +/*?*/ { +/*?*/ sal_Int32 n = 0; +/*?*/ nYear = aDateStr.getToken( 0, '-', n ).toInt32(); +/*?*/ if ( nYear > 9999 ) +/*?*/ bSuccess = sal_False; +/*?*/ else if ( nDateTokens >= 2 ) +/*?*/ { +/*?*/ nMonth = aDateStr.getToken( 0, '-', n ).toInt32(); +/*?*/ if ( nMonth > 12 ) +/*?*/ bSuccess = sal_False; +/*?*/ else if ( nDateTokens >= 3 ) +/*?*/ { +/*?*/ nDay = aDateStr.getToken( 0, '-', n ).toInt32(); +/*?*/ if ( nDay > 31 ) +/*?*/ bSuccess = sal_False; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if ( bSuccess && aTimeStr.getLength() > 0 ) // time is optional +/*?*/ { +/*?*/ pStr = aTimeStr.getStr(); +/*?*/ sal_Int32 nTimeTokens = 1; +/*?*/ while ( *pStr ) +/*?*/ { +/*?*/ if ( *pStr == ':' ) +/*?*/ nTimeTokens++; +/*?*/ pStr++; +/*?*/ } +/*?*/ if ( nTimeTokens > 3 ) +/*?*/ bSuccess = sal_False; +/*?*/ else +/*?*/ { +/*?*/ sal_Int32 n = 0; +/*?*/ nHour = aTimeStr.getToken( 0, ':', n ).toInt32(); +/*?*/ if ( nHour > 23 ) +/*?*/ bSuccess = sal_False; +/*?*/ else if ( nTimeTokens >= 2 ) +/*?*/ { +/*?*/ nMin = aTimeStr.getToken( 0, ':', n ).toInt32(); +/*?*/ if ( nMin > 59 ) +/*?*/ bSuccess = sal_False; +/*?*/ else if ( nTimeTokens >= 3 ) +/*?*/ { +/*?*/ nSec = aTimeStr.getToken( 0, ':', n ).toInt32(); +/*?*/ if ( nSec > 59 ) +/*?*/ bSuccess = sal_False; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ if ( bSuccess ) +/*?*/ rDateTime = DateTime( Date( (USHORT)nDay, (USHORT)nMonth, (USHORT)nYear ), +/*?*/ Time( nHour, nMin, nSec ) ); +/*?*/ +/*?*/ return bSuccess; +/*?*/ } + +// ------------------------------------------------------------------------ +/*N*/ sal_Bool SfxXMLVersList_Impl::ReadInfo( SvStorageRef xRoot, SfxVersionTableDtor *pList ) +/*N*/ { +/*N*/ sal_Bool bRet = sal_False; +/*N*/ +/*N*/ const OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_VERSIONSLIST ) ); +/*N*/ +/*N*/ if ( xRoot->IsContained ( sDocName ) ) +/*N*/ { +/*?*/ Reference< lang::XMultiServiceFactory > xServiceFactory = +/*?*/ ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*?*/ DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); +/*?*/ +/*?*/ InputSource aParserInput; +/*?*/ aParserInput.sSystemId = xRoot->GetName(); +/*?*/ +/*?*/ SvStorageStreamRef xDocStream = xRoot->OpenStream( sDocName, STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE ); +/*?*/ xDocStream->Seek( 0L ); +/*?*/ xDocStream->SetBufferSize( 16*1024 ); +/*?*/ aParserInput.aInputStream = new ::utl::OInputStreamWrapper( *xDocStream ); +/*?*/ +/*?*/ // get parser +/*?*/ Reference< XInterface > xXMLParser = xServiceFactory->createInstance( +/*?*/ OUString::createFromAscii("com.sun.star.xml.sax.Parser") ); +/*?*/ DBG_ASSERT( xXMLParser.is(), +/*?*/ "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" ); +/*?*/ +/*?*/ // get filter +/*?*/ // #110680# +/*?*/ // Reference< XDocumentHandler > xFilter = new SfxXMLVersListImport_Impl( pList ); +/*?*/ Reference< XDocumentHandler > xFilter = new SfxXMLVersListImport_Impl( xServiceFactory, pList ); +/*?*/ +/*?*/ // connect parser and filter +/*?*/ Reference< XParser > xParser( xXMLParser, UNO_QUERY ); +/*?*/ xParser->setDocumentHandler( xFilter ); +/*?*/ +/*?*/ // parse +/*?*/ try +/*?*/ { +/*?*/ xParser->parseStream( aParserInput ); +/*?*/ bRet = sal_True; +/*?*/ } +/*?*/ catch( SAXParseException& ) {} +/*?*/ catch( SAXException& ) {} +/*?*/ catch( io::IOException& ) {} +/*?*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/timestamp.cxx b/binfilter/bf_sfx2/source/doc/timestamp.cxx new file mode 100644 index 000000000000..c8b3c3110dcc --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/timestamp.cxx @@ -0,0 +1,451 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove + +//______________________________________________________________________________________________________________________________ +// my own includes +//______________________________________________________________________________________________________________________________ + +#include "timestamp.hxx" + +#include <tools/debug.hxx> + +#define TIMESTAMP_INVALID_DATETIME ( DateTime ( Date ( 1, 1, 1601 ), Time ( 0, 0, 0 ) ) ) /// Invalid value for date and time to create invalid instance of TimeStamp. + +/******************************************************************************************************************* + * + * @short default constructor + * @descr Take default values for member initialization. + * + * @ATTENTION We use default constructor for member !!! And the default of "DateTime" is the current date and time. + * + ******************************************************************************************************************/ +namespace binfilter { + +TimeStamp::TimeStamp () + : m_sModifiedByName () + , m_aModifiedDateTime () +{ +} + +/******************************************************************************************************************* + * + * @short overloaded constructor + * @descr Take default value for date and time. Name can be set. + * + * @ATTENTION We use default constructor for member !!! And the default of "DateTime" is the current date and time. + * + ******************************************************************************************************************/ + +TimeStamp::TimeStamp ( const String& rName ) + : m_sModifiedByName ( rName ) + , m_aModifiedDateTime ( ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rName ), "TimeStamp::TimeStamp(String)\nInvalid parameter detected!\n" ) ; + + // Make valid name. + impl_adjustName ( m_sModifiedByName ) ; +} + +/******************************************************************************************************************* + * + * @short overloaded constructor + * @descr Take default value for name. Date and time can be set. + * + ******************************************************************************************************************/ + +TimeStamp::TimeStamp ( const DateTime& rDateTime ) + : m_sModifiedByName ( ) + , m_aModifiedDateTime ( rDateTime ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rDateTime ), "TimeStamp::TimeStamp(DateTime)\nInvalid parameter detected!\n" ) ; +} + +/******************************************************************************************************************* + * + * @short overloaded constructor + * @descr All member can be set. + * + ******************************************************************************************************************/ + +TimeStamp::TimeStamp ( const String& rName, const DateTime& rDateTime ) + : m_sModifiedByName ( rName ) + , m_aModifiedDateTime ( rDateTime ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rName, rDateTime ), "TimeStamp::TimeStamp(String,DateTime)\nInvalid parameter detected!\n" ) ; + + // Make valid name. + impl_adjustName ( m_sModifiedByName ) ; +} + +//______________________________________________________________________________________________________________________________ +// operator methods +//______________________________________________________________________________________________________________________________ + +/******************************************************************************************************************* + * + * @short Set one instance to another. + * + ******************************************************************************************************************/ + +const TimeStamp& TimeStamp::operator= ( const TimeStamp& rCopy ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rCopy ), "TimeStamp::operator=()\nInvalid parameter detected!\n" ) ; + + // Save new values. + m_sModifiedByName = rCopy.m_sModifiedByName ; + m_aModifiedDateTime = rCopy.m_aModifiedDateTime ; + + // Adjust name. + impl_adjustName ( m_sModifiedByName ) ; + + // Return pointer to this instance. + return *this ; +} + +/******************************************************************************************************************* + * + * @short Compare two instances of this class. + * @return TRUE on equal / FALSE on non equal + * + ******************************************************************************************************************/ + +BOOL TimeStamp::operator== ( const TimeStamp& rCompare ) const +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rCompare ), "TimeStamp::operator==()\nInvalid parameter detected!\n" ) ; + + // Compare member of this two objects. + // Safe result for better debug ! (to se value) + BOOL bResult = ( + ( m_sModifiedByName == rCompare.m_sModifiedByName ) && + ( m_aModifiedDateTime == rCompare.m_aModifiedDateTime ) + ) ; + + return bResult ; +} + +/******************************************************************************************************************* + * + * @short Compare two instances of this class. + * @return TRUE on non equal / FALSE on equal + * + ******************************************************************************************************************/ + +int TimeStamp::operator!= ( const TimeStamp& rCompare ) const +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rCompare ), "TimeStamp::operator!=()\nInvalid parameter detected!\n" ) ; + + // Use operator "==" !!! + return ( ! operator== ( rCompare ) ) ; +} + +//______________________________________________________________________________________________________________________________ +// other methods +//______________________________________________________________________________________________________________________________ + +/******************************************************************************************************************* + * + * @short Check state of object. + * @return TRUE on OK / FALSE on error + * + ******************************************************************************************************************/ + +BOOL TimeStamp::IsValid () const +{ + // Timestamp is only valid, if member "m_aModifiedDateTime" not the default. + // The name can have a defaultvalue! + // And its better to safe this result in a local variable ... for better debug! (to see value) + BOOL bResult = ( m_aModifiedDateTime != TIMESTAMP_INVALID_DATETIME ) ; + return bResult && m_aModifiedDateTime.IsValid(); +} + + +/******************************************************************************************************************* + * + * @short Load a timestamp from stream. + * @return TRUE on OK / FALSE on error + * + ******************************************************************************************************************/ + +BOOL TimeStamp::Load ( SvStream& rStream ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rStream ), "TimeStamp::Load()\nInvalid parameter detected!\n" ) ; + + // Load name from stream. + CharSet eConvertCharSet = rStream.GetStreamCharSet(); + DBG_ASSERT( !(eConvertCharSet == RTL_TEXTENCODING_DONTKNOW) , "TimeStamp::Load()\nCharSet of stream is unknown. Can't convert bytestring to UniCode!\n" ); + DBG_ASSERT( !(eConvertCharSet == ((rtl_TextEncoding)9)) , "TimeStamp::Load()\nCharSet SYSTEM is obsolete. Can't convert bytestring to UniCode!\n" ); + rStream.ReadByteString( m_sModifiedByName, eConvertCharSet ); + + // Skip name in stream. + + // Follow operation "USHORT nSkip = ..." is right !!! + // This fix old bugs of StarOffice versions before 5.1 ... + // These versions write SfxStamps. And this implementation use USHORT to! + // Follow subtraction will produce an overflow, if length of string greater then max. value. + // We must keep ALL bytes of written strings - it can be up to 64K !!! ... :-( + USHORT nSkip = TIMESTAMP_MAXLENGTH - m_sModifiedByName.Len () ; + + rStream.SeekRel ( nSkip ) ; + + // Adjust name. + impl_adjustName ( m_sModifiedByName ) ; + + // Load date and time from stream. + long nDate ; + long nTime ; + + rStream >> nDate >> nTime ; + + // Safe date and time in member. + m_aModifiedDateTime = DateTime ( Date ( nDate ), Time ( nTime ) ) ; + + // There was errors ... + if ( rStream.GetError () != SVSTREAM_OK ) + { + // Reset object to default => "IsValid()" return now FALSE !!! + SetInvalid () ; + // And return with ERROR. + return FALSE ; + } + + // OK. + return TRUE ; +} + +/******************************************************************************************************************* + * + * @short Save a timestamp to stream. + * @return TRUE on OK / FALSE on error + * + ******************************************************************************************************************/ + +BOOL TimeStamp::Save ( SvStream& rStream ) const +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rStream ), "TimeStamp::Save()\nInvalid parameter detected!\n" ) ; + + // DEFINE "TIMESTAMP_MAXLENGTH" is to short for this operation. + DBG_ASSERT ( !( m_sModifiedByName.Len () > TIMESTAMP_MAXLENGTH ), "TimeStamp::Save()\n\"TIMESTAMP_MAXLENGTH\" is to short! Please change this." ) ; + + // Save name in stream. + CharSet eConvertCharSet = rStream.GetStreamCharSet(); + DBG_ASSERT( !(eConvertCharSet == RTL_TEXTENCODING_DONTKNOW) , "TimeStamp::Save()\nCharSet of stream is unknown. Can't convert bytestring to UniCode!\n" ); + DBG_ASSERT( !(eConvertCharSet == ((rtl_TextEncoding)9)) , "TimeStamp::Save()\nCharSet SYSTEM is obsolete. Can't convert bytestring to UniCode!\n" ); + rStream.WriteByteString( m_sModifiedByName, eConvertCharSet ); + + // Fill blanks in stream to get free place for follow date and time! + USHORT nBlanksCount = TIMESTAMP_MAXLENGTH - m_sModifiedByName.Len () ; + USHORT nCounter = 0 ; + + for ( nCounter = 0; nCounter < nBlanksCount; ++nCounter ) + { + rStream << ' '; + } + + // Save date and time in stream. + rStream << (long) m_aModifiedDateTime.GetDate () ; + rStream << (long) m_aModifiedDateTime.GetTime () ; + + // There was errors ... + if ( rStream.GetError () != SVSTREAM_OK ) + { + // Do not reset object to default !!! + // Its not an error of member variables - is an error of streaming ! + // But return with ERROR. + return FALSE ; + } + + // OK. + return TRUE ; +} + +/******************************************************************************************************************* + * + * @short Set name of timestamp. + * + ******************************************************************************************************************/ + +void TimeStamp::SetName ( const String& rName ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rName ), "TimeStamp::SetName()\nInvalid parameter detected!\n" ) ; + + // Set new value at member. + m_sModifiedByName = rName ; + + // Adjust member. + impl_adjustName ( m_sModifiedByName ) ; +} + +/******************************************************************************************************************* + * + * @short Set date and time of timestamp. + * + ******************************************************************************************************************/ + +void TimeStamp::SetTime ( const DateTime& rDateTime ) +{ + // Safe impossible cases + DBG_ASSERT ( impl_debug_checkParameter ( rDateTime ), "TimeStamp::SetTime()\nInvalid parameter detected!\n" ) ; + + m_aModifiedDateTime = rDateTime ; +} + +/******************************************************************************************************************* + * + * @short Get name of timestamp. + * + ******************************************************************************************************************/ + +const String& TimeStamp::GetName () const +{ + return m_sModifiedByName ; +} + +/******************************************************************************************************************* + * + * @short Get date and time of timestamp. + * + ******************************************************************************************************************/ + +const DateTime& TimeStamp::GetTime () const +{ + return m_aModifiedDateTime ; +} + +//______________________________________________________________________________________________________________________________ +// protected methods +//______________________________________________________________________________________________________________________________ + +//______________________________________________________________________________________________________________________________ +// private methods +//______________________________________________________________________________________________________________________________ + +/******************************************************************************************************************* + * + * @short Reset member of instance to invalid values. The method "IsValid()" return now FALSE !!! + * + ******************************************************************************************************************/ + +void TimeStamp::SetInvalid () +{ + m_sModifiedByName = String() ; + m_aModifiedDateTime = TIMESTAMP_INVALID_DATETIME ; +} + +/******************************************************************************************************************* + * + * @short Adjust member "m_sModifiedByName". + * + ******************************************************************************************************************/ + +void TimeStamp::impl_adjustName ( String& rName ) +{ + // If there to much letters ... + if ( rName.Len () > TIMESTAMP_MAXLENGTH ) + { + // .. delete it. + rName.Erase ( TIMESTAMP_MAXLENGTH ) ; + } +} + +//______________________________________________________________________________________________________________________________ +// debug methods +//______________________________________________________________________________________________________________________________ + +#ifdef DBG_UTIL + +/******************************************************************************************************************* + * + * @descr The follow methods "impl_debug_checkParameter()" checks parameter for other methods. + * The return value is used for a DEBUG_ASSERT in "other methods". + * + * There are no check-methods for ALL public-methods ... only for different parameters! + * + ******************************************************************************************************************/ + +BOOL TimeStamp::impl_debug_checkParameter ( const String& rString ) const +{ + if ( &rString == NULL ) return FALSE ; // NULL-Pointer as reference :-( +// if ( rString.Len () < 1 ) return FALSE ; // This is an invalid text for a name! + + // OK. + return TRUE ; +} + +BOOL TimeStamp::impl_debug_checkParameter ( const String& rString, const DateTime& rDateTime ) const +{ + if ( &rString == NULL ) return FALSE ; // NULL-Pointer as reference :-( + if ( &rDateTime == NULL ) return FALSE ; // NULL-Pointer as reference :-( +// if ( rString.Len () < 1 ) return FALSE ; // This is an invalid text for a name! +// if ( rDateTime == TIMESTAMP_INVALID_DATETIME ) return FALSE ; // This will set "IsValid()" to FALSE !!! + + // OK. + return TRUE ; +} + +BOOL TimeStamp::impl_debug_checkParameter ( const TimeStamp& rTimeStamp ) const +{ + if ( &rTimeStamp == NULL ) return FALSE ; // NULL-Pointer as reference :-( +// if ( rTimeStamp.IsValid () == FALSE ) return FALSE ; // Somewhere will set invalid values ??!! + + // OK. + return TRUE ; +} + +BOOL TimeStamp::impl_debug_checkParameter ( SvStream& rSvStream ) const +{ + if ( &rSvStream == NULL ) return FALSE ; // NULL-Pointer as reference :-( + if ( rSvStream.GetError () != SVSTREAM_OK ) return FALSE ; // This stream has errors! + + // OK. + return TRUE ; +} + +BOOL TimeStamp::impl_debug_checkParameter ( const DateTime& rDateTime ) const +{ + if ( &rDateTime == NULL ) return FALSE ; // NULL-Pointer as reference :-( +// if ( rDateTime == TIMESTAMP_INVALID_DATETIME ) return FALSE ; // This will set "IsValid()" to FALSE !!! + + // OK. + return TRUE ; +} + +#endif // DBG_UTIL + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/doc/xmlversion.hxx b/binfilter/bf_sfx2/source/doc/xmlversion.hxx new file mode 100644 index 000000000000..0b791db8242d --- /dev/null +++ b/binfilter/bf_sfx2/source/doc/xmlversion.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_XMLVERSION_HXX +#define _SFX_XMLVERSION_HXX + +#include <bf_so3/svstor.hxx> + +#include <bf_xmloff/xmlexp.hxx> + +#include <bf_xmloff/xmlimp.hxx> + + + +class DateTime; +namespace binfilter { + +class SfxVersionTableDtor; + +// ------------------------------------------------------------------------ +class SfxXMLVersListImport_Impl : public SvXMLImport +{ +private: + SfxVersionTableDtor *mpVersions; + +protected: + + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + +public: + + // #110680# + SfxXMLVersListImport_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SfxVersionTableDtor *pVersions ); + ~SfxXMLVersListImport_Impl() throw(); + + SfxVersionTableDtor* GetList() { return mpVersions; } +}; + +// ------------------------------------------------------------------------ +class SfxXMLVersListContext_Impl : public SvXMLImportContext +{ +private: + SfxXMLVersListImport_Impl & rLocalRef; + +public: + + SfxXMLVersListContext_Impl( SfxXMLVersListImport_Impl& rImport, + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + ~SfxXMLVersListContext_Impl(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + +}; + +// ------------------------------------------------------------------------ +class SfxXMLVersionContext_Impl : public SvXMLImportContext +{ +private: + SfxXMLVersListImport_Impl& rLocalRef; + + static sal_Bool ParseISODateTimeString( + const ::rtl::OUString& rString, + DateTime& rDateTime ); + +public: + + SfxXMLVersionContext_Impl( SfxXMLVersListImport_Impl& rImport, + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + ~SfxXMLVersionContext_Impl(); +}; + + +// ------------------------------------------------------------------------ +class SfxXMLVersList_Impl +{ +public: + static sal_Bool ReadInfo( SvStorageRef xRoot, SfxVersionTableDtor *pList ); +}; + + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/explorer/makefile.mk b/binfilter/bf_sfx2/source/explorer/makefile.mk new file mode 100644 index 000000000000..5b6cbd95c129 --- /dev/null +++ b/binfilter/bf_sfx2/source/explorer/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_explorer + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS=TRUE +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_nochaos.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/explorer/sfx2_nochaos.cxx b/binfilter/bf_sfx2/source/explorer/sfx2_nochaos.cxx new file mode 100644 index 000000000000..d14eafeea15f --- /dev/null +++ b/binfilter/bf_sfx2/source/explorer/sfx2_nochaos.cxx @@ -0,0 +1,217 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/stritem.hxx> +#include <nochaos.hxx> +#include "sfxuno.hxx" +namespace binfilter { + + +#define WID_CHAOS_START 500 +//========================================================================= +// +// class CntStaticPoolDefaults_Impl +// +//========================================================================= + +class CntItemPool; + +class CntStaticPoolDefaults_Impl +{ + sal_uInt32 m_nItems; + SfxPoolItem** m_ppDefaults; + SfxItemInfo* m_pItemInfos; + +private: + // Forbidden and not implemented... + CntStaticPoolDefaults_Impl( const CntStaticPoolDefaults_Impl& ); + CntStaticPoolDefaults_Impl& operator=( const CntStaticPoolDefaults_Impl& ); + + inline void Insert( SfxPoolItem* pItem, sal_uInt16 nSID, sal_uInt16 nFlags ); + +public: + CntStaticPoolDefaults_Impl( CntItemPool* pPool ); + ~CntStaticPoolDefaults_Impl(); + + SfxPoolItem** GetDefaults() const { return m_ppDefaults; } + const SfxItemInfo* GetItemInfos() const { return m_pItemInfos; } +}; + +//---------------------------------------------------------------------------- + +//========================================================================= + +class CntItemPool: public SfxItemPool +{ + static CntItemPool* _pThePool; + USHORT _nRefs; + +protected: + CntItemPool(); + virtual ~CntItemPool(); + +public: + static CntItemPool* Acquire(); + static USHORT Release(); +}; + +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +// static +/*N*/ SfxItemPool* NoChaos::GetItemPool() +/*N*/ { +/*N*/ // Get and hold CHAOS item pool. +/*N*/ return CntItemPool::Acquire(); +/*N*/ } + +//---------------------------------------------------------------------------- +// static +/*N*/ USHORT NoChaos::ReleaseItemPool() +/*N*/ { +/*N*/ // Release CHAOS item pool. +/*N*/ return CntItemPool::Release(); +/*N*/ } + +//========================================================================= +// +// CntItemPool implementation +// +//========================================================================= + +static CntStaticPoolDefaults_Impl* pPoolDefs_Impl = NULL; + +// static member! +CntItemPool* CntItemPool::_pThePool = NULL; + +//------------------------------------------------------------------------- +/*N*/ CntItemPool::CntItemPool() +/*N*/ : SfxItemPool( DEFINE_CONST_UNICODE("chaos"), WID_CHAOS_START, WID_CHAOS_START, NULL ), +/*N*/ _nRefs( 0 ) +/*N*/ { +/*N*/ SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); +/*N*/ +/*N*/ FreezeIdRanges(); +/*N*/ +/*N*/ // Create static defaults. +/*N*/ pPoolDefs_Impl = new CntStaticPoolDefaults_Impl( this ); +/*N*/ +/*N*/ // Set item infos. +/*N*/ SetItemInfos( pPoolDefs_Impl->GetItemInfos() ); +/*N*/ +/*N*/ // Set static pool default items. +/*N*/ SetDefaults( pPoolDefs_Impl->GetDefaults() ); +/*N*/ } + +//------------------------------------------------------------------------- +//virtual +/*N*/ CntItemPool::~CntItemPool() +/*N*/ { +/*N*/ // Release static pool default items. +/*N*/ ReleaseDefaults( sal_False ); +/*N*/ } + +//------------------------------------------------------------------------- +// static +/*N*/ CntItemPool* CntItemPool::Acquire() +/*N*/ { +/*N*/ if ( !_pThePool ) +/*N*/ _pThePool = new CntItemPool; +/*N*/ +/*N*/ _pThePool->_nRefs++; +/*N*/ +/*N*/ return _pThePool; +/*N*/ } + +//------------------------------------------------------------------------- +// static +/*N*/ sal_uInt16 CntItemPool::Release() +/*N*/ { +/*N*/ if ( !_pThePool ) +/*N*/ return 0; +/*N*/ +/*N*/ sal_uInt16& nRefs = _pThePool->_nRefs; +/*N*/ +/*N*/ if ( nRefs ) +/*N*/ --nRefs; +/*N*/ +/*N*/ if ( !nRefs ) +/*N*/ { +/*N*/ DELETEZ( _pThePool ); +/*N*/ DELETEZ( pPoolDefs_Impl ); +/*N*/ return 0; +/*N*/ } +/*N*/ +/*N*/ return nRefs; +/*N*/ } + +//========================================================================= +// +// CntStaticPoolDefaults_Impl implementation. +// +//========================================================================= + +/*?*/ inline void CntStaticPoolDefaults_Impl::Insert( +/*?*/ SfxPoolItem* pItem, /* Static Pool Default Item */ +/*?*/ sal_uInt16 nSID, sal_uInt16 nFlags /* Item Info */ ) +/*?*/ { +/*?*/ sal_uInt16 nPos = pItem->Which() - WID_CHAOS_START; +/*?*/ +/*?*/ m_ppDefaults[ nPos ] = pItem; +/*?*/ m_pItemInfos[ nPos ]._nSID = nSID; +/*?*/ m_pItemInfos[ nPos ]._nFlags = nFlags; +/*?*/ } + +//------------------------------------------------------------------------- +/*N*/ CntStaticPoolDefaults_Impl::~CntStaticPoolDefaults_Impl() +/*N*/ { +/*N*/ for ( sal_uInt32 n = 0; n < m_nItems; ++n ) +/*N*/ delete m_ppDefaults[ n ]; +/*N*/ +/*N*/ delete [] m_ppDefaults; +/*N*/ delete [] m_pItemInfos; +/*N*/ } + +//------------------------------------------------------------------------- +/*N*/ CntStaticPoolDefaults_Impl::CntStaticPoolDefaults_Impl( CntItemPool* pPool ) +/*N*/ : m_nItems( 1 ), +/*N*/ m_ppDefaults( new SfxPoolItem* [ m_nItems ] ), +/*N*/ m_pItemInfos( new SfxItemInfo [ m_nItems ] ) +/*N*/ { +/*N*/ rtl_zeroMemory( m_ppDefaults, sizeof( SfxPoolItem* ) * m_nItems ); +/*N*/ rtl_zeroMemory( m_pItemInfos, sizeof( SfxItemInfo ) * m_nItems ); +/*N*/ +/*N*/ Insert( +/*N*/ new SfxStringItem( WID_CHAOS_START, String() ), +/*N*/ 0, +/*N*/ SFX_ITEM_POOLABLE ); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/appbas.hxx b/binfilter/bf_sfx2/source/inc/appbas.hxx new file mode 100644 index 000000000000..2b8091f962dc --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/appbas.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_APPBAS_HXX +#define _SFX_APPBAS_HXX + + +#include "bf_basic/sbxdef.hxx" +namespace binfilter { + +class StarBASIC; +class SbxObject; + +//========================================================================= + +SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject, + const char *pName, ULONG nSID, SbxDataType eType=SbxOBJECT, + SbxClassType = SbxCLASS_PROPERTY ); + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/appdata.hxx b/binfilter/bf_sfx2/source/inc/appdata.hxx new file mode 100644 index 000000000000..6f82603cd936 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/appdata.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_APPDATA_HXX +#define _SFX_APPDATA_HXX + +#include <tools/link.hxx> +#include <tools/list.hxx> +#include <bf_svtools/lstner.hxx> +#include <vcl/timer.hxx> +#include <tools/string.hxx> +#include "rtl/ref.hxx" + +#include "bitset.hxx" +class SvStrings; +class Config; +class SvVerbList; +class SvtSaveOptions; +class SvtUndoOptions; +class SvtHelpOptions; + +namespace binfilter { + +class SvUShorts; +class SfxItemPool; +class SfxCancelManager; +class SfxApplication; + +class SfxBmkMenu; +class SfxProgress; +class SfxChildWinFactArr_Impl; +class SfxToolBoxConfig; +class SfxDdeDocTopics_Impl; +class SfxEventConfiguration; +class SfxMacroConfig; +class SfxInitLinkList; +class SfxFilterMatcher; +struct SfxFrameObjectFactoryPtr; +struct SfxPluginObjectFactoryPtr; +class ISfxTemplateCommon; +class SfxFilterMatcher; +class SfxStatusDispatcher; +class SfxMiscCfg; +class SfxDocumentTemplates; +class SfxFrameArr_Impl; +class SfxObjectFactory; +class SfxObjectShell; +namespace sfx2 { namespace appl { class ImeStatusWindow; } } + +//========================================================================= +// SfxAppData_Impl +//========================================================================= + +class SfxAppData_Impl +{ +public: + IndexBitSet aIndexBitSet; // for counting noname documents + + // single instance classes + SfxFrameObjectFactoryPtr* pSfxFrameObjectFactoryPtr; + + // special members + SfxInitLinkList* pInitLinkList; + + // application members + SfxFilterMatcher* pMatcher; + SfxCancelManager* pCancelMgr; + + // global pointers + SfxItemPool* pPool; + SfxEventConfiguration* pEventConfig; + SfxMiscCfg* pMiscConfig; + + // "current" functionality + SfxObjectShell* pThisDocument; + SfxProgress* pProgress; + + USHORT nBasicCallLevel; + USHORT nRescheduleLocks; + USHORT nInReschedule; + + ::rtl::Reference< sfx2::appl::ImeStatusWindow > m_xImeStatusWindow; + + BOOL bInQuit : 1; + BOOL bInException : 1; + BOOL bOLEResize : 1; + + SfxAppData_Impl( SfxApplication* ); + ~SfxAppData_Impl(); +}; + +}//end of namespace binfilter +#endif // #ifndef _SFX_APPDATA_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/brokenpackageint.hxx b/binfilter/bf_sfx2/source/inc/brokenpackageint.hxx new file mode 100644 index 000000000000..3d96cc3bf14e --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/brokenpackageint.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <framework/interaction.hxx> +namespace binfilter { + +using namespace ::framework; +typedef ContinuationBase< ::com::sun::star::task::XInteractionApprove > SfxContinuationApprove; +typedef ContinuationBase< ::com::sun::star::task::XInteractionDisapprove > SfxContinuationDisapprove; + +}//end of namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/cfgmgr.hxx b/binfilter/bf_sfx2/source/inc/cfgmgr.hxx new file mode 100644 index 000000000000..69e10f46f624 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/cfgmgr.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXCFGMGR_HXX +#define _SFXCFGMGR_HXX + +#include <bf_so3/svstor.hxx> +class SvStream; +class String; +namespace binfilter { + +class SfxObjectShell; +class SfxConfigItem; +class SfxConfigItemArr_Impl; +struct SfxConfigItem_Impl; +class SfxConfigManager +{ +private: + SotStorageRef m_xStorage; + SfxObjectShell* pObjShell; + SfxConfigItemArr_Impl* pItemArr; + USHORT nErrno; + BOOL bModified; + + // to prevent from using + SfxConfigManager( const SfxConfigManager& ); + const SfxConfigManager& operator=( const SfxConfigManager& ); + + BOOL LoadConfiguration( SotStorage& rStorage ); + BOOL StoreConfiguration_Impl( SotStorage* pStorage=NULL ); + +public: + enum Error { + ERR_NO, + ERR_READ, + ERR_WRITE, + ERR_OPEN, + ERR_FILETYPE, + ERR_VERSION, + ERR_IMPORT, + ERR_EXPORT + }; + + static String GetStorageName(); + static BOOL HasConfiguration( SotStorage& rStorage ); + + // construct a configmanager from a storage + // pStor == NULL means default config manager ( soffice.cfg ) + SfxConfigManager( SotStorage* pStor = NULL ); + + // construct a configmanager from a documents' storage + SfxConfigManager( SfxObjectShell& rDoc ); + ~SfxConfigManager(); + + SotStorage* GetConfigurationStorage( SotStorage* ); + + void AddConfigItem( SfxConfigItem& rCItem ); + void RemoveConfigItem( SfxConfigItem& rCItem ); + SfxConfigItem* GetNextItem( SfxConfigItem& rCItem ); + USHORT GetErrorCode() + { return nErrno; } + + // store the whole configuration into a storage + // pStore == NULL means store into own storage + BOOL StoreConfiguration( SotStorage* pStorage=NULL ); + + BOOL LoadConfigItem( SfxConfigItem& ); + BOOL StoreConfigItem( SfxConfigItem& ); + BOOL StoreAlwaysConfigItem( SfxConfigItem& ); + + // Reload all items using a special stream + void ReInitialize( const String& rStreamName ); + + void SetModified(BOOL); + BOOL IsModified() + { return bModified; } + SfxObjectShell* GetObjectShell() const + { return pObjShell; } +}; + +}//end of namespace binfilter +#endif // #ifndef _SFXCFGMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/conttrans.hxx b/binfilter/bf_sfx2/source/inc/conttrans.hxx new file mode 100644 index 000000000000..c89319f0b8c8 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/conttrans.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONTTRANS_HXX +#define _CONTTRANS_HXX + +// interfaces and structs +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/ucb/XContentTransmitter.hpp> + +// helper classes and functions +#include <cppuhelper/implbase2.hxx> +#include <uno/dispatcher.h> +#include <uno/mapping.hxx> +#include <cppuhelper/factory.hxx> + + +#include <rtl/ustrbuf.hxx> +#include <bf_svtools/lstner.hxx> +namespace binfilter { + +//========================================================================= + +#define CT_SERVICE_NAME L"com.sun.star.ucb.ContentTransmitter" +#define FLAG_SET_READONLY 0x01 +#define FLAG_NOTIFY_ANCHOR 0x02 + +//========================================================================= + +class ContentTransmitter : public SfxListener, + public cppu::WeakImplHelper2< + ::com::sun::star::ucb::XContentTransmitter, + ::com::sun::star::lang::XServiceInfo > +{ + ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > m_xFact; + ::rtl::OUString m_aSource; + ::rtl::OUString m_aDest; + long m_nFlags; + +public: + + ContentTransmitter( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& rFact ) + : m_xFact( rFact ) + {} + + // SfxListener + virtual void + Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XContentTransmitter + virtual void SAL_CALL + transmit( const ::rtl::OUString& Source, + const ::rtl::OUString& Destination, + long Flags ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL + getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // static Helper functions + static ::com::sun::star::uno::Sequence< ::rtl::OUString > + getSupportedServiceNames_Static(); + + static ::rtl::OUString + getImplementationName_Static() { return CT_SERVICE_NAME; } + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > + createServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ); +}; + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/dinfobj.hxx b/binfilter/bf_sfx2/source/inc/dinfobj.hxx new file mode 100644 index 000000000000..dcf42b05b9a3 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/dinfobj.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_DINFOBJ_HXX +#define _SFX_DINFOBJ_HXX + + +#include <bf_so3/auto.hxx> +#include "docinf.hxx" +#include "dinfdlg.hxx" +namespace binfilter { + +class SfxMedium; + +//========================================================================= + +class SfxDocumentInfoObject_Impl: public SvDispatch +{ + SfxDocumentInfoItem aDocInfo; + SfxMedium* pMedium; + +protected: + SvGlobalName GetTypeName() const; + BOOL FillTypeLibInfo( String * pName, + USHORT * pMajor, USHORT * pMinor ) const; + +public: + SfxDocumentInfoObject_Impl(); + ~SfxDocumentInfoObject_Impl(); + + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +}; + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/dlgcont.hxx b/binfilter/bf_sfx2/source/inc/dlgcont.hxx new file mode 100644 index 000000000000..dc829adc0dec --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/dlgcont.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_DLGCONT_HXX +#define _SFX_DLGCONT_HXX + +#include <namecont.hxx> +#include <tools/debug.hxx> //for strip +namespace binfilter { + +//============================================================================ + +class SfxDialogLibraryContainer : public SfxLibraryContainer_Impl +{ + // Methods to distinguish between different library types + virtual SfxLibrary_Impl* SAL_CALL implCreateLibrary( void ); + virtual SfxLibrary_Impl* SAL_CALL implCreateLibraryLink + ( const ::rtl::OUString& aLibInfoFileURL, + const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ); + virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ); + virtual sal_Bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ); + virtual void SAL_CALL writeLibraryElement + ( + ::com::sun::star::uno::Any aElement, + const ::rtl::OUString& aElementName, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + ) + throw(::com::sun::star::uno::Exception); + virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement + ( const ::rtl::OUString& aFile, SotStorageStreamRef xElementStream ); + virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ); + + virtual SfxLibraryContainer_Impl* createInstanceImpl( void ){DBG_BF_ASSERT(0, "STRIP");return NULL;}//STRIP001 virtual SfxLibraryContainer_Impl* createInstanceImpl( void ); + + sal_Bool init( const ::rtl::OUString& aInitialisationParam, + SotStorage* pStor=NULL ); + +public: + SfxDialogLibraryContainer( void ); + SfxDialogLibraryContainer( SotStorage* pStor ); + + // Methods XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + + // Service + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); + static ::rtl::OUString impl_getStaticImplementationName(); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) + throw( ::com::sun::star::uno::Exception ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + +}; + +// class to represent application container service +class SfxApplicationDialogLibraryContainer +{ +public: + // Service + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); + static ::rtl::OUString impl_getStaticImplementationName(); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) + throw( ::com::sun::star::uno::Exception ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + +}; + + +//============================================================================ + +class SfxDialogLibrary : public SfxLibrary_Impl +{ +public: + SfxDialogLibrary + ( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI + ); + + SfxDialogLibrary + ( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI, + const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly + ); +}; + +}//end of namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/doctemplates.hxx b/binfilter/bf_sfx2/source/inc/doctemplates.hxx new file mode 100644 index 000000000000..a2c9c4e0ac99 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/doctemplates.hxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_DOCTEMPLATES_HXX_ +#define _SFX_DOCTEMPLATES_HXX_ + +#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase3.hxx> + +#include <com/sun/star/container/XNameAccess.hpp> + +#include <com/sun/star/frame/XDocumentTemplates.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/XLocalizable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <com/sun/star/ucb/XContent.hpp> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <ucbhelper/content.hxx> + +#include <sfxuno.hxx> +namespace binfilter { + +//-------------------------------------------------------------------------------------------------------- + +#define LOCALE ::com::sun::star::lang::Locale +#define REFERENCE ::com::sun::star::uno::Reference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define XCONTENT ::com::sun::star::ucb::XContent +#define XDOCUMENTTEMPLATES ::com::sun::star::frame::XDocumentTemplates +#define XINTERFACE ::com::sun::star::uno::XInterface +#define XLOCALIZABLE ::com::sun::star::lang::XLocalizable +#define XMODEL ::com::sun::star::frame::XModel +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XNAMEACCESS ::com::sun::star::container::XNameAccess +#define XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define XSTORABLE ::com::sun::star::frame::XStorable + +//-------------------------------------------------------------------------------------------------------- + +class SfxDocTplService_Impl; + +class SfxDocTplService: public ::cppu::WeakImplHelper3< XLOCALIZABLE, XDOCUMENTTEMPLATES, XSERVICEINFO > +{ + SfxDocTplService_Impl *pImp; + +public: + SFX_DECL_XSERVICEINFO + + SfxDocTplService( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + ~SfxDocTplService(); + + // --- XLocalizable --- + void SAL_CALL setLocale( const LOCALE & eLocale ) throw( RUNTIMEEXCEPTION ); + LOCALE SAL_CALL getLocale() throw( RUNTIMEEXCEPTION ); + + // --- XDocumentTemplates --- + REFERENCE< XCONTENT > SAL_CALL getContent() throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL storeTemplate( const ::rtl::OUString& GroupName, + const ::rtl::OUString& TemplateName, + const REFERENCE< XSTORABLE >& Storable ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL addTemplate( const ::rtl::OUString& GroupName, + const ::rtl::OUString& TemplateName, + const ::rtl::OUString& SourceURL ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL removeTemplate( const ::rtl::OUString& GroupName, + const ::rtl::OUString& TemplateName ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL renameTemplate( const ::rtl::OUString& GroupName, + const ::rtl::OUString& OldTemplateName, + const ::rtl::OUString& NewTemplateName ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL addGroup( const ::rtl::OUString& GroupName ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL removeGroup( const ::rtl::OUString& GroupName ) throw( RUNTIMEEXCEPTION ); + sal_Bool SAL_CALL renameGroup( const ::rtl::OUString& OldGroupName, + const ::rtl::OUString& NewGroupName ) throw( RUNTIMEEXCEPTION ); + void SAL_CALL update() throw( RUNTIMEEXCEPTION ); +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/eacopier.hxx b/binfilter/bf_sfx2/source/inc/eacopier.hxx new file mode 100644 index 000000000000..d850aee3be4a --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/eacopier.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_EACOPIER_HXX +#define _SFX_EACOPIER_HXX + +#include <tools/eacopier.hxx> +namespace binfilter { +class SvFileStream; + +// class SfxEA_Copier ---------------------------------------------------- + +class SfxEA_Copier : public EA_Copier +{ +public: + SfxEA_Copier() { Register( this ); } + ~SfxEA_Copier() { Register( NULL ); } + + virtual BOOL Copy( const SvFileStream& rFrom, const SvFileStream& rTo ) const; +}; + +}//end of namespace binfilter +#endif // #ifndef _SFX_EACOPIER_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/eventsupplier.hxx b/binfilter/bf_sfx2/source/inc/eventsupplier.hxx new file mode 100644 index 000000000000..10c51c70aa3b --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/eventsupplier.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_EVENTSUPPLIER_HXX_ +#define _SFX_EVENTSUPPLIER_HXX_ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/task/XJobExecutor.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Type.hxx> + +#include <sal/types.h> +#include <osl/mutex.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> + +#include <sfxuno.hxx> + +#include <osl/mutex.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <bf_svtools/lstner.hxx> +namespace binfilter { + +class SvxMacro; + +//-------------------------------------------------------------------------------------------------------- + +#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException +#define XNAMEREPLACE ::com::sun::star::container::XNameReplace +#define DOCEVENTOBJECT ::com::sun::star::document::EventObject +#define XEVENTBROADCASTER ::com::sun::star::document::XEventBroadcaster +#define XDOCEVENTLISTENER ::com::sun::star::document::XEventListener +#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier +#define XJOBEXECUTOR ::com::sun::star::task::XJobExecutor +#define EVENTOBJECT ::com::sun::star::lang::EventObject +#define ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException +#define WRAPPEDTARGETEXCEPTION ::com::sun::star::lang::WrappedTargetException +#define ANY ::com::sun::star::uno::Any +#define REFERENCE ::com::sun::star::uno::Reference +#define WEAKREFERENCE ::com::sun::star::uno::WeakReference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define SEQUENCE ::com::sun::star::uno::Sequence +#define UNOTYPE ::com::sun::star::uno::Type +#define OUSTRING ::rtl::OUString +#define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper + +//-------------------------------------------------------------------------------------------------------- + +class SfxObjectShell; +class SfxBaseModel; + +//-------------------------------------------------------------------------------------------------------- + +class SfxEvents_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameReplace, ::com::sun::star::document::XEventListener > +{ + SEQUENCE< OUSTRING > maEventNames; + SEQUENCE< ANY > maEventData; + REFERENCE< XEVENTBROADCASTER > mxBroadcaster; + ::osl::Mutex maMutex; + SfxObjectShell *mpObjShell; + + +public: + SfxEvents_Impl( SfxObjectShell* pShell, + REFERENCE< XEVENTBROADCASTER > xBroadcaster ); + ~SfxEvents_Impl(); + + // --- XNameReplace --- + virtual void SAL_CALL replaceByName( const OUSTRING & aName, const ANY & aElement ) + throw( ILLEGALARGUMENTEXCEPTION, NOSUCHELEMENTEXCEPTION, + WRAPPEDTARGETEXCEPTION, RUNTIMEEXCEPTION ); + + // --- XNameAccess ( parent of XNameReplace ) --- + virtual ANY SAL_CALL getByName( const OUSTRING& aName ) + throw( NOSUCHELEMENTEXCEPTION, WRAPPEDTARGETEXCEPTION, + RUNTIMEEXCEPTION ); + virtual SEQUENCE< OUSTRING > SAL_CALL getElementNames() throw ( RUNTIMEEXCEPTION ); + virtual sal_Bool SAL_CALL hasByName( const OUSTRING& aName ) throw ( RUNTIMEEXCEPTION ); + + // --- XElementAccess ( parent of XNameAccess ) --- + virtual UNOTYPE SAL_CALL getElementType() throw ( RUNTIMEEXCEPTION ); + virtual sal_Bool SAL_CALL hasElements() throw ( RUNTIMEEXCEPTION ); + + // --- ::document::XEventListener --- + virtual void SAL_CALL notifyEvent( const DOCEVENTOBJECT& aEvent ) + throw( RUNTIMEEXCEPTION ); + + // --- ::lang::XEventListener --- + virtual void SAL_CALL disposing( const EVENTOBJECT& Source ) + throw( RUNTIMEEXCEPTION ); + + static SvxMacro* ConvertToMacro( const ANY& rElement, SfxObjectShell* pDoc, BOOL bBlowUp ); + static void BlowUpMacro( const ANY& rIn, ANY& rOut, SfxObjectShell* pDoc ); +}; + +class SfxGlobalEvents_Impl : public ::cppu::WeakImplHelper3< ::com::sun::star::document::XEventsSupplier, + ::com::sun::star::document::XEventBroadcaster, ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ + SfxEvents_Impl* pImp; + REFERENCE < XNAMEREPLACE > m_xEvents; + WEAKREFERENCE < XJOBEXECUTOR > m_xJobsBinding; + OINTERFACECONTAINERHELPER m_aInterfaceContainer; + ::osl::Mutex m_aMutex; + + void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ); +public: + SfxGlobalEvents_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSmgr ); + ~SfxGlobalEvents_Impl(); + SFX_DECL_XSERVICEINFO + virtual REFERENCE< XNAMEREPLACE > SAL_CALL getEvents() throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL addEventListener( const REFERENCE< XDOCEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL removeEventListener( const REFERENCE< XDOCEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) {DBG_BF_ASSERT(0, "STRIP");}//STRIP001 virtual void SAL_CALL removeEventListener( const REFERENCE< XDOCEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/fltfnc.hxx b/binfilter/bf_sfx2/source/inc/fltfnc.hxx new file mode 100644 index 000000000000..82ed4c326d00 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/fltfnc.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXFLTFNC_HXX +#define _SFXFLTFNC_HXX + +#include "fcontnr.hxx" +namespace binfilter { + +BOOL SfxIsHelpEntryURL( const String &rURL, const String &rExtMask ); + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/fltoptint.hxx b/binfilter/bf_sfx2/source/inc/fltoptint.hxx new file mode 100644 index 000000000000..12db9b12dc06 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/fltoptint.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/document/XInteractionFilterOptions.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include <framework/interaction.hxx> + +using namespace ::framework; +namespace binfilter { + +class FilterOptionsContinuation : public ContinuationBase< ::com::sun::star::document::XInteractionFilterOptions > +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties; + +public: + virtual void SAL_CALL setFilterOptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProp ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getFilterOptions( ) throw (::com::sun::star::uno::RuntimeException); +}; + +class RequestFilterOptions : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +{ + ::com::sun::star::uno::Any m_aRequest; + + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > + > m_lContinuations; + + ContinuationAbort* m_pAbort; + + FilterOptionsContinuation* m_pOptions; + +public: + RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties ); + + sal_Bool isAbort() { return m_pAbort->isSelected(); } + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getFilterOptions() + { + return m_pOptions->getFilterOptions(); + } + + virtual ::com::sun::star::uno::Any SAL_CALL getRequest() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > + > SAL_CALL getContinuations() + throw( ::com::sun::star::uno::RuntimeException ); +}; +}//end of namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/helper.hxx b/binfilter/bf_sfx2/source/inc/helper.hxx new file mode 100644 index 000000000000..e808cb8c2c69 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/helper.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_HELPER_HXX +#define _SFX_HELPER_HXX + +// include --------------------------------------------------------------- + +#include <com/sun/star/uno/Sequence.hxx> + +class String; + + + +namespace binfilter { + +// class SfxContentHelper ------------------------------------------------ + +class SfxContentHelper +{ +private: + +public: + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > + GetResultSet( const String& rURL ); + static String GetActiveHelpString( const String& rURL ); + + + + // please don't use this! +}; + +}//end of namespace binfilter +#endif // #ifndef _SFX_HELPER_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/namecont.hxx b/binfilter/bf_sfx2/source/inc/namecont.hxx new file mode 100644 index 000000000000..c640da938e65 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/namecont.hxx @@ -0,0 +1,504 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_NAMECONT_HXX +#define _SFX_NAMECONT_HXX + +#include <hash_map> + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/script/XLibraryContainer2.hpp> +#include <com/sun/star/script/XLibraryContainerPassword.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> + +#include <osl/mutex.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <bf_so3/svstor.hxx> +#include <xmlscript/xmllib_imexp.hxx> + +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase4.hxx> +namespace binfilter { + +class BasicManager; + +typedef ::cppu::WeakImplHelper4< + ::com::sun::star::lang::XInitialization, + ::com::sun::star::script::XLibraryContainer2, + ::com::sun::star::script::XLibraryContainerPassword, + ::com::sun::star::container::XContainer > LibraryContainerHelper; + + +namespace SfxContainer_Impl +{ + +typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XContainer > NameContainerHelper; + + +struct hashName_Impl +{ + size_t operator()(const ::rtl::OUString Str) const + { + return (size_t)Str.hashCode(); + } +}; + +struct eqName_Impl +{ + sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const + { + return ( Str1 == Str2 ); + } +}; + +typedef std::hash_map +< + ::rtl::OUString, + sal_Int32, + hashName_Impl, + eqName_Impl +> +NameContainerNameMap; + + + +//============================================================================ + +struct MutexHolder +{ + ::osl::Mutex mMutex; +}; + +class NameContainer_Impl : public MutexHolder, public NameContainerHelper +{ + NameContainerNameMap mHashMap; + ::com::sun::star::uno::Sequence< ::rtl::OUString > mNames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues; + sal_Int32 mnElementCount; + + ::com::sun::star::uno::Type mType; + ::com::sun::star::uno::XInterface* mpxEventSource; + + ::cppu::OInterfaceContainerHelper maListenerContainer; + +public: + NameContainer_Impl( const ::com::sun::star::uno::Type& rType ) + : mType( rType ) + , mpxEventSource( NULL ) + , mnElementCount( 0 ) + , maListenerContainer( mMutex ) + {} + + void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource ) + { mpxEventSource = pxEventSource; } + + // Methods XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) + throw(::com::sun::star::uno::RuntimeException); + + // Methods XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // Methods XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // Methods XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // Methods XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + +}; + +} // namespace SfxContainer_Impl + + +//============================================================================ + +class SfxLibrary_Impl; + + +enum InitMode +{ + DEFAULT, + CONTAINER_INIT_FILE, + LIBRARY_INIT_FILE, + OFFICE_DOCUMENT, + OLD_BASIC_STORAGE +}; + +class SfxLibraryContainer_Impl : public LibraryContainerHelper +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubstitution; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander > mxMacroExpander; + + SfxContainer_Impl::NameContainer_Impl maNameContainer; + sal_Bool mbModified; + sal_Bool mbOldInfoFormat; + + ::rtl::OUString maInitialisationParam; + ::rtl::OUString maInfoFileName; + ::rtl::OUString maOldInfoFileName; + ::rtl::OUString maLibElementFileExtension; + ::rtl::OUString maLibraryPath; + ::rtl::OUString maLibrariesDir; + + SotStorageRef mxStorage; + BasicManager* mpBasMgr; + sal_Bool mbOwnBasMgr; + + InitMode meInitMode; + + void implStoreLibraryIndexFile( SfxLibrary_Impl* pLib, + const ::xmlscript::LibDescriptor& rLib, SotStorageRef xStorage ); + sal_Bool implLoadLibraryIndexFile( SfxLibrary_Impl* pLib, ::xmlscript::LibDescriptor& rLib, + SotStorageRef xStorage, const ::rtl::OUString& aIndexFileName ); + void implImportLibDescriptor( SfxLibrary_Impl* pLib, ::xmlscript::LibDescriptor& rLib ); + + // Methods to distinguish between deffirent library types + virtual SfxLibrary_Impl* SAL_CALL implCreateLibrary( void ) = 0; + virtual SfxLibrary_Impl* SAL_CALL implCreateLibraryLink + ( const ::rtl::OUString& aLibInfoFileURL, + const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0; + virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0; + virtual sal_Bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) = 0; + virtual void SAL_CALL writeLibraryElement + ( + ::com::sun::star::uno::Any aElement, + const ::rtl::OUString& aElementName, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + ) + throw(::com::sun::star::uno::Exception) = 0; + + virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement + ( const ::rtl::OUString& aFile, SotStorageStreamRef xElementStream ) = 0; + virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0; + + void implStoreLibrary( SfxLibrary_Impl* pLib, + const ::rtl::OUString& aName, SotStorageRef xStorage ); + + // Password encryption + virtual sal_Bool implStorePasswordLibrary( SfxLibrary_Impl* pLib, const ::rtl::OUString& aName, + SotStorageRef xStorage ); + virtual sal_Bool implLoadPasswordLibrary( SfxLibrary_Impl* pLib, const ::rtl::OUString& Name, + sal_Bool bVerifyPasswordOnly=false ) + throw(::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // #56666, Creates another library container + // instance of the same derived class + virtual SfxLibraryContainer_Impl* createInstanceImpl( void ) = 0; + + + // Interface to get the BasicManager (Hack for password implementation) + BasicManager* getBasicManager( void ) { return mpBasMgr; } + ::rtl::OUString createAppLibraryFolder( SfxLibrary_Impl* pLib, const ::rtl::OUString& aName ); + + sal_Bool init( const ::rtl::OUString& aInitialisationParam, + const ::rtl::OUString& aInfoFileName, + const ::rtl::OUString& aOldInfoFileName, + const ::rtl::OUString& aLibElementFileExtension, + const ::rtl::OUString& aLibrariesDir, + SotStorageRef xStorage ); + + // Handle maLibInfoFileURL and maStorageURL correctly + void checkStorageURL + ( + const ::rtl::OUString& aSourceURL, + ::rtl::OUString& aLibInfoFileURL, + ::rtl::OUString& aStorageURL, + ::rtl::OUString& aUnexpandedStorageURL + ); + ::rtl::OUString expand_url( const ::rtl::OUString& url ) + throw(::com::sun::star::uno::RuntimeException); + + SfxLibrary_Impl* getImplLib( const String& rLibraryName ); + +public: + SfxLibraryContainer_Impl( void ); + ~SfxLibraryContainer_Impl(); + + // Interface to release and reset storage for saving + void setStorage( SotStorageRef xStorage ) + { + mxStorage = xStorage; + } + + // Interface to set the BasicManager (Hack for password implementation) + void setBasicManager( BasicManager* pBasMgr ) + { + mpBasMgr = pBasMgr; + } + + // TODO: Methods of new XLibraryStorage interface? + virtual void SAL_CALL storeLibraries( sal_Bool bComplete ); + virtual void SAL_CALL storeLibrariesToStorage( SotStorageRef xStorage ); + virtual void SAL_CALL storeLibraries_Impl( SotStorageRef xStorage, sal_Bool bComplete ); + + // Methods XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() + throw(::com::sun::star::uno::RuntimeException); + + // Methods XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // Methods XLibraryContainer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL + createLibrary( const ::rtl::OUString& Name ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink + ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // Methods XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException) = 0; + + // Methods XLibraryContainer2 + virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::uno::RuntimeException); + + // Methods XLibraryContainerPassword + virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name, + const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // Methods XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); +}; + + +//============================================================================ + +struct OLibraryMutex +{ + ::osl::Mutex m_mutex; +}; + +class SfxLibrary_Impl + : public ::com::sun::star::container::XNameContainer + , public ::com::sun::star::container::XContainer + , public OLibraryMutex + , public ::cppu::OComponentHelper +{ + friend class SfxLibraryContainer_Impl; + friend class SfxScriptLibraryContainer; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI; + + SfxContainer_Impl::NameContainer_Impl maNameContainer; + + sal_Bool mbLoaded; + sal_Bool mbModified; + sal_Bool mbInitialised; + + ::rtl::OUString maLibElementFileExtension; + ::rtl::OUString maLibInfoFileURL; + ::rtl::OUString maStorageURL; + ::rtl::OUString maUnexpandedStorageURL; + sal_Bool mbLink; + sal_Bool mbReadOnly; + sal_Bool mbReadOnlyLink; + + sal_Bool mbPasswordProtected; + sal_Bool mbPasswordVerified; + sal_Bool mbDoc50Password; + ::rtl::OUString maPassword; + + sal_Bool mbSharedIndexFile; + + +public: + SfxLibrary_Impl( ::com::sun::star::uno::Type aType, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI ); + SfxLibrary_Impl( ::com::sun::star::uno::Type aType, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI, + const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly ); + + + // Methods XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } + virtual void SAL_CALL release() throw() { OComponentHelper::release(); } + + // Methods XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) + throw(::com::sun::star::uno::RuntimeException); + + // Methods XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // Methods XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // Methods XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) + throw( ::com::sun::star::uno::RuntimeException ); + ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) + throw( ::com::sun::star::uno::RuntimeException ); + + // Methods XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); +}; + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/nochaos.hxx b/binfilter/bf_sfx2/source/inc/nochaos.hxx new file mode 100644 index 000000000000..c31cc5d85c2d --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/nochaos.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_NOCHAOS_HXX +#define _SFX_NOCHAOS_HXX +namespace binfilter { + +class SfxItemPool; + +class NoChaos +{ +public: + static SfxItemPool* GetItemPool(); + static USHORT ReleaseItemPool(); +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/objshimp.hxx b/binfilter/bf_sfx2/source/inc/objshimp.hxx new file mode 100644 index 000000000000..233e7efdc5e3 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/objshimp.hxx @@ -0,0 +1,201 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_OBJSHIMP_HXX +#define _SFX_OBJSHIMP_HXX + +#include <com/sun/star/frame/XModel.hpp> +#include <tools/datetime.hxx> + +#include <bf_svtools/securityoptions.hxx> +#include "objsh.hxx" +#include "bitset.hxx" + +namespace binfilter { + +class AsynchronLink; +//==================================================================== + +DBG_NAMEEX(SfxObjectShell)//STRIP008 ; + +class SfxViewFrame; +struct MarkData_Impl +{ + String aMark; + String aUserData; + SfxViewFrame* pFrame; +}; + +class SfxFrame; +class SfxDialogLibraryContainer; +class SfxScriptLibraryContainer; +class SfxImageManager; +class SfxToolBoxConfig; +struct SfxObjectShell_Impl +{ + SfxDocumentInfo* pDocInfo; + SfxConfigManager* pCfgMgr; + SfxInPlaceObject* pInPlaceObj; // das dazugeh"orige SO2-Objekt, falls this ein SfxInPlaceObject ist + BasicManager* pBasicMgr; // Doc-BASIC oder 0 + SfxScriptLibraryContainer* pBasicLibContainer; + SfxDialogLibraryContainer* pDialogLibContainer; + SfxProgress* pProgress; + String aTitle; + String aTempName; + DateTime nTime; + sal_uInt16 nVisualDocumentNumber; + sal_Bool bTemplateConfig:1, + bInList:1, // ob per First/Next erreichbar + bClosing:1, // sal_True w"aehrend Close(), um Benachrichtigungs-Rekursionen zu verhindern + bSetInPlaceObj:1, // sal_True, falls bereits versucht wurde pInPlaceObject zu casten + bIsSaving:1, + bPasswd:1, + bIsTmp:1, + bIsNamedVisible:1, + bDidWarnFormat:1, // sal_True, falls schon wg. speichern in Fremformat gewarnt wurde + bSetStandardName:1, // sal_True, falls im FileSave Dialog xxxx.sdw im Standardverzeichnis vorgeschlagen werden soll. + bDidDangerousSave:1, // sal_True, falls ein Save in ein Alienformat durchgefuehrt wurde + bIsTemplate:1, + bIsAbortingImport:1, // Importvorgang soll abgebrochen werden. + bImportDone : 1, //Import schon fertig? Fuer AutoReload von Docs. + bInPrepareClose : 1, + bPreparedForClose : 1, + bWaitingForPicklist : 1,// Muss noch in die Pickliste + bModuleSearched : 1, + bIsBasicDefault : 1, + bIsHelpObjSh : 1, + bForbidCaching : 1, + bForbidReload : 1, + bSupportsEventMacros: 1, + bLoadingWindows: 1, + bBasicInitialized :1, + bHidden :1; // indicates a hidden view shell + + + String aNewName; // Der Name, unter dem das Doc gespeichert + // werden soll + IndexBitSet aBitSet; + sal_uInt32 lErr; + sal_uInt16 nEventId; // falls vor Activate noch ein + // Open/Create gesendet werden mu/s + sal_Bool bDoNotTouchDocInfo; + + AutoReloadTimer_Impl *pReloadTimer; + MarkData_Impl* pMarkData; + sal_uInt16 nLoadedFlags; + String aMark; + Size aViewSize; // wird leider vom Writer beim + sal_Bool bInFrame; // HTML-Import gebraucht + sal_Bool bModalMode; + sal_Bool bRunningMacro; + sal_Bool bReloadAvailable; + sal_uInt16 nAutoLoadLocks; + SfxModule* pModule; + SfxFrame* pFrame; + SfxImageManager* pImageManager; + SfxToolBoxConfig* pTbxConfig; + SfxEventConfigItem_Impl* pEventConfig; + SfxObjectShellFlags eFlags; + AsynchronLink* pCloser; + String aBaseURL; + sal_Bool bReadOnlyUI; + SvRefBaseRef xHeaderAttributes; + sal_Bool bHiddenLockedByAPI; + sal_Bool bInCloseEvent; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel; + sal_uInt16 nStyleFilter; + sal_Int16 nMacroMode; + sal_Bool bDisposing; + + SfxObjectShell_Impl() : + nTime(), + bIsTmp( sal_False), + bClosing( sal_False), + bSetInPlaceObj( sal_False), + bPasswd( sal_False), + pInPlaceObj( 0), + pBasicMgr( 0), + pBasicLibContainer( 0 ), + pDialogLibContainer( 0 ), + pProgress( 0), + nVisualDocumentNumber( USHRT_MAX), + bIsSaving( sal_False), + bIsNamedVisible( sal_False), + pCfgMgr( 0), + bTemplateConfig( sal_False), + bDidWarnFormat( sal_False), + bDidDangerousSave(sal_False), + bIsBasicDefault( sal_True ), + bIsTemplate(sal_False), + lErr(ERRCODE_NONE), + nEventId ( 0), + pDocInfo ( 0), + bIsAbortingImport ( sal_False), + bInList ( sal_False), + bImportDone ( sal_False), + pReloadTimer ( 0), + nLoadedFlags ( SFX_LOADED_MAINDOCUMENT ), + pMarkData( 0 ), + bInFrame( sal_False ), + bModalMode( sal_False ), + bRunningMacro( sal_False ), + bReloadAvailable( sal_False ), + nAutoLoadLocks( 0 ), + bInPrepareClose( sal_False ), + bPreparedForClose( sal_False ), + bWaitingForPicklist( sal_False ), + pModule( 0 ), + bModuleSearched( sal_False ), + pFrame( 0 ), + pImageManager( 0 ), + pTbxConfig( 0 ), + pEventConfig(NULL), + bIsHelpObjSh( sal_False ), + bForbidCaching( sal_False ), + bDoNotTouchDocInfo( sal_False ), + bForbidReload( sal_False ), + bBasicInitialized( sal_False ), + eFlags( SFXOBJECTSHELL_UNDEFINED ), + pCloser( 0 ), + bSupportsEventMacros( sal_True ), + bReadOnlyUI( sal_False ), + bHiddenLockedByAPI( sal_False ), + bInCloseEvent( sal_False ), + bLoadingWindows( sal_False ), + bHidden( sal_False ) + , nStyleFilter( 0 ) + , nMacroMode( -1 ) + , bDisposing( sal_False ) + {} + ~SfxObjectShell_Impl(); + +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/openflag.hxx b/binfilter/bf_sfx2/source/inc/openflag.hxx new file mode 100644 index 000000000000..4263e6779b37 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/openflag.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_OPENFLAG_HXX +#define _SFX_OPENFLAG_HXX +namespace binfilter { + +// Datei zum Bearbeiten "offnen, anschliessend funktioniert nur noch +// die dritte Variante (Lesen einer Kopie) +#define SFX_STREAM_READWRITE (STREAM_READWRITE | STREAM_SHARE_DENYWRITE) +// Ich arbeite roh auf dem Original, keine Kopie +// -> Datei kann anschliessend nicht zum Bearbeiten ge"offnet werden +#define SFX_STREAM_READONLY (STREAM_READ | STREAM_SHARE_DENYWRITE) // + !bDirect +// Jemand anders bearbeitet das File, es wird eine Kopie erstellt +// -> Datei kann anschliessend zum Bearbeiten ge"offnet werden +#define SFX_STREAM_READONLY_MAKECOPY (STREAM_READ | STREAM_SHARE_DENYNONE) + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/referers.hxx b/binfilter/bf_sfx2/source/inc/referers.hxx new file mode 100644 index 000000000000..9c968cb329ae --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/referers.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_REFERERS_HXX +#define _SFX_REFERERS_HXX +namespace binfilter { + +#define SFX_REFERER_USER "private:user" +#define SFX_REFERER_APPEVENT "private:appevent" +#define SFX_REFERER_EXPLORER "private:explorer" +#define SFX_REFERER_NEWMENU "private:newmenu" + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/scriptcont.hxx b/binfilter/bf_sfx2/source/inc/scriptcont.hxx new file mode 100644 index 000000000000..8af1fa12c4e2 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/scriptcont.hxx @@ -0,0 +1,173 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#ifndef _SFX_SCRIPTCONT_HXX +#define _SFX_SCRIPTCONT_HXX + +#include <bf_basic/basmgr.hxx> +class BasicManager; +namespace binfilter { + + +//============================================================================ + + +class SfxScriptLibraryContainer : public SfxLibraryContainer_Impl, public OldBasicPassword +{ + ::rtl::OUString maScriptLanguage; + BasicManager* mpBasMgr; + + // Methods to distinguish between deffirent library types + virtual SfxLibrary_Impl* SAL_CALL implCreateLibrary( void ); + virtual SfxLibrary_Impl* SAL_CALL implCreateLibraryLink + ( const ::rtl::OUString& aLibInfoFileURL, + const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ); + virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ); + virtual sal_Bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ); + virtual void SAL_CALL writeLibraryElement + ( + ::com::sun::star::uno::Any aElement, + const ::rtl::OUString& aElementName, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + ) + throw(::com::sun::star::uno::Exception); + virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement + ( const ::rtl::OUString& aFile, SotStorageStreamRef xElementStream ); + virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ); + + virtual SfxLibraryContainer_Impl* createInstanceImpl( void ){DBG_BF_ASSERT(0, "STRIP");return NULL;}//STRIP001 virtual SfxLibraryContainer_Impl* createInstanceImpl( void ); + + + // Password encryption + virtual sal_Bool implStorePasswordLibrary( SfxLibrary_Impl* pLib, const ::rtl::OUString& aName, + SotStorageRef xStorage ); + virtual sal_Bool implLoadPasswordLibrary( SfxLibrary_Impl* pLib, const ::rtl::OUString& Name, + sal_Bool bVerifyPasswordOnly=false ) + throw(::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // OldBasicPassword interface + virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword ); + virtual String getLibraryPassword( const String& rLibraryName ); + virtual void clearLibraryPassword( const String& rLibraryName ); + virtual sal_Bool hasLibraryPassword( const String& rLibraryName ); + + sal_Bool init( const ::rtl::OUString& aInitialisationParam, + const ::rtl::OUString& aScriptLanguage, + BasicManager* pBasMgr=NULL, SotStorage* pStor=NULL ); + +public: + SfxScriptLibraryContainer( void ); + SfxScriptLibraryContainer( const ::rtl::OUString& aScriptLanguage, + BasicManager* pBasMgr, SotStorage* pStor=NULL ); + + // TODO: Methods of new XLibraryStorage interface? + virtual void SAL_CALL storeLibraries( sal_Bool bComplete ); + virtual void SAL_CALL storeLibrariesToStorage( SotStorageRef xStorage ); + + // Methods XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + + // Methods XLibraryContainerPassword + virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name, + const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // Service + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); + static ::rtl::OUString impl_getStaticImplementationName(); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) + throw( ::com::sun::star::uno::Exception ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + +}; + +// class to represent application container service +class SfxApplicationScriptLibraryContainer +{ +public: + // Service + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); + static ::rtl::OUString impl_getStaticImplementationName(); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) + throw( ::com::sun::star::uno::Exception ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory + ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + +}; + + +//============================================================================ + +class SfxScriptLibrary : public SfxLibrary_Impl +{ + friend class SfxScriptLibraryContainer; + + sal_Bool mbLoadedSource; + sal_Bool mbLoadedBinary; + +public: + SfxScriptLibrary + ( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI + ); + + SfxScriptLibrary + ( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSFI, + const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly + ); +}; + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/sfxtypes.hxx b/binfilter/bf_sfx2/source/inc/sfxtypes.hxx new file mode 100644 index 000000000000..8929f004b336 --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/sfxtypes.hxx @@ -0,0 +1,171 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_SFXTYPES_HXX +#define _SFX_SFXTYPES_HXX + +#include <tools/rcid.h> +#include <vcl/wrkwin.hxx> + +class Timer; +namespace binfilter { + +#ifndef DELETEZ +#define DELETEZ(pPtr) ( delete pPtr, pPtr = 0 ) +#endif + +#ifndef DELETEX +#ifdef DBG_UTIL +#define DELETEX(pPtr) ( delete pPtr, (void*&) pPtr = (void*) 0xFFFFFFFF ) +#else +#define DELETEX(pPtr) delete pPtr +#endif +#endif + +class SfxShell; + +#if !defined(_SFX_APPCTOR_CXX) && defined(WNT) +#ifndef _DLL_ +#error _DLL_ mal wieder nicht defined => GetpApp() == 0 +#endif +#endif + +//------------------------------------------------------------------------ + +// Macro fuer den Call-Profiler unter WinNT +// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden +#if defined( WNT ) && defined( PROFILE ) + +extern "C" { + void StartCAP(); + void StopCAP(); + void DumpCAP(); +}; + +#define S_CAP() StartCAP(); +#define E_CAP() StopCAP(); DumpCAP(); + +struct _Capper +{ + _Capper() { S_CAP(); } + ~_Capper() { E_CAP(); } +}; + +#define CAP _Capper _aCap_ + +#else + +#define S_CAP() +#define E_CAP() +#define CAP + +#endif + +#ifdef DBG_UTIL +#ifndef DBG +#define DBG(statement) statement +#endif +#define DBG_OUTF(x) DbgOutf x +#else +#ifndef DBG +#define DBG(statement) +#endif +#define DBG_OUTF(x) +#endif + +#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars() + +//------------------------------------------------------------------------ + +String SfxShellIdent_Impl( const SfxShell *pSh ); + +//------------------------------------------------------------------------ + +#if defined(DBG_UTIL) && ( defined(WNT) || defined(OS2) ) + +class SfxStack +{ + static unsigned nLevel; + +public: + SfxStack( const char *pName ) + { + ++nLevel; + DbgOutf( "STACK: enter %3d %s", nLevel, pName ); + } + ~SfxStack() + { + DbgOutf( "STACK: leave %3d", nLevel ); + --nLevel; + } +}; + +#define SFX_STACK(s) SfxStack aSfxStack_( #s ) +#else +#define SFX_STACK(s) +#endif + +//------------------------------------------------------------------------ + +String SearchAndReplace( const String &rSource, + const String &rToReplace, + const String &rReplacement ); + +#define SFX_PASSWORD_CODE "_:;*?()/&[&" +String SfxStringDecode( const String &rSource, + const char *pKey = SFX_PASSWORD_CODE ); + + +#define SFX_DEL_PTRARR(pArr) \ + { \ + for ( USHORT n = (pArr)->Count(); n--; ) \ + delete (pArr)->GetObject(n); \ + DELETEX(pArr); \ + } + +class SfxBoolResetter +{ + BOOL& _rVar; + BOOL _bOld; + +public: + SfxBoolResetter( BOOL &rVar ) + : _rVar( rVar ), + _bOld( rVar ) + {} + + ~SfxBoolResetter() + { _rVar = _bOld; } +}; + +#define GPF() *(int*)0 = 0 + +}//end of namespace binfilter +#endif // #ifndef _SFX_SFXTYPES_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/inc/tplcomp.hxx b/binfilter/bf_sfx2/source/inc/tplcomp.hxx new file mode 100644 index 000000000000..8c9296c0db1f --- /dev/null +++ b/binfilter/bf_sfx2/source/inc/tplcomp.hxx @@ -0,0 +1,222 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TPLCOMP_HXX +#define _TPLCOMP_HXX + +#include <osl/mutex.hxx> +//ASDBG #include <usr/uno.hxx> +//ASDBG #include <usr/iterhlp.hxx> +//ASDBG #include <usr/services.hxx> +#include <com/sun/star/chaos/XCommandExecutor.hpp> +#include <com/sun/star/chaos/XStatusCallback.hpp> +#include <com/sun/star/chaos/UnknownCommandException.hpp> +#include <com/sun/star/chaos/StatusCallbackEvent.hpp> +#include <com/sun/star/chaos/XURLContent.hpp> +#include <com/sun/star/chaos/XExplorerExchange.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/beans/XVetoableChangeListener.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XPropertyStateChangeListener.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/beans/PropertyStateChangeEvent.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +namespace binfilter { + +class CntAnchor; + +class TplAnchorListener; + +// ----------------- +// - TplComponent - +// ----------------- + +class TplComponent : public ::com::sun::star::chaos::XURLContent, public ::com::sun::star::chaos::XCommandExecutor, + public ::com::sun::star::beans::XPropertySet, public ::com::sun::star::chaos::XExplorerExchange, + public ::cppu::OWeakObject, public ::com::sun::star::lang::XServiceInfo +{ +private: + + void HandleNewEvt( const ::rtl::OUString& rCommand, + const ::com::sun::star::uno::Any& rAny ); + void CreatePopupMenu( ::com::sun::star::uno::Any& rAny ) const; + +protected: + + ::rtl::OUString maURL; + ::rtl::OUString maName; + ::osl::Mutex aMutex; + ::cppu::OInterfaceContainerHelper maListeners; + TplAnchorListener* mpListener; + short mnOpenMode; + +public: + + SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO + + TplComponent(); + ~TplComponent(); + + // interface ::com::sun::star::ucb::XContent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent() throw ( ::com::sun::star::uno::RuntimeException ) + { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > aRef; return aRef; } + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Parent ) throw ( ::com::sun::star::uno::RuntimeException ) + {} + + // interface ::com::sun::star::chaos::XURLContent + virtual ::rtl::OUString SAL_CALL getURL() throw ( ::com::sun::star::uno::RuntimeException ) + { return maURL; } + virtual sal_Bool SAL_CALL initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > & aParent, const ::rtl::OUString& aURL ) throw ( ::com::sun::star::uno::RuntimeException ); + + // interface ::com::sun::star::chaos::XCommandExecutor + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL queryCommands() throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL cancel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rCommandId ) throw ( ::com::sun::star::uno::RuntimeException ) + {} + virtual void SAL_CALL execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Any& rArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rCallback ) throw ( ::com::sun::star::uno::RuntimeException ); + + // interface ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& aPropertyName ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException ); + // interface ::com::sun::star::chaos::XExplorerExchange + virtual ::com::sun::star::uno::Any SAL_CALL createDataObject( sal_uInt16& nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_uInt16 SAL_CALL insertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr, + sal_uInt16 nUserAction, + sal_uInt16 nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL queryInsertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr, + sal_uInt16 nUserAction, + sal_uInt16 nSourceOptions, + sal_uInt16& nResultingAction, + sal_uInt16& nDefaultAction ) throw ( ::com::sun::star::uno::RuntimeException ); + + + // ------------------------------------------------------------- + + void CreateNewChild( CntAnchor* pAnchor, + const String& rTitle ); + void RemoveChild( CntAnchor* pAnchor ); + void StopListening( CntAnchor* pAnchor ); + void HandleOpenEvt(); +}; + +// ------------------------ +// - TplContentsComponent - +// ------------------------ + +class TplContentsListener; + +class TplContentsComponent : public TplComponent +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > _xParent; + TplContentsListener* _pListener; + SvDataObjectRef _xObject; + sal_uInt16 _nLayout; + + void HandleOpenEvt( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rJob, + const ::com::sun::star::chaos::StatusCallbackEvent& rEvt ); + void HandleNewEvt( const ::rtl::OUString& rCommand, + const ::com::sun::star::uno::Any& rAny ); + void HandleInitEvt(); + + void CreateFileName( String& rName, + String& rDirURL ); + void CreateNewTpl( const String& rFilter, + const String& rParentDir, + const String& rFileName, + const String& rDocName ); +protected: + + void CreatePopupMenu( ::com::sun::star::uno::Any& rAny ) const; + +public: + + SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO + + TplContentsComponent(); + ~TplContentsComponent(); + + virtual sal_Bool SAL_CALL initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > & aParent, const ::rtl::OUString& aURL ) throw ( ::com::sun::star::uno::RuntimeException ); + + + // interface ::com::sun::star::chaos::XCommandExecutor + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL queryCommands() throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Any& rArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rCallback ) throw ( ::com::sun::star::uno::RuntimeException ); + + // interface ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& aPropertyName ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::uno::RuntimeException ); + + // interface ::com::sun::star::chaos::XExplorerExchange + virtual ::com::sun::star::uno::Any SAL_CALL createDataObject( sal_uInt16& nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_uInt16 SAL_CALL insertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr, + sal_uInt16 nUserAction, + sal_uInt16 nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL queryInsertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr, + sal_uInt16 nUserAction, + sal_uInt16 nSourceOptions, + sal_uInt16& nResultingAction, + sal_uInt16& nDefaultAction ) throw ( ::com::sun::star::uno::RuntimeException ); + + // ------------------------------------------------------------- + + void CreateNewChild( CntAnchor* pAnchor ); + void HandleDeleteEvt(); + void SetURL( const ::rtl::OUString& rURL); + void SetName( const ::rtl::OUString& rNewName ); +}; + + +}//end of namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/notify/makefile.mk b/binfilter/bf_sfx2/source/notify/makefile.mk new file mode 100644 index 000000000000..4a234fb9e709 --- /dev/null +++ b/binfilter/bf_sfx2/source/notify/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME=binfilter +TARGET=sfx2_notify + +NO_HIDS=TRUE + +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_eventsupplier.obj \ + $(SLO)$/sfx2_hintpost.obj + +EXCEPTIONSFILES = \ + $(SLO)$/sfx2_eventsupplier.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/notify/sfx2_eventsupplier.cxx b/binfilter/bf_sfx2/source/notify/sfx2_eventsupplier.cxx new file mode 100644 index 000000000000..13f6ba307827 --- /dev/null +++ b/binfilter/bf_sfx2/source/notify/sfx2_eventsupplier.cxx @@ -0,0 +1,476 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//-------------------------------------------------------------------------------------------------------- + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <com/sun/star/util/URL.hpp> + +#include <com/sun/star/util/XURLTransformer.hpp> + +#include <tools/urlobj.hxx> + +#include <bf_svtools/macitem.hxx> + +#include <appuno.hxx> +#include <objsh.hxx> +#include <sfxbasemodel.hxx> +#include <evntconf.hxx> + +#include <bf_svtools/securityoptions.hxx> +#include <comphelper/processfactory.hxx> + +#include "eventsupplier.hxx" + +#include "app.hxx" + +#include "sfxsids.hrc" +#include "docfile.hxx" + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +//-------------------------------------------------------------------------------------------------------- + +#define MACRO_PRFIX "macro://" +#define MACRO_POSTFIX "()" + +//-------------------------------------------------------------------------------------------------------- + +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY + +//-------------------------------------------------------------------------------------------------------- + // --- XNameReplace --- +//-------------------------------------------------------------------------------------------------------- +/*N*/ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY & rElement ) +/*N*/ throw( ILLEGALARGUMENTEXCEPTION, NOSUCHELEMENTEXCEPTION, +/*N*/ WRAPPEDTARGETEXCEPTION, RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( maMutex ); +/*N*/ +/*N*/ // find the event in the list and replace the data +/*N*/ long nCount = maEventNames.getLength(); +/*N*/ for ( long i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ if ( maEventNames[i] == aName ) +/*N*/ { +/*N*/ // check for correct type of the element +/*N*/ if ( ::getCppuType( (const SEQUENCE < PROPERTYVALUE > *)0 ) == rElement.getValueType() ) +/*N*/ { +/*N*/ // create Configuration at first, creation might call this method also and that would overwrite everything +/*N*/ // we might have stored before! +/*N*/ USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName ); +/*N*/ if ( nID && mpObjShell ) +/*N*/ { +/*N*/ SfxEventConfigItem_Impl* pConfig = +/*N*/ mpObjShell->GetEventConfig_Impl(TRUE); +/*N*/ +/*N*/ ANY aValue; +/*N*/ BlowUpMacro( rElement, aValue, mpObjShell ); +/*N*/ +/*N*/ // pConfig becomes the owner of the new SvxMacro +/*N*/ SvxMacro *pMacro = ConvertToMacro( aValue, mpObjShell, FALSE ); +/*N*/ pConfig->ConfigureEvent( nID, pMacro ); +/*N*/ maEventData[i] = aValue; +/*N*/ +/*N*/ SEQUENCE < PROPERTYVALUE > aProperties; +/*N*/ if ( aValue >>= aProperties ) +/*N*/ { +/*N*/ long nCount = aProperties.getLength(); +/*N*/ for ( long nIndex = 0; nIndex < nCount; nIndex++ ) +/*N*/ { +/*N*/ if ( aProperties[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) +/*N*/ { +/*N*/ ::rtl::OUString aType; +/*N*/ aProperties[ nIndex ].Value >>= aType; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ throw ILLEGALARGUMENTEXCEPTION(); +/*N*/ +/*N*/ return; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ throw NOSUCHELEMENTEXCEPTION(); +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +// --- XNameAccess --- +//-------------------------------------------------------------------------------------------------------- +/*N*/ ANY SAL_CALL SfxEvents_Impl::getByName( const OUSTRING& aName ) +/*N*/ throw( NOSUCHELEMENTEXCEPTION, WRAPPEDTARGETEXCEPTION, +/*N*/ RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( maMutex ); +/*N*/ +/*N*/ // find the event in the list and return the data +/*N*/ +/*N*/ long nCount = maEventNames.getLength(); +/*N*/ +/*N*/ for ( long i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ if ( maEventNames[i] == aName ) +/*N*/ return maEventData[i]; +/*N*/ } +/*N*/ +/*N*/ throw NOSUCHELEMENTEXCEPTION(); +/*N*/ +/*N*/ return ANY(); +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*N*/ SEQUENCE< OUSTRING > SAL_CALL SfxEvents_Impl::getElementNames() throw ( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ return maEventNames; +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*?*/ sal_Bool SAL_CALL SfxEvents_Impl::hasByName( const OUSTRING& aName ) throw ( RUNTIMEEXCEPTION ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------------------------------------------- +// --- XElementAccess ( parent of XNameAccess ) --- +//-------------------------------------------------------------------------------------------------------- +/*?*/ UNOTYPE SAL_CALL SfxEvents_Impl::getElementType() throw ( RUNTIMEEXCEPTION ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); UNOTYPE aUNOTYPE; return aUNOTYPE; //STRIP001 +/*?*/ } + +//-------------------------------------------------------------------------------------------------------- +/*?*/ sal_Bool SAL_CALL SfxEvents_Impl::hasElements() throw ( RUNTIMEEXCEPTION ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 +/*?*/ } + +//-------------------------------------------------------------------------------------------------------- +// --- ::document::XEventListener --- +//-------------------------------------------------------------------------------------------------------- +/*N*/ void SAL_CALL SfxEvents_Impl::notifyEvent( const DOCEVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +// --- ::lang::XEventListener --- +//-------------------------------------------------------------------------------------------------------- +/*N*/ void SAL_CALL SfxEvents_Impl::disposing( const EVENTOBJECT& Source ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ ::osl::MutexGuard aGuard( maMutex ); +/*N*/ +/*N*/ if ( mxBroadcaster.is() ) +/*N*/ { +/*N*/ mxBroadcaster->removeEventListener( this ); +/*N*/ mxBroadcaster = NULL; +/*N*/ } +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------------------------------- +/*N*/ SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell, +/*N*/ REFERENCE< XEVENTBROADCASTER > xBroadcaster ) +/*N*/ { +/*N*/ // get the list of supported events and store it +/*N*/ if ( pShell ) +/*N*/ maEventNames = pShell->GetEventNames(); +/*N*/ else +/*N*/ maEventNames = SfxObjectShell::GetEventNames_Impl(); +/*N*/ +/*N*/ maEventData = SEQUENCE < ANY > ( maEventNames.getLength() ); +/*N*/ +/*N*/ mpObjShell = pShell; +/*N*/ mxBroadcaster = xBroadcaster; +/*N*/ +/*N*/ if ( mxBroadcaster.is() ) +/*N*/ mxBroadcaster->addEventListener( this ); +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*N*/ SfxEvents_Impl::~SfxEvents_Impl() +/*N*/ { +/*N*/ if ( mxBroadcaster.is() ) +/*?*/ mxBroadcaster->removeEventListener( this ); +/*N*/ } + +//-------------------------------------------------------------------------------------------------------- +/*N*/ SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* pObjShell, BOOL bBlowUp ) +/*N*/ { +/*N*/ SvxMacro* pMacro = NULL; +/*N*/ SEQUENCE < PROPERTYVALUE > aProperties; +/*N*/ ANY aAny; +/*N*/ if ( bBlowUp ) +/*?*/ BlowUpMacro( rElement, aAny, pObjShell ); +/*N*/ else +/*N*/ aAny = rElement; +/*N*/ +/*N*/ if ( aAny >>= aProperties ) +/*N*/ { +/*N*/ OUSTRING aType; +/*N*/ OUSTRING aScriptURL; +/*N*/ OUSTRING aLibrary; +/*N*/ OUSTRING aMacroName; +/*N*/ +/*N*/ long nCount = aProperties.getLength(); +/*N*/ long nIndex = 0; +/*N*/ +/*N*/ if ( !nCount ) +/*N*/ return pMacro; +/*N*/ +/*N*/ while ( nIndex < nCount ) +/*N*/ { +/*N*/ if ( aProperties[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) +/*N*/ aProperties[ nIndex ].Value >>= aType; +/*N*/ else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_SCRIPT ) == 0 ) +/*N*/ aProperties[ nIndex ].Value >>= aScriptURL; +/*N*/ else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_LIBRARY ) == 0 ) +/*N*/ aProperties[ nIndex ].Value >>= aLibrary; +/*N*/ else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_MACRO_NAME ) == 0 ) +/*N*/ aProperties[ nIndex ].Value >>= aMacroName; +/*N*/ else +/*N*/ DBG_ERROR("Unknown propery value!"); +/*N*/ nIndex += 1; +/*N*/ } +/*N*/ +/*N*/ // Get the type +/*N*/ ScriptType eType( STARBASIC ); +/*N*/ if ( aType.compareToAscii( STAR_BASIC ) == COMPARE_EQUAL ) +/*N*/ eType = STARBASIC; +/*N*/ else if ( aType.compareToAscii( "Script" ) == COMPARE_EQUAL && aScriptURL.getLength() ) +/*N*/ eType = EXTENDED_STYPE; +/*N*/ else if ( aType.compareToAscii( SVX_MACRO_LANGUAGE_JAVASCRIPT ) == COMPARE_EQUAL ) +/*N*/ eType = JAVASCRIPT; +/*N*/ else +/*N*/ DBG_ERRORFILE( "ConvertToMacro: Unknown macro type" ); +/*N*/ +/*N*/ if ( aMacroName.getLength() ) +/*N*/ { +/*N*/ if ( aLibrary.compareToAscii("application") == 0 ) +/*N*/ aLibrary = SFX_APP()->GetName(); +/*N*/ else +/*N*/ aLibrary = ::rtl::OUString(); +/*N*/ pMacro = new SvxMacro( aMacroName, aLibrary, eType ); +/*N*/ } +/*N*/ else if ( eType == EXTENDED_STYPE ) +/*?*/ pMacro = new SvxMacro( aScriptURL, aType ); +/*N*/ } +/*N*/ +/*N*/ return pMacro; +/*N*/ } + +/*N*/ void SfxEvents_Impl::BlowUpMacro( const ANY& rEvent, ANY& rRet, SfxObjectShell* pDoc ) +/*N*/ { +/*N*/ if ( !pDoc ) +/*N*/ pDoc = SfxObjectShell::Current(); +/*N*/ +/*N*/ SEQUENCE < PROPERTYVALUE > aInProps; +/*N*/ SEQUENCE < PROPERTYVALUE > aOutProps(2); +/*N*/ +/*N*/ if ( !( rEvent >>= aInProps ) ) +/*N*/ return; +/*N*/ +/*N*/ sal_Int32 nCount = aInProps.getLength(); +/*N*/ +/*N*/ if ( !nCount ) +/*N*/ return; +/*N*/ +/*N*/ OUSTRING aType; +/*N*/ OUSTRING aScript; +/*N*/ OUSTRING aLibrary; +/*N*/ OUSTRING aMacroName; +/*N*/ +/*N*/ sal_Int32 nIndex = 0; +/*N*/ +/*N*/ while ( nIndex < nCount ) +/*N*/ { +/*N*/ if ( aInProps[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) +/*N*/ { +/*?*/ aInProps[nIndex].Value >>= aType; +/*?*/ aOutProps[0] = aInProps[nIndex]; +/*N*/ } +/*N*/ else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_SCRIPT ) == 0 ) +/*N*/ { +/*N*/ aInProps[nIndex].Value >>= aScript; +/*N*/ aOutProps[1] = aInProps[nIndex]; +/*N*/ } +/*N*/ else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_LIBRARY ) == 0 ) +/*N*/ { +/*N*/ aInProps[ nIndex ].Value >>= aLibrary; +/*N*/ } +/*N*/ else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_MACRO_NAME ) == 0 ) +/*N*/ { +/*N*/ aInProps[ nIndex ].Value >>= aMacroName; +/*N*/ } +/*N*/ nIndex += 1; +/*N*/ } +/*N*/ +/*N*/ if ( aType.compareToAscii( STAR_BASIC ) == 0 ) +/*N*/ { +/*N*/ aOutProps.realloc(4); +/*N*/ if ( aScript.getLength() ) +/*N*/ { +/*N*/ if( ! aMacroName.getLength() || ! aLibrary.getLength() ) +/*?*/ { +/*?*/ sal_Int32 nHashPos = aScript.indexOf( '/', 8 ); +/*?*/ sal_Int32 nArgsPos = aScript.indexOf( '(' ); +/*?*/ if ( ( nHashPos != STRING_NOTFOUND ) && ( nHashPos < nArgsPos ) ) +/*?*/ { +/*?*/ OUSTRING aBasMgrName( INetURLObject::decode( aScript.copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET ) ); +/*?*/ if ( aBasMgrName.compareToAscii(".") == 0 ) +/*?*/ aLibrary = pDoc->GetTitle( SFX_TITLE_APINAME ); +/* + else if ( aBasMgrName.getLength() ) + aLibrary = aBasMgrName; + */ +/*?*/ else +/*?*/ aLibrary = SFX_APP()->GetName(); +/*?*/ +/*?*/ // Get the macro name +/*?*/ aMacroName = aScript.copy( nHashPos+1, nArgsPos - nHashPos - 1 ); +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERRORFILE( "ConvertToMacro: Unknown macro url format" ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if ( aMacroName.getLength() ) +/*N*/ { +/*N*/ aScript = OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_PRFIX ) ); +/*N*/ if ( aLibrary.compareTo( SFX_APP()->GetName() ) != 0 && aLibrary.compareToAscii("StarDesktop") != 0 && aLibrary.compareToAscii("application") != 0 ) +/*N*/ aScript += OUSTRING('.'); +/*N*/ +/*N*/ aScript += OUSTRING('/'); +/*N*/ aScript += aMacroName; +/*N*/ aScript += OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_POSTFIX ) ); +/*N*/ } +/*N*/ else +/*N*/ // wrong properties +/*N*/ return; +/*N*/ + OUSTRING sApplication( OUSTRING::createFromAscii( "application" ) ); + OUSTRING sDocument( OUSTRING::createFromAscii( "document" ) ); + if ( aLibrary != sApplication && aLibrary != sDocument ) + { + if ( aLibrary == OUSTRING( SFX_APP()->GetName() ) || aLibrary.equalsAscii( "StarDesktop" ) ) + aLibrary = sApplication; + else + aLibrary = sDocument; + } +/*N*/ +/*N*/ aOutProps[1].Name = OUSTRING::createFromAscii( PROP_SCRIPT ); +/*N*/ aOutProps[1].Value <<= aScript; +/*N*/ aOutProps[2].Name = OUSTRING::createFromAscii( PROP_LIBRARY ); +/*N*/ aOutProps[2].Value <<= aLibrary; +/*N*/ aOutProps[3].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME ); +/*N*/ aOutProps[3].Value <<= aMacroName; +/*N*/ rRet <<= aOutProps; +/*N*/ } +/*N*/ else if ( aType.compareToAscii( SVX_MACRO_LANGUAGE_JAVASCRIPT ) == 0 ) +/*N*/ { +/*?*/ aOutProps[1] = aInProps[1]; +/*?*/ rRet <<= aOutProps; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ rRet <<= aOutProps; +/*N*/ } +/*N*/ } + +/*N*/ SFX_IMPL_XSERVICEINFO( SfxGlobalEvents_Impl, "com.sun.star.frame.GlobalEventBroadcaster", "com.sun.star.comp.sfx2.GlobalEventBroadcaster" ) +/*N*/ SFX_IMPL_ONEINSTANCEFACTORY( SfxGlobalEvents_Impl ); + +/*N*/ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSmgr ) +/*N*/ : m_aInterfaceContainer( m_aMutex ) +/*N*/ { +/*N*/ m_refCount++; +/*N*/ pImp = new SfxEvents_Impl( NULL, this ); +/*N*/ m_xEvents = pImp; +/*N*/ m_xJobsBinding = REFERENCE< XJOBEXECUTOR >(xSmgr->createInstance(OUSTRING::createFromAscii("com.sun.star.task.JobExecutor")), UNO_QUERY); +/*N*/ m_refCount--; +/*N*/ StartListening(*SFX_APP()); +/*N*/ } + +/*?*/ SfxGlobalEvents_Impl::~SfxGlobalEvents_Impl() +/*?*/ { +/*?*/ } + +/*N*/ REFERENCE< XNAMEREPLACE > SAL_CALL SfxGlobalEvents_Impl::getEvents() throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ return m_xEvents; +/*N*/ } + +/*N*/ void SAL_CALL SfxGlobalEvents_Impl::addEventListener( const REFERENCE< XDOCEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) +/*N*/ { +/*N*/ m_aInterfaceContainer.addInterface( xListener ); +/*N*/ } + + +/*N*/ void SfxGlobalEvents_Impl::Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) +/*N*/ { +/*N*/ SfxEventHint* pNamedHint = PTR_CAST( SfxEventHint, &aHint ); +/*N*/ if ( pNamedHint ) +/*N*/ { +/*N*/ OUSTRING aName = SfxEventConfiguration::GetEventName_Impl( pNamedHint->GetEventId() ); +/*N*/ REFERENCE < XEVENTSSUPPLIER > xSup; +/*N*/ if ( pNamedHint->GetObjShell() ) +/*N*/ xSup = REFERENCE < XEVENTSSUPPLIER >( pNamedHint->GetObjShell()->GetModel(), UNO_QUERY ); +/*N*/ // else +/*N*/ // xSup = (XEVENTSSUPPLIER*) this; +/*N*/ +/*N*/ DOCEVENTOBJECT aEvent( xSup, aName ); +/*N*/ +/*N*/ // Attention: This listener is a special one. It binds the global document events +/*N*/ // to the generic job execution framework. It's a loose binding (using weak references). +/*N*/ // So we hold this listener outside our normal listener container. +/*N*/ // The implementation behind this job executor can be replaced ... +/*N*/ // but we check for this undocumented interface! +/*N*/ REFERENCE< XDOCEVENTLISTENER > xJobExecutor(m_xJobsBinding.get(), UNO_QUERY); +/*N*/ if (xJobExecutor.is()) +/*N*/ xJobExecutor->notifyEvent(aEvent); +/*N*/ +/*N*/ ::cppu::OInterfaceIteratorHelper aIt( m_aInterfaceContainer ); +/*N*/ while( aIt.hasMoreElements() ) +/*N*/ { +/*N*/ try +/*N*/ { +/*N*/ ((XDOCEVENTLISTENER *)aIt.next())->notifyEvent( aEvent ); +/*N*/ } +/*N*/ catch( RUNTIMEEXCEPTION& ) +/*N*/ { +/*?*/ aIt.remove(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ }} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/notify/sfx2_hintpost.cxx b/binfilter/bf_sfx2/source/notify/sfx2_hintpost.cxx new file mode 100644 index 000000000000..2f8efda9b937 --- /dev/null +++ b/binfilter/bf_sfx2/source/notify/sfx2_hintpost.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "hintpost.hxx" +#include "app.hxx" +namespace binfilter { + +//==================================================================== + +//-------------------------------------------------------------------- + +/*N*/ SfxHintPoster::~SfxHintPoster() +/*N*/ { +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ IMPL_LINK_INLINE_START( SfxHintPoster, DoEvent_Impl, SfxHint *, pPostedHint ) +/*N*/ { +/*N*/ DBG_MEMTEST(); +/*N*/ Event( pPostedHint ); +/*N*/ ReleaseRef(); +/*N*/ return 0; +/*N*/ } +/*N*/ IMPL_LINK_INLINE_END( SfxHintPoster, DoEvent_Impl, SfxHint *, pPostedHint ) + +//-------------------------------------------------------------------- + +/*N*/ void SfxHintPoster::Event( SfxHint* pPostedHint ) +/*N*/ { +/*N*/ aLink.Call( pPostedHint ); +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/source/view/makefile.mk b/binfilter/bf_sfx2/source/view/makefile.mk new file mode 100644 index 000000000000..3c71d36568ad --- /dev/null +++ b/binfilter/bf_sfx2/source/view/makefile.mk @@ -0,0 +1,55 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PRJNAME= binfilter +TARGET= sfx2_view + +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS= TRUE + +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sfx2 + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sfx2_printer.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sfx2/source/view/sfx2_printer.cxx b/binfilter/bf_sfx2/source/view/sfx2_printer.cxx new file mode 100644 index 000000000000..eeaf6ac4f7f5 --- /dev/null +++ b/binfilter/bf_sfx2/source/view/sfx2_printer.cxx @@ -0,0 +1,197 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svtools/itemset.hxx> +#include <bf_svtools/svarray.hxx> + +#include "bf_sfx2/printer.hxx" +namespace binfilter { + +//-------------------------------------------------------------------- + +/*N*/ SV_DECL_PTRARR_DEL(SfxFontArr_Impl,SfxFont*,10,5) + +// struct SfxPrinter_Impl ------------------------------------------------ + +/*N*/ struct SfxPrinter_Impl +/*N*/ { +/*N*/ SfxFontArr_Impl* mpFonts; +/*N*/ BOOL mbAll; +/*N*/ BOOL mbSelection; +/*N*/ BOOL mbFromTo; +/*N*/ BOOL mbRange; +/*N*/ +/*N*/ SfxPrinter_Impl() : +/*N*/ mpFonts ( NULL ), +/*N*/ mbAll ( TRUE ), +/*N*/ mbSelection ( TRUE ), +/*N*/ mbFromTo ( TRUE ), +/*N*/ mbRange ( TRUE ) {} +/*N*/ ~SfxPrinter_Impl() { delete mpFonts; } +/*N*/ }; + +/*N*/ #define FONTS() pImpl->mpFonts + +//-------------------------------------------------------------------- + +/*N*/ SfxFont::SfxFont( const FontFamily eFontFamily, const String& aFontName, +/*N*/ const FontPitch eFontPitch, const CharSet eFontCharSet ): +/*N*/ aName( aFontName ), +/*N*/ eFamily( eFontFamily ), +/*N*/ ePitch( eFontPitch ), +/*N*/ eCharSet( eFontCharSet ) +/*N*/ { +/*N*/ } + +// class SfxPrinter ------------------------------------------------------ + +/*N*/ SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions ) + +/* [Beschreibung] + + Erzeugt einen <SfxPrinter> aus dem Stream. Geladen wird genaugenommen + nur ein JobSetup. Falls ein solcher Drucker auf dem System nicht + verf"augbar ist, wird das Original als Orig-JobSetup gemerkt und + ein "anhlicher exisitierender Drucker genommen. + + Die 'pOptions' werden in den erzeugten SfxPrinter "ubernommen, + der Returnwert geh"ort dem Caller. +*/ + +/*N*/ { +/*N*/ // JobSetup laden +/*N*/ JobSetup aFileJobSetup; +/*N*/ rStream >> aFileJobSetup; +/*N*/ +/*N*/ // Drucker erzeugen +/*N*/ SfxPrinter *pPrinter = new SfxPrinter( pOptions, aFileJobSetup ); +/*N*/ return pPrinter; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SvStream& SfxPrinter::Store( SvStream& rStream ) const + +/* [Beschreibung] + + Speichert das verwendete JobSetup des <SfxPrinter>s. +*/ + +/*N*/ { +/*N*/ return ( rStream << GetJobSetup() ); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions ) : + +/* [Beschreibung] + + Dieser Ctor erzeugt einen Standard-Drucker. +*/ + +/*N*/ pOptions( pTheOptions ), +/*N*/ bKnown(sal_True) + +/*N*/ { +/*N*/ pImpl = new SfxPrinter_Impl; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions, +/*N*/ const JobSetup& rTheOrigJobSetup ) : + +/*N*/ Printer ( rTheOrigJobSetup.GetPrinterName() ), +/*N*/ pOptions ( pTheOptions ) + +/*N*/ { +/*N*/ pImpl = new SfxPrinter_Impl; +/*N*/ bKnown = GetName() == rTheOrigJobSetup.GetPrinterName(); +/*N*/ +/*N*/ if ( bKnown ) + { +/*N*/ SetJobSetup( rTheOrigJobSetup ); + } + + // --> FME 2006-09-19 #b6449032# Use old XPrinter emulation. rTheOrigJobSetup + // already has this setting (see SfxPrinter::Create()). + JobSetup aJobSetup( GetJobSetup() ); + aJobSetup.SetValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); + SetJobSetup( aJobSetup ); + // <-- +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions, +/*N*/ const String& rPrinterName ) : +/*N*/ +/*N*/ Printer ( rPrinterName ), +/*N*/ pOptions ( pTheOptions ), +/*N*/ bKnown ( GetName() == rPrinterName ) +/*N*/ +/*N*/ { +/*N*/ pImpl = new SfxPrinter_Impl; +/*N*/ } + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- + +/*N*/ SfxPrinter::~SfxPrinter() +/*N*/ { +/*N*/ delete pOptions; +/*N*/ delete pImpl; +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions ) +/*N*/ { +/*N*/ pOptions->Set(rNewOptions); +/*N*/ } + +//-------------------------------------------------------------------- + +/*N*/ SV_IMPL_PTRARR(SfxFontArr_Impl,SfxFont*) + +//-------------------------------------------------------------------- + +/*?*/ const SfxFont* SfxPrinter::GetFontByName( const String &rFontName ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 +/*?*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sfx2/util/make_tco.btm b/binfilter/bf_sfx2/util/make_tco.btm new file mode 100644 index 000000000000..d25dad24a692 --- /dev/null +++ b/binfilter/bf_sfx2/util/make_tco.btm @@ -0,0 +1 @@ +nmake product=full TCV_CORE=t diff --git a/binfilter/bf_sfx2/util/makefile.mk b/binfilter/bf_sfx2/util/makefile.mk new file mode 100644 index 000000000000..37c02b833c81 --- /dev/null +++ b/binfilter/bf_sfx2/util/makefile.mk @@ -0,0 +1,73 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +BFPRJ=.. +PRJ=..$/.. + +ENABLE_EXCEPTIONS=TRUE + +PRJNAME=binfilter +TARGET=bf_sfx + +NO_HIDS=TRUE + +.INCLUDE : $(BFPRJ)$/util$/makefile.pmk + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +INC+= -I$(PRJ)$/inc$/bf_sfx2 +# --- Allgemein ---------------------------------------------------- + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1ARCHIV=$(LB)$/lib$(TARGET).a +LIB1FILES= $(SLB)$/sfx2_appl.lib \ + $(SLB)$/sfx2_explorer.lib \ + $(SLB)$/sfx2_doc.lib \ + $(SLB)$/sfx2_view.lib \ + $(SLB)$/sfx2_control.lib \ + $(SLB)$/sfx2_notify.lib \ + $(SLB)$/sfx2_bastyp.lib \ + $(SLB)$/sfx2_config.lib + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + + +## --- SFX-Filter-Datei --- +# +#$(MISC)$/$(SHL1TARGET).flt: makefile.mk +# @echo ------------------------------ +# @echo Making: $@ +# @$(TYPE) sfxwin.flt > $@ + + diff --git a/binfilter/bf_sfx2/util/makefile.pmk b/binfilter/bf_sfx2/util/makefile.pmk new file mode 100644 index 000000000000..1b35ca49549d --- /dev/null +++ b/binfilter/bf_sfx2/util/makefile.pmk @@ -0,0 +1,26 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* diff --git a/binfilter/bf_sfx2/util/makefile.prj b/binfilter/bf_sfx2/util/makefile.prj new file mode 100644 index 000000000000..86c47b9cf658 --- /dev/null +++ b/binfilter/bf_sfx2/util/makefile.prj @@ -0,0 +1,4 @@ +PROJECTPCH4DLL=TRUE +PROJECTPCH=sfxpch +PROJECTPCHSOURCE=$(PRJ)\util\sfxpch +PDBTARGET=sfx2 diff --git a/binfilter/bf_sfx2/util/sfx.xml b/binfilter/bf_sfx2/util/sfx.xml new file mode 100644 index 000000000000..d067e6d125ff --- /dev/null +++ b/binfilter/bf_sfx2/util/sfx.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> + +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + + <module-name> sfx </module-name> + + <component-description> + <author> Dirk Voelzke </author> + <name> com.sun.star.comp.sfx2.DocumentTemplates </name> + <description> + A service to access the document templates and to manipulate them. + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="final"/> + <supported-service> com.sun.star.frame.DocumentTemplates </supported-service> + </component-description> + + <component-description> + <author> Mathias Bauer </author> + <name> com.sun.star.comp.office.FrameLoader </name> + <description> + Used to detect (means a deep detection) of content formats + and to load it into a frame synchronously. + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="final"/> + <supported-service> com.sun.star.document.ExtendedTypeDetection </supported-service> + <supported-service> com.sun.star.frame.SynchronousFrameLoader </supported-service> + </component-description> + + <component-description> + <author> Mathias Bauer </author> + <name> com.sun.star.comp.sfx2.AppDispatchProvider </name> + <description> + AppDispatchProvider. + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="final"/> + <supported-service> com.sun.star.frame.ProtocolHandler </supported-service> + </component-description> + + <component-description> + <author> Mathias Bauer </author> + <name> com.sun.star.comp.sfx2.SfxMacroLoader </name> + <description> + SfxMacroLoader. + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="final"/> + <supported-service> com.sun.star.frame.ProtocolHandler </supported-service> + </component-description> + + <component-description> + <author> Mathias Bauer </author> + <name> com.sun.star.comp.sfx2.StandaloneDocumentInfo </name> + <description> + StandaloneDocumentInfo. + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="final"/> + <supported-service> com.sun.star.document.StandaloneDocumentInfo </supported-service> + </component-description> + + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + <project-build-dependency> tools </project-build-dependency> + <project-build-dependency> svtools </project-build-dependency> + <project-build-dependency> toolkit </project-build-dependency> + <project-build-dependency> sv </project-build-dependency> + <project-build-dependency> comphelper </project-build-dependency> + <project-build-dependency> unotools </project-build-dependency> + <project-build-dependency> ucbhelper </project-build-dependency> + <project-build-dependency> svl </project-build-dependency> + <project-build-dependency> sot </project-build-dependency> + + <runtime-module-dependency> cppu2 </runtime-module-dependency> + <runtime-module-dependency> cppuhelper </runtime-module-dependency> + <runtime-module-dependency> sal2 </runtime-module-dependency> + <runtime-module-dependency> tl </runtime-module-dependency> + <runtime-module-dependency> svt </runtime-module-dependency> + <runtime-module-dependency> svl </runtime-module-dependency> + <runtime-module-dependency> tk </runtime-module-dependency> + <runtime-module-dependency> sv </runtime-module-dependency> + <runtime-module-dependency> comphelp2 </runtime-module-dependency> + <runtime-module-dependency> utl </runtime-module-dependency> + <runtime-module-dependency> ucb </runtime-module-dependency> + <runtime-module-dependency> sot </runtime-module-dependency> + +</module-description> diff --git a/binfilter/bf_sfx2/util/sfx2_sfxpch.cxx b/binfilter/bf_sfx2/util/sfx2_sfxpch.cxx new file mode 100644 index 000000000000..c7183aa8d782 --- /dev/null +++ b/binfilter/bf_sfx2/util/sfx2_sfxpch.cxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +namespace binfilter { + +/*! (pb) needs new construction */ + +#ifndef _DLL_ +#error PCH wird mal wieder ohne -D_DLL_ kompiliert +#endif + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |