diff options
Diffstat (limited to 'sfx2')
450 files changed, 11421 insertions, 13157 deletions
diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index c49fd42cd96e..77691fe88025 100644..100755 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -39,10 +39,10 @@ $(eval $(call gb_SrsTarget_set_include,sfx/res,\ $$(INCLUDE) \ -I$(OUTDIR)/inc \ -I$(WORKDIR)/inc \ - -I$(SRCDIR)/sfx2/source/dialog \ - -I$(SRCDIR)/sfx2/source/inc \ - -I$(SRCDIR)/sfx2/inc/ \ - -I$(SRCDIR)/sfx2/inc/sfx \ + -I$(realpath $(SRCDIR)/sfx2/source/dialog) \ + -I$(realpath $(SRCDIR)/sfx2/source/inc) \ + -I$(realpath $(SRCDIR)/sfx2/inc/) \ + -I$(realpath $(SRCDIR)/sfx2/inc/sfx) \ )) $(eval $(call gb_SrsTarget_add_files,sfx/res,\ diff --git a/sfx2/CppunitTest_sfx2_metadatable.mk b/sfx2/CppunitTest_sfx2_metadatable.mk index 0899eeb04b9e..0824d40cfa64 100755 --- a/sfx2/CppunitTest_sfx2_metadatable.mk +++ b/sfx2/CppunitTest_sfx2_metadatable.mk @@ -34,7 +34,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sfx2_metadatable, \ $(eval $(call gb_CppunitTest_add_linked_libs,sfx2_metadatable, \ sal \ sfx \ - stl \ $(gb_STDLIBS) \ )) diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk index 0ab800aee9b5..8f09f3d799a9 100755 --- a/sfx2/JunitTest_sfx2_complex.mk +++ b/sfx2/JunitTest_sfx2_complex.mk @@ -42,18 +42,18 @@ $(eval $(call gb_JunitTest_add_jars,sfx2_complex,\ )) $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\ - sfx2/qa/complex/sfx2/tools/DialogThread \ - sfx2/qa/complex/sfx2/tools/WriterHelper \ - sfx2/qa/complex/sfx2/tools/TestDocument \ - sfx2/qa/complex/sfx2/GlobalEventBroadcaster \ + sfx2/qa/complex/sfx2/DocumentInfo \ sfx2/qa/complex/sfx2/DocumentMetadataAccess \ sfx2/qa/complex/sfx2/DocumentProperties \ - sfx2/qa/complex/sfx2/DocumentInfo \ + sfx2/qa/complex/sfx2/GlobalEventBroadcaster \ sfx2/qa/complex/sfx2/StandaloneDocumentInfo \ sfx2/qa/complex/sfx2/UndoManager \ sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest \ - sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper \ sfx2/qa/complex/sfx2/standalonedocinfo/Test01 \ + sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper \ + sfx2/qa/complex/sfx2/tools/DialogThread \ + sfx2/qa/complex/sfx2/tools/TestDocument \ + sfx2/qa/complex/sfx2/tools/WriterHelper \ sfx2/qa/complex/sfx2/undo/CalcDocumentTest \ sfx2/qa/complex/sfx2/undo/ChartDocumentTest \ sfx2/qa/complex/sfx2/undo/DocumentTest \ @@ -68,8 +68,9 @@ $(eval $(call gb_JunitTest_add_classes,sfx2_complex,\ complex.sfx2.DocumentInfo \ complex.sfx2.DocumentProperties \ complex.sfx2.DocumentMetadataAccess \ - complex.sfx2.UndoManager \ )) +# fd#35663 fails currently: +# complex.sfx2.UndoManager \ # #i115674# fails currently: misses some OnUnfocus event # complex.sfx2.GlobalEventBroadcaster \ # breaks because binfilter export has been removed diff --git a/sfx2/JunitTest_sfx2_unoapi.mk b/sfx2/JunitTest_sfx2_unoapi.mk index f7fdfae94e76..f7fdfae94e76 100644..100755 --- a/sfx2/JunitTest_sfx2_unoapi.mk +++ b/sfx2/JunitTest_sfx2_unoapi.mk diff --git a/sfx2/Library_qstart.mk b/sfx2/Library_qstart.mk index ab8ced21b275..c775d21650d7 100755 --- a/sfx2/Library_qstart.mk +++ b/sfx2/Library_qstart.mk @@ -61,7 +61,6 @@ $(eval $(call gb_Library_add_linked_libs,qstart_gtk,\ sax \ sb \ sot \ - stl \ svl \ svt \ tk \ @@ -69,8 +68,6 @@ $(eval $(call gb_Library_add_linked_libs,qstart_gtk,\ ucbhelper \ utl \ vcl \ - vos3 \ - eggtray \ sfx \ )) diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 68fca0719e93..bb57c4d59d57 100755 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -39,10 +39,10 @@ $(eval $(call gb_Library_add_sdi_headers,sfx,sfx2/sdi/sfxslots)) $(eval $(call gb_Library_set_componentfile,sfx,sfx2/util/sfx)) $(eval $(call gb_Library_set_include,sfx,\ - -I$(SRCDIR)/sfx2/inc \ - -I$(SRCDIR)/sfx2/inc/sfx2 \ - -I$(SRCDIR)/sfx2/source/inc \ - -I$(SRCDIR)/sfx2/inc/pch \ + -I$(realpath $(SRCDIR)/sfx2/inc) \ + -I$(realpath $(SRCDIR)/sfx2/inc/sfx2) \ + -I$(realpath $(SRCDIR)/sfx2/source/inc) \ + -I$(realpath $(SRCDIR)/sfx2/inc/pch) \ -I$(WORKDIR)/SdiTarget/sfx2/sdi \ -I$(WORKDIR)/inc/ \ $$(INCLUDE) \ @@ -64,7 +64,6 @@ $(eval $(call gb_Library_add_linked_libs,sfx,\ sax \ sb \ sot \ - stl \ svl \ svt \ tk \ @@ -72,7 +71,6 @@ $(eval $(call gb_Library_add_linked_libs,sfx,\ ucbhelper \ utl \ vcl \ - vos3 \ $(gb_STDLIBS) \ )) @@ -240,9 +238,9 @@ $(eval $(call gb_SdiTarget_SdiTarget,sfx2/sdi/sfxslots,sfx2/sdi/sfx)) $(eval $(call gb_SdiTarget_set_include,sfx2/sdi/sfxslots,\ $$(INCLUDE) \ - -I$(SRCDIR)/sfx2/inc/sfx2 \ - -I$(SRCDIR)/sfx2/inc \ - -I$(SRCDIR)/sfx2/sdi \ + -I$(realpath $(SRCDIR)/sfx2/inc/sfx2) \ + -I$(realpath $(SRCDIR)/sfx2/inc) \ + -I$(realpath $(SRCDIR)/sfx2/sdi) \ )) ifeq ($(OS),$(filter WNT MACOSX,$(OS))) @@ -251,11 +249,6 @@ $(eval $(call gb_Library_add_defs,sfx,\ )) endif -ifeq ($(OS),OS2) -$(eval $(call gb_Library_add_exception_objects,sfx,\ - sfx2/source/appl/shutdowniconOs2.ob \ -)) -endif ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_objcxxobjects,sfx,\ sfx2/source/appl/shutdowniconaqua \ diff --git a/sfx2/Makefile b/sfx2/Makefile index a79aff831024..a79aff831024 100644..100755 --- a/sfx2/Makefile +++ b/sfx2/Makefile diff --git a/sfx2/Module_sfx2.mk b/sfx2/Module_sfx2.mk index f42b8122e9ef..33fd675822a1 100755 --- a/sfx2/Module_sfx2.mk +++ b/sfx2/Module_sfx2.mk @@ -43,7 +43,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sfx2,\ JunitTest_sfx2_unoapi \ )) -ifeq ($(OS),LINUX) +ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS))) ifeq ($(ENABLE_SYSTRAY_GTK),TRUE) $(eval $(call gb_Module_add_targets,sfx2,\ Library_qstart \ diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk index 6ecf5f368d27..6ecf5f368d27 100644..100755 --- a/sfx2/Package_inc.mk +++ b/sfx2/Package_inc.mk diff --git a/sfx2/Package_sdi.mk b/sfx2/Package_sdi.mk index 43e484b19a2d..43e484b19a2d 100644..100755 --- a/sfx2/Package_sdi.mk +++ b/sfx2/Package_sdi.mk diff --git a/sfx2/README b/sfx2/README new file mode 100755 index 000000000000..3b160a25203b --- /dev/null +++ b/sfx2/README @@ -0,0 +1,3 @@ +This is the gui code, much of which is now deprecated. +List of documents open would be traceked, +raw C__ code; gutsy core of document management and loading. diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx index c6d2ed3c8e78..c7d181eb1110 100644 --- a/sfx2/inc/arrdecl.hxx +++ b/sfx2/inc/arrdecl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,9 +28,9 @@ #ifndef _SFX_ARRDECL_HXX #define _SFX_ARRDECL_HXX -#include <tools/list.hxx> #include <svl/svarray.hxx> #include <sfx2/minarray.hxx> +#include <vector> struct CntUpdateResult; @@ -70,22 +71,16 @@ class SfxFrame; typedef SfxFrame* SfxFramePtr; SV_DECL_PTRARR( SfxFrameArr_Impl, SfxFramePtr, 4, 4 ) -DECLARE_LIST( SfxFilterList_Impl, SfxFilter* ) +typedef ::std::vector< SfxFilter* > SfxFilterList_Impl; struct SfxExternalLib_Impl; typedef SfxExternalLib_Impl* SfxExternalLibPtr; SV_DECL_PTRARR_DEL( SfxExternalLibArr_Impl, SfxExternalLibPtr, 2, 2 ) -//class XEventListenerRef; -//typedef XEventListenerRef* XEventListenerPtr; -//SV_DECL_PTRARR_DEL( XEventListenerArr_Impl, XEventListenerPtr, 4, 4 ) - -//class XFrameRef; -//typedef XFrameRef* XFramePtr; -//SV_DECL_PTRARR_DEL( XFrameArr_Impl, XFramePtr, 4, 4 ) - class SfxSlot; typedef SfxSlot* SfxSlotPtr; SV_DECL_PTRARR( SfxSlotArr_Impl, SfxSlotPtr, 20, 20 ) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/bitset.hxx b/sfx2/inc/bitset.hxx index 3fbf4eecffbd..98a7f583cfb2 100644 --- a/sfx2/inc/bitset.hxx +++ b/sfx2/inc/bitset.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -196,7 +197,7 @@ inline sal_Bool BitSet::IsRealSubSet( const BitSet& ) const } //-------------------------------------------------------------------- -// detsermines if the other bitset is a superset or equal +// determines if the other bitset is a superset or equal inline sal_Bool BitSet::IsSubSet( const BitSet& ) const { @@ -255,3 +256,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/brokenpackageint.hxx b/sfx2/inc/brokenpackageint.hxx new file mode 100644 index 000000000000..daa47dcd9d51 --- /dev/null +++ b/sfx2/inc/brokenpackageint.hxx @@ -0,0 +1,103 @@ +/* -*- 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 "sal/config.h" +#include "sfx2/dllapi.h" +#include <com/sun/star/document/BrokenPackageRequest.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionDisapprove.hpp> +#include <framework/interaction.hxx> + +using namespace ::framework; +typedef ContinuationBase< ::com::sun::star::task::XInteractionApprove > SfxContinuationApprove; +typedef ContinuationBase< ::com::sun::star::task::XInteractionDisapprove > SfxContinuationDisapprove; + +class SFX2_DLLPUBLIC RequestPackageReparation : + public ::com::sun::star::task::XInteractionRequest, + public ::cppu::OWeakObject +{ + ::com::sun::star::uno::Any m_aRequest; + + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > + > m_lContinuations; + + SfxContinuationApprove* m_pApprove; + SfxContinuationDisapprove* m_pDisapprove; + +public: + RequestPackageReparation( ::rtl::OUString aName ); + + // XInterface / OWeakObject + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + + sal_Bool isApproved() { return m_pApprove->isSelected(); } + + 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 ); +}; + +class SFX2_DLLPUBLIC NotifyBrokenPackage : + public ::com::sun::star::task::XInteractionRequest, + public ::cppu::OWeakObject +{ + ::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; + +public: + NotifyBrokenPackage( ::rtl::OUString aName ); + + // XInterface / OWeakObject + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + + sal_Bool isAborted() { return m_pAbort->isSelected(); } + + 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 ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/configmgr.hxx b/sfx2/inc/configmgr.hxx index 0cc4305349e8..5146fd662101 100644 --- a/sfx2/inc/configmgr.hxx +++ b/sfx2/inc/configmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,8 +33,7 @@ namespace utl{ class ConfigManager; } -/* -----------------------------05.09.00 16:42-------------------------------- - appdata.cxx - ---------------------------------------------------------------------------*/ utl::ConfigManager* GetUtlConfigManager(); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/docvor.hxx b/sfx2/inc/docvor.hxx index 9e252123348b..c800d445f6af 100644 --- a/sfx2/inc/docvor.hxx +++ b/sfx2/inc/docvor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #define _SFXDOCVOR_HXX -#ifndef _DIALOG_HXX //autogen #include <vcl/dialog.hxx> -#endif #include <svtools/svtreebx.hxx> #include <sfx2/objsh.hxx> @@ -58,11 +57,6 @@ friend class SfxOrganizeDlg_Impl; Image aOpenedDocBmp; Image aClosedDocBmp; - Image aOpenedFolderBmpHC; - Image aClosedFolderBmpHC; - Image aOpenedDocBmpHC; - Image aClosedDocBmpHC; - SfxOrganizeMgr* pMgr; SfxOrganizeDlg_Impl* pDlg; @@ -103,8 +97,8 @@ public: void SetMgr(SfxOrganizeMgr *pM) { pMgr = pM; } void Reset(); inline void SetBitmaps( - const Image &rOFolderBmp, const Image &rCFolderBmp, const Image &rODocBmp, const Image &rCDocBmp, - const Image &rOFolderBmpHC, const Image &rCFolderBmpHC, const Image &rODocBmpHC, const Image &rCDocBmpHC ); + const Image &rOFolderBmp, const Image &rCFolderBmp, const Image &rODocBmp, const Image &rCDocBmp + ); const Image &GetClosedBmp(sal_uInt16 nLevel) const; const Image &GetOpenedBmp(sal_uInt16 nLevel) const; @@ -145,7 +139,6 @@ friend class SfxOrganizeListBox_Impl; class SfxOrganizeDlg_Impl *pImp; -// virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: SfxTemplateOrganizeDlg(Window * pParent, SfxDocumentTemplates* = 0); ~SfxTemplateOrganizeDlg(); @@ -156,3 +149,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/filedlghelper.hrc b/sfx2/inc/filedlghelper.hrc index a5db7b4fdb30..a5db7b4fdb30 100644..100755 --- a/sfx2/inc/filedlghelper.hrc +++ b/sfx2/inc/filedlghelper.hrc diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 437f3bf07439..a35ce9d5a263 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,3 +152,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/fwkhelper.hxx b/sfx2/inc/fwkhelper.hxx index 7dd54559dc0b..1b23e4c2bae6 100644 --- a/sfx2/inc/fwkhelper.hxx +++ b/sfx2/inc/fwkhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,4 +33,8 @@ #include <rtl/ustring.hxx> -SFX2_DLLPUBLIC void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); +SFX2_DLLPUBLIC void SAL_CALL RefreshToolbars( + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame +); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx index b10ed6c90819..28f8379c6f1f 100644 --- a/sfx2/inc/guisaveas.hxx +++ b/sfx2/inc/guisaveas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -107,3 +108,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/idpool.hxx b/sfx2/inc/idpool.hxx index b8e605b6ef13..d5fc4adb0ed7 100644 --- a/sfx2/inc/idpool.hxx +++ b/sfx2/inc/idpool.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,4 @@ inline sal_Bool IdPool::IsLocked( sal_uInt16 nId ) const #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index 97b5275711f1..f0a73404320c 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <tools/string.hxx> #include <tools/urlobj.hxx> -#ifndef _COMBOBOX_HXX //autogen #include <vcl/combobox.hxx> -#endif #include <svtools/acceleratorexecute.hxx> #if _SOLAR__PRIVATE @@ -78,3 +77,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/macro.hxx b/sfx2/inc/macro.hxx index b6a0a2a655d5..b9e4b18dbe8d 100644 --- a/sfx2/inc/macro.hxx +++ b/sfx2/inc/macro.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef _SFXMACRO_HXX #define _SFXMACRO_HXX @@ -16,11 +17,11 @@ class SfxMacro; class SfxMacroStatement { - sal_uInt16 nSlotId; // ausgef"uhrte Slot-Id oder 0, wenn manuell - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aArgs; // aktuelle Parameter, falls nSlotId != 0 - String aStatement; // Statement in BASIC-Syntax (ggf. mit CR/LF) - sal_Bool bDone; // auskommentieren wenn kein Done() gerufen - void* pDummy; // f"ur alle F"alle zum kompatibel bleiben + sal_uInt16 nSlotId; // performed Slot-Id or 0, if manually + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aArgs; // current Parameter, in case nSlotId != 0 + String aStatement; // Statement in BASIC-Syntax (if necessary with CR/LF) + sal_Bool bDone; // comment out if no Done() is called + void* pDummy; // for all cases, to remain compatible #ifdef _SFXMACRO_HXX private: @@ -58,11 +59,10 @@ public: inline sal_uInt16 SfxMacroStatement::GetSlotId() const -/* [Beschreibung] +/* [Description] - Liefert die Slot-Id die das Statement beim Abspielen wieder ausf"uhren - soll oder 0, falls das Statement manuell (<SFX_SLOT_RECORDMANUAL>) - aufgezeichnet wurde. + Returns the Slot-Id which the Statement should redo when called or 0 + if the Statement (<SFX_SLOT_RECORDMANUAL>) was recorded manually. */ { @@ -73,14 +73,13 @@ inline sal_uInt16 SfxMacroStatement::GetSlotId() const inline const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& SfxMacroStatement::GetArgs() const -/* [Beschreibung] +/* [Description] - Liefert die Parameter mit denen Statement ausgef"uhrt wurde oder 0, - falls das Statement manuell (<SFX_SLOT_RECORDMANUAL>) aufgezeichnet - wurde. + Returns the Parameter which was used in the call of the Statement or 0 + if the Statement (<SFX_SLOT_RECORDMANUAL>) was recorded manually - Der R"uckgabewert geh"ort dem SfxMacroStatement und ist nur im - unmittelbar aufrufenden Stackframe g"ultig. + The returned value belongs to the SfxMacroStatement and is only valid + to the Stackframe. */ { @@ -91,11 +90,11 @@ inline const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::Property inline sal_Bool SfxMacroStatement::IsDone() const -/* [Beschreibung] +/* [Description] - Liefert TRUE, wenn das Statement wirklich ausgef"uhrt wurde, - also z.B. nicht vom Benutzer abgebrochen wurde. Wurde es nicht - wirklich ausgef"uhrt, dann wird es im BASIC-Source auskommentiert. + Returns TRUE only if the Statement really was excecuted, so for instance + not if it was canceled by the user. If it was not excecuted the + BASIC-Source would be commented out. */ { @@ -104,18 +103,18 @@ inline sal_Bool SfxMacroStatement::IsDone() const //-------------------------------------------------------------------- -/* [Beschreibung] +/* [Description] - Liefert das Statement in BASIC-Syntax. Wurde das Makro manuell erzeugt, - wird genau der im Konstruktor angegebene String zur"uckgegeben, sonst - der generierte Source-Code. + Returns the Statement in BASIC-Syntax. If the Macro was created manually, + the string will be returned exactly as given in the constructor, else the + generated Source-Code is returned. - Bei beiden Arten ist es m"oglich, da\s mehrere BASIC-Statements, jeweils - mit CR/LF getrennt in dem String enthalten sind, da ein SFx-Statement - ggf. in mehrere BASIC-Statements "ubersetzt wird. + It is possible in both of the above cases that several BASIC-Statements, + each contains CR / LF separators in the string, since a SFx statement + is translated if necessary into several BASIC statements. - Statements f"ur die nicht <SfxRequest::Done()> gerufen wurde, werden - mit einem vorangestellten 'rem' gekennzeichnet. + Statements for which <SfxRequest::Done()> was not called are marked + with a preceding 'rem'. */ inline const String& SfxMacroStatement::GetStatement() const @@ -127,41 +126,38 @@ inline const String& SfxMacroStatement::GetStatement() const enum SfxMacroMode -/* [Beschreibung] +/* [Description] - Mit diesem enum wird bestimmt, ob eine <SfxMacro>-Instanz zum - absoluten oder relativen Recorden erzeugt wurde, oder um ein - existierendendes Makro zu Referenzieren. + By using this enum it is determined, if a <SfxMacro>-Instance was created + by absolute or relative recording, or to create a reference to a existing + macro. */ { - SFX_MACRO_EXISTING, /* es handelt sich um ein bereits - exitistierendes Makro, welches lediglich - referenziert wird */ - - SFX_MACRO_RECORDINGABSOLUTE,/* dieses Makro soll aufgezeichnet werden, - wobei die betroffenen Objekte m"oglichst - direkt angesprochen werden sollen - (Beispiel: "[doc.sdc]") */ - - SFX_MACRO_RECORDINGRELATIVE/* dieses Makro soll aufgezeichnet werden, - wobei die betroffenen Objekte so - angesprochen werden sollen, da\s sich das - Abspielen auf die dann g"ultige Selektion - bezieht (Beispiel: "ActiveDocument()") */ + SFX_MACRO_EXISTING, /* Indicates that it is a existing + macro, which will only referenced */ + + SFX_MACRO_RECORDINGABSOLUTE, /* This macro shall be recorded so that the + affected objects are to be addressed as + directly as possible (example: "[doc.sdc]") */ + + SFX_MACRO_RECORDINGRELATIVE /* This macro is recorded and the affected + objects are addressed in such a way so + that when running the macro it refers to + a vaild selection + (example:" active document () ") */ }; //==================================================================== class SfxMacro -/* [Beschreibung] +/* [Description] - "Uber diese Klasse (bzw. genaugenommen ihre Subklassen) wird zum - einen die Lokation einer BASIC-Funktion (also in welcher Library, - in welchem Modul sowie der Funktions-Name) beschrieben, als auch - ein aufzuzeichnendes Makro w"ahrend der Aufzeichnung zwischen- - gespeichert. + Through using this class (and in fact its subclasses) the location of a + BASIC function will be discribed (also in which Library, in which module + and the Function name) as well as temporary storing a macro during the + recording. */ { @@ -181,3 +177,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/msgnodei.hxx b/sfx2/inc/msgnodei.hxx deleted file mode 100644 index c6d714657ed6..000000000000 --- a/sfx2/inc/msgnodei.hxx +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MSGNODEI_HXX -#define _MSGNODEI_HXX - - -#include <svl/eitem.hxx> -#include <tools/string.hxx> -#include <svl/poolitem.hxx> -#include <tools/list.hxx> -struct SfxMsgAttachFile { - String aFile; - String aName; - - int operator==( const SfxMsgAttachFile& rRec ) const - { - if( aName == rRec.aName && aFile == rRec.aFile ) - return sal_True; - return sal_False; - } - - SfxMsgAttachFile( const String& rFile, const String& rName) - : aName( rName ), aFile( rFile ) {} - - SfxMsgAttachFile( const SfxMsgAttachFile& rRec ) - : aName( rRec.aName), aFile( rRec.aFile ) {} -}; - -enum SfxMsgReceiverRole -{ - MSG_RECEIVER_TO = 0, - MSG_RECEIVER_CC, - MSG_RECEIVER_BCC, - MSG_RECEIVER_NEWSGROUP -}; - -struct SfxMsgReceiver { - String aName; - SfxMsgReceiverRole eRole; - - int operator==( const SfxMsgReceiver& rRec ) const - { - if( aName == rRec.aName && eRole == rRec.eRole ) - return sal_True; - return sal_False; - } - - SfxMsgReceiver( const String& rName, SfxMsgReceiverRole _eRole ) - : aName( rName ), eRole( _eRole ) {} - - SfxMsgReceiver( const SfxMsgReceiver& rRec ) - : aName( rRec.aName), eRole( rRec.eRole ) {} -}; - -// ------------------------------------------------------------------------ - -class SfxMsgReceiverList_Impl : public List -{ - sal_uIntPtr nRef; - ~SfxMsgReceiverList_Impl(); - SfxMsgReceiverList_Impl& operator=( const SfxMsgReceiverList_Impl&); //n.i. -public: - SfxMsgReceiverList_Impl(); - SfxMsgReceiverList_Impl(const SfxMsgReceiverList_Impl&); - - void Load( SvStream& ); - void Store( SvStream& ) const; - void IncRef() { nRef++; } - void DecRef() { nRef--; if( !nRef ) delete this; } - sal_uIntPtr GetRefCount() const { return nRef; } - int operator==( const SfxMsgReceiverList_Impl& ) const; -}; - -class SfxMsgReceiverListItem : public SfxPoolItem -{ - void Disconnect(); -protected: - SfxMsgReceiverList_Impl* pImp; -public: - TYPEINFO(); - - SfxMsgReceiverListItem(); - SfxMsgReceiverListItem( sal_uInt16 nWhich ); - SfxMsgReceiverListItem( sal_uInt16 nWhich, SvStream& rStream ); - SfxMsgReceiverListItem( const SfxMsgReceiverListItem& rItem ); - ~SfxMsgReceiverListItem(); - - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText ) const; - - sal_uInt16 Count() const; - SfxMsgReceiver* GetObject( sal_uInt16 nPos ); - void Remove( sal_uInt16 nPos ); - void Add( const SfxMsgReceiver& ); - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const; - virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; -}; - - -// ------------------------------------------------------------------------ - -class SfxMsgAttachFileList_Impl : public List -{ - sal_uIntPtr nRef; - ~SfxMsgAttachFileList_Impl(); - SfxMsgAttachFileList_Impl& operator=( const SfxMsgAttachFileList_Impl&); //n.i. - -public: - SfxMsgAttachFileList_Impl(); - SfxMsgAttachFileList_Impl(const SfxMsgAttachFileList_Impl&); - - int operator==( const SfxMsgAttachFileList_Impl& rRec ) const; - SfxMsgAttachFile* GetReceiver(sal_uIntPtr nPos) { return (SfxMsgAttachFile*)List::GetObject(nPos); } - void Load( SvStream& ); - void Store( SvStream& ) const; - void IncRef() { nRef++; } - void DecRef() { nRef--; if( !nRef ) delete this; } - sal_uIntPtr GetRefCount() const { return nRef; } -}; - -class SfxMsgAttachFileListItem : public SfxPoolItem -{ -protected: - SfxMsgAttachFileList_Impl* pImp; - void Disconnect(); -public: - TYPEINFO(); - - SfxMsgAttachFileListItem(); - SfxMsgAttachFileListItem( sal_uInt16 nWhich ); - SfxMsgAttachFileListItem( sal_uInt16 nWhich, SvStream& rStream ); - SfxMsgAttachFileListItem( const SfxMsgAttachFileListItem& rItem ); - ~SfxMsgAttachFileListItem(); - - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText ) const; - - sal_uInt16 Count() const; - SfxMsgAttachFile* GetObject( sal_uInt16 nPos ); - void Remove( sal_uInt16 nPos ); - void Add( const SfxMsgAttachFile& ); - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const; - virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; -}; - - -//========================================================================= - -enum SfxMsgPriority -{ - MSG_PRIORITY_LOW = 0, - MSG_PRIORITY_NORMAL, - MSG_PRIORITY_URGENT -}; -#define SFXMSGPRIORITYCOUNT 3 - -class SfxMsgPriorityItem : public SfxEnumItem -{ -public: - TYPEINFO(); - - SfxMsgPriorityItem( sal_uInt16 nWhich, SfxMsgPriority = MSG_PRIORITY_NORMAL); - - virtual SfxPoolItem* Clone( SfxItemPool* pPool=0 ) const; - virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; - virtual SvStream& Store( SvStream&, sal_uInt16 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresentationMetric, - String &rText ) const; - virtual sal_uInt16 GetValueCount() const; - virtual String GetValueTextByPos( sal_uInt16 nPos ) const; - - inline SfxMsgPriorityItem& operator=(const SfxMsgPriorityItem& rPrio) - { - SetValue( rPrio.GetValue() ); - return *this; - } -}; - - -#endif diff --git a/sfx2/inc/orgmgr.hxx b/sfx2/inc/orgmgr.hxx index 99a87f75f860..da26a55f0921 100644 --- a/sfx2/inc/orgmgr.hxx +++ b/sfx2/inc/orgmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -104,3 +105,4 @@ public: #endif // #ifndef _SFX_ORGMGR_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/pch/precompiled_sfx2.cxx b/sfx2/inc/pch/precompiled_sfx2.cxx index c87b9d94ed2b..7f5f9dd3a307 100644 --- a/sfx2/inc/pch/precompiled_sfx2.cxx +++ b/sfx2/inc/pch/precompiled_sfx2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_sfx2.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index 86b9c9841fa0..f5a7c5a4187e 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -465,6 +466,7 @@ #include "osl/mutex.hxx" #include "osl/process.h" #include "osl/security.hxx" +#include "osl/socket.hxx" #include "osl/thread.h" #include "osl/thread.hxx" #include "rsc/rscsfx.hxx" @@ -596,8 +598,6 @@ #include "tools/globname.hxx" #include "tools/inetmime.hxx" #include "tools/link.hxx" -#include "tools/list.hxx" -#include "tools/ownlist.hxx" #include "tools/rc.hxx" #include "tools/rcid.h" #include "tools/ref.hxx" @@ -654,14 +654,11 @@ #include "vcl/timer.hxx" #include "vcl/unohelp.hxx" #include "tools/wintypes.hxx" -#include "vos/diagnose.hxx" -#include "vos/module.hxx" -#include "vos/mutex.hxx" -#include "vos/process.hxx" -#include "vos/security.hxx" -#include "vos/socket.hxx" -#include "vos/thread.hxx" -#include "vos/xception.hxx" +#include "osl/diagnose.h" +#include "osl/module.hxx" +#include "osl/mutex.hxx" +#include "osl/process.h" //---MARKER--- #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/progind.hxx b/sfx2/inc/progind.hxx index a3857b14c4ed..e06665e41779 100644 --- a/sfx2/inc/progind.hxx +++ b/sfx2/inc/progind.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,3 +82,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/resmgr.hxx b/sfx2/inc/resmgr.hxx index 7fdb1eab2d7c..3e0fc3cfc1c5 100644 --- a/sfx2/inc/resmgr.hxx +++ b/sfx2/inc/resmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/DocumentMetadataAccess.hxx b/sfx2/inc/sfx2/DocumentMetadataAccess.hxx index def1e4ab5a0e..d22f37304445 100644 --- a/sfx2/inc/sfx2/DocumentMetadataAccess.hxx +++ b/sfx2/inc/sfx2/DocumentMetadataAccess.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -213,3 +214,4 @@ private: #endif // _SFX_DOCUMENTMETADATAACCESS_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/Metadatable.hxx b/sfx2/inc/sfx2/Metadatable.hxx index 273eb1afef87..143f0ec52efb 100644 --- a/sfx2/inc/sfx2/Metadatable.hxx +++ b/sfx2/inc/sfx2/Metadatable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -185,3 +186,5 @@ protected: } // namespace sfx2 #endif // METADATABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/QuerySaveDocument.hxx b/sfx2/inc/sfx2/QuerySaveDocument.hxx index e25d1a23082c..89a2902b1081 100644 --- a/sfx2/inc/sfx2/QuerySaveDocument.hxx +++ b/sfx2/inc/sfx2/QuerySaveDocument.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,7 @@ class Window; class String; -/** opens the generell query save document dialog. +/** Opens the general query save document dialog. @param _pParent The parent window. @_rTitle @@ -43,3 +44,4 @@ SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( #endif //SFX_QUERYSAVEDOCUMENT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/XmlIdRegistry.hxx b/sfx2/inc/sfx2/XmlIdRegistry.hxx index 7871fbe66ac5..00c5ae88063a 100644 --- a/sfx2/inc/sfx2/XmlIdRegistry.hxx +++ b/sfx2/inc/sfx2/XmlIdRegistry.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,8 +52,8 @@ isValidXmlId(::rtl::OUString const & i_rStreamName, ::rtl::OUString const & i_rIdref) { return isValidNCName(i_rIdref) && - (i_rStreamName.equalsAscii("content.xml") || - i_rStreamName.equalsAscii("styles.xml")); + (i_rStreamName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("content.xml")) || + i_rStreamName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("styles.xml"))); } @@ -96,3 +97,4 @@ public: #endif // _SFX_XMLIDREGISTRY_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index f8032b448291..79f08172a621 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,6 +46,7 @@ #include <vcl/svapp.hxx> #include <sfx2/shell.hxx> +#include <vector> class Timer; class ApplicationEvent; @@ -68,7 +70,6 @@ class SfxEventHint; class SfxItemSet; class SfxMacroConfig; class SfxMedium; -class SfxMediumList; class SfxMenuCtrlFactArr_Impl; class SfxNewFileDialog; class SfxObjectShell; @@ -102,6 +103,8 @@ class ModalDialog; class SbxArray; class SbxValue; +typedef ::std::vector< SfxMedium* > SfxMediumList; + namespace sfx2 { class SvLinkSource; @@ -123,31 +126,9 @@ public: }; //TODO/CLEANUP -//wird anscheinend nur in SfxPickList/SfxFrameLoader benutzt +//is apparently used only in SfxPickList/SfxFrameLoader DECL_OBJHINT( SfxStringHint, String ); -/* -typedef SfxPoolItem* (*SfxItemCreateFunc)(); -class SfxItemFactory_Impl; -class SfxItemFactoryList -{ - List aList; -public: - ~SfxItemFactoryList(); - - SfxItemFactory_Impl* GetFactory_Impl( const SvGlobalName& rName ) const; - SfxItemFactory_Impl* GetFactory_Impl( TypeId ) const; - const SvGlobalName* GetGlobalName( const SfxPoolItem* pItem ) const; - SfxPoolItem* Create( - const SvGlobalName& rName, sal_uInt16 nId, SvStream* pStrm = 0) const; - void RegisterItemFactory( - const SvGlobalName& rName, SfxItemCreateFunc ); -}; - -#define REGISTER_ITEM( ItemClass, aGlobName ) \ -RegisterItemFactory( aGlobName, ( SfxItemCreateFunc) ItemClass::StaticType() ); -*/ - #ifndef SFX_DECL_OBJECTSHELL_DEFINED #define SFX_DECL_OBJECTSHELL_DEFINED SV_DECL_REF(SfxObjectShell) @@ -236,9 +217,6 @@ public: StarBASIC* GetBasic(); sal_uInt16 SaveBasicManager() const; sal_uInt16 SaveBasicAndDialogContainer() const; - void RegisterBasicConstants( const char *pPrefix, - const SfxConstant *pConsts, - sal_uInt16 nCount ); // misc. sal_Bool GetOptions(SfxItemSet &); @@ -254,7 +232,6 @@ public: const String* pPostStr = 0); void ResetLastDir(); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;} SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); @@ -309,8 +286,9 @@ public: SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const; SAL_DLLPRIVATE SfxModule* GetModule_Impl(); SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl(); -//#endif + /* loads a branded bitmap - that can be overridden per locale */ + static bool LoadBrandBitmap (const char* pName, BitmapEx &rBitmap); /** loads the application logo as used in the about dialog and impress slideshow pause screen */ static Image GetApplicationLogo(); }; @@ -327,3 +305,4 @@ inline SfxApplication* SfxGetpApp() #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/appuno.hxx b/sfx2/inc/sfx2/appuno.hxx index 8136caac2ad9..9c5727e62f1a 100644 --- a/sfx2/inc/sfx2/appuno.hxx +++ b/sfx2/inc/sfx2/appuno.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -133,3 +134,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/basedlgs.hxx b/sfx2/inc/sfx2/basedlgs.hxx index 979cfe5693a9..428e4865aa9c 100644 --- a/sfx2/inc/sfx2/basedlgs.hxx +++ b/sfx2/inc/sfx2/basedlgs.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,13 +31,9 @@ #include "sal/config.h" #include "sfx2/dllapi.h" #include "sal/types.h" -#ifndef _FLOATWIN_HXX //autogen #include <vcl/floatwin.hxx> -#endif #include <vcl/timer.hxx> -#ifndef _DIALOG_HXX //autogen #include <vcl/dialog.hxx> -#endif class TabPage; class SfxTabPage; @@ -217,11 +214,10 @@ private: HelpButton* pHelpBtn; SingleTabDlgImpl* pImpl; -// const SfxItemSet* pOptions; -// SfxItemSet* pOutSet; DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * ); }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/basmgr.hxx b/sfx2/inc/sfx2/basmgr.hxx index 0227ad6515ec..37096a6637ab 100644 --- a/sfx2/inc/sfx2/basmgr.hxx +++ b/sfx2/inc/sfx2/basmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,3 +33,5 @@ #include <svtools/svtools.hrc> #endif //_SFX_BASMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/bindings.hxx b/sfx2/inc/sfx2/bindings.hxx index 32a5fb1dd223..23354d1baf06 100644 --- a/sfx2/inc/sfx2/bindings.hxx +++ b/sfx2/inc/sfx2/bindings.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,12 +70,12 @@ SV_DECL_PTRARR( SfxUnoControllerArr_Impl, SfxUnoControllerItemPtr, 20, 20 ) // defines //________________________________________________________________________________________________________________ -#define SFX_CALLMODE_SLOT 0x00 // sync/async vom Slot -#define SFX_CALLMODE_SYNCHRON 0x01 // synchron im selben Stackframe -#define SFX_CALLMODE_ASYNCHRON 0x02 // asynchron per AppEvent -#define SFX_CALLMODE_RECORD 0x04 // beim Recorden ber"ucksichtigen -#define SFX_CALLMODE_API 0x08 // Call von der API (silent) -#define SFX_CALLMODE_MODAL 0x10 // trotz ModalMode +#define SFX_CALLMODE_SLOT 0x00 // sync/async from Slot +#define SFX_CALLMODE_SYNCHRON 0x01 // synchronously in the same Stackframe +#define SFX_CALLMODE_ASYNCHRON 0x02 // asynchronously via AppEvent +#define SFX_CALLMODE_RECORD 0x04 // take into accont while recording +#define SFX_CALLMODE_API 0x08 // API call (silent) +#define SFX_CALLMODE_MODAL 0x10 // despite ModalMode #define SFX_CALLMODE_STANDARD SFX_CALLMODE_RECORD typedef sal_uInt16 SfxCallMode; @@ -89,23 +90,22 @@ enum SfxPopupAction //==================================================================== class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster -/* [Beschreibung] - - In jeder SFx-Applikation existiert "uber die Laufzeit von vor - <SfxApplication::Init()> bis nach <SfxApplication::Exit()> eine Instanz - der Klasse SfxBindings. Sie wird von der SfxApplication automatisch - angelegt und zerst"ort. Instanzen werden aber i.d.R. "uber das - Makro <SFX_BINDINGS> oder den zugeh"origen <SfxViewFrame> besorgt - werden. - - Die SfxBindings verwalten alle in den an ihr angemeldeten Controllern - gebundenen Slot-Ids und cachen die jeweiligen <Slot-Server> - (so nenne wir die Kombination aus SfxShell-Instanz und SfxSlot). - In den SfxBindings ist gespeichert, ob und welche Controller dirty - sind sowie welche Slot-Server-Caches jeweils dirty sind. Sie fa"st - Status-Anfragen (Aufrufe der in der IDL genannten Status-Methoden) - zusammen, die von derselben Status-Methode bedient werden, und sorgt - f"ur die Simulation der <Pseudo-Slots>. +/* [Description] + + In each SFx application one instance of the SfxBindings-Class will + exists from <SfxApplication::Init()> until <SfxApplication::Exit()>. + This instance is automatically created and destroyed by SfxApplication. + However these instances will be handled by the Macro <SFX_BINDINGS> + or the associated <SfxViewFrame>. + + The SfxBindings manages all of its Slot-Ids bound by the registerd + controllers and keeps a cache of the <Slot-Server> respectively. + (it is what we call the combination of SfxShell instance and SfxSlot). + In the SfxBindings it is stored, if and in this case which controllers + that are dirty and which Slot-Server-Caches are dirty respectively. + It summarizes status queries (calls to the status methods specified + in the IDL) that are served by the same state methods, and handles + the simulation of <Pseudo-Slots>. */ { @@ -113,16 +113,15 @@ friend class SfxApplication; friend class SfxShell; friend class SfxBindings_Impl; - SfxBindings_Impl*pImp; // Daten der Bindings-Instanz - SfxDispatcher* pDispatcher; // zu verwendender Dispatcher - sal_uInt16 nRegLevel; // Lock-Level waehrend Reconfig + SfxBindings_Impl*pImp; // Data of the Bindings instance + SfxDispatcher* pDispatcher; // Dispatcher, to be used + sal_uInt16 nRegLevel; // Lock-Level while Reconfig -//#if 0 // _SOLAR__PRIVATE private: SAL_DLLPRIVATE const SfxPoolItem* Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, SfxCallMode nCall, const SfxPoolItem **pInternalArgs, sal_Bool bGlobalOnly=sal_False); SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* ); - SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // SlotServer aktualisieren + SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer SAL_DLLPRIVATE SfxItemSet* CreateSet_Impl( SfxStateCache* &pCache, const SfxSlot* &pRealSlot, const SfxSlotServer**, @@ -135,18 +134,17 @@ private: const SfxPoolItem *pItem, SfxItemState eItemState ); DECL_DLLPRIVATE_LINK( NextJob_Impl, Timer * ); -//#endif public: SfxBindings(); ~SfxBindings(); void HidePopups( bool bHide = true ); - SAL_DLLPRIVATE void HidePopupCtrls_Impl( int bHide = sal_True ); + SAL_DLLPRIVATE void HidePopupCtrls_Impl( bool bHide = true ); void SetDispatcher(SfxDispatcher *pDisp); - void Update( sal_uInt16 nId ); // z.B. aus Menu::Activate + void Update( sal_uInt16 nId ); // For example, from Menu::Activate void Update(); SAL_DLLPRIVATE void StartUpdate_Impl(sal_Bool bComplete=sal_False); void Invalidate( sal_uInt16 nId ); @@ -193,7 +191,6 @@ public: com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetRecorder() const; com::sun::star::uno::Reference < com::sun::star::frame::XDispatch > GetDispatch( const SfxSlot*, const com::sun::star::util::URL& aURL, sal_Bool bMasterCommand ); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void ContextChanged_Impl(); SAL_DLLPRIVATE void Execute_Impl( SfxRequest& rReq, const SfxSlot* pSlot, SfxShell* pShell ); SAL_DLLPRIVATE void DeleteControllers_Impl(); @@ -214,7 +211,6 @@ public: SAL_DLLPRIVATE void ExecuteGlobal_Impl( sal_uInt16 nId ); SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl(); SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId ); -//#endif }; #ifdef DBG_UTIL @@ -235,21 +231,21 @@ public: inline int SfxBindings::IsInRegistrations() const -/* [Beschreibung] +/* [Description] - Stellt fest, ob an der SfxBindings Instanz gerade <SfxContollerItems> - an- oder abgemeldet werden, also noch <SfxBindings::EnterRegistrations()> - Aufrufe nicht mit <SfxBindings::EnterRegistrations()> geschlo"sen wurden. + Determines whether the <SfxContollerItems> SfxBindings instance is + registerd or unregisted, i.e. <SfxBindings::EnterRegistrations()> + calls that have not been closed by <SfxBindings::LeaveRegistrations()>. - [R"uckgabewert] + [Return value] int sal_True - Die SfxBindings Instanz ist gerade im Registrierungs- - Modus. Es erfolgen also keine Status-Updates. + The SfxBindings instance is currently in + Registration-Mode. No status updates . - sal_False - Die SfxBindings Instanz ist gerade im normalen - Modus. Es k"oennen also Status-Updates erfolgen. + int sal_False + The SfxBindings instance is the normal mode. + Status updates can be done. */ { @@ -260,3 +256,4 @@ inline int SfxBindings::IsInRegistrations() const #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/brokenpackageint.hxx b/sfx2/inc/sfx2/brokenpackageint.hxx index 5186e875a6ea..5186e875a6ea 100755..100644 --- a/sfx2/inc/sfx2/brokenpackageint.hxx +++ b/sfx2/inc/sfx2/brokenpackageint.hxx diff --git a/sfx2/inc/sfx2/chalign.hxx b/sfx2/inc/sfx2/chalign.hxx index 26b13ee34bd7..6707424e816f 100644 --- a/sfx2/inc/sfx2/chalign.hxx +++ b/sfx2/inc/sfx2/chalign.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,35 +30,37 @@ #include <tools/solar.h> -// Neue Reihenfolge: zuerst Navigationsleiste, dann senkrecht angedockte -// ChildWindows (Explorer!), dann horizontal angedockte ChildWindows (Browser!), -// dann die Formatleiste, die Statuszeile, am Ende die Werkzeugleiste. +// New order: first, navigation bar, then vertically docked child windows +// (Explorer!), then horizontally docked child windows (Browser!), +// then the format bar, status bar, and at the end of the toolbar. enum SfxChildAlignment { - SFX_ALIGN_HIGHESTTOP, // z.B. Navigationsleiste + SFX_ALIGN_HIGHESTTOP, // for example Navigation bar SFX_ALIGN_LOWESTBOTTOM, SFX_ALIGN_FIRSTLEFT, SFX_ALIGN_LASTRIGHT, - SFX_ALIGN_LEFT, // z.B. SplitWindow + SFX_ALIGN_LEFT, // for example SplitWindow SFX_ALIGN_RIGHT, SFX_ALIGN_LASTLEFT, SFX_ALIGN_FIRSTRIGHT, - SFX_ALIGN_TOP, // z.B. Hyperlink-Builder, SplitWindow - SFX_ALIGN_BOTTOM, // z.B. SplitWindow - SFX_ALIGN_TOOLBOXTOP, // z.B. Objektleiste + SFX_ALIGN_TOP, // for example Hyperlink-Builder, SplitWindow + SFX_ALIGN_BOTTOM, // for example SplitWindow + SFX_ALIGN_TOOLBOXTOP, // for example Objekt bar SFX_ALIGN_TOOLBOXBOTTOM, - SFX_ALIGN_LOWESTTOP, // z.B. Calc-Rechenleiste - SFX_ALIGN_HIGHESTBOTTOM, // z.B. Statusleiste - SFX_ALIGN_TOOLBOXLEFT, // z.B. Werkzeugleiste + SFX_ALIGN_LOWESTTOP, // for example Calc bar + SFX_ALIGN_HIGHESTBOTTOM, // for example Status bar + SFX_ALIGN_TOOLBOXLEFT, // for example Tool bar SFX_ALIGN_TOOLBOXRIGHT, - SFX_ALIGN_NOALIGNMENT // alle FloatingWindows + SFX_ALIGN_NOALIGNMENT // all FloatingWindows }; -// "Uberpr"uft, ob ein g"ultiges Alignment verwendet wird +// Verifies that a valid alignment is used inline sal_Bool SfxChildAlignValid( SfxChildAlignment eAlign ) { return ( eAlign >= SFX_ALIGN_HIGHESTTOP && eAlign <= SFX_ALIGN_NOALIGNMENT ); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/childwin.hxx b/sfx2/inc/sfx2/childwin.hxx index 5570506b2c89..8aeaff3ad0ad 100644 --- a/sfx2/inc/sfx2/childwin.hxx +++ b/sfx2/inc/sfx2/childwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <vcl/window.hxx> #include <com/sun/star/frame/XFrame.hpp> -#ifdef ENABLE_INIMANAGER//MUSTINI +#ifdef ENABLE_INIMANAGER #include "inimgr.hxx" #endif #include <sfx2/shell.hxx> @@ -47,22 +48,18 @@ class SfxChildWindow; class SfxChildWindowContext; class SfxChildWinContextArr_Impl; -//ASDBG #ifndef _XFRAME_REF -//ASDBG #define _XFRAME_REF -//ASDBG USR_DECLIMPL_REF( ::com::sun::star::frame::XFrame, ::com::sun::star::uno::XInterface ); -//ASDBG #endif - -#define SFX_CHILDWIN_ZOOMIN 0x01 // ganz eingeklapptes Float -#define SFX_CHILDWIN_SMALL 0x02 // halb eingeklapptes Float -#define SFX_CHILDWIN_FORCEDOCK 0x04 // Float verboten -#define SFX_CHILDWIN_AUTOHIDE 0x08 // DockingWindow im AutoHide-Modus -#define SFX_CHILDWIN_TASK 0x10 // ChildWindow innerhalb der Task -#define SFX_CHILDWIN_CANTGETFOCUS 0x20 // ChildWindow kann keinen Focus bekommen +#define SFX_CHILDWIN_ZOOMIN 0x01 // Fully retracted Float +#define SFX_CHILDWIN_SMALL 0x02 // Half retracted Float +#define SFX_CHILDWIN_FORCEDOCK 0x04 // Float forbidden +#define SFX_CHILDWIN_AUTOHIDE 0x08 // DockingWindow in AutoHide mode +#define SFX_CHILDWIN_TASK 0x10 // ChildWindow inside the Task +#define SFX_CHILDWIN_CANTGETFOCUS 0x20 // ChildWindow can not get focus #define SFX_CHILDWIN_ALWAYSAVAILABLE 0x40 // ChildWindow is never disabled -#define SFX_CHILDWIN_NEVERHIDE 0x80 // ChildWindow is can always made visible/is visible +#define SFX_CHILDWIN_NEVERHIDE 0x80 // ChildWindow is can always made + // visible/is visible #define CHILDWIN_NOPOS USHRT_MAX -// Konfiguration eines ChildWindows +// ChildWindow Configuration struct SfxChildWinInfo { sal_Bool bVisible; @@ -77,30 +74,28 @@ struct SfxChildWinInfo bVisible = sal_False; nFlags = 0; } -//#if 0 // _SOLAR__PRIVATE sal_Bool GetExtraData_Impl( SfxChildAlignment *pAlign, SfxChildAlignment *pLastAlign = 0, Size *pSize = 0, sal_uInt16 *pLine = 0, sal_uInt16 *pPos = 0 ) const; -//#endif }; -// Factory-Methode eines ChildWindows +// ChildWindow factory methods typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo); -// Factory-Methode eines ChildWindowsContexts +// ChildWindowsContexts factory methods typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow, SfxBindings *pBindings, SfxChildWinInfo *pInfo); struct SfxChildWinContextFactory { - SfxChildWinContextCtor pCtor; // Factory-Methode - sal_uInt16 nContextId; // Identifier f"ur das SfxInterface - SfxChildWinInfo aInfo; // Konfiguration + SfxChildWinContextCtor pCtor; // Factory method + sal_uInt16 nContextId; // Idenifier for SfxInterface + SfxChildWinInfo aInfo; // Configuration SfxChildWinContextFactory( SfxChildWinContextCtor pTheCtor, sal_uInt16 nID ) : pCtor(pTheCtor) @@ -112,11 +107,11 @@ SV_DECL_PTRARR_DEL( SfxChildWinContextArr_Impl, SfxChildWinContextFactory*, 2, 2 struct SfxChildWinFactory { - SfxChildWinCtor pCtor; // Factory-Methode + SfxChildWinCtor pCtor; // Factory method sal_uInt16 nId; // ChildWindow-Id ( SlotId ) - SfxChildWinInfo aInfo; // Konfiguration - sal_uInt16 nPos; // ggf. Position im UI - SfxChildWinContextArr_Impl *pArr; // Array f"ur Contexte + SfxChildWinInfo aInfo; // Configuration + sal_uInt16 nPos; // Position in UI + SfxChildWinContextArr_Impl *pArr; // Array for Contexts SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n ) @@ -126,16 +121,11 @@ struct SfxChildWinFactory , pArr( NULL ) {} -//#if 0 // _SOLAR__PRIVATE ~SfxChildWinFactory() { delete pArr; } -//#else - // Der WIN16-Compiler versucht dort zu "ubersetzen, wo dieser Header - // included wird, und kann dann nat"urlich nicht linken, wenn inline ... -// ~SfxChildWinFactory(); -//#endif + }; class FloatingWindow; @@ -173,13 +163,13 @@ class SFX2_DLLPUBLIC SfxChildWindow sal_uInt16 nType; // ChildWindow-Id protected: - SfxChildAlignment eChildAlignment;// aktuelles ::com::sun::star::drawing::Alignment - ::Window* pWindow; // eigentlicher Inhalt - SfxChildWindow_Impl* pImp; // Imp-Daten + SfxChildAlignment eChildAlignment; // Current ::com::sun::star::drawing::Alignment + ::Window* pWindow; // actual contents + SfxChildWindow_Impl* pImp; // Implementation data private: - SfxChildWindowContext* pContext; // bei kontextsensitiven ChildWindows: - // weiteres window in pWindow + SfxChildWindowContext* pContext; // With context-sensitive ChildWindows: + // Annother window in pWindow SAL_DLLPRIVATE SfxChildWindowContext* GetContext() const { return pContext; } @@ -202,10 +192,8 @@ public: void SetPosSizePixel(const Point& rPoint, Size& rSize); Point GetPosPixel() { return pWindow->GetPosPixel(); } -//<!--Modified by PengYunQuan for Validity Cell Range Picker virtual void Hide(); virtual void Show( sal_uInt16 nFlags ); -//-->Modified by PengYunQuan for Validity Cell Range Picker sal_uInt16 GetFlags() const { return GetInfo().nFlags; } sal_Bool CanGetFocus() const; @@ -240,11 +228,9 @@ public: virtual com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame(); void SetFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & ); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo&); SAL_DLLPRIVATE void SetVisible_Impl( sal_Bool bVis ); SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* ); - //SfxWorkWindow* GetWorkWindow_Impl() const; SAL_DLLPRIVATE void Activate_Impl(); SAL_DLLPRIVATE void Deactivate_Impl(); @@ -252,25 +238,24 @@ public: GetContext_Impl() const { return pContext; } SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* ); -//#endif }; //------------------------------------------------------------------ -//! demn"achst hinf"allig ! +//! soon obsolete ! #define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \ static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(SfxModule *pMod=0); \ -//! Das Macro der Zukunft ... +//! The Macro of the future ... #define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ static SfxChildWindowContext* CreateImpl(::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \ -//! demn"achst hinf"allig ! +//! soon obsolete ! #define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ + SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent, \ @@ -286,11 +271,12 @@ public: SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, pFact); \ } -//! Das Macro der Zukunft ... -// CreateImpl mu\s noch als Parameter die Factory mitbekommen wg. ContextId -// Solange wird diese Id auf 0 gesetzt und in SfxChildWindow::CreateContext gepatched +//! The Macro of the future ... +// As a parameter and because of ContextId, CreateImpl must be handed the +// factory. As long as Id is set to 0 and patched in +// SfxChildWindow::CreateContext #define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ - SfxChildWindowContext* __EXPORT Class::CreateImpl( ::Window *pParent, \ + SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\ @@ -315,13 +301,13 @@ public: SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS) #define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ - SfxChildWindow* __EXPORT Class::CreateImpl( ::Window *pParent, \ + SfxChildWindow* Class::CreateImpl( ::Window *pParent, \ sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ { \ SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\ return pWin; \ } \ - sal_uInt16 __EXPORT Class::GetChildWindowId () \ + sal_uInt16 Class::GetChildWindowId () \ { return MyID; } \ void Class::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags) \ { \ @@ -334,7 +320,7 @@ public: #define SFX_IMPL_FLOATINGWINDOW(Class, MyID) \ SFX_IMPL_CHILDWINDOW(Class, MyID) \ - SfxChildWinInfo __EXPORT Class::GetInfo() const \ + SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \ @@ -342,7 +328,7 @@ public: #define SFX_IMPL_MODELESSDIALOG(Class, MyID) \ SFX_IMPL_CHILDWINDOW(Class, MyID) \ - SfxChildWinInfo __EXPORT Class::GetInfo() const \ + SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ ((SfxModelessDialog*)GetWindow())->FillInfo( aInfo ); \ @@ -350,7 +336,7 @@ public: #define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \ SFX_IMPL_CHILDWINDOW(Class, MyID) \ - SfxChildWinInfo __EXPORT Class::GetInfo() const \ + SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \ @@ -358,7 +344,7 @@ public: #define SFX_IMPL_TOOLBOX(Class, MyID) \ SFX_IMPL_CHILDWINDOW(Class, MyID) \ - SfxChildWinInfo __EXPORT Class::GetInfo() const \ + SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ ((SfxToolbox*)GetWindow())->FillInfo( aInfo ); \ @@ -367,3 +353,5 @@ public: //------------------------------------------------------------------ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/cntids.hrc b/sfx2/inc/sfx2/cntids.hrc index ef652981f76d..35cbf6e1fc6f 100644..100755 --- a/sfx2/inc/sfx2/cntids.hrc +++ b/sfx2/inc/sfx2/cntids.hrc @@ -39,9 +39,9 @@ // Slot-ID's ----------------------------------------------------------------- #ifndef SID_SFX_START -// HACK() - SID's duerfen nicht o.w. ihren numerischen Wert aendern, -// sfxsids.hrc darf aber nicht included werden!!! Loesung: sfxsids.hrc -// "tiefer legen" - z.B. svtools??? +// HACK() - SID's may not change its numerical value just like that, +// sfxsids.hrc may not be included!!! Solution: sfxsids.hrc +// include it on a lower level - for example svtools??? #define SID_SFX_START 5000 #endif #define SID_TITLE (SID_SFX_START + 307) @@ -349,24 +349,24 @@ // Tabpage-Ids --------------------------------------------------------------- -#define CNT_TABPAGE_GENERAL 1 // "Allgemein" -#define CNT_TABPAGE_SERVER_SETTINGS 2 // "Server" -#define CNT_TABPAGE_RULES 3 // "Regeln" -#define CNT_TABPAGE_VIEW_PROPERTIES 4 // "Ansicht" -#define CNT_TABPAGE_CONTENT_PROPERTIES 5 // "Inhalte" -#define CNT_TABPAGE_SUBSCRIBE 6 // "Abonniert" -#define CNT_TABPAGE_RECIPIENT_STATE 7 // "Status" (Outtray-Msgs) -#define CNT_TABPAGE_RECV_POP3 8 // "Empfangen" fuer POP3 -#define CNT_TABPAGE_RECV_NNTP 9 // - " - fuer NNTP-Accounts -#define CNT_TABPAGE_RECV_IMAP 10 // - " - fuer IMAP-Accounts -#define CNT_TABPAGE_RECV_VIM 11 // - " - fuer VIM-Accounts -#define CNT_TABPAGE_SEND_SMTP 12 // "SMTP" -#define CNT_TABPAGE_SEND_NNTP 13 // "NNTP" -#define CNT_TABPAGE_SEND_VIM 14 // "VIM" -#define CNT_TABPAGE_MAIL_NEWS_SEND 15 // "Versenden" +#define CNT_TABPAGE_GENERAL 1 +#define CNT_TABPAGE_SERVER_SETTINGS 2 +#define CNT_TABPAGE_RULES 3 +#define CNT_TABPAGE_VIEW_PROPERTIES 4 +#define CNT_TABPAGE_CONTENT_PROPERTIES 5 +#define CNT_TABPAGE_SUBSCRIBE 6 +#define CNT_TABPAGE_RECIPIENT_STATE 7 +#define CNT_TABPAGE_RECV_POP3 8 +#define CNT_TABPAGE_RECV_NNTP 9 +#define CNT_TABPAGE_RECV_IMAP 10 +#define CNT_TABPAGE_RECV_VIM 11 +#define CNT_TABPAGE_SEND_SMTP 12 +#define CNT_TABPAGE_SEND_NNTP 13 +#define CNT_TABPAGE_SEND_VIM 14 +#define CNT_TABPAGE_MAIL_NEWS_SEND 15 #define CNT_TABPAGE_SEARCH_CRITERIA 16 #define CNT_TABPAGE_SEARCH_LOCATIONS 17 -#define CNT_TABPAGE_PROJECT_DATAEXCHANGE 18 // "Datenaustausch" +#define CNT_TABPAGE_PROJECT_DATAEXCHANGE 18 #define CNT_TABPAGE_SBOX_LOCATION 19 #define CNT_TABPAGE_SBOX_SUBSCRIBTION 20 #define CNT_TABPAGE_SBOX_SCHEDULE 21 @@ -377,12 +377,12 @@ #define CNT_TABPAGE_SBOX_SDC_GENERAL 26 #define CNT_TABPAGE_SBOX_CDF_SUBSCRIBTION 27 #define CNT_TABPAGE_BACKGROUND 28 -#define CNT_TABPAGE_HEADER 29 // "Kopfzeilen" - Header bei Mail/News etc. -#define CNT_TABPAGE_DESCRIPTION 30 // "Beschreibung" - Header im Filesys +#define CNT_TABPAGE_HEADER 29 +#define CNT_TABPAGE_DESCRIPTION 30 #define CNT_TABPAGE_FONT 31 -#define CNT_TABPAGE_FOLDER_BMK 32 // Link auf Ordner -#define CNT_TABPAGE_DOCUMENT_BMK 33 // Link auf Dokument -#define CNT_TABPAGE_WEBVIEW 34 // Web-Ansicht +#define CNT_TABPAGE_FOLDER_BMK 32 +#define CNT_TABPAGE_DOCUMENT_BMK 33 +#define CNT_TABPAGE_WEBVIEW 34 #define DEF_WIDTH_FROM 150 diff --git a/sfx2/inc/sfx2/controlwrapper.hxx b/sfx2/inc/sfx2/controlwrapper.hxx index ed962342b6e3..5959e5eed2ea 100644 --- a/sfx2/inc/sfx2/controlwrapper.hxx +++ b/sfx2/inc/sfx2/controlwrapper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,7 @@ #include <memory> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/edit.hxx> #include <vcl/field.hxx> #include <vcl/lstbox.hxx> @@ -669,3 +668,4 @@ void ValueSetWrapper< ValueT >::SetControlValue( ValueT nValue ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/ctrlitem.hxx b/sfx2/inc/sfx2/ctrlitem.hxx index 4ceb2d940f52..e7b1dc6cfbc2 100644 --- a/sfx2/inc/sfx2/ctrlitem.hxx +++ b/sfx2/inc/sfx2/ctrlitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,30 +41,29 @@ class SFX2_DLLPUBLIC SfxControllerItem { private: sal_uInt16 nId; - SfxControllerItem* pNext; // zu benachrichtigendes weiteres ControllerItem + SfxControllerItem* pNext; // to notify next ControllerItem SfxBindings* pBindings; protected: -//#if defined( DBG_UTIL ) && defined( _SOLAR__PRIVATE ) #if defined( DBG_UTIL ) SAL_DLLPRIVATE void CheckConfigure_Impl( sal_uIntPtr nType ); #endif public: SfxBindings & GetBindings() { - DBG_ASSERT(pBindings, "keine Bindings"); + DBG_ASSERT(pBindings, "no Bindings"); return *pBindings; } const SfxBindings & GetBindings() const { - DBG_ASSERT(pBindings, "keine Bindings"); + DBG_ASSERT(pBindings, "no Bindings"); return *pBindings; } - SfxControllerItem(); // fuer arrays + SfxControllerItem(); // for arrays SfxControllerItem( sal_uInt16 nId, SfxBindings & ); virtual ~SfxControllerItem(); - void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // in SfxBindings registrieren + void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings void UnBind(); void ReBind(); sal_Bool IsBound() const; @@ -85,11 +85,9 @@ public: static SfxItemState GetItemState( const SfxPoolItem* pState ); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const { return pBindings != NULL; } SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* ); -//#endif }; //==================================================================== @@ -109,3 +107,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/dialogs.hrc b/sfx2/inc/sfx2/dialogs.hrc index 97e9dd725c9a..97e9dd725c9a 100644..100755 --- a/sfx2/inc/sfx2/dialogs.hrc +++ b/sfx2/inc/sfx2/dialogs.hrc diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index 61e972c99278..a8e9a6654472 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -162,8 +163,8 @@ public: virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const; virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; // class SfxDocumentPage ------------------------------------------------- @@ -173,6 +174,7 @@ class SfxDocumentPage : public SfxTabPage private: FixedImage aBmp1; Edit aNameED; + PushButton aChangePassBtn; FixedLine aLine1FL; FixedText aTypeFT; @@ -212,7 +214,9 @@ private: DECL_LINK( DeleteHdl, PushButton * ); DECL_LINK( SignatureHdl, PushButton * ); + DECL_LINK( ChangePassHdl, PushButton * ); void ImplUpdateSignatures(); + void ImplCheckPasswordState(); protected: SfxDocumentPage( Window* pParent, const SfxItemSet& ); @@ -253,7 +257,6 @@ public: // class SfxInternetPage ------------------------------------------------- -class TargetList; namespace sfx2 { class FileDialogHelper; @@ -573,3 +576,4 @@ public: #endif // #ifndef _SFX_DINFDLG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/dinfedt.hxx b/sfx2/inc/sfx2/dinfedt.hxx index 64ad32cb1337..1560ae450da8 100644 --- a/sfx2/inc/sfx2/dinfedt.hxx +++ b/sfx2/inc/sfx2/dinfedt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ // include --------------------------------------------------------------- -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/dialog.hxx> #include <vcl/edit.hxx> #include <vcl/fixed.hxx> @@ -77,3 +76,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/dispatch.hxx b/sfx2/inc/sfx2/dispatch.hxx index 945d04b71f99..f6eb60be3755 100644 --- a/sfx2/inc/sfx2/dispatch.hxx +++ b/sfx2/inc/sfx2/dispatch.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,7 +111,7 @@ class SFX2_DLLPUBLIC SfxDispatcher sal_Bool bFlushed; private: - // auf temporaer ausgewerteten Todos suchen + // Search for temporary evaluated Todos SAL_DLLPRIVATE sal_Bool CheckVirtualStack( const SfxShell& rShell, sal_Bool bDeep ); #ifndef _SFX_HXX @@ -130,8 +131,8 @@ friend class SfxBindings; friend class SfxStateCache; friend class SfxPopupMenuManager; friend class SfxHelp; - // Fuer die Bindings: Finden einer Message; Level fuer - // erneuten Zugriff + // For bindings: Finding the Message; + // level for re-access SAL_DLLPRIVATE sal_Bool _TryIntercept_Impl( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal ); sal_Bool _FindServer( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal ); sal_Bool _FillState( const SfxSlotServer &rServer, @@ -231,7 +232,6 @@ public: void SetDisableFlags( sal_uInt32 nFlags ); sal_uInt32 GetDisableFlags() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool HasSlot_Impl( sal_uInt16 ); SAL_DLLPRIVATE void SetMenu_Impl(); SAL_DLLPRIVATE void Update_Impl( sal_Bool bForce = sal_False ); // ObjectBars etc. @@ -255,18 +255,16 @@ public: SAL_DLLPRIVATE void DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ); SAL_DLLPRIVATE void InvalidateBindings_Impl(sal_Bool); SAL_DLLPRIVATE sal_uInt16 GetNextToolBox_Impl( sal_uInt16 nPos, sal_uInt16 nType, String *pStr ); -//#endif }; //-------------------------------------------------------------------- inline sal_Bool SfxDispatcher::IsFlushed() const -/* [Beschreibung] +/* [Description] - Mit dieser Methode l"a"st sich erfragen, ob der Stack des - SfxDispatchers geflusht ist, oder noch Push- oder Pop-Befehle - ausstehen. + This method checks if the stack of the SfxDispatchers is flushed, or if + push- or pop- commands are pending. */ { @@ -277,13 +275,12 @@ inline sal_Bool SfxDispatcher::IsFlushed() const inline void SfxDispatcher::Flush() -/* [Beschreibung] +/* [Description] - Diese Methode f"uhrt ausstehenden Push- und Pop-Befehle aus. - F"ur <SfxShell>s, die dabei neu auf den Stack kommen, wird - <SfxShell::Activate(sal_Bool)> mit bMDI == sal_True aufgerufen, f"ur - SfxShells, die vom Stack entfernt werden, wird <SfxShell::Deactivate(sal_Bool)> - mit bMDI == sal_True aufgerufen. + This method performs outstanding push- and pop- commands. For <SfxShell>s, + which are new on the stack, the <SfxShell::Activate(sal_Bool)> is invoked with + bMDI == sal_True, for SfxShells that are removed from the stack, the + <SfxShell::Deactivate(sal_Bool)> is invoked with bMDI == sal_True */ { @@ -294,14 +291,15 @@ inline void SfxDispatcher::Flush() inline void SfxDispatcher::Push( SfxShell& rShell ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode wird eine <SfxShell> auf den SfxDispatcher - gepusht. Die SfxShell wird zun"achst zum pushen vermerkt und - es wird ein Timer aufgesetzt. Erst bei Ablauf des Timers wird - tats"achlich gepusht (<SfxDispatcher::Flush()>) und die <SfxBindings> - werden invalidiert. W"ahrend der Timer l"auft gleichen sich - entgegengesetzte Push und Pop Befehle mit derselben SfxShell aus. + With this method, a <SfxShell> pushed on to the SfxDispatcher. + The SfxShell is first marked for push and a timer is set up. + First when the timer has couted down to zero the push + ( <SfxDispatcher::Flush()> ) is actually performed and the + <SfxBindings> is invalidated. While the timer is counting down + the opposing push and pop commands on the same SfxShell are + leveled out. */ { @@ -312,21 +310,18 @@ inline void SfxDispatcher::Push( SfxShell& rShell ) inline sal_Bool SfxDispatcher::IsActive( const SfxShell& rShell ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann abgefragt werden, ob sich eine bestimmte - <SfxShell>-Instanz auf dem SfxDispatcher befindet. + This method checks whether a particular <SfxShell> instance is + on the SfxDispatcher. - [R"uckgabewert] + [Return value] sal_Bool sal_True - Die SfxShell-Instanz befindet sich auf dem - SfxDispatcher. + The SfxShell instance is on the SfxDispatcher. sal_False - Die SfxShell-Instanz befindet sich nicht auf dem - SfxDispatcher. - + The SfxShell instance is not on the SfxDispatcher. */ { @@ -336,21 +331,20 @@ inline sal_Bool SfxDispatcher::IsActive( const SfxShell& rShell ) inline sal_Bool SfxDispatcher::IsOnTop( const SfxShell& rShell ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann abgefragt werden, ob sich eine bestimmte - <SfxShell>-Instanz zuoberst auf dem SfxDispatcher befindet. + This method checks whether a particular <SfxShell> instance is on + top of the SfxDispatcher. - [R"uckgabewert] + [Return value] sal_Bool sal_True - Die SfxShell-Instanz befindet sich als oberste - SfxShell auf dem SfxDispatcher. + The SfxShell instance is on the top of + the SfxDispatcher. sal_False - Die SfxShell-Instanz befindet sich nicht als - oberste SfxShell auf dem SfxDispatcher. - + The SfxShell instance is not on the top of + the SfxDispatcher. */ { @@ -361,3 +355,4 @@ inline sal_Bool SfxDispatcher::IsOnTop( const SfxShell& rShell ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/dllapi.h b/sfx2/inc/sfx2/dllapi.h index 78066a4b2d7c..82018b6480e5 100644..100755 --- a/sfx2/inc/sfx2/dllapi.h +++ b/sfx2/inc/sfx2/dllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,3 +41,5 @@ #define SFX2_DLLPRIVATE SAL_DLLPRIVATE #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index bc2d9bfc7be2..b0a047c7180b 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <tools/rtti.hxx> // SFX_IMPL_MODULE_LIB -#include <vos/module.hxx> +#include <osl/module.hxx> #include <rtl/ustring.hxx> #include <sfx2/objsh.hxx> @@ -53,25 +54,25 @@ class SfxBindings; typedef void (*SfxVoidFunc)(); #define SDT_SDT_DOCFACTPRIO 10 // Explorer -#define SDT_SW_DOCFACTPRIO 20 // Text-Dokument -#define SDT_SWW_DOCFACTPRIO 21 // Web-Dokument -#define SDT_SC_DOCFACTPRIO 30 // Tabellen-Dokument -#define SDT_SI_DOCFACTPRIO 40 // Impress-Dokument -#define SDT_SD_DOCFACTPRIO 41 // Draw-Dokument -#define SDT_SCH_DOCFACTPRIO 50 // Chart-Dokument -#define SDT_SMA_DOCFACTPRIO 60 // Math-Dokument -#define SDT_SIM_DOCFACTPRIO 70 // Image-Dokument -#define SDT_FRM_DOCFACTPRIO 100 // Rahmen-Dokument -#define SDT_MSG_DOCFACTPRIO 110 // Nachrichten-Dokument -#define SDT_SDB_DOCFACTPRIO 200 // Datenbank-Dokument +#define SDT_SW_DOCFACTPRIO 20 // Text Document +#define SDT_SWW_DOCFACTPRIO 21 // Web Document +#define SDT_SC_DOCFACTPRIO 30 // Table Document +#define SDT_SI_DOCFACTPRIO 40 // Impress Document +#define SDT_SD_DOCFACTPRIO 41 // Draw Document +#define SDT_SCH_DOCFACTPRIO 50 // Chart Document +#define SDT_SMA_DOCFACTPRIO 60 // Math Document +#define SDT_SIM_DOCFACTPRIO 70 // Image Document +#define SDT_FRM_DOCFACTPRIO 100 // Frame Document +#define SDT_MSG_DOCFACTPRIO 110 // Message Document +#define SDT_SDB_DOCFACTPRIO 200 // Database Document //==================================================================== class SFX2_DLLPUBLIC SfxObjectFactory { private: - const char* pShortName; // Objekt-Kurzname - SfxObjectFactory_Impl* pImpl; // Zusatzdaten + const char* pShortName; + SfxObjectFactory_Impl* pImpl; // Additional Data SfxObjectShellFlags nFlags; SAL_DLLPRIVATE void Construct(); @@ -108,11 +109,9 @@ public: SfxModule* GetModule() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); SAL_DLLPRIVATE static void UpdateFilterContainers_Impl(); SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const; -//#endif private: // Kopieren verboten @@ -123,19 +122,16 @@ private: //========================================================================= #define SFX_DECL_OBJECTFACTORY() \ -private: \ - static SfxObjectFactory* pObjectFactory; \ public: \ static SfxObjectFactory& Factory(); \ virtual SfxObjectFactory& GetFactory() const { return Factory(); } #define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \ - SfxObjectFactory* ClassName::pObjectFactory = 0; \ - SfxObjectFactory& ClassName::Factory() \ - { if (!pObjectFactory) \ - pObjectFactory = \ - new SfxObjectFactory( GlobName, Flags, ShortName ); \ - return *pObjectFactory; \ - } + SfxObjectFactory& ClassName::Factory() \ + { \ + static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \ + return aObjectFactory; \ + } #endif // #ifndef _SFX_OBJFAC_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 87e62aef5b63..273fb3d3ef45 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,13 +45,14 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <tools/stream.hxx> #include <tools/string.hxx> -#include <tools/list.hxx> #include <svl/lstner.hxx> #include <tools/globname.hxx> #include <cppuhelper/weak.hxx> #include <ucbhelper/content.hxx> +#include <vector> + class SvKeyValueIterator; class SfxObjectFactory; class SfxFilter; @@ -63,8 +65,6 @@ class SfxItemSet; class DateTime; class SvStringsDtor; -#define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) - //____________________________________________________________________________________________________________________________________ // defines for namespaces //____________________________________________________________________________________________________________________________________ @@ -92,7 +92,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase SvGlobalName aFilterClass; SvStream* pInStream; SvStream* pOutStream; -//REMOVE SvStorageRef aStorage; const SfxFilter* pFilter; SfxItemSet* pSet; SfxMedium_Impl* pImp; @@ -160,11 +159,7 @@ public: void ReOpen(); void CompleteReOpen(); const String& GetName() const {return aLogicName;} -#if defined SINIX && defined GCC && defined C272 - const INetURLObject& GetURLObject(); -#else const INetURLObject& GetURLObject() const; -#endif void CheckFileDate( const ::com::sun::star::util::DateTime& aInitDate ); sal_Bool DocNeedsFileDateCheck(); @@ -183,7 +178,6 @@ public: void SetDataAvailableLink( const Link& rLink ); Link GetDataAvailableLink( ) const; - sal_uInt32 GetMIMEAndRedirect( String& ); sal_uInt32 GetErrorCode() const; sal_uInt32 GetError() const { return ERRCODE_TOERROR(GetErrorCode()); } @@ -277,7 +271,6 @@ public: SAL_DLLPRIVATE void SetUpdatePickList(sal_Bool); SAL_DLLPRIVATE sal_Bool IsUpdatePickList() const; -//REMOVE void SetStorage_Impl( SvStorage* pStor ); SAL_DLLPRIVATE void SetLongName(const String &rName) { aLongName = rName; } SAL_DLLPRIVATE const String & GetLongName() const { return aLongName; } @@ -329,10 +322,8 @@ public: SV_DECL_IMPL_REF( SfxMedium ) SV_DECL_COMPAT_WEAK( SfxMedium ) -#ifndef SFXMEDIUM_LIST -#define SFXMEDIUM_LIST -DECLARE_LIST( SfxMediumList, SfxMedium* ) -#endif +typedef ::std::vector< SfxMedium* > SfxMediumList; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx index 7a6af9040066..a951239d4a25 100644 --- a/sfx2/inc/sfx2/docfilt.hxx +++ b/sfx2/inc/sfx2/docfilt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,6 +39,7 @@ #include <tools/wldcrd.hxx> #include <comphelper/documentconstants.hxx> +#define SFX_FILTER_STARTPRESENTATION 0x20000000L #include <sfx2/sfxdefs.hxx> @@ -119,3 +121,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docinf.hxx b/sfx2/inc/sfx2/docinf.hxx index 9f7da1932110..22b13be1d56d 100644 --- a/sfx2/inc/sfx2/docinf.hxx +++ b/sfx2/inc/sfx2/docinf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,4 @@ bool SFX2_DLLPUBLIC SaveOlePropertySet( #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docinsert.hxx b/sfx2/inc/sfx2/docinsert.hxx index c4e4be12185e..40969a76dbe1 100644 --- a/sfx2/inc/sfx2/docinsert.hxx +++ b/sfx2/inc/sfx2/docinsert.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,15 +32,17 @@ #include <tools/errcode.hxx> #include <tools/link.hxx> #include <tools/string.hxx> +#include <vector> #include "sfx2/dllapi.h" namespace sfx2 { class FileDialogHelper; } class SfxMedium; -class SfxMediumList; class SfxItemSet; class SvStringsDtor; +typedef ::std::vector< SfxMedium* > SfxMediumList; + // ============================================================================ namespace sfx2 { @@ -87,3 +90,4 @@ public: #endif // _SFX_DOCINSERT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/dockwin.hxx b/sfx2/inc/sfx2/dockwin.hxx index c9138988fa45..021b9fdefe44 100644 --- a/sfx2/inc/sfx2/dockwin.hxx +++ b/sfx2/inc/sfx2/dockwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,9 +77,7 @@ protected: virtual sal_Bool Close(); virtual void Move(); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; } -//#endif public: SfxDockingWindow( SfxBindings *pBindings, @@ -113,7 +112,6 @@ public: void AutoShow( sal_Bool bShow = sal_True ); DECL_LINK( TimerHdl, Timer* ); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void Initialize_Impl(); SAL_DLLPRIVATE sal_uInt16 GetWinBits_Impl() const; SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize ); @@ -125,7 +123,6 @@ public: SAL_DLLPRIVATE void Pin_Impl( sal_Bool bPinned ); SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const; SAL_DLLPRIVATE void ReleaseChildWindow_Impl(); -//#endif }; class SfxDockingWrapper : public SfxChildWindow @@ -140,3 +137,5 @@ class SfxDockingWrapper : public SfxChildWindow }; #endif // #ifndef _SFXDOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docmacromode.hxx b/sfx2/inc/sfx2/docmacromode.hxx index 463e5dbe4aa2..48b58b4ecd9b 100644 --- a/sfx2/inc/sfx2/docmacromode.hxx +++ b/sfx2/inc/sfx2/docmacromode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -330,3 +331,5 @@ namespace sfx2 //........................................................................ #endif // SFX2_DOCMACROMODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/docstoragemodifylistener.hxx b/sfx2/inc/sfx2/docstoragemodifylistener.hxx index 977916ed532c..b6ac0da8becb 100644 --- a/sfx2/inc/sfx2/docstoragemodifylistener.hxx +++ b/sfx2/inc/sfx2/docstoragemodifylistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,10 +37,6 @@ #include <cppuhelper/implbase1.hxx> -namespace vos -{ - class IMutex; -} //........................................................................ namespace sfx2 @@ -66,10 +63,10 @@ namespace sfx2 class SFX2_DLLPUBLIC DocumentStorageModifyListener : public DocumentStorageModifyListener_Base { IModifiableDocument* m_pDocument; - ::vos::IMutex& m_rMutex; + ::osl::SolarMutex& m_rMutex; public: - DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::vos::IMutex& _rMutex ); + DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex ); void dispose(); @@ -93,3 +90,5 @@ namespace sfx2 //........................................................................ #endif // SFX2_DOCSTORAGEMODIFYLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/doctdlg.hxx b/sfx2/inc/sfx2/doctdlg.hxx index 9c991912448a..8d8e7dfdd546 100644 --- a/sfx2/inc/sfx2/doctdlg.hxx +++ b/sfx2/inc/sfx2/doctdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <vcl/lstbox.hxx> #include <vcl/edit.hxx> #include <vcl/fixed.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> @@ -84,3 +83,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx index bc0728b0ec1b..1216ef09bcdc 100644 --- a/sfx2/inc/sfx2/doctempl.hxx +++ b/sfx2/inc/sfx2/doctempl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -69,7 +70,7 @@ public: static sal_Bool SaveDir( /*SfxTemplateDir &rEntry */ ) ; const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &); - sal_Bool Rescan( ); // Aktualisieren + sal_Bool Rescan( ); void ReInitFromComponent(); sal_Bool IsRegionLoaded( sal_uInt16 nIdx ) const; @@ -86,16 +87,15 @@ public: String GetDefaultTemplatePath(const String &rLongName); - // Pfad zur Vorlage geben lassen; logischer Name muss angegeben - // werden, damit beim Ueberschreiben einer Vorlage der - // richtige Dateiname gefunden werden kann + // Path to the template; the logical name must be given in order to find + // the correct file name when overwriting a template String GetTemplatePath(sal_uInt16 nRegion, const String &rLongName) const; // Allows to retrieve the target template URL from the UCB ::rtl::OUString GetTemplateTargetURLFromComponent( const ::rtl::OUString& aGroupName, const ::rtl::OUString& aTitle ); - // Speichern als Vorlage hat geklappt -> Aktualisieren + // Save as template worked -> update void NewTemplate(sal_uInt16 nRegion, const String &rLongName, const String &rFileName); @@ -146,3 +146,4 @@ public: #endif // #ifndef _SFXDOCTEMPL_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/event.hxx b/sfx2/inc/sfx2/event.hxx index d24a38be0deb..6e28386b4f19 100644 --- a/sfx2/inc/sfx2/event.hxx +++ b/sfx2/inc/sfx2/event.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -140,3 +141,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/evntconf.hxx b/sfx2/inc/sfx2/evntconf.hxx index 791b63da930a..89fef8d61687 100644 --- a/sfx2/inc/sfx2/evntconf.hxx +++ b/sfx2/inc/sfx2/evntconf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,6 +45,7 @@ #endif #define ITEMID_MACRO SID_ATTR_MACROITEM #include <svl/macitem.hxx> +#include <vector> class SfxObjectShell; class SvxMacroTableDtor; @@ -64,16 +66,26 @@ struct SFX2_DLLPUBLIC SfxEventName , maUIName( rUIName ) {} }; -DECLARE_LIST( _SfxEventNamesList, SfxEventName* ) +typedef ::std::vector< SfxEventName* > _SfxEventNamesList; -class SFX2_DLLPUBLIC SfxEventNamesList : public _SfxEventNamesList +class SFX2_DLLPUBLIC SfxEventNamesList { +private: + _SfxEventNamesList aEventNamesList; + void DelDtor(); + public: - SfxEventNamesList( const sal_uInt16 nInitSz = 0, const sal_uInt16 nReSz = 1 ): _SfxEventNamesList( nInitSz, nReSz ) {} - SfxEventNamesList( const SfxEventNamesList &rCpy ) : _SfxEventNamesList() { *this = rCpy; } + SfxEventNamesList() {} + SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; } ~SfxEventNamesList() { DelDtor(); } SfxEventNamesList& operator=( const SfxEventNamesList &rCpy ); - void DelDtor(); + + size_t size() const { return aEventNamesList.size(); }; + + SfxEventName* at( size_t Index ) const + { return Index < aEventNamesList.size() ? aEventNamesList[ Index ] : NULL; } + + void push_back( SfxEventName* Item ) { aEventNamesList.push_back( Item ); } }; class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem @@ -117,3 +129,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/fcontnr.hxx b/sfx2/inc/sfx2/fcontnr.hxx index 90c43c1ff774..513846614d4c 100644 --- a/sfx2/inc/sfx2/fcontnr.hxx +++ b/sfx2/inc/sfx2/fcontnr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,6 +40,8 @@ #include <sfx2/docfilt.hxx> #include <sfx2/sfxdefs.hxx> +#include <boost/utility.hpp> + class Window; class SfxFilter; class SfxFilterArr_Impl; @@ -102,8 +105,6 @@ public: SfxFilterContainer( const String& rName ); ~SfxFilterContainer(); -// SfxFilterContainerFlags GetFlags() const; -// void SetFlags( SfxFilterContainerFlags eFlags ); const String GetName() const; @@ -115,31 +116,27 @@ public: const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; const SfxFilter* GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static void ReadFilters_Impl( sal_Bool bUpdate=sal_False ); SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xTypeCFG, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG, sal_Bool bUpdate ); SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const String& ); -//#endif }; class SfxFilterMatcher_Impl; -class SFX2_DLLPUBLIC SfxFilterMatcher +class SFX2_DLLPUBLIC SfxFilterMatcher : private boost::noncopyable { friend class SfxFilterMatcherIter; - SfxFilterMatcher_Impl *pImpl; + SfxFilterMatcher_Impl &m_rImpl; public: SfxFilterMatcher( const String& rFact ); SfxFilterMatcher(); ~SfxFilterMatcher(); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static sal_Bool IsFilterInstalled_Impl( const SfxFilter* pFilter ); DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String* ); -//#endif sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; sal_uInt32 GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; @@ -157,22 +154,23 @@ public: }; class SfxFilterContainer_Impl; -class SFX2_DLLPUBLIC SfxFilterMatcherIter +class SFX2_DLLPUBLIC SfxFilterMatcherIter : private boost::noncopyable + { SfxFilterFlags nOrMask; SfxFilterFlags nAndMask; sal_uInt16 nCurrent; - const SfxFilterMatcher_Impl *pMatch; + const SfxFilterMatcher_Impl &m_rMatch; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE const SfxFilter* Find_Impl(); -//#endif public: - SfxFilterMatcherIter( const SfxFilterMatcher* pMatchP, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED ); + SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED ); const SfxFilter* First(); const SfxFilter* Next(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 619358f077ac..bbcf9b8b5b27 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,9 +39,7 @@ #include <tools/errcode.hxx> #include <vcl/dialog.hxx> #include <vcl/edit.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/graph.hxx> #include <sfx2/sfxdefs.hxx> #include <sfx2/sfxuno.hxx> @@ -85,10 +84,10 @@ class Window; #define SFXWB_READONLY WB_READONLY // ((WinBits)0x02000000) #define SFXWB_PATHDIALOG WB_PATH // ((WinBits)0x00100000) #define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) -#define SFXWB_SHOWALLFOLDER 0x10000000L // alle Ordner auch Mail/News/... -#define SFXWB_MULTISELECTION 0x20000000L // Multiselection an +#define SFXWB_SHOWALLFOLDER 0x10000000L // All folders also mail/news/... +#define SFXWB_MULTISELECTION 0x20000000L #define SFXWB_NOREMOTE 0x40000000L -#define SFXWB_SHOWVERSIONS 0x80000000L // Versionsauswahl anzeigen +#define SFXWB_SHOWVERSIONS 0x80000000L #define SFXWB_GRAPHIC 0x00800000L // FileOpen with link and preview box #define SFXWB_SHOWSTYLES 0x01000000L // FileOpen with link and preview box and styles @@ -135,12 +134,9 @@ private: ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePickerListener > mxImp; FileDialogHelper_Impl *mpImp; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Int16 getDialogType( sal_Int64 nFlags ) const; -//#endif - public: FileDialogHelper( sal_Int64 nFlags, const String& rFactory, @@ -292,21 +288,18 @@ public: DECL_LINK( ExecuteSystemFilePicker, void* ); -//#if 0 // _SOLAR__PRIVATE ErrCode Execute( SvStringsDtor*& rpURLList, SfxItemSet *& rpSet, String& rFilter, const String& rDirPath ); ErrCode Execute( SfxItemSet *& rpSet, String& rFilter ); -//#endif }; #define SFX2_IMPL_DIALOG_CONFIG 0 #define SFX2_IMPL_DIALOG_SYSTEM 1 #define SFX2_IMPL_DIALOG_OOO 2 -//#if 0 // _SOLAR__PRIVATE ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, const String& rFact, SvStringsDtor *& rpURLList, @@ -316,10 +309,10 @@ ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG, const String& rStandardDir = String::CreateFromAscii( "" ), const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >()); -//#endif } //----------------------------------------------------------------------------- #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 622be188072a..1080824baeb7 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,9 +67,9 @@ namespace com #include <tools/ref.hxx> #include <tools/string.hxx> #include <svl/brdcst.hxx> -#include <tools/list.hxx> #include <svl/poolitem.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <vector> class SvBorder; class SfxWorkWindow; @@ -93,21 +94,20 @@ class SystemWindow; typedef SfxFrame* SfxFramePtr; class SfxFrameArr_Impl; -DECLARE_LIST( TargetList, String* ) +typedef ::std::vector< String* > TargetList; #define SFXFRAME_HASTITLE 0x0001 //========================================================================== -// Ein SfxFrame ist eine Verwaltungsklasse f"ur Fenster und deren Inhalte. -// Eine SfxApplication pr"asentiert sich als Hierarchie von SfxFrames, wobei -// die konkreten Inhalte in den abgeleiteten Klassen festgelegt werden. -// Die Basisklasse SfxFrame implementiert 2 Aspekte der Frames: Benennung und -// Kontrolle der Lebensdauer. -// Innerhalb einer Frames-Hierarchie kontrolliert immer der ParentFrame die -// Lebensdauer seiner ChildFrames, auch wenn sie in der Regel gar nicht von -// ihm selbst erzeugt wurden. Durch Aufruf vonn DoClose() an irgendeinem -// Frame in der Hierarchie kann ein Teil des "Frameworks" entfernt werden, -// wobei sich Frames an ihren ParentFrames selbst abmelden. +// SfxFrame is a management class for windows and their content. +// A SfxApplication represent a hierarchy of SfxFrames, with which the actual +// content in the derived classes is defined. The base class SfxFrame +// implements two aspects of frames: naming and control of its lifespan. +// Inside a frame hierarchy the parent frame always controls the lifespan of +// its child frames, even though they usually are not even produced by the +// parent. By calling DoCloser() on any frame in the hierarchy, +// a part of the "framework" can be removed, where frames unsubscribe +// from their parent frames. //========================================================================== class SfxFrameArr_Impl; @@ -183,7 +183,6 @@ public: sal_Bool IsInPlace() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool DoClose_Impl(); SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); @@ -195,7 +194,7 @@ public: SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; SAL_DLLPRIVATE void SetIsClosing_Impl(); - // Methoden f"ur den Zugriff auf das aktuelle Set + // Methods for accessing the current set SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* ); SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; @@ -225,7 +224,6 @@ public: SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; -//#endif private: SAL_DLLPRIVATE void Construct_Impl(); }; @@ -237,9 +235,7 @@ class SfxFrameIterator const SfxFrame* pFrame; sal_Bool bRecursive; -//#if 0 // _SOLAR__PRIVATE SfxFrame* NextSibling_Impl( SfxFrame& rPrev ); -//#endif public: SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True ); @@ -267,8 +263,8 @@ public: virtual String GetValueText() const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); sal_Bool FrameKilled() const { return &wFrame != pFrame; } @@ -286,8 +282,8 @@ public: { return aValue; } virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem @@ -304,10 +300,12 @@ public: { return m_xFrame; } virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; typedef SfxUsrAnyItem SfxUnoAnyItem; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/frmdescr.hxx b/sfx2/inc/sfx2/frmdescr.hxx index cc6ae5f4cb7e..f1c62c66f129 100644 --- a/sfx2/inc/sfx2/frmdescr.hxx +++ b/sfx2/inc/sfx2/frmdescr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,16 +47,14 @@ typedef SfxFrameDescriptor* SfxFrameDescriptorPtr; SV_DECL_PTRARR(SfxFramesArr, SfxFrameDescriptorPtr, 4, 2) //=========================================================================== -// Die SfxFrame...descriptoren bauen eine rekursive Struktur auf, die -// s"amtliche zur Anzeige des Frame-Dokuments erforderlichen Daten umfa\st. -// "Uber einen SfxFrameSetDescriptor hat man Zugriff auf die gesamte darunter -// liegende Struktur. -// Aufgrund der besonderen Eigenschaften des SfxFrames-Dokuments ist ein -// SfxFramesSetDescriptor nicht nur der Inhalt dieses Dokuments, sondern -// beschreibt auch die View darauf. -// Das FrameSet wird aus Zeilen aufgebaut, die wiederum die eigentlichen -// Fenster enthalten. Eine Zeile kann horizontal oder vertikal ausgerichtet -// sein, woraus sich auch das Alignment des FrameSets ergibt. +// The SfxFrame descriptors build a recursive structure, that covers all the +// required data in-order to display the frame document. +// Through a SfxFrameSetDescriptor access is given to the whole underlying +// structure. Due to the nature of the SfxFrames document, the +// SfxFramesSetDescriptor is not only the content of this document, but also +// describes the view on it. The FrameSet is made up of lines, which in turn, +// contains the actual window . A line can be horizontally or vertically +// aligned, from which also the alignment of the FrameSet is given. //=========================================================================== enum ScrollingMode @@ -104,7 +103,7 @@ public: SfxFrameDescriptor(); ~SfxFrameDescriptor(); - // Eigenschaften + // Properties void TakeProperties( const SfxFrameProperties& rProp ); // FileName/URL @@ -183,7 +182,7 @@ public: void SetHasUI( sal_Bool bOn ) { bHasUI = bOn; } - // Attribute f"ur das Splitwindow + // Attribute for Splitwindow sal_uInt16 GetItemId() const { return nItemId; } void SetItemId( sal_uInt16 nId ) @@ -192,11 +191,11 @@ public: long GetSize() const; sal_uInt16 GetItemPos() const; - // Kopie z.B. f"ur die Views + // Copy for example for Views SfxFrameDescriptor* Clone( sal_Bool bWithIds = sal_True ) const; }; -// Kein Bock, einen operator= zu implementieren... +// No block to implement a =operator struct SfxFrameProperties { String aURL; @@ -280,9 +279,6 @@ public: UniString &rText, const IntlWrapper * = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - //virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; - //virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; - //virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; const SfxFrameProperties& GetProperties() const { return aProperties; } @@ -292,3 +288,4 @@ public: #endif // #ifndef _SFX_FRMDESCRHXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/frmhtml.hxx b/sfx2/inc/sfx2/frmhtml.hxx index 9c3ff64e688a..c6d007bea86d 100644 --- a/sfx2/inc/sfx2/frmhtml.hxx +++ b/sfx2/inc/sfx2/frmhtml.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,10 +51,11 @@ protected: SfxHTMLParser( rStream, bIsNewDoc, pMediumPtr ) {}; public: - // Diese Methoden koennen auch von anderen Parsern benutzt werden + // These methods can also be used by other parsers. static void ParseFrameOptions(SfxFrameDescriptor*, const HTMLOptions*, const String& ); }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/frmhtmlw.hxx b/sfx2/inc/sfx2/frmhtmlw.hxx index e6b681c57f93..9521d6982fb6 100644 --- a/sfx2/inc/sfx2/frmhtmlw.hxx +++ b/sfx2/inc/sfx2/frmhtmlw.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,4 @@ inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/genlink.hxx b/sfx2/inc/sfx2/genlink.hxx index 35a7534e6294..81479a0af846 100644 --- a/sfx2/inc/sfx2/genlink.hxx +++ b/sfx2/inc/sfx2/genlink.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/hintpost.hxx b/sfx2/inc/sfx2/hintpost.hxx index 375a22f5b2ec..13c4993bca5d 100644 --- a/sfx2/inc/sfx2/hintpost.hxx +++ b/sfx2/inc/sfx2/hintpost.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,17 +39,16 @@ class SfxHint; class SfxHintPoster: public SvRefBase -/* [Beschreibung] +/* [Description] - Mit Instanzen dieser Klasse k"onnen eindeutige Events per PostUserEvent - "uber die StarView-Application verschickt werden. Wenn das User-Event - ausgel"ost wird, wird der Handler <Event()> gerufen, dessen - Basisimplementierung den mit <SetEventHdl()> angegbenen Link ruft. + With instances of this class unique events per PostUserEvent can be sent + using the StarView-application. If the User-Event is triggered often, + the handler <Event()> is called, the base implementation with the + <SetEventHdl()> line is making these link calls. - Die Instanz wird via Ref-Count mindestens solange gehalten, wie - ein ggf. abgeschicktes Event noch nicht angekommen ist. Sollte das - Ziel vorher sterben, ist die Verbindung zuvor mit 'SetEventHdl(GenLink())' - zu kappen. + The instance are held via Ref-Count at least as long as a possible sent + event has not arrived yet. Should be killed before the goal, before the + connection is SetEventHdl (GenLink ()) . */ { @@ -57,9 +57,7 @@ class SfxHintPoster: public SvRefBase private: void RegisterEvent(); -//#if 0 // _SOLAR__PRIVATE DECL_LINK( DoEvent_Impl, SfxHint * ); -//#endif protected: virtual ~SfxHintPoster(); @@ -78,3 +76,5 @@ public: SV_DECL_IMPL_REF(SfxHintPoster); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/htmlmode.hxx b/sfx2/inc/sfx2/htmlmode.hxx index 51f341c5c3c0..5f3c36c147d5 100644 --- a/sfx2/inc/sfx2/htmlmode.hxx +++ b/sfx2/inc/sfx2/htmlmode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,19 +30,19 @@ #define HTMLMODE_ON 0x0001 -#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */ -#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */ -#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */ -#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */ +#define HTMLMODE_PARA_BORDER 0x0002 +#define HTMLMODE_PARA_DISTANCE 0x0004 +#define HTMLMODE_SMALL_CAPS 0x0008 +#define HTMLMODE_FRM_COLUMNS 0x0010 #define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */ #define HTMLMODE_FULL_STYLES 0x0040 /* == SW */ -#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/ -#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */ -#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/ -#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */ -#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */ -#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */ -#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/ +#define HTMLMODE_BLINK 0x0080 +#define HTMLMODE_PARA_BLOCK 0x0100 +#define HTMLMODE_DROPCAPS 0x0200 +#define HTMLMODE_FIRSTLINE 0x0400 /* First-line intent with Spacer == NS 3.0 */ +#define HTMLMODE_GRAPH_POS 0x0800 +#define HTMLMODE_FULL_ABS_POS 0x1000 +#define HTMLMODE_SOME_ABS_POS 0x2000 #define HTMLMODE_RESERVED1 0x4000 #define HTMLMODE_RESERVED0 0x8000 @@ -66,3 +67,4 @@ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/imagemgr.hxx b/sfx2/inc/sfx2/imagemgr.hxx index fb5337f63b5a..0bbde7a0b47b 100644 --- a/sfx2/inc/sfx2/imagemgr.hxx +++ b/sfx2/inc/sfx2/imagemgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,4 +34,10 @@ #include <rtl/ustring.hxx> #include <vcl/image.hxx> -SFX2_DLLPUBLIC Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ); +SFX2_DLLPUBLIC Image SAL_CALL GetImage( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::rtl::OUString& aURL, + bool bBig +); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/imgdef.hxx b/sfx2/inc/sfx2/imgdef.hxx index 1aa34a393b33..a729eb6cda84 100644 --- a/sfx2/inc/sfx2/imgdef.hxx +++ b/sfx2/inc/sfx2/imgdef.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,4 @@ #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/imgmgr.hxx b/sfx2/inc/sfx2/imgmgr.hxx index 555cd37939b3..de3c9b55ecfc 100644 --- a/sfx2/inc/sfx2/imgmgr.hxx +++ b/sfx2/inc/sfx2/imgmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ #include <sal/types.h> #include <tools/gen.hxx> -#ifndef _IMAGE_HXX //autogen #include <vcl/image.hxx> -#endif class ToolBox; class SfxModule; @@ -55,13 +54,15 @@ public: // get images from resources void SetImages( ToolBox& rToolBox ); - void SetImages( ToolBox& rToolBox, sal_Bool bHiContrast, sal_Bool bLarge ); - void SetImagesForceSize( ToolBox& rToolBox, sal_Bool bHiContrast, sal_Bool bLarge ); + void SetImages( ToolBox& rToolBox, bool bLarge ); + void SetImagesForceSize( ToolBox& rToolBox, bool bLarge ); - Image GetImage( sal_uInt16 nId, sal_Bool bLarge, sal_Bool bHiContrast ) const; - Image GetImage( sal_uInt16 nId, sal_Bool bHiContrast ) const; - Image SeekImage( sal_uInt16 nId, sal_Bool bLarge, sal_Bool bHiContrast ) const; - Image SeekImage( sal_uInt16 nId, sal_Bool bHiContrast ) const; + Image GetImage( sal_uInt16 nId, bool bLarge ) const; + Image GetImage( sal_uInt16 nId) const; + Image SeekImage( sal_uInt16 nId, bool bLarge ) const; + Image SeekImage( sal_uInt16 nId ) const; }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/ipclient.hxx b/sfx2/inc/sfx2/ipclient.hxx index d302bc53442e..a441acad6b2e 100644 --- a/sfx2/inc/sfx2/ipclient.hxx +++ b/sfx2/inc/sfx2/ipclient.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,11 +99,9 @@ public: void ResetObject(); sal_Bool IsUIActive(); - // used in Writer - // Rectangle PixelObjVisAreaToLogic( const Rectangle & rObjRect ) const; - // Rectangle LogicObjAreaToPixel( const Rectangle & rRect ) const; virtual void FormatChanged(); // object format was changed (used for StarMath formulas aligning) }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/itemconnect.hxx b/sfx2/inc/sfx2/itemconnect.hxx index 3d93bded533f..7808de9d32f8 100644 --- a/sfx2/inc/sfx2/itemconnect.hxx +++ b/sfx2/inc/sfx2/itemconnect.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,8 +49,6 @@ const ItemConnFlags ITEMCONN_NONE = 0x0000; /** Connection is inactive - virtual functions will not be called. */ const ItemConnFlags ITEMCONN_INACTIVE = 0x0001; -/** Clone item in FillItemSet() from old item set. */ -//const ItemConnFlags ITEMCONN_CLONE_ITEM = 0x0002; /** Enable control(s), if the item is known. */ const ItemConnFlags ITEMCONN_ENABLE_KNOWN = 0x0010; @@ -593,3 +592,4 @@ ValueSetConnection< ItemWrpT >::ValueSetConnection( #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/itemwrapper.hxx b/sfx2/inc/sfx2/itemwrapper.hxx index 939182eae12d..55d7c9b2a4d3 100644 --- a/sfx2/inc/sfx2/itemwrapper.hxx +++ b/sfx2/inc/sfx2/itemwrapper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -205,3 +206,4 @@ const ItemT& SingleItemWrapper< ItemT, ValueT >::GetDefaultItem( const SfxItemSe #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/layout-post.hxx b/sfx2/inc/sfx2/layout-post.hxx index 91ae78410500..e7eddef08f39 100644 --- a/sfx2/inc/sfx2/layout-post.hxx +++ b/sfx2/inc/sfx2/layout-post.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ #endif /* ENABLE_LAYOUT */ #endif /* _SFX2_LAYOUT_POST_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/layout-pre.hxx b/sfx2/inc/sfx2/layout-pre.hxx index fdd4d418ebf9..db467fd06da7 100644 --- a/sfx2/inc/sfx2/layout-pre.hxx +++ b/sfx2/inc/sfx2/layout-pre.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,3 +48,5 @@ #endif /* ENABLE_LAYOUT */ #endif /* _SFX2_LAYOUT_PRE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/layout-tabdlg.hxx b/sfx2/inc/sfx2/layout-tabdlg.hxx index a5099a3a6b75..2629b2c7c106 100644 --- a/sfx2/inc/sfx2/layout-tabdlg.hxx +++ b/sfx2/inc/sfx2/layout-tabdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,4 @@ #endif /* _LAYOUT_SFX_TABDLG_HXX */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/layout.hxx b/sfx2/inc/sfx2/layout.hxx index d92ed2ac4ac1..95bd42d39c88 100644 --- a/sfx2/inc/sfx2/layout.hxx +++ b/sfx2/inc/sfx2/layout.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,18 +50,6 @@ public: SfxDialog (::Window* parent, char const* xml_file, char const* id, SfxBindings* bindings=0, SfxChildWindow* child=0); }; -#if 0 -class SFX2_DLLPUBLIC SfxTabDialog - : public ::SfxTabDialog - , public InPlug -{ -public: - SfxTabDialog (::Window *parent, char const* xml_file, char const* id, ResId const& res_id, SfxItemSet const* set=0); - ::Window* GetParent () const; - void FreeResource (); -}; -#endif - class SFX2_DLLPUBLIC SfxTabPage : public ::SfxTabPage , public InPlug @@ -76,3 +65,5 @@ public: } // end namespace layout #endif /* _SFX2_LAYOUT_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/linkmgr.hxx b/sfx2/inc/sfx2/linkmgr.hxx index 5a1dd1b15bd7..39fcd6bd3918 100644 --- a/sfx2/inc/sfx2/linkmgr.hxx +++ b/sfx2/inc/sfx2/linkmgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,16 +34,24 @@ #include <tools/string.hxx> #include <svl/svarray.hxx> +#include <vector> + class SfxObjectShell; class Graphic; class Size; +namespace com { namespace sun { namespace star { + namespace lang { + class XComponent; + } +}}} + namespace sfx2 { - // Damit der Link ueber den Status der zu ladenen Grafik informierten werden - // verschickt das FileObject ein SvData, mit der FormatId - // "RegisterStatusInfoId" und ein einem String als Datentraeger. Dieser - // enthaelt den folgenden enum. + // For the link to receive information about the status of graphics that + // will be loaded the FileObject sends a SvData, which contains the + // FormatID "RegisterStatusInfoId" and a string as the data container. + // This contains the following enum. class SvBaseLink; class SvBaseLinkRef; @@ -55,10 +64,14 @@ SV_DECL_PTRARR( SvLinkSources, SvLinkSourcePtr, 1, 1 ) class SFX2_DLLPUBLIC LinkManager { + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > + CompVector; + CompVector maCachedComps; + SvBaseLinks aLinkTbl; SvLinkSources aServerTbl; - SfxObjectShell *pPersist; // LinkMgr muss vor SfxObjectShell freigegeben werden + SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell protected: sal_Bool InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, sal_uInt16 nUpdateType, const String* pName = 0 ); @@ -74,6 +87,16 @@ public: LinkManager( SfxObjectShell * pCacheCont ); ~LinkManager(); + /** + * Insert a component loaded during link update, which needs to be closed + * when the update is complete. + * + * @param xComp component loaded during link update. + */ + void InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp); + + void CloseCachedComps(); + SfxObjectShell* GetPersist() const { return pPersist; } void SetPersist( SfxObjectShell * p ) { pPersist = p; } @@ -81,26 +104,37 @@ public: void Remove( sal_uInt16 nPos, sal_uInt16 nCnt = 1 ); sal_Bool Insert( SvBaseLink* pLink ); - // den Link mit einem SvLinkSource verbinden und in die Liste eintragen + // the links connect to a SvLinkSource and adds to the list sal_Bool InsertDDELink( SvBaseLink*, const String& rServer, const String& rTopic, const String& rItem ); - // falls am Link schon alles eingestellt ist ! + // if everything is already set at the link! sal_Bool InsertDDELink( SvBaseLink* ); - // den Link mit einem PseudoObject verbinden und in die Liste eintragen + // Connect the links to a pseudo-object and add to the list sal_Bool InsertFileLink( sfx2::SvBaseLink&, sal_uInt16 nFileType, const String& rTxt, const String* pFilterNm = 0, const String* pRange = 0 ); - // falls am Link schon alles eingestellt ist ! + // if everything is already set for the link! sal_Bool InsertFileLink( sfx2::SvBaseLink& ); - // erfrage die Strings fuer den Dialog + void ReconnectDdeLink(SfxObjectShell& rServer); + + /** + * Reconnect the server document shell to a DDE link object. + * + * @param rPath path to the server document + * @param rServer server document shell instance + * @param rLink link object of the client document + */ + void LinkServerShell(const ::rtl::OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const; + + // Obtain the string for the dialog sal_Bool GetDisplayNames( const SvBaseLink *, String* pType, String* pFile = 0, @@ -114,29 +148,29 @@ public: sal_Bool bUpdateGrfLinks = sal_False, Window* pParentWin = 0 ); - // Liste aller Links erfragen (z.B. fuer Verknuepfungs-Dialog) + // Call for list of links (eg for link-dialog) const SvBaseLinks& GetLinks() const { return aLinkTbl; } - // ----------------- Serverseitige Verwaltung -------------------- + // ----------------- Server-side management -------------------- - // Liste der zu serviereden Links erfragen + // Call with list of links to server const SvLinkSources& GetServers() const { return aServerTbl; } - // einen zu servierenden Link eintragen/loeschen + // Link register/delete sal_Bool InsertServer( SvLinkSource* rObj ); void RemoveServer( SvLinkSource* rObj ); void RemoveServer( sal_uInt16 nPos, sal_uInt16 nCnt = 1 ) { aServerTbl.Remove( nPos, nCnt ); } - // eine Uebertragung wird abgebrochen, also alle DownloadMedien canceln - // (ist zur Zeit nur fuer die FileLinks interressant!) + // A transfer is aborted, so cancel all download media + // (for the time beeing this is only of interest for the FileLinks!) void CancelTransfers(); - // um Status Informationen aus dem FileObject an den BaseLink zu - // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat - // dann die entsprechenden Informationen als String. - // Wird zur Zeit fuer FileObject in Verbindung mit JavaScript benoetigt - // - das braucht Informationen ueber Load/Abort/Error - static sal_uIntPtr RegisterStatusInfoId(); + // To send status information from the FileObject to the Baselink, + // for this there exist a separate ClipBoardId. The SvData-object has + // got the appropriate information as a string. + // Is now required for FileObject in conjunction with JavaScript + // this needs information about Load/Abort/Error + static sal_uIntPtr RegisterStatusInfoId(); // if the mimetype says graphic/bitmap/gdimetafile then get the // graphic from the Any. Return says no errors @@ -149,15 +183,15 @@ private: LinkManager& operator=( const LinkManager& ); }; -// Trenner im LinkName fuer die DDE-/File-/Grafik- Links -// (nur wer es braucht, um einen SvLinkName zusammenzubasteln) +// Separator in the link name for the DDE-/File-/Graphics- links +// (only those who need to construct a SvLinkName) const sal_Unicode cTokenSeperator = 0xFFFF; -// erzeuge einen String fuer den SvLinkName. Fuer -// - DDE die ersten 3 Strings, (Server, Topic, Item) -// - File-/Grf-LinkNms die letzen 3 Strings (FileName, Bereich, Filter) +// create a string for the SvLinkName. For: +// - DDE the first 3 Strings, (Server, Topic, Item) +// - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter) SFX2_DLLPUBLIC void MakeLnkName( String& rName, - const String* pType, // kann auch 0 sein !! + const String* pType, // Can also be null!! const String& rFile, const String& rLink, const String* pFilter = 0 ); @@ -166,3 +200,4 @@ SFX2_DLLPUBLIC void MakeLnkName( String& rName, #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/linksrc.hxx b/sfx2/inc/sfx2/linksrc.hxx index 16e9af685c8e..7b6f1fbb26d1 100644 --- a/sfx2/inc/sfx2/linksrc.hxx +++ b/sfx2/inc/sfx2/linksrc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "sal/config.h" #include "sfx2/dllapi.h" -#ifndef _TOOLS_REF_HXX #include <tools/ref.hxx> -#endif #include <tools/rtti.hxx> #include <com/sun/star/io/XInputStream.hpp> @@ -44,13 +43,12 @@ namespace com { namespace sun { namespace star { namespace uno { class Any; - //class Type; }}}} class Window; class String; #ifndef ADVISEMODE_NODATA -// Muessen die gleichen Werte wie Ole2 ADVF_* sein +// Must be the same value as Ole2 ADVF_* #define ADVISEMODE_NODATA 0x01 //#define ADVISEMODE_PRIMEFIRST 0x02 #define ADVISEMODE_ONLYONCE 0x04 @@ -74,7 +72,6 @@ public: SvLinkSource(); virtual ~SvLinkSource(); -// SvBaseLink* GetDataBaseLink() const; sal_Bool HasDataLinks( const SvBaseLink* = 0 ) const; void Closed(); @@ -124,12 +121,12 @@ public: StreamToLoadFrom getStreamToLoadFrom(); void setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly ); - // --> OD 2008-06-18 #i88291# void clearStreamToLoadFrom(); - // <-- }; SV_DECL_IMPL_REF(SvLinkSource); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/lnkbase.hxx b/sfx2/inc/sfx2/lnkbase.hxx index ffd3020fa9d0..621e597c23bd 100644 --- a/sfx2/inc/sfx2/lnkbase.hxx +++ b/sfx2/inc/sfx2/lnkbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,17 +32,12 @@ #include "sal/config.h" #include "sfx2/dllapi.h" #include <sot/exchange.hxx> -#ifndef _TOOLS_REF_HXX #include <tools/ref.hxx> -#endif -#ifndef _LINKSOURCE_HXX #include <sfx2/linksrc.hxx> -#endif namespace com { namespace sun { namespace star { namespace uno { class Any; - //class Type; }}}} namespace sfx2 @@ -58,16 +54,16 @@ class FileDialogHelper; #define OBJECT_DDE_EXTERN 0x02 #endif -#define OBJECT_CLIENT_SO 0x80 // ein Link +#define OBJECT_CLIENT_SO 0x80 // a Link #define OBJECT_CLIENT_DDE 0x81 -//#define OBJECT_CLIENT_OLE 0x82 // ein Ole-Link -//#define OBJECT_CLIENT_OLE_CACHE 0x83 // ein Ole-Link mit SvEmbeddedObject +//#define OBJECT_CLIENT_OLE 0x82 // a Ole-Link +//#define OBJECT_CLIENT_OLE_CACHE 0x83 // a Ole-Link with SvEmbeddedObject #define OBJECT_CLIENT_FILE 0x90 #define OBJECT_CLIENT_GRF 0x91 #define OBJECT_CLIENT_OLE 0x92 // embedded link enum sfxlink { - // Ole2 compatibel und persistent + // Ole2 compatibel and persistent LINKUPDATE_ALWAYS = 1, LINKUPDATE_ONCALL = 3, @@ -88,7 +84,7 @@ private: sal_uInt16 nObjType; sal_Bool bVisible : 1; sal_Bool bSynchron : 1; - sal_Bool bUseCache : 1; // fuer GrafikLinks! + sal_Bool bUseCache : 1; // for Graphics Links! sal_Bool bWasLastEditOK : 1; DECL_LINK( EndEditHdl, String* ); @@ -98,9 +94,9 @@ private: protected: void SetObjType( sal_uInt16 ); - // setzen des LinkSourceName ohne aktion + // Set LinkSourceName without action void SetName( const String & rLn ); - // LinkSourceName der im SvLinkBase steht + // LinkSourceName which is in SvLinkBase String GetName() const; ImplBaseLinkData* pImplData; @@ -124,7 +120,7 @@ protected: public: TYPEINFO(); - // ask JP + virtual void Closed(); SvBaseLink( const String& rNm, sal_uInt16 nObjectType, SvLinkSource* ); @@ -137,8 +133,13 @@ public: void SetLinkSourceName( const String & rName ); String GetLinkSourceName() const; - virtual void DataChanged( const String & rMimeType, - const ::com::sun::star::uno::Any & rValue ); + enum UpdateResult { + SUCCESS = 0, + ERROR_GENERAL = 1 + }; + + virtual UpdateResult DataChanged( + const String & rMimeType, const ::com::sun::star::uno::Any & rValue ); void SetUpdateMode( sal_uInt16 ); sal_uInt16 GetUpdateMode() const; @@ -155,10 +156,10 @@ public: // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this virtual void Edit( Window*, const Link& rEndEditHdl ); - // soll der Link im Dialog angezeigt werden ? (Links im Link im ...) + // should the link appear in the dialog? (to the left in the link in the...) sal_Bool IsVisible() const { return bVisible; } void SetVisible( sal_Bool bFlag ) { bVisible = bFlag; } - // soll der Link synchron oder asynchron geladen werden? + // should the Link be loaded synchronous or asynchronous? sal_Bool IsSynchron() const { return bSynchron; } void SetSynchron( sal_Bool bFlag ) { bSynchron = bFlag; } @@ -170,9 +171,8 @@ public: sal_Bool bIsReadOnly ) { m_xInputStreamToLoadFrom = xInputStream; m_bIsReadOnly = bIsReadOnly; } - // --> OD 2008-06-18 #i88291# + // #i88291# void clearStreamToLoadFrom(); - // <-- inline sal_Bool WasLastEditOK() const { return bWasLastEditOK; } FileDialogHelper* GetFileDialog( sal_uInt32 nFlags, const String& rFactory ) const; @@ -183,3 +183,5 @@ SV_DECL_IMPL_REF(SvBaseLink); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/macrconf.hxx b/sfx2/inc/sfx2/macrconf.hxx new file mode 100644 index 000000000000..60692b4c49a6 --- /dev/null +++ b/sfx2/inc/sfx2/macrconf.hxx @@ -0,0 +1,141 @@ +/* -*- 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_MACROCONF_HXX +#define _SFX_MACROCONF_HXX + +#include "sal/config.h" +#include "sfx2/dllapi.h" +#include "sal/types.h" +#include <tools/errcode.hxx> +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> // SvUShorts +#include <sfx2/evntconf.hxx> + +class SfxMacroInfo; +class SfxSlot; +class SfxMacroInfoItem; +class SfxObjectShell; +class BasicManager; +struct SfxMacroConfig_Impl; +class SbMethod; +class SbxValue; +class SbxObject; +class SbxArray; +class SvStream; +class SvxMacro; + +typedef SfxMacroInfo* SfxMacroInfoPtr; +SV_DECL_PTRARR(SfxMacroInfoArr_Impl, SfxMacroInfoPtr, 5, 5) + +class SFX2_DLLPUBLIC SfxMacroInfo +{ +friend class SfxMacroConfig; +friend class SfxEventConfiguration; + + String* pHelpText; + sal_uInt16 nRefCnt; + sal_Bool bAppBasic; + String aLibName; + String aModuleName; + String aMethodName; + sal_uInt16 nSlotId; + SfxSlot* pSlot; + +public: + SfxMacroInfo( const String& rURL ); + SfxMacroInfo( bool _bAppBasic = true ); + SfxMacroInfo( bool _bAppBasic, const String& rQualifiedName ); + SfxMacroInfo(SfxMacroInfo& rOther); + SfxMacroInfo(bool _bAppBasic, const String& rLibName, + const String& rModuleName, const String& rMethodName); + ~SfxMacroInfo(); + sal_Bool operator==(const SfxMacroInfo& rOther) const; + String GetMacroName() const; + String GetQualifiedName() const; + String GetFullQualifiedName() const; + BasicManager* GetBasicManager() const; + String GetBasicName() const; + String GetHelpText() const; + sal_Bool IsAppMacro() const + { return bAppBasic; } + const String& GetModuleName() const + { return aModuleName; } + const String& GetLibName() const + { return aLibName; } + const String& GetMethodName() const + { return aMethodName; } + sal_uInt16 GetSlotId() const + { return nSlotId; } + SfxSlot* GetSlot() const + { return pSlot; } + + sal_Bool Compare( const SvxMacro& ) const; + void SetHelpText( const String& rText ); + String GetURL() const; +}; + +class SFX2_DLLPUBLIC SfxMacroConfig +{ +friend class SfxEventConfiguration; + + SAL_DLLPRIVATE static SfxMacroConfig* pMacroConfig; + + SfxMacroConfig_Impl* pImp; + SvUShorts aIdArray; + +public: + SfxMacroConfig(); + ~SfxMacroConfig(); + + static SfxMacroConfig* GetOrCreate(); + + static String RequestHelp( sal_uInt16 nId ); + static sal_Bool IsMacroSlot( sal_uInt16 nId ); + static sal_Bool IsBasic( SbxObject*, const String&, BasicManager* ); + static ErrCode Call( SbxObject*, const String&, BasicManager*, + SbxArray *pArgs=NULL, SbxValue *pRet=NULL ); + static SbMethod* GetMethod_Impl( const String&, BasicManager* ); + + sal_uInt16 GetSlotId(SfxMacroInfoPtr); + void ReleaseSlotId(sal_uInt16 nId); + void RegisterSlotId(sal_uInt16 nId); + SfxMacroInfo* GetMacroInfo(sal_uInt16 nId) const; + sal_Bool ExecuteMacro(sal_uInt16 nId, const String& rArgs ) const; + sal_Bool ExecuteMacro( SfxObjectShell*, const SvxMacro*, const String& ) const; + sal_Bool CheckMacro(sal_uInt16 nId) const; + sal_Bool CheckMacro( SfxObjectShell*, const SvxMacro* ) const; + + SAL_DLLPRIVATE static void Release_Impl(); + SAL_DLLPRIVATE const SfxMacroInfo* GetMacroInfo_Impl( const SvxMacro *pMacro ) const; + DECL_DLLPRIVATE_LINK( CallbackHdl_Impl, SfxMacroConfig*); + DECL_DLLPRIVATE_LINK( EventHdl_Impl, SfxMacroInfo*); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/mailmodelapi.hxx b/sfx2/inc/sfx2/mailmodelapi.hxx index d94583f44eb2..3411a7647451 100644 --- a/sfx2/inc/sfx2/mailmodelapi.hxx +++ b/sfx2/inc/sfx2/mailmodelapi.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,11 @@ #include <tools/string.hxx> #include "sfx2/dllapi.h" -// class SfxMailModel_Impl ----------------------------------------------- +// class AddressList_Impl ------------------------------------------------ +typedef String* AddressItemPtr_Impl; +typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl; -class AddressList_Impl; +// class SfxMailModel_Impl ----------------------------------------------- class SFX2_DLLPUBLIC SfxMailModel { @@ -139,3 +142,5 @@ public: sal_Bool CreateFromAddress_Impl( String& rFrom ); #endif // INCLUDED_SFX_MAILMODEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/mgetempl.hxx b/sfx2/inc/sfx2/mgetempl.hxx index a599163116e5..21af363ca94f 100644 --- a/sfx2/inc/sfx2/mgetempl.hxx +++ b/sfx2/inc/sfx2/mgetempl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,18 +32,16 @@ #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> #include <svtools/stdctrl.hxx> -#ifndef _SV_MEDIT_HXX #include <svtools/svmedit.hxx> -#endif #include <sfx2/tabdlg.hxx> #include <svtools/svmedit2.hxx> #include <svtools/svmedit.hxx> -/* erwartet: - SID_TEMPLATE_NAME : In: StringItem, Name der Vorlage - SID_TEMPLATE_FAMILY : In: Familie der Vorlage +/* expected: + SID_TEMPLATE_NAME : In: StringItem, Name of Template + SID_TEMPLATE_FAMILY : In: Family of Template */ class SfxStyleFamilies; @@ -80,7 +79,7 @@ class SfxManageStyleSheetPage : public SfxTabPage String aBuf; sal_Bool bModified; - // initiale Daten des Styles + // initial data for the style String aName; String aFollow; String aParent; @@ -89,13 +88,11 @@ class SfxManageStyleSheetPage : public SfxTabPage private: friend class SfxStyleDialog; -//#if 0 // _SOLAR__PRIVATE DECL_LINK( GetFocusHdl, Edit * ); DECL_LINK( LoseFocusHdl, Edit * ); void UpdateName_Impl(ListBox *, const String &rNew); void SetDescriptionText_Impl(); -//#endif SfxManageStyleSheetPage(Window *pParent, const SfxItemSet &rAttrSet ); ~SfxManageStyleSheetPage(); @@ -118,3 +115,4 @@ protected: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/mieclip.hxx b/sfx2/inc/sfx2/mieclip.hxx index 7a00cabd307e..72f2e4e0487b 100644 --- a/sfx2/inc/sfx2/mieclip.hxx +++ b/sfx2/inc/sfx2/mieclip.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,4 @@ public: #endif //_MIECLIP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/minarray.hxx b/sfx2/inc/sfx2/minarray.hxx index 6ccd7e0081c4..9ed76ede6039 100644 --- a/sfx2/inc/sfx2/minarray.hxx +++ b/sfx2/inc/sfx2/minarray.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,6 @@ #include <string.h> #include <tools/solar.h> #include <tools/debug.hxx> -//#include "typecast.hxx" #if defined (ALPHA) && defined (UNX) #define DEL_ARRAY( X ) @@ -60,7 +60,6 @@ public:\ const T& GetObject( sal_uInt16 nPos ) const; \ T& GetObject( sal_uInt16 nPos ); \ \ - void Insert( sal_uInt16 nPos, ARR& rIns, sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX );\ void Insert( sal_uInt16 nPos, const T& rElem );\ void Insert( sal_uInt16 nPos, const T& rElems, sal_uInt16 nLen );\ void Append( const T& rElem );\ @@ -77,11 +76,6 @@ public:\ void Clear() { Remove( 0, Count() ); }\ };\ \ -inline void ARR::Insert( sal_uInt16 nPos, ARR& rIns, sal_uInt16 nStart, sal_uInt16 nEnd )\ -{\ - Insert( nPos, *(rIns.pData+(sizeof(T)*nStart)), nStart-nEnd+1 );\ -}\ -\ inline void ARR::Insert( sal_uInt16 nPos, const T& rElem )\ {\ Insert( nPos, rElem, 1 );\ @@ -282,7 +276,7 @@ void ARR::Insert( sal_uInt16 nPos, const T& rElems, sal_uInt16 nLen ) \ if ( nUnused == 0 ) \ { \ \ - /* auf die naechste Grow-Grenze aufgerundet vergroeszern */ \ + /* increase (round up) to the next Grow-limit */ \ sal_uInt16 nNewSize; \ for ( nNewSize = nUsed+nGrow; nNewSize < (nUsed + nLen); ++nNewSize ) \ /* empty loop */; \ @@ -527,3 +521,5 @@ public:\ }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/minfitem.hxx b/sfx2/inc/sfx2/minfitem.hxx index bdeeaaaba6c8..3d2cd29aaa44 100644 --- a/sfx2/inc/sfx2/minfitem.hxx +++ b/sfx2/inc/sfx2/minfitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/minstack.hxx b/sfx2/inc/sfx2/minstack.hxx index 6b92205a7694..4c98ec5ef0f2 100644 --- a/sfx2/inc/sfx2/minstack.hxx +++ b/sfx2/inc/sfx2/minstack.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,6 @@ #ifndef _SFXMINSTACK_HXX #define _SFXMINSTACK_HXX -//ASDBG #ifndef _SFXMINARRAY_HXX #include <sfx2/minarray.hxx> #define DECL_OBJSTACK( ARR, T, nI, nG ) \ @@ -97,3 +97,4 @@ public: \ #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/mnuitem.hxx b/sfx2/inc/sfx2/mnuitem.hxx index 669f579a254c..a4b990c63b1f 100644 --- a/sfx2/inc/sfx2/mnuitem.hxx +++ b/sfx2/inc/sfx2/mnuitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,11 +44,7 @@ struct SfxMenuCtrlFactory; class SFX2_DLLPUBLIC SfxMenuControl: public SfxControllerItem { -//friend SvStream& operator<<( SvStream& rStream, const SfxMenuControl& rItem ); -//friend SvStream& operator>>( SvStream& rStream, SfxMenuControl& rItem ); - String aTitle; - String aHelpText; SfxVirtualMenu* pOwnMenu; SfxVirtualMenu* pSubMenu; sal_Bool b_ShowStrings; @@ -65,15 +62,10 @@ public: using SfxControllerItem::Bind; void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, - const String& rTitle, const String &rHelpText, - SfxBindings & ); + const String& rTitle, SfxBindings& rBindings ); void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, SfxVirtualMenu& rSubMenu, - const String& rTitle, const String &rHelpText, - SfxBindings & ); - -// SvStream & Load(SvStream &, SfxBindings*); -// SvStream & Store(SvStream &); + const String& rTitle, SfxBindings& rBindings ); String GetTitle() const; SfxVirtualMenu* GetPopupMenu() const; @@ -81,15 +73,12 @@ public: void SetOwnMenu( SfxVirtualMenu* pMenu ); void RemovePopup(); - const String& GetHelpText() const { return aHelpText; } - void SetHelpText(const String &rStr) { aHelpText = rStr; } - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); static SfxMenuControl* CreateControl( sal_uInt16 nId, Menu &, SfxBindings & ); static SfxUnoMenuControl* CreateControl( const String&, sal_uInt16, Menu&, SfxBindings&, SfxVirtualMenu* ); - static SfxUnoMenuControl* CreateControl( const String&, sal_uInt16, Menu&, const String& sItemText, const String& sHelpText, SfxBindings&, SfxVirtualMenu* ); + static SfxUnoMenuControl* CreateControl( const String&, sal_uInt16, Menu&, const String& sItemText, SfxBindings&, SfxVirtualMenu* ); static sal_Bool IsSpecialControl( sal_uInt16 nId, SfxModule* ); static void RegisterMenuControl(SfxModule*, SfxMenuCtrlFactory*); @@ -102,14 +91,12 @@ public: SfxUnoMenuControl( const String&, sal_uInt16 nId, Menu&, SfxBindings&, SfxVirtualMenu* ); SfxUnoMenuControl( const String&, sal_uInt16 nId, Menu&, - const String&, const String&, + const String&, SfxBindings&, SfxVirtualMenu* ); ~SfxUnoMenuControl(); void Select(); }; -//-------------------------------------------------------------------- - typedef SfxMenuControl* (*SfxMenuControlCtor)( sal_uInt16 nId, Menu &, SfxBindings & ); struct SfxMenuCtrlFactory @@ -126,44 +113,36 @@ struct SfxMenuCtrlFactory {} }; -// - inline String SfxMenuControl::GetTitle() const { return aTitle; } -//-------------------------------------------------------------------- - -// inline SfxVirtualMenu* SfxMenuControl::GetPopupMenu() const { return pSubMenu; } -//-------------------------------------------------------------------- #define SFX_DECL_MENU_CONTROL() \ static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); \ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) #define SFX_IMPL_MENU_CONTROL(Class, nItemClass) \ - SfxMenuControl* __EXPORT Class::CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) \ + SfxMenuControl* Class::CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) \ { return new Class(nId, rMenu, rBindings); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxMenuControl::RegisterMenuControl( pMod, new SfxMenuCtrlFactory( \ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } -//#if 0 // _SOLAR__PRIVATE class SfxAppMenuControl_Impl : public SfxMenuControl { PopupMenu* pMenu; sal_uIntPtr m_nSymbolsStyle; - sal_Bool m_bWasHiContrastMode; sal_Bool m_bShowMenuImages; protected: - DECL_LINK( Activate, Menu * ); // Needed to support high contrast images + DECL_LINK( Activate, Menu * ); public: SFX_DECL_MENU_CONTROL(); @@ -171,6 +150,6 @@ public: ~SfxAppMenuControl_Impl(); }; -//#endif - #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/mnumgr.hxx b/sfx2/inc/sfx2/mnumgr.hxx index d54dafd6e0b2..49ff8fa47d84 100644 --- a/sfx2/inc/sfx2/mnumgr.hxx +++ b/sfx2/inc/sfx2/mnumgr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include <stdarg.h> -#ifndef _MENU_HXX //autogen //wg. MENU_APPEND !!!! #include <vcl/menu.hxx> -#endif #include <tools/wintypes.hxx> #include <tools/link.hxx> #include <com/sun/star/embed/VerbDescriptor.hpp> @@ -58,9 +57,9 @@ class SfxMenuManager { friend class SfxPopupMenuManager; - SfxVirtualMenu* pMenu; // das eigentliche Menu + SfxVirtualMenu* pMenu; // the actual Menu SfxVirtualMenu* pOldMenu; // only while reconfiguring - sal_Bool bMenuBar; // Popup oder MenuBar + sal_Bool bMenuBar; // Popup or MenuBar SfxBindings* pBindings; ResMgr* pResMgr; sal_uInt32 nType; @@ -89,9 +88,7 @@ public: ResMgr* GetResMgr() const { return pResMgr; } void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu ); -//#if 0 // _SOLAR__PRIVATE void Construct_Impl( Menu* pMenu, sal_Bool bWithHelp ); -//#endif }; //-------------------------------------------------------------------- @@ -119,7 +116,6 @@ public: // @deprecated!! // Don't use this method any longer. The whole class will be removed in the future. // Changing code which relies on Popup would need much more effort. - // Please contact cd@openoffice.org if you have questions or need help static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow ); sal_uInt16 Execute( const Point& rPos, Window *pWindow ); @@ -129,7 +125,6 @@ public: // @deprecated (start)!! // Don't use these methods any longer. The whole class will be removed in the future. // Changing code which relies on these methods would need much more effort! - // Please contact cd@openoffice.org if you have questions or need help void StartInsert(); void EndInsert(); void CheckItem( sal_uInt16, sal_Bool ); @@ -146,3 +141,4 @@ public: #endif // #ifndef _SFXMNUMGR_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/module.hxx b/sfx2/inc/sfx2/module.hxx index 5551df850ff2..4dcd035fd49f 100644 --- a/sfx2/inc/sfx2/module.hxx +++ b/sfx2/inc/sfx2/module.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,8 +26,8 @@ * ************************************************************************/ #ifndef _SFXMODULE_HXX -#define _SFXMODULE_HXX // intern -#define _SFXMOD_HXX // extern +#define _SFXMODULE_HXX // internal +#define _SFXMOD_HXX // external #include "sal/config.h" #include "sfx2/dllapi.h" @@ -69,9 +70,7 @@ private: sal_Bool bDummy : 1; SfxModule_Impl* pImpl; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void Construct_Impl(); -//#endif public: TYPEINFO(); @@ -111,7 +110,6 @@ public: static FieldUnit GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame ); FieldUnit GetFieldUnit() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl(); SAL_DLLPRIVATE static void DestroyModules_Impl(); SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const; @@ -119,9 +117,8 @@ public: SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const; SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const; SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig ); - SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig, sal_Bool bHiContrast ); -//#endif }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/msg.hxx b/sfx2/inc/sfx2/msg.hxx index a69fd108ccea..c4d914b93453 100644 --- a/sfx2/inc/sfx2/msg.hxx +++ b/sfx2/inc/sfx2/msg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,42 +36,51 @@ //-------------------------------------------------------------------- -#define SFX_SLOT_CACHABLE 0x0001L // exklusiv zu VOLATILE, default -#define SFX_SLOT_VOLATILE 0x0002L // per Timer alle 2s neu geholt, exklusiv zu CACHABLE -#define SFX_SLOT_TOGGLE 0x0004L // invertiert bei Execute alten Wert -#define SFX_SLOT_AUTOUPDATE 0x0008L // invalidiert den Status nach Execute automatisch +#define SFX_SLOT_CACHABLE 0x0001L // exclusiv to VOLATILE, default +#define SFX_SLOT_VOLATILE 0x0002L // per Timer every 2s get new, + // exclusiv to CACHABLE +#define SFX_SLOT_TOGGLE 0x0004L // inverted for Execute old value +#define SFX_SLOT_AUTOUPDATE 0x0008L // invalidated the status automatically + // after execute -#define SFX_SLOT_SYNCHRON 0x0010L // exklusiv zu ASYNCHRON, default -#define SFX_SLOT_ASYNCHRON 0x0020L // via Post-Message, exklusiv zu SYNCHRON +#define SFX_SLOT_SYNCHRON 0x0010L // exclusiv to ASYNCHRON, default +#define SFX_SLOT_ASYNCHRON 0x0020L // via Post-Message, exclusiv + // to SYNCHRON -#define SFX_SLOT_HASCOREID 0x0040L // Slot-ID/Which-ID Mappting durchf"uhren -#define SFX_SLOT_HASDIALOG 0x0080L // Punkte fuer Dialog nach recofig +#define SFX_SLOT_HASCOREID 0x0040L // Slot-ID/Which-ID execute mapping +#define SFX_SLOT_HASDIALOG 0x0080L // Coordinates for dialogue after recofig -#define SFX_SLOT_NORECORD 0x0100L // kein Recording -#define SFX_SLOT_RECORDPERITEM 0x0200L // je Item ein Statement -#define SFX_SLOT_RECORDPERSET 0x0400L // das ganze Set ist ein Statement, def. -#define SFX_SLOT_RECORDMANUAL 0x0800L // Recording vom Applikationsentwickler iss-default +#define SFX_SLOT_NORECORD 0x0100L // no recording +#define SFX_SLOT_RECORDPERITEM 0x0200L // each item, one statement +#define SFX_SLOT_RECORDPERSET 0x0400L // The whole Set is a Statement, default +#define SFX_SLOT_RECORDMANUAL 0x0800L // Recording by the application + // developer is default -#define SFX_SLOT_RECORDABSOLUTE 0x1000000L // Recording mit absolutem Target +#define SFX_SLOT_RECORDABSOLUTE 0x1000000L // Recording with absolute Target #define SFX_SLOT_STANDARD ( SFX_SLOT_CACHABLE | \ SFX_SLOT_SYNCHRON | \ SFX_SLOT_RECORDPERSET ) -#define SFX_SLOT_PROPGET 0x1000L // abfragbares Property -#define SFX_SLOT_PROPSET 0x2000L // setzbares Property, exklusiv zu SFX_SLOT_METHOD -#define SFX_SLOT_METHOD 0x4000L // Methode, exklusiv zu SFX_SLOT_PROPSET +#define SFX_SLOT_PROPGET 0x1000L // get property +#define SFX_SLOT_PROPSET 0x2000L // set property, exclusiv to + // SFX_SLOT_METHOD +#define SFX_SLOT_METHOD 0x4000L // Method, exclusiv to SFX_SLOT_PROPSET -#define SFX_SLOT_FASTCALL 0x8000L // vor Execute keine Pr"ufung, ob disabled +#define SFX_SLOT_FASTCALL 0x8000L // No test if disabled before Execute -#define SFX_SLOT_STATUSBARCONFIG 0x10000L // konfigurierbar in Statuszeile -#define SFX_SLOT_MENUCONFIG 0x20000L // konfigurierbar im Men"u -#define SFX_SLOT_TOOLBOXCONFIG 0x40000L // konfigurierbar in Toolboxen -#define SFX_SLOT_ACCELCONFIG 0x80000L // konfigurierbar auf Tasten +#define SFX_SLOT_STATUSBARCONFIG 0x10000L // configurable status row +#define SFX_SLOT_MENUCONFIG 0x20000L // configurable Menu +#define SFX_SLOT_TOOLBOXCONFIG 0x40000L // configurable Toolboxen +#define SFX_SLOT_ACCELCONFIG 0x80000L // configurable keys -#define SFX_SLOT_CONTAINER 0x100000L // beim InPlace vom Container bedient -#define SFX_SLOT_READONLYDOC 0x200000L // auch bei readonly-Docs verf"ugbar -#define SFX_SLOT_IMAGEROTATION 0x400000L // bei Vertical/Bidi writing Image drehen -#define SFX_SLOT_IMAGEREFLECTION 0x800000L // bei Vertical/Bidi writing Image spiegeln +#define SFX_SLOT_CONTAINER 0x100000L // Operated by the container at + // InPlace +#define SFX_SLOT_READONLYDOC 0x200000L // also available for + // read-only Documents +#define SFX_SLOT_IMAGEROTATION 0x400000L // Rotate image on Vertical/ + // Bi-directional writing +#define SFX_SLOT_IMAGEREFLECTION 0x800000L // Mirror image on Vertical/ + // Bi-directional writing //-------------------------------------------------------------------- @@ -78,14 +88,14 @@ class SfxRequest; class SfxItemSet; #define SFX_EXEC_STUB( aShellClass, aExecMethod) \ - void __EXPORT SfxStub##aShellClass##aExecMethod( \ + void SfxStub##aShellClass##aExecMethod( \ SfxShell *pShell, SfxRequest& rReq) \ { \ (( aShellClass* ) pShell )->aExecMethod( rReq ); \ } #define SFX_STATE_STUB( aShellClass, aStateMethod) \ - void __EXPORT SfxStub##aShellClass##aStateMethod( \ + void SfxStub##aShellClass##aStateMethod( \ SfxShell *pShell, SfxItemSet& rSet) \ { \ (( aShellClass* ) pShell )->aStateMethod( rSet ); \ @@ -112,7 +122,7 @@ enum SfxSlotKind struct SfxTypeAttrib { sal_uInt16 nAID; - const char __FAR_DATA* pName; + const char* pName; }; struct SfxType @@ -225,8 +235,8 @@ SFX_DECL_TYPE(18); // for SvxSearchItem } #define SFX_SLOTMAP_NONE(ShellClass) \ - static SfxFormalArgument __FAR_DATA a##ShellClass##Args_Impl[1]; \ - static SfxSlot __FAR_DATA a##ShellClass##Slots_Impl[] = \ + static SfxFormalArgument a##ShellClass##Args_Impl[1]; \ + static SfxSlot a##ShellClass##Slots_Impl[] = \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } #define SFX_ARGUMENT( ArgSlotId, ArgName, ArgTypeId ) \ @@ -238,9 +248,9 @@ class SfxPoolItem; struct SfxFormalArgument { - const SfxType* pType; // Typ des Parameters (SfxPoolItem Subklasse) - const char __FAR_DATA* pName; // Name des Parameters - sal_uInt16 nSlotId;// Slot-Id zur Identifikation des Parameters + const SfxType* pType; // Type of the parameter (SfxPoolItem subclass) + const char* pName; // Name of the sParameters + sal_uInt16 nSlotId; // Slot-Id for identification of the Parameters const TypeId& Type() const { return pType->aTypeId; } @@ -253,29 +263,30 @@ struct SfxFormalArgument class SfxSlot { public: - sal_uInt16 nSlotId; // in Shell eindeutige Slot-Id - sal_uInt16 nGroupId; // f"ur Konfigurations-Bereich - sal_uIntPtr nHelpId; // i.d.R. == nSlotId - sal_uIntPtr nFlags; // artihm. veroderte Flags + sal_uInt16 nSlotId; // Unique slot-ID in Shell + sal_uInt16 nGroupId; // for configuration region + sal_uIntPtr nHelpId; // Usually == nSlotId + sal_uIntPtr nFlags; // artihmetic ordered Flags - sal_uInt16 nMasterSlotId; // Enum-Slot bzw. Which-Id - sal_uInt16 nValue; // Wert, falls Enum-Slot + sal_uInt16 nMasterSlotId; // Enum-Slot for example Which-Id + sal_uInt16 nValue; // Value, in case of Enum-Slot - SfxExecFunc fnExec; // Funktion zum Ausf"uhren - SfxStateFunc fnState; // Funktion f"ur Status + SfxExecFunc fnExec; // Function to be excecuted + SfxStateFunc fnState; // Function for Status - const SfxType* pType; // SfxPoolItem-Typ (Status) - const char __FAR_DATA* pName; // Name des Slots - const char __FAR_DATA* pMethodName; // Name der Method falls anders + const SfxType* pType; // SfxPoolItem-Type (Status) + const char* pName; // Name of the Slots + const char* pMethodName; // Name of the Method if different - const SfxSlot* pLinkedSlot; // Master-Slot f"ur Enum-Werte - const SfxSlot* pNextSlot; // mit derselben Status-Methode + const SfxSlot* pLinkedSlot; // Master-Slot for Enum value + const SfxSlot* pNextSlot; // with the same Status-Method - const SfxFormalArgument* pFirstArgDef; // erste formale Argument-Definition - sal_uInt16 nArgDefCount; // Anzahl der formalen Argumente - long nDisableFlags; // DisableFlags, die vorhanden sein - // m"ussen, damit der Slot enabled ist - const char __FAR_DATA* pUnoName; // UnoName des Slots + const SfxFormalArgument* pFirstArgDef; // first formal Argument-Definition + sal_uInt16 nArgDefCount; // Number of formal Argumentents + long nDisableFlags; // DisableFlags that need to be + // present, so that the Slot + // can be enabled + const char* pUnoName; // UnoName for the Slots public: @@ -347,3 +358,5 @@ inline sal_uInt16 SfxSlot::GetGroupId() const } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/msgpool.hxx b/sfx2/inc/sfx2/msgpool.hxx index 2bda4f36a59d..05854edbb010 100644 --- a/sfx2/inc/sfx2/msgpool.hxx +++ b/sfx2/inc/sfx2/msgpool.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,4 @@ inline const SfxSlot* SfxSlotPool::FirstSlot() #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/navigat.hxx b/sfx2/inc/sfx2/navigat.hxx index 2958f92ca0d3..2412fca06a09 100644 --- a/sfx2/inc/sfx2/navigat.hxx +++ b/sfx2/inc/sfx2/navigat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,3 +63,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/new.hxx b/sfx2/inc/sfx2/new.hxx index e6bfe590431e..23d2444f6722 100644 --- a/sfx2/inc/sfx2/new.hxx +++ b/sfx2/inc/sfx2/new.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,18 +31,10 @@ #include "sal/config.h" #include "sfx2/dllapi.h" -#ifndef _BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif -#ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> -#endif -#ifndef _EDIT_HXX //autogen #include <vcl/edit.hxx> -#endif -#ifndef _FIXED_HXX //autogen #include <vcl/fixed.hxx> -#endif #include <sfx2/basedlgs.hxx> //========================================================================= @@ -70,13 +63,6 @@ protected: virtual void Paint( const Rectangle& rRect ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); - /** state whether a system setting for high contrast should be evaluated - and taken into account for this window. - - The default implementation uses the accessibility option IsForDrawings - */ - virtual bool UseHighContrastSetting() const; - public: SfxPreviewWin( Window* pParent, const ResId& rResId, @@ -96,9 +82,8 @@ public: SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags = 0); ~SfxNewFileDialog(); - // Liefert sal_False, wenn '- Keine -' als Vorlage eingestellt ist - // Nur wenn IsTemplate() sal_True liefert, koennen Vorlagennamen - // erfragt werden + // Returns sal_False, when '- No -' is set as Template + // Template names can only be obtained when IsTemplate() returns sal_True. sal_Bool IsTemplate() const; String GetTemplateRegion() const; String GetTemplateName() const; @@ -110,3 +95,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/newstyle.hxx b/sfx2/inc/sfx2/newstyle.hxx index ce596bacaa81..22f47eec8974 100644 --- a/sfx2/inc/sfx2/newstyle.hxx +++ b/sfx2/inc/sfx2/newstyle.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "sal/config.h" #include "sfx2/dllapi.h" -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/msgbox.hxx> #include <vcl/combobox.hxx> #include <vcl/dialog.hxx> @@ -51,10 +50,8 @@ private: QueryBox aQueryOverwriteBox; SfxStyleSheetBasePool& rPool; -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( OKHdl, Control * ); DECL_DLLPRIVATE_LINK( ModifyHdl, ComboBox * ); -//#endif public: SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& ); @@ -65,3 +62,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/objface.hxx b/sfx2/inc/sfx2/objface.hxx index 4294a93a454c..d867bd065f2b 100644 --- a/sfx2/inc/sfx2/objface.hxx +++ b/sfx2/inc/sfx2/objface.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include "sfx2/dllapi.h" #include "sal/types.h" #include <tools/string.hxx> -#ifndef _RESID_HXX //autogen #include <tools/resid.hxx> -#endif #include <sfx2/msg.hxx> @@ -109,12 +108,10 @@ public: void Register( SfxModule* ); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE int ContainsSlot_Impl( const SfxSlot *pSlot ) const { return pSlot >= pSlots && pSlot < pSlots + Count(); } SAL_DLLPRIVATE ResMgr* GetResManager_Impl() const { return aNameResId.GetResMgr(); } -//#endif }; //-------------------------------------------------------------------- @@ -135,7 +132,6 @@ inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const return nPos < nCount? pSlots+nPos: 0; } -//#if 0 // _SOLAR__PRIVATE class SfxIFConfig_Impl { friend class SfxInterface; @@ -149,6 +145,7 @@ public: void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 ); sal_uInt16 GetType(); }; -//#endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/objitem.hxx b/sfx2/inc/sfx2/objitem.hxx index f7024ccc76f9..cc14c6881791 100644 --- a/sfx2/inc/sfx2/objitem.hxx +++ b/sfx2/inc/sfx2/objitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 05ae3365d6b1..31890aa1d5e4 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,19 +43,14 @@ #include <com/sun/star/security/DocumentSignatureInformation.hpp> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> - #include <com/sun/star/beans/XPropertySet.hpp> - #include <boost/shared_ptr.hpp> - //________________________________________________________________________________________________________________ // include something else //________________________________________________________________________________________________________________ -//#if 0 // _SOLAR__PRIVATE #include <vcl/timer.hxx> -//#endif #include <svl/poolitem.hxx> #include <vcl/timer.hxx> #include <vcl/bitmap.hxx> @@ -97,7 +93,7 @@ class Point; // From embobj.hxx #define ASPECT_CONTENT 1 -#define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Farben DIB in MetaFile */ +#define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */ #define ASPECT_ICON 4 #define ASPECT_DOCPRINT 8 #define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT) @@ -126,6 +122,9 @@ namespace com { namespace sun { namespace star { namespace document { class XDocumentProperties; } + namespace lang { + class XComponent; + } } } } typedef sal_uInt32 SfxObjectShellFlags; @@ -149,7 +148,7 @@ typedef sal_uInt32 SfxObjectShellFlags; #define SFX_TITLE_CAPTION 5 #define SFX_TITLE_PICKLIST 6 #define SFX_TITLE_HISTORY 7 -#define SFX_TITLE_MAXLEN 10 // ab hier sind das L"angenbegrenzungen +#define SFX_TITLE_MAXLEN 10 // this gives the limits on length #define SFX_LOADED_MAINDOCUMENT 1 #define SFX_LOADED_IMAGES 2 @@ -183,9 +182,9 @@ enum SfxObjectCreateMode /*==================================================================== -Die Klasse SfxObjectShell ist die Basisklasse f"ur SFx-Objekte, also -f"ur Dokumente und Teile von Dokumenten, die als selbst"andige Objekte -in fremde Objekte integriert werden k"onnen. +The class SfxObjectShell is the base class for SFx-objects, ie documents +and parts of documents that can be integrated as separate objects +into foreign objects. ----------------------------------------------------------------------*/ @@ -200,25 +199,22 @@ friend struct ModifyBlocker_Impl; friend class SfxObjectShellLock; private: - struct SfxObjectShell_Impl* pImp; // interne Daten + struct SfxObjectShell_Impl* pImp; // internal data - SfxMedium * pMedium; // Beschreibung der Datei bzw. des Storage, in dem sich das Objekt befindet + SfxMedium * pMedium; // Description of the file for example + // storage that contains the object SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets - SfxObjectCreateMode eCreateMode; // Zweck des Objekts - sal_Bool bHasName :1, // sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt - bIsTmp :1; // temp. Storage + SfxObjectCreateMode eCreateMode; // Purpose of the object + sal_Bool bHasName :1, // sal_True := existing object, + // sal_False := new object + bIsTmp :1; // temporary Storage private: -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties> & i_xDocProps); SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet ); -//REMOVE sal_Bool SaveInfoAndConfig_Impl( SvStorageRef pNewStg ); - -//#endif - protected: SfxObjectShell(SfxObjectCreateMode); SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx @@ -234,6 +230,9 @@ protected: /// template method, called by FlushDocInfo; this implementation is empty virtual void DoFlushDocInfo(); + // helper method + void AddToRecentlyUsedList(); + public: TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH) @@ -274,7 +273,6 @@ public: void FlushDocInfo(); sal_Bool HasName() const { return bHasName; } virtual String GetAPIName() const; - void SetHasName( sal_Bool bSet = sal_True ) { bHasName = bSet; } void SetReadOnly(); sal_Bool IsReadOnly() const; sal_Bool IsReadOnlyMedium() const; @@ -283,9 +281,7 @@ public: void SetNoName(); sal_Bool IsInModalMode() const; sal_Bool IsInPrepareClose() const; - //<!--Added by PengYunQuan for Validity Cell Range Picker virtual sal_Bool AcceptStateUpdate() const; - //-->Added by PengYunQuan for Validity Cell Range Picker sal_Bool HasModalViews() const; sal_Bool IsHelpDocument() const; @@ -300,10 +296,8 @@ public: void SetSharedXMLFlag( sal_Bool bFlag ) const; sal_Bool HasSharedXMLFlagSet() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetModalMode_Impl(sal_Bool bModal=sal_True); SAL_DLLPRIVATE void SetMacroMode_Impl(sal_Bool bModal=sal_True); -//#endif void ResetError(); sal_uInt32 GetError() const; @@ -335,6 +329,13 @@ public: virtual sal_Bool SwitchPersistance( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); virtual void UpdateLinks(); + /** + * Called when the Options dialog is dismissed with the OK button, to + * handle potentially conflicting option settings. + */ + virtual void CheckConfigOptions(); + sal_Bool IsConfigOptionsChecked() const; + void SetConfigOptionsChecked( sal_Bool bChecked ); // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId ); @@ -346,8 +347,7 @@ public: sal_Bool bForceNonModified = sal_False ); sal_Bool SaveCompletedChildren( sal_Bool bSuccess ); - sal_Bool InsertFrom( SfxMedium &rMedium ); - sal_Bool ImportFrom( SfxMedium &rMedium ); + virtual sal_Bool ImportFrom( SfxMedium &rMedium, bool bInsert ); sal_Bool ExportTo( SfxMedium &rMedium ); // xmlsec05, check with SFX team @@ -368,8 +368,8 @@ public: ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, - bool bRaiseError = true - ); + bool bRaiseError = true, + const ::com::sun::star::uno::Any* aCaller = 0 ); static ErrCode CallXScript( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext, @@ -378,7 +378,8 @@ public: ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, - bool bRaiseError = true + bool bRaiseError = true, + const ::com::sun::star::uno::Any* aCaller = 0 ); /** adjusts the internal macro mode, according to the current security settings @@ -465,12 +466,10 @@ public: SfxProgress* GetProgress() const; void SetWaitCursor( sal_Bool bSet ) const; -//(mba) virtual SotObjectRef CreateAggObj( const SotFactory* pFact ); - // Naming Interface void SetTitle( const String& rTitle ); String GetTitle( sal_uInt16 nMaxLen = 0 ) const; - void InvalidateName(); // Zuruecksetzen auf unbenannt + void InvalidateName(); // Re-set to unnamed // DDE-Interface virtual long DdeExecute( const String& rCmd ); @@ -481,13 +480,16 @@ public: const String& rMimeType, const ::com::sun::star::uno::Any & rValue ); virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); + virtual void ReconnectDdeLink(SfxObjectShell& rServer); + + static void ReconnectDdeLinks(SfxObjectShell& rServer); // Contents virtual SfxStyleSheetBasePool* GetStyleSheetPool(); - void SetStyleSheetPool( SfxStyleSheetBasePool *pBasePool ) { + void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) { pStyleSheetPool = pBasePool; } - //determine the position of the "Automatic" filter in the stylist + // Determine the position of the "Automatic" filter in the stylist void SetAutoStyleFilterIndex(sal_uInt16 nSet); sal_uInt16 GetAutoStyleFilterIndex(); virtual sal_Bool HasBasic() const; @@ -498,7 +500,7 @@ public: GetDialogContainer(); StarBASIC* GetBasic() const; - // Interface Dok-Inhalte, Organizer + // Interface Document content, Organizer #define INDEX_IGNORE USHRT_MAX #define CONTENT_STYLE 0 @@ -510,36 +512,24 @@ public: virtual void SetOrganizerSearchMask( SfxStyleSheetBasePool* ) const; + virtual sal_uInt16 GetContentCount( sal_uInt16 nIdx1 = INDEX_IGNORE ); - virtual sal_uInt16 GetContentCount( - sal_uInt16 nIdx1 = INDEX_IGNORE, - sal_uInt16 nIdx2 = INDEX_IGNORE ); virtual sal_Bool CanHaveChilds( sal_uInt16 nIdx1, - sal_uInt16 nIdx2 = INDEX_IGNORE ); - virtual void GetContent( String &, - Bitmap &rClosedBitmap, - Bitmap &rOpenedBitmap, - sal_Bool &bCanDelete, - sal_uInt16 nPos, - sal_uInt16 nIdx1, - sal_uInt16 nIdx2 = INDEX_IGNORE ); + sal_uInt16 nIdx2 = INDEX_IGNORE + ); virtual void GetContent( String &, Bitmap &rClosedBitmap, Bitmap &rOpenedBitmap, - BmpColorMode eColorMode, sal_Bool &bCanDelete, sal_uInt16 nPos, - sal_uInt16 nIdx1, - sal_uInt16 nIdx2 = INDEX_IGNORE ); + sal_uInt16 nIdx1 + ); - virtual void TriggerHelpPI( - sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16 nIdx3); + virtual void TriggerHelpPI( sal_uInt16 nIdx1, sal_uInt16 nIdx2 ); - virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily ); - - virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily, BmpColorMode eColorMode ); + virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily); virtual sal_Bool Insert( SfxObjectShell &rSource, sal_uInt16 nSourceIdx1, @@ -564,22 +554,18 @@ public: void ReadNote( INote * ); void UpdateNote( INote * ); - // F"ur Docs, die zum Formatieren die Viewgr"o\se - // ben"otigen + // Documents, for which to format the view size + virtual SfxObjectShell* GetObjectShell(); - //void SetBaseURL( const String& rURL ); - //const String& GetBaseURL() const; - //const String& GetBaseURLForSaving() const; - //void SetEmptyBaseURL(); virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() const; - // Nur uebergangsweise fuer die Applikationen !!! + // Only temporarily for the applications! void SetBaseModel( SfxBaseModel* pModel ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; - // Nur uebergangsweise fuer die Applikationen !!! + // Only temporarily for the applications! virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames(); @@ -588,6 +574,9 @@ public: static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); static SfxObjectShell* CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); static SfxObjectShell* CreateAndLoadObject( const SfxItemSet& rSet, SfxFrame* pFrame=0 ); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL ); + static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp ); static String GetServiceNameFromFactory( const String& rFact ); sal_Bool IsInPlaceActive(); sal_Bool IsUIActive(); @@ -611,7 +600,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage(); -//REMOVE void SetFileName( const ::rtl::OUString& ); SvGlobalName GetClassName() const; // comphelper::IEmbeddedHelper @@ -672,9 +660,7 @@ public: // ================================= -//#if 0 // _SOLAR__PRIVATE - - SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHighContrast ) const; + SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const; SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const; @@ -728,7 +714,7 @@ public: SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &); SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &); - // Laden-speichern public internals + // Load/Save public internals SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr ); @@ -766,15 +752,12 @@ public: SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False ); SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); -//#endif }; #define SFX_GLOBAL_CLASSID \ 0x9eaba5c3, 0xb232, 0x4309, \ 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74 -//#if 0 // _SOLAR__PRIVATE - struct ModifyBlocker_Impl { SfxObjectShell* pPersist; @@ -791,7 +774,7 @@ public: pPersist->EnableSetModified( bWasEnabled ); } }; -//#endif + //-------------------------------------------------------------------- #ifndef SFX_DECL_OBJECTSHELL_DEFINED @@ -802,7 +785,6 @@ SV_DECL_LOCK(SfxObjectShell) SV_IMPL_LOCK(SfxObjectShell) SV_IMPL_REF(SfxObjectShell) -//#if 0 // _SOLAR__PRIVATE //-------------------------------------------------------------------- class AutoReloadTimer_Impl : public Timer { @@ -815,7 +797,6 @@ public: SfxObjectShell* pSh ); virtual void Timeout(); }; -//#endif //------------------------------------------------------------------------- @@ -842,8 +823,8 @@ public: virtual int operator==( const SfxPoolItem& ) const; virtual String GetValueText() const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); SfxObjectShell* GetObjectShell() const { return pObjSh; } @@ -851,3 +832,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/objuno.hxx b/sfx2/inc/sfx2/objuno.hxx index 0a0dea610ac5..1c7a63998c03 100644 --- a/sfx2/inc/sfx2/objuno.hxx +++ b/sfx2/inc/sfx2/objuno.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -190,3 +191,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/opengrf.hxx b/sfx2/inc/sfx2/opengrf.hxx index 7887b12a761e..3c9f20a18632 100644 --- a/sfx2/inc/sfx2/opengrf.hxx +++ b/sfx2/inc/sfx2/opengrf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,4 @@ private: #endif // _SVX_OPENGRF_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx index 26458b16f844..567320cfa58e 100644 --- a/sfx2/inc/sfx2/passwd.hxx +++ b/sfx2/inc/sfx2/passwd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,6 +57,7 @@ private: Edit maPasswordED; FixedText maConfirmFT; Edit maConfirmED; + FixedText maMinLengthFT; FixedLine maPassword2Box; FixedText maPassword2FT; Edit maPassword2ED; @@ -66,13 +68,19 @@ private: CancelButton maCancelBtn; HelpButton maHelpBtn; - sal_uInt16 mnMinLen; - sal_uInt16 mnExtras; + String maConfirmStr; + String maMinLenPwdStr; + String maEmptyPwdStr; + String maMainPwdStr; + sal_uInt16 mnMinLen; + sal_uInt16 mnExtras; bool mbAsciiOnly; DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* ); DECL_DLLPRIVATE_LINK( OKHdl, OKButton* ); + void SetPasswdText(); + public: SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL ); @@ -95,3 +103,4 @@ public: #endif // #ifndef _SFX_PASSWD_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/printer.hxx b/sfx2/inc/sfx2/printer.hxx index 53b2e87d5fa8..68315b772736 100644 --- a/sfx2/inc/sfx2/printer.hxx +++ b/sfx2/inc/sfx2/printer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "sal/config.h" #include "sfx2/dllapi.h" #include "sal/types.h" -#ifndef _PRINT_HXX //autogen #include <vcl/print.hxx> -#endif class SfxTabPage; class SfxItemSet; @@ -81,3 +80,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/printopt.hxx b/sfx2/inc/sfx2/printopt.hxx index 723fbcc02f9e..0b25dec5dc38 100644 --- a/sfx2/inc/sfx2/printopt.hxx +++ b/sfx2/inc/sfx2/printopt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,14 +32,10 @@ #include "sal/config.h" #include "sfx2/dllapi.h" #include "sal/types.h" -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/field.hxx> #include <vcl/fixed.hxx> -#ifndef _SV_BUTTON_HXX //autogen wg. FixedText #include <vcl/button.hxx> -#endif #include <vcl/lstbox.hxx> #include <vcl/print.hxx> @@ -104,9 +101,8 @@ private: SAL_DLLPRIVATE void ImplUpdateControls( const PrinterOptions* pCurrentOptions ); SAL_DLLPRIVATE void ImplSaveControls( PrinterOptions* pCurrentOptions ); - // --> OD 2008-06-25 #i63982# + // #i63982# SAL_DLLPRIVATE void ImplSetAccessibleNames(); - // <-- protected: @@ -126,10 +122,6 @@ public: static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); }; -// ------------------------------- -// - TransparencyPrintWarningBox - -// ------------------------------- - class TransparencyPrintWarningBox : public ModalDialog { private: @@ -153,3 +145,4 @@ public: #endif // #ifndef _SFX_PRINTOPT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/prnmon.hxx b/sfx2/inc/sfx2/prnmon.hxx index 0b00fbb47ab9..48273cdea55c 100644 --- a/sfx2/inc/sfx2/prnmon.hxx +++ b/sfx2/inc/sfx2/prnmon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,45 +34,15 @@ #include <vcl/button.hxx> #include <vcl/dialog.hxx> #include <sfx2/printer.hxx> -//#include <sfx2/progress.hxx> + class SfxViewShell; -//class SfxProgress; struct SfxPrintProgress_Impl; // ------------------------------------------------------------------------ -#define PAGE_MAX 9999 //max. Anzahl der Seiten die gedruckt werden - -//-------------------------------------------------------------------- -/* -class SFX2_DLLPUBLIC SfxPrintProgress: public SfxProgress -{ - SfxPrintProgress_Impl* pImp; +#define PAGE_MAX 9999 // max. Number of pages to be printed -private: -//#if 0 // _SOLAR__PRIVATE - DECL_DLLPRIVATE_LINK( PrintErrorNotify, void * ); - DECL_DLLPRIVATE_LINK( StartPrintNotify, void * ); - DECL_DLLPRIVATE_LINK( EndPrintNotify, void * ); -//#endif -public: - SfxPrintProgress( SfxViewShell* pViewSh, - FASTBOOL bShow = sal_True ); - virtual ~SfxPrintProgress(); - - virtual void SetText( const String &rText ); - sal_Bool SetStateText( sal_uIntPtr nVal, const String &rVal, sal_uIntPtr nNewRange = 0 ); - virtual sal_Bool SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 ); - - void RestoreOnEndPrint( SfxPrinter *pOldPrinter ); - void RestoreOnEndPrint( SfxPrinter *pOldPrinter, - sal_Bool bOldEnablePrintFile ); - void DeleteOnEndPrint(); - void SetCancelHdl( const Link& aCancelHdl ); - sal_Bool IsAborted() const; -}; -*/ // ------------------------------------------------------------------------ struct SfxPrintOptDlg_Impl; @@ -102,3 +73,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/progress.hxx b/sfx2/inc/sfx2/progress.hxx index 6f21f6ed92f8..f8bd9e7ffb9d 100644 --- a/sfx2/inc/sfx2/progress.hxx +++ b/sfx2/inc/sfx2/progress.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,13 +80,12 @@ public: static void EnterLock(); static void LeaveLock(); -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus* ); DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, DefaultBindingProgress, SvProgressArg* ); - SAL_DLLPRIVATE FASTBOOL StatusBarManagerGone_Impl(SfxStatusBarManager*pStb); + SAL_DLLPRIVATE bool StatusBarManagerGone_Impl(SfxStatusBarManager*pStb); SAL_DLLPRIVATE const String& GetStateText_Impl() const; -//#endif }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/qswin32.h b/sfx2/inc/sfx2/qswin32.h index a7d82975b0b2..30045ddadcb0 100644 --- a/sfx2/inc/sfx2/qswin32.h +++ b/sfx2/inc/sfx2/qswin32.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,6 +45,7 @@ # define QUICKSTART_CLASSNAME QUICKSTART_CLASSNAMEA # define QUICKSTART_WINDOWNAME QUICKSTART_WINDOWNAMEA # define SHUTDOWN_QUICKSTART_MESSAGE SHUTDOWN_QUICKSTART_MESSAGEA -#endif #endif /* _QSWIN32_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/querystatus.hxx b/sfx2/inc/sfx2/querystatus.hxx index 97764317522e..28a0460a4b5b 100644 --- a/sfx2/inc/sfx2/querystatus.hxx +++ b/sfx2/inc/sfx2/querystatus.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,3 +60,5 @@ class SFX2_DLLPUBLIC SfxQueryStatus }; #endif // _SFXQUERYSTATUS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/request.hxx b/sfx2/inc/sfx2/request.hxx index 26a87fa31c3d..d7c993b94148 100644 --- a/sfx2/inc/sfx2/request.hxx +++ b/sfx2/inc/sfx2/request.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,7 +62,6 @@ friend struct SfxRequest_Impl; SfxRequest_Impl* pImp; //--------------------------------------------------------------------- -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot, com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, @@ -69,7 +69,6 @@ public: private: SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet ); -//#endif //--------------------------------------------------------------------- public: @@ -105,7 +104,7 @@ public: static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL ); static sal_Bool HasMacroRecorder( SfxViewFrame* pFrame=NULL ); sal_uInt16 GetCallMode() const; - bool IsRecording() const; + bool IsRecording() const; void AllowRecording( sal_Bool ); sal_Bool AllowsRecording() const; sal_Bool IsAPI() const; @@ -137,3 +136,5 @@ private: SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/securitypage.hxx b/sfx2/inc/sfx2/securitypage.hxx index 4c47533f4e4a..255e4298fd17 100644 --- a/sfx2/inc/sfx2/securitypage.hxx +++ b/sfx2/inc/sfx2/securitypage.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,6 @@ #include <memory> -////////////////////////////////////////////////////////////////////// struct SfxSecurityPage_Impl; @@ -52,7 +52,7 @@ public: static SfxTabPage* Create( Window* pParent, const SfxItemSet& ); }; -////////////////////////////////////////////////////////////////////// #endif // #ifndef _SECURITYPAGE_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index dfa3cc8593ec..e09af8141332 100755 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -69,7 +69,7 @@ #define EVENT_SGA_START EVENT_OBJ3_START #define EVENT_SVX_START EVENT_OBJ4_START -// Achtung: die folgenden sind gleichzeitig SID_ON_... +// Warning: the following are simultaneously SID_ON_ ... #define SFX_EVENT_STARTAPP (EVENT_SFX_START) #define SFX_EVENT_CLOSEAPP (EVENT_SFX_START + 1) #define SFX_EVENT_CREATEDOC (EVENT_SFX_START + 2) @@ -111,7 +111,7 @@ #define SFX_EVENT_TITLECHANGED (EVENT_SFX_START + 30) #define SFX_EVENT_MODECHANGED (EVENT_SFX_START + 31) -// Events f"ur Controls etc. +// Events for Controls etc. #define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 ) #define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 ) #define SFX_EVENT_MOUSEOUT_OBJECT ( EVENT_SFX_START + 102 ) @@ -165,7 +165,7 @@ #define SFX_OBJECTBAR_NAVIGATION 12 #define SFX_OBJECTBAR_MAX 13 -// temp. wg. Kompatibilitaet +// temporary due to compatibility #define SFX_OBJECTBAR_IDE 2 #define SFX_OBJECTBAR_FRAME 3 @@ -183,9 +183,7 @@ #define RID_DEFAULTIMAGELIST_LC (RID_SFX_START+17) #define RID_DEFAULTIMAGELIST_LM (RID_SFX_START+18) #define RID_STYLEDLG (RID_SFX_START+28) -#define RID_DEFAULTIMAGELIST_SCH (RID_SFX_START+35) #define RID_DEFAULTIMAGELIST_SMH (RID_SFX_START+36) -#define RID_DEFAULTIMAGELIST_LCH (RID_SFX_START+37) #define RID_DEFAULTIMAGELIST_LMH (RID_SFX_START+38) #define RID_IMAGELIST_SCH (RID_SFX_START+39) #define RID_IMAGELIST_SMH (RID_SFX_START+40) @@ -202,7 +200,6 @@ #define RID_DEFAULTINTRO (RID_SFX_START+0) #define RID_DEFAULTINTRO_ADABAS (RID_SFX_START+1) #define RID_DEFAULTINTRO_PORTAL (RID_SFX_START+2) -#define RID_DEFAULT_ABOUT_BMP_LOGO (RID_SFX_START+3) #define RID_STYLECATALOG (RID_SFX_START+1201) @@ -222,16 +219,15 @@ #define TP_MANAGE_STYLES (RID_SFX_START+7) #define DLG_STYLE_DESIGNER (RID_SFX_START+8) -#define RID_SFX_PROTECT_RECORDS (RID_SFX_START+216) -#define RID_SFX_UNPROTECT_RECORDS (RID_SFX_START+217) -#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+218) +#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+216) #define STR_STYLE_FILTER_AUTO (RID_SFX_START+9) #define STR_STYLE_FILTER_USED (RID_SFX_START+10) #define STR_STYLE_FILTER_USERDEF (RID_SFX_START+11) #define STR_STYLE_FILTER_ALL (RID_SFX_START+12) -// +13 schon benutzt! +// +13 already used! #define STR_STYLE_FILTER_HIERARCHICAL (RID_SFX_START+1200) +#define STR_STYLE_ELEMTLIST (RID_SFX_START+1202) #define STR_NONAME (RID_SFX_START+100) #define STR_NONE (RID_SFX_START+101) @@ -291,6 +287,7 @@ #define GID_MODIFY (RID_GROUPS_SFXOFFSET+23) #define GID_DRAWING (RID_GROUPS_SFXOFFSET+24) #define GID_CONTROLS (RID_GROUPS_SFXOFFSET+25) +#define GID_NAVIGATION (RID_GROUPS_SFXOFFSET+26) // compatibility-#defines #define GID_FORMEL GID_MATH @@ -355,8 +352,10 @@ #define MID_DOCINFO_ENCRYPTED 0x2c #define MID_DOCINFO_STATISTIC 0x33 #define MID_DOCINFO_CHARLOCALE 0x34 - -#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE +#define MID_CATEGORY 0x35 +#define MID_COMPANY 0x36 +#define MID_MANAGER 0x37 +#define MID_LAST_USED_PROPID MID_MANAGER // Config-Ids ----------------------------------------------------------- diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index 4cc7d0321da3..cd0f1e8ce50d 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -384,7 +385,6 @@ public: virtual void SAL_CALL addTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); -//#if 0 // _SOLAR__PRIVATE // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now; // either the _Impl name should vanish or there should be an "official" API SfxViewShell* GetViewShell_Impl() const; @@ -393,7 +393,6 @@ public: SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl(); SAL_DLLPRIVATE void SetCreationArguments_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rCreationArgs ); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper (); -//#endif private: enum ConnectSfxFrame { @@ -415,3 +414,5 @@ private: } ; // class SfxBaseController #endif // _SFX_SFXBASECONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 017486d251de..167618a792c3 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,7 +88,7 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/script/XStarBasicAccess.hpp> #include <osl/mutex.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <tools/link.hxx> @@ -1513,6 +1514,7 @@ protected: /* returns true if the document signatures are valid, otherwise false */ sal_Bool hasValidSignatures() const; + void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& ); //________________________________________________________________________________________________________ // private methods //________________________________________________________________________________________________________ @@ -1619,12 +1621,12 @@ public: }; SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) - :m_aGuard( Application::GetSolarMutex() ) + : m_aGuard() { i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING ); } SfxModelGuard( SfxModelSubComponent& i_rSubComponent ) - :m_aGuard( Application::GetSolarMutex() ) + :m_aGuard() { i_rSubComponent.MethodEntryCheck(); } @@ -1643,9 +1645,11 @@ public: } private: - ::osl::ResettableGuard< ::vos::IMutex > m_aGuard; + SolarMutexResettableGuard m_aGuard; }; #undef css #endif // _SFX_SFXBASEMODEL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxdefs.hxx b/sfx2/inc/sfx2/sfxdefs.hxx index 55a521e3951c..30536360c3f0 100644 --- a/sfx2/inc/sfx2/sfxdefs.hxx +++ b/sfx2/inc/sfx2/sfxdefs.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,13 @@ #ifndef _SFXDEFS_HXX #define _SFXDEFS_HXX -#define MESSAGEFILE_SDM_EXT "sdm" // Extension des neuen Formats -#define MESSAGEFILE_EXT "smd" // Extension der Single-Mail/News-Files -#define MESSAGETEMPFILE_EXT "sd~" // Extension f"ur Mail/News-TempFiles +#define MESSAGEFILE_SDM_EXT "sdm" // Extension for the new Formats +#define MESSAGEFILE_EXT "smd" // Extension for Single-Mail/News-Files +#define MESSAGETEMPFILE_EXT "sd~" // Extension for Mail/News-TempFiles #define SfxFilterFlags sal_uLong #define PRODUCT_VERSION "5.0" #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxdlg.hxx b/sfx2/inc/sfx2/sfxdlg.hxx index eefa614d9630..5bc6812082bd 100644 --- a/sfx2/inc/sfx2/sfxdlg.hxx +++ b/sfx2/inc/sfx2/sfxdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,8 +54,6 @@ class TransferableDataHelper; struct TransferableObjectDescriptor; #include <sfx2/tabdlg.hxx> -//typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet); -//typedef sal_uInt16* (*GetTabPageRanges)(); namespace sfx2 { @@ -158,3 +157,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxhelp.hxx b/sfx2/inc/sfx2/sfxhelp.hxx index 98b31872ce68..8c11031ff8e9 100644 --- a/sfx2/inc/sfx2/sfxhelp.hxx +++ b/sfx2/inc/sfx2/sfxhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,3 +71,4 @@ public: #endif // #ifndef _SFX_HELP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxhtml.hxx b/sfx2/inc/sfx2/sfxhtml.hxx index a2d0e4162ba6..9a03eb3afacb 100644 --- a/sfx2/inc/sfx2/sfxhtml.hxx +++ b/sfx2/inc/sfx2/sfxhtml.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,9 +48,9 @@ class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser String aScriptType; SfxMedium* pMedium; - SfxMedium *pDLMedium; // Medium fuer Download von Files + SfxMedium *pDLMedium; // Medium for Download Files - sal_uInt16 nMetaTags; // Anzahl der bisher gelesenen Meta-Tags + sal_uInt16 nMetaTags; // Number of previously read Meta-Tags ScriptType eScriptType; SAL_DLLPRIVATE void GetScriptType_Impl( SvKeyValueIterator* ); @@ -61,9 +62,9 @@ protected: virtual ~SfxHTMLParser(); public: - // Lesen der Optionen einer Image-Map - // <MAP>: sal_True = Image-Map hat einen Namen - // <AREA>: sal_True = Image-Map hat jetzt einen Bereich mehr + // Read the options of an image map + // <MAP>: sal_True = Image-Map has a name + // <AREA>: sal_True = Image-Map has now one Region more static sal_Bool ParseMapOptions(ImageMap * pImageMap, const HTMLOptions * pOptions ); sal_Bool ParseMapOptions(ImageMap * pImageMap) @@ -82,41 +83,31 @@ public: const String& aNumStr, SvNumberFormatter& rFormatter ); protected: - - // Start eines File-Downloads. Dieser erfolgt synchron oder asynchron. - // Im synchronen Fall befindet sich der Parser nach dem Aufruf im - // Working-Zustand. Die gelesene Datei kann dann direkt mit - // FinishFileDownload abgeholt werden. - // Im asynchronen Fall befindet sich der Parser nach dem Aufruf im - // Pending-Zustand. Der Parser muss dann ueber das Continue verlassen - // werden (ohne Reschedule!). Wenn die Datei geladen ist, wird - // ein Continue mit dem uebergebenen Token aufgerufen. Die Datei kann - // dann wiederum mit FinishFileDownload abgeholt werden. - // Zum Abbrechen des Dwonloads sollte eine Shell uebergeben werden. - // Es kann nur ein einziger Download gleichzeitig existieren. Fuer jeden - // gestarteten Download muss FinshFileDownload aufgerufen werden. + // Start a file download. This is done asynchronously or synchronously. + // In the synchronous case, the parser is in the the working state after + // it has been called. The read file can then be picked up directly with + // FinishFileDownload. In the asynchronous case, the parser is in the + // pending state after it hs been called. The parser then has to leave + // over the Continue (without Reschedule!). If the file is loaded, + // a Continue is called with passed on token. The file can then be picked + // up by FinishFileDownload. To cancel the download should a shell be + // left. It can only exist a single download at the same time, For every + // started download FinshFileDownload must be called. void StartFileDownload( const String& rURL, int nToken, SfxObjectShell *pSh=0 ); - // Ermittelnd des MIME-Types eines zuvor downloadeten Files. Kann nur - // unmittelbar vor FinishFileDownload aufgerufen werden, nie aber - // danach. - - sal_Bool GetFileDownloadMIME( String& rMime ); - - // Beenden eines asynchronen File-Downloads. Gibt sal_True zurueck, wenn - // der Download geklappt hat. Das gelesene File befindet sich dann in - // dem uebergeben String. + // End of an asynchronous file download. Returns TRUE if the download + // was successful. The read file is then passed into String. sal_Bool FinishFileDownload( String& rStr ); - // Gibt sal_True zurueck, wenn ein File downloaded wurde und - // FileDownloadFinished noch nicht gerufen wurde. + // Returns TRUE if a file was downloaded and if FileDownloadFinished + // has not yet been called sal_Bool ShouldFinishFileDownload() const { return pDLMedium != 0; } SfxMedium *GetMedium() { return pMedium; } const SfxMedium *GetMedium() const { return pMedium; } - // Default (auch ohne Iterator) ist JavaScript + // Default (without iterator) is JavaScript ScriptType GetScriptType( SvKeyValueIterator* ) const; const String& GetScriptTypeString( SvKeyValueIterator* ) const; }; @@ -131,3 +122,5 @@ inline sal_Bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const Stri #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxmodelfactory.hxx b/sfx2/inc/sfx2/sfxmodelfactory.hxx index 416358cb60e2..37e6582b697d 100644 --- a/sfx2/inc/sfx2/sfxmodelfactory.hxx +++ b/sfx2/inc/sfx2/sfxmodelfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,5 @@ namespace sfx2 //........................................................................ #endif // SFX2_SFXMODELFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxresid.hxx b/sfx2/inc/sfx2/sfxresid.hxx index 6c67fbbf7dcc..320d18bf0f03 100644 --- a/sfx2/inc/sfx2/sfxresid.hxx +++ b/sfx2/inc/sfx2/sfxresid.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,3 +55,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 17d47097fb46..594c2691d894 100644..100755 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -65,7 +65,7 @@ #define SID_SETUPPRINTER (SID_SFX_START + 302) #define SID_EXITANDRETURN (SID_SFX_START + 303) -// SID_TITLE steht unter diesem Wert in chaos/cntids.hrc!! +// SID_TITLE, this value below is given in chaos/cntids.hrc!! //#define SID_TITLE (SID_SFX_START + 307) #define SID_CONTEXT (SID_SFX_START + 310) @@ -75,6 +75,7 @@ #define SID_VERSION_VISIBLE (SID_SFX_START + 313) #define SID_PASTE_UNFORMATTED (SID_SFX_START + 314) +#define SID_DIALOG_RETURN (SID_SFX_START + 318) #define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320) #define SID_PRINTER_USETHREAD (SID_SFX_START + 321) #define SID_PRINTER_NAME (SID_SFX_START + 322) @@ -107,7 +108,7 @@ #define SID_PROGFILENAME (SID_SFX_START + 342) #define SID_SELECTION (SID_SFX_START + 346) -// 360-400 siehe SID_MAIL_... +// 360-400 see SID_MAIL_... // default-ids for help #define SID_HELPONHELP (SID_SFX_START + 400) @@ -126,7 +127,8 @@ #define SID_HELP_ZOOMOUT (SID_SFX_START + 418) #define SID_HELP_HELPFILEBOX (SID_SFX_START + 419) #define SID_HELP_HELPFILEBOX_SELECTED (SID_SFX_START + 420) -#define SID_HELP_SUPPORTPAGE (SID_SFX_START + 1683) +#define SID_SHOW_LICENSE (SID_SFX_START + 1683) +#define SID_SHOW_CREDITS (SID_SFX_START + 1711) #define SID_HELP_TUTORIALS (SID_SFX_START + 1695) // default-ids for document @@ -184,7 +186,7 @@ #define SID_BROWSER (SID_SFX_START + 1318) #define SID_MACROEXECMODE (SID_SFX_START + 1319) -// die Id steht mit diesem Wert in chaos/cntids.hrc!! +// The Id value is given in chaos/cntids.hrc!! //#define SID_INTERNET_ONLINE (SID_SFX_START + 1370) #define SID_FILTER_DATA (SID_SFX_START + 1375) @@ -368,6 +370,7 @@ #define SID_OPENCOPY (SID_SFX_START + 674) #define SID_SOURCEVIEW (SID_SFX_START + 675) #define SID_DOC_STARTPRESENTATION (SID_SFX_START + 695) +#define SID_DDE_RECONNECT_ONLOAD (SID_SFX_START + 696) #define SID_PLUGFRAMEARG (SID_SFX_START + 666) #define SID_NEWWINDOWFOREDIT (SID_SFX_START + 667) @@ -377,7 +380,7 @@ #define SID_JSCALL (SID_SFX_START + 1382) #define SID_AUTOPILOTMENU (SID_SFX_START + 1381) -// Floating Window Vorlagen +// Floating Window Template #define SID_STYLE_DESIGNER (SID_SFX_START + 539) // Organizer @@ -497,7 +500,7 @@ #define SID_COPY (SID_SFX_START + 711) #define SID_PASTE (SID_SFX_START + 712) -// steht unter diesem Wert in chaos/cntids.hrc!!! +// Value below given in chaos/cntids.hrc!!! //#define SID_DELETE (SID_SFX_START + 713) #define SID_BACKSPACE (SID_SFX_START + 714) @@ -580,7 +583,7 @@ #define SID_AUTOHIDE (SID_SFX_START + 932) #define SID_TOGGLENAVBAR (SID_SFX_START + 1603) -// Item-Id f"ur die Ereigniszuweisen-Tabpage +// Item-Id for the assinged event Tabpage #define SID_ATTR_MACROITEM (SID_SFX_START + 934) #define SID_SAVECONFIG (SID_SFX_START + 930) @@ -748,6 +751,7 @@ #define SID_ATTR_QUICKLAUNCHER (SID_OPTIONS_START + 74) #define SID_ATTR_YEAR2000 (SID_OPTIONS_START + 87) #define SID_ATTR_ALLOWFOLDERWEBVIEW (SID_OPTIONS_START + 92) +#define SID_ATTR_APPLYCHARUNIT (SID_OPTIONS_START + 88) // PathTabPage @@ -826,7 +830,7 @@ #define SID_SAVEREL_INET (SID_OPTIONS_START + 30) #define SID_SAVEREL_FSYS (SID_OPTIONS_START + 31) -// Automatisches update von Styles - Verwalten-TabPage +// Automatic update of Styles - manage TabPage #define SID_ATTR_AUTO_STYLE_UPDATE (SID_OPTIONS_START + 65) #define SID_SECURE_URL (SID_OPTIONS_START + 66) @@ -860,7 +864,6 @@ #define SID_ZOOM (SID_SVX_START + 289) #define SID_SEARCH_ITEM (SID_SVX_START + 291) #define SID_ATTR_CHAR_FONTWIDTH (SID_SVX_START + 303) -#define SID_HYPERLINK_INSERT (SID_SVX_START + 360) #define SID_HYPERLINK_GETLINK (SID_SVX_START + 361) #define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) #define SID_NAVIGATOR (SID_SVX_START + 366) @@ -884,7 +887,7 @@ #define FID_SVX_START (SID_LIB_START + 500) #define FID_SEARCH_NOW (FID_SVX_START + 2) -// SlotIds f"ur Basic ------------------------------------------------------- +// SlotIds for Basic ------------------------------------------------------- #define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 ) #define SID_BASICIDE_ADDWATCH ( SID_BASICIDE_START + 1 ) #define SID_BASICIDE_APPEAR ( SID_BASICIDE_START + 15 ) @@ -935,7 +938,7 @@ #define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 ) #define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 ) -// SlotIds f"ur Apps -------------------------------------------------------- +// SlotIds for Apps -------------------------------------------------------- #define FN_PARAM (SID_SW_START + 1100) #define FN_PARAM_1 (FN_PARAM+60) #define FN_PARAM_2 (FN_PARAM+61) @@ -945,7 +948,7 @@ #define FN_PARAM_6 (FN_PARAM+65) #define FN_PARAM_7 (FN_PARAM+66) #define FN_PARAM_8 (FN_PARAM+67) -#define FN_FAX (SID_SW_START + 28) /* Faxen */ +#define FN_FAX (SID_SW_START + 28) /* Fax */ #define SID_KEYFUNC_START (SID_SC_START + 521) #define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0) diff --git a/sfx2/inc/sfx2/sfxstatuslistener.hxx b/sfx2/inc/sfx2/sfxstatuslistener.hxx index 02fa61b17f45..c8b709e2aeb5 100644 --- a/sfx2/inc/sfx2/sfxstatuslistener.hxx +++ b/sfx2/inc/sfx2/sfxstatuslistener.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ class SFX2_DLLPUBLIC SfxStatusListener : }; #endif // _SFXSTATUSLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/sfxuno.hxx b/sfx2/inc/sfx2/sfxuno.hxx index 691716b70571..d0fc3601b593 100644 --- a/sfx2/inc/sfx2/sfxuno.hxx +++ b/sfx2/inc/sfx2/sfxuno.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,9 +57,7 @@ //________________________________________________________________________________________________________________________ #include <osl/mutex.hxx> -#ifndef _RTL_USTRING_HXX #include <rtl/ustring.hxx> -#endif //________________________________________________________________________________________________________________________ // defines for namespaces ! @@ -609,3 +608,5 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, ::com::sun::star::uno::Sequ } #endif // _SFX_SFXUNO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/shell.hxx b/sfx2/inc/sfx2/shell.hxx index 40c2a7fc42fc..1b933a90778f 100644 --- a/sfx2/inc/sfx2/shell.hxx +++ b/sfx2/inc/sfx2/shell.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,6 @@ #include <tools/rtti.hxx> #include <svl/brdcst.hxx> -#include <tools/ownlist.hxx> #include <tools/unqid.hxx> #include <tools/string.hxx> @@ -79,11 +79,10 @@ namespace svl enum SfxInterfaceId -/* [Beschreibung] +/* [Description] - Id f"ur die <SfxInterface>s, damit wird "uber ein Array an der - <SfxApplication> ein quasi-statischer Zugriff auf die Interfaces - erlaubt. + Id for <SfxInterface>s, gives a quasi-static access to the interface + through an array to <SfxApplication>. */ { @@ -130,7 +129,7 @@ enum SfxInterfaceId SFX_INTERFACE_SBA_END = 399, SFX_INTERFACE_IDE_START = 400, SFX_INTERFACE_IDE_END = 409, - //-falls die noch einer braucht + //-if one is still needed SFX_INTERFACE_APP = SFX_INTERFACE_SW_START, SFX_INTERFACE_LIB = 450 }; @@ -145,20 +144,19 @@ typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet); class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster -/* [Beschreibung] +/* [Description] - Die Klasse SfxShell ist Basisklasse f"ur alle Schichten, die - Funktionalit"at Form von <Slot>s bereitstellen wollen. - - Jede Instanz hat einen Verweis auf eine Interface-Beschreibung, der - mit <SfxShell::GetInterface()const> erh"altlich ist. Dieses Interface - stellt die Verbindung zu konkreten Methoden her und enth"alt einige - weitere beschreibende Daten f"ur Controller wie Menus und Toolboxen, aber - auch f"ur die diversen APIs. Der Hautpteil der Interface-Beschreibung - liegt in Form einer <Type-Library> vor, die mit dem <SVIDL-Compiler> - aus einem IDL-File generiert wird. F"ur jede SfxShell-Subclass ist ein - solches IDL-File zu schreiben. + The class SfxShell is the base class for all classes, which provide + the functionality of the form <Slot>s. + Each instance has a reference to an interface description, which is + obtainable through <SfxShell::GetInterface()const>. This interface + provides the connection to specific methods and contains some other + descriptive data for controllers like menus and toolboxes, but also + for the various APIs. The main part of the interface description is in + the form of a <Type-Library>, which is generated from an IDL-file by + the <SVIDL-Compiler>. For each SfxShell Subclass-File there is one + such IDL-file to write. */ { @@ -169,8 +167,8 @@ class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster ::svl::IUndoManager* pUndoMgr; private: - SfxShell( const SfxShell & ); // n.i. - SfxShell& operator = ( const SfxShell & ); // n.i. + SfxShell( const SfxShell & ); // internal + SfxShell& operator = ( const SfxShell & ); // internal protected: SfxShell(); @@ -259,7 +257,7 @@ public: virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); #ifndef _SFXSH_HXX - SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); + SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); #endif @@ -268,15 +266,15 @@ public: //-------------------------------------------------------------------- SfxItemPool& SfxShell::GetPool() const /* - [Beschreibung] + [Description] - Jede Subclass von SfxShell mu"s einen Pool referenzieren. Dieser - wird teilweise von SFx-eigenen Subklassen gesetzt (z.B. <SfxViewShell>), - mu"s aber insbesondere bei direkt von SfxShell abgeleiteten Klassen - und bei Ableitungen von SfxObjectShell selbst gesetzt werden. + Each Subclass of SfxShell must reference a pool. This is partly set by + SFx's own set of subclasses (eg <SfxViewShell>). In particular however + this must be set directly from one derived SfxShell class and ny + derivatives of SfxObjectShell. - Die Klasse SfxShell selbst hat noch keinen SfxItemPool, es wird - daher ein 0-Pointer zur"uckgeliefert. + The SfxShell class itself does not have any SfxItemPool, therfore a + null-pointer is returned. */ { @@ -286,17 +284,16 @@ SfxItemPool& SfxShell::GetPool() const //------------------------------------------------------------------- inline void SfxShell::SetPool ( - SfxItemPool* pNewPool // Pointer auf den neuen Pool oder 0 + SfxItemPool* pNewPool // Pointer to the new Pool or null ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode melden die Subklassen ihren speziellen <SfxItemPool> - an der SfxShell an. Jede SfxShell Instanz mu\s Zugriff auf einen - SfxItemPool haben. In der Regel ist dies der SfxItemPool der - SfxDocumentShell. Die SfxShell Subklasse "ubernimmt nicht die - Eigent"umerschaft "uber den "ubergebenen Pool. Bevor er gel"oscht - wirde, mu\s er mit SetPool(0) abgemeldet werden. + With this method, the subclasses register their special <SfxItemPool> + in the SfxShell. Each SfxShell instance must have access to a SfxItemPool. + Usually this is the SfxItemPool of the SfxDocumentShell. The SfxShell + subclass does not take ownership of the orphaned pool. Before it is + deleted it has to be deregisted with SetPool(0). */ { @@ -305,12 +302,12 @@ inline void SfxShell::SetPool //===================================================================== -#define SFX_ARGUMENTMAP(ShellClass) static SfxFormalArgument __FAR_DATA a##ShellClass##Args_Impl[] = +#define SFX_ARGUMENTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[] = -#define SFX_SLOTMAP(ShellClass) static SfxFormalArgument __FAR_DATA a##ShellClass##Args_Impl[1]; \ - static SfxSlot __FAR_DATA a##ShellClass##Slots_Impl[] = +#define SFX_SLOTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[1]; \ + static SfxSlot a##ShellClass##Slots_Impl[] = -#define SFX_SLOTMAP_ARG(ShellClass) static SfxSlot __FAR_DATA a##ShellClass##Slots_Impl[] = +#define SFX_SLOTMAP_ARG(ShellClass) static SfxSlot a##ShellClass##Slots_Impl[] = #define SFX_DECL_INTERFACE(nId) \ static SfxInterface* pInterface; \ @@ -327,7 +324,7 @@ inline void SfxShell::SetPool \ SfxInterface* Class::pInterface = 0; \ const SfxFormalArgument* Class::pSfxFormalArgs_Impl = a##Class##Args_Impl;\ - SfxInterface* __EXPORT Class::GetStaticInterface() \ + SfxInterface* Class::GetStaticInterface() \ { \ if ( !pInterface ) \ { \ @@ -356,11 +353,11 @@ inline void SfxShell::SetPool #define SFX_POSITION_MASK 0x000F #define SFX_VISIBILITY_MASK 0xFFF0 -#define SFX_VISIBILITY_UNVISIBLE 0x0000 // nie sichtbar +#define SFX_VISIBILITY_UNVISIBLE 0x0000 // Never visible #define SFX_VISIBILITY_PLUGSERVER 0x0010 #define SFX_VISIBILITY_PLUGCLIENT 0x0020 #define SFX_VISIBILITY_VIEWER 0x0040 - // noch 1 sind frei! + // One is still free! #define SFX_VISIBILITY_RECORDING 0x0200 #define SFX_VISIBILITY_READONLYDOC 0x0400 #define SFX_VISIBILITY_DESKTOP 0x0800 @@ -368,7 +365,7 @@ inline void SfxShell::SetPool #define SFX_VISIBILITY_FULLSCREEN 0x2000 #define SFX_VISIBILITY_CLIENT 0x4000 #define SFX_VISIBILITY_SERVER 0x8000 -#define SFX_VISIBILITY_NOCONTEXT 0xFFFF // immer sichtbar +#define SFX_VISIBILITY_NOCONTEXT 0xFFFF // Always visable #define SFX_OBJECTBAR_REGISTRATION(nPos,rResId) \ GetStaticInterface()->RegisterObjectBar( nPos, rResId ) @@ -396,3 +393,4 @@ inline void SfxShell::SetPool #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/signaturestate.hxx b/sfx2/inc/sfx2/signaturestate.hxx index bea01c6e283a..a7e68013d499 100644 --- a/sfx2/inc/sfx2/signaturestate.hxx +++ b/sfx2/inc/sfx2/signaturestate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ #define SIGNATURESTATE_SIGNATURES_PARTIAL_OK (sal_Int16)5 #endif // SFX2_SIGNATURESTATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/stbitem.hxx b/sfx2/inc/sfx2/stbitem.hxx index f3bb30eaea5f..8be28db84d92 100644 --- a/sfx2/inc/sfx2/stbitem.hxx +++ b/sfx2/inc/sfx2/stbitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,7 +139,7 @@ public: static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \ - SfxStatusBarControl* __EXPORT Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \ + SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \ { return new Class( nSlotId, nId, rStb ); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \ @@ -146,3 +147,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/styfitem.hxx b/sfx2/inc/sfx2/styfitem.hxx index 5bb473906dbd..dd79ff6556f8 100644 --- a/sfx2/inc/sfx2/styfitem.hxx +++ b/sfx2/inc/sfx2/styfitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,28 +31,17 @@ #include "sal/config.h" #include "sfx2/dllapi.h" -#ifndef _BITMAP_HXX //autogen #include <vcl/bitmap.hxx> -#endif -#ifndef _IMAGE_HXX //autogen #include <vcl/image.hxx> -#endif -#include <tools/list.hxx> -#ifndef _RC_HXX //autogen #include <tools/rc.hxx> -#endif #include <rsc/rscsfx.hxx> +#include <vector> -#ifndef _SFX_STYFITEM_HXX_NOLIST struct SfxFilterTupel { String aName; sal_uInt16 nFlags; }; - -DECLARE_LIST(SfxStyleFilter, SfxFilterTupel*) -#else -typedef List SfxStyleFilter; -#endif +typedef ::std::vector< SfxFilterTupel* > SfxStyleFilter; // CLASS ----------------------------------------------------------------- @@ -80,11 +70,7 @@ public: void SetImage( const Image& _rImg ) { aImage = _rImg; } }; -//#if 0 // _SOLAR__PRIVATE -DECLARE_LIST(SfxStyleFamilyList, SfxStyleFamilyItem*) -//#else -//typedef List SfxStyleFamilyList; -//#endif +typedef ::std::vector< SfxStyleFamilyItem* > SfxStyleFamilyList; class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource { @@ -98,11 +84,11 @@ public: SfxStyleFamilies( ) {}; ~SfxStyleFamilies(); - sal_uInt16 Count() const - { return (sal_uInt16)aEntryList.Count(); } + size_t size() const + { return aEntryList.size(); } - const SfxStyleFamilyItem* GetObject(sal_uIntPtr nIdx) const - { return (SfxStyleFamilyItem*)aEntryList.GetObject(nIdx); } + const SfxStyleFamilyItem* at(size_t nIdx) const + { return (SfxStyleFamilyItem*)(aEntryList.empty() ? NULL : aEntryList[nIdx]); } /** updates the images of all single SfxStyleFamilyItems with new images from the given resource @@ -114,8 +100,9 @@ public: @return <TRUE/> if an image list for the requested mode could be found in the given resource. */ - sal_Bool updateImages( const ResId& _rId, const BmpColorMode _eMode ); + sal_Bool updateImages( const ResId& _rId ); }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/styledlg.hxx b/sfx2/inc/sfx2/styledlg.hxx index 10c4b28381a6..4d121edf0e24 100644 --- a/sfx2/inc/sfx2/styledlg.hxx +++ b/sfx2/inc/sfx2/styledlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,9 +39,7 @@ class SFX2_DLLPUBLIC SfxStyleDialog: public SfxTabDialog { private: SfxStyleSheetBase* pStyle; -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( CancelHdl, Button * ); -//#endif protected: virtual const SfxItemSet* GetRefreshedSet(); @@ -59,3 +58,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx index 6ea55ed96067..fc240fc2f2eb 100644 --- a/sfx2/inc/sfx2/tabdlg.hxx +++ b/sfx2/inc/sfx2/tabdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,7 +58,7 @@ class SfxBindings; #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG*/ typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet); -typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Wert +typedef sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value struct TabPageImpl; class SfxUs_Impl; @@ -110,7 +111,6 @@ friend class SfxTabDialogController; sal_Bool bItemsReset; sal_Bool bFmt; -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); DECL_DLLPRIVATE_LINK( OkHdl, Button * ); @@ -119,13 +119,12 @@ friend class SfxTabDialogController; DECL_DLLPRIVATE_LINK( UserHdl, Button * ); DECL_DLLPRIVATE_LINK( CancelHdl, Button * ); SAL_DLLPRIVATE void Init_Impl(sal_Bool, const String *); -//#endif protected: virtual short Ok(); - // wird im Sfx gel"oscht! + // Is deleted in Sfx! virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId ); - // wird *nicht* im Sfx gel"oscht! + // Is not deleted in Sfx! virtual const SfxItemSet* GetRefreshedSet(); virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); virtual long Notify( NotifyEvent& rNEvt ); @@ -153,18 +152,18 @@ public: void AddTabPage( sal_uInt16 nId, CreateTabPage pCreateFunc, // != 0 - GetTabPageRanges pRangesFunc, // darf 0 sein + GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False); void AddTabPage( sal_uInt16 nId, const String &rRiderText, CreateTabPage pCreateFunc, // != 0 - GetTabPageRanges pRangesFunc, // darf 0 sein + GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False, sal_uInt16 nPos = TAB_APPEND); void AddTabPage( sal_uInt16 nId, const Bitmap &rRiderBitmap, CreateTabPage pCreateFunc, // != 0 - GetTabPageRanges pRangesFunc, // darf 0 sein + GetTabPageRanges pRangesFunc, // can be 0 sal_Bool bItemsOnDemand = sal_False, sal_uInt16 nPos = TAB_APPEND); @@ -186,7 +185,7 @@ public: { return aTabCtrl.GetCurPageId(); } void ShowPage( sal_uInt16 nId ); - // liefert ggf. per Map konvertierte lokale Slots + // may provide local slots converted by Map const sal_uInt16* GetInputRanges( const SfxItemPool& ); void SetInputSet( const SfxItemSet* pInSet ); const SfxItemSet* GetOutputItemSet() const { return pOutSet; } @@ -226,10 +225,8 @@ public: void SetApplyHandler(const Link& _rHdl); Link GetApplyHandler() const; -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void Start_Impl(); SAL_DLLPRIVATE sal_Bool OK_Impl() { return PrepareLeaveCurrentPage(); } -//#endif }; END_NAMESPACE_LAYOUT_SFX_TABDIALOG @@ -287,12 +284,11 @@ public: { bHasExchangeSupport = bNew; } enum sfxpg { - KEEP_PAGE = 0x0000, // Fehlerbehandlung; Seite nicht wechseln - // 2. F"ullen eines ItemSets f"ur die Aktualilsierung - // "ubergeordneter Beispiele; dieser Pointer kann immer - // NULL sein!! + KEEP_PAGE = 0x0000, // Error handling; page does not change + // 2. Fill an itemset for update + // parent examples, this pointer can be NULL all the time! LEAVE_PAGE = 0x0001, - // Set aktualisieren und andere Page aktualisieren + // Set, refresh and update other Page REFRESH_SET = 0x0002 }; @@ -305,7 +301,7 @@ public: String GetUserData() { return aUserString; } virtual void FillUserData(); virtual sal_Bool IsReadOnly() const; - virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001 + virtual void PageCreated (SfxAllItemSet aSet); static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True ); void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); @@ -316,3 +312,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/taskpane.hxx b/sfx2/inc/sfx2/taskpane.hxx index 54783b6df455..f80b66c4d0ee 100644 --- a/sfx2/inc/sfx2/taskpane.hxx +++ b/sfx2/inc/sfx2/taskpane.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -243,3 +244,5 @@ namespace sfx2 //...................................................................................................................... #endif // SFX_TASKPANE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/tbxctrl.hxx b/sfx2/inc/sfx2/tbxctrl.hxx index f8bfa0f00b37..cef2730687d5 100644 --- a/sfx2/inc/sfx2/tbxctrl.hxx +++ b/sfx2/inc/sfx2/tbxctrl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,15 +32,9 @@ #include "sfx2/dllapi.h" #include "sal/types.h" #include <vcl/timer.hxx> -#ifndef _MENU_HXX //autogen #include <vcl/menu.hxx> -#endif -#ifndef _FIXED_HXX //autogen #include <vcl/fixed.hxx> -#endif -#ifndef _FLOATWIN_HXX //autogen #include <vcl/floatwin.hxx> -#endif #include <sfx2/ctrlitem.hxx> #include <sfx2/sfxstatuslistener.hxx> #include <svtools/toolboxcontroller.hxx> @@ -61,7 +56,6 @@ class SfxUnoControllerItem; svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ); -//typedef SfxToolBoxControl* (*SfxToolBoxControlCtor)( sal_uInt16 nId, ToolBox &rTbx, SfxBindings & ); typedef SfxToolBoxControl* (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); struct SfxTbxCtrlFactory @@ -110,9 +104,9 @@ class SfxFrameStatusListener : public svt::FrameStatusListener //------------------------------------------------------------------ -/* FloatingWindows, die aus ToolBoxen abgerissen werden k"onnen, sollten - dieser Klasse abgeleitet werden. Da sie ebenfalls von SfxControllerItem - abgeleitet ist, erhalten ihre Instanzen auch die StateChanged Aufrufe. +/* Floating windows that can be torn from tool boxes should be derived from + this class. Since it is also derived from SfxControllerItem, its instances + will also receive the StateChanged calls. */ class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow, public SfxStatusListenerInterface @@ -133,10 +127,7 @@ private: SAL_DLLPRIVATE SfxPopupWindow(SfxPopupWindow &); // not defined SAL_DLLPRIVATE void operator =(SfxPopupWindow &); // not defined - -//#if 0 // _SOLAR__PRIVATE DECL_DLLPRIVATE_LINK( Delete, void * ); -//#endif protected: virtual void PopupModeEnd(); @@ -187,20 +178,18 @@ public: }; //------------------------------------------------------------------ -//------------------------------------------------------------------ #define SFX_DECL_TOOLBOX_CONTROL() \ static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL) -/* F"ur spezielle ToolBox-Controls, z.B. eine Font-Auswahl-Box oder - aus ToolBoxen abrei"sbare FloatingWindows mu"s passend zur Item-Subclass - eine Subclass von SfxTooBoxControl implementiert werden. +/* For special ToolBox controls, such as a font selection box or toolbox + tear-off floating windows, an appropriate Item-Subclass of SfxTooBoxControl + has to be implemented. - Diese Klasse mu"s in SfxApplication::Init() mit der statischen Methode - RegisterControl() registriert werden. Der SFx erzeugt dann automatisch - diese Controls in ToolBoxen, wenn die dazugeh"origen Slots von dem - angegebenen Typ sind. + This class has to be registered in SfxApplication:Init() with the static + control method RegisterControl(). The SFx then automatically creates these + controls in the toolbox, if the associated slots are of the specific type. */ struct SfxToolBoxControl_Impl; @@ -307,14 +296,14 @@ public: }; #define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \ - SfxToolBoxControl* __EXPORT Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx ); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); } #define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \ - SfxToolBoxControl* __EXPORT Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx, Arg); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \ @@ -322,7 +311,6 @@ public: //========================================================================= -//#if 0 // _SOLAR__PRIVATE class SfxDragButton_Impl : public FixedImage { @@ -335,10 +323,6 @@ public: }; class SfxDragToolBoxControl_Impl : public SfxToolBoxControl -/* [Beschreibung] - -*/ - { public: SFX_DECL_TOOLBOX_CONTROL(); @@ -352,10 +336,10 @@ public: class SfxAppToolBoxControl_Impl : public SfxToolBoxControl -/* [Beschreibung] +/* [Description] - Interne Hilfsklasse f"ur um das Popup-Menu <AppMenu_Impl> unter Neu - im SDT zu starten. + Internal helper class for the pop-up menu <AppMenu_Impl> under new + start in the SDT. */ { @@ -380,13 +364,12 @@ protected: virtual void Select( sal_Bool ); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); virtual SfxPopupWindow* CreatePopupWindow(); - DECL_LINK( Activate, Menu * ); // Needed to support high contrast images + DECL_LINK( Activate, Menu * ); private: String aLastURL; sal_Bool bBigImages; PopupMenu* pMenu; sal_uIntPtr m_nSymbolsStyle; - sal_Bool m_bWasHiContrastMode; sal_Bool m_bShowMenuImages; }; @@ -430,7 +413,6 @@ class SfxAddonsToolBoxControl_Impl : public SfxToolBoxControl { sal_Bool bBigImages; PopupMenu* pMenu; - sal_Bool m_bWasHiContrastMode; sal_Bool m_bShowMenuImages; protected: @@ -438,7 +420,7 @@ protected: using SfxToolBoxControl::Select; virtual void Select( sal_Bool ); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); - DECL_LINK( Activate, Menu * ); // Needed to support high contrast images + DECL_LINK( Activate, Menu * ); public: SFX_DECL_TOOLBOX_CONTROL(); SfxAddonsToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); @@ -447,6 +429,6 @@ public: void RefreshMenuImages( Menu* pMenu ); }; -//#endif - #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/templdlg.hxx b/sfx2/inc/sfx2/templdlg.hxx index b663a277065f..e235e760698c 100644 --- a/sfx2/inc/sfx2/templdlg.hxx +++ b/sfx2/inc/sfx2/templdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -100,3 +101,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/titledockwin.hxx b/sfx2/inc/sfx2/titledockwin.hxx index cee9709841a5..8b03be062387 100644 --- a/sfx2/inc/sfx2/titledockwin.hxx +++ b/sfx2/inc/sfx2/titledockwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -170,3 +171,5 @@ namespace sfx2 //...................................................................................................................... #endif // SFX_TITLEDOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/tplpitem.hxx b/sfx2/inc/sfx2/tplpitem.hxx index 5b2cbd1dfaf9..c8c9765be13c 100644 --- a/sfx2/inc/sfx2/tplpitem.hxx +++ b/sfx2/inc/sfx2/tplpitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,8 +50,10 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual int operator==( const SfxPoolItem& ) const; virtual sal_uInt8 GetFlagCount() const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/unoctitm.hxx b/sfx2/inc/sfx2/unoctitm.hxx index f30a544922b5..d1fcf169046b 100644 --- a/sfx2/inc/sfx2/unoctitm.hxx +++ b/sfx2/inc/sfx2/unoctitm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -164,7 +165,6 @@ public: SfxDispatcher* GetDispatcher_Impl(); }; -//#if 0 // _SOLAR__PRIVATE class SfxDispatchController_Impl : public SfxControllerItem { ::com::sun::star::util::URL aDispatchURL; @@ -205,7 +205,7 @@ public: SfxDispatcher* GetDispatcher(); void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); }; -//#endif #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/userinputinterception.hxx b/sfx2/inc/sfx2/userinputinterception.hxx index 16504af6331e..4f7311125bd3 100644 --- a/sfx2/inc/sfx2/userinputinterception.hxx +++ b/sfx2/inc/sfx2/userinputinterception.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,3 +82,5 @@ namespace sfx2 //........................................................................ #endif // USERINPUTINTERCEPTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/viewfac.hxx b/sfx2/inc/sfx2/viewfac.hxx index f3376e733702..da4d7902c30a 100644 --- a/sfx2/inc/sfx2/viewfac.hxx +++ b/sfx2/inc/sfx2/viewfac.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,3 +71,4 @@ private: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index ef5d4a358e22..3c3f1472be8d 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -195,7 +196,6 @@ public: sal_Bool IsInModalMode() const; void Resize(sal_Bool bForce=sal_False); - //void SetChildWindow(sal_uInt16 nId, sal_Bool bVisible ); void SetChildWindow(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus=sal_True); void ToggleChildWindow(sal_uInt16); sal_Bool HasChildWindow(sal_uInt16); @@ -205,7 +205,6 @@ public: void ChildWindowExecute(SfxRequest&); void ChildWindowState(SfxItemSet&); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetDowning_Impl(); SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE sal_Bool IsDowning_Impl() const; @@ -249,7 +248,6 @@ public: SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID ); SAL_DLLPRIVATE void ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ); -//#endif private: SAL_DLLPRIVATE sal_Bool SwitchToViewShell_Impl( sal_uInt16 nNo, sal_Bool bIsIndex = sal_False ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); @@ -343,8 +341,10 @@ public: virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbList() const { return aVerbs; } }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 6e613cce0176..c904e8d1d28e 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,8 @@ #include <tools/gen.hxx> #include <tools/errcode.hxx> #include <vcl/jobset.hxx> +#include <vector> + class SfxBaseController; class Size; class Fraction; @@ -68,7 +71,7 @@ class Dialog; class Menu; class NotifyEvent; -#define SFX_PRINTER_PRINTER 1 // ohne JOBSETUP => temporaer +#define SFX_PRINTER_PRINTER 1 // without JOB SETUP => Temporary #define SFX_PRINTER_JOBSETUP 2 #define SFX_PRINTER_OPTIONS 4 #define SFX_PRINTER_CHG_ORIENTATION 8 @@ -89,7 +92,7 @@ enum SfxScrollingMode SCROLLING_DEFAULT }; -// "Geeicht" mit www.apple.com und Netscape 3.01 +// "Verified" using www.apple.com and Netscape 3.01 #define DEFAULT_MARGIN_WIDTH 8 #define DEFAULT_MARGIN_HEIGHT 12 @@ -97,19 +100,19 @@ enum SfxScrollingMode // @[SfxViewShell-Flags] -#define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button und Options- - Dialog im PrintDialog */ -#define SFX_VIEW_CAN_PRINT 0x0020 /* enabled Printing ohne Printer - erzeugen zu m"ussen */ -#define SFX_VIEW_NO_SHOW 0x0040 /* Window der ViewShell darf nicht - automatisch geshowed werden */ -#define SFX_VIEW_NO_NEWWINDOW 0x0100 /* keine weitere View erlauben */ +#define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button and Options- + Dialog in PrintDialog */ +#define SFX_VIEW_CAN_PRINT 0x0020 /* Printing enabled without having + to create a Printer */ +#define SFX_VIEW_NO_SHOW 0x0040 /* Window of the ViewShell shall + not be showed automatically */ +#define SFX_VIEW_NO_NEWWINDOW 0x0100 /* Allow N View */ -/* [Beschreibung] +/* [Description] - Die SfxViewShell-Flags steuern das Verhalten der SfxViewShell f"ur die - Dauer ihrer Lebenszeit. Sie werden im Konstruktor der <SfxViewShell> - angegeben. + The SfxViewShell flags control the behavior of SfxViewShell for the + duration of its lifetime. They are defined in the constructor of + <SfxViewShell>. */ //========================================================================= @@ -125,7 +128,7 @@ public: \ #define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \ SfxViewFactory* Class::pFactory; \ - SfxViewShell* __EXPORT Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \ + SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \ { return new Class(pFrame, pOldView); } \ void Class::RegisterFactory( sal_uInt16 nPrio ) \ { \ @@ -141,7 +144,7 @@ public: \ Factory().RegisterViewFactory( ViewShellClass::Factory() ) class SfxInPlaceClient; -DECLARE_LIST( SfxInPlaceClientList, SfxInPlaceClient* ) +typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList; // ----------------------------------------------------------------------- class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener @@ -183,7 +186,7 @@ public: static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); - // Ctoren/Dtoren Initialisierung + // Initialize Constructors/Destructors TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH) @@ -205,7 +208,7 @@ public: virtual void JumpToMark( const String& rMark ); void VisAreaChanged(const Rectangle& rRect); - // Verhaltens-Flags + // Behavior Flags SfxScrollingMode GetScrollingMode() const; void SetScrollingMode( SfxScrollingMode eMode ); @@ -224,8 +227,8 @@ public: // Focus, KeyInput, Cursor void GotFocus() const; inline void LostFocus() const; - virtual void ShowCursor( FASTBOOL bOn = sal_True ); - virtual FASTBOOL KeyInput( const KeyEvent &rKeyEvent ); + virtual void ShowCursor( bool bOn = true ); + virtual bool KeyInput( const KeyEvent &rKeyEvent ); sal_Bool Escape(); // Viewing Interface @@ -247,7 +250,7 @@ public: virtual JobSetup GetJobSetup() const; Printer* GetActivePrinter() const; - // Workingset + // Working set virtual void WriteUserData( String&, sal_Bool bBrowse = sal_False ); virtual void ReadUserData( const String&, sal_Bool bBrowse = sal_False ); virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False ); @@ -299,9 +302,8 @@ public: SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ); SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ) - { GetIPClientList_Impl(sal_True)->Insert(pIPClient); } - SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient ) - { GetIPClientList_Impl(sal_True)->Remove(pIPClient); } + { GetIPClientList_Impl(sal_True)->push_back(pIPClient); } + SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient ); SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( sal_Bool bCreate = sal_True ) const; SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP ); SAL_DLLPRIVATE void DiscardClients_Impl(); @@ -336,19 +338,18 @@ public: inline void SfxViewShell::LostFocus() const -/* [Beschreibung] - - Diese Methode mu\s vom Applikationsentwickler gerufen werden, wenn - das Edit-Window den Focus verloren hat. Der SFx hat so z.B. die - M"oglichkeit, den Accelerator auszuschalten, damit in bestimmten - Floating-Windows die Cursor-Tasten, die Delete-Taste etc. funktionieren, - obwohl sie "uber den Accelerator umdefiniert sind. +/* [Description] + This method has to be called by the application developer, if the edit + window has lost the focus. The SFx has for example the ability to turn off + the accelerator, so that the cursor keys, the Delete button, etc. work in + certain Floating-Windows, even though they are redefined by the + Accelerator. - [Anmerkung] + [Note] - <StarView> liefert leider keine M"oglichkeit, solche Events - 'von der Seite' einzuh"angen. + <StarView> unfortunatly does not provide the possibility to define + such events 'from the side'. */ { @@ -358,16 +359,14 @@ inline void SfxViewShell::LostFocus() const inline SfxViewFrame* SfxViewShell::GetViewFrame() const -/* [Bechreibung] +/* [Description] - Diese Methode liefert einen Pointer auf die <SfxViewFrame>-Instanz, - in der diese SfxViewShell dargestellt wird. Dieses ist die Instanz, - die imKonstruktor durchgereicht wurde. Es ist gew"ahrleistet, da\s - der zur"uckgegebene Pointer auf eine g"ultige SfxViewFrame-Instanz - zeigt. + This method returns a pointer to the <SfxViewFrame> Instance in which + this SfxViewShell is displayed. This is the instance that was passed + on in the constructor. It is guaranteed that the returned pointer + points on the valid SfxViewFrame instance. - - [Querverweise] + [Cross-reference] <SfxShell::GetFrame()const> */ @@ -378,3 +377,5 @@ inline SfxViewFrame* SfxViewShell::GetViewFrame() const #endif // #ifndef _SFXVIEWSH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfxbasic.hxx b/sfx2/inc/sfxbasic.hxx new file mode 100644 index 000000000000..14a8bd7f9904 --- /dev/null +++ b/sfx2/inc/sfxbasic.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 _SFXBASIC_HXX +#define _SFXBASIC_HXX + +class BasicManager; +class SbMethod; + +//------------------------------------------------------------------ + +SbMethod* SfxQueryMacro( BasicManager* pMgr, const String& rMacro ); + +ErrCode SfxCallMacro( BasicManager* pMgr, const String& rMacro, + SbxArray *pArgs = 0, SbxValue *pRet = 0 ); + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sorgitm.hxx b/sfx2/inc/sorgitm.hxx index 52dbe7b71294..aedb2ab16ac8 100644 --- a/sfx2/inc/sorgitm.hxx +++ b/sfx2/inc/sorgitm.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,10 +46,11 @@ public: virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const; virtual int operator==( const SfxPoolItem& ) const; - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); String getLanguage() { return aLanguage; }; }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/srchdlg.hxx b/sfx2/inc/srchdlg.hxx index 4816bfc58f8e..2e6d1effb4c7 100644 --- a/sfx2/inc/srchdlg.hxx +++ b/sfx2/inc/srchdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,16 +28,10 @@ #ifndef _SFX_SRCHDLG_HXX_ #define _SFX_SRCHDLG_HXX_ -#ifndef _VCL_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/combobox.hxx> -#ifndef _VCL_EDIT_HXX #include <vcl/edit.hxx> -#endif -#ifndef _VCL_FIXED_HXX #include <vcl/fixed.hxx> -#endif #include <sfx2/basedlgs.hxx> // ============================================================================ @@ -103,3 +98,4 @@ public: #endif // _SFX_SRCHDLG_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/prj/build.lst b/sfx2/prj/build.lst index dbc233ce44e7..1cf56d7517cd 100644 --- a/sfx2/prj/build.lst +++ b/sfx2/prj/build.lst @@ -1,2 +1,2 @@ -sf sfx2 : L10N:l10n idl basic xmlscript framework readlicense_oo shell sax SYSTRAY_GTK:libegg LIBXML2:libxml2 LIBXSLT:libxslt NULL +sf sfx2 : TRANSLATIONS:translations idl basic xmlscript framework readlicense_oo shell sax LIBXML2:libxml2 LIBXSLT:libxslt NULL sf sfx2\prj nmake - all sf_prj NULL diff --git a/sfx2/prj/makefile.mk b/sfx2/prj/makefile.mk index e312a7ccab65..e312a7ccab65 100644..100755 --- a/sfx2/prj/makefile.mk +++ b/sfx2/prj/makefile.mk diff --git a/sfx2/qa/complex/sfx2/DocumentInfo.java b/sfx2/qa/complex/sfx2/DocumentInfo.java index ca7ae8b1dda0..ca7ae8b1dda0 100644..100755 --- a/sfx2/qa/complex/sfx2/DocumentInfo.java +++ b/sfx2/qa/complex/sfx2/DocumentInfo.java diff --git a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java index d145b9028473..8f7071048fc3 100644..100755 --- a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java +++ b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java @@ -127,10 +127,6 @@ public class DocumentMetadataAccess XRepositorySupplier xRS; XDocumentMetadataAccess xDMA; -// public String[] getTestMethodNames () -// { -// return new String[] { "check", "checkRDFa" }; -// } /** * The test parameters */ @@ -522,11 +518,6 @@ public class DocumentMetadataAccess PropertyValue file = new PropertyValue(); file.Name = "URL"; file.Value = tempDir + "TESTDMA.odt"; - /* - PropertyValue baseURL = new PropertyValue(); - baseURL.Name = "DocumentBaseURL"; - baseURL.Value = tempDir + "TMP.odt"; - */ PropertyValue mimetype = new PropertyValue(); mimetype.Name = "MediaType"; mimetype.Value = "application/vnd.oasis.opendocument.text"; @@ -960,39 +951,14 @@ public class DocumentMetadataAccess return blank != null; } -/* - static class Statement implements XStatement - { - XResource m_Subject; - XResource m_Predicate; - XNode m_Object; - XURI m_Graph; - - Statement(XResource i_Subject, XResource i_Predicate, XNode i_Object, - XURI i_Graph) - { - m_Subject = i_Subject; - m_Predicate = i_Predicate; - m_Object = i_Object; - m_Graph = i_Graph; - } - - public XResource getSubject() { return m_Subject; } - public XResource getPredicate() { return m_Predicate; } - public XNode getObject() { return m_Object; } - public XURI getGraph() { return m_Graph; } - } -*/ static Statement[] toSeq(XEnumeration i_Enum) throws Exception { java.util.Collection c = new java.util.Vector(); while (i_Enum.hasMoreElements()) { Statement s = (Statement) i_Enum.nextElement(); -//System.out.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + "."); c.add(s); } -// return (Statement[]) c.toArray(); // java sucks Object[] arr = c.toArray(); Statement[] ret = new Statement[arr.length]; @@ -1009,7 +975,6 @@ public class DocumentMetadataAccess XNode[] s = (XNode[]) i_Enum.nextElement(); c.add(s); } -// return (XNode[][]) c.toArray(); Object[] arr = c.toArray(); XNode[][] ret = new XNode[arr.length][]; for (int i = 0; i < arr.length; ++i) { diff --git a/sfx2/qa/complex/sfx2/DocumentProperties.java b/sfx2/qa/complex/sfx2/DocumentProperties.java index 01ccaa21619b..01ccaa21619b 100644..100755 --- a/sfx2/qa/complex/sfx2/DocumentProperties.java +++ b/sfx2/qa/complex/sfx2/DocumentProperties.java diff --git a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java index 41bd66ccb5b9..41bd66ccb5b9 100644..100755 --- a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java +++ b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java diff --git a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java index 1e9cbb1f4738..1e9cbb1f4738 100644..100755 --- a/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java +++ b/sfx2/qa/complex/sfx2/StandaloneDocumentInfo.java diff --git a/sfx2/qa/complex/sfx2/UndoManager.java b/sfx2/qa/complex/sfx2/UndoManager.java index f37530aba726..c64cd7022e25 100755 --- a/sfx2/qa/complex/sfx2/UndoManager.java +++ b/sfx2/qa/complex/sfx2/UndoManager.java @@ -781,6 +781,7 @@ public class UndoManager m_currentTestCase.doSingleModification(); assertEquals( "when the Undo manager is locked, no implicit additions should happen", 0, m_undoListener.getUndoActionsAdded() ); + assertTrue( "Undo manager gets unlocked as a side effect of performing a simple operation", i_undoManager.isLocked() ); i_undoManager.unlock(); assertEquals( "unlock is not expected to add collected actions - they should be discarded", 0, m_undoListener.getUndoActionsAdded() ); diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java index d255f3d16822..d255f3d16822 100644..100755 --- a/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest.java diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java index bf54bb4ca90b..bf54bb4ca90b 100644..100755 --- a/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/Test01.java diff --git a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java index a650ce9bb2e4..a650ce9bb2e4 100644..100755 --- a/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java +++ b/sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper.java diff --git a/sfx2/qa/complex/sfx2/testdocuments/empty.rdf b/sfx2/qa/complex/sfx2/testdocuments/empty.rdf index af62bab39dfa..af62bab39dfa 100644..100755 --- a/sfx2/qa/complex/sfx2/testdocuments/empty.rdf +++ b/sfx2/qa/complex/sfx2/testdocuments/empty.rdf diff --git a/sfx2/qa/complex/sfx2/tools/DialogThread.java b/sfx2/qa/complex/sfx2/tools/DialogThread.java index e67e65f218db..e67e65f218db 100644..100755 --- a/sfx2/qa/complex/sfx2/tools/DialogThread.java +++ b/sfx2/qa/complex/sfx2/tools/DialogThread.java diff --git a/sfx2/qa/complex/sfx2/tools/TestDocument.java b/sfx2/qa/complex/sfx2/tools/TestDocument.java index 8f2108df358e..8f2108df358e 100644..100755 --- a/sfx2/qa/complex/sfx2/tools/TestDocument.java +++ b/sfx2/qa/complex/sfx2/tools/TestDocument.java diff --git a/sfx2/qa/complex/sfx2/tools/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java index 4767028572bb..b604bd010d65 100644..100755 --- a/sfx2/qa/complex/sfx2/tools/WriterHelper.java +++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java @@ -194,8 +194,6 @@ public class WriterHelper { xRoot = AccessibilityTools.getAccessibleObject(xWindow); - //at.printAccessibleTree(new PrintWriter(System.out),xRoot); - XAccessibleAction action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, bName)); try { diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx index 9930d61acf20..4a94890f21df 100644 --- a/sfx2/qa/cppunit/test_metadatable.cxx +++ b/sfx2/qa/cppunit/test_metadatable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -107,12 +108,12 @@ void MetadatableTest::test() MockMetadatable m4(*pReg); MockMetadatable m5(*pReg); ::rtl::OUString empty; - ::rtl::OUString content( ::rtl::OUString::createFromAscii("content.xml") ); - ::rtl::OUString styles ( ::rtl::OUString::createFromAscii("styles.xml") ); - ::rtl::OUString sid1( ::rtl::OUString::createFromAscii("id1") ); - ::rtl::OUString sid2( ::rtl::OUString::createFromAscii("id2") ); - ::rtl::OUString sid3( ::rtl::OUString::createFromAscii("id3") ); - ::rtl::OUString sid4( ::rtl::OUString::createFromAscii("id4") ); + ::rtl::OUString content( RTL_CONSTASCII_USTRINGPARAM("content.xml") ); + ::rtl::OUString styles( RTL_CONSTASCII_USTRINGPARAM("styles.xml") ); + ::rtl::OUString sid1( RTL_CONSTASCII_USTRINGPARAM("id1") ); + ::rtl::OUString sid2( RTL_CONSTASCII_USTRINGPARAM("id2") ); + ::rtl::OUString sid3( RTL_CONSTASCII_USTRINGPARAM("id3") ); + ::rtl::OUString sid4( RTL_CONSTASCII_USTRINGPARAM("id4") ); beans::StringPair id1(content, sid1); beans::StringPair id2(content, sid2); beans::StringPair id3(content, sid3); @@ -272,3 +273,4 @@ CPPUNIT_TEST_SUITE_REGISTRATION(MetadatableTest); CPPUNIT_PLUGIN_IMPLEMENT(); +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/qa/cppunit/version.map b/sfx2/qa/cppunit/version.map index 3308588ef6f8..3308588ef6f8 100644..100755 --- a/sfx2/qa/cppunit/version.map +++ b/sfx2/qa/cppunit/version.map diff --git a/sfx2/qa/unoapi/Test.java b/sfx2/qa/unoapi/Test.java index c1231c975a2b..c1231c975a2b 100644..100755 --- a/sfx2/qa/unoapi/Test.java +++ b/sfx2/qa/unoapi/Test.java diff --git a/sfx2/qa/unoapi/knownissues.xcl b/sfx2/qa/unoapi/knownissues.xcl index 1d87f84c96d2..1d87f84c96d2 100644..100755 --- a/sfx2/qa/unoapi/knownissues.xcl +++ b/sfx2/qa/unoapi/knownissues.xcl diff --git a/sfx2/qa/unoapi/sfx.sce b/sfx2/qa/unoapi/sfx.sce index ce72c463ee55..ce72c463ee55 100644..100755 --- a/sfx2/qa/unoapi/sfx.sce +++ b/sfx2/qa/unoapi/sfx.sce diff --git a/sfx2/qa/unoapi/testdocuments/SfxStandaloneDocInfoObject.sdw b/sfx2/qa/unoapi/testdocuments/SfxStandaloneDocInfoObject.sdw Binary files differindex c4b5672f9624..c4b5672f9624 100644..100755 --- a/sfx2/qa/unoapi/testdocuments/SfxStandaloneDocInfoObject.sdw +++ b/sfx2/qa/unoapi/testdocuments/SfxStandaloneDocInfoObject.sdw diff --git a/sfx2/qa/unoapi/testdocuments/report.stw b/sfx2/qa/unoapi/testdocuments/report.stw Binary files differindex 5b8efafa159b..5b8efafa159b 100644..100755 --- a/sfx2/qa/unoapi/testdocuments/report.stw +++ b/sfx2/qa/unoapi/testdocuments/report.stw diff --git a/sfx2/qa/unoapi/testdocuments/report2.stw b/sfx2/qa/unoapi/testdocuments/report2.stw Binary files differindex 9ee0a7ee0ee0..9ee0a7ee0ee0 100644..100755 --- a/sfx2/qa/unoapi/testdocuments/report2.stw +++ b/sfx2/qa/unoapi/testdocuments/report2.stw diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index f20cdbd7c385..3bd2bc8b1e02 100644..100755 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -167,7 +167,11 @@ interface Application ExecMethod = MiscExec_Impl ; StateMethod = MiscState_Impl ; ] - SID_HELP_SUPPORTPAGE + SID_SHOW_LICENSE + [ + ExecMethod = MiscExec_Impl ; + ] + SID_SHOW_CREDITS [ ExecMethod = MiscExec_Impl ; ] @@ -177,6 +181,7 @@ interface Application SID_AVAILABLE_TOOLBARS [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_HELP_TUTORIALS [ diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index 0e4a302d9d13..0e4a302d9d13 100644..100755 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index dbf9267448e1..c17b2b190c08 100644..100755 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -30,11 +30,6 @@ interface Window Automation = FALSE ; ] { - SID_HYPERLINK_INSERT - [ - ExecMethod = ChildWindowExecute ; - StateMethod = ChildWindowState ; - ] SID_HYPERLINK_DIALOG [ ExecMethod = ChildWindowExecute ; @@ -281,12 +276,12 @@ interface Window ExecMethod = ExecView_Impl; ] - // Nur f"ur Gestalter: Slot mu\s vorhanden sein + // Only for Designers: Slot must be present SID_STYLE_NEW [ ] - // Nur f"ur Gestalter: Slot mu\s vorhanden sein + // Only for Designers: Slot must be present SID_STYLE_DRAGHIERARCHIE [ ] @@ -333,7 +328,7 @@ interface BrowseWindow : Window { SID_ACTIVATE // ole(no) api(final/play/rec) [ - // Implementierung in Subklassen + // Implementations in Subclasses ] SID_NEWWINDOW // ole(no) api(play/rec) [ diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index a9c5ca6e7330..e69bf590a322 100644..100755 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -2953,33 +2953,6 @@ SfxBoolItem InsertDoc SID_INSERTDOC ] //-------------------------------------------------------------------------- -SfxBoolItem InsertHyperlink SID_HYPERLINK_INSERT - -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- SfxVoidItem InsertObjectFloatingFrame SID_INSERT_FLOATINGFRAME ( SfxStringItem Name FN_PARAM_1, @@ -3830,6 +3803,33 @@ SfxUInt16Item MetricUnit SID_ATTR_METRIC ] //-------------------------------------------------------------------------- +SfxBoolItem ApplyCharUnit SID_ATTR_APPLYCHARUNIT + +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_VIEW; +] + +//-------------------------------------------------------------------------- SfxBoolItem Modified SID_MODIFIED [ @@ -3857,7 +3857,7 @@ SfxBoolItem Modified SID_MODIFIED ] //-------------------------------------------------------------------------- -SfxStringItem ModifiedStatus SID_DOC_MODIFIED +SfxBoolItem ModifiedStatus SID_DOC_MODIFIED [ /* flags: */ @@ -7264,7 +7264,32 @@ SfxVoidItem UpdateConfiguration SID_UPDATE_CONFIG ] //-------------------------------------------------------------------------- -SfxVoidItem HelpSupport SID_HELP_SUPPORTPAGE +SfxVoidItem ShowLicense SID_SHOW_LICENSE +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_APPLICATION; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ShowCredits SID_SHOW_CREDITS () [ /* flags: */ diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi index 421c1cb29529..421c1cb29529 100644..100755 --- a/sfx2/sdi/sfxitems.sdi +++ b/sfx2/sdi/sfxitems.sdi diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi index 1479c4716efc..1479c4716efc 100644..100755 --- a/sfx2/sdi/sfxslots.sdi +++ b/sfx2/sdi/sfxslots.sdi diff --git a/sfx2/sdi/viwslots.sdi b/sfx2/sdi/viwslots.sdi index 4d14d927adf6..4d14d927adf6 100644..100755 --- a/sfx2/sdi/viwslots.sdi +++ b/sfx2/sdi/viwslots.sdi diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index d8442bb215f6..c69b3939ee99 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,6 @@ #include <sfx2/app.hxx> #include <sfx2/frame.hxx> -#include <vos/process.hxx> #include <tools/simplerm.hxx> #include <tools/config.hxx> #include <basic/basrdll.hxx> @@ -121,7 +121,7 @@ #include <sfx2/mnuitem.hxx> #endif -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) #define DDE_AVAILABLE #endif @@ -147,137 +147,119 @@ #include <framework/addonsoptions.hxx> #include <svtools/ttprops.hxx> #include <unotools/extendedsecurityoptions.hxx> +#include <rtl/instance.hxx> using namespace ::com::sun::star; // Static member SfxApplication* SfxApplication::pApp = NULL; static BasicDLL* pBasic = NULL; +static SfxHelp* pSfxHelp = NULL; -class SfxPropertyHandler : public PropertyHandler +namespace { - virtual void Property( ApplicationProperty& ); -}; - -static SfxPropertyHandler* pPropertyHandler = 0; - -SfxPropertyHandler* GetOrCreatePropertyHandler() -{ - if ( !pPropertyHandler ) + class SfxPropertyHandler : public PropertyHandler { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pPropertyHandler ) - pPropertyHandler = new SfxPropertyHandler; - } - - return pPropertyHandler; -} + virtual void Property( ApplicationProperty& ); + }; -void SfxPropertyHandler::Property( ApplicationProperty& rProp ) -{ - TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp ); - if ( pTTProperties ) + void SfxPropertyHandler::Property( ApplicationProperty& rProp ) { - pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION; - switch ( pTTProperties->nActualPR ) + TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp ); + if ( pTTProperties ) { - case TT_PR_SLOTS: - { - pTTProperties->nSidOpenUrl = SID_OPENURL; - pTTProperties->nSidFileName = SID_FILE_NAME; - pTTProperties->nSidNewDocDirect = SID_NEWDOCDIRECT; - pTTProperties->nSidCopy = SID_COPY; - pTTProperties->nSidPaste = SID_PASTE; - pTTProperties->nSidSourceView = SID_SOURCEVIEW; - pTTProperties->nSidSelectAll = SID_SELECTALL; - pTTProperties->nSidReferer = SID_REFERER; - pTTProperties->nActualPR = 0; - } - break; - case TT_PR_DISPATCHER: + pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION; + switch ( pTTProperties->nActualPR ) { - // interface for TestTool - SfxViewFrame* pViewFrame=0; - SfxDispatcher* pDispatcher=0; - pViewFrame = SfxViewFrame::Current(); - if ( !pViewFrame ) - pViewFrame = SfxViewFrame::GetFirst(); - if ( pViewFrame ) - pDispatcher = pViewFrame->GetDispatcher(); - else - pDispatcher = NULL; - if ( !pDispatcher ) - pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER; - else + case TT_PR_SLOTS: { - pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON); - if ( pTTProperties->mnSID == SID_NEWDOCDIRECT - || pTTProperties->mnSID == SID_OPENDOC ) + pTTProperties->nSidOpenUrl = SID_OPENURL; + pTTProperties->nSidFileName = SID_FILE_NAME; + pTTProperties->nSidNewDocDirect = SID_NEWDOCDIRECT; + pTTProperties->nSidCopy = SID_COPY; + pTTProperties->nSidPaste = SID_PASTE; + pTTProperties->nSidSourceView = SID_SOURCEVIEW; + pTTProperties->nSidSelectAll = SID_SELECTALL; + pTTProperties->nSidReferer = SID_REFERER; + pTTProperties->nActualPR = 0; + } + break; + case TT_PR_DISPATCHER: + { + // interface for TestTool + SfxViewFrame* pViewFrame=0; + SfxDispatcher* pDispatcher=0; + pViewFrame = SfxViewFrame::Current(); + if ( !pViewFrame ) + pViewFrame = SfxViewFrame::GetFirst(); + if ( pViewFrame ) + pDispatcher = pViewFrame->GetDispatcher(); + else + pDispatcher = NULL; + if ( !pDispatcher ) + pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER; + else { - SfxPoolItem** pArgs = pTTProperties->mppArgs; - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - if ( pArgs && *pArgs ) - { - for ( SfxPoolItem **pArg = pArgs; *pArg; ++pArg ) - aSet.Put( **pArg ); - } - if ( pTTProperties->mnSID == SID_NEWDOCDIRECT ) + pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON); + if ( pTTProperties->mnSID == SID_NEWDOCDIRECT + || pTTProperties->mnSID == SID_OPENDOC ) { - String aFactory = String::CreateFromAscii("private:factory/"); + SfxPoolItem** pArgs = pTTProperties->mppArgs; + SfxAllItemSet aSet( SFX_APP()->GetPool() ); if ( pArgs && *pArgs ) { - SFX_ITEMSET_ARG( &aSet, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, sal_False ); - if ( pFactoryName ) - aFactory += pFactoryName->GetValue(); + for ( SfxPoolItem **pArg = pArgs; *pArg; ++pArg ) + aSet.Put( **pArg ); + } + if ( pTTProperties->mnSID == SID_NEWDOCDIRECT ) + { + String aFactory = String::CreateFromAscii("private:factory/"); + if ( pArgs && *pArgs ) + { + SFX_ITEMSET_ARG( &aSet, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, sal_False ); + if ( pFactoryName ) + aFactory += pFactoryName->GetValue(); + else + aFactory += String::CreateFromAscii("swriter"); + } else aFactory += String::CreateFromAscii("swriter"); + + aSet.Put( SfxStringItem( SID_FILE_NAME, aFactory ) ); + aSet.ClearItem( SID_NEWDOCDIRECT ); + pTTProperties->mnSID = SID_OPENDOC; } - else - aFactory += String::CreateFromAscii("swriter"); - aSet.Put( SfxStringItem( SID_FILE_NAME, aFactory ) ); - aSet.ClearItem( SID_NEWDOCDIRECT ); - pTTProperties->mnSID = SID_OPENDOC; + aSet.Put( SfxStringItem( SID_TARGETNAME, DEFINE_CONST_UNICODE("_blank") ) ); + if ( pDispatcher->ExecuteFunction( pTTProperties->mnSID, aSet, pTTProperties->mnMode ) + == EXECUTE_NO ) + pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; + else + pTTProperties->nActualPR = 0; } - - aSet.Put( SfxStringItem( SID_TARGETNAME, DEFINE_CONST_UNICODE("_blank") ) ); - if ( pDispatcher->ExecuteFunction( pTTProperties->mnSID, aSet, pTTProperties->mnMode ) - == EXECUTE_NO ) - pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; - else - pTTProperties->nActualPR = 0; - } - else - { - if ( pDispatcher->ExecuteFunction( - pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode ) - == EXECUTE_NO ) - pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; else - pTTProperties->nActualPR = 0; + { + if ( pDispatcher->ExecuteFunction( + pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode ) + == EXECUTE_NO ) + pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; + else + pTTProperties->nActualPR = 0; + } } } + break; + default: + { + pTTProperties->nPropertyVersion = 0; + } } - break; -/* - case TT_PR_IMG: - { - SvDataMemberObjectRef aDataObject = new SvDataMemberObject(); - SvData* pDataBmp = new SvData( FORMAT_BITMAP ); - pDataBmp->SetData( pTTProperties->mpBmp ); - aDataObject->Append( pDataBmp ); - aDataObject->CopyClipboard(); - pTTProperties->nActualPR = 0; - } - break; -*/ - default: - { - pTTProperties->nPropertyVersion = 0; - } + return; } - return; } + + class thePropertyHandler + : public rtl::Static<SfxPropertyHandler, thePropertyHandler> {}; } #include <framework/imageproducer.hxx> @@ -297,15 +279,16 @@ SfxApplication* SfxApplication::GetOrCreate() SfxApplication *pNew = new SfxApplication; //TODO/CLEANUP - //ist das Mutex-Handling OK? + // Is the Mutex-Handling OK? static ::osl::Mutex aProtector; ::osl::MutexGuard aGuard2( aProtector ); RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxApplication::SetApp" ); pApp = pNew; - // at the moment a bug may occur when Initialize_Impl returns sal_False, but this is only temporary because all code that may cause such a - // fault will be moved outside the SFX + // 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 fault will be moved outside the SFX pApp->Initialize_Impl(); ::framework::SetImageProducer( GetImage ); @@ -316,7 +299,6 @@ SfxApplication* SfxApplication::GetOrCreate() ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible ); ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel ); - SfxHelp* pSfxHelp = new SfxHelp; Application::SetHelp( pSfxHelp ); if ( SvtHelpOptions().IsHelpTips() ) Help::EnableQuickHelp(); @@ -336,12 +318,11 @@ SfxApplication::SfxApplication() RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxApplication::SfxApplication" ); SetName( DEFINE_CONST_UNICODE("StarOffice") ); - GetpApp()->SetPropertyHandler( GetOrCreatePropertyHandler() ); + GetpApp()->SetPropertyHandler( &thePropertyHandler::get() ); SvtViewOptions::AcquireOptions(); pAppData_Impl = new SfxAppData_Impl( this ); - pAppData_Impl->UpdateApplicationSettings( SvtMenuOptions().IsEntryHidingEnabled() ); pAppData_Impl->m_xImeStatusWindow->init(); pApp->PreInit(); @@ -353,7 +334,7 @@ SfxApplication::SfxApplication() #else if( !InitializeDde() ) { - ByteString aStr( "Kein DDE-Service moeglich. Fehler: " ); + ByteString aStr( "No DDE-Service possible. Error: " ); if( GetDdeService() ) aStr += ByteString::CreateFromInt32(GetDdeService()->GetError()); else @@ -363,6 +344,8 @@ SfxApplication::SfxApplication() #endif #endif + pSfxHelp = new SfxHelp; + pBasic = new BasicDLL; StarBASIC::SetGlobalErrorHdl( LINK( this, SfxApplication, GlobalBasicErrorHdl_Impl ) ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} initialize DDE" ); @@ -376,6 +359,9 @@ SfxApplication::~SfxApplication() SfxModule::DestroyModules_Impl(); + delete pSfxHelp; + Application::SetHelp( NULL ); + // delete global options SvtViewOptions::ReleaseOptions(); delete pBasic; @@ -391,16 +377,15 @@ SfxApplication::~SfxApplication() const String& SfxApplication::GetLastDir_Impl() const -/* [Beschreibung] +/* [Description] - Interne Methode, mit der im SFx das zuletzt mit der Methode - <SfxApplication::SetLastDir_Impl()> gesetzte Verzeichnis - zurueckgegeben wird. + Internal method by which the last set directory with the method + <SfxApplication::SetLastDir_Impl()> in SFX is returned. - Dieses ist i.d.R. das zuletzt durch den SfxFileDialog - angesprochene Verzeichnis. + This is usually the most recently addressed by the + SfxFileDialog directory. - [Querverweis] + [Cross-reference] <SfxApplication::SetLastDir_Impl()> */ @@ -410,11 +395,11 @@ const String& SfxApplication::GetLastDir_Impl() const const String& SfxApplication::GetLastSaveDirectory() const -/* [Beschreibung] +/* [Description] - Wie <SfxApplication::GetLastDir_Impl()>, nur extern + As <SfxApplication::GetLastDir_Impl()>, only external - [Querverweis] + [Cross-reference] <SfxApplication::GetLastDir_Impl()> */ @@ -426,15 +411,15 @@ const String& SfxApplication::GetLastSaveDirectory() const void SfxApplication::SetLastDir_Impl ( - const String& rNewDir /* kompletter Verzeichnis-Pfad als String */ - ) + const String& rNewDir /* Complete directory path as a string */ +) -/* [Beschreibung] +/* [Description] - Interne Methode, mit der ein Verzeichnis-Pfad gesetzt wird, der - zuletzt (z.B. durch den SfxFileDialog) angesprochen wurde. + Internal Method, by which a directory path is set that was last addressed + (eg by the SfxFileDialog). - [Querverweis] + [Cross-reference] <SfxApplication::GetLastDir_Impl()> */ @@ -472,9 +457,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) // DocWinActivate : both frames belong to the same TopWindow // TopWinActivate : both frames belong to different TopWindows -// not used anymore! -// sal_Bool bDocWinActivate = pOldContainerFrame && pNewContainerFrame && -// pOldContainerFrame->GetTopViewFrame() == pNewContainerFrame->GetTopViewFrame(); + sal_Bool bTaskActivate = pOldContainerFrame != pNewContainerFrame; if ( pOldContainerFrame ) @@ -489,15 +472,6 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) pAppData_Impl->pViewFrame = pFrame; - //const SfxObjectShell* pSh = pViewFrame ? pViewFrame->GetObjectShell() : 0; - //if ( !pSh ) - //{ - // // otherwise BaseURL is set in activation of document - // INetURLObject aObject( SvtPathOptions().GetWorkPath() ); - // aObject.setFinalSlash(); - // INetURLObject::SetBaseURL( aObject.GetMainURL( INetURLObject::NO_DECODE ) ); - //} - if( pNewContainerFrame ) { pNewContainerFrame->DoActivate( bTaskActivate ); @@ -557,8 +531,7 @@ short SfxApplication::QuerySave_Impl( SfxObjectShell& rDoc, sal_Bool /*bAutoSave ResMgr* SfxApplication::CreateResManager( const char *pPrefix ) { - String aMgrName = String::CreateFromAscii( pPrefix ); - return ResMgr::CreateResMgr(U2S(aMgrName)); + return ResMgr::CreateResMgr(pPrefix); } //--------------------------------------------------------------------- @@ -727,7 +700,7 @@ IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic ) basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData ); // call basicide_handle_basic_error in basctl - long nRet = pSymbol( pStarBasic ); + long nRet = pSymbol ? pSymbol( pStarBasic ) : 0; return nRet; } @@ -743,8 +716,8 @@ sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL ) ::com::sun::star::uno::Reference < ::com::sun::star::uri::XUriReferenceFactory > xFactory( xSMgr->createInstance( - ::rtl::OUString::createFromAscii( - "com.sun.star.uri.UriReferenceFactory" ) ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uri.UriReferenceFactory" )) ), ::com::sun::star::uno::UNO_QUERY ); if ( xFactory.is() ) @@ -823,3 +796,5 @@ ErrCode SfxApplication::CallBasic( const String& rCode, BasicManager* pMgr, SbxA { return pMgr->ExecuteMacro( rCode, pArgs, pRet); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index ff01fd358d4d..25e4e4527e37 100644..100755 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -34,9 +34,6 @@ #define ACC_IBM (RID_SFX_APP_START+2) #define MSG_ERR_NO_WEBBROWSER_FOUND (RID_SFX_APP_START+7) -// Note: no longer in use -// #define MSG_ERR_EXTERNAL_APP_NOT_FOUND (RID_SFX_APP_START+8) - #define MSG_ISPRINTING_QUERYABORT (RID_SFX_APP_START+9) #define MSG_CANT_QUIT (RID_SFX_APP_START+10) #define STR_ISMODIFIED (RID_SFX_APP_START+11) @@ -77,13 +74,9 @@ #define IMG_HELP_TOOLBOX_COPY (RID_SFX_APP_START+118) #define IMG_HELP_CONTENT_BOOK_OPEN (RID_SFX_APP_START+120) -#define IMG_HELP_CONTENT_BOOK_OPEN_HC (RID_SFX_APP_START+121) #define IMG_HELP_CONTENT_BOOK_CLOSED (RID_SFX_APP_START+122) -#define IMG_HELP_CONTENT_BOOK_CLOSED_HC (RID_SFX_APP_START+123) #define IMG_HELP_CONTENT_DOC (RID_SFX_APP_START+124) -#define IMG_HELP_CONTENT_DOC_HC (RID_SFX_APP_START+125) // image - #define STR_HELP_WINDOW_TITLE (RID_SFX_APP_START+125) // string #define STR_HELP_BUTTON_INDEX_ON (RID_SFX_APP_START+126) @@ -114,16 +107,6 @@ #define RID_HELP_ONSTARTUP_BOX (RID_SFX_APP_START+144) #define RID_HELP_ONSTARTUP_TEXT (RID_SFX_APP_START+145) -#define IMG_HELP_TOOLBOX_HC_INDEX_ON (RID_SFX_APP_START+150) -#define IMG_HELP_TOOLBOX_HC_INDEX_OFF (RID_SFX_APP_START+151) -#define IMG_HELP_TOOLBOX_HC_START (RID_SFX_APP_START+152) -#define IMG_HELP_TOOLBOX_HC_PREV (RID_SFX_APP_START+153) -#define IMG_HELP_TOOLBOX_HC_NEXT (RID_SFX_APP_START+154) -#define IMG_HELP_TOOLBOX_HC_PRINT (RID_SFX_APP_START+155) -#define IMG_HELP_TOOLBOX_HC_BOOKMARKS (RID_SFX_APP_START+156) -#define IMG_HELP_TOOLBOX_HC_SEARCHDIALOG (RID_SFX_APP_START+157) -#define IMG_HELP_TOOLBOX_HC_COPY (RID_SFX_APP_START+158) - #define IMG_HELP_TOOLBOX_L_INDEX_ON (RID_SFX_APP_START+160) #define IMG_HELP_TOOLBOX_L_INDEX_OFF (RID_SFX_APP_START+161) #define IMG_HELP_TOOLBOX_L_START (RID_SFX_APP_START+162) @@ -134,31 +117,15 @@ #define IMG_HELP_TOOLBOX_L_SEARCHDIALOG (RID_SFX_APP_START+167) #define IMG_HELP_TOOLBOX_L_COPY (RID_SFX_APP_START+168) -#define IMG_HELP_TOOLBOX_HCL_INDEX_ON (RID_SFX_APP_START+170) -#define IMG_HELP_TOOLBOX_HCL_INDEX_OFF (RID_SFX_APP_START+171) -#define IMG_HELP_TOOLBOX_HCL_START (RID_SFX_APP_START+172) -#define IMG_HELP_TOOLBOX_HCL_PREV (RID_SFX_APP_START+173) -#define IMG_HELP_TOOLBOX_HCL_NEXT (RID_SFX_APP_START+174) -#define IMG_HELP_TOOLBOX_HCL_PRINT (RID_SFX_APP_START+175) -#define IMG_HELP_TOOLBOX_HCL_BOOKMARKS (RID_SFX_APP_START+176) -#define IMG_HELP_TOOLBOX_HCL_SEARCHDIALOG (RID_SFX_APP_START+177) -#define IMG_HELP_TOOLBOX_HCL_COPY (RID_SFX_APP_START+178) - #define RID_SECURITY_WARNING_HYPERLINK (RID_SFX_APP_START + 180) #define RID_SECURITY_WARNING_TITLE (RID_SFX_APP_START + 181) #define RID_DESKTOP (RID_SFX_APP_START + 184) -// #define RID_XMLSEC_WARNING_BROKENSIGNATURE (RID_SFX_APP_START + 185) #define RID_XMLSEC_QUERY_LOSINGSIGNATURE (RID_SFX_APP_START + 186) #define RID_XMLSEC_QUERY_SAVEBEFORESIGN (RID_SFX_APP_START + 187) - // FREE - // FREE -#define RID_XMLSEC_INFO_WRONGDOCFORMAT (RID_SFX_APP_START + 190) -/* obsolete -#define RID_WARNING_MACROSDISABLED (RID_SFX_APP_START + 191) -*/ +#define RID_XMLSEC_INFO_WRONGDOCFORMAT (RID_SFX_APP_START + 190) #define STR_QUERY_UPDATE_LINKS (RID_SFX_APP_START + 192) #define STR_DDE_ERROR (RID_SFX_APP_START + 193) @@ -176,6 +143,16 @@ #define RID_SVXSTR_GRFILTER_FILTERERROR (RID_SFX_APP_START + 202) #define RID_SVXSTR_GRFILTER_TOOBIG (RID_SFX_APP_START + 203) +// For the License Information dialog box +#define DLG_HELP_LICENSING (RID_SFX_APP_START + 204) +#define STR_LICENSING_INFORMATION_1 (RID_SFX_APP_START + 205) +#define STR_LICENSING_INFORMATION_2 (RID_SFX_APP_START + 206) +#define STR_LICENSING_INFORMATION_3 (RID_SFX_APP_START + 207) +#define STR_LICENSING_INFORMATION_4 (RID_SFX_APP_START + 208) +#define STR_LICENSING_INFORMATION_5 (RID_SFX_APP_START + 209) +#define PB_LICENSING_SHOW (RID_SFX_APP_START + 210) +#define PB_LICENSING_CLOSE (RID_SFX_APP_START + 211) + #define MD_DDE_LINKEDIT (RID_SFX_APP_START + 1) #endif // #ifndef _SFX_APP_HRC diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index fa5a1fc1c335..f11578805e4d 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -324,16 +324,6 @@ ToolBox RID_HELPBAR { Identifier = SID_HELP_ANNOTATE ; }; - /* - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - ToolBoxItem - { - Identifier = SID_HELP_DOWNLOAD ; - }; -*/ }; }; @@ -399,7 +389,7 @@ String STR_QUICKSTART_RECENTDOC String STR_QUERY_UPDATE_LINKS { - Text [ en-US ] = "Update all links?" ; + Text [ en-US ] = "This document contains one or more links to external data.\n\nWould you like to change the document, and update all links\nto get the most recent data?" ; }; String STR_DDE_ERROR @@ -417,7 +407,6 @@ WarningBox RID_SECURITY_WARNING_HYPERLINK WarningBox RID_SECURITY_WARNING_NO_HYPERLINKS { - //HelpId = HID_WARNING_SECURITY_NO_HYPERLINKS; Buttons = WB_OK ; DefButton = WB_DEF_OK ; Message [ en-US ] = "For security reasons, the hyperlink cannot be executed.\nThe stated address will not be opened."; @@ -435,7 +424,6 @@ String RID_DESKTOP QueryBox RID_XMLSEC_QUERY_LOSINGSIGNATURE { -// HelpId = HID_XMLSEC_QUERY_LOSINGSIGNATURE; Buttons = WB_YES_NO ; DefButton = WB_DEF_NO ; Message [ en-US ] = "Saving will remove all existing signatures.\nDo you want to continue saving the document?" ; @@ -443,7 +431,6 @@ QueryBox RID_XMLSEC_QUERY_LOSINGSIGNATURE QueryBox RID_XMLSEC_QUERY_SAVEBEFORESIGN { -// HelpId = HID_XMLSEC_QUERY_SAVEBEFORESIGN; Buttons = WB_YES_NO ; DefButton = WB_DEF_YES ; Message [ en-US ] = "The document has to be saved before it can be signed.\nDo you want to save the document?" ; @@ -451,7 +438,6 @@ QueryBox RID_XMLSEC_QUERY_SAVEBEFORESIGN InfoBox RID_XMLSEC_INFO_WRONGDOCFORMAT { -// HelpId = HID_XMLSEC_INFO_WRONGDOCFORMAT; Message [ en-US ] = "This document must be saved in OpenDocument file format before it can be digitally signed." ; }; @@ -516,3 +502,57 @@ String RID_SVXSTR_GRFILTER_TOOBIG Text [ en-US ] = "Not enough memory to insert graphic" ; }; +ModalDialog DLG_HELP_LICENSING +{ + // Size is computed + Text [ en-US ] = "Licensing and Legal information"; + MOVEABLE = TRUE ; + CLOSEABLE = TRUE ; + OUTPUTSIZE = TRUE ; + SVLOOK = TRUE ; + String STR_LICENSING_INFORMATION_1 + { + Text [ en-US ] = + "%PRODUCTNAME is made available subject to the terms of GNU Lesser General Public\n" + "License Version 3. A copy of the LGPL license can be found at\n" + "http://www.gnu.org/licenses/lgpl-3.0.html" ; + }; + String STR_LICENSING_INFORMATION_2 + { + Text [ en-US ] = + "Third Party Code Additional copyright notices and license terms applicable to\n" + "portions of the Software are set forth in the THIRDPARTYLICENSEREADME.html\n" + "file; choose Show License to see exact details in English." ; + }; + String STR_LICENSING_INFORMATION_3 + { + Text [ en-US ] = + "All trademarks and registered trademarks mentioned herein are the property of\n" + "their respective owners." ; + }; + String STR_LICENSING_INFORMATION_4 + { + Text [ en-US ] = + "Copyright © 2000, 2010 LibreOffice contributors and/or their affiliates. All rights\n" + "reserved." ; + }; + String STR_LICENSING_INFORMATION_5 + { + Text [ en-US ] = + "This product was created by %OOOVENDOR, based on OpenOffice.org,\n" + "which is Copyright 2000, 2010 Oracle and/or its affiliates.\n" + "%OOOVENDOR acknowledges all community members, please see\n" + "http://www.libreoffice.org/ for more details." ; + }; + OKButton PB_LICENSING_SHOW + { + // Position and size is computed + Text [ en-US ] = "~Show License" ; + DefButton = TRUE ; + }; + CancelButton PB_LICENSING_CLOSE + { + // Position and size is computed + Text [ en-US ] = "~Close" ; + }; +}; diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 6d6c8ace5a09..a776e09d1f74 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,7 +87,7 @@ #define ITEMID_SEARCH SID_SEARCH_ITEM #include <svl/srchitem.hxx> -#include <vos/socket.hxx> +#include <osl/socket.hxx> #define SFX_TYPEMAP #define Selection @@ -99,17 +100,15 @@ using namespace ::com::sun::star::script; using ::basic::BasicManagerRepository; -//======================================================================== - //------------------------------------------------------------------------ -String lcl_GetVersionString(ResMgr* /*pAppData_ImplResMgr*/) +String lcl_GetVersionString() { ::rtl::OUString aDefault; String aVersion( utl::Bootstrap::getBuildIdData( aDefault )); if ( aVersion.Len() == 0 ) { - DBG_ERROR( "No BUILDID in bootstrap file found" ); + OSL_FAIL( "No BUILDID in bootstrap file found" ); } aVersion.Erase( 0, aVersion.Search( ':' ) + 1 ); @@ -133,46 +132,6 @@ sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const //-------------------------------------------------------------------- -void SfxApplication::RegisterBasicConstants -( - const char*, // Prefix vor Konstanten-Namen - const SfxConstant*, // Array von <SfxConstant> Instanzen - sal_uInt16 // Anahl der Kontanten in pConsts -) - -/* [Beschreibung] - - Diese Methode meldet Konstanten beim BASIC an. Sie sollte on-demand - (in GetSbxObject() der Applikation) gerufen werden. Das Array mu\s - alphabetisch nach den Namen sortiert sein! - - Durch den Prefix kann Speicher gespart und das Suchen beschleunigt - werden. Im StarOffice soll der Prefix "so" verwendet werden. - - - [Beispiel] - - const SfxConstant __FAR_DATA aConstants[] = - { - SFX_BOOL_CONSTANT( "False", sal_False ), - SFX_BOOL_CONSTANT( "True", sal_True ), - }; - - ... - SFX_APP()->RegisterBasicConstants( 0, aConstants, 2 ); - ... - -*/ - -{ -// DBG_ASSERT( pAppData_Impl->pBasicMgr, "no basic available" ); - -// pAppData_Impl->pBasicMgr->GetLib(0)->Insert( -// new SfxConstants_Impl( pPrefix, pConsts, nCount ) ); -} - -//-------------------------------------------------------------------- - SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject, const char *pName, sal_uInt32 nSID, SbxDataType eType, SbxClassType eClassType ) { @@ -229,7 +188,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) { SbxObject* pObject = SbxBase::CreateObject( pItem->GetValue() ); pObject->AddRef(); -//(mba) rReq.SetReturnValue( SfxObjectItem( 0, pObject ) ); rReq.Done(); } break; @@ -237,12 +195,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) case SID_DELETE_BASICOBJECT: { - SFX_REQUEST_ARG(rReq, pItem, SfxObjectItem, nSID, sal_False); - if ( pItem ) - { -//(mba) SbxObject* pObject = pItem->GetObject(); -//(mba) pObject->ReleaseRef(); - } break; } @@ -290,7 +242,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) //------------------------------------------------------------------------- void SfxApplication::PropState_Impl( SfxItemSet &rSet ) { -// SfxViewFrame *pFrame = SfxViewFrame::Current(); SfxWhichIter aIter(rSet); for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() ) { @@ -329,3 +280,4 @@ void SfxApplication::PropState_Impl( SfxItemSet &rSet ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index 7f4e8cedb637..eb2c43a27dd3 100755..100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,7 +147,7 @@ Reference< XLibraryContainer > SfxBasicManagerHolder::getLibraryContainer( Conta case SCRIPTS: return mxBasicContainer.get(); case DIALOGS: return mxDialogContainer.get(); } - DBG_ERROR( "SfxBasicManagerHolder::getLibraryContainer: illegal container type!" ); + OSL_FAIL( "SfxBasicManagerHolder::getLibraryContainer: illegal container type!" ); return NULL; } @@ -177,7 +178,7 @@ Sequence< OUString > SfxApplicationDialogLibraryContainer::impl_getStaticSupport if( bNeedsInit ) { OUString* pSeq = seqServiceNames.getArray(); - pSeq[0] = OUString::createFromAscii( "com.sun.star.script.ApplicationDialogLibraryContainer" ); + pSeq[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.ApplicationDialogLibraryContainer")); bNeedsInit = sal_False; } return seqServiceNames; @@ -191,7 +192,7 @@ OUString SfxApplicationDialogLibraryContainer::impl_getStaticImplementationName( MutexGuard aGuard( Mutex::getGlobalMutex() ); if( bNeedsInit ) { - aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.ApplicationDialogLibraryContainer" ); + aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sfx2.ApplicationDialogLibraryContainer")); bNeedsInit = sal_False; } return aImplName; @@ -220,7 +221,7 @@ Sequence< OUString > SfxApplicationScriptLibraryContainer::impl_getStaticSupport if( bNeedsInit ) { OUString* pSeq = seqServiceNames.getArray(); - pSeq[0] = OUString::createFromAscii( "com.sun.star.script.ApplicationScriptLibraryContainer" ); + pSeq[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.ApplicationScriptLibraryContainer")); bNeedsInit = sal_False; } return seqServiceNames; @@ -234,7 +235,7 @@ OUString SfxApplicationScriptLibraryContainer::impl_getStaticImplementationName( MutexGuard aGuard( Mutex::getGlobalMutex() ); if( bNeedsInit ) { - aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.ApplicationScriptLibraryContainer" ); + aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sfx2.ApplicationScriptLibraryContainer")); bNeedsInit = sal_False; } return aImplName; @@ -250,3 +251,4 @@ Reference< XInterface > SAL_CALL SfxApplicationScriptLibraryContainer::impl_crea return xRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index d98147078bc6..7c399b32ad2c 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,15 +31,11 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/util/XURLTransformer.hpp> -#ifndef _COM_SUN_STAR_BEANS_PropertyValue_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> -#endif #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XFlushable.hpp> -#ifndef _STDLIB_H #include <stdlib.h> -#endif #include <tools/config.hxx> #include <vcl/sound.hxx> #include <vcl/msgbox.hxx> @@ -157,7 +154,7 @@ IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer) { ByteString aTmp( "SfxEvent: "); aTmp += ByteString( String( aHint.GetEventName() ), RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + OSL_TRACE( "%s", aTmp.GetBuffer() ); } #endif SFX_APP()->Broadcast( aHint ); @@ -174,7 +171,7 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) { sal_Bool bRet = sal_False; SfxItemPool &rPool = GetPool(); - String aTRUEStr('1'); + String asal_TrueStr('1'); const sal_uInt16 *pRanges = rSet.GetRanges(); SvtSaveOptions aSaveOptions; @@ -274,9 +271,6 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) } break; case SID_ATTR_METRIC : -// if(rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_METRIC ), -// pOptions->GetMetric() ) ) ) -// bRet = sal_True; break; case SID_HELPBALLOONS : if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPBALLOONS ), @@ -390,23 +384,14 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS)) { ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs = aSecurityOptions.GetSecureURLs(); - List aList; + std::vector<String> aList; sal_uInt32 nCount = seqURLs.getLength(); sal_uInt32 nURL; for( nURL=0; nURL<nCount; ++nURL ) - { - aList.Insert( new String( seqURLs[nURL] ), LIST_APPEND ); - } - if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL), - &aList ) ) ) - { + aList.push_back(seqURLs[nURL]); + + if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL), &aList ) ) ) bRet = sal_False; - } - for( nURL=0; nURL<nCount; ++nURL ) - { - delete (String*)aList.GetObject(nURL); - } - aList.Clear(); } } break; @@ -505,7 +490,7 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) } #ifdef DBG_UTIL if ( !bRet ) - DBG_ERROR( "Putting options failed!" ); + OSL_FAIL( "Putting options failed!" ); #endif } pRanges++; @@ -520,13 +505,11 @@ sal_Bool SfxApplication::IsSecureURL( const INetURLObject& rURL, const String* p return SvtSecurityOptions().IsSecureURL( rURL.GetMainURL( INetURLObject::NO_DECODE ), *pReferer ); } //-------------------------------------------------------------------- -// TODO/CLEANUP: wieso zwei SetOptions Methoden? +// TODO/CLEANUP: Why two SetOptions Methods? void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) { const SfxPoolItem *pItem = 0; SfxItemPool &rPool = GetPool(); - sal_Bool bResetSession = sal_False; - sal_Bool bProxiesModified = sal_False; SvtSaveOptions aSaveOptions; SvtUndoOptions aUndoOptions; @@ -609,14 +592,14 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aSaveOptions.SetDocInfoSave(((const SfxBoolItem *)pItem)->GetValue()); } - // offende Dokumente merken + // Mark open Documents if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), sal_True, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue()); } - // Fenster-Einstellung speichern + // Save window settings if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), sal_True, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); @@ -627,7 +610,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), sal_True, &pItem)) { DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); -// pOptions->SetMetric((FieldUnit)((const SfxUInt16Item*)pItem)->GetValue()); } // HelpBalloons @@ -672,7 +654,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) sal_Bool bReset = ((const SfxBoolItem *)pItem)->GetValue(); if ( bReset ) { - DBG_ERROR( "Not implemented, may be EOL!" ); + OSL_FAIL( "Not implemented, may be EOL!" ); } } if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), sal_True, &pItem)) @@ -702,16 +684,16 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) sal_uInt16 nUndoCount = ((const SfxUInt16Item*)pItem)->GetValue(); aUndoOptions.SetUndoCount( nUndoCount ); - // um alle Undo-Manager zu erwischen: "uber alle Frames iterieren + // To catch all Undo-Managers: Iterate over all Frames for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(); pFrame; pFrame = SfxViewFrame::GetNext(*pFrame) ) { - // den Dispatcher des Frames rausholen + // Get the Dispatcher of the Frames SfxDispatcher *pDispat = pFrame->GetDispatcher(); pDispat->Flush(); - // "uber alle SfxShells auf dem Stack des Dispatchers iterieren + // Iterate over all SfxShells on the Dispatchers Stack sal_uInt16 nIdx = 0; for ( SfxShell *pSh = pDispat->GetShell(nIdx); pSh; @@ -743,51 +725,38 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); aSecurityOptions.SetExecutePlugins( ( (const SfxBoolItem *)pItem )->GetValue() ); - bResetSession = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), sal_True, &pItem)) { DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" ); aInetOptions.SetProxyType((SvtInetOptions::ProxyType)( (const SfxUInt16Item*)pItem )->GetValue()); - bResetSession = sal_True; - bProxiesModified = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), sal_True, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); aInetOptions.SetProxyHttpName( ((const SfxStringItem *)pItem)->GetValue() ); - bResetSession = sal_True; - bProxiesModified = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), sal_True, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); aInetOptions.SetProxyHttpPort( ( (const SfxInt32Item*)pItem )->GetValue() ); - bResetSession = sal_True; - bProxiesModified = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), sal_True, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); aInetOptions.SetProxyFtpName( ((const SfxStringItem *)pItem)->GetValue() ); - bResetSession = sal_True; - bProxiesModified = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), sal_True, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); aInetOptions.SetProxyFtpPort( ( (const SfxInt32Item*)pItem )->GetValue() ); - bResetSession = sal_True; - bProxiesModified = sal_True; } if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_NOPROXY, sal_True, &pItem)) { DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); aInetOptions.SetProxyNoProxy(((const SfxStringItem *)pItem)->GetValue()); - bResetSession = sal_True; - bProxiesModified = sal_True; } // Secure-Referers @@ -796,13 +765,12 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) DELETEZ(pAppData_Impl->pSecureURLs); DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected"); - const List *pList = ((SfxStringListItem*)pItem)->GetList(); - sal_uInt32 nCount = pList->Count(); + const std::vector<String> &aList = ((SfxStringListItem*)pItem)->GetList(); + sal_uInt32 nCount = aList.size(); ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs(nCount); for( sal_uInt32 nPosition=0;nPosition<nCount;++nPosition) - { - seqURLs[nPosition] = *(const String*)(pList->GetObject(nPosition)); - } + seqURLs[nPosition] = aList[nPosition]; + aSecurityOptions.SetSecureURLs( seqURLs ); } @@ -825,7 +793,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) #endif } - // geaenderte Daten speichern + // Store changed data aInetOptions.flush(); } @@ -834,7 +802,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) { SvtPathOptions aPathOptions; - // Daten werden in DocInfo und IniManager gespeichert + // Data is saved in DocInfo and IniManager const SfxPoolItem *pItem = 0; SfxItemPool &rPool = GetPool(); @@ -933,7 +901,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) //-------------------------------------------------------------------- -// alle Dokumente speichern +// Save all Documents sal_Bool SfxApplication::SaveAll_Impl(sal_Bool bPrompt, sal_Bool bAutoSave) { @@ -993,13 +961,6 @@ void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) return; -#ifdef DBG_UTIL - //::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() ); - //ByteString aTmp( "SfxEvent: "); - //aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); - //DBG_TRACE( aTmp.GetBuffer() ); -#endif - if ( bSynchron ) { #ifdef DBG_UTIL @@ -1007,7 +968,7 @@ void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron { ByteString aTmp( "SfxEvent: "); aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + OSL_TRACE( "%s", aTmp.GetBuffer() ); } #endif Broadcast(rEventHint); @@ -1020,3 +981,4 @@ void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron IMPL_OBJHINT( SfxStringHint, String ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index ea7b331b839b..08a5fc054425 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif #include <svl/whiter.hxx> #include <svl/eitem.hxx> @@ -60,17 +59,13 @@ void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, SfxChildWinFacto if (!pAppData_Impl->pFactArr) pAppData_Impl->pFactArr = new SfxChildWinFactArr_Impl; -//#ifdef DBG_UTIL for (sal_uInt16 nFactory=0; nFactory<pAppData_Impl->pFactArr->Count(); ++nFactory) { if (pFact->nId == (*pAppData_Impl->pFactArr)[nFactory]->nId) { pAppData_Impl->pFactArr->Remove( nFactory ); -// DBG_ERROR("ChildWindow mehrfach registriert!"); -// return; } } -//#endif pAppData_Impl->pFactArr->C40_INSERT( SfxChildWinFactory, pFact, pAppData_Impl->pFactArr->Count() ); @@ -83,7 +78,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 SfxChildWinFactory *pF = NULL; if ( pMod ) { - // Modul "ubergeben, ChildwindowFactory dort suchen + // Abandon Module, search there for ChildwindowFactory pFactories = pMod->GetChildWinFactories_Impl(); if ( pFactories ) { @@ -93,7 +88,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 SfxChildWinFactory *pFac = (*pFactories)[nFactory]; if ( nId == pFac->nId ) { - // Factory gefunden, Context dort registrieren + // Factory found, registrer Context here. pF = pFac; break; } @@ -103,9 +98,9 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 if ( !pF ) { - // Factory an der Application suchen - DBG_ASSERT( pAppData_Impl, "Keine AppDaten!" ); - DBG_ASSERT( pAppData_Impl->pFactArr, "Keine Factories!" ); + // Search for Factory in the Application + DBG_ASSERT( pAppData_Impl, "No AppData!" ); + DBG_ASSERT( pAppData_Impl->pFactArr, "No Factories!" ); pFactories = pAppData_Impl->pFactArr; sal_uInt16 nCount = pFactories->Count(); @@ -116,10 +111,10 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 { if ( pMod ) { - // Wenn der Context von einem Modul registriert wurde, - // mu\s die ChildwindowFactory auch dort zur Verf"ugung - // stehen, sonst m"u\ste sich die Contextfactory im DLL-Exit - // wieder abmelden ! + // If the context of a module has been registered, then the + // ChildWindowFactory must also be available there, + // else the ContextFactory would have be unsubscribed on + // DLL-exit pF = new SfxChildWinFactory( pFac->pCtor, pFac->nId, pFac->nPos ); pMod->RegisterChildWindow( pF ); @@ -139,7 +134,7 @@ void SfxApplication::RegisterChildWindowContext_Impl( SfxModule *pMod, sal_uInt1 return; } - DBG_ERROR( "Kein ChildWindow fuer diesen Context!" ); + OSL_FAIL( "No ChildWindow for this Context!" ); } //-------------------------------------------------------------------- @@ -174,3 +169,4 @@ SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) co return NULL; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index 2914c648bfe9..3838526a9eb1 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,14 +30,12 @@ #include "precompiled_sfx2.hxx" #include <tools/cachestr.hxx> #include <tools/config.hxx> -#ifndef _INETSTRM_HXX //autogen #include <svl/inetstrm.hxx> -#endif #include <svl/stritem.hxx> #define _SVSTDARR_STRINGS #include <svl/svstdarr.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/menu.hxx> #include <vcl/msgbox.hxx> @@ -152,20 +151,6 @@ SfxAppData_Impl::~SfxAppData_Impl() delete pBasMgrListener; } -void SfxAppData_Impl::UpdateApplicationSettings( sal_Bool bDontHide ) -{ - AllSettings aAllSet = Application::GetSettings(); - StyleSettings aStyleSet = aAllSet.GetStyleSettings(); - sal_uInt32 nStyleOptions = aStyleSet.GetOptions(); - if ( bDontHide ) - nStyleOptions &= ~STYLE_OPTION_HIDEDISABLED; - else - nStyleOptions |= STYLE_OPTION_HIDEDISABLED; - aStyleSet.SetOptions( nStyleOptions ); - aAllSet.SetStyleSettings( aStyleSet ); - Application::SetSettings( aAllSet ); -} - SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates() { if ( !pTemplates ) @@ -184,3 +169,5 @@ void SfxAppData_Impl::OnApplicationBasicManagerCreated( BasicManager& _rBasicMan Reference< XInterface > xCurrentComponent = SfxObjectShell::GetCurrentComponent(); _rBasicManager.SetGlobalUNOConstant( "ThisComponent", makeAny( xCurrentComponent ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 26e4fecf3864..c3fb0e9dfc92 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,8 +41,6 @@ #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> #include <unotools/pathoptions.hxx> -#ifndef GCC -#endif #include <sfx2/app.hxx> #include "appdata.hxx" @@ -78,9 +77,6 @@ public: virtual sal_Bool MakeTopic( const String& ); virtual String Topics(); -// virtual String Formats(); -// virtual String SysItems(); -// virtual String Status(); virtual sal_Bool SysTopicExecute( const String* pStr ); }; @@ -111,12 +107,6 @@ public: virtual sal_Bool Execute( const String* ); virtual sal_Bool StartAdviseLoop(); virtual sal_Bool MakeItem( const String& rItem ); - -// wird benoetigt? -// virtual void Connect( long n ); -// virtual void Disconnect( long n ); -// virtual void StopAdviseLoop(); - }; @@ -128,15 +118,14 @@ SV_IMPL_PTRARR( SfxDdeDocTopics_Impl, SfxDdeDocTopic_Impl *) sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, const String &rCmd, const String &rEvent ) -/* [Beschreibung] +/* [Description] - Pr"uft, ob 'rCmd' das Event 'rEvent' ist (ohne '(') und baut - aus diesem dann ein <ApplicationEvent> zusammen, das per - <Application::AppEvent()> ausgef"uhrt werden kann. Ist 'rCmd' das - angegegeben Event 'rEvent', dann wird TRUE zur"uckgegeben, sonst FALSE. + Checks if 'rCmd' of the event 'rEvent' is (without '(') and then assemble + this data into a <ApplicationEvent>, which can be excecuted through + <Application::AppEvent()>. If 'rCmd' is the given event 'rEvent', then + TRUE is returned, otherwise FALSE. - - [Beispiel] + [Example] rCmd = "Open(\"d:\doc\doc.sdw\")" rEvent = "Open" @@ -151,7 +140,7 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, aData.Erase( 0, aEvent.Len() ); if ( aData.Len() > 2 ) { - // in das ApplicationEvent-Format wandeln + // Transform into the ApplicationEvent Format aData.Erase( aData.Len()-1, 1 ); for ( sal_uInt16 n = 0; n < aData.Len(); ++n ) { @@ -175,31 +164,30 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, long SfxApplication::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to thier SfxApplication subclass. - Die Basisimplementierung versteht die API-Funktionalit"at der - betreffenden SfxApplication-Subklasse in BASIC-Syntax. R"uckgabewerte - k"onnen dabei leider nicht "ubertragen werden. + The base implementation understands the API functionality of the + relevant SfxApplication subclass in BASIC syntax. Return values can + not be transferred, unfortunately. */ { - // Print oder Open-Event? + // Print or Open-Event? ApplicationEvent aAppEvent; if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print") ) || SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open") ) ) GetpApp()->AppEvent( aAppEvent ); else { - // alle anderen per BASIC + // all others are BASIC StarBASIC* pBasic = GetBasic(); - ENSURE_OR_RETURN( pBasic, "where's my basic?", 0 ); + DBG_ASSERT( pBasic, "Where is the Basic???" ); SbxVariable* pRet = pBasic->Execute( rCmd ); if( !pRet ) { @@ -214,18 +202,17 @@ long SfxApplication::DdeExecute long SfxApplication::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -236,18 +223,17 @@ long SfxApplication::DdeGetData long SfxApplication::DdeSetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -258,15 +244,15 @@ long SfxApplication::DdeSetData ::sfx2::SvLinkSource* SfxApplication::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxApplication-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { @@ -277,21 +263,20 @@ long SfxApplication::DdeSetData long SfxObjectShell::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to the thier SfxApplication subclass. - Die Basisimplementierung f"uhrt nichts aus und liefert 0 zur"uck. + The base implementation does nothing and returns 0. */ { StarBASIC* pBasic = GetBasic(); - DBG_ASSERT( pBasic, "Wo ist mein Basic???" ) ; + DBG_ASSERT( pBasic, "Where is the Basic???" ) ; SbxVariable* pRet = pBasic->Execute( rCmd ); if( !pRet ) { @@ -306,18 +291,17 @@ long SfxObjectShell::DdeExecute long SfxObjectShell::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -328,18 +312,17 @@ long SfxObjectShell::DdeGetData long SfxObjectShell::DdeSetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -349,38 +332,54 @@ long SfxObjectShell::DdeSetData //-------------------------------------------------------------------- ::sfx2::SvLinkSource* SfxObjectShell::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxObjectShell-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { return 0; } +void SfxObjectShell::ReconnectDdeLink(SfxObjectShell& /*rServer*/) +{ +} + +void SfxObjectShell::ReconnectDdeLinks(SfxObjectShell& rServer) +{ + TypeId aType = TYPE(SfxObjectShell); + SfxObjectShell* p = GetFirst(&aType, false); + while (p) + { + if (&rServer != p) + p->ReconnectDdeLink(rServer); + + p = GetNext(*p, &aType, false); + } +} + //======================================================================== long SfxViewFrame::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to the thier SfxApplication subclass. - Die Basisimplementierung versteht die API-Funktionalit"at des - betreffenden SfxViewFrame, der darin dargestellten SfxViewShell und - der betreffenden SfxObjectShell-Subklasse in BASIC-Syntax. - R"uckgabewerte k"onnen dabei leider nicht "ubertragen werden. + The base implementation understands the API functionality of the + relevant SfxViewFrame, which is shown and the relevant SfxViewShell + and the relevant SfxApplication subclass in BASIC syntax. Return + values can not be transferred, unfortunately. */ { @@ -394,18 +393,17 @@ long SfxViewFrame::DdeExecute long SfxViewFrame::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -416,18 +414,17 @@ long SfxViewFrame::DdeGetData long SfxViewFrame::DdeSetData ( - const String& , // das anzusprechende Item - const String& , // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const String&, // the Item to be addressed + const String&, // in: Format + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -438,15 +435,15 @@ long SfxViewFrame::DdeSetData ::sfx2::SvLinkSource* SfxViewFrame::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxViewFrame-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { @@ -458,7 +455,7 @@ long SfxViewFrame::DdeSetData sal_Bool SfxApplication::InitializeDde() { DBG_ASSERT( !pAppData_Impl->pDdeService, - "Dde kann nicht mehrfach initialisiert werden" ); + "Dde can not be initialized multiple times" ); pAppData_Impl->pDdeService = new ImplDdeService( Application::GetAppName() ); int nError = pAppData_Impl->pDdeService->GetError(); @@ -466,10 +463,10 @@ sal_Bool SfxApplication::InitializeDde() { pAppData_Impl->pDocTopics = new SfxDdeDocTopics_Impl; - // wir wollen auf jedenfall RTF unterstuetzen! + // we certainly want to support RTF! pAppData_Impl->pDdeService->AddFormat( FORMAT_RTF ); - // Config-Pfad als Topic wegen Mehrfachstart + // Config path as a topic becauseof multiple starts INetURLObject aOfficeLockFile( SvtPathOptions().GetUserConfigPath() ); aOfficeLockFile.insertName( DEFINE_CONST_UNICODE( "soffice.lck" ) ); String aService( SfxDdeServiceName_Impl( @@ -494,20 +491,18 @@ void SfxAppData_Impl::DeInitDDE() void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) { - DBG_ASSERT( pAppData_Impl->pDocTopics, "es gibt gar keinen Dde-Service" ); - //OV: Im Serverbetrieb ist DDE abgeklemmt! + DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" ); + //OV: DDE is disconnected in server mode! if( !pAppData_Impl->pDocTopics ) return; - // doppeltes Eintragen verhindern + // prevent double submit String sShellNm; sal_Bool bFnd = sal_False; for( sal_uInt16 n = pAppData_Impl->pDocTopics->Count(); n; ) if( (*pAppData_Impl->pDocTopics)[ --n ]->pSh == pSh ) { - // JP 18.03.96 - Bug 26470 - // falls das Document unbenannt wurde, ist trotzdem ein - // neues Topics anzulegen! + // If the document is untitled, is still a new Topic is created! if( !bFnd ) { bFnd = sal_True; @@ -526,8 +521,8 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) void SfxApplication::RemoveDdeTopic( SfxObjectShell* pSh ) { - DBG_ASSERT( pAppData_Impl->pDocTopics, "es gibt gar keinen Dde-Service" ); - //OV: Im Serverbetrieb ist DDE abgeklemmt! + DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" ); + //OV: DDE is disconnected in server mode! if( !pAppData_Impl->pDocTopics ) return; @@ -554,14 +549,14 @@ DdeService* SfxApplication::GetDdeService() sal_Bool ImplDdeService::MakeTopic( const String& rNm ) { - // Workaround gegen Event nach unserem Main() unter OS/2 - // passierte wenn man beim Beenden aus dem OffMgr die App neu startet + // Workaround for Event after Main() under OS/2 + // happens when exiting starts the App again if ( !Application::IsInExecute() ) return sal_False; - // das Topic rNm wird gesucht, haben wir es ? - // erstmal nur ueber die ObjectShells laufen und die mit dem - // Namen heraussuchen: + // The Topic rNm is sought, do we have it? + // First only loop over the ObjectShells to find those + // with the specific name: sal_Bool bRet = sal_False; String sNm( rNm ); sNm.ToLowerAscii(); @@ -571,7 +566,7 @@ sal_Bool ImplDdeService::MakeTopic( const String& rNm ) { String sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); sTmp.ToLowerAscii(); - if( sTmp == sNm ) // die wollen wir haben + if( sTmp == sNm ) { SFX_APP()->AddDdeTopic( pShell ); bRet = sal_True; @@ -587,9 +582,7 @@ sal_Bool ImplDdeService::MakeTopic( const String& rNm ) if ( aWorkPath.GetNewAbsURL( rNm, &aFile ) && SfxContentHelper::IsDocument( aFile.GetMainURL( INetURLObject::NO_DECODE ) ) ) { - // File vorhanden - - // dann versuche die Datei zu laden: + // File exists? then try to load it: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, sal_True); @@ -698,7 +691,7 @@ sal_Bool SfxDdeDocTopic_Impl::StartAdviseLoop() ::sfx2::SvLinkSource* pNewObj = pSh->DdeCreateLinkSource( GetCurItem() ); if( pNewObj ) { - // dann richten wir auch einen entsprechenden SvBaseLink ein + // then we also establish a corresponding SvBaseLink String sNm, sTmp( Application::GetAppName() ); ::sfx2::MakeLnkName( sNm, &sTmp, pSh->GetTitle(SFX_TITLE_FULLNAME), GetCurItem() ); new ::sfx2::SvBaseLink( sNm, OBJECT_DDE_EXTERN, pNewObj ); @@ -707,3 +700,4 @@ sal_Bool SfxDdeDocTopic_Impl::StartAdviseLoop() return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index ba23e04cad12..4f4f3a1ebe6a 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,23 +40,17 @@ #include <unotools/saveopt.hxx> #include <unotools/localisationoptions.hxx> #include <tools/config.hxx> -#ifndef _SV_RESARY_HXX #include <tools/resary.hxx> -#endif #include <tools/urlobj.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <svtools/ehdl.hxx> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <unotools/configmgr.hxx> #include <rtl/ustrbuf.hxx> -#include <vos/security.hxx> +#include <osl/security.hxx> #include <ucbhelper/configurationkeys.hxx> #include <unotools/pathoptions.hxx> #include <unotools/historyoptions.hxx> @@ -118,22 +113,23 @@ void SAL_CALL SfxTerminateListener_Impl::disposing( const EventObject& ) throw( void SAL_CALL SfxTerminateListener_Impl::queryTermination( const EventObject& ) throw(TerminationVetoException, RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !SFX_APP()->QueryExit_Impl() ) throw TerminationVetoException(); } void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& aEvent ) throw(RuntimeException ) { - static ::rtl::OUString SERVICE_GLOBALEVENTBROADCASTER = ::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster"); - static ::rtl::OUString EVENT_QUIT_APP = ::rtl::OUString::createFromAscii("OnCloseApp"); + static ::rtl::OUString SERVICE_GLOBALEVENTBROADCASTER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster")); + static ::rtl::OUString EVENT_QUIT_APP (RTL_CONSTASCII_USTRINGPARAM("OnCloseApp")); Reference< XDesktop > xDesktop( aEvent.Source, UNO_QUERY ); if( xDesktop.is() == sal_True ) xDesktop->removeTerminateListener( this ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - utl::ConfigManager::GetConfigManager()->StoreConfigItems(); + SolarMutexGuard aGuard; + utl::ConfigManager::GetConfigManager().StoreConfigItems(); + SfxApplication* pApp = SFX_APP(); pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) ); pApp->Get_Impl()->pAppDispatch->ReleaseAll(); @@ -148,14 +144,13 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a xGlobalBroadcaster->notifyEvent(aEvent2); } - //pApp->Deinitialize(); delete pApp; Application::Quit(); } ::rtl::OUString SAL_CALL SfxTerminateListener_Impl::getImplementationName() throw (RuntimeException) { - static const ::rtl::OUString IMPLNAME = ::rtl::OUString::createFromAscii("com.sun.star.comp.sfx2.SfxTerminateListener"); + static const ::rtl::OUString IMPLNAME(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sfx2.SfxTerminateListener")); return IMPLNAME; } @@ -182,7 +177,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxTerminateListener_Impl::getSupportedServ // The desktop must know, which listener will terminate the SfxApplication in real ! // It must call this special listener as last one ... otherwise we shutdown the SfxApplication BEFORE other listener // can react ... - static const ::rtl::OUString SERVICENAME = ::rtl::OUString::createFromAscii("com.sun.star.frame.TerminateListener"); + static const ::rtl::OUString SERVICENAME(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.TerminateListener")); Sequence< ::rtl::OUString > lNames(1); lNames[0] = SERVICENAME; return lNames; @@ -207,7 +202,7 @@ String GetSpecialCharsForEdit(Window* pParent, const Font& rFont) static bool bDetermineFunction = false; static PFunc_getSpecialCharsForEdit pfunc_getSpecialCharsForEdit = 0; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !bDetermineFunction ) { bDetermineFunction = true; @@ -258,20 +253,20 @@ bool SfxApplication::Initialize_Impl() #ifdef DBG_UTIL - // Der SimplerErrorHandler dient Debugzwecken. In der Product werden - // nichtgehandelte Fehler durch Errorcode 1 an SFX gegeben. - new SimpleErrorHandler; + // The SimplerErrorHandler is for debugging. In the Product errors + // not processed are given to SFX as Errorcode 1. + pAppData_Impl->m_pSimpleErrorHdl = new SimpleErrorHandler; #endif + pAppData_Impl->m_pToolsErrorHdl = new SfxErrorHandler( + RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1); + pAppData_Impl->pBasicResMgr = CreateResManager("sb"); pAppData_Impl->pSvtResMgr = CreateResManager("svt"); - new SfxErrorHandler( RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1 ); - new SfxErrorHandler( RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr ); - new SfxErrorHandler( RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr ); - - // diverse Pointer - SfxPickList::GetOrCreate( SvtHistoryOptions().GetSize( ePICKLIST ) ); - ///////////////////////////////////////////////////////////////// + pAppData_Impl->m_pSoErrorHdl = new SfxErrorHandler( + RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr ); + pAppData_Impl->m_pSbxErrorHdl = new SfxErrorHandler( + RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr ); DBG_ASSERT( !pAppData_Impl->pAppDispat, "AppDispatcher already exists" ); pAppData_Impl->pAppDispat = new SfxDispatcher((SfxDispatcher*)0); @@ -305,10 +300,12 @@ bool SfxApplication::Initialize_Impl() pAppData_Impl->pAppDispat->DoActivate_Impl( sal_True, NULL ); { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // Set special characters callback on vcl edit control Edit::SetGetSpecialCharsFunction(&GetSpecialCharsForEdit); } return sal_True; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx index 64c6673bbafb..00ec4e88ecdd 100644 --- a/sfx2/source/appl/appmain.cxx +++ b/sfx2/source/appl/appmain.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -//#define TF_NEWDESKTOP - #define _SDINTERN_HXX #include <stdio.h> @@ -40,7 +39,6 @@ #include <svl/itempool.hxx> #include <svl/urihelper.hxx> #include <svtools/helpopt.hxx> -#include <vos/process.hxx> #include <framework/sfxhelperfunctions.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -85,7 +83,7 @@ DBG_NAME(SfxAppMainCHAOSReg) //=================================================================== #ifdef TF_POOLABLE -static SfxItemInfo __READONLY_DATA aItemInfos[] = +static SfxItemInfo const aItemInfos[] = { { 0, 0 } }; @@ -100,18 +98,19 @@ void SfxApplication::Init ( ) -/* [Beschreibung] +/* [Description] + + This virtual method is called from SFx through Application::Main(), + before Execute() is called and: + - the Intro is already displayed, + - the Applications window exists, but it is still hidden, + - the Bindings already exist (Controller can be registered), + - the Init and Config-Manager already exists, + - the Standard-Controller already exists, + - the SFx-Shells have alredy registered their Interfaces. - 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. + [Cross-reference] - [Querverweise] <SfxApplication::Exit()> <SfxApplication::OpenClients()> */ @@ -122,17 +121,17 @@ void SfxApplication::Init void SfxApplication::Exit() -/* [Beschreibung] +/* [Description] - 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 + This virtual method is called from SFx through Application::Main(), + after Execute() has finished and + - the configuration (SfxConfigManager) was already saved, + - the window postions etc. in the SfxIniManager were written, + - the Application widow still exists, but is hidden + - all Documents and their Views already are closed. + - Dispatcher, Bindings etc. already destroyed. - [Querverweise] + [Cross-reference] <SfxApplication::Init(int,char*[])> */ @@ -161,3 +160,5 @@ SfxFilterMatcher& SfxApplication::GetFilterMatcher() } return *pAppData_Impl->pMatcher; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index eafe9d262189..eb0a10016d33 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,8 +30,6 @@ #include "precompiled_sfx2.hxx" #include <vcl/status.hxx> #include <vcl/msgbox.hxx> -#include <vos/process.hxx> -#include <vos/xception.hxx> #include <svl/whiter.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> @@ -46,7 +45,7 @@ #include <com/sun/star/uno/Reference.h> #include <tools/config.hxx> #include <tools/rcid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <unotools/configmgr.hxx> #include <com/sun/star/frame/XDesktop.hpp> #include <unotools/ucbstreamhelper.hxx> @@ -86,7 +85,6 @@ #include <sfx2/objface.hxx> #include "helper.hxx" // SfxContentHelper::Kill() -using namespace ::vos; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::beans; @@ -156,13 +154,12 @@ SFX_IMPL_INTERFACE(SfxApplication,SfxShell,SfxResId(RID_DESKTOP)) //-------------------------------------------------------------------- SfxProgress* SfxApplication::GetProgress() const -/* [Beschreibung] +/* [Description] - Liefert den f"ur die gesamte Applikation laufenden SfxProgress - oder 0, falls keiner f"ur die gesamte Applikation l"auft. + Returns the running SfxProgress for the entire application or 0 if + none is running for the entire application. - - [Querverweise] + [Cross-reference] <SfxProgress::GetActiveProgress(SfxViewFrame*)> <SfxViewFrame::GetProgress()const> @@ -180,7 +177,7 @@ SvUShorts* SfxApplication::GetDisabledSlotList_Impl() SvUShorts* pList = pAppData_Impl->pDisabledSlotList; if ( !pList ) { - // Gibt es eine Slotdatei ? + // Is there a slot file? INetURLObject aUserObj( SvtPathOptions().GetUserConfigPath() ); aUserObj.insertName( DEFINE_CONST_UNICODE( "slots.cfg" ) ); SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aUserObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READ ); @@ -196,7 +193,7 @@ SvUShorts* SfxApplication::GetDisabledSlotList_Impl() sal_Bool bSlots = ( pStream && !pStream->GetError() ); if( bSlots && bSlotsEnabled ) { - // SlotDatei einlesen + // Read Slot file String aTitle; pStream->ReadByteString(aTitle); if ( aTitle.CompareToAscii("SfxSlotFile" ) == COMPARE_EQUAL ) @@ -216,21 +213,20 @@ SvUShorts* SfxApplication::GetDisabledSlotList_Impl() pStream->ReadByteString(aTitle); if ( aTitle.CompareToAscii("END" ) != COMPARE_EQUAL || pStream->GetError() ) { - // Lesen schief gegangen + // Read failed DELETEZ( pList ); bError = sal_True; } } else { - // Streamerkennung fehlgeschlagen + // Stream detection failure bError = sal_True; } } else if ( bSlots != bSlotsEnabled ) { - // Wenn kein Slotlist-Eintrag, dann darf auch keine SlotDatei - // vorhanden sein + // If no slot list entry, then no slot file shall exist bError = sal_True; } @@ -246,9 +242,9 @@ SvUShorts* SfxApplication::GetDisabledSlotList_Impl() if ( bError ) { - // Wenn ein Sloteintrag vorhanden ist, aber keine oder eine fehlerhafte - // SlotDatei, oder aber eine Slotdatei, aber kein Sloteintrag, dann - // gilt dies als fehlerhafte Konfiguration + // If an entry slot is present, but no or faulty slot file, or a slot + // file, but no slot entry, then this is considered to be a + // misconfiguration new SfxSpecialConfigError_Impl( String( SfxResId( RID_SPECIALCONFIG_ERROR ) ) ); } @@ -265,7 +261,7 @@ SfxModule* SfxApplication::GetModule_Impl() return pModule; else { - DBG_ERROR( "No module!" ); + OSL_FAIL( "No module!" ); return NULL; } } @@ -285,8 +281,6 @@ SfxResourceManager& SfxApplication::GetResourceManager() const { return *pAppDat sal_Bool SfxApplication::IsDowning() const { return pAppData_Impl->bDowning; } SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->pAppDispat; } SfxSlotPool& SfxApplication::GetAppSlotPool_Impl() const { return *pAppData_Impl->pSlotPool; } -//SfxOptions& SfxApplication::GetOptions() { return *pAppData_Impl->pOptions; } -//const SfxOptions& SfxApplication::GetOptions() const { return *pAppData_Impl->pOptions; } static bool impl_loadBitmap( const rtl::OUString &rPath, const rtl::OUString &rBmpFileName, @@ -302,8 +296,8 @@ static bool impl_loadBitmap( // Use graphic class to also support more graphic formats (bmp,png,...) Graphic aGraphic; - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); - pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); + rGF.ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); // Default case, we load the intro bitmap from a seperate file // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) @@ -325,7 +319,7 @@ Image SfxApplication::GetApplicationLogo() do { bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")), aAbouts.getToken( 0, ',', nIndex ), aAppLogo ); } while ( !bLoaded && ( nIndex >= 0 ) ); @@ -334,25 +328,26 @@ Image SfxApplication::GetApplicationLogo() if ( !bLoaded ) { bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/edition")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("about.png")), aAppLogo ); if ( !bLoaded ) bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/edition")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("about.bmp")), aAppLogo ); } if ( !bLoaded ) { bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("about.png")), aAppLogo ); if ( !bLoaded ) bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("about.bmp")), aAppLogo ); } return aAppLogo; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 8b76024c1afb..c644e5dcb30f 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,7 +81,7 @@ #include <comphelper/docpasswordhelper.hxx> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <rtl/logfile.hxx> @@ -152,45 +153,45 @@ void SAL_CALL SfxOpenDocStatusListener_Impl::disposing( const EventObject& ) thr SfxObjectShellRef SfxApplication::DocAlreadyLoaded ( - const String& rName, // Name des Dokuments mit Pfad - sal_Bool bSilent, // sal_True: nicht nach neuer Sicht fragen - sal_Bool bActivate, // soll bestehende Sicht aktiviert werden + const String& rName, // Name of Documents including path + sal_Bool bSilent, // sal_True: do not ask for a new view + sal_Bool bActivate, // existing view to be activated sal_Bool bForbidVisible, const String* pPostStr ) -/* [Beschreibung] +/* [Description] - Stellt fest, ob ein Dokument mit dem Namen 'rName' bereits geladen - ist und liefert einen Pointer darauf zu"uck. + Determines whether a document with the name 'rName' already is loaded and + returns a pointer to this document. - Ist das Dokument noch nicht geladen, wird ein 0-Pointer zur"uckgeliefert. + If the document is not loaded, a 0-pointer is returned. */ { - // zu suchenden Namen als URL aufbereiten + // prepare to search for names as URL INetURLObject aUrlToFind( rName ); DBG_ASSERT( aUrlToFind.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL" ); String aPostString; if ( pPostStr ) aPostString = *pPostStr; - // noch offen? + // still open? SfxObjectShellRef xDoc; if ( !aUrlToFind.HasError() ) { - // dann bei den normal geoeffneten Docs + // then with the normally open Documents if ( !xDoc.Is() ) { - xDoc = SfxObjectShell::GetFirst( 0, sal_False ); // auch hidden Docs + xDoc = SfxObjectShell::GetFirst( 0, sal_False ); // also hidden Documents while( xDoc.Is() ) { if ( xDoc->GetMedium() && xDoc->GetCreateMode() == SFX_CREATE_MODE_STANDARD && !xDoc->IsAbortingImport() && !xDoc->IsLoading() ) { - // Vergleiche anhand der URLs + // Comparisons between URLs INetURLObject aUrl( xDoc->GetMedium()->GetName() ); if ( !aUrl.HasError() && aUrl == aUrlToFind && (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, sal_True )) && @@ -204,11 +205,10 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded } } - // gefunden? + // Found? if ( xDoc.Is() && bActivate ) { - DBG_ASSERT( - !bForbidVisible, "Unsichtbares kann nicht aktiviert werden" ); + DBG_ASSERT(!bForbidVisible, "Invisible can not be enabled" ); SfxViewFrame* pFrame; for( pFrame = SfxViewFrame::GetFirst( xDoc ); @@ -301,19 +301,17 @@ private: sal_uInt32 CheckPasswd_Impl ( - //Window *pWin, // Parent des Dialogs SfxObjectShell* pDoc, - SfxItemPool& /*rPool*/, // Pool, falls ein Set erzeugt werden mus - SfxMedium* pFile // das Medium, dessen Passwort gfs. erfragt werden soll + SfxItemPool& /*rPool*/, // Pool, if a Set has to be created + SfxMedium* pFile // the Medium and its Password shold be obtained ) -/* [Beschreibung] +/* [Description] - 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. + Ask for the password for a medium, only works if it concerns storage. + If the password flag is set in the Document Info, then the password is + requested through a user dialogue and the set at the Set of the medium. + If the set does not exist the it is created. */ { sal_uIntPtr nRet = ERRCODE_NONE; @@ -328,16 +326,13 @@ sal_uInt32 CheckPasswd_Impl { sal_Bool bIsEncrypted = sal_False; try { - xStorageProps->getPropertyValue( ::rtl::OUString::createFromAscii("HasEncryptedEntries") ) + xStorageProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HasEncryptedEntries")) ) >>= bIsEncrypted; } catch( uno::Exception& ) { // TODO/LATER: // the storage either has no encrypted elements or it's just // does not allow to detect it, probably it should be implemented laiter - /* - bIsEncrypted = ( aInfo.Load( xStorage ) && aInfo.IsPasswd() ); - */ } if ( bIsEncrypted ) @@ -398,7 +393,7 @@ sal_uInt32 CheckPasswd_Impl } else { - OSL_ENSURE( sal_False, "A storage must implement XPropertySet interface!" ); + OSL_FAIL( "A storage must implement XPropertySet interface!" ); nRet = ERRCODE_SFX_CANTGETPASSWD; } } @@ -491,8 +486,6 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String xDoc->GetStorage()->copyToStorage( xTempStorage ); -//REMOVE // the following operations should be done in one step -//REMOVE xDoc->DoHandsOff(); if ( !xDoc->DoSaveCompleted( new SfxMedium( xTempStorage, String() ) ) ) throw uno::RuntimeException(); } @@ -521,7 +514,6 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String SfxItemSet* pNew = xDoc->GetMedium()->GetItemSet()->Clone(); pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); pNew->ClearItem( SID_FILTER_NAME ); - //pNew->Put( SfxStringItem( SID_FILTER_NAME, xDoc->GetFactory().GetFilter(0)->GetFilterName() ) ); ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; TransformItems( SID_OPENDOC, *pNew, aArgs ); sal_Int32 nLength = aArgs.getLength(); @@ -576,7 +568,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); - // keine Parameter vom BASIC nur Factory angegeben? + // No Parameter from BASIC only Factory given? SFX_REQUEST_ARG(rReq, pTemplNameItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False); SFX_REQUEST_ARG(rReq, pTemplFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False); SFX_REQUEST_ARG(rReq, pTemplRegionNameItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, sal_False); @@ -584,7 +576,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) SfxObjectShellLock xDoc; String aTemplateRegion, aTemplateName, aTemplateFileName; - sal_Bool bDirect = sal_False; // "uber FileName anstelle Region/Template + sal_Bool bDirect = sal_False; // through FileName instead of Region/Template SfxErrorContext aEc(ERRCTX_SFX_NEWDOC); if ( !pTemplNameItem && !pTemplFileNameItem ) { @@ -680,6 +672,29 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) //--------------------------------------------------------------------------- +namespace { + +/** + * Check if a given filter type should open the hyperlinked document + * natively. + * + * @param rFilter filter object + */ +bool lcl_isFilterNativelySupported(const SfxFilter& rFilter) +{ + if (rFilter.IsOwnFormat()) + return true; + + ::rtl::OUString aName = rFilter.GetFilterName(); + if (aName.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Excel"))) == 0) + // We can handle all Excel variants natively. + return true; + + return false; +} + +} + void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -797,8 +812,8 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) rReq.RemoveItem( SID_FILE_NAME ); rReq.AppendItem( SfxStringItem( SID_FILE_NAME, aURL ) ); - // synchron ausf"uhren, damit beim Reschedulen nicht schon das n"achste Dokument - // geladen wird + // Run synchronous, so that not the next document is loaded + // when rescheduling // TODO/LATER: use URLList argument and always remove one document after another, each step in asychronous execution, until finished // but only if reschedule is a problem GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, *rReq.GetArgs() ); @@ -830,13 +845,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) delete pURLList; } - if ( !rReq.IsSynchronCall() ) - { - // now check wether a stream is already there - // if not: download it in a thread and restart the call - // return; - } - sal_Bool bHyperlinkUsed = sal_False; if ( SID_OPENURL == nSID ) @@ -910,13 +918,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) rReq.AppendItem( SfxBoolItem( SID_PREVIEW, sal_True ) ); } - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0053 ) ) // S = 53h - { - // not supported anymore - //rReq.RemoveItem( SID_SILENT ); - //rReq.AppendItem( SfxBoolItem( SID_SILENT, sal_True ) ); - } - rReq.RemoveItem( SID_OPTIONS ); } @@ -925,7 +926,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))), UNO_QUERY ); if ( xTypeDetection.is() ) { @@ -934,49 +935,16 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) aURL.Complete = aFileName; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aURL ); INetProtocol aINetProtocol = INetURLObject( aURL.Complete ).GetProtocol(); SvtExtendedSecurityOptions aExtendedSecurityOptions; SvtExtendedSecurityOptions::OpenHyperlinkMode eMode = aExtendedSecurityOptions.GetOpenHyperlinkMode(); - if ( eMode == SvtExtendedSecurityOptions::OPEN_WITHSECURITYCHECK ) - { - if ( aINetProtocol == INET_PROT_FILE ) - { -/*!!! pb: #i49802# no security warning any longer - // Check if file URL is a directory. This is not insecure! - osl::Directory aDir( aURL.Main ); - sal_Bool bIsDir = ( aDir.open() == osl::Directory::E_None ); - - if ( !bIsDir && !aExtendedSecurityOptions.IsSecureHyperlink( aURL.Complete ) ) - { - // Security check for local files depending on the extension - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window *pWindow = SFX_APP()->GetTopWindow(); - - String aSecurityWarningBoxTitle( SfxResId( RID_SECURITY_WARNING_TITLE )); - WarningBox aSecurityWarningBox( pWindow, SfxResId( RID_SECURITY_WARNING_HYPERLINK )); - aSecurityWarningBox.SetText( aSecurityWarningBoxTitle ); - // Replace %s with the real file name - String aMsgText = aSecurityWarningBox.GetMessText(); - String aMainURL( aURL.Main ); - String aFileName; - - utl::LocalFileHelper::ConvertURLToPhysicalName( aMainURL, aFileName ); - aMsgText.SearchAndReplaceAscii( "%s", aFileName ); - aSecurityWarningBox.SetMessText( aMsgText ); - - if( aSecurityWarningBox.Execute() == RET_NO ) - return; - } -*/ - } - } - else if ( eMode == SvtExtendedSecurityOptions::OPEN_NEVER && aINetProtocol != INET_PROT_VND_SUN_STAR_HELP ) + if ( eMode == SvtExtendedSecurityOptions::OPEN_NEVER && aINetProtocol != INET_PROT_VND_SUN_STAR_HELP ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pWindow = SFX_APP()->GetTopWindow(); String aSecurityWarningBoxTitle( SfxResId( RID_SECURITY_WARNING_TITLE )); @@ -989,11 +957,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) aTypeName = xTypeDetection->queryTypeByURL( aURL.Main ); SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); const SfxFilter* pFilter = rMatcher.GetFilter4EA( aTypeName ); - if ( !pFilter || !( pFilter->IsOwnFormat() )) + if (!pFilter || !lcl_isFilterNativelySupported(*pFilter)) { // hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS Reference< XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), UNO_QUERY ); if ( xSystemShellExecute.is() ) { if ( aINetProtocol == INET_PROT_MAILTO ) @@ -1014,13 +982,13 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } catch ( ::com::sun::star::lang::IllegalArgumentException& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pWindow = SFX_APP()->GetTopWindow(); ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); } catch ( ::com::sun::star::system::SystemShellExecuteException& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pWindow = SFX_APP()->GetTopWindow(); ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); } @@ -1033,14 +1001,14 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) Sequence < ::rtl::OUString > aProtocols(2); // add special protocols that always should be treated as internal - aProtocols[0] = ::rtl::OUString::createFromAscii("private:*"); - aProtocols[1] = ::rtl::OUString::createFromAscii("vnd.sun.star.*"); + aProtocols[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:*")); + aProtocols[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.*")); try { // get registered protocol handlers from configuration Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.ProtocolHandler/HandlerSet"), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.ProtocolHandler/HandlerSet")), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); if ( xAccess.is() ) { Sequence < ::rtl::OUString > aNames = xAccess->getElementNames(); @@ -1052,7 +1020,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( xSet.is() ) { // copy protocols - aRet = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("Protocols") ); + aRet = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Protocols")) ); Sequence < ::rtl::OUString > aTmp; aRet >>= aTmp; @@ -1097,7 +1065,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } catch ( ::com::sun::star::lang::IllegalArgumentException& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pWindow = SFX_APP()->GetTopWindow(); ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); } @@ -1105,7 +1073,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( !pFilter ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pWindow = SFX_APP()->GetTopWindow(); ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); } @@ -1189,7 +1157,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if (!pInteractionItem) { - Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY ); + Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler"))), UNO_QUERY ); if (xHdl.is()) rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) ); } @@ -1218,8 +1186,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } Reference < XController > xController; -// if ( ( !bIsBlankTarget && pFrame ) || pLinkItem || !rReq.IsSynchronCall() ) -// { // if a frame is given, it must be used for the starting point of the targetting mechanism // this code is also used if asynchronous loading is possible, because loadComponent always is synchron if ( !xTargetFrame.is() ) @@ -1230,7 +1196,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } else { - xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY ); } } @@ -1256,15 +1222,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { // if loading must be done synchron, we must wait for completion to get a return value // find frame by myself; I must konw the exact frame to get the controller for the return value from it - //if( aTarget.getLength() ) - // xTargetFrame = xTargetFrame->findFrame( aTarget, FrameSearchFlag::ALL ); Reference < XComponent > xComp; try { xComp = ::comphelper::SynchronousDispatch::dispatch( xTargetFrame, aFileName, aTarget, 0, aArgs ); -// Reference < XComponentLoader > xLoader( xTargetFrame, UNO_QUERY ); -// xComp = xLoader->loadComponentFromURL( aFileName, aTarget, 0, aArgs ); } catch(const RuntimeException&) { @@ -1285,7 +1247,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { URL aURL; aURL.Complete = aFileName; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aURL ); Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY ); @@ -1294,37 +1256,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( xDisp.is() ) xDisp->dispatch( aURL, aArgs ); } - /* - } - else - { - // synchron loading without a given frame or as blank frame - SFX_REQUEST_ARG( rReq, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); - - // Desktop service must exists! dont catch() or check for problems here ... - // But loading of documents can fail by other reasons. Handle it more gracefully. - Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); - Reference < XComponent > xComp; - try - { - xComp = xDesktop->loadComponentFromURL( pFileNameItem->GetValue(), aTarget, 0, aArgs ); - } - catch(const RuntimeException&) - { - throw; - } - catch(const ::com::sun::star::uno::Exception&) - { - xDesktop.clear(); - xComp.clear(); - } - - Reference < XModel > xModel( xComp, UNO_QUERY ); - if ( xModel.is() ) - xController = xModel->getCurrentController(); - else - xController = Reference < XController >( xComp, UNO_QUERY ); - }*/ if ( xController.is() ) { @@ -1358,3 +1289,5 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) delete pLinkItem; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index 1a62f48a7a24..c8f3cb7c11d8 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,17 +32,12 @@ #include <basic/sbstar.hxx> #include <svl/svdde.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <svl/eitem.hxx> #include <unotools/saveopt.hxx> #include <unotools/misccfg.hxx> -#ifndef GCC -#endif - #include "app.hrc" #include <sfx2/app.hxx> #include <sfx2/evntconf.hxx> @@ -76,13 +72,13 @@ sal_Bool SfxApplication::QueryExit_Impl() { sal_Bool bQuit = sal_True; - // will trotzdem noch jemand, den man nicht abschiessen kann, die App haben? + // Does some instance, that can not be shut down, still require the app? if ( !bQuit ) { - // nicht wirklich beenden, nur minimieren + // Not really exit, only minimize InfoBox aInfoBox( NULL, SfxResId(MSG_CANT_QUIT) ); aInfoBox.Execute(); - DBG_TRACE( "QueryExit => FALSE (in use)" ); + OSL_TRACE( "QueryExit => sal_False (in use)" ); return sal_False; } @@ -98,14 +94,14 @@ void SfxApplication::Deinitialize() StarBASIC::Stop(); - // ggf. BASIC speichern + // Save BASIC if possible BasicManager* pBasMgr = BasicManagerRepository::getApplicationBasicManager( false ); if ( pBasMgr && pBasMgr->IsModified() ) SaveBasicManager(); SaveBasicAndDialogContainer(); - pAppData_Impl->bDowning = sal_True; // wegen Timer aus DecAliveCount und QueryExit + pAppData_Impl->bDowning = sal_True; // due to Timer from DecAliveCount and QueryExit DELETEZ( pAppData_Impl->pTemplates ); @@ -113,8 +109,6 @@ void SfxApplication::Deinitialize() // this method. Therefore this call makes no sense and is the source of // some stack traces, which we don't understand. // For more information see: - // #123501# - //SetViewFrame(0); pAppData_Impl->bDowning = sal_False; DBG_ASSERT( !SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute" ); @@ -128,8 +122,8 @@ void SfxApplication::Deinitialize() // call derived application-exit Exit(); - // Controller u."a. freigeben - // dabei sollten auch restliche Komponenten ( Beamer! ) verschwinden + // Release Controller and others + // then the remaining components should alse disapear ( Beamer! ) BasicManagerRepository::resetApplicationBasicManager(); pAppData_Impl->pBasicManager->reset( NULL ); // this will also delete pBasMgr @@ -143,7 +137,7 @@ void SfxApplication::Deinitialize() SfxResId::DeleteResMgr(); DELETEZ(pAppData_Impl->pOfaResMgr); - // ab hier d"urfen keine SvObjects mehr existieren + // from here no SvObjects have to exists DELETEZ(pAppData_Impl->pMatcher); DELETEX(pAppData_Impl->pSlotPool); @@ -159,14 +153,18 @@ void SfxApplication::Deinitialize() //TODO/CLEANTUP //ReleaseArgs could be used instead! -/* This leak is intended ! - Otherwise the TestTool cant use .uno:QuitApp ... - because every destructed ItemSet work's on an already - released pool pointer .-) - - NoChaos::ReleaseItemPool(); -*/ pAppData_Impl->pPool = NULL; + NoChaos::ReleaseItemPool(); + DELETEZ(pAppData_Impl->pBasicResMgr); DELETEZ(pAppData_Impl->pSvtResMgr); + + delete pAppData_Impl->m_pSbxErrorHdl; + delete pAppData_Impl->m_pSoErrorHdl; + delete pAppData_Impl->m_pToolsErrorHdl; +#ifdef DBG_UTIL + delete pAppData_Impl->m_pSimpleErrorHdl; +#endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index dfecc21f9d4b..743c783471a3 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,6 @@ #include <vcl/toolbox.hxx> -#ifndef GCC -#endif - #include <sfx2/app.hxx> #include "appdata.hxx" #include "arrdecl.hxx" @@ -94,7 +92,7 @@ void SfxApplication::RegisterToolBoxControl_Impl( SfxModule *pMod, SfxTbxCtrlFac if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("TbxController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("TbxController registration is not clearly defined!"); } } #endif @@ -119,7 +117,7 @@ void SfxApplication::RegisterStatusBarControl_Impl( SfxModule *pMod, SfxStbCtrlF if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("StbController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("StbController registration is not clearly defined!"); } } #endif @@ -144,10 +142,12 @@ void SfxApplication::RegisterMenuControl_Impl( SfxModule *pMod, SfxMenuCtrlFacto if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("MenuController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("MenuController register is not clearly defined!"); } } #endif pAppData_Impl->pMenuCtrlFac->C40_INSERT( SfxMenuCtrlFactory, pFact, pAppData_Impl->pMenuCtrlFac->Count() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 3e9629149d2a..e3c7fd09be5c 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,6 +48,8 @@ #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/SystemShellExecuteException.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> + #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> #include "comphelper/configurationhelper.hxx" @@ -70,15 +73,16 @@ #include <vcl/help.hxx> #include <vcl/stdtext.hxx> #include <rtl/ustrbuf.hxx> +#include <osl/file.hxx> #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/regoptions.hxx> #include <svtools/helpopt.hxx> +#include <svtools/miscopt.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/shl.hxx> #include <unotools/bootstrap.hxx> -#include <vos/process.hxx> #include <rtl/bootstrap.hxx> #include <cppuhelper/exc_hlp.hxx> #include <rtl/ustrbuf.hxx> @@ -151,10 +155,49 @@ long QuitAgain_Impl( void* pObj, void* pArg ) return 0; } +/// Find the correct location of the document (LICENSE.odt, etc.), and return +/// it in rURL if found. +static sal_Bool checkURL( const char *pName, const char *pExt, rtl::OUString &rURL ) +{ + using namespace osl; + DirectoryItem aDirItem; + + rURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/") ); + rURL += rtl::OUString::createFromAscii( pName ); + rURL += rtl::OUString::createFromAscii( pExt ); + rtl::Bootstrap::expandMacros( rURL ); + + if (rURL.getLength() != 0) + return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None; + else + return sal_False; +} + +/// Displays CREDITS or LICENSE in any of the available version +static void showDocument( const char* pBaseName ) +{ + try { + Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY ); + Sequence < com::sun::star::beans::PropertyValue > args(2); + args[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ViewOnly")); + args[0].Value <<= sal_True; + args[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); + args[1].Value <<= sal_True; + + rtl::OUString aURL; + if ( checkURL ( pBaseName, ".odt", aURL ) || + checkURL ( pBaseName, ".html", aURL ) || + checkURL ( pBaseName, "", aURL ) ) { + xLoader->loadComponentFromURL( aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, args ); + } + } catch (const ::com::sun::star::uno::Exception &) { + } +} + void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); - bool bDone = sal_False; + bool bDone = false; switch ( rReq.GetSlot() ) { case SID_SETOPTIONS: @@ -206,7 +249,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if this dialog is closed by the user ... So we ignore this request now and wait for a new user decision. */ - DBG_TRACE1( "QueryExit => FALSE (DispatchLevel == %u)", Application::GetDispatchLevel() ); + OSL_TRACE( "QueryExit => sal_False (DispatchLevel == %u)", Application::GetDispatchLevel() ); return; } @@ -222,7 +265,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) // if terminate() was successful, SfxApplication is now dead! pAppData_Impl->bInQuit = sal_False; - // Returnwert setzten, ggf. terminieren + // Set return value, terminate if possible rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) ); return; } @@ -266,7 +309,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) const short nRet = pDlg->Execute(); if ( nRet ) - bDone = sal_True; + bDone = true; delete pDlg; } @@ -305,14 +348,13 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) sal_Bool bOk = ( n == 0); rReq.SetReturnValue( SfxBoolItem( 0, bOk ) ); - bDone = sal_True; + bDone = true; break; } case SID_SAVEDOCS: { sal_Bool bOK = sal_True; - sal_Bool bTmpDone = sal_True; for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst(); pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) ) @@ -322,7 +364,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { pObjSh->ExecuteSlot( aReq ); SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, aReq.GetReturnValue() ); - bTmpDone = aReq.IsDone(); if ( !pItem || !pItem->GetValue() ) bOK = sal_False; } @@ -333,26 +374,62 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) break; } + case SID_SHOW_LICENSE: + { + ModalDialog aDialog( NULL, SfxResId( DLG_HELP_LICENSING ) ); + + String aLicensing; + for ( int i = STR_LICENSING_INFORMATION_1; i <= STR_LICENSING_INFORMATION_5; ++i ) + { + if ( i != STR_LICENSING_INFORMATION_1 ) + aLicensing += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n" ) ); + aLicensing += String( SfxResId( i ) ); + } + + FixedText aText( &aDialog ); + aText.SetText( aLicensing ); + OKButton aShow( &aDialog, SfxResId( PB_LICENSING_SHOW ) ); + CancelButton aClose( &aDialog, SfxResId( PB_LICENSING_CLOSE ) ); + + // positions and sizes are computed to always fit the language + Size aTextSize( aText.GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aShowSize( aShow.GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aCloseSize( aClose.GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + + long nDelimX = 12; + long nDelimY = 12; + long nWidth = aTextSize.Width() + 2*nDelimX; + long nButtonY = aTextSize.Height() + 2*nDelimY; + Size aButtonSize( std::max( aShowSize.Width(), aCloseSize.Width() ) + nDelimX, + std::max( aShowSize.Height(), aCloseSize.Height() ) ); + + aDialog.SetSizePixel( Size( nWidth, aTextSize.Height() + 3*nDelimY + aButtonSize.Height() ) ); + aText.SetPosSizePixel( Point( nDelimX, nDelimY ), aTextSize ); + aShow.SetPosSizePixel( Point( ( nWidth - nDelimX ) / 2 - aButtonSize.Width(), nButtonY ), aButtonSize ); + aClose.SetPosSizePixel( Point( aShow.GetPosPixel().X() + aButtonSize.Width() + nDelimX, nButtonY ), aButtonSize ); + + aText.Show(); + + if ( aDialog.Execute() == RET_OK ) + showDocument( "LICENSE" ); + + break; + } + + case SID_SHOW_CREDITS: + { + showDocument( "CREDITS" ); + break; + } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_HELPINDEX: - case SID_HELP_SUPPORTPAGE: { Help* pHelp = Application::GetHelp(); if ( pHelp ) { - if ( rReq.GetSlot() == SID_HELP_SUPPORTPAGE ) - { - // show Support page with new URL - String sHelpURL = SfxHelp::CreateHelpURL( String::CreateFromAscii(".uno:HelpSupport"), String() ); - String sParams = sHelpURL.Copy( sHelpURL.Search( '?' ) ); - sHelpURL = String::CreateFromAscii("vnd.sun.star.help://shared/text/shared/05/00000001.xhp"); - sHelpURL += sParams; - sHelpURL += String::CreateFromAscii("&UseDB=no"); - pHelp->Start( sHelpURL, NULL ); - } - else - pHelp->Start( String::CreateFromAscii(".uno:HelpIndex"), NULL ); // show start page - bDone = sal_True; + pHelp->Start( String::CreateFromAscii(".uno:HelpIndex"), NULL ); // show start page + bDone = true; } break; } @@ -360,22 +437,21 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_HELPTIPS: { - // Parameter aus werten + // Evaluate Parameter SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, sal_False); bool bOn = pOnItem ? ((SfxBoolItem*)pOnItem)->GetValue() : !Help::IsQuickHelpEnabled(); - // ausf"uhren if ( bOn ) Help::EnableQuickHelp(); else Help::DisableQuickHelp(); SvtHelpOptions().SetHelpTips( bOn ); Invalidate(SID_HELPTIPS); - bDone = sal_True; + bDone = true; - // ggf. recorden + // Record if possible if ( !rReq.IsAPI() ) rReq.AppendItem( SfxBoolItem( SID_HELPTIPS, bOn) ); break; @@ -388,22 +464,21 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } case SID_HELPBALLOONS: { - // Parameter auswerten + // Evaluate Parameter SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, sal_False); bool bOn = pOnItem ? ((SfxBoolItem*)pOnItem)->GetValue() : !Help::IsBalloonHelpEnabled(); - // ausf"uhren if ( bOn ) Help::EnableBalloonHelp(); else Help::DisableBalloonHelp(); SvtHelpOptions().SetExtendedHelp( bOn ); Invalidate(SID_HELPBALLOONS); - bDone = sal_True; + bDone = true; - // ggf. recorden + // Record if possible if ( !rReq.IsAPI() ) rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS, bOn) ); break; @@ -419,7 +494,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) : !aHelpOpt.IsHelpAgentAutoStartMode(); aHelpOpt.SetHelpAgentAutoStartMode( bOn ); Invalidate(SID_HELP_PI); - bDone = sal_True; + bDone = true; break; } @@ -432,7 +507,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) VclAbstractDialog* pDlg = pFact->CreateVclDialog( 0, RID_DEFAULTABOUT ); pDlg->Execute(); delete pDlg; - bDone = sal_True; + bDone = true; } break; } @@ -444,7 +519,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) new SfxTemplateOrganizeDlg(NULL); pDlg->Execute(); delete pDlg; - bDone = sal_True; + bDone = true; break; } @@ -452,7 +527,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessServiceFactory()); aDialog.Execute(); - bDone = sal_True; + bDone = true; break; } @@ -525,7 +600,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) rtl::OUStringBuffer aBuf( aToolbarResName ); aBuf.append( pToolbarName->GetValue() ); - // Parameter auswerten + // Evaluate Parameter rtl::OUString aToolbarName( aBuf.makeStringAndClear() ); sal_Bool bShow( !xLayoutManager->isElementVisible( aToolbarName )); @@ -559,7 +634,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); + DBG_ASSERT(pRanges && *pRanges, "Set without range"); while ( *pRanges ) { for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) @@ -580,6 +655,18 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) break; } + case SID_CONFIG: + case SID_TOOLBOXOPTIONS: + case SID_CONFIGSTATUSBAR: + case SID_CONFIGMENU: + case SID_CONFIGACCEL: + case SID_CONFIGEVENT: + { + if( SvtMiscOptions().DisableUICustomization() ) + rSet.DisableItem(nWhich); + break; + } + case SID_BASICSTOP: if ( !StarBASIC::IsRunning() ) rSet.DisableItem(nWhich); @@ -656,7 +743,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) static const ::rtl::OUString& getProductRegistrationServiceName( ) { - static ::rtl::OUString s_sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.setup.ProductRegistration" ); + static ::rtl::OUString s_sServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.setup.ProductRegistration")); return s_sServiceName; } @@ -770,7 +857,7 @@ namespace { Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); ::rtl::OUString sModule = xCheck->identify( xFrame ); - if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) + if ( sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.frame.StartModule" ) ) ) return xFrame; } catch( const UnknownModuleException& ) @@ -841,11 +928,17 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { VclAbstractDialog* pDlg = pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL ); - pDlg->Execute(); + short nRet = pDlg->Execute(); delete pDlg; SfxViewFrame* pView = SfxViewFrame::GetFirst(); while ( pView ) { + if (nRet == RET_OK) + { + SfxObjectShell* pObjSh = pView->GetObjectShell(); + if (pObjSh) + pObjSh->SetConfigOptionsChecked(false); + } pView->GetBindings().InvalidateAll(sal_False); pView = SfxViewFrame::GetNext( *pView ); } @@ -866,9 +959,9 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) // read repository URL from configuration ::rtl::OUString sTemplRepoURL = getConfigurationStringValue( - ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"), - ::rtl::OUString::createFromAscii("Dictionaries"), - ::rtl::OUString::createFromAscii("RepositoryURL"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dictionaries")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepositoryURL")), ::rtl::OUString()); if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 ) @@ -879,10 +972,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) // read locale from configuration ::rtl::OUString sLocale = getConfigurationStringValue( - ::rtl::OUString::createFromAscii("org.openoffice.Setup"), - ::rtl::OUString::createFromAscii("L10N"), - ::rtl::OUString::createFromAscii("ooLocale"), - ::rtl::OUString::createFromAscii("en-US")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooLocale")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"))); aURLBuf.append( sLocale ); xSystemShell->execute( @@ -912,12 +1005,12 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) // tell it that the user wants to register if ( xProductRegistration.is() ) { - xProductRegistration->trigger( ::rtl::OUString::createFromAscii( "RegistrationRequired" ) ); + xProductRegistration->trigger( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RegistrationRequired")) ); } } catch( const ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" ); + OSL_FAIL( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" ); } } break; @@ -1152,13 +1245,13 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); Reference< com::sun::star::frame::XDispatchProvider > xProv( - xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY ); + xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ModuleDispatcher"))), UNO_QUERY ); if ( xProv.is() ) { ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); Reference< com::sun::star::frame::XDispatchHelper > xHelper( - xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); + xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper"))), UNO_QUERY ); if ( xHelper.is() ) { Sequence < com::sun::star::beans::PropertyValue > aSeq; @@ -1182,13 +1275,13 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { Reference< com::sun::star::lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); Reference< com::sun::star::frame::XDispatchProvider > xProv( - xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.text.ModuleDispatcher")), UNO_QUERY ); + xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ModuleDispatcher"))), UNO_QUERY ); if ( xProv.is() ) { ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); Reference< com::sun::star::frame::XDispatchHelper > xHelper( - xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); + xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper"))), UNO_QUERY ); if ( xHelper.is() ) { Sequence < com::sun::star::beans::PropertyValue > aSeq; @@ -1240,7 +1333,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) void SfxApplication::OfaState_Impl(SfxItemSet &rSet) { const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); + DBG_ASSERT(pRanges && *pRanges, "Set without Region"); while ( *pRanges ) { for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) @@ -1270,3 +1363,5 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet) if ( !aModuleOpt.IsImpress() ) rSet.DisableItem( SID_SD_AUTOPILOT ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 9ffb48e1b34a..193834d44ed5 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,7 +136,6 @@ using namespace ::com::sun::star::io; #include <ownsubfilterservice.hxx> #include "SfxDocumentMetaData.hxx" -#define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" static char const sTemplateRegionName[] = "TemplateRegionName"; @@ -145,6 +145,7 @@ static char const sOpenNewView[] = "OpenNewView"; static char const sViewId[] = "ViewId"; static char const sPluginMode[] = "PluginMode"; static char const sReadOnly[] = "ReadOnly"; +static char const sDdeReconnect[] = "DDEReconnect"; static char const sStartPresentation[] = "StartPresentation"; static char const sFrameName[] = "FrameName"; static char const sMediaType[] = "MediaType"; @@ -219,7 +220,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque #ifdef DBG_UTIL ByteString aStr( "No creator method for item: "); aStr += ByteString::CreateFromInt32( nSlotId ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); #endif return; } @@ -243,7 +244,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ByteString aStr( "Property not convertable: "); aStr += pSlot->pUnoName; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif } @@ -253,7 +254,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque // for a simple property there can be only one parameter and its name *must* match ByteString aStr( "Property name does not match: "); aStr += ByteString( aName, RTL_TEXTENCODING_UTF8 ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif else @@ -296,7 +297,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ByteString aDbgStr( "Property not convertable: "); aDbgStr += pSlot->pUnoName; - DBG_ERROR( aDbgStr.GetBuffer() ); + OSL_FAIL( aDbgStr.GetBuffer() ); } #endif break; @@ -309,7 +310,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque // there was a parameter with a name that didn't match to any of the members ByteString aStr( "Property name does not match: "); aStr += ByteString( String(rPropValue.Name), RTL_TEXTENCODING_UTF8 ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif } @@ -337,7 +338,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque #ifdef DBG_UTIL ByteString aStr( "No creator method for argument: "); aStr += rArg.pName; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); #endif return; } @@ -367,7 +368,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ByteString aStr( "Property not convertable: "); aStr += rArg.pName; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif break; @@ -396,7 +397,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ByteString aStr( "Property not convertable: "); aStr += rArg.pName; - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif } @@ -435,7 +436,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque #ifdef DBG_UTIL ByteString aDbgStr( "Property not convertable: "); aDbgStr += rArg.pName; - DBG_ERROR( aDbgStr.GetBuffer() ); + OSL_FAIL( aDbgStr.GetBuffer() ); #endif } @@ -608,6 +609,14 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDdeReconnect)) ) + { + sal_Bool bVal = sal_True; + sal_Bool bOK = (rProp.Value >>= bVal); + DBG_ASSERT( bOK, "invalid type for DDEReconnect" ); + if (bOK) + rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) ); + } else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) ) { sal_Bool bVal = sal_False; @@ -875,7 +884,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque #endif } } - // --> PB 2007-12-09 #i83757# + // API to raise options dialog with a specified options ab page (#i83757#) else { // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog" @@ -897,7 +906,6 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque } } } - // <-- #ifdef DB_UTIL if ( nFoundArgs == nCount ) { @@ -953,7 +961,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta // we will not rely on the "toggle" ability of some property slots ByteString aStr( "Processing property slot without argument: "); aStr += ByteString::CreateFromInt32( nSlotId ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif @@ -1027,6 +1035,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET ) + nAdditional++; if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET ) @@ -1266,13 +1276,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta sal_uInt16 nSubCount = pType->nAttribs; if ( !nSubCount ) { - //rPool.FillVariable( *pItem, *pVar, eUserMetric ); pValue[nActProp].Name = String( String::CreateFromAscii( pSlot->pUnoName ) ) ; if ( !pItem->QueryValue( pValue[nActProp].Value ) ) { ByteString aStr( "Item not convertable: "); aStr += ByteString::CreateFromInt32(nSlotId); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } } else @@ -1280,7 +1289,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta // complex type, add a property value for every member of the struct for ( sal_uInt16 n=1; n<=nSubCount; ++n ) { - //rPool.FillVariable( *pItem, *pVar, eUserMetric ); sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID; if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; @@ -1296,7 +1304,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta aStr += ByteString::CreateFromInt32( pType->aAttrib[n-1].nAID ); aStr += " not convertable in slot: "; aStr += ByteString::CreateFromInt32(nSlotId); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } } } @@ -1317,13 +1325,12 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta sal_uInt16 nSubCount = rArg.pType->nAttribs; if ( !nSubCount ) { - //rPool.FillVariable( *pItem, *pVar, eUserMetric ); pValue[nActProp].Name = String( String::CreateFromAscii( rArg.pName ) ) ; if ( !pItem->QueryValue( pValue[nActProp++].Value ) ) { ByteString aStr( "Item not convertable: "); aStr += ByteString::CreateFromInt32(rArg.nSlotId); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } } else @@ -1331,7 +1338,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta // complex type, add a property value for every member of the struct for ( sal_uInt16 n = 1; n <= nSubCount; ++n ) { - //rPool.FillVariable( rItem, *pVar, eUserMetric ); sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID; if ( bConvertTwips ) nSubId |= CONVERT_TWIPS; @@ -1347,7 +1353,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta aStr += ByteString::CreateFromInt32( rArg.pType->aAttrib[n-1].nAID ); aStr += " not convertable in slot: "; aStr += ByteString::CreateFromInt32(rArg.nSlotId); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } } } @@ -1423,13 +1429,13 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); if ( pItem->ISA( SfxUsrAnyItem ) ) { - OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); + OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); } else if ( pItem->ISA( SfxUnoFrameItem ) ) pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); else - OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" ); + OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { @@ -1456,6 +1462,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } + if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDdeReconnect)); + pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); + } if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation)); @@ -1688,7 +1699,7 @@ void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star:: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_uInt32 nPropertyCount = lArgs.getLength(); ::rtl::OUString aReferer; @@ -1733,7 +1744,7 @@ void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL& const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_uInt32 nPropertyCount = lArgs.getLength(); ::rtl::OUString aReferer; @@ -1980,7 +1991,7 @@ throw( RuntimeException ) Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; std::list< sal_Int16 > aGroupList; SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl(); @@ -2015,7 +2026,7 @@ throw (::com::sun::star::uno::RuntimeException) { std::list< ::com::sun::star::frame::DispatchInformation > aCmdList; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl(); if ( pAppSlotPool ) @@ -2159,7 +2170,6 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory( //============================================================================= // Add new macro line to handle new service. - // // !!! ATTENTION !!! // Write no ";" at end of line and dont forget "else" ! (see macro) //============================================================================= @@ -2177,13 +2187,6 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory( IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler ) #endif IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator ) - #if 0 - if ( ::sfx2::AppletObject::impl_getStaticImplementationName().equals( - ::rtl::OUString::createFromAscii( pImplementationName ) ) ) - { - xFactory = ::sfx2::AppletObject::impl_createFactory(); - } - #endif IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject ) IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject ) IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService ) @@ -2195,6 +2198,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory( ::comp_SfxDocumentMetaData::_getImplementationName(), ::comp_SfxDocumentMetaData::_getSupportedServiceNames()); } + if ( ::comp_CompatWriterDocProps::_getImplementationName().equals( + ::rtl::OUString::createFromAscii( pImplementationName ) ) ) + { + xFactory = ::cppu::createSingleComponentFactory( + ::comp_CompatWriterDocProps::_create, + ::comp_CompatWriterDocProps::_getImplementationName(), + ::comp_CompatWriterDocProps::_getSupportedServiceNames()); + } + + // Factory is valid - service was found. // Factory is valid - service was found. if ( xFactory.is() ) @@ -2396,3 +2409,4 @@ com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > N return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 2af0e9c179e2..3ce4d0ee5a00 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,21 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _TOOLBOX_HXX //autogen #include <vcl/toolbox.hxx> -#endif -#ifndef _RCID_H #include <tools/rcid.h> -#endif #include <unotools/viewoptions.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <cppuhelper/implbase1.hxx> -#ifndef GCC -#endif - #include <sfx2/childwin.hxx> #include <sfx2/app.hxx> #include "arrdecl.hxx" @@ -219,8 +213,8 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, SfxChildWinFactory* pFact=0; sal_uInt16 nOldMode = Application::GetSystemWindowMode(); - // Zuerst ChildWindow im SDT suchen; "Uberlagerungen m"ussen mit einem - // ChildWindowContext realisiert werden + // First search for ChildWindow in SDT; "Overloading has to be realized + // by using ChildWindowContext SfxApplication *pApp = SFX_APP(); { SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl(); @@ -282,12 +276,12 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, if ( pChild ) pChild->SetFactory_Impl( pFact ); - DBG_ASSERT(pFact && (pChild || !rInfo.bVisible), "ChildWindow-Typ nicht registriert!"); + DBG_ASSERT(pFact && (pChild || !rInfo.bVisible), "ChildWindow-Typ not registered!"); if ( pChild && !pChild->pWindow ) { DELETEZ(pChild); - DBG_WARNING("ChildWindow hat kein Fenster!"); + DBG_WARNING("ChildWindow has no Window!"); } return pChild; @@ -311,8 +305,6 @@ void SfxChildWindow::SaveStatus(const SfxChildWinInfo& rInfo) } SvtViewOptions aWinOpt( E_WINDOW, String::CreateFromInt32( nID ) ); - // aWinOpt.SetPosition( rInfo.aPos.X(), rInfo.aPos.Y() ); - // aWinOpt.SetSize( rInfo.aSize.Width(), rInfo.aSize.Height() ); aWinOpt.SetWindowState( String( rInfo.aWinState, RTL_TEXTENCODING_UTF8 ) ); ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); @@ -378,43 +370,6 @@ sal_uInt16 SfxChildWindow::GetPosition() return pImp->pFact->nPos; } -#if 0 -static void ImplWindowStateFromStr( Point rPos, Size rSize, const ByteString& rStr ) -{ - sal_uIntPtr nValidMask = 0; - xub_StrLen nIndex = 0; - ByteString aTokenStr; - - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) - { - rPos.X() = aTokenStr.ToInt32(); - nValidMask |= WINDOWSTATE_MASK_X; - } - - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) - { - rPos.Y() = aTokenStr.ToInt32(); - nValidMask |= WINDOWSTATE_MASK_Y; - } - - aTokenStr = rStr.GetToken( 0, ',', nIndex ); - if ( aTokenStr.Len() ) - { - rSize.Width() = aTokenStr.ToInt32(); - nValidMask |= WINDOWSTATE_MASK_WIDTH; - } - - aTokenStr = rStr.GetToken( 0, ';', nIndex ); - if ( aTokenStr.Len() ) - { - rSize.Height() = aTokenStr.ToInt32(); - nValidMask |= WINDOWSTATE_MASK_HEIGHT; - } -} -#endif - //------------------------------------------------------------------------- void SfxChildWindow::InitializeChildWinFactory_Impl( sal_uInt16 nId, SfxChildWinInfo& rInfo ) { @@ -433,19 +388,18 @@ void SfxChildWindow::InitializeChildWinFactory_Impl( sal_uInt16 nId, SfxChildWin String aWinData( aTmp ); rInfo.aWinState = ByteString( String(aWinOpt.GetWindowState()), RTL_TEXTENCODING_UTF8 ); - //ImplWindowStateFromStr( rInfo.aPos, rInfo.aSize, ByteString( aWinState, RTL_TEXTENCODING_UTF8 ) ); if ( aWinData.Len() ) { - // Nach Versionskennung suchen + // Search for version ID if ( aWinData.GetChar((sal_uInt16)0) != 0x0056 ) // 'V' = 56h - // Keine Versionskennung, daher nicht verwenden + // A version ID, so do not use return; - // 'V' l"oschen + // Delete 'V' aWinData.Erase(0,1); - // Version lesen + // Read version char cToken = ','; sal_uInt16 nPos = aWinData.Search( cToken ); sal_uInt16 nActVersion = (sal_uInt16)aWinData.Copy( 0, nPos + 1 ).ToInt32(); @@ -454,10 +408,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl( sal_uInt16 nId, SfxChildWin aWinData.Erase(0,nPos+1); - //aWinOpt.GetPosition( rInfo.aPos.X(), rInfo.aPos.Y() ); - //aWinOpt.GetSize( rInfo.aSize.Width(), rInfo.aSize.Height() ); - - // Sichtbarkeit laden: ist als ein char codiert + // Load Visibility: is coded as a char rInfo.bVisible = (aWinData.GetChar(0) == 0x0056); // 'V' = 56h aWinData.Erase(0,1); nPos = aWinData.Search( cToken ); @@ -466,7 +417,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl( sal_uInt16 nId, SfxChildWin sal_uInt16 nNextPos = aWinData.Search( cToken, 2 ); if ( nNextPos != STRING_NOTFOUND ) { - // es gibt noch Extra-Information + // there is extra information rInfo.nFlags = (sal_uInt16)aWinData.Copy( nPos+1, nNextPos - nPos - 1 ).ToInt32(); aWinData.Erase( nPos, nNextPos-nPos+1 ); rInfo.aExtraString = aWinData; @@ -495,7 +446,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding pFact = rFactories[nFactory]; if ( pFact->nId == GetType() ) { - DBG_ASSERT( pFact->pArr, "Kein Kontext angemeldet!" ); + DBG_ASSERT( pFact->pArr, "No context registered!" ); if ( !pFact->pArr ) break; @@ -527,7 +478,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding pFact = rFactories[nFactory]; if ( pFact->nId == GetType() ) { - DBG_ASSERT( pFact->pArr, "Kein Kontext angemeldet!" ); + DBG_ASSERT( pFact->pArr, "No context registered!" ); if ( !pFact->pArr ) break; @@ -552,7 +503,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding if ( !pCon ) { - DBG_ERROR( "Kein geeigneter Context gefunden!" ); + OSL_FAIL( "No suitable context found! "); return; } @@ -587,7 +538,7 @@ FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const } else { - DBG_ERROR("Kein FloatingWindow-Context!"); + OSL_FAIL("No FloatingWindow-Context!"); return NULL; } } @@ -661,7 +612,7 @@ sal_Bool SfxChildWinInfo::GetExtraData_Impl sal_uInt16 *pPos ) const { - // ung"ultig? + // invalid? if ( !aExtraString.Len() ) return sal_False; String aStr; @@ -669,8 +620,8 @@ sal_Bool SfxChildWinInfo::GetExtraData_Impl if ( nPos == STRING_NOTFOUND ) return sal_False; - // Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn - // er nicht vorhanden ist, liegt eine "altere Version vor + // Try to read the alignment string "ALIGN :(...)", but if + // it is not present, then use an older version if ( nPos != STRING_NOTFOUND ) { sal_uInt16 n1 = aExtraString.Search('(', nPos); @@ -679,20 +630,20 @@ sal_Bool SfxChildWinInfo::GetExtraData_Impl sal_uInt16 n2 = aExtraString.Search(')', n1); if ( n2 != STRING_NOTFOUND ) { - // Alignment-String herausschneiden + // Cut out Alignment string aStr = aExtraString.Copy(nPos, n2 - nPos + 1); aStr.Erase(nPos, n1-nPos+1); } } } - // Zuerst das Alignment extrahieren + // First extract the Alignment if ( !aStr.Len() ) return sal_False; if ( pAlign ) *pAlign = (SfxChildAlignment) (sal_uInt16) aStr.ToInt32(); - // Dann das LastAlignment + // then the LastAlignment nPos = aStr.Search(','); if ( nPos == STRING_NOTFOUND ) return sal_False; @@ -700,10 +651,10 @@ sal_Bool SfxChildWinInfo::GetExtraData_Impl if ( pLastAlign ) *pLastAlign = (SfxChildAlignment) (sal_uInt16) aStr.ToInt32(); - // Dann die Splitting-Informationen + // Then the splitting information nPos = aStr.Search(','); if ( nPos == STRING_NOTFOUND ) - // Dockt nicht in einem Splitwindow + // No docking in a Splitwindow return sal_True; aStr.Erase(0, nPos+1); Point aChildPos; @@ -747,8 +698,6 @@ void SfxChildWindow::Hide() } } - - void SfxChildWindow::Show( sal_uInt16 nFlags ) { switch ( pWindow->GetType() ) @@ -777,20 +726,14 @@ void SfxChildWindow::SetWorkWindow_Impl( SfxWorkWindow* pWin ) pImp->pWorkWin->SetActiveChild_Impl( pWindow ); } -//SfxWorkWindow* SfxChildWindow::GetWorkWindow_Impl() const -//{ -// return pImp->pWorkWin; -//} - void SfxChildWindow::Activate_Impl() { - if(pImp->pWorkWin!=NULL) //@#60568# + if(pImp->pWorkWin!=NULL) pImp->pWorkWin->SetActiveChild_Impl( pWindow ); } void SfxChildWindow::Deactivate_Impl() { -// pImp->pWorkWin->SetActiveChild_Impl( NULL ); } sal_Bool SfxChildWindow::QueryClose() @@ -853,3 +796,4 @@ void SfxChildWindow::RegisterChildWindow(SfxModule* pMod, SfxChildWinFactory* pF SFX_APP()->RegisterChildWindow_Impl( pMod, pFact ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/dde.hrc b/sfx2/source/appl/dde.hrc index d3e178606809..d3e178606809 100644..100755 --- a/sfx2/source/appl/dde.hrc +++ b/sfx2/source/appl/dde.hrc diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index a2b29344f52c..95d32df52f1a 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -109,9 +110,9 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, case FILETYPE_TEXT: if( FORMAT_FILE == nFmt ) { - // das Medium muss in der Applikation geoffnet werden, um die - // relativen Datei Links aufzuloesen!!!! Wird ueber den - // LinkManager und damit von dessen Storage erledigt. + // The media in the application must be opened to lookup the + // relative file links!! This is done through the link manager + // of the Storage. rData <<= rtl::OUString( sFileNm ); } break; @@ -126,20 +127,15 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, { Graphic aGrf; - //JP 15.07.98: Bug 52959 - // falls das Nativformat doch erwuenscht ist, muss am - // Ende das Flag zurueckgesetzt werden. -// wird einzig und allein im sw/ndgrf.cxx benutzt, wenn der Link vom -// GraphicNode entfernt wird. + // If the native format is reqested, has to be reset at the + // end of the flag. Is solely in the sw/ndgrf.cxx used when + // the link is removed form GraphicNode. sal_Bool bOldNativFormat = bNativFormat; -//!!?? bNativFormat = 0 != (ASPECT_ICON & pSvData->GetAspect()); - // falls gedruckt werden soll, warten wir bis die - // Daten vorhanden sind + // If about to print, waiting for the data to be available if( bGetSynchron ) { - // testhalber mal ein LoadFile rufen um das nach- - // laden ueberahaupt anzustossen + // call a LoadFile every second time to test the loading if( !xMed.Is() ) LoadFile_Impl(); @@ -155,13 +151,10 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, } if( pDownLoadData || - ( !bWaitForData && ( xMed.Is() || // wurde als URL geladen + ( !bWaitForData && ( xMed.Is() || // was loaded as URL ( bSynchron && LoadFile_Impl() && xMed.Is() ) )) ) { - // falls - - // falls es uebers Internet gesogen wurde, nicht - // wieder versuchen + // If it was loaded from the Internet, do not retry if( !bGetSynchron ) bLoadAgain = !xMed->IsRemote(); bLoadError = !GetGraphic_Impl( aGrf, xMed->GetInStream() ); @@ -196,7 +189,7 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, break; default: - if( aGrf.GetGDIMetaFile().GetActionCount() ) + if( aGrf.GetGDIMetaFile().GetActionSize() ) { GDIMetaFile aMeta( aGrf.GetGDIMetaFile() ); aMeta.Write( aMemStm ); @@ -207,7 +200,7 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, bNativFormat = bOldNativFormat; - // alles fertig? + // Everything ready? if( xMed.Is() && !bSynchron && bClearMedium ) { xMed.Clear(); @@ -224,16 +217,12 @@ sal_Bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData, return sal_True/*0 != aTypeList.Count()*/; } - - - sal_Bool SvFileObject::Connect( sfx2::SvBaseLink* pLink ) { if( !pLink || !pLink->GetLinkManager() ) return sal_False; - // teste doch mal, ob nicht ein anderer Link mit der gleichen - // Verbindung schon existiert + // Test if not another link of the same connection already exists pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sFileNm, 0, &sFilter ); if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) @@ -271,26 +260,24 @@ sal_Bool SvFileObject::Connect( sfx2::SvBaseLink* pLink ) SetUpdateTimeout( 0 ); - // und jetzt bei diesem oder gefundenem Pseudo-Object anmelden + // and now register by this or other found Pseudo-Object AddDataAdvise( pLink, SotExchange::GetFormatMimeType( pLink->GetContentType()), 0 ); return sal_True; } - sal_Bool SvFileObject::LoadFile_Impl() { - // wir sind noch im Laden!! + // We are still at Loading!! if( bWaitForData || !bLoadAgain || xMed.Is() || pDownLoadData ) return sal_False; - // z.Z. nur auf die aktuelle DocShell + // at the moment on the current DocShell xMed = new SfxMedium( sFileNm, STREAM_STD_READ, sal_True ); SvLinkSource::StreamToLoadFrom aStreamToLoadFrom = getStreamToLoadFrom(); xMed->setStreamToLoadFrom( aStreamToLoadFrom.m_xInputStreamToLoadFrom, aStreamToLoadFrom.m_bIsReadOnly); - // setStreamToLoadFrom(0,0); if( sReferer.Len() ) xMed->SetReferer( sReferer ); @@ -307,7 +294,7 @@ sal_Bool SvFileObject::LoadFile_Impl() bClearMedium = !xMed.Is(); if( bClearMedium ) - xMed = xTmpMed; // falls gleich im DownLoad schon schluss ist + xMed = xTmpMed; // If already finished in DownLoad return bDataReady; } @@ -317,7 +304,7 @@ sal_Bool SvFileObject::LoadFile_Impl() bLoadAgain = !xMed->IsRemote(); bWaitForData = sal_False; - // Grafik ist fertig, also DataChanged von der Statusaederung schicken: + // Graphic is finished, also send DataChanged of the Status change: SendStateChg_Impl( xMed->GetInStream() && xMed->GetInStream()->GetError() ? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK ); return sal_True; @@ -326,32 +313,32 @@ sal_Bool SvFileObject::LoadFile_Impl() sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); - const sal_uInt16 nFilter = sFilter.Len() && pGF->GetImportFormatCount() - ? pGF->GetImportFormatNumber( sFilter ) + const sal_uInt16 nFilter = sFilter.Len() && rGF.GetImportFormatCount() + ? rGF.GetImportFormatNumber( sFilter ) : GRFILTER_FORMAT_DONTKNOW; String aEmptyStr; int nRes; - // vermeiden, dass ein native Link angelegt wird + // To avoid that a native link is created if( ( !pStream || !pDownLoadData ) && !rGrf.IsLink() && !rGrf.GetContext() && !bNativFormat ) rGrf.SetLink( GfxLink() ); if( !pStream ) nRes = xMed.Is() ? GRFILTER_OPENERROR - : pGF->ImportGraphic( rGrf, INetURLObject(sFileNm), + : rGF.ImportGraphic( rGrf, INetURLObject(sFileNm), nFilter ); else if( !pDownLoadData ) { pStream->Seek( STREAM_SEEK_TO_BEGIN ); - nRes = pGF->ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter ); + nRes = rGF.ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter ); } else { - nRes = pGF->ImportGraphic( pDownLoadData->aGrf, aEmptyStr, + nRes = rGF.ImportGraphic( pDownLoadData->aGrf, aEmptyStr, *pStream, nFilter ); if( pDownLoadData ) @@ -364,14 +351,13 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) if( !pDownLoadData->aGrf.GetContext() ) { xMed->SetDataAvailableLink( Link() ); -// xMed->SetDoneLink( Link() ); delete pDownLoadData, pDownLoadData = 0; bDataReady = sal_True; bWaitForData = sal_False; } else if( sal_False ) { - // Timer aufsetzen, um zurueck zukehren + // Set up Timer, to return back pDownLoadData->aTimer.Start(); } } @@ -385,14 +371,14 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) { if( xMed.Is() && !pStream ) { - DBG_WARNING3( "GrafikFehler [%d] - [%s] URL[%s]", + DBG_WARNING3( "Graphic error [%d] - [%s] URL[%s]", nRes, xMed->GetPhysicalName().GetBuffer(), sFileNm.GetBuffer() ); } else { - DBG_WARNING2( "GrafikFehler [%d] - [%s]", + DBG_WARNING2( "Graphic error [%d] - [%s]", nRes, sFileNm.GetBuffer() ); } } @@ -418,7 +404,7 @@ String impl_getFilter( const String& _rURL ) { css::uno::Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection") ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ), css::uno::UNO_QUERY ); if ( xTypeDetection.is() ) { @@ -435,7 +421,7 @@ String impl_getFilter( const String& _rURL ) { ::comphelper::SequenceAsHashMap lTypeProps( xTypeCont->getByName( sType ) ); sFilter = lTypeProps.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredFilter")), ::rtl::OUString() ); } } } @@ -459,7 +445,7 @@ void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& r { case OBJECT_CLIENT_GRF: { - nType = FILETYPE_GRF; // falls noch nicht gesetzt + nType = FILETYPE_GRF; // If not set already SvxOpenGraphicDialog aDlg(SfxResId(RID_SVXSTR_EDITGRFLINK)); aDlg.EnableLink(sal_False); @@ -518,19 +504,18 @@ void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& r IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG ) { - // wenn wir von hier kommen, kann es kein Fehler mehr sein + // When we come form here there it can not be an error no more. pThis->bLoadError = sal_False; pThis->bWaitForData = sal_False; pThis->bInCallDownLoad = sal_False; if( !pThis->bInNewData && !pThis->bDataReady ) { - // Grafik ist fertig, also DataChanged von der Status- - // aederung schicken: + // Graphic is finished, also send DataChanged from Status change pThis->bDataReady = sal_True; pThis->SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_OK ); - // und dann nochmal die Daten senden + // and then send the data again pThis->NotifyDataChanged(); } @@ -563,7 +548,7 @@ IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed ) IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG ) { - // wenn wir von hier kommen, kann es kein Fehler mehr sein + // When we come form here there it can not be an error no more. if( pThis->bInNewData ) return 0; @@ -574,13 +559,11 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG ) { pThis->pDownLoadData = new Impl_DownLoadData( STATIC_LINK( pThis, SvFileObject, LoadGrfNewData_Impl ) ); - - // Null-Link setzen, damit keine temporaeren Grafiken - // rausgeswapt werden; der Filter prueft, ob schon - // ein Link gesetzt ist => falls dies zutrifft, wird - // _kein_ neuer Link gesetzt; der Link muss hier gesetzt werden, - // (bevor das erste Mal gefiltert wird), um zu verhindern, - // dass der Kontext zurueckgesetzt wird (aynchrones Laden) + // Set Zero-link, so that no temporary graphics can be swapped out, + // the filter checks whether a link is set already => if so, is _no_ + // new link set, the link here must be set (before it is first + // filtered), to prevent, that the context will be reset + // (aynchronous loading) if( !pThis->bNativFormat ) { static GfxLink aDummyLink; @@ -596,7 +579,7 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG ) if( ERRCODE_IO_PENDING == pStrm->GetError() ) pStrm->ResetError(); - // im DataChanged ein DataReady? + // a DataReady in DataChanged? else if( pThis->bWaitForData && pThis->pDownLoadData ) { pThis->bLoadError = sal_True; @@ -605,8 +588,7 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG ) if( pThis->bDataReady ) { - // Grafik ist fertig, also DataChanged von der Status- - // aederung schicken: + // Graphic is finished, also send DataChanged from Status change pThis->SendStateChg_Impl( pStrm->GetError() ? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK ); } @@ -640,14 +622,14 @@ IMPL_LINK( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) return 0; } -/* [Beschreibung] +/* [Description] + + The method determines whether the data-object can be read from a DDE. - Die Methode stellt fest, ob aus einem DDE-Object die Daten gelesen - werden kann. - Zurueckgegeben wird: - ERRCODE_NONE wenn sie komplett gelesen wurde - ERRCODE_SO_PENDING wenn sie noch nicht komplett gelesen wurde - ERRCODE_SO_FALSE sonst + The following can be returned: + ERRCODE_NONE if it has been completely read + ERRCODE_SO_PENDING if it has not been completely read + ERRCODE_SO_FALSE otherwise */ sal_Bool SvFileObject::IsPending() const { @@ -680,10 +662,10 @@ sal_Bool SvFileObject::IsDataComplete() const void SvFileObject::CancelTransfers() { - // und aus dem Cache austragen, wenn man mitten im Laden ist + // unsubscribe from the cache if in the middle of loading if( !bDataReady ) { - // nicht noch mal aufsetzen + // Do not set-up again bLoadAgain = sal_False; bDataReady = bLoadError = bWaitForData = sal_True; SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_ABORT ); @@ -704,3 +686,4 @@ void SvFileObject::SendStateChg_Impl( sfx2::LinkManager::LinkState nState ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx index 0510f38092bd..ceb0f14ea1bc 100644 --- a/sfx2/source/appl/fileobj.hxx +++ b/sfx2/source/appl/fileobj.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,8 +83,7 @@ public: virtual sal_Bool Connect( sfx2::SvBaseLink* ); virtual void Edit( Window *, sfx2::SvBaseLink *, const Link& rEndEditHdl ); - // erfrage ob das man direkt auf die Daten zugreifen kann oder ob das - // erst angestossen werden muss + // Ask whether you can access data directly or whether it has to be triggered virtual sal_Bool IsPending() const; virtual sal_Bool IsDataComplete() const; @@ -93,3 +93,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/fwkhelper.cxx b/sfx2/source/appl/fwkhelper.cxx index 1909bcac2e17..60ae5499cc8e 100644 --- a/sfx2/source/appl/fwkhelper.cxx +++ b/sfx2/source/appl/fwkhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include "sal/config.h" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include "workwin.hxx" @@ -39,7 +40,7 @@ void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xFrame.is() ) { SfxFrame* pFrame=0; @@ -57,3 +58,5 @@ void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::sta } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/helpdispatch.cxx b/sfx2/source/appl/helpdispatch.cxx index 2e1128aea277..4a7a2f5c0254 100644 --- a/sfx2/source/appl/helpdispatch.cxx +++ b/sfx2/source/appl/helpdispatch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,4 @@ void SAL_CALL HelpDispatch_Impl::removeStatusListener( m_xRealDispatch->removeStatusListener( xControl, aURL ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/helpdispatch.hxx b/sfx2/source/appl/helpdispatch.hxx index b9d1e7b17b63..f99c054a3063 100644 --- a/sfx2/source/appl/helpdispatch.hxx +++ b/sfx2/source/appl/helpdispatch.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,4 @@ public: #endif // #ifndef SFX_HELPDISPATCHER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index 4f24ecb21355..26f0117aa566 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,9 +63,12 @@ HelpInterceptor_Impl::HelpInterceptor_Impl() : HelpInterceptor_Impl::~HelpInterceptor_Impl() { - for ( sal_uInt16 i = 0; m_pHistory && i < m_pHistory->Count(); ++i ) - delete m_pHistory->GetObject(i); - delete m_pHistory; + if ( m_pHistory ) + { + for ( size_t i = 0, n = m_pHistory->size(); i < n; ++i ) + delete m_pHistory->at( i ); + delete m_pHistory; + } } // ----------------------------------------------------------------------- @@ -73,26 +77,32 @@ void HelpInterceptor_Impl::addURL( const String& rURL ) { if ( !m_pHistory ) m_pHistory = new HelpHistoryList_Impl; - sal_uIntPtr nCount = m_pHistory->Count(); + + size_t nCount = m_pHistory->size(); if ( nCount && m_nCurPos < ( nCount - 1 ) ) { - for ( sal_uIntPtr i = nCount - 1; i > m_nCurPos; i-- ) - delete m_pHistory->Remove(i); + for ( size_t i = nCount - 1; i > m_nCurPos; i-- ) + { + delete m_pHistory->at( i ); + HelpHistoryList_Impl::iterator it = m_pHistory->begin(); + ::std::advance( it, i ); + m_pHistory->erase( it ); + } } Reference<XFrame> xFrame(m_xIntercepted, UNO_QUERY); Reference<XController> xController; if(xFrame.is()) xController = xFrame->getController(); Any aViewData; - if(xController.is() && m_pHistory->Count()) + if(xController.is() && !m_pHistory->empty()) { - m_pHistory->GetObject(m_nCurPos)->aViewData = xController->getViewData(); + m_pHistory->at( m_nCurPos )->aViewData = xController->getViewData(); } m_aCurrentURL = rURL; Any aEmptyViewData; - m_pHistory->Insert( new HelpHistoryEntry_Impl( rURL, aEmptyViewData ), LIST_APPEND ); - m_nCurPos = m_pHistory->Count() - 1; + m_pHistory->push_back( new HelpHistoryEntry_Impl( rURL, aEmptyViewData ) ); + m_nCurPos = m_pHistory->size() - 1; // TODO ? if ( m_xListener.is() ) { @@ -126,8 +136,8 @@ void HelpInterceptor_Impl::SetStartURL( const String& rURL ) { m_pHistory = new HelpHistoryList_Impl; Any aEmptyViewData; - m_pHistory->Insert( new HelpHistoryEntry_Impl( rURL, aEmptyViewData ), ((sal_uIntPtr)0x0) ); - m_nCurPos = m_pHistory->Count() - 1; + m_pHistory->insert( m_pHistory->begin(), new HelpHistoryEntry_Impl( rURL, aEmptyViewData)); + m_nCurPos = m_pHistory->size() - 1; m_pWindow->UpdateToolbox(); } @@ -141,7 +151,7 @@ sal_Bool HelpInterceptor_Impl::HasHistoryPred() const sal_Bool HelpInterceptor_Impl::HasHistorySucc() const { - return m_pHistory && ( m_nCurPos < ( m_pHistory->Count() - 1 ) ); + return m_pHistory && ( m_nCurPos < ( m_pHistory->size() - 1 ) ); } @@ -159,9 +169,7 @@ Reference< XDispatch > SAL_CALL HelpInterceptor_Impl::queryDispatch( if ( m_xSlaveDispatcher.is() ) xResult = m_xSlaveDispatcher->queryDispatch( aURL, aTargetFrameName, nSearchFlags ); - // INetURLObject aObj( aURL.Complete ); - // sal_Bool bHelpURL = ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP ); - sal_Bool bHelpURL = aURL.Complete.toAsciiLowerCase().match(rtl::OUString::createFromAscii("vnd.sun.star.help"),0); + sal_Bool bHelpURL = aURL.Complete.toAsciiLowerCase().match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.help")),0); if ( bHelpURL ) { @@ -257,7 +265,7 @@ void SAL_CALL HelpInterceptor_Impl::dispatch( { if ( m_pHistory ) { - if(m_pHistory->Count() > m_nCurPos) + if(m_pHistory->size() > m_nCurPos) { Reference<XFrame> xFrame(m_xIntercepted, UNO_QUERY); Reference<XController> xController; @@ -265,18 +273,18 @@ void SAL_CALL HelpInterceptor_Impl::dispatch( xController = xFrame->getController(); if(xController.is()) { - m_pHistory->GetObject(m_nCurPos)->aViewData = xController->getViewData(); + m_pHistory->at( m_nCurPos )->aViewData = xController->getViewData(); } } sal_uIntPtr nPos = ( bBack && m_nCurPos > 0 ) ? --m_nCurPos - : ( !bBack && m_nCurPos < m_pHistory->Count() - 1 ) + : ( !bBack && m_nCurPos < m_pHistory->size() - 1 ) ? ++m_nCurPos : ULONG_MAX; if ( nPos < ULONG_MAX ) { - HelpHistoryEntry_Impl* pEntry = m_pHistory->GetObject( nPos ); + HelpHistoryEntry_Impl* pEntry = m_pHistory->at( nPos ); if ( pEntry ) m_pWindow->loadHelpContent(pEntry->aURL, sal_False); // false => dont add item to history again! } @@ -333,35 +341,29 @@ void SAL_CALL HelpListener_Impl::disposing( const ::com::sun::star::lang::EventO pInterceptor->removeStatusListener( this, ::com::sun::star::util::URL() ); pInterceptor = NULL; } -/*-- 05.09.2002 12:17:59--------------------------------------------------- - -----------------------------------------------------------------------*/ HelpStatusListener_Impl::HelpStatusListener_Impl( Reference < XDispatch > aDispatch, URL& rURL) { aDispatch->addStatusListener(this, rURL); } -/*-- 05.09.2002 12:17:59--------------------------------------------------- - -----------------------------------------------------------------------*/ HelpStatusListener_Impl::~HelpStatusListener_Impl() { if(xDispatch.is()) xDispatch->removeStatusListener(this, com::sun::star::util::URL()); } -/*-- 05.09.2002 12:17:59--------------------------------------------------- - -----------------------------------------------------------------------*/ void HelpStatusListener_Impl::statusChanged( const FeatureStateEvent& rEvent ) throw( RuntimeException ) { aStateEvent = rEvent; } -/*-- 05.09.2002 12:18:00--------------------------------------------------- - -----------------------------------------------------------------------*/ void HelpStatusListener_Impl::disposing( const EventObject& ) throw( RuntimeException ) { xDispatch->removeStatusListener(this, com::sun::star::util::URL()); xDispatch = 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx index 5a6f0d024c20..e912fcdf2364 100644 --- a/sfx2/source/appl/helpinterceptor.hxx +++ b/sfx2/source/appl/helpinterceptor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,9 +28,7 @@ #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX #define INCLUDED_SFX_HELPINTERCEPTOR_HXX -#ifndef _CPPUHELPER_IMPLBASE2_HXX_ #include <cppuhelper/implbase3.hxx> -#endif #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XInterceptorInfo.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -38,8 +37,8 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/frame/XStatusListener.hpp> #include <tools/string.hxx> -#include <tools/list.hxx> #include <tools/link.hxx> +#include <vector> struct HelpHistoryEntry_Impl { @@ -50,7 +49,7 @@ struct HelpHistoryEntry_Impl aURL( rURL ), aViewData(rViewData) {} }; -DECLARE_LIST(HelpHistoryList_Impl,HelpHistoryEntry_Impl*) +typedef ::std::vector< HelpHistoryEntry_Impl* > HelpHistoryList_Impl; class SfxHelpWindow_Impl; class HelpInterceptor_Impl : public ::cppu::WeakImplHelper3< @@ -171,3 +170,4 @@ public: #endif // #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index af8086f4e046..d4c410a2a7ac 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfac.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -61,17 +62,17 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; -typedef std::hash_map< ::rtl::OUString, +typedef boost::unordered_map< ::rtl::OUString, WeakReference< XImageManager >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleIdToImagegMgr; -static WeakReference< XModuleManager > m_xModuleManager; -static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSupplier; -static WeakReference< XURLTransformer > m_xURLTransformer; -static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap; -Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ) +Image SAL_CALL GetImage( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::rtl::OUString& aURL, + bool bBig +) { // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel if ( !rFrame.is() ) @@ -90,22 +91,6 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta rtl::OUString aCommandURL( aURL ); if ( nProtocol == INET_PROT_SLOT ) { - /* - // Support old way to retrieve image via slot URL - Reference< XURLTransformer > xURLTransformer = m_xURLTransformer; - if ( !xURLTransformer.is() ) - { - xURLTransformer = Reference< XURLTransformer >( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), - UNO_QUERY ); - m_xURLTransformer = xURLTransformer; - } - - URL aTargetURL; - aTargetURL.Complete = aURL; - xURLTransformer->parseStrict( aTargetURL ); - sal_uInt16 nId = ( sal_uInt16 ) aTargetURL.Path.toInt32();*/ sal_uInt16 nId = ( sal_uInt16 ) String(aURL).Copy(5).ToInt32(); const SfxSlot* pSlot = 0; if ( xModel.is() ) @@ -147,8 +132,6 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta ::com::sun::star::ui::ImageType::SIZE_DEFAULT ); if ( bBig ) nImageType |= ::com::sun::star::ui::ImageType::SIZE_LARGE; - if ( bHiContrast ) - nImageType |= ::com::sun::star::ui::ImageType::COLOR_HIGHCONTRAST; if ( xDocImgMgr.is() ) { @@ -170,6 +153,8 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta } } + static WeakReference< XModuleManager > m_xModuleManager; + Reference< XModuleManager > xModuleManager = m_xModuleManager; if ( !xModuleManager.is() ) @@ -188,11 +173,16 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta { Reference< XImageManager > xModuleImageManager; rtl::OUString aModuleId = xModuleManager->identify( rFrame ); + + static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap; + ModuleIdToImagegMgr::iterator pIter = m_aModuleIdToImageMgrMap.find( aModuleId ); if ( pIter != m_aModuleIdToImageMgrMap.end() ) xModuleImageManager = pIter->second; else { + static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSupplier; + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = m_xModuleCfgMgrSupplier; if ( !xModuleCfgMgrSupplier.is() ) @@ -223,7 +213,7 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta if ( !!aImage ) return aImage; else if ( nProtocol != INET_PROT_UNO && nProtocol != INET_PROT_SLOT ) - return SvFileInformationManager::GetImageNoDefault( aObj, bBig, bHiContrast ); + return SvFileInformationManager::GetImageNoDefault( aObj, bBig ); } } catch ( Exception& ) @@ -232,3 +222,5 @@ Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::sta return Image(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index 07eb47bd92ad..ca1f2c3592cb 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,45 @@ #include "rtl/ustring.hxx" #include "sal/types.h" #include "vcl/svapp.hxx" -#include "vos/mutex.hxx" +#include "osl/mutex.hxx" + +//TO-Do, merge into framework/inc/helpers/mischelpers.hxx and deliver +class WeakPropertyChangeListener : public ::cppu::WeakImplHelper1<com::sun::star::beans::XPropertyChangeListener> +{ + private: + com::sun::star::uno::WeakReference<com::sun::star::beans::XPropertyChangeListener> mxOwner; + + public: + WeakPropertyChangeListener(com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener> xOwner) + : mxOwner(xOwner) + { + } + + virtual ~WeakPropertyChangeListener() + { + } + + virtual void SAL_CALL propertyChange(const com::sun::star::beans::PropertyChangeEvent &rEvent ) + throw(com::sun::star::uno::RuntimeException) + { + com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener> xOwner(mxOwner.get(), + com::sun::star::uno::UNO_QUERY); + if (xOwner.is()) + xOwner->propertyChange(rEvent); + + } + + // lang.XEventListener + virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& rEvent) + throw(com::sun::star::uno::RuntimeException) + { + com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener> xOwner(mxOwner.get(), + com::sun::star::uno::UNO_QUERY); + if (xOwner.is()) + xOwner->disposing(rEvent); + + } +}; namespace css = com::sun::star; @@ -77,7 +116,7 @@ void ImeStatusWindow::init() } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception"); + OSL_FAIL("com.sun.star.uno.Exception"); // Degrade gracefully and use the VCL-supplied default if no // configuration is available. } @@ -95,7 +134,7 @@ bool ImeStatusWindow::isShowing() } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception"); + OSL_FAIL("com.sun.star.uno.Exception"); // Degrade gracefully and use the VCL-supplied default if no // configuration is available. } @@ -121,7 +160,7 @@ void ImeStatusWindow::show(bool bShow) } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception"); + OSL_FAIL("com.sun.star.uno.Exception"); } } @@ -132,17 +171,17 @@ bool ImeStatusWindow::canToggle() const ImeStatusWindow::~ImeStatusWindow() { - if (m_xConfig.is()) + if (m_xConfig.is() && m_xConfigListener.is()) // We should never get here, but just in case... try { m_xConfig->removePropertyChangeListener( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowStatusWindow")), - this); + m_xConfigListener); } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.RuntimeException"); + OSL_FAIL("com.sun.star.uno.RuntimeException"); } } @@ -158,7 +197,7 @@ void SAL_CALL ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & ) throw (css::uno::RuntimeException) { - vos::OGuard aGuard(Application::GetSolarMutex()); + SolarMutexGuard aGuard; SfxApplication* pApp = SfxApplication::Get(); if (pApp) pApp->Invalidate(SID_SHOW_IME_STATUS_WINDOW); @@ -220,12 +259,16 @@ css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig() 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): + m_xConfigListener = new WeakPropertyChangeListener(this); xConfig->addPropertyChangeListener( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowStatusWindow")), - this); + m_xConfigListener); + } return xConfig; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx index 4edba523ed30..a0a350ce6809 100644 --- a/sfx2/source/appl/imestatuswindow.hxx +++ b/sfx2/source/appl/imestatuswindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,9 +118,13 @@ private: osl::Mutex m_aMutex; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > m_xConfig; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > + m_xConfigListener; bool m_bDisposed; }; } } #endif // INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index df8ae4b8b425..2d423978619c 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,8 @@ #include "precompiled_sfx2.hxx" #if defined(WNT) -#include <tools/svwin.h> +#include <prewin.h> +#include <postwin.h> #endif #include "impldde.hxx" @@ -127,9 +129,6 @@ IMPL_STATIC_LINK( SvDDELinkEditDialog, EditHdl_Impl, Edit *, pEdit ) return 0; } -/* */ - - SvDDEObject::SvDDEObject() : pConnection( 0 ), pLink( 0 ), pRequest( 0 ), pGetData( 0 ), nError( 0 ) { @@ -151,7 +150,7 @@ sal_Bool SvDDEObject::GetData( ::com::sun::star::uno::Any & rData /*out param*/, if( !pConnection ) return sal_False; - if( pConnection->GetError() ) // dann versuchen wir es nochmal + if( pConnection->GetError() ) // then we try once more { String sServer( pConnection->GetServiceName() ); String sTopic( pConnection->GetTopicName() ); @@ -162,13 +161,13 @@ sal_Bool SvDDEObject::GetData( ::com::sun::star::uno::Any & rData /*out param*/, nError = DDELINK_ERROR_APP; } - if( bWaitForData ) // wir sind rekursiv drin, wieder raus + if( bWaitForData ) // we are in an rekursive loop, get out again return sal_False; - // Verriegeln gegen Reentrance + // Lock against Reentrance bWaitForData = sal_True; - // falls gedruckt werden soll, warten wir bis die Daten vorhanden sind + // if you want to print, we'll wait until the data is available if( bSynchron ) { DdeRequest aReq( *pConnection, sItem, 5000 ); @@ -188,8 +187,7 @@ sal_Bool SvDDEObject::GetData( ::com::sun::star::uno::Any & rData /*out param*/, } else { - // ansonsten wird es asynchron ausgefuehrt -// if( !pLink || !pLink->IsBusy() ) + // otherwise it will be executed asynchronously { if( pRequest ) delete pRequest; @@ -215,9 +213,9 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink ) static sal_Bool bInWinExec = sal_False; #endif sal_uInt16 nLinkType = pSvLink->GetUpdateMode(); - if( pConnection ) // Verbindung steht ja schon + if( pConnection ) // Connection is already made { - // tja, dann nur noch als Abhaengig eintragen + // well, then just add it as dependent AddDataAdvise( pSvLink, SotExchange::GetFormatMimeType( pSvLink->GetContentType()), LINKUPDATE_ONCALL == nLinkType @@ -240,8 +238,8 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink ) pConnection = new DdeConnection( sServer, sTopic ); if( pConnection->GetError() ) { - // kann man denn das System-Topic ansprechen ? - // dann ist der Server oben, kennt nur nicht das Topic! + // Is it possible to address the system-Topic? + // then the server is up, it just does not know the topic! if( sTopic.EqualsIgnoreCaseAscii( "SYSTEM" ) ) { sal_Bool bSysTopic; @@ -255,12 +253,12 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink ) nError = DDELINK_ERROR_DATA; return sal_False; } - // ansonsten unter Win/WinNT die Applikation direkt starten + // otherwise in Win/WinNT, start the Application directly } #if defined(WNT) - // Server nicht da, starten und nochmal versuchen + // Server not up, try once more to start it. if( !bInWinExec ) { ByteString aCmdLine( sServer, RTL_TEXTENCODING_ASCII_US ); @@ -299,7 +297,7 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink ) if( LINKUPDATE_ALWAYS == nLinkType && !pLink && !pConnection->GetError() ) { - // Hot Link einrichten, Daten kommen irgendwann spaeter + // Setting up Hot Link, Data will be available at some point later on pLink = new DdeHotLink( *pConnection, sItem ); pLink->SetDataHdl( LINK( this, SvDDEObject, ImplGetDDEData ) ); pLink->SetDoneHdl( LINK( this, SvDDEObject, ImplDoneDDEData ) ); @@ -352,22 +350,22 @@ sal_Bool SvDDEObject::ImplHasOtherFormat( DdeTransaction& rReq ) nFmt = FORMAT_GDIMETAFILE; break; - // sonst noch irgendwas ?? + // something else? } if( nFmt ) - rReq.SetFormat( nFmt ); // damit nochmal versuchen + rReq.SetFormat( nFmt ); // try it once more return 0 != nFmt; } sal_Bool SvDDEObject::IsPending() const -/* [Beschreibung] - - Die Methode stellt fest, ob aus einem DDE-Object die Daten gelesen - werden kann. - Zurueckgegeben wird: - ERRCODE_NONE wenn sie komplett gelesen wurde - ERRCODE_SO_PENDING wenn sie noch nicht komplett gelesen wurde - ERRCODE_SO_FALSE sonst +/* [Description] + + The method determines whether the data-object can be read from a DDE. + + Returned is the following: + ERRCODE_NONE if it has been completely read + ERRCODE_SO_PENDING if it has not been completely read + ERRCODE_SO_FALSE otherwise */ { return bWaitForData; @@ -397,8 +395,8 @@ IMPL_LINK( SvDDEObject, ImplGetDDEData, DdeData*, pData ) Sequence< sal_Int8 > aSeq( (const sal_Int8*)p, nLen ); if( pGetData ) { - *pGetData <<= aSeq; // Daten kopieren - pGetData = 0; // und den Pointer bei mir zuruecksetzen + *pGetData <<= aSeq; // Copy Data + pGetData = 0; // reset the pointer here } else { @@ -421,9 +419,9 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, void*, pData ) { DdeTransaction* pReq = 0; if( !pLink || ( pLink && pLink->IsBusy() )) - pReq = pRequest; // dann kann nur der fertig sein + pReq = pRequest; // only the one that is ready else if( pRequest && pRequest->IsBusy() ) - pReq = pLink; // dann kann nur der fertig sein + pReq = pLink; // only the one that is ready if( pReq ) { @@ -433,16 +431,17 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, void*, pData ) } else if( pReq == pRequest ) { - // das wars dann bWaitForData = sal_False; } } } else - // das warten ist beendet + // End waiting bWaitForData = sal_False; return 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx index 4494cb9c20fa..3a2a84c2b685 100644 --- a/sfx2/source/appl/impldde.hxx +++ b/sfx2/source/appl/impldde.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,8 +49,8 @@ class SvDDEObject : public SvLinkSource DdeRequest* pRequest; ::com::sun::star::uno::Any * pGetData; - sal_uInt8 bWaitForData : 1; // wird auf Daten gewartet? - sal_uInt8 nError : 7; // Error Code fuer den Dialog + sal_uInt8 bWaitForData : 1; // waiting for data? + sal_uInt8 nError : 7; // Error code for dialogue sal_Bool ImplHasOtherFormat( DdeTransaction& ); @@ -76,3 +77,5 @@ public: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index e689b3f22282..9829c3bed5ce 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,6 +56,16 @@ #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/util/XCloseable.hpp> + +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::lang::XComponent; +using ::com::sun::star::util::XCloseable; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + namespace sfx2 { @@ -89,16 +100,30 @@ LinkManager::~LinkManager() } } +void LinkManager::InsertCachedComp(const Reference<XComponent>& xComp) +{ + maCachedComps.push_back(xComp); +} -/************************************************************************ -|* LinkManager::Remove() -|* -|* Beschreibung -*************************************************************************/ +void LinkManager::CloseCachedComps() +{ + CompVector::iterator itr = maCachedComps.begin(), itrEnd = maCachedComps.end(); + for (; itr != itrEnd; ++itr) + { + Reference<XCloseable> xCloseable(*itr, UNO_QUERY); + if (!xCloseable.is()) + continue; + + xCloseable->close(true); + } + maCachedComps.clear(); +} + +//-------------------------------------------------------------------------- void LinkManager::Remove( SvBaseLink *pLink ) { - // keine Links doppelt einfuegen + // No duplicate links inserted int bFound = sal_False; SvBaseLinkRef** ppRef = (SvBaseLinkRef**)aLinkTbl.GetData(); for( sal_uInt16 n = aLinkTbl.Count(); n; --n, ++ppRef ) @@ -111,7 +136,7 @@ void LinkManager::Remove( SvBaseLink *pLink ) bFound = sal_True; } - // falls noch leere rum stehen sollten, weg damit + // Remove emty ones if they exist if( !(*ppRef)->Is() ) { delete *ppRef; @@ -148,7 +173,7 @@ void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt ) sal_Bool LinkManager::Insert( SvBaseLink* pLink ) { - // keine Links doppelt einfuegen + // No duplicate links inserted for( sal_uInt16 n = 0; n < aLinkTbl.Count(); ++n ) { SvBaseLinkRef* pTmp = aLinkTbl[ n ]; @@ -171,7 +196,7 @@ sal_Bool LinkManager::InsertLink( SvBaseLink * pLink, sal_uInt16 nUpdateMode, const String* pName ) { - // unbedingt zuerst + // This First pLink->SetObjType( nObjType ); if( pName ) pLink->SetName( *pName ); @@ -210,7 +235,7 @@ sal_Bool LinkManager::InsertDDELink( SvBaseLink * pLink ) } -// erfrage die Strings fuer den Dialog +// Obtain the string for the dialog sal_Bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, String* pType, String* pFile, @@ -283,8 +308,8 @@ void LinkManager::UpdateAllLinks( SvStringsDtor aApps, aTopics, aItems; String sApp, sTopic, sItem; - // erstmal eine Kopie vom Array machen, damit sich updatende Links in - // Links in ... nicht dazwischen funken!! + // First make a copy of the array in order to update links + // links in ... no contact between them! SvPtrarr aTmpArr( 255, 50 ); sal_uInt16 n; for( n = 0; n < aLinkTbl.Count(); ++n ) @@ -302,7 +327,7 @@ void LinkManager::UpdateAllLinks( { SvBaseLink* pLink = (SvBaseLink*)aTmpArr[ n ]; - // suche erstmal im Array nach dem Eintrag + // search first in the array after the entry sal_uInt16 nFndPos = USHRT_MAX; for( sal_uInt16 i = 0; i < aLinkTbl.Count(); ++i ) if( pLink == *aLinkTbl[ i ] ) @@ -312,9 +337,9 @@ void LinkManager::UpdateAllLinks( } if( USHRT_MAX == nFndPos ) - continue; // war noch nicht vorhanden! + continue; // was not available! - // Graphic-Links noch nicht updaten + // Graphic-Links not to update yet if( !pLink->IsVisible() || ( !bUpdateGrfLinks && OBJECT_CLIENT_GRF == pLink->GetObjType() )) continue; @@ -323,19 +348,16 @@ void LinkManager::UpdateAllLinks( { int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_YES, SfxResId( STR_QUERY_UPDATE_LINKS ) ).Execute(); if( RET_YES != nRet ) - return ; // es soll nichts geupdatet werden - bAskUpdate = sal_False; // einmal reicht + return ; // nothing should be updated + bAskUpdate = sal_False; // once is enough } pLink->Update(); } + CloseCachedComps(); } -/************************************************************************ -|* SvBaseLink::CreateObject() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- SvLinkSourceRef LinkManager::CreateObj( SvBaseLink * pLink ) { @@ -356,7 +378,7 @@ SvLinkSourceRef LinkManager::CreateObj( SvBaseLink * pLink ) sal_Bool LinkManager::InsertServer( SvLinkSource* pObj ) { - // keine doppelt einfuegen + // no duplicate inserts if( !pObj || USHRT_MAX != aServerTbl.GetPos( pObj ) ) return sal_False; @@ -387,6 +409,56 @@ void MakeLnkName( String& rName, const String* pType, const String& rFile, ((rName += cTokenSeperator ) += *pFilter).EraseLeadingChars().EraseTrailingChars(); } +void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer) +{ + SfxMedium* pMed = rServer.GetMedium(); + if (!pMed) + return; + + const ::sfx2::SvBaseLinks& rLinks = GetLinks(); + sal_uInt16 n = rLinks.Count(); + + for (sal_uInt16 i = 0; i < n; ++i) + { + ::sfx2::SvBaseLink* p = *rLinks[i]; + String aType, aFile, aLink, aFilter; + if (!GetDisplayNames(p, &aType, &aFile, &aLink, &aFilter)) + continue; + + if (!aType.EqualsAscii("soffice")) + // DDE connections between OOo apps are always named 'soffice'. + continue; + + String aTmp; + OUString aURL = aFile; + if (utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp)) + aURL = aTmp; + + if (!aURL.equalsIgnoreAsciiCase(pMed->GetName())) + // This DDE link is not associated with this server shell... Skip it. + continue; + + if (!aLink.Len()) + continue; + + LinkServerShell(aLink, rServer, *p); + } +} + +void LinkManager::LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const +{ + ::sfx2::SvLinkSource* pSrvSrc = rServer.DdeCreateLinkSource(rPath); + if (pSrvSrc) + { + ::com::sun::star::datatransfer::DataFlavor aFl; + SotExchange::GetFormatDataFlavor(rLink.GetContentType(), aFl); + rLink.SetObj(pSrvSrc); + pSrvSrc->AddDataAdvise( + &rLink, aFl.MimeType, + sfx2::LINKUPDATE_ONCALL == rLink.GetUpdateMode() ? ADVISEMODE_ONLYONCE : 0); + } +} + sal_Bool LinkManager::InsertFileLink( sfx2::SvBaseLink& rLink, sal_uInt16 nFileType, const String& rFileNm, @@ -413,8 +485,8 @@ sal_Bool LinkManager::InsertFileLink( sfx2::SvBaseLink& rLink ) return sal_False; } -// eine Uebertragung wird abgebrochen, also alle DownloadMedien canceln -// (ist zur Zeit nur fuer die FileLinks interressant!) +// A transfer is aborted, so cancel all download media +// (for now this is only of interest for the file links!) void LinkManager::CancelTransfers() { SvFileObject* pFileObj; @@ -425,27 +497,22 @@ void LinkManager::CancelTransfers() if( 0 != ( pLnk = &(*rLnks[ --n ])) && OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & pLnk->GetObjType()) && 0 != ( pFileObj = (SvFileObject*)pLnk->GetObj() ) ) -// 0 != ( pFileObj = (SvFileObject*)SvFileObject::ClassFactory()-> -// CastAndAddRef( pLnk->GetObj() )) ) pFileObj->CancelTransfers(); } - - // um Status Informationen aus dem FileObject an den BaseLink zu - // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat - // dann die entsprechenden Informationen als String. - // Wird zur Zeit fuer FileObject in Verbindung mit JavaScript benoetigt - // - das braucht Informationen ueber Load/Abort/Error + // For the purpose of sending Status information from the file object to + // the base link, there exist a dedicated ClipBoardId. The SvData-object + // gets the appropriate information as a string + // For now this is required for file object in conjunction with JavaScript + // - needs information about Load/Abort/Error sal_uIntPtr LinkManager::RegisterStatusInfoId() { static sal_uIntPtr nFormat = 0; if( !nFormat ) { -// wie sieht die neue Schnittstelle aus? -// nFormat = Exchange::RegisterFormatName( "StatusInfo vom SvxInternalLink" ); nFormat = SotExchange::RegisterFormatName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( - "StatusInfo vom SvxInternalLink" ))); + "StatusInfo from SvxInternalLink" ))); } return nFormat; } @@ -511,13 +578,11 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) SfxObjectShell* pFndShell = 0; sal_uInt16 nUpdateMode = com::sun::star::document::UpdateDocMode::NO_UPDATE; String sTopic, sItem, sReferer; - if( pLink->GetLinkManager() && - pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sTopic, &sItem ) - && sTopic.Len() ) + LinkManager* pLinkMgr = pLink->GetLinkManager(); + if (pLinkMgr && pLinkMgr->GetDisplayNames(pLink, 0, &sTopic, &sItem) && sTopic.Len()) { - // erstmal nur ueber die DocumentShells laufen und die mit dem - // Namen heraussuchen: - + // first only loop over the DocumentShells the shells and find those + // with the name: com::sun::star::lang::Locale aLocale; MsLangId::convertLanguageToLocale( LANGUAGE_SYSTEM, aLocale ); CharClass aCC( aLocale ); @@ -528,7 +593,7 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) TypeId aType( TYPE(SfxObjectShell) ); sal_Bool bFirst = sal_True; - SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); + SfxObjectShell* pShell = pLinkMgr->GetPersist(); if( pShell && pShell->GetMedium() ) { sReferer = pShell->GetMedium()->GetBaseURL(); @@ -556,7 +621,7 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) aCC.toLower( sTmp ); - if( sTmp == sNmURL ) // die wollen wir haben + if( sTmp == sNmURL ) // we want these { pFndShell = pShell; break; @@ -578,9 +643,25 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) if( !sTopic.Len() ) return sal_False; - if( !pFndShell ) + if (pFndShell) { - // dann versuche die Datei zu laden: + sfx2::SvLinkSource* pNewSrc = pFndShell->DdeCreateLinkSource( sItem ); + if( pNewSrc ) + { + ::com::sun::star::datatransfer::DataFlavor aFl; + SotExchange::GetFormatDataFlavor( pLink->GetContentType(), aFl ); + + pLink->SetObj( pNewSrc ); + pNewSrc->AddDataAdvise( pLink, aFl.MimeType, + sfx2::LINKUPDATE_ONCALL == pLink->GetUpdateMode() + ? ADVISEMODE_ONLYONCE + : 0 ); + return true; + } + } + else + { + // then try to download the file: INetURLObject aURL( sTopic ); INetProtocol eOld = aURL.GetProtocol(); aURL.SetURL( sTopic = lcl_DDE_RelToAbs( sTopic, sReferer ) ); @@ -593,7 +674,11 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") ); SfxStringItem aReferer( SID_REFERER, sReferer ); SfxUInt16Item aUpdate( SID_UPDATEDOCMODE, nUpdateMode ); - SfxBoolItem aReadOnly(SID_DOC_READONLY, sal_True); + SfxBoolItem aReadOnly(SID_DOC_READONLY, false); + + // Disable automatic re-connection to avoid this link instance + // being destroyed at re-connection. + SfxBoolItem aDdeConnect(SID_DDE_RECONNECT_ONLOAD, false); // #i14200# (DDE-link crashes wordprocessor) SfxAllItemSet aArgs( SFX_APP()->GetPool() ); @@ -604,29 +689,19 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) aArgs.Put(aName); aArgs.Put(aUpdate); aArgs.Put(aReadOnly); - pFndShell = SfxObjectShell::CreateAndLoadObject( aArgs ); + aArgs.Put(aDdeConnect); + Reference<XComponent> xComp = SfxObjectShell::CreateAndLoadComponent(aArgs); + pFndShell = SfxObjectShell::GetShellFromComponent(xComp); + if (xComp.is() && pFndShell) + { + pLinkMgr->InsertCachedComp(xComp); + pLinkMgr->LinkServerShell(sItem, *pFndShell, *pLink); + return true; + } } } - sal_Bool bRet = sal_False; - if( pFndShell ) - { - sfx2::SvLinkSource* pNewSrc = pFndShell->DdeCreateLinkSource( sItem ); - if( pNewSrc ) - { - bRet = sal_True; - - ::com::sun::star::datatransfer::DataFlavor aFl; - SotExchange::GetFormatDataFlavor( pLink->GetContentType(), aFl ); - - pLink->SetObj( pNewSrc ); - pNewSrc->AddDataAdvise( pLink, aFl.MimeType, - sfx2::LINKUPDATE_ONCALL == pLink->GetUpdateMode() - ? ADVISEMODE_ONLYONCE - : 0 ); - } - } - return bRet; + return false; } @@ -634,3 +709,4 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index ee6e4fba588b..70aa59578c2d 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <sfx2/linksrc.hxx> #include <sfx2/lnkbase.hxx> -//#include <sot/exchange.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -46,7 +46,6 @@ namespace sfx2 TYPEINIT0( SvLinkSource ) -/************** class SvLinkSourceTimer *********************************/ class SvLinkSourceTimer : public Timer { SvLinkSource * pOwner; @@ -62,7 +61,7 @@ SvLinkSourceTimer::SvLinkSourceTimer( SvLinkSource * pOwn ) void SvLinkSourceTimer::Timeout() { - // sicher gegen zerstoeren im Handler + // Secure against beeing destroyed in Handler SvLinkSourceRef aAdv( pOwner ); pOwner->SendDataChanged(); } @@ -209,12 +208,11 @@ void SvLinkSource::setStreamToLoadFrom(const com::sun::star::uno::Reference<com: pImpl->m_bIsReadOnly = bIsReadOnly; } -// --> OD 2008-06-18 #i88291# +// #i88291# void SvLinkSource::clearStreamToLoadFrom() { pImpl->m_xInputStreamToLoadFrom.clear(); } -// <-- void SvLinkSource::Closed() { @@ -277,7 +275,7 @@ void SvLinkSource::SendDataChanged() void SvLinkSource::NotifyDataChanged() { if( pImpl->nTimeout ) - StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // Timeout neu + StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // New timeout else { SvLinkSource_EntryIter_Impl aIter( pImpl->aArr ); @@ -316,10 +314,10 @@ void SvLinkSource::DataChanged( const String & rMimeType, const ::com::sun::star::uno::Any & rVal ) { if( pImpl->nTimeout && !rVal.hasValue() ) - { // nur wenn keine Daten mitgegeben wurden + { // only when no data was included // fire all data to the sink, independent of the requested format pImpl->aDataMimeType = rMimeType; - StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // Timeout neu + StartTimer( &pImpl->pTimer, this, pImpl->nTimeout ); // New timeout } else { @@ -433,3 +431,4 @@ void SvLinkSource::Edit( Window *, SvBaseLink *, const Link& ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index 95c24e4a77ab..cc7b31bd1b15 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" - #include <sfx2/lnkbase.hxx> #include <sot/exchange.hxx> #include <com/sun/star/uno/Any.hxx> @@ -72,16 +72,16 @@ struct BaseLink_Impl { delete m_pFileDlg; } }; -// nur fuer die interne Verwaltung +// only for internal management struct ImplBaseLinkData { struct tClientType { - // gilt fuer alle Links - sal_uIntPtr nCntntType; // Update Format - // nicht Ole-Links - sal_Bool bIntrnlLnk; // ist es ein interner Link - sal_uInt16 nUpdateMode;// UpdateMode + // applies for all links + sal_uIntPtr nCntntType; // Update Format + // Not Ole-Links + sal_Bool bIntrnlLnk; // It is an internal link + sal_uInt16 nUpdateMode; // UpdateMode }; struct tDDEType @@ -107,7 +107,7 @@ class ImplDdeItem : public DdeGetPutItem { SvBaseLink* pLink; DdeData aData; - Sequence< sal_Int8 > aSeq; // Datacontainer for DdeData !!! + Sequence< sal_Int8 > aSeq; // Datacontainer for DdeData !!! sal_Bool bIsValidData : 1; sal_Bool bIsInDTOR : 1; public: @@ -130,12 +130,7 @@ public: sal_Bool IsInDTOR() const { return bIsInDTOR; } }; - -/************************************************************************ -|* SvBaseLink::SvBaseLink() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- SvBaseLink::SvBaseLink() { @@ -146,11 +141,7 @@ SvBaseLink::SvBaseLink() bWasLastEditOK = sal_False; } -/************************************************************************ -|* SvBaseLink::SvBaseLink() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- SvBaseLink::SvBaseLink( sal_uInt16 nUpdateMode, sal_uIntPtr nContentType ) { @@ -160,19 +151,16 @@ SvBaseLink::SvBaseLink( sal_uInt16 nUpdateMode, sal_uIntPtr nContentType ) bVisible = bSynchron = bUseCache = sal_True; bWasLastEditOK = sal_False; - // falls es ein Ole-Link wird, + // It it going to be a Ole-Link, pImplData->ClientType.nUpdateMode = nUpdateMode; pImplData->ClientType.nCntntType = nContentType; pImplData->ClientType.bIntrnlLnk = sal_False; } -/************************************************************************ -|* SvBaseLink::SvBaseLink() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- SvBaseLink::SvBaseLink( const String& rLinkName, sal_uInt16 nObjectType, SvLinkSource* pObj ) + : pImpl(0) { bVisible = bSynchron = bUseCache = sal_True; bWasLastEditOK = sal_False; @@ -182,7 +170,7 @@ SvBaseLink::SvBaseLink( const String& rLinkName, sal_uInt16 nObjectType, SvLinkS if( !pObj ) { - DBG_ASSERT( pObj, "Wo ist mein zu linkendes Object" ); + DBG_ASSERT( pObj, "Where is my left-most object" ); return; } @@ -192,15 +180,14 @@ SvBaseLink::SvBaseLink( const String& rLinkName, sal_uInt16 nObjectType, SvLinkS DdeTopic* pTopic = FindTopic( aLinkName, &nItemStt ); if( pTopic ) { - // dann haben wir alles zusammen - // MM hat gefummelt ??? - // MM_TODO wie kriege ich den Namen + // then we have it all together + // MM_TODO how do I get the name String aStr = aLinkName; // xLinkName->GetDisplayName(); aStr = aStr.Copy( nItemStt ); pImplData->DDEType.pItem = new ImplDdeItem( *this, aStr ); pTopic->InsertItem( pImplData->DDEType.pItem ); - // dann koennen wir uns auch das Advise merken + // store the Advice xObj = pObj; } } @@ -208,11 +195,7 @@ SvBaseLink::SvBaseLink( const String& rLinkName, sal_uInt16 nObjectType, SvLinkS xObj = pObj; } -/************************************************************************ -|* SvBaseLink::~SvBaseLink() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- SvBaseLink::~SvBaseLink() { @@ -227,6 +210,7 @@ SvBaseLink::~SvBaseLink() } delete pImplData; + delete pImpl; } IMPL_LINK( SvBaseLink, EndEditHdl, String*, _pNewName ) @@ -242,11 +226,7 @@ IMPL_LINK( SvBaseLink, EndEditHdl, String*, _pNewName ) return 0; } -/************************************************************************ -|* SvBaseLink::SetObjType() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- void SvBaseLink::SetObjType( sal_uInt16 nObjTypeP ) { @@ -256,33 +236,21 @@ void SvBaseLink::SetObjType( sal_uInt16 nObjTypeP ) nObjType = nObjTypeP; } -/************************************************************************ -|* SvBaseLink::SetName() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- void SvBaseLink::SetName( const String & rNm ) { aLinkName = rNm; } -/************************************************************************ -|* SvBaseLink::GetName() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- String SvBaseLink::GetName() const { return aLinkName; } -/************************************************************************ -|* SvBaseLink::SetObj() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- void SvBaseLink::SetObj( SvLinkSource * pObj ) { @@ -293,45 +261,32 @@ void SvBaseLink::SetObj( SvLinkSource * pObj ) xObj = pObj; } -/************************************************************************ -|* SvBaseLink::SetLinkSourceName() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- void SvBaseLink::SetLinkSourceName( const String & rLnkNm ) { if( aLinkName == rLnkNm ) return; - AddNextRef(); // sollte ueberfluessig sein - // Alte Verbindung weg + AddNextRef(); // should be superfluous + // remove old connection Disconnect(); aLinkName = rLnkNm; - // Neu verbinden + // New Connection _GetRealObject(); - ReleaseRef(); // sollte ueberfluessig sein + ReleaseRef(); // should be superfluous } -/************************************************************************ -|* SvBaseLink::GetLinkSourceName() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- String SvBaseLink::GetLinkSourceName() const { return aLinkName; } - -/************************************************************************ -|* SvBaseLink::SetUpdateMode() -|* -|* Beschreibung -*************************************************************************/ +//-------------------------------------------------------------------------- void SvBaseLink::SetUpdateMode( sal_uInt16 nMode ) { @@ -347,7 +302,7 @@ void SvBaseLink::SetUpdateMode( sal_uInt16 nMode ) } } -// --> OD 2008-06-19 #i88291# +// #i88291# void SvBaseLink::clearStreamToLoadFrom() { m_xInputStreamToLoadFrom.clear(); @@ -356,7 +311,6 @@ void SvBaseLink::clearStreamToLoadFrom() xObj->clearStreamToLoadFrom(); } } -// <-- sal_Bool SvBaseLink::Update() { @@ -370,28 +324,27 @@ sal_Bool SvBaseLink::Update() if( xObj.Is() ) { xObj->setStreamToLoadFrom(m_xInputStreamToLoadFrom,m_bIsReadOnly); - // m_xInputStreamToLoadFrom = 0; String sMimeType( SotExchange::GetFormatMimeType( pImplData->ClientType.nCntntType )); Any aData; if( xObj->GetData( aData, sMimeType ) ) { - DataChanged( sMimeType, aData ); - //JP 13.07.00: Bug 76817 - for manual Updates there is no - // need to hold the ServerObject + UpdateResult eRes = DataChanged(sMimeType, aData); + bool bSuccess = eRes == SUCCESS; + //for manual Updates there is no need to hold the ServerObject if( OBJECT_CLIENT_DDE == nObjType && LINKUPDATE_ONCALL == GetUpdateMode() && xObj.Is() ) xObj->RemoveAllDataAdvise( this ); - return sal_True; + return bSuccess; } if( xObj.Is() ) { - // sollten wir asynschron sein? + // should be asynschron? if( xObj->IsPending() ) return sal_True; - // dann brauchen wir das Object auch nicht mehr + // we do not need the object anymore AddNextRef(); Disconnect(); ReleaseRef(); @@ -421,14 +374,14 @@ void SvBaseLink::_GetRealObject( sal_Bool bConnect) { String sServer; if( pImpl->m_pLinkMgr->GetDisplayNames( this, &sServer ) && - sServer == GetpApp()->GetAppName() ) // interner Link !!! + sServer == GetpApp()->GetAppName() ) // internal Link !!! { - // damit der Internal - Link erzeugt werden kann !!! + // so that the Internal link can be created! nObjType = OBJECT_INTERN; xObj = pImpl->m_pLinkMgr->CreateObj( this ); pImplData->ClientType.bIntrnlLnk = sal_True; - nObjType = OBJECT_CLIENT_DDE; // damit wir wissen was es mal war !! + nObjType = OBJECT_CLIENT_DDE; // so we know what it once was! } else { @@ -448,7 +401,7 @@ sal_uIntPtr SvBaseLink::GetContentType() const if( OBJECT_CLIENT_SO & nObjType ) return pImplData->ClientType.nCntntType; - return 0; // alle Formate ? + return 0; // all Formats ? } @@ -487,7 +440,7 @@ void SvBaseLink::Disconnect() } } -void SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any & ) +SvBaseLink::UpdateResult SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any & ) { switch( nObjType ) { @@ -496,6 +449,7 @@ void SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any & pImplData->DDEType.pItem->Notify(); break; } + return SUCCESS; } void SvBaseLink::Edit( Window* pParent, const Link& rEndEditHdl ) @@ -578,7 +532,6 @@ bool SvBaseLink::ExecuteEdit( const String& _rNewName ) void SvBaseLink::Closed() { if( xObj.Is() ) - // beim Advise Abmelden xObj->RemoveAllDataAdvise( this ); } @@ -593,8 +546,7 @@ FileDialogHelper* SvBaseLink::GetFileDialog( sal_uInt32 nFlags, const String& rF ImplDdeItem::~ImplDdeItem() { bIsInDTOR = sal_True; - // damit im Disconnect nicht jemand auf die Idee kommt, den Pointer zu - // loeschen!! + // So that no-one gets the idea to delete the pointer when Disconnecting! SvBaseLinkRef aRef( pLink ); aRef->Disconnect(); } @@ -603,7 +555,7 @@ DdeData* ImplDdeItem::Get( sal_uIntPtr nFormat ) { if( pLink->GetObj() ) { - // ist das noch gueltig? + // is it still valid? if( bIsValidData && nFormat == aData.GetFormat() ) return &aData; @@ -628,19 +580,19 @@ DdeData* ImplDdeItem::Get( sal_uIntPtr nFormat ) sal_Bool ImplDdeItem::Put( const DdeData* ) { - DBG_ERROR( "ImplDdeItem::Put not implemented" ); + OSL_FAIL( "ImplDdeItem::Put not implemented" ); return sal_False; } void ImplDdeItem::AdviseLoop( sal_Bool bOpen ) { - // Verbindung wird geschlossen, also Link abmelden + // Connection is closed, so also unsubscribe link if( pLink->GetObj() ) { if( bOpen ) { - // es wird wieder eine Verbindung hergestellt + // A connection is re-established if( OBJECT_DDE_EXTERN == pLink->GetObjType() ) { pLink->GetObj()->AddDataAdvise( pLink, String::CreateFromAscii( "text/plain;charset=utf-16" ), ADVISEMODE_NODATA ); @@ -649,8 +601,8 @@ void ImplDdeItem::AdviseLoop( sal_Bool bOpen ) } else { - // damit im Disconnect nicht jemand auf die Idee kommt, - // den Pointer zu loeschen!! + // So that no-one gets the idea to delete the pointer + // when Disconnecting! SvBaseLinkRef aRef( pLink ); aRef->Disconnect(); } @@ -672,24 +624,24 @@ static DdeTopic* FindTopic( const String & rLinkName, sal_uInt16* pItemStt ) pService = rSvc.Next() ) if( pService->GetName() == sService ) { - // dann suchen wir uns das Topic + // then we search for the Topic String sTopic( sNm.GetToken( 0, cTokenSeperator, nTokenPos ) ); if( pItemStt ) *pItemStt = nTokenPos; - DdeTopics& rTopics = pService->GetTopics(); + std::vector<DdeTopic*>& rTopics = pService->GetTopics(); for( int i = 0; i < 2; ++i ) { - for( DdeTopic* pTopic = rTopics.First(); pTopic; - pTopic = rTopics.Next() ) - if( pTopic->GetName() == sTopic ) - return pTopic; + for( std::vector<DdeTopic*>::iterator iterTopic = rTopics.begin(); + iterTopic != rTopics.end(); ++iterTopic ) + if( (*iterTopic)->GetName() == sTopic ) + return *iterTopic; - // Topic nicht gefunden ? - // dann versuchen wir ihn mal anzulegen + // Topic not found? + // then we try once to create it if( i || !pService->MakeTopic( sTopic ) ) - break; // hat nicht geklappt, also raus + break; // did not work, exiting } break; } @@ -697,3 +649,5 @@ static DdeTopic* FindTopic( const String & rLinkName, sal_uInt16* pItemStt ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 87953e134292..8048e4b85a55 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include <stdio.h> #include <tools/rcid.h> @@ -69,12 +67,10 @@ public: SfxChildWinFactArr_Impl* pFactArr; ImageList* pImgListSmall; ImageList* pImgListBig; - ImageList* pImgListHiSmall; - ImageList* pImgListHiBig; SfxModule_Impl(); ~SfxModule_Impl(); - ImageList* GetImageList( ResMgr*, sal_Bool, sal_Bool bHiContrast = sal_False ); + ImageList* GetImageList( ResMgr* pResMgr, bool bBig ); }; SfxModule_Impl::SfxModule_Impl() @@ -91,18 +87,15 @@ SfxModule_Impl::~SfxModule_Impl() delete pFactArr; delete pImgListSmall; delete pImgListBig; - delete pImgListHiSmall; - delete pImgListHiBig; } -ImageList* SfxModule_Impl::GetImageList( ResMgr* pResMgr, sal_Bool bBig, sal_Bool bHiContrast ) +ImageList* SfxModule_Impl::GetImageList( ResMgr* pResMgr, bool bBig ) { - ImageList*& rpList = bBig ? ( bHiContrast ? pImgListHiBig: pImgListBig ) : - ( bHiContrast ? pImgListHiSmall : pImgListSmall ); + ImageList*& rpList = bBig ? pImgListBig : pImgListSmall; if ( !rpList ) { - ResId aResId( bBig ? ( bHiContrast ? RID_DEFAULTIMAGELIST_LCH : RID_DEFAULTIMAGELIST_LC ) : - ( bHiContrast ? RID_DEFAULTIMAGELIST_SCH : RID_DEFAULTIMAGELIST_SC ), *pResMgr ); + ResId aResId( bBig ? ( RID_DEFAULTIMAGELIST_LC ) : ( RID_DEFAULTIMAGELIST_SC ), *pResMgr ); + aResId.SetRT( RSC_IMAGELIST ); DBG_ASSERT( pResMgr->IsAvailable(aResId), "No default ImageList!" ); @@ -131,16 +124,7 @@ ResMgr* SfxModule::GetResMgr() } //==================================================================== -/* -SfxModule::SfxModule( ResMgr* pMgrP, sal_Bool bDummyP, - SfxObjectFactory* pFactoryP ) - : pResMgr( pMgrP ), bDummy( bDummyP ), pImpl(0L) -{ - Construct_Impl(); - if ( pFactoryP ) - pFactoryP->SetModule_Impl( this ); -} -*/ + SfxModule::SfxModule( ResMgr* pMgrP, sal_Bool bDummyP, SfxObjectFactory* pFactoryP, ... ) : pResMgr( pMgrP ), bDummy( bDummyP ), pImpl(0L) @@ -171,8 +155,6 @@ void SfxModule::Construct_Impl() pImpl->pFactArr=0; pImpl->pImgListSmall=0; pImpl->pImgListBig=0; - pImpl->pImgListHiSmall=0; - pImpl->pImgListHiBig=0; SetPool( &pApp->GetPool() ); } @@ -186,7 +168,8 @@ SfxModule::~SfxModule() { if ( SFX_APP()->Get_Impl() ) { - // Das Modul wird noch vor dem DeInitialize zerst"ort, also auis dem Array entfernen + // The module will be destroyed before the Deinitialize, + // so remove from the array SfxModuleArr_Impl& rArr = GetModules_Impl(); for( sal_uInt16 nPos = rArr.Count(); nPos--; ) { @@ -215,22 +198,20 @@ SfxSlotPool* SfxModule::GetSlotPool() const void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact) { - DBG_ASSERT( pImpl, "Kein echtes Modul!" ); + DBG_ASSERT( pImpl, "No real Module!" ); if (!pImpl->pFactArr) pImpl->pFactArr = new SfxChildWinFactArr_Impl; -//#ifdef DBG_UTIL for (sal_uInt16 nFactory=0; nFactory<pImpl->pFactArr->Count(); ++nFactory) { if (pFact->nId == (*pImpl->pFactArr)[nFactory]->nId) { pImpl->pFactArr->Remove( nFactory ); - DBG_ERROR("ChildWindow mehrfach registriert!"); + OSL_FAIL("ChildWindow registered multiple times!"); return; } } -//#endif pImpl->pFactArr->C40_INSERT( SfxChildWinFactory, pFact, pImpl->pFactArr->Count() ); @@ -241,7 +222,7 @@ void SfxModule::RegisterChildWindow(SfxChildWinFactory *pFact) void SfxModule::RegisterChildWindowContext( sal_uInt16 nId, SfxChildWinContextFactory *pFact) { - DBG_ASSERT( pImpl, "Kein echtes Modul!" ); + DBG_ASSERT( pImpl, "No real Module!" ); sal_uInt16 nCount = pImpl->pFactArr->Count(); for (sal_uInt16 nFactory=0; nFactory<nCount; ++nFactory) @@ -256,7 +237,7 @@ void SfxModule::RegisterChildWindowContext( sal_uInt16 nId, } } - DBG_ERROR( "Kein ChildWindow fuer diesen Context!" ); + OSL_FAIL( "No ChildWindow for this Context!" ); } //------------------------------------------------------------------------- @@ -273,7 +254,7 @@ void SfxModule::RegisterToolBoxControl( SfxTbxCtrlFactory *pFact ) if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("TbxController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("TbxController-Registering is not clearly defined!"); } } #endif @@ -295,7 +276,7 @@ void SfxModule::RegisterStatusBarControl( SfxStbCtrlFactory *pFact ) if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("StbController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("TbxController-Registering is not clearly defined!"); } } #endif @@ -317,7 +298,7 @@ void SfxModule::RegisterMenuControl( SfxMenuCtrlFactory *pFact ) if ( pF->nTypeId && pF->nTypeId == pFact->nTypeId && (pF->nSlotId == pFact->nSlotId || pF->nSlotId == 0) ) { - DBG_WARNING("MenuController-Registrierung ist nicht eindeutig!"); + DBG_WARNING("MenuController-Registering is not clearly defined!"); } } #endif @@ -355,15 +336,10 @@ SfxChildWinFactArr_Impl* SfxModule::GetChildWinFactories_Impl() const ImageList* SfxModule::GetImageList_Impl( sal_Bool bBig ) { - return pImpl->GetImageList( pResMgr, bBig, sal_False ); + return pImpl->GetImageList( pResMgr, bBig ); } -ImageList* SfxModule::GetImageList_Impl( sal_Bool bBig, sal_Bool bHiContrast ) -{ - return pImpl->GetImageList( pResMgr, bBig, bHiContrast ); -} - -SfxTabPage* SfxModule::CreateTabPage( sal_uInt16, Window*, const SfxItemSet& ) +SfxTabPage* SfxModule::CreateTabPage( sal_uInt16, Window*, const SfxItemSet& ) { return NULL; } @@ -381,10 +357,11 @@ void SfxModule::DestroyModules_Impl() { SfxModuleArr_Impl& rModules = *pModules; for( sal_uInt16 nPos = rModules.Count(); nPos--; ) - { - SfxModule* pMod = rModules.GetObject(nPos); - delete pMod; - } + { + SfxModule* pMod = rModules.GetObject(nPos); + delete pMod; + } + delete pModules, pModules = 0; } } @@ -482,3 +459,5 @@ FieldUnit SfxModule::GetFieldUnit() const eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); return eUnit; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index dbeb25d8c6b9..1aa2e8ad6230 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,7 +46,7 @@ #include "newhelp.hrc" #include "helpid.hrc" -#include <hash_map> +#include <boost/unordered_map.hpp> #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> @@ -70,9 +71,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <com/sun/star/frame/XFrame.hpp> -#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include <com/sun/star/i18n/XBreakIterator.hpp> -#endif #include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/style/XStyle.hpp> @@ -133,8 +132,6 @@ using namespace ::com::sun::star::ui; using namespace ::comphelper; -extern void AppendConfigToken_Impl( String& rURL, sal_Bool bQuestionMark ); // sfxhelp.cxx - // defines --------------------------------------------------------------- #define SPLITSET_ID 0 @@ -293,13 +290,6 @@ ContentListBox_Impl::ContentListBox_Impl( Window* pParent, const ResId& rResId ) aDocumentImage ( SfxResId( IMG_HELP_CONTENT_DOC ) ) { - if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) - { - aOpenBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_OPEN_HC ) ); - aClosedBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_CLOSED_HC ) ); - aDocumentImage = Image( SfxResId( IMG_HELP_CONTENT_DOC_HC ) ); - } - SetStyle( GetStyle() | WB_HIDESELECTION | WB_HSCROLL ); SetEntryHeight( 16 ); @@ -412,7 +402,7 @@ void ContentListBox_Impl::RequestingChilds( SvLBoxEntry* pParent ) } catch( Exception& ) { - DBG_ERROR( "ContentListBox_Impl::RequestingChilds(): unexpected exception" ); + OSL_FAIL( "ContentListBox_Impl::RequestingChilds(): unexpected exception" ); } } @@ -613,7 +603,7 @@ namespace sfx2 { } }; - typedef ::std::hash_map< ::rtl::OUString, int, hashOUString, equalOUString > KeywordInfo; + typedef ::boost::unordered_map< ::rtl::OUString, int, hashOUString, equalOUString > KeywordInfo; } #define UNIFY_AND_INSERT_TOKEN( aToken ) \ @@ -653,7 +643,7 @@ void IndexTabPage_Impl::InitializeIndex() aURL += ::rtl::OUString( sFactory ); String aTemp = aURL; - AppendConfigToken_Impl( aTemp, sal_True ); + AppendConfigToken( aTemp, sal_True ); aURL = aTemp; Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); @@ -742,7 +732,7 @@ void IndexTabPage_Impl::InitializeIndex() } catch( Exception& ) { - DBG_ERROR( "IndexTabPage_Impl::InitializeIndex(): unexpected exception" ); + OSL_FAIL( "IndexTabPage_Impl::InitializeIndex(): unexpected exception" ); } aIndexCB.SetUpdateMode( sal_True ); @@ -902,7 +892,7 @@ sal_Bool IndexTabPage_Impl::HasKeyword() const } // ----------------------------------------------------------------------- -//added by BerryJia for fixing Bug98251, 2002-12-11 + sal_Bool IndexTabPage_Impl::HasKeywordIgnoreCase() { sal_Bool bRet = sal_False; @@ -1098,7 +1088,7 @@ IMPL_LINK( SearchTabPage_Impl, SearchHdl, PushButton*, EMPTYARG ) if ( !aFullWordsCB.IsChecked() ) aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, true ); aSearchURL += aSearchText; - AppendConfigToken_Impl( aSearchURL, sal_False ); + AppendConfigToken( aSearchURL, sal_False ); if ( aScopeCB.IsChecked() ) aSearchURL += DEFINE_CONST_UNICODE("&Scope=Heading"); Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aSearchURL ); @@ -1315,7 +1305,7 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction ) RemoveEntry( nPos ); rtl::OUString aImageURL = IMAGE_URL; aImageURL += INetURLObject( *pURL ).GetHost(); - nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( aImageURL ) ); + nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( aImageURL, false ) ); SetEntryData( nPos, (void*)(sal_uIntPtr)( new String( *pURL ) ) ); SelectEntryPos( nPos ); delete pURL; @@ -1488,7 +1478,7 @@ void BookmarksTabPage_Impl::AddBookmarks( const String& rTitle, const String& rU { rtl::OUString aImageURL = IMAGE_URL; aImageURL += INetURLObject( rURL ).GetHost(); - sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( aImageURL ) ); + sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( aImageURL, false ) ); aBookmarksBox.SetEntryData( nPos, (void*)(sal_uIntPtr)( new String( rURL ) ) ); } @@ -1523,7 +1513,7 @@ sal_Bool SfxHelpWindow_Impl::splitHelpURL(const ::rtl::OUString& sHelpURL, sHelpURL.append(sFactory); sHelpURL.append(sContent); String sURL = String(sHelpURL.makeStringAndClear()); - AppendConfigToken_Impl(sURL, bUseQuestionMark); + AppendConfigToken(sURL, bUseQuestionMark); if (sAnchor.getLength()) sURL += String(sAnchor); return ::rtl::OUString(sURL); @@ -1535,7 +1525,6 @@ void SfxHelpWindow_Impl::loadHelpContent(const ::rtl::OUString& sHelpURL, sal_Bo if (!xLoader.is()) return; - // --> PB 2007-03-12 #134037# // If a print job runs do not open a new page Reference< XFrame > xTextFrame = pTextWin->getFrame(); Reference< XController > xTextController ; @@ -1546,7 +1535,6 @@ void SfxHelpWindow_Impl::loadHelpContent(const ::rtl::OUString& sHelpURL, sal_Bo xTextController->suspend( sal_False ); return; } - // <-- // save url to history if (bAddToHistory) @@ -1563,7 +1551,6 @@ void SfxHelpWindow_Impl::loadHelpContent(const ::rtl::OUString& sHelpURL, sal_Bo if (xContent.is()) { bSuccess = sal_True; -// break; } } catch(const RuntimeException&) @@ -1644,7 +1631,7 @@ SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl() void SfxHelpIndexWindow_Impl::Initialize() { String aHelpURL = HELP_URL; - AppendConfigToken_Impl( aHelpURL, sal_True ); + AppendConfigToken( aHelpURL, sal_True ); Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpURL ); const ::rtl::OUString* pFacs = aFactories.getConstArray(); sal_uInt32 i, nCount = aFactories.getLength(); @@ -1786,7 +1773,7 @@ IMPL_LINK( SfxHelpIndexWindow_Impl, KeywordHdl, IndexTabPage_Impl *, EMPTYARG ) { // keyword found on index? sal_Bool bIndex = pIPage->HasKeyword(); - //The following two lines are added by BerryJia for fixing Bug98251, 2002-12-11 + if( !bIndex) bIndex = pIPage->HasKeywordIgnoreCase(); // then set index or search page as current. @@ -2175,34 +2162,35 @@ sal_Bool SfxHelpTextWindow_Impl::HasSelection() const void SfxHelpTextWindow_Impl::InitToolBoxImages() { sal_Bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge(); - sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - aIndexOnImage = Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_INDEX_ON : IMG_HELP_TOOLBOX_L_INDEX_ON - : bHiContrast ? IMG_HELP_TOOLBOX_HC_INDEX_ON : IMG_HELP_TOOLBOX_INDEX_ON ) ); - aIndexOffImage = Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_INDEX_OFF : IMG_HELP_TOOLBOX_L_INDEX_OFF - : bHiContrast ? IMG_HELP_TOOLBOX_HC_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) ); + + aIndexOnImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_ON : IMG_HELP_TOOLBOX_INDEX_ON ) ); + aIndexOffImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) ); + aToolBox.SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage ); - aToolBox.SetItemImage( TBI_BACKWARD, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_PREV : IMG_HELP_TOOLBOX_L_PREV - : bHiContrast ? IMG_HELP_TOOLBOX_HC_PREV : IMG_HELP_TOOLBOX_PREV ) ) ); - aToolBox.SetItemImage( TBI_FORWARD, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_NEXT : IMG_HELP_TOOLBOX_L_NEXT - : bHiContrast ? IMG_HELP_TOOLBOX_HC_NEXT : IMG_HELP_TOOLBOX_NEXT ) ) ); - aToolBox.SetItemImage( TBI_START, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_START : IMG_HELP_TOOLBOX_L_START - : bHiContrast ? IMG_HELP_TOOLBOX_HC_START : IMG_HELP_TOOLBOX_START ) ) ); - aToolBox.SetItemImage( TBI_PRINT, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_PRINT : IMG_HELP_TOOLBOX_L_PRINT - : bHiContrast ? IMG_HELP_TOOLBOX_HC_PRINT : IMG_HELP_TOOLBOX_PRINT ) ) ); - aToolBox.SetItemImage( TBI_BOOKMARKS, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_BOOKMARKS : IMG_HELP_TOOLBOX_L_BOOKMARKS - : bHiContrast ? IMG_HELP_TOOLBOX_HC_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) ) ); - aToolBox.SetItemImage( TBI_SEARCHDIALOG, Image( SfxResId( - bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_SEARCHDIALOG : IMG_HELP_TOOLBOX_L_SEARCHDIALOG - : bHiContrast ? IMG_HELP_TOOLBOX_HC_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) ) ); + aToolBox.SetItemImage( TBI_BACKWARD, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PREV : IMG_HELP_TOOLBOX_PREV ) ) + ); + + aToolBox.SetItemImage( TBI_FORWARD, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_NEXT : IMG_HELP_TOOLBOX_NEXT ) ) + ); + + aToolBox.SetItemImage( TBI_START, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_START : IMG_HELP_TOOLBOX_START ) ) + ); + + aToolBox.SetItemImage( TBI_PRINT, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PRINT : IMG_HELP_TOOLBOX_PRINT ) ) + ); + + aToolBox.SetItemImage( TBI_BOOKMARKS, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) ) + ); + + aToolBox.SetItemImage( TBI_SEARCHDIALOG, + Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) ) + ); Size aSize = aToolBox.CalcWindowSizePixel(); aSize.Height() += TOOLBOX_OFFSET; @@ -2353,7 +2341,7 @@ Reference< XTextRange > SfxHelpTextWindow_Impl::getCursor() const } catch( Exception& ) { - DBG_ERROR( "SfxHelpTextWindow_Impl::getCursor(): unexpected exception" ); + OSL_FAIL( "SfxHelpTextWindow_Impl::getCursor(): unexpected exception" ); } return xCursor; @@ -2421,7 +2409,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, SelectHdl, Timer*, EMPTYARG ) } catch( Exception& ) { - DBG_ERROR( "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" ); + OSL_FAIL( "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" ); } return 1; @@ -2517,7 +2505,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg ) } catch( Exception& ) { - DBG_ERROR( "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" ); + OSL_FAIL( "SfxHelpTextWindow_Impl::SelectHdl(): unexpected exception" ); } return 0; @@ -2581,7 +2569,6 @@ long SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt ) if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox ) { - sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Point aPos; if ( pCmdEvt->IsMouseEvent() ) aPos = pCmdEvt->GetMousePosPixel(); @@ -2590,33 +2577,44 @@ long SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt ) aPos.Y() += pTextWin->GetPosPixel().Y(); PopupMenu aMenu; if ( bIsIndexOn ) - aMenu.InsertItem( TBI_INDEX, aIndexOffText, Image( SfxResId( - bHiContrast ? IMG_HELP_TOOLBOX_HC_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) ) ); + aMenu.InsertItem( TBI_INDEX, aIndexOffText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ) ); else - aMenu.InsertItem( TBI_INDEX, aIndexOnText, Image( SfxResId( - bHiContrast ? IMG_HELP_TOOLBOX_HC_INDEX_ON : IMG_HELP_TOOLBOX_INDEX_ON ) ) ); + aMenu.InsertItem( TBI_INDEX, aIndexOnText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ) ); + aMenu.SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX ); aMenu.InsertSeparator(); - aMenu.InsertItem( TBI_BACKWARD, String( SfxResId( STR_HELP_BUTTON_PREV ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_PREV : IMG_HELP_TOOLBOX_PREV ) ) ); + aMenu.InsertItem( TBI_BACKWARD, + String( SfxResId( STR_HELP_BUTTON_PREV ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_PREV ) ) + ); aMenu.SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD ); aMenu.EnableItem( TBI_BACKWARD, pHelpWin->HasHistoryPredecessor() ); - aMenu.InsertItem( TBI_FORWARD, String( SfxResId( STR_HELP_BUTTON_NEXT ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_NEXT : IMG_HELP_TOOLBOX_NEXT ) ) ); + aMenu.InsertItem( TBI_FORWARD, + String( SfxResId( STR_HELP_BUTTON_NEXT ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_NEXT ) ) + ); aMenu.SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD ); aMenu.EnableItem( TBI_FORWARD, pHelpWin->HasHistorySuccessor() ); - aMenu.InsertItem( TBI_START, String( SfxResId( STR_HELP_BUTTON_START ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_START : IMG_HELP_TOOLBOX_START ) ) ); + aMenu.InsertItem( TBI_START, + String( SfxResId( STR_HELP_BUTTON_START ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_START ) ) + ); aMenu.SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START ); aMenu.InsertSeparator(); - aMenu.InsertItem( TBI_PRINT, String( SfxResId( STR_HELP_BUTTON_PRINT ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_PRINT : IMG_HELP_TOOLBOX_PRINT ) ) ); + aMenu.InsertItem( TBI_PRINT, + String( SfxResId( STR_HELP_BUTTON_PRINT ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_PRINT ) ) + ); aMenu.SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT ); - aMenu.InsertItem( TBI_BOOKMARKS, String( SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) ) ); + aMenu.InsertItem( TBI_BOOKMARKS, + String( SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_BOOKMARKS ) ) + ); aMenu.SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS ); - aMenu.InsertItem( TBI_SEARCHDIALOG, String( SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) ) ); + aMenu.InsertItem( TBI_SEARCHDIALOG, + String( SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_SEARCHDIALOG ) ) + ); aMenu.SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG ); aMenu.InsertSeparator(); aMenu.InsertItem( TBI_SELECTIONMODE, String( SfxResId( STR_HELP_MENU_TEXT_SELECTION_MODE ) ) ); @@ -2638,8 +2636,10 @@ long SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt ) aMenu.CheckItem(TBI_SELECTIONMODE, bCheck); } aMenu.InsertSeparator(); - aMenu.InsertItem( TBI_COPY, String( SfxResId( STR_HELP_MENU_TEXT_COPY ) ), - Image( SfxResId( bHiContrast ? IMG_HELP_TOOLBOX_HC_COPY : IMG_HELP_TOOLBOX_COPY ) ) ); + aMenu.InsertItem( TBI_COPY, + String( SfxResId( STR_HELP_MENU_TEXT_COPY ) ), + Image( SfxResId( IMG_HELP_TOOLBOX_COPY ) ) + ); aMenu.SetHelpId( TBI_COPY, ".uno:Copy" ); aMenu.EnableItem( TBI_COPY, HasSelection() ); @@ -2918,7 +2918,6 @@ void SfxHelpWindow_Impl::MakeLayout() Some VCL-patches could not solve this problem so I've established the workaround: resize the help window if it's visible .-) */ -// pScreenWin->Hide(); ::com::sun::star::awt::Rectangle aRect = xWindow->getPosSize(); sal_Int32 nOldWidth = bIndex ? nCollapseWidth : nExpandWidth; @@ -2935,8 +2934,6 @@ void SfxHelpWindow_Impl::MakeLayout() } else if ( aWinPos.X() > 0 && aWinPos.Y() > 0 ) pScreenWin->SetPosPixel( aWinPos ); - -// pScreenWin->Show(); } Clear(); @@ -3085,10 +3082,7 @@ IMPL_LINK( SfxHelpWindow_Impl, OpenHdl, SfxHelpIndexWindow_Impl* , EMPTYARG ) ::rtl::OUString sHelpURL; -// INetURLObject aObj(aEntry); -// sal_Bool bComplete = ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP ); - - sal_Bool bComplete = rtl::OUString(aEntry).toAsciiLowerCase().match(rtl::OUString::createFromAscii("vnd.sun.star.help"),0); + bool bComplete = rtl::OUString(aEntry).toAsciiLowerCase().match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.help")),0); if (bComplete) sHelpURL = ::rtl::OUString(aEntry); @@ -3189,7 +3183,7 @@ void SfxHelpWindow_Impl::openDone(const ::rtl::OUString& sURL , } catch( Exception& ) { - DBG_ERROR( "SfxHelpWindow_Impl::OpenDoneHdl(): unexpected exception" ); + OSL_FAIL( "SfxHelpWindow_Impl::OpenDoneHdl(): unexpected exception" ); } // When the SearchPage opens the help doc, then select all words, which are equal to its text @@ -3400,7 +3394,7 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId ) } catch( Exception& ) { - DBG_ERROR( "SfxHelpWindow_Impl::DoAction(): unexpected exception" ); + OSL_FAIL( "SfxHelpWindow_Impl::DoAction(): unexpected exception" ); } } break; @@ -3490,3 +3484,4 @@ void SfxAddHelpBookmarkDialog_Impl::SetTitle( const String& rTitle ) aTitleED.SetSelection( Selection( 0, rTitle.Len() ) ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/newhelp.hrc b/sfx2/source/appl/newhelp.hrc index 7bb9aa85678c..7bb9aa85678c 100644..100755 --- a/sfx2/source/appl/newhelp.hrc +++ b/sfx2/source/appl/newhelp.hrc diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index fb34640f93ef..ff983671fa8e 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -188,7 +189,7 @@ public: inline void SetKeywordHdl( const Link& rLink ) { aKeywordLink = rLink; } void SetKeyword( const String& rKeyword ); sal_Bool HasKeyword() const; - sal_Bool HasKeywordIgnoreCase(); //added by BerryJia for fixing Bug98251, 2002-12-11 + sal_Bool HasKeywordIgnoreCase(); void OpenKeyword(); inline void SelectExecutableEntry() { aIndexCB.SelectExecutableEntry(); } @@ -610,5 +611,9 @@ public: inline String GetTitle() const { return aTitleED.GetText(); } }; +/// Appends ?Language=xy&System=abc to the help URL in rURL +void AppendConfigToken( String& rURL, sal_Bool bQuestionMark, const rtl::OUString &rLang = rtl::OUString() ); + #endif // #ifndef INCLUDED_SFX_NEWHELP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/newhelp.src b/sfx2/source/appl/newhelp.src index 88dfed8ad71e..da59e0a35f07 100644 --- a/sfx2/source/appl/newhelp.src +++ b/sfx2/source/appl/newhelp.src @@ -217,113 +217,118 @@ Image IMG_HELP_TOOLBOX_INDEX_ON ImageBitmap = Bitmap { File = "indexon_small.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_INDEX_OFF { ImageBitmap = Bitmap { File = "indexoff_small.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_START { ImageBitmap = Bitmap { File = "sc06303.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_PREV { ImageBitmap = Bitmap { File = "sc06301.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_NEXT { ImageBitmap = Bitmap { File = "sc06300.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_PRINT { ImageBitmap = Bitmap { File = "sc05504.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_BOOKMARKS { ImageBitmap = Bitmap { File = "favourite.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_SEARCHDIALOG { ImageBitmap = Bitmap { File = "sc05961.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_COPY { ImageBitmap = Bitmap { File = "sc05711.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_CONTENT_BOOK_OPEN { ImageBitmap = Bitmap { File = "hlpbookopen.bmp" ; }; MASKCOLOR_MAGENTA }; -Image IMG_HELP_CONTENT_BOOK_OPEN_HC -{ - ImageBitmap = Bitmap { File = "hlpbookopen_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; + Image IMG_HELP_CONTENT_BOOK_CLOSED { ImageBitmap = Bitmap { File = "hlpbookclosed.bmp" ; }; MASKCOLOR_MAGENTA }; -Image IMG_HELP_CONTENT_BOOK_CLOSED_HC -{ - ImageBitmap = Bitmap { File = "hlpbookclosed_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; + Image IMG_HELP_CONTENT_DOC { ImageBitmap = Bitmap { File = "hlpdoc.bmp" ; }; MASKCOLOR_MAGENTA }; -Image IMG_HELP_CONTENT_DOC_HC -{ - ImageBitmap = Bitmap { File = "hlpdoc_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; String STR_HELP_WINDOW_TITLE { Text [ en-US ] = "%PRODUCTNAME Help"; }; + String STR_HELP_BUTTON_INDEX_ON { Text [ en-US ] = "Show Navigation Pane"; }; + String STR_HELP_BUTTON_INDEX_OFF { Text [ en-US ] = "Hide Navigation Pane"; }; + String STR_HELP_BUTTON_START { Text [ en-US ] = "First Page"; }; + String STR_HELP_BUTTON_PREV { Text [ en-US ] = "Previous Page"; }; + String STR_HELP_BUTTON_NEXT { Text [ en-US ] = "Next Page"; }; + String STR_HELP_BUTTON_PRINT { Text [ en-US ] = "Print..."; }; + String STR_HELP_BUTTON_ADDBOOKMARK { Text [ en-US ] = "Add to Bookmarks..."; }; + String STR_HELP_BUTTON_SEARCHDIALOG { Text [ en-US ] = "Find on this Page..."; }; + String STR_HELP_BUTTON_SOURCEVIEW { Text [ en-US ] = "HTML Source"; @@ -333,18 +338,22 @@ String STR_HELP_FIRST_MESSAGE { Text [ en-US ] = "The Help is being started..."; }; + String STR_HELP_FIRST_HTML { Text = "<html></head><body><center><br></br><br></br><p><tt>%1</tt></center></body></html>"; }; + String STR_HELP_MENU_TEXT_SELECTION_MODE { Text [ en-US ] = "Select Text"; }; + String STR_HELP_MENU_TEXT_COPY { Text [ en-US ] = "~Copy" ; }; + ModalDialog DLG_HELP_ADDBOOKMARK { HelpID = "sfx2:ModalDialog:DLG_HELP_ADDBOOKMARK"; @@ -440,144 +449,60 @@ InfoBox RID_INFO_NOSEARCHTEXTFOUND Message [ en-US ] = "The text you entered was not found."; }; -Image IMG_HELP_TOOLBOX_HC_INDEX_ON -{ - ImageBitmap = Bitmap { File = "indexon_small_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_INDEX_OFF -{ - ImageBitmap = Bitmap { File = "indexoff_small_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_START -{ - ImageBitmap = Bitmap { File = "sch06303.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_PREV -{ - ImageBitmap = Bitmap { File = "sch06301.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_NEXT -{ - ImageBitmap = Bitmap { File = "sch06300.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_PRINT -{ - ImageBitmap = Bitmap { File = "sch05504.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_BOOKMARKS -{ - ImageBitmap = Bitmap { File = "favourite_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_SEARCHDIALOG -{ - ImageBitmap = Bitmap { File = "sch05961.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HC_COPY -{ - ImageBitmap = Bitmap { File = "sch05711.bmp" ; }; - MASKCOLOR_MAGENTA -}; - Image IMG_HELP_TOOLBOX_L_INDEX_ON { ImageBitmap = Bitmap { File = "indexon_big.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_INDEX_OFF { ImageBitmap = Bitmap { File = "indexoff_big.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_START { ImageBitmap = Bitmap { File = "lc06303.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_PREV { ImageBitmap = Bitmap { File = "lc06301.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_NEXT { ImageBitmap = Bitmap { File = "lc06300.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_PRINT { ImageBitmap = Bitmap { File = "lc05504.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_BOOKMARKS { ImageBitmap = Bitmap { File = "favourite_big.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_SEARCHDIALOG { ImageBitmap = Bitmap { File = "lc05961.bmp" ; }; MASKCOLOR_MAGENTA }; + Image IMG_HELP_TOOLBOX_L_COPY { ImageBitmap = Bitmap { File = "lc05711.bmp" ; }; MASKCOLOR_MAGENTA }; -Image IMG_HELP_TOOLBOX_HCL_INDEX_ON -{ - ImageBitmap = Bitmap { File = "indexon_big_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_INDEX_OFF -{ - ImageBitmap = Bitmap { File = "indexoff_big_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_START -{ - ImageBitmap = Bitmap { File = "lch06303.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_PREV -{ - ImageBitmap = Bitmap { File = "lch06301.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_NEXT -{ - ImageBitmap = Bitmap { File = "lch06300.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_PRINT -{ - ImageBitmap = Bitmap { File = "lch05504.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_BOOKMARKS -{ - ImageBitmap = Bitmap { File = "favourite_big_h.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_SEARCHDIALOG -{ - ImageBitmap = Bitmap { File = "lch05961.bmp" ; }; - MASKCOLOR_MAGENTA -}; -Image IMG_HELP_TOOLBOX_HCL_COPY -{ - ImageBitmap = Bitmap { File = "lch05711.bmp" ; }; - MASKCOLOR_MAGENTA -}; - CheckBox RID_HELP_ONSTARTUP_BOX { HelpId = HID_HELP_ONSTARTUP_BOX; @@ -585,8 +510,8 @@ CheckBox RID_HELP_ONSTARTUP_BOX TabStop = TRUE; Size = MAP_APPFONT ( 200 , 10 ) ; }; + String RID_HELP_ONSTARTUP_TEXT { Text [ en-US ] = "~Display %PRODUCTNAME %MODULENAME Help at Startup"; }; - diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 6bd233949ddf..25d9857c53c4 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -126,12 +127,12 @@ short SvxOpenGraphicDialog::Execute() { if( GetPath().Len() ) { - GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter(); + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); INetURLObject aObj( GetPath() ); // check whether we can load the graphic String aCurFilter( GetCurrentFilter() ); - sal_uInt16 nFormatNum = pFilter->GetImportFormatNumber( aCurFilter ); + sal_uInt16 nFormatNum = rFilter.GetImportFormatNumber( aCurFilter ); sal_uInt16 nRetFormat = 0; sal_uInt16 nFound = USHRT_MAX; @@ -143,23 +144,23 @@ short SvxOpenGraphicDialog::Execute() SvStream* pStream = aMed.GetInStream(); if( pStream ) - nImpRet = pFilter->CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, nFormatNum, &nRetFormat ); + nImpRet = rFilter.CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, nFormatNum, &nRetFormat ); else - nImpRet = pFilter->CanImportGraphic( aObj, nFormatNum, &nRetFormat ); + nImpRet = rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat ); if ( GRFILTER_OK != nImpRet ) { if ( !pStream ) - nImpRet = pFilter->CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); + nImpRet = rFilter.CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); else - nImpRet = pFilter->CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, + nImpRet = rFilter.CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); } } else { - if( (nImpRet=pFilter->CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != GRFILTER_OK ) - nImpRet = pFilter->CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); + if( (nImpRet=rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != GRFILTER_OK ) + nImpRet = rFilter.CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); } if ( GRFILTER_OK == nImpRet ) @@ -174,9 +175,9 @@ short SvxOpenGraphicDialog::Execute() else { // setup appropriate filter (so next time, it will work) - if( pFilter->GetImportFormatCount() ) + if( rFilter.GetImportFormatCount() ) { - String aFormatName(pFilter->GetImportFormatName(nFound)); + String aFormatName(rFilter.GetImportFormatName(nFound)); SetCurrentFilter(aFormatName); } @@ -210,10 +211,10 @@ void SvxOpenGraphicDialog::EnableLink( sal_Bool state ) { mpImpl->xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, state ); } - catch(IllegalArgumentException) + catch(const IllegalArgumentException&) { #ifdef DBG_UTIL - DBG_ERROR( "Cannot enable \"link\" checkbox" ); + OSL_FAIL( "Cannot enable \"link\" checkbox" ); #endif } } @@ -229,10 +230,10 @@ void SvxOpenGraphicDialog::AsLink(sal_Bool bState) Any aAny; aAny <<= bState; mpImpl->xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aAny ); } - catch(IllegalArgumentException) + catch(const IllegalArgumentException&) { #ifdef DBG_UTIL - DBG_ERROR( "Cannot check \"link\" checkbox" ); + OSL_FAIL( "Cannot check \"link\" checkbox" ); #endif } } @@ -250,10 +251,10 @@ sal_Bool SvxOpenGraphicDialog::IsAsLink() const return aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_False; } } - catch(IllegalArgumentException) + catch(const IllegalArgumentException&) { #ifdef DBG_UTIL - DBG_ERROR( "Cannot access \"link\" checkbox" ); + OSL_FAIL( "Cannot access \"link\" checkbox" ); #endif } @@ -290,3 +291,5 @@ void SvxOpenGraphicDialog::SetControlHelpIds( const sal_Int16* _pControlId, cons } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/panelist.hxx b/sfx2/source/appl/panelist.hxx index 7cbf2a19e628..e5924071a64e 100644 --- a/sfx2/source/appl/panelist.hxx +++ b/sfx2/source/appl/panelist.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,3 +49,5 @@ namespace sfx2 } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 855369c11bc9..7820b46eb713 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,6 +50,8 @@ #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <svtools/helpopt.hxx> @@ -67,7 +70,6 @@ #include <svtools/sfxecode.hxx> #define _SVSTDARR_STRINGSDTOR -#define _SVSTDARR_ULONGSSORT #include <svl/svstdarr.hxx> #include "newhelp.hxx" @@ -87,12 +89,11 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::system; #define ERROR_TAG String( DEFINE_CONST_UNICODE("Error: ") ) #define PATH_TAG String( DEFINE_CONST_UNICODE("\nPath: ") ) -// class NoHelpErrorBox -------------------------------------------------- - class NoHelpErrorBox : public ErrorBox { public: @@ -113,25 +114,28 @@ void NoHelpErrorBox::RequestHelp( const HelpEvent& ) // do nothing, because no help available } -// ----------------------------------------------------------------------- - #define STARTERLIST 0 -rtl::OUString HelpLocaleString() +static bool impl_hasHelpInstalled( const rtl::OUString &rLang ); + +/// Return the locale we prefer for displaying help +static rtl::OUString HelpLocaleString() { static rtl::OUString aLocaleStr; if (!aLocaleStr.getLength()) { + const rtl::OUString aEnglish( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); // detect installed locale Any aLocale = - ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( + ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); aLocale >>= aLocaleStr; bool bOk = aLocaleStr.getLength() != 0; - if ( bOk ) + if ( !bOk ) + aLocaleStr = aEnglish; + else { rtl::OUString aBaseInstallPath; - // utl::Bootstrap::PathStatus aBaseLocateResult = utl::Bootstrap::locateBaseInstallation(aBaseInstallPath); static const char *szHelpPath = "/help/"; @@ -155,15 +159,19 @@ rtl::OUString HelpLocaleString() } } } - if (!bOk) - aLocaleStr = rtl::OUString( DEFINE_CONST_UNICODE("en") ); + // if not OK, and not even English installed, we use online help, and + // have to preserve the full locale name + if ( !bOk && impl_hasHelpInstalled( aEnglish ) ) + aLocaleStr = aEnglish; } return aLocaleStr; } -void AppendConfigToken_Impl( String& rURL, sal_Bool bQuestionMark ) +void AppendConfigToken( String& rURL, sal_Bool bQuestionMark, const rtl::OUString &rLang ) { - ::rtl::OUString aLocaleStr(HelpLocaleString()); + ::rtl::OUString aLocaleStr( rLang ); + if ( !aLocaleStr.getLength() ) + aLocaleStr = HelpLocaleString(); // query part exists? if ( bQuestionMark ) @@ -179,24 +187,27 @@ void AppendConfigToken_Impl( String& rURL, sal_Bool bQuestionMark ) rURL += DEFINE_CONST_UNICODE("&System="); rURL += SvtHelpOptions().GetSystem(); -} + static rtl::OUString aVersion; + if ( aVersion.isEmpty() ) + aVersion = utl::Bootstrap::getProductVersion(); -// ----------------------------------------------------------------------- + if ( !aVersion.isEmpty() ) + { + rURL += DEFINE_CONST_UNICODE( "&Version=" ); + rURL += String( aVersion ); + } +} sal_Bool GetHelpAnchor_Impl( const String& _rURL, String& _rAnchor ) { sal_Bool bRet = sal_False; ::rtl::OUString sAnchor; - // --> OD 2009-07-01 #159496# - // do not release solar mutex due to crash regarding accessibility -// sal_uIntPtr nSolarCount = Application::ReleaseSolarMutex(); - // <-- try { ::ucbhelper::Content aCnt( INetURLObject( _rURL ).GetMainURL( INetURLObject::NO_DECODE ), Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); - if ( ( aCnt.getPropertyValue( ::rtl::OUString::createFromAscii( "AnchorName" ) ) >>= sAnchor ) ) + if ( ( aCnt.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorName")) ) >>= sAnchor ) ) { if ( sAnchor.getLength() > 0 ) @@ -213,15 +224,10 @@ sal_Bool GetHelpAnchor_Impl( const String& _rURL, String& _rAnchor ) catch( ::com::sun::star::uno::Exception& ) { } - // --> OD 2009-07-01 #159496# -// Application::AcquireSolarMutex( nSolarCount ); - // <-- return bRet; } -// ----------------------------------------------------------------------- - class SfxHelpOptions_Impl : public utl::ConfigItem { private: @@ -254,10 +260,8 @@ static Sequence< ::rtl::OUString > GetPropertyNames() return aNames; } -// ----------------------------------------------------------------------- - SfxHelpOptions_Impl::SfxHelpOptions_Impl() - : ConfigItem( ::rtl::OUString::createFromAscii("Office.SFX/Help") ) + : ConfigItem( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.SFX/Help")) ) { Sequence< ::rtl::OUString > aNames = GetPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); @@ -317,8 +321,6 @@ void SfxHelpOptions_Impl::Commit() { } -// class SfxHelp_Impl ---------------------------------------------------- - class SfxHelp_Impl { private: @@ -355,7 +357,7 @@ void SfxHelp_Impl::Load() // fill modules list // create the help url (empty, without module and helpid) String sHelpURL( DEFINE_CONST_UNICODE("vnd.sun.star.help://") ); - AppendConfigToken_Impl( sHelpURL, sal_True ); + AppendConfigToken( sHelpURL, sal_True ); // open ucb content and get the list of the help modules // the list contains strings with three tokens "ui title \t type \t url" @@ -407,201 +409,6 @@ sal_Bool SfxHelp_Impl::IsHelpInstalled() return ( m_aModulesList.begin() != m_aModulesList.end() ); } -// class SfxHelp --------------------------------------------------------- -/* some test code for HID conversion - please don't remove - -#include <tools/stream.hxx> -void TestHids() -{ - static const char* aModules[] = - { - "swriter", - "scalc", - "simpress", - "sdraw", - "sdatabase", - "smath", - "schart", - "sbasic" - }; - - SvFileStream* pOut[] = - { - 0,0,0,0,0,0,0,0,0 - }; - - String aIn = String::CreateFromAscii("/data/OOo/replacer/hidsin.lst"); - String aOut = String::CreateFromAscii("/data/OOo/replacer/"); - SvFileStream aInStrm( aIn, STREAM_READ ); - ByteString aBuffer; - while ( aInStrm.ReadLine( aBuffer ) ) - { - ByteString aHid = aBuffer.GetToken(0, ' '); - ByteString aNr = aBuffer.GetToken(1, ' '); - bool bFound=false; - for (sal_Int32 n= 0; n<8; n++) - { - bFound = false; - String aHelpURL = SfxHelp::CreateHelpURL( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ); - if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) - { - if (!pOut[n]) - { - String aTmp( aOut ); - aTmp += String( aModules[n], RTL_TEXTENCODING_UTF8 ); - aTmp += String::CreateFromAscii(".lst"); - pOut[n] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC ); - } - pOut[n]->WriteLine( aHid ); - bFound = true; - break; - } - } - - if (!bFound) - { - if (!pOut[8]) - { - String aTmp( aOut ); - aTmp += String( "notfound", RTL_TEXTENCODING_UTF8 ); - aTmp += String::CreateFromAscii(".lst"); - pOut[8] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC ); - } - pOut[8]->WriteLine( aHid ); - } - } - - for (sal_Int32 n= 0; n<9; n++) - DELETEZ( pOut[n] ); -} - -void TestHids2() -{ - static const char* aModules[] = - { - "swriter", - "scalc", - "simpress", - "smath", - "sbasic" - }; - - String aOut = String::CreateFromAscii("/data/OOo/replacer/"); - aOut += String::CreateFromAscii("lost.lst"); - SvFileStream aOutStrm( aOut, STREAM_WRITE | STREAM_TRUNC ); - for (sal_Int32 n= 0; n<5; n++) - { - String aIn = String::CreateFromAscii("/data/OOo/replacer/help/"); - aIn += String::CreateFromAscii( aModules[n] ); - aIn += String::CreateFromAscii(".lst"); - SvFileStream aInStrm( aIn, STREAM_READ ); - ByteString aBuffer; - while ( aInStrm.ReadLine( aBuffer ) ) - { - String aHelpURL = SfxHelp::CreateHelpURL( String( aBuffer, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ); - if ( SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) - aOutStrm.WriteLine( aBuffer ); - } - } -} - -#include <tools/stream.hxx> -void TestHids3() -{ - static const char* aModules[] = - { - "swriter", - "scalc", - "simpress", - "sdraw", - "sdatabase", - "smath", - "schart", - "sbasic" - }; - - SvFileStream* pOut[] = - { - 0,0,0,0,0,0,0,0,0 - }; - - String aIn = String::CreateFromAscii("/data/OOo/replacer/hidsin.lst"); - String aOut = String::CreateFromAscii("/data/OOo/replacer/quickhelp/"); - SvFileStream aInStrm( aIn, STREAM_READ ); - ByteString aBuffer; - while ( aInStrm.ReadLine( aBuffer ) ) - { - ByteString aHid = aBuffer.GetToken(0, ' '); - ByteString aNr = aBuffer.GetToken(1, ' '); - bool bFound=false; - for (sal_Int32 n= 0; n<8; n++) - { - bFound = false; - String aHelpURL = SfxHelp::CreateHelpURL( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ); - if ( SfxContentHelper::GetActiveHelpString( aHelpURL ).Len() ) -// if ( SfxHelp_Impl::GetHelpText( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ).Len() ) - { - if (!pOut[n]) - { - String aTmp( aOut ); - aTmp += String( aModules[n], RTL_TEXTENCODING_UTF8 ); - aTmp += String::CreateFromAscii(".lst"); - pOut[n] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC ); - } - pOut[n]->WriteLine( aHid ); - bFound = true; - break; - } - } - - if (!bFound) - { - if (!pOut[8]) - { - String aTmp( aOut ); - aTmp += String( "notfound", RTL_TEXTENCODING_UTF8 ); - aTmp += String::CreateFromAscii(".lst"); - pOut[8] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC ); - } - pOut[8]->WriteLine( aHid ); - } - } - - for (sal_Int32 n= 0; n<9; n++) - DELETEZ( pOut[n] ); -} - -void TestHids4() -{ - static const char* aModules[] = - { - "swriter", - "scalc", - "simpress", - "smath", - "sbasic" - }; - - String aOut = String::CreateFromAscii("/data/OOo/replacer/quickhelp/"); - aOut += String::CreateFromAscii("lost.lst"); - SvFileStream aOutStrm( aOut, STREAM_WRITE | STREAM_TRUNC ); - for (sal_Int32 n= 0; n<5; n++) - { - String aIn = String::CreateFromAscii("/data/OOo/replacer/quickhelp/"); - aIn += String::CreateFromAscii( aModules[n] ); - aIn += String::CreateFromAscii(".lst"); - SvFileStream aInStrm( aIn, STREAM_READ ); - ByteString aBuffer; - while ( aInStrm.ReadLine( aBuffer ) ) - { - String aHelpURL = SfxHelp::CreateHelpURL( String( aBuffer, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ); - if ( !SfxContentHelper::GetActiveHelpString( aHelpURL ).Len() ) - aOutStrm.WriteLine( aBuffer ); - } - } -} -*/ - SfxHelp::SfxHelp() : bIsDebug( sal_False ), @@ -723,7 +530,7 @@ String SfxHelp::GetHelpModuleName_Impl() xCont->getByName( aModuleIdentifier ) >>= lProps; for ( sal_Int32 i = 0; i < lProps.getLength(); ++i ) { - if ( lProps[i].Name.equalsAscii("ooSetupFactoryShortName") ) + if ( lProps[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooSetupFactoryShortName")) ) { lProps[i].Value >>= aFactoryShortName; break; @@ -740,26 +547,26 @@ String SfxHelp::GetHelpModuleName_Impl() if ( aFactoryShortName.getLength() > 0 ) { // Map some module identifiers to their "real" help module string. - if ( aFactoryShortName.equalsAscii( "chart2" ) ) + if ( aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("chart2")) ) aFactoryShortName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "schart" ) ); - else if ( aFactoryShortName.equalsAscii( "BasicIDE" ) ) + else if ( aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BasicIDE")) ) aFactoryShortName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sbasic" ) ); - else if ( aFactoryShortName.equalsAscii( "sweb" ) - || aFactoryShortName.equalsAscii( "sglobal" ) - || aFactoryShortName.equalsAscii( "swxform" ) ) + else if ( aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sweb")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sglobal")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("swxform")) ) aFactoryShortName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "swriter" ) ); - else if ( aFactoryShortName.equalsAscii( "dbquery" ) - || aFactoryShortName.equalsAscii( "dbbrowser" ) - || aFactoryShortName.equalsAscii( "dbrelation" ) - || aFactoryShortName.equalsAscii( "dbtable" ) - || aFactoryShortName.equalsAscii( "dbapp" ) - || aFactoryShortName.equalsAscii( "dbreport" ) - || aFactoryShortName.equalsAscii( "swreport" ) - || aFactoryShortName.equalsAscii( "dbbrowser" ) - || aFactoryShortName.equalsAscii( "swform" ) ) + else if ( aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbquery")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbbrowser")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbrelation")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbtable")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbapp")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbreport")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("swreport")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dbbrowser")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("swform")) ) aFactoryShortName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sdatabase" ) ); - else if ( aFactoryShortName.equalsAscii( "sbibliography" ) - || aFactoryShortName.equalsAscii( "StartModule" ) ) + else if ( aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sbibliography")) + || aFactoryShortName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("StartModule")) ) aFactoryShortName = sDefaultModule; } else @@ -794,11 +601,11 @@ String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rM RTL_TEXTENCODING_UTF8 )); String aTempURL = aHelpURL; - AppendConfigToken_Impl( aTempURL, sal_True ); + AppendConfigToken( aTempURL, sal_True ); bHasAnchor = GetHelpAnchor_Impl( aTempURL, aAnchor ); } - AppendConfigToken_Impl( aHelpURL, sal_True ); + AppendConfigToken( aHelpURL, sal_True ); if ( bHasAnchor ) { @@ -901,6 +708,16 @@ XubString SfxHelp::GetHelpText( const String& aCommandURL, const Window* pWindow return sHelpText; } +/// Check for built-in help +static bool impl_hasHelpInstalled( const rtl::OUString &rLang = rtl::OUString() ) +{ + String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") ); + AppendConfigToken( aHelpRootURL, sal_True, rLang ); + Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL ); + + return ( aFactories.getLength() != 0 ); +} + sal_Bool SfxHelp::SearchKeyword( const XubString& rKeyword ) { return Start_Impl( String(), NULL, rKeyword ); @@ -911,19 +728,39 @@ sal_Bool SfxHelp::Start( const String& rURL, const Window* pWindow ) return Start_Impl( rURL, pWindow, String() ); } +/// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org +static bool impl_showOnlineHelp( const String& rURL ) +{ + String aInternal( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.help://" ) ); + if ( rURL.Len() <= aInternal.Len() || rURL.Copy( 0, aInternal.Len() ) != aInternal ) + return false; + + rtl::OUString aHelpLink( RTL_CONSTASCII_USTRINGPARAM( "http://help.libreoffice.org/" ) ); + aHelpLink += rURL.Copy( aInternal.Len() ); + try + { + Reference< XSystemShellExecute > xSystemShell( + ::comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), + UNO_QUERY ); + + if ( xSystemShell.is() ) + { + xSystemShell->execute( aHelpLink, rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + return true; + } + } + catch( const Exception& ) + { + } + return false; +} + sal_Bool SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const String& rKeyword ) { - // check if help is available String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") ); - AppendConfigToken_Impl( aHelpRootURL, sal_True ); + AppendConfigToken( aHelpRootURL, sal_True); Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL ); - if ( 0 == aFactories.getLength() ) - { - // no factories -> no help -> error message and return - NoHelpErrorBox aErrBox( const_cast< Window* >( pWindow ) ); - aErrBox.Execute(); - return sal_False; - } /* rURL may be - a "real" URL @@ -940,6 +777,8 @@ sal_Bool SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const S INetURLObject aParser( rURL ); INetProtocol nProtocol = aParser.GetProtocol(); String aHelpModuleName( GetHelpModuleName_Impl() ); + + ::rtl::OUString sKeyword; switch ( nProtocol ) { case INET_PROT_VND_SUN_STAR_HELP: @@ -949,8 +788,15 @@ sal_Bool SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const S default: { // no URL, just a HelpID (maybe empty in case of keyword search) - aHelpURL = CreateHelpURL_Impl( rURL, aHelpModuleName ); - if ( pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) + aHelpURL = CreateHelpURL_Impl( rURL, aHelpModuleName ); + + // pb i91715: strings begin with ".HelpId:" are not words of the basic ide + // they are helpid-strings used by the testtool -> so we ignore them + static const String sHelpIdScheme( DEFINE_CONST_OUSTRING(".HelpId:") ); + if ( rURL.Search( sHelpIdScheme ) != 0 ) + sKeyword = ::rtl::OUString( rURL ); + + if ( impl_hasHelpInstalled() && pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) { // no help found -> try with parent help id. Window* pParent = pWindow->GetParent(); @@ -973,6 +819,18 @@ sal_Bool SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const S } } + if ( !impl_hasHelpInstalled() ) + { + if ( impl_showOnlineHelp( aHelpURL ) ) + return sal_True; + else + { + NoHelpErrorBox aErrBox( const_cast< Window* >( pWindow ) ); + aErrBox.Execute(); + return sal_False; + } + } + Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); @@ -997,7 +855,7 @@ sal_Bool SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const S #ifdef DBG_UTIL ByteString aTmp("SfxHelp: HelpId = "); aTmp += ByteString( aHelpURL, RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + OSL_TRACE( aTmp.GetBuffer() ); #endif pHelpWindow->SetHelpURL( aHelpURL ); @@ -1041,7 +899,7 @@ void SfxHelp::OpenHelpAgent( const rtl::OString& sHelpId ) URL aURL; aURL.Complete = CreateHelpURL_Impl( String( ByteString(sHelpId), RTL_TEXTENCODING_UTF8 ), GetHelpModuleName_Impl() ); Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) ), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer")) ), UNO_QUERY ); xTrans->parseStrict(aURL); Reference < XFrame > xCurrentFrame; @@ -1054,7 +912,7 @@ void SfxHelp::OpenHelpAgent( const rtl::OString& sHelpId ) Reference< XDispatch > xHelpDispatch; if ( xDispProv.is() ) xHelpDispatch = xDispProv->queryDispatch( - aURL, ::rtl::OUString::createFromAscii("_helpagent"), + aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_helpagent")), FrameSearchFlag::PARENT | FrameSearchFlag::SELF ); DBG_ASSERT( xHelpDispatch.is(), "OpenHelpAgent: could not get a dispatcher!" ); @@ -1078,3 +936,4 @@ String SfxHelp::GetDefaultHelpModule() return getCurrentModuleIdentifier_Impl(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 59a753fdb2c4..ed4c98638440 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,6 +58,8 @@ #include "objshimp.hxx" #include <sfx2/docfilt.hxx> +#include <rtl/instance.hxx> + #include <algorithm> // ---------------------------------------------------------------------------- @@ -67,7 +70,6 @@ using namespace ::com::sun::star::util; // ---------------------------------------------------------------------------- -osl::Mutex* SfxPickList::pMutex = 0; SfxPickList* SfxPickList::pUniqueInstance = 0; // ---------------------------------------------------------------------------- @@ -86,20 +88,6 @@ class StringLength : public ::cppu::WeakImplHelper1< XStringWidth > } }; -// ---------------------------------------------------------------------------- - -osl::Mutex* SfxPickList::GetOrCreateMutex() -{ - if ( !pMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pMutex ) - pMutex = new osl::Mutex; - } - - return pMutex; -} - void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const String& aURLString, sal_uInt32 nNo ) { String aPickEntry; @@ -125,8 +113,6 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons // path and abbreviate it with a special function: String aFileSystemPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) ); -// ::utl::LocalFileHelper::ConvertURLToPhysicalName( aURLString, aPhysicalName ); - ::rtl::OUString aSystemPath( aFileSystemPath ); ::rtl::OUString aCompactedSystemPath; @@ -160,9 +146,15 @@ void SfxPickList::CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, cons pMenu->SetAccessibleName( nItemId, aAccessibleName ); } +namespace +{ + class thePickListMutex + : public rtl::Static<osl::Mutex, thePickListMutex> {}; +} + void SfxPickList::RemovePickListEntries() { - ::osl::MutexGuard aGuard( GetOrCreateMutex() ); + ::osl::MutexGuard aGuard( thePickListMutex::get() ); for ( sal_uInt32 i = 0; i < m_aPicklistVector.size(); i++ ) delete m_aPicklistVector[i]; m_aPicklistVector.clear(); @@ -178,28 +170,10 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex ) return 0; } -SfxPickList* SfxPickList::GetOrCreate( const sal_uInt32 nMenuSize ) +SfxPickList& SfxPickList::Get() { - if ( !pUniqueInstance ) - { - ::osl::MutexGuard aGuard( GetOrCreateMutex() ); - if ( !pUniqueInstance ) - pUniqueInstance = new SfxPickList( nMenuSize ); - } - - return pUniqueInstance; -} - -SfxPickList* SfxPickList::Get() -{ - ::osl::MutexGuard aGuard( GetOrCreateMutex() ); - return pUniqueInstance; -} - -void SfxPickList::Delete() -{ - ::osl::MutexGuard aGuard( GetOrCreateMutex() ); - DELETEZ( pUniqueInstance ); + static SfxPickList aUniqueInstance(SvtHistoryOptions().GetSize(ePICKLIST)); + return aUniqueInstance; } SfxPickList::SfxPickList( sal_uInt32 nAllowedMenuSize ) : @@ -219,7 +193,7 @@ void SfxPickList::CreatePickListEntries() { RemovePickListEntries(); - // Einlesen der Pickliste + // Reading the pick list Sequence< Sequence< PropertyValue > > seqPicklist = SvtHistoryOptions().GetList( ePICKLIST ); sal_uInt32 nCount = seqPicklist.getLength(); @@ -266,9 +240,9 @@ void SfxPickList::CreatePickListEntries() void SfxPickList::CreateMenuEntries( Menu* pMenu ) { - static sal_Bool bPickListMenuInitializing = sal_False; + ::osl::MutexGuard aGuard( thePickListMutex::get() ); - ::osl::MutexGuard aGuard( GetOrCreateMutex() ); + static sal_Bool bPickListMenuInitializing = sal_False; if ( bPickListMenuInitializing ) // method is not reentrant! return; @@ -301,9 +275,9 @@ void SfxPickList::CreateMenuEntries( Menu* pMenu ) void SfxPickList::ExecuteEntry( sal_uInt32 nIndex ) { - ::osl::ClearableMutexGuard aGuard( GetOrCreateMutex() ); + ::osl::ClearableMutexGuard aGuard( thePickListMutex::get() ); - PickListEntry *pPick = SfxPickList::Get()->GetPickListEntry( nIndex ); + PickListEntry *pPick = SfxPickList::Get().GetPickListEntry( nIndex ); if ( pPick ) { @@ -335,7 +309,7 @@ void SfxPickList::ExecuteMenuEntry( sal_uInt16 nId ) String SfxPickList::GetMenuEntryTitle( sal_uInt32 nIndex ) { - PickListEntry *pPick = SfxPickList::Get()->GetPickListEntry( nIndex ); + PickListEntry *pPick = SfxPickList::Get().GetPickListEntry( nIndex ); if ( pPick ) return pPick->aTitle; @@ -356,7 +330,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( rHint.IsA( TYPE( SfxEventHint ))) { SfxEventHint* pEventHint = PTR_CAST(SfxEventHint,&rHint); - // nur ObjectShell-bezogene Events mit Medium interessieren + // only ObjectShell-related events with media interest SfxObjectShell* pDocSh = pEventHint->GetObjShell(); if( !pDocSh ) return; @@ -392,12 +366,12 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) if( !pMed ) return; - // unbenannt-Docs und embedded-Docs nicht in History + // Unnamed Documents and embedded-Documents not in History if ( !pDocSh->HasName() || SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() ) return; - // Hilfe nicht in History + // Help not in History INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) ); if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP ) return; @@ -423,12 +397,12 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) if( !pMed ) return; - // unbenannt-Docs und embedded-Docs nicht in Pickliste + // Unnamed Documents and embedded-Documents not im Pickliste if ( !pDocSh->HasName() || SFX_CREATE_MODE_STANDARD != pDocSh->GetCreateMode() ) return; - // Hilfe nicht in History + // Help not in History INetURLObject aURL( pDocSh->IsDocShared() ? pDocSh->GetSharedFileURL() : ::rtl::OUString( pMed->GetOrigURL() ) ); if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP ) return; @@ -471,3 +445,5 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index f7053321ddfa..5cd33826c6e1 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,10 +32,9 @@ #include <shutdownicon.hxx> #include <app.hrc> #include <sfx2/app.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> -// #include <cmdlineargs.hxx> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> @@ -52,9 +52,7 @@ #include <com/sun/star/document/UpdateDocMode.hpp> #include <sfx2/filedlghelper.hxx> #include <sfx2/fcontnr.hxx> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <cppuhelper/compbase1.hxx> #include <sfx2/dispatch.hxx> #include <comphelper/extract.hxx> @@ -79,7 +77,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; using namespace ::com::sun::star::ui::dialogs; -using namespace ::vos; #ifdef WNT using ::rtl::OUString; #else @@ -193,6 +190,9 @@ bool ShutdownIcon::LoadModule( osl::Module **pModule, return true; } +// These two timeouts are necessary to avoid there being +// plugin frames still on the stack, after unloading that +// code, causing a crash during disabling / termination. class IdleUnloader : Timer { ::osl::Module *m_pModule; @@ -210,6 +210,22 @@ public: } }; +class IdleTerminate : Timer +{ + Reference< XDesktop > m_xDesktop; +public: + IdleTerminate (Reference< XDesktop > xDesktop) + { + m_xDesktop = xDesktop; + Start(); + } + virtual void Timeout() + { + m_xDesktop->terminate(); + delete this; + } +}; + void ShutdownIcon::initSystray() { if (m_bInitialized) @@ -275,7 +291,7 @@ void ShutdownIcon::OpenURL( const ::rtl::OUString& aURL, const ::rtl::OUString& aDispatchURL.Complete = aURL; Reference < com::sun::star::util::XURLTransformer > xURLTransformer( - ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.util.URLTransformer") ), + ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer")) ), com::sun::star::uno::UNO_QUERY ); if ( xURLTransformer.is() ) { @@ -306,7 +322,7 @@ void ShutdownIcon::FileOpen() { if ( getInstance() && getInstance()->m_xDesktop.is() ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; EnterModalMode(); getInstance()->StartFileDialog(); } @@ -325,7 +341,7 @@ void ShutdownIcon::FromTemplate() URL aTargetURL; aTargetURL.Complete = OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:5500" ) ); - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, UNO_QUERY ); @@ -335,14 +351,14 @@ void ShutdownIcon::FromTemplate() if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL ) xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); else - xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_blank"), 0 ); + xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0 ); } if ( xDisp.is() ) { Sequence<PropertyValue> aArgs(1); PropertyValue* pArg = aArgs.getArray(); - pArg[0].Name = rtl::OUString::createFromAscii("Referer"); - pArg[0].Value <<= ::rtl::OUString::createFromAscii("private:user"); + pArg[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); + pArg[0].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:user")); Reference< ::com::sun::star::frame::XNotifyingDispatch > xNotifyer( xDisp, UNO_QUERY ); if ( xNotifyer.is() ) { @@ -359,7 +375,7 @@ void ShutdownIcon::FromTemplate() #include <tools/rcid.h> OUString ShutdownIcon::GetResString( int id ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; if( ! m_pResMgr ) m_pResMgr = SfxResId::GetResMgr(); @@ -376,7 +392,7 @@ OUString ShutdownIcon::GetResString( int id ) OUString ShutdownIcon::GetUrlDescription( const OUString& aUrl ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; return OUString( SvFileInformationManager::GetDescription( INetURLObject( aUrl ) ) ); } @@ -385,7 +401,7 @@ OUString ShutdownIcon::GetUrlDescription( const OUString& aUrl ) void ShutdownIcon::StartFileDialog() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; bool bDirty = ( m_bSystemDialogs != static_cast<bool>(SvtMiscOptions().UseSystemFileDialog()) ); @@ -408,7 +424,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR { DBG_ASSERT( pThis->m_pFileDlg, "ShutdownIcon, DialogClosedHdl_Impl(): no file dialog" ); - // use ctor for filling up filters automatically! #89169# + // use constructor for filling up filters automatically! if ( ERRCODE_NONE == pThis->m_pFileDlg->GetError() ) { Reference< XFilePicker > xPicker = pThis->m_pFileDlg->GetFilePicker(); @@ -429,21 +445,21 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR Sequence< PropertyValue > aArgs(3); Reference < com::sun::star::task::XInteractionHandler > xInteraction( - ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.task.InteractionHandler") ), + ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")) ), com::sun::star::uno::UNO_QUERY ); - aArgs[0].Name = OUString::createFromAscii( "InteractionHandler" ); + aArgs[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); aArgs[0].Value <<= xInteraction; sal_Int16 nMacroExecMode = ::com::sun::star::document::MacroExecMode::USE_CONFIG; - aArgs[1].Name = OUString::createFromAscii( "MacroExecutionMode" ); + aArgs[1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); aArgs[1].Value <<= nMacroExecMode; sal_Int16 nUpdateDoc = ::com::sun::star::document::UpdateDocMode::ACCORDING_TO_CONFIG; - aArgs[2].Name = OUString::createFromAscii( "UpdateDocMode" ); + aArgs[2].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("UpdateDocMode")); aArgs[2].Value <<= nUpdateDoc; - // pb: #102643# use the filedlghelper to get the current filter name, + // use the filedlghelper to get the current filter name, // because it removes the extensions before you get the filter name. OUString aFilterName( pThis->m_pFileDlg->GetCurrentFilter() ); @@ -457,12 +473,12 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR xPickerControls->getValue( ExtendedFilePickerElementIds::CHECKBOX_READONLY, 0 ) >>= bReadOnly; - // #95239#: Only set porperty if readonly is set to TRUE + // Only set porperty if readonly is set to TRUE if ( bReadOnly ) { aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = OUString::createFromAscii( "ReadOnly" ); + aArgs[nArgs-1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); aArgs[nArgs-1].Value <<= bReadOnly; } @@ -477,7 +493,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR sal_Int16 uVersion = (sal_Int16)iVersion; aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = OUString::createFromAscii( "Version" ); + aArgs[nArgs-1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Version")); aArgs[nArgs-1].Value <<= uVersion; } @@ -502,7 +518,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR if ( aFilterName.getLength() ) { aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = OUString::createFromAscii( "FilterName" ); + aArgs[nArgs-1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); aArgs[nArgs-1].Value <<= aFilterName; } } @@ -514,7 +530,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR { OUString aBaseDirURL = sFiles[0]; if ( aBaseDirURL.getLength() > 0 && aBaseDirURL[aBaseDirURL.getLength()-1] != '/' ) - aBaseDirURL += OUString::createFromAscii("/"); + aBaseDirURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/")); int iFiles; for ( iFiles = 1; iFiles < nFiles; iFiles++ ) @@ -532,7 +548,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR } #ifdef WNT - // #103346 Destroy dialog to prevent problems with custom controls + // Destroy dialog to prevent problems with custom controls // This fix is dependent on the dialog settings. Destroying the dialog here will // crash the non-native dialog implementation! Therefore make this dependent on // the settings. @@ -579,19 +595,16 @@ void ShutdownIcon::terminateDesktop() return; // always remove ourselves as listener - xDesktop->removeTerminateListener( pInst ); pInst->m_bListenForTermination = true; + xDesktop->removeTerminateListener( pInst ); // terminate desktop only if no tasks exist Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); if ( xSupplier.is() ) { Reference< XIndexAccess > xTasks ( xSupplier->getFrames(), UNO_QUERY ); - if( xTasks.is() ) - { - if( xTasks->getCount() < 1 ) - xDesktop->terminate(); - } + if( xTasks.is() && xTasks->getCount() < 1 ) + new IdleTerminate( xDesktop ); } // remove the instance pointer @@ -629,7 +642,7 @@ ShutdownIcon* ShutdownIcon::createInstance() void ShutdownIcon::init() throw( ::com::sun::star::uno::Exception ) { // access resource system and sfx only protected by solarmutex - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aSolarGuard; ResMgr *pResMgr = SfxResId::GetResMgr(); ::osl::ResettableMutexGuard aGuard( m_aMutex ); @@ -714,19 +727,6 @@ void SAL_CALL ShutdownIcon::initialize( const ::com::sun::star::uno::Sequence< : /* Create a sub-classed instance - foo */ ShutdownIcon::pShutdownIcon = this; initSystray(); -#ifdef OS2 - // above win32 starts the quickstart thread, but we have - // quickstart running only when -quickstart is specified - // on command line (next boot). - // so if -quickstart was not specified, we cannot issue - // quickstart veto on shutdown. - if (bQuickstart) - { - // disable shutdown - ShutdownIcon::getInstance()->SetVeto( true ); - ShutdownIcon::getInstance()->addTerminateListener(); - } -#endif } catch(const ::com::sun::star::lang::IllegalArgumentException&) { @@ -761,8 +761,6 @@ void ShutdownIcon::LeaveModalMode() #ifdef WNT // defined in shutdowniconw32.cxx -#elif defined(OS2) -// defined in shutdowniconOs2.cxx #elif defined QUARTZ // defined in shutdowniconaqua.cxx #else @@ -781,12 +779,20 @@ bool ShutdownIcon::IsQuickstarterInstalled() // --------------------------------------------------------------------------- #if defined (ENABLE_QUICKSTART_APPLET) && defined (UNX) -static OUString getDotAutostart( bool bCreate = false ) +/** +* Return the XDG autostart directory. +* http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html +* Available in Unix and with Quickstart enabled. +* @param bCreate Create the directory if it does not exist yet. +* @return OUString containing the autostart directory path. +*/ +static OUString getAutostartDir( bool bCreate = false ) { OUString aShortcut; const char *pConfigHome; if( (pConfigHome = getenv("XDG_CONFIG_HOME") ) ) - aShortcut = OStringToOUString( OString( pConfigHome ), RTL_TEXTENCODING_UTF8 ); + aShortcut = OStringToOUString( OString( pConfigHome ), + RTL_TEXTENCODING_UTF8 ); else { OUString aHomeURL; @@ -815,7 +821,7 @@ rtl::OUString ShutdownIcon::getShortcutName() ResMgr* pMgr = SfxResId::GetResMgr(); if( pMgr ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; UniString aRes( SfxResId( STR_QUICKSTART_LNKNAME ) ); aShortcutName = OUString( aRes ); } @@ -826,7 +832,7 @@ rtl::OUString ShutdownIcon::getShortcutName() aShortcut += OUString( RTL_CONSTASCII_USTRINGPARAM( "\\" ) ); aShortcut += aShortcutName; #else // UNX - OUString aShortcut = getDotAutostart(); + OUString aShortcut = getAutostartDir(); aShortcut += OUString( RTL_CONSTASCII_USTRINGPARAM( "/qstart.desktop" ) ); #endif // UNX return aShortcut; @@ -835,9 +841,7 @@ rtl::OUString ShutdownIcon::getShortcutName() bool ShutdownIcon::GetAutostart( ) { -#if defined(OS2) - return GetAutostartOs2( ); -#elif defined QUARTZ +#if defined QUARTZ return true; #else bool bRet = false; @@ -846,7 +850,7 @@ bool ShutdownIcon::GetAutostart( ) OUString aShortcutUrl; osl::File::getFileURLFromSystemPath( aShortcut, aShortcutUrl ); osl::File f( aShortcutUrl ); - osl::File::RC error = f.open( OpenFlag_Read ); + osl::File::RC error = f.open( osl_File_OpenFlag_Read ); if( error == osl::File::E_None ) { f.close(); @@ -867,7 +871,7 @@ void ShutdownIcon::SetAutostart( bool bActivate ) #ifdef WNT EnableAutostartW32( aShortcut ); #else // UNX - getDotAutostart( true ); + getAutostartDir( true ); OUString aPath( RTL_CONSTASCII_USTRINGPARAM("${BRAND_BASE_DIR}/share/xdg/qstart.desktop" ) ); Bootstrap::expandMacros( aPath ); @@ -879,10 +883,11 @@ void ShutdownIcon::SetAutostart( bool bActivate ) osl_getThreadTextEncoding() ); OString aShortcutUnx = OUStringToOString( aShortcut, osl_getThreadTextEncoding() ); - if ((0 != symlink(aDesktopFileUnx, aShortcutUnx)) && (errno == EEXIST)) + if ((0 != symlink(aDesktopFileUnx.getStr(), aShortcutUnx.getStr())) && (errno == EEXIST)) { - unlink(aShortcutUnx); - symlink(aDesktopFileUnx, aShortcutUnx); + unlink(aShortcutUnx.getStr()); + int ret = symlink(aDesktopFileUnx.getStr(), aShortcutUnx.getStr()); + (void)ret; //deliberately ignore return value, it's non-critical if it fails } ShutdownIcon *pIcon = ShutdownIcon::createInstance(); @@ -903,8 +908,6 @@ void ShutdownIcon::SetAutostart( bool bActivate ) } #endif } -#elif defined OS2 - SetAutostartOs2( bActivate ); #else (void)bActivate; // unused variable #endif // ENABLE_QUICKSTART_APPLET @@ -963,3 +966,5 @@ void SAL_CALL ShutdownIcon::setFastPropertyValue( ::sal_Int32 return aValue; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index d702f2a50977..d9e6e17bf802 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef __SHUTDOWNICON_HXX__ #define __SHUTDOWNICON_HXX__ @@ -12,12 +13,8 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp> -#ifndef _RTL_STRING_HXX #include <rtl/string.hxx> -#endif -#ifndef _RTL_USTRING_HXX #include <rtl/ustring.hxx> -#endif #include <osl/mutex.hxx> #include <osl/module.hxx> #include <sfx2/sfxuno.hxx> @@ -152,10 +149,6 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase static void EnableAutostartW32( const rtl::OUString &aShortcutName ); static rtl::OUString GetAutostartFolderNameW32(); #endif -#ifdef OS2 - static void SetAutostartOs2( bool bActivate ); - static bool GetAutostartOs2( ); -#endif }; extern "C" { @@ -173,3 +166,5 @@ extern "C" { } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdowniconOs2.cxx b/sfx2/source/appl/shutdowniconOs2.cxx index 936d6f925053..56932fff80a6 100644 --- a/sfx2/source/appl/shutdowniconOs2.cxx +++ b/sfx2/source/appl/shutdowniconOs2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,9 +46,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::osl; -// // This ObjectID must match the one created in WarpIN scripts!! -// #define QUICKSTART_OBJID "OO2_QUICKSTART" bool ShutdownIcon::IsQuickstarterInstalled() @@ -92,3 +91,4 @@ bool ShutdownIcon::GetAutostartOs2( ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm index d51df52b02d1..481447fe7f1a 100644..100755 --- a/sfx2/source/appl/shutdowniconaqua.mm +++ b/sfx2/source/appl/shutdowniconaqua.mm @@ -34,8 +34,9 @@ #include "tools/urlobj.hxx" #include "osl/file.h" #include "comphelper/sequenceashashmap.hxx" -#include "vos/mutex.hxx" +#include "osl/mutex.hxx" #include "sfx2/app.hxx" +#include <sal/macros.h> #include "app.hrc" #define USE_APP_SHORTCUTS #include "shutdownicon.hxx" @@ -386,7 +387,7 @@ extern "C" void aqua_init_systray() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ShutdownIcon *pShutdownIcon = ShutdownIcon::getInstance(); if( ! pShutdownIcon ) @@ -450,12 +451,12 @@ void aqua_init_systray() if( [NSApp respondsToSelector: @selector(setDockIconClickHandler:)] ) [NSApp performSelector:@selector(setDockIconClickHandler:) withObject: pExecute]; else - DBG_ERROR( "setDockIconClickHandler selector failed on NSApp\n" ); + OSL_FAIL( "setDockIconClickHandler selector failed on NSApp\n" ); } // insert the menu entries for launching the applications - for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i ) { if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) ) // the complete application is not even installed @@ -497,10 +498,10 @@ void aqua_init_systray() [NSApp performSelector:@selector(addDockMenuItem:) withObject: pDockSubMenu]; } else - DBG_ERROR( "addDockMenuItem selector failed on NSApp\n" ); + OSL_FAIL( "addDockMenuItem selector failed on NSApp\n" ); } else - DBG_ERROR( "addFallbackMenuItem selector failed on NSApp\n" ); + OSL_FAIL( "addFallbackMenuItem selector failed on NSApp\n" ); } } diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx index c9c9e06ae248..5e70016d1ff1 100644 --- a/sfx2/source/appl/shutdowniconunx.cxx +++ b/sfx2/source/appl/shutdowniconunx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifdef ENABLE_QUICKSTART_APPLET @@ -7,19 +8,20 @@ #include <gtk/gtk.h> #include <glib.h> -#include <eggtray/eggtrayicon.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/bitmapex.hxx> #include <vcl/bmpacc.hxx> #include <sfx2/app.hxx> -#ifndef _SFX_APP_HRC #include "app.hrc" -#endif #ifndef __SHUTDOWNICON_HXX__ #define USE_APP_SHORTCUTS #include "shutdownicon.hxx" #endif +#ifdef ENABLE_GIO +#include <gio/gio.h> +#endif + // Cut/paste from vcl/inc/svids.hrc #define SV_ICON_SMALL_START 25000 @@ -36,9 +38,13 @@ using namespace ::rtl; using namespace ::osl; static ResMgr *pVCLResMgr; -static EggTrayIcon *pTrayIcon; +static GtkStatusIcon* pTrayIcon; static GtkWidget *pExitMenuItem = NULL; static GtkWidget *pOpenMenuItem = NULL; +static GtkWidget *pDisableMenuItem = NULL; +#ifdef ENABLE_GIO +GFileMonitor* pMonitor = NULL; +#endif static void open_url_cb( GtkWidget *, gpointer data ) { @@ -66,9 +72,10 @@ static void systray_disable_cb() static void exit_quickstarter_cb( GtkWidget * ) { - egg_tray_icon_cancel_message (pTrayIcon, 1 ); - ShutdownIcon::getInstance()->terminateDesktop(); plugin_shutdown_sys_tray(); + //terminate may cause this .so to be unloaded. So we must be hands off + //all calls into this .so after this call + ShutdownIcon::terminateDesktop(); } static void menu_deactivate_cb( GtkWidget *pMenu ) @@ -83,13 +90,14 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) Bitmap pInSalBitmap = aIcon.GetBitmap(); AlphaMask pInSalAlpha = aIcon.GetAlpha(); - BitmapReadAccess* pSalBitmap = pInSalBitmap.AcquireReadAccess(); - BitmapReadAccess* pSalAlpha = pInSalAlpha.AcquireReadAccess(); + Bitmap::ScopedReadAccess pSalBitmap(pInSalBitmap); + AlphaMask::ScopedReadAccess pSalAlpha(pInSalAlpha); - g_return_val_if_fail( pSalBitmap != NULL, NULL ); + g_return_val_if_fail( pSalBitmap, NULL ); Size aSize( pSalBitmap->Width(), pSalBitmap->Height() ); - g_return_val_if_fail( Size( pSalAlpha->Width(), pSalAlpha->Height() ) == aSize, NULL ); + if (pSalAlpha) + g_return_val_if_fail( Size( pSalAlpha->Width(), pSalAlpha->Height() ) == aSize, NULL ); int nX, nY; guchar *pPixbufData = ( guchar * )g_malloc( 4 * aSize.Width() * aSize.Height() ); @@ -115,10 +123,6 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) } } - pInSalBitmap.ReleaseAccess( pSalBitmap ); - if( pSalAlpha ) - pInSalAlpha.ReleaseAccess( pSalAlpha ); - return gdk_pixbuf_new_from_data( pPixbufData, GDK_COLORSPACE_RGB, sal_True, 8, aSize.Width(), aSize.Height(), @@ -182,13 +186,13 @@ static void add_ugly_db_item( GtkMenuShell *pMenuShell, const char *pAsciiURL, Sequence < PropertyValue >& aEntry = aMenu[n]; for ( sal_Int32 m=0; m<aEntry.getLength(); m++ ) { - if ( aEntry[m].Name.equalsAsciiL( "URL", 3 ) ) + if ( aEntry[m].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")) ) aEntry[m].Value >>= aURL; - if ( aEntry[m].Name.equalsAsciiL( "Title", 5 ) ) + if ( aEntry[m].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Title")) ) aEntry[m].Value >>= aDescription; } - if ( aURL.equalsAscii( BASE_URL ) && aDescription.getLength() ) + if ( aURL.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(BASE_URL)) && aDescription.getLength() ) { add_item (pMenuShell, pAsciiURL, &aDescription, nResId, pFnCallback); break; @@ -265,7 +269,7 @@ static void populate_menu( GtkWidget *pMenu ) pMenuItem = gtk_separator_menu_item_new(); gtk_menu_shell_append( pMenuShell, pMenuItem ); - (void) add_image_menu_item + pDisableMenuItem = add_image_menu_item ( pMenuShell, GTK_STOCK_CLOSE, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH_UNX ), G_CALLBACK( systray_disable_cb ) ); @@ -289,30 +293,7 @@ static void refresh_menu( GtkWidget *pMenu ) bool bModal = ShutdownIcon::bModalMode; gtk_widget_set_sensitive( pExitMenuItem, !bModal); gtk_widget_set_sensitive( pOpenMenuItem, !bModal); -} - -extern "C" { -static void -layout_menu( GtkMenu *menu, - gint *x, gint *y, gboolean *push_in, - gpointer ) -{ - GtkRequisition req; - GtkWidget *ebox = GTK_BIN( pTrayIcon )->child; - - gtk_widget_size_request( GTK_WIDGET( menu ), &req ); - gdk_window_get_origin( ebox->window, x, y ); - - (*x) += ebox->allocation.x; - (*y) += ebox->allocation.y; - - if (*y >= gdk_screen_get_height (gtk_widget_get_screen (ebox)) / 2) - (*y) -= req.height; - else - (*y) += ebox->allocation.height; - - *push_in = sal_True; -} + gtk_widget_set_sensitive( pDisableMenuItem, !bModal); } static gboolean display_menu_cb( GtkWidget *, @@ -321,41 +302,51 @@ static gboolean display_menu_cb( GtkWidget *, if (event->button == 2) return sal_False; -#ifdef TEMPLATE_DIALOG_MORE_POLISHED - if (event->button == 1 && - event->type == GDK_2BUTTON_PRESS) - { - open_template_cb( NULL ); - return sal_True; - } - if (event->button == 3) - { - ... as below ... -#endif - refresh_menu( pMenu ); gtk_menu_popup( GTK_MENU( pMenu ), NULL, NULL, - layout_menu, NULL, 0, event->time ); + gtk_status_icon_position_menu, pTrayIcon, + 0, event->time ); return sal_True; } -extern "C" { - static gboolean - show_at_idle( gpointer ) +#ifdef ENABLE_GIO +/* + * If the quickstarter is running, then LibreOffice is + * upgraded, then the old quickstarter is still running, but is now unreliable + * as the old install has been deleted. A fairly intractable problem but we + * can avoid much of the pain if we turn off the quickstarter if we detect + * that it has been physically deleted or overwritten +*/ +static void notify_file_changed(GFileMonitor * /*gfilemonitor*/, GFile * /*arg1*/, + GFile * /*arg2*/, GFileMonitorEvent event_type, gpointer /*user_data*/) +{ + //Shutdown the quick starter if anything has happened to make it unsafe + //to remain running, e.g. rpm --erased and all libs deleted, or + //rpm --upgrade and libs being overwritten + switch (event_type) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - gtk_widget_show_all( GTK_WIDGET( pTrayIcon ) ); - return sal_False; + case G_FILE_MONITOR_EVENT_DELETED: + case G_FILE_MONITOR_EVENT_CREATED: + case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: + case G_FILE_MONITOR_EVENT_UNMOUNTED: + exit_quickstarter_cb(GTK_WIDGET(pTrayIcon)); + break; + default: + break; } } +#endif void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; - if( !g_type_from_name( "GdkDisplay" ) ) + if( /* need gtk_status to resolve */ + (gtk_check_version( 2, 10, 0 ) != NULL) || + /* we need the vcl plugin and mainloop initialized */ + !g_type_from_name( "GdkDisplay" ) ) return; OString aLabel; @@ -365,45 +356,65 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray() pShutdownIcon->GetResString( STR_QUICKSTART_TIP ), RTL_TEXTENCODING_UTF8 ); - pTrayIcon = egg_tray_icon_new( aLabel ); - - GtkWidget *pParent = gtk_event_box_new(); - GtkTooltips *pTooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip( GTK_TOOLTIPS( pTooltips ), pParent, aLabel, NULL ); - - GtkWidget *pIconImage = gtk_image_new(); - gtk_container_add( GTK_CONTAINER( pParent ), pIconImage ); - pVCLResMgr = CREATEVERSIONRESMGR( vcl ); GdkPixbuf *pPixbuf = ResIdToPixbuf( SV_ICON_ID_OFFICE ); - gtk_image_set_from_pixbuf( GTK_IMAGE( pIconImage ), pPixbuf ); + pTrayIcon = gtk_status_icon_new_from_pixbuf(pPixbuf); g_object_unref( pPixbuf ); + g_object_set (pTrayIcon, "title", aLabel.getStr(), + "tooltip_text", aLabel.getStr(), NULL); + GtkWidget *pMenu = gtk_menu_new(); g_signal_connect (pMenu, "deactivate", G_CALLBACK (menu_deactivate_cb), NULL); - g_signal_connect( pParent, "button_press_event", - G_CALLBACK( display_menu_cb ), pMenu ); - gtk_container_add( GTK_CONTAINER( pTrayIcon ), pParent ); - - // Show at idle to avoid artefacts at startup - g_idle_add (show_at_idle, (gpointer) pTrayIcon); + g_signal_connect(pTrayIcon, "button_press_event", + G_CALLBACK(display_menu_cb), pMenu); // disable shutdown pShutdownIcon->SetVeto( true ); pShutdownIcon->addTerminateListener(); + +#ifdef ENABLE_GIO + GFile* pFile = NULL; + rtl::OUString sLibraryFileUrl; + if (osl::Module::getUrlFromAddress(plugin_init_sys_tray, sLibraryFileUrl)) + pFile = g_file_new_for_uri(rtl::OUStringToOString(sLibraryFileUrl, RTL_TEXTENCODING_UTF8).getStr()); + + if (pFile) + { + if ((pMonitor = g_file_monitor_file(pFile, G_FILE_MONITOR_NONE, NULL, NULL))) + g_signal_connect(pMonitor, "changed", (GCallback)notify_file_changed, NULL); + g_object_unref(pFile); + } +#endif } void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + ::SolarMutexGuard aGuard; if( !pTrayIcon ) return; - gtk_widget_destroy( GTK_WIDGET( pTrayIcon ) ); + +#ifdef ENABLE_GIO + if (pMonitor) + { + g_signal_handlers_disconnect_by_func(pMonitor, + (void*)notify_file_changed, pMonitor); + g_file_monitor_cancel(pMonitor); + g_object_unref(pMonitor); + pMonitor = NULL; + } +#endif + + g_object_unref(pTrayIcon); pTrayIcon = NULL; + pExitMenuItem = NULL; pOpenMenuItem = NULL; + pDisableMenuItem = NULL; } #endif // ENABLE_QUICKSTART_APPLET + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 3f1b49d6d0e4..57cb6ab0d926 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" +#include <sal/macros.h> #ifdef WNT @@ -39,9 +41,7 @@ #undef WINVER #define WINVER 0x0400 #define USE_APP_SHORTCUTS -// // the systray icon is only available on windows -// #include <unotools/moduleoptions.hxx> #include <unotools/dynamicmenuoptions.hxx> @@ -130,29 +130,6 @@ typedef struct tagMYITEM // ------------------------------- -static bool isNT() -{ - static bool bInitialized = false; - static bool bWnt = false; - - if( !bInitialized ) - { - bInitialized = true; - - OSVERSIONINFO aVerInfo; - aVerInfo.dwOSVersionInfoSize = sizeof( aVerInfo ); - if ( GetVersionEx( &aVerInfo ) ) - { - if ( aVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - bWnt = true; - } - } - return bWnt; -} - - -// ------------------------------- - static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module ) { MENUITEMINFOW mi; @@ -250,7 +227,7 @@ static HMENU createSystrayMenu( ) OUString aEmpty; // insert the menu entries for launching the applications - for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i ) { if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) ) // the complete application is not even installed @@ -273,7 +250,7 @@ static HMENU createSystrayMenu( ) addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "SHELL32" )); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString(RTL_CONSTASCII_USTRINGPARAM("SHELL32"))); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); @@ -340,30 +317,6 @@ static void addTaskbarIcon( HWND hWnd ) // ------------------------------- -/* -static void removeTaskbarIcon() -{ - ShutdownIcon *pShutdownIcon = ShutdownIcon::getInstance(); - OSL_ENSURE( pShutdownIcon, "ShutdownIcon instance empty!"); - - if( !pShutdownIcon ) - return; - - if ( IsWindow( aListenerWindow )) - { - deleteSystrayMenu( popupMenu ); - - NOTIFYICONDATAA nid; - nid.cbSize=sizeof(NOTIFYICONDATA); - nid.hWnd = aListenerWindow; - nid.uID = ID_QUICKSTART; - Shell_NotifyIconA(NIM_DELETE, &nid); - } -} -*/ - -// ------------------------------- - LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static UINT s_uTaskbarRestart = 0; @@ -427,7 +380,6 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP #endif int m = TrackPopupMenuEx( popupMenu, TPM_RETURNCMD|TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, hWnd, NULL ); - // BUGFIX: See Q135788 (PRB: Menus for Notification Icons Don't Work Correctly) PostMessage( hWnd, NULL, 0, 0 ); switch( m ) { @@ -493,7 +445,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP static sal_Bool checkOEM() { Reference<XMultiServiceFactory> rFactory = ::comphelper::getProcessServiceFactory(); Reference<XJob> rOemJob(rFactory->createInstance( - OUString::createFromAscii("com.sun.star.office.OEMPreloadJob")), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.OEMPreloadJob"))), UNO_QUERY ); Sequence<NamedValue> args; sal_Bool bResult = sal_False; @@ -762,7 +714,6 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR | LR_SHARED ); - // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) ); @@ -915,22 +866,7 @@ static bool FileExistsW( LPCWSTR lpPath ) bool ShutdownIcon::IsQuickstarterInstalled() { wchar_t aPath[_MAX_PATH]; - if( isNT() ) - { - GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); - } - else - { - char szPathA[_MAX_PATH]; - GetModuleFileNameA( NULL, szPathA, _MAX_PATH-1); - - // calc the string wcstr len - int nNeededWStrBuffSize = MultiByteToWideChar( CP_ACP, 0, szPathA, -1, NULL, 0 ); - - // copy the string if necessary - if ( nNeededWStrBuffSize > 0 ) - MultiByteToWideChar( CP_ACP, 0, szPathA, -1, aPath, nNeededWStrBuffSize ); - } + GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) ); int i = aOfficepath.lastIndexOf((sal_Char) '\\'); @@ -946,20 +882,7 @@ bool ShutdownIcon::IsQuickstarterInstalled() void ShutdownIcon::EnableAutostartW32( const rtl::OUString &aShortcut ) { wchar_t aPath[_MAX_PATH]; - if( isNT() ) - GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); - else - { - char szPathA[_MAX_PATH]; - GetModuleFileNameA( NULL, szPathA, _MAX_PATH-1); - - // calc the string wcstr len - int nNeededWStrBuffSize = MultiByteToWideChar( CP_ACP, 0, szPathA, -1, NULL, 0 ); - - // copy the string if necessary - if ( nNeededWStrBuffSize > 0 ) - MultiByteToWideChar( CP_ACP, 0, szPathA, -1, aPath, nNeededWStrBuffSize ); - } + GetModuleFileNameW( NULL, aPath, _MAX_PATH-1); OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) ); int i = aOfficepath.lastIndexOf((sal_Char) '\\'); @@ -975,3 +898,4 @@ void ShutdownIcon::EnableAutostartW32( const rtl::OUString &aShortcut ) #endif // WNT +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 0692b85afcda..e61171a381f7 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include <stdio.h> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> @@ -59,9 +57,7 @@ #include <svl/itemiter.hxx> #include <svl/whiter.hxx> #include <svl/intitem.hxx> -#ifndef _SFXEITEM_HXX //autogen #include <svl/eitem.hxx> -#endif #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp> @@ -141,6 +137,7 @@ static const ResIdToResName pToolBarResToName[] = { 23031, "mediaobjectbar" }, //draw/impress { 25060, "mediaobjectbar" }, //calc { 23311, "mediaobjectbar" }, //writer + { 23313, "navigationobjectbar" }, //writer { 0, "" } }; @@ -149,11 +146,11 @@ DBG_NAME(SfxWorkWindow) //SV_IMPL_OBJARR( SfxObjectBarArr_Impl, SfxObjectBar_Impl ); //==================================================================== -// Sortiert die Children nach ihrem Alignment -// Reihenfolge entspricht der im enum SfxChildAlignment (->CHILDWIN.HXX). +// Sort the Children according their alignment +// The order corresponds to the enum SfxChildAlignment (->CHILDWIN.HXX). // -// Hilfe, um die "Anderungen am Alignment kompatibal zu machen! +// Help to make changes to the alignment compatible! SFX_IMPL_XINTERFACE_3( LayoutManagerListener, OWeakObject, ::com::sun::star::frame::XLayoutManagerListener, ::com::sun::star::lang::XEventListener, ::com::sun::star::lang::XComponent ) @@ -173,7 +170,7 @@ LayoutManagerListener::~LayoutManagerListener() void LayoutManagerListener::setFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pWrkWin && !m_bHasFrame ) { m_xFrame = xFrame; @@ -238,7 +235,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL LayoutManagerListener::dispose() throw( css::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // reset member m_pWrkWin = 0; @@ -285,7 +282,7 @@ void SAL_CALL LayoutManagerListener::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pWrkWin = 0; m_bHasFrame = sal_False; m_xFrame = css::uno::Reference< css::frame::XFrame >(); @@ -300,7 +297,7 @@ void SAL_CALL LayoutManagerListener::layoutEvent( const css::uno::Any& ) throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pWrkWin ) { if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE ) @@ -328,7 +325,7 @@ throw (css::uno::RuntimeException) //==================================================================== -typedef std::hash_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap; +typedef boost::unordered_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap; static sal_Bool bMapInitialized = sal_False; static ToolBarResIdToResourceURLMap aResIdToResourceURLMap; @@ -527,7 +524,6 @@ void SfxWorkWindow::Sort_Impl() { sal_uInt16 k; for (k=0; k<aSortedList.Count(); k++) -// if ( (*pChilds)[aSortedList[k]]->eAlign > pCli->eAlign ) if (ChildAlignValue((*pChilds)[aSortedList[k]]->eAlign) > ChildAlignValue(pCli->eAlign)) break; @@ -540,7 +536,7 @@ void SfxWorkWindow::Sort_Impl() //==================================================================== -// ctor f"ur workwin eines Frames +// constructor for workwin of a Frame SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster ) : SfxWorkWindow( @@ -558,11 +554,11 @@ SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window *pWin, SfxFrame *pFrm, SfxFra bInternalDockingAllowed = sal_True; } - // Die ben"otigten SplitWindows (je eins f"ur jede Seite) werden erzeugt + // The required split windows (one for each side) can be created for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { - // Die SplitWindows sind direkte ChildWindows des WorkWindows und enthalten - // die angedockten Fenster. + // The SplitWindows excludes direct ChildWindows of the WorkWindows + // and receives the docked window. SfxChildAlignment eAlign = ( n == SFX_SPLITWINDOWS_LEFT ? SFX_ALIGN_LEFT : @@ -573,13 +569,12 @@ SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window *pWin, SfxFrame *pFrm, SfxFra pSplit[n] = pSplitWin; } - //nOrigMode = SFX_VISIBILITY_CLIENT; nOrigMode = SFX_VISIBILITY_STANDARD; nUpdateMode = SFX_VISIBILITY_STANDARD; } //==================================================================== -// ctor der Basisklasse +// Constructor of the base class SfxWorkWindow::SfxWorkWindow( Window *pWin, SfxBindings& rB, SfxWorkWindow* pParentWorkwin ) : pParent( pParentWorkwin ), @@ -602,15 +597,15 @@ SfxWorkWindow::SfxWorkWindow( Window *pWin, SfxBindings& rB, SfxWorkWindow* pPar m_aProgressBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" )) { DBG_CTOR(SfxWorkWindow, 0); - DBG_ASSERT (pBindings, "Keine Bindings!"); + DBG_ASSERT (pBindings, "No Bindings!"); pBindings->SetWorkWindow_Impl( this ); pChildWins = new SfxChildWindows_Impl; pChilds = new SfxChildList_Impl; - // F"ur die ObjectBars wird ein fester Platz in der ChildList reserviert, - // damit sie immer in einer definierten Reihenfolge kommen. + // For the ObjectBars a integral place in the Childlist is reserved, + // so that they always come in a defined order. SfxChild_Impl* pChild=0; for (sal_uInt16 n=0; n < SFX_OBJECTBAR_MAX; ++n) pChilds->Insert(0,pChild); @@ -625,13 +620,13 @@ SfxWorkWindow::SfxWorkWindow( Window *pWin, SfxBindings& rB, SfxWorkWindow* pPar } //==================================================================== -// dtor +// Destructor SfxWorkWindow::~SfxWorkWindow() { DBG_DTOR(SfxWorkWindow, 0); - // SplitWindows l"oschen + // Delete SplitWindows for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { SfxSplitWindow *p = pSplit[n]; @@ -640,7 +635,7 @@ SfxWorkWindow::~SfxWorkWindow() delete p; } - // Hilfsstruktur f"ur Child-Windows l"oschen + // Delete help structure for Child-Windows DBG_ASSERT( pChilds->Count() == 0, "dangling childs" ); delete pChilds; delete pChildWins; @@ -665,7 +660,7 @@ void SfxWorkWindow::Lock_Impl( sal_Bool bLock ) --m_nLock; if ( m_nLock<0 ) { - DBG_ERROR("Lock count underflow!"); + OSL_FAIL("Lock count underflow!"); m_nLock = 0; } @@ -705,17 +700,17 @@ void SfxWorkWindow::SaveStatus_Impl() } //-------------------------------------------------------------------- -// Hilfsmethode zum Freigeben der Childlisten. Wenn danach nicht der dtor -// aufgerufen wird, sondern weiter gearbeitet wird, mu\s wie im ctor von -// SfxWorkWindow noch Platz f"ur die Objectbars und SplitWindows reserviert -// werden. +// Helper method to release the child lists. Should the destructor not be +// called after this, instead work continues, then space for the object bars +// and split windows has to be reserved in the same way as in the constructor +// of SfxWorkWindow. void SfxWorkWindow::DeleteControllers_Impl() { DBG_CHKTHIS(SfxWorkWindow, 0); - // SplitWindows locken (d.h. Resize-Reaktion an den - // DockingWindows unterdr"ucken) + // Lock SplitWindows (which means supressing the Resize-Reaction of the + // DockingWindows) sal_uInt16 n; for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { @@ -724,7 +719,7 @@ void SfxWorkWindow::DeleteControllers_Impl() p->Lock(); } - // Child-Windows l"oschen + // Delete Child-Windows for ( n=0; n<pChildWins->Count(); ) { SfxChildWin_Impl* pCW = (*pChildWins)[n]; @@ -732,18 +727,12 @@ void SfxWorkWindow::DeleteControllers_Impl() SfxChildWindow *pChild = pCW->pWin; if (pChild) { -/* - sal_uInt16 nFlags = pCW->aInfo.nFlags; - pCW->aInfo = pChild->GetInfo(); - pCW->aInfo.nFlags |= nFlags; - SaveStatus_Impl(pChild, pCW->aInfo); -*/ pChild->Hide(); - // Wenn das ChildWindow ein direktes Childfenster ist und nicht - // in einem SplitWindow liegt, am WorkWindow abmelden. - // Nach TH ist eine Abmeldung am Splitwindow nicht erforderlich, - // wenn dieses auch gleich mit zerst"ort wird (s.u.). + // If the child window is a direct child window and not in a + // SplitWindow, cancel it at the workwindow. + // After TH a cancellation on the SplitWindow is not necessary + // since this window is also destroyed (see below). if (pCW->pCli) ReleaseChild_Impl(*pChild->GetWindow()); pCW->pWin = 0; @@ -756,14 +745,10 @@ void SfxWorkWindow::DeleteControllers_Impl() // ATTENTION: The array itself is cleared after this loop!! // Therefore we have to set every array entry to zero as it could be // accessed by calling pChild->Destroy(). - // See task 128307 (Windows) // Window::NotifyAllChilds() calls SfxWorkWindow::DataChanged_Impl for // 8-bit displays (WM_QUERYPALETTECHANGED message due to focus change)!! - //(*pChildWins)[n] = 0; } - //pChildWins->Remove((sal_uInt16)0, nCount); - Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface(); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -783,21 +768,22 @@ void SfxWorkWindow::DeleteControllers_Impl() { xLayoutManager->reset(); - // StatusBar l"oschen + // Delete StatusBar ResetStatusBar_Impl(); - // ObjectBars l"oschen( zuletzt, damit pChilds nicht tote Pointer enh"alt ) + // Delete ObjectBars (this is done last, so that pChilds does not + // receive dead Pointers) for ( sal_uInt16 i = 0; i < aObjBarList.size(); i++ ) { - // Nicht jede Position mu\s belegt sein + // Not every position must be occupied sal_uInt16 nId = aObjBarList[i].nId; if ( nId ) aObjBarList[i].nId = 0; } } - // ObjectBars werden alle auf einmal released, da sie einen - // festen zusammenh"angenden Bereich im Array pChilds belegen + // ObjectBars are all released at once, since they occupy a + // fixed contiguous area in the array pChild pChilds->Remove(0, SFX_OBJECTBAR_MAX); bSorted = sal_False; @@ -805,7 +791,7 @@ void SfxWorkWindow::DeleteControllers_Impl() } //==================================================================== -// Virtuelle Methode zum Anordnen der Childfenster. +// Virtual method for placing the child window. void SfxWorkWindow::ArrangeChilds_Impl( sal_Bool /*bForce*/) { @@ -835,16 +821,14 @@ void SfxFrameWorkWin_Impl::ArrangeChilds_Impl( sal_Bool bForce ) if ( IsVisible_Impl() ) aBorder = Arrange_Impl(); } - - // Wenn das aktuelle Dokument der Applikation einen IPClient enth"alt, mu\s - // dem dazugeh"origen Objekt durch SetTopToolFramePixel der zur Verf"ugung - // stehende Platz zugeteilt werden. Das Objekt zeigt dann seine UITools an - // und setzt den App-Border(->SfxInPlaceEnv_Impl::ArrangeChilds_Impl()). - // Anderenfalls wird hier direkt der AppBorder gesetzt, um evtl. den Border - // zu "uberschreiben, den bisher ein Objekt aus einem anderen Dokument - // gesetzt hatte. - // Das Objekt setzt, wenn es seine UI-Tools wegnimmt, den SetAppBorder nicht, - // damit kein ObjectBar-Zappeln entsteht. + // If the current application document contains a IPClient, then the + // object through SetTopToolFramePixel has to be assigned the available + // space. The object will then point to its UITools and sets the app border + // (-> SfxInPlaceEnv_Impl:: ArrangeChilds_Impl ()). Otherwise the + // app border is set here directly to possibly overwrite the Border that + // was set by an object from another document. The object does not set + // the SetAppBorder when it removes its UI tools so that no-dithering + // ObjectBar arises. // (->SfxInPlaceEnv_Impl::ArrangeChilds_Impl()) pMasterFrame->SetToolSpaceBorderPixel_Impl( aBorder ); @@ -856,13 +840,12 @@ void SfxFrameWorkWin_Impl::ArrangeChilds_Impl( sal_Bool bForce ) SvBorder SfxWorkWindow::Arrange_Impl() -/* [Beschreibung] - - Diese Methode ordnet alle sichtbaren ChildFenster so an, da\s die angedockten - Fenster nach der Sorierreihenfolge von au\sen nach innen aneinander - gesetzt werden. Wenn ein an sich sichtbares Fenster nicht mehr in die - noch freie ClientArea pa\st, wird es auf "nicht sichtbar" gesetzt. +/* [Description] + This method organizes all visible child windows so that the docked window + sorted in order from the outside to the inside are placed after one + another. If a visible window does not fit anymore into the free + ClientArea, it is set to "not visible". */ { DBG_CHKTHIS(SfxWorkWindow, 0); @@ -887,10 +870,10 @@ SvBorder SfxWorkWindow::Arrange_Impl() if ( !pCli->pWin ) continue; - // Zun"achst nehmen wir an, da\s das Fenster Platz hat + // First, we assume that there is room for the window. pCli->nVisible |= CHILD_FITS_IN; - // Nicht sichtbare Fenster "uberspringen + // Skip invisiable windows if (pCli->nVisible != CHILD_VISIBLE) continue; @@ -1007,8 +990,7 @@ SvBorder SfxWorkWindow::Arrange_Impl() } //-------------------------------------------------------------------- -// Close-Handler: die Konfiguration der ChildWindows wird gespeichert. -// +// Close-Handler: The Configuration of the ChildWindows is saved. void SfxWorkWindow::Close_Impl() { @@ -1045,7 +1027,7 @@ SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( Window& rWindow, SfxChildAlignment eAlign, sal_Bool bCanGetFocus ) { DBG_CHKTHIS(SfxWorkWindow, 0); - DBG_ASSERT( pChilds->Count() < 255, "too many childs" ); + DBG_ASSERT( pChilds->Count() < 255, "too many children" ); DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" ); DBG_ASSERT( !FindChild_Impl(rWindow), "child registered more than once" ); @@ -1070,7 +1052,6 @@ void SfxWorkWindow::AlignChild_Impl( Window& rWindow, SfxChildAlignment eAlign ) { DBG_CHKTHIS(SfxWorkWindow, 0); -// DBG_ASSERT( pChilds, "aligning unregistered child" ); DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" ); SfxChild_Impl *pChild = FindChild_Impl(rWindow); @@ -1084,7 +1065,7 @@ void SfxWorkWindow::AlignChild_Impl( Window& rWindow, pChild->bResize = sal_True; } else { - DBG_ERROR( "aligning unregistered child" ); + OSL_FAIL( "aligning unregistered child" ); } } @@ -1093,7 +1074,6 @@ void SfxWorkWindow::AlignChild_Impl( Window& rWindow, void SfxWorkWindow::ReleaseChild_Impl( Window& rWindow ) { DBG_CHKTHIS(SfxWorkWindow, 0); -// DBG_ASSERT( pChilds, "releasing unregistered child" ); SfxChild_Impl *pChild = 0; sal_uInt16 nPos; @@ -1113,7 +1093,7 @@ void SfxWorkWindow::ReleaseChild_Impl( Window& rWindow ) delete pChild; } else { - DBG_ERROR( "releasing unregistered child" ); + OSL_FAIL( "releasing unregistered child" ); } } @@ -1294,11 +1274,10 @@ void SfxWorkWindow::SetObjectBar_Impl( sal_uInt16 nPos, sal_uInt32 nResId, bool SfxWorkWindow::KnowsObjectBar_Impl( sal_uInt16 nPos ) const -/* [Beschreibung] +/* [Description] - Stellt fest, ob an der betreffenden Position "uberhaupt eine - Objektleiste zur Verf"ugung stehen w"urde. Ist unabh"agig davon, - ob diese tats"achlich ein- oder ausgeschaltet ist. + Determines if a object list is available at the position in question. + This is independent for the fact whether it is actually turned on or off. */ { @@ -1356,7 +1335,6 @@ void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl() SfxWorkWindow::UpdateObjectBars_Impl(); -// if ( pTask->IsActive() ) { pWork = pParent; while ( pWork ) @@ -1443,8 +1421,8 @@ sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell ) void SfxWorkWindow::UpdateObjectBars_Impl() { - // SplitWindows locken (d.h. Resize-Reaktion an den - // DockingWindows unterdr"ucken) + // Lock SplitWindows (which means supressing the Resize-Reaction of the + // DockingWindows) sal_uInt16 n; for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { @@ -1453,7 +1431,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl() p->Lock(); } - // was man so "ofters braucht, merkt man sich (spart Code und Laufzeit) + // you realize what is needed often (saves Code and execution time) SFX_APP(); Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); @@ -1478,21 +1456,21 @@ void SfxWorkWindow::UpdateObjectBars_Impl() bPluginMode = IsPluginMode( pFrame->GetObjectShell() ); } - // "uber alle Toolboxen iterieren + // Iterate over all Toolboxes xLayoutManager->lock(); for ( n = 0; n < aObjBarList.size(); ++n ) { sal_uInt16 nId = aObjBarList[n].nId; sal_Bool bDestroy = aObjBarList[n].bDestroy; - // die Modi bestimmen, f"ur die die ToolBox gilt + // Determine the vaild mode for the ToolBox sal_uInt16 nTbxMode = aObjBarList[n].nMode; bool bFullScreenTbx = SFX_VISIBILITY_FULLSCREEN == ( nTbxMode & SFX_VISIBILITY_FULLSCREEN ); nTbxMode &= ~SFX_VISIBILITY_FULLSCREEN; nTbxMode &= ~SFX_VISIBILITY_VIEWER; - // wird in diesem Kontext eine ToolBox gefordert? + // Is a ToolBox required in this context ? bool bModesMatching = ( nUpdateMode && ( nTbxMode & nUpdateMode) == nUpdateMode ); if ( bDestroy ) { @@ -1516,7 +1494,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl() } else if ( nId != 0 ) { - // ggf. Toolbox an dieser Position l"oschen + // Delete the Toolbox at this Position if possible rtl::OUString aTbxId( m_aTbxTypeName ); aTbxId += GetResourceURLFromResId( aObjBarList[n].nId ); xLayoutManager->destroyElement( aTbxId ); @@ -1530,7 +1508,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl() UpdateChildWindows_Impl(); - // SplitWindows wieder ent-locken + // Unlock the SplitWindows again for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { SfxSplitWindow *p = pSplit[n]; @@ -1551,7 +1529,7 @@ bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW void SfxWorkWindow::UpdateChildWindows_Impl() { - // alle vorhandenen oder in den Kontext gekommenen ChildWindows + // any current or in the context available Childwindows for ( sal_uInt16 n=0; n<pChildWins->Count(); n++ ) { SfxChildWin_Impl *pCW = (*pChildWins)[n]; @@ -1559,8 +1537,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl() sal_Bool bCreate = sal_False; if ( pCW->nId && !pCW->bDisabled && (pCW->aInfo.nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE || IsVisible_Impl( pCW->nVisibility ) ) ) { - // Im Kontext ist ein geeignetes ChildWindow erlaubt; - // ist es auch eingeschaltet ? + // In the context is an appropriate ChildWindow allowed; + // it is also turned on? if ( pChildWin == NULL && pCW->bCreate ) { // Internal docking is only used for embedding into another @@ -1574,7 +1552,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl() } else if ( !IsDockingAllowed() || bIsFullScreen ) // || !bInternalDocking ) { - // im PresentationMode oder FullScreen nur FloatingWindows + // In Presentation mode or FullScreen only FloatingWindows SfxChildAlignment eAlign; if ( pCW->aInfo.GetExtraData_Impl( &eAlign ) ) bCreate = ( eAlign == SFX_ALIGN_NOALIGNMENT ); @@ -1585,8 +1563,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl() if ( bCreate ) bCreate = AllowChildWindowCreation_Impl( *pCW ); - // Momentan kein Fenster da, aber es ist eingeschaltet; Fenster - // und ggf. Context erzeugen + // Currently, no window here, but it is enabled; windows + // Create window and if possible theContext if ( bCreate ) CreateChildWin_Impl( pCW, sal_False ); @@ -1598,23 +1576,23 @@ void SfxWorkWindow::UpdateChildWindows_Impl() } else if ( pChildWin ) { - // Fenster existiert schon; soll es auch sichtbar sein ? + // Window already exists, it should also be visible? if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildsVisible ) { - // Updatemode ist kompatibel; auf jeden Fall wieder einschalten + // Update Mode is compatible; definitely enable it bCreate = AllowChildWindowCreation_Impl( *pCW ); if ( bCreate ) { if ( pCW->pCli ) { - // Fenster ist direktes Child + // The window is a direct Child if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; } else { if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) - // Fenster liegt in einem SplitWindow + // The window ia within a SplitWindow ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl(); } @@ -1654,21 +1632,15 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFoc if ( bSetFocus ) bSetFocus = pChildWin->WantsFocus(); pChildWin->SetWorkWindow_Impl( this ); -#if 0 - // Enable-Status richtig setzen - pChildWin->GetWindow()->EnableInput( pCW->bEnable && - ( pWorkWin->IsInputEnabled() /* || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) ); -#endif - // Zumindest der ExtraString wird beim Auswerten ver"andert, also neu holen + + // At least the extra string is changed during the evaluation, + // also get it anewed SfxChildWinInfo aInfo = pChildWin->GetInfo(); pCW->aInfo.aExtraString = aInfo.aExtraString; pCW->aInfo.bVisible = aInfo.bVisible; pCW->aInfo.nFlags |= aInfo.nFlags; - // Nein !! Sonst kann man keine Fenster defaultmaessig ausschalten ( Partwindow! ) -// pCW->aInfo.bVisible = sal_True; - - // Erzeugung war erfolgreich + // The creation was successful GetBindings().Invalidate(pCW->nId); sal_uInt16 nPos = pChildWin->GetPosition(); @@ -1676,9 +1648,8 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFoc { DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!"); if ((*pChilds)[TbxMatch(nPos)])// && -// pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign ) { - // ChildWindow ersetzt ObjectBar + // ChildWindow replaces ObjectBar (*pChilds)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN; } } @@ -1690,9 +1661,8 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFoc if ( pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT || pChildWin->GetWindow()->GetParent() == pWorkWin) { - // Das Fenster ist entweder nicht angedockt oder au\serhalb - // eines SplitWindows angedockt und mu\s daher explizit als - // Child registriert werden + // The window is not docked or docked outside of one split windows + // and must therefore be registered explicitly as a Child pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment(), pChildWin->CanGetFocus()); pCW->pCli->nVisible = CHILD_VISIBLE; if ( pChildWin->GetAlignment() != SFX_ALIGN_NOALIGNMENT && bIsFullScreen ) @@ -1701,17 +1671,15 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFoc } else { - // Ein angedocktes Fenster, dessen Parent nicht das WorkWindow ist, - // mu\s in einem SplitWindow liegen und daher nicht explizit - // registriert werden. - // Das passiert aber schon bei der Initialisierung des - // SfxDockingWindows! + // A docked window which parent is not a WorkingWindow, must lie + // in a SplitWindow and thus not be explicitly registered. + // This happens already in the initialization of SfxDockingWindows! } if ( pCW->nInterfaceId != pChildWin->GetContextId() ) pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); - // Information in der INI-Datei sichern + // Save the information in the INI file SaveStatus_Impl(pChildWin, pCW->aInfo); } } @@ -1721,24 +1689,7 @@ void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW ) sal_uInt16 nId = pCW->nSaveId; SfxChildWindow *pChildWin = pCW->pWin; - // vorhandenes Fenster geht aus dem Kontext und wird daher entfernt - sal_uInt16 nPos = pChildWin->GetPosition(); - if (nPos != CHILDWIN_NOPOS) - { -/* - // ChildWindow "uberlagert einen ObjectBar - DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!"); - if ((*pChilds)[TbxMatch(nPos)] && - (aObjBars[nPos].nMode & nUpdateMode) ) //&& -// pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign ) - { - // ObjectBar war "uberlagert; jetzt wieder anzeigen - (*pChilds)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN; - } -*/ - } - - // Information in der INI-Datei sichern + // Save the information in the INI file sal_uInt16 nFlags = pCW->aInfo.nFlags; pCW->aInfo = pChildWin->GetInfo(); pCW->aInfo.nFlags |= nFlags; @@ -1748,15 +1699,15 @@ void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW ) if ( pCW->pCli ) { - // ChildWindow ist ein direktes ChildWindow und mu\s sich daher - // beim WorkWindow abmelden + // Child window is a direct child window and must therefore unregister + // itself from the WorkWindow pCW->pCli = 0; ReleaseChild_Impl(*pChildWin->GetWindow()); } else { - // ChildWindow liegt in einem SplitWindow und meldet sich - // selbst im dtor dort ab + // ChildWindow is within a SplitWindow and unregister itself in + // the destructor. } pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChildWin->GetWindow() ); @@ -1798,7 +1749,8 @@ void SfxWorkWindow::SetTempStatusBar_Impl( sal_Bool bSet ) aStatBar.bTemp = bSet; if ( !bOn || bReset || (!bSet && aStatBar.nId ) ) { - // Nur was tun, wenn die Temp-Einstellung wirklich was bewirkt + // Just do something if the temp settings really are causing + // anything UpdateStatusBar_Impl(); ArrangeChilds_Impl(); ShowChilds_Impl(); @@ -1817,42 +1769,25 @@ void SfxWorkWindow::UpdateStatusBar_Impl() Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName ); aValue >>= xLayoutManager; - // keine Statusleiste, wenn keine Id gew"unscht oder bei FullScreenView - // oder wenn ausgeschaltet + // No status bar, if no ID is required or when in FullScreenView or + // if disabled if ( aStatBar.nId && IsDockingAllowed() && bInternalDockingAllowed && bShowStatusBar && ( (aStatBar.bOn && !bIsFullScreen) || aStatBar.bTemp ) ) { - // Id hat sich ge"andert, also passenden Statusbarmanager erzeugen, - // dieser "ubernimmt die aktuelle Statusleiste; + // Id has changed, thus create a suitable Statusbarmanager, this takes + // over the current status bar; if ( xLayoutManager.is() ) xLayoutManager->requestElement( m_aStatusBarResName ); } else { - // Aktuelle StatusBar vernichten - // Der Manager erzeugt die Statusleiste nur, er zerst"ort sie - // nicht ! + // Destroy the current StatusBar + // The Manager only creates the Status bar, does not destroy it. if ( xLayoutManager.is() ) xLayoutManager->destroyElement( m_aStatusBarResName ); } } -//------------------------------------------------------------------------ -/* -void SfxWorkWindow::SetObjectBarVisibility_Impl( sal_uInt16 nMask ) -{ - switch( nMask ) - { - case SFX_VISIBILITY_UNVISIBLE: - case SFX_VISIBILITY_STANDARD: - case SFX_VISIBILITY_CLIENT: - case SFX_VISIBILITY_SERVER: - nOrigMode = nMask; - } - if (nMask != nUpdateMode) - nUpdateMode = nMask; -}*/ - void SfxWorkWindow::MakeVisible_Impl( sal_Bool bVis ) { if ( bVis ) @@ -1997,14 +1932,13 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, if ( nPos == USHRT_MAX ) return; -// SfxChild_Impl *pChild = (*pChilds)[nPos]; Rectangle aOuterRect( GetTopRect_Impl() ); aOuterRect.SetPos( pWorkWin->OutputToScreenPixel( aOuterRect.TopLeft() )); Rectangle aInnerRect( aOuterRect ); sal_Bool bTbx = (eChild == SFX_CHILDWIN_OBJECTBAR); - // Das gerade betroffene Fenster wird bei der Berechnung des - // inneren Rechtecks mit eingeschlossen! + // The current affected window is included in the calculation of + // the inner rectangle! for ( sal_uInt16 m=0; m<aSortedList.Count(); ++m ) { sal_uInt16 i=aSortedList[m]; @@ -2015,93 +1949,89 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, switch ( pCli->eAlign ) { case SFX_ALIGN_TOP: - // Objekt-Toolboxen kommen immer zuletzt - //if ( bTbx || i <= nPos) + // Objekt-Toolboxes come always last aInnerRect.Top() += pCli->aSize.Height(); break; case SFX_ALIGN_TOOLBOXTOP: - // Toolbox geht nur vor, wenn nicht h"ohere Position + // Toolbox has priority, if no higher Position if ( bTbx && i <= nPos) aInnerRect.Top() += pCli->aSize.Height(); break; case SFX_ALIGN_HIGHESTTOP: - // Geht immer vor + // Always performed first aInnerRect.Top() += pCli->aSize.Height(); break; case SFX_ALIGN_LOWESTTOP: - // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist + // Is only counted if it is the current window if ( i == nPos ) aInnerRect.Top() += pCli->aSize.Height(); break; case SFX_ALIGN_BOTTOM: - // Objekt-Toolboxen kommen immer zuletzt - //if ( bTbx || i <= nPos) + // Objekt-Toolboxes come always last aInnerRect.Bottom() -= pCli->aSize.Height(); break; case SFX_ALIGN_TOOLBOXBOTTOM: - // Toolbox geht nur vor, wenn nicht h"ohere Position + // Toolbox has priority, if no higher Position if ( bTbx && i <= nPos) aInnerRect.Bottom() -= pCli->aSize.Height(); break; case SFX_ALIGN_LOWESTBOTTOM: - // Geht immer vor + // Always performed first aInnerRect.Bottom() -= pCli->aSize.Height(); break; case SFX_ALIGN_HIGHESTBOTTOM: - // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist + // Is only counted if it is the current window if ( i == nPos ) aInnerRect.Bottom() -= pCli->aSize.Height(); break; case SFX_ALIGN_LEFT: - // Toolboxen kommen immer zuletzt - //if (bTbx || i <= nPos) + // Toolboxes come always last aInnerRect.Left() += pCli->aSize.Width(); break; case SFX_ALIGN_TOOLBOXLEFT: - // Toolboxen kommen immer zuletzt + // Toolboxes come always last if (bTbx && i <= nPos) aInnerRect.Left() += pCli->aSize.Width(); break; case SFX_ALIGN_FIRSTLEFT: - // Geht immer vor + // Always performed first aInnerRect.Left() += pCli->aSize.Width(); break; case SFX_ALIGN_LASTLEFT: - // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist + // Is only counted if it is the current window if (i == nPos) aInnerRect.Left() += pCli->aSize.Width(); case SFX_ALIGN_RIGHT: - // Toolboxen kommen immer zuletzt - //if (bTbx || i <= nPos) + // Toolboxes come always last aInnerRect.Right() -= pCli->aSize.Width(); break; case SFX_ALIGN_TOOLBOXRIGHT: - // Toolboxen kommen immer zuletzt + // Toolboxes come always last if (bTbx && i <= nPos) aInnerRect.Right() -= pCli->aSize.Width(); break; case SFX_ALIGN_FIRSTRIGHT: - // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist + // Is only counted if it is the current window if (i == nPos) aInnerRect.Right() -= pCli->aSize.Width(); break; case SFX_ALIGN_LASTRIGHT: - // Geht immer vor + // Always performed first aInnerRect.Right() -= pCli->aSize.Width(); break; @@ -2162,7 +2092,6 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, } } - //-------------------------------------------------------------------- void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnabled, sal_uInt16 nMode ) @@ -2173,14 +2102,14 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnable SfxChildWin_Impl *pCW=NULL; SfxWorkWindow *pWork = pParent; - // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow - // der Task bzw. des Frames oder am AppWorkWindow angemeldet + // Get the top parent, child windows are alwas registered at the + // task of the WorkWindow for example the frame or on AppWorkWindow while ( pWork && pWork->pParent ) pWork = pWork->pParent; if ( pWork ) { - // Dem Parent schon bekannt ? + // The Parent already known? sal_uInt16 nCount = pWork->pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pWork->pChildWins)[n]->nSaveId == nId) @@ -2192,7 +2121,7 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnable if ( !pCW ) { - // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen + // If no Parent or the Parent us still unknown, then search here sal_uInt16 nCount = pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pChildWins)[n]->nSaveId == nId) @@ -2204,8 +2133,8 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnable if ( !pCW ) { - // Ist neu, also initialisieren; je nach Flag beim Parent oder bei - // mir eintragen + // If new, then initialize, add this here depending on the flag or + // the Parent pCW = new SfxChildWin_Impl( lId ); pCW->nId = nId; InitializeChild_Impl( pCW ); @@ -2220,16 +2149,11 @@ void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnable pCW->nInterfaceId = nInter; pCW->nVisibility = nMode; pCW->bEnable = bEnabled; -#if 0 - if ( pCW->pWin ) - pCW->pWin->GetWindow()->EnableInput( bEnabled && - ( pWorkWin->IsInputEnabled() /* || pCW->pWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) ); -#endif pCW->nVisibility = nMode; } //-------------------------------------------------------------------- -// Der An/Aus-Status eines ChildWindows wird umgeschaltet. +// The on/of-Status of a ChildWindows is switched void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus) { @@ -2241,7 +2165,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus) if ( n<nCount ) { - // Das Fenster ist schon bekannt + // The Window is aleady known SfxChildWin_Impl *pCW = (*pChildWins)[n]; SfxChildWindow *pChild = pCW->pWin; @@ -2268,7 +2192,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus) } else { - // Fenster soll ausgeschaltet werdem + // The Window should be switched off pChild->SetVisible_Impl( sal_False ); RemoveChildWin_Impl( pCW ); } @@ -2331,11 +2255,11 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus) if ( n < nCount ) { - DBG_ERROR("ChildWindow ist nicht im Kontext!"); + OSL_FAIL("The ChildWindow is not in context!"); } else { - DBG_ERROR("ChildWindow ist nicht registriert!"); + OSL_FAIL("The ChildWindow is not registered!"); } #endif } @@ -2368,14 +2292,14 @@ sal_Bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) SfxChildWin_Impl *pCW=NULL; SfxWorkWindow *pWork = pParent; - // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow - // der Task bzw. des Frames oder am AppWorkWindow angemeldet + // Get the top parent, child windows are alwas registered at the + // task of the WorkWindow for example the frame or on AppWorkWindow while ( pWork && pWork->pParent ) pWork = pWork->pParent; if ( pWork ) { - // Dem Parent schon bekannt ? + // The Parent already known? sal_uInt16 nCount = pWork->pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pWork->pChildWins)[n]->nSaveId == nId) @@ -2387,7 +2311,7 @@ sal_Bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) if ( !pCW ) { - // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen + // If no Parent or the Parent us still unknown, then search here sal_uInt16 nCount = pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pChildWins)[n]->nSaveId == nId) @@ -2399,8 +2323,8 @@ sal_Bool SfxWorkWindow::IsFloating( sal_uInt16 nId ) if ( !pCW ) { - // Ist neu, also initialisieren; je nach Flag beim Parent oder bei - // mir eintragen + // If new, then initialize, add this here depending on the flag or + // the Parent pCW = new SfxChildWin_Impl( nId ); pCW->bEnable = sal_False; pCW->nId = 0; @@ -2452,14 +2376,14 @@ void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, sal_Bool bOn, sal_Bool b SfxChildWin_Impl *pCW=NULL; SfxWorkWindow *pWork = pParent; - // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow - // der Task bzw. des Frames oder am AppWorkWindow angemeldet + // Get the top parent, child windows are alwas registered at the + // task of the WorkWindow for example the frame or on AppWorkWindow while ( pWork && pWork->pParent ) pWork = pWork->pParent; if ( pWork ) { - // Dem Parent schon bekannt ? + // The Parent already known? sal_uInt16 nCount = pWork->pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pWork->pChildWins)[n]->nSaveId == nId) @@ -2471,7 +2395,7 @@ void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, sal_Bool bOn, sal_Bool b if ( !pCW ) { - // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen + // If no Parent or the Parent us still unknown, then search here sal_uInt16 nCount = pChildWins->Count(); for (sal_uInt16 n=0; n<nCount; n++) if ((*pChildWins)[n]->nSaveId == nId) @@ -2484,8 +2408,8 @@ void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, sal_Bool bOn, sal_Bool b if ( !pCW ) { - // Ist neu, also initialisieren; je nach Flag beim Parent oder bei - // mir eintragen + // If new, then initialize, add this here depending on the flag or + // the Parent pCW = new SfxChildWin_Impl( nId ); InitializeChild_Impl( pCW ); if ( !pWork || pCW->aInfo.nFlags & SFX_CHILDWIN_TASK ) @@ -2576,11 +2500,11 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, sal_Bool bVisible, sal_ if ( n<nCount ) { - DBG_ERROR("ChildWindow ist nicht im Kontext!"); + OSL_FAIL("The ChildWindow is not in context!"); } else { - DBG_ERROR("ChildWindow ist nicht registriert!"); + OSL_FAIL("The ChildWindow is not registered"); } #endif } @@ -2606,9 +2530,6 @@ SfxChildWindow* SfxWorkWindow::GetChildWindow_Impl(sal_uInt16 nId) void SfxWorkWindow::ResetChildWindows_Impl() { -// if ( pParent ) -// pParent->ResetChildWindows_Impl(); - for ( sal_uInt16 n = 0; n < pChildWins->Count(); ++n ) { (*pChildWins)[n]->nId = 0; @@ -2617,9 +2538,8 @@ void SfxWorkWindow::ResetChildWindows_Impl() } //------------------------------------------------------------------------ -// Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent -// windows liefert, in der Child-Fenster angeordnet werden k"onnen. -// in der ClientArea des parent findet. +// Virtual method that returns the size of the area (client area) of the +// parent windows, in which the ChildWindow can be fitted. Rectangle SfxWorkWindow::GetTopRect_Impl() { @@ -2627,9 +2547,8 @@ Rectangle SfxWorkWindow::GetTopRect_Impl() } //------------------------------------------------------------------------ -// Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent -// windows liefert, in der Child-Fenster angeordnet werden k"onnen. -// in der ClientArea des parent findet. +// Virtual method that returns the size of the area (client area) of the +// parent windows, in which the ChildWindow can be fitted. Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl() { @@ -2637,8 +2556,8 @@ Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl() } //------------------------------------------------------------------------ -// Virtuelle Methode, um herauszufinden, ob ein Child-Fenster noch Platz -// in der ClientArea des parent findet. +// Virtual method to find out if there is room for a ChildWindow in the +// client area of the parent. sal_Bool SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder ) { @@ -2652,7 +2571,7 @@ sal_Bool SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder ) void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow *pChild, const SfxChildWinInfo &rInfo) { - // Den Status vom Presentation mode wollen wir nicht sichern + // The Status of the Presentation mode is not saved if ( IsDockingAllowed() && bInternalDockingAllowed ) pChild->SaveStatus(rInfo); } @@ -2718,11 +2637,6 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW) } } } -/* -SfxStatBar_Impl* SfxWorkWindow::GetStatusBar_Impl() -{ - return &aStatBar; -} */ SfxSplitWindow* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign ) { @@ -2815,11 +2729,10 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) Rectangle aArea( aUpperClientArea ); for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { - // Es werden entweder Dummyfenster oder Fenster im AutoShow-Modus - // ( nicht gepinned, FadeIn ) behandelt. - // Nur das "ubergebene Fenster darf unsichtbar sein, denn vielleicht - // soll daf"ur gerade die Gr"o\se berechnet werden, bevor es angezeigt - // wird. + // Either dummy window or window in the auto-show-mode are processed + // (not pinned, FadeIn). + // Only the abandoned window may be invisible, because perhaps its + // size is just beeing calculated before it is displayed. SfxSplitWindow* pSplitWin = pSplit[n]; sal_Bool bDummyWindow = !pSplitWin->IsFadeIn(); Window *pDummy = pSplitWin->GetSplitWindow(); @@ -2827,7 +2740,7 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) if ( (pSplitWin->IsPinned() && !bDummyWindow) || (!pWin->IsVisible() && pActSplitWin != pSplitWin) ) continue; - // Breite und Position des Dummy-Fensters als Ausgangspunkt + // Width and position of the dummy window as a starting point Size aSize = pDummy->GetSizePixel(); Point aPos = pDummy->GetPosPixel(); @@ -2835,13 +2748,13 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) { case ( 0 ) : { - // Linkes SplitWindow - // Breite vom Fenster selbst holen, wenn nicht das DummyWindow + // Left SplitWindow + // Get the width of the Window yourself, if no DummyWindow if ( !bDummyWindow ) aSize.Width() = pSplitWin->GetSizePixel().Width(); - // Wenn links ein Window sichtbar ist, beginnt der freie - // Bereich rechts davon bzw. bei der Client area + // If a Window is visable to the left, then the free region + // starts to the right from it, for example at the Client area long nLeft = aPos.X() + aSize.Width(); if ( nLeft > aArea.Left() ) aArea.Left() = nLeft; @@ -2849,26 +2762,26 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) } case ( 1 ) : { - // Rechtes SplitWindow - // Position um Differenz der Breiten korrigieren + // Right SplitWindow + // Position to correct the difference of the widths aPos.X() += aSize.Width(); - // Breite vom Fenster selbst holen, wenn nicht das DummyWindow + // Get the width of the Window yourself, if no DummyWindow if ( !bDummyWindow ) aSize.Width() = pSplitWin->GetSizePixel().Width(); aPos.X() -= aSize.Width(); - // Wenn links schon ein Fenster aufgeklappt ist, darf - // das rechte nicht dar"uber gehen + // If already a window is opened at the left side, then the + // right is not allowed to overlap this one. if ( aPos.X() < aArea.Left() ) { aPos.X() = aArea.Left(); aSize.Width() = aArea.GetWidth(); } - // Wenn rechts ein Window sichtbar ist, endet der freie - // Bereich links davon bzw. bei der Client area + // If a Window is visable to the right, then the free region + // starts to the left from it, for example at the Client area long nRight = aPos.X(); if ( nRight < aArea.Right() ) aArea.Right() = nRight; @@ -2876,18 +2789,19 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) } case ( 2 ) : { - // Oberes SplitWindow - // H"ohe vom Fenster selbst holen, wenn nicht das DummyWindow + // Top SplitWindow + // Get the height of the Window yourself, if no DummyWindow if ( !bDummyWindow ) aSize.Height() = pSplitWin->GetSizePixel().Height(); - // Breite anpassen, je nachdem ob links oder rechts - // schon ein Fenster aufgeklappt ist + + // Adjust width with regard to if a Window is already open + // to the left or right aPos.X() = aArea.Left(); aSize.Width() = aArea.GetWidth(); - // Wenn oben ein Window sichtbar ist, beginnt der freie - // Bereich darunter bzw. bei der Client Area + // If a Window is visable at the top, then the free region + // starts beneath it, for example at the Client area long nTop = aPos.Y() + aSize.Height(); if ( nTop > aArea.Top() ) aArea.Top() = nTop; @@ -2895,23 +2809,23 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) } case ( 3 ) : { - // Das untere SplitWindow - // Position um Differenz der H"ohen korrigieren + // The bottom SplitWindow + // Position to correct the difference of the heights aPos.Y() += aSize.Height(); - // H"ohe vom Fenster selbst holen, wenn nicht das DummmyWindow + // Get the height of the Window yourself, if no DummyWindow if ( !bDummyWindow ) aSize.Height() = pSplitWin->GetSizePixel().Height(); aPos.Y() -= aSize.Height(); - // Breite anpassen, je nachdem ob links oder rechts - // schon ein Fenster aufgeklappt ist + // Adjust width with regard to if a Window is already open + // to the left or right. aPos.X() = aArea.Left(); aSize.Width() = aArea.GetWidth(); - // Wenn oben schon ein Fenster aufgeklappt ist, darf - // das untere nicht dar"uber gehen + // If already a window is opened at the top, then the + // bottom one is not allowed to overlap this one. if ( aPos.Y() < aArea.Top() ) { aPos.Y() = aArea.Top(); @@ -2923,11 +2837,11 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin ) } if ( !bDummyWindow ) - // Das FadeIn-Window ist ein Float, dessen Koordinaten in - // Screenkoordinaten gesetzt werden + // the FadeIn-Window is a Floating window, which coordinates are + // set in Screen coordinates. pSplitWin->SetPosSizePixel( pWorkWin->OutputToScreenPixel(aPos), aSize ); else - // Das angedockte DummyWindow + // the docked DummyWindow pDummy->SetPosSizePixel( aPos, aSize ); } } @@ -3010,7 +2924,7 @@ Window* SfxWorkWindow::GetActiveChild_Impl() sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward ) { - // Alle Kinder gem"a\s Liste sortieren + // Sort all children under list SvUShorts aList; for ( sal_uInt16 i=SFX_OBJECTBAR_MAX; i<pChilds->Count(); i++) { @@ -3040,7 +2954,7 @@ sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward ) SfxChild_Impl *pAct=NULL; if ( pActiveChild ) { - // Das aktive Fenster suchen + // Look for the active window for ( n=0; n<aList.Count(); n++ ) { SfxChild_Impl* pCli = (*pChilds)[aList[n]]; @@ -3060,7 +2974,7 @@ sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward ) { for ( sal_uInt16 i=0; i<SFX_SPLITWINDOWS_MAX; i++ ) { - // Eventuell ist pAct ein Splitwindow + // Maybe the pNext is a Splitwindow SfxSplitWindow *p = pSplit[i]; if ( pAct->pWin == p ) { @@ -3070,8 +2984,8 @@ sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward ) } } - // pAct ist ein direktes ChildWindow - // mit dem Nachfolger bzw. Vorg"anger des aktiven Fensters weitermachen + // pAct is a direct ChildWindow + // continue with the successor or predecessor of the active window if ( bForward ) n = n+1; else @@ -3089,11 +3003,11 @@ sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward ) SfxChild_Impl* pNext = pCli; for ( sal_uInt16 i=0; n<SFX_SPLITWINDOWS_MAX; n++ ) { - // Eventuell ist pNext ein Splitwindow + // Maybe the pNext is a Splitwindow SfxSplitWindow *p = pSplit[i]; if ( pNext->pWin == p ) { - // Das erste/letzte Fenster dort aktivieren + // Activate the first/last window p->SetActiveWindow_Impl( NULL ); pNext = NULL; if( p->ActivateNextChild_Impl( bForward ) ) @@ -3140,3 +3054,4 @@ void SfxWorkWindow::DataChanged_Impl( const DataChangedEvent& ) ArrangeChilds_Impl(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 6e6606a67041..17a27c6c8ce9 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,15 +48,15 @@ using namespace ::com::sun::star; uno::Sequence< ::rtl::OUString > SAL_CALL OPackageStructureCreator::impl_getStaticSupportedServiceNames() { uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.PackageStructureCreator"); - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.PackageStructureCreator"); + aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.PackageStructureCreator")); + aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.PackageStructureCreator")); return aRet; } //------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OPackageStructureCreator::impl_getStaticImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.PackageStructureCreator"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.PackageStructureCreator")); } //------------------------------------------------------------------------- @@ -200,3 +201,4 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OPackageStructureCreator::getSupported return impl_getStaticSupportedServiceNames(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/xpackcreator.hxx b/sfx2/source/appl/xpackcreator.hxx index ff3b84dbec64..03ef58e27e03 100644 --- a/sfx2/source/appl/xpackcreator.hxx +++ b/sfx2/source/appl/xpackcreator.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/bastyp.hrc b/sfx2/source/bastyp/bastyp.hrc index b585ac79f035..fd53e2577212 100644..100755 --- a/sfx2/source/bastyp/bastyp.hrc +++ b/sfx2/source/bastyp/bastyp.hrc @@ -27,12 +27,12 @@ #include <sfx2/sfx.hrc> -//fuer das Mapping Fehlercode -> ResId +//for the mapping error code -> ResId -#define RC_BASTYP RID_SFX_BASTYP_START -#define STR_FILTER_NOT_INSTALLED (RC_BASTYP + 9) -#define STR_FILTER_CONSULT_SERVICE (RC_BASTYP + 10) -#define STR_MEMEXCEPTION (RC_BASTYP + 28) -#define MSG_MEM_WARN (RC_BASTYP + 29) -#define STR_HTML_GENERATOR (RC_BASTYP + 30) +#define RC_BASTYP RID_SFX_BASTYP_START +#define STR_FILTER_NOT_INSTALLED (RC_BASTYP + 9) +#define STR_FILTER_CONSULT_SERVICE (RC_BASTYP + 10) +#define STR_MEMEXCEPTION (RC_BASTYP + 28) +#define MSG_MEM_WARN (RC_BASTYP + 29) +#define STR_HTML_GENERATOR (RC_BASTYP + 30) diff --git a/sfx2/source/bastyp/bitset.cxx b/sfx2/source/bastyp/bitset.cxx index dde66315720f..6dead7468b30 100644 --- a/sfx2/source/bastyp/bitset.cxx +++ b/sfx2/source/bastyp/bitset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" #include <tools/debug.hxx> -#ifndef GCC -#endif #include "bitset.hxx" @@ -229,8 +228,8 @@ BitSet& BitSet::operator=( sal_uInt16 nBit ) sal_uIntPtr nBitVal = 1L << (nBit % 32); nCount = 1; - pBitmap = new sal_uIntPtr[nBlocks]; - memset( pBitmap + nBlocks, 0, 4 * nBlocks ); + pBitmap = new sal_uIntPtr[nBlocks + 1]; + memset( pBitmap, 0, 4 * (nBlocks + 1) ); *(pBitmap+nBlocks) = nBitVal; @@ -393,3 +392,4 @@ sal_uInt16 IndexBitSet::GetFreeIndex() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index f73e6e5498ad..348399b34a6a 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,9 +41,7 @@ #include <comphelper/sequenceashashmap.hxx> -#ifndef _EXCHANGE_HXX //autogen #include <sot/exchange.hxx> -#endif #include <tools/config.hxx> #include <basic/sbmeth.hxx> #include <basic/basmgr.hxx> @@ -50,12 +49,8 @@ #include <basic/sbxobj.hxx> #include <basic/sbxmeth.hxx> #include <basic/sbxcore.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif -#ifndef _RTL_USTRING_HXX //autogen #include <rtl/ustring.hxx> -#endif #include <rtl/ustrbuf.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> @@ -84,28 +79,25 @@ #include <com/sun/star/frame/XFilterDetect.hpp> #include <com/sun/star/loader/XImplementationLoader.hpp> #include <com/sun/star/loader/CannotActivateFactoryException.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <com/sun/star/beans/PropertyValue.hpp> #include <sal/types.h> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/ucb/XContent.hpp> #include <rtl/ustring.hxx> -#include <vos/process.hxx> #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> #include <comphelper/mediadescriptor.hxx> #include <tools/urlobj.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::document; using namespace ::com::sun::star::beans; -using namespace ::vos; #include <svl/ctypeitm.hxx> #include <svtools/sfxecode.hxx> #include <unotools/syslocale.hxx> @@ -131,13 +123,21 @@ using namespace ::vos; #include <sfx2/appuno.hxx> #include <sfx2/viewfrm.hxx> +#include <boost/ptr_container/ptr_vector.hpp> +#include <functional> + +namespace +{ + class theSfxFilterListener : public rtl::Static<SfxFilterListener, theSfxFilterListener> {}; +} + static SfxFilterList_Impl* pFilterArr = 0; static sal_Bool bFirstRead = sal_True; static void CreateFilterArr() { pFilterArr = new SfxFilterList_Impl; - new SfxFilterListener(); + theSfxFilterListener::get(); } //---------------------------------------------------------------- @@ -191,6 +191,7 @@ SfxFilterContainer::SfxFilterContainer( const String& rName ) SfxFilterContainer::~SfxFilterContainer() { + delete pImpl; } //---------------------------------------------------------------- @@ -226,7 +227,7 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const String& rName const SfxFilter* pFilter = aMatcher.GetFilter4FilterName(sDefaultFilter); if ( - (pFilter ) && + (pFilter) && (pFilter->GetServiceName().CompareIgnoreCaseToAscii( sServiceName ) != COMPARE_EQUAL) ) { @@ -240,10 +241,9 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const String& rName if ( bFirstRead ) ReadFilters_Impl(); - sal_uInt16 nCount = ( sal_uInt16 ) pFilterArr->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i ) { - const SfxFilter* pCheckFilter = pFilterArr->GetObject( n ); + const SfxFilter* pCheckFilter = pFilterArr->at( i ); if ( pCheckFilter->GetServiceName().CompareIgnoreCaseToAscii( sServiceName ) == COMPARE_EQUAL ) { pFilter = pCheckFilter; @@ -258,9 +258,6 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const String& rName //---------------------------------------------------------------- -class SfxFilterMatcherArr_Impl; -static SfxFilterMatcherArr_Impl* pImplArr = 0; - // Impl-Data is shared between all FilterMatchers of the same factory class SfxFilterMatcher_Impl { @@ -268,52 +265,75 @@ public: ::rtl::OUString aName; SfxFilterList_Impl* pList; // is created on demand - void InitForIterating() const; - void Update(); - SfxFilterMatcher_Impl() - : pList(0) - {} + void InitForIterating() const; + void Update(); + SfxFilterMatcher_Impl(const ::rtl::OUString &rName) + : aName(rName) + , pList(0) + { + } }; -DECL_PTRARRAY( SfxFilterMatcherArr_Impl, SfxFilterMatcher_Impl*, 2, 2 ) - -SfxFilterMatcher::SfxFilterMatcher( const String& rName ) - : pImpl( 0 ) +namespace { - if ( !pImplArr ) - // keep track of created filter matchers to recycle the FilterLists - pImplArr = new SfxFilterMatcherArr_Impl; + typedef boost::ptr_vector<SfxFilterMatcher_Impl> SfxFilterMatcherArr_Impl; + static SfxFilterMatcherArr_Impl aImplArr; + static int nSfxFilterMatcherCount; - String aName = SfxObjectShell::GetServiceNameFromFactory( rName ); - DBG_ASSERT(aName.Len(), "Found boes type :-)"); - for ( sal_uInt16 n=0; n<pImplArr->Count(); n++ ) + class hasName : + public std::unary_function<SfxFilterMatcher_Impl, bool> { - // find the impl-Data of any comparable FilterMatcher that was created before - SfxFilterMatcher_Impl* pImp = pImplArr->GetObject(n); - if ( String(pImp->aName) == aName ) - pImpl = pImp; - } + private: + const rtl::OUString& mrName; + public: + hasName(const rtl::OUString &rName) : mrName(rName) {} + bool operator() (const SfxFilterMatcher_Impl& rImpl) const + { + return rImpl.aName == mrName; + } + }; - if ( !pImpl ) + SfxFilterMatcher_Impl & getSfxFilterMatcher_Impl(const rtl::OUString &rName) { + rtl::OUString aName; + + if (rName.getLength()) + aName = SfxObjectShell::GetServiceNameFromFactory(rName); + + // find the impl-Data of any comparable FilterMatcher that was created + // previously + SfxFilterMatcherArr_Impl::iterator aEnd = aImplArr.end(); + SfxFilterMatcherArr_Impl::iterator aIter = + std::find_if(aImplArr.begin(), aEnd, hasName(rName)); + if (aIter != aEnd) + return *aIter; + // first Matcher created for this factory - pImpl = new SfxFilterMatcher_Impl; - pImpl->aName = aName; - pImplArr->Insert( pImplArr->Count(), pImpl ); + SfxFilterMatcher_Impl *pImpl = new SfxFilterMatcher_Impl(aName); + aImplArr.push_back(pImpl); + return *pImpl; } } +SfxFilterMatcher::SfxFilterMatcher( const String& rName ) + : m_rImpl( getSfxFilterMatcher_Impl(rName) ) +{ + ++nSfxFilterMatcherCount; +} + SfxFilterMatcher::SfxFilterMatcher() + : m_rImpl( getSfxFilterMatcher_Impl(::rtl::OUString()) ) { - // global FilterMatcher always uses global filter array (also created on demand) - pImpl = new SfxFilterMatcher_Impl; + // global FilterMatcher always uses global filter array (also created on + // demand) + ++nSfxFilterMatcherCount; } SfxFilterMatcher::~SfxFilterMatcher() { - if ( !pImpl->aName.getLength() ) - // only the global Matcher owns his ImplData - delete pImpl; + --nSfxFilterMatcherCount; + if (nSfxFilterMatcherCount == 0) + aImplArr.clear(); } void SfxFilterMatcher_Impl::Update() @@ -321,12 +341,12 @@ void SfxFilterMatcher_Impl::Update() if ( pList ) { // this List was already used - pList->Clear(); - for ( sal_uInt16 n=0; n<pFilterArr->Count(); n++ ) + pList->clear(); + for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i ) { - SfxFilter* pFilter = pFilterArr->GetObject(n); + SfxFilter* pFilter = pFilterArr->at( i ); if ( pFilter->GetServiceName() == String(aName) ) - pList->Insert( pFilter, LIST_APPEND ); + pList->push_back( pFilter ); } } } @@ -355,11 +375,10 @@ void SfxFilterMatcher_Impl::InitForIterating() const const SfxFilter* SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const { - pImpl->InitForIterating(); - sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + m_rImpl.InitForIterating(); + for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pImpl->pList->GetObject( n ); + const SfxFilter* pFilter = m_rImpl.pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) return pFilter; @@ -373,14 +392,13 @@ const SfxFilter* SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilter sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter**ppFilter, - SfxFilterFlags /*nMust*/, - SfxFilterFlags /*nDont*/ ) const + SfxFilterFlags nMust, + SfxFilterFlags nDont ) const { - Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), UNO_QUERY ); + Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))), UNO_QUERY ); ::rtl::OUString sTypeName; try { - //!MBA: nmust, ndont? sTypeName = xDetection->queryTypeByURL( rMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ); } catch( Exception& ) @@ -389,7 +407,11 @@ sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent( *ppFilter = NULL; if ( sTypeName.getLength() ) - *ppFilter = GetFilter4EA( sTypeName ); + { + // make sure filter list is initialized + m_rImpl.InitForIterating(); + *ppFilter = GetFilter4EA( sTypeName, nMust, nDont ); + } return *ppFilter ? ERRCODE_NONE : ERRCODE_ABORT; } @@ -406,7 +428,7 @@ if( nErr == 1 || nErr == USHRT_MAX || nErr == ULONG_MAX ) \ aText += ' '; \ aText += ByteString(U2S(pFilter->GetFilterName())); \ } \ - DBG_ERROR( aText.GetBuffer() ); \ + OSL_FAIL( aText.GetBuffer() ); \ nErr = ERRCODE_ABORT; \ } @@ -424,7 +446,7 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c const SfxFilter* pOldFilter = *ppFilter; // no detection service -> nothing to do ! - Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), UNO_QUERY ); + Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))), UNO_QUERY ); if (!xDetection.is()) return ERRCODE_ABORT; @@ -446,8 +468,8 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c aDescriptor[::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] <<= xInStream; aDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= rMedium.GetInteractionHandler(); - if ( pImpl->aName.getLength() ) - aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE()] <<= pImpl->aName; + if ( m_rImpl.aName.getLength() ) + aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTSERVICE()] <<= m_rImpl.aName; if ( pOldFilter ) { @@ -470,7 +492,7 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c // The DocumentService property is only a preselection, and all preselections are considered as optional! // This "wrong" type will be sorted out now because we match only allowed filters to the detected type ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > lQuery(1); - lQuery[0].Name = ::rtl::OUString::createFromAscii("Name"); + lQuery[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")); lQuery[0].Value <<= sTypeName; const SfxFilter* pFilter = GetFilterForProps(lQuery, nMust, nDont); @@ -492,7 +514,7 @@ sal_Bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter ) { if ( pFilter->GetFilterFlags() & SFX_FILTER_MUSTINSTALL ) { - // Hier k"onnte noch eine Nachinstallation angeboten werden + // Here could a re-installation be offered String aText( SfxResId( STR_FILTER_NOT_INSTALLED ) ); aText.SearchAndReplaceAscii( "$(FILTER)", pFilter->GetUIName() ); QueryBox aQuery( NULL, WB_YES_NO | WB_DEF_YES, aText ); @@ -500,11 +522,11 @@ sal_Bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter ) if ( nRet == RET_YES ) { #ifdef DBG_UTIL - // Setup starten - InfoBox( NULL, DEFINE_CONST_UNICODE("Hier soll jetzt das Setup starten!") ).Execute(); + // Start Setup + InfoBox( NULL, DEFINE_CONST_UNICODE("Here should the Setup now be starting!") ).Execute(); #endif - // Installation mu\s hier noch mitteilen, ob es geklappt hat, dann kann das - // Filterflag gel"oscht werden + // Installation must still give feedback if it worked or not, + // then the Filterflag be deleted } return ( !(pFilter->GetFilterFlags() & SFX_FILTER_MUSTINSTALL) ); @@ -522,9 +544,9 @@ sal_Bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter ) sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**ppFilter, sal_Bool /*bPlugIn*/, sal_Bool bAPI ) const -/* [Beschreibung] +/* [Description] - Hier wird noch die Filterauswahlbox hochgezogen. Sonst GuessFilter + Here the Filter selection box is pulled up. Otherwise GuessFilter */ { @@ -563,17 +585,18 @@ sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter** { const SfxFilter* pInstallFilter = NULL; - // Jetzt auch Filter testen, die nicht installiert sind ( ErrCode ist irrelevant ) + // Now test the filter which are not installed (ErrCode is irrelevant) GuessFilter( rMedium, &pInstallFilter, SFX_FILTER_IMPORT, SFX_FILTER_CONSULTSERVICE ); if ( pInstallFilter ) { if ( IsFilterInstalled_Impl( pInstallFilter ) ) - // Eventuell wurde der Filter nachinstalliert + // Maybe the filter was installed was installed afterwards. pFilter = pInstallFilter; } else { - // Jetzt auch Filter testen, die erst von Star bezogen werden m"ussen ( ErrCode ist irrelevant ) + // Now test the filter, which first must be obtained by Star + // (ErrCode is irrelevant) GuessFilter( rMedium, &pInstallFilter, SFX_FILTER_IMPORT, 0 ); if ( pInstallFilter ) IsFilterInstalled_Impl( pInstallFilter ); @@ -612,7 +635,7 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno: ::rtl::OUString aValue; // try to get the preferred filter (works without loading all filters!) - if ( (aProps[::rtl::OUString::createFromAscii("PreferredFilter")] >>= aValue) && aValue.getLength() ) + if ( (aProps[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredFilter"))] >>= aValue) && aValue.getLength() ) { const SfxFilter* pFilter = SfxFilter::GetFilterByName( aValue ); if ( !pFilter || (pFilter->GetFilterFlags() & nMust) != nMust || (pFilter->GetFilterFlags() & nDont ) ) @@ -620,15 +643,15 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno: // pFilter == 0: if preferred filter is a Writer filter, but Writer module is not installed continue; - if ( pImpl->aName.getLength() ) + if ( m_rImpl.aName.getLength() ) { // if this is not the global FilterMatcher: check if filter matches the document type ::rtl::OUString aService; - if ( pFilter->GetServiceName() != String(pImpl->aName) ) + if ( pFilter->GetServiceName() != String(m_rImpl.aName) ) { // preferred filter belongs to another document type; now we must search the filter - pImpl->InitForIterating(); - aProps[::rtl::OUString::createFromAscii("Name")] >>= aValue; + m_rImpl.InitForIterating(); + aProps[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))] >>= aValue; pFilter = GetFilter4EA( aValue, nMust, nDont ); if ( pFilter ) return pFilter; @@ -647,12 +670,11 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const com::sun::star::uno: const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxFilterFlags nMust, SfxFilterFlags nDont ) const { - if ( pImpl->pList ) + if ( m_rImpl.pList ) { - sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pImpl->pList->GetObject( n ); + const SfxFilter* pFilter = m_rImpl.pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetMimeType() == rMediaType ) return pFilter; @@ -662,20 +684,19 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const String& rMediaType,SfxF } com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("MediaType"); + aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")); aSeq[0].Value <<= ::rtl::OUString( rMediaType ); return GetFilterForProps( aSeq, nMust, nDont ); } const SfxFilter* SfxFilterMatcher::GetFilter4EA( const String& rType,SfxFilterFlags nMust, SfxFilterFlags nDont ) const { - if ( pImpl->pList ) + if ( m_rImpl.pList ) { - sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count(); const SfxFilter* pFirst = 0; - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pImpl->pList->GetObject( n ); + const SfxFilter* pFilter = m_rImpl.pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetTypeName() == rType ) { @@ -692,19 +713,18 @@ const SfxFilter* SfxFilterMatcher::GetFilter4EA( const String& rType,SfxFilterFl } com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("Name"); + aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")); aSeq[0].Value <<= ::rtl::OUString( rType ); return GetFilterForProps( aSeq, nMust, nDont ); } const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const String& rExt, SfxFilterFlags nMust, SfxFilterFlags nDont ) const { - if ( pImpl->pList ) + if ( m_rImpl.pList ) { - sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pImpl->pList->GetObject( n ); + const SfxFilter* pFilter = m_rImpl.pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) { @@ -732,7 +752,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const String& rExt, SfxF sExt.Erase(0,1); com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("Extensions"); + aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extensions")); ::com::sun::star::uno::Sequence < ::rtl::OUString > aExts(1); aExts[0] = sExt; aSeq[0].Value <<= aExts; @@ -746,19 +766,18 @@ const SfxFilter* SfxFilterMatcher::GetFilter4ClipBoardId( sal_uInt32 nId, SfxFil com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); ::rtl::OUString aName = SotExchange::GetFormatName( nId ); - aSeq[0].Name = ::rtl::OUString::createFromAscii("ClipboardFormat"); + aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClipboardFormat")); aSeq[0].Value <<= aName; return GetFilterForProps( aSeq, nMust, nDont ); } const SfxFilter* SfxFilterMatcher::GetFilter4UIName( const String& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const { - pImpl->InitForIterating(); + m_rImpl.InitForIterating(); const SfxFilter* pFirstFilter=0; - sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pImpl->pList->GetObject( n ); + const SfxFilter* pFilter = m_rImpl.pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetUIName() == rName ) @@ -778,7 +797,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const String& rName, Sf sal_uInt16 nIndex = aName.SearchAscii(": "); if ( nIndex != STRING_NOTFOUND ) { - DBG_ERROR("Old filter name used!"); + OSL_FAIL("Old filter name used!"); aName = rName.Copy( nIndex + 2 ); } @@ -799,9 +818,9 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const String& rName, Sf CreateFilterArr(); else { - for( sal_uInt16 n=0; n<pFilterArr->Count(); n++ ) + for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i ) { - const SfxFilter* pFilter = pFilterArr->GetObject( n ); + const SfxFilter* pFilter = pFilterArr->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().CompareIgnoreCaseToAscii( aName ) == COMPARE_EQUAL ) return pFilter; @@ -812,14 +831,13 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const String& rName, Sf } } - SfxFilterList_Impl* pList = pImpl->pList; + SfxFilterList_Impl* pList = m_rImpl.pList; if ( !pList ) pList = pFilterArr; - sal_uInt16 nCount = ( sal_uInt16 ) pList->Count(); - for( sal_uInt16 n = 0; n < nCount; n++ ) + for ( size_t i = 0, n = pList->size(); i < n; ++i ) { - const SfxFilter* pFilter = pList->GetObject( n ); + const SfxFilter* pFilter = pList->at( i ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().CompareIgnoreCaseToAscii( aName ) == COMPARE_EQUAL ) return pFilter; @@ -840,14 +858,14 @@ IMPL_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String*, pString ) //---------------------------------------------------------------- SfxFilterMatcherIter::SfxFilterMatcherIter( - const SfxFilterMatcher* pMatchP, + const SfxFilterMatcher& rMatcher, SfxFilterFlags nOrMaskP, SfxFilterFlags nAndMaskP ) : nOrMask( nOrMaskP ), nAndMask( nAndMaskP ), - nCurrent(0), pMatch( pMatchP->pImpl) + nCurrent(0), m_rMatch(rMatcher.m_rImpl) { - if( nOrMask == 0xffff ) //Wg. Fehlbuild auf s + if( nOrMask == 0xffff ) //Due to falty build on s nOrMask = 0; - pMatch->InitForIterating(); + m_rMatch.InitForIterating(); } //---------------------------------------------------------------- @@ -855,9 +873,9 @@ SfxFilterMatcherIter::SfxFilterMatcherIter( const SfxFilter* SfxFilterMatcherIter::Find_Impl() { const SfxFilter* pFilter = 0; - while( nCurrent < pMatch->pList->Count() ) + while( nCurrent < m_rMatch.pList->size() ) { - pFilter = pMatch->pList->GetObject(nCurrent++); + pFilter = m_rMatch.pList->at( nCurrent++ ); SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if( ((nFlags & nOrMask) == nOrMask ) && !(nFlags & nAndMask ) ) break; @@ -950,33 +968,33 @@ void SfxFilterContainer::ReadSingleFilter_Impl( sal_Int32 nFilterProperty = 0 ; for( nFilterProperty=0; nFilterProperty<nFilterPropertyCount; ++nFilterProperty ) { - if( lFilterProperties[nFilterProperty].Name.compareToAscii( "FileFormatVersion" ) == 0 ) + if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileFormatVersion")) ) { lFilterProperties[nFilterProperty].Value >>= nFormatVersion; } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "TemplateName" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TemplateName")) ) { lFilterProperties[nFilterProperty].Value >>= sDefaultTemplate; } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "Flags" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Flags")) ) { lFilterProperties[nFilterProperty].Value >>= nFlags; } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "UIName" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UIName")) ) { lFilterProperties[nFilterProperty].Value >>= sUIName; } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "UserData" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UserData")) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > lUserData; lFilterProperties[nFilterProperty].Value >>= lUserData; sUserData = implc_convertStringlistToString( lUserData, ',', ::rtl::OUString() ); } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "DocumentService" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocumentService")) ) { lFilterProperties[nFilterProperty].Value >>= sServiceName; } - else if( lFilterProperties[nFilterProperty].Name.compareToAscii( "Type" ) == 0 ) + else if( lFilterProperties[nFilterProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Type")) ) { lFilterProperties[nFilterProperty].Value >>= sType; // Try to get filter .. but look for any exceptions! @@ -998,25 +1016,25 @@ void SfxFilterContainer::ReadSingleFilter_Impl( sal_Int32 nTypeProperty = 0 ; for( nTypeProperty=0; nTypeProperty<nTypePropertyCount; ++nTypeProperty ) { - if( lTypeProperties[nTypeProperty].Name.compareToAscii( "ClipboardFormat" ) == 0 ) + if( lTypeProperties[nTypeProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClipboardFormat")) ) { lTypeProperties[nTypeProperty].Value >>= sHumanName; } - else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "DocumentIconID" ) == 0 ) + else if( lTypeProperties[nTypeProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocumentIconID")) ) { lTypeProperties[nTypeProperty].Value >>= nDocumentIconId; } - else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "MediaType" ) == 0 ) + else if( lTypeProperties[nTypeProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")) ) { lTypeProperties[nTypeProperty].Value >>= sMimeType; } - else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "Extensions" ) == 0 ) + else if( lTypeProperties[nTypeProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Extensions")) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > lExtensions; lTypeProperties[nTypeProperty].Value >>= lExtensions; sExtension = implc_convertStringlistToString( lExtensions, ';', DEFINE_CONST_UNICODE("*.") ); } - else if( lTypeProperties[nTypeProperty].Name.compareToAscii( "URLPattern" ) == 0 ) + else if( lTypeProperties[nTypeProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URLPattern")) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > lPattern; lTypeProperties[nTypeProperty].Value >>= lPattern; @@ -1035,7 +1053,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl( { nClipboardId = SotExchange::RegisterFormatName( sHumanName ); - // #100570# For external filters ignore clipboard IDs + // For external filters ignore clipboard IDs if((nFlags & SFX_FILTER_STARONEFILTER) == SFX_FILTER_STARONEFILTER) { nClipboardId = 0; @@ -1047,7 +1065,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl( sal_Int32 nStartRealName = sFilterName.indexOf( DEFINE_CONST_UNICODE(": "), 0 ); if( nStartRealName != -1 ) { - DBG_ERROR("Old format, not supported!"); + OSL_FAIL("Old format, not supported!"); sFilterName = sFilterName.copy( nStartRealName+2 ); } @@ -1090,7 +1108,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl( pFilter->SetURLPattern(sPattern); if (bNew) - rList.Insert( pFilter, USHRT_MAX ); + rList.push_back( pFilter ); } } @@ -1128,15 +1146,14 @@ void SfxFilterContainer::ReadFilters_Impl( sal_Bool bUpdate ) // ReadExternalFilters must work in update mode. // Best way seams to mark all filters NOT_INSTALLED // and change it back for all valid filters afterwards. - if( rList.Count() > 0 ) + if( !rList.empty() ) { bUpdate = sal_True; - sal_uInt16 nCount = (sal_uInt16)rList.Count(); SfxFilter* pFilter; - for (sal_uInt16 f=0; f<nCount; ++f) + for ( size_t i = 0, n = rList.size(); i < n; ++i ) { pFilter = NULL; - pFilter = rList.GetObject(f); + pFilter = rList[ i ]; pFilter->nFormatType |= SFX_FILTER_NOTINSTALLED; } } @@ -1149,17 +1166,6 @@ void SfxFilterContainer::ReadFilters_Impl( sal_Bool bUpdate ) // Try to get filter .. but look for any exceptions! // May be filter was deleted by another thread ... ::rtl::OUString sFilterName = lFilterNames[nFilter]; - - // This debug code can be used to break on inserting/updating - // special debug filters at runtime. - // Otherwise you have to check more then 300 filter names manually .-) - // And conditional breakpoints on unicode values seams not to be supported .-( - #ifdef DEBUG - bool bDBGStop = sal_False; - if (sFilterName.indexOf(::rtl::OUString::createFromAscii("DBG_"))>-1) - bDBGStop = sal_True; - #endif - ReadSingleFilter_Impl( sFilterName, xTypeCFG, xFilterCFG, bUpdate ); } } @@ -1170,10 +1176,13 @@ void SfxFilterContainer::ReadFilters_Impl( sal_Bool bUpdate ) DBG_ASSERT( sal_False, "SfxFilterContainer::ReadFilter()\nException detected. Possible not all filters could be cached.\n" ); } - if ( pImplArr && bUpdate ) + if ( bUpdate ) { - // global filter arry was modified, factory specific ones might need an update too - for ( sal_uInt16 n=0; n<pImplArr->Count(); n++ ) - pImplArr->GetObject(n)->Update(); + // global filter arry was modified, factory specific ones might need an + // update too + std::for_each(aImplArr.begin(), aImplArr.end(), + std::mem_fun_ref(&SfxFilterMatcher_Impl::Update)); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/fltlst.cxx b/sfx2/source/bastyp/fltlst.cxx index 297dedc50807..16f1ccf64d20 100644 --- a/sfx2/source/bastyp/fltlst.cxx +++ b/sfx2/source/bastyp/fltlst.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,13 +42,46 @@ #include <sfx2/docfac.hxx> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> //***************************************************************************************************************** // namespaces //***************************************************************************************************************** using namespace ::com::sun::star; + +class SfxRefreshListener : public ::cppu::WeakImplHelper1<com::sun::star::util::XRefreshListener> +{ + private: + SfxFilterListener *m_pOwner; + + public: + SfxRefreshListener(SfxFilterListener *pOwner) + : m_pOwner(pOwner) + { + } + + virtual ~SfxRefreshListener() + { + } + + // util.XRefreshListener + virtual void SAL_CALL refreshed( const ::com::sun::star::lang::EventObject& rEvent ) + throw(com::sun::star::uno::RuntimeException) + { + m_pOwner->refreshed(rEvent); + } + + // lang.XEventListener + virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& rEvent) + throw(com::sun::star::uno::RuntimeException) + { + m_pOwner->disposing(rEvent); + } +}; + + + //***************************************************************************************************************** // definitions //***************************************************************************************************************** @@ -84,7 +118,8 @@ SfxFilterListener::SfxFilterListener() if( xNotifier.is() == sal_True ) { m_xFilterCache = xNotifier; - m_xFilterCache->addRefreshListener( this ); + m_xFilterCacheListener = new SfxRefreshListener(this); + m_xFilterCache->addRefreshListener( m_xFilterCacheListener ); } } } @@ -95,7 +130,7 @@ SfxFilterListener::~SfxFilterListener() void SAL_CALL SfxFilterListener::refreshed( const lang::EventObject& aSource ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< util::XRefreshable > xContainer( aSource.Source, uno::UNO_QUERY ); if( (xContainer.is() ) && @@ -108,7 +143,7 @@ void SAL_CALL SfxFilterListener::refreshed( const lang::EventObject& aSource ) t void SAL_CALL SfxFilterListener::disposing( const lang::EventObject& aSource ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference< util::XRefreshable > xNotifier( aSource.Source, uno::UNO_QUERY ); if (!xNotifier.is()) return; @@ -116,3 +151,5 @@ void SAL_CALL SfxFilterListener::disposing( const lang::EventObject& aSource ) t if (xNotifier == m_xFilterCache) m_xFilterCache.clear(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/fltlst.hxx b/sfx2/source/bastyp/fltlst.hxx index b3afb425634d..e7d010bbbcd7 100644 --- a/sfx2/source/bastyp/fltlst.hxx +++ b/sfx2/source/bastyp/fltlst.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,27 +42,24 @@ #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/uno/RuntimeException.hpp> -//***************************************************************************************************************** -// declarations -//***************************************************************************************************************** -class SfxFilterListener : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XRefreshListener > +class SfxFilterListener { - // member private: ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > m_xFilterCache; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener > m_xFilterCacheListener; - // c++ interface public: - SfxFilterListener(); - ~SfxFilterListener(); + SfxFilterListener(); + ~SfxFilterListener(); - // uno interface public: // XRefreshListener virtual void SAL_CALL refreshed( 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 +}; #endif // _SFX_FLTLST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/frmhtml.cxx b/sfx2/source/bastyp/frmhtml.cxx index fb850b624695..19c11b525dab 100644 --- a/sfx2/source/bastyp/frmhtml.cxx +++ b/sfx2/source/bastyp/frmhtml.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#include <tools/list.hxx> #include <tools/table.hxx> #include <svtools/htmltokn.h> #include <svtools/asynclink.hxx> @@ -50,14 +50,14 @@ #define SFX_HTMLFRMSIZE_REL 0x0001 #define SFX_HTMLFRMSIZE_PERCENT 0x0002 -static sal_Char __READONLY_DATA sHTML_SC_yes[] = "YES"; -static sal_Char __READONLY_DATA sHTML_SC_no[] = "NO"; -static sal_Char __READONLY_DATA sHTML_SC_auto[] = "AUTO"; +static sal_Char const sHTML_SC_yes[] = "YES"; +static sal_Char const sHTML_SC_no[] = "NO"; +static sal_Char const sHTML_SC_auto[] = "AUTO"; #define HTML_O_READONLY "READONLY" #define HTML_O_EDIT "EDIT" -static HTMLOptionEnum __READONLY_DATA aScollingTable[] = +static HTMLOptionEnum const aScollingTable[] = { { sHTML_SC_yes, ScrollingYes }, { sHTML_SC_no, ScrollingNo }, @@ -67,14 +67,14 @@ static HTMLOptionEnum __READONLY_DATA aScollingTable[] = void SfxFrameHTMLParser::ParseFrameOptions( SfxFrameDescriptor *pFrame, const HTMLOptions *pOptions, const String& rBaseURL ) { - // die Optionen holen und setzen + // Get and set the options Size aMargin( pFrame->GetMargin() ); - // MIB 15.7.97: Netscape scheint marginwidth auf 0 zu setzen, sobald - // marginheight gesetzt wird und umgekehrt. Machen wir jetzt wegen - // bug #41665# auch so. - // Netscape l"a\st aber ein direktes Setzen auf 0 nicht zu, IE4.0 schon. - // Den Bug machen wir nicht mit! + // Netscape seems to set marginwidth to 0 as soon as + // marginheight is set, and vice versa. + // Netscape does however not allow for a direct + // seting to 0, while IE4.0 does + // We will not mimic that bug ! sal_Bool bMarginWidth = sal_False, bMarginHeight = sal_False; sal_uInt16 nArrLen = pOptions->Count(); @@ -102,8 +102,6 @@ void SfxFrameHTMLParser::ParseFrameOptions( SfxFrameDescriptor *pFrame, const HT case HTML_O_MARGINWIDTH: aMargin.Width() = pOption->GetNumber(); -// if( aMargin.Width() < 1 ) -// aMargin.Width() = 1; if( !bMarginHeight ) aMargin.Height() = 0; bMarginWidth = sal_True; @@ -111,8 +109,6 @@ void SfxFrameHTMLParser::ParseFrameOptions( SfxFrameDescriptor *pFrame, const HT case HTML_O_MARGINHEIGHT: aMargin.Height() = pOption->GetNumber(); -// if( aMargin.Height() < 1 ) -// aMargin.Height() = 1; if( !bMarginWidth ) aMargin.Width() = 0; bMarginHeight = sal_True; @@ -161,3 +157,5 @@ void SfxFrameHTMLParser::ParseFrameOptions( SfxFrameDescriptor *pFrame, const HT pFrame->SetMargin( aMargin ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 9330608d9f8b..c73f595056a6 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _INETDEF_HXX #include <svl/inetdef.hxx> -#endif #include "svtools/htmlkywd.hxx" -//!(dv) #include <chaos2/cntapi.hxx> #include <rtl/tencinfo.h> #include <unotools/configmgr.hxx> @@ -57,31 +55,22 @@ #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> +#include <rtl/bootstrap.hxx> + // ----------------------------------------------------------------------- using namespace ::com::sun::star; -static sal_Char __READONLY_DATA sHTML_SC_yes[] = "YES"; -static sal_Char __READONLY_DATA sHTML_SC_no[] = "NO"; -static sal_Char __READONLY_DATA sHTML_SC_auto[] = "AUTO"; -static sal_Char __READONLY_DATA sHTML_MIME_text_html[] = "text/html; charset="; - -/* not used anymore? -static HTMLOutEvent __FAR_DATA aFrameSetEventTable[] = -{ - { sHTML_O_SDonload, sHTML_O_onload, SFX_EVENT_OPENDOC }, - { sHTML_O_SDonunload, sHTML_O_onunload, SFX_EVENT_PREPARECLOSEDOC }, - { sHTML_O_SDonfocus, sHTML_O_onfocus, SFX_EVENT_ACTIVATEDOC }, - { sHTML_O_SDonblur, sHTML_O_onblur, SFX_EVENT_DEACTIVATEDOC }, - { 0, 0, 0 } -}; -*/ +static sal_Char const sHTML_SC_yes[] = "YES"; +static sal_Char const sHTML_SC_no[] = "NO"; +static sal_Char const sHTML_SC_auto[] = "AUTO"; +static sal_Char const sHTML_MIME_text_html[] = "text/html; charset="; #if defined(UNX) const sal_Char SfxFrameHTMLWriter::sNewLine[] = "\012"; #else -const sal_Char __FAR_DATA SfxFrameHTMLWriter::sNewLine[] = "\015\012"; +const sal_Char SfxFrameHTMLWriter::sNewLine[] = "\015\012"; #endif void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, @@ -158,14 +147,16 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL, // Who we are String sGenerator( SfxResId( STR_HTML_GENERATOR ) ); - sGenerator.SearchAndReplaceAscii( "%1", String( DEFINE_CONST_UNICODE( TOOLS_INETDEF_OS ) ) ); + ::rtl::OUString os( RTL_CONSTASCII_USTRINGPARAM("$_OS") ); + ::rtl::Bootstrap::expandMacros(os); + sGenerator.SearchAndReplaceAscii( "%1", os ); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, sal_False, eDestEnc, pNonConvertableChars ); if( i_xDocProps.is() ) { // Reload if( (i_xDocProps->getAutoloadSecs() != 0) || - !i_xDocProps->getAutoloadURL().equalsAscii("") ) + i_xDocProps->getAutoloadURL().getLength() ) { String sContent = String::CreateFromInt32( i_xDocProps->getAutoloadSecs() ); @@ -236,7 +227,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL, uno::Reference < script::XTypeConverter > xConverter( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"))), uno::UNO_QUERY_THROW ); uno::Reference<beans::XPropertySet> xUserDefinedProps( i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); @@ -264,23 +255,6 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL, } } } -/* -void SfxFrameHTMLWriter::OutHeader( rtl_TextEncoding eDestEnc ) -{ - // <HTML> - // <HEAD> - // <TITLE>Titel</TITLE> - // </HEAD> - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_html ) << sNewLine; - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head ); - - Out_DocInfo( Strm(), &pDoc->GetDocInfo(), "\t", eDestEnc ); - Strm() << sNewLine; - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head, sal_False ) << sNewLine; - -//! OutScript(); // Hier fehlen noch die Scripten im Header -} -*/ void SfxFrameHTMLWriter::Out_FrameDescriptor( SvStream& rOut, const String& rBaseURL, const uno::Reference < beans::XPropertySet >& xSet, @@ -290,7 +264,7 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( { ByteString sOut; ::rtl::OUString aStr; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") ); + uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL")) ); if ( (aAny >>= aStr) && aStr.getLength() ) { String aURL = INetURLObject( aStr ).GetMainURL( INetURLObject::DECODE_TO_IURI ); @@ -305,7 +279,7 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( } } - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName")) ); if ( (aAny >>= aStr) && aStr.getLength() ) { ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; @@ -315,18 +289,18 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( } sal_Int32 nVal = SIZE_NOT_SET; - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth")) ); if ( (aAny >>= nVal) && nVal != SIZE_NOT_SET ) (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_marginwidth) += '=') += ByteString::CreateFromInt32( nVal ); - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight")) ); if ( (aAny >>= nVal) && nVal != SIZE_NOT_SET ) (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_marginheight) += '=') += ByteString::CreateFromInt32( nVal ); sal_Bool bVal = sal_True; - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll")) ); if ( (aAny >>= bVal) && !bVal ) { - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode")) ); if ( aAny >>= bVal ) { const sal_Char *pStr = bVal ? sHTML_SC_yes : sHTML_SC_no; @@ -334,30 +308,17 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( } } - // frame border (MS+Netscape-Erweiterung) - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") ); + // frame border (MS+Netscape-Extension) + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoBorder")) ); if ( (aAny >>= bVal) && !bVal ) { - aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") ); + aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder")) ); if ( aAny >>= bVal ) { const char* pStr = bVal ? sHTML_SC_yes : sHTML_SC_no; (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_frameborder) += '=') += pStr; } } - - // TODO/LATER: currently not supported attributes - // resize - //if( !pFrame->IsResizable() ) - // (sOut += ' ') += sHTML_O_noresize; - // - //if ( pFrame->GetWallpaper() ) - //{ - // ((sOut += ' ') += sHTML_O_bordercolor) += '='; - // rOut << sOut.GetBuffer(); - // HTMLOutFuncs::Out_Color( rOut, pFrame->GetWallpaper()->GetColor(), eDestEnc ); - //} - //else rOut << sOut.GetBuffer(); } catch ( uno::Exception& ) @@ -372,10 +333,10 @@ String SfxFrameHTMLWriter::CreateURL( SfxFrame* pFrame ) if( !aRet.Len() && pShell ) { aRet = pShell->GetMedium()->GetName(); -//!(dv) CntAnchor::ToPresentationURL( aRet ); } return aRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 3493981e5a25..b7ecb65a06fb 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,13 +57,19 @@ #include <ucbhelper/commandenvironment.hxx> #include <comphelper/processfactory.hxx> #include <osl/file.hxx> +#include <vector> using namespace com::sun::star; -using namespace rtl; using namespace comphelper; using namespace osl; -DECLARE_LIST( StringList_Impl, OUString* ) +using ::std::vector; + +using ::rtl::OUString; +using ::rtl::OStringBuffer; +using ::rtl::OStringToOUString; + +typedef vector< OUString* > StringList_Impl; #define CONVERT_DATETIME( aUnoDT, aToolsDT ) \ aToolsDT = DateTime( Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year ), \ @@ -102,7 +109,7 @@ sal_Bool SfxContentHelper::Transfer_Impl( const String& rSource, const String& r { ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands(); - OUString aTransferName = OUString::createFromAscii( "transfer" ); + OUString aTransferName(RTL_CONSTASCII_USTRINGPARAM("transfer")); if ( xInfo->hasCommandByName( aTransferName ) ) { aDestPath.executeCommand( aTransferName, uno::makeAny( @@ -113,11 +120,11 @@ sal_Bool SfxContentHelper::Transfer_Impl( const String& rSource, const String& r DBG_ERRORFILE( "transfer command not available" ); } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { bRet = sal_False; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); bRet = sal_False; @@ -142,19 +149,19 @@ sal_Bool SfxContentHelper::IsDocument( const String& rContent ) ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); bRet = aCnt.isDocument(); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_WARNING( "CommandAbortedException" ); } - catch( ucb::IllegalIdentifierException& ) + catch( const ucb::IllegalIdentifierException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( ucb::ContentCreationException& ) + catch( const ucb::ContentCreationException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -174,19 +181,19 @@ sal_Bool SfxContentHelper::IsFolder( const String& rContent ) ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); bRet = aCnt.isFolder(); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_WARNING( "CommandAbortedException" ); } - catch( ucb::IllegalIdentifierException& ) + catch( const ucb::IllegalIdentifierException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( ucb::ContentCreationException& ) + catch( const ucb::ContentCreationException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -205,15 +212,15 @@ sal_Bool SfxContentHelper::GetTitle( const String& rContent, String& rTitle ) { ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); OUString aTemp; - aCnt.getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTemp; + aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Title")) ) >>= aTemp; rTitle = String( aTemp ); bRet = sal_True; } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -231,14 +238,14 @@ sal_Bool SfxContentHelper::Kill( const String& rContent ) try { ::ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - aCnt.executeCommand( OUString::createFromAscii( "delete" ), uno::makeAny( sal_Bool( sal_True ) ) ); + aCnt.executeCommand( OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), uno::makeAny( sal_Bool( sal_True ) ) ); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_WARNING( "CommandAbortedException" ); bRet = sal_False; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); bRet = sal_False; @@ -260,8 +267,8 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContents( const String& rF uno::Reference< sdbc::XResultSet > xResultSet; uno::Sequence< OUString > aProps(2); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); - pProps[1] = OUString::createFromAscii( "IsFolder" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -278,7 +285,7 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContents( const String& rF uno::Reference < ucb::XAnyCompareFactory > xFactory; uno::Reference < lang::XMultiServiceFactory > xMgr = getProcessServiceFactory(); uno::Reference < ucb::XSortedDynamicResultSetFactory > xSRSFac( - xMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), uno::UNO_QUERY ); + xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), uno::UNO_QUERY ); uno::Sequence< ucb::NumberedSortingInfo > aSortInfo( 2 ); ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray(); @@ -296,18 +303,18 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContents( const String& rF } } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "createCursor: CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "createCursor: Any other exception" ); } if ( xResultSet.is() ) { - pFiles = new StringList_Impl; + pFiles = new StringList_Impl(); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); try { @@ -315,35 +322,36 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContents( const String& rF { OUString aId = xContentAccess->queryContentIdentifierString(); OUString* pFile = new OUString( aId ); - pFiles->Insert( pFile, LIST_APPEND ); + pFiles->push_back( pFile ); } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "XContentAccess::next(): CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "XContentAccess::next(): Any other exception" ); } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "GetFolderContents: Any other exception" ); } if ( pFiles ) { - sal_uIntPtr nCount = pFiles->Count(); + size_t nCount = pFiles->size(); uno::Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( sal_uIntPtr i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pFile = pFiles->GetObject(i); + OUString* pFile = pFiles->at( i ); pRet[i] = *( pFile ); delete pFile; } + pFiles->clear(); delete pFiles; return aRet; } @@ -368,11 +376,11 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S uno::Reference< sdbc::XResultSet > xResultSet; uno::Sequence< OUString > aProps(5); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); - pProps[1] = OUString::createFromAscii( "ContentType" ); - pProps[2] = OUString::createFromAscii( "Size" ); - pProps[3] = OUString::createFromAscii( "DateModified" ); - pProps[4] = OUString::createFromAscii( "IsFolder" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType")); + pProps[2] = OUString(RTL_CONSTASCII_USTRINGPARAM("Size")); + pProps[3] = OUString(RTL_CONSTASCII_USTRINGPARAM("DateModified")); + pProps[4] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -383,7 +391,7 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S uno::Reference < ucb::XAnyCompareFactory > xCmpFactory; uno::Reference < lang::XMultiServiceFactory > xMgr = getProcessServiceFactory(); uno::Reference < ucb::XSortedDynamicResultSetFactory > xSRSFac( - xMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), uno::UNO_QUERY ); + xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), uno::UNO_QUERY ); uno::Sequence< ucb::NumberedSortingInfo > aSortInfo( 2 ); ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray(); @@ -399,15 +407,12 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S { xResultSet = xDynamicResultSet->getStaticResultSet(); } - -// if ( xDynResultSet.is() ) -// xResultSet = xDynResultSet->getStaticResultSet(); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "createCursor: CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "createCursor: Any other exception" ); } @@ -415,10 +420,10 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S if ( xResultSet.is() ) { LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - pProperties = new StringList_Impl; + pProperties = new StringList_Impl(); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); - sal_uIntPtr nFolderPos = LIST_APPEND; + size_t nFolderPos = size_t(-1); try { @@ -428,12 +433,10 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S String aType( xRow->getString(2) ); sal_Int64 nSize = xRow->getLong(3); util::DateTime aDT = xRow->getTimestamp(4); - sal_Bool bFolder = xRow->getBoolean(5); + sal_Bool bFolder = xRow->getBoolean(5); // true = directory, else file String aRow = aTitle; aRow += '\t'; -//! aRow += aType; -//! aRow += '\t'; aRow += String::CreateFromInt64( nSize ); aRow += '\t'; AppendDateTime_Impl( aDT, aRow, aLocaleWrapper ); @@ -442,44 +445,52 @@ uno::Sequence < OUString > SfxContentHelper::GetFolderContentProperties( const S aRow += '\t'; aRow += bFolder ? '1' : '0'; OUString* pRow = new OUString( aRow ); - sal_uIntPtr nPos = LIST_APPEND; - if ( bFolder ) + size_t nPos = size_t(-1); + if ( bFolder ) // place the directories at the top of the listing { - if ( LIST_APPEND == nFolderPos ) + if ( nFolderPos == size_t(-1) ) nFolderPos = 0; else nFolderPos++; nPos = nFolderPos; } - pProperties->Insert( pRow, nPos ); + if ( nPos >= pProperties->size() ) + pProperties->push_back( pRow ); + else + { + StringList_Impl::iterator it = pProperties->begin(); + ::std::advance( it, nPos ); + it = pProperties->insert( it, pRow ); + } } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "XContentAccess::next(): CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "XContentAccess::next(): Any other exception" ); } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "GetFolderContents: Any other exception" ); } if ( pProperties ) { - sal_uIntPtr nCount = pProperties->Count(); + size_t nCount = pProperties->size(); uno::Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( sal_uIntPtr i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pProperty = pProperties->GetObject(i); + OUString* pProperty = pProperties->at(i); pRet[i] = *( pProperty ); delete pProperty; } + pProperties->clear(); delete pProperties; return aRet; } @@ -499,9 +510,9 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) uno::Reference< ucb::XDynamicResultSet > xDynResultSet; uno::Sequence< OUString > aProps(3); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); - pProps[1] = OUString::createFromAscii( "ContentType" ); - pProps[2] = OUString::createFromAscii( "IsFolder" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType")); + pProps[2] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -509,18 +520,18 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) if ( xDynResultSet.is() ) xResultSet = xDynResultSet->getStaticResultSet(); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "createCursor: CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "createCursor: Any other exception" ); } if ( xResultSet.is() ) { - pList = new StringList_Impl; + pList = new StringList_Impl(); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); @@ -536,20 +547,20 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) aRow += '\t'; aRow += String( xContentAccess->queryContentIdentifierString() ); OUString* pRow = new OUString( aRow ); - pList->Insert( pRow, LIST_APPEND ); + pList->push_back( pRow ); } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "XContentAccess::next(): CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "XContentAccess::next(): Any other exception" ); } } } - catch( uno::Exception& e ) + catch( const uno::Exception& e ) { (void) e; DBG_ERRORFILE( @@ -564,15 +575,16 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) if ( pList ) { - sal_uIntPtr nCount = pList->Count(); + size_t nCount = pList->size(); uno::Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( sal_uIntPtr i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pEntry = pList->GetObject(i); + OUString* pEntry = pList->at(i); pRet[i] = *( pEntry ); delete pEntry; } + pList->clear(); delete pList; return aRet; } @@ -595,8 +607,8 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin uno::Reference< sdbc::XResultSet > xResultSet; uno::Sequence< OUString > aProps(2); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); - pProps[1] = OUString::createFromAscii( "IsFolder" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -605,16 +617,16 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin if ( xDynResultSet.is() ) xResultSet = xDynResultSet->getStaticResultSet(); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } if ( xResultSet.is() ) { - pProperties = new StringList_Impl; + pProperties = new StringList_Impl(); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); @@ -630,32 +642,33 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin aRow += '\t'; aRow += bFolder ? '1' : '0'; OUString* pRow = new OUString( aRow ); - pProperties->Insert( pRow, LIST_APPEND ); + pProperties->push_back( pRow ); } } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } if ( pProperties ) { - sal_uIntPtr nCount = pProperties->Count(); + size_t nCount = pProperties->size(); uno::Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( sal_uIntPtr i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pProperty = pProperties->GetObject(i); + OUString* pProperty = pProperties->at(i); pRet[i] = *( pProperty ); delete pProperty; } + pProperties->clear(); delete pProperties; return aRet; } @@ -690,7 +703,7 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL ) nRead = xStream->readBytes( lData, 1024 ); } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } @@ -706,12 +719,12 @@ sal_Bool SfxContentHelper::IsHelpErrorDocument( const String& rURL ) { ::ucbhelper::Content aCnt( INetURLObject( rURL ).GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - if ( !( aCnt.getPropertyValue( OUString::createFromAscii( "IsErrorDocument" ) ) >>= bRet ) ) + if ( !( aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsErrorDocument")) ) >>= bRet ) ) { DBG_ERRORFILE( "Property 'IsErrorDocument' is missing" ); } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } @@ -757,15 +770,15 @@ sal_Bool SfxContentHelper::MakeFolder( const String& rFolder ) OUString aType( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.staroffice.fsys-folder" ) ); bRet = aCnt.insertNewContent( aType, aNames, aValues, aNewFolder ); } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { // double name? } - catch( ucb::IllegalIdentifierException& ) + catch( const ucb::IllegalIdentifierException& ) { DBG_ERRORFILE( "Illegal identifier" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -784,14 +797,14 @@ ErrCode SfxContentHelper::QueryDiskSpace( const String& rPath, sal_Int64& rFreeB try { ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - aCnt.getPropertyValue( OUString::createFromAscii( "FreeSpace" ) ) >>= rFreeBytes; + aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("FreeSpace")) ) >>= rFreeBytes; } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "CommandAbortedException" ); nErr = ERRCODE_IO_GENERAL; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); nErr = ERRCODE_IO_GENERAL; @@ -810,13 +823,13 @@ sal_uIntPtr SfxContentHelper::GetSize( const String& rContent ) try { ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - aCnt.getPropertyValue( OUString::createFromAscii( "Size" ) ) >>= nTemp; + aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Size")) ) >>= nTemp; } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_ERRORFILE( "CommandAbortedException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -839,19 +852,19 @@ sal_Bool SfxContentHelper::Exists( const String& rContent ) aCnt.isDocument(); bRet = sal_True; } - catch( ucb::CommandAbortedException& ) + catch( const ucb::CommandAbortedException& ) { DBG_WARNING( "CommandAbortedException" ); } - catch( ucb::IllegalIdentifierException& ) + catch( const ucb::IllegalIdentifierException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( ucb::ContentCreationException& ) + catch( const ucb::ContentCreationException& ) { DBG_WARNING( "IllegalIdentifierException" ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Any other exception" ); } @@ -877,3 +890,4 @@ sal_Bool SfxContentHelper::Find( const String& rFolder, const String& rName, Str } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 0b5315eab809..db1899e23b71 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,4 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) return pStrm; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/minarray.cxx b/sfx2/source/bastyp/minarray.cxx index 9559de4069b0..4deae2555f0a 100644 --- a/sfx2/source/bastyp/minarray.cxx +++ b/sfx2/source/bastyp/minarray.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include <sfx2/minarray.hxx> // ----------------------------------------------------------------------- @@ -103,7 +101,7 @@ void SfxPtrArr::Append( void* aElem ) { DBG_MEMTEST(); DBG_ASSERT( sal::static_int_cast< unsigned >(nUsed+1) < ( USHRT_MAX / sizeof(void*) ), "array too large" ); - // musz das Array umkopiert werden? + // Does the Array need to be copied? if ( nUnused == 0 ) { sal_uInt16 nNewSize = (nUsed == 1) ? (nGrow==1 ? 2 : nGrow) : nUsed+nGrow; @@ -118,7 +116,7 @@ void SfxPtrArr::Append( void* aElem ) pData = pNewData; } - // jetzt hinten in den freien Raum schreiben + // now write at the back in the open space pData[nUsed] = aElem; ++nUsed; --nUnused; @@ -129,14 +127,14 @@ void SfxPtrArr::Append( void* aElem ) sal_uInt16 SfxPtrArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) { DBG_MEMTEST(); - // nLen adjustieren, damit nicht ueber das Ende hinaus geloescht wird + // Adjust nLen, thus to avoid deleting beyond the end nLen = Min( (sal_uInt16)(nUsed-nPos), nLen ); - // einfache Aufgaben erfordern einfache Loesungen! + // simple problems require simple solutions! if ( nLen == 0 ) return 0; - // bleibt vielleicht keiner uebrig + // Maybe no one will remain if ( (nUsed-nLen) == 0 ) { delete [] pData; @@ -146,10 +144,10 @@ sal_uInt16 SfxPtrArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // feststellen, ob das Array dadurch physikalisch schrumpft... + // Determine whether the array has physically shrunk... if ( (nUnused+nLen) >= nGrow ) { - // auf die naechste Grow-Grenze aufgerundet verkleinern + // reduce (rounded up) to the next Grow-border sal_uInt16 nNewUsed = nUsed-nLen; sal_uInt16 nNewSize = ((nNewUsed+nGrow-1)/nGrow) * nGrow; DBG_ASSERT( nNewUsed <= nNewSize && nNewUsed+nGrow > nNewSize, @@ -170,7 +168,7 @@ sal_uInt16 SfxPtrArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // in allen anderen Faellen nur zusammenschieben + // in all other cases, only push together if ( nUsed-nPos-nLen > 0 ) memmove( pData+nPos, pData+nPos+nLen, (nUsed-nPos-nLen)*sizeof(void*) ); nUsed = nUsed - nLen; @@ -183,11 +181,11 @@ sal_uInt16 SfxPtrArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) sal_Bool SfxPtrArr::Remove( void* aElem ) { DBG_MEMTEST(); - // einfache Aufgaben ... + // simple tasks ... if ( nUsed == 0 ) return sal_False; - // rueckwaerts, da meist der letzte zuerst wieder entfernt wird + // backwards, since most of the last is first removed void* *pIter = pData + nUsed - 1; for ( sal_uInt16 n = 0; n < nUsed; ++n, --pIter ) if ( *pIter == aElem ) @@ -203,11 +201,11 @@ sal_Bool SfxPtrArr::Remove( void* aElem ) sal_Bool SfxPtrArr::Replace( void* aOldElem, void* aNewElem ) { DBG_MEMTEST(); - // einfache Aufgaben ... + // simple tasks ... if ( nUsed == 0 ) return sal_False; - // rueckwaerts, da meist der letzte zuerst wieder entfernt wird + // backwards, since most of the last is first removed void* *pIter = pData + nUsed - 1; for ( sal_uInt16 n = 0; n < nUsed; ++n, --pIter ) if ( *pIter == aOldElem ) @@ -242,10 +240,10 @@ void SfxPtrArr::Insert( sal_uInt16 nPos, void* rElem ) { DBG_MEMTEST(); DBG_ASSERT( sal::static_int_cast< unsigned >(nUsed+1) < ( USHRT_MAX / sizeof(void*) ), "array too large" ); - // musz das Array umkopiert werden? + // Does the Array have o be copied? if ( nUnused == 0 ) { - // auf die naechste Grow-Grenze aufgerundet vergroeszern + // increase (rounded up ) to the next Grow-border sal_uInt16 nNewSize = nUsed+nGrow; void** pNewData = new void*[nNewSize]; @@ -259,11 +257,11 @@ void SfxPtrArr::Insert( sal_uInt16 nPos, void* rElem ) pData = pNewData; } - // jetzt den hinteren Teil verschieben + // Now move the rear part if ( nPos < nUsed ) memmove( pData+nPos+1, pData+nPos, (nUsed-nPos)*sizeof(void*) ); - // jetzt in den freien Raum schreiben + // Now write into the free space. memmove( pData+nPos, &rElem, sizeof(void*) ); nUsed += 1; nUnused -= 1; @@ -338,7 +336,7 @@ ByteArr& ByteArr::operator=( const ByteArr& rOrig ) void ByteArr::Append( char aElem ) { DBG_MEMTEST(); - // musz das Array umkopiert werden? + // Does the Array have o be copied? if ( nUnused == 0 ) { sal_uInt16 nNewSize = (nUsed == 1) ? (nGrow==1 ? 2 : nGrow) : nUsed+nGrow; @@ -353,7 +351,7 @@ void ByteArr::Append( char aElem ) pData = pNewData; } - // jetzt hinten in den freien Raum schreiben + // now write at the back in the open space pData[nUsed] = aElem; ++nUsed; --nUnused; @@ -364,14 +362,14 @@ void ByteArr::Append( char aElem ) sal_uInt16 ByteArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) { DBG_MEMTEST(); - // nLen adjustieren, damit nicht ueber das Ende hinaus geloescht wird + // Adjust nLen, thus to avoid deleting beyond the end nLen = Min( (sal_uInt16)(nUsed-nPos), nLen ); - // einfache Aufgaben erfordern einfache Loesungen! + // simple problems require simple solutions! if ( nLen == 0 ) return 0; - // bleibt vielleicht keiner uebrig + // Maybe no one will remain if ( (nUsed-nLen) == 0 ) { delete [] pData; @@ -381,10 +379,10 @@ sal_uInt16 ByteArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // feststellen, ob das Array dadurch physikalisch schrumpft... + // Determine whether the array has physically shrunk... if ( (nUnused+nLen) >= nGrow ) { - // auf die naechste Grow-Grenze aufgerundet verkleinern + // reduce (rounded up) to the next Grow-border sal_uInt16 nNewUsed = nUsed-nLen; sal_uInt16 nNewSize = ((nNewUsed+nGrow-1)/nGrow) * nGrow; DBG_ASSERT( nNewUsed <= nNewSize && nNewUsed+nGrow > nNewSize, @@ -405,7 +403,7 @@ sal_uInt16 ByteArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // in allen anderen Faellen nur zusammenschieben + // in all other cases, only push together if ( nUsed-nPos-nLen > 0 ) memmove( pData+nPos, pData+nPos+nLen, (nUsed-nPos-nLen)*sizeof(char) ); nUsed = nUsed - nLen; @@ -418,11 +416,11 @@ sal_uInt16 ByteArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) sal_Bool ByteArr::Remove( char aElem ) { DBG_MEMTEST(); - // einfache Aufgaben ... + // simple tasks ... if ( nUsed == 0 ) return sal_False; - // rueckwaerts, da meist der letzte zuerst wieder entfernt wird + // backwards, since most of the last is first removed char *pIter = pData + nUsed - 1; for ( sal_uInt16 n = 0; n < nUsed; ++n, --pIter ) if ( *pIter == aElem ) @@ -456,10 +454,10 @@ sal_Bool ByteArr::Contains( const char rItem ) const void ByteArr::Insert( sal_uInt16 nPos, char rElem ) { DBG_MEMTEST(); - // musz das Array umkopiert werden? + // Does the Array need to be copied? if ( nUnused == 0 ) { - // auf die naechste Grow-Grenze aufgerundet vergroeszern + // increase (rounded up) to the next Grow-border sal_uInt16 nNewSize = nUsed+nGrow; char* pNewData = new char[nNewSize]; @@ -473,11 +471,11 @@ void ByteArr::Insert( sal_uInt16 nPos, char rElem ) pData = pNewData; } - // jetzt den hinteren Teil verschieben + // Now move the rear part if ( nPos < nUsed ) memmove( pData+nPos+1, pData+nPos, (nUsed-nPos)*sizeof(char) ); - // jetzt in den freien Raum schreiben + // now write at the back in the open space memmove( pData+nPos, &rElem, sizeof(char) ); nUsed += 1; nUnused -= 1; @@ -570,7 +568,7 @@ WordArr& WordArr::operator=( const WordArr& rOrig ) void WordArr::Append( short aElem ) { DBG_MEMTEST(); - // musz das Array umkopiert werden? + // Does the Array need to be copied? if ( nUnused == 0 ) { sal_uInt16 nNewSize = (nUsed == 1) ? (nGrow==1 ? 2 : nGrow) : nUsed+nGrow; @@ -585,7 +583,7 @@ void WordArr::Append( short aElem ) pData = pNewData; } - // jetzt hinten in den freien Raum schreiben + // now write at the back in the open space pData[nUsed] = aElem; ++nUsed; --nUnused; @@ -596,14 +594,14 @@ void WordArr::Append( short aElem ) sal_uInt16 WordArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) { DBG_MEMTEST(); - // nLen adjustieren, damit nicht ueber das Ende hinaus geloescht wird + // Adjust nLen, thus to avoid deleting beyond the end nLen = Min( (sal_uInt16)(nUsed-nPos), nLen ); - // einfache Aufgaben erfordern einfache Loesungen! + // simple problems require simple solutions! if ( nLen == 0 ) return 0; - // bleibt vielleicht keiner uebrig + // Maybe no one will remain if ( (nUsed-nLen) == 0 ) { delete [] pData; @@ -613,10 +611,10 @@ sal_uInt16 WordArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // feststellen, ob das Array dadurch physikalisch schrumpft... + // Determine whether the array has physically shrunk... if ( (nUnused+nLen) >= nGrow ) { - // auf die naechste Grow-Grenze aufgerundet verkleinern + // reduce (rounded up) to the next Grow-border sal_uInt16 nNewUsed = nUsed-nLen; sal_uInt16 nNewSize = ((nNewUsed+nGrow-1)/nGrow) * nGrow; DBG_ASSERT( nNewUsed <= nNewSize && nNewUsed+nGrow > nNewSize, @@ -637,7 +635,7 @@ sal_uInt16 WordArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) return nLen; } - // in allen anderen Faellen nur zusammenschieben + // in all other cases, only push together if ( nUsed-nPos-nLen > 0 ) memmove( pData+nPos, pData+nPos+nLen, (nUsed-nPos-nLen)*sizeof(short) ); nUsed = nUsed - nLen; @@ -650,11 +648,11 @@ sal_uInt16 WordArr::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) sal_Bool WordArr::Remove( short aElem ) { DBG_MEMTEST(); - // einfache Aufgaben ... + // simple tasks ... if ( nUsed == 0 ) return sal_False; - // rueckwaerts, da meist der letzte zuerst wieder entfernt wird + // backwards, since most of the last is first removed short *pIter = pData + nUsed - 1; for ( sal_uInt16 n = 0; n < nUsed; ++n, --pIter ) if ( *pIter == aElem ) @@ -688,10 +686,10 @@ sal_Bool WordArr::Contains( const short rItem ) const void WordArr::Insert( sal_uInt16 nPos, short rElem ) { DBG_MEMTEST(); - // musz das Array umkopiert werden? + // Does the Array need to be copied? if ( nUnused == 0 ) { - // auf die naechste Grow-Grenze aufgerundet vergroeszern + // increase (rounded up) to the next Grow-border sal_uInt16 nNewSize = nUsed+nGrow; short* pNewData = new short[nNewSize]; @@ -705,11 +703,11 @@ void WordArr::Insert( sal_uInt16 nPos, short rElem ) pData = pNewData; } - // jetzt den hinteren Teil verschieben + // Now move the rear part if ( nPos < nUsed ) memmove( pData+nPos+1, pData+nPos, (nUsed-nPos)*sizeof(short) ); - // jetzt in den freien Raum schreiben + // now write at the back in the open space memmove( pData+nPos, &rElem, sizeof(short) ); nUsed += 1; nUnused -= 1; @@ -734,3 +732,4 @@ short& WordArr::operator [] (sal_uInt16 nPos) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/misc.cxx b/sfx2/source/bastyp/misc.cxx index ae3b0807bbe4..b20a23266353 100644 --- a/sfx2/source/bastyp/misc.cxx +++ b/sfx2/source/bastyp/misc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,14 +29,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include "sfxtypes.hxx" //-------------------------------------------------------------------- -#if defined(DBG_UTIL) && ( defined(WNT) || defined(OS2) ) +#if defined(DBG_UTIL) && defined(WNT) unsigned SfxStack::nLevel = 0; #endif @@ -73,3 +71,4 @@ String SfxStringDecode( const String &, const char * ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 3c4c78e9d630..0ad5de1fea52 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,14 +33,11 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#ifndef _SBX_HXX //autogen #include <basic/sbx.hxx> -#endif #include <svl/eitem.hxx> #include <tools/time.hxx> -// wg. nRescheduleLocks #include "appdata.hxx" #include <sfx2/request.hxx> #include <sfx2/frame.hxx> @@ -114,7 +112,7 @@ struct SfxProgress_Impl #define aTypeLibInfo aProgressTypeLibImpl //======================================================================== -extern sal_uIntPtr Get10ThSec(); +extern sal_uInt32 Get10ThSec(); // ----------------------------------------------------------------------- @@ -150,31 +148,30 @@ SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) SfxProgress::SfxProgress ( - SfxObjectShell* pObjSh, /* SfxObjectShell, an der die Aktion ausgef"uhrt - wird. Kann NULL sein, dann wird die Applikation - verwendet */ + SfxObjectShell* pObjSh, /* The action is performed on the + SfxObjectShell which can be NULL. + When it is then the application will be + used */ - const String& rText, /* Text, der in der Statuszeile vor den Statusmonitor - erscheint */ + const String& rText, /* Text, which appears before the Statusmonitor + in the status line */ - sal_uIntPtr nRange, /* Maximalwert des Bereiches */ + sal_uIntPtr nRange, /* Max value for range */ - sal_Bool bAll /* alle Dokumente oder nur das Dokument des ViewFrames - disablen (sal_False) */ - ,sal_Bool bWait /* initial den Wait-Pointer aktivieren (sal_True) */ + sal_Bool bAll, /* Disable all documents or only the document of the ViewFram */ + sal_Bool bWait /* Activate the wait-Pointer initially (TRUE) */ ) -/* [Beschreibung] +/* [Description] - 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. + The constructor of the class SfxProgress switches the SfxObjectShell + passed as parameter and SfxViewFrames which display this document in + a progress mode. Ie as long as one of those SfxViewFrame instances is + active the associated SfxDispatcher and associated Window is disabled. + A progress-bar will be displayed in the status bar, */ -: pImp( new SfxProgress_Impl( rText ) ), +: pImp( new SfxProgress_Impl( rText ) ), nVal(0), bSuspended(sal_True) { @@ -207,11 +204,10 @@ SfxProgress::SfxProgress SfxProgress::~SfxProgress() -/* [Beschreibung] +/* [Description] - Der Destruktor der Klasse SfxProgress restauriert den alten Zustand; - die Dokumente werden wieder freigeschaltet und die Statuszeile zeigt - wieder Items an. + The destructor of the class SfxProgress restores the old status, + the documents are released again and the status bar shows the items again. */ { @@ -228,9 +224,9 @@ SfxProgress::~SfxProgress() void SfxProgress::Stop() -/* [Beschreibung] +/* [Description] - Vorzeitiges Beenden des <SfxProgress>. + Early Exit of <SfxProgress>. */ { @@ -259,13 +255,12 @@ void SfxProgress::Stop() void SfxProgress::SetText ( - const String& /* neuer Text */ + const String& /* new Text */ ) -/* [Beschreibung] +/* [Description] - "Andert den Text, der links neben dem Fortschritts-Balken - angezeigt wird. + Changes the text that appears to the left next to progress bar. */ { @@ -285,29 +280,8 @@ const String& SfxProgress::GetStateText_Impl() const } // ----------------------------------------------------------------------- -/* -IMPL_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus*, pStatus ) -{ - INetRequest* pReq = 0; - const INetHint *pHint = PTR_CAST( INetHint, pStatus->pHint ); - pReq = PTR_CAST( INetRequest, pStatus->pBC ); - - String aString; - if( pReq ) - aString = SfxMedium::GetStatusString( pHint->GetId(), pReq, pHint ); - if( aString.Len() ) - { - GetpApp()->ShowStatusText( aString ); - if( pThis ) - pThis->pImp->bIsStatusText = sal_True; - } - return 0; -} -*/ - -// ----------------------------------------------------------------------- -// muss in AppDaten +// Required in App data static sal_uIntPtr nLastTime = 0; long TimeOut_Impl( void*, void* pArgV ) @@ -327,9 +301,9 @@ long TimeOut_Impl( void*, void* pArgV ) sal_Bool SfxProgress::SetStateText ( - sal_uLong nNewVal, /* neuer Wert f"ur die Fortschritts-Anzeige */ - const String& rNewVal, /* Status als Text */ - sal_uLong nNewRange /* neuer Maximalwert, 0 f"ur Beibehaltung des alten */ + sal_uLong nNewVal, /* New value for the progress-bar */ + const String& rNewVal, /* Status as Text */ + sal_uLong nNewRange /* new maximum value, 0 for retaining the old */ ) { @@ -341,43 +315,34 @@ sal_Bool SfxProgress::SetStateText sal_Bool SfxProgress::SetState ( - sal_uLong nNewVal, /* neuer Wert f"ur die Fortschritts-Anzeige */ + sal_uLong nNewVal, /* new value for the progress bar */ - sal_uLong nNewRange /* neuer Maximalwert, 0 f"ur Beibehaltung des alten */ + sal_uLong nNewRange /* new maximum value, 0 for retaining the old */ ) -/* [Beschreibung] - - Setzen des aktuellen Status; nach einem zeitlichen Versatz - wird Reschedule aufgerufen. +/* [Description] + Setting the current status, after a time delay Reschedule is called. - [R"uckgabewert] + [Return value] sal_Bool TRUE - Fortfahren mit der Aktion + Proceed with the action FALSE - Abbrechen der Aktion + Cancel action */ { - // wurde via Stop-Button angehalten? -// if ( pImp->IsCancelled() ) -// return sal_False; - if( pImp->pActiveProgress ) return sal_True; - // neuen Wert "ubernehmen - sal_Bool bOver=sal_False; nVal = nNewVal; - // neuer Range? + // new Range? if ( nNewRange && nNewRange != pImp->nMax ) { DBG( DbgOutf( "SfxProgress: range changed from %lu to %lu", pImp->nMax, nNewRange ) ); pImp->nMax = nNewRange; - bOver = sal_True; } if ( !pImp->xStatusInd.is() ) @@ -400,14 +365,6 @@ sal_Bool SfxProgress::SetState SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); if ( !pHiddenItem || !pHiddenItem->GetValue() ) { - // not in a view, perhaps it's just loading - //SfxFrame* pFrame = pMedium->GetLoadTargetFrame(); - //if ( pFrame && pFrame->GetCurrentViewFrame() ) - //{ - // recycling frame - //pImp->pView = pFrame->GetCurrentViewFrame(); - //} - //else { SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False ); Reference< XStatusIndicator > xInd; @@ -443,11 +400,12 @@ sal_Bool SfxProgress::SetState void SfxProgress::Resume() -/* [Beschreibung] +/* [Description] + + Resumed the status of the display after an interrupt. - Nimmt die Anzeige des Status nach einer Unterbrechung wieder auf. + [Cross-reference] - [Querverweise] <SfxProgress::Suspend()> */ @@ -488,11 +446,12 @@ void SfxProgress::Resume() void SfxProgress::Suspend() -/* [Beschreibung] +/* [Description] - Unterbricht die Anzeige des Status + Interrupts the status of the display + + [Cross-reference] - [Querverweise] <SfxProgress::Resume()> */ @@ -530,8 +489,8 @@ void SfxProgress::Suspend() void SfxProgress::Lock() { if( pImp->pActiveProgress ) return; - // kein Reschedule bei Embedded-Objekten, - // da wir gegen das OLE Protokoll wehrlos sind + // No Reschedule for Embedded-Objects, + // because we are defenseless against the OLE protocol if ( !pImp->xObjSh.Is() ) { for ( SfxObjectShell *pDocSh = SfxObjectShell::GetFirst(); @@ -581,10 +540,9 @@ void SfxProgress::UnLock() void SfxProgress::Reschedule() -/* [Beschreibung] - - Reschedule von au"sen rufbar +/* [Description] + Reschedule, callable from the outside */ { @@ -609,16 +567,13 @@ void SfxProgress::Reschedule() void SfxProgress::SetWaitMode ( sal_Bool bWait /* TRUE - Wartecursor wird verwendet - FALSE - Es wird kein Wartecursor verwendet */ + FALSE Wait-cursor not used */ ) -/* [Beschreibung] - - Wartecursor-Modus umschalten. +/* [Description] + Switch Wait-mode. */ { @@ -656,10 +611,9 @@ void SfxProgress::SetWaitMode sal_Bool SfxProgress::GetWaitMode() const -/* [Beschreibung] - - Wartecursor-Modus abfragen. +/* [Description] + Get Wait-cursor mode. */ { @@ -670,36 +624,34 @@ sal_Bool SfxProgress::GetWaitMode() const SfxProgress* SfxProgress::GetActiveProgress ( - 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. */ + SfxObjectShell* pDocSh /* the <SfxObjectShell>, which should be + queried after a current <SfxProgress>, + or 0 if an current SfxProgress for the + entire application should be obtained. + The pointer only needs at the time of + the call to be valid. + */ ) -/* [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. +/* [Description] + This method is used to check whether and which <SfxProgress> is currently + active for a specific instance of SfxObjectShell or even an entire + application. This can for example be used to check for Time-Out-Events, etc. - [Anmerkung] + Instead of a pointer to the SfxProgress the SfxObjectShell may be + pointed at the SfxProgress of the application, with the query + 'SfxProgress:: GetActiveProgress (pMyDocSh)' thus the current + SfxProgress of 'pMyDocSh' is delivered, otherwise the SfxProgress of + the application or a 0-pointer. - "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. + [Note] + If no SfxProgress is running in the application and also not at the + specified SfxObjectShell, then this method will always return 0, + even if one SfxProgress runs on another SfxObjectShell. - [Querverweise] + [Cross-reference] <SfxApplication::GetProgress()const> <SfxObjectShell::GetProgress()const> @@ -735,19 +687,19 @@ void SfxProgress::LeaveLock() // ----------------------------------------------------------------------- -FASTBOOL SfxProgress::StatusBarManagerGone_Impl +bool SfxProgress::StatusBarManagerGone_Impl ( - SfxStatusBarManager * // dieser <SfxStatusBarManager> wird zerst"ort + SfxStatusBarManager * // This <SfxStatusBarManager> will be destroyed ) -/* [Beschreibung] +/* [Description] - Interne Methode zum Benachrichtigen des SfxProgress, da\s der angegebene - SfxStatusBarManger zerst"ort wird. Damit der Progress ihn loslassen - kann. + Internal method for notifying the SfxProgress that the specified + SfxStatusBarManger will be destroyed so that the Progress can let go of it. */ { return sal_True; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 7d86043308ce..ede1f873d6bc 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,12 +58,12 @@ using namespace ::com::sun::star; -sal_Char __FAR_DATA sHTML_MIME_text[] = "text/"; -sal_Char __FAR_DATA sHTML_MIME_application[] = "application/"; -sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-"; +sal_Char sHTML_MIME_text[] = "text/"; +sal_Char sHTML_MIME_application[] = "application/"; +sal_Char sHTML_MIME_experimental[] = "x-"; // <INPUT TYPE=xxx> -static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] = +static HTMLOptionEnum const aAreaShapeOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_SH_rect, IMAP_OBJ_RECTANGLE }, { OOO_STRING_SVTOOLS_HTML_SH_rectangle, IMAP_OBJ_RECTANGLE }, @@ -79,30 +80,27 @@ SfxHTMLParser::SfxHTMLParser( SvStream& rStream, sal_Bool bIsNewDoc, pMedium( pMed ), pDLMedium( 0 ), nMetaTags( 0 ) { - DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), - "SfxHTMLParser::SfxHTMLParser: Wo kommt der ZS her?" ); + DBG_ASSERT( RTL_TEXTENCODING_UTF8 == GetSrcEncoding( ), + "SfxHTMLParser::SfxHTMLParser: From where comes ZS?" ); + DBG_ASSERT( !IsSwitchToUCS2(), "SfxHTMLParser::SfxHTMLParser: Switch to UCS2?" ); - // Altough the real default encoding is ISO8859-1, we use MS-1252 - // als default encoding. - SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) ); - // If the file starts with a BOM, switch to UCS2. SetSwitchToUCS2( sal_True ); } -__EXPORT SfxHTMLParser::~SfxHTMLParser() +SfxHTMLParser::~SfxHTMLParser() { - DBG_ASSERT( !pDLMedium, "Da ist ein File-Download stehengeblieben" ); + DBG_ASSERT( !pDLMedium, "Here is a File Download that has got stuck" ); delete pDLMedium; } sal_Bool SfxHTMLParser::ParseMapOptions(ImageMap * pImageMap, const HTMLOptions * pOptions) { - DBG_ASSERT( pImageMap, "ParseMapOptions: keine Image-Map" ); - DBG_ASSERT( pOptions, "ParseMapOptions: keine Optionen" ); + DBG_ASSERT( pImageMap, "ParseMapOptions: No Image-Map" ); + DBG_ASSERT( pOptions, "ParseMapOptions: No Options" ); String aName; @@ -128,8 +126,8 @@ sal_Bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const String& rBa sal_uInt16 nEventMouseOver, sal_uInt16 nEventMouseOut ) { - DBG_ASSERT( pImageMap, "ParseAreaOptions: keine Image-Map" ); - DBG_ASSERT( pOptions, "ParseAreaOptions: keine Optionen" ); + DBG_ASSERT( pImageMap, "ParseAreaOptions: no Image-Map" ); + DBG_ASSERT( pOptions, "ParseAreaOptions: no Options" ); sal_uInt16 nShape = IMAP_OBJ_RECTANGLE; SvULongs aCoords; @@ -246,53 +244,42 @@ IMAPOBJ_SETEVENT: void SfxHTMLParser::StartFileDownload( const String& rURL, int nToken, SfxObjectShell *pSh ) { - DBG_ASSERT( !pDLMedium, "StartFileDwonload bei aktivem Download" ); + DBG_ASSERT( !pDLMedium, "StartFileDownload when active Download" ); if( pDLMedium ) return; pDLMedium = new SfxMedium( rURL, SFX_STREAM_READONLY, sal_False ); if( pSh ) { - // Medium registrieren, damit abgebrochen werden kann + // Register the medium, so that it can be stopped. pSh->RegisterTransfer( *pDLMedium ); - - // Target-Frame uebertragen, damit auch javascript:-URLs - // "geladen" werden koennen. - //const SfxMedium *pShMedium = pSh->GetMedium(); - //if( pShMedium ) - // pDLMedium->SetLoadTargetFrame( pShMedium->GetLoadTargetFrame() ); } - // Download anstossen (Achtung: Kann auch synchron sein). + // Push Download (Note: Can also be synchronous). if ( sal_True /*pMedium->GetDoneLink() == Link()*/ ) pDLMedium->DownLoad(); else { - // Downloading-Flag auf sal_True setzen. Es werden dann auch - // Data-Available-Links, wenn wir in den Pending-Staus gelangen. + // Set Downloading-Flag to TRUE. When we get into the Pending-status + // we will then also have Data-Available-Links. SetDownloadingFile( sal_True ); pDLMedium->DownLoad( STATIC_LINK( this, SfxHTMLParser, FileDownloadDone ) ); - // Wenn das Dowsnloading-Flag noch gesetzt ist erfolgt der Download - // asynchron. Wir gehen dann in den Pedning-Staus und warten dort. - // Solange sind alle Aufrufe des Data-Avaialble-Link gesperrt. + // If the Downloading-Flag is still set downloading will be done + // asynchronously. We will go into Pedning-status and wait there. + // As long as we are there all calls to the Data-Link Avaialble are + // locked. if( IsDownloadingFile() ) { - // Den aktuellen Zustand einfrieren und in den Pending-Status gehen. - // Wenn der Download beendet oder abgebrochen wurde, wird ueber - // NewDataRead ein Continue mit dem uebergeben Token angesteossen. + // Unfreeze the current state and go into the Pending-Status. + // When the download is completed or aborted, a Continue with + // the transfer token will be pushed by passedNewDataRead. SaveState( nToken ); eState = SVPAR_PENDING; } } } -sal_Bool SfxHTMLParser::GetFileDownloadMIME( String& rMIME ) -{ - return pDLMedium && pDLMedium->GetErrorCode()==0 && - pDLMedium->GetMIMEAndRedirect(rMIME)==0; -} - sal_Bool SfxHTMLParser::FinishFileDownload( String& rStr ) { String aStr; @@ -301,30 +288,19 @@ sal_Bool SfxHTMLParser::FinishFileDownload( String& rStr ) if( bOK ) { SvStream* pStream = pDLMedium->GetInStream(); - DBG_ASSERT( pStream, "Kein In-Stream vom Medium erhalten" ); + DBG_ASSERT( pStream, "No In-Stream received from Medium" ); SvMemoryStream aStream; - if( pStream ) // HACK wegen #65563# + if( pStream ) aStream << *pStream; aStream.Seek( STREAM_SEEK_TO_END ); DBG_ASSERT( aStream.Tell() < STRING_MAXLEN, - "File zu lang fuer einen String, Ende abgeschnitten" ); + "File too long for a string, cut off the end" ); xub_StrLen nLen = aStream.Tell() < STRING_MAXLEN ? (xub_StrLen)aStream.Tell() : STRING_MAXLEN; - // TODO: untested!!! - rtl_TextEncoding eEnc = - GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ); - String sMime; - if( pDLMedium->GetMIMEAndRedirect( sMime ) == 0 ) - { - rtl_TextEncoding eMimeEnc = GetEncodingByMIME( sMime ); - if( RTL_TEXTENCODING_DONTKNOW != eMimeEnc ) - eEnc = eMimeEnc; - } - ByteString sBuffer; sal_Char* pBuffer = sBuffer.AllocBuffer(nLen); aStream.Seek( 0 ); @@ -340,11 +316,11 @@ sal_Bool SfxHTMLParser::FinishFileDownload( String& rStr ) IMPL_STATIC_LINK( SfxHTMLParser, FileDownloadDone, void*, EMPTYARG ) { - // Der Download ist jetzt abgeschlossen. Ausserdem muss/darf der - // Data-Available-Link wieder durchgelassen werden. + // The Download is now completed. also the Data-Available-Link + // must or are allowed to be passed through. pThis->SetDownloadingFile( sal_False ); - // ... und einmal aufrufen, damit weitergelesen wird. + // ... and call once, thus will continue reading. pThis->CallAsyncCallLink(); return 0; @@ -445,3 +421,4 @@ double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm, return fVal; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx index 0ed0aab649cf..e98014cdba16 100644 --- a/sfx2/source/bastyp/sfxresid.cxx +++ b/sfx2/source/bastyp/sfxresid.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif #include <tools/simplerm.hxx> #include "sfx2/sfxresid.hxx" @@ -46,9 +45,7 @@ SfxResId::SfxResId( sal_uInt16 nId ) : } //============================================================================ -// // SfxSimpleResId Implementation. -// //============================================================================ SfxSimpleResId::SfxSimpleResId(sal_uInt16 nID): @@ -71,3 +68,4 @@ void SfxResId::DeleteResMgr() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 31f9105c28aa..b2e1b9c36b54 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" + +#include <boost/scoped_ptr.hpp> + #include <vcl/msgbox.hxx> #include <tools/resary.hxx> #include <svl/lstner.hxx> @@ -66,24 +70,20 @@ using namespace com::sun::star; SfxEventNamesList& SfxEventNamesList::operator=( const SfxEventNamesList& rTbl ) { DelDtor(); - for (sal_uInt16 n=0; n<rTbl.Count(); n++ ) + for ( size_t i = 0, n = rTbl.size(); i < n; ++i ) { - SfxEventName* pTmp = ((SfxEventNamesList&)rTbl).GetObject(n); - SfxEventName *pNew = new SfxEventName( *pTmp ); - Insert( pNew, n ); + SfxEventName* pTmp = rTbl.at( i ); + SfxEventName* pNew = new SfxEventName( *pTmp ); + aEventNamesList.push_back( pNew ); } return *this; } void SfxEventNamesList::DelDtor() { - SfxEventName* pTmp = First(); - while( pTmp ) - { - delete pTmp; - pTmp = Next(); - } - Clear(); + for ( size_t i = 0, n = aEventNamesList.size(); i < n; ++i ) + delete aEventNamesList[ i ]; + aEventNamesList.clear(); } int SfxEventNamesItem::operator==( const SfxPoolItem& rAttr ) const @@ -93,13 +93,13 @@ int SfxEventNamesItem::operator==( const SfxPoolItem& rAttr ) const const SfxEventNamesList& rOwn = aEventsList; const SfxEventNamesList& rOther = ( (SfxEventNamesItem&) rAttr ).aEventsList; - if ( rOwn.Count() != rOther.Count() ) + if ( rOwn.size() != rOther.size() ) return sal_False; - for ( sal_uInt16 nNo = 0; nNo < rOwn.Count(); ++nNo ) + for ( size_t nNo = 0, nCnt = rOwn.size(); nNo < nCnt; ++nNo ) { - const SfxEventName *pOwn = rOwn.GetObject(nNo); - const SfxEventName *pOther = rOther.GetObject(nNo); + const SfxEventName *pOwn = rOwn.at( nNo ); + const SfxEventName *pOther = rOther.at( nNo ); if ( pOwn->mnId != pOther->mnId || pOwn->maEventName != pOther->maEventName || pOwn->maUIName != pOther->maUIName ) @@ -127,25 +127,25 @@ SfxPoolItem* SfxEventNamesItem::Clone( SfxItemPool *) const SfxPoolItem* SfxEventNamesItem::Create(SvStream &, sal_uInt16) const { - DBG_ERROR("not streamable!"); + OSL_FAIL("not streamable!"); return new SfxEventNamesItem(Which()); } SvStream& SfxEventNamesItem::Store(SvStream &rStream, sal_uInt16 ) const { - DBG_ERROR("not streamable!"); + OSL_FAIL("not streamable!"); return rStream; } sal_uInt16 SfxEventNamesItem::GetVersion( sal_uInt16 ) const { - DBG_ERROR("not streamable!"); + OSL_FAIL("not streamable!"); return 0; } void SfxEventNamesItem::AddEvent( const String& rName, const String& rUIName, sal_uInt16 nID ) { - aEventsList.Insert( new SfxEventName( nID, rName, rUIName.Len() ? rUIName : rName ) ); + aEventsList.push_back( new SfxEventName( nID, rName, rUIName.Len() ? rUIName : rName ) ); } @@ -173,17 +173,17 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) uno::Sequence < beans::PropertyValue > aProperties(3); beans::PropertyValue *pValues = aProperties.getArray(); - ::rtl::OUString aType = ::rtl::OUString::createFromAscii( STAR_BASIC );; + ::rtl::OUString aType(RTL_CONSTASCII_USTRINGPARAM( STAR_BASIC )); ::rtl::OUString aLib = pMacro->GetLibName(); ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); + pValues[ 0 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_EVENT_TYPE )); pValues[ 0 ].Value <<= aType; - pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_LIBRARY ); + pValues[ 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_LIBRARY )); pValues[ 1 ].Value <<= aLib; - pValues[ 2 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME ); + pValues[ 2 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_MACRO_NAME )); pValues[ 2 ].Value <<= aMacro; aEventData <<= aProperties; @@ -196,10 +196,10 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) ::rtl::OUString aLib = pMacro->GetLibName(); ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); + pValues[ 0 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_EVENT_TYPE )); pValues[ 0 ].Value <<= aLib; - pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_SCRIPT ); + pValues[ 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_SCRIPT )); pValues[ 1 ].Value <<= aMacro; aEventData <<= aProperties; @@ -211,10 +211,10 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); - pValues[ 0 ].Value <<= ::rtl::OUString::createFromAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT); + pValues[ 0 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_EVENT_TYPE )); + pValues[ 0 ].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT)); - pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME ); + pValues[ 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( PROP_MACRO_NAME )); pValues[ 1 ].Value <<= aMacro; aEventData <<= aProperties; @@ -245,7 +245,7 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const { xSupplier = uno::Reference < document::XEventsSupplier > ( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), uno::UNO_QUERY ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))), uno::UNO_QUERY ); } if ( xSupplier.is() ) @@ -259,9 +259,9 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const { xEvents->replaceByName( aEventName, aEventData ); } - catch( ::com::sun::star::lang::IllegalArgumentException ) + catch( const ::com::sun::star::lang::IllegalArgumentException& ) { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ); } - catch( ::com::sun::star::container::NoSuchElementException ) + catch( const ::com::sun::star::container::NoSuchElementException& ) { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ); } } else { @@ -273,17 +273,10 @@ void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const //-------------------------------------------------------------------------------------------------------- void SfxEventConfiguration::ConfigureEvent( rtl::OUString aName, const SvxMacro& rMacro, SfxObjectShell *pDoc ) { - SvxMacro *pMacro = NULL; + boost::scoped_ptr<SvxMacro> pMacro; if ( rMacro.GetMacName().Len() ) - pMacro = new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() ); - if ( pDoc ) - { - PropagateEvent_Impl( pDoc, aName, pMacro ); - } - else - { - PropagateEvent_Impl( NULL, aName, pMacro ); - } + pMacro.reset( new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() ) ); + PropagateEvent_Impl( pDoc ? pDoc : 0, aName, pMacro.get() ); } // ------------------------------------------------------------------------------------------------------- @@ -291,3 +284,5 @@ SvxMacro* SfxEventConfiguration::ConvertToMacro( const com::sun::star::uno::Any& { return SfxEvents_Impl::ConvertToMacro( rElement, pDoc, bBlowUp ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index d8e4258e60d4..67152990891c 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> #include <svl/itempool.hxx> #include <svl/itemiter.hxx> #include <svl/eitem.hxx> @@ -49,10 +50,7 @@ #include <comphelper/processfactory.hxx> #include <svtools/itemdel.hxx> -#ifndef GCC -#endif - -// wg. nInReschedule +//Includes below due to nInReschedule #include "appdata.hxx" #include <sfx2/bindings.hxx> #include <sfx2/msg.hxx> @@ -74,6 +72,7 @@ #include <comphelper/uieventslogger.hxx> #include <com/sun/star/frame/XModuleManager.hpp> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -100,7 +99,7 @@ static sal_uInt16 nTimeOut = 300; static sal_uInt32 nCache1 = 0; static sal_uInt32 nCache2 = 0; -typedef std::hash_map< sal_uInt16, bool > InvalidateSlotMap; +typedef boost::unordered_map< sal_uInt16, bool > InvalidateSlotMap; //==================================================================== @@ -150,33 +149,33 @@ public: SfxWorkWindow* pWorkWin; SfxBindings* pSubBindings; SfxBindings* pSuperBindings; - SfxStateCacheArr_Impl* pCaches; // je ein cache fuer jede gebundene - sal_uInt16 nCachedFunc1; // index der zuletzt gerufenen - sal_uInt16 nCachedFunc2; // index der vorletzt gerufenen - sal_uInt16 nMsgPos; // Message-Position, ab der zu aktualisieren ist - SfxPopupAction ePopupAction; // in DeleteFloatinWindow() abgefragt - sal_Bool bContextChanged; - sal_Bool bMsgDirty; // wurde ein MessageServer invalidiert? - sal_Bool bAllMsgDirty; // wurden die MessageServer invalidiert? - sal_Bool bAllDirty; // nach InvalidateAll - sal_Bool bCtrlReleased; // waehrend EnterRegistrations - AutoTimer aTimer; // fuer volatile Slots - sal_Bool bInUpdate; // fuer Assertions - sal_Bool bInNextJob; // fuer Assertions - sal_Bool bFirstRound; // Erste Runde im Update - sal_uInt16 nFirstShell; // Shell, die in erster Runde bevorzugt wird - sal_uInt16 nOwnRegLevel; // z"ahlt die echten Locks, ohne die der SuperBindings - InvalidateSlotMap m_aInvalidateSlots; // store slots which are invalidated while in update + SfxStateCacheArr_Impl* pCaches; // One chache for each binding + sal_uInt16 nCachedFunc1; // index for the last one called + sal_uInt16 nCachedFunc2; // index for the second last called + sal_uInt16 nMsgPos; // Message-Position relative the one to be updated + SfxPopupAction ePopupAction; // Checked in DeleteFloatinWindow() + sal_Bool bContextChanged; + sal_Bool bMsgDirty; // Has a MessageServer been invalidated? + sal_Bool bAllMsgDirty; // Has a MessageServer been invalidated? + sal_Bool bAllDirty; // After InvalidateAll + sal_Bool bCtrlReleased; // while EnterRegistrations + AutoTimer aTimer; // for volatile Slots + sal_Bool bInUpdate; // for Assertions + sal_Bool bInNextJob; // for Assertions + sal_Bool bFirstRound; // First round in Update + sal_uInt16 nFirstShell; // Shell, the first round is prefered + sal_uInt16 nOwnRegLevel; // Counts the real Locks, exept those of the Super Bindings + InvalidateSlotMap m_aInvalidateSlots; // store slots which are invalidated while in update }; //-------------------------------------------------------------------- struct SfxFoundCache_Impl { - sal_uInt16 nSlotId; // die Slot-Id - sal_uInt16 nWhichId; // falls verf"ugbar die Which-Id, sonst nSlotId - const SfxSlot* pSlot; // Pointer auf den <Master-Slot> - SfxStateCache* pCache; // Pointer auf den StatusCache, ggf. 0 + sal_uInt16 nSlotId; // the Slot-Id + sal_uInt16 nWhichId; // If available: Which-Id, else: nSlotId + const SfxSlot* pSlot; // Pointer to <Master-Slot> + SfxStateCache* pCache; // Pointer to StatusCache, if possible NULL SfxFoundCache_Impl(): nSlotId(0), @@ -216,7 +215,7 @@ SV_IMPL_OP_PTRARR_SORT(SfxFoundCacheArr_Impl, SfxFoundCache_Impl*); SfxBindings::SfxBindings() : pImp(new SfxBindings_Impl), pDispatcher(0), - nRegLevel(1) // geht erst auf 0, wenn Dispatcher gesetzt + nRegLevel(1) // first becomes 0, when the Dispatcher is set { pImp->nMsgPos = 0; pImp->bAllMsgDirty = sal_True; @@ -246,21 +245,20 @@ SfxBindings::SfxBindings() SfxBindings::~SfxBindings() -/* [Beschreibung] +/* [Description] - Destruktor der Klasse SfxBindings. Die eine, f"ur jede <SfxApplication> - existierende Instanz wird von der <SfxApplication> nach Ausf"urhung - von <SfxApplication::Exit()> automatisch zerst"ort. + Destructor of the SfxBindings class. The one, for each <SfxApplication> + existing Instance is automatically destroyed by the <SfxApplication> + after the execution of <SfxApplication::Exit()>. - Noch existierende <SfxControllerItem> Instanzen, die bei dieser - SfxBindings Instanz angemeldet sind, werden im Destruktor - automatisch zerst"ort. Dies sind i.d.R. Floating-Toolboxen, Value-Sets - etc. Arrays von SfxControllerItems d"urfen zu diesem Zeitpunkt nicht - mehr exisitieren. + The still existing <SfxControllerItem> instances, which are registered + by the SfxBindings instance, are automatically destroyed in the Destructor. + These are usually the Floating-Toolboxen, Value-Sets + etc. Arrays of SfxControllerItems may at this time no longer exist. */ { - // Die SubBindings sollen ja nicht gelocked werden ! + // The SubBindings should not be locked! pImp->pSubBindings = NULL; ENTERREGISTRATIONS(); @@ -268,7 +266,7 @@ SfxBindings::~SfxBindings() pImp->aTimer.Stop(); DeleteControllers_Impl(); - // Caches selbst l"oschen + // Delete Caches sal_uInt16 nCount = pImp->pCaches->Count(); for ( sal_uInt16 nCache = 0; nCache < nCount; ++nCache ) delete pImp->pCaches->GetObject(nCache); @@ -283,19 +281,19 @@ SfxBindings::~SfxBindings() void SfxBindings::DeleteControllers_Impl() { - // in der ersten Runde den SfxPopupWindows l"oschen + // in the first round delete SfxPopupWindows sal_uInt16 nCount = pImp->pCaches->Count(); sal_uInt16 nCache; for ( nCache = 0; nCache < nCount; ++nCache ) { - // merken wo man ist + // Remember were you are SfxStateCache *pCache = pImp->pCaches->GetObject(nCache); sal_uInt16 nSlotId = pCache->GetId(); - // SfxPopupWindow l"oschen lassen + // Delete SfxPopupWindow pCache->DeleteFloatingWindows(); - // da der Cache verkleinert worden sein kann, wiederaufsetzen + // Re-align, because the cache may have been reduced sal_uInt16 nNewCount = pImp->pCaches->Count(); if ( nNewCount < nCount ) { @@ -307,13 +305,13 @@ void SfxBindings::DeleteControllers_Impl() } } - // alle Caches l"oschen + // Delete all Caches for ( nCache = pImp->pCaches->Count(); nCache > 0; --nCache ) { - // Cache via ::com::sun::star::sdbcx::Index besorgen + // Get Cache via ::com::sun::star::sdbcx::Index SfxStateCache *pCache = pImp->pCaches->GetObject(nCache-1); - // alle Controller in dem Cache unbinden + // unbind all controllers in the cache SfxControllerItem *pNext; for ( SfxControllerItem *pCtrl = pCache->GetItemLink(); pCtrl; pCtrl = pNext ) @@ -325,7 +323,7 @@ void SfxBindings::DeleteControllers_Impl() if ( pCache->GetInternalController() ) pCache->GetInternalController()->UnBind(); - // Cache l"oschen + // Delete Cache if( nCache-1 < pImp->pCaches->Count() ) delete (*pImp->pCaches)[nCache-1]; pImp->pCaches->Remove(nCache-1, 1); @@ -340,7 +338,7 @@ void SfxBindings::DeleteControllers_Impl() pCtrl->ReleaseBindings(); } - DBG_ASSERT( !pImp->pUnoCtrlArr->Count(), "UnoControllerItems nicht entfernt!" ); + DBG_ASSERT( !pImp->pUnoCtrlArr->Count(), "Do not remove UnoControllerItems!" ); DELETEZ( pImp->pUnoCtrlArr ); } } @@ -357,7 +355,7 @@ SfxPopupAction SfxBindings::GetPopupAction_Impl() const void SfxBindings::HidePopups( bool bHide ) { - // SfxPopupWindows hiden + // Hide SfxPopupWindows HidePopupCtrls_Impl( bHide ); SfxBindings *pSub = pImp->pSubBindings; while ( pSub ) @@ -366,22 +364,22 @@ void SfxBindings::HidePopups( bool bHide ) pSub = pSub->pImp->pSubBindings; } - // SfxChildWindows hiden + // Hide SfxChildWindows DBG_ASSERT( pDispatcher, "HidePopups not allowed without dispatcher" ); if ( pImp->pWorkWin ) pImp->pWorkWin->HidePopups_Impl( bHide, sal_True ); } -void SfxBindings::HidePopupCtrls_Impl( FASTBOOL bHide ) +void SfxBindings::HidePopupCtrls_Impl( bool bHide ) { if ( bHide ) { - // SfxPopupWindows hiden + // Hide SfxPopupWindows pImp->ePopupAction = SFX_POPUP_HIDE; } else { - // SfxPopupWindows showen + // Show SfxPopupWindows pImp->ePopupAction = SFX_POPUP_SHOW; } @@ -394,7 +392,7 @@ void SfxBindings::HidePopupCtrls_Impl( FASTBOOL bHide ) void SfxBindings::Update_Impl ( - SfxStateCache* pCache // der upzudatende SfxStatusCache + SfxStateCache* pCache // The up to date SfxStatusCache ) { if( pCache->GetDispatch().is() && pCache->GetItemLink() ) @@ -408,7 +406,7 @@ void SfxBindings::Update_Impl return; DBG_PROFSTART(SfxBindingsUpdate_Impl); - // alle mit derselben Statusmethode zusammensammeln, die dirty sind + // gather together all with the same status method which are dirty SfxDispatcher &rDispat = *pDispatcher; const SfxSlot *pRealSlot = 0; const SfxSlotServer* pMsgServer = 0; @@ -417,10 +415,10 @@ void SfxBindings::Update_Impl sal_Bool bUpdated = sal_False; if ( pSet ) { - // Status erfragen + // Query Status if ( rDispat._FillState( *pMsgServer, *pSet, pRealSlot ) ) { - // Status posten + // Post Status const SfxInterface *pInterface = rDispat.GetShell(pMsgServer->GetShellLevel())->GetInterface(); for ( sal_uInt16 nPos = 0; nPos < aFound.Count(); ++nPos ) @@ -441,8 +439,9 @@ void SfxBindings::Update_Impl if ( !bUpdated && pCache ) { - // Wenn pCache == NULL und kein SlotServer ( z.B. weil Dispatcher gelockt! ), - // darf nat"urlich kein Update versucht werden + // When pCache == NULL and no SlotServer + // (for example due to locked Dispatcher! ), + // obviously do not try to update SfxFoundCache_Impl aFoundCache( pCache->GetId(), 0, pRealSlot, pCache ); @@ -476,16 +475,12 @@ void SfxBindings::AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId ) void SfxBindings::Update ( - sal_uInt16 nId // die gebundene und upzudatende Slot-Id + sal_uInt16 nId // the bound and up-to-date Slot-Id ) { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); -//!!TLX: Fuehrte zu Vorlagenkatalogstillstand -// if ( nRegLevel ) -// return; - if ( pDispatcher ) pDispatcher->Flush(); @@ -513,7 +508,7 @@ void SfxBindings::Update if ( bInternalUpdate ) { - // Status erfragen + // Query Status const SfxSlotServer* pMsgServer = pCache->GetSlotServer(*pDispatcher, pImp->xProv); if ( !pCache->IsControllerDirty() && ( !pMsgServer || @@ -571,10 +566,10 @@ void SfxBindings::Update() void SfxBindings::SetState ( - const SfxItemSet& rSet // zu setzende Status-Werte + const SfxItemSet& rSet // status values to be set ) { - // wenn gelockt, dann nur invalidieren + // when locked then only invalidate if ( nRegLevel ) { SfxItemIter aIter(rSet); @@ -585,12 +580,12 @@ void SfxBindings::SetState } else { - // Status d"urfen nur angenommen werden, wenn alle Slot-Pointer gesetzt sind + // Status may be accepted only if all slot-pointers are set if ( pImp->bMsgDirty ) UpdateSlotServer_Impl(); - // "uber das ItemSet iterieren, falls Slot gebunden, updaten - //! Bug: WhichIter verwenden und ggf. VoidItems hochschicken + // Iterate over the itemset, update if the slot bound + //! Bug: Use WhichIter and possibly send VoidItems up SfxItemIter aIter(rSet); for ( const SfxPoolItem *pItem = aIter.FirstItem(); pItem; @@ -600,12 +595,12 @@ void SfxBindings::SetState GetStateCache( rSet.GetPool()->GetSlotId(pItem->Which()) ); if ( pCache ) { - // Status updaten + // Update status if ( !pCache->IsControllerDirty() ) pCache->Invalidate(sal_False); pCache->SetState( SFX_ITEM_AVAILABLE, pItem ); - //! nicht implementiert: Updates von EnumSlots via MasterSlots + //! Not implemented: Updates from EnumSlots via master slots } } } @@ -615,7 +610,7 @@ void SfxBindings::SetState void SfxBindings::SetState ( - const SfxPoolItem& rItem // zu setzender Status-Wert + const SfxPoolItem& rItem // Status value to be set ) { if ( nRegLevel ) @@ -624,22 +619,22 @@ void SfxBindings::SetState } else { - // Status d"urfen nur angenommen werden, wenn alle Slot-Pointer gesetzt sind + // Status may be accepted only if all slot-pointers are set if ( pImp->bMsgDirty ) UpdateSlotServer_Impl(); - // falls der Slot gebunden ist, updaten + //update if the slot bound DBG_ASSERT( SfxItemPool::IsSlot( rItem.Which() ), "cannot set items with which-id" ); SfxStateCache* pCache = GetStateCache( rItem.Which() ); if ( pCache ) { - // Status updaten + // Update Status if ( !pCache->IsControllerDirty() ) pCache->Invalidate(sal_False); pCache->SetState( SFX_ITEM_AVAILABLE, &rItem ); - //! nicht implementiert: Updates von EnumSlots via MasterSlots + //! Not implemented: Updates from EnumSlots via master slots } } } @@ -657,13 +652,11 @@ SfxStateCache* SfxBindings::GetAnyStateCache_Impl( sal_uInt16 nId ) SfxStateCache* SfxBindings::GetStateCache ( - sal_uInt16 nId /* Slot-Id, deren SfxStatusCache gefunden - werden soll */, - sal_uInt16* pPos /* 0 bzw. Position, ab der die Bindings - bin"ar durchsucht werden sollen. Liefert - die Position zur"uck, an der nId gefunden - wurde, bzw. an der es einfef"ugt werden - w"urde. */ + sal_uInt16 nId, /* Slot-Id, which SfxStatusCache is to be found */ + sal_uInt16* pPos /* NULL for instance the position from which the + bindings are to be searched binary. Returns the + position back for where the nId was found, + or where it was inserted. */ ) { DBG_MEMTEST(); @@ -686,11 +679,8 @@ SfxStateCache* SfxBindings::GetStateCache void SfxBindings::InvalidateAll ( - sal_Bool bWithMsg /* sal_True - Slot-Server als ung"ultig markieren - - sal_False - Slot-Server bleiben g"ultig */ + sal_Bool bWithMsg /* sal_True Mark Slot Server as invalid + sal_False Slot Server remains valid */ ) { DBG_PROFSTART(SfxBindingsInvalidateAll); @@ -701,7 +691,7 @@ void SfxBindings::InvalidateAll if ( pImp->pSubBindings ) pImp->pSubBindings->InvalidateAll( bWithMsg ); - // ist schon alles dirty gesetzt oder downing => nicht zu tun + // everything is already set dirty or downing => nothing to do if ( !pDispatcher || ( pImp->bAllDirty && ( !bWithMsg || pImp->bAllMsgDirty ) ) || SFX_APP()->IsDowning() ) @@ -716,21 +706,13 @@ void SfxBindings::InvalidateAll for ( sal_uInt16 n = 0; n < pImp->pCaches->Count(); ++n ) pImp->pCaches->GetObject(n)->Invalidate(bWithMsg); -/* - ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); - if ( bWithMsg && xFrame.is() ) - xFrame->contextChanged(); -*/ pImp->nMsgPos = 0; if ( !nRegLevel ) { pImp->aTimer.Stop(); pImp->aTimer.SetTimeout(TIMEOUT_FIRST); pImp->aTimer.Start(); -// pImp->bFirstRound = sal_True; -// pImp->nFirstShell = 0; } DBG_PROFSTOP(SfxBindingsInvalidateAll); @@ -740,13 +722,11 @@ void SfxBindings::InvalidateAll void SfxBindings::Invalidate ( - const sal_uInt16* pIds /* numerisch sortiertes 0-terminiertes Array - von Slot-Ids (einzel, nicht als Paare!) */ + const sal_uInt16* pIds /* numerically sorted NULL-terminated array of + slot IDs (individual, not as a couple!) */ ) { DBG_PROFSTART(SfxBindingsInvalidateAll); -// DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); - DBG_MEMTEST(); if ( pImp->bInUpdate ) @@ -763,35 +743,33 @@ void SfxBindings::Invalidate if ( pImp->pSubBindings ) pImp->pSubBindings->Invalidate( pIds ); - // ist schon alles dirty gesetzt oder downing => nicht zu tun + // everything is already set dirty or downing => nothing to do if ( !pDispatcher || pImp->bAllDirty || SFX_APP()->IsDowning() ) return; - // in immer kleiner werdenden Berichen bin"ar suchen + // Search binary in always smaller areas for ( sal_uInt16 n = GetSlotPos(*pIds); *pIds && n < pImp->pCaches->Count(); n = GetSlotPos(*pIds, n) ) { - // falls SID "uberhaupt gebunden ist, den Cache invalidieren + // If SID is ever bound, then invalidate the cache SfxStateCache *pCache = pImp->pCaches->GetObject(n); if ( pCache->GetId() == *pIds ) pCache->Invalidate(sal_False); - // n"achste SID + // Next SID if ( !*++pIds ) break; DBG_ASSERT( *pIds > *(pIds-1), "pIds unsorted" ); } - // falls nicht gelockt, Update-Timer starten + // if not enticed to start update timer pImp->nMsgPos = 0; if ( !nRegLevel ) { pImp->aTimer.Stop(); pImp->aTimer.SetTimeout(TIMEOUT_FIRST); pImp->aTimer.Start(); -// pImp->bFirstRound = sal_True; -// pImp->nFirstShell = 0; } DBG_PROFSTOP(SfxBindingsInvalidateAll); @@ -801,17 +779,15 @@ void SfxBindings::Invalidate void SfxBindings::InvalidateShell ( - const SfxShell& rSh /* Die <SfxShell>, deren Slot-Ids - invalidiert werden sollen. */, - - sal_Bool bDeep /* sal_True - auch die, von der SfxShell - ererbten Slot-Ids werden invalidert - - sal_False - die ererbten und nicht "uberladenen - Slot-Ids werden invalidiert */ - //! MI: z. Zt. immer bDeep + const SfxShell& rSh, /* <SfxShell>, which Slot-Ids should be + invalidated */ + sal_Bool bDeep /* sal_True + also inherited slot IDs of SfxShell are invalidert + + sal_False + the inherited and not overloaded Slot-Ids were + invalidiert */ + // for now always bDeep ) { DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -825,19 +801,19 @@ void SfxBindings::InvalidateShell DBG_PROFSTART(SfxBindingsInvalidateAll); DBG_MEMTEST(); - // Jetzt schon flushen, wird in GetShellLevel(rSh) sowieso gemacht; wichtig, - // damit pImp->bAll(Msg)Dirty korrekt gesetzt ist + // flush now already, it is done in GetShellLevel (rsh) anyway, + // important so that is set correctly: pimp-> ball(Msg)Dirty pDispatcher->Flush(); if ( !pDispatcher || ( pImp->bAllDirty && pImp->bAllMsgDirty ) || SFX_APP()->IsDowning() ) { - // Wenn sowieso demn"achst alle Server geholt werden + // if the next one is anyway, then all the servers are collected return; } - // Level finden + // Find Level sal_uInt16 nLevel = pDispatcher->GetShellLevel(rSh); if ( nLevel != USHRT_MAX ) { @@ -867,11 +843,10 @@ void SfxBindings::InvalidateShell void SfxBindings::Invalidate ( - sal_uInt16 nId // zu invalidierende Slot-Id + sal_uInt16 nId // Status value to be set ) { DBG_MEMTEST(); -// DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); if ( pImp->bInUpdate ) { @@ -905,9 +880,9 @@ void SfxBindings::Invalidate void SfxBindings::Invalidate ( - sal_uInt16 nId, // zu invalidierende Slot-Id - sal_Bool bWithItem, // StateCache clearen ? - sal_Bool bWithMsg // SlotServer neu holen ? + sal_uInt16 nId, // Status value to be set + sal_Bool bWithItem, // Clear StateCache? + sal_Bool bWithMsg // Get new SlotServer? ) { DBG_MEMTEST(); @@ -996,7 +971,7 @@ sal_uInt16 SfxBindings::GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt ) while ( !bFound && nLow <= nHigh ) { nMid = (nLow + nHigh) >> 1; - DBG_ASSERT( nMid < pImp->pCaches->Count(), "bsearch ist buggy" ); + DBG_ASSERT( nMid < pImp->pCaches->Count(), "bsearch is buggy" ); int nDiff = (int) nId - (int) ( ((*pImp->pCaches)[nMid])->GetId() ); if ( nDiff < 0) { if ( nMid == 0 ) @@ -1077,7 +1052,6 @@ void SfxBindings::Release( SfxControllerItem& rItem ) { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); - //! DBG_ASSERT( nRegLevel > 0, "release without EnterRegistrations" ); DBG_ASSERT( !pImp->bInNextJob, "SfxBindings::Release while status-updating" ); ENTERREGISTRATIONS(); @@ -1112,11 +1086,6 @@ void SfxBindings::Release( SfxControllerItem& rItem ) // was this the last controller? if ( pCache->GetItemLink() == 0 && !pCache->GetInternalController() ) { -#ifdef slow - // remove the BoundFunc - delete (*pImp->pCaches)[nPos]; - pImp->pCaches->Remove(nPos, 1); -#endif pImp->bCtrlReleased = sal_True; } } @@ -1176,14 +1145,14 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* rDispatcher.GetFrame(); // -Wall is this required??? // get SlotServer (Slot+ShellLevel) and Shell from cache - sal_Bool bDeleteCache = sal_False; + ::boost::scoped_ptr<SfxStateCache> xCache; if ( !pCache ) { // Execution of non cached slots (Accelerators don't use Controllers) // slot is uncached, use SlotCache to handle external dispatch providers - pCache = new SfxStateCache( nId ); + xCache.reset(new SfxStateCache(nId)); + pCache = xCache.get(); pCache->GetSlotServer( rDispatcher, pImp->xProv ); - bDeleteCache = sal_True; } if ( pCache && pCache->GetDispatch().is() ) @@ -1199,8 +1168,6 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* // cache binds to an external dispatch provider pCache->Dispatch( aReq.GetArgs(), nCallMode == SFX_CALLMODE_SYNCHRON ); - if ( bDeleteCache ) - DELETEZ( pCache ); SfxPoolItem *pVoid = new SfxVoidItem( nId ); DeleteItemOnIdle( pVoid ); return pVoid; @@ -1254,9 +1221,6 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* pRet = pVoid; } - if ( bDeleteCache ) - delete pCache; - return pRet; } @@ -1266,7 +1230,8 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell if ( SFX_KIND_ENUM == pSlot->GetKind() ) { - // bei Enum-Slots muss der Master mit dem Wert des Enums executet werden + // for Enum-Slots, the Master has to be excecuted with the value + // of the enums const SfxSlot *pRealSlot = pShell->GetInterface()->GetRealSlot(pSlot); const sal_uInt16 nSlotId = pRealSlot->GetSlotId(); aReq.SetSlot( nSlotId ); @@ -1275,12 +1240,12 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell } else if ( SFX_KIND_ATTR == pSlot->GetKind() ) { - // bei Attr-Slots muss der Which-Wert gemapped werden + // Which value has to be mapped for Attribute slots const sal_uInt16 nSlotId = pSlot->GetSlotId(); aReq.SetSlot( nSlotId ); if ( pSlot->IsMode(SFX_SLOT_TOGGLE) ) { - // an togglebare-Attribs (Bools) wird der Wert angeheangt + // The value is attached to a toggleable attribute (Bools) sal_uInt16 nWhich = pSlot->GetWhich(rPool); SfxItemSet aSet(rPool, nWhich, nWhich, 0); SfxStateFunc aFunc = pSlot->GetStateFnc(); @@ -1300,7 +1265,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell { if ( pOldItem->ISA(SfxBoolItem) ) { - // wir koennen Bools toggeln + // we can toggle Bools sal_Bool bOldValue = ((const SfxBoolItem *)pOldItem)->GetValue(); SfxBoolItem *pNewItem = (SfxBoolItem*) (pOldItem->Clone()); pNewItem->SetValue( !bOldValue ); @@ -1310,7 +1275,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell else if ( pOldItem->ISA(SfxEnumItemInterface) && ((SfxEnumItemInterface *)pOldItem)->HasBoolValue()) { - // und Enums mit Bool-Interface + // and Enums with Bool-Interface SfxEnumItemInterface *pNewItem = (SfxEnumItemInterface*) (pOldItem->Clone()); pNewItem->SetBoolValue(!((SfxEnumItemInterface *)pOldItem)->GetBoolValue()); @@ -1318,36 +1283,36 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell delete pNewItem; } else { - DBG_ERROR( "Toggle only for Enums and Bools allowed" ); + OSL_FAIL( "Toggle only for Enums and Bools allowed" ); } } else if ( SFX_ITEM_DONTCARE == eState ) { - // ein Status-Item per Factory erzeugen + // Create one Status-Item for each Factory SfxPoolItem *pNewItem = pSlot->GetType()->CreateItem(); - DBG_ASSERT( pNewItem, "Toggle an Slot ohne ItemFactory" ); + DBG_ASSERT( pNewItem, "Toggle to slot without ItemFactory" ); pNewItem->SetWhich( nWhich ); if ( pNewItem->ISA(SfxBoolItem) ) { - // wir koennen Bools toggeln + // we can toggle Bools ((SfxBoolItem*)pNewItem)->SetValue( sal_True ); aReq.AppendItem( *pNewItem ); } else if ( pNewItem->ISA(SfxEnumItemInterface) && ((SfxEnumItemInterface *)pNewItem)->HasBoolValue()) { - // und Enums mit Bool-Interface + // and Enums with Bool-Interface ((SfxEnumItemInterface*)pNewItem)->SetBoolValue(sal_True); aReq.AppendItem( *pNewItem ); } else { - DBG_ERROR( "Toggle only for Enums and Bools allowed" ); + OSL_FAIL( "Toggle only for Enums and Bools allowed" ); } delete pNewItem; } else { - DBG_ERROR( "suspicious Toggle-Slot" ); + OSL_FAIL( "suspicious Toggle-Slot" ); } } @@ -1365,9 +1330,8 @@ void SfxBindings::UpdateSlotServer_Impl() DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); - // synchronisieren + // synchronize pDispatcher->Flush(); -// pDispatcher->Update_Impl(); if ( pImp->bAllMsgDirty ) { @@ -1375,8 +1339,6 @@ void SfxBindings::UpdateSlotServer_Impl() { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); - //if ( xFrame.is() ) - // xFrame->contextChanged(); pImp->bContextChanged = sal_False; } else @@ -1398,15 +1360,11 @@ void SfxBindings::UpdateSlotServer_Impl() //-------------------------------------------------------------------- -#ifdef WNT -int __cdecl CmpUS_Impl(const void *p1, const void *p2) -#else -int CmpUS_Impl(const void *p1, const void *p2) -#endif +int SAL_CALL CmpUS_Impl(const void *p1, const void *p2) -/* [Beschreibung] +/* [Description] - Interne Vergleichsfunktion fuer qsort. + Internal Comparison function for qsort. */ { @@ -1417,16 +1375,16 @@ int CmpUS_Impl(const void *p1, const void *p2) SfxItemSet* SfxBindings::CreateSet_Impl ( - SfxStateCache*& pCache, // in: Status-Cache von nId - const SfxSlot*& pRealSlot, // out: RealSlot zu nId - const SfxSlotServer** pMsgServer, // out: Slot-Server zu nId - SfxFoundCacheArr_Impl& rFound // out: Liste der Caches der Siblings + SfxStateCache*& pCache, // in: Status-Cache from nId + const SfxSlot*& pRealSlot, // out: RealSlot to nId + const SfxSlotServer** pMsgServer, // out: Slot-Server to nId + SfxFoundCacheArr_Impl& rFound // out: List of Caches for Siblings ) { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); - DBG_ASSERT( !pImp->bMsgDirty, "CreateSet_Impl mit dirty MessageServer" ); + DBG_ASSERT( !pImp->bMsgDirty, "CreateSet_Impl with dirty MessageServer" ); const SfxSlotServer* pMsgSvr = pCache->GetSlotServer(*pDispatcher, pImp->xProv); if(!pMsgSvr || !pDispatcher) @@ -1438,30 +1396,27 @@ SfxItemSet* SfxBindings::CreateSet_Impl sal_uInt16 nShellLevel = pMsgSvr->GetShellLevel(); SfxShell *pShell = pDispatcher->GetShell( nShellLevel ); - if ( !pShell ) // seltener GPF beim Browsen durch Update aus Inet-Notify + if ( !pShell ) // rare GPF when browsing through update from Inet-Notify return 0; SfxItemPool &rPool = pShell->GetPool(); - // hole die Status-Methode, von der pCache bedient wird + // get the status method, which is served by the pCache SfxStateFunc pFnc = 0; const SfxInterface *pInterface = pShell->GetInterface(); if ( SFX_KIND_ENUM == pMsgSvr->GetSlot()->GetKind() ) { pRealSlot = pInterface->GetRealSlot(pMsgSvr->GetSlot()); pCache = GetStateCache( pRealSlot->GetSlotId() ); -// DBG_ASSERT( pCache, "Kein Slotcache fuer den Masterslot gefunden!" ); } else pRealSlot = pMsgSvr->GetSlot(); - // - // Achtung: pCache darf auch NULL sein !!! - // + // Note: pCache can be NULL! pFnc = pRealSlot->GetStateFnc(); - // der RealSlot ist immer drin + // the RealSlot is always on const SfxFoundCache_Impl *pFound = new SfxFoundCache_Impl( pRealSlot->GetSlotId(), pRealSlot->GetWhich(rPool), pRealSlot, pCache ); rFound.Insert( pFound ); @@ -1470,24 +1425,23 @@ SfxItemSet* SfxBindings::CreateSet_Impl if ( !(nSlot >= SID_VERB_START && nSlot <= SID_VERB_END) ) { pInterface = pInterface->GetRealInterfaceForSlot( pRealSlot ); - DBG_ASSERT (pInterface,"Slot in angegebener Shell nicht gefunden!"); + DBG_ASSERT (pInterface,"Slot in the given shell is not found"); } - // Durchsuche die Bindings nach den von derselben Funktion bedienten Slots. - // Daf"ur kommen nur Slots in Frage, die es im gefundenen Interface gibt. + // Search through the bindings for slots served by the same function. This , // will only affect slots which are present in the found interface. - // Die Position des Statecaches im StateCache-Array + // The position of the Statecaches in StateCache-Array sal_uInt16 nCachePos = pImp->nMsgPos; const SfxSlot *pSibling = pRealSlot->GetNextSlot(); - // Die Slots eines Interfaces sind im Kreis verkettet + // the Slots odf a interfaces ar linked in a circle while ( pSibling > pRealSlot ) { SfxStateFunc pSiblingFnc=0; SfxStateCache *pSiblingCache = GetStateCache( pSibling->GetSlotId(), &nCachePos ); - // Ist der Slot "uberhaupt gecached ? + // Is the slot cached ? if ( pSiblingCache ) { const SfxSlotServer *pServ = pSiblingCache->GetSlotServer(*pDispatcher, pImp->xProv); @@ -1495,34 +1449,34 @@ SfxItemSet* SfxBindings::CreateSet_Impl pSiblingFnc = pServ->GetSlot()->GetStateFnc(); } - // Mu\s der Slot "uberhaupt upgedatet werden ? + // Does the slot have to be updated at all? bool bInsert = pSiblingCache && pSiblingCache->IsControllerDirty(); - // Bugfix #26161#: Es reicht nicht, nach der selben Shell zu fragen !! + // It is not enough to ask for the same shell!! bool bSameMethod = pSiblingCache && pFnc == pSiblingFnc; - // Wenn der Slot ein nicht-dirty MasterSlot ist, dann ist vielleicht - // einer seiner Slaves dirty ? Dann wird der Masterslot doch eingef"ugt. + // If the slot is a non-dirty master slot, then maybe one of his slaves + // is dirty? Then the master slot is still inserted. if ( !bInsert && bSameMethod && pSibling->GetLinkedSlot() ) { - // auch Slave-Slots auf Binding pru"fen + // Also check slave slots for Binding const SfxSlot* pFirstSlave = pSibling->GetLinkedSlot(); for ( const SfxSlot *pSlaveSlot = pFirstSlave; !bInsert; pSlaveSlot = pSlaveSlot->GetNextSlot()) { - // Die Slaves zeigen auf ihren Master + // the slaves points to its master DBG_ASSERT(pSlaveSlot->GetLinkedSlot() == pSibling, - "Falsche Master/Slave-Beziehung!"); + "Wrong Master/Slave relationship!"); sal_uInt16 nCurMsgPos = pImp->nMsgPos; const SfxStateCache *pSlaveCache = GetStateCache( pSlaveSlot->GetSlotId(), &nCurMsgPos ); - // Ist der Slave-Slot gecached und dirty ? + // Is the slave slot chached and dirty ? bInsert = pSlaveCache && pSlaveCache->IsControllerDirty(); - // Slaves sind untereinander im Kreis verkettet + // Slaves are chained together in a circle if (pSlaveSlot->GetNextSlot() == pFirstSlave) break; } @@ -1540,20 +1494,20 @@ SfxItemSet* SfxBindings::CreateSet_Impl pSibling = pSibling->GetNextSlot(); } - // aus den Ranges ein Set erzeugen + // Create a Set from the ranges sal_uInt16 *pRanges = new sal_uInt16[rFound.Count() * 2 + 1]; int j = 0; sal_uInt16 i = 0; while ( i < rFound.Count() ) { pRanges[j++] = rFound[i]->nWhichId; - // aufeinanderfolgende Zahlen + // consecutive numbers for ( ; i < rFound.Count()-1; ++i ) if ( rFound[i]->nWhichId+1 != rFound[i+1]->nWhichId ) break; pRanges[j++] = rFound[i++]->nWhichId; } - pRanges[j] = 0; // terminierende NULL + pRanges[j] = 0; // terminating NULL SfxItemSet *pSet = new SfxItemSet(rPool, pRanges); delete [] pRanges; DBG_PROFSTOP(SfxBindingsCreateSet); @@ -1564,7 +1518,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl void SfxBindings::UpdateControllers_Impl ( - const SfxInterface* pIF, // das diese Id momentan bedienende Interface + const SfxInterface* pIF, // Id of the current serving Interface const SfxFoundCache_Impl* pFound, // Cache, Slot, Which etc. const SfxPoolItem* pItem, // item to send to controller SfxItemState eState // state of item @@ -1578,18 +1532,18 @@ void SfxBindings::UpdateControllers_Impl const SfxSlot* pSlot = pFound->pSlot; DBG_ASSERT( !pCache || !pSlot || pCache->GetId() == pSlot->GetSlotId(), "SID mismatch" ); - // insofern gebunden, die Controller f"uer den Slot selbst updaten + // bound until now, the Controller to update the Slot. if ( pCache && pCache->IsControllerDirty() ) { if ( SFX_ITEM_DONTCARE == eState ) { - // uneindeuting + // ambiguous pCache->SetState( SFX_ITEM_DONTCARE, (SfxPoolItem *)-1 ); } else if ( SFX_ITEM_DEFAULT == eState && pFound->nWhichId > SFX_WHICH_MAX ) { - // kein Status oder Default aber ohne Pool + // no Status or Default but without Pool SfxVoidItem aVoid(0); pCache->SetState( SFX_ITEM_UNKNOWN, &aVoid ); } @@ -1601,8 +1555,8 @@ void SfxBindings::UpdateControllers_Impl DBG_PROFSTOP(SfxBindingsUpdateCtrl1); - // insofern vorhanden und gebunden, die Controller f"uer Slave-Slots - // (Enum-Werte) des Slots updaten + // Update the slots for so far available and bound Controllers for + // Slave-Slots (Enum-value) DBG_PROFSTART(SfxBindingsUpdateCtrl2); DBG_ASSERT( !pSlot || 0 == pSlot->GetLinkedSlot() || !pItem || pItem->ISA(SfxEnumItemInterface), @@ -1610,7 +1564,7 @@ void SfxBindings::UpdateControllers_Impl const SfxSlot *pFirstSlave = pSlot ? pSlot->GetLinkedSlot() : 0; if ( pIF && pFirstSlave) { - // Items auf EnumItem casten + // Items cast on EnumItem const SfxEnumItemInterface *pEnumItem = PTR_CAST(SfxEnumItemInterface,pItem); if ( eState == SFX_ITEM_AVAILABLE && !pEnumItem ) @@ -1618,14 +1572,14 @@ void SfxBindings::UpdateControllers_Impl else eState = SfxControllerItem::GetItemState( pEnumItem ); - // "uber alle Slaves-Slots iterieren + // Iterate over all Slaves-Slots for ( const SfxSlot *pSlave = pFirstSlave; pSlave; pSlave = pSlave->GetNextSlot() ) { - DBG_ASSERT(pSlave, "Falsche SlaveSlot-Verkettung!"); + DBG_ASSERT(pSlave, "Wrong SlaveSlot binding!"); DBG_ASSERT(SFX_KIND_ENUM == pSlave->GetKind(),"non enum slaves aren't allowed"); - DBG_ASSERT(pSlave->GetMasterSlotId() == pSlot->GetSlotId(),"falscher MasterSlot!"); + DBG_ASSERT(pSlave->GetMasterSlotId() == pSlot->GetSlotId(),"Wrong MasterSlot!"); - // ist die Funktion gebunden? + // Binding exist for function ? SfxStateCache *pEnumCache = GetStateCache( pSlave->GetSlotId() ); if ( pEnumCache ) { @@ -1650,14 +1604,14 @@ void SfxBindings::UpdateControllers_Impl } else if ( SFX_ITEM_AVAILABLE == eState ) { - // enum-Wert ermitteln + // Determine enum value sal_uInt16 nValue = pEnumItem->GetEnumValue(); SfxBoolItem aBool( pFound->nWhichId, pSlave->GetValue() == nValue ); pEnumCache->SetState(SFX_ITEM_AVAILABLE, &aBool); } else { - // uneindeuting + // ambiguous pEnumCache->SetState( SFX_ITEM_DONTCARE, (SfxPoolItem *)-1 ); } } @@ -1676,8 +1630,8 @@ void SfxBindings::UpdateControllers_Impl IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) { #ifdef DBG_UTIL - // on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT or another MS library - // try to get them here + // on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT + // or another MS library try to get them here try { #endif @@ -1701,10 +1655,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) // modifying the SfxObjectInterface-stack without SfxBindings => nothing to do SfxViewFrame* pFrame = pDispatcher->GetFrame(); - //<!--Modified by PengYunQuan for Validity Cell Range Picker - //if ( (pFrame && pFrame->GetObjectShell()->IsInModalMode()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() ) if ( (pFrame && !pFrame->GetObjectShell()->AcceptStateUpdate()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() ) - //-->Modified by PengYunQuan for Validity Cell Range Picker { DBG_PROFSTOP(SfxBindingsNextJob_Impl0); return sal_True; @@ -1715,7 +1666,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) return sal_True; } - // gfs. alle Server aktualisieren / geschieht in eigener Zeitscheibe + // if possible Update all server / happens in its own time slice if ( pImp->bMsgDirty ) { UpdateSlotServer_Impl(); @@ -1744,26 +1695,9 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) sal_Bool bWasDirty = pCache->IsControllerDirty(); if ( bWasDirty ) { -/* - sal_Bool bSkip = sal_False; - if ( pImp->bFirstRound ) - { - // Falls beim Update eine Shell vorgezogen werden soll, - // kommt in einer ersten Update-Runde nur diese dran - const SfxSlotServer *pMsgServer = - pCache->GetSlotServer(*pDispatcher, pImp->xProv); - if ( pMsgServer && - pMsgServer->GetShellLevel() != pImp->nFirstShell ) - bSkip = sal_True; - } - - if ( !bSkip ) - { -*/ Update_Impl( pCache ); DBG_ASSERT( nCount == pImp->pCaches->Count(), "Reschedule in StateChanged => buff" ); -// } } // skip to next function binding @@ -1773,8 +1707,9 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) bJobDone = pImp->nMsgPos >= nCount; if ( bJobDone && pImp->bFirstRound ) { - // Update der bevorzugten Shell ist gelaufen, nun d"urfen - // auch die anderen + + // Update of the preferred shell has been done, now may + // also the others shells be updated bJobDone = sal_False; pImp->bFirstRound = sal_False; pImp->nMsgPos = 0; @@ -1809,7 +1744,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) else pImp->aTimer.Stop(); - // Update-Runde ist beendet + // Update round is finished pImp->bInNextJob = sal_False; Broadcast(SfxSimpleHint(SFX_HINT_UPDATEDONE)); DBG_PROFSTOP(SfxBindingsNextJob_Impl); @@ -1818,7 +1753,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) } catch (...) { - DBG_ERROR("C++ exception caught!"); + OSL_FAIL("C++ exception caught!"); pImp->bInNextJob = sal_False; } @@ -1847,21 +1782,18 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine) aMsg += " Line: "; aMsg += ByteString::CreateFromInt32(nLine); } -// FILE* pLog = fopen( "c:\\bindings.log", "a+w" ); -// fwrite( aMsg.GetBuffer(), 1, aMsg.Len(), pLog ); -// fclose( pLog ); DbgTrace( aMsg.GetBuffer() ); #endif - // Wenn Bindings gelockt werden, auch SubBindings locken + // When bindings are locked, also lock sub bindings. if ( pImp->pSubBindings ) { pImp->pSubBindings->ENTERREGISTRATIONS(); - // Dieses EnterRegistrations ist f"ur die SubBindings kein "echtes" + // These EnterRegistrations are not "real" for the SubBindings pImp->pSubBindings->pImp->nOwnRegLevel--; - // Bindings synchronisieren + // Synchronize Bindings pImp->pSubBindings->nRegLevel = nRegLevel + pImp->pSubBindings->pImp->nOwnRegLevel + 1; } @@ -1877,7 +1809,7 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine) pImp->nCachedFunc1 = 0; pImp->nCachedFunc2 = 0; - // merken, ob ganze Caches verschwunden sind + // Mark if the all of the Caches have dissapered. pImp->bCtrlReleased = sal_False; } @@ -1894,14 +1826,14 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int DBG_ASSERT( nRegLevel, "Leave without Enter" ); DBG_ASSERT( nLevel == USHRT_MAX || nLevel == nRegLevel, "wrong Leave" ); - // Nur wenn die SubBindings noch von den SuperBindings gelockt sind, diesen Lock entfernen - // ( d.h. wenn es mehr Locks als "echte" Locks dort gibt ) + // Only when the SubBindings are still locked by the Superbindings, + // remove this lock (i.e. if there are more locks than "real" ones) if ( pImp->pSubBindings && pImp->pSubBindings->nRegLevel > pImp->pSubBindings->pImp->nOwnRegLevel ) { - // Bindings synchronisieren + // Synchronize Bindings pImp->pSubBindings->nRegLevel = nRegLevel + pImp->pSubBindings->pImp->nOwnRegLevel; - // Dieses LeaveRegistrations ist f"ur die SubBindings kein "echtes" + // This LeaveRegistrations is not "real" for SubBindings pImp->pSubBindings->pImp->nOwnRegLevel++; pImp->pSubBindings->LEAVEREGISTRATIONS(); } @@ -1914,40 +1846,29 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int if ( pImp->bContextChanged ) { pImp->bContextChanged = sal_False; - /* - ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); - if ( xFrame.is() ) - xFrame->contextChanged();*/ } -#ifndef slow SfxViewFrame* pFrame = pDispatcher->GetFrame(); - // ggf unbenutzte Caches entfernen bzw. PlugInInfo aufbereiten + // If possible remove unused Caches, for example prepare PlugInInfo if ( pImp->bCtrlReleased ) { for ( sal_uInt16 nCache = pImp->pCaches->Count(); nCache > 0; --nCache ) { - // Cache via ::com::sun::star::sdbcx::Index besorgen + // Get Cache via ::com::sun::star::sdbcx::Index SfxStateCache *pCache = pImp->pCaches->GetObject(nCache-1); - // kein Controller mehr interessiert + // No interested Controller present if ( pCache->GetItemLink() == 0 && !pCache->GetInternalController() ) { - // Cache entfernen. Safety: first remove and then delete + // Remove Cache. Safety: first remove and then delete SfxStateCache* pSfxStateCache = (*pImp->pCaches)[nCache-1]; pImp->pCaches->Remove(nCache-1, 1); delete pSfxStateCache; } - else - { - // neue Controller mit den alten Items benachrichtigen - //!pCache->SetCachedState(); - } } } -#endif + // restart background-processing pImp->nMsgPos = 0; if ( !pFrame || !pFrame->GetObjectShell() ) @@ -1957,7 +1878,6 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int pImp->aTimer.Stop(); pImp->aTimer.SetTimeout(TIMEOUT_FIRST); pImp->aTimer.Start(); -// pImp->bFirstRound = sal_True; } } @@ -1975,9 +1895,6 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int aMsg += " Line: "; aMsg += ByteString::CreateFromInt32(nLine); } -// FILE* pLog = fopen( "c:\\bindings.log", "a+w" ); -// fwrite( aMsg.GetBuffer(), 1, aMsg.Len(), pLog ); -// fclose( pLog ); DbgTrace( aMsg.GetBuffer() ); #endif } @@ -1989,7 +1906,7 @@ const SfxSlot* SfxBindings::GetSlot(sal_uInt16 nSlotId) DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); - // syncronisieren + // synchronizing pDispatcher->Flush(); if ( pImp->bMsgDirty ) UpdateSlotServer_Impl(); @@ -2033,7 +1950,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) { if ( pImp->pSubBindings && pImp->pSubBindings->pDispatcher != pOldDispat ) { - DBG_ERROR( "SubBindings vor Aktivieren schon gesetzt!" ); + OSL_FAIL( "SubBindings already set before activating!" ); pImp->pSubBindings->ENTERREGISTRATIONS(); } LEAVEREGISTRATIONS(); @@ -2043,7 +1960,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) ENTERREGISTRATIONS(); if ( pImp->pSubBindings && pImp->pSubBindings->pDispatcher != pOldDispat ) { - DBG_ERROR( "SubBindings im Deaktivieren immer noch gesetzt!" ); + OSL_FAIL( "SubBindings still set even when deactivating!" ); pImp->pSubBindings->LEAVEREGISTRATIONS(); } } @@ -2081,10 +1998,10 @@ void SfxBindings::StartUpdate_Impl( sal_Bool bComplete ) pImp->pSubBindings->StartUpdate_Impl( bComplete ); if ( !bComplete ) - // Update darf unterbrochen werden + // Update may be interrupted NextJob_Impl(&pImp->aTimer); else - // alle Slots am St"uck updaten + // Update all slots in a row NextJob_Impl(0); } @@ -2185,14 +2102,14 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState ) } } - // Dann am Dispatcher testen; da die von dort zur"uckgegebenen Items immer - // DELETE_ON_IDLE sind, mu\s eine Kopie davon gezogen werden, um einen - // Eigent"umer"ubergang zu erm"oglichen + // Then test at the dispatcher to check if the returned items from + // there are always DELETE_ON_IDLE, a copy of it has to be made in + // order to allow for transition of ownership. const SfxPoolItem *pItem = NULL; SfxItemState eState = pDispatcher->QueryState( nSlot, pItem ); if ( eState == SFX_ITEM_SET ) { - DBG_ASSERT( pItem, "SFX_ITEM_SET aber kein Item!" ); + DBG_ASSERT( pItem, "SFX_ITEM_SET but no item!" ); if ( pItem ) rpState = pItem->Clone(); } @@ -2350,7 +2267,7 @@ sal_Bool SfxBindings::ExecuteCommand_Impl( const String& rCommand ) { ::com::sun::star::util::URL aURL; aURL.Complete = rCommand; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aURL ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDisp = pImp->xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); if ( xDisp.is() ) @@ -2360,7 +2277,7 @@ sal_Bool SfxBindings::ExecuteCommand_Impl( const String& rCommand ) ::rtl::OUString sAppName; try { - static ::rtl::OUString our_aModuleManagerName = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); + static ::rtl::OUString our_aModuleManagerName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager( @@ -2371,7 +2288,7 @@ sal_Bool SfxBindings::ExecuteCommand_Impl( const String& rCommand ) sAppName = xModuleManager->identify(xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence<beans::PropertyValue> source; - ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString::createFromAscii("SfxAsyncExec")); + ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxAsyncExec"))); ::comphelper::UiEventsLogger::logDispatch(aURL, source); } new SfxAsyncExec_Impl( aURL, xDisp ); @@ -2424,3 +2341,5 @@ uno::Reference < frame::XDispatch > SfxBindings::GetDispatch( const SfxSlot* pSl return xRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx index e90b680ffa13..bd7c0a987546 100644 --- a/sfx2/source/control/ctrlitem.cxx +++ b/sfx2/source/control/ctrlitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" #include <svl/itempool.hxx> -#ifndef GCC -#endif #include <sfx2/ctrlitem.hxx> #include <sfx2/bindings.hxx> @@ -47,11 +46,11 @@ DBG_NAME(SfxControllerItem); void SfxControllerItem::CheckConfigure_Impl( sal_uIntPtr nType ) { - // echter Slot? (also kein Separator etc.) + // Real Slot? (i.e. no Separator etc.) if ( !nId ) return; - // ist die Id "uberhaupt in 'nType' konfigurierbar? + // is the ID configurable at all in 'nType'? const SfxSlot *pSlot = SFX_SLOTPOOL().GetSlot(nId); DBG_ASSERTWARNING( pSlot, "SfxControllerItem: binding not existing slot" ); if ( pSlot && !pSlot->IsMode(nType) ) @@ -65,7 +64,6 @@ void SfxControllerItem::CheckConfigure_Impl( sal_uIntPtr nType ) #endif //-------------------------------------------------------------------- - // returns the next registered SfxControllerItem with the same id SfxControllerItem* SfxControllerItem::GetItemLink() @@ -76,7 +74,6 @@ SfxControllerItem* SfxControllerItem::GetItemLink() } //-------------------------------------------------------------------- - // returns sal_True if this binding is really bound to a function sal_Bool SfxControllerItem::IsBound() const @@ -86,24 +83,17 @@ sal_Bool SfxControllerItem::IsBound() const return pNext != this; } -//-------------------------------------------------------------------- - -// returns the associated function-id or 0 if none - -// sal_uInt16 SfxControllerItem::GetId() const; - //==================================================================== - // registeres with the id at the bindings void SfxControllerItem::Bind( sal_uInt16 nNewId, SfxBindings *pBindinx ) { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings || pBindinx, "Keine Bindings"); + DBG_ASSERT(pBindings || pBindinx, "No Bindings"); if ( IsBound() ) { - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); pBindings->Release(*this); } @@ -119,10 +109,10 @@ void SfxControllerItem::BindInternal_Impl( sal_uInt16 nNewId, SfxBindings *pBind { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings || pBindinx, "Keine Bindings"); + DBG_ASSERT(pBindings || pBindinx, "No Bindings"); if ( IsBound() ) { - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); pBindings->Release(*this); } @@ -139,14 +129,14 @@ void SfxControllerItem::BindInternal_Impl( sal_uInt16 nNewId, SfxBindings *pBind void SfxControllerItem::UnBind() -/* [Beschreibung] - - "ost die Verbindung dieses SfxControllerItems mit der SfxBindings-Instanz, - an der es zur Zeit gebunden ist. Ab diesem Zeitpunkt erh"alt es keine - Statusbenachrichtigungen (<SfxControllerItem::StateChented()>) mehr. +/* [Description] + Unbinds the connection of this SfxControllerItems with the SfxBindings + instance with which it to time is bound. From this time on it does not + receive any status notifications (<SfxControllerItem::StateChented()>) + anymore. - [Querverweise] + [Cross-reference] <SfxControllerItem::ReBind()> <SfxControllerItem::ClearCache()> @@ -154,7 +144,7 @@ void SfxControllerItem::UnBind() { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); DBG_ASSERT( IsBound(), "unbindings unbound SfxControllerItem" ); pBindings->Release(*this); @@ -165,14 +155,13 @@ void SfxControllerItem::UnBind() void SfxControllerItem::ReBind() -/* [Beschreibung] +/* [Description] - Binded dieses SfxControllerItem wieder an die SfxBindings-Instanz, - an der es zuletzt gebunden war. Ab diesem Zeitpunkt erh"alt es wieder - Statusbenachrichtigungen (<SfxControllerItem::StateChented()>). + Binds this SfxControllerItem with the SfxBindings instance again, + with which it was last bound. From this time on it does receive status + notifications (<SfxControllerItem::StateChented()>) again. - - [Querverweise] + [Cross-reference] <SfxControllerItem::UnBind()> <SfxControllerItem::ClearCache()> @@ -181,7 +170,7 @@ void SfxControllerItem::ReBind() { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); DBG_ASSERT( !IsBound(), "bindings rebound SfxControllerItem" ); pBindings->Register(*this); @@ -191,11 +180,11 @@ DBG_CHKTHIS(SfxControllerItem, 0); void SfxControllerItem::UpdateSlot() -/* [Beschreibung] +/* [Description] - Holt den Status 'hart' neu. + Get the Status again. - [Querverweise] + [Cross-reference] <SfxControllerItem::ClearCache()> */ @@ -203,7 +192,7 @@ void SfxControllerItem::UpdateSlot() { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); pBindings->Update( GetId() ); } @@ -212,24 +201,20 @@ void SfxControllerItem::UpdateSlot() void SfxControllerItem::ClearCache() -/* [Beschreibung] - - "oscht den Status-Cache f"ur dieses SfxControllerItem. D.h. beim - n"achsten Status-Update wird das <SfxPoolItem> auf jeden Fall geschickt, - auch wenn zuvor dasselbe geschickt wurde. Dies wird ben"otigt, wenn - ein Controller umgeschaltet werden kann und sich diesen Status - selbst merkt. - +/* [Description] - [Beispiel] + Clears the cache status for this SfxControllerItem. That is by the next + status update is the <SfxPoolItem> sent in any case, even if the same was + sent before. This is needed if a controller can be switched on and note + that status themselves. - Der Kombi-Controller f"ur das Einstellen des Fl"achentyps und der - konkreten Auspr"agung (Farbe blau oder Schraffur X) kann im Typ - umgestellt werden, wird jedoch dann bei der n"achsten Selektion - wieder benachrichtigt, auch wenn es dieselben Daten sind. + [Example] + The combined controller for adjusting the surface type and the concrete + expression (blue color, or hatching X) can be changed in type, but is then + notified of the next selection again, even if it the same data. - [Querverweise] + [Cross-reference] <SfxControllerItem::UnBind()> <SfxControllerItem::ReBind()> @@ -239,13 +224,12 @@ void SfxControllerItem::ClearCache() { DBG_MEMTEST(); DBG_CHKTHIS(SfxControllerItem, 0); - DBG_ASSERT(pBindings, "Keine Bindings"); + DBG_ASSERT(pBindings, "No Bindings"); pBindings->ClearCache_Impl( GetId() ); } //-------------------------------------------------------------------- - // replaces the successor in the list of bindings of the same id SfxControllerItem* SfxControllerItem::ChangeItemLink( SfxControllerItem* pNewLink ) @@ -258,7 +242,6 @@ SfxControllerItem* SfxControllerItem::ChangeItemLink( SfxControllerItem* pNewLin } //-------------------------------------------------------------------- - // changes the id of unbound functions (e.g. for sub-menu-ids) void SfxControllerItem::SetId( sal_uInt16 nItemId ) @@ -271,7 +254,7 @@ void SfxControllerItem::SetId( sal_uInt16 nItemId ) //-------------------------------------------------------------------- -// creates a atomic item for a controller without registration +// creates a atomic item for a controller without registration. SfxControllerItem::SfxControllerItem(): nId(0), @@ -283,7 +266,6 @@ SfxControllerItem::SfxControllerItem(): } //-------------------------------------------------------------------- - // creates a representation of the function nId and registeres it SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ): @@ -297,7 +279,6 @@ SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ): } //-------------------------------------------------------------------- - // unregisteres the item in the bindings SfxControllerItem::~SfxControllerItem() @@ -312,27 +293,29 @@ SfxControllerItem::~SfxControllerItem() void SfxControllerItem::StateChanged ( - sal_uInt16 , // <SID> des ausl"osenden Slot - SfxItemState , // <SfxItemState> von 'pState' - const SfxPoolItem* // Slot-Status, ggf. 0 oder IsInvalidItem() + sal_uInt16, // <SID> of the triggering slot + SfxItemState, // <SfxItemState> of 'pState' + const SfxPoolItem* // Slot-Status, NULL or IsInvalidItem() ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird vom SFx gerufen, um <SfxControllerItem>s - dar"uber zu benachrichtigen, da\s sich der Status des Slots 'nSID' - ge"andert hat. Der neue Wert sowie der von diesem Wert ermittelte - Status wird als 'pState' bzw. 'eState' mitgegeben. + This virtual method is called by the SFx to inform the <SfxControllerItem>s + is about that state of the slots 'NSID' has changed. The new value and the + value determined by this status is given as 'pState' or 'eState'. - Der Status eines Slots kann sich "andern, wenn z.B. das MDI-Fenster - gewechselt wird oder der Slot explizit mit <SfxBindings::Invalidate()> - invalidiert wurde. + The status of a slot may change, for example when the MDI window is + switched or when the slot was invalidated explicitly with + <SfxBindings::Invalidate()>. Achtung! Die Methode wird nicht gerufen, wenn der Slot ung"ultig wurde, danach jedoch wieder denselben Wert angenommen hat. - Diese Basisklasse braucht nicht gerufen zu werden, weitere Zwischenstufen - jedoch (z.B. <SfxToolboxControl>) sollten gerufen werden. + Beware! The method is not called when the slot is invalid, however + has again assumed the same value. + + This base class need not be called, further interim steps however + (eg <SfxToolboxControl> ) should be called. */ { @@ -352,9 +335,9 @@ void SfxControllerItem::DeleteFloatingWindow() void SfxStatusForwarder::StateChanged ( - sal_uInt16 nSID, // <SID> des ausl"osenden Slot - SfxItemState eState, // <SfxItemState> von 'pState' - const SfxPoolItem* pState // Slot-Status, ggf. 0 oder IsInvalidItem() + sal_uInt16 nSID, // <SID> of the triggering slot + SfxItemState eState, // <SfxItemState> of 'pState' + const SfxPoolItem* pState // Slot-Status, NULL or IsInvalidItem() ) { @@ -375,37 +358,35 @@ SfxStatusForwarder::SfxStatusForwarder( SfxItemState SfxControllerItem::GetItemState ( - const SfxPoolItem* pState /* Pointer auf das <SfxPoolItem>, dessen - Status erfragt werden soll. */ + const SfxPoolItem* pState /* Pointer to <SfxPoolItem>, which + Status should be queried. */ ) -/* [Beschreibung] +/* [Description] - Statische Methode zum Ermitteln des Status des SfxPoolItem-Pointers, - in der Methode <SfxControllerItem::StateChanged(const SfxPoolItem*)> - zu verwenden. + Static method to determine the status of the SfxPoolItem-Pointers, to be + used in the method <SfxControllerItem::StateChanged(const SfxPoolItem*)> - [R"uckgabewert] + [Return value] SfxItemState SFX_ITEM_UNKNOWN - Enabled, aber keine weitere Statusinformation - verf"ugbar. Typisch f"ur <Slot>s, die allenfalls - zeitweise disabled sind, aber ihre Darstellung sonst - nicht "andern. + Enabled, but no further status information available. + Typical for <Slot>s, which anyway are sometimes + disabled, but otherwise do not change their appearance. SFX_ITEM_DISABLED - Disabled und keine weiter Statusinformation - verf"ugbar. Alle anderen ggf. angezeigten Werte sollten - auf den Default zur"uckgesetzt werden. + Disabled and no further status information available. + All other values that may appear should be reset to + default. SFX_ITEM_DONTCARE - Enabled aber es waren nur uneindeutige Werte - verf"ugbar (also keine, die abgefragt werden k"onnen). + Enabled but there were only ambiguous values available + (i.e. non that can be queried). SFX_ITEM_AVAILABLE - Enabled und mit verf"ugbarem Wert, der von 'pState' - erfragbar ist. Der Typ ist dabei im gesamten - Programm eindeutig und durch den Slot festgelegt. + Enabled and with available values, which are queried + by 'pState'. The Type is thus clearly defined in the + entire Program and specified through the Slot. */ { @@ -422,10 +403,10 @@ SfxItemState SfxControllerItem::GetItemState SfxMapUnit SfxControllerItem::GetCoreMetric() const -/* [Beschreibung] +/* [Description] - Holt vom zust"andigen Pool die Ma\seinheit ab, in der das Status-Item - vorliegt. + Gets the measurement unit from the competent pool, in which the Status + item exist. */ { @@ -463,4 +444,4 @@ SfxMapUnit SfxControllerItem::GetCoreMetric() const #pragma optimize("g",off) #endif - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 9b403e3ddab4..59dfe7fd75f0 100755..100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,17 +35,13 @@ #include <svl/itemiter.hxx> #include <svl/whiter.hxx> #include <svl/intitem.hxx> -#ifndef _SFXEITEM_HXX //autogen #include <svl/eitem.hxx> -#endif #include <svl/undo.hxx> -#ifndef _WRKWIN_HXX //autogen #include <vcl/wrkwin.hxx> -#endif #include <svtools/ttprops.hxx> #include <stdio.h> #include <stdarg.h> -#include <stdlib.h> // wg. bsearch +#include <stdlib.h> // due to bsearch #define _SVSTDARR_ULONGS #include <svl/svstdarr.hxx> @@ -52,10 +49,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#ifndef GCC -#endif - -// wg. nAutoPageID +// due to nAutoPageID #include "appdata.hxx" #include "sfx2/sfxhelp.hxx" #include <sfx2/dispatch.hxx> @@ -98,10 +92,10 @@ DECL_PTRSTACK(SfxShellStack_Impl, SfxShell*, 8, 4 ); struct SfxToDo_Impl { - SfxShell* pCluster; - bool bPush; - bool bDelete; - bool bUntil; + SfxShell* pCluster; + bool bPush; + bool bDelete; + bool bUntil; SfxToDo_Impl() : pCluster(0) @@ -126,10 +120,10 @@ IMPL_OBJSTACK(SfxToDoStack_Impl, SfxToDo_Impl); struct SfxObjectBars_Impl { - sal_uInt32 nResId; // Resource - und ConfigId der Toolbox - sal_uInt16 nMode; // spezielle Sichtbarkeitsflags - String aName; - SfxInterface* pIFace; + sal_uInt32 nResId; // Resource - and ConfigId of the Toolbox + sal_uInt16 nMode; // special visibility flags + String aName; + SfxInterface* pIFace; SfxObjectBars_Impl() : nResId( 0 ) @@ -140,37 +134,39 @@ struct SfxObjectBars_Impl struct SfxDispatcher_Impl { - SfxRequestPtrArray aReqArr; - const SfxSlotServer* pCachedServ1; // zuletzt gerufene Message - const SfxSlotServer* pCachedServ2; // vorletzt gerufene Message - SfxShellStack_Impl aStack; // aktive Funktionalitaet - Timer aTimer; // fuers flushen - SfxToDoStack_Impl aToDoStack; // nicht abgearb. Push/Pop - SfxViewFrame* pFrame; // 0 oder zugeh"or. Frame - SfxDispatcher* pParent; // z.B. AppDispatcher, ggf. 0 - SfxHintPosterRef xPoster; // asynchrones Execute - sal_Bool bFlushing; // sal_True waehrend Flush //? - sal_Bool bUpdated; // Update_Impl gelaufen - sal_Bool bLocked; // kein Execute - sal_Bool bInvalidateOnUnlock;// da fragte jemand - sal_Bool bActive; // nicht verwechseln mit gesetzt! - sal_Bool* pInCallAliveFlag; // dem Stack den Dtor anzeigen - SfxObjectBars_Impl aObjBars[SFX_OBJECTBAR_MAX]; - SfxObjectBars_Impl aFixedObjBars[SFX_OBJECTBAR_MAX]; - SvULongs aChildWins; - sal_uInt32 nEventId; // EventId UserEvent - sal_Bool bUILocked; // Update abgeklemmt (!zappeln) - sal_Bool bNoUI; // UI nur vom Parent Dispatcher - sal_Bool bReadOnly; // Dokument ist ReadOnly - sal_Bool bQuiet; // nur parent dispatcher verwenden - sal_Bool bModal; // nur Slots vom Parent-Dispatcher - - sal_Bool bFilterEnabling; // sal_True=filter enabled slots, 2==ReadOnlyDoc uebersteuert - sal_uInt16 nFilterCount; // Anzahl der SIDs in pFilterSIDs - const sal_uInt16* pFilterSIDs; // sortiertes Array von SIDs - sal_uInt16 nStandardMode; // ExecuteMode f. PlugInDispatcher - SvUShorts* pDisableList; - sal_uInt32 nDisableFlags; + SfxRequestPtrArray aReqArr; + const SfxSlotServer* pCachedServ1; // last called message + const SfxSlotServer* pCachedServ2; // penultimate called Message + SfxShellStack_Impl aStack; // active functionality + Timer aTimer; // for Flush + SfxToDoStack_Impl aToDoStack; // not processed Push/Pop + SfxViewFrame* pFrame; // NULL or associated Frame + SfxDispatcher* pParent; // AppDispatcher, NULL if possible + SfxHintPosterRef xPoster; // Execute asynchronous + sal_Bool bFlushing; // sal_True during Flush //? + sal_Bool bUpdated; // Update_Impl has run + sal_Bool bLocked; // No Execute + sal_Bool bInvalidateOnUnlock; // because someone asked + sal_Bool bActive; // not to be confused with set! + sal_Bool* pInCallAliveFlag; // view the Destructor Stack + SfxObjectBars_Impl aObjBars[SFX_OBJECTBAR_MAX]; + SfxObjectBars_Impl aFixedObjBars[SFX_OBJECTBAR_MAX]; + SvULongs aChildWins; + sal_uInt16 nActionLevel; // in EnterAction + sal_uInt32 nEventId; // EventId UserEvent + sal_Bool bUILocked; // Update disconnected (no flicker) + sal_Bool bNoUI; // UI only from Parent Dispatcher + sal_Bool bReadOnly; // Document is ReadOnly + sal_Bool bQuiet; // Only use parent dispatcher + sal_Bool bModal; // Only slots from parent dispatcher + + sal_Bool bFilterEnabling; // sal_True=filter enabled slots, + // 2==ReadOnlyDoc overturned + sal_uInt16 nFilterCount; // Number of SIDs in pFilterSIDs + const sal_uInt16* pFilterSIDs; // sorted Array of SIDs + sal_uInt16 nStandardMode; // ExecuteMode from PlugInDispatcher + SvUShorts* pDisableList; + sal_uInt32 nDisableFlags; }; #define NO_OBJECTBAR 0 @@ -184,18 +180,17 @@ struct SfxDispatcher_Impl //==================================================================== sal_Bool SfxDispatcher::IsLocked( sal_uInt16 ) const -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann festgestellt werden, ob der SfxDispatcher - gesperrt oder freigegeben ist. Ein gesperrter SfxDispatcher - f"uhrt keine <SfxRequest>s mehr aus und liefert keine - Status-Informationen mehr. Er verh"alt sich so als w"aren alle - Slots disabled. + With this method it can be determined whether the SfxDispatcher is + locked or unlocked. A locked SfxDispatcher does not perform <SfxRequest>s + and no longer provides any status information. It behaves as if all the + slots are disabled. - Der Dispatcher gilt auch als gesperrt, wenn alle Dispatcher - gelockt sind (<SfxApplication::LockDispatcher()>) oder der zugeh"orige - Top-Frame im modal-mode ist und der angegebene Slot Frame-spezifisch - (also nicht von der Application) bedient wird. + The dispatcher is also marked as blocked, if all Dispatcher are locked + (<SfxApplication::LockDispatcher()>) or the associated top frame is in the + modal-mode and if the specified slot are handled as frame-specific + (ie, not served by the application). */ { @@ -205,19 +200,15 @@ sal_Bool SfxDispatcher::IsLocked( sal_uInt16 ) const //-------------------------------------------------------------------- sal_Bool SfxDispatcher::IsAppDispatcher() const -/* [Beschreibung] - - Mit dieser Methode l"a\st sich festellen, ob der SfxDispacher der - Applikations-Dispatcher ist. +/* [Description] + With this method it can be determined if the SfxDispacher is the + applications dispatcher. - [R"uckgabewert] + [Return value] - sal_Bool sal_True - Es ist der Applikations-Dispatcher. - - sal_False - Es ist ein Dispatcher eines SfxViewFrame. + sal_Bool sal_True it is the application dispatcher. + sal_Fals it is a SfxViewFrame dispatcher. */ { @@ -227,21 +218,21 @@ sal_Bool SfxDispatcher::IsAppDispatcher() const //-------------------------------------------------------------------- int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, sal_Bool bRecord ) -/* [Beschreibung] +/* [Description] - Hilfsfunktion zum pr"ufen, ob ein Slot executed werden darf und - der Execution selbst. + Helper function to check whether a slot can be executed and + check the execution itself */ { SFX_STACK(SfxDispatcher::Call_Impl); - // darf der Slot gerufen werden (i.S.v. enabled) + // The slot may be called (meaning enabled) if ( rSlot.IsMode(SFX_SLOT_FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) ) { if ( GetFrame() ) { - // ggf. Recording anwerfen + // Recording may start com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); @@ -252,7 +243,7 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest if ( xSet.is() ) { - com::sun::star::uno::Any aProp = xSet->getPropertyValue(::rtl::OUString::createFromAscii("DispatchRecorderSupplier")); + com::sun::star::uno::Any aProp = xSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DispatchRecorderSupplier"))); com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorderSupplier > xSupplier; com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; aProp >>= xSupplier; @@ -263,14 +254,13 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest rReq.Record_Impl( rShell, rSlot, xRecorder, GetFrame() ); } } - - // Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht - // "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist + // Get all that is needed, because the slot may not have survived the + // Execute if it is a 'pseudo slot' for macros or verbs. sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE); - // API-Call-Klammerung und Document-Lock w"ahrend des Calls + // API-call parentheses and document-lock during the calls { - // 'this' mu\s im Dtor bescheid sagen + // 'this' must respond in the Destructor sal_Bool bThisDispatcherAlive = sal_True; sal_Bool *pOldInCallAliveFlag = pImp->pInCallAliveFlag; pImp->pInCallAliveFlag = &bThisDispatcherAlive; @@ -288,14 +278,14 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SfxExecFunc pFunc = rSlot.GetExecFnc(); rShell.CallExec( pFunc, rReq ); - // falls 'this' noch lebt + // If 'this' is still alive if ( bThisDispatcherAlive ) pImp->pInCallAliveFlag = pOldInCallAliveFlag; else { if ( pOldInCallAliveFlag ) { - // auch verschachtelte Stack-Frames sch"utzen + // also protect nested stack frames *pOldInCallAliveFlag = sal_False; } @@ -308,14 +298,14 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest { SfxBindings *pBindings = GetBindings(); - // bei AutoUpdate sofort updaten; "Pseudoslots" d"urfen nicht - // Autoupdate sein! + // When AutoUpdate update immediately; "Pseudoslots" must not be + // Autoupdate! if ( bAutoUpdate && pBindings ) { const SfxSlot* pSlave = rSlot.GetLinkedSlot(); if (pSlave) { - // bei Enum-Slots irgendeinen gebundenen Slave-Slot nehmen + // When enum slots take any bound slave slot while (!pBindings->IsBound(pSlave->GetSlotId()) && pSlave != &rSlot ) pSlave = pSlave->GetLinkedSlot(); pBindings->Invalidate(pSlave->GetSlotId()); @@ -385,11 +375,10 @@ SfxDispatcher::SfxDispatcher( SfxDispatcher* pParent ) SfxDispatcher::SfxDispatcher( SfxViewFrame *pViewFrame ) -/* [Beschreibung] +/* [Description] - Der Konstruktor der Klasse SfxDispatcher legt einen leeren Stack - von <SfxShell>-Pointern an. Er ist initial nicht gelockt und gilt als - geflusht. + The constructor of the SfxDispatcher class places a stack of empty + <SfxShell> pointers. It is not initially locked and is considered flushed. */ { @@ -409,42 +398,38 @@ SfxDispatcher::SfxDispatcher( SfxViewFrame *pViewFrame ) //==================================================================== SfxDispatcher::~SfxDispatcher() -/* [Beschreibung] +/* [Description] - Der Destruktor der Klasse SfxDispatcher darf nicht gerufen werden, - wenn die SfxDispatcher-Instanz aktiv ist. Es d"urfen sich allerdings - noch <SfxShell>-Pointer auf dem Stack befinden. + The destructor of the SfxDispatcher class should not be called when the + SfxDispatcher instance is active. It may, however, still be a <SfxShell> + pointer on the stack. */ { #ifdef DBG_UTIL ByteString sTemp( "Delete Dispatcher " ); sTemp += ByteString::CreateFromInt64( (sal_uIntPtr)this ); - DBG_TRACE( sTemp.GetBuffer() ); + OSL_TRACE( "%s", sTemp.GetBuffer() ); DBG_ASSERT( !pImp->bActive, "deleting active Dispatcher" ); #endif - // Damit in LeaveRegistrations kein Timer per Reschedule in PlugComm - // zuschlaegt + // So that no timer by Reschedule in PlugComm strikes the LeaveRegistrations pImp->aTimer.Stop(); pImp->xPoster->SetEventHdl( Link() ); - // die Stack-Varialblem in Call_Impl benachrichtigen + // Notify the stack varialbles in Call_Impl if ( pImp->pInCallAliveFlag ) *pImp->pInCallAliveFlag = sal_False; - // Bindings und App besorgen + // Get bindings and application SfxApplication *pSfxApp = SFX_APP(); SfxBindings* pBindings = GetBindings(); -// if (pImp->nEventId) -// pSfxApp->RemoveEventHdl(pImp->nEventId); - - // wenn noch nicht flushed, die Bindings wiederbeleben + // When not flushed, revive the bindings if ( pBindings && !pSfxApp->IsDowning() && !bFlushed ) pBindings->DLEAVEREGISTRATIONS(); - // ggf. bei den Bindings abmelden + // may unregister the bindings while ( pBindings ) { if ( pBindings->GetDispatcher_Impl() == this) @@ -458,27 +443,27 @@ SfxDispatcher::~SfxDispatcher() //==================================================================== void SfxDispatcher::Pop ( - SfxShell& rShell, /* Die vom Stack zu nehmende SfxShell-Instanz. */ + SfxShell& rShell, /* the stack to take the SfxShell instance. */ - sal_uInt16 nMode /* SFX_SHELL_POP_UNTIL - Es werden auch alle "uber 'rShell' liegenenden - SfxShell's vom Stack genommen. + sal_uInt16 nMode /* SFX_SHELL_POP_UNTIL + Also all 'rShell' of SfxShells are taken from the + stack. - SFX_SHELL_POP_DELETE - Alle tats"achlich vom Stack genommenen - SfxShells werden gel"oscht. + SFX_SHELL_POP_DELETE + All SfxShells actually taken from the stack + will be deleted. - SFX_SHELL_PUSH (InPlace use only) - Die Shell wird gepusht. */ + SFX_SHELL_PUSH (InPlace use only) + The Shell is pushed. */ ) -/* [Beschreibung] - - Mit dieser Methode wird eine oder mehrere <SfxShell> vom SfxDispatcher - gepoppt. Die SfxShell wird zun"achst zum poppen vermerkt und - es wird ein Timer aufgesetzt. Erst bei Ablauf des Timers wird - tats"achlich gepoppt (<SfxDispatcher::Flush()>) und die <SfxBindings> - werden invalidiert. W"ahrend der Timer l"auft gleichen sich - entgegengesetzte Push und Pop Befehle mit derselben SfxShell aus. +/* [Description] + + With this method, one or more <SfxShell> are poped from the SfxDispatcher. + The SfxShell is marked for popping and a timer is set up. Only when the + timer has reached the end, the pop is actually performed + ( <SfxDispatcher::Flush()> ) and the <SfxBindings> is invalidated. + While the timer is running the opposing push and pop commands on one + SfxShell cancel each other out. */ { @@ -505,10 +490,10 @@ void SfxDispatcher::Pop DbgTrace( aMsg.GetBuffer() ); #endif - // gleiche Shell wie on-Top des ToDo-Stacks? + // same shell as on top of the to-do stack? if ( pImp->aToDoStack.Count() && pImp->aToDoStack.Top().pCluster == &rShell ) { - // inverse Actions heben sich auf + // cancel inverse actions if ( pImp->aToDoStack.Top().bPush != bPush ) pImp->aToDoStack.Pop(); else @@ -519,15 +504,15 @@ void SfxDispatcher::Pop } else { - // ::com::sun::star::chaos::Action merken + // Remember ::com::sun::star::chaos::Action pImp->aToDoStack.Push( SfxToDo_Impl(bPush, bDelete, bUntil, rShell) ); if ( bFlushed ) { - DBG_TRACE("Unflushed dispatcher!"); + OSL_TRACE("Unflushed dispatcher!"); bFlushed = sal_False; pImp->bUpdated = sal_False; - // Bindings schlafen legen + // Put bindings to sleep SfxBindings* pBindings = GetBindings(); if ( pBindings ) pBindings->DENTERREGISTRATIONS(); @@ -537,29 +522,28 @@ void SfxDispatcher::Pop if ( !pSfxApp->IsDowning() && pImp->aToDoStack.Count() ) { //! if (SFX_APP()->AnyInput(INPUT_KEYBOARD | INPUT_MOUSE) ) - //! AnyInput haut nicht hin; hier muss noch ein Kriterium gefunden - //! werden. Solange wieder immer mit Timer. - + //! AnyInput does not work, here a criterion has yet to found. + //! As long as time after time with a timer. if (sal_True) { - // Kein sofortiges Update gewuenscht + // No immediate update is requested pImp->aTimer.SetTimeout(SFX_FLUSH_TIMEOUT); pImp->aTimer.SetTimeoutHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) ); pImp->aTimer.Start(); } else { - // Schnellstmoegliches Update (sollte Normalfall sein) + // Upgrade as quickly as possible(should be the normal case) pImp->aTimer.Stop(); GetpApp()->PostUserEvent(pImp->nEventId, (void*)0); } } else { - // doch nichts zu tun + // but to do nothing pImp->aTimer.Stop(); - // ggf. Bindings wieder aufwecken + // Bindings may wake up again if ( !pImp->aToDoStack.Count() ) { SfxBindings* pBindings = GetBindings(); @@ -573,13 +557,13 @@ void SfxDispatcher::Pop IMPL_LINK_INLINE_START( SfxDispatcher, EventHdl_Impl, void *, pvoid ) -/* [Beschreibung] +/* [Description] - Dieser Handler wird nach <SfxDispatcher::Invalidate()> oder Bewegungen - auf dem Stack (<SfxDispatcher::Push()> und <SfxDispatcher::Pop()) gerufen. + This handler is called after <SfxDispatcher::Invalidate()> or after + changes on the stack (<SfxDispatcher::Push()> and <SfxDispatcher::Pop()) - Er flusht den Stack, falls er dirty ist, f"uhrt also die ausstehenden - Push und Pop Befehle tats"achlich aus. + It flushes the Stack, if it is dirty, thus it actually excecutes the + pending Push and Pop commands. */ { @@ -598,14 +582,14 @@ IMPL_LINK_INLINE_END( SfxDispatcher, EventHdl_Impl, void *, pvoid ) //-------------------------------------------------------------------- sal_Bool SfxDispatcher::CheckVirtualStack( const SfxShell& rShell, sal_Bool bDeep ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann gepr"uft werden, ob sich die <SfxShell> rShell - auf dem Stack befindet, wenn er geflusht w"are. Dabei wird der - SfxDispatcher jedoch nicht tats"achlich geflusht. + With this method it can be tested whether the <SfxShell> rShell is on the + stack, when it was flushed. This way the SfxDispatcher is not actually + flushed. - Diese Methode ist u.a. dazu gedacht, Assertions zu erm"oglichen, ohne - als Seiteneffekt den SfxDispathcer flushen zu m"ussen. + This method is intended among other things to make assertions possible + without the side effect of having to flush the SfxDispathcer. */ { @@ -642,21 +626,19 @@ sal_Bool SfxDispatcher::CheckVirtualStack( const SfxShell& rShell, sal_Bool bDee //-------------------------------------------------------------------- sal_uInt16 SfxDispatcher::GetShellLevel( const SfxShell& rShell ) -/* [Beschreibung] - - Ermittelt die Position einer SfxShell im Stack des Dispatchers. - Dazu wird dieser ggf. zuvor geflusht. +/* [Description] + Determines the position of a given SfxShell in the stack of the dispatcher. + If possible this is flushed before. - [Rueckgabewert] + [Return value] - sal_uInt16 == USRT_MAX - Die SfxShell befindet sich nicht auf - diesem SfxDispatcher. + sal_uInt16 == USRT_MAX + The SfxShell is not on this SfxDispatcher. < USHRT_MAX - Position der SfxShell auf dem Dispatcher - von oben mit 0 beginnend gez"ahlt. + Position of the SfxShell on the Dispatcher + from the top count stating with 0. */ { @@ -681,14 +663,14 @@ sal_uInt16 SfxDispatcher::GetShellLevel( const SfxShell& rShell ) //-------------------------------------------------------------------- SfxShell *SfxDispatcher::GetShell(sal_uInt16 nIdx) const -/* [Beschreibung] +/* [Description] - Liefert einen Pointer auf die <SfxShell>, welche sich an der Position - nIdx (von oben, letzt-gepushte liegt bei 0) auf dem Stack befindet. + Returns a pointer to the <SfxShell> which is at the position nIdx + (from the top, last pushed is 0) on the stack. - Dabei wird der SfxDispatcher nicht geflusht. + Thus the SfxDispatcher is not flushed. - Ist der Stack nicht tief genug, wird ein 0-Pointer zur"uckgegeben. + Is the stack not deep enough a NULL-Pointer is returned. */ { @@ -705,15 +687,15 @@ SfxShell *SfxDispatcher::GetShell(sal_uInt16 nIdx) const //-------------------------------------------------------------------- SfxBindings* SfxDispatcher::GetBindings() const -/* [Beschreibung] +/* [Description] - Diese Methode liefert einen Pointer auf die <SfxBindings> Instanz - zur"uck, an die der SfxDispatcher gerade gebunden ist. Ein SfxDispatcher - ist nur dann an SfxBindings gebunden, wenn er <UI-aktiv> ist. Ist - er nicht UI-aktiv, wird ein 0-Pointer zur"uckgegeben. + This method returns a pointer to the <SfxBinding> Instance on which the + SfxDispatcher is curretly bound. A SfxDispatcher is only bound to + the SfxBindings when it is <UI-aktiv>. If it is not UI-active, + a NULL-pointer is returned. - Der zur"uckgegebene Pointer ist nur im <unmittelbaren Kontext> des - Methodenaufrufs g"ultig. + The returned pointer is only valid in the immediate context of the method + call. */ { @@ -726,11 +708,11 @@ SfxBindings* SfxDispatcher::GetBindings() const //-------------------------------------------------------------------- SfxViewFrame* SfxDispatcher::GetFrame() const -/* [Beschreibung] +/* [Description] - Liefert einen Pointer auf die <SfxViewFrame> Instanz, der dieser - SfxDispatcher geh"ort. Falls es sich um den Applikations-Dispatcher - handelt, wird ein 0-Pointer zur"uckgegeben. + Returns a pointer to the <SfxViewFrame> instance, which belongs to + this SfxDispatcher. If it is about the application dispatcher, + a NULL-pointer is returned. */ { @@ -741,18 +723,18 @@ SfxViewFrame* SfxDispatcher::GetFrame() const //-------------------------------------------------------------------- void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) -/* [Beschreibung] +/* [Description] - Diese Methode steuert das Aktivieren eines Dispatchers. + This method controls the activation of a dispatcher. - Da der Applikations-Dispatcher immer aktiv ist, entweder als - Unterdispatcher des <SfxViewFrame>-Dispatchers oder selbst, wird - er nie als ganzes Aktiviert, sondern nur seine einzelnen <SfxShell>s - bei <SfxDispatcher::Push(SfxShell&)>. + Since the application dispatcher is always active, either as a sub + dispatcher of the <SfxViewFrame> dispatcher or as itself, it is never + activated as a whole, instead only its individual <SfxShell>s at + <SfxDispatcher::Push(SfxShell&)>. - Beim Aktivieren eines SfxDispatchers wird an allen auf seinem - Stack befindlichen SfxShells, beginnend mit der untersten, der Handler - <SfxShell::Activate(sal_Bool)> gerufen. + When activating a SfxDispatcher all of the SfxShells located on its stack + are called with the handler <SfxShell::Activate(sal_Bool)>, starting with + the lowest. */ { @@ -763,8 +745,8 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) #ifdef DBG_UTIL ByteString sTemp("Activate Dispatcher "); sTemp += ByteString::CreateFromInt64( (sal_uIntPtr) this ); - DBG_TRACE(sTemp.GetBuffer()); - DBG_ASSERT( !pImp->bActive, "Activate-Fehler" ); + OSL_TRACE( "%s", sTemp.GetBuffer()); + DBG_ASSERT( !pImp->bActive, "Activation error" ); #endif pImp->bActive = sal_True; pImp->bUpdated = sal_False; @@ -780,7 +762,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) #ifdef DBG_UTIL ByteString sTemp("Non-MDI-Activate Dispatcher"); sTemp += ByteString::CreateFromInt64( (sal_uIntPtr) this ); - DBG_TRACE( sTemp.GetBuffer() ); + OSL_TRACE( "%s", sTemp.GetBuffer() ); #endif } @@ -792,7 +774,6 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( bMDI && pImp->pFrame ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -807,14 +788,14 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) { if (sal_True) { - // Kein sofortiges Update gewuenscht + // No immediate update is requested pImp->aTimer.SetTimeout(SFX_FLUSH_TIMEOUT); pImp->aTimer.SetTimeoutHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) ); pImp->aTimer.Start(); } else { - // Schnellstmoegliches Update (sollte Normalfall sein) + // Upgrade as quickly as possible(should be the normal case) pImp->aTimer.Stop(); GetpApp()->PostUserEvent(pImp->nEventId, (void*)0); } @@ -830,18 +811,18 @@ void SfxDispatcher::DoParentActivate_Impl() //-------------------------------------------------------------------- void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) -/* [Beschreibung] +/* [Description] - Diese Methode steuert das Deaktivieren eines Dispatchers. + This method controls the deactivation of a dispatcher. - Da der Applikations-Dispatcher immer aktiv ist, entweder als - Unterdispatcher des <SfxViewFrame>-Dispatchers oder selbst, wird - er nie als ganzes Deaktiviert, sondern nur seine einzelnen <SfxShell>s - bei <SfxDispatcher::Pop(SfxShell&)>. + Since the application dispatcher is always active, either as a sub + dispatcher of the <SfxViewFrame> dispatcher or as itself, it is never + deactivated as a whole, instead only its individual <SfxShell>s at + <SfxDispatcher::Pop(SfxShell&)>. - Beim Deaktivieren eines SfxDispatchers wird an allen auf seinem - Stack befindlichen SfxShells, beginnend mit der obersten, der Handler - <SfxShell::Deactivate(sal_Bool)> gerufen. + When deactivating a SfxDispatcher all of the SfxShells located on its stack + are called with the handler <SfxShell::Deactivate(sal_Bool)>, starting with + the lowest. */ { @@ -852,8 +833,8 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( bMDI ) { - DBG_TRACE(ByteString("Deactivate Dispatcher ").Append(ByteString::CreateFromInt64( (sal_uIntPtr) this )).GetBuffer()); - DBG_ASSERT( pImp->bActive, "Deactivate-Fehler" ); + OSL_TRACE(ByteString("Deactivate Dispatcher ").Append(ByteString::CreateFromInt64( (sal_uIntPtr) this )).GetBuffer()); + DBG_ASSERT( pImp->bActive, "Deactivate error" ); pImp->bActive = sal_False; if ( pImp->pFrame && !(pImp->pFrame->GetObjectShell()->IsInPlaceActive() ) ) @@ -873,7 +854,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) } } else { - DBG_TRACE( ByteString ("Non-MDI-DeActivate Dispatcher").Append(ByteString::CreateFromInt64( (sal_uIntPtr) this )).GetBuffer() ); + OSL_TRACE( ByteString ("Non-MDI-DeActivate Dispatcher").Append(ByteString::CreateFromInt64( (sal_uIntPtr) this )).GetBuffer() ); } if ( IsAppDispatcher() && !pSfxApp->IsDowning() ) @@ -897,7 +878,6 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( bHidePopups ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -920,30 +900,28 @@ void SfxDispatcher::DoParentDeactivate_Impl() //-------------------------------------------------------------------- int SfxDispatcher::GetShellAndSlot_Impl ( - sal_uInt16 nSlot, // die zu suchende Slot-Id - SfxShell** ppShell, // die SfxShell, welche nSlot z.Zt. bedient - const SfxSlot** ppSlot, // der SfxSlot, welcher nSlot z.Zt. bedient - sal_Bool bOwnShellsOnly, - sal_Bool bModal, // trotz ModalMode + sal_uInt16 nSlot, // the searchable Slot-Id + SfxShell** ppShell, // the SfxShell, which are currently handled + // the nSlot + const SfxSlot** ppSlot, // the SfxSlot, which are currently handled + // the nSlot + sal_Bool bOwnShellsOnly, + sal_Bool bModal, // ModalMode sal_Bool bRealSlot ) -/* [Beschreibung] +/* [Description] - Diese Methode sucht im SfxDispatcher nach der <SfxShell>, von der - die Slot-Id nSlot zur Zeit bedient wird. Dazu wird der Dispatcher - zuvor geflusht. + This method searches in SfxDispatcher after <SfxShell> , from the Slot Id + nSlot currently being handled. For this, the dispatcher is first flushed. + [Return value] - [R"uckgabewert] + int sal_True + The SfxShell was found, ppShell and ppSlot are valid. - int sal_True - Die SfxShell wurde gefunden, ppShell und ppSlot - sind g"ultig. - - sal_True - Die SfxShell wurde nicht gefunden, ppShell und ppSlot - sind ung"ultig. + sal_False + The SfxShell was not found, ppShell and ppSlot are invalid. */ { @@ -964,55 +942,26 @@ int SfxDispatcher::GetShellAndSlot_Impl if ( bRealSlot && ((0 == *ppSlot) || (0 == (*ppSlot)->GetExecFnc()) )) return sal_False; -#ifdef DBG_UTILx - ByteString aMsg( nSlot ); - aMsg += " found in "; - aMsg += (*ppShell)->GetInterface()->GetClassName(); - DbgTrace( aMsg.GetBuffer() ); -#endif - return sal_True; } -#ifdef DBG_UTILx - ByteString aMsg( nSlot ); - aMsg += " not found"; - DbgTrace( aMsg.GetBuffer() ); -#endif - return sal_False; } -/* -struct Executer : public SfxHint -{ - SfxRequest *pRequest; - const SfxSlot* pSlot; - sal_uInt16 nLevel; - - Executer( SfxRequest* pReq, const SfxSlot* p, sal_uInt16 n ) - : pRequest( pReq ) - , pSlot(p) - , nLevel(n) - {} - ~Executer() - {delete pRequest;} -}; -*/ - //-------------------------------------------------------------------- void SfxDispatcher::_Execute ( - SfxShell& rShell, // zu rufende <SfxShell> - const SfxSlot& rSlot, // zu rufender <SfxSlot> - SfxRequest& rReq, // auszuf"uhrende Funktion (Id und optional Parameter) - SfxCallMode eCallMode // synchron, asynchron oder wie beim Slot angegeben + SfxShell& rShell, // to the calling <SfxShell> + const SfxSlot& rSlot, // to the calling <SfxSlot> + SfxRequest& rReq, // function to be performed + // (Id and optional parameters) + SfxCallMode eCallMode // Synchronously, asynchronously or as shown in + // the slot ) -/* [Beschreibung] +/* [Description] - Diese Methode f"uhrt einen Request "uber einen gecachten <Slot-Server> - aus. + This method performs a request for a cached <Slot-Server>. */ { @@ -1038,7 +987,6 @@ void SfxDispatcher::_Execute if ( eCallMode & SFX_CALLMODE_RECORD ) rReq.AllowRecording( sal_True ); pDispat->pImp->xPoster->Post(new SfxRequest(rReq)); -// pDispat->pImp->xPoster->Post(new Executer(new SfxRequest(rReq), &rSlot, n )); return; } } @@ -1053,14 +1001,14 @@ void SfxDispatcher::_Execute //-------------------------------------------------------------------- void MappedPut_Impl( SfxAllItemSet &rSet, const SfxPoolItem &rItem ) -/* [Beschreibung] +/* [Description] - Hilfsfunktion zum putten von rItem unter der im Pool des Item-Sets - rSet geltenden Which-Id. + Helper function to put from rItem below the Which-ID in the pool of the + Item Sets rSet. */ { - // mit ggf. gemappter Which-Id putten + // Put with mapped Which-Id if possible const SfxItemPool *pPool = rSet.GetPool(); sal_uInt16 nWhich = rItem.Which(); #ifdef TF_POOLABLE @@ -1084,7 +1032,7 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, SfxPoolItem **pArgs if ( !nMode ) nMode = pImp->nStandardMode; - // via Bindings/Interceptor? (dann ist der Returnwert nicht exakt) + // through Bindings/Interceptor? (then the return value is not exact) sal_Bool bViaBindings = SFX_USE_BINDINGS == ( nMode & SFX_USE_BINDINGS ); nMode &= ~sal_uInt16(SFX_USE_BINDINGS); if ( bViaBindings && GetBindings() ) @@ -1092,7 +1040,7 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, SfxPoolItem **pArgs ? EXECUTE_POSSIBLE : EXECUTE_NO; - // sonst via Dispatcher + // otherwise through the Dispatcher if ( IsLocked(nSlot) ) return 0; SfxShell *pShell = 0; @@ -1101,7 +1049,7 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, SfxPoolItem **pArgs const SfxSlot *pSlot = 0; if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, sal_False, sal_False ) ) { - // Ausf"uhrbarkeit vorher testen + // Feasibility test before if ( pSlot->IsMode( SFX_SLOT_FASTCALL ) || pShell->CanExecuteSlot_Impl( *pSlot ) ) nRet = EXECUTE_POSSIBLE; @@ -1112,7 +1060,6 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, SfxPoolItem **pArgs eCall = SFX_CALLMODE_ASYNCHRON; else if ( pSlot->GetMode() & SFX_SLOT_ASYNCHRON ) eCall = SFX_CALLMODE_ASYNCHRON; - sal_Bool bDone = sal_False; if ( pArgs && *pArgs ) { SfxAllItemSet aSet( pShell->GetPool() ); @@ -1120,13 +1067,11 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, SfxPoolItem **pArgs MappedPut_Impl( aSet, **pArg ); SfxRequest aReq( nSlot, eCall, aSet ); _Execute( *pShell, *pSlot, aReq, eCall ); - bDone = aReq.IsDone(); } else { SfxRequest aReq( nSlot, eCall, pShell->GetPool() ); _Execute( *pShell, *pSlot, aReq, eCall ); - bDone = aReq.IsDone(); } } @@ -1139,17 +1084,7 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, const SfxItemSet& r if ( !nMode ) nMode = pImp->nStandardMode; -/* - // at the moment not implemented - // via Bindings/Interceptor? (dann ist der Returnwert nicht exakt) - sal_Bool bViaBindings = SFX_USE_BINDINGS == ( nMode & SFX_USE_BINDINGS ); - nMode &= ~sal_uInt16(SFX_USE_BINDINGS); - if ( bViaBindings && GetBindings() ) - return GetBindings()->Execute( nSlot, rArgs, nMode ) - ? EXECUTE_POSSIBLE - : EXECUTE_NO; -*/ - // sonst via Dispatcher + // otherwise through the Dispatcher if ( IsLocked(nSlot) ) return 0; SfxShell *pShell = 0; @@ -1158,7 +1093,7 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, const SfxItemSet& r const SfxSlot *pSlot = 0; if ( GetShellAndSlot_Impl( nSlot, &pShell, &pSlot, sal_False, sal_False ) ) { - // Ausf"uhrbarkeit vorher testen + // Feasibility test before if ( pSlot->IsMode( SFX_SLOT_FASTCALL ) || pShell->CanExecuteSlot_Impl( *pSlot ) ) nRet = EXECUTE_POSSIBLE; @@ -1169,10 +1104,8 @@ sal_uInt16 SfxDispatcher::ExecuteFunction( sal_uInt16 nSlot, const SfxItemSet& r eCall = SFX_CALLMODE_ASYNCHRON; else if ( pSlot->GetMode() & SFX_SLOT_ASYNCHRON ) eCall = SFX_CALLMODE_ASYNCHRON; - sal_Bool bDone = sal_False; - SfxRequest aReq( nSlot, eCall, rArgs ); - _Execute( *pShell, *pSlot, aReq, eCall ); - bDone = aReq.IsDone(); + SfxRequest aReq( nSlot, eCall, rArgs ); + _Execute( *pShell, *pSlot, aReq, eCall ); } return nRet; @@ -1188,7 +1121,7 @@ sal_uInt16 SfxDispatcher::GetSlotId( const String& rCommand ) const SfxSlot* SfxDispatcher::GetSlot( const String& rCommand ) { - // Anzahl der Shells auf den verkettenten Dispatchern z"ahlen + // Count the number of Shells on the linked Dispatcher Flush(); sal_uInt16 nTotCount = pImp->aStack.Count(); if ( pImp->pParent ) @@ -1320,27 +1253,26 @@ const SfxPoolItem* SfxDispatcher::Execute( //-------------------------------------------------------------------- const SfxPoolItem* SfxDispatcher::Execute ( - sal_uInt16 nSlot, // die Id der auszufuehrenden Funktion - SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON oder ..._SLOT - const SfxPoolItem **pArgs, // 0-terminiertes C-Array von Parametern + sal_uInt16 nSlot, // the Id of the executing function + SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON + // or ..._SLOT + const SfxPoolItem **pArgs, // Zero teminated C-Array of Parameters sal_uInt16 nModi, - const SfxPoolItem **pInternalArgs // 0-terminiertes C-Array von Parametern + const SfxPoolItem **pInternalArgs // Zero terminated C-Array of Parameters ) -/* [Beschreibung] +/* [Description] - Methode zum Ausf"uhren eines <SfxSlot>s "uber die Slot-Id. + Method to excecute a <SfxSlot>s over the Slot-Id. + [Return value] - [R"uckgabewert] + const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run + though the Message-Loop, which contains the return + value. - const SfxPoolItem* Pointer auf ein bis zum n"achsten Durchlauf - der Message-Loop g"ultiges SfxPoolItem, - welches den R"uckgabewert enth"alt. - - Oder ein 0-Pointer, wenn die Funktion nicht - ausgef"uhrt wurde (z.B. Abbruch durch den - Benutzer). + Or a NULL-Pointer, when the function was not + executed (for example canceled by the user). */ { @@ -1380,25 +1312,23 @@ const SfxPoolItem* SfxDispatcher::Execute //-------------------------------------------------------------------- const SfxPoolItem* SfxDispatcher::Execute ( - sal_uInt16 nSlot, // die Id der auszufuehrenden Funktion - SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON oder ..._SLOT - const SfxItemSet &rArgs // <SfxItemSet> mit Parametern + sal_uInt16 nSlot, // the Id of the executing function + SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON or ..._SLOT + const SfxItemSet &rArgs // <SfxItemSet> with the parameters ) -/* [Beschreibung] - - Methode zum Ausf"uhren eines <SfxSlot>s "uber die Slot-Id. +/* [Description] + Method to excecute a <SfxSlot>s over the Slot-Id. - [R"uckgabewert] + [Return value] - const SfxPoolItem* Pointer auf ein bis zum n"achsten Durchlauf - der Message-Loop g"ultiges SfxPoolItem, - welches den R"uckgabewert enth"alt. + const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run + though the Message-Loop, which contains the return + value. - Oder ein 0-Pointer, wenn die Funktion nicht - ausgef"uhrt wurde (z.B. Abbruch durch den - Benutzer). + Or a NULL-Pointer, when the function was not + executed (for example canceled by the user). */ { @@ -1439,26 +1369,25 @@ const SfxPoolItem* SfxDispatcher::Execute //-------------------------------------------------------------------- const SfxPoolItem* SfxDispatcher::_Execute ( - sal_uInt16 nSlot, // die Id der auszufuehrenden Funktion - SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON oder ..._SLOT - va_list pVarArgs, // Parameterliste ab 2. Parameter - const SfxPoolItem* pArg1 // erster Parameter + sal_uInt16 nSlot, // the Id of the executing function + SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON or + //..._SLOT + va_list pVarArgs, // Parameter list from the 2nd parameter + const SfxPoolItem* pArg1 // First parameter ) -/* [Beschreibung] +/* [Description] - Methode zum Ausf"uhren eines <SfxSlot>s "uber die Slot-Id. + Method to excecute a <SfxSlot>s over the Slot-Id. + [Return value] - [R"uckgabewert] + const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run + though the Message-Loop, which contains the return + value. - const SfxPoolItem* Pointer auf ein bis zum n"achsten Durchlauf - der Message-Loop g"ultiges SfxPoolItem, - welches den R"uckgabewert enth"alt. - - Oder ein 0-Pointer, wenn die Funktion nicht - ausgef"uhrt wurde (z.B. Abbruch durch den - Benutzer). + Or a NULL-Pointer, when the function was not + executed (for example canceled by the user). */ { @@ -1487,35 +1416,32 @@ const SfxPoolItem* SfxDispatcher::_Execute //-------------------------------------------------------------------- const SfxPoolItem* SfxDispatcher::Execute ( - sal_uInt16 nSlot, // die Id der auszufuehrenden Funktion - SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON oder ..._SLOT - const SfxPoolItem* pArg1, // erster Parameter - ... // 0-terminiertes Liste Parametern + sal_uInt16 nSlot, // the Id of the executing function + SfxCallMode eCall, // SFX_CALLMODE_SYNCRHON, ..._ASYNCHRON or + // ..._SLOT + const SfxPoolItem* pArg1, // First parameter + ... // Zero terminated list of parameters ) -/* [Beschreibung] - - Methode zum Ausf"uhren eines <SfxSlot>s "uber die Slot-Id. +/* [Description] + Method to excecute a <SfxSlot>s over the Slot-Id. - [Anmerkung] + [Note] - Die Parameter werden kopiert, k"onnen daher als Adresse von - Stack-Objekten "ubergeben werden. + The parameters are copied, can therefore be passed on as the address + of stack objects. + [Return value] - [R"uckgabewert] + const SfxPoolItem* Pointer to the SfxPoolItem valid to the next run + though the Message-Loop, which contains the return + value. - const SfxPoolItem* Pointer auf ein bis zum n"achsten Durchlauf - der Message-Loop g"ultiges SfxPoolItem, - welches den R"uckgabewert enth"alt. + Or a NULL-Pointer, when the function was not + executed (for example canceled by the user). - Oder ein 0-Pointer, wenn die Funktion nicht - ausgef"uhrt wurde (z.B. Abbruch durch den - Benutzer). - - - [Beispiel] + [Example] pDispatcher->Execute( SID_OPENDOCUMENT, SFX_CALLMODE_SYNCHRON, &SfxStringItem( SID_FILE_NAME, "\\tmp\\temp.sdd" ), @@ -1554,9 +1480,9 @@ const SfxPoolItem* SfxDispatcher::Execute IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq ) -/* [Beschreibung] +/* [Description] - Hilfsmethode zum Empfangen der asynchron auszuf"uhrenden <SfxRequest>s. + Helper method to receive the asynchronously executed <SfxRequest>s. */ { @@ -1564,8 +1490,7 @@ IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq ) DBG_ASSERT( !pImp->bFlushing, "recursive call to dispatcher" ); SFX_STACK(SfxDispatcher::PostMsgHandler); - // ist auch der Pool noch nicht gestorben? -// SfxRequest* pReq = pExec->pRequest; + // Has also the Pool not yet died? if ( !pReq->IsCancelled() ) { if ( !IsLocked(pReq->GetSlot()) ) @@ -1573,8 +1498,6 @@ IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq ) Flush(); SfxSlotServer aSvr; if ( _FindServer(pReq->GetSlot(), aSvr, HACK(x) sal_True ) ) -// SfxShell *pShell = GetShell(pExec->nLevel); -// if ( pShell && pShell->GetInterface()->GetSlot( pExec->pSlot->GetSlotId() ) ) { const SfxSlot *pSlot = aSvr.GetSlot(); SfxShell *pSh = GetShell(aSvr.GetShellLevel()); @@ -1582,27 +1505,21 @@ IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq ) DBG( SfxApplication *pSfxApp = SFX_APP() ); DBG( pSfxApp->EnterAsynchronCall_Impl() ); - // Wenn pSlot ein "Pseudoslot" f"ur Macros oder Verben ist, kann - // er im Call_Impl zerst"ort werden, also nicht mehr benutzen! + // When the pSlot is a "Pseudoslot" for macros or Verbs, it can + // be destroyed in the Call_Impl, thus do not use it anymore! pReq->SetSynchronCall( sal_False ); - Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! woher bRecord? -// Call_Impl( *pShell, *pExec->pSlot, *pReq, sal_True ); //! woher bRecord? + Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! why bRecord? DBG( pSfxApp->LeaveAsynchronCall_Impl() ); } - -// delete pExec; } else { -// pImp->xPoster->Post(pExec); if ( pImp->bLocked ) pImp->aReqArr.Insert( new SfxRequest(*pReq), pImp->aReqArr.Count() ); else pImp->xPoster->Post(new SfxRequest(*pReq)); } } -// else -// delete pExec; delete pReq; return 0; @@ -1789,7 +1706,7 @@ void SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, sal_Bo if ( bReadOnlyShell && !( nPos & SFX_VISIBILITY_READONLYDOC ) ) continue; - // check wether toolbar needs activation of a special feature + // check weather toolbar needs activation of a special feature sal_uInt32 nFeature = pIFace->GetObjectBarFeature(nNo); if ( nFeature && !pShell->HasUIFeature( nFeature ) ) continue; @@ -1914,9 +1831,9 @@ void SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, sal_Bo //-------------------------------------------------------------------- void SfxDispatcher::FlushImpl() -/* [Beschreibung] +/* [Description] - Hilfsmethode zum Ausf"uhren der ausstehenden Push- und Pop-Befehle. + Helper method to execute the outstanding push and pop commands. */ { @@ -1924,7 +1841,7 @@ void SfxDispatcher::FlushImpl() DBG_MEMTEST(); SFX_STACK(SfxDispatcher::FlushImpl); - DBG_TRACE("Flushing dispatcher!"); + OSL_TRACE("Flushing dispatcher!"); #ifdef DBG_UTIL ByteString aMsg( "SfxDispatcher(" ); @@ -1937,26 +1854,17 @@ void SfxDispatcher::FlushImpl() if ( pImp->pParent ) pImp->pParent->Flush(); -// if ( pImp->bQuiet ) -// return; - pImp->bFlushing = !pImp->bFlushing; if ( !pImp->bFlushing ) { pImp->bFlushing = sal_True; DBG_PROFSTOP(SfxDispatcherFlush); -//! -#ifdef DBG_UTIL_MESSEHACK_AUSKOMMENT - DBG_ERROR( "reentering SfxDispatcher::Flush()" ); - aMsg += " reentering, aborted"; - DbgTrace( aMsg.GetBuffer() ); -#endif return; } SfxApplication *pSfxApp = SFX_APP(); - // in der 1. Runde den echten Stack 'um'bauen + // Re-build the true stack in the first round SfxToDoStack_Impl aToDoCopy; sal_Bool bModify = sal_False; short nToDo; @@ -1967,20 +1875,20 @@ void SfxDispatcher::FlushImpl() SfxToDo_Impl aToDo( pImp->aToDoStack.Top(nToDo) ); if ( aToDo.bPush ) { - // tats"aechlich pushen + // Actually push DBG_ASSERT( !pImp->aStack.Contains( aToDo.pCluster ), "pushed SfxShell already on stack" ); pImp->aStack.Push( aToDo.pCluster ); aToDo.pCluster->SetDisableFlags( pImp->nDisableFlags ); - // die bewegte Shell merken + // Mark the moved shell aToDoCopy.Push( aToDo ); } else { - // tats"aechlich poppen + // Actually pop SfxShell* pPopped = 0; - bool bFound = sal_False; + bool bFound = false; do { DBG_ASSERT( pImp->aStack.Count(), "popping from empty stack" ); @@ -1988,7 +1896,7 @@ void SfxDispatcher::FlushImpl() pPopped->SetDisableFlags( 0 ); bFound = pPopped == aToDo.pCluster; - // die bewegte Shell merken + // Mark the moved Shell aToDoCopy.Push( SfxToDo_Impl( sal_False, aToDo.bDelete, sal_False, *pPopped) ); } while ( aToDo.bUntil && !bFound ); @@ -1999,7 +1907,7 @@ void SfxDispatcher::FlushImpl() pImp->aToDoStack.Clear(); } - // ggf. Bindings invalidieren + // Invalidate bindings, if possible if ( !pSfxApp->IsDowning() ) { if ( bModify ) @@ -2012,11 +1920,11 @@ void SfxDispatcher::FlushImpl() } pImp->bFlushing = sal_False; - pImp->bUpdated = sal_False; // nicht nur bei bModify, falls Doc/Template-Config + pImp->bUpdated = sal_False; // not only when bModify, if Doc/Template-Config bFlushed = sal_True; - DBG_TRACE("Successfully flushed dispatcher!"); + OSL_TRACE("Successfully flushed dispatcher!"); - // in der 2. Runde die Shells aktivieren und ggf. l"oschen + // Activate the Shells and possible delete them in the 2nd round for ( nToDo = aToDoCopy.Count()-1; nToDo >= 0; --nToDo ) { SfxToDo_Impl aToDo( aToDoCopy.Top(nToDo) ); @@ -2038,9 +1946,10 @@ void SfxDispatcher::FlushImpl() if( bAwakeBindings ) aToDoCopy.Clear(); - // Wenn bei Activate/Deactivate/Delete weitere Stackbewegungen erfolgt sind : + // If more changes have occured on the stach when + // Activate/Deactivate/Delete: if (!bFlushed) - // falls jemand Push/Pop gerufen hat, wurde auch EnterReg gerufen! + // If Push/Pop hs been called by someone, theb also EnterReg was called! FlushImpl(); if( bAwakeBindings && GetBindings() ) @@ -2060,52 +1969,51 @@ void SfxDispatcher::FlushImpl() void SfxDispatcher::SetSlotFilter ( HACK(hier muss mal ein enum rein) - sal_Bool bEnable, /* sal_True: - nur angegebene Slots enablen, - alle anderen disablen + sal_Bool bEnable, /* sal_True: + only enable specified slots, + disable all other sal_False: - die angegebenen Slots disablen, - alle anderen zun"achst enablen - */ - sal_uInt16 nCount, // Anzahl der SIDs im folgenden Array - const sal_uInt16* pSIDs // sortiertes Array von 'nCount' SIDs + disable specified slots, + first enable all other + */ + sal_uInt16 nCount, // Number of SIDs in the following Array + const sal_uInt16* pSIDs // sorted Array of 'nCount' SIDs ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode wird ein Filter gesetzt, mit dem gezielt Slots - enabled bzw. disabled werden k"onnen. Das "ubergebene Array mu\s - bis zum Dtor bzw. n"achsten <SetSlotFilter()> erhalten bleiben, es - wird nicht vom Dispatcher gel"oscht, es kann daher static sein. + With this method a filter set, the target slots can be enabled or disabled. + The passed array must be retained until the destructor or the next + <SetSlotFilter()>, it is not deleted from the dispatcher, so it can thus be + static. - In ReadOnly-Dokumenten kann man mit 'bEnable==2' quasi das ReadOnlyDoc - Flag von Slots "ubersteuern, dieser werden also wieder gefunden. Auf - andere Slots hat das dann keine Auswirkung. + In read-only documents the quasi ReadOnlyDoc Flag of slots can be + overturned by the use of 'bEnable == 2', so this will be displayed again. + On the other slots it has no effect. + [Example] - [Beispiel] + Targeted disabling of Slots 1, 2 and 3: - gezieltes disablen der Slots 1, 2 und 3: - - static sal_uInt16 __READONLY_DATA pSIDs[] = { 1, 2, 3 }; + static sal_uInt16 const pSIDs[] = { 1, 2, 3 }; pDisp->SetSlotFilter( sal_False, sizeof(pSIDs)/sizeof(sal_uInt16), pSIDs ); - nur die Slots 5, 6 und 7 zulassen: + only permit Slots 5, 6 and 7: - static sal_uInt16 __READONLY_DATA pSIDs[] = { 5, 6, 7 }; + static sal_uInt16 const pSIDs[] = { 5, 6, 7 }; pDisp->SetSlotFilter( sal_True, sizeof(pSIDs)/sizeof(sal_uInt16), pSIDs ); - Filter ausschalten: + Turn-off Filter: pDisp->SetSlotFilter(); */ { #ifdef DBG_UTIL - // Array "uberpr"ufen + // Check Array for ( sal_uInt16 n = 1; n < nCount; ++n ) - DBG_ASSERT( pSIDs[n] > pSIDs[n-1], "SetSlotFilter: SIDs not sortet" ); + DBG_ASSERT( pSIDs[n] > pSIDs[n-1], "SetSlotFilter: SIDs not sorted" ); #endif if ( pImp->pFilterSIDs ) @@ -2120,15 +2028,11 @@ void SfxDispatcher::SetSlotFilter //-------------------------------------------------------------------- EXTERN_C -#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC )) -int _stdcall -#else #ifdef WNT int _cdecl #else int #endif -#endif SfxCompareSIDs_Impl( const void* pSmaller, const void* pBigger ) { @@ -2139,59 +2043,59 @@ SfxCompareSIDs_Impl( const void* pSmaller, const void* pBigger ) //-------------------------------------------------------------------- sal_Bool SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const -/* [Beschreibung] +/* [Description] - Sucht 'nSID' in dem mit <SetSlotFilter()> gesetzten Filter und - liefert sal_True, falls die SID erlaubt ist, bzw. sal_False, falls sie - durch den Filter disabled ist. + Searches for 'nSID' in the Filter set by <SetSlotFilter()> and + returns sal_True, if the SIDis allowed, or sal_False, if it is + disabled by the Filter. - [R"uckgabewert] - sal_Bool 0 => disabled - 1 => enabled - 2 => enabled even if ReadOnlyDoc + [Return value] + sal_Bool 0 => disabled + 1 => enabled + 2 => enabled even if ReadOnlyDoc */ { - // kein Filter? + // no filter? if ( 0 == pImp->nFilterCount ) - // => alle SIDs erlaubt + // => all SIDs allowed return sal_True; - // suchen + // search sal_Bool bFound = 0 != bsearch( &nSID, pImp->pFilterSIDs, pImp->nFilterCount, sizeof(sal_uInt16), SfxCompareSIDs_Impl ); // even if ReadOnlyDoc if ( 2 == pImp->bFilterEnabling ) return bFound ? 2 : 1; - // sonst je nach Negativ/Positiv Filter + // Otherwise after Negative/Positive Filter return pImp->bFilterEnabling ? bFound : !bFound; } //-------------------------------------------------------------------- sal_Bool SfxDispatcher::_TryIntercept_Impl ( - sal_uInt16 nSlot, // zu suchende Slot-Id - SfxSlotServer& rServer, // zu f"uellende <SfxSlotServer>-Instanz - sal_Bool bSelf + sal_uInt16 nSlot, // Slot-Id to search for + SfxSlotServer& rServer, // <SfxSlotServer>-Instance to fill + sal_Bool bSelf ) { - // Eventuell geh"ort der parent auch zu einer Komponente + // Maybe the parent is also belongs to a component SfxDispatcher *pParent = pImp->pParent; sal_uInt16 nLevels = pImp->aStack.Count(); while ( pParent && pParent->pImp->pFrame ) { if ( pParent->pImp->pFrame->GetFrame().HasComponent() ) { - // Components d"urfen intercepten + // Components may be intercepted if ( pParent->_TryIntercept_Impl( nSlot, rServer, sal_True ) ) { - // Die eigenen Shells zum Shelllevel hinzuz"ahlen + // The own shells are added to the Shell Level rServer.SetShellLevel( rServer.GetShellLevel() + nLevels ); return sal_True; } else - // Keine weitere Interception + // No further Interception break; } else @@ -2202,7 +2106,7 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl if ( bSelf ) { - // Die ComponentViewShell befragen + // Query the ComponentViewShell Flush(); SfxShell *pObjShell = GetShell(0); SfxInterface *pIFace = pObjShell->GetInterface(); @@ -2212,11 +2116,6 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl { rServer.SetSlot(pSlot); rServer.SetShellLevel(0); -#ifdef DBG_UTILx - String aMsg( nSlot ); - aMsg += " intercepted"; - DbgTrace( aMsg.GetBuffer() ); -#endif return sal_True; } } @@ -2226,43 +2125,42 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl sal_Bool SfxDispatcher::_FindServer ( - sal_uInt16 nSlot, // zu suchende Slot-Id - SfxSlotServer& rServer, // zu f"uellnde <SfxSlotServer>-Instanz - sal_Bool bModal // trotz ModalMode + sal_uInt16 nSlot, // Slot-Id to search for + SfxSlotServer& rServer, // <SfxSlotServer>-Instance to fill + sal_Bool bModal // Dispite ModalMode ) -/* [Beschreibung] +/* [Description] - Diese Hilfsmethode sucht den <Slot-Server>, der nSlot zur Zeit bedient. - Als Ergebnis wird rServer entsprechend gef"ullt. + This helper method searches for the <Slot-Server> which currently serves + the nSlot. As the result, rServe is filled accordingly. - Falls bekannt, kann das SfxInterface mitgegeben werden, von welchem - nSlot momentan bedient wird. + If known the SfxInterface which is currently served by nSlot can be + passed along. - Vor der Suche nach nSlot wird der SfxDispatcher geflusht. + The SfxDispatcher is flushed while searching for nSlot. + [Return value] - [R"uckgabewert] - sal_Bool sal_True - Der Slot wurde gefunden, rServer ist g"ultig. + sal_Bool sal_True + The Slot was found, rServer is valid. sal_False - Der Slot wird momentan nicht bedient, rServer - ist ung"ultig. + The Slot is currently not served, rServer is invalid. */ { SFX_STACK(SfxDispatcher::_FindServer); - // Dispatcher gelockt? (SID_HELP_PI trotzdem durchlassen) + // Dispatcher locked? (nevertheless let SID_HELP_PI through) if ( IsLocked(nSlot) ) { pImp->bInvalidateOnUnlock = sal_True; return sal_False; } - // Anzahl der Shells auf den verkettenten Dispatchern z"ahlen + // Count the number of Shells in the linked dispatchers. Flush(); sal_uInt16 nTotCount = pImp->aStack.Count(); if ( pImp->pParent ) @@ -2296,7 +2194,7 @@ sal_Bool SfxDispatcher::_FindServer } } - // SID gegen gesetzten Filter pr"ufen + // SID check against set filter sal_uInt16 nSlotEnableMode=0; if ( pImp->pFrame ) { @@ -2305,7 +2203,7 @@ sal_Bool SfxDispatcher::_FindServer return sal_False; } - // im Quiet-Mode nur Parent-Dispatcher + // In Quiet-Mode only Parent-Dispatcher if ( pImp->bQuiet ) { if ( pImp->pParent ) @@ -2320,13 +2218,9 @@ sal_Bool SfxDispatcher::_FindServer } sal_Bool bReadOnly = ( 2 != nSlotEnableMode && pImp->bReadOnly ); -// ( pImp->pFrame && pImp->pFrame->GetObjectShell() ); -// pImp->pFrame->GetObjectShell()->IsLoading() ); - // durch alle Shells der verketteten Dispatchern von oben nach unten suchen -#ifdef DBG_UTILx - String aStack( "Stack:" ); -#endif + // search through all the shells of the chained dispatchers + // from top to bottom sal_uInt16 nFirstShell = pImp->bModal && !bModal ? pImp->aStack.Count() : 0; for ( sal_uInt16 i = nFirstShell; i < nTotCount; ++i ) { @@ -2342,45 +2236,31 @@ sal_Bool SfxDispatcher::_FindServer if ( pSlot ) { - // Slot geh"ort zum Container? + // Slot belongs to Container? bool bIsContainerSlot = pSlot->IsMode(SFX_SLOT_CONTAINER); bool bIsInPlace = pImp->pFrame && pImp->pFrame->GetObjectShell()->IsInPlaceActive(); - // Shell geh"ort zum Server? - // AppDispatcher oder IPFrame-Dispatcher + // Shell belongs to Server? + // AppDispatcher or IPFrame-Dispatcher bool bIsServerShell = !pImp->pFrame || bIsInPlace; - // Nat"urlich sind ServerShell-Slots auch ausf"uhrbar, wenn sie auf - // einem Container-Dispatcher ohne IPClient ausgef"uhrt werden sollen. + // Of course ShellServer-Slots are also executable even when it is + // excecuted on a container dispatcher without a IPClient. if ( !bIsServerShell ) { SfxViewShell *pViewSh = pImp->pFrame->GetViewShell(); bIsServerShell = !pViewSh || !pViewSh->GetUIActiveClient(); } - // Shell geh"ort zum Container? - // AppDispatcher oder kein IPFrameDispatcher + // Shell belongs to Container? + // AppDispatcher or no IPFrameDispatcher bool bIsContainerShell = !pImp->pFrame || !bIsInPlace; - // Shell und Slot passen zusammen + // Shell and Slot match if ( !( ( bIsContainerSlot && bIsContainerShell ) || ( !bIsContainerSlot && bIsServerShell ) ) ) pSlot = 0; } -#ifdef DBG_UTILx - if ( pSlot ) - { - String aMsg( nSlot ); - aMsg += " found in "; - aMsg += pObjShell->GetInterface()->GetClassName(); - DbgTrace( aMsg.GetBuffer() ); - } - else - { - aStack += " "; - aStack += pObjShell->GetInterface()->GetClassName(); - } -#endif if ( pSlot && !IsAllowed( nSlot ) ) { pSlot = NULL; @@ -2394,12 +2274,6 @@ sal_Bool SfxDispatcher::_FindServer } } -#ifdef DBG_UTILx - String aMsg( nSlot ); - aMsg += " not found in "; - aMsg += aStack; - DbgTrace( aMsg.GetBuffer() ); -#endif return sal_False; } @@ -2427,7 +2301,7 @@ sal_Bool SfxDispatcher::HasSlot_Impl( sal_uInt16 nSlot ) } } - // SID gegen gesetzten Filter pr"ufen + // SID check against set filter sal_uInt16 nSlotEnableMode=0; if ( pImp->pFrame ) { @@ -2436,13 +2310,11 @@ sal_Bool SfxDispatcher::HasSlot_Impl( sal_uInt16 nSlot ) return sal_False; } - // im Quiet-Mode nur Parent-Dispatcher + // In Quiet-Mode only Parent-Dispatcher if ( pImp->bQuiet ) return sal_False; sal_Bool bReadOnly = ( 2 != nSlotEnableMode && pImp->bReadOnly ); -// ( pImp->pFrame && pImp->pFrame->GetObjectShell()); -// pImp->pFrame->GetObjectShell()->IsLoading() ); for ( sal_uInt16 i=0 ; i < nTotCount; ++i ) { @@ -2457,27 +2329,27 @@ sal_Bool SfxDispatcher::HasSlot_Impl( sal_uInt16 nSlot ) if ( pSlot ) { - // Slot geh"ort zum Container? + // Slot belongs to Container? bool bIsContainerSlot = pSlot->IsMode(SFX_SLOT_CONTAINER); bool bIsInPlace = pImp->pFrame && pImp->pFrame->GetObjectShell()->IsInPlaceActive(); - // Shell geh"ort zum Server? - // AppDispatcher oder IPFrame-Dispatcher + // Shell belongs to Server? + // AppDispatcher or IPFrame-Dispatcher bool bIsServerShell = !pImp->pFrame || bIsInPlace; - // Nat"urlich sind ServerShell-Slots auch ausf"uhrbar, wenn sie auf - // einem Container-Dispatcher ohne IPClient ausgef"uhrt werden sollen. + // Of course ShellServer-Slots are also executable even when it is + // excecuted on a container dispatcher without a IPClient if ( !bIsServerShell ) { SfxViewShell *pViewSh = pImp->pFrame->GetViewShell(); bIsServerShell = !pViewSh || !pViewSh->GetUIActiveClient(); } - // Shell geh"ort zum Container? - // AppDispatcher oder kein IPFrameDispatcher + // Shell belongs to Container? + // AppDispatcher or no IPFrameDispatcher bool bIsContainerShell = !pImp->pFrame || !bIsInPlace; - // Shell und Slot passen zusammen + // Shell and Slot match if ( !( ( bIsContainerSlot && bIsContainerShell ) || ( !bIsContainerSlot && bIsServerShell ) ) ) pSlot = 0; @@ -2493,23 +2365,21 @@ sal_Bool SfxDispatcher::HasSlot_Impl( sal_uInt16 nSlot ) return sal_False; } - - //-------------------------------------------------------------------- sal_Bool SfxDispatcher::_FillState ( - const SfxSlotServer& rSvr, // abzufragende <Slot-Server> - SfxItemSet& rState, // zu f"ullendes <SfxItemSet> - const SfxSlot* pRealSlot // ggf. der tats"achliche Slot + const SfxSlotServer& rSvr, // <Slot-Server> to query + SfxItemSet& rState, // <SfxItemSet> to be filled + const SfxSlot* pRealSlot // The actual Slot if possible ) -/* [Beschreibung] +/* [Description] - Hilfsmethode zum Abfragen des Status des <Slot-Server>s rSvr. - In rState m"ussen die gew"unschten Slots-Ids (teilweise in Which-Ids - des betreffenden Pools umgewandelt) vorhanden sein. + Helper method to obtain the status of the <Slot-Server>s rSvr. + The required slots IDs (partly converted to Which-IDs of the pool) + must be present in rstate. - Der SfxDispatcher wird vor der Abfrage geflusht. + The SfxDispatcher is flushed before the query. */ { @@ -2530,11 +2400,10 @@ sal_Bool SfxDispatcher::_FillState DBG_ASSERT(bFlushed, "Dispatcher not flushed after retrieving slot servers!"); if ( !bFlushed ) return sal_False; - // Flush(); - // Objekt ermitteln und Message an diesem Objekt aufrufen + // Determine the object and call the Message of this object SfxShell *pSh = GetShell(rSvr.GetShellLevel()); - DBG_ASSERT(pSh, "ObjektShell nicht gefunden"); + DBG_ASSERT(pSh, "ObjektShell not found"); SfxStateFunc pFunc; @@ -2545,7 +2414,7 @@ sal_Bool SfxDispatcher::_FillState pSh->CallState( pFunc, rState ); #ifdef DBG_UTIL - // pr"ufen, ob IDL (SlotMap) und aktuelle Items "ubereinstimmen + // To examine the conformity of IDL (SlotMap) and current Items if ( DbgIsAssertWarning() && rState.Count() ) { SfxInterface *pIF = pSh->GetInterface(); @@ -2580,10 +2449,9 @@ sal_Bool SfxDispatcher::_FillState //-------------------------------------------------------------------- const SfxPoolItem* SfxDispatcher::_Execute( const SfxSlotServer &rSvr ) -/* [Beschreibung] +/* [Description] - Diese Methode f"uhrt einen Request "uber einen gecachten <Slot-Server> - aus. + This method performs a request for a cached <Slot-Server>. */ { @@ -2596,7 +2464,7 @@ const SfxPoolItem* SfxDispatcher::_Execute( const SfxSlotServer &rSvr ) Flush(); if ( pSlot->IsMode(SFX_SLOT_ASYNCHRON) ) - //! ignoriert rSvr + //! ignore rSvr { SfxShell *pShell = GetShell( rSvr.GetShellLevel() ); SfxDispatcher *pDispat = this; @@ -2609,20 +2477,16 @@ const SfxPoolItem* SfxDispatcher::_Execute( const SfxSlotServer &rSvr ) pDispat->pImp->xPoster->Post( new SfxRequest( pSlot->GetSlotId(), SFX_CALLMODE_RECORD, pShell->GetPool() ) ); -// pDispat->pImp->xPoster->Post(new Executer( -// new SfxRequest( pSlot->GetSlotId(), -// SFX_CALLMODE_RECORD, pShell->GetPool() ), -// pSlot, n )); return 0; } } } else { - // Objekt ermitteln und Message an diesem Objekt aufrufen + // Determine the object and call the Message of this object SfxShell *pSh = GetShell(rSvr.GetShellLevel()); SfxRequest aReq( pSlot->GetSlotId(), SFX_CALLMODE_RECORD, pSh->GetPool() ); - if ( Call_Impl( *pSh, *pSlot, aReq, sal_True ) ) // von Bindings immer recorden + if ( Call_Impl( *pSh, *pSlot, aReq, sal_True ) ) // Bindings always recording return aReq.GetReturnValue(); } } @@ -2669,20 +2533,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin SfxDispatcher &rDisp = *SFX_APP()->GetDispatcher_Impl(); sal_uInt16 nShLevel = 0; SfxShell *pSh; -/* - const SvVerbList *pVerbList = 0; - sal_uInt16 nMaxShellLevel = rDisp.pImp->aStack.Count(); - for ( pSh = rDisp.GetShell(nShLevel); - pSh && nShLevel < nMaxShellLevel ; - ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) - { - if ( pSh->GetVerbs() ) - { - pVerbList = pSh->GetVerbs(); - break; - } - } -*/ + nShLevel=0; if ( rDisp.pImp->bQuiet ) { @@ -2696,14 +2547,6 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); if ( ( nConfigId == 0 && rResId.GetId() ) || ( nConfigId != 0 && rResId.GetId() == nConfigId ) ) { - //SfxPopupMenuManager aPop( rResId.GetId(), *rDisp.GetBindings() ); - //aPop.SetResMgr(rResId.GetResMgr()); - //aPop.AddClipboardFunctions(); - //aPop.Initialize(); - //if ( pVerbList && pVerbList->Count() ) - // aPop.InsertVerbs(pVerbList); - //aPop.RemoveDisabledEntries(); - //aPop.Execute( pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); SfxPopupMenuManager::ExecutePopup( rResId, rDisp.GetFrame(), pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); return; } @@ -2714,25 +2557,17 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin void SfxDispatcher::ExecutePopup( const ResId &rId, Window *pWin, const Point *pPos ) { Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); -/* - SfxPopupMenuManager aPop( rId, *GetBindings() ); - aPop.AddClipboardFunctions(); - aPop.Initialize(); - aPop.RemoveDisabledEntries(); - aPop.Execute( pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); -*/ SfxPopupMenuManager::ExecutePopup( rId, GetFrame(), pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); } //-------------------------------------------------------------------- void SfxDispatcher::Lock( sal_Bool bLock ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann der SfxDispatcher gesperrt und freigegeben - werden. Ein gesperrter SfxDispatcher f"uhrt keine <SfxRequest>s mehr - aus und liefert keine Status-Informationen mehr. Er verh"alt sich - so als w"aren alle Slots disabled. + With this method the SfxDispatcher can be locked and released. A locked + SfxDispatcher does not perform <SfxRequest>s and does no longer provide + status information. It behaves as if all the slots were disabled. */ { @@ -2763,10 +2598,10 @@ sal_uInt32 SfxDispatcher::GetObjectBarId( sal_uInt16 nPos ) const //-------------------------------------------------------------------- void SfxDispatcher::ResetObjectBars_Impl() -/* [Beschreibung] +/* [Description] - Mit dieser Methode werden alle Objectbar-Anforderungen, die dieser - Dispatcher an das AppWindow hat, beseitigt. + With this method all Objectbar requirements which this Dispatcher + imposes on the AppWindow are eliminated. */ { for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++) @@ -2784,15 +2619,15 @@ void SfxDispatcher::DebugOutput_Impl() const DbgGetData()->nTraceOut = DBG_OUT_FILE; if (bFlushed) - DBG_TRACE("Flushed"); + OSL_TRACE("Flushed"); if (pImp->bUpdated) - DBG_TRACE("Updated"); + OSL_TRACE("updated"); for ( sal_uInt16 nShell = pImp->aStack.Count(); nShell > 0; --nShell ) { SfxShell *pShell = GetShell(nShell-1); const SfxInterface *pIFace = pShell->GetInterface(); - DBG_TRACE (pIFace->GetClassName()); + OSL_TRACE("%s", pIFace->GetClassName()); } DbgGetData()->nTraceOut = nOld; @@ -2811,8 +2646,6 @@ void SfxDispatcher::LockUI_Impl( sal_Bool bLock ) //------------------------------------------------------------------------- void SfxDispatcher::HideUI( sal_Bool bHide ) { -// if ( !bHide && pImp->bReadOnly ) -// bHide = sal_True; sal_Bool bWasHidden = pImp->bNoUI; pImp->bNoUI = bHide; if ( pImp->pFrame ) @@ -2843,7 +2676,6 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) void SfxDispatcher::SetReadOnly_Impl( sal_Bool bOn ) { pImp->bReadOnly = bOn; -// pImp->bNoUI = bOn; } sal_Bool SfxDispatcher::GetReadOnly_Impl() const @@ -2854,10 +2686,10 @@ sal_Bool SfxDispatcher::GetReadOnly_Impl() const //------------------------------------------------------------------------- void SfxDispatcher::SetQuietMode_Impl( sal_Bool bOn ) -/* [Beschreibung] +/* [Description] - Bei 'bOn' stellt sich dieser Dispatcher quasi tot und leitet alles - an den Parent-Dispatcher weiter. + With 'bOn' the Dispatcher is quasi dead and transfers everything to the + Parent-Dispatcher. */ { @@ -2870,9 +2702,9 @@ void SfxDispatcher::SetQuietMode_Impl( sal_Bool bOn ) //------------------------------------------------------------------------- void SfxDispatcher::SetModalMode_Impl( sal_Bool bOn ) -/* [Beschreibung] +/* [Description] - Bei 'bOn' werden nur noch Slots des Parent-Dispatchers gefunden. + With 'Bon' only slots of the parent dispatcher are found. */ { @@ -2951,8 +2783,8 @@ sal_Bool SfxDispatcher::IsReadOnlyShell_Impl( sal_uInt16 nShell ) const return sal_True; } -// Ein dirty trick, um an die Methoden der private base class von -// SfxShellStack_Impl heranzukommen +// A dirty trick, to get hold of the methods of the private base class +// SfxShellStack_Impl class StackAccess_Impl : public SfxShellStack_Implarr_ {}; @@ -2960,7 +2792,7 @@ void SfxDispatcher::InsertShell_Impl( SfxShell& rShell, sal_uInt16 nPos ) { Flush(); - // Der cast geht, weil SfxShellStack_Impl keine eigenen member hat + // The cast is because SfxShellStack_Impl member has non of its own ((StackAccess_Impl*) (&pImp->aStack))->Insert( nPos, &rShell ); rShell.SetDisableFlags( pImp->nDisableFlags ); rShell.DoActivate_Impl(pImp->pFrame, sal_True); @@ -2978,7 +2810,7 @@ void SfxDispatcher::RemoveShell_Impl( SfxShell& rShell ) { Flush(); - // Der cast geht, weil SfxShellStack_Impl keine eigenen member hat + // The cast is because SfxShellStack_Impl member has non of its own StackAccess_Impl& rStack = *((StackAccess_Impl*) (&pImp->aStack)); sal_uInt16 nCount = rStack.Count(); for ( sal_uInt16 n=0; n<nCount; ++n ) @@ -3006,16 +2838,17 @@ sal_Bool SfxDispatcher::IsAllowed sal_uInt16 nSlot ) const /* - [Beschreibung] - Die Methode prueft, ob der Zugriff auf diese Schnittstelle erlaubt ist. - */ + [Description] + + The method checks whether the access is allowed on this interface. + */ { if ( !pImp->pDisableList ) { return sal_True; } - // BinSearch in der DisableListe + // BinSearch in the disable list SvUShorts& rList = *pImp->pDisableList; sal_uInt16 nCount = rList.Count(); sal_uInt16 nLow = 0, nMid = 0, nHigh; @@ -3025,7 +2858,7 @@ sal_Bool SfxDispatcher::IsAllowed while ( !bFound && nLow <= nHigh ) { nMid = (nLow + nHigh) >> 1; - DBG_ASSERT( nMid < nCount, "bsearch ist buggy" ); + DBG_ASSERT( nMid < nCount, "bsearch is buggy" ); int nDiff = (int) nSlot - (int) rList[nMid]; if ( nDiff < 0) @@ -3045,7 +2878,7 @@ sal_Bool SfxDispatcher::IsAllowed } #ifdef _DEBUG - // Slot in der Liste gefunden ? + // Slot found in the List? sal_uInt16 nPos = bFound ? nMid : nLow; DBG_ASSERT( nPos <= nCount, "" ); @@ -3111,3 +2944,5 @@ SfxModule* SfxDispatcher::GetModule() const return (SfxModule*) pSh; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/macrconf.cxx b/sfx2/source/control/macrconf.cxx new file mode 100644 index 000000000000..1464ffe0abed --- /dev/null +++ b/sfx2/source/control/macrconf.cxx @@ -0,0 +1,794 @@ +/* -*- 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 +#include "precompiled_sfx2.hxx" +#include <basic/sbstar.hxx> +#include <basic/basmgr.hxx> +#include <basic/sbx.hxx> +#include <svl/intitem.hxx> +#include <basic/sbmeth.hxx> +#include <basic/sbmod.hxx> +#include <basic/sbuno.hxx> + +#include <osl/mutex.hxx> + +#include <com/sun/star/script/XEngine.hpp> +#include <com/sun/star/document/MacroExecMode.hpp> + +#include <comphelper/processfactory.hxx> +#include <unotools/intlwrapper.hxx> + +#include <sfx2/msgpool.hxx> +#include <sfx2/macrconf.hxx> +#include "sfxbasic.hxx" +#include <sfx2/sfx.hrc> +#include <sfx2/app.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/dispatch.hxx> +#include "minfitem.hxx" +#include "imgmgr.hxx" +#include <sfx2/evntconf.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/genlink.hxx> +#include <sfx2/viewfrm.hxx> +#include <appdata.hxx> +#include "objshimp.hxx" +#include <sfx2/request.hxx> + +static const sal_uInt16 nCompatVersion = 2; +static const sal_uInt16 nVersion = 3; + +// Static member +SfxMacroConfig* SfxMacroConfig::pMacroConfig = NULL; + +SfxMacroConfig* SfxMacroConfig::GetOrCreate() +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pMacroConfig ) + pMacroConfig = new SfxMacroConfig; + return pMacroConfig; +} + +void SfxMacroConfig::Release_Impl() +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + DELETEZ( pMacroConfig ); +} + +//========================================================================== + +struct SfxMacroConfig_Impl +{ + SfxMacroInfoArr_Impl aArr; + sal_uInt32 nEventId; + sal_Bool bWaitingForCallback; + + SfxMacroConfig_Impl() + : nEventId( 0 ) + , bWaitingForCallback( sal_False ) + {} +}; + +//========================================================================== + +SbMethod* SfxQueryMacro_Impl( BasicManager* pMgr , const String& rMacro, + const String &rLibName, const String& rModule ) +{ + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); + const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); + sal_uInt16 nLibCount = pMgr->GetLibCount(); + for ( sal_uInt16 nLib = 0; nLib < nLibCount; ++nLib ) + { + if ( COMPARE_EQUAL == pCollator->compareString( pMgr->GetLibName( nLib ), rLibName ) ) + { + StarBASIC* pLib = pMgr->GetLib( nLib ); + if( !pLib ) + { + pMgr->LoadLib( nLib ); + pLib = pMgr->GetLib( nLib ); + } + + if( pLib ) + { + sal_uInt16 nModCount = pLib->GetModules()->Count(); + for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod ) + { + SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod ); + if ( pMod && COMPARE_EQUAL == pCollator->compareString( pMod->GetName(), rModule ) ) + { + SbMethod* pMethod = (SbMethod*)pMod->Find( rMacro, SbxCLASS_METHOD ); + if( pMethod ) + return pMethod; + } + } + } + } + } + return 0; +} + +SbMethod* SfxQueryMacro( BasicManager* pMgr , const String& rMacro ) +{ + sal_uInt16 nLast = 0; + String aMacro = rMacro; + String aLibName = aMacro.GetToken( 0, '.', nLast ); + String aModule = aMacro.GetToken( 0, '.', nLast ); + aMacro.Erase( 0, nLast ); + + return SfxQueryMacro_Impl( pMgr, aMacro, aLibName, aModule ); +} + +ErrCode SfxCallMacro( BasicManager* pMgr, const String& rCode, + SbxArray *pArgs, SbxValue *pRet ) +{ + ErrCode nErr; + SfxApplication *pApp = SFX_APP(); + pApp->EnterBasicCall(); + SbMethod* pMethod = SfxQueryMacro( pMgr, rCode ); + if ( pMethod ) + { + if ( pArgs ) + pMethod->SetParameters( pArgs ); + nErr = pMethod->Call( pRet ); + } + else + nErr = ERRCODE_BASIC_PROC_UNDEFINED; + + pApp->LeaveBasicCall(); + return nErr; +} + +//========================================================================== + +SfxMacroInfo::SfxMacroInfo( const String& rURL ) : + pHelpText(0), + nRefCnt(0), + bAppBasic(TRUE), + nSlotId(0), + pSlot(0) +{ + if ( rURL.CompareToAscii( "macro:", 6 ) == COMPARE_EQUAL ) + { + String aTmp = rURL.Copy( 6 ); + if ( aTmp.GetTokenCount('/') > 3 ) + { + // 'macro:///lib.mod.proc(args)' => Macro via App-BASIC-Mgr + // 'macro://[docname|.]/lib.mod.proc(args)' => Macro via included Doc-BASIC-Mgr + if ( aTmp.CompareToAscii("///", 3 ) != COMPARE_EQUAL ) + bAppBasic = FALSE; + aTmp = rURL.GetToken( 3, '/' ); + if ( aTmp.GetTokenCount('.') == 3 ) + { + aLibName = aTmp.GetToken( 0, '.' ); + aModuleName = aTmp.GetToken( 1, '.' ); + aMethodName = aTmp.GetToken( 2, '.' ); + + // Remove arguments to be compatible + aMethodName.SearchAndReplaceAscii( "()", String(), sal::static_int_cast< xub_StrLen >(std::max( aMethodName.Len()-2, 0 ))); + } + } + + DBG_ASSERT( aLibName.Len() && aModuleName.Len() && aMethodName.Len(), "Wrong macro URL!" ); + } + else + aMethodName = rURL; +} + +SfxMacroInfo::SfxMacroInfo( bool _bAppBasic ) : + pHelpText(0), + nRefCnt(0), + bAppBasic(_bAppBasic), + nSlotId(0), + pSlot(0) +{} + +//========================================================================== + +SfxMacroInfo::SfxMacroInfo(bool _bAppBasic, const String& rLibName, + const String& rModuleName, const String& rMethodName) : + pHelpText(0), + nRefCnt(0), + bAppBasic(_bAppBasic), + aLibName(rLibName), + aModuleName(rModuleName), + aMethodName(rMethodName), + nSlotId(0), + pSlot(0) +{ +} + +//========================================================================== + +SfxMacroInfo::SfxMacroInfo(bool _bAppBasic, const String& rQualifiedName ) +: pHelpText(0), + nRefCnt(0), + bAppBasic(_bAppBasic), + nSlotId(0), + pSlot(0) +{ + sal_uInt16 nCount = rQualifiedName.GetTokenCount('.'); + aMethodName = rQualifiedName.GetToken( nCount-1, '.' ); + if ( nCount > 1 ) + aModuleName = rQualifiedName.GetToken( nCount-2, '.' ); + if ( nCount > 2 ) + aLibName = rQualifiedName.GetToken( 0, '.' ); +} + +//========================================================================== + +SfxMacroInfo::SfxMacroInfo(SfxMacroInfo& rOther) : + pHelpText(0), + nRefCnt(0), + bAppBasic(rOther.bAppBasic), + aLibName(rOther.aLibName), + aModuleName(rOther.aModuleName), + aMethodName(rOther.aMethodName), + nSlotId(rOther.nSlotId), + pSlot(0) +{} + +//========================================================================== + +SfxMacroInfo::~SfxMacroInfo() +{ + delete pSlot; + delete pHelpText; +} + +//========================================================================== + +sal_Bool SfxMacroInfo::operator==(const SfxMacroInfo& rOther) const +{ + if ( GetQualifiedName() == rOther.GetQualifiedName() && + bAppBasic == rOther.bAppBasic ) + return sal_True; + else + return sal_False; +} + +//========================================================================== + +String SfxMacroInfo::GetMacroName() const +{ + String aMacroName = aMethodName; + aMacroName += '('; + aMacroName += aLibName; + aMacroName += '.'; + aMacroName += aModuleName; + aMacroName += ')'; + return aMacroName; +} + +//========================================================================== + +String SfxMacroInfo::GetQualifiedName() const +{ + String aMacroName; + if( aMacroName.Len() || aLibName.Len() ) + { + // Altes Format + aMacroName = aLibName; + aMacroName += '.'; + aMacroName += aModuleName; + aMacroName += '.'; + } + + // due to ::com::sun::star::script::JavaScript + // no more disassembly of the string + aMacroName += aMethodName; + return aMacroName; +} + +String SfxMacroInfo::GetFullQualifiedName() const +{ + // Returns only nonsense, when called for a + // ::com::sun::star::script::JavaScript ! + String aRet; + if ( bAppBasic ) + aRet = SFX_APP()->GetName(); + aRet += '.'; + aRet += GetQualifiedName(); + return aRet; +} + +String SfxMacroInfo::GetURL() const +{ + if ( !aLibName.Len() ) + return aMethodName; + + // 'macro:///lib.mod.proc(args)' => Macro via App-BASIC-Mgr + // 'macro://[docname|.]/lib.mod.proc(args)' => Macro via included Doc-BASIC-Mgr + // 'macro://obj.method(args)' => Object via App-BASIC-Mgr + String aURL( String::CreateFromAscii("macro://") ); + if ( !bAppBasic ) + aURL += '.'; + aURL += '/'; + aURL += aLibName; + aURL += '.'; + aURL += aModuleName; + aURL += '.'; + aURL += aMethodName; + aURL += String::CreateFromAscii("()"); + + return aURL; +} + +//========================================================================== + +BasicManager* SfxMacroInfo::GetBasicManager() const +{ + if (bAppBasic) + { + return SFX_APP()->GetBasicManager(); + } + else + { + SfxObjectShell *pCurrDocShell = SfxObjectShell::Current(); + return pCurrDocShell ? pCurrDocShell->GetBasicManager() : + SFX_APP()->GetBasicManager(); + } +} + +//========================================================================== + +String SfxMacroInfo::GetBasicName() const +{ + if (bAppBasic) + { + return SFX_APP()->GetName(); + } + else + { + SfxObjectShell *pCurrDocShell = SfxObjectShell::Current(); + if ( pCurrDocShell ) + return pCurrDocShell->GetTitle(); + else + return SFX_APP()->GetName(); + } +} + +String SfxMacroInfo::GetHelpText() const +{ + if ( pHelpText ) + return *pHelpText; + return String(); +} + +String SfxMacroConfig::RequestHelp( sal_uInt16 nId ) +{ + SfxMacroInfo *pInfo = SFX_APP()->GetMacroConfig()->GetMacroInfo( nId ); + if ( !pInfo ) + return String(); + + if ( !pInfo->pHelpText ) + { + SbMethod *pMethod = + SfxQueryMacro_Impl( pInfo->GetBasicManager(), pInfo->aMethodName, + pInfo->aLibName, pInfo->aModuleName ); + if ( pMethod && pMethod->GetInfo() ) + pInfo->pHelpText = new String( pMethod->GetInfo()->GetComment() ); + } + + return pInfo->GetHelpText(); +} + +void SfxMacroInfo::SetHelpText( const String& rName ) +{ + if ( !pHelpText ) + pHelpText = new String; + *pHelpText = rName; +} + +sal_Bool SfxMacroInfo::Compare( const SvxMacro& rMacro ) const +{ + String aName = rMacro.GetLibName(); + aName += '.'; + aName += rMacro.GetMacName(); + if ( GetFullQualifiedName() == aName ) + return sal_True; + return sal_False; +} + +//========================================================================== + +SfxMacroConfig::SfxMacroConfig() +{ + pImp = new SfxMacroConfig_Impl; +} + +//========================================================================== + +SfxMacroConfig::~SfxMacroConfig() +{ + if ( pImp->nEventId ) + Application::RemoveUserEvent( pImp->nEventId ); + delete pImp; +} + +//========================================================================== + +SFX_STATE_STUB( SfxApplication, MacroState_Impl ) +SFX_EXEC_STUB( SfxApplication, MacroExec_Impl ) + +sal_uInt16 SfxMacroConfig::GetSlotId(SfxMacroInfoPtr pInfo) +{ + sal_uInt16 nCount = pImp->aArr.Count(); // Search for Macro + sal_uInt16 i; + for (i=0; i<nCount; i++) + if ((*(pImp->aArr)[i]) == (*pInfo)) + break; + + if (i == nCount) + { + // Macro still unknown + nCount = aIdArray.Count(); + sal_uInt16 n; + for (n=0; n<nCount; n++) // Seearch for free SlotId + if (aIdArray[n] > SID_MACRO_START + n) + break; + + sal_uInt16 nNewSlotId = SID_MACRO_START + n; + if ( nNewSlotId > SID_MACRO_END ) + return 0; + aIdArray.Insert( SID_MACRO_START + n, n ); + + SfxSlot *pNewSlot = new SfxSlot; + pNewSlot->nSlotId = SID_MACRO_START + n; + pNewSlot->nGroupId = 0; + pNewSlot->nFlags = SFX_SLOT_ASYNCHRON; + pNewSlot->nMasterSlotId = 0; + pNewSlot->nValue = 0; + pNewSlot->fnExec = SFX_STUB_PTR(SfxApplication,MacroExec_Impl); + pNewSlot->fnState = SFX_STUB_PTR(SfxApplication,MacroState_Impl); + pNewSlot->pType = 0; HACK(SFX_TYPE(SfxVoidItem)) + pNewSlot->pName = pNewSlot->pMethodName = U2S(pInfo->aMethodName).getStr(); + pNewSlot->pLinkedSlot = 0; + pNewSlot->nArgDefCount = 0; + pNewSlot->pFirstArgDef = 0; + pNewSlot->pUnoName = 0; + + if (nCount) + { + SfxSlot *pSlot = (pImp->aArr)[0]->pSlot; + pNewSlot->pNextSlot = pSlot->pNextSlot; + pSlot->pNextSlot = pNewSlot; + } + else + pNewSlot->pNextSlot = pNewSlot; + + // Take over Macro + SfxMacroInfoPtr pNewInfo = new SfxMacroInfo(*pInfo); + pNewInfo->nSlotId = SID_MACRO_START + n; + pImp->aArr.Insert(pNewInfo,n); + pNewInfo->pSlot = pNewSlot; + pInfo->nSlotId = pNewInfo->nSlotId; + pNewInfo->nRefCnt++; + } + else + { + pInfo->nSlotId = (pImp->aArr)[i]->nSlotId; + (pImp->aArr)[i]->nRefCnt++; + } + + return pInfo->nSlotId; +} + +//========================================================================== + +void SfxMacroConfig::ReleaseSlotId(sal_uInt16 nId) +{ + DBG_ASSERT( IsMacroSlot( nId ), "SlotId is no Macro!"); + + sal_uInt16 nCount = pImp->aArr.Count(); + for (sal_uInt16 i=0; i<nCount; i++) + { + SfxMacroInfo *pInfo = (pImp->aArr)[i]; + if (pInfo->nSlotId == nId) + { + pInfo->nRefCnt--; + if (pInfo->nRefCnt == 0) + { + // Slot is no longer referenced, so get + SfxSlot *pSlot = pInfo->pSlot; + + // Take out Slot from the concatenation + while (pSlot->pNextSlot != pInfo->pSlot) + pSlot = (SfxSlot*) pSlot->pNextSlot; + pSlot->pNextSlot = pInfo->pSlot->pNextSlot; + + // Slot close itself briefly + pSlot = pInfo->pSlot; + pSlot->pNextSlot = pSlot; + + // Remove Macro info from array so that it can not cause + // any harm + pImp->aArr.Remove(i); + + // Release SlotId again + sal_uInt16 nIdCount = aIdArray.Count(); + for (sal_uInt16 n=0; n<nIdCount; n++) + { + if (aIdArray[n] == nId) + { + aIdArray.Remove(n); + break; + } + } + + // Unless the application is not shut down, then + // the Slot has to be deleted asynchronously if cancelled in + // its own Execute! + if ( !SFX_APP()->Get_Impl()->bInQuit ) + pImp->nEventId = Application::PostUserEvent( LINK(this, SfxMacroConfig, EventHdl_Impl), pInfo ); + else + EventHdl_Impl( pInfo ); + } + return; + } + } + + OSL_FAIL("Macro-SlotId is not found!"); +} + +//========================================================================== + +void SfxMacroConfig::RegisterSlotId(sal_uInt16 nId) +{ + DBG_ASSERT( IsMacroSlot( nId ), "SlotId is no Macro!"); + + sal_uInt16 nCount = pImp->aArr.Count(); + for (sal_uInt16 i=0; i<nCount; i++) + { + if ((pImp->aArr)[i]->nSlotId == nId) + { + (pImp->aArr)[i]->nRefCnt++; + return; + } + } + + OSL_FAIL("Macro-SlotId is not found!"); +} + +//========================================================================== + +SfxMacroInfo* SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const +{ + sal_uInt16 nCount = pImp->aArr.Count(); + for (sal_uInt16 i=0; i<nCount; i++) + if ((pImp->aArr)[i]->nSlotId == nId) + return (pImp->aArr)[i]; + + return 0; +} + +//========================================================================== + +const SfxMacroInfo* SfxMacroConfig::GetMacroInfo_Impl( const SvxMacro *pMacro ) const +{ + sal_uInt16 nCount = pImp->aArr.Count(); + for (sal_uInt16 i=0; i<nCount; i++) + if ((pImp->aArr)[i]->Compare(*pMacro) ) + return (pImp->aArr)[i]; + return 0; +} + +//========================================================================== + +sal_Bool SfxMacroConfig::ExecuteMacro( sal_uInt16 nId, const String& rArgs ) const +{ + const SfxMacroInfo* pInfo = GetMacroInfo( nId ); + if ( !pInfo ) + return sal_False; + + SfxObjectShell* pSh = SfxObjectShell::Current(); + + SvxMacro aMacro( pInfo->GetQualifiedName(), pInfo->GetBasicName(), STARBASIC ); + sal_Bool bRet = ExecuteMacro( pSh, &aMacro, rArgs ); + + // Release, because a register was created in the dispatcher Execute + ((SfxMacroConfig*)this)->ReleaseSlotId( nId ); + return bRet; +} + +sal_Bool SfxMacroConfig::ExecuteMacro( SfxObjectShell *pSh, const SvxMacro* pMacro, const String& /*rArgs*/ ) const +{ + SfxApplication *pApp = SFX_APP(); + + // Name of the Macros or Scripts (ScriptCode) + String aCode( pMacro->GetMacName() ); + ErrCode nErr = ERRCODE_NONE; + + // Is it a Basic-Macro ? + ScriptType eSType = pMacro->GetScriptType(); + sal_Bool bIsBasic = eSType == STARBASIC; + sal_Bool bIsStarScript = ( eSType == EXTENDED_STYPE && pMacro->GetLibName().SearchAscii( "StarScript" ) != STRING_NOTFOUND ); + sal_Bool bIsBasicLibBased = bIsBasic || bIsStarScript || !pSh; + + if ( bIsBasicLibBased ) + { + pApp->EnterBasicCall(); + BasicManager *pAppMgr = SFX_APP()->GetBasicManager(); + if( bIsBasic ) + { + // BasicManager of the Document? + BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL; + + // As the name has unfortunately been changed often ... + if( SFX_APP()->GetName() == pMacro->GetLibName() || + pMacro->GetLibName().EqualsAscii("StarDesktop") ) + pMgr = pAppMgr; + else if ( pMgr == pAppMgr ) + pMgr = NULL; + + if ( pSh && pMgr && pMgr != pAppMgr ) + { + if ( !pSh->AdjustMacroMode( String() ) ) + return sal_False; + } + + if ( pSh && pMgr && pMgr == pAppMgr ) + { + ::com::sun::star::uno::Any aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pSh->GetModel() ) ); + nErr = Call( 0, aCode, pMgr ); + pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); + } + else if ( pMgr ) + nErr = Call( 0, aCode, pMgr ); + else + nErr = SbxERR_NO_METHOD; + + } + + pApp->LeaveBasicCall(); + } + else + { + nErr = SbxERR_NO_METHOD; + } + + return ( nErr == ERRCODE_NONE ); +} + +sal_Bool SfxMacroConfig::CheckMacro( SfxObjectShell *pSh, const SvxMacro* pMacro ) const +{ + SfxApplication *pApp = SFX_APP(); + + // Name of Macros or Scripts (ScriptCode) + String aCode( pMacro->GetMacName() ); + ErrCode nErr = ERRCODE_NONE; + + // BasicManager of Document or Application + pApp->EnterBasicCall(); + BasicManager *pAppMgr = SFX_APP()->GetBasicManager(); + BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL; + + // As the name has unfortunately been changed often ... + if( SFX_APP()->GetName() == pMacro->GetLibName() || + pMacro->GetLibName().EqualsAscii("StarDesktop") ) + pMgr = pAppMgr; + else if ( pMgr == pAppMgr ) + pMgr = NULL; + + if ( !pMgr || !SfxQueryMacro( pMgr, aCode ) ) + nErr = SbxERR_NO_METHOD; + pApp->LeaveBasicCall(); + return ( nErr == ERRCODE_NONE ); +} + +//========================================================================== + +sal_Bool SfxMacroConfig::CheckMacro( sal_uInt16 nId ) const +{ + const SfxMacroInfo* pInfo = GetMacroInfo( nId ); + if ( !pInfo ) + return sal_False; + + // only initialize Basic, when default is not + // ::com::sun::star::script::JavaScript; then the Basic has to be created + // anyway in IsBasic() + SfxObjectShell* pSh = SfxObjectShell::Current(); + + SfxApplication *pApp = SFX_APP(); + pApp->EnterBasicCall(); + + // BasicManager of Document or Application + BasicManager *pAppMgr = SFX_APP()->GetBasicManager(); + BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL; + + if( SFX_APP()->GetName() == pInfo->GetBasicName() ) + pMgr = SFX_APP()->GetBasicManager(); + else if ( pMgr == pAppMgr ) + pMgr = NULL; + + String aFull( pInfo->GetQualifiedName() ); + sal_Bool bIsBasic = pMgr ? IsBasic( 0, aFull, pMgr ) : sal_False; + pApp->LeaveBasicCall(); + return bIsBasic; +} + +//========================================================================== + +IMPL_LINK( SfxMacroConfig, CallbackHdl_Impl, SfxMacroConfig*, pConfig ) +{ + (void)pConfig; // unused + pImp->bWaitingForCallback = sal_False; + return 0; +} + +IMPL_LINK( SfxMacroConfig, EventHdl_Impl, SfxMacroInfo*, pInfo ) +{ + delete pInfo; + pImp->nEventId = 0; + return 0; +} + +sal_Bool SfxMacroConfig::IsBasic( + SbxObject* /*pVCtrl*/, + const String& rCode, + BasicManager* pMgr ) +{ + sal_Bool bFound; + SFX_APP()->EnterBasicCall(); + bFound = SfxQueryMacro( pMgr, rCode ) != 0; + SFX_APP()->LeaveBasicCall(); + return bFound; +} + +ErrCode SfxMacroConfig::Call( + SbxObject* /*pVCtrl*/, + const String& rCode, + BasicManager* pMgr, + SbxArray *pArgs, + SbxValue *pRet ) +{ + SfxApplication *pApp = SFX_APP(); + pApp->EnterBasicCall(); + SbMethod* pMethod = SfxQueryMacro( pMgr, rCode ); + ErrCode nErr = 0; + if( pMethod ) + { + if ( pArgs ) + pMethod->SetParameters( pArgs ); + nErr = pMethod->Call( pRet ); + } + else + nErr = ERRCODE_BASIC_PROC_UNDEFINED; + + pApp->LeaveBasicCall(); + return nErr; +} + + +sal_Bool SfxMacroConfig::IsMacroSlot( sal_uInt16 nId ) +{ + return ( nId >= SID_MACRO_START && nId <= SID_MACRO_END ); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/macro.cxx b/sfx2/source/control/macro.cxx index 87879656021e..d14ac4b7790f 100644 --- a/sfx2/source/control/macro.cxx +++ b/sfx2/source/control/macro.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,181 +46,87 @@ SV_IMPL_PTRARR( SfxStatements_Impl, SfxMacroStatement* ); struct SfxMacro_Impl -/* [Beschreibung] +/* [Description] - Implementations-Struktur der Klasse <SfxMacro>. + Implementation structure for the <SfxMacro> class. */ { - SfxMacroMode eMode; /* Zweck der <SfxMacro>-Instanz, - Bedeutung siehe enum <SfxMacroMode> */ - SfxStatements_Impl aList; /* Liste von aufgezeichneten Statements */ + SfxMacroMode eMode; /* purpose of the <SfxMacro> instance, + for meaning see enum <SfxMacroMode> */ + SfxStatements_Impl aList; /* List of recorded Statements */ }; //==================================================================== SfxMacroStatement::SfxMacroStatement ( - const SfxShell& /*rShell*/, // <SfxShell>, die den Request ausf"uhrte - const String& /*rTarget*/, // Name des Zielobjektes vor der Ausf"urhung - sal_Bool /*bAbsolute*/, // obsolet - const SfxSlot& rSlot, // der <SfxSlot>, der das Statement abspielen kann - sal_Bool bRequestDone, // wurde der Request tats"achlich ausgef"uhrt + const SfxShell& /*rShell*/, // <SfxShell> which excexutes the Request + const String& /*rTarget*/, // Name of the target object for the + // excecution + sal_Bool /*bAbsolute*/, // obsolete + const SfxSlot& rSlot, // the <SfxSlot>, which can read the + // statement + sal_Bool bRequestDone, // Was the Request really excecuted ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rArgs ) -/* [Beschreibung] +/* [Description] - Dieser Konstruktor der Klasse SfxMacroStatement erzeugt ein Statement, - bei dem ein Objekt angesprochen wird, welches durch 'rShell' angegeben - ist. Dabei erfolgt die Addressierung je nach 'bAbsolute' absolut, - also z.B. als '[mydoc.sdc]' oder relativ, also z.B. 'ActiveDocument'. + This constructor of the SfxMacroStatement class generates a statement in + which an object is brought up, which is given by 'rShell'. Thus It is + addressing the always after 'bAbsolute' absolute, for example, as + '[mydoc.sdc]', or relative, that is 'active document'. - Je nach Art der Subklasse von 'rShell' ergeben sich folgende - Ausdr"ucke: + Depending on the subclass of 'rShell', the following terms: - | absolut relativ + | absolute relative ----------------------------------------------------------------------- SfxApplication' | 'StarCalc' 'Application' SfxViewFrame' | '[mydoc.sdc:1]' 'ActiveWindow' SfxViewShell' | '[mydoc.sdc:1]' 'AvtiveWindow' SfxObjectShell' | '[mydoc.sdc]' 'ActiveDocument' - sonstige (Sub-Shells) | '[mydoc.sdc:1]' 'ActiveWindow' + Other (Sub-Shells) | '[mydoc.sdc:1]' 'ActiveWindow' - Dabei sind 'StarCalc' stellvertretend fuer den Namen der Applikation - (Application::GetAppName()const). In der absoluten Fassung k"onnte - die Selektion auch deskriptiv z.B. als 'CellSelection("A5-D8")') - angesprochen werden, dazu mu\ jedoch vom Anwendungsprogrammierer der - Konstruktor <SfxMacroStatement::SfxMacroStatement(const String&, - const SfxSlot&,sal_Bool,SfxArguments*)> verwendet werden. + Thus 'StarCalc' is a proxy for the name of the application + (Application::GetAppName()const). In the absolute sense of the selection + could be addressed as descriptive as in 'cell selection ("A5-D8")'), to do this + the application programmer must however use the constructor + <SfxMacroStatement::SfxMacroStatement(const String&, + const SfxSlot&,sal_Bool,SfxArguments*)>. - F"ur das so bezeichnete Objekt wird dann je nach Typ des Slots - eine Zuweisung an eines seiner Properties oder der Aufruf einer seiner - Methoden ausgedr"uckt. + For the so-called object is then, depending on the type of slots, + expressed as an assignment to one of its properties or calling its methods. + [Example] - [Beispiele] - - absolut: + absolute: SCalc3.OpenDocument( "\docs\mydoc.sdd", "StarDraw Presentation", 0, 0 ) [mydoc.sdd].Activate() [mydoc.sdd:1].SwitchToView( 2 ) [mydoc.sdc:1:1].CellSelection( "A5-D8" ).LineColor = 192357 - relativ: + relative: ActiveWindow.LineColor = 192357 - - [Querverweise] + [Cross-reference] <SfxMacroStatement::SfxMacroStatement(const String&,const SfxSlot&,sal_Bool,SfxArguments*)> <SfxMacroStatement::SfxMacroStatement(const String&)> */ -: nSlotId( rSlot.GetSlotId() ), +: nSlotId( rSlot.GetSlotId() ), aArgs( rArgs ), bDone( bRequestDone ), pDummy( 0 ) { - // Workaround Recording nicht exportierter Slots (#25386#) + // Workaround Recording non exported Slots if ( !rSlot.pName ) return; -/* - // Objekt-Typ bestimmen - bool bIsApp = rShell.ISA(SfxApplication); - bool bIsDoc = rShell.ISA(SfxObjectShell); - bool bIsWin = !bIsApp && !bIsDoc && - ( rShell.ISA(SfxViewShell) || rShell.ISA(SfxViewFrame) ); - bool bIsSel = !bIsApp && !bIsDoc && !bIsWin; - - // Objekt nicht schon im Slot-Namen enthalten? - if ( bIsSel || rSlot.pName[0] == '.' ) - { - // absolutes Aufzeichnen? - if ( rSlot.IsMode( SFX_SLOT_RECORDABSOLUTE ) ) - { - // an der Applikation oder am Modul - if ( rShell.ISA(SfxApplication) || rShell.ISA(SfxModule) ) - aStatement = rTarget; - - // am Dokument? - // '[' = 5Bh - // ']' = 5Dh - else if ( rShell.ISA(SfxObjectShell) ) - { - aStatement = 0x005B; - aStatement += rTarget; - aStatement += 0x005D; - } - - else if ( rShell.ISA(SfxViewFrame) ) - { - aStatement = 0x005B; - aStatement += String::CreateFromAscii("ViewFrame");//rShell.GetSbxObject()->GetName(); - aStatement += 0x005D; - } - - else - { - // an der View oder Sub-Shell - SfxViewShell *pViewShell = rShell.GetViewShell(); - aStatement = 0x005B; - aStatement += String::CreateFromAscii("ViewShell");//pViewShell->GetViewFrame()->GetSbxObject()->GetName(); - aStatement += 0x005D; - if ( !rShell.ISA(SfxViewFrame) ) - // an einer Sub-Shell zus"atlich ".Selection" anh"angen - aStatement += DEFINE_CONST_UNICODE(".Selection"); - } - } - else // relatives Aufzeichnen - { - // an der Application? - if ( rShell.ISA(SfxApplication) ) - aStatement = DEFINE_CONST_UNICODE("Application"); - - // am Modul? - else if ( rShell.ISA(SfxModule) ) - aStatement = DEFINE_CONST_UNICODE("ActiveModule"); - - // am Dokument - else if ( rShell.ISA(SfxObjectShell) ) - aStatement = DEFINE_CONST_UNICODE("ActiveDocument"); - - // am Window - else if ( rShell.ISA(SfxViewShell) || rShell.ISA(SfxViewFrame) ) - aStatement = DEFINE_CONST_UNICODE("ActiveWindow"); - - else - // an einer Sub-Shell - aStatement = DEFINE_CONST_UNICODE("Selection"); - } - } - if ( bIsSel ) - { - // bei Selection ggf. noch den Namen der SubShell anh"angen - const SfxShellObject *pShObj = - (const SfxShellObject*) rShell.GetSbxObject(); - if ( pShObj ) - { - const SfxShellObject *pParentObj = - (const SfxShellObject*) pShObj->GetParent(); - SfxShell *pParentSh = pParentObj->GetShell(); - DBG_ASSERT( pParentSh->ISA(SfxViewFrame), - "parent of SubShell must be a Frame" ); - if ( rSlot.pName[0] == '.' ) - { - aStatement += '.'; - aStatement += rShell.GetSbxObject()->GetName(); - } - } - else - DBG_ASSERT( rSlot.pName[0] != '0', "recording unnamed object" ); - } -*/ aStatement = DEFINE_CONST_UNICODE("Selection"); - // an diesen Objekt-Ausdruck den Methoden-/Property-Namen und Parameter + // to these object expression of the Method-/Property-Name and parameters GenerateNameAndArgs_Impl( SfxRequest::GetRecordingMacro(), rSlot, bRequestDone, aArgs); } @@ -227,22 +134,22 @@ SfxMacroStatement::SfxMacroStatement SfxMacroStatement::SfxMacroStatement ( - const String& rTarget, // Objekt, was beim Playing angesprochen wird - const SfxSlot& rSlot, // der <SfxSlot>, der das Statement abspielen kann - sal_Bool bRequestDone, // wurde der Request tats"achlich ausgef"uhrt + const String& rTarget, // The Object which is addressed while playing + const SfxSlot& rSlot, // The <SfxSlot>, which can playback the statement + sal_Bool bRequestDone, // was the Request actually performed ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rArgs ) -/* [Beschreibung] +/* [Description] - [Querverweise] + [Cross-reference] <SfxMacroStatement::SfxMacroStatement(const String&)> <SfxMacroStatement::SfxMacroStatement(const SfxShell&,sal_Bool,const SfxSlot&,sal_Bool,SfxArguments*)> */ -: nSlotId( rSlot.GetSlotId() ), +: nSlotId( rSlot.GetSlotId() ), aArgs( rArgs ), bDone( bRequestDone ), pDummy( 0 ) @@ -256,25 +163,24 @@ SfxMacroStatement::SfxMacroStatement SfxMacroStatement::SfxMacroStatement ( - const String& rStatement // manuell erzeugte(s) Statement(s) + const String& rStatement // manually generated statement(s) ) -/* [Beschreibung] - - Dieser Konstruktor erzeugt eine SfxMacroStatement-Instanz, deren - Aufbau vollst"andig vom Applikationsentwickler bestimmt wird. Da der - angegebene String auch mehrere mit CR/LF getrennte Statements - enthalten darf, ist damit ein weitgehender Eingriff in das Aufzeichnen - von BASIC-Makros m"oglich, um Spezialf"alle zu behandeln. +/* [Description] + This constructor creates a SfxMacroStatement instance, its structure is + determined completely by the application developer. Because the specified + string may contain several statements separated with CR/LF, which enables + a extensive in the recording of BASIC-macros, in order to handle special + cases. - [Querverweise] + [Cross-reference] <SfxMacroStatement::SfxMacroStatement(const String&,const SfxSlot&,sal_Bool,SfxArguments*)> <SfxMacroStatement::SfxMacroStatement(const SfxShell&,sal_Bool,const SfxSlot&,sal_Bool,SfxArguments*)> */ -: nSlotId( 0 ), +: nSlotId( 0 ), aStatement( rStatement ), bDone( sal_True ), pDummy( 0 ) @@ -285,15 +191,15 @@ SfxMacroStatement::SfxMacroStatement SfxMacroStatement::SfxMacroStatement ( - const SfxMacroStatement& rOrig // Original, von dem kopiert wird + const SfxMacroStatement& rOrig // Original, from which it will be copied ) -/* [Beschreibung] +/* [Description] - Copy-Konstruktor der SfxMacroStatement-Klasse. + Copy constructor of the sSfxMacroStatement class. */ -: nSlotId( rOrig.nSlotId ), +: nSlotId( rOrig.nSlotId ), aStatement( rOrig.aStatement ), bDone( rOrig.bDone ), pDummy( 0 ) @@ -305,10 +211,10 @@ SfxMacroStatement::SfxMacroStatement SfxMacroStatement::~SfxMacroStatement() -/* [Beschreibung] +/* [Description] - Destruktor der Klasse SfxMacroStatement. Gibt die Liste der - aktuellen Parameter frei. + Destructor of the SfxMacroStatement class. Frees the list of the + current parameters. */ { @@ -318,18 +224,17 @@ SfxMacroStatement::~SfxMacroStatement() void SfxMacroStatement::GenerateNameAndArgs_Impl ( - SfxMacro* /*pMacro*/, // darin wird aufgezeichnet - const SfxSlot& rSlot, // der Slot, der das Statement abspielen kann - sal_Bool bRequestDone, // sal_True=wurde ausgef"uhrt, sal_False=abgebrochen + SfxMacro* /*pMacro*/, // in this is recorded + const SfxSlot& rSlot, // the slot, which can playback the statement + sal_Bool bRequestDone, // TRUE=was executed, FALSE=cancelled ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& /*rArgs*/ ) -/* [Beschreibung] +/* [Description] - Interne Hilfsmethode zum generieren des Funktions-/Property-Names - sowie der Parameter. Diese Methode wird nur verwendet, wenn der - Anwendungsprogrammierer keinen eigenen Source an den <SfxRequest> - geh"angt hat. + Internal utility method for generating the functions-/property-names as + well as the parameter. This method is only used if the application + programmer has not attached his own source to the <SfxRequest>. */ { @@ -337,18 +242,18 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl && rSlot.pName[0] != '.' ) aStatement += '.'; - // der Name des Slots ist der Name der Methode / des Properties + // The name of the slots is the name of the method or properties aStatement += String::CreateFromAscii(rSlot.pName); if ( rSlot.IsMode(SFX_SLOT_METHOD) ) aStatement += DEFINE_CONST_UNICODE("( "); else aStatement += DEFINE_CONST_UNICODE(" = "); - // alle zusammengesuchten Parameter rausschreiben + // Print all required Parameters if ( aArgs.getLength() ) for ( sal_uInt16 nArg = 0; nArg < aArgs.getLength(); ++nArg ) { - // den Parameter textuell darstellen + // represent the parameters textually String aArg; ::com::sun::star::uno::Any& rValue = aArgs[nArg].Value; ::com::sun::star::uno::Type pType = rValue.getValueType(); @@ -375,23 +280,23 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl ::rtl::OUString sTemp; rValue >>= sTemp; - // Anf"uhrungszeichen werden verdoppelt + // Quotation marks are doubled XubString aRecordable( sTemp ); sal_uInt16 nPos = 0; while ( sal_True ) { - nPos = aRecordable.SearchAndReplace( DEFINE_CONST_UNICODE('"'), DEFINE_CONST_UNICODE("\"\""), nPos ); + nPos = aRecordable.SearchAndReplace( String('"'), DEFINE_CONST_UNICODE("\"\""), nPos ); if ( STRING_NOTFOUND == nPos ) break; nPos += 2; } - // nicht druckbare Zeichen werden als chr$(...) geschrieben - bool bPrevReplaced = sal_False; + // non-printable characters are written as chr $(...) + bool bPrevReplaced = false; for ( sal_uInt16 n = 0; n < aRecordable.Len(); ++n ) { sal_Unicode cChar = aRecordable.GetChar(n); - if ( !( cChar>=32 && cChar!=127 ) ) // ALS ERSATZ FUER String::IsPrintable()! + if ( !( cChar>=32 && cChar!=127 ) ) // As replacement for String::IsPrintable()! { XubString aReplacement( DEFINE_CONST_UNICODE("+chr$(") ); aReplacement += cChar; @@ -402,7 +307,6 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl n = n + aReplacement.Len(); aRecordable.SetChar((unsigned short) (n-2), 0x0029);// ')' = 29h aRecordable.Replace( n-1, 2, DEFINE_CONST_UNICODE("+\"") ); - // ++n; } else { @@ -411,24 +315,16 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl aRecordable.Insert( aReplacement, n + 1 ); n = n + aReplacement.Len(); } - bPrevReplaced = sal_True; + bPrevReplaced = true; } else - bPrevReplaced = sal_False; + bPrevReplaced = false; - // Argument in Anf"uhrungszeichen + // Argument in quotation marks aArg = '"'; aArg += aRecordable; aArg += '"'; } -/* - case SbxBYTE: - { - // als Zahl darstellen - aArg = (sal_uInt16) rVar.GetByte(); - break; - } -*/ } else { @@ -436,12 +332,12 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl pType == ::getVoidCppuType(), "Unknown Type in recorder!" ); } - // den Parameter anh"angen + // Attach the parameter aStatement += aArg; aStatement += DEFINE_CONST_UNICODE(", "); } - // Statement beeden + // End statement if ( aArgs.getLength() ) aStatement.Erase( aStatement.Len() - 2, 1 ); else @@ -450,7 +346,7 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl aStatement += ')'; if ( !bRequestDone ) - // nicht als "Done()" gekennzeichnete Statements auskommentieren + // not comment out the "Done ()" marked statements aStatement.InsertAscii( "rem ", 0 ); } @@ -458,29 +354,28 @@ void SfxMacroStatement::GenerateNameAndArgs_Impl SfxMacro::SfxMacro ( - SfxMacroMode eMode // Zweck der Instanz, siehe <SfxMacroMode> + SfxMacroMode eMode // Purpose of the instance, see <SfxMacroMode> ) -/* [Beschreibung] +/* [Description] - Konstruktor der Klasse SfxMacro. Instanzen dieser Klasse werden im - SFx zu zwei Zwecken ben"otigt: + Constructor of the SfxMacro class. Instances of this class are required + for two purposes in SFx: - 1. zum Aufzeichnen von Makros - In diesem Fall wird der Konstruktor mit SFX_MACRO_RECORDINGABSOLUTE - oder SFX_MACRO_RECORDINGRELATIVE aufgerufen. Es sollte sich um eine - Instanz einer abgeleiteten Klasse handeln, um in der Ableitung - die Information dar"uber unterzubringen, wo das Makro gespeichert - werden soll. Ein solches Makro solle sich dann in seinem Destruktor - an der vom Benutzer gew"ahlten Stelle speichern. + 1. for recording macros + In this cas is th constructor called with SFX_MACRO_RECORDINGABSOLUTE or + SFX_MACRO_RECORDINGRELATIVE. Should be an instance of a derived class, + in order to acommodate the derivation of information, where the macro + should be saved. Such a macro should, in its destructor, be saved at the + location specified by the user. - 2. zum Zuordnen von exisitierenden Makros - In diesem Fall wird der Konstruktor mit SFX_MACRO_EXISTING aufgerufen. - Eine solche Instanz wird z.B. ben"otigt, wenn Makros auf Events - oder <SfxControllerItem>s konfiguriert werden sollen. + 2. Assignment of exisiting macros + In this case the constructor is called with SFX_MACRO_EXISTING. + Such a instance is for example needed when macros are to be configured for + events or <SfxControllerItem>s. */ -: pImp( new SfxMacro_Impl ) +: pImp( new SfxMacro_Impl ) { pImp->eMode = eMode; @@ -490,15 +385,13 @@ SfxMacro::SfxMacro SfxMacro::~SfxMacro() -/* [Beschreibung] - - Virtueller Destruktor der Klasse SfxMacro. Dieser sollte in den - abgeleiteten Klassen "uberladen werden, um in den Modi - SFX_MACRO_RECORDINGABSOLUTE und SFX_MACRO_RECORDINGRELATIVE den - aufgezeichneten Source abzuspeichern. +/* [Description] + Virtual Destructor of the SfxMacro class. This should be overloaded in + the derived classes to save the recorded source in the mode + SFX_MACRO_RECORDINGABSOLUTE and SFX_MACRO_RECORDINGRELATIVE. - [Querverweise] + [Cross-reference] <SfxMacro::GenerateSource()const> */ @@ -515,13 +408,12 @@ SfxMacro::~SfxMacro() SfxMacroMode SfxMacro::GetMode() const -/* [Beschreibung] - - Liefert den Modus, der besagt zu welchem Zweck das SfxMacro konstruiert - wurde. +/* [Description] + Returns the mode, which indicates for what purpose this SfxMacro was + constructed. - [Querverweise] + [Cross-reference] enum <SfxMacroMode> */ @@ -534,21 +426,20 @@ SfxMacroMode SfxMacro::GetMode() const void SfxMacro::Record ( - SfxMacroStatement* pStatement // aufzuzeichnendes <SfxMacroStatement> + SfxMacroStatement* pStatement // the recordning <SfxMacroStatement> ) -/* [Beschreibung] +/* [Description] - Diese Methode zeichnet das als Parameter "ubergeben Statement auf. - Die Instanz auf die der "ubergebe Pointer zeigt, geht in das Eigentum - des SfxMacro "uber. + This method features the parameters passed on as a Statement. The + instance to which the pointer points is transfered to the ownership + of SfxMacro. - Der Aufruf ist nur g"ultig, wenn es sich um ein SfxMacro handelt, - welches mit SFX_MACRO_RECORDINGABSOLUTE oder SFX_MACRO_RECORDINGRELATIVE - konstruiert wirde. + The call is only valid if it is about a SfxMacro, which was constructed + with SFX_MACRO_RECORDINGRELATIVE or SFX_MACRO_RECORDINGABSOLUTE and is + available as an already recorded statement. - - [Querverweise] + [Cross-reference] <SfxMacro::Replace(SfxMacroStatement*)> <SfxMacro::Remove()> @@ -564,35 +455,30 @@ void SfxMacro::Record void SfxMacro::Replace ( - SfxMacroStatement* pStatement // aufzuzeichnendes <SfxMacroStatement> + SfxMacroStatement* pStatement // the recording <SfxMacroStatement> ) -/* [Beschreibung] - - Diese Methode zeichnet das als Parameter "ubergeben Statement auf. - Dabei wird das jeweils zuletzt aufgezeichnete Statement "uberschrieben. - Die Instanz auf die der "ubergebe Pointer zeigt, geht in das Eigentum - des SfxMacro "uber. +/* [Description] - Mit dieser Methode ist es m"oglich, Statements zusammenzufassen. Z.B. - anstelle f"unfmal hintereinander 'CursorLeft()' aufzurufen, k"onnte - das zu 'CursorLeft(5)' zusammengefa\st werden. Oder anstelle ein Wort - Buchstabe f"ur Buchstabe aufzubauen, k"onnte dies durch ein einziges - Statement 'InsertString("Hallo")' ersetzt werden. + This method records the statement passed on as a parameter. This will + overwrite the last recorded statement. The instance to which the passed + pointer points is transfered to the ownership of the SfxMacro. - Der Aufruf ist nur g"ultig, wenn es sich um ein SfxMacro handelt, - welches mit SFX_MACRO_RECORDINGABSOLUTE oder SFX_MACRO_RECORDINGRELATIVE - konstruiert wurde und bereits ein aufgezeichnetes Statement vorhanden - ist. + With this method it is possible to combine statements. For example, instead + of calling the 'CursorLeft()' five times could be summarized as + 'CursorLeft (5)'. Or rather than building a word letter by letter, this + could be done by a single statement 'InsertString("Hello")'. + The call is only valid if it is about a SfxMacro, which was constructed + with SFX_MACRO_RECORDINGRELATIVE or SFX_MACRO_RECORDINGABSOLUTE and is + available as an already recorded statement. - [Anmerkung] + [Note] - Diese Methode wird typischerweise aus den Execute-Methoden der - <SfxSlot>s von den Applikationsentwicklern gerufen. + This method is typically called from the execute methods of + <SfxSlot>s created by the application developers. - - [Querverweise] + [Cross-reference] <SfxMacro::Record(SfxMacroStatement*)> <SfxMacro::Remove()> @@ -610,30 +496,26 @@ void SfxMacro::Replace void SfxMacro::Remove() -/* [Beschreibung] - - Diese Methode l"oscht das zuletzt aufgezeichnete <SfxMacroStatement> - und entfernt es aus dem Macro. - - Mit dieser Methode ist es m"oglich, Statements zusammenzufassen. Z.B. - anstelle f"unfmal hintereinander 'CursorLeft()' aufzurufen, k"onnte - das zu 'CursorLeft(5)' zusammengefa\st werden. Oder anstelle ein Wort - Buchstabe f"ur Buchstabe aufzubauen, k"onnte dies durch ein einziges - Statement 'InsertString("Hallo")' ersetzt werden. +/* [Description] - Der Aufruf ist nur g"ultig, wenn es sich um ein SfxMacro handelt, - welches mit SFX_MACRO_RECORDINGABSOLUTE oder SFX_MACRO_RECORDINGRELATIVE - konstruiert wurde und bereits ein aufgezeichnetes Statement vorhanden - ist. + This method deletes the last recorded <SfxMacroStatement> and removes + it from the macro. + With this method it is possible to combine statements. For example, instead + of calling the 'CursorLeft()' five times could be summarized as + 'CursorLeft (5)'. Or rather than building a word letter by letter, this + could be done by a single statement 'InsertString("Hello")'. - [Anmerkung] + The call is only valid if it is about a SfxMacro, which was constructed + with SFX_MACRO_RECORDINGRELATIVE or SFX_MACRO_RECORDINGABSOLUTE and is + available as an already recorded statement. - Diese Methode wird typischerweise aus den Execute-Methoden der - <SfxSlot>s von den Applikationsentwicklern gerufen. + [Note] + This method is typically called from the the Execute methods of <SfxSlot>s + by the application developer. - [Querverweise] + [Cross-reference] <SfxMacro::Replace(SfxMacroStatement*)> <SfxMacro::Record(SfxMacroStatement*)> @@ -650,19 +532,17 @@ void SfxMacro::Remove() const SfxMacroStatement* SfxMacro::GetLastStatement() const -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann auf das jeweils zuletzt aufgezeichnete Statement - lesend zugegriffen werden. Zusammen mit der Methode - <SfxMacro::Replace(SfxMacroStatement*)> ergibt sich dadurch die - M"oglichkeit, Statements zusammenzufassen. + This method enables read access to the last recorded statement. + Together with the method <SfxMacro::Replace(SfxMacroStatement*)> this opens + for the possibility to summarize statements. - Der Aufruf ist nur g"ultig, wenn es sich um ein SfxMacro handelt, - welches mit SFX_MACRO_RECORDINGABSOLUTE oder SFX_MACRO_RECORDINGRELATIVE - konstruiert wurde. + The call is only valid if it is about a SfxMacro, which was constructed + with SFX_MACRO_RECORDINGRELATIVE or SFX_MACRO_RECORDINGABSOLUTE and is + available as an already recorded statement. - - [Querverweise] + [Cross-reference] <SfxMacro::Record(SfxMacroStatement*)> <SfxMacro::Replace(SfxMacroStatement*)> @@ -679,15 +559,14 @@ const SfxMacroStatement* SfxMacro::GetLastStatement() const String SfxMacro::GenerateSource() const -/* [Beschreibung] - - Diese Funktion generiert aus den, seit dem Konstruieren der Instanz - bis zum Zeitpunkt des Aufrufs dieser Methode aufgezeichneten - <SfxMacroStatement>s einen BASIC-Sourcecode, der die Statements, - jedoch nicht den Header ('Sub X') und den Footer ('End Sub') enth"alt. +/* [Description] + This function generates BASIC source code that contains the statements, but + does not contain the header ('Sub X') and Footer ('End Sub') from recorded + <SfxMacroStatement> since the construction of the instance until the time + of calling this method. - [Querverweise] + [Cross-reference] <SfxMacro::Record(SfxMacroStatement*)> <SfxMacro::Repeat(SfxMacroStatement*)> @@ -706,3 +585,4 @@ String SfxMacro::GenerateSource() const return aSource; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/minfitem.cxx b/sfx2/source/control/minfitem.cxx index c5e46620a908..55c56c184b24 100644 --- a/sfx2/source/control/minfitem.cxx +++ b/sfx2/source/control/minfitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,7 +57,7 @@ SfxMacroInfoItem::SfxMacroInfoItem( // ----------------------------------------------------------------------- -// copy ctor +// copy constructor SfxMacroInfoItem::SfxMacroInfoItem(const SfxMacroInfoItem& rCopy): SfxPoolItem(rCopy), @@ -102,3 +103,4 @@ String SfxMacroInfoItem::GetQualifiedName() const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx index ffedd2632770..119b186f112b 100644 --- a/sfx2/source/control/msg.cxx +++ b/sfx2/source/control/msg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,7 @@ SfxSlotKind SfxSlot::GetKind() const return (SfxSlotKind) SFX_KIND_ENUM; else { - DBG_ERROR( "invalid slot kind detected" ); + OSL_FAIL( "invalid slot kind detected" ); return SFX_KIND_ENUM; } } @@ -73,3 +74,4 @@ sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const return rtl::OUString( aCmd, aCmd.getLength(), RTL_TEXTENCODING_UTF8 ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx index 9cda943c8509..b2afa3dc1e22 100644 --- a/sfx2/source/control/msgpool.cxx +++ b/sfx2/source/control/msgpool.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,10 +30,8 @@ #include "precompiled_sfx2.hxx" #include <tools/stream.hxx> #include <rsc/rscsfx.hxx> -#ifndef GCC -#endif -// wg. pSlotPool +// due to pSlotPool #include "appdata.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/minarray.hxx> @@ -48,13 +47,6 @@ //==================================================================== -struct SfxSIDRegistration_Impl -{ - String _aGroup; - String _aName; - sal_uInt16 _nSID; -}; - struct SfxSlotType_Impl { sal_uInt16 nId; @@ -105,7 +97,6 @@ SfxSlotPool::~SfxSlotPool() } //==================================================================== - // registers the availability of the Interface of functions void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) @@ -117,8 +108,8 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) _pInterfaces = new SfxInterfaceArr_Impl; _pInterfaces->Append(&rInterface); - // bei einem (einzelnen) Null-Slot abbrechen (aus syntaktischen Gr"unden - // enthalten interfaces immer mindestens einen Slot) + // Stop at a (single) Null-slot (for syntactic reasons the interfaces + // always contain at least one slot) if ( rInterface.Count() == 1 && !rInterface[0]->nSlotId ) return; @@ -129,7 +120,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) if ( _pParentPool ) { - // Die Groups im parent Slotpool sind auch hier bekannt + // The Groups in parent Slotpool are also known here SfxSlotGroupArr_Impl& rGroups = *_pParentPool->_pGroups; for ( sal_uInt16 n=0; n<rGroups.Count(); n++ ) _pGroups->Append( rGroups[n] ); @@ -149,26 +140,6 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) else _pGroups->Append(pDef->GetGroupId()); } -#if 0 - const TypeId &rTypeId = pDef->GetType()->Type(); - if ( /*rTypeId != TYPE(SfxVoidItem) &&*/ rTypeId != 0 ) - { - sal_uInt16 nPos; - for ( nPos = 0; nPos < _pTypes->Count(); ++nPos ) - { - if ( _pTypes->GetObject(nPos)->nId == pDef->GetSlotId() ) - { - DBG_ASSERT( rTypeId == _pTypes->GetObject(nPos)->nType, - "same slot id with unequal item types" ); - } - else if ( _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) - break; - } - if ( nPos >= _pTypes->Count() || - _pTypes->GetObject(nPos)->nId > pDef->GetSlotId() ) - _pTypes->Append( new SfxSlotType_Impl( pDef->GetSlotId(), rTypeId ) ); - } -#endif } } @@ -178,18 +149,9 @@ TypeId SfxSlotPool::GetSlotType( sal_uInt16 nId ) const { const SfxSlot* pSlot = (const_cast <SfxSlotPool*> (this))->GetSlot( nId ); return pSlot ? pSlot->GetType()->Type() : 0; -/* - for ( sal_uInt16 nPos = 0; nPos < _pTypes->Count(); ++nPos ) - { - if ( _pTypes->GetObject(nPos)->nId == nId ) - return _pTypes->GetObject(nPos)->nType; - } - return _pParentPool ? _pParentPool->GetSlotType( nId ) : 0; - */ } //==================================================================== - // unregisters the availability of the Interface of functions void SfxSlotPool::ReleaseInterface( SfxInterface& rInterface ) @@ -209,7 +171,7 @@ const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId ) DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Zun"achst die eigenen Interfaces absuchen + // First, search their own interfaces for ( sal_uInt16 nInterf = 0; nInterf < _pInterfaces->Count(); ++nInterf ) { const SfxSlot *pDef = _pInterfaces->GetObject(nInterf)->GetSlot(nId); @@ -217,7 +179,7 @@ const SfxSlot* SfxSlotPool::GetSlot( sal_uInt16 nId ) return pDef; } - // Dann beim eventuell vorhandenen parent versuchen + // Then try any of the possible existing parent return _pParentPool ? _pParentPool->GetSlot( nId ) : 0; } @@ -236,15 +198,14 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo ) _nCurGroup = nNo; if ( _pParentPool ) { - // Meistens stimmt die Reihenfolge der Ids "uberein + // In most cases, the order of the IDs agree sal_uInt16 nParentCount = _pParentPool->_pGroups->Count(); if ( nNo < nParentCount && (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[nNo] ) _pParentPool->_nCurGroup = nNo; else { - // Ansonsten mu\s gesucht werden - // Wenn die Gruppe im parent pool nicht gefunden wird, wird - // _nCurGroup au\serhalb des g"ultigen Bereiches gesetzt + // Otherwise search. If the group is not found in the parent + // pool, _nCurGroup is set outside the valid range sal_uInt16 i; for ( i=1; i<nParentCount; i++ ) if ( (*_pGroups)[nNo] == (*_pParentPool->_pGroups)[i] ) @@ -257,7 +218,7 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo ) aResId.SetRT(RSC_STRING); if ( !aResId.GetResMgr()->IsAvailable(aResId) ) { - DBG_ERROR( "GroupId-Name nicht im SFX definiert!" ); + OSL_FAIL( "GroupId-Name not defined in SFX!" ); return String(); } @@ -285,18 +246,18 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface ) DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Die Numerierung der interfaces startet beim parent pool + // The numbering starts at the interfaces of the parent pool sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; - // sind wir am Ende des Parent-Pools angekommen? + // have reached the end of the Parent-Pools? if ( nStartInterface < nFirstInterface && _pParentPool->_nCurGroup >= _pParentPool->_pGroups->Count() ) nStartInterface = nFirstInterface; - // liegt das Interface noch im Parent-Pool? + // Is the Interface still in the Parent-Pool? if ( nStartInterface < nFirstInterface ) { - DBG_ASSERT( _pParentPool, "Kein parent pool!" ); + DBG_ASSERT( _pParentPool, "No parent pool!" ); _nCurInterface = nStartInterface; return _pParentPool->SeekSlot( nStartInterface ); } @@ -322,7 +283,6 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface ) } //-------------------------------------------------------------------- - // skips to the next func in the current group const SfxSlot* SfxSlotPool::NextSlot() @@ -330,7 +290,7 @@ const SfxSlot* SfxSlotPool::NextSlot() DBG_MEMTEST(); DBG_ASSERT( _pInterfaces != 0, "no Interfaces registered" ); - // Die Numerierung der interfaces startet beim parent pool + // The numbering starts at the interfaces of the parent pool sal_uInt16 nFirstInterface = _pParentPool ? _pParentPool->_pInterfaces->Count() : 0; if ( _nCurInterface < nFirstInterface && _nCurGroup >= _pParentPool->_pGroups->Count() ) @@ -338,13 +298,13 @@ const SfxSlot* SfxSlotPool::NextSlot() if ( _nCurInterface < nFirstInterface ) { - DBG_ASSERT( _pParentPool, "Kein parent pool!" ); + DBG_ASSERT( _pParentPool, "No parent pool!" ); const SfxSlot *pSlot = _pParentPool->NextSlot(); _nCurInterface = _pParentPool->_nCurInterface; if ( pSlot ) return pSlot; if ( _nCurInterface == nFirstInterface ) - // parent pool ist fertig + // parent pool is ready return SeekSlot( nFirstInterface ); } @@ -367,9 +327,7 @@ const SfxSlot* SfxSlotPool::NextSlot() //-------------------------------------------------------------------- - -// SlotName erfragen, gfs. mit HilfeText - +// Query SlotName with help text //-------------------------------------------------------------------- SfxInterface* SfxSlotPool::FirstInterface() @@ -419,3 +377,4 @@ SfxSlotPool& SfxSlotPool::GetSlotPool( SfxViewFrame *pFrame ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index f73a7f4acf4b..6570a27b956e 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,6 @@ #include <stdlib.h> #include <tools/rcid.h> -#ifndef GCC -#endif #include <tools/stream.hxx> #include <sfx2/module.hxx> @@ -48,15 +47,11 @@ DBG_NAME(SfxInterface) //==================================================================== EXTERN_C -#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC )) -int _stdcall -#else #ifdef WNT int _cdecl #else int #endif -#endif SfxCompareSlots_Impl( const void* pSmaller, const void* pBigger ) { @@ -131,7 +126,7 @@ static SfxObjectUI_Impl* CreateObjectBarUI_Impl( sal_uInt16 nPos, const ResId& r //==================================================================== //==================================================================== -// ctor, registeres a new unit +// constuctor, registeres a new unit SfxInterface::SfxInterface( const char *pClassName, const ResId& rNameResId, @@ -175,17 +170,14 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) sal_uInt16 nIter = 1; for ( pIter = pSlots; nIter <= nCount; ++pIter, ++nIter ) { - //! hier bitte sinnvoll pruefen - //! DBG_ASSERT(!(pIter->IsMode(SFX_SLOT_CACHABLE) && - //! pIter->IsMode(SFX_SLOT_VOLATILE)), - //! "invalid Flags" ); + DBG_ASSERT( nIter == nCount || pIter->GetSlotId() != (pIter+1)->GetSlotId(), "doppelte SID" ); - // jeder Master verweist auf seinen ersten Slave (ENUM), alle - // Slaves auf ihren Master. - // Slaves verweisen im Ring auf die anderen mit gleichem Master + // every master refers to his first slave (ENUM), + // all slaves refer to their master. + // Slaves refer in a circle to the other slaves with the same master if ( pIter->GetKind() == SFX_KIND_ENUM ) { pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId ); @@ -210,7 +202,8 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) } else if ( 0 == pIter->GetNextSlot() ) { - // Slots verweisen im Ring auf den n"achten mit derselben Statusmethode + // Slots refering in circle to the next with the same + // Status method. SfxSlot *pLastSlot = pIter; for ( sal_uInt16 n = nIter; n < Count(); ++n ) { @@ -233,7 +226,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) { if ( pNext->GetSlotId() <= pIter->GetSlotId() ) - DBG_ERROR ("Falsche Reihenfolge!"); + OSL_FAIL("Wrong order!"); if ( pIter->GetKind() == SFX_KIND_ENUM ) { @@ -244,20 +237,20 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) { if ( pSlave->pLinkedSlot != pMasterSlot ) { - ByteString aStr("Falsche Master/Slave-Verkettung : "); + ByteString aStr("Wrong Master/Slave- link: "); aStr += ByteString::CreateFromInt32(pMasterSlot->GetSlotId()); aStr += " , "; aStr += ByteString::CreateFromInt32(pSlave->GetSlotId()); - DBG_ERROR(aStr.GetBuffer()); + OSL_FAIL(aStr.GetBuffer()); } if ( pSlave->nMasterSlotId != pMasterSlot->GetSlotId() ) { - ByteString aStr("Falsche Master/Slave-Ids : "); + ByteString aStr("Wrong Master/Slave-Ids: "); aStr += ByteString::CreateFromInt32(pMasterSlot->GetSlotId()); aStr += " , "; aStr += ByteString::CreateFromInt32(pSlave->GetSlotId()); - DBG_ERROR(aStr.GetBuffer()); + OSL_FAIL(aStr.GetBuffer()); } pSlave = pSlave->pNextSlot; @@ -270,11 +263,11 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) { if ( pIter->pLinkedSlot->GetKind() != SFX_KIND_ENUM ) { - ByteString aStr("Slave ist kein enum : "); + ByteString aStr("Slave is no enum: "); aStr += ByteString::CreateFromInt32(pIter->GetSlotId()); aStr += " , "; aStr += ByteString::CreateFromInt32(pIter->pLinkedSlot->GetSlotId()); - DBG_ERROR(aStr.GetBuffer()); + OSL_FAIL(aStr.GetBuffer()); } } @@ -284,11 +277,11 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) pCurSlot = pCurSlot->pNextSlot; if ( pCurSlot->GetStateFnc() != pIter->GetStateFnc() ) { - ByteString aStr("Verkettete Slots mit verschiedenen StateMethods : "); + ByteString aStr("Linked Slots with different State Methods : "); aStr += ByteString::CreateFromInt32(pCurSlot->GetSlotId()); aStr += " , "; aStr += ByteString::CreateFromInt32(pIter->GetSlotId()); - DBG_ERROR(aStr.GetBuffer()); + OSL_FAIL(aStr.GetBuffer()); } } while ( pCurSlot != pIter ); @@ -300,11 +293,8 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) #endif } - //-------------------------------------------------------------------- - - SfxInterface::~SfxInterface() { SfxModule *pMod = pImpData->pModule; @@ -324,7 +314,6 @@ SfxInterface::~SfxInterface() // searches for the specified func - const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const { DBG_MEMTEST(); @@ -360,7 +349,6 @@ const SfxSlot* SfxInterface::GetSlot( const String& rCommand ) const //-------------------------------------------------------------------- - const SfxSlot* SfxInterface::GetRealSlot( const SfxSlot *pSlot ) const { DBG_MEMTEST(); @@ -371,7 +359,7 @@ const SfxSlot* SfxInterface::GetRealSlot( const SfxSlot *pSlot ) const { if(pGenoType) return pGenoType->GetRealSlot(pSlot); - DBG_ERROR("fremder Slot"); + OSL_FAIL("unknown Slot"); return 0; } @@ -380,7 +368,6 @@ const SfxSlot* SfxInterface::GetRealSlot( const SfxSlot *pSlot ) const //-------------------------------------------------------------------- - const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const { DBG_MEMTEST(); @@ -392,7 +379,7 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const { if(pGenoType) return pGenoType->GetRealSlot(nSlotId); - DBG_ERROR("fremder Slot"); + OSL_FAIL("unkonown Slot"); return 0; } @@ -401,7 +388,6 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const //-------------------------------------------------------------------- - void SfxInterface::RegisterPopupMenu( const ResId& rResId ) { DBG_CHKTHIS(SfxInterface, 0); @@ -438,7 +424,7 @@ SfxObjectUI_Impl* CreateObjectBarUI_Impl( sal_uInt16 nPos, const ResId& rResId, aResId.SetResMgr(rResId.GetResMgr()); if( ! aResId.GetResMgr() ) aResId.SetResMgr( SfxApplication::GetOrCreate()->GetOffResManager_Impl() ); - if ( !aResId.GetResMgr()->IsAvailable(aResId) ) + if ( !aResId.GetResMgr() || !aResId.GetResMgr()->IsAvailable(aResId) ) pUI->pName = new String (DEFINE_CONST_UNICODE("NoName")); else pUI->pName = new String(aResId); @@ -454,10 +440,10 @@ const ResId& SfxInterface::GetObjectBarResId( sal_uInt16 nNo ) const sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName()); if ( bGenoType ) { - // Gibt es Toolbars in der Superklasse ? + // Are there toolbars in the super class? sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetObjectBarResId( nNo ); else nNo = nNo - nBaseCount; @@ -465,7 +451,7 @@ const ResId& SfxInterface::GetObjectBarResId( sal_uInt16 nNo ) const #ifdef DBG_UTIL sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); - DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" ); + DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif return (*pImpData->pObjectBars)[nNo]->aResId; } @@ -478,10 +464,10 @@ sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName()); if ( bGenoType ) { - // Gibt es Toolbars in der Superklasse ? + // Are there toolbars in the super class? sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetObjectBarPos( nNo ); else nNo = nNo - nBaseCount; @@ -489,7 +475,7 @@ sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const #ifdef DBG_UTIL sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); - DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" ); + DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif return (*pImpData->pObjectBars)[nNo]->nPos; } @@ -528,10 +514,10 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const { if ( pGenoType ) { - // Gibt es ChildWindows in der Superklasse ? + // Are there ChildWindows in der Superklasse? sal_uInt16 nBaseCount = pGenoType->GetChildWindowCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetChildWindowId( nNo ); else nNo = nNo - nBaseCount; @@ -539,7 +525,7 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const #ifdef DBG_UTIL sal_uInt16 nCWCount = pImpData->pChildWindows->Count(); - DBG_ASSERT( nNo<nCWCount,"ChildWindow ist unbekannt!" ); + DBG_ASSERT( nNo<nCWCount,"ChildWindow is unknown!" ); #endif sal_uInt32 nRet = (*pImpData->pChildWindows)[nNo]->aResId.GetId(); if ( (*pImpData->pChildWindows)[nNo]->bContext ) @@ -551,10 +537,10 @@ sal_uInt32 SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const { if ( pGenoType ) { - // Gibt es ChildWindows in der Superklasse ? + // Are there ChildWindows in der Superklasse? sal_uInt16 nBaseCount = pGenoType->GetChildWindowCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetChildWindowFeature( nNo ); else nNo = nNo - nBaseCount; @@ -562,7 +548,7 @@ sal_uInt32 SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const #ifdef DBG_UTIL sal_uInt16 nCWCount = pImpData->pChildWindows->Count(); - DBG_ASSERT( nNo<nCWCount,"ChildWindow ist unbekannt!" ); + DBG_ASSERT( nNo<nCWCount,"ChildWindow is unknown!" ); #endif return (*pImpData->pChildWindows)[nNo]->nFeature; } @@ -600,10 +586,10 @@ const String* SfxInterface::GetObjectBarName ( sal_uInt16 nNo ) const sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName()); if ( bGenoType ) { - // Gibt es Toolbars in der Superklasse ? + // Are there toolbars in the super class? sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetObjectBarName( nNo ); else nNo = nNo - nBaseCount; @@ -611,7 +597,7 @@ const String* SfxInterface::GetObjectBarName ( sal_uInt16 nNo ) const #ifdef DBG_UTIL sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); - DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" ); + DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif return (*pImpData->pObjectBars)[nNo]->pName; } @@ -621,10 +607,10 @@ sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName()); if ( bGenoType ) { - // Gibt es Toolbars in der Superklasse ? + // Are there toolbars in the super class? sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->GetObjectBarFeature( nNo ); else nNo = nNo - nBaseCount; @@ -632,7 +618,7 @@ sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const #ifdef DBG_UTIL sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); - DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" ); + DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif return (*pImpData->pObjectBars)[nNo]->nFeature; } @@ -642,10 +628,10 @@ sal_Bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName()); if ( bGenoType ) { - // Gibt es Toolbars in der Superklasse ? + // Are there toolbars in the super class? sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount(); if ( nNo < nBaseCount ) - // Die der Superklasse kommen zuerst + // The Super class comes first return pGenoType->IsObjectBarVisible( nNo ); else nNo = nNo - nBaseCount; @@ -653,7 +639,7 @@ sal_Bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const #ifdef DBG_UTIL sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count(); - DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" ); + DBG_ASSERT( nNo<nObjBarCount,"Objectbar is unknown!" ); #endif return (*pImpData->pObjectBars)[nNo]->bVisible; } @@ -663,17 +649,17 @@ const SfxInterface* SfxInterface::GetRealInterfaceForSlot( const SfxSlot *pRealS DBG_ASSERT( pImpData->bRegistered, "Interface not registered!" ); const SfxInterface* pInterface = this; - // Der Slot k"onnte auch aus dem Interface einer Shell-Basisklasse stammen + // The slot could also originate from the interface of a shell base class. do { const SfxSlot *pLastSlot = (*pInterface)[pInterface->Count()-1]; const SfxSlot *pFirstSlot = (*pInterface)[0]; - // Ist pInterface der Owner von pRealSlot ? + // Is pInterface the Owner of pRealSlot ? if ( pFirstSlot <= pRealSlot && pRealSlot <= pLastSlot ) break; - // Sonst Interface der Superklasse probieren + // Otherwise try the Interface of Super class pInterface = pInterface->pGenoType; } while ( pInterface ); @@ -681,5 +667,4 @@ const SfxInterface* SfxInterface::GetRealInterfaceForSlot( const SfxSlot *pRealS return pInterface; } - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/querystatus.cxx b/sfx2/source/control/querystatus.cxx index 9fb17332c27d..5632858d2b6b 100644 --- a/sfx2/source/control/querystatus.cxx +++ b/sfx2/source/control/querystatus.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include <svl/visitem.hxx> #include <cppuhelper/weak.hxx> #include <comphelper/processfactory.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> @@ -97,7 +98,7 @@ SfxQueryStatus_Impl::SfxQueryStatus_Impl( const Reference< XDispatchProvider >& { m_aCommand.Complete = rCommand; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( m_aCommand ); if ( rDispatchProvider.is() ) m_xDispatch = rDispatchProvider->queryDispatch( m_aCommand, rtl::OUString(), 0 ); @@ -111,14 +112,14 @@ SfxQueryStatus_Impl::~SfxQueryStatus_Impl() void SAL_CALL SfxQueryStatus_Impl::disposing( const EventObject& ) throw( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xDispatch.clear(); } void SAL_CALL SfxQueryStatus_Impl::statusChanged( const FeatureStateEvent& rEvent) throw( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pItem = NULL; m_eState = SFX_ITEM_DISABLED; @@ -189,7 +190,7 @@ throw( RuntimeException ) // Query method SfxItemState SfxQueryStatus_Impl::QueryState( SfxPoolItem*& rpPoolItem ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_bQueryInProgress ) { m_pItem = NULL; @@ -236,6 +237,8 @@ SfxQueryStatus::~SfxQueryStatus() SfxItemState SfxQueryStatus::QueryState( SfxPoolItem*& rpPoolItem ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_pSfxQueryStatusImpl->QueryState( rpPoolItem ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index ec6f9a7428e9..c99badd04d46 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,16 +39,11 @@ #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <svl/itemiter.hxx> -#ifndef _ARGS_HXX //autogen #include <svl/itempool.hxx> -#endif #include <svtools/itemdel.hxx> #include <comphelper/processfactory.hxx> -#ifndef GCC -#endif - #include <svl/smplhint.hxx> #include <sfx2/request.hxx> @@ -64,23 +60,23 @@ using namespace ::com::sun::star; struct SfxRequest_Impl: public SfxListener -/* [Beschreibung] +/* [Description] - Implementations-Struktur der Klasse <SfxRequest>. + Implementation structur of the <SfxRequest> class. */ { - SfxRequest* pAnti; // Owner wegen sterbendem Pool - String aTarget; // ggf. von App gesetztes Zielobjekt - SfxItemPool* pPool; // ItemSet mit diesem Pool bauen - SfxPoolItem* pRetVal; // R"uckgabewert geh"ort sich selbst - SfxShell* pShell; // ausgef"uhrt an dieser Shell - const SfxSlot* pSlot; // ausgef"uhrter Slot - sal_uInt16 nModifier; // welche Modifier waren gedrueckt? - sal_Bool bDone; // "uberhaupt ausgef"uhrt - sal_Bool bIgnored; // vom User abgebrochen - sal_Bool bCancelled; // nicht mehr zustellen - sal_Bool bUseTarget; // aTarget wurde von Applikation gesetzt + SfxRequest* pAnti; // Owner because of dying pool + String aTarget; // if possible from target object set by App + SfxItemPool* pPool; // ItemSet build with this pool + SfxPoolItem* pRetVal; // Return value belongs to itself + SfxShell* pShell; // run from this shell + const SfxSlot* pSlot; // executed Slot + sal_uInt16 nModifier; // which Modifier was pressed? + sal_Bool bDone; // at all executed + sal_Bool bIgnored; // Cancelled by the User + sal_Bool bCancelled; // no longer notify + sal_Bool bUseTarget; // aTarget was set by Application sal_uInt16 nCallMode; // Synch/Asynch/API/Record sal_Bool bAllowRecording; SfxAllItemSet* pInternalArgs; @@ -137,11 +133,11 @@ SfxRequest::~SfxRequest() { DBG_MEMTEST(); - // nicht mit Done() marktierte Requests mit 'rem' rausschreiben + // Leave out Done() marked requests with 'rem' if ( pImp->xRecorder.is() && !pImp->bDone && !pImp->bIgnored ) pImp->Record( uno::Sequence < beans::PropertyValue >() ); - // Objekt abr"aumen + // Clear object delete pArgs; if ( pImp->pRetVal ) DeleteItemOnIdle(pImp->pRetVal); @@ -190,13 +186,13 @@ SfxRequest::SfxRequest ) -/* [Beschreibung] +/* [Description] - Mit diesem Konstruktor k"onnen Events, die nicht "uber den SfxDispatcher - gelaufen sind (z.B aus KeyInput() oder Mouse-Events) nachtr"aglich - recorded werden. Dazu wird eine SfxRequest-Instanz mit diesem Konstruktor - erzeugt und dann genauso verfahren, wie mit einem SfxRequest, der in - eine <Slot-Execute-Methode> als Parameter gegeben wird. + With this constructor events can subsequently be recorded that are not run + across SfxDispatcher (eg from KeyInput() or mouse events). For this, a + SfxRequest instance is created by this constructor and then proceed + exactly as with a SfxRequest that in a <Slot-Execute-Method> is given as a + parameter. */ : nSlot(nSlotId), @@ -225,7 +221,7 @@ SfxRequest::SfxRequest { ByteString aStr( "Recording unsupported slot: "); aStr += ByteString::CreateFromInt32( pImp->pPool->GetSlotId(nSlotId) ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif } @@ -235,9 +231,9 @@ SfxRequest::SfxRequest SfxRequest::SfxRequest ( - sal_uInt16 nSlotId, // auszuf"uhrende <Slot-Id> + sal_uInt16 nSlotId, // executed <Slot-Id> SfxCallMode nMode, // Synch/API/... - SfxItemPool& rPool // ggf. f"ur das SfxItemSet f"ur Parameter + SfxItemPool& rPool // necessary for the SfxItemSet for parameters ) // creates a SfxRequest without arguments @@ -260,10 +256,10 @@ SfxRequest::SfxRequest SfxRequest::SfxRequest ( - const SfxSlot* pSlot, // auszuf"uhrende <Slot-Id> + const SfxSlot* pSlot, // executed <Slot-Id> const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs, SfxCallMode nMode, // Synch/API/... - SfxItemPool& rPool // ggf. f"ur das SfxItemSet f"ur Parameter + SfxItemPool& rPool // necessary for the SfxItemSet for parameters ) : nSlot(pSlot->GetSlotId()), pArgs(new SfxAllItemSet(rPool)), @@ -348,16 +344,15 @@ const SfxItemSet* SfxRequest::GetInternalArgs_Impl() const void SfxRequest_Impl::Record ( - const uno::Sequence < beans::PropertyValue >& rArgs // aktuelle Parameter + const uno::Sequence < beans::PropertyValue >& rArgs // current Parameter ) -/* [Beschreibung] - - Interne Hilfsmethode zum erzeugen einer <SfxMacroStatement>-Instanz, - welche den bereits ausgef"uhrten SfxRequest wiederholbar beschreibt. +/* [Description] - Die erzeugte Instanz, auf die ein Pointer zur"uckgeliefert wird - geht in das Eigentum des Aufrufers "uber. + Internal helper method to create a <SfxMacroStatement> Instance, which + repeatable describes the just executed SfxRequest. The ownership of thr + created instance, to which a pointer is returned, is handed over to the + caller. */ { @@ -394,7 +389,7 @@ void SfxRequest_Impl::Record com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > xTransform( - xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), + xFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), com::sun::star::uno::UNO_QUERY); com::sun::star::util::URL aURL; @@ -412,19 +407,17 @@ void SfxRequest_Impl::Record void SfxRequest::Record_Impl ( - SfxShell& rSh, // die <SfxShell>, die den Request ausgef"uhrt hat - const SfxSlot& rSlot, // der <SfxSlot>, der den Request ausgef"uhrt hat - com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, // der Recorder, mit dem aufgezeichnet wird + SfxShell& rSh, // the <SfxShell>, which has excecuted the Request + const SfxSlot& rSlot, // the <SfxSlot>, which has executed the Request + com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, SfxViewFrame* pViewFrame ) -/* [Beschreibung] +/* [Description] - Diese interne Methode markiert den SfxRequest als in dem angegebenen - SfxMakro aufzuzeichnen. - - Pointer auf die Parameter werden in Done() wieder verwendet, m"usseb - dann also noch leben. + This internal method marks the specified SfxMakro SfxRequest as recorded in + SfxMakro. Pointer to the parameters in Done() is used again, thus has to + still be alive. */ { @@ -470,9 +463,9 @@ void SfxRequest::RemoveItem( sal_uInt16 nID ) const SfxPoolItem* SfxRequest::GetArg ( - sal_uInt16 nSlotId, // Slot-Id oder Which-Id des Parameters - bool bDeep, // false: nicht in Parent-ItemSets suchen - TypeId aType // != 0: RTTI Pruefung mit Assertion + sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters + bool bDeep, // sal_False: do not seach in the Parent-ItemSets + TypeId aType // != 0: RTTI check with Assertion ) const { return GetItem( pArgs, nSlotId, bDeep, aType ); @@ -483,22 +476,19 @@ const SfxPoolItem* SfxRequest::GetArg const SfxPoolItem* SfxRequest::GetItem ( const SfxItemSet* pArgs, - sal_uInt16 nSlotId, // Slot-Id oder Which-Id des Parameters - bool bDeep, // false: nicht in Parent-ItemSets suchen - TypeId aType // != 0: RTTI Pruefung mit Assertion + sal_uInt16 nSlotId, // Slot-Id or Which-Id of the parameters + bool bDeep, // sal_False: do not seach in the Parent-ItemSets + TypeId aType // != 0: RTTI check with Assertion ) -/* [Beschreibung] - - Mit dieser Methode wird der Zugriff auf einzelne Parameter im - SfxRequest wesentlich vereinfacht. Insbesondere wird die Typpr"ufung - (per Assertion) durchgef"uhrt, wodurch die Applikations-Sourcen - wesentlich "ubersichtlicher werden. In der PRODUCT-Version wird - eine 0 zur"uckgegeben, wenn das gefundene Item nicht von der - angegebenen Klasse ist. +/* [Description] + With this method the access to individual parameters in the SfxRequest is + simplified. In particular the type-examination (by Assertion) is performed, + whereby the application source code will be much clearer. In the product- + version is a 0 returned, if the found item is not of the specified class. - [Beispiel] + [Example] void MyShell::Execute( SfxRequest &rReq ) { @@ -507,12 +497,12 @@ const SfxPoolItem* SfxRequest::GetItem case SID_MY: { ... - // ein Beispiel ohne Verwendung des Makros + // An Example on not using the macros const SfxInt32Item *pPosItem = (const SfxUInt32Item*) rReq.GetArg( SID_POS, sal_False, TYPE(SfxInt32Item) ); sal_uInt16 nPos = pPosItem ? pPosItem->GetValue() : 0; - // ein Beispiel mit Verwendung des Makros + // An Example on using the macros SFX_REQUEST_ARG(rReq, pSizeItem, SfxInt32Item, SID_SIZE, sal_False); sal_uInt16 nSize = pSizeItem ? pPosItem->GetValue() : 0; @@ -527,24 +517,24 @@ const SfxPoolItem* SfxRequest::GetItem { if ( pArgs ) { - // ggf. in Which-Id umrechnen + // Which may be converted to ID sal_uInt16 nWhich = pArgs->GetPool()->GetWhich(nSlotId); - // ist das Item gesetzt oder bei bDeep==TRUE verf"ugbar? + // Is the item set or available at bDeep == sal_True? const SfxPoolItem *pItem = 0; if ( ( bDeep ? SFX_ITEM_AVAILABLE : SFX_ITEM_SET ) <= pArgs->GetItemState( nWhich, bDeep, &pItem ) ) { - // stimmt der Typ "uberein? + // Compare type if ( !pItem || pItem->IsA(aType) ) return pItem; - // Item da aber falsch => Programmierfehler - DBG_ERROR( "invalid argument type" ); + // Item of wrong type => Programming error + OSL_FAIL( "invalid argument type" ); } } - // keine Parameter, nicht gefunden oder falschen Typ gefunden + // No Parameter, not found or wrong type return 0; } @@ -552,7 +542,7 @@ const SfxPoolItem* SfxRequest::GetItem void SfxRequest::SetReturnValue(const SfxPoolItem &rItem) { - DBG_ASSERT(!pImp->pRetVal, "Returnwert mehrfach setzen?"); + DBG_ASSERT(!pImp->pRetVal, "Set Return value multiple times?"); if(pImp->pRetVal) delete pImp->pRetVal; pImp->pRetVal = rItem.Clone(); @@ -569,47 +559,42 @@ const SfxPoolItem* SfxRequest::GetReturnValue() const void SfxRequest::Done ( - const SfxItemSet& rSet, /* von der Applikation mitgeteilte Parameter, - die z.B. in einem Dialog vom Benuter - erfragt wurden, ggf. 0 falls keine - Parameter gesetzt wurden */ + const SfxItemSet& rSet, /* parameters passed on by the application, + that for example were asked for by the user + in a dialogue, 0 if no parameters have been + set */ - bool bKeep /* true (default) - 'rSet' wird gepeichert und ist "uber - GetArgs() abfragbar + bool bKeep /* true (default) + 'rSet' is saved and GetArgs() queriable. false - 'rSet' wird nicht kopiert (schneller) */ + 'rSet' is not copied (faster) */ ) -/* [Beschreibung] - - Diese Methode mu\s in der <Execute-Methode> des <SfxSlot>s gerufen - werden, der den SfxRequest ausgef"uhrt hat, wenn die Ausf"uhrung - tats"achlich stattgefunden hat. Wird 'Done()' nicht gerufen, gilt - der SfxRequest als abgebrochen. +/* [Description] - Etwaige Returnwerte werden nur durchgereicht, wenn 'Done()' gerufen - wurde. Ebenso werden beim Aufzeichnen von Makros nur echte - Statements erzeugt, wenn 'Done()' gerufen wurde; f"ur SfxRequests, - die nicht derart gekennzeichnet wurden, wird anstelle dessen eine - auf die abgebrochene Funktion hinweisende Bemerkung ('rem') eingf"ugt. + This method must be called in the <Execute-Method> of the <SfxSlot>s, which + has performed the SfxRequest when the execution actually took place. If + 'Done()' is not called, then the SfxRequest is considered canceled. + Any return values are passed only when 'Done()' was called. Similar, when + recording a macro only true statements are generated if 'Done()' was + called; for SfxRequests that were not identified as such will instead + be commented out by inserting ('rem'). - [Anmerkung] + [Note] - 'Done()' wird z.B. nicht gerufen, wenn ein durch die Funktion gestarteter - Dialog vom Benutzer abgebrochen wurde oder das Ausf"uhren aufgrund - eines falschen Kontextes (ohne Verwendung separater <SfxShell>s) - nicht durchgef"uhrt werden konnte. 'Done()' mu\s sehr wohl gerufen - werden, wenn das Ausf"uhren der Funktion zu einem regul"aren Fehler - f"uhrte (z.B. Datei konnte nicht ge"offnet werden). + 'Done ()' is not called, for example when a dialoge started by the function + was canceled by the user or if the execution could not be performed due to + a wrong context (without use of separate <SfxShell>s). 'Done ()' will be + launched, when executing the function led to a regular error + (for example, file could not be opened). */ { Done_Impl( &rSet ); - // ggf. Items merken, damit StarDraw sie abfragen kann + // Keep items if possible, so they can be queried by StarDraw. if ( bKeep ) { if ( !pArgs ) @@ -661,10 +646,10 @@ sal_Bool SfxRequest::IsCancelled() const void SfxRequest::Cancel() -/* [Beschreibung] +/* [Description] - Markiert diesen Request als nicht mehr auszufuehren. Wird z.B. gerufen, - wenn das Ziel (genauer dessen Pool) stirbt. + Marks this request as no longer executable. For example, if called when + the target (more precisely, its pool) dies. */ { @@ -678,22 +663,20 @@ void SfxRequest::Cancel() void SfxRequest::Ignore() -/* [Beschreibung] +/* [Description] - Wird diese Methode anstelle von <SfxRequest::Done()> gerufen, dann - wird dieser Request nicht recorded. + If this method is called instead of <SfxRequest::Done()>, then this + request is not recorded. + [Example] - [Bespiel] - - Das Selektieren von Tools im StarDraw soll nicht aufgezeichnet werden, - dieselben Slots sollen aber zum erzeugen der von den Tools zu - erzeugenden Objekte verwendet werde. Also kann nicht NoRecord - angegeben werden, dennoch soll u.U. nicht aufgezeichnet werden. + The selecting of tools in StarDraw should not be recorded, but the same + slots are to be used from the generation of the tools to the generated + objects. Thus can NoRecords not be specified, i.e. should not be recorded. */ { - // als tats"achlich ausgef"uhrt markieren + // Mark as actually executed pImp->bIgnored = sal_True; } @@ -701,55 +684,56 @@ void SfxRequest::Ignore() void SfxRequest::Done_Impl ( - const SfxItemSet* pSet /* von der Applikation mitgeteilte Parameter, - die z.B. in einem Dialog vom Benuter - erfragt wurden, ggf. 0 falls keine - Parameter gesetzt wurden */ + const SfxItemSet* pSet /* parameters passed on by the application, + that for example were asked for by the user + in a dialogue, 0 if no parameters have been + set */ + ) -/* [Beschreibung] +/* [Description] - Interne Methode zum als 'done' markieren des SfxRequest und zum Auswerten - der Parameter in 'pSet' falls aufgezeichnet wird. + Internal method to mark SfxRequest with 'done' and to evaluate the + parameters in 'pSet' in case it is recorded. */ { - // als tats"achlich ausgef"uhrt markieren + // Mark as actually executed pImp->bDone = sal_True; - // nicht Recorden + // not Recording if ( !pImp->xRecorder.is() ) return; - // wurde ein anderer Slot ausgef"uhrt als angefordert (Delegation) + // was running a different slot than requested (Delegation) if ( nSlot != pImp->pSlot->GetSlotId() ) { - // Slot neu suchen + // Search Slot again pImp->pSlot = pImp->pShell->GetInterface()->GetSlot(nSlot); DBG_ASSERT( pImp->pSlot, "delegated SlotId not found" ); - if ( !pImp->pSlot ) // Hosentr"ger und G"urtel + if ( !pImp->pSlot ) // playing it safe return; } - // record-f"ahig? - // neues Recorden verwendet UnoName! + // recordable? + // new Recording uses UnoName! if ( !pImp->pSlot->pUnoName ) { ByteString aStr( "Recording not exported slot: "); aStr += ByteString::CreateFromInt32( pImp->pSlot->GetSlotId() ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } - if ( !pImp->pSlot->pUnoName ) // Hosentr"ger und G"urtel + if ( !pImp->pSlot->pUnoName ) // playing it safe return; - // "ofters ben"otigte Werte + // often required values SfxItemPool &rPool = pImp->pShell->GetPool(); // Property-Slot? if ( !pImp->pSlot->IsMode(SFX_SLOT_METHOD) ) { - // des Property als SfxPoolItem besorgen + // get the property as SfxPoolItem const SfxPoolItem *pItem; sal_uInt16 nWhich = rPool.GetWhich(pImp->pSlot->GetSlotId()); SfxItemState eState = pSet ? pSet->GetItemState( nWhich, sal_False, &pItem ) : SFX_ITEM_UNKNOWN; @@ -758,7 +742,7 @@ void SfxRequest::Done_Impl { ByteString aStr( "Recording property not available: "); aStr += ByteString::CreateFromInt32( pImp->pSlot->GetSlotId() ); - DBG_ERROR( aStr.GetBuffer() ); + OSL_FAIL( aStr.GetBuffer() ); } #endif uno::Sequence < beans::PropertyValue > aSeq; @@ -767,7 +751,7 @@ void SfxRequest::Done_Impl pImp->Record( aSeq ); } - // alles in ein einziges Statement aufzeichnen? + // record everything in a single statement? else if ( pImp->pSlot->IsMode(SFX_SLOT_RECORDPERSET) ) { uno::Sequence < beans::PropertyValue > aSeq; @@ -776,27 +760,27 @@ void SfxRequest::Done_Impl pImp->Record( aSeq ); } - // jedes Item als einzelnes Statement recorden + // record each item as a single statement else if ( pImp->pSlot->IsMode(SFX_SLOT_RECORDPERITEM) ) { if ( pSet ) { - // "uber die Items iterieren + // iterate over Items SfxItemIter aIter(*pSet); for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() ) { - // die Slot-Id f"ur das einzelne Item ermitteln + // to determine the slot ID for the individual item sal_uInt16 nSlotId = rPool.GetSlotId( pItem->Which() ); if ( nSlotId == nSlot ) { - // mit Hosentr"ager und G"urtel reparieren des falschen Flags - DBG_ERROR( "recursion RecordPerItem - use RecordPerSet!" ); + // play it safe; repair the wrong flags + OSL_FAIL( "recursion RecordPerItem - use RecordPerSet!" ); SfxSlot *pSlot = (SfxSlot*) pImp->pSlot; pSlot->nFlags &= ~((sal_uIntPtr)SFX_SLOT_RECORDPERITEM); pSlot->nFlags &= SFX_SLOT_RECORDPERSET; } - // einen Sub-Request recorden + // Record a Sub-Request SfxRequest aReq( pImp->pViewFrame, nSlotId ); if ( aReq.pImp->pSlot ) aReq.AppendItem( *pItem ); @@ -805,7 +789,7 @@ void SfxRequest::Done_Impl } else { - HACK(hierueber nochmal nachdenken) + //HACK(think about this again) pImp->Record( uno::Sequence < beans::PropertyValue >() ); } } @@ -815,18 +799,16 @@ void SfxRequest::Done_Impl sal_Bool SfxRequest::IsDone() const -/* [Beschreibung] - - Mit dieser Methode kann abgefragt werden, ob der SfxRequest tats"achlich - ausgef"uhrt wurde oder nicht. Wurde ein SfxRequest nicht ausgef"uhrt, - liegt dies z.B. daran, da\s der Benutzer abgebrochen hat oder - der Kontext f"ur diesen Request falsch war, dieses aber nicht "uber - eine separate <SfxShell> realisiert wurde. +/* [Description] - SfxRequest-Instanzen, die hier sal_False liefern, werden nicht recorded. + With this method it can be queried whether the SfxRequest was actually + executed or not. If a SfxRequest was not executed, then this is for example + because it was canceled by the user or the context for this request was + wrong, this was not implemented on a separate <SfxShell>. + SfxRequest instances that return sal_False will not be recorded. - [Querverweise] + [Cross-reference] <SfxRequest::Done(const SfxItemSet&)> <SfxRequest::Done()> @@ -840,10 +822,10 @@ sal_Bool SfxRequest::IsDone() const SfxMacro* SfxRequest::GetRecordingMacro() -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann abgefragt werden, ob und in welchem <SfxMacro> - die SfxRequests gerade aufgezeichnet werden. + With this method it can be queried as to whether and to what <SfxMacro> + the SfxRequests is being recorded. */ { @@ -854,12 +836,13 @@ SfxMacro* SfxRequest::GetRecordingMacro() com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder( SfxViewFrame* pView ) -/* [Beschreibung] +/* [Description] - Hier wird versucht einen Recorder fuer dispatch() Aufrufe vom Frame zu bekommen. - Dieser ist dort per Property an einem Supplier verfuegbar - aber nur dann, wenn - recording angeschaltet wurde. - (Siehe auch SfxViewFrame::MiscExec_Impl() und SID_RECORDING) + This recorder is an attempt for dispatch () to get calls from the Frame. + This is then available through a property by a supplier but only when + recording was turned on. + + (See also SfxViewFrame::MiscExec_Impl() and SID_RECORDING) */ { @@ -871,7 +854,7 @@ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRe if(xSet.is()) { - com::sun::star::uno::Any aProp = xSet->getPropertyValue(rtl::OUString::createFromAscii("DispatchRecorderSupplier")); + com::sun::star::uno::Any aProp = xSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DispatchRecorderSupplier"))); com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorderSupplier > xSupplier; aProp >>= xSupplier; if(xSupplier.is()) @@ -891,10 +874,10 @@ sal_Bool SfxRequest::HasMacroRecorder( SfxViewFrame* pView ) sal_Bool SfxRequest::IsAPI() const -/* [Beschreibung] +/* [Description] - Liefert sal_True, wenn dieser SfxRequest von einer API (z.B. BASIC) - erzeugt wurde, sonst sal_False. + Returns sal_True if this SfxRequest was generated by an API (for example BASIC), + otherwise sal_False. */ { @@ -906,13 +889,13 @@ sal_Bool SfxRequest::IsAPI() const bool SfxRequest::IsRecording() const -/* [Beschreibung] +/* [Description] - Liefert sal_True, wenn dieser SfxRequest recorded werden soll, d.h. - 1. zu Zeit ein Makro aufgezeichnet wird - 2. dieser Request "uberhaupt aufgezeichnet wird - 3. der Request nicht von reiner API (z.B. BASIC) ausgeht, - sonst sal_False. + Returns sal_True if this SfxRequest is to be recorded ie + 1. Currently a macro is beeing recorded + 2. This request is even recorded + 3. the request did not originate from a pure API (for example BASIC), + otherwise sal_False. */ { @@ -935,19 +918,18 @@ sal_uInt16 SfxRequest::GetModifier() const void SfxRequest::SetTarget( const String &rTarget ) -/* [Beschreibung] - - Mit dieser Methode kann das zu recordende Zielobjekt umgesetzt werden. +/* [Description] + With this method the recording of the target object can be implemented. - [Beispiel] + [Example] - Die BASIC-Methode 'Open' wird zwar von der Shell 'Application' ausgef"uhrt, - aber am Objekt 'Documents' (global) recorded: + The BASIC-Methode 'Open' is although executed by the Shell 'Application' + but recorded on the Objekt 'Documents' (global): rReq.SetTarget( "Documents" ); - Dies f"uhrt dann zu: + This then leads to: Documents.Open( ... ) */ @@ -976,3 +958,5 @@ void SfxRequest::ReleaseArgs() DELETEZ( pArgs ); DELETEZ( pImp->pInternalArgs ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index 96f305f58389..c40263f18cac 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ #include <svl/visitem.hxx> #include <cppuhelper/weak.hxx> #include <comphelper/processfactory.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -68,7 +69,7 @@ SfxStatusListener::SfxStatusListener( const Reference< XDispatchProvider >& rDis { m_aCommand.Complete = rCommand; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( m_aCommand ); if ( rDispatchProvider.is() ) m_xDispatch = rDispatchProvider->queryDispatch( m_aCommand, rtl::OUString(), 0 ); @@ -112,7 +113,7 @@ void SfxStatusListener::Bind( sal_uInt16 nSlotId, const rtl::OUString& rNewComma m_nSlotID = nSlotId; m_aCommand.Complete = rNewCommand; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( m_aCommand ); m_xDispatch = m_xDispatchProvider->queryDispatch( m_aCommand, rtl::OUString(), 0 ); @@ -190,7 +191,7 @@ throw ( RuntimeException ) void SAL_CALL SfxStatusListener::disposing( const EventObject& Source ) throw( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( Source.Source == Reference< XInterface >( m_xDispatch, UNO_QUERY )) m_xDispatch.clear(); @@ -201,7 +202,7 @@ throw( RuntimeException ) void SAL_CALL SfxStatusListener::statusChanged( const FeatureStateEvent& rEvent) throw( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxViewFrame* pViewFrame = NULL; if ( m_xDispatch.is() ) @@ -288,3 +289,4 @@ throw( RuntimeException ) delete pItem; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index be365349888f..ecebb51c40b2 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,9 +39,6 @@ #include <unotools/undoopt.hxx> -#ifndef GCC -#endif - #include <sfx2/app.hxx> #include <sfx2/shell.hxx> #include <sfx2/bindings.hxx> @@ -76,12 +74,12 @@ using namespace com::sun::star; //========================================================================= struct SfxShell_Impl: public SfxBroadcaster { - String aObjectName;// Name des Sbx-Objects - SfxItemArray_Impl aItems; // Datenaustausch auf Item-Basis - SfxViewShell* pViewSh; // SfxViewShell falls Shell ViewFrame/ViewShell/SubShell ist - SfxViewFrame* pFrame; // Frame, falls <UI-aktiv> - SfxRepeatTarget* pRepeatTarget; -// SbxObjectRef xParent; + String aObjectName; // Name of Sbx-Objects + SfxItemArray_Impl aItems; // Data exchange on Item level + SfxViewShell* pViewSh; // SfxViewShell if Shell is + // ViewFrame/ViewShell/SubShell list + SfxViewFrame* pFrame; // Frame, if <UI-active> + SfxRepeatTarget* pRepeatTarget; // SbxObjectRef xParent; sal_Bool bInAppBASIC; sal_Bool bActive; sal_uIntPtr nDisableFlags; @@ -89,6 +87,7 @@ struct SfxShell_Impl: public SfxBroadcaster svtools::AsynchronLink* pExecuter; svtools::AsynchronLink* pUpdater; SfxVerbSlotArr_Impl aSlotArr; + com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbList; SfxShell_Impl() : pExecuter( 0 ), pUpdater( 0 ) {} ~SfxShell_Impl() { delete pExecuter; delete pUpdater;} @@ -99,10 +98,10 @@ struct SfxShell_Impl: public SfxBroadcaster String SfxShellIdent_Impl( const SfxShell *pSh ) -/* [Beschreibung] +/* [Description] - Interne Hilfesfunktion. Liefert einen die SfxShell 'pSh' beschreibenden - String zur"uck. Z.B.: SfxApplication[StarWriter] + Internal helper function. Returns a SfxShell 'pSh' descriptive string. + For instance: SfxApplication [StarWriter] */ { @@ -123,21 +122,21 @@ String SfxShellIdent_Impl( const SfxShell *pSh ) // SfxShell //========================================================================= -void __EXPORT SfxShell::EmptyExecStub(SfxShell *, SfxRequest &) +void SfxShell::EmptyExecStub(SfxShell *, SfxRequest &) { } -void __EXPORT SfxShell::EmptyStateStub(SfxShell *, SfxItemSet &) +void SfxShell::EmptyStateStub(SfxShell *, SfxItemSet &) { } SfxShell::SfxShell() -/* [Beschreibung] +/* [Description] - Der Konstruktor der Klasse SfxShell initialisierung nur einfache - Typen, das dazugeh"orige SbxObject wird erst on-demand erzeugt. - Daher ist das Anlegen einer SfxShell Instanz sehr billig. + The constructor of the SfxShell class initializes only simple types, + the corresponding SbxObject is only created on-demand. Therefore, + the application of a SfxShell instance is very cheap. */ : pImp(0), @@ -159,11 +158,11 @@ SfxShell::SfxShell() SfxShell::SfxShell( SfxViewShell *pViewSh ) -/* [Beschreibung] +/* [Description] - Der Konstruktor der Klasse SfxShell initialisierung nur einfache - Typen, das dazugeh"orige SbxObject wird erst on-demand erzeugt. - Daher ist das Anlegen einer SfxShell Instanz sehr billig. + The constructor of the SfxShell class initializes only simple types, + the corresponding SbxObject is only created on-demand. Therefore, + the application of a SfxShell instance is very cheap. */ : pImp(0), @@ -184,11 +183,11 @@ SfxShell::SfxShell( SfxViewShell *pViewSh ) SfxShell::~SfxShell() -/* [Beschreibung] +/* [Description] - Die Verbindungs zu einem ggf. zugeh"origen SbxObject wird gel"ost. - Das SbxObject existiert ggf. weiter, kann aber keine Funktionen - mehr ausf"uhren und keine Properties mehr bereitstellen. + The connection to a possible corresponding SbxObject is dissolved. + The SbxObject may continoue to exist, but can not any longer perform + any functions and can not provide any properties. */ { @@ -200,10 +199,10 @@ SfxShell::~SfxShell() void SfxShell::SetName( const String &rName ) -/* [Beschreibung] +/* [Description] - Setzt den Namen des Shell-Objekts. Mit diesem Namen kann die - SfxShell-Instanz vom BASIC aus angesprochen werden. + Sets the name of the Shell object. With this name, the SfxShell instance + of BASIC can be expressed. */ { @@ -214,10 +213,10 @@ void SfxShell::SetName( const String &rName ) const String& SfxShell::GetName() const -/* [Beschreibung] +/* [Description] - Liefert den Namen des Shell-Objekts. Mit diesem Namen kann die - SfxShell-Instanz vom BASIC aus angesprochen werden. + Returns the name of the Shell object. With this name, the SfxShell instance + of BASIC can be expressed. */ { @@ -228,11 +227,11 @@ const String& SfxShell::GetName() const SvGlobalName SfxShell::GetGlobalName() const -/* [Beschreibung] +/* [Description] - Liefert den Global Unique Identifier des Shell-Objekts. Mit diesem - Namen kann die SfxShell-Instanz z.B. via OLE Automation angesprochen - werden, bzw. in der Registration-Database gefunden werden. + Provides the Global Unique Identifier of the Shell object. With this name + can the SfxShell instance for example be expressed via OLE Automation, or + be found in the Registration Database. */ { @@ -243,14 +242,13 @@ SvGlobalName SfxShell::GetGlobalName() const SfxDispatcher* SfxShell::GetDispatcher() const -/* [Beschreibung] +/* [Description] - Diese Methode liefert einen Pointer auf den <SfxDispatcher>, in - dem die SfxShell gerade <UI-aktiv> ist bzw. einen 0-Pointer, wenn - sie gerade nicht UI-aktiv ist. + This method returns a pointer to the <SfxDispatcher>, when the SfxShell + is currently <UI-active> or a NULL-pointer if it is not UI-active. - Der zur"uckgegebene Pointer ist nur im unmittelbaren Kontext des - Methodenaufrufs g"ultig. + The returned pointer is only valid in the immediate context of the method + call. */ { @@ -261,10 +259,11 @@ SfxDispatcher* SfxShell::GetDispatcher() const SfxViewShell* SfxShell::GetViewShell() const -/* [Beschreibung] +/* [Description] - Liefert bei SubShells die SfxViewShell, in der sie liegen. Sonst und - falls nicht vom App-Entwickler angegeben liefert diese Methode 0. + Returns the SfxViewShell in which they are located in the subshells. + Otherwise, and if not specified by the App developer, this method + returns NULL. */ { @@ -275,25 +274,23 @@ SfxViewShell* SfxShell::GetViewShell() const SfxViewFrame* SfxShell::GetFrame() const -/* [Beschreibung] - - Diese Methode liefert einen Pointer auf den <SfxViewFrame>, dem diese - SfxShell-Instanz zugeordnet ist oder in dem sie zur Zeit <UI-aktiv> ist. - Ein 0-Pointer wird geliefert, wenn diese SfxShell-OInstanz gerade nicht - UI-aktiv ist und auch keinem SfxViewFrame fest zugeordnet ist. - - Der zur"uckgegebene Pointer ist nur im unmittelbaren Kontext des - Methodenaufrufs g"ultig. +/* [Description] + This method returns a pointer to the <SfxViewFrame> to which this SfxShell + instance is associated or in which they currently is <UI-active>. + A NULL pointer is returned if this SfxShell instance is not UI-active at + the moment and also no SfxViewFrame is permanently assigned. - [Anmerkung] + The returned pointer is only valid in the immediate context of the method + call. - Nur Instanzen von Subklasse von SfxApplication und SfxObjectShell sollten - hier einen 0-Pointer liefern. Ansonsten liegt ein Fehler im Anwendungs- - programm vor (falscher Ctor von SfxShell gerufen). + [Note] + Only instances of a subclass of SfxApplication and SfxObjectShell + should here provide a NULL-pointer. Otherwise, there is an error in the + application program (wrong constructor was called from SfxShell). - [Querverweise] + [Cross-reference] <SfxViewShell::GetViewFrame()const> */ @@ -310,21 +307,19 @@ SfxViewFrame* SfxShell::GetFrame() const const SfxPoolItem* SfxShell::GetItem ( - sal_uInt16 nSlotId // Slot-Id des zu erfragenden <SfxPoolItem>s + sal_uInt16 nSlotId // Slot-Id of the querying <SfxPoolItem>s ) const -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann auf beliebige Objekte von Subklassen von - <SfxPoolItem> zugegriffen werden. Diese Austauschtechnik wird ben"otigt, - wenn z.B. spezielle <SfxToolBoxControl> Subklassen Zugriff auf - bestimmte Daten z.B. der <SfxObjectShell> ben"otigen. + With this method any objects of <SfxPoolItemu> subclasses can be accessed. + This exchange method is needed if, for example special <SfxToolBoxControl> + subclasses need access to certain data such as the <SfxObjectShell>. - Die zur"uckgelieferte Instanz geh"ort der jeweilige SfxShell und - darf nur im unmittelbaren Kontext des Methodenaufrufs verwendet werden. + The returned instance belongs to the particular SfxShell and may be + used only in the immediate context of the method call. - - [Querverweise] + [Cross-reference] <SfxShell::PutItem(const SfxPoolItem&)> <SfxShell::RemoveItem(sal_uInt16)> @@ -341,19 +336,17 @@ const SfxPoolItem* SfxShell::GetItem void SfxShell::RemoveItem ( - sal_uInt16 nSlotId // Slot-Id des zu l"oschenden <SfxPoolItem>s + sal_uInt16 nSlotId // Slot-Id of the deleting <SfxPoolItem>s ) -/* [Beschreibung] - - Mit dieser Methode k"onnen die allgemein zur Verf"ugung gestellten - Instanzen von Subklassen von <SfxPoolItem> aus der SfxShell entfernt - werden. +/* [Description] - Die gespeicherte Instanz wird gel"oscht. + With this method the general available subclasses instances of + <cSfxPoolItem> from the SfxShell are removed. + The stored instance is deleted. - [Querverweise] + [Cross-reference] <SfxShell::PutItem(const SfxPoolItem&)> <SfxShell::GetItem(sal_uInt16)> @@ -363,12 +356,12 @@ void SfxShell::RemoveItem for ( sal_uInt16 nPos = 0; nPos < pImp->aItems.Count(); ++nPos ) if ( pImp->aItems.GetObject(nPos)->Which() == nSlotId ) { - // Item entfernen und l"oschen + // Remove and delete Item SfxPoolItem *pItem = pImp->aItems.GetObject(nPos); delete pItem; pImp->aItems.Remove(nPos); - // falls aktiv Bindings benachrichtigen + // if active, notify Bindings SfxDispatcher *pDispat = GetDispatcher(); if ( pDispat ) { @@ -382,23 +375,20 @@ void SfxShell::RemoveItem void SfxShell::PutItem ( - const SfxPoolItem& rItem /* Instanz, von der eine Kopie erstellt wird, - die in der SfxShell in einer Liste - gespeichert wird. */ + const SfxPoolItem& rItem /* Instance, of which a copy is created, + which is stored in the SfxShell in a list. */ ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode k"onnen beliebige Objekte von Subklassen von - <SfxPoolItem> zur Verf"ugung gestellt werden. Diese Austauschtechnik - wird ben"otigt, wenn z.B. spezielle <SfxToolBoxControl> Subklassen - Zugriff auf bestimmte Daten z.B. der <SfxObjectShell> ben"otigen. + With this method, any objects of subclasses of <SfxPoolItem> can be made + available. This exchange technology is needed if, for example, special + <SfxToolBoxControl> Subclasses need access to certain data such as the + <SfxObjectShell> - Falls ein SfxPoolItem mit derselben Slot-Id exisitert, wird dieses - automatisch gel"oscht. + If a SfxPoolItem exists with the same slot ID, it is deleted automatically. - - [Querverweise] + [Cross-reference] <SfxShell::RemoveItem(sal_uInt16)> <SfxShell::GetItem(sal_uInt16)> @@ -409,7 +399,7 @@ void SfxShell::PutItem DBG_ASSERT( SfxItemPool::IsSlot( rItem.Which() ), "items with Which-Ids aren't allowed here" ); - // MSC auf WNT/W95 machte hier Mist, Vorsicht bei Umstellungen + // MSC made a mess here of WNT/W95, beware of changes const SfxPoolItem *pItem = rItem.Clone(); SfxPoolItemHint aItemHint( (SfxPoolItem*) pItem ); const sal_uInt16 nWhich = rItem.Which(); @@ -419,12 +409,12 @@ void SfxShell::PutItem { if ( (*ppLoopItem)->Which() == nWhich ) { - // Item austauschen + // Replace Item delete *ppLoopItem; pImp->aItems.Remove(nPos); pImp->aItems.Insert( (SfxPoolItemPtr) pItem, nPos ); - // falls aktiv Bindings benachrichtigen + // if active, notify Bindings SfxDispatcher *pDispat = GetDispatcher(); if ( pDispat ) { @@ -450,15 +440,14 @@ void SfxShell::PutItem SfxInterface* SfxShell::GetInterface() const -/* [Beschreibung] +/* [Description] - Mit dieser virtuellen Methode, die durch das Makro <SFX_DECL_INTERFACE> - von jeder Subclass mit eigenen Slots automatisch "uberladen wird, kann - auf die zu der Subklasse geh"orende <SfxInterface>-Instanz zugegriffen - werden. + With this virtual method, which is automatically overloaded by each subclass + with its own slots through the macro <SFX_DECL_INTERFACE>, one can access + each of the <SfxInterface> instance beloning to the subclass. - Die Klasse SfxShell selbst hat noch kein eigenes SfxInterface - (keine Slots), daher wird ein 0-Pointer zur"uckgeliefert. + The class SfxShell itself has no own SfxInterface (no slots), therefore a + NULL-pointer is returned. */ { @@ -469,10 +458,10 @@ SfxInterface* SfxShell::GetInterface() const SfxBroadcaster* SfxShell::GetBroadcaster() -/* [Beschreibung] +/* [Description] - Liefert einen SfxBroadcaster f"ur diese SfxShell-Instanz bis die - Klasse SfxShell von SfxBroadcaster abgeleitet ist. + Returns a SfxBroadcaster for this SfxShell instance until the class of + SfxShell is derived by SfxBroadcaster. */ { @@ -483,14 +472,13 @@ SfxBroadcaster* SfxShell::GetBroadcaster() ::svl::IUndoManager* SfxShell::GetUndoManager() -/* [Beschreibung] +/* [Description] - Jede Subclass von SfxShell kann "uber einen <SfxUndoManager> verf"ugen. - Dieser kann in den abgeleiteten Klasse mit <SfxShell:SetUndoManager()> - gesetzt werden. + Each Subclass of SfxShell can hava a <SfxUndoManager>. This can be set in + the derived class with <SfxShell:SetUndoManager()>. - Die Klasse SfxShell selbst hat noch keinen SfxUndoManager, es wird - daher ein 0-Pointer zur"uckgeliefert. + The class SfxShell itself does not have a SfxUndoManager, a NULL-pointer + is therefore returned. */ { @@ -501,17 +489,17 @@ SfxBroadcaster* SfxShell::GetBroadcaster() void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) -/* [Beschreibung] +/* [Description] - Setzt einen <SfxUndoManager> f"ur diese <SfxShell> Instanz. F"ur das - Undo wird immer nur der Undo-Manager an der jeweils oben auf dem - Stack des <SfxDispatcher> liegenden SfxShell verwendet. + Sets a <SfxUndoManager> for this <SfxShell> Instance. For the undo + is only the undo-manager used for SfxShell at the top of the stack of each + <SfxDispatcher>. - Am "ubergebenen <SfxUndoManager> wird automatisch die aktuelle - Max-Undo-Action-Count Einstellung aus den Optionen gesetzt. + On the given <SfxUndoManager> is automatically the current + Max-Undo-Action-Count setting set form the options. - 'pNewUndoMgr' mu\s bis zum Dtor dieser SfxShell-Instanz oder bis - zum n"achsten 'SetUndoManager()' existieren. + 'pNewUndoMgr' must exist until the Destuctor of SfxShell instance is called + or until the next 'SetUndoManager()'. */ { @@ -530,20 +518,17 @@ void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) SfxRepeatTarget* SfxShell::GetRepeatTarget() const -/* [Beschreibung] - - Liefert einen Pointer auf die <SfxRepeatTarget>-Instanz, die - als RepeatTarget bei SID_REPEAT verwendet wird, wenn der - von dieser SfxShell gelieferte <SfxUndoManager> angesprochen wird. - Der R"uckgabewert kann 0 sein. +/* [Description] + Returns a pointer to the <SfxRepeatTarget> instance that is used in + SID_REPEAT as repeat target when it is adressed from the <SfxUndoManager> + supplied by this SfxShell. The return value can be NULL. - [Anmerkung] + [Note] - Eine Ableitung von <SfxShell> oder einer ihrer Subklassen von - <SfxRepeatTarget> ist nicht zu empfehlen, da Compiler-Fehler - provoziert werden (wegen Call-to-Pointer-to-Member-Function to - subclass). + A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget> + is not recommended, as compiler errors are provoked. + (due to Call-to-Pointer-to-Member-Function to the subclass). */ { @@ -554,21 +539,18 @@ SfxRepeatTarget* SfxShell::GetRepeatTarget() const void SfxShell::SetRepeatTarget( SfxRepeatTarget *pTarget ) -/* [Beschreibung] +/* [Description] - Setzt den die <SfxRepeatTarget>-Instanz, die bei SID_REPEAT als - RepeatTarget verwendet wird, wenn der von dieser SfxShell gelieferte - <SfxUndoManager> angesprochen wird. Durch 'pTarget==0' wird SID_REPEAT - f"ur diese SfxShell disabled. Die Instanz '*pTarget' mu\s so lange - leben, wie sie angemeldet ist. + Sets the <SfxRepeatTarget> instance that is used in SID_REPEAT as + RepeatTarget, when the current supplied by this <SfxUndoManager> is + addressed. By 'pTarget==0' the SID_REPEAT is disabled for this SfxShell. + The instance '*pTarget' must live as long as it is registered. + [Note] - [Anmerkung] - - Eine Ableitung von <SfxShell> oder einer ihrer Subklassen von - <SfxRepeatTarget> ist nicht zu empfehlen, da Compiler-Fehler - provoziert werden (wegen Call-to-Pointer-to-Member-Function to - subclass). + A derivation of <SfxShell> or one of its subclasses of <SfxRepeatTarget> + is not recommended, as compiler errors are provoked. + (due to Call-to-Pointer-to-Member-Function to the subclass). */ { @@ -579,19 +561,20 @@ void SfxShell::SetRepeatTarget( SfxRepeatTarget *pTarget ) void SfxShell::Invalidate ( - sal_uInt16 nId /* Zu invalidierende Slot-Id oder Which-Id. - Falls diese 0 ist (default), werden - alle z.Zt. von dieser Shell bedienten - Slot-Ids invalidiert. */ + sal_uInt16 nId /* Invalidated Slot-Id or Which-Id. + If these are 0 (default), then all + by this Shell currently handled Slot-Ids are + invalidated. */ ) -/* [Beschreibung] +/* [Description] + + With this method can the slots of the subclasses be invalidated through the + slot Id or alternatively through the Which ID. Slot IDs, which are + inherited by the subclass are also invalidert. - Mit dieser Methode k"onnen Slots der Subclasses "uber die Slot-Id - oder alternativ "uber die Which-Id invalidiert werden. Slot-Ids, - die von der Subclass ererbt sind, werden ebenfalls invalidert. + [Cross-reference] - [Querverweise] <SfxBindings::Invalidate(sal_uInt16)> <SfxBindings::InvalidateAll(sal_Bool)> */ @@ -599,7 +582,7 @@ void SfxShell::Invalidate { if ( !GetViewShell() ) { - DBG_ERROR( "wrong Invalidate method called!" ); + OSL_FAIL( "wrong Invalidate method called!" ); return; } @@ -620,11 +603,11 @@ void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ) const SfxSlot *pSlot = pIF->GetSlot(nId); if ( pSlot ) { - // bei Enum-Slots ist der Master-Slot zu invalidieren + // At Enum-Slots invalidate the Master-Slot if ( SFX_KIND_ENUM == pSlot->GetKind() ) pSlot = pSlot->GetLinkedSlot(); - // den Slot selbst und ggf. auch alle Slave-Slots invalidieren + // Invalidate the Slot itself and possible also all Slave-Slots rBindings.Invalidate( pSlot->GetSlotId() ); for ( const SfxSlot *pSlave = pSlot->GetLinkedSlot(); pSlave && pIF->ContainsSlot_Impl( pSlave ) && @@ -648,15 +631,15 @@ void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ) void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI ) -/* [Beschreibung] +/* [Description] - Diese Methode steuert die Aktivierung der SfxShell-Instanz. Zun"achst - wird durch Aufruf der virtuellen Methode <SfxShell::Activate(sal_Bool)> - der Subclass die M"oglichkeit gegeben, auf das Event zu reagieren. + This method controls the activation of SfxShell instance. First, by calling + the virtual method <SfxShell::Activate(sal_Bool)> which gives the subclass the + opportunity to respond to the event. - Bei bMDI == TRUE wird das zugeh"orige SbxObject 'scharfgeschaltet', - so da\s Methoden des Objekts unqualifiziert (ohne den Namen des Objekts) - vom BASIC gefunden werden. + When bMDI == TRUE, the associated SbxObject is being 'armed', so that + unqualified methods of the object (without the name of the object) + from BASIC are found. */ { @@ -677,12 +660,12 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI ) if ( bMDI ) { - // Frame merken, in dem aktiviert wird + // Remember Frame, in which it was activated pImp->pFrame = pFrame; pImp->bActive = sal_True; } - // Subklasse benachrichtigen + // Notify Subclass Activate(bMDI); } @@ -690,16 +673,14 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI ) void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI ) -/* [Beschreibung] +/* [Description] - Diese Methode steuert die Deaktivierung der SfxShell-Instanz. Bei - bMDI == TRUE wird zun"achst das SbxObject in einen Status versetzt, - so da\s Methoden vom BASIC aus nur noch qualifiziert gerufen werden - k"onnen. + This method controls the deactivation of the SfxShell instance. When + bMDI == TRUE the SbxObject is first set to a status that only qualified + BASIC methods can be called. - Dann erh"alt in jedem Fall die Subclass durch Aufruf der virtuellen - Methode <SfxShell::Deactivate(sal_Bool)> die M"oglichkeit auf das Event - zu reagieren. + Then the subclass gets the opportunity in every case to respond to the + event by calling the virtual method <SfxShell::Deactivate(sal_Bool)>. */ { @@ -718,15 +699,16 @@ void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI ) DbgTrace( aMsg.GetBuffer() ); #endif - // nur wenn er vom Frame kommt (nicht z.B. pop der BASIC-IDE vom AppDisp) + // Only when it comes from a Frame + // (not when for instance by poping BASIC-IDE from AppDisp) if ( bMDI && pImp->pFrame == pFrame ) { - // austragen + // deliver pImp->pFrame = 0; pImp->bActive = sal_False; } - // Subklasse benachrichtigen + // Notify Subclass Deactivate(bMDI); } @@ -742,28 +724,27 @@ sal_Bool SfxShell::IsActive() const void SfxShell::Activate ( sal_Bool /*bMDI*/ /* TRUE - der <SfxDispatcher>, auf dem die SfxShell sich - befindet, ist aktiv geworden oder die SfxShell - Instanz wurde auf einen aktiven SfxDispatcher - gepusht. (vergl. SystemWindow::IsMDIActivate()) + the <SfxDispatcher>, on which the SfxShell is + located, is activated or the SfxShell instance + was pushed on an active SfxDispatcher. + (compare with SystemWindow::IsMDIActivate()) FALSE - das zum <SfxViewFrame>, auf dessen SfxDispatcher - sich die SfxShell Instanz befindet, wurde - aktiviert. - (z.B. durch einen geschlossenen Dialog) */ + the <SfxViewFrame>, on which SfxDispatcher + the SfxShell instance is located, was + activated. (for example by a closing dialoge) */ ) -/* [Beschreibung] +/* [Description] - Virtuelle Methode, die beim Aktivieren der SfxShell Instanz gerufen - wird, um den Subclasses die Gelegenheit zu geben, auf das Aktivieren - zu reagieren. + Virtual method that is called when enabling the SfxShell instance, + in order to give the Subclasses the opportunity to respond to the + to the enabling. - Die Basisimplementation ist leer und braucht nicht gerufen zu werden. + The base implementation is empty and does not need to be called. + [Cross-reference] - [Querverweise] StarView SystemWindow::Activate(sal_Bool) */ @@ -775,28 +756,27 @@ void SfxShell::Activate void SfxShell::Deactivate ( sal_Bool /*bMDI*/ /* TRUE - der <SfxDispatcher>, auf dem die SfxShell sich - befindet, ist inaktiv geworden oder die SfxShell - Instanz wurde auf einen aktiven SfxDispatcher - gepoppt. (vergl. SystemWindow::IsMDIActivate()) + the <SfxDispatcher>, on which the SfxShell is + located, is inactivated or the SfxShell instance + was popped on an active SfxDispatcher. + (compare with SystemWindow::IsMDIActivate()) FALSE - das zum <SfxViewFrame>, auf dessen SfxDispatcher - sich die SfxShell Instanz befindet, wurde - deaktiviert. (z.B. durch einen Dialog) */ + the <SfxViewFrame>, on which SfxDispatcher + the SfxShell instance is located, was + deactivated. (for example by a dialoge) */ ) -/* [Beschreibung] +/* [Description] - Virtuelle Methode, die beim Deaktivieren der SfxShell Instanz gerufen - wird, um den Subclasses die Gelegenheit zu geben, auf das Deaktivieren - zu reagieren. + Virtual method that is called when disabling the SfxShell instance, + to give the Subclasses the opportunity to respond to the disabling. - Die Basisimplementation ist leer und braucht nicht gerufen zu werden. + The base implementation is empty and does not need to be called. + [Cross-reference] - [Querverweise] StarView SystemWindow::Dectivate(sal_Bool) */ @@ -807,15 +787,16 @@ void SfxShell::ParentActivate ( ) -/* [Beschreibung] +/* [Description] + + A parent of the <SfxDispatcher> on which the SfxShell is located, has + become active, or the SfxShell instance was pushed on a <SfxDispatcher>, + which parent is active. - Ein Parent des <SfxDispatcher>, auf dem die SfxShell sich befindet, - ist aktiv geworden, oder die SfxShell Instanz wurde auf einen - <SfxDispatcher> gepusht, dessen parent aktiv ist. + The base implementation is empty and does not need to be called. - Die Basisimplementation ist leer und braucht nicht gerufen zu werden. + [Cross-reference] - [Querverweise] SfxShell::Activate() */ { @@ -827,14 +808,15 @@ void SfxShell::ParentDeactivate ( ) -/* [Beschreibung] +/* [Description] - Der aktive Parent des <SfxDispatcher>, auf dem die SfxShell sich befindet, - ist deaktiviert worden. + The active parent of the <SfxDispatcher> on which the SfxShell is located, + has been disabled. - Die Basisimplementation ist leer und braucht nicht gerufen zu werden. + The base implementation is empty and does not need to be called. + + [Cross-reference] - [Querverweise] SfxShell::Deactivate() */ { @@ -844,11 +826,11 @@ void SfxShell::ParentDeactivate ResMgr* SfxShell::GetResMgr() const -/* [Beschreibung] +/* [Description] - Diese Methode liefert den ResMgr der <Resource-DLL>, die von der - SfxShell-Instanz verwendet wird. Ist dies ein 0-Pointer, so - ist der aktuelle Resource-Manager zu verwenden. + This method provides the ResMgr of the <Resource-DLL> that are used by + the SfxShell instance. If this is a NULL-pointer, then the current + resource manager is to be used. */ { @@ -859,13 +841,13 @@ ResMgr* SfxShell::GetResMgr() const bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) -/* [Beschreibung] +/* [Description] - Diese Methode stellt durch Aufruf der Statusfunktion fest, - ob 'rSlot' aktuell ausgef"uhrt werden kann. + This method determines by calling the status function whether 'rSlot' + can be executed currently. */ { - // Slot-Status holen + // Get Slot status SfxItemPool &rPool = GetPool(); const sal_uInt16 nId = rSlot.GetWhich( rPool ); SfxItemSet aSet(rPool, nId, nId); @@ -882,8 +864,9 @@ long ShellCall_Impl( void* pObj, void* pArg ) return 0; } -/* [Beschreibung] - Asynchrones ExecuteSlot fuer das RELOAD +/* [Description] + + Asynchronous ExecuteSlot for the RELOAD */ //-------------------------------------------------------------------- @@ -903,24 +886,23 @@ const SfxPoolItem* SfxShell::ExecuteSlot( SfxRequest& rReq, sal_Bool bAsync ) const SfxPoolItem* SfxShell::ExecuteSlot ( - SfxRequest &rReq, // der weiterzuleitende <SfxRequest> - const SfxInterface* pIF // default = 0 bedeutet virtuell besorgen + SfxRequest &rReq, // the relayed <SfxRequest> + const SfxInterface* pIF // default = 0 means get virtually ) -/* [Beschreibung] +/* [Description] - Diese Methode erm"oglicht das Weiterleiten eines <SfxRequest> an - die angegebene Basis-<SfxShell>. + This method allows you to forward a <SfxRequest> to the specified + base <SfxShell>. + [Example] - [Beispiel] + In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be + intercepted. Under certain circumstances a query should appear before + you print, and the request will be aborted if necessary. - In einer von SfxViewShell abgeleiteten Klasse soll SID_PRINTDOCDIRECT - abgefangen werden. Unter bestimmten Umst"anden soll vor dem Drucken - eine Abfrage erscheinen, und der Request soll ggf. abgebrochen werden. - - Dazu ist in der IDL dieser Subklasse der o.g. Slot einzutragen. Die - Execute-Methode enth"alt dann skizziert: + Also in the IDL of this subclass of the above slot is entered. The status + method will contain in outline: void SubViewShell::Exec( SfxRequest &rReq ) { @@ -932,11 +914,10 @@ const SfxPoolItem* SfxShell::ExecuteSlot } } - Es braucht i.d.R. kein rReq.Done() gerufen zu werden, da das bereits - die Implementierung der SfxViewShell erledigt bzw. abgebrochen wurde. - + It usually takes no rReq.Done() to be called as that is already completed + in implementation of the SfxViewShell, for instance it has been canceled. - [Querverweise] + [Cross-reference] <SfxShell::GetSlotState(sal_uInt16,const SfxInterface*,SfxItemSet*)> */ @@ -964,34 +945,33 @@ const SfxPoolItem* SfxShell::ExecuteSlot const SfxPoolItem* SfxShell::GetSlotState ( - sal_uInt16 nSlotId, // Slot-Id des zu befragenden Slots - const SfxInterface* pIF, // default = 0 bedeutet virtuell besorgen - SfxItemSet* pStateSet // SfxItemSet der Slot-State-Methode + sal_uInt16 nSlotId, // Slot-Id to the Slots in question + const SfxInterface* pIF, // default = 0 means get virtually + SfxItemSet* pStateSet // SfxItemSet of the Slot-State method ) -/* [Beschreibung] +/* [Description] - Diese Methode liefert den Status des Slots mit der angegebenen Slot-Id - "uber das angegebene Interface. + This method returns the status of the slot with the specified slot ID + on the specified interface. - Ist der Slot disabled oder in dieser SfxShell (und deren Parent-Shells) - nicht bekannt, wird ein 0-Pointer zur"uckgeliefert. + If the slot is disabled or in this SfxShell (and their parent shells) are + not known, a Null-pointer is returned. - Hat der Slot keinen Status, wird ein SfxVoidItem zur"uckgeliefert. + If the slot does not have a Status, a SfxVoidItem is returned. - Der Status wird bei pStateSet != 0 gleich in diesem Set gesetzt, so - da\s <SfxShell>-Subklassen Slots-"uberladen und auch bei der - Status-Methode die Basis-Implementierung rufen k"onnen. + The status is set directly in this Set when pStateSet != 0 , so that + overloaded Slots of the <SfxShell> Subclasses and also in the Status + method of the base implementation can be called. + [Example] - [Beispiel] + In a derived class of SfxViewShell the SID_PRINTDOCDIRECT will be + intercepted. Under certain circumstances a query should appear before + you print, and the request will be aborted if necessary. - In einer von SfxViewShell abgeleiteten Klasse soll SID_PRINTDOCDIRECT - abgefangen werden. Unter bestimmten Umst"anden soll vor dem Drucken - eine Abfrage erscheinen, und der Request soll ggf. abgebrochen werden. - - Dazu ist in der IDL dieser Subklasse der o.g. Slot einzutragen. Die - Status-Methode enth"alt dann skizziert: + Also in the IDL of this subclass of the above slot is entered. The status + method will contain in outline: void SubViewShell::PrintState( SfxItemSet &rState ) { @@ -1001,14 +981,13 @@ const SfxPoolItem* SfxShell::GetSlotState ... } - - [Querverweise] + [Cross-reference] <SfxShell::ExecuteSlot(SfxRequest&)> */ { - // Slot am angegebenen Interface besorgen + // Get Slot on the given Interface if ( !pIF ) pIF = GetInterface(); SfxItemState eState; @@ -1020,21 +999,21 @@ const SfxPoolItem* SfxShell::GetSlotState if ( !pSlot ) pSlot = pIF->GetSlot(nSlotId); if ( pSlot ) - // ggf. auf Which-Id mappen + // Map on Which-Id if possible nSlotId = pSlot->GetWhich( rPool ); - // Item und Item-Status besorgen + // Get Item and Item status const SfxPoolItem *pItem = NULL; - SfxItemSet aSet( rPool, nSlotId, nSlotId ); // pItem stirbt sonst zu fr"uh + SfxItemSet aSet( rPool, nSlotId, nSlotId ); // else pItem dies too soon if ( pSlot ) { - // Status-Methode rufen + // Call Status method SfxStateFunc pFunc = pSlot->GetStateFnc(); if ( pFunc ) CallState( pFunc, aSet ); eState = aSet.GetItemState( nSlotId, sal_True, &pItem ); - // ggf. Default-Item besorgen + // get default Item if possible if ( eState == SFX_ITEM_DEFAULT ) { if ( SfxItemPool::IsWhich(nSlotId) ) @@ -1046,7 +1025,7 @@ const SfxPoolItem* SfxShell::GetSlotState else eState = SFX_ITEM_UNKNOWN; - // Item und Item-Status auswerten und ggf. in pStateSet mitpflegen + // Evaluate Item and item status and possibly maintain them in pStateSet SfxPoolItem *pRetItem = 0; if ( eState <= SFX_ITEM_DISABLED ) { @@ -1080,12 +1059,12 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em { SfxViewShell *pViewSh = PTR_CAST ( SfxViewShell, this); - DBG_ASSERT(pViewSh, "SetVerbs nur an der ViewShell aufrufen!"); + DBG_ASSERT(pViewSh, "Only call SetVerbs at the ViewShell!"); if ( !pViewSh ) return; - // Zun"achst alle Statecaches dirty machen, damit keiner mehr versucht, - // die Slots zu benutzen + // First make all Statecaches dirty, so that no-one no longer tries to use + // the Slots { SfxBindings *pBindings = pViewSh->GetViewFrame()->GetDispatcher()->GetBindings(); @@ -1101,7 +1080,7 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em for (sal_Int32 n=0; n<aVerbs.getLength(); n++) { sal_uInt16 nSlotId = SID_VERB_START + nr++; - DBG_ASSERT(nSlotId <= SID_VERB_END, "Zuviele Verben!"); + DBG_ASSERT(nSlotId <= SID_VERB_END, "To many Verbs!"); if (nSlotId > SID_VERB_END) break; @@ -1109,8 +1088,8 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em pNewSlot->nSlotId = nSlotId; pNewSlot->nGroupId = 0; - // Verb-Slots m"ussen asynchron ausgef"uhrt werden, da sie w"ahrend - // des Ausf"uhrens zerst"ort werden k"onnten + // Verb slots must be executed asynchronously, so that they can be + // destroyed while executing. pNewSlot->nFlags = SFX_SLOT_ASYNCHRON | SFX_SLOT_CONTAINER; pNewSlot->nMasterSlotId = 0; pNewSlot->nValue = 0; @@ -1139,8 +1118,8 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em if (pViewSh) { - // Der Status von SID_OBJECT wird im Controller direkt an der Shell - // abgeholt, es reicht also, ein neues StatusUpdate anzuregen + // The status of SID_OBJECT is collected in the controller directly on + // the Shell, it is thus enough to encourage a new status update SfxBindings *pBindings = pViewSh->GetViewFrame()->GetDispatcher()-> GetBindings(); pBindings->Invalidate( SID_OBJECT, sal_True, sal_True ); @@ -1196,9 +1175,9 @@ const SfxSlot* SfxShell::GetVerbSlot_Impl(sal_uInt16 nId) const { com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > rList = pImp->aVerbList; - DBG_ASSERT(nId >= SID_VERB_START && nId <= SID_VERB_END,"Falsche VerbId!"); + DBG_ASSERT(nId >= SID_VERB_START && nId <= SID_VERB_END,"Wrong VerbId!"); sal_uInt16 nIndex = nId - SID_VERB_START; - DBG_ASSERT(nIndex < rList.getLength(),"Falsche VerbId!"); + DBG_ASSERT(nIndex < rList.getLength(),"Wrong VerbId!"); if (nIndex < rList.getLength()) return pImp->aSlotArr[nIndex]; @@ -1249,13 +1228,13 @@ void SfxShell::UIFeatureChanged() SfxViewFrame *pFrame = GetFrame(); if ( pFrame && pFrame->IsVisible() ) { - // Auch dann Update erzwingen, wenn Dispatcher schon geupdated ist, - // sonst bleibt evtl. irgendwas in den gebunkerten Tools stecken. - // Asynchron aufrufen, um Rekursionen zu vermeiden + // Also force an update, if dispatcher is already updated otherwise + // something my get stuck in the bunkered tools. Asynchronous call to + // prevent recursion. if ( !pImp->pUpdater ) pImp->pUpdater = new svtools::AsynchronLink( Link( this, DispatcherUpdate_Impl ) ); - // Mehrfachaufrufe gestattet + // Multiple views allowed pImp->pUpdater->Call( pFrame->GetDispatcher(), sal_True ); } } @@ -1286,3 +1265,4 @@ void SfxShell::SetViewShell_Impl( SfxViewShell* pView ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/sorgitm.cxx b/sfx2/source/control/sorgitm.cxx index df627a19e6fb..4bf146527839 100644 --- a/sfx2/source/control/sorgitm.cxx +++ b/sfx2/source/control/sorgitm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -88,7 +89,7 @@ int SfxScriptOrganizerItem::operator==( const SfxPoolItem& rItem) const } -sal_Bool SfxScriptOrganizerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const +bool SfxScriptOrganizerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const { String aValue; sal_Bool bIsString = sal_False; @@ -102,21 +103,21 @@ sal_Bool SfxScriptOrganizerItem::QueryValue( com::sun::star::uno::Any& rVal, sal aValue = aLanguage; break; default: - DBG_ERROR("Wrong MemberId!"); - return sal_False; + OSL_FAIL("Wrong MemberId!"); + return false; } if ( bIsString ) rVal <<= ::rtl::OUString( aValue ); else rVal <<= bValue; - return sal_True; + return true; } -sal_Bool SfxScriptOrganizerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) +bool SfxScriptOrganizerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) { ::rtl::OUString aValue; - sal_Bool bRet = sal_False; + sal_Bool bRet = false; nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) { @@ -127,10 +128,11 @@ sal_Bool SfxScriptOrganizerItem::PutValue( const com::sun::star::uno::Any& rVal, aLanguage = aValue; break; default: - DBG_ERROR("Wrong MemberId!"); - return sal_False; + OSL_FAIL("Wrong MemberId!"); + return false; } return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 889cf97b1b6c..50011820f4bf 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,11 +30,10 @@ #include "precompiled_sfx2.hxx" #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 +#include <string> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> @@ -49,9 +49,6 @@ #include <svl/visitem.hxx> #include <comphelper/processfactory.hxx> -#ifndef GCC -#endif - #include <sfx2/app.hxx> #include <sfx2/appuno.hxx> #include "statcach.hxx" @@ -110,7 +107,6 @@ void SAL_CALL BindDispatch_Impl::statusChanged( const ::com::sun::star::frame:: SfxPoolItem *pItem=NULL; sal_uInt16 nId = pCache->GetId(); SfxItemState eState = SFX_ITEM_DISABLED; - // pCache->Invalidate( sal_False ); if ( !aStatus.IsEnabled ) { // default @@ -204,10 +200,7 @@ void BindDispatch_Impl::Dispatch( uno::Sequence < beans::PropertyValue > aProps, } //-------------------------------------------------------------------- - -/* Dieser Konstruktor fuer einen ungueltigen Cache, der sich also - bei der ersten Anfrage zun"achst updated. - */ +// This constructor for an invalid cache that is updated in the first request. SfxStateCache::SfxStateCache( sal_uInt16 nFuncId ): pDispatch( 0 ), @@ -226,16 +219,13 @@ SfxStateCache::SfxStateCache( sal_uInt16 nFuncId ): } //-------------------------------------------------------------------- - -/* Der Destruktor pr"uft per Assertion, ob noch Controller angemeldet - sind. - */ +// The Destructor checks by assertion, even if controllers are registered. SfxStateCache::~SfxStateCache() { DBG_MEMTEST(); DBG_DTOR(SfxStateCache, 0); - DBG_ASSERT( pController == 0 && pInternalController == 0, "es sind noch Controller angemeldet" ); + DBG_ASSERT( pController == 0 && pInternalController == 0, "there are still Controllers registered" ); if ( !IsInvalidItem(pLastItem) ) delete pLastItem; if ( pDispatch ) @@ -263,7 +253,6 @@ void SfxStateCache::Invalidate( sal_Bool bWithMsg ) } //-------------------------------------------------------------------- - // gets the corresponding function from the dispatcher or the cache const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & xProv ) @@ -360,27 +349,23 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons //-------------------------------------------------------------------- -// Status setzen in allen Controllern +// Set Status in all Controllers void SfxStateCache::SetState ( - SfxItemState eState, // <SfxItemState> von 'pState' - const SfxPoolItem* pState, // Status des Slots, ggf. 0 oder -1 + SfxItemState eState, // <SfxItemState> from 'pState' + const SfxPoolItem* pState, // Slot Status, 0 or -1 sal_Bool bMaybeDirty ) -/* [Beschreibung] +/* [Description] - Diese Methode verteilt die Status auf alle an dieser SID gebundenen - <SfxControllerItem>s. Ist der Wert derselbe wie zuvor und wurde in- - zwischen weder ein Controller angemeldet, noch ein Controller invalidiert, - dann wird kein Wert weitergeleitet. Dadurch wird z.B. Flackern in - ListBoxen vermieden. + This method distributes the status of all of this SID bound + <SfxControllerItem>s. If the value is the same as before, and if neither + controller was registered nor invalidated inbetween, then no value is + passed. This way the flickering is for example avoided in ListBoxes. */ - { -// if ( pDispatch ) -// return; SetState_Impl( eState, pState, bMaybeDirty ); } @@ -390,7 +375,6 @@ void SfxStateCache::SetVisibleState( sal_Bool bShow ) { SfxItemState eState( SFX_ITEM_AVAILABLE ); const SfxPoolItem* pState( NULL ); - sal_Bool bNotify( sal_False ); sal_Bool bDeleteItem( sal_False ); if ( bShow != bItemVisible ) @@ -407,7 +391,6 @@ void SfxStateCache::SetVisibleState( sal_Bool bShow ) pState = pLastItem; eState = eLastState; - bNotify = ( pState != 0 ); } else { @@ -415,7 +398,7 @@ void SfxStateCache::SetVisibleState( sal_Bool bShow ) bDeleteItem = sal_True; } - // Controller updaten + // Update Controller if ( !pDispatch && pController ) { for ( SfxControllerItem *pCtrl = pController; @@ -427,7 +410,7 @@ void SfxStateCache::SetVisibleState( sal_Bool bShow ) if ( pInternalController ) pInternalController->StateChanged( nId, eState, pState ); - if ( !bDeleteItem ) + if ( bDeleteItem ) delete pState; } } @@ -436,8 +419,8 @@ void SfxStateCache::SetVisibleState( sal_Bool bShow ) void SfxStateCache::SetState_Impl ( - SfxItemState eState, // <SfxItemState> von 'pState' - const SfxPoolItem* pState, // Status des Slots, ggf. 0 oder -1 + SfxItemState eState, // <SfxItemState> from 'pState' + const SfxPoolItem* pState, // Slot Status, 0 or -1 sal_Bool bMaybeDirty ) { @@ -445,18 +428,16 @@ void SfxStateCache::SetState_Impl DBG_MEMTEST(); DBG_CHKTHIS(SfxStateCache, 0); - // wenn zwischen Enter- und LeaveRegistrations ein hartes Update kommt - // k"onnen zwischenzeitlich auch Cached ohne Controller exisitieren + // If a hard update occurs between enter- and leave-registrations is a + // can also intermediate Cached exist without controller. if ( !pController && !pInternalController ) return; DBG_ASSERT( bMaybeDirty || !bSlotDirty, "setting state of dirty message" ); -// DBG_ASSERT( bCtrlDirty || ( aSlotServ.GetSlot() && aSlotServ.GetSlot()->IsMode(SFX_SLOT_VOLATILE) ), ! Discussed with MBA -// "setting state of non dirty controller" ); DBG_ASSERT( SfxControllerItem::GetItemState(pState) == eState, "invalid SfxItemState" ); DBG_PROFSTART(SfxStateCacheSetState); - // m"ussen die Controller "uberhaupt benachrichtigt werden? + // does the controller have to be notified at all? bool bNotify = bItemDirty; if ( !bItemDirty ) { @@ -472,7 +453,7 @@ void SfxStateCache::SetState_Impl if ( bNotify ) { - // Controller updaten + // Update Controller if ( !pDispatch && pController ) { for ( SfxControllerItem *pCtrl = pController; @@ -484,7 +465,7 @@ void SfxStateCache::SetState_Impl if ( pInternalController ) ((SfxDispatchController_Impl *)pInternalController)->StateChanged( nId, eState, pState, &aSlotServ ); - // neuen Wert merken + // Remember new value if ( !IsInvalidItem(pLastItem) ) DELETEZ(pLastItem); if ( pState && !IsInvalidItem(pState) ) @@ -501,22 +482,21 @@ void SfxStateCache::SetState_Impl //-------------------------------------------------------------------- - -// alten Status in allen Controllern nochmal setzen +// Set old status again in all the controllers void SfxStateCache::SetCachedState( sal_Bool bAlways ) { DBG_MEMTEST(); DBG_CHKTHIS(SfxStateCache, 0); - DBG_ASSERT(pController==NULL||pController->GetId()==nId, "Cache mit falschem ControllerItem" ); + DBG_ASSERT(pController==NULL||pController->GetId()==nId, "Cache with wrong ControllerItem" ); DBG_PROFSTART(SfxStateCacheSetState); - // nur updaten wenn cached item vorhanden und auch verarbeitbar - // (Wenn der State gesendet wird, mu\s sichergestellt sein, da\s ein - // Slotserver vorhanden ist, s. SfxControllerItem::GetCoreMetric() ) + // Only update if cached item exists and also able to process. + // (If the State is sent, it must be ensured that a SlotServer is present, + // see SfxControllerItem:: GetCoreMetric()) if ( bAlways || ( !bItemDirty && !bSlotDirty ) ) { - // Controller updaten + // Update Controller if ( !pDispatch && pController ) { for ( SfxControllerItem *pCtrl = pController; @@ -528,7 +508,7 @@ void SfxStateCache::SetCachedState( sal_Bool bAlways ) if ( pInternalController ) ((SfxDispatchController_Impl *)pInternalController)->StateChanged( nId, eLastState, pLastItem, &aSlotServ ); - // Controller sind jetzt ok + // Controller is now ok bCtrlDirty = sal_True; } @@ -537,8 +517,7 @@ void SfxStateCache::SetCachedState( sal_Bool bAlways ) //-------------------------------------------------------------------- - -// FloatingWindows in allen Controls mit dieser Id zerstoeren +// Destroy FloatingWindows in all Controls with this Id void SfxStateCache::DeleteFloatingWindows() { @@ -548,7 +527,7 @@ void SfxStateCache::DeleteFloatingWindows() SfxControllerItem *pNextCtrl=0; for ( SfxControllerItem *pCtrl=pController; pCtrl; pCtrl=pNextCtrl ) { - DBG_TRACE((ByteString("pCtrl: ").Append(ByteString::CreateFromInt64((sal_uIntPtr)pCtrl))).GetBuffer()); + OSL_TRACE((ByteString("pCtrl: ").Append(ByteString::CreateFromInt64((sal_uIntPtr)pCtrl))).GetBuffer()); pNextCtrl = pCtrl->GetItemLink(); pCtrl->DeleteFloatingWindow(); } @@ -575,3 +554,4 @@ void SfxStateCache::Dispatch( const SfxItemSet* pSet, sal_Bool bForceSynchron ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 0bde76cb44b1..e512340443a3 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,7 @@ #include <com/sun/star/frame/status/Visibility.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <uno/current_context.hxx> #include <vcl/svapp.hxx> @@ -71,7 +72,6 @@ namespace css = ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; -//long nOfficeDispatchCount = 0; enum URLTypeId { @@ -105,10 +105,10 @@ SfxUnoControllerItem::SfxUnoControllerItem( SfxControllerItem *pItem, SfxBinding : pCtrlItem( pItem ) , pBindings( &rBind ) { - DBG_ASSERT( !pCtrlItem || !pCtrlItem->IsBound(), "ControllerItem fehlerhaft!" ); + DBG_ASSERT( !pCtrlItem || !pCtrlItem->IsBound(), "ControllerItem is incorrect!" ); aCommand.Complete = rCmd; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aCommand ); pBindings->RegisterUnoController_Impl( this ); } @@ -130,19 +130,18 @@ void SfxUnoControllerItem::UnBind() void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DBG_ASSERT( pCtrlItem, "dispatch implementation didn't respect our previous removeStatusListener call!" ); if ( rEvent.Requery ) { - // Fehler kann nur passieren, wenn das alte Dispatch fehlerhaft implementiert - // ist, also removeStatusListener nicht gefunzt hat. Aber sowas soll - // ja vorkommen ... - // Also besser vor ReleaseDispatch gegen Abflug sch"utzen! + // Error can only happen if the old Dispatch is implemented incorrectly + // i.e. removeStatusListener did not work. But such things can happen... + // So protect before ReleaseDispatch from release! ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); ReleaseDispatch(); if ( pCtrlItem ) - GetNewDispatch(); // asynchron ?? + GetNewDispatch(); // asynchronous ?? } else if ( pCtrlItem ) { @@ -206,7 +205,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !pBindings ) { // Bindings released - DBG_ERROR( "Tried to get dispatch, but no Bindings!" ); + OSL_FAIL( "Tried to get dispatch, but no Bindings!" ); return; } @@ -339,48 +338,20 @@ sal_Int64 SAL_CALL SfxOfficeDispatch::getSomething( const ::com::sun::star::uno: return 0; } -/* ASDBG -void* SfxOfficeDispatch::getImplementation(Reflection *p) -{ - if( p == ::getCppuType((const SfxOfficeDispatch*)0) ) - return this; - else - return ::cppu::OWeakObject::getImplementation(p); - -} - -Reflection* ::getCppuType((const SfxOfficeDispatch*)0) -{ - static StandardClassReflection aRefl( - 0, - createStandardClass( - "SfxOfficeDispatch", ::cppu::OWeakObject::get::cppu::OWeakObjectIdlClass(), - 1, - ::getCppuType((const ::com::sun::star::frame::XDispatch*)0) ) ); - return &aRefl; -} -*/ - SfxOfficeDispatch::SfxOfficeDispatch( SfxBindings& rBindings, SfxDispatcher* pDispat, const SfxSlot* pSlot, const ::com::sun::star::util::URL& rURL ) { -// nOfficeDispatchCount++; - // this object is an adapter that shows a ::com::sun::star::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state pControllerItem = new SfxDispatchController_Impl( this, &rBindings, pDispat, pSlot, rURL ); } SfxOfficeDispatch::SfxOfficeDispatch( SfxDispatcher* pDispat, const SfxSlot* pSlot, const ::com::sun::star::util::URL& rURL ) { -// nOfficeDispatchCount++; - // this object is an adapter that shows a ::com::sun::star::frame::XDispatch-Interface to the outside and uses a SfxControllerItem to monitor a state pControllerItem = new SfxDispatchController_Impl( this, NULL, pDispat, pSlot, rURL ); } SfxOfficeDispatch::~SfxOfficeDispatch() { -// --nOfficeDispatchCount; - if ( pControllerItem ) { // when dispatch object is released, destroy its connection to this object and destroy it @@ -470,7 +441,7 @@ sal_Bool SfxOfficeDispatch::IsMasterUnoCommand() const // Determine if URL contains a master/slave command which must be handled a little bit different sal_Bool SfxOfficeDispatch::IsMasterUnoCommand( const ::com::sun::star::util::URL& aURL ) { - if ( aURL.Protocol.equalsAscii( ".uno:" ) && + if ( aURL.Protocol.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".uno:" ) ) && ( aURL.Path.indexOf( '.' ) > 0 )) return sal_True; @@ -506,12 +477,12 @@ SfxDispatchController_Impl::SfxDispatchController_Impl( , bVisible( sal_True ) , pUnoName( pSlot->pUnoName ) { - if ( aDispatchURL.Protocol.equalsAscii("slot:") && pUnoName ) + if ( aDispatchURL.Protocol.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("slot:")) && pUnoName ) { ByteString aTmp(".uno:"); aTmp += pUnoName; aDispatchURL.Complete = ::rtl::OUString::createFromAscii( aTmp.GetBuffer() ); - Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aDispatchURL ); } @@ -667,7 +638,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( pDispatch && ( @@ -676,14 +647,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util ) ) { - /* - if ( !IsBound() && pBindings ) - { - pBindings->ENTERREGISTRATIONS(); - BindInternal_Impl( nSlot, pBindings ); - pBindings->LEAVEREGISTRATIONS(); - } */ - if ( !pDispatcher && pBindings ) pDispatcher = GetBindings().GetDispatcher_Impl(); @@ -702,6 +665,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util // Filter arguments which shouldn't be part of the sequence property value sal_Bool bTemp = sal_Bool(); sal_uInt16 nModifier(0); + sal_Bool bVBARequest = sal_False; std::vector< ::com::sun::star::beans::PropertyValue > aAddArgs; for( sal_Int32 n=0; n<nCount; n++ ) { @@ -718,6 +682,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util } else if( rProp.Name.equalsAsciiL("KeyModifier",11)) rProp.Value >>= nModifier; + else if( rProp.Name.equalsAsciiL("VBADialogResultRequest",22) ) + { + rProp.Value >>= bVBARequest; + } else aAddArgs.push_back( aArgs[n] ); } @@ -759,7 +727,6 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util aInternalSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrameRef ) ); sal_Bool bSuccess = sal_False; - sal_Bool bFailure = sal_False; const SfxPoolItem* pItem = NULL; SfxShell* pShell( 0 ); // #i102619# Retrieve metric from shell before execution - the shell could be destroyed after execution @@ -800,7 +767,14 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util pDispatcher->GetBindings()->Execute_Impl( aReq, pSlot, pShell ); pItem = aReq.GetReturnValue(); bSuccess = aReq.IsDone() || pItem != NULL; - bFailure = aReq.IsCancelled(); + if ( bVBARequest ) + { + SFX_REQUEST_ARG( aReq, pDlgRet, SfxBoolItem, SID_DIALOG_RETURN, sal_False ); + if ( pDlgRet ) + { + bSuccess = pDlgRet->GetValue(); + } + } } } #ifdef DBG_UTIL @@ -842,11 +816,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util ::com::sun::star::frame::DispatchResultEvent aEvent; if ( bSuccess ) aEvent.State = com::sun::star::frame::DispatchResultState::SUCCESS; -// else if ( bFailure ) else aEvent.State = com::sun::star::frame::DispatchResultState::FAILURE; -// else -// aEvent.State = com::sun::star::frame::DispatchResultState::DONTKNOW; aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch; if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) ) @@ -871,17 +842,10 @@ SfxDispatcher* SfxDispatchController_Impl::GetDispatcher() void SAL_CALL SfxDispatchController_Impl::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & aListener, const ::com::sun::star::util::URL& aURL) throw ( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !pDispatch ) return; - /*if ( !IsBound() && pBindings ) - { - pBindings->ENTERREGISTRATIONS(); - BindInternal_Impl( nSlot, pBindings ); - pBindings->LEAVEREGISTRATIONS(); - } */ - // Use alternative QueryState call to have a valid UNO representation of the state. ::com::sun::star::uno::Any aState; if ( !pDispatcher && pBindings ) @@ -1011,3 +975,5 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt { StateChanged( nSID, eState, pState, 0 ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index 13a0433b7be5..6e2dd844b095 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" +#include <sal/macros.h> #include "alienwarn.hxx" #include "sfx2/sfxresid.hxx" #include <sfx2/sfxuno.hxx> @@ -143,7 +145,7 @@ void SfxAlienWarningDialog::InitSize() &m_aSaveODFBtn, &m_aKeepCurrentBtn, &m_aMoreInfoBtn, &m_aOptionLine, &m_aWarningOnBox }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; @@ -175,3 +177,4 @@ void SfxAlienWarningDialog::InitSize() m_aSaveODFBtn.SetPosSizePixel( aPos, aNewSize ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/alienwarn.hrc b/sfx2/source/dialog/alienwarn.hrc index e3a23dc57836..e3a23dc57836 100644..100755 --- a/sfx2/source/dialog/alienwarn.hrc +++ b/sfx2/source/dialog/alienwarn.hrc diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index c7f9bbeec244..8c69e1b4bbc5 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,7 +56,7 @@ using namespace ::com::sun::star::uno; using namespace ::rtl; -#define USERITEM_NAME OUString::createFromAscii( "UserItem" ) +#define USERITEM_NAME OUString(RTL_CONSTASCII_USTRINGPARAM("UserItem")) class SfxModelessDialog_Impl : public SfxListener { @@ -136,10 +137,10 @@ void SfxModalDialog::SetDialogData_Impl() void SfxModalDialog::GetDialogData_Impl() -/* [Beschreibung] +/* [Description] - Hilfsfunktion; liest die Dialogposition aus der Ini-Datei - und setzt diese am "ubergebenen Window. + Helper function, reads the dialogue position from the ini file and + puts them on the transfered window. */ { @@ -166,11 +167,10 @@ void SfxModalDialog::init() SfxModalDialog::SfxModalDialog(Window* pParent, const ResId &rResId ) -/* [Beschreibung] +/* [Description] - Konstruktor der allgemeinen Basisklasse f"ur modale Dialoge; - ResId wird als ID im ini-file verwendet. - Die dort gespeicherte Position wird gesetzt. + Constructor of the general base class for modal Dialoge; + ResId is used as ID in ini-file. The saved position from there is set. */ : ModalDialog(pParent, rResId), @@ -186,11 +186,11 @@ SfxModalDialog::SfxModalDialog(Window* pParent, const ResId &rResId ) SfxModalDialog::SfxModalDialog(Window* pParent, sal_uInt32 nUniqueId, WinBits nWinStyle) : -/* [Beschreibung] +/* [Description] - Konstruktor der allgemeinen Basisklasse f"ur modale Dialoge; - ID f"ur das ini-file wird explizit "ubergeben. - Die dort gespeicherte Position wird gesetzt. + Constructor of the general base class for modal Dialoge; + The ID for the ini-file wird explicilty handed over. + The saved position from there is set. */ ModalDialog(pParent, nWinStyle), @@ -205,9 +205,9 @@ SfxModalDialog::SfxModalDialog(Window* pParent, SfxModalDialog::~SfxModalDialog() -/* [Beschreibung] +/* [Description] - Dtor; schreibt Dialogposition in das ini-file + Destructor; writes the Dialog position in the ini-file. */ { @@ -282,12 +282,12 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) void SfxModelessDialog::Initialize(SfxChildWinInfo *pInfo) -/* [Beschreibung] +/* [Description] - Initialisierung der Klasse SfxModelessDialog "uber ein SfxChildWinInfo. - Die Initialisierung erfolgt erst in einem 2.Schritt - nach dem ctor und sollte vom ctor der abgeleiteten Klasse - oder von dem des SfxChildWindows aufgerufen werden. + Initialization of the class SfxModelessDialog via a SfxChildWinInfo. + The initialization is done only in a 2nd step after the constructor, this + constructor should be called from the derived class or from the + SfxChildWindows. */ { @@ -296,12 +296,11 @@ void SfxModelessDialog::Initialize(SfxChildWinInfo *pInfo) void SfxModelessDialog::Resize() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse FloatingWindow merkt sich ggf. eine - ver"anderte Gr"o\se. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - auch SfxFloatingWindow::Resize() gerufen werden. + This virtual method of the class FloatingWindow keeps track if a change + in size has been made. When this method is overridden by a derived class, + then the SfxFloatingWindow: Resize() must also be called. */ { @@ -385,10 +384,10 @@ SfxModelessDialog::SfxModelessDialog( SfxBindings *pBindinx, long SfxModelessDialog::Notify( NotifyEvent& rEvt ) -/* [Beschreibung] +/* [Description] - Wenn ein ModelessDialog aktiviert wird, wird sein ViewFrame aktiviert. - Notwendig ist das bei PlugInFrames. + If a ModelessDialog is enabled its ViewFrame wil be activated. + This is necessary by PluginInFrames. */ { @@ -414,9 +413,9 @@ long SfxModelessDialog::Notify( NotifyEvent& rEvt ) } else if( rEvt.GetType() == EVENT_KEYINPUT ) { - // KeyInput zuerst f"ur Dialogfunktionen zulassen ( TAB etc. ) + // First, allow KeyInput for Dialog functions ( TAB etc. ) if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() ) - // dann auch global g"ultige Acceleratoren verwenden + // then also for valid global accelerators. return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); return sal_True; } @@ -428,9 +427,9 @@ long SfxModelessDialog::Notify( NotifyEvent& rEvt ) SfxModelessDialog::~SfxModelessDialog() -/* [Beschreibung] +/* [Description] - Dtor + Destructor */ { @@ -443,19 +442,16 @@ SfxModelessDialog::~SfxModelessDialog() sal_Bool SfxModelessDialog::Close() -/* [Beschreibung] - - Das Fenster wird geschlossen, indem das ChildWindow durch Ausf"uhren des - ChildWindow-Slots zerst"ort wird. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - danach SfxModelessDialogWindow::Close() gerufen werden, wenn nicht das - Close() mit "return sal_False" abgebrochen wird. +/* [Description] + The window is closed when the ChildWindow is destroyed by running the + ChildWindow-slots. If this is method is overridden by a derived class + method, then the SfxModelessDialogWindow: Close() must be called afterwards + if the Close() was not cancelled with "return sal_False". */ { - // Execute mit Parametern, da Toggle von einigen ChildWindows ignoriert - // werden kann + // Execute with Parameters, since Toggle is ignored by some ChildWindows. SfxBoolItem aValue( pImp->pMgr->GetType(), sal_False); pBindings->GetDispatcher_Impl()->Execute( pImp->pMgr->GetType(), @@ -467,14 +463,13 @@ sal_Bool SfxModelessDialog::Close() void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const -/* [Beschreibung] +/* [Description] - F"ullt ein SfxChildWinInfo mit f"ur SfxModelessDialof spezifischen Daten, - damit sie in die INI-Datei geschrieben werden koennen. - Es wird angenommen, da\s rInfo alle anderen evt. relevanten Daten in - der ChildWindow-Klasse erh"alt. - ModelessDialogs haben keine spezifischen Informationen, so dass die - Basisimplementierung nichts tut und daher nicht gerufen werden mu\s. + Fills a SfxChildWinInfo with specific data from SfxModelessDialog, + so that it can be written in the INI file. It is assumed that rinfo + receives all other possible relevant data in the ChildWindow class. + ModelessDialogs have no specific information, so that the base + implementation does nothing and therefore must not be called. */ { @@ -487,10 +482,10 @@ void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const long SfxFloatingWindow::Notify( NotifyEvent& rEvt ) -/* [Beschreibung] +/* [Description] - Wenn ein ModelessDialog aktiviert wird, wird sein ViewFrame aktiviert. - Notwendig ist das bei PlugInFrames. + If a ModelessDialog is enabled, its ViewFrame will be activated. + This necessary for the PluginInFrames. */ { @@ -519,9 +514,9 @@ long SfxFloatingWindow::Notify( NotifyEvent& rEvt ) } else if( rEvt.GetType() == EVENT_KEYINPUT ) { - // KeyInput zuerst f"ur Dialogfunktionen zulassen + // First, allow KeyInput for Dialog functions if ( !FloatingWindow::Notify( rEvt ) && SfxViewShell::Current() ) - // dann auch global g"ultige Acceleratoren verwenden + // then also for valid global accelerators. return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); return sal_True; } @@ -572,19 +567,16 @@ SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, sal_Bool SfxFloatingWindow::Close() -/* [Beschreibung] - - Das Fenster wird geschlossen, indem das ChildWindow durch Ausf"uhren des - ChildWindow-Slots zerst"ort wird. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - danach SfxFloatingWindow::Close() gerufen werden, wenn nicht das Close() - mit "return sal_False" abgebrochen wird. +/* [Description] + The window is closed when the ChildWindow is destroyed by running the + ChildWindow-slots. If this is method is overridden by a derived class + method, then the SfxModelessDialogWindow: Close) must be called afterwards + if the Close() was not cancelled with "return sal_False". */ { - // Execute mit Parametern, da Toggle von einigen ChildWindows ignoriert - // werden kann + // Execute with Parameters, since Toggle is ignored by some ChildWindows. SfxBoolItem aValue( pImp->pMgr->GetType(), sal_False); pBindings->GetDispatcher_Impl()->Execute( pImp->pMgr->GetType(), @@ -596,9 +588,9 @@ sal_Bool SfxFloatingWindow::Close() SfxFloatingWindow::~SfxFloatingWindow() -/* [Beschreibung] +/* [Description] - Dtor + Destructor */ { @@ -611,12 +603,11 @@ SfxFloatingWindow::~SfxFloatingWindow() void SfxFloatingWindow::Resize() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse FloatingWindow merkt sich ggf. eine - ver"anderte Gr"o\se. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - auch SfxFloatingWindow::Resize() gerufen werden. + This virtual method of the class FloatingWindow keeps track if a change + in size has been made. When this method is overridden by a derived class, + then the SfxFloatingWindow: Resize() must also be called. */ { @@ -675,12 +666,12 @@ void SfxFloatingWindow::StateChanged( StateChangedType nStateChange ) void SfxFloatingWindow::Initialize(SfxChildWinInfo *pInfo) -/* [Beschreibung] +/* [Description] - Initialisierung der Klasse SfxFloatingWindow "uber ein SfxChildWinInfo. - Die Initialisierung erfolgt erst in einem 2.Schritt - nach dem ctor und sollte vom ctor der abgeleiteten Klasse - oder von dem des SfxChildWindows aufgerufen werden. + Initialization of a class SfxFloatingWindow through a SfxChildWinInfo. + The initialization is done only in a 2nd step after the constructor and + should be called by the constructor of the derived class or from the + SfxChildWindows. */ { pImp->aWinState = pInfo->aWinState; @@ -690,15 +681,13 @@ void SfxFloatingWindow::Initialize(SfxChildWinInfo *pInfo) void SfxFloatingWindow::FillInfo(SfxChildWinInfo& rInfo) const -/* [Beschreibung] +/* [Description] - F"ullt ein SfxChildWinInfo mit f"ur SfxFloatingWindow spezifischen Daten, - damit sie in die INI-Datei geschrieben werden koennen. - Es wird angenommen, da\s rInfo alle anderen evt. relevanten Daten in - der ChildWindow-Klasse erh"alt. - Eingetragen werden hier gemerkte Gr"o\se und das ZoomIn-Flag. - Wird diese Methode "uberschrieben, mu\s zuerst die Basisimplementierung - gerufen werden. + Fills a SfxChildWinInfo with specific data from SfxFloatingWindow, + so that it can be written in the INI file. It is assumed that rinfo + receives all other possible relevant data in the ChildWindow class. + Insertions are marked with size and the ZoomIn flag. + If this method is overridden, the base implementation must be called first. */ { @@ -711,9 +700,9 @@ void SfxFloatingWindow::FillInfo(SfxChildWinInfo& rInfo) const IMPL_LINK( SfxSingleTabDialog, OKHdl_Impl, Button *, EMPTYARG ) -/* [Beschreibung] +/* [Description] - Ok_Handler; f"ur die gesetzte Page wird FillItemSet() gerufen. + Ok_Handler; FillItemSet() is called for setting of Page. */ { @@ -743,7 +732,7 @@ IMPL_LINK( SfxSingleTabDialog, OKHdl_Impl, Button *, EMPTYARG ) if ( bModified ) { - // auch noch schnell User-Daten im IniManager abspeichern + // Save user data in IniManager. pImpl->m_pSfxPage->FillUserData(); String sData( pImpl->m_pSfxPage->GetUserData() ); SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( GetUniqId() ) ); @@ -764,10 +753,10 @@ SfxSingleTabDialog::SfxSingleTabDialog sal_uInt16 nUniqueId ) : -/* [Beschreibung] +/* [Description] - Konstruktor der allgemeinen Basisklasse f"ur SingleTab-Dialoge; - ID f"ur das ini-file wird "ubergeben. + Constructor of the general base class for SingleTab-Dialoge; + ID for the ini-file is handed over. */ SfxModalDialog( pParent, nUniqueId, WinBits( WB_STDMODAL | WB_3DLOOK ) ), @@ -777,7 +766,7 @@ SfxSingleTabDialog::SfxSingleTabDialog pHelpBtn ( 0 ), pImpl ( new SingleTabDlgImpl ) { - DBG_WARNING( "please use the ctor with ViewFrame" ); + DBG_WARNING( "please use the constructor with ViewFrame" ); SetInputSet( &rSet ); } @@ -790,11 +779,11 @@ SfxSingleTabDialog::SfxSingleTabDialog const SfxItemSet* pInSet ) -/* [Beschreibung] +/* [Description] - Konstruktor der allgemeinen Basisklasse f"ur SingleTab-Dialoge; - ID f"ur das ini-file wird "ubergeben. - Sollte nicht mehr benutzt werden. + Constructor of the general base class for SingleTab-Dialoge; + ID for the ini-file is handed over. + Deprecated. */ : SfxModalDialog( pParent, nUniqueId, WinBits( WB_STDMODAL | WB_3DLOOK ) ), @@ -804,7 +793,7 @@ SfxSingleTabDialog::SfxSingleTabDialog pHelpBtn ( 0 ), pImpl ( new SingleTabDlgImpl ) { - DBG_WARNING( "bitte den Ctor mit ViewFrame verwenden" ); + DBG_WARNING( "please use the constructor with ViewFrame" ); SetInputSet( pInSet ); } @@ -817,11 +806,11 @@ SfxSingleTabDialog::SfxSingleTabDialog const String& rInfoURL ) -/* [Beschreibung] +/* [Description] - Konstruktor der allgemeinen Basisklasse f"ur SingleTab-Dialoge; - ID f"ur das ini-file wird "ubergeben. - */ + Constructor of the general base class for SingleTab-Dialoge; + ID for the ini-file is handed over. +*/ : SfxModalDialog( pParent, nUniqueId, WinBits( WB_STDMODAL | WB_3DLOOK ) ), @@ -881,7 +870,7 @@ void SfxSingleTabDialog::SetPage( TabPage* pNewPage ) if ( pImpl->m_pTabPage ) { - // Gr"ossen und Positionen anpassen + // Adjust size and position. pImpl->m_pTabPage->SetPosPixel( Point() ); Size aOutSz( pImpl->m_pTabPage->GetSizePixel() ); Size aOffSz = LogicToPixel( Size( RSC_SP_CTRL_X, RSC_SP_CTRL_Y ), MAP_APPFONT ); @@ -910,10 +899,10 @@ void SfxSingleTabDialog::SetPage( TabPage* pNewPage ) pOKBtn->Show(); pImpl->m_pTabPage->Show(); - // Text der TabPage in den Dialog setzen + // Set TabPage text in the Dialog SetText( pImpl->m_pTabPage->GetText() ); - // Dialog bekommt HelpId der TabPage + // Dialog recieves the HelpId of TabPage SetHelpId( pImpl->m_pTabPage->GetHelpId() ); SetUniqueId( pImpl->m_pTabPage->GetUniqueId() ); } @@ -923,12 +912,11 @@ void SfxSingleTabDialog::SetPage( TabPage* pNewPage ) void SfxSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc ) -/* [Beschreibung] +/* [Description] - Setzen einer (neuen) TabPage; eine bereits vorhandene Page - wird gel"oscht. - Die "ubergebene Page wird durch Aufruf von Reset() mit dem - initial "ubergebenen Itemset initialisiert. + Insert a (new) TabPage; an existing page is deleted. + The passed on page is initialized with the initially given Itemset + through calling Reset(). */ { @@ -951,7 +939,7 @@ void SfxSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, if ( pImpl->m_pSfxPage ) { - // erstmal die User-Daten besorgen, dann erst Reset() + // First obtain the user data, only then Reset() SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( GetUniqId() ) ); String sUserData; Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); @@ -962,7 +950,7 @@ void SfxSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, pImpl->m_pSfxPage->Reset( *GetInputItemSet() ); pImpl->m_pSfxPage->Show(); - // Gr"ossen und Positionen anpassen + // Adjust size and position pImpl->m_pSfxPage->SetPosPixel( Point() ); Size aOutSz( pImpl->m_pSfxPage->GetSizePixel() ); Size aBtnSiz = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); @@ -980,10 +968,10 @@ void SfxSingleTabDialog::SetTabPage( SfxTabPage* pTabPage, if ( Help::IsContextHelpEnabled() ) pHelpBtn->Show(); - // Text der TabPage in den Dialog setzen + // Set TabPage text in the Dialog SetText( pImpl->m_pSfxPage->GetText() ); - // Dialog bekommt HelpId der TabPage + // Dialog recieves the HelpId of TabPage SetHelpId( pImpl->m_pSfxPage->GetHelpId() ); SetUniqueId( pImpl->m_pSfxPage->GetUniqueId() ); } @@ -997,17 +985,9 @@ void SfxSingleTabDialog::SetInfoLink( const Link& rLink ) } //-------------------------------------------------------------------- -// Vergleichsfunktion fuer qsort - -#ifdef WNT -int __cdecl BaseDlgsCmpUS_Impl( const void* p1, const void* p2 ) -#else -#if defined(OS2) && defined(ICC) -int _Optlink BaseDlgsCmpUS_Impl( const void* p1, const void* p2 ) -#else -extern "C" int BaseDlgsCmpUS_Impl( const void* p1, const void* p2 ) -#endif -#endif +// Comparison function for qsort + +extern "C" int SAL_CALL BaseDlgsCmpUS_Impl( const void* p1, const void* p2 ) { return *(sal_uInt16*)p1 - *(sal_uInt16*)p2; } @@ -1015,15 +995,15 @@ extern "C" int BaseDlgsCmpUS_Impl( const void* p1, const void* p2 ) // ----------------------------------------------------------------------- /* - Bildet das Set "uber die Ranges der Page. Die Page muss die statische - Methode f"ur das Erfragen ihrer Ranges bei SetTabPage angegeben haben, - liefert also ihr Set onDemand. + Creates the set over the Page range. the page must register the static + method for querys on the range in SetTabPage, so the Set is delivered + onDemand. */ const sal_uInt16* SfxSingleTabDialog::GetInputRanges( const SfxItemPool& rPool ) { if ( GetInputItemSet() ) { - DBG_ERROR( "Set bereits vorhanden!" ); + OSL_FAIL( "Set already exists!" ); return GetInputItemSet()->GetRanges(); } @@ -1041,13 +1021,13 @@ const sal_uInt16* SfxSingleTabDialog::GetInputRanges( const SfxItemPool& rPool ) aUS.Insert( pTmpRanges, nLen, aUS.Count() ); } - //! Doppelte Ids entfernen? + //! Remove duplicate IDs? sal_uInt16 nCount = aUS.Count(); for ( sal_uInt16 i = 0; i < nCount; ++i ) aUS[i] = rPool.GetWhich( aUS[i]) ; - // sortieren + // sort if ( aUS.Count() > 1 ) qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(sal_uInt16), BaseDlgsCmpUS_Impl ); @@ -1057,3 +1037,4 @@ const sal_uInt16* SfxSingleTabDialog::GetInputRanges( const SfxItemPool& rPool ) return pRanges; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index 7f03bf416431..08940391ac87 100644..100755 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -65,8 +65,6 @@ #define RID_ERRBOX_MAIL_CONFIG ( RC_DIALOG_BEGIN + 92 ) -#define IMG_LST_STYLE_DESIGNER_HC ( RC_DIALOG_BEGIN + 99 ) - // 100-106 in tbxcust.hrc #define STR_MACRO_LOSS ( RC_DIALOG_BEGIN + 107 ) #define STR_CANCEL_RECORDING ( RC_DIALOG_BEGIN + 108 ) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 2d5c383f8b89..106633b0a9d5 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,7 +68,7 @@ #include <sfx2/frame.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/request.hxx> -//#include "exptypes.hxx" +#include <sfx2/passwd.hxx> #include "helper.hxx" #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> @@ -163,7 +164,8 @@ String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartE fSize /= nGiga; nDec = 3; } - const LocaleDataWrapper& rLocaleWrapper = SvtSysLocale().GetLocaleData(); + const SvtSysLocale aSysLocale; + const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); String aSizeStr( rLocaleWrapper.getNum( nSize1, 0 ) ); aSizeStr += aUnitStr; if ( bExtraBytes && ( nSize1 < nSize2 ) ) @@ -402,7 +404,6 @@ void SfxDocumentInfoItem::UpdateDocumentInfo( i_xDocProps->setAutoloadURL(::rtl::OUString()); } i_xDocProps->setDefaultTarget(getDefaultTarget()); -// i_xDocProps->setTemplateName(getTemplateName()); i_xDocProps->setAuthor(getAuthor()); i_xDocProps->setCreationDate(getCreationDate()); i_xDocProps->setModifiedBy(getModifiedBy()); @@ -510,7 +511,7 @@ void SfxDocumentInfoItem::AddCustomProperty( const ::rtl::OUString& sName, const m_aCustomProperties.push_back( pProp ); } -sal_Bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const +bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const { String aValue; sal_Int32 nValue = 0; @@ -558,7 +559,7 @@ sal_Bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const aValue = getTitle(); break; default: - DBG_ERROR("Wrong MemberId!"); + OSL_FAIL("Wrong MemberId!"); return sal_False; } @@ -568,15 +569,15 @@ sal_Bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const rVal <<= nValue; else rVal <<= bValue; - return sal_True; + return true; } -sal_Bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId ) +bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId ) { ::rtl::OUString aValue; sal_Int32 nValue=0; sal_Bool bValue = sal_False; - sal_Bool bRet = sal_False; + bool bRet = false; nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) { @@ -632,8 +633,8 @@ sal_Bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId ) setTitle(aValue); break; default: - DBG_ERROR("Wrong MemberId!"); - return sal_False; + OSL_FAIL("Wrong MemberId!"); + return false; } return bRet; @@ -671,7 +672,7 @@ SfxTabPage *SfxDocumentDescPage::Create(Window *pParent, const SfxItemSet &rItem sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet) { - // Pruefung, ob eine Aenderung vorliegt + // Test whether a change is present const sal_Bool bTitleMod = aTitleEd.IsModified(); const sal_Bool bThemeMod = aThemaEd.IsModified(); const sal_Bool bKeywordsMod = aKeywordsEd.IsModified(); @@ -681,7 +682,7 @@ sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet) return sal_False; } - // Erzeugung der Ausgabedaten + // Generating the output data const SfxPoolItem* pItem = NULL; SfxDocumentInfoItem* pInfo = NULL; SfxTabDialog* pDlg = GetTabDialog(); @@ -790,6 +791,7 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) aBmp1 ( this, SfxResId( BMP_FILE_1 ) ), aNameED ( this, SfxResId( ED_FILE_NAME ) ), + aChangePassBtn ( this, SfxResId( BTN_CHANGE_PASS ) ), aLine1FL ( this, SfxResId( FL_FILE_1 ) ), aTypeFT ( this, SfxResId( FT_FILE_TYP ) ), @@ -832,8 +834,10 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) FreeResource(); ImplUpdateSignatures(); + ImplCheckPasswordState(); aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) ); aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) ); + aChangePassBtn.SetClickHdl( LINK( this, SfxDocumentPage, ChangePassHdl ) ); // if the button text is too wide, then broaden it const long nOffset = 12; @@ -909,6 +913,32 @@ IMPL_LINK( SfxDocumentPage, SignatureHdl, PushButton*, EMPTYARG ) return 0; } +IMPL_LINK( SfxDocumentPage, ChangePassHdl, PushButton*, EMPTYARG ) +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + do + { + if (!pShell) + break; + + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); + if (!pMedSet) + break; + + ::std::auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(this)); + pDlg->SetMinLen(1); + pDlg->ShowExtras(SHOWEXTRAS_CONFIRM); + if (pDlg->Execute() != RET_OK) + break; + + String aNewPass = pDlg->GetPassword(); + pMedSet->Put( SfxStringItem(SID_PASSWORD, aNewPass) ); + pShell->SetModified(true); + } + while (false); + return 0; +} + void SfxDocumentPage::ImplUpdateSignatures() { SfxObjectShell* pDoc = SfxObjectShell::Current(); @@ -944,6 +974,34 @@ void SfxDocumentPage::ImplUpdateSignatures() } } +void SfxDocumentPage::ImplCheckPasswordState() +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + do + { + if (!pShell) + break; + + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); + if (!pMedSet) + break; + + const SfxPoolItem* pItem; + if (!pMedSet->GetItemState(SID_PASSWORD, true, &pItem)) + break; + + const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem); + if (!pStrItem) + break; + + String aPass = pStrItem->GetValue(); + aChangePassBtn.Enable(); + return; + } + while (false); + aChangePassBtn.Disable(); +} + //------------------------------------------------------------------------ SfxTabPage* SfxDocumentPage::Create( Window* pParent, const SfxItemSet& rItemSet ) @@ -978,20 +1036,6 @@ sal_Bool SfxDocumentPage::FillItemSet( SfxItemSet& rSet ) SfxDocumentInfoItem* pInfoItem = (SfxDocumentInfoItem*)pItem; sal_Bool bUseData = ( STATE_CHECK == aUseUserDataCB.GetState() ); pInfoItem->SetUseUserData( bUseData ); -/* - if ( !bUseData ) - { - // "Benutzerdaten verwenden" ausgeschaltet -> - // den Benutzer aus den Stamps l"oschen - String aEmptyUser; - aInfo.SetCreated( - SfxStamp( aEmptyUser, aInfo.GetCreated().GetTime() ) ); - aInfo.SetChanged( - SfxStamp( aEmptyUser, aInfo.GetChanged().GetTime() ) ); - aInfo.SetPrinted( - SfxStamp( aEmptyUser, aInfo.GetPrinted().GetTime() ) ); - } -*/ rSet.Put( SfxDocumentInfoItem( *pInfoItem ) ); bRet = sal_True; } @@ -1037,7 +1081,7 @@ sal_Bool SfxDocumentPage::FillItemSet( SfxItemSet& rSet ) void SfxDocumentPage::Reset( const SfxItemSet& rSet ) { - // Bestimmung der Dokumentinformationen + // Determine the document information const SfxDocumentInfoItem *pInfoItem = &(const SfxDocumentInfoItem &)rSet.Get(SID_DOCINFO); @@ -1075,7 +1119,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet ) } else { - DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), "SfxDocumentPage:<SfxStringItem> erwartet" ); + DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), "SfxDocumentPage:<SfxStringItem> expected" ); aName = ( ( SfxStringItem* ) pItem )->GetValue(); } aNameED.SetText( aName ); @@ -1127,12 +1171,10 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet ) aCreateValFt.SetText( ConvertDateTime_Impl( pInfoItem->getAuthor(), pInfoItem->getCreationDate(), aLocaleWrapper ) ); util::DateTime aTime( pInfoItem->getModificationDate() ); -// if ( aTime.IsValid() ) if ( aTime.Month > 0 ) aChangeValFt.SetText( ConvertDateTime_Impl( pInfoItem->getModifiedBy(), aTime, aLocaleWrapper ) ); aTime = pInfoItem->getPrintDate(); -// if ( aTime.IsValid()) if ( aTime.Month > 0 ) aPrintValFt.SetText( ConvertDateTime_Impl( pInfoItem->getPrintedBy(), aTime, aLocaleWrapper ) ); @@ -1197,10 +1239,10 @@ SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet ) { pFrame->GetTargetList( aList ); - String* pObj; - for( sal_uInt16 nPos = ( sal_uInt16 ) aList.Count() ; nPos ; ) + String* pObj; + for( size_t nPos = aList.size() ; nPos ; ) { - pObj = aList.GetObject( --nPos ); + pObj = aList[ --nPos ]; aCBFrame.InsertEntry( *pObj ); delete pObj; } @@ -1262,7 +1304,7 @@ void SfxInternetPage::ChangeState( STATE eNewState ) EnableReload( sal_True ); break; default: - DBG_ERROR( "*SfxInternetPage::SetState(): unhandled state!" ); + OSL_FAIL( "*SfxInternetPage::SetState(): unhandled state!" ); } eState = eNewState; @@ -1462,7 +1504,6 @@ void SfxInternetPage::Reset( const SfxItemSet& rSet ) ChangeState( eNewState ); - // #102907# ------------------------ SFX_ITEMSET_ARG( &rSet, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); if ( pROItem && pROItem->GetValue() ) { @@ -1518,13 +1559,13 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, DBG_ASSERT( pURLItem, "No BaseURL provided for InternetTabPage!" ); #endif - // Bestimmung des Titels + // Determine the Titels const SfxPoolItem* pItem = 0; String aTitle( GetText() ); if ( SFX_ITEM_SET != rItemSet.GetItemState( SID_EXPLORER_PROPS_START, sal_False, &pItem ) ) { - // Dateiname + // File name String aFile( pInfoItem->GetValue() ); INetURLObject aURL; @@ -1544,12 +1585,12 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, else { DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), - "SfxDocumentInfoDialog:<SfxStringItem> erwartet" ); + "SfxDocumentInfoDialog:<SfxStringItem> expected" ); aTitle += ( ( SfxStringItem* ) pItem )->GetValue(); } SetText( aTitle ); - // Eigenschaftenseiten + // Property Pages AddTabPage(TP_DOCINFODESC, SfxDocumentDescPage::Create, 0); AddTabPage(TP_DOCINFODOC, SfxDocumentPage::Create, 0); AddTabPage(TP_CUSTOMPROPERTIES, SfxCustomPropertiesPage::Create, 0); @@ -1611,9 +1652,7 @@ public: util::Duration GetDuration() const; }; -/*-- 20.11.2009 15:40:46--------------------------------------------------- - -----------------------------------------------------------------------*/ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& rDuration) : ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), @@ -1647,15 +1686,11 @@ DurationDialog_Impl::DurationDialog_Impl( aSecondNF.SetValue(rDuration.Seconds); aMSecondNF.SetValue(rDuration.MilliSeconds); } -/*-- 20.11.2009 16:08:55--------------------------------------------------- - -----------------------------------------------------------------------*/ DurationDialog_Impl::~DurationDialog_Impl() { } -/*-- 20.11.2009 15:41:47--------------------------------------------------- - -----------------------------------------------------------------------*/ util::Duration DurationDialog_Impl::GetDuration() const { util::Duration aRet; @@ -1670,24 +1705,17 @@ util::Duration DurationDialog_Impl::GetDuration() const return aRet; } -/*-- 20.11.2009 15:30:58--------------------------------------------------- - - -----------------------------------------------------------------------*/ CustomPropertiesDurationField::CustomPropertiesDurationField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : Edit( pParent, rResId ), m_pLine( pLine ) { SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) ); } -/*-- 23.11.2009 08:46:02--------------------------------------------------- - -----------------------------------------------------------------------*/ CustomPropertiesDurationField::~CustomPropertiesDurationField() { } -/*-- 23.11.2009 09:23:35--------------------------------------------------- - -----------------------------------------------------------------------*/ void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt ) { if( rHEvt.GetMode() & HELPMODE_QUICK ) @@ -1701,9 +1729,7 @@ void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt ) QUICKHELP_LEFT|QUICKHELP_VCENTER ); } } -/*-- 20.11.2009 15:30:58--------------------------------------------------- - -----------------------------------------------------------------------*/ void CustomPropertiesDurationField::SetDuration( const util::Duration& rDuration ) { m_aDuration = rDuration; @@ -1717,23 +1743,17 @@ void CustomPropertiesDurationField::SetDuration( const util::Duration& rDuration sText.SearchAndReplace(String::CreateFromAscii( "%6"), String::CreateFromInt32( rDuration.Seconds) ); SetText( sText ); } -/*-- 23.11.2009 08:51:15--------------------------------------------------- - -----------------------------------------------------------------------*/ CustomPropertiesEditButton::CustomPropertiesEditButton( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) : PushButton( pParent, rResId ), m_pLine( pLine ) { SetClickHdl( LINK( this, CustomPropertiesEditButton, ClickHdl )); } -/*-- 23.11.2009 08:51:15--------------------------------------------------- - -----------------------------------------------------------------------*/ CustomPropertiesEditButton::~CustomPropertiesEditButton() { } -/*-- 23.11.2009 08:47:37--------------------------------------------------- - -----------------------------------------------------------------------*/ IMPL_LINK( CustomPropertiesEditButton, ClickHdl, PushButton*, EMPTYARG ) { DurationDialog_Impl* pDurationDlg = new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() ); @@ -1777,8 +1797,7 @@ CustomPropertyLine::CustomPropertyLine( Window* pParent ) : m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG ); m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); - m_aRemoveButton.SetModeImage( SfxResId( SFX_IMG_PROPERTY_REMOVE ), BMP_COLOR_NORMAL ); - m_aRemoveButton.SetModeImage( SfxResId( SFX_IMG_PROPERTY_REMOVE_HC ), BMP_COLOR_HIGHCONTRAST ); + m_aRemoveButton.SetModeImage( SfxResId( SFX_IMG_PROPERTY_REMOVE ) ); } void CustomPropertyLine::SetRemoved() @@ -2099,7 +2118,7 @@ void CustomPropertiesWindow::AddLine( const ::rtl::OUString& sName, Any& rAny ) pCurrent++; pNewCurrent++; } - // + pNewLine->m_aDatePos = pNewLine->m_aDateField.GetPosPixel(); pNewLine->m_aTimePos = pNewLine->m_aTimeField.GetPosPixel(); pNewLine->m_aDateTimeSize = pNewLine->m_aDateField.GetSizePixel(); @@ -2113,7 +2132,7 @@ void CustomPropertiesWindow::AddLine( const ::rtl::OUString& sName, Any& rAny ) SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); pNewLine->m_aNameBox.SetText( sName ); - sal_Int32 nType = CUSTOM_TYPE_UNKNOWN; + sal_IntPtr nType = CUSTOM_TYPE_UNKNOWN; String sValue; if ( rAny >>= nTmpValue ) @@ -2211,8 +2230,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos ) if ( pLine->m_bIsRemoved ) continue; - Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField, - &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField, + &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; Window** pCurrent = pWindows; while ( *pCurrent ) { @@ -2354,7 +2373,6 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId& Link aScrollLink = LINK( this, CustomPropertiesControl, ScrollHdl ); m_aVertScroll.SetScrollHdl( aScrollLink ); -// m_aVertScroll.SetEndScrollHdl( aScrollLink ); } CustomPropertiesControl::~CustomPropertiesControl() @@ -2475,3 +2493,4 @@ SfxTabPage* SfxCustomPropertiesPage::Create( Window* pParent, const SfxItemSet& return new SfxCustomPropertiesPage( pParent, rItemSet ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc index 43bd848844a0..362f42f75ac8 100644..100755 --- a/sfx2/source/dialog/dinfdlg.hrc +++ b/sfx2/source/dialog/dinfdlg.hrc @@ -133,6 +133,7 @@ #define FT_SIGNED_VAL 77 #define STR_MULTSIGNED 78 #define BTN_SIGNATURE 79 +#define BTN_CHANGE_PASS 80 #define WIN_PROPERTIES 90 #define SB_VERTICAL 91 diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index eaa24105bb17..45ef821ace2d 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -126,10 +126,18 @@ TabPage TP_DOCINFODOC Edit ED_FILE_NAME { HelpID = "sfx2:Edit:TP_DOCINFODOC:ED_FILE_NAME"; - Pos = MAP_APPFONT ( 54 , 12 ) ; - Size = MAP_APPFONT ( 200 , RSC_CD_TEXTBOX_HEIGHT ) ; + Pos = MAP_APPFONT ( 36 , 12 ) ; + Size = MAP_APPFONT ( 140 , RSC_CD_TEXTBOX_HEIGHT ) ; Border = TRUE ; }; + PushButton BTN_CHANGE_PASS + { + HelpID = "sfx2:Edit:TP_DOCINFODOC:BTN_CHANGE_PASS"; + Pos = MAP_APPFONT ( 189 , 11 ) ; + Size = MAP_APPFONT ( 65 , RSC_CD_PUSHBUTTON_HEIGHT ) ; + Hide = FALSE; + Text [ en-US ] = "Change ~Password..."; + }; FixedLine FL_FILE_1 { Pos = MAP_APPFONT ( 6 , 31 ) ; @@ -527,7 +535,6 @@ TabPage TP_CUSTOMPROPERTIES Size = MAP_APPFONT ( 248 , 141 ) ; Border = TRUE; DialogControl = TRUE; - //OutputSize = TRUE ; Window WIN_PROPERTIES { OutputSize = TRUE ; @@ -709,11 +716,6 @@ Image SFX_IMG_PROPERTY_REMOVE ImageBitmap = Bitmap { File = "deleterow.bmp" ; }; MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; }; }; -Image SFX_IMG_PROPERTY_REMOVE_HC -{ - ImageBitmap = Bitmap { File = "deleterow_h.bmp" ; }; - MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; }; -}; QueryBox SFX_QB_WRONG_TYPE { diff --git a/sfx2/source/dialog/dinfedt.cxx b/sfx2/source/dialog/dinfedt.cxx index 5c250f7cc912..93ee933d48bf 100644 --- a/sfx2/source/dialog/dinfedt.cxx +++ b/sfx2/source/dialog/dinfedt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include "sfx2/dinfedt.hxx" #include "sfx2/sfxresid.hxx" @@ -64,3 +62,4 @@ SfxDocInfoEditDlg::SfxDocInfoEditDlg( Window* pParent ) : FreeResource(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/dinfedt.hrc b/sfx2/source/dialog/dinfedt.hrc index ef52362af2cb..ef52362af2cb 100644..100755 --- a/sfx2/source/dialog/dinfedt.hrc +++ b/sfx2/source/dialog/dinfedt.hrc diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 76bd38377eb8..a787013cf04f 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -104,9 +105,6 @@ namespace }; } -static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration; -static uno::WeakReference< frame::XModuleManager > m_xModuleManager; - static bool lcl_getWindowState( const uno::Reference< container::XNameAccess >& xWindowStateMgr, const ::rtl::OUString& rResourceURL, WindowState& rWindowState ) { bool bResult = false; @@ -120,7 +118,7 @@ static bool lcl_getWindowState( const uno::Reference< container::XNameAccess >& { for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ ) { - if ( aWindowState[n].Name.equalsAscii( "UIName" )) + if ( aWindowState[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UIName" ) )) { aWindowState[n].Value >>= rWindowState.sTitle; } @@ -191,6 +189,8 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , uno::UNO_QUERY ); } + static uno::WeakReference< frame::XModuleManager > m_xModuleManager; + uno::Reference< frame::XModuleManager > xModuleManager( m_xModuleManager ); if ( !xModuleManager.is() ) { @@ -201,6 +201,8 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , m_xModuleManager = xModuleManager; } + static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration; + uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration ); if ( !xWindowStateConfiguration.is() ) { @@ -248,7 +250,8 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , SfxChildWindow* SfxDockingWrapper::CreateImpl( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) { - SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo); return pWin; + SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo); + return pWin; } sal_uInt16 SfxDockingWrapper::GetChildWindowId () @@ -390,7 +393,7 @@ static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame:: */ void SAL_CALL SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); // Check the range of the provided ID otherwise nothing will happen @@ -416,7 +419,7 @@ void SAL_CALL SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rF */ bool SAL_CALL IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); @@ -445,11 +448,10 @@ friend class SfxDockingWindow; Size aMinSize; SfxSplitWindow* pSplitWin; sal_Bool bSplitable; -// sal_Bool bAutoHide; Timer aMoveTimer; - // Folgende members sind nur in der Zeit von StartDocking bis EndDocking - // g"ultig: + // The following members are only valid in the time from startDocking to + // EndDocking: sal_Bool bEndDocked; Size aSplitSize; long nHorizontalSize; @@ -476,12 +478,11 @@ friend class SfxDockingWindow; void SfxDockingWindow::Resize() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow merkt sich ggf. eine - ver"anderte FloatingSize. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - auch SfxDockingWindow::Resize() gerufen werden. + This virtual method of the class FloatingWindow keeps track of changes in + FloatingSize. If this method is overridden by a derived class, + then the SfxFloatingWindow: Resize() must also be called. */ { DockingWindow::Resize(); @@ -527,13 +528,13 @@ void SfxDockingWindow::Resize() sal_Bool SfxDockingWindow::PrepareToggleFloatingMode() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow erm"oglicht ein Eingreifen - in das Umschalten des floating mode. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - danach SfxDockingWindow::PrepareToggleFloatingMode() gerufen werden, - wenn nicht FALSE zur"uckgegeben wird. + This virtual method of the class DockingWindow makes it possible to + intervene in the switching of the floating mode. + If this method is overridden by a derived class, + then the SfxDockingWindow::PrepareToggleFloatingMode() must be called + afterwards, if not FALSE is returned. */ { @@ -548,13 +549,13 @@ sal_Bool SfxDockingWindow::PrepareToggleFloatingMode() if (!IsFloatingMode()) { - // Testen, ob FloatingMode erlaubt ist + // Test, if FloatingMode is permitted. if ( CheckAlignment(GetAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT ) return sal_False; if ( pImp->pSplitWin ) { - // Das DockingWindow sitzt in einem SplitWindow und wird abgerissen + // The DockingWindow is inside a SplitWindow and will be teared of. pImp->pSplitWin->RemoveWindow(this/*, sal_False*/); pImp->pSplitWin = 0; } @@ -563,11 +564,11 @@ sal_Bool SfxDockingWindow::PrepareToggleFloatingMode() { pImp->aWinState = GetFloatingWindow()->GetWindowState(); - // Testen, ob es erlaubt ist, anzudocken + // Test if it is allowed to dock, if (CheckAlignment(GetAlignment(),pImp->GetLastAlignment()) == SFX_ALIGN_NOALIGNMENT) return sal_False; - // Testen, ob das Workwindow gerade ein Andocken erlaubt + // Test, if the Workwindow allows for docking at the moment. SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); if ( !pWorkWin->IsDockingAllowed() || !pWorkWin->IsInternalDockingAllowed() ) return sal_False; @@ -580,24 +581,22 @@ sal_Bool SfxDockingWindow::PrepareToggleFloatingMode() void SfxDockingWindow::ToggleFloatingMode() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow setzt die internen - Daten des SfxDockingWindow und sorgt f"ur korrektes Alignment am - parent window. - Durch PrepareToggleFloatMode und Initialize ist sichergestellt, da\s - pImp->GetLastAlignment() immer eine erlaubtes Alignment liefert. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - zuerst SfxDockingWindow::ToggleFloatingMode() gerufen werden. + This virtual method of the DockingWindow class sets the internal data of + the SfxDockingWindow and ensures the correct alignment on the parent window. + Through PrepareToggleFloatMode and Initialize it is ensured that + pImp-> GetLastAlignment() always delivers an allowed alignment. If this + method is overloaded from a derived class, then first the + SfxDockingWindow:: ToggleFloatingMode() must be called. */ { if ( !pImp->bConstructed || !pMgr ) - return; // Kein Handler-Aufruf + return; // No Handler call - // Altes Alignment merken und dann umschalten. - // Sv hat jetzt schon umgeschaltet, aber Alignment am SfxDockingWindow - // ist noch das alte! - // Was war ich bisher ? + // Remember old alignment and then switch. + // SV has already switched, but the alignment SfxDockingWindow is still + // the old one. What I was before? SfxChildAlignment eLastAlign = GetAlignment(); SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); @@ -612,27 +611,22 @@ void SfxDockingWindow::ToggleFloatingMode() GetFloatingWindow()->SetWindowState( pImp->aWinState ); else GetFloatingWindow()->SetOutputSizePixel( GetFloatingSize() ); -/* - if ( pImp->bSplitable && !pImp->bEndDocked ) - // Wenn das Fenster vorher in einem SplitWindow lag, kommt von - // Sv kein Show - Show(); -*/ } else { if (pImp->GetDockAlignment() == eLastAlign) { - // Wenn ToggleFloatingMode aufgerufen wurde, das DockAlignment - // aber noch unver"andert ist, mu\s das ein Toggeln durch DClick - // gewesen sein, also LastAlignment verwenden + // If ToggleFloatingMode was called, but the DockAlignment still + // is unchanged, then this means that it must have been a toggling + // through DClick, so use last alignment SetAlignment (pImp->GetLastAlignment()); if ( !pImp->bSplitable ) SetSizePixel( CalcDockingSize(GetAlignment()) ); } else { - // Toggeln wurde durch Draggen ausgel"ost + + // Toggling was triggered by dragging pImp->nLine = pImp->nDockLine; pImp->nPos = pImp->nDockPos; SetAlignment (pImp->GetDockAlignment()); @@ -640,13 +634,13 @@ void SfxDockingWindow::ToggleFloatingMode() if ( pImp->bSplitable ) { - // Das DockingWindow kommt jetzt in ein SplitWindow + // The DockingWindow is now in a SplitWindow pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment()); - // Das LastAlignment ist jetzt immer noch das zuletzt angedockte + // The LastAlignment is still the last docked SfxSplitWindow *pSplit = pWorkWin->GetSplitWindow_Impl(pImp->GetLastAlignment()); - DBG_ASSERT( pSplit, "LastAlignment kann nicht stimmen!" ); + DBG_ASSERT( pSplit, "LastAlignment is not correct!" ); if ( pSplit && pSplit != pImp->pSplitWin ) pSplit->ReleaseWindow_Impl(this); if ( pImp->GetDockAlignment() == eLastAlign ) @@ -658,14 +652,14 @@ void SfxDockingWindow::ToggleFloatingMode() } } - // altes Alignment festhalten f"ur n"achstes Togglen; erst jetzt setzen - // wg. Abmelden beim SplitWindow! + // Keep the old alignment for the next toggle; set it only now due to the + // unregister SplitWindow! pImp->SetLastAlignment(eLastAlign); - // DockAlignment zur"ucksetzen, falls noch EndDocking gerufen wird + // Reset DockAlignment, if EndDocking is still called pImp->SetDockAlignment(GetAlignment()); - // SfxChildWindow korrekt andocken bzw. entdocken + // Dock or undock SfxChildWindow correctly. if ( pMgr ) pWorkWin->ConfigChild_Impl( eIdent, SFX_TOGGLEFLOATMODE, pMgr->GetType() ); } @@ -674,12 +668,12 @@ void SfxDockingWindow::ToggleFloatingMode() void SfxDockingWindow::StartDocking() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow holt vom parent window - das innere und "au\sere docking rectangle. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - am Ende SfxDockingWindow::StartDocking() gerufen werden. + This virtual method of the DockingWindow class takes the inner and outer + docking rectangle from the parent window. If this method is overloaded by a + a derived class, then SfxDockingWindow:StartDocking() has to be called at + the end. */ { if ( !pImp->bConstructed || !pMgr ) @@ -693,7 +687,7 @@ void SfxDockingWindow::StartDocking() if ( pImp->pSplitWin ) { - // Die aktuellen Docking-Daten besorgen + // Get the current docking data pImp->pSplitWin->GetWindowPos(this, pImp->nLine, pImp->nPos); pImp->nDockLine = pImp->nLine; pImp->nDockPos = pImp->nPos; @@ -705,12 +699,12 @@ void SfxDockingWindow::StartDocking() sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow berechnet das aktuelle - tracking rectangle. Dazu benutzt sie die Methode CalcAlignment(rPos,rRect), - deren Verhalten von abgeleiteten Klassen beeinflu\st werden kann (s.u.). - Diese Methode sollte nach M"oglichkeit nicht "uberschrieben werden. + This virtual method of the DockingWindow class calculates the current + tracking rectangle. For this purpose the method CalcAlignment(RPOs, rRect) + is used, the behavior can be influenced by the derived classes (see below). + This method should if possible not be overwritten. */ { if ( Application::IsInModalMode() ) @@ -730,7 +724,7 @@ sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) if ( GetOuterRect().IsInside( rPos ) && !IsDockingPrevented() ) { - // Maus innerhalb OuterRect : Alignment und Rectangle berechnen + // Mouse within OuterRect: calculate Alignment and Rectangle SfxChildAlignment eAlign = CalcAlignment(rPos, rRect); if (eAlign == SFX_ALIGN_NOALIGNMENT) bFloatMode = sal_True; @@ -738,15 +732,15 @@ sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) } else { - // Maus nicht innerhalb OuterRect : muss FloatingWindow sein - // Ist das erlaubt ? + // Mouse is not within OuterRect: must be FloatingWindow + // Is this allowed? if (CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT) return sal_False; bFloatMode = sal_True; if ( SFX_ALIGN_NOALIGNMENT != pImp->GetDockAlignment() ) { - // wg. SV-Bug darf rRect nur ver"andert werden, wenn sich das - // Alignment "andert ! + // Due to a bug the rRect may only be changed when the + // alignment is changed! pImp->SetDockAlignment(SFX_ALIGN_NOALIGNMENT); rRect.SetSize(CalcDockingSize(SFX_ALIGN_NOALIGNMENT)); } @@ -754,8 +748,8 @@ sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) if ( !pImp->bSplitable ) { - // Bei individuell angedocktem Window wird die Position durch das - // Alignment und die docking rects festgelegt. + // For individually docked window the position is set through the + // alignment and the docking rectangle. Size aSize = rRect.GetSize(); Point aPos; @@ -808,12 +802,11 @@ sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode der Klasse DockingWindow sorgt f"ur das korrekte - Alignment am parent window. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - zuerst SfxDockingWindow::EndDocking() gerufen werden. + Virtual method of the DockingWindow class ensures the correct alignment on + the parent window. If this method is overloaded by a derived class, then + SfxDockingWindow::EndDocking() must be called first. */ { if ( !pImp->bConstructed || IsDockingCanceled() || !pMgr ) @@ -821,15 +814,12 @@ void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); sal_Bool bReArrange = sal_False; - SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; if ( pImp->bSplitable ) { - eIdent = SFX_CHILDWIN_SPLITWINDOW; - - // Wenn sich das Alignment "andert und das Fenster befindet sich - // im angedockten Zustand in einem SplitWindow, mu\s umgemeldet werden - // Wenn neu angedockt wird, machen PrepareToggleFloatingMode() - // und ToggleFloatingMode() das Ummelden. + // If the alignment changes and the window is in a docked state in a + // SplitWindow, then it must be re-registered. If it is docked again, + // PrepareToggleFloatingMode() and ToggleFloatingMode() preform the + // re-registered if ( !bFloatMode ) bReArrange = sal_True; } @@ -838,12 +828,12 @@ void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) { if ( GetAlignment() != pImp->GetDockAlignment() ) { - // Vor dem Show() mu\s das Ummelden passiert sein, daher kann nicht - // die Basisklasse gerufen werden + // before Show() is called must the reassignment have been made, + // therefore the base class can not be called if ( IsFloatingMode() || !pImp->bSplitable ) Show( sal_False, SHOW_NOFOCUSCHANGE ); - // Die Gr"o\se f"urs Toggeln setzen + // Set the size for toggling. pImp->aSplitSize = rRect.GetSize(); if ( IsFloatingMode() ) { @@ -865,7 +855,7 @@ void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) } else if ( pImp->nLine != pImp->nDockLine || pImp->nPos != pImp->nDockPos || pImp->bNewLine ) { - // Ich wurde innerhalb meines Splitwindows verschoben. + // Moved within Splitwindows if ( pImp->nLine != pImp->nDockLine ) pImp->aSplitSize = rRect.GetSize(); pImp->pSplitWin->MoveWindow( this, pImp->aSplitSize, pImp->nDockLine, pImp->nDockPos, pImp->bNewLine ); @@ -885,22 +875,16 @@ void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) void SfxDockingWindow::Resizing( Size& /*rSize*/ ) -/* [Beschreibung] +/* [Description] - Virtuelle Methode der Klasse DockingWindow. - Hier kann das interaktive Umgr"o\sern im FloatingMode beeinflu\t werden, - z.B. indem nur diskrete Werte f"ur Breite und/oder H"ohe zugelassen werden. - Die Basisimplementation verhindert, da\s die OutputSize kleiner wird als - eine mit SetMinOutputSizePixel() gesetzte Gr"o\se. + Virtual method of the DockingWindow class. Here, the interactive resize in + FloatingMode can be influenced, for example by only allowing for discrete + values for width and / or height. The base implementation prevents that the + output size is smaller than one set with SetMinOutputSizePixel(). */ { -/* - if(rSize.Width() < pImp->aMinSize.Width()) - rSize.Width() = pImp->aMinSize.Width(); - if(rSize.Height() < pImp->aMinSize.Height()) - rSize.Height() = pImp->aMinSize.Height(); -*/ + } //------------------------------------------------------------------------- @@ -912,10 +896,10 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, pMgr(pCW), pImp(NULL) -/* [Beschreibung] +/* [Description] - ctor der Klasse SfxDockingWindow. Es wird ein SfxChildWindow ben"otigt, - da das Andocken im Sfx "uber SfxChildWindows realisiert wird. + Constructor for the SfxDockingWindow class. A SfxChildWindow will be + required because the docking is implemented in Sfx through SfxChildWindows. */ { @@ -944,17 +928,14 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, pImp->bDockingPrevented = sal_False; pImp->bSplitable = sal_True; -// pImp->bAutoHide = sal_False; - // Zun"achst auf Defaults setzen; das Alignment wird in der Subklasse gesetzt + // Initially set to default, the alignment is set in the subclass pImp->nLine = pImp->nDockLine = 0; pImp->nPos = pImp->nDockPos = 0; pImp->bNewLine = sal_False; pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT); pImp->aMoveTimer.SetTimeout(50); pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl)); - -// DBG_ASSERT(pMgr,"DockingWindow erfordert ein SfxChildWindow!"); } //------------------------------------------------------------------------- @@ -966,10 +947,10 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, pMgr(pCW), pImp(NULL) -/* [Beschreibung] +/* [Description] - ctor der Klasse SfxDockingWindow. Es wird ein SfxChildWindow ben"otigt, - da das Andocken im Sfx "uber SfxChildWindows realisiert wird. + Constructor for the SfxDockingWindow class. A SfxChildWindow will be + required because the docking is implemented in Sfx through SfxChildWindows. */ { @@ -998,33 +979,29 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, pImp->bDockingPrevented = sal_False; pImp->bSplitable = sal_True; -// pImp->bAutoHide = sal_False; - // Zun"achst auf Defaults setzen; das Alignment wird in der Subklasse gesetzt + // Initially set to default, the alignment is set in the subclass pImp->nLine = pImp->nDockLine = 0; pImp->nPos = pImp->nDockPos = 0; pImp->bNewLine = sal_False; pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT); pImp->aMoveTimer.SetTimeout(50); pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl)); - -// DBG_ASSERT(pMgr,"DockingWindow erfordert ein SfxChildWindow!"); } //------------------------------------------------------------------------- void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) -/* [Beschreibung] +/* [Description] - Initialisierung der Klasse SfxDockingWindow "uber ein SfxChildWinInfo. - Die Initialisierung erfolgt erst in einem 2.Schritt nach dem ctor und sollte - vom ctor der abgeleiteten Klasse oder vom ctor des SfxChildWindows - aufgerufen werden. + Initialization of the SfxDockingDialog class via a SfxChildWinInfo. + The initialization is done only in a 2nd step after the constructor, this + constructor should be called from the derived class or from the + SfxChildWindows. */ { if ( !pMgr ) { - // Bugfix #39771 pImp->SetDockAlignment( SFX_ALIGN_NOALIGNMENT ); pImp->bConstructed = sal_True; return; @@ -1083,7 +1060,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) SfxChildAlignment eAlign = CheckAlignment(GetAlignment(),GetAlignment()); if ( eAlign != GetAlignment() ) { - DBG_ERROR("Invalid Alignment!"); + OSL_FAIL("Invalid Alignment!"); SetAlignment( eAlign ); aStr.Erase(); } @@ -1114,7 +1091,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) } } else { - DBG_ERROR( "Information is missing!" ); + OSL_FAIL( "Information is missing!" ); } } @@ -1174,17 +1151,15 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) if ( pImp->bSplitable ) { -// pImp->bAutoHide = ( pInfo->nFlags & SFX_CHILDWIN_AUTOHIDE) != 0; pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment()); pImp->pSplitWin->InsertWindow(this, pImp->aSplitSize); } else { //?????? Currently not supported - // Fenster ist individuell angedockt; Gr"o\se berechnen. - // Dazu mu\s sie mit der FloatingSize initialisiert werden, falls - // irgendwer sich darauf verl"a\st, da\s eine vern"unftige Gr"o\se - // gesetzt ist + // Window is docked individually; size is calculated. + // It must therefore be initialized with the DloatingSize if + // someone relies on it that a reasonable size is set SetSizePixel(GetFloatingSize()); SetSizePixel(CalcDockingSize(GetAlignment())); } @@ -1198,7 +1173,6 @@ void SfxDockingWindow::Initialize_Impl() { if ( !pMgr ) { - // Bugfix #39771 pImp->bConstructed = sal_True; return; } @@ -1238,8 +1212,6 @@ void SfxDockingWindow::Initialize_Impl() // remember floating size for calculating alignment and tracking rectangle SetFloatingSize( pFloatWin->GetSizePixel() ); - // some versions of VCL didn't call resize in the current situation - //Resize(); } // allow calling of docking handlers @@ -1250,16 +1222,13 @@ void SfxDockingWindow::Initialize_Impl() void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const -/* [Beschreibung] +/* [Description] - F"ullt ein SfxChildWinInfo mit f"ur SfxDockingWindow spezifischen Daten, - damit sie in die INI-Datei geschrieben werden koennen. - Es wird angenommen, da\s rInfo alle anderen evt. relevanten Daten in - der ChildWindow-Klasse erh"alt. - Eingetragen werden hier gemerkten Gr"o\sen, das ZoomIn-Flag und die - f"ur das Docking relevanten Informationen. - Wird diese Methode "uberschrieben, mu\s zuerst die Basisimplementierung - gerufen werden. + Fills a SfxChildWinInfo with specific data from SfxDockingWindow, + so that it can be written in the INI file. It is assumed that rinfo + receives all other possible relevant data in the ChildWindow class. + Insertions are marked with size and the ZoomIn flag. + If this method is overridden, the base implementation must be called first. */ { @@ -1317,20 +1286,18 @@ void SfxDockingWindow::ReleaseChildWindow_Impl() SfxChildAlignment SfxDockingWindow::CalcAlignment(const Point& rPos, Rectangle& rRect) -/* [Beschreibung] +/* [Description] - Diese Methode berechnet f"ur gegebene Mausposition und tracking rectangle, - welches Alignment sich daraus ergeben w"urde. Beim Wechsel des Alignments - kann sich auch das tracking rectangle "andern, so dass ein ver"andertes - rectangle zur"uckgegeben wird. + This method calculates a resulting alignment for the given mouse position + and tracking rectangle. When changing the alignment it can also be that + the tracking rectangle is changed, so that an altered rectangle is + returned. The user of this class can influence behaviour of this method, + and thus the behavior of his DockinWindow class when docking where the + called virtual method: - Der Klassenbenutzer kann das Verhalten dieser Methode und damit das Verhalten - seiner DockinWindow-Klasse beim Docken beeinflussen, indem er die hier - aufgerufene virtuelle Methode + SfxDockingWindow :: CalcDockingSize (SfxChildAlignment eAlign) - SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign) - - "uberschreibt (s.u.). + is overridden (see below). */ { @@ -1520,9 +1487,9 @@ SfxChildAlignment SfxDockingWindow::CalcAlignment(const Point& rPos, Rectangle& if ( eDockAlign == SFX_ALIGN_NOALIGNMENT ) { - //Im FloatingMode erh"alt das tracking rectangle die floating size - // wg. SV-Bug darf rRect nur ver"andert werden, wenn sich das - // Alignment "andert ! + // In the FloatingMode the tracking rectangle will get the floating + // size. Due to a bug the rRect may only be changed when the + // alignment is changed! if ( eDockAlign != pImp->GetDockAlignment() ) aDockingRect.SetSize( aFloatingSize ); } @@ -1687,25 +1654,22 @@ SfxChildAlignment SfxDockingWindow::CalcAlignment(const Point& rPos, Rectangle& Size SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign) -/* [Beschreibung] - - Virtuelle Methode der Klasse SfxDockingWindow. - Hier wird festgelegt, wie sich die Gr"o\se des DockingWindows abh"angig vom - Alignment "andert. - Die Basisimplementation setzt im Floating Mode die Gr"o\se auf die gemerkte - Floating Size. - Bei horizontalem Alignment wird die Breite auf die Breite des "au\seren - DockingRects, bei vertikalem Alignment die H"ohe auf die H"ohe des inneren - DockingRects (ergibt sich aus der Reihenfolge, in der im SFX ChildWindows - ausgegeben werden). Die jeweils andere Gr"o\se wird auf die aktuelle - Floating Size gesetzt, hier k"onnte eine abgeleitete Klasse "andernd - eingreifen. - Die DockingSize mu\s f"ur Left/Right und Top/Bottom jeweils gleich sein. +/* [Description] + + Virtual method of the SfxDockingWindow class. This method determines how + the size of the DockingWindows changes depending on the alignment. The base + implementation uses the floating mode, the size of the marked Floating + Size. For horizontal alignment, the width will be the width of the outer + DockingRectangle, with vertical alignment the height will be the height of + the inner DockingRectangle (resulting from the order in which the SFX child + windows are displayed). The other size is set to the current floating-size, + this could changed by a to intervening derived class. The docking size must + be the same for Left/Right and Top/Bottom. */ { - // Achtung: falls das Resizing auch im angedockten Zustand geht, mu\s dabei - // auch die Floating Size angepa\st werden !? + // Note: if the resizing is also possible in the docked state, then the + // Floating-size does also have to be adjusted? Size aSize = GetFloatingSize(); switch (eAlign) @@ -1740,11 +1704,11 @@ Size SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign) SfxChildAlignment SfxDockingWindow::CheckAlignment(SfxChildAlignment, SfxChildAlignment eAlign) -/* [Beschreibung] +/* [Description] - Virtuelle Methode der Klasse SfxDockingWindow. - Hier kann eine abgeleitete Klasse bestimmte Alignments verbieten. - Die Basisimplementation verbietet kein Alignment. + Virtual method of the SfxDockingWindow class. Here a derived class can + disallow certain alignments. The base implementation does not + prohibit alignment. */ { @@ -1755,18 +1719,15 @@ SfxChildAlignment SfxDockingWindow::CheckAlignment(SfxChildAlignment, sal_Bool SfxDockingWindow::Close() -/* [Beschreibung] - - Das Fenster wird geschlossen, indem das ChildWindow durch Ausf"uhren des - ChildWindow-Slots zerst"ort wird. - Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s - danach SfxDockingWindow::Close() gerufen werden, wenn nicht das Close() - mit "return FALSE" abgebrochen wird. +/* [Description] + The window is closed when the ChildWindow is destroyed by running the + ChildWindow-slots. If this is method is overridden by a derived class + method, then the SfxDockingDialogWindow: Close() must be called afterwards + if the Close() was not cancelled with "return sal_False". */ { - // Execute mit Parametern, da Toggle von einigen ChildWindows ignoriert - // werden kann + // Execute with Parameters, since Toggle is ignored by some ChildWindows. if ( !pMgr ) return sal_True; @@ -1780,10 +1741,10 @@ sal_Bool SfxDockingWindow::Close() void SfxDockingWindow::Paint(const Rectangle& /*rRect*/) -/* [Beschreibung] +/* [Description] - Es wird im angedockten Zustand eine Begrenzungslinie an der angedockten - Kante und ein Rahmen ausgegeben. Dabei wird SVLOOK ber"ucksichtigt. + Returns a boundary line to the docked edge and a frame when the Window is in + a docked state. In this way SVLOOK is considered. */ { @@ -1833,10 +1794,10 @@ void SfxDockingWindow::Paint(const Rectangle& /*rRect*/) void SfxDockingWindow::SetMinOutputSizePixel( const Size& rSize ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann eine minimale OutpuSize gesetzt werden, die - im Resizing()-Handler abgefragt wird. + With this method, a minimal OutputSize be can set, that is queried in + the Resizing()-Handler. */ { @@ -1848,9 +1809,9 @@ void SfxDockingWindow::SetMinOutputSizePixel( const Size& rSize ) Size SfxDockingWindow::GetMinOutputSizePixel() const -/* [Beschreibung] +/* [Description] - Die gesetzte minimale Gr"o\se wird zur"uckgegeben. + Set the minimum size which is returned. */ { @@ -1881,17 +1842,17 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) if ( sHelpId.getLength() ) SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), sHelpId ); - // In VCL geht Notify zun"achst an das Fenster selbst, - // also base class rufen, sonst erf"ahrt der parent nichts + // In VCL Notify goes first to the window itself, also call the + // base class, otherwise the parent learns nothing // if ( rEvt.GetWindow() == this ) PB: #i74693# not necessary any longer DockingWindow::Notify( rEvt ); return sal_True; } else if( rEvt.GetType() == EVENT_KEYINPUT ) { - // KeyInput zuerst f"ur Dialogfunktionen zulassen + // First, allow KeyInput for Dialog functions if ( !DockingWindow::Notify( rEvt ) && SfxViewShell::Current() ) - // dann auch global g"ultige Acceleratoren verwenden + // then also for valid global accelerators. return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); return sal_True; } @@ -1908,8 +1869,6 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) sal_uInt16 SfxDockingWindow::GetWinBits_Impl() const { sal_uInt16 nBits = 0; -// if ( pImp->bAutoHide ) -// nBits |= SWIB_AUTOHIDE; return nBits; } @@ -1971,14 +1930,6 @@ void SfxDockingWindow::AutoShow_Impl( sal_Bool bShow ) } } -/* -void SfxDockingWindow::Pin_Impl( sal_Bool bPinned ) -{ - if ( pImp->pSplitWin ) - pImp->pSplitWin->Pin_Impl( bPinned ); -} -*/ - SfxSplitWindow* SfxDockingWindow::GetSplitWindow_Impl() const { return pImp->pSplitWin; @@ -2019,3 +1970,4 @@ IMPL_LINK( SfxDockingWindow, TimerHdl, Timer*, EMPTYARG) return 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index eb6373b5b998..411ee30e124f 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,9 +64,9 @@ #include <unotools/ucbstreamhelper.hxx> #include <unotools/ucbhelper.hxx> #include <unotools/localfilehelper.hxx> -#include <vos/thread.hxx> -#include <vos/mutex.hxx> -#include <vos/security.hxx> +#include <osl/mutex.hxx> +#include <osl/security.hxx> +#include <osl/thread.hxx> #include <vcl/cvtgrf.hxx> #include <vcl/msgbox.hxx> #include <vcl/mnemonic.hxx> @@ -154,35 +155,35 @@ String DecodeSpaces_Impl( const String& rSource ); // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::fileSelectionChanged( const FilePickerEvent& aEvent ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpAntiImpl->FileSelectionChanged( aEvent ); } // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::directoryChanged( const FilePickerEvent& aEvent ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpAntiImpl->DirectoryChanged( aEvent ); } // ------------------------------------------------------------------------ OUString SAL_CALL FileDialogHelper_Impl::helpRequested( const FilePickerEvent& aEvent ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return mpAntiImpl->HelpRequested( aEvent ); } // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::controlStateChanged( const FilePickerEvent& aEvent ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpAntiImpl->ControlStateChanged( aEvent ); } // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::dialogSizeChanged() throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpAntiImpl->DialogSizeChanged(); } @@ -191,7 +192,7 @@ void SAL_CALL FileDialogHelper_Impl::dialogSizeChanged() throw ( RuntimeExceptio // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::dialogClosed( const DialogClosedEvent& _rEvent ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; mpAntiImpl->DialogClosed( _rEvent ); postExecute( _rEvent.DialogResult ); } @@ -314,13 +315,12 @@ void FileDialogHelper_Impl::handleDialogSizeChanged() // ------------------------------------------------------------------------ void SAL_CALL FileDialogHelper_Impl::disposing( const EventObject& ) throw ( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; dispose(); } // ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ + void FileDialogHelper_Impl::dispose() { if ( mxFileDlg.is() ) @@ -407,7 +407,7 @@ sal_Bool FileDialogHelper_Impl::updateExtendedControl( sal_Int16 _nExtendedContr } catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::updateExtendedControl: caught an exception!" ); + OSL_FAIL( "FileDialogHelper_Impl::updateExtendedControl: caught an exception!" ); } } return bIsEnabled; @@ -438,7 +438,7 @@ sal_Bool FileDialogHelper_Impl::CheckFilterOptionsCapability( const SfxFilter* _ } } } - catch( Exception& ) + catch( const Exception& ) { } } @@ -530,7 +530,7 @@ void FileDialogHelper_Impl::updateSelectionBox() Sequence< ::rtl::OUString > aCtrlList = xCtrlInfo->getSupportedControls(); sal_uInt32 nCount = aCtrlList.getLength(); for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl ) - if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") ) + if ( aCtrlList[ nCtrl ].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SelectionBox")) ) { bSelectionBoxFound = sal_False; break; @@ -608,7 +608,6 @@ void FileDialogHelper_Impl::updatePreviewState( sal_Bool _bUpdatePreviewWindow ) { mbShowPreview = bShowPreview; - // #97633 // setShowState has currently no effect for the // OpenOffice FilePicker (see svtools/source/filepicker/iodlg.cxx) uno::Reference< XFilePreview > xFilePreview( mxFileDlg, UNO_QUERY ); @@ -619,7 +618,7 @@ void FileDialogHelper_Impl::updatePreviewState( sal_Bool _bUpdatePreviewWindow ) TimeOutHdl_Impl( NULL ); } } - catch( Exception ) + catch( const Exception& ) { DBG_ERRORFILE( "FileDialogHelper_Impl::updatePreviewState: caught an exception!" ); } @@ -657,20 +656,8 @@ void FileDialogHelper_Impl::updateVersions() for ( sal_Int32 i=0; i<xVersions.getLength(); i++ ) aEntries[ i + 1 ] = xVersions[i].Identifier; - - // TODO/LATER: not sure that this information must be shown in future ( binfilter? ) -//REMOVE else -//REMOVE { -//REMOVE SfxFilterFlags nMust = SFX_FILTER_IMPORT | SFX_FILTER_OWN; -//REMOVE SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED | SFX_FILTER_STARONEFILTER; -//REMOVE if ( SFX_APP()->GetFilterMatcher().GetFilter4ClipBoardId( pStor->GetFormat(), nMust, nDont ) ) -//REMOVE { -//REMOVE aEntries.realloc( 1 ); -//REMOVE aEntries[0] = OUString( String ( SfxResId( STR_SFX_FILEDLG_ACTUALVERSION ) ) ); -//REMOVE } -//REMOVE } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -684,7 +671,7 @@ void FileDialogHelper_Impl::updateVersions() xDlg->setValue( ExtendedFilePickerElementIds::LISTBOX_VERSION, ControlActions::DELETE_ITEMS, aValue ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} sal_Int32 nCount = aEntries.getLength(); @@ -701,27 +688,11 @@ void FileDialogHelper_Impl::updateVersions() xDlg->setValue( ExtendedFilePickerElementIds::LISTBOX_VERSION, ControlActions::SET_SELECT_ITEM, aPos ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } } // ----------------------------------------------------------------------- -class OReleaseSolarMutex -{ -private: - const sal_Int32 m_nAquireCount; -public: - OReleaseSolarMutex( ) - :m_nAquireCount( Application::ReleaseSolarMutex() ) - { - } - ~OReleaseSolarMutex( ) - { - Application::AcquireSolarMutex( m_nAquireCount ); - } -}; - -// ----------------------------------------------------------------------- IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG ) { if ( !mbHasPreview ) @@ -743,7 +714,6 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG ) if ( ERRCODE_NONE == getGraphic( aURL, maGraphic ) ) { - // #89491 // changed the code slightly; // before: the bitmap was scaled and // surrounded a white frame @@ -768,7 +738,7 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG ) else aBmp.Scale( nYRatio, nYRatio ); - // #94505# Convert to true color, to allow CopyPixel + // Convert to true color, to allow CopyPixel aBmp.Convert( BMP_CONVERSION_24BIT ); // and copy it into the Any @@ -786,11 +756,11 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG ) try { - OReleaseSolarMutex aReleaseForCallback; + SolarMutexReleaser aReleaseForCallback; // clear the preview window xFilePicker->setImage( FilePreviewImageFormats::BITMAP, aAny ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { } @@ -1059,9 +1029,6 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( break; } - - - //Sequence < Any > aInitArguments( mbSystemPicker || !mpPreferredParentWindow ? 1 : 3 ); Sequence < Any > aInitArguments( !mpPreferredParentWindow ? 3 : 4 ); // This is a hack. We currently know that the internal file picker implementation @@ -1098,8 +1065,6 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( mpPreferredParentWindow ) ) ); - - } try @@ -1108,7 +1073,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( } catch( const Exception& ) { - DBG_ERROR( "FileDialogHelper_Impl::FileDialogHelper_Impl: could not initialize the picker!" ); + OSL_FAIL( "FileDialogHelper_Impl::FileDialogHelper_Impl: could not initialize the picker!" ); } } @@ -1143,7 +1108,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( xExtDlg->setLabel( CommonFilePickerElementIds::PUSHBUTTON_OK, OUString( String( SfxResId( STR_SFX_EXPLORERFILE_BUTTONINSERT ) ) ) ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } } @@ -1171,10 +1136,10 @@ FileDialogHelper_Impl::~FileDialogHelper_Impl() #define nMagic -1 -class PickerThread_Impl : public ::vos::OThread +class PickerThread_Impl : public ::osl::Thread { uno::Reference < XFilePicker > mxPicker; - ::vos::OMutex maMutex; + ::osl::Mutex maMutex; virtual void SAL_CALL run(); sal_Int16 mnRet; public: @@ -1182,10 +1147,10 @@ public: : mxPicker( rPicker ), mnRet(nMagic) {} sal_Int16 GetReturnValue() - { ::vos::OGuard aGuard( maMutex ); return mnRet; } + { ::osl::MutexGuard aGuard( maMutex ); return mnRet; } void SetReturnValue( sal_Int16 aRetValue ) - { ::vos::OGuard aGuard( maMutex ); mnRet = aRetValue; } + { ::osl::MutexGuard aGuard( maMutex ); mnRet = aRetValue; } }; void SAL_CALL PickerThread_Impl::run() @@ -1195,7 +1160,7 @@ void SAL_CALL PickerThread_Impl::run() sal_Int16 n = mxPicker->execute(); SetReturnValue( n ); } - catch( RuntimeException& ) + catch( const RuntimeException& ) { SetReturnValue( ExecutableDialogResults::CANCEL ); DBG_ERRORFILE( "RuntimeException caught" ); @@ -1230,7 +1195,7 @@ void FileDialogHelper_Impl::setControlHelpIds( const sal_Int16* _pControlId, con } catch( const Exception& ) { - DBG_ERROR( "FileDialogHelper_Impl::setControlHelpIds: caught an exception while setting the help ids!" ); + OSL_FAIL( "FileDialogHelper_Impl::setControlHelpIds: caught an exception while setting the help ids!" ); } } @@ -1254,7 +1219,6 @@ void FileDialogHelper_Impl::preExecute() updatePreviewState( sal_False ); implInitializeFileName( ); - // #106079# / 2002-12-09 / fs@openoffice.org #if !(defined(MACOSX) && defined(QUARTZ)) && !defined(WNT) // allow for dialog implementations which need to be executed before they return valid values for @@ -1289,7 +1253,6 @@ void FileDialogHelper_Impl::implInitializeFileName( ) // in case we're operating as save dialog, and "auto extension" is checked, // cut the extension from the name - // #106079# / 2002-12-09 / fs@openoffice.org if ( mbIsSaveDlg && mbHasAutoExt ) { try @@ -1312,7 +1275,7 @@ void FileDialogHelper_Impl::implInitializeFileName( ) } catch( const Exception& ) { - DBG_ERROR( "FileDialogHelper_Impl::implInitializeFileName: could not ask for the auto-extension current-value!" ); + OSL_FAIL( "FileDialogHelper_Impl::implInitializeFileName: could not ask for the auto-extension current-value!" ); } } } @@ -1328,28 +1291,14 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() //On MacOSX the native file picker has to run in the primordial thread because of drawing issues //On Linux the native gtk file picker, when backed by gnome-vfs2, needs to be run in the same //primordial thread as the ucb gnome-vfs2 provider was initialized in. -/* -#ifdef WNT - if ( mbSystemPicker ) - { - PickerThread_Impl* pThread = new PickerThread_Impl( mxFileDlg ); - pThread->create(); - while ( pThread->GetReturnValue() == nMagic ) - Application::Yield(); - pThread->join(); - nRet = pThread->GetReturnValue(); - delete pThread; - } - else -#endif -*/ + { try { #ifdef WNT if ( mbSystemPicker ) { - OReleaseSolarMutex aSolarMutex; + SolarMutexReleaser aSolarMutex; nRet = mxFileDlg->execute(); } else @@ -1397,35 +1346,7 @@ String FileDialogHelper_Impl::implEnsureURLExtension(const String& sURL, const String& /*sExtension*/) { return sURL; - /* - // This feature must be active for file save/export only ! - if ( - (! mbIsSaveDlg) && - (! mbExport ) - ) - return sURL; - - // no extension available (because "ALL *.*" was selected) ? - // Nod idea what else should happen here .-) - if (sExtension.Len() < 1) - return sURL; - - // Some FilePicker implementations already add the right extension ... - // or might be the user used the right one already ... - // Dont create duplicate extension. - INetURLObject aURL(sURL); - if (aURL.getExtension().equals(sExtension)) - return sURL; - - // Ignore any other extension set by the user. - // Make sure suitable extension is used always. - // e.g. "test.bla.odt" for "ODT" - ::rtl::OUStringBuffer sNewURL(256); - sNewURL.append (sURL ); - sNewURL.appendAscii("." ); - sNewURL.append (sExtension); - return sNewURL.makeStringAndClear(); - */ + } // ------------------------------------------------------------------------ @@ -1575,9 +1496,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( aValue >>= bSelection ) rpSet->Put( SfxBoolItem( SID_SELECTION, bSelection ) ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); + OSL_FAIL( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); } } @@ -1596,9 +1517,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( ( aValue >>= bReadOnly ) && bReadOnly ) rpSet->Put( SfxBoolItem( SID_DOC_READONLY, bReadOnly ) ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); + OSL_FAIL( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); } } } @@ -1613,7 +1534,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // open a special version; 0 == current version rpSet->Put( SfxInt16Item( SID_VERSION, (short)nVersion ) ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } // set the filter @@ -1636,7 +1557,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( ( aValue >>= bPassWord ) && bPassWord ) { // ask for a password - uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY ); + uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler"))), UNO_QUERY ); if( xInteractionHandler.is() ) { @@ -1701,7 +1622,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, } } } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } SaveLastUsedFilter(); @@ -1777,12 +1698,6 @@ void FileDialogHelper_Impl::displayFolder( const ::rtl::OUString& _rPath ) // nothing to do return; - /* - if ( !::utl::UCBContentHelper::IsFolder( _rPath ) ) - // only valid folders accepted here - return; - */ - maPath = _rPath; if ( mxFileDlg.is() ) { @@ -1792,7 +1707,7 @@ void FileDialogHelper_Impl::displayFolder( const ::rtl::OUString& _rPath ) } catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::displayFolder: caught an exception!" ); + OSL_FAIL( "FileDialogHelper_Impl::displayFolder: caught an exception!" ); } } } @@ -1809,7 +1724,7 @@ void FileDialogHelper_Impl::setFileName( const ::rtl::OUString& _rFile ) } catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::setFileName: caught an exception!" ); + OSL_FAIL( "FileDialogHelper_Impl::setFileName: caught an exception!" ); } } } @@ -1837,7 +1752,7 @@ void FileDialogHelper_Impl::setFilter( const OUString& rFilter ) { xFltMgr->setCurrentFilter( maCurFilter ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } } @@ -1874,7 +1789,7 @@ void FileDialogHelper_Impl::addFilters( sal_Int64 nFlags, uno::Reference< XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); uno::Reference< XContainerQuery > xFilterCont( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory"))), UNO_QUERY); if ( ! xFilterCont.is() ) return; @@ -1897,7 +1812,7 @@ void FileDialogHelper_Impl::addFilters( sal_Int64 nFlags, { xResult = xFilterCont->createSubSetEnumerationByQuery(sQuery.makeStringAndClear()); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { DBG_ERRORFILE( "Could not get filters from the configuration!" ); } @@ -1937,7 +1852,7 @@ void FileDialogHelper_Impl::addFilter( const OUString& rFilterName, if ( !maSelectFilter.getLength() ) maSelectFilter = rFilterName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { #ifdef DBG_UTIL ByteString aMsg( "Could not append Filter" ); @@ -1994,7 +1909,7 @@ void FileDialogHelper_Impl::addGraphicFilter() xFltMgr->appendFilter( aAllFilterName, aExtensions ); maSelectFilter = aAllFilterName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { DBG_ERRORFILE( "Could not append Filter" ); } @@ -2023,7 +1938,7 @@ void FileDialogHelper_Impl::addGraphicFilter() { xFltMgr->appendFilter( aName, aExt ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { DBG_ERRORFILE( "Could not append Filter" ); } @@ -2049,11 +1964,7 @@ void FileDialogHelper_Impl::saveConfig() try { - aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ); sal_Bool bValue = sal_False; - aValue >>= bValue; - aUserData.SetToken( 0, ' ', String::CreateFromInt32( (sal_Int32) bValue ) ); - aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 ); bValue = sal_False; aValue >>= bValue; @@ -2070,7 +1981,7 @@ void FileDialogHelper_Impl::saveConfig() aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aUserData ) ) ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } else { @@ -2096,7 +2007,7 @@ void FileDialogHelper_Impl::saveConfig() aUserData.SetToken( 0, ' ', String::CreateFromInt32( (sal_Int32) bAutoExt ) ); bWriteConfig = sal_True; } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if ( ! mbIsSaveDlg ) @@ -2122,7 +2033,7 @@ void FileDialogHelper_Impl::saveConfig() aUserData.SetToken( 2, ' ', String::CreateFromInt32( (sal_Int32) bSelection ) ); bWriteConfig = sal_True; } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if ( bWriteConfig ) @@ -2157,7 +2068,7 @@ namespace ::ucbhelper::Content aContent( sPathCheck, uno::Reference< ucb::XCommandEnvironment >() ); bValid = aContent.isFolder(); } - catch( Exception& ) {} + catch( const Exception& ) {} } if ( !bValid ) @@ -2193,14 +2104,6 @@ void FileDialogHelper_Impl::loadConfig() { try { - // respect the last "insert as link" state - sal_Bool bLink = (sal_Bool) aUserData.GetToken( 0, ' ' ).ToInt32(); - if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ).hasValue() ) - { - aValue <<= bLink; - xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aValue ); - } - // respect the last "show preview" state sal_Bool bShowPreview = (sal_Bool) aUserData.GetToken( 1, ' ' ).ToInt32(); if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 ).hasValue() ) @@ -2222,7 +2125,7 @@ void FileDialogHelper_Impl::loadConfig() // set the member so we know that we have to show the preview mbShowPreview = bShowPreview; } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if ( !maPath.getLength() ) @@ -2255,7 +2158,7 @@ void FileDialogHelper_Impl::loadConfig() { xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if( mbHasSelectionBox ) @@ -2266,7 +2169,7 @@ void FileDialogHelper_Impl::loadConfig() { xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, aValue ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if ( !maPath.getLength() ) @@ -2285,7 +2188,7 @@ void FileDialogHelper_Impl::setDefaultValues() { xFltMgr->setCurrentFilter( maSelectFilter ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) {} } @@ -2299,11 +2202,8 @@ void FileDialogHelper_Impl::setDefaultValues() } catch( const Exception& ) { - DBG_ERROR( "FileDialogHelper_Impl::setDefaultValues: caught an exception while setting the display directory!" ); + OSL_FAIL( "FileDialogHelper_Impl::setDefaultValues: caught an exception while setting the display directory!" ); } - - // INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); - //SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) ); } } @@ -2351,24 +2251,6 @@ void FileDialogHelper_Impl::SetContext( FileDialogHelper::Context _eNewContext ) { meContext = _eNewContext; - sal_Int32 nNewHelpId = 0; - OUString aConfigId; - - switch( _eNewContext ) - { -// #104952# dependency to SVX not allowed! When used again, another solution has to be found -// case FileDialogHelper::SW_INSERT_GRAPHIC: -// case FileDialogHelper::SC_INSERT_GRAPHIC: -// case FileDialogHelper::SD_INSERT_GRAPHIC: nNewHelpId = SID_INSERT_GRAPHIC; break; - case FileDialogHelper::SW_INSERT_SOUND: - case FileDialogHelper::SC_INSERT_SOUND: - case FileDialogHelper::SD_INSERT_SOUND: nNewHelpId = SID_INSERT_SOUND; break; - case FileDialogHelper::SW_INSERT_VIDEO: - case FileDialogHelper::SC_INSERT_VIDEO: - case FileDialogHelper::SD_INSERT_VIDEO: nNewHelpId = SID_INSERT_VIDEO; break; - default: break; - } - const OUString* pConfigId = GetLastFilterConfigId( _eNewContext ); if( pConfigId ) LoadLastUsedFilter( *pConfigId ); @@ -2714,7 +2596,7 @@ static int impl_isFolder( const OUString& rPath ) xHandler.set( xFactory->createInstance( DEFINE_CONST_OUSTRING( "com.sun.star.task.InteractionHandler" ) ), uno::UNO_QUERY_THROW ); } - catch ( Exception const & ) + catch ( const Exception & ) { } @@ -2729,7 +2611,7 @@ static int impl_isFolder( const OUString& rPath ) return 0; } - catch ( Exception const & ) + catch ( const Exception & ) { } @@ -2765,7 +2647,7 @@ void FileDialogHelper::SetDisplayDirectory( const String& _rPath ) if ( sFolder.getLength() == 0 ) { // _rPath is not a valid path -> fallback to home directory - vos:: OSecurity aSecurity; + osl::Security aSecurity; aSecurity.getHomeDir( sFolder ); } mpImp->displayFolder( sFolder ); @@ -2872,8 +2754,6 @@ void SAL_CALL FileDialogHelper::DialogClosed( const DialogClosedEvent& _rEvent ) } // ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ -// ------------------------------------------------------------------------ ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, const String& rFact, @@ -2919,3 +2799,4 @@ String DecodeSpaces_Impl( const String& rSource ) } // end of namespace sfx2 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/filedlghelper.src b/sfx2/source/dialog/filedlghelper.src index 61df13350510..eeee5d36aab7 100644 --- a/sfx2/source/dialog/filedlghelper.src +++ b/sfx2/source/dialog/filedlghelper.src @@ -25,14 +25,9 @@ * ************************************************************************/ -// includes ****************************************************************** - #include "sfxlocal.hrc" #include "filedlghelper.hrc" -//#include "helpid.hrc" - -// strings ******************************************************************* String STR_SFX_FILEDLG_ACTUALVERSION { diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 6c559139ddd2..0a76cb1eca67 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -236,3 +237,4 @@ namespace sfx2 #endif // _SFX_FILEDLGIMPL_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index ab75d777c5ff..4f8ca6c43af2 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -223,7 +224,7 @@ namespace sfx2 if ( m_aClassReferrer.end() == aClassRef ) { // we do not know this global class - DBG_ERROR( "ReadGlobalFilter::operator(): unknown filter name!" ); + OSL_FAIL( "ReadGlobalFilter::operator(): unknown filter name!" ); // TODO: perhaps we should be more tolerant - at the moment, the filter is dropped // We could silently push_back it to the container .... } @@ -692,12 +693,6 @@ namespace sfx2 FilterGroupEntryReferrer::iterator aBelongsToLocal = aLocalClassesRef.find( sFilterName ); if ( aLocalClassesRef.end() != aBelongsToLocal ) { -/* -#ifdef DBG_UTIL - const ::rtl::OUString& rLocalClassDisplayName = aBelongsToLocal->second->First; - const ::rtl::OUString& rLocalClassExtension = aBelongsToLocal->second->Second; -#endif -*/ // okay, there is a local class which the filter belongs to // -> append the wildcard aExtendWildcard( *aBelongsToLocal ); @@ -831,7 +826,7 @@ namespace sfx2 #ifdef DBG_UTIL ByteString aMsg( "sfx2::lcl_EnsureAllFilesEntry: could not append Filter" ); aMsg += ByteString( String( sAllFilterName ), RTL_TEXTENCODING_UTF8 ); - DBG_ERROR( aMsg.GetBuffer() ); + OSL_FAIL( aMsg.GetBuffer() ); #endif } } @@ -919,7 +914,7 @@ namespace sfx2 { ::comphelper::SequenceAsHashMap lFilterProps (xFilterList->nextElement()); ::rtl::OUString sFilterName = lFilterProps.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii("Name"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString()); if (sFilterName.getLength()) m_lFilters.push_back(sFilterName); @@ -967,10 +962,9 @@ namespace sfx2 // retrieve the default filter for this application module. // It must be set as first of the generated filter list. const SfxFilter* pDefaultFilter = SfxFilterContainer::GetDefaultFilter_Impl(_rFactory); - // --> PB 2004-11-01 #i32434# only use one extension + // Only use one extension (#i32434#) // (and always the first if there are more than one) sExtension = pDefaultFilter->GetWildcard().GetWildCard().GetToken( 0, ';' ); - // <-- sUIName = addExtension( pDefaultFilter->GetUIName(), sExtension, sal_False, _rFileDlgImpl ); try { @@ -978,7 +972,7 @@ namespace sfx2 if ( !_rFirstNonEmpty.getLength() ) _rFirstNonEmpty = sUIName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { #ifdef DBG_UTIL ByteString aMsg( "Could not append DefaultFilter" ); @@ -992,10 +986,9 @@ namespace sfx2 if (pFilter->GetName() == pDefaultFilter->GetName()) continue; - // --> PB 2004-09-21 #i32434# only use one extension + // Only use one extension (#i32434#) // (and always the first if there are more than one) sExtension = pFilter->GetWildcard().GetWildCard().GetToken( 0, ';' ); - // <-- sUIName = addExtension( pFilter->GetUIName(), sExtension, sal_False, _rFileDlgImpl ); try { @@ -1003,7 +996,7 @@ namespace sfx2 if ( !_rFirstNonEmpty.getLength() ) _rFirstNonEmpty = sUIName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { #ifdef DBG_UTIL ByteString aMsg( "Could not append Filter" ); @@ -1075,9 +1068,9 @@ namespace sfx2 { std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin(); if ( nHTMLIndex != -1 ) - aIter++; + ++aIter; if ( nXHTMLIndex != -1 ) - aIter++; + ++aIter; aImportantFilterGroup.insert( aIter, aExportFilter ); nPDFIndex = 0; } @@ -1085,11 +1078,11 @@ namespace sfx2 { std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin(); if ( nHTMLIndex != -1 ) - aIter++; + ++aIter; if ( nXHTMLIndex != -1 ) - aIter++; + ++aIter; if ( nPDFIndex != -1 ) - aIter++; + ++aIter; aImportantFilterGroup.insert( aIter, aExportFilter ); nFlashIndex = 0; } @@ -1100,7 +1093,7 @@ namespace sfx2 if ( xFilterGroupManager.is() ) { // Add both html/pdf filter as a filter group to get a separator between both groups - if ( aImportantFilterGroup.size() > 0 ) + if ( !aImportantFilterGroup.empty() ) { Sequence< StringPair > aFilters( aImportantFilterGroup.size() ); for ( sal_Int32 i = 0; i < (sal_Int32)aImportantFilterGroup.size(); i++ ) @@ -1115,12 +1108,12 @@ namespace sfx2 { xFilterGroupManager->appendFilterGroup( ::rtl::OUString(), aFilters ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { } } - if ( aFilterGroup.size() > 0 ) + if ( !aFilterGroup.empty() ) { Sequence< StringPair > aFilters( aFilterGroup.size() ); for ( sal_Int32 i = 0; i < (sal_Int32)aFilterGroup.size(); i++ ) @@ -1135,7 +1128,7 @@ namespace sfx2 { xFilterGroupManager->appendFilterGroup( ::rtl::OUString(), aFilters ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { } } @@ -1157,7 +1150,7 @@ namespace sfx2 _rFirstNonEmpty = sUIName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { #ifdef DBG_UTIL ByteString aMsg( "Could not append Filter" ); @@ -1179,7 +1172,7 @@ namespace sfx2 _rFirstNonEmpty = sUIName; } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { #ifdef DBG_UTIL ByteString aMsg( "Could not append Filter" ); @@ -1272,3 +1265,4 @@ namespace sfx2 //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/filtergrouping.hxx b/sfx2/source/dialog/filtergrouping.hxx index 8075186614dd..5702362298fd 100644 --- a/sfx2/source/dialog/filtergrouping.hxx +++ b/sfx2/source/dialog/filtergrouping.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -104,3 +105,4 @@ namespace sfx2 #endif // SFX2_FILTERGROUPING_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/intro.cxx b/sfx2/source/dialog/intro.cxx index 637b89898a3a..8bfed93e4cba 100644 --- a/sfx2/source/dialog/intro.cxx +++ b/sfx2/source/dialog/intro.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include "intro.hxx" #include <tools/stream.hxx> @@ -108,3 +106,4 @@ void IntroWindow_Impl::Slide() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx index 68fab9fed333..0cffdf5217ab 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -406,3 +407,4 @@ bool ItemConnectionArray::FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& r } // namespace sfx +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 6664e393ed5a..4db7f7c8e078 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -144,11 +145,6 @@ void PrepareListener_Impl::disposing(const css::lang::EventObject& /*rEvent*/) t { } -// class AddressList_Impl ------------------------------------------------ - -typedef String* AddressItemPtr_Impl; -DECLARE_LIST( AddressList_Impl, AddressItemPtr_Impl ) - // class SfxMailModel ----------------------------------------------- static const char PDF_DOCUMENT_TYPE[] = "pdf_Portable_Document_Format"; @@ -158,10 +154,9 @@ void SfxMailModel::ClearList( AddressList_Impl* pList ) { if ( pList ) { - sal_uIntPtr i, nCount = pList->Count(); - for ( i = 0; i < nCount; ++i ) - delete pList->GetObject(i); - pList->Clear(); + for( size_t i = 0, n = pList->size(); i < n; ++i ) + delete pList->at(i); + pList->clear(); } } @@ -170,12 +165,11 @@ void SfxMailModel::MakeValueList( AddressList_Impl* pList, String& rValueList ) rValueList.Erase(); if ( pList ) { - sal_uIntPtr i, nCount = pList->Count(); - for ( i = 0; i < nCount; ++i ) + for( size_t i = 0, n = pList->size(); i < n; ++i ) { if ( rValueList.Len() > 0 ) rValueList += ','; - rValueList += *pList->GetObject(i); + rValueList += *pList->at(i); } } } @@ -221,7 +215,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG = uno::Reference< container::XNameAccess >( xSMGR->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), uno::UNO_QUERY ); css::uno::Reference< css::util::XModifiable > xModifiable( xModel, css::uno::UNO_QUERY ); if ( !xFilterCFG.is() ) @@ -234,7 +228,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( sal_Int32 nPropertyCount = aProps.getLength(); for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty ) { - if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii( "UIComponent" )) ) + if( aProps[nProperty].Name.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent"))) ) { ::rtl::OUString aServiceName; aProps[nProperty].Value >>= aServiceName; @@ -281,7 +275,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( //add them to the args for ( sal_Int32 nInd = 0; nInd < aPropsFromDialog.getLength(); nInd++ ) { - if( aPropsFromDialog[ nInd ].Name.equals( ::rtl::OUString::createFromAscii( "FilterData" ) ) ) + if( aPropsFromDialog[ nInd ].Name.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterData")) ) ) { //found the filterdata, add to the storing argument rArgs.realloc( ++rNumArgs ); @@ -441,7 +435,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { ::comphelper::SequenceAsHashMap aFilterPropsHM( xEnumeration->nextElement() ); aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Name" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString() ); } @@ -480,7 +474,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { ::comphelper::SequenceAsHashMap aFilterPropsHM( xNameAccess->getByName( aModule ) ); aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "ooSetupFactoryDefaultFilter" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDefaultFilter")), ::rtl::OUString() ); css::uno::Reference< css::container::XNameAccess > xNameAccess2( xContainerQuery, css::uno::UNO_QUERY ); @@ -488,7 +482,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { ::comphelper::SequenceAsHashMap aFilterPropsHM2( xNameAccess2->getByName( aFilterName ) ); aTypeName = aFilterPropsHM2.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Type" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")), ::rtl::OUString() ); } } @@ -527,7 +521,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { ::comphelper::SequenceAsHashMap aTypeNamePropsHM( xTypeDetection->getByName( aTypeName ) ); uno::Sequence< ::rtl::OUString > aExtensions = aTypeNamePropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Extensions" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extensions")), ::uno::Sequence< ::rtl::OUString >() ); if ( aExtensions.getLength() ) aExtension = aExtensions[0]; @@ -776,21 +770,21 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) { if ( !mpToList ) // create the list - mpToList = new AddressList_Impl; + mpToList = new AddressList_Impl(); pList = mpToList; } else if ( ROLE_CC == eRole ) { if ( !mpCcList ) // create the list - mpCcList = new AddressList_Impl; + mpCcList = new AddressList_Impl(); pList = mpCcList; } else if ( ROLE_BCC == eRole ) { if ( !mpBccList ) // create the list - mpBccList = new AddressList_Impl; + mpBccList = new AddressList_Impl(); pList = mpBccList; } else @@ -802,7 +796,7 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) { // add address to list AddressItemPtr_Impl pAddress = new String( rAddress ); - pList->Insert( pAddress, LIST_APPEND ); + pList->push_back( pAddress ); } } } @@ -865,59 +859,65 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: } xSimpleMailMessage->setOriginator( maFromAddress ); - sal_Int32 nToCount = mpToList ? mpToList->Count() : 0; - sal_Int32 nCcCount = mpCcList ? mpCcList->Count() : 0; - sal_Int32 nCcSeqCount = nCcCount; + size_t nToCount = mpToList ? mpToList->size() : 0; + size_t nCcCount = mpCcList ? mpCcList->size() : 0; + size_t nCcSeqCount = nCcCount; // set recipient (only one) for this simple mail server!! if ( nToCount > 1 ) { nCcSeqCount = nToCount - 1 + nCcCount; - xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 )); + xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) ); nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; } else if ( nToCount == 1 ) { - xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 )); + xSimpleMailMessage->setRecipient( *mpToList->at( 0 ) ); nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; } // all other recipient must be handled with CC recipients! if ( nCcSeqCount > 0 ) { - sal_Int32 nIndex = 0; + size_t nIndex = 0; Sequence< OUString > aCcRecipientSeq; aCcRecipientSeq.realloc( nCcSeqCount ); if ( nCcSeqCount > nCcCount ) { - for ( sal_Int32 i = 1; i < nToCount; ++i ) + for ( size_t i = 1; i < nToCount; ++i ) { - aCcRecipientSeq[nIndex++] = *mpToList->GetObject(i); + aCcRecipientSeq[nIndex++] = *mpToList->at(i); } } - for ( sal_Int32 i = 0; i < nCcCount; i++ ) + for ( size_t i = 0; i < nCcCount; i++ ) { - aCcRecipientSeq[nIndex++] = *mpCcList->GetObject(i); + aCcRecipientSeq[nIndex++] = *mpCcList->at(i); } xSimpleMailMessage->setCcRecipient( aCcRecipientSeq ); } - sal_Int32 nBccCount = mpBccList ? mpBccList->Count() : 0; + size_t nBccCount = mpBccList ? mpBccList->size() : 0; if ( nBccCount > 0 ) { Sequence< OUString > aBccRecipientSeq( nBccCount ); - for ( sal_Int32 i = 0; i < nBccCount; ++i ) + for ( size_t i = 0; i < nBccCount; ++i ) { - aBccRecipientSeq[i] = *mpBccList->GetObject(i); + aBccRecipientSeq[i] = *mpBccList->at(i); } xSimpleMailMessage->setBccRecipient( aBccRecipientSeq ); } Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size()); - xSimpleMailMessage->setSubject( maSubject ); + if ( xSimpleMailMessage->getSubject().getLength() == 0 ) { + OUString baseName( maAttachedDocuments[0].copy( maAttachedDocuments[0].lastIndexOf( '/' ) + 1 ) ); + OUString subject( baseName ); + if ( maAttachedDocuments.size() > 1 ) + subject += OUString(RTL_CONSTASCII_USTRINGPARAM(", ...")); + xSimpleMailMessage->setSubject( subject ); + } xSimpleMailMessage->setAttachement( aAttachmentSeq ); sal_Bool bSend( sal_False ); @@ -937,7 +937,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: { css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); ErrorBox aBox( pParentWindow, SfxResId( RID_ERRBOX_MAIL_CONFIG )); @@ -979,17 +979,16 @@ SfxMailModel::SendMailResult SfxMailModel::SaveAndSend( const css::uno::Referenc sal_Bool CreateFromAddress_Impl( String& rFrom ) -/* [Beschreibung] +/* [Description] - Diese Funktion versucht mit Hilfe des IniManagers eine From-Adresse - zu erzeugen. daf"ur werden die Felder 'Vorname', 'Name' und 'EMail' - aus der Applikations-Ini-Datei ausgelesen. Sollten diese Felder - nicht gesetzt sein, wird FALSE zur"uckgegeben. + This function tries to create a From-address with the help of IniManagers. + For this the fields 'first name', 'Name' and 'Email' are read from the + application-ini-data. If these fields are not set, FALSE is returned. - [R"uckgabewert] + [Return value] - sal_True: Adresse konnte erzeugt werden. - sal_False: Adresse konnte nicht erzeugt werden. + sal_True: Address could be created. + sal_False: Address could not be created. */ { @@ -1006,14 +1005,14 @@ sal_Bool CreateFromAddress_Impl( String& rFrom ) rFrom += ' '; } rFrom += TRIM( aName ); - // unerlaubte Zeichen entfernen + // remove illegal characters rFrom.EraseAllChars( '<' ); rFrom.EraseAllChars( '>' ); rFrom.EraseAllChars( '@' ); } String aEmailName = aUserCFG.GetEmail(); - // unerlaubte Zeichen entfernen + // remove illegal characters aEmailName.EraseAllChars( '<' ); aEmailName.EraseAllChars( '>' ); @@ -1027,3 +1026,5 @@ sal_Bool CreateFromAddress_Impl( String& rFrom ) rFrom.Erase(); return ( rFrom.Len() > 0 ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 5cac88236f4a..44efeec1e87e 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,16 +30,11 @@ #include "precompiled_sfx2.hxx" // include --------------------------------------------------------------- - -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <vcl/field.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include <svl/style.hxx> -#ifndef GCC -#endif #include <sfx2/styfitem.hxx> #include <sfx2/styledlg.hxx> @@ -53,9 +49,7 @@ #include "dialog.hrc" #include "mgetempl.hrc" -#ifndef _SFX_STYLE_HRC #include <svl/style.hrc> -#endif // SfxManageStyleSheetPage ----------------------------------------------- @@ -90,10 +84,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem aParent ( pStyle->GetParent() ), nFlags ( pStyle->GetMask() ) -/* [Beschreibung] - - Konstruktor; initialisiert die ListBoxen mit den Vorlagen +/* [Description] + Constructor, initializes the list box with the templates */ { @@ -108,11 +101,11 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem aDescED.Hide(); aDescFt.Show(); - // diese Page braucht ExchangeSupport + // this Page needs ExchangeSupport SetExchangeSupport(); ResMgr* pResMgr = SFX_APP()->GetModule_Impl()->GetResMgr(); - DBG_ASSERT( pResMgr, "kein ResMgr am Modul" ); + OSL_ENSURE( pResMgr, "No ResMgr in Module" ); pFamilies = new SfxStyleFamilies( ResId( DLG_STYLE_DESIGNER, *pResMgr ) ); SfxStyleSheetBasePool* pPool = 0; @@ -120,17 +113,17 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem if ( pDocShell ) pPool = pDocShell->GetStyleSheetPool(); - DBG_ASSERT( pPool, "kein Pool oder keine DocShell" ); + OSL_ENSURE( pPool, "no Pool or no DocShell" ); if ( pPool ) { pPool->SetSearchMask( pStyle->GetFamily() ); - pPool->First(); // fuer SW - interne Liste updaten + pPool->First(); // for SW - update internal list } if ( !pStyle->GetName().Len() && pPool ) { - // NullString als Name -> Name generieren + // NullString as Name -> generate Name String aNoName( SfxResId( STR_NONAME ) ); sal_uInt16 nNo = 1; String aNo( aNoName ); @@ -170,7 +163,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem pPoolStyle = pPool->Next(); } - // eine neue Vorlage ist noch nicht im Pool + // A new Template is not jet in the Pool if ( LISTBOX_ENTRY_NOTFOUND == aFollowLb.GetEntryPos( pStyle->GetName() ) ) aFollowLb.InsertEntry( pStyle->GetName() ); } @@ -189,7 +182,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem if ( pStyle->HasParentSupport() && pPool ) { if ( pStyle->HasClearParentSupport() ) - // die Basisvorlage darf auf NULL gesetzt werden + // the base template can be set to NULL aBaseLb.InsertEntry( String( SfxResId( STR_NONE ) ) ); SfxStyleSheetBase* pPoolStyle = pPool->First(); @@ -197,7 +190,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem while ( pPoolStyle ) { const String aStr( pPoolStyle->GetName() ); - // eigener Namen nicht als Basisvorlage + // own name as base template if ( aStr != aName ) aBaseLb.InsertEntry( aStr ); pPoolStyle = pPool->Next(); @@ -208,37 +201,35 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem aBaseFt.Disable(); aBaseLb.Disable(); } - sal_uInt16 nCount = pFamilies->Count(); - sal_uInt16 i; + size_t nCount = pFamilies->size(); + size_t i; for ( i = 0; i < nCount; ++i ) { - pItem = pFamilies->GetObject(i); + pItem = pFamilies->at( i ); if ( pItem->GetFamily() == pStyle->GetFamily() ) break; } - sal_uInt16 nStyleFilterIdx = 0xffff; - if ( i < nCount ) { - // Filterflags + sal_uInt16 nStyleFilterIdx = 0xffff; + // Filter flags const SfxStyleFilter& rList = pItem->GetFilterList(); - nCount = (sal_uInt16)rList.Count(); + nCount = rList.size(); sal_uInt16 nIdx = 0; sal_uInt16 nMask = pStyle->GetMask() & ~SFXSTYLEBIT_USERDEF; - if ( !nMask ) // Benutzervorlage? + if ( !nMask ) // User Template? nMask = pStyle->GetMask(); for ( i = 0; i < nCount; ++i ) { - SfxFilterTupel* pTupel = rList.GetObject(i); + SfxFilterTupel* pTupel = rList[ i ]; if ( pTupel->nFlags != SFXSTYLEBIT_AUTO && pTupel->nFlags != SFXSTYLEBIT_USED && -// pTupel->nFlags != SFXSTYLEBIT_USERDEF && pTupel->nFlags != SFXSTYLEBIT_ALL ) { aFilterLb.InsertEntry( pTupel->aName, nIdx ); @@ -271,7 +262,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem aNameEd.SetLoseFocusHdl( LINK( this, SfxManageStyleSheetPage, LoseFocusHdl ) ); } - // ist es ein Style mit automatischem Update? (nur SW) + // It is a style with auto update? (SW only) if(SFX_ITEM_SET == rAttrSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE)) { Size aSize = aNameEd.GetSizePixel(); @@ -285,10 +276,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage( Window* pParent, const SfxItem SfxManageStyleSheetPage::~SfxManageStyleSheetPage() -/* [Beschreibung] - - Destruktor; Freigabe der Daten +/* [Description] + Destructor, release of the data */ { @@ -305,23 +295,20 @@ SfxManageStyleSheetPage::~SfxManageStyleSheetPage() void SfxManageStyleSheetPage::UpdateName_Impl( ListBox* pBox, const String& rNew ) -/* [Beschreibung] +/* [Description] - Nach der "Anderung eines Vorlagennamens die ListBox pBox - aktualisieren + After the change of a template name update the ListBox pBox [Parameter] - ListBox* pBox ListBox, deren Eintr"age aktualisiert - werden sollen - const String& rNew der neue Name - + ListBox* pBox ListBox, whose entries are to be updated + const String& rNew the new Name */ { if ( pBox->IsEnabled() ) { - // ist der aktuelle Eintrag, dessen Namen modifizieren wurde + // it is the current entry, which name was modified const sal_Bool bSelect = pBox->GetSelectEntry() == aBuf; pBox->RemoveEntry( aBuf ); pBox->InsertEntry( rNew ); @@ -335,14 +322,13 @@ void SfxManageStyleSheetPage::UpdateName_Impl( ListBox* pBox, void SfxManageStyleSheetPage::SetDescriptionText_Impl() -/* [Beschreibung] +/* [Description] - Attributbeschreibung setzen. daf"ur die eingestellte Metrik besorgen. + Set attribute description. Get the set metric for this. */ { SfxMapUnit eUnit = SFX_MAPUNIT_CM; -// FieldUnit eFieldUnit = pSfxApp->GetOptions().GetMetric(); FieldUnit eFieldUnit( FUNIT_CM ); SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) @@ -355,20 +341,17 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() switch ( eFieldUnit ) { case FUNIT_MM: eUnit = SFX_MAPUNIT_MM; break; - case FUNIT_CM: case FUNIT_M: case FUNIT_KM: eUnit = SFX_MAPUNIT_CM; break; - case FUNIT_POINT: case FUNIT_PICA: eUnit = SFX_MAPUNIT_POINT; break; - case FUNIT_INCH: case FUNIT_FOOT: case FUNIT_MILE: eUnit = SFX_MAPUNIT_INCH; break; default: - DBG_ERRORFILE( "not supported fieldunit" ); + OSL_FAIL( "non supported field unit" ); } aDescFt.SetText( pStyle->GetDescription( eUnit ) ); } @@ -377,10 +360,9 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit ) -/* [Beschreibung] - - StarView Handler; GetFocus-Handler des Edits mit dem Vorlagennamen. +/* [Description] + StarView Handler; GetFocus-Handler of the Edits with the template name. */ { @@ -393,19 +375,17 @@ IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit ) IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit ) -/* [Beschreibung] - - StarView Handler; LoseFocus-Handler des Edits mit dem Vorlagennamen. - Dieser aktualisiert ggf. die Listbox mit den Folgevorlagen. - In der Listbox mit den Basisvorlagen ist die aktuelle Vorlage - selbst nicht enthalten. +/* [Description] + StarView Handler; loose-focus-handler of the edits of the template name. + This will update the listbox with the subsequent templates. The current + template itself is not returned in the listbox of the base templates. */ { const String aStr( pEdit->GetText().EraseLeadingChars() ); pEdit->SetText( aStr ); - // ggf. Listbox der Basisvorlagen aktualisieren + // Update the Listbox of the base template if possible if ( aStr != aBuf ) UpdateName_Impl( &aFollowLb, aStr ); return 0; @@ -416,50 +396,38 @@ IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit ) sal_Bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet& rSet ) -/* [Beschreibung] - +/* [Description] - Handler f"ur das Setzen der (modifizierten) Daten. Wird aus - dem Ok des SfxTabDialog gerufen. + Handler for setting the (modified) data. I called from the OK of the + SfxTabDialog. [Parameter] - SfxItemSet &rAttrSet das Set, das die Daten entgegennimmt. + SfxItemSet &rAttrSet The set, which receives the data. + [Return value] - [R"uckgabewert] + sal_Bool sal_True: The data had been changed + sal_False: The data had not been changed - sal_Bool sal_True: es hat eine "Anderung der Daten - stattgefunden - sal_False: es hat keine "Anderung der Daten - stattgefunden - - [Querverweise] + [Cross-reference] <class SfxTabDialog> - */ { const sal_uInt16 nFilterIdx = aFilterLb.GetSelectEntryPos(); - // Filter setzen + // Set Filter if ( LISTBOX_ENTRY_NOTFOUND != nFilterIdx && nFilterIdx != aFilterLb.GetSavedValue() && aFilterLb.IsEnabled() ) { bModified = sal_True; - DBG_ASSERT( pItem, "kein Item" ); - // geht nur bei Benutzervorlagen -#if OSL_DEBUG_LEVEL > 1 - sal_uInt16 nIdx = (sal_uInt16)(long)aFilterLb.GetEntryData( nFilterIdx ); - SfxFilterTupel* p; - p = pItem->GetFilterList().GetObject( nIdx ); -#endif - sal_uInt16 nMask = pItem->GetFilterList().GetObject( - (sal_uInt16)(long)aFilterLb.GetEntryData( nFilterIdx ) )->nFlags | - SFXSTYLEBIT_USERDEF; + OSL_ENSURE( pItem, "No Item" ); + // is only possibly for user templates + sal_uInt16 nMask = pItem->GetFilterList()[ (size_t)aFilterLb.GetEntryData( nFilterIdx ) ]->nFlags | SFXSTYLEBIT_USERDEF; pStyle->SetMask( nMask ); } if(aAutoCB.IsVisible() && @@ -475,20 +443,17 @@ sal_Bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet& rSet ) void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ ) -/* [Beschreibung] - +/* [Description] - Handler f"ur das Initialisieren der Seite mit den initialen Daten. + Handler to initialize the page with the initial data. [Parameter] - const SfxItemSet &rAttrSet das Set mit den Daten + const SfxItemSet &rAttrSet The data set - - [Querverweise] + [Cross-reference] <class SfxTabDialog> - */ { @@ -526,7 +491,7 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ ) if ( String( SfxResId( STR_STANDARD ) ) == aName ) { - // die Standardvorlage kann nicht verkn"upft werden + // the default template can not be linked aBaseFt.Disable(); aBaseLb.Disable(); } @@ -547,15 +512,13 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ ) SfxTabPage* SfxManageStyleSheetPage::Create( Window* pParent, const SfxItemSet &rAttrSet ) -/* [Beschreibung] +/* [Description] + Factory for the creation of the page. - Factory f"ur das Erzeugen der Seite - - [Querverweise] + [Cross-reference] <class SfxTabDialog> - */ { @@ -566,27 +529,25 @@ SfxTabPage* SfxManageStyleSheetPage::Create( Window* pParent, void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet) -/* [Beschreibung] +/* [Description] - ActivatePage- Handler des SfxTabDialog; wird f"ur die Aktualisierung - des beschreibenden Textes verwendet, da sich dieser durch "Anderungen - der Daten anderer Seiten ge"andert haben kann. + ActivatePage handler of SfxTabDialog, is used for the the update of the + descriptive text, since this might have changed through changes of data on + other pages. [Parameter] - const SfxItemSet& das Set f"ur den Datenaustausch; wird - hier nicht verwendet. + const SfxItemSet& the set for the exchange of data; is not used here. - [Querverweise] + [Cross-reference] <SfxTabDialog::ActivatePage(const SfxItemSet &)> - */ { SetDescriptionText_Impl(); - // ist es ein Style mit automatischem Update? (nur SW) + // It is a style with auto update? (SW only) const SfxPoolItem* pPoolItem; if ( SFX_ITEM_SET == @@ -599,21 +560,18 @@ void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet) int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) -/* [Beschreibung] - - DeactivatePage- Handler des SfxTabDialog; die Daten werden - an der Vorlage eingestellt, damit die richtige Vererbung - f"ur die anderen Seiten des Dialoges vorliegt. - Im Fehlerfall wird das Verlassen der Seite unterbunden. +/* [Description] + DeactivatePage-handler of SfxTabDialog; data is set on the template, so + that the correct inheritance on the other pages of the dialog is made. + If an error occurs, leaving the page is prevented. [Parameter] - SfxItemSet* das Set f"ur den Datenaustausch; wird hier nicht verwendet. + SfxItemSet* the set for the exchange of data; is not used here. - [Querverweise] + [Cross-reference] <SfxTabDialog::DeactivatePage(SfxItemSet*)> - */ { @@ -621,7 +579,7 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) if ( aNameEd.IsModified() ) { - // bei <Enter> wird kein LoseFocus() durch StarView ausgel"ost + // By pressing <Enter> LoseFocus() is not trigged through StarView if ( aNameEd.HasFocus() ) LoseFocusHdl( &aNameEd ); @@ -680,3 +638,4 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) return nRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/mgetempl.hrc b/sfx2/source/dialog/mgetempl.hrc index a34700846f9c..a34700846f9c 100644..100755 --- a/sfx2/source/dialog/mgetempl.hrc +++ b/sfx2/source/dialog/mgetempl.hrc diff --git a/sfx2/source/dialog/mgetempl.src b/sfx2/source/dialog/mgetempl.src index c478ed715646..9d359813b82a 100644 --- a/sfx2/source/dialog/mgetempl.src +++ b/sfx2/source/dialog/mgetempl.src @@ -84,8 +84,6 @@ TabPage TP_MANAGE_STYLES { Pos = MAP_APPFONT ( 6 , 44 ) ; Size = MAP_APPFONT ( 61 , 10 ) ; - /* ### ACHTUNG: Neuer Text in Resource? ~Verknüpft mit : ~Verkn³pft mit */ - /* ### ACHTUNG: Neuer Text in Resource? ~Verknüpft mit : ~Verkn³pft mit */ Text [ en-US ] = "Linked with" ; }; ListBox LB_BASE diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx index fbfabe632009..de6c5a624f15 100644 --- a/sfx2/source/dialog/navigat.cxx +++ b/sfx2/source/dialog/navigat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,6 @@ // includes ******************************************************************* -#ifndef GCC -#endif - #include <sfx2/navigat.hxx> #include <sfx2/sfx.hrc> #include <sfx2/app.hxx> @@ -83,7 +81,7 @@ void SfxNavigator::Resizing( Size &rSize ) SfxDockingWindow::Resizing( rSize ); SfxChildWindowContext *pCon = GetChildWindow_Impl()->GetContext_Impl(); - DBG_ASSERT( pCon, "Kein Context!" ); + DBG_ASSERT( pCon, "No Context!" ); if ( pCon ) pCon->Resizing( rSize ); } @@ -91,10 +89,11 @@ void SfxNavigator::Resizing( Size &rSize ) sal_Bool SfxNavigator::Close() { SfxChildWindowContext *pCon = GetChildWindow_Impl()->GetContext_Impl(); - DBG_ASSERT( pCon, "Kein Context!" ); + DBG_ASSERT( pCon, "No Context!" ); if ( !pCon || pCon->Close() ) return SfxDockingWindow::Close(); else return sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 17bbee8c126f..0984e8c62010 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,6 @@ // INCLUDE --------------------------------------------------------------- #include <svl/style.hxx> -#ifndef GCC -#endif #include <sfx2/newstyle.hxx> #include "dialog.hrc" @@ -103,7 +102,8 @@ SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool // ----------------------------------------------------------------------- -__EXPORT SfxNewStyleDlg::~SfxNewStyleDlg() +SfxNewStyleDlg::~SfxNewStyleDlg() { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/newstyle.hrc b/sfx2/source/dialog/newstyle.hrc index 0efc04869ba9..0efc04869ba9 100644..100755 --- a/sfx2/source/dialog/newstyle.hrc +++ b/sfx2/source/dialog/newstyle.hrc diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index cb082987a3e1..0b40f7c69b67 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,9 +44,7 @@ #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/PosSize.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <toolkit/helper/vclunohelper.hxx> @@ -72,7 +71,7 @@ SfxPartChildWnd_Impl::SfxPartChildWnd_Impl ) : SfxChildWindow( pParentWnd, nId ) { - // Window erzeugen + // Create Window pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK ); eChildAlignment = SFX_ALIGN_TOP; if ( pInfo ) @@ -96,37 +95,9 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl() // and we need a valid pMgr for further operations ... SfxPartDockWnd_Impl* pWin = (SfxPartDockWnd_Impl*) pWindow; -// if( pWin != NULL && !xFrame.is() ) -// pWin->ReleaseChildWindow_Impl(); -/* - // Release frame and window. - // If frame reference is valid here ... start dieing from inside by calling dispose(). - SetFrame( NULL ); - pWindow = NULL; -*/ + if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() ) pWin->GetBindings().SetActiveFrame( NULL ); -/* - if( xFrame.is() ) - { - try - { - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > xCloseable ( xFrame, ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xDisposeable( xFrame, ::com::sun::star::uno::UNO_QUERY ); - if (xCloseable.is()) - xCloseable->close(sal_True); - else - if (xDisposeable.is()) - xDisposeable->dispose(); - } - catch( ::com::sun::star::util::CloseVetoException& ) - { - } - catch( ::com::sun::star::lang::DisposedException& ) - { - } - } - */ } sal_Bool SfxPartChildWnd_Impl::QueryClose() @@ -183,7 +154,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl xSupp->getFrames()->append( xFrame ); } else { - DBG_ERROR("Bindings without Dispatcher!"); + OSL_FAIL("Bindings without Dispatcher!"); } } @@ -202,8 +173,9 @@ Rectangle impl_Rectangle_Struct2Object( const ::com::sun::star::awt::Rectangle& void SfxPartDockWnd_Impl::Resize() -/* [Beschreibung] - Anpassung der Gr"osse der Controls an die neue Windowgr"osse +/* [Description] + + Adjusting the size of the controls wrt the new window size */ { @@ -255,3 +227,4 @@ void SfxPartDockWnd_Impl::FillInfo( SfxChildWinInfo& rInfo ) const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index 47af8e61d81b..41a5de5650f1 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,6 @@ // Include --------------------------------------------------------------- #include <vcl/msgbox.hxx> -#ifndef GCC -#endif #include <sfx2/passwd.hxx> #include "sfxtypes.hxx" @@ -111,6 +110,8 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ), maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ), maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ), + + maMinLengthFT ( this, SfxResId( FT_PASSWD_MINLEN ) ), maPassword2Box ( this, 0 ), maPassword2FT ( this, SfxResId( FT_PASSWD_PASSWORD2 ) ), maPassword2ED ( this, SfxResId( ED_PASSWD_PASSWORD2 ) ), @@ -120,7 +121,9 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ), maHelpBtn ( this, SfxResId( BTN_PASSWD_HELP ) ), - mnMinLen ( 1 ), + maMinLenPwdStr ( SfxResId( STR_PASSWD_MIN_LEN ) ), + maEmptyPwdStr ( SfxResId( STR_PASSWD_EMPTY ) ), + maMainPwdStr ( ), mnExtras ( 0 ), mbAsciiOnly ( false ) @@ -162,6 +165,9 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText // add second confirm line xEdits->addRow( &maConfirm2FT, &maConfirm2ED, -2, aEditSize ); + // add password length warning line + xEdits->addWindow( &maMinLengthFT ); + // add a FixedLine FixedLine* pLine = new FixedLine( this, 0 ); pLine->Show(); @@ -174,10 +180,10 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText nChildIndex = xLayout->addChild( xButtons ); xLayout->setBorders( nChildIndex, -2, 0, -2, -2 ); - size_t nBtnIndex = xButtons->addWindow( &maHelpBtn, 0, aBtnSize ); + xButtons->addWindow( &maHelpBtn, 0, aBtnSize ); xButtons->addChild( new vcl::Spacer( xButtons.get() ) ); - nBtnIndex = xButtons->addWindow( &maOKBtn, 0, aBtnSize ); - nBtnIndex = xButtons->addWindow( &maCancelBtn, 0, aBtnSize ); + xButtons->addWindow( &maOKBtn, 0, aBtnSize ); + xButtons->addWindow( &maCancelBtn, 0, aBtnSize ); Link aLink = LINK( this, SfxPasswordDialog, EditModifyHdl ); maPasswordED.SetModifyHdl( aLink ); @@ -187,6 +193,25 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText if ( pGroupText ) maPasswordBox.SetText( *pGroupText ); + +//set the text to the pasword length + SetPasswdText(); +} + +// ----------------------------------------------------------------------- + +void SfxPasswordDialog::SetPasswdText( ) +{ +//set the new string to the minimum password length + if( mnMinLen == 0 ) + maMinLengthFT.SetText( maEmptyPwdStr ); + else + { + maMainPwdStr = maMinLenPwdStr; + maMainPwdStr.SearchAndReplace( String::CreateFromAscii( "$(MINLEN)" ), String::CreateFromInt32((sal_Int32) mnMinLen ), 0); + maMinLengthFT.SetText( maMainPwdStr ); + maMinLengthFT.Show(); + } } // ----------------------------------------------------------------------- @@ -194,6 +219,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText void SfxPasswordDialog::SetMinLen( sal_uInt16 nLen ) { mnMinLen = nLen; + SetPasswdText(); EditModifyHdl( NULL ); } @@ -226,6 +252,66 @@ short SfxPasswordDialog::Execute() maPasswordFT.Show(); if( (mnExtras & SHOWEXTRAS_USER ) ) { + //TODO: Inevitably this layout logic will be wrong post merge until we can see the dialog to test it. + Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ); + Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); + long nMinHeight = maHelpBtn.GetPosPixel().Y() + + maHelpBtn.GetSizePixel().Height() + a6Size.Height(); + sal_uInt16 nRowHided = 1; + + if ( SHOWEXTRAS_NONE == mnExtras ) + { + maUserFT.Hide(); + maUserED.Hide(); + maConfirmFT.Hide(); + maConfirmED.Hide(); + maPasswordFT.Hide(); + + Point aPos = maUserFT.GetPosPixel(); + long nEnd = maUserED.GetPosPixel().X() + maUserED.GetSizePixel().Width(); + maPasswordED.SetPosPixel( aPos ); + Size aSize = maPasswordED.GetSizePixel(); + aSize.Width() = nEnd - aPos.X(); + maPasswordED.SetSizePixel( aSize ); + + nRowHided = 2; + } + else if ( SHOWEXTRAS_USER == mnExtras ) + { + maConfirmFT.Hide(); + maConfirmED.Hide(); + } + else if ( SHOWEXTRAS_CONFIRM == mnExtras ) + { + maUserFT.Hide(); + maUserED.Hide(); + + Point aPwdPos1 = maPasswordFT.GetPosPixel(); + Point aPwdPos2 = maPasswordED.GetPosPixel(); + + Point aPos = maUserFT.GetPosPixel(); + maPasswordFT.SetPosPixel( aPos ); + aPos = maUserED.GetPosPixel(); + maPasswordED.SetPosPixel( aPos ); + + aPos = maConfirmFT.GetPosPixel(); + maConfirmFT.SetPosPixel( aPwdPos1 ); + maConfirmED.SetPosPixel( aPwdPos2 ); + maMinLengthFT.SetPosPixel(aPos); + } + + Size aBoxSize = maPasswordBox.GetSizePixel(); + aBoxSize.Height() -= ( nRowHided * maUserED.GetSizePixel().Height() ); + aBoxSize.Height() -= ( nRowHided * a3Size.Height() ); + maPasswordBox.SetSizePixel( aBoxSize ); + + long nDlgHeight = maPasswordBox.GetPosPixel().Y() + aBoxSize.Height() + a6Size.Height(); + if ( nDlgHeight < nMinHeight ) + nDlgHeight = nMinHeight; + Size aDlgSize = GetOutputSizePixel(); + aDlgSize.Height() = nDlgHeight; + SetOutputSizePixel( aDlgSize ); + maUserFT.Show(); maUserED.Show(); } @@ -254,3 +340,4 @@ short SfxPasswordDialog::Execute() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/passwd.hrc b/sfx2/source/dialog/passwd.hrc index dd35a6449dd8..8a82c853320e 100644..100755 --- a/sfx2/source/dialog/passwd.hrc +++ b/sfx2/source/dialog/passwd.hrc @@ -36,6 +36,7 @@ #define ED_PASSWD_PASSWORD 14 #define FT_PASSWD_CONFIRM 15 #define ED_PASSWD_CONFIRM 16 +#define FT_PASSWD_MINLEN 17 #define BTN_PASSWD_OK 20 #define BTN_PASSWD_CANCEL 21 @@ -46,10 +47,11 @@ #define FT_PASSWD_CONFIRM2 27 #define ED_PASSWD_CONFIRM2 28 -//IAccessibility2 Implementation 2009----- -#define TEXT_PASSWD 31 -//-----IAccessibility2 Implementation 2009 -#endif +#define STR_PASSWD_CONFIRM 29 +#define STR_PASSWD_MIN_LEN 30 +#define STR_PASSWD_EMPTY 31 + +#define TEXT_PASSWD 32 -// ******************************************************************* EOF +#endif diff --git a/sfx2/source/dialog/passwd.src b/sfx2/source/dialog/passwd.src index beb2f96a5e21..cca8814d1526 100644 --- a/sfx2/source/dialog/passwd.src +++ b/sfx2/source/dialog/passwd.src @@ -80,6 +80,22 @@ ModalDialog DLG_PASSWD Pos = MAP_APPFONT( 57, 44 ); Size = MAP_APPFONT( 75, 12 ); }; + + String STR_PASSWD_MIN_LEN + { + Text [ en-US ] = "(Minimum $(MINLEN) characters)" ; + }; + String STR_PASSWD_EMPTY + { + Text [ en-US ] = "(The password can be empty)" ; + }; + + FixedText FT_PASSWD_MINLEN + { + Pos = MAP_APPFONT(12, 65 ); + Size = MAP_APPFONT( 126, 10 ); + }; + FixedLine GB_PASSWD_PASSWORD { Pos = MAP_APPFONT( 6, 3 ); diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index e6182880b963..bec9a5760c5c 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif +#include <sal/macros.h> #include <vcl/msgbox.hxx> #include <unotools/printwarningoptions.hxx> #include <svtools/printoptions.hxx> @@ -42,19 +42,9 @@ #include <sfx2/viewsh.hxx> #include <sfx2/printopt.hxx> -// ----------- -// - statics - -// ----------- - static sal_uInt16 aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; static sal_Bool bOutputForPrinter = sal_True; -#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ])) - -// -------------------------------- -// - SfxCommonPrintOptionsTabPage - -// -------------------------------- - SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage( pParent, SfxResId( TP_COMMONPRINTOPTIONS ), rSet ), @@ -107,8 +97,7 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, con aReduceGradientsStripesRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceGradientsStripesRBHdl ) ); aReduceBitmapsResolutionRB.SetToggleHdl( LINK( this, SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl ) ); - // --> PB 2008-06-09 #i89164# - // calculate dynamically the width of radiobutton and listbox + // #i89164# calculate dynamically the width of radiobutton and listbox const long nOffset = 10; Size aOldSize = aReduceBitmapsResolutionRB.GetSizePixel(); Size aNewSize = aReduceBitmapsResolutionRB.GetOptimalSize( WINDOWSIZE_PREFERRED ); @@ -123,24 +112,17 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, con aNewSize.Width() += nOffset; aNewSize.Height() = aOldSize.Height(); aReduceBitmapsResolutionLB.SetPosSizePixel( aPos, aNewSize ); - // <-- } -// ----------------------------------------------------------------------------- - SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage() { } -// ----------------------------------------------------------------------------- - SfxTabPage* SfxCommonPrintOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) { return( new SfxCommonPrintOptionsTabPage( pParent, rAttrSet ) ); } -// ----------------------------------------------------------------------------- - Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const Window* pWindow ) const { if ( pWindow == (Window *)&aReduceGradientsStepCountNF ) @@ -161,8 +143,6 @@ Window* SfxCommonPrintOptionsTabPage::GetParentLabelFor( const Window* pWindow ) return SfxTabPage::GetParentLabelFor( pWindow ); } -// ----------------------------------------------------------------------------- - sal_Bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet& /*rSet*/ ) { SvtPrintWarningOptions aWarnOptions; @@ -187,8 +167,6 @@ sal_Bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet& /*rSet*/ ) return bModified; } -// ----------------------------------------------------------------------------- - void SfxCommonPrintOptionsTabPage::Reset( const SfxItemSet& /*rSet*/ ) { SvtPrintWarningOptions aWarnOptions; @@ -209,13 +187,10 @@ void SfxCommonPrintOptionsTabPage::Reset( const SfxItemSet& /*rSet*/ ) ImplUpdateControls( aPrinterOutputRB.IsChecked() ? &maPrinterOptions : &maPrintFileOptions ); - // --> OD 2008-06-25 #i63982# + // #i63982# ImplSetAccessibleNames(); - // <-- } -// ----------------------------------------------------------------------------- - int SfxCommonPrintOptionsTabPage::DeactivatePage( SfxItemSet* pItemSet ) { if( pItemSet ) @@ -224,8 +199,6 @@ int SfxCommonPrintOptionsTabPage::DeactivatePage( SfxItemSet* pItemSet ) return LEAVE_PAGE; } -// ----------------------------------------------------------------------------- - void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCurrentOptions ) { aReduceTransparencyCB.Check( pCurrentOptions->IsReduceTransparency() ); @@ -259,7 +232,7 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu aReduceBitmapsResolutionLB.SelectEntryPos( 0 ); else { - for( long i = ( DPI_COUNT - 1 ); i >= 0; i-- ) + for( long i = ( SAL_N_ELEMENTS(aDPIArray) - 1 ); i >= 0; i-- ) { if( nDPI >= aDPIArray[ i ] ) { @@ -279,8 +252,6 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu ClickReduceBitmapsCBHdl( &aReduceBitmapsCB ); } -// ----------------------------------------------------------------------------- - void SfxCommonPrintOptionsTabPage::ImplSetAccessibleNames() { static const String cSeparator = String::CreateFromAscii( " - " ); @@ -379,8 +350,6 @@ void SfxCommonPrintOptionsTabPage::ImplSetAccessibleNames() aTransparencyCB.SetAccessibleName( sAccessibleName ); } -// ----------------------------------------------------------------------------- - void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOptions ) { pCurrentOptions->SetReduceTransparency( aReduceTransparencyCB.IsChecked() ); @@ -392,13 +361,11 @@ void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOpt pCurrentOptions->SetReducedBitmapMode( aReduceBitmapsOptimalRB.IsChecked() ? PRINTER_BITMAP_OPTIMAL : ( aReduceBitmapsNormalRB.IsChecked() ? PRINTER_BITMAP_NORMAL : PRINTER_BITMAP_RESOLUTION ) ); pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ Min( (sal_uInt16) aReduceBitmapsResolutionLB.GetSelectEntryPos(), - (sal_uInt16)( sizeof( aDPIArray ) / sizeof( aDPIArray[ 0 ] ) - 1 ) ) ] ); + (sal_uInt16)( SAL_N_ELEMENTS( aDPIArray ) - 1 ) ) ] ); pCurrentOptions->SetReducedBitmapIncludesTransparency( aReduceBitmapsTransparencyCB.IsChecked() ); pCurrentOptions->SetConvertToGreyscales( aConvertToGreyscalesCB.IsChecked() ); } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceTransparencyCBHdl, CheckBox*, pBox ) { (void)pBox; //unused @@ -412,8 +379,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceTransparencyCBHdl, CheckBox* return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceGradientsCBHdl, CheckBox*, pBox ) { (void)pBox; //unused @@ -428,8 +393,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceGradientsCBHdl, CheckBox*, p return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceBitmapsCBHdl, CheckBox*, pBox ) { (void)pBox; //unused @@ -446,8 +409,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ClickReduceBitmapsCBHdl, CheckBox*, pBo return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceGradientsStripesRBHdl, RadioButton*, pButton ) { (void)pButton; //unused @@ -458,8 +419,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceGradientsStripesRBHdl, Radi return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl, RadioButton*, pButton ) { (void)pButton; //unused @@ -470,8 +429,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleReduceBitmapsResolutionRBHdl, Rad return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrinterRBHdl, RadioButton*, pButton ) { if( pButton->IsChecked() ) @@ -479,9 +436,8 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrinterRBHdl, RadioButton*, aOutputGB.SetText( OutputDevice::GetNonMnemonicString( pButton->GetText() ) ); ImplUpdateControls( &maPrinterOptions ); bOutputForPrinter = sal_True; - // --> OD 2008-06-25 #i63982# + // #i63982# ImplSetAccessibleNames(); - // <-- } else ImplSaveControls( &maPrinterOptions ); @@ -489,8 +445,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrinterRBHdl, RadioButton*, return 0; } -// ----------------------------------------------------------------------------- - IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrintFileRBHdl, RadioButton*, pButton ) { if( pButton->IsChecked() ) @@ -498,9 +452,8 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrintFileRBHdl, RadioButton aOutputGB.SetText( OutputDevice::GetNonMnemonicString( pButton->GetText() ) ); ImplUpdateControls( &maPrintFileOptions ); bOutputForPrinter = sal_False; - // --> OD 2008-06-25 #i63982# + // #i63982# ImplSetAccessibleNames(); - // <-- } else ImplSaveControls( &maPrintFileOptions ); @@ -508,10 +461,6 @@ IMPL_LINK( SfxCommonPrintOptionsTabPage, ToggleOutputPrintFileRBHdl, RadioButton return 0; } -// ------------------------------- -// - TransparencyPrintWarningBox - -// ------------------------------- - TransparencyPrintWarningBox::TransparencyPrintWarningBox( Window* pParent ) : ModalDialog( pParent, SfxResId( RID_WARN_PRINTTRANSPARENCY ) ), aWarnFI ( this, SfxResId( FI_PRINTTRANSWARN ) ), @@ -529,17 +478,15 @@ TransparencyPrintWarningBox::TransparencyPrintWarningBox( Window* pParent ) : aNoBtn.SetClickHdl( LINK( this, TransparencyPrintWarningBox, ClickNoBtn ) ); } -// ----------------------------------------------------------------------------- - TransparencyPrintWarningBox::~TransparencyPrintWarningBox() { } -// ----------------------------------------------------------------------------- - IMPL_LINK( TransparencyPrintWarningBox, ClickNoBtn, PushButton*, pButton ) { (void)pButton; //unused EndDialog( RET_NO ); return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/printopt.hrc b/sfx2/source/dialog/printopt.hrc index 38c766c9f56a..38c766c9f56a 100644..100755 --- a/sfx2/source/dialog/printopt.hrc +++ b/sfx2/source/dialog/printopt.hrc diff --git a/sfx2/source/dialog/printopt.src b/sfx2/source/dialog/printopt.src index 01650f3e9275..394c0415880d 100644 --- a/sfx2/source/dialog/printopt.src +++ b/sfx2/source/dialog/printopt.src @@ -33,9 +33,7 @@ #include "helpid.hrc" //**************************************************************************** -// // TabPage -// //**************************************************************************** TabPage TP_COMMONPRINTOPTIONS diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 7b24a3862811..2fac778744d7 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -128,7 +129,7 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c { for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - if ( aPropSeq[i].Name.equalsAscii( "Label" )) + if ( aPropSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Label" ) )) { aPropSeq[i].Value >>= aLabel; break; @@ -278,3 +279,5 @@ IMPL_LINK( SfxRecordingFloat_Impl, Select, ToolBox*, pToolBar ) return 1; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/recfloat.src b/sfx2/source/dialog/recfloat.src index d71270d1e312..47e4803c1b5b 100644 --- a/sfx2/source/dialog/recfloat.src +++ b/sfx2/source/dialog/recfloat.src @@ -30,7 +30,6 @@ // ----------------------------------------------------------------------- #define STD_MASKCOLOR Color { Red = 0xC000; Green = 0xC000; Blue = 0xC000; } -#define STD_HC_MASKCOLOR Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; } FloatingWindow SID_RECORDING_FLOATWINDOW { diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index abad2c341c01..039e22be91e4 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,6 @@ using namespace ::com::sun::star; -////////////////////////////////////////////////////////////////////// namespace @@ -61,22 +61,6 @@ namespace enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; enum RedlineFunc { RF_ON, RF_PROTECT }; -/* - bool QueryIsEnabled( sal_uInt16 _nSlot ) - { - bool bRes = false; - SfxViewShell* pViewSh = SfxViewShell::Current(); - if (pViewSh) - { - const SfxPoolItem* pItem; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - SfxItemState eState = pDisp->QueryState( _nSlot, pItem ); - bRes = (eState & SFX_ITEM_DISABLED) == 0; - } - return bRes; - } -*/ - bool QueryState( sal_uInt16 _nSlot, bool& _rValue ) { bool bRet = false; @@ -119,9 +103,6 @@ namespace } -////////////////////////////////////////////////////////////////////// - - static short lcl_GetPassword( Window *pParent, bool bProtect, @@ -129,8 +110,6 @@ static short lcl_GetPassword( { bool bRes = false; SfxPasswordDialog aPasswdDlg( pParent ); - const String aTitle( SfxResId( bProtect ? RID_SFX_PROTECT_RECORDS : RID_SFX_UNPROTECT_RECORDS ) ); - aPasswdDlg.SetText( aTitle ); aPasswdDlg.SetMinLen( 1 ); if (bProtect) aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); @@ -163,9 +142,6 @@ static bool lcl_IsPasswordCorrect( const String &rPassword ) } -////////////////////////////////////////////////////////////////////// - - struct SfxSecurityPage_Impl { SfxSecurityPage & m_rMyTabPage; @@ -497,8 +473,6 @@ IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) m_bNewPasswordIsValid = true; m_aNewPassword = bNewProtection? aPasswordText : String(); -// // RecordChangesCB is enabled if protection is off -// m_aRecordChangesCB.Enable( !bNewProtection ); m_aRecordChangesCB.Check( bNewProtection ); // toggle text of button "Protect" <-> "Unprotect" m_aChangeProtectionPB.SetText( bNewProtection ? m_aUnProtectSTR : m_aProtectSTR ); @@ -507,9 +481,6 @@ IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) } -////////////////////////////////////////////////////////////////////// - - SfxTabPage* SfxSecurityPage::Create( Window * pParent, const SfxItemSet & rItemSet ) { return new SfxSecurityPage( pParent, rItemSet ); @@ -548,6 +519,4 @@ void SfxSecurityPage::Reset( const SfxItemSet & rItemSet ) } -////////////////////////////////////////////////////////////////////// - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index fee60404d01c..87cc2e1af8d8 100755..100644 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -159,14 +159,6 @@ TabPage TP_DOCINFOSECURITY }; }; -String RID_SFX_PROTECT_RECORDS -{ - Text [ en-US ] = "Protect Records" ; -}; -String RID_SFX_UNPROTECT_RECORDS -{ - Text [ en-US ] = "Unprotect Records" ; -}; String RID_SFX_INCORRECT_PASSWORD { Text [ en-US ] = "Incorrect password" ; diff --git a/sfx2/source/dialog/sfxdlg.cxx b/sfx2/source/dialog/sfxdlg.cxx index becab5097ec3..76010410b898 100755..100644 --- a/sfx2/source/dialog/sfxdlg.cxx +++ b/sfx2/source/dialog/sfxdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,5 @@ SfxAbstractDialogFactory* SfxAbstractDialogFactory::Create() SfxAbstractDialogFactory::~SfxAbstractDialogFactory() { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 2eb332f9d5d9..56951f9d6bc0 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,18 +30,13 @@ #include "precompiled_sfx2.hxx" #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 +#include <string> -#ifndef _WRKWIN_HXX //autogen #include <vcl/wrkwin.hxx> -#endif #include <unotools/viewoptions.hxx> -#ifndef GCC -#endif #include <vcl/timer.hxx> @@ -60,14 +56,14 @@ using namespace ::rtl; #define VERSION 1 #define nPixel 30L -#define USERITEM_NAME OUString::createFromAscii( "UserItem" ) +#define USERITEM_NAME OUString(RTL_CONSTASCII_USTRINGPARAM("UserItem")) struct SfxDock_Impl { sal_uInt16 nType; - SfxDockingWindow* pWin; // SplitWindow hat dieses Fenster + SfxDockingWindow* pWin; // SplitWindow has this window sal_Bool bNewLine; - sal_Bool bHide; // SplitWindow hatte dieses Fenster + sal_Bool bHide; // SplitWindow had this window long nSize; }; @@ -77,11 +73,11 @@ SV_IMPL_PTRARR( SfxDockArr_Impl, SfxDockPtr); class SfxEmptySplitWin_Impl : public SplitWindow { -/* [Beschreibung] +/* [Description] - Das SfxEmptySplitWin_Impldow ist ein leeres SplitWindow, das das SfxSplitWindow - im AutoHide-Modus ersetzt. Es dient nur als Platzhalter, um MouseMoves - zu empfangen und ggf. das eigentlichte SplitWindow einzublenden + The SfxEmptySplitWin_Impldow is an empty SplitWindow, that replaces the + SfxSplitWindow AutoHide mode. It only serves as a placeholder to receive + mouse moves and if possible blend in the true SplitWindow display. */ friend class SfxSplitWindow; @@ -106,7 +102,6 @@ friend class SfxSplitWindow; aTimer.SetTimeoutHdl( LINK(pOwner, SfxSplitWindow, TimerHdl ) ); aTimer.SetTimeout( 200 ); -// EnableDrop( sal_True ); SetAlign( pOwner->GetAlign() ); Actualize(); ShowAutoHideButton( pOwner->IsAutoHideButtonVisible() ); @@ -158,9 +153,9 @@ void SfxEmptySplitWin_Impl::FadeIn() pOwner->Show_Impl(); if ( bAutoHide ) { - // Timer zum Schlie\sen aufsetzen; der Aufrufer mu\s selbst sicherstellen, - // da\s das Window nicht gleich wieder zu geht ( z.B. durch Setzen des - // Focus oder einen modal mode ) + // Set Timer to close; the caller has to ensure themselves that the + // Window is not closed instantly (eg by setting the focus or a modal + // mode. aLastPos = GetPointerPosPixel(); aTimer.Start(); } @@ -186,12 +181,12 @@ void SfxEmptySplitWin_Impl::MouseMove( const MouseEvent& rMEvt ) SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, SfxWorkWindow *pW, sal_Bool bWithButtons, WinBits nBits ) -/* [Beschreibung] +/* [Description] - Ein SfxSplitWindow verbirgt die rekursive Struktur des SV-Splitwindows - nach au\sen, indem es einen tabellenartigen Aufbau mit Zeilen und Spalten - ( also maximale Rekursionstiefe 2 ) simuliert. - Au\erdem sichert es die Persistenz der Anordnung der SfxDockingWindows. + A SfxSplitWindow brings the recursive structure of the SV-SplitWindows to + the outside by simulating a table-like structure with rows and columns + (maximum recursion depth 2). Furthermore, it ensures the persistence of + the arrangement of the SfxDockingWindows. */ : SplitWindow ( pParent, nBits | WB_HIDE ), @@ -209,7 +204,7 @@ SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, ShowFadeOutButton( sal_True ); } - // SV-Alignment setzen + // Set SV-Alignment WindowAlign eTbxAlign; switch ( eAlign ) { @@ -241,7 +236,7 @@ SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, if ( bWithButtons ) { - // Konfiguration einlesen + // Read Configuration String aWindowId = String::CreateFromAscii("SplitWindow"); aWindowId += String::CreateFromInt32( (sal_Int32) eTbxAlign ); SvtViewOptions aWinOpt( E_WINDOW, aWindowId ); @@ -255,7 +250,6 @@ SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, pEmptyWin->nState = (sal_uInt16) aWinData.GetToken( 1, ',' ).ToInt32(); if ( pEmptyWin->nState & 2 ) pEmptyWin->bFadeIn = sal_True; - //bPinned = !( pEmptyWin->nState & 1 ); bPinned = sal_True; // always assume pinned - floating mode not used anymore sal_uInt16 i=2; @@ -269,11 +263,11 @@ SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32(); if ( !pDock->nType ) { - // K"onnte NewLine bedeuten + // could mean NewLine pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32(); if ( !pDock->nType ) { - // Lesefehler + // Read error delete pDock; break; } @@ -305,9 +299,8 @@ SfxSplitWindow::~SfxSplitWindow() if ( pEmptyWin ) { - // pOwner auf NULL setzen, sonst versucht pEmptyWin, nochmal zu - // l"oschen; es wird n"amlich von au\sen immer das Fenster deleted, - // das gerade angedockt ist + // Set pOwner to NULL, otherwise try to delete pEmptyWin once more. The + // window that is just beeing docked is always deleted from the outside. pEmptyWin->pOwner = NULL; delete pEmptyWin; } @@ -317,7 +310,7 @@ SfxSplitWindow::~SfxSplitWindow() void SfxSplitWindow::SaveConfig_Impl() { - // Konfiguration abspeichern + // Save configuration String aWinData('V'); aWinData += String::CreateFromInt32( VERSION ); aWinData += ','; @@ -436,15 +429,14 @@ void SfxSplitWindow::Split() void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize) -/* [Beschreibung] - - Zum Einf"ugen von SfxDockingWindows kann auch keine Position "ubergeben - werden. Das SfxSplitWindow sucht dann die zuletzt gemerkte zu dem - "ubergebenen SfxDockingWindow heraus oder h"angt es als letztes neu an. +/* [Description] + To insert SfxDockingWindows can no position be passed. The SfxSplitWindow + searches the last marked one to the passed SfxDockingWindow or appends a + new one at the end. */ { - short nLine = -1; // damit erstes Fenster nLine auf 0 hochsetzen kann + short nLine = -1; // so that the first window cab set nline to 0 sal_uInt16 nL; sal_uInt16 nPos = 0; sal_Bool bNewLine = sal_True; @@ -456,33 +448,33 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize SfxDock_Impl *pDock = (*pDockArr)[n]; if ( pDock->bNewLine ) { - // Das Fenster er"offnet eine neue Zeile + // The window opens a new line if ( pFoundDock ) - // Aber hinter dem gerade eingef"ugten Fenster + // But after the just inserted window break; - // Neue Zeile + // New line nPos = 0; bNewLine = sal_True; } if ( pDock->pWin ) { - // Es gibt an dieser Stelle gerade ein Fenster + // Does there exist a window now at this position if ( bNewLine && !pFoundDock ) { - // Bisher ist nicht bekannt, in welcher realen Zeile es liegt + // Not known until now in which real line it is located GetWindowPos( pDock->pWin, nL, nPos ); nLine = (short) nL; } if ( !pFoundDock ) { - // Fenster liegt vor dem eingef"ugten + // The window is located before the inserted one nPos++; } - // Zeile ist schon er"offnet + // Line is opened bNewLine = sal_False; if ( pFoundDock ) break; @@ -490,16 +482,16 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize if ( pDock->nType == pDockWin->GetType() ) { - DBG_ASSERT( !pFoundDock && !pDock->pWin, "Fenster ist schon vorhanden!"); + DBG_ASSERT( !pFoundDock && !pDock->pWin, "Window does already exist!"); pFoundDock = pDock; if ( !bNewLine ) break; else { - // Es wurde zuletzt eine neue Reihe gestartet, aber noch kein - // darin liegendes Fenster gefunden; daher weitersuchen, ob noch - // ein Fenster in dieser Zeile folgt, um bNewLine korrekt zu setzen. - // Dabei darf aber nLine oder nPos nicht mehr ver"andert werden! + // A new line has been created but no window was fond there; + // continue searching for a window in this line in-order to set + // bNewLine correctly. While doing so nline or nPos are not + // to be changed! nLine++; } } @@ -507,7 +499,7 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize if ( !pFoundDock ) { - // Nicht gefunden, am Ende einf"ugen + // Not found, insert at end pFoundDock = new SfxDock_Impl; pFoundDock->bHide = sal_True; pDockArr->Insert( pFoundDock, nCount ); @@ -530,9 +522,9 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSave) -/* [Beschreibung] +/* [Description] - Das DockingWindow wird nicht mehr in den internen Daten gespeichert. + The docking window is no longer stored in the internal data. */ { @@ -547,7 +539,7 @@ void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSa if ( pDock->bNewLine && n<nCount-1 ) (*pDockArr)[n+1]->bNewLine = sal_True; - // Fenster hat schon eine Position, die vergessen wir + // Window has a position, this we forget bFound = sal_True; pDockArr->Remove(n); break; @@ -566,10 +558,9 @@ void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSa void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) -/* [Beschreibung] - - Das DockingWindow wird innerhalb des Splitwindows verschoben. +/* [Description] + The docking window is moved within the SplitWindows. */ { @@ -578,16 +569,10 @@ void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, if ( nLine > nL && GetItemCount( GetItemId( nL, 0 ) ) == 1 ) { - // Wenn das letzte Fenster aus seiner Zeile entfernt wird, rutscht - // alles eine Zeile nach vorne! + // If the last window is removed from its line, then everything slips + // one line to the front! nLine--; } -/* - else if ( nLine == nL && nPos > nP ) - { - nPos--; - } -*/ RemoveWindow( pDockWin ); InsertWindow( pDockWin, rSize, nLine, nPos, bNewLine ); } @@ -597,11 +582,10 @@ void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize, sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) -/* [Beschreibung] - - Das DockingWindow wird in dieses Splitwindow geschoben und soll die - "ubergebene Position und Gr"o\se haben. +/* [Description] + The DockingWindow that is pushed on this SplitWindow and shall hold the + given position and size. */ { ReleaseWindow_Impl( pDockWin, sal_False ); @@ -611,15 +595,16 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize pDock->bNewLine = bNewLine; pDock->pWin = pDockWin; - DBG_ASSERT( nPos==0 || !bNewLine, "Falsche Paramenter!"); + DBG_ASSERT( nPos==0 || !bNewLine, "Wrong Paramenter!"); if ( bNewLine ) nPos = 0; - // Das Fenster mu\s vor dem ersten Fenster eingef"ugt werden, das die - // gleiche oder eine gr"o\sere Position hat als pDockWin. + // The window must be inserted before the first window so that it has the + // same or a greater position than pDockWin. sal_uInt16 nCount = pDockArr->Count(); + sal_uInt16 nLastWindowIdx(0); - // Wenn gar kein Fenster gefunden wird, wird als erstes eingef"ugt + // If no window is found, a first window is inserted sal_uInt16 nInsertPos = 0; for ( sal_uInt16 n=0; n<nCount; n++ ) { @@ -627,30 +612,35 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize if (pD->pWin) { - // Ein angedocktes Fenster wurde gefunden - // Wenn kein geeignetes Fenster hinter der gew"unschten Einf"ugeposition - // gefunden wird, wird am Ende eingef"ugt + // A docked window has been found. If no suitable window behind the + // the desired insertion point s found, then insertion is done at + // the end. nInsertPos = nCount; + nLastWindowIdx = n; sal_uInt16 nL=0, nP=0; GetWindowPos( pD->pWin, nL, nP ); if ( (nL == nLine && nP == nPos) || nL > nLine ) { - DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Falsche Parameter!" ); + DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Wrong Parameter!" ); if ( nL == nLine && nPos == 0 && !bNewLine ) { - DBG_ASSERT(pD->bNewLine, "Keine neue Zeile?"); + DBG_ASSERT(pD->bNewLine, "No new line?"); - // Das Fenster wird auf nPos==0 eingeschoben + // The posption is pushed to nPos==0 pD->bNewLine = sal_False; pDock->bNewLine = sal_True; } - nInsertPos = n; + nInsertPos = n != 0 ? nLastWindowIdx + 1 : 0; // ignore all non-windows after the last window break; } } } + if (nCount != 0 && nInsertPos == nCount && nLastWindowIdx != nCount - 1) + { + nInsertPos = nLastWindowIdx + 1; // ignore all non-windows after the last window + } pDockArr->Insert(pDock, nInsertPos); InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine ); @@ -663,10 +653,10 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, const Size& rSize, sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) -/* [Beschreibung] +/* [Description] - F"ugt ein DockingWindow ein und veranla\st die Neuberechnung der Gr"o\se - des Splitwindows. + Adds a DockingWindow, and causes the recalculation of the size of + the SplitWindows. */ { @@ -694,8 +684,8 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, if ( bNewLine || nLine == GetItemCount( 0 ) ) { - // Es soll nicht in eine vorhandene Zeile eingef"ugt werden, sondern - // eine neue erzeugt werden + // An existing row should not be inserted, instead a new one + // will be created sal_uInt16 nId = 1; for ( sal_uInt16 n=0; n<GetItemCount(0); n++ ) @@ -704,28 +694,28 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, nId = GetItemId(n)+1; } - // Eine neue nLine-te Zeile erzeugen + // Create a new nLine:th line sal_uInt16 nBits = nItemBits; if ( GetAlign() == WINDOWALIGN_TOP || GetAlign() == WINDOWALIGN_BOTTOM ) nBits |= SWIB_COLSET; InsertItem( nId, nSetSize, nLine, 0, nBits ); } - // In Zeile mit Position nLine das Fenster einf"ugen - // ItemWindowSize auf "Prozentual" setzen, da SV dann das Umgr"o\sern - // so macht, wie man erwartet; "Pixel" macht eigentlich nur Sinn, wenn - // auch Items mit prozentualen oder relativen Gr"o\sen dabei sind. + // Insert the window at line with the position nline. ItemWindowSize set to + // "percentage" share since the SV then does the re-sizing as expected, + // "pixel" actually only makes sense if also items with percentage or + // relative sizes are present. nItemBits |= SWIB_PERCENTSIZE; bLocked = sal_True; sal_uInt16 nSet = GetItemId( nLine ); InsertItem( pDockWin->GetType(), pDockWin, nWinSize, nPos, nSet, nItemBits ); - // Splitwindows werden im SFX einmal angelegt und beim Einf"ugen des ersten - // DockingWindows sichtbar gemacht. + // SplitWindows are once created in SFX and when inserting the first + // DockingWindows is made visable. if ( GetItemCount( 0 ) == 1 && GetItemCount( 1 ) == 1 ) { - // Das Neuarrangieren am WorkWindow und ein Show() auf das SplitWindow - // wird vom SfxDockingwindow veranla\st (->SfxWorkWindow::ConfigChild_Impl) + // The Rearranging in WorkWindow and a Show() on the SplitWindow is + // caues by SfxDockingwindow (->SfxWorkWindow::ConfigChild_Impl) if ( !bPinned && !IsFloatingMode() ) { bPinned = sal_True; @@ -733,7 +723,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, pEmptyWin->bFadeIn = sal_False; SetPinned_Impl( sal_False ); pEmptyWin->Actualize(); - DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; pWorkWin->ArrangeChilds_Impl(); if ( bFadeIn ) @@ -747,11 +737,11 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, #ifdef DBG_UTIL if ( !bPinned || !pEmptyWin->bFadeIn ) { - DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); } else { - DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" ); } #endif pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; @@ -772,20 +762,19 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) -/* [Beschreibung] +/* [Description] - Entfernt ein DockingWindow. Wenn es das letzte war, wird das SplitWindow - gehidet. + Removes a DockingWindow. If it was the last one, then the SplitWindow is + beeing hidden. */ { sal_uInt16 nSet = GetSet( pDockWin->GetType() ); - // Splitwindows werden im SFX einmal angelegt und nach dem Entfernen - // des letzten DockingWindows unsichtbar gemacht. + // SplitWindows are once created in SFX and is made invisible after + // removing the last DockingWindows. if ( GetItemCount( nSet ) == 1 && GetItemCount( 0 ) == 1 ) { - // Das Neuarrangieren am WorkWindow wird vom SfxDockingwindow - // veranla\st! + // The Rearranging in WorkWindow is caues by SfxDockingwindow Hide(); pEmptyWin->aTimer.Stop(); sal_uInt16 nRealState = pEmptyWin->nState; @@ -794,11 +783,11 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) #ifdef DBG_UTIL if ( !bPinned || !pEmptyWin->bFadeIn ) { - DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" ); } else { - DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" ); } #endif pWorkWin->ReleaseChild_Impl( *GetSplitWindow() ); @@ -819,8 +808,8 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) } } - // Fenster removen, und wenn es das letzte der Zeile war, auch die Zeile - // ( Zeile = ItemSet ) + // Remove Windows, and if it was the last of the line, then also remove + // the line (line = itemset) sal_Bool bUpdateMode = IsUpdateMode(); if ( bUpdateMode ) SetUpdateMode( sal_False ); @@ -840,10 +829,10 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow, sal_uInt16& rLine, sal_uInt16& rPos ) const -/* [Beschreibung] +/* [Description] - Liefert die Id des Itemsets und die des Items f"ur das "ubergebene - DockingWindow in der alten Zeilen/Spalten-Bezeichnung zur"uck. + Returns the ID of the item sets and items for the DockingWindow in + the position passed on the old row / column-name. */ { @@ -860,11 +849,10 @@ sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow, sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos, sal_uInt16& rLine, sal_uInt16& rPos ) const -/* [Beschreibung] +/* [Description] - Liefert die Id des Itemsets und die des Items f"ur das DockingWindow - an der "ubergebenen Position in der alten Zeilen/Spalten-Bezeichnung - zur"uck. + Returns the ID of the item sets and items for the DockingWindow in + the position passed on the old row / column-name. */ { @@ -882,9 +870,9 @@ sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos, sal_uInt16 SfxSplitWindow::GetLineCount() const -/* [Beschreibung] +/* [Description] - Liefert die Zeilenzahl = Zahl der Sub-Itemsets im Root-Set. + Returns the number of rows = number of sub-itemsets in the root set. */ { return GetItemCount( 0 ); @@ -894,9 +882,9 @@ sal_uInt16 SfxSplitWindow::GetLineCount() const long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const -/* [Beschreibung] +/* [Description] - Liefert die "Zeilenh"ohe" des nLine-ten Itemsets. + Returns the Row Height of nline itemset. */ { sal_uInt16 nId = GetItemId( nLine ); @@ -907,9 +895,9 @@ long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const -/* [Beschreibung] +/* [Description] - Liefert die + Returns the total number of windows */ { sal_uInt16 nId = GetItemId( nLine ); @@ -920,9 +908,9 @@ sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const sal_uInt16 SfxSplitWindow::GetWindowCount() const -/* [Beschreibung] +/* [Description] - Liefert die Gesamtzahl aller Fenstert + Returns the total number of windows */ { return GetItemCount( 0 ); @@ -944,8 +932,8 @@ IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer) if ( CursorIsOverRect( sal_False ) || !pTimer ) { - // Wenn der Mauszeiger innerhalb des Fensters liegt, SplitWindow anzeigen - // und Timer zum Schlie\sen aufsetzen + // If the cursor is within the window, display the SplitWindow and set + // up the timer for close pEmptyWin->bAutoHide = sal_True; if ( !IsVisible() ) pEmptyWin->FadeIn(); @@ -957,16 +945,16 @@ IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer) { if ( GetPointerPosPixel() != pEmptyWin->aLastPos ) { - // Die Maus wurd innerhalb der Timerlaugzeit bewegt, also erst einmal - // nichts tun + // The mouse has moved within the running time of the timer, thus + // do nothing pEmptyWin->aLastPos = GetPointerPosPixel(); pEmptyWin->aTimer.Start(); return 0L; } - // Speziell f"ur TF_AUTOSHOW_ON_MOUSEMOVE : - // Wenn das Fenster nicht sichtbar ist, gibt es nichts zu tun - // (Benutzer ist einfach mit der Maus "uber pEmptyWin gefahren) + // Especially for TF_AUTOSHOW_ON_MOUSEMOVE : + // If the window is not visible, there is nothing to do + // (user has simply moved the mouse over pEmptyWin) if ( IsVisible() ) { pEmptyWin->bEndAutoHide = sal_False; @@ -974,18 +962,18 @@ IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer) !PopupMenu::IsInExecute() && !pEmptyWin->bSplit && !HasChildPathFocus( sal_True ) ) { - // W"ahrend ein modaler Dialog oder ein Popupmenu offen sind - // oder w"ahrend des Splittens auf keinen Fall zumachen; auch - // solange eines der Children den Focus hat, bleibt das - // das Fenster offen + // While a modal dialog or a popup menu is open or while the + // Splitting is done, in any case, do not close. Even as long + // as one of the Children has the focus, the window remains + // open. pEmptyWin->bEndAutoHide = sal_True; } if ( pEmptyWin->bEndAutoHide ) { - // Von mir aus kann Schlu\s sein mit AutoShow - // Aber vielleicht will noch ein anderes SfxSplitWindow offen bleiben, - // dann bleiben auch alle anderen offen + // As far as I am concered this can be the end of AutoShow + // But maybe some other SfxSplitWindow will remain open, + // then all others remain open too. if ( !pWorkWin->IsAutoHideMode( this ) ) { FadeOut_Impl(); @@ -1014,13 +1002,13 @@ sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const { sal_Bool bVisible = IsVisible(); - // Auch das kollabierte SplitWindow ber"ucksichtigen + // Also, take the collapsed SplitWindow into account Point aPos = pEmptyWin->GetParent()->OutputToScreenPixel( pEmptyWin->GetPosPixel() ); Size aSize = pEmptyWin->GetSizePixel(); if ( bForceAdding ) { - // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os + // Extend with +/- a few pixels, otherwise it is too nervous aPos.X() -= nPixel; aPos.Y() -= nPixel; aSize.Width() += 2 * nPixel; @@ -1034,7 +1022,7 @@ sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const Point aVisPos = GetPosPixel(); Size aVisSize = GetSizePixel(); - // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os + // Extend with +/- a few pixels, otherwise it is too nervous aVisPos.X() -= nPixel; aVisPos.Y() -= nPixel; aVisSize.Width() += 2 * nPixel; @@ -1085,12 +1073,12 @@ void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn ) pEmptyWin->nState |= 1; if ( pEmptyWin->bFadeIn ) { - // Ersatzfenster anmelden - DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" ); + // Unregister replacement windows + OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" ); pWorkWin->ReleaseChild_Impl( *this ); Hide(); pEmptyWin->Actualize(); - DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" ); pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; } @@ -1111,11 +1099,11 @@ void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn ) if ( pEmptyWin->bFadeIn ) { - // Ersatzfenster abmelden - DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" ); + // Unregister replacement windows + OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" ); pWorkWin->ReleaseChild_Impl( *pEmptyWin ); pEmptyWin->Hide(); - DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" ); pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; } } @@ -1140,16 +1128,16 @@ void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn ) pEmptyWin->nState |= 2; if ( IsFloatingMode() ) { - // FloatingWindow ist nicht sichtbar, also anzeigen + // FloatingWindow is not visable, thus display it pWorkWin->ArrangeAutoHideWindows( this ); Show(); } else { - DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" ); pWorkWin->ReleaseChild_Impl( *pEmptyWin ); pEmptyWin->Hide(); - DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" ); pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; pWorkWin->ArrangeChilds_Impl(); pWorkWin->ShowChilds_Impl(); @@ -1161,12 +1149,12 @@ void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn ) pEmptyWin->nState &= ~2; if ( !IsFloatingMode() ) { - // Das Fenster "schwebt" nicht, soll aber ausgeblendet werden, - DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" ); + // The window is not "floating", should be hidden + OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" ); pWorkWin->ReleaseChild_Impl( *this ); Hide(); pEmptyWin->Actualize(); - DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" ); + OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" ); pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; pWorkWin->ArrangeChilds_Impl(); pWorkWin->ShowChilds_Impl(); @@ -1182,17 +1170,17 @@ void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn ) void SfxSplitWindow::AutoHide() { - // Wenn dieser Handler am "echten" SplitWindow aufgerufen wird, ist es - // entweder angedockt und soll "schwebend" angezeigt werden oder umgekehrt + // If this handler is called in the "real" SplitWindow, it is + // either docked and should be displayed as floating, or vice versa if ( !bPinned ) { - // Es "schwebt", also wieder andocken + // It "floats", thus dock it again SetPinned_Impl( sal_True ); pWorkWin->ArrangeChilds_Impl(); } else { - // In den "Schwebezustand" bringen + // In "limbo" SetPinned_Impl( sal_False ); pWorkWin->ArrangeChilds_Impl(); pWorkWin->ArrangeAutoHideWindows( this ); @@ -1236,23 +1224,19 @@ void SfxSplitWindow::Show_Impl() pDock->pWin->FadeIn( pEmptyWin->bFadeIn ); } } -/* -void SfxSplitWindow::Pin_Impl( sal_Bool bPin ) -{ - if ( bPinned != bPin ) - AutoHide(); -} -*/ + sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward ) { - // Wenn kein pActive, auf erstes bzw. letztes Fenster gehen ( bei !bForward wird erst in der loop dekrementiert ) + // If no pActive, go to first and last window (!bForward is first + // decremented in the loop) sal_uInt16 nCount = pDockArr->Count(); sal_uInt16 n = bForward ? 0 : nCount; - // Wenn Focus innerhalb, dann ein Fenster vor oder zur"uck, wenn m"oglich + // if Focus is within, then move to a window forward or backwards + // if possible if ( pActive ) { - // Aktives Fenster ermitteln + // Determine the active window for ( n=0; n<nCount; n++ ) { SfxDock_Impl *pD = (*pDockArr)[n]; @@ -1261,13 +1245,14 @@ sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward ) } if ( bForward ) - // ein Fenster weiter ( wenn dann n>nCount, wird die Schleife unten gar nicht durchlaufen ) + // up window counter (then when n>nCount, the loop below is + // not entered) n++; } if ( bForward ) { - // N"achstes Fenster suchen + // Search for next window for ( sal_uInt16 nNext=n; nNext<nCount; nNext++ ) { SfxDock_Impl *pD = (*pDockArr)[nNext]; @@ -1280,7 +1265,7 @@ sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward ) } else { - // Vorheriges Fenster suchen + // Search for previous window for ( sal_uInt16 nNext=n; nNext--; ) { SfxDock_Impl *pD = (*pDockArr)[nNext]; @@ -1302,3 +1287,4 @@ void SfxSplitWindow::SetActiveWindow_Impl( SfxDockingWindow* pWin ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx index ff3cd08b01c8..c385bad34df3 100644 --- a/sfx2/source/dialog/srchdlg.cxx +++ b/sfx2/source/dialog/srchdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -200,3 +201,4 @@ void SearchDialog::Move() // ============================================================================ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/srchdlg.hrc b/sfx2/source/dialog/srchdlg.hrc index 55fe9ce47d26..55fe9ce47d26 100644..100755 --- a/sfx2/source/dialog/srchdlg.hrc +++ b/sfx2/source/dialog/srchdlg.hrc diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx index ba6fac0fdee8..9f7304d6df2d 100644 --- a/sfx2/source/dialog/styfitem.cxx +++ b/sfx2/source/dialog/styfitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,6 @@ // INCLUDE --------------------------------------------------------------- -#ifndef GCC -#endif - #include <sfx2/styfitem.hxx> #include <svtools/localresaccess.hxx> #include <tools/debug.hxx> @@ -65,7 +63,7 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : pTupel->aName = ReadStringRes(); long lFlags = ReadLongRes(); pTupel->nFlags = (sal_uInt16)lFlags; - aFilterList.Insert(pTupel, LIST_APPEND); + aFilterList.push_back( pTupel ); } } if(nMask & RSC_SFX_STYLE_ITEM_BITMAP) @@ -98,26 +96,21 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : // ----------------------------------------------------------------------- -// Destruktor; gibt interne Daten frei +// Destructor; releases the internal data SfxStyleFamilyItem::~SfxStyleFamilyItem() { - SfxFilterTupel *pTupel = aFilterList.First(); - while(pTupel) - { - delete pTupel; - pTupel = aFilterList.Next(); - } + for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) + delete aFilterList[ i ]; + aFilterList.clear(); } // ----------------------------------------------------------------------- -// Implementierung des Resource-Konstruktors +// Implementation of the resource constructor SfxStyleFamilies::SfxStyleFamilies( const ResId& rResId ) : - - Resource( rResId.SetRT( RSC_SFX_STYLE_FAMILIES ).SetAutoRelease( sal_False ) ), - aEntryList( 4, 1 ) + Resource( rResId.SetRT( RSC_SFX_STYLE_FAMILIES ).SetAutoRelease( false ) ) { sal_uIntPtr nCount = ReadLongRes(); for( sal_uIntPtr i = 0; i < nCount; i++ ) @@ -125,33 +118,29 @@ SfxStyleFamilies::SfxStyleFamilies( const ResId& rResId ) : const ResId aResId((RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr()); SfxStyleFamilyItem *pItem = new SfxStyleFamilyItem(aResId); IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) ); - aEntryList.Insert(pItem, LIST_APPEND); + aEntryList.push_back( pItem ); } FreeResource(); - updateImages( rResId, BMP_COLOR_NORMAL ); + updateImages( rResId ); } // ----------------------------------------------------------------------- -// Destruktor; gibt interne Daten frei +// Destructor; releases the internal data SfxStyleFamilies::~SfxStyleFamilies() { - SfxStyleFamilyItem *pItem = aEntryList.First(); - - while(pItem) - { - delete pItem; - pItem = aEntryList.Next(); - } + for ( size_t i = 0, n = aEntryList.size(); i < n; ++i ) + delete aEntryList[ i ]; + aEntryList.clear(); } // ----------------------------------------------------------------------- -sal_Bool SfxStyleFamilies::updateImages( const ResId& _rId, const BmpColorMode _eMode ) +sal_Bool SfxStyleFamilies::updateImages( const ResId& _rId ) { sal_Bool bSuccess = sal_False; @@ -159,7 +148,7 @@ sal_Bool SfxStyleFamilies::updateImages( const ResId& _rId, const BmpColorMode _ ::svt::OLocalResourceAccess aLocalRes( _rId ); // check if the image list is present - ResId aImageListId( (sal_uInt16)_eMode + 1, *_rId.GetResMgr() ); + ResId aImageListId( (sal_uInt16) 1, *_rId.GetResMgr() ); aImageListId.SetRT( RSC_IMAGELIST ); if ( aLocalRes.IsAvailableRes( aImageListId ) ) @@ -168,14 +157,14 @@ sal_Bool SfxStyleFamilies::updateImages( const ResId& _rId, const BmpColorMode _ // number of styles items/images sal_uInt16 nCount = aImages.GetImageCount( ); - DBG_ASSERT( Count() == nCount, "SfxStyleFamilies::updateImages: found the image list, but missing some bitmaps!" ); - if ( nCount > Count() ) - nCount = Count(); + DBG_ASSERT( aEntryList.size() == nCount, "SfxStyleFamilies::updateImages: found the image list, but missing some bitmaps!" ); + if ( nCount > aEntryList.size() ) + nCount = aEntryList.size(); // set the images on the items - for ( sal_uInt16 i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - SfxStyleFamilyItem* pItem = static_cast< SfxStyleFamilyItem* >( aEntryList.GetObject( i ) ); + SfxStyleFamilyItem* pItem = aEntryList[ i ]; pItem->SetImage( aImages.GetImage( aImages.GetImageId( i ) ) ); } @@ -185,3 +174,5 @@ sal_Bool SfxStyleFamilies::updateImages( const ResId& _rId, const BmpColorMode _ return bSuccess; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index 1a155458995f..b583dc98bd76 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,11 +32,7 @@ // include --------------------------------------------------------------- #include <svl/whiter.hxx> #include <svl/style.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif -#ifndef GCC -#endif #include <sfx2/styledlg.hxx> #include <sfx2/mgetempl.hxx> @@ -50,20 +47,20 @@ SfxStyleDialog::SfxStyleDialog ( Window* pParent, // Parent const ResId& rResId, // ResId - SfxStyleSheetBase& rStyle, // zu bearbeitendes StyleSheet - sal_Bool bFreeRes, // Flag Resourcen freigeben + SfxStyleSheetBase& rStyle, // stylesheet to be processed + sal_Bool bFreeRes, // Flag release resources const String* pUserBtnTxt ) : -/* [Beschreibung] +/* [Description] - Konstruktor: Verwalten-TabPage zuf"ugen, ExampleSet vom Style setzen. + Constructor: Add Manage TabPage, set ExampleSet from style. */ SfxTabDialog( pParent, rResId, rStyle.GetItemSet().Clone(), - // auch ohne ParentSupport TRUE "ubergeben, aber erweitert - // um den StandardButton zu unterdr"ucken + // return TRUE also without ParentSupport , but extended + // to suppress the standardButton rStyle.HasParentSupport() ? sal_True : 2, pUserBtnTxt ), @@ -74,8 +71,7 @@ SfxStyleDialog::SfxStyleDialog String( SfxResId( STR_TABPAGE_MANAGESTYLES ) ), SfxManageStyleSheetPage::Create, 0, sal_False, 0 ); - // bei neuer Vorlage immer die Verwaltungsseite als aktuelle - // Seite setzen + // With new template always set the management page as the current page if( !rStyle.GetName().Len() ) SetCurPageId( ID_TABPAGE_MANAGESTYLES ); @@ -86,7 +82,7 @@ SfxStyleDialog::SfxStyleDialog sTxt += rStyle.GetName(); SetText( sTxt ); } - delete pExampleSet; // im SfxTabDialog::Ctor() schon angelegt + delete pExampleSet; // in SfxTabDialog::Ctor() already created pExampleSet = &pStyle->GetItemSet(); if ( bFreeRes ) @@ -98,10 +94,10 @@ SfxStyleDialog::SfxStyleDialog SfxStyleDialog::~SfxStyleDialog() -/* [Beschreibung] +/* [Description] - Destruktor: ExampleSet auf NULL setzen, damit der SfxTabDialog nicht den - Set vom Style l"oscht. + Destructor: set ExampleSet to NULL, so that SfxTabDialog does not delete + the Set from Style. */ { @@ -114,10 +110,10 @@ SfxStyleDialog::~SfxStyleDialog() const SfxItemSet* SfxStyleDialog::GetRefreshedSet() -/* [Beschreibung] +/* [Description] - Diese wird gerufen, wenn <SfxTabPage::DeactivatePage(SfxItemSet *)> - <SfxTabPage::REFRESH_SET> liefert. + This is called when <SfxTabPage::DeactivatePage(SfxItemSet *)> + returns <SfxTabPage::REFRESH_SET>. */ { @@ -128,9 +124,9 @@ const SfxItemSet* SfxStyleDialog::GetRefreshedSet() short SfxStyleDialog::Ok() -/* [Beschreibung] +/* [Description] - "Uberladen, damit immer RET_OK zur"uckgegeben wird. + Overloaded, so that always RET_OK is returned. */ { @@ -142,10 +138,10 @@ short SfxStyleDialog::Ok() IMPL_LINK( SfxStyleDialog, CancelHdl, Button *, pButton ) -/* [Beschreibung] +/* [Description] - Wenn der Dialog abgebrochen wurde, m"ussen alle schon eingestellten - Attribute wieder zur"uckgesetzt werden. + If the dialogue was canceled, then all selected attributes must be reset + again. */ { @@ -174,3 +170,4 @@ IMPL_LINK( SfxStyleDialog, CancelHdl, Button *, pButton ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 35a5fb766b97..c9d90ae59b0b 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <vcl/msgbox.hxx> #include <unotools/viewoptions.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uInt16S #include <svl/svstdarr.hxx> #include "appdata.hxx" @@ -62,7 +63,7 @@ using namespace ::com::sun::star::uno; using namespace ::rtl; -#define USERITEM_NAME OUString::createFromAscii( "UserItem" ) +#define USERITEM_NAME OUString(RTL_CONSTASCII_USTRINGPARAM("UserItem")) TYPEINIT1(LAYOUT_NS_SFX_TABDIALOG SfxTabDialogItem,SfxSetItem); @@ -79,14 +80,14 @@ NAMESPACE_LAYOUT_SFX_TABDIALOG struct Data_Impl { - sal_uInt16 nId; // Die ID - CreateTabPage fnCreatePage; // Pointer auf die Factory - GetTabPageRanges fnGetRanges;// Pointer auf die Ranges-Funktion - SfxTabPage* pTabPage; // die TabPage selber + sal_uInt16 nId; // The ID + CreateTabPage fnCreatePage; // Pointer to Factory + GetTabPageRanges fnGetRanges; // Pointer to Ranges-Function + SfxTabPage* pTabPage; // The TabPage itself sal_Bool bOnDemand; // Flag: ItemSet onDemand - sal_Bool bRefresh; // Flag: Seite mu\s neu initialisiert werden + sal_Bool bRefresh; // Flag: Page must be re-initialized - // Konstruktor + // Constructor Data_Impl( sal_uInt16 Id, CreateTabPage fnPage, GetTabPageRanges fnRanges, sal_Bool bDemand ) : @@ -119,14 +120,14 @@ SfxTabDialogItem::SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ) { } -SfxPoolItem* __EXPORT SfxTabDialogItem::Clone(SfxItemPool* pToPool) const +SfxPoolItem* SfxTabDialogItem::Clone(SfxItemPool* pToPool) const { return new SfxTabDialogItem( *this, pToPool ); } -SfxPoolItem* __EXPORT SfxTabDialogItem::Create(SvStream& /*rStream*/, sal_uInt16 /*nVersion*/) const +SfxPoolItem* SfxTabDialogItem::Create(SvStream& /*rStream*/, sal_uInt16 /*nVersion*/) const { - DBG_ERROR( "Use it only in UI!" ); + OSL_FAIL( "Use it only in UI!" ); return NULL; } @@ -255,9 +256,9 @@ void SfxTabPage::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::st SfxTabPage::SfxTabPage( Window *pParent, const ResId &rResId, const SfxItemSet &rAttrSet ) : -/* [Beschreibung] +/* [Description] - Konstruktor + Constructor */ TabPage( pParent, rResId ), @@ -282,9 +283,9 @@ SfxTabPage:: SfxTabPage( Window *pParent, WinBits nStyle, const SfxItemSet &rAtt SfxTabPage::~SfxTabPage() -/* [Beschreibung] +/* [Description] - Destruktor + Destructor */ { @@ -312,12 +313,10 @@ void SfxTabPage::Reset( const SfxItemSet& rSet ) void SfxTabPage::ActivatePage( const SfxItemSet& ) -/* [Beschreibung] - - Defaultimplementierung der virtuellen ActivatePage-Methode - Diese wird gerufen, wenn eine Seite des Dialogs den Datenaustausch - zwischen Pages unterst"utzt. +/* [Description] + Default implementation of the virtual ActivatePage method. This method is + called when a page of dialogue supports the exchange of data between pages. <SfxTabPage::DeactivatePage(SfxItemSet *)> */ @@ -328,22 +327,19 @@ void SfxTabPage::ActivatePage( const SfxItemSet& ) int SfxTabPage::DeactivatePage( SfxItemSet* ) -/* [Beschreibung] +/* [Description] - Defaultimplementierung der virtuellen DeactivatePage-Methode - Diese wird vor dem Verlassen einer Seite durch den Sfx gerufen; - die Anwendung kann "uber den Returnwert steuern, - ob die Seite verlassen werden soll. - Falls die Seite "uber bHasExchangeSupport - anzeigt, da\s sie einen Datenaustausch zwischen Seiten - unterst"utzt, wird ein Pointer auf das Austausch-Set als - Parameter "ubergeben. Dieser nimmt die Daten f"ur den Austausch - entgegen; das Set steht anschlie\send als Parameter in - <SfxTabPage::ActivatePage(const SfxItemSet &)> zur Verf"ugung. + Default implementation of the virtual DeactivatePage method. This method is + called by Sfx when leaving a page; the application can, through the return + value, control whether to leave the page. If the page is displayed through + bHasExchangeSupport which supports data exchange between pages, then a + pointer to the exchange set is passed as parameter. This takes on data for + the exchange, then the set is available as a parameter in + <SfxTabPage::ActivatePage(const SfxItemSet &)>. - [R"uckgabewert] + [Return value] - LEAVE_PAGE; Verlassen der Seite erlauben + LEAVE_PAGE; Allow leaving the page */ { @@ -354,12 +350,11 @@ int SfxTabPage::DeactivatePage( SfxItemSet* ) void SfxTabPage::FillUserData() -/* [Beschreibung] +/* [Description] - virtuelle Methode, wird von der Basisklasse im Destruktor gerufen - um spezielle Informationen der TabPage in der Ini-Datei zu speichern. - Beim "Uberladen muss ein String zusammengestellt werden, der mit - <SetUserData()> dann weggeschrieben wird. + Virtual method is called by the base class in the destructor to save + specific information of the TabPage in the ini-file. When overloading a + string must be compiled, which is then flushed with the <SetUserData()>. */ { @@ -368,11 +363,6 @@ void SfxTabPage::FillUserData() // ----------------------------------------------------------------------- sal_Bool SfxTabPage::IsReadOnly() const - -/* [Description] - -*/ - { return sal_False; } @@ -381,22 +371,17 @@ sal_Bool SfxTabPage::IsReadOnly() const const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep ) -/* [Beschreibung] - - static Methode: hiermit wird der Code der TabPage-Implementierungen - vereinfacht. +/* [Description] + static Method: hereby are the implementations of the TabPage code + beeing simplified. */ { const SfxItemPool* pPool = rSet.GetPool(); sal_uInt16 nWh = pPool->GetWhich( nSlot, bDeep ); const SfxPoolItem* pItem = 0; -#ifdef DEBUG - SfxItemState eState; - eState = -#endif - rSet.GetItemState( nWh, sal_True, &pItem ); // -Wall required?? + rSet.GetItemState( nWh, sal_True, &pItem ); if ( !pItem && nWh != nSlot ) pItem = &pPool->GetDefaultItem( nWh ); @@ -408,10 +393,9 @@ const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot const SfxPoolItem* SfxTabPage::GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep ) -/* [Beschreibung] +/* [Description] - Diese Methode gibt f"ur Vergleiche den alten Wert eines - Attributs zur"uck. + This method returns an attribute for comparison of the old value. */ { @@ -434,11 +418,10 @@ const SfxPoolItem* SfxTabPage::GetOldItem( const SfxItemSet& rSet, const SfxPoolItem* SfxTabPage::GetExchangeItem( const SfxItemSet& rSet, sal_uInt16 nSlot ) -/* [Beschreibung] +/* [Description] - Diese Methode gibt f"ur Vergleiche den alten Wert eines - Attributs zur"uck. Dabei wird ber"ucksichtigt, ob der Dialog - gerade mit OK beendet wurde. + This method returns an attribute for comparison of the old value. This way + it will be considered whether the dialogue has just been ended with OK. */ { @@ -448,12 +431,11 @@ const SfxPoolItem* SfxTabPage::GetExchangeItem( const SfxItemSet& rSet, return GetOldItem( rSet, nSlot ); } -// add CHINA001 begin + void SfxTabPage::PageCreated( SfxAllItemSet /*aSet*/ ) { DBG_ASSERT(0, "SfxTabPage::PageCreated should not be called"); -}//CHINA001 -// add CHINA001 end +} // ----------------------------------------------------------------------- @@ -501,21 +483,21 @@ void SfxTabPage::AddItemConnection( sfx::ItemConnectionBase* pConnection ) SfxTabDialog::SfxTabDialog -/* [Beschreibung] +/* [Description] - Konstruktor + Constructor */ ( - SfxViewFrame* pViewFrame, // Frame, zu dem der Dialog geh"ort - Window* pParent, // Parent-Fenster + SfxViewFrame* pViewFrame, // Frame, to which the Dialog belongs + Window* pParent, // Parent Window const ResId& rResId, // ResourceId - const SfxItemSet* pItemSet, // Itemset mit den Daten; - // kann NULL sein, wenn Pages onDemand - sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet - // wenn ja -> zus"atzlicher Button f"ur Standard - const String* pUserButtonText // Text fuer BenutzerButton; - // wenn != 0, wird der UserButton erzeugt + const SfxItemSet* pItemSet, // Itemset with the data; + // can be NULL, when Pages are onDemand + sal_Bool bEditFmt, // Flag: templates are processed + // when yes -> additional Button for standard + const String* pUserButtonText // Text for UserButton; + // if != 0, the UserButton is created ) : TabDialog( pParent, rResId ), pFrame( pViewFrame ), @@ -528,45 +510,45 @@ SfxTabDialog::SfxTabDialog SfxTabDialog::SfxTabDialog -/* [Beschreibung] +/* [Description] - Konstruktor, tempor"ar ohne Frame + Constructor, temporary without Frame */ ( - Window* pParent, // Parent-Fenster + Window* pParent, // Parent Window const ResId& rResId, // ResourceId - const SfxItemSet* pItemSet, // Itemset mit den Daten; kann NULL sein, - // wenn Pages onDemand - sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet - // wenn ja -> zus"atzlicher Button f"ur Standard - const String* pUserButtonText // Text f"ur BenutzerButton; - // wenn != 0, wird der UserButton erzeugt + const SfxItemSet* pItemSet, // Itemset with the data; + // can be NULL, when Pages are onDemand + sal_Bool bEditFmt, // Flag: templates are processed + // when yes -> additional Button for standard + const String* pUserButtonText // Text for UserButton; + // if != 0, the UserButton is created ) : TabDialog( pParent, rResId ), pFrame( 0 ), INI_LIST(pItemSet) { Init_Impl( bFmt, pUserButtonText ); - DBG_WARNING( "bitte den Ctor mit ViewFrame verwenden" ); + DBG_WARNING( "Please use the Construtor with the ViewFrame" ); } SfxTabDialog::SfxTabDialog -/* [Beschreibung] +/* [Description] - Konstruktor, tempor"ar ohne Frame + Constructor, temporary without Frame */ ( - Window* pParent, // Parent-Fenster + Window* pParent, // Parent Window const ResId& rResId, // ResourceId sal_uInt16 nSetId, SfxBindings& rBindings, - sal_Bool bEditFmt, // Flag: es werden Vorlagen bearbeitet - // wenn ja -> zus"atzlicher Button f"ur Standard - const String* pUserButtonText // Text f"ur BenutzerButton; - // wenn != 0, wird der UserButton erzeugt + sal_Bool bEditFmt, // Flag: templates are processed + // when yes -> additional Button for standard + const String* pUserButtonText // Text for UserButton; + // if != 0, the UserButton is created ) : TabDialog( pParent, rResId ), pFrame( 0 ), @@ -646,9 +628,9 @@ SfxTabDialog::~SfxTabDialog() void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText ) -/* [Beschreibung] +/* [Description] - interne Initialisierung des Dialogs + internal initialization of the dialogue */ { @@ -682,10 +664,10 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText ) aBaseFmtBtn.SetClickHdl( LINK( this, SfxTabDialog, BaseFmtHdl ) ); aBaseFmtBtn.SetHelpId( HID_TABDLG_STANDARD_BTN ); - // bFmt = tempor"ares Flag im Ctor() "ubergeben, - // wenn bFmt == 2, dann auch sal_True, - // zus"atzlich Ausblendung vom StandardButton, - // nach der Initialisierung wieder auf sal_True setzen + // bFmt = temporary Flag passed on in the Constructor(), + // if bFmt == 2, then also sal_True, + // additional suppression of the standard button, + // after the Initializing set to sal_True again if ( bFmtFlag != 2 ) aBaseFmtBtn.Show(); else @@ -843,7 +825,7 @@ void SfxTabDialog::Start_Impl() SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); #endif /* !ENABLE_LAYOUT_SFX_TABDIALOG */ - // initiale TabPage aus Programm/Hilfe/Konfig + // initial TabPage from Program/Help/config nActPage = (sal_uInt16)aDlgOpt.GetPageID(); if ( USHRT_MAX != nAppPageId ) @@ -888,20 +870,19 @@ void SfxTabDialog::AddTabPage( sal_uInt16 nId, const Bitmap &rRiderBitmap, sal_B void SfxTabDialog::AddTabPage -/* [Beschreibung] +/* [Description] - Hinzuf"ugen einer Seite zu dem Dialog. - Mu\s korrespondieren zu einem entsprechende Eintrag im - TabControl in der Resource des Dialogs. + Adding a page to the dialogue. Must correspond to a entry in the + TabControl in the resource of the dialogue. */ ( - sal_uInt16 nId, // ID der Seite - CreateTabPage pCreateFunc, // Pointer auf die Factory-Methode - GetTabPageRanges pRangesFunc, // Pointer auf die Methode f"ur das - // Erfragen der Ranges onDemand - sal_Bool bItemsOnDemand // gibt an, ob das Set dieser Seite beim - // Erzeugen der Seite erfragt wird + sal_uInt16 nId, // Page ID + CreateTabPage pCreateFunc, // Pointer to the Factory Method + GetTabPageRanges pRangesFunc, // Pointer to the Method for quering + // Ranges onDemand + sal_Bool bItemsOnDemand // indicates whether the set of this page is + // requested when created ) { pImpl->pData->Append( @@ -912,11 +893,10 @@ void SfxTabDialog::AddTabPage void SfxTabDialog::AddTabPage -/* [Beschreibung] +/* [Description] - Hinzuf"ugen einer Seite zu dem Dialog. - Der Ridertext wird "ubergeben, die Seite hat keine Entsprechung im - TabControl in der Resource des Dialogs. + Add a page to the dialog. The Rider text is passed on, the page has no + counterpart in the TabControl in the resource of the dialogue. */ ( @@ -929,7 +909,7 @@ void SfxTabDialog::AddTabPage ) { DBG_ASSERT( TAB_PAGE_NOTFOUND == aTabCtrl.GetPagePos( nId ), - "Doppelte Page-Ids in der Tabpage" ); + "Double Page-Ids in the Tabpage" ); aTabCtrl.InsertPage( nId, rRiderText, nPos ); pImpl->pData->Append( new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); @@ -940,11 +920,10 @@ void SfxTabDialog::AddTabPage void SfxTabDialog::AddTabPage -/* [Beschreibung] +/* [Description] - Hinzuf"ugen einer Seite zu dem Dialog. - Die Riderbitmap wird "ubergeben, die Seite hat keine Entsprechung im - TabControl in der Resource des Dialogs. + Add a page to the dialog. The riders bitmap is passed on, the page has no + counterpart in the TabControl in the resource of the dialogue. */ ( @@ -957,7 +936,7 @@ void SfxTabDialog::AddTabPage ) { DBG_ASSERT( TAB_PAGE_NOTFOUND == aTabCtrl.GetPagePos( nId ), - "Doppelte Page-Ids in der Tabpage" ); + "Duplicate Page-Ids in the Tabpage" ); aTabCtrl.InsertPage( nId, rRiderBitmap, nPos ); pImpl->pData->Append( new Data_Impl( nId, pCreateFunc, pRangesFunc, bItemsOnDemand ) ); @@ -968,9 +947,9 @@ void SfxTabDialog::AddTabPage void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) -/* [Beschreibung] +/* [Description] - L"oschen der TabPage mit der ID nId + Delete the TabPage with ID nId */ { @@ -1001,7 +980,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) } else { - DBG_WARNINGFILE( "TabPage-Id nicht bekannt" ); + DBG_WARNINGFILE( "TabPage-Id not known" ); } } @@ -1009,16 +988,16 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) void SfxTabDialog::PageCreated -/* [Beschreibung] +/* [Description] - Defaultimplemetierung der virtuellen Methode. - Diese wird unmittelbar nach dem Erzeugen einer Seite gerufen. - Hier kann der Dialog direkt an der TabPage Methoden rufen. + Default implemetation of the virtual method. This is called immediately + after creating a page. Here the dialogue can call the TabPage Method + directly. */ ( - sal_uInt16, // Id der erzeugten Seite - SfxTabPage& // Referenz auf die erzeugte Seite + sal_uInt16, // Id of the created page + SfxTabPage& // Reference to the created page ) { } @@ -1027,11 +1006,10 @@ void SfxTabDialog::PageCreated SfxItemSet* SfxTabDialog::GetInputSetImpl() -/* [Beschreibung] +/* [Description] - Abgeleitete Klassen legen ggf. fuer den InputSet neuen Speicher an. - Dieser mu\s im Destruktor auch wieder freigegeben werden. Dazu mu\s - diese Methode gerufen werden. + Derived classes may create new storage for the InputSet. This has to be + released in the Destructor. To do this, this method must be called. */ { @@ -1042,9 +1020,9 @@ SfxItemSet* SfxTabDialog::GetInputSetImpl() SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const -/* [Beschreibung] +/* [Description] - TabPage mit der "Ubergebenen Id zur"uckgeben. + Return TabPage with the specified Id. */ { @@ -1059,11 +1037,6 @@ SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- sal_Bool SfxTabDialog::IsInOK() const - -/* [Beschreibung] - -*/ - { return pImpl->bInOK; } @@ -1072,18 +1045,17 @@ sal_Bool SfxTabDialog::IsInOK() const short SfxTabDialog::Ok() -/* [Beschreibung] +/* [Description] - Ok-Handler des Dialogs - Das OutputSet wird erstellt und jede Seite wird mit - dem bzw. ihrem speziellen OutputSet durch Aufruf der Methode - <SfxTabPage::FillItemSet(SfxItemSet &)> dazu aufgefordert, - die vom Benuzter eingestellten Daten in das Set zu tun. + Ok handler for the Dialogue. + The OutputSet is created and for each page this or the special OutputSet + is set by calling the method <SfxTabPage::FillItemSet(SfxItemSet &)>, to + insert the entered data by the user into the set. - [R"uckgabewert] + [Return value] - RET_OK: wenn mindestens eine Seite sal_True als Returnwert von - FillItemSet geliefert hat, sonst RET_CANCEL. + RET_OK: if at least one page has returned from FillItemSet, + otherwise RET_CANCEL. */ { @@ -1092,7 +1064,7 @@ short SfxTabDialog::Ok() if ( !pOutSet ) { if ( !pExampleSet && pSet ) - pOutSet = pSet->Clone( sal_False ); // ohne Items + pOutSet = pSet->Clone( sal_False ); // without Items else if ( pExampleSet ) pOutSet = new SfxItemSet( *pExampleSet ); } @@ -1148,14 +1120,14 @@ IMPL_LINK( SfxTabDialog, CancelHdl, Button*, pButton ) SfxItemSet* SfxTabDialog::CreateInputItemSet( sal_uInt16 ) -/* [Beschreibung] +/* [Description] - Defaultimplemetierung der virtuellen Methode. - Diese wird gerufen, wenn Pages ihre Sets onDenamd anlegen + Default implemetation of the virtual Method. + This is called when pages create their sets onDenamd. */ { - DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" ); + DBG_WARNINGFILE( "CreateInputItemSet not implemented" ); return new SfxAllItemSet( SFX_APP()->GetPool() ); } @@ -1163,15 +1135,15 @@ SfxItemSet* SfxTabDialog::CreateInputItemSet( sal_uInt16 ) const SfxItemSet* SfxTabDialog::GetRefreshedSet() -/* [Beschreibung] +/* [Description] - Defaultimplemetierung der virtuellen Methode. - Diese wird gerufen, wenn <SfxTabPage::DeactivatePage(SfxItemSet *)> - <SfxTabPage::REFRESH_SET> liefert. + Default implemetation of the virtual Method. + This is called, when <SfxTabPage::DeactivatePage(SfxItemSet *)> + returns <SfxTabPage::REFRESH_SET>. */ { - DBG_ERRORFILE( "GetRefreshedSet nicht implementiert" ); + DBG_ERRORFILE( "GetRefreshedSet not implemented" ); return 0; } @@ -1179,13 +1151,12 @@ const SfxItemSet* SfxTabDialog::GetRefreshedSet() IMPL_LINK( SfxTabDialog, OkHdl, Button *, EMPTYARG ) -/* [Beschreibung] +/* [Description] - Handler des Ok-Buttons - Dieser ruft f"ur die aktuelle Seite - <SfxTabPage::DeactivatePage(SfxItemSet *)>. - Liefert diese <SfxTabPage::LEAVE_PAGE>, wird <SfxTabDialog::Ok()> gerufen - und so der Dialog beendet. + Handler of the Ok-Buttons + This calls the current page <SfxTabPage::DeactivatePage(SfxItemSet *)>. + Returns <SfxTabPage::LEAVE_PAGE>, <SfxTabDialog::Ok()> is called + anf the Dialog is ended. */ { @@ -1244,13 +1215,12 @@ bool SfxTabDialog::PrepareLeaveCurrentPage() IMPL_LINK( SfxTabDialog, UserHdl, Button *, EMPTYARG ) -/* [Beschreibung] +/* [Description] - Handler des User-Buttons - Dieser ruft f"ur die aktuelle Seite - <SfxTabPage::DeactivatePage(SfxItemSet *)>. - Liefert diese <SfxTabPage::LEAVE_PAGE>, wird <SfxTabDialog::Ok()> gerufen. - Mit dem Return-Wert von <SfxTabDialog::Ok()> wird dann der Dialog beendet. + Handler of the User-Buttons + This calls the current page <SfxTabPage::DeactivatePage(SfxItemSet *)>. + returns this <SfxTabPage::LEAVE_PAGE> and <SfxTabDialog::Ok()> is called. + Then the Dialog is ended with the Return value <SfxTabDialog::Ok()> */ { @@ -1271,22 +1241,21 @@ IMPL_LINK( SfxTabDialog, UserHdl, Button *, EMPTYARG ) IMPL_LINK( SfxTabDialog, ResetHdl, Button *, EMPTYARG ) -/* [Beschreibung] +/* [Description] - Handler hinter dem Zur"ucksetzen-Button. - Die aktuelle Page wird mit ihren initialen Daten - neu initialisiert; alle Einstellungen, die der Benutzer - auf dieser Seite get"atigt hat, werden aufgehoben. + Handler behind the reset button. + The Current Page is new initialized with their initial data, all the + settings that the user has made on this page are repealed. */ { const sal_uInt16 nId = aTabCtrl.GetCurPageId(); Data_Impl* pDataObject = Find( *pImpl->pData, nId ); - DBG_ASSERT( pDataObject, "Id nicht bekannt" ); + DBG_ASSERT( pDataObject, "Id not known" ); if ( pDataObject->bOnDemand ) { - // CSet auf AIS hat hier Probleme, daher getrennt + // CSet on AIS has problems here, thus separated const SfxItemSet* pItemSet = &pDataObject->pTabPage->GetItemSet(); pDataObject->pTabPage->Reset( *(SfxItemSet*)pItemSet ); } @@ -1299,18 +1268,17 @@ IMPL_LINK( SfxTabDialog, ResetHdl, Button *, EMPTYARG ) IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG ) -/* [Beschreibung] +/* [Description] - Handler hinter dem Standard-Button. - Dieser Button steht beim Bearbeiten von StyleSheets zur Verf"ugung. - Alle in dem bearbeiteten StyleSheet eingestellten Attribute - werden gel"oscht. + Handler behind the Standard-Button. + This button is available when editing style sheets. All the set attributes + in the edited stylesheet are deleted. */ { const sal_uInt16 nId = aTabCtrl.GetCurPageId(); Data_Impl* pDataObject = Find( *pImpl->pData, nId ); - DBG_ASSERT( pDataObject, "Id nicht bekannt" ); + DBG_ASSERT( pDataObject, "Id not known" ); bFmt = 2; if ( pDataObject->fnGetRanges ) @@ -1328,23 +1296,23 @@ IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG ) if ( *pTmpRanges == *pU ) { - // Range mit zwei gleichen Werten -> nur ein Item setzen + // Range which two identical values -> only set one Item sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges ); pExampleSet->ClearItem( nWh ); aTmpSet.ClearItem( nWh ); - // am OutSet mit InvalidateItem, - // damit die "Anderung wirksam wird + // At the Outset of InvalidateItem, + // so that the change takes effect pOutSet->InvalidateItem( nWh ); } else { - // richtiger Range mit mehreren Werten + // Correct Range with multiple values sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; - DBG_ASSERT( nTmp <= nTmpEnd, "Range ist falsch sortiert" ); + DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" ); if ( nTmp > nTmpEnd ) { - // wenn wirklich falsch sortiert, dann neu setzen + // If really sorted wrongly, then set new sal_uInt16 nTmp1 = nTmp; nTmp = nTmpEnd; nTmpEnd = nTmp1; @@ -1352,21 +1320,21 @@ IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG ) while ( nTmp <= nTmpEnd ) { - // "uber den Range iterieren, und die Items setzen + // Iterate over the Range and set the Items sal_uInt16 nWh = pPool->GetWhich( nTmp ); pExampleSet->ClearItem( nWh ); aTmpSet.ClearItem( nWh ); - // am OutSet mit InvalidateItem, - // damit die "Anderung wirksam wird + // At the Outset of InvalidateItem, + // so that the change takes effect pOutSet->InvalidateItem( nWh ); nTmp++; } } - // zum n"achsten Paar gehen + // Go to the next pair pTmpRanges += 2; } - // alle Items neu gesetzt -> dann an der aktuellen Page Reset() rufen - DBG_ASSERT( pDataObject->pTabPage, "die Page ist weg" ); + // Set all Items as new -> the call the current Page Reset() + DBG_ASSERT( pDataObject->pTabPage, "the Page is gone" ); pDataObject->pTabPage->Reset( aTmpSet ); pDataObject->pTabPage->pImpl->mbStandard = sal_True; } @@ -1383,29 +1351,27 @@ IMPL_LINK( SfxTabDialog, BaseFmtHdl, Button *, EMPTYARG ) IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) -/* [Beschreibung] +/* [Description] - Handler, der vor dem Umschalten auf eine andere Seite - durch Starview gerufen wird. - Existiert die Seite noch nicht, so wird sie erzeugt und - die virtuelle Methode <SfxTabDialog::PageCreated( sal_uInt16, SfxTabPage &)> - gerufen. Existiert die Seite bereits, so wird ggf. - <SfxTabPage::Reset(const SfxItemSet &)> oder - <SfxTabPage::ActivatePage(const SfxItemSet &)> gerufen. + Handler that is called by StarView for switching to a different page. + If the page not exist yet then it is created and the virtual Method + <SfxTabDialog::PageCreated( sal_uInt16, SfxTabPage &)> is called. If the page + exist, then the if possible the <SfxTabPage::Reset(const SfxItemSet &)> or + <SfxTabPage::ActivatePage(const SfxItemSet &)> is called. */ { sal_uInt16 const nId = pTabCtrl->GetCurPageId(); - DBG_ASSERT( pImpl->pData->Count(), "keine Pages angemeldet" ); + DBG_ASSERT( pImpl->pData->Count(), "no Pages registered" ); SFX_APP(); // Tab Page schon da? SfxTabPage* pTabPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId )); Data_Impl* pDataObject = Find( *pImpl->pData, nId ); - DBG_ASSERT( pDataObject, "Id nicht bekannt" ); + DBG_ASSERT( pDataObject, "Id not known" ); - // ggf. TabPage erzeugen: + // Create TabPage if possible: if ( !pTabPage ) { #if ENABLE_LAYOUT_SFX_TABDIALOG @@ -1459,7 +1425,7 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) #endif /* ENABLE_LAYOUT */ Size aCtrlSiz = pTabCtrl->GetTabPageSizePixel(); - // Gr"o/se am TabControl nur dann setzen, wenn < als TabPage + // Only set Size on TabControl when < as TabPage if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) { @@ -1494,11 +1460,11 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) -/* [Beschreibung] +/* [Description] - Handler, der vor dem Verlassen einer Seite durch Starview gerufen wird. + Handler that is called by StarView before leaving a page. - [Querverweise] + [Cross-reference] <SfxTabPage::DeactivatePage(SfxItemSet *)> */ @@ -1507,13 +1473,13 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) sal_uInt16 nId = pTabCtrl->GetCurPageId(); SFX_APP(); SfxTabPage *pPage = dynamic_cast<SfxTabPage*> (pTabCtrl->GetTabPage( nId )); - DBG_ASSERT( pPage, "keine aktive Page" ); + DBG_ASSERT( pPage, "no active Page" ); #ifdef DBG_UTIL Data_Impl* pDataObject = Find( *pImpl->pData, pTabCtrl->GetCurPageId() ); - DBG_ASSERT( pDataObject, "keine Datenstruktur zur aktuellen Seite" ); + DBG_ASSERT( pDataObject, "no Data structur for current page" ); if ( pPage->HasExchangeSupport() && pDataObject->bOnDemand ) { - DBG_WARNING( "Datenaustausch bei ItemsOnDemand ist nicht gewuenscht!" ); + DBG_WARNING( "Data exchange in ItemsOnDemand is not desired!" ); } #endif @@ -1530,9 +1496,6 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) nRet = pPage->DeactivatePage( &aTmp ); else nRet = pPage->DeactivatePage( NULL ); -//! else -//! pPage->FillItemSet( aTmp ); - if ( ( SfxTabPage::LEAVE_PAGE & nRet ) == SfxTabPage::LEAVE_PAGE && aTmp.Count() ) { @@ -1559,15 +1522,15 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) if ( nRet & SfxTabPage::REFRESH_SET ) { pSet = GetRefreshedSet(); - DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" ); - // alle Pages als neu zu initialsieren flaggen + DBG_ASSERT( pSet, "GetRefreshedSet() returns NULL" ); + // Flag all Pages as to be initialized as new const sal_uInt16 nCount = pImpl->pData->Count(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { Data_Impl* pObj = (*pImpl->pData)[i]; - if ( pObj->pTabPage != pPage ) // eigene Page nicht mehr refreshen + if ( pObj->pTabPage != pPage ) // Do not refresh own Page anymore pObj->bRefresh = sal_True; else pObj->bRefresh = sal_False; @@ -1583,11 +1546,11 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl ) const SfxItemSet* SfxTabDialog::GetOutputItemSet -/* [Beschreibung] +/* [Description] - Liefert die Pages, die ihre Sets onDemand liefern, das OutputItemSet. + Return the pages that provide their sets onDemand, the OutputItemSet. - [Querverweise] + [Cross-reference] <SfxTabDialog::AddTabPage(sal_uInt16, CreateTabPage, GetTabPageRanges, sal_Bool)> <SfxTabDialog::AddTabPage(sal_uInt16, const String &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> @@ -1595,12 +1558,11 @@ const SfxItemSet* SfxTabDialog::GetOutputItemSet */ ( - sal_uInt16 nId // die Id, unter der die Seite bei AddTabPage() - // hinzugef"ugt wurde. + sal_uInt16 nId // the Id, under which the page was added at AddTabPage(). ) const { Data_Impl* pDataObject = Find( *pImpl->pData, nId ); - DBG_ASSERT( pDataObject, "TabPage nicht gefunden" ); + DBG_ASSERT( pDataObject, "TabPage not found" ); if ( pDataObject ) { @@ -1609,7 +1571,6 @@ const SfxItemSet* SfxTabDialog::GetOutputItemSet if ( pDataObject->bOnDemand ) return &pDataObject->pTabPage->GetItemSet(); - // else return pOutSet; } return NULL; @@ -1629,19 +1590,11 @@ int SfxTabDialog::FillOutputItemSet() // ----------------------------------------------------------------------- -#ifdef WNT -int __cdecl TabDlgCmpUS_Impl( const void* p1, const void* p2 ) -#else -#if defined(OS2) && defined(ICC) -int _Optlink TabDlgCmpUS_Impl( const void* p1, const void* p2 ) -#else -extern "C" int TabDlgCmpUS_Impl( const void* p1, const void* p2 ) -#endif -#endif +extern "C" int SAL_CALL TabDlgCmpUS_Impl( const void* p1, const void* p2 ) -/* [Beschreibung] +/* [Description] - Vergleichsfunktion f"ur qsort + Comparison function for qsort */ { @@ -1652,9 +1605,9 @@ extern "C" int TabDlgCmpUS_Impl( const void* p1, const void* p2 ) void SfxTabDialog::ShowPage( sal_uInt16 nId ) -/* [Beschreibung] +/* [Description] - Es wird die TabPage mit der "ubergebenen Id aktiviert. + The TabPage is activated with the specified Id. */ { @@ -1666,29 +1619,28 @@ void SfxTabDialog::ShowPage( sal_uInt16 nId ) const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool ) -/* [Beschreibung] +/* [Description] + + Makes the set over the range of all pages of the dialogue. Pages have the + static method for querying their range in AddTabPage, ie deliver their + sets onDemand. - Bildet das Set "uber die Ranges aller Seiten des Dialogs. - Die Pages m"ussen die statische Methode f"ur das Erfragen ihrer - Ranges bei AddTabPage angegeben haben, liefern also ihre Sets onDemand. + [Return value] - [Querverweise] + Pointer to a null-terminated array of sal_uInt16. This array belongs to the + dialog and is deleted when the dialogue is destroy. + + [Cross-reference] <SfxTabDialog::AddTabPage(sal_uInt16, CreateTabPage, GetTabPageRanges, sal_Bool)> <SfxTabDialog::AddTabPage(sal_uInt16, const String &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> <SfxTabDialog::AddTabPage(sal_uInt16, const Bitmap &, CreateTabPage, GetTabPageRanges, sal_Bool, sal_uInt16)> - - [R"uckgabewert] - - Pointer auf nullterminiertes Array von USHORTs - Dieses Array geh"ort dem Dialog und wird beim - Zerst"oren des Dialogs gel"oscht. */ { if ( pSet ) { - DBG_ERRORFILE( "Set bereits vorhanden!" ); + DBG_ERRORFILE( "Set already exists!" ); return pSet->GetRanges(); } @@ -1714,7 +1666,7 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool ) } } - //! Doppelte Ids entfernen? + //! Remove duplicated Ids? #ifndef TF_POOLABLE if ( rPool.HasMap() ) #endif @@ -1725,30 +1677,11 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool ) aUS[i] = rPool.GetWhich( aUS[i] ); } - // sortieren + // sort if ( aUS.Count() > 1 ) qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(sal_uInt16), TabDlgCmpUS_Impl ); - // Ranges erzeugen - //!! Auskommentiert, da fehlerhaft - /* - pRanges = new sal_uInt16[aUS.Count() * 2 + 1]; - int j = 0; - i = 0; - - while ( i < aUS.Count() ) - { - pRanges[j++] = aUS[i]; - // aufeinanderfolgende Zahlen - for( ; i < aUS.Count()-1; ++i ) - if ( aUS[i] + 1 != aUS[i+1] ) - break; - pRanges[j++] = aUS[i++]; - } - pRanges[j] = 0; // terminierende NULL - */ - pRanges = new sal_uInt16[aUS.Count() + 1]; memcpy(pRanges, aUS.GetData(), sizeof(sal_uInt16) * aUS.Count()); pRanges[aUS.Count()] = 0; @@ -1759,10 +1692,9 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool ) void SfxTabDialog::SetInputSet( const SfxItemSet* pInSet ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann nachtr"aglich der Input-Set initial oder - neu gesetzt werden. + With this method the Input-Set can subsequently be set initally or re-set. */ { @@ -1801,3 +1733,5 @@ long SfxTabDialog::Notify( NotifyEvent& rNEvt ) } END_NAMESPACE_LAYOUT_SFX_TABDIALOG + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 8974363a02d1..f32025e74414 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -184,8 +185,7 @@ namespace sfx2 aCommandName.append( sImageURL.copy( nCommandImagePrefixLen ) ); const ::rtl::OUString sCommandName( aCommandName.makeStringAndClear() ); - const sal_Bool bHiContrast( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, sal_False, bHiContrast ) ); + const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, sal_False ) ); return aPanelImage.GetXGraphic(); } @@ -1128,7 +1128,7 @@ namespace sfx2 // --------------------------------------------------------------------------------------------------------------------- void TaskPaneController_Impl::Dying() { - OSL_ENSURE( false, "TaskPaneController_Impl::Dying: unexpected call!" ); + OSL_FAIL( "TaskPaneController_Impl::Dying: unexpected call!" ); // We are expected to live longer than the ToolPanelDeck we work with. Since we remove ourself, in our dtor, // as listener from the panel deck, this method here should never be called. } @@ -1297,3 +1297,5 @@ namespace sfx2 //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index d8ea47baf32d..b2aba626123f 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,14 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _MENU_HXX //autogen +#include <boost/scoped_ptr.hpp> + #include <vcl/menu.hxx> -#endif #include <svl/intitem.hxx> #include <svl/stritem.hxx> #include <svl/style.hxx> -#ifndef GCC -#endif #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> @@ -79,6 +78,7 @@ #include <sfx2/viewfrm.hxx> #include <comphelper/configurationhelper.hxx> +#include <comphelper/string.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -86,8 +86,7 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::uno; //========================================================================= - -// Fenster wird ab jetzt dynamisch erstellt. Daher hier R"ander usw. +// Window is now created dynamically. So here margins, etc. #define SFX_TEMPLDLG_HFRAME 3 #define SFX_TEMPLDLG_VTOPFRAME 3 @@ -102,6 +101,13 @@ static sal_uInt16 nLastItemId = USHRT_MAX; // filter box has maximum 12 entries visible #define MAX_FILTER_ENTRIES 12 +// Special constant to save hierarchical mode +// We've to use this hack since this is not the +// index in the filter listbox that is saved but the +// index in the filters list and hierarchical is not +// in it +#define HIERARCHICAL_FILTER_INDEX 0xfffe // 0xffff is reserved + //========================================================================= TYPEINIT0(SfxCommonTemplateDialog_Impl); @@ -112,7 +118,7 @@ SFX_IMPL_DOCKINGWINDOW(SfxTemplateDialogWrapper, SID_STYLE_DESIGNER) //------------------------------------------------------------------------- -// Redirektionsfunktionen +// Re-direct functions SfxTemplateDialog::SfxTemplateDialog ( @@ -121,8 +127,8 @@ SfxTemplateDialog::SfxTemplateDialog Window *pParent ) -/* [Beschreibung] - Gestalterklasse. +/* [Description] + Designer class. */ : SfxDockingWindow( pBind, pCW, pParent, SfxResId(DLG_STYLE_DESIGNER) ), @@ -263,9 +269,6 @@ sal_Int8 DropListBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt ) sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) { -// rEvt.maDropEvent.Context->acceptDrop( DND_ACTION_NONE ); -// rEvt.maDropEvent.Context->dropComplete( sal_True ); - sal_Int8 nRet = DND_ACTION_NONE; SfxObjectShell* pDocShell = pDialog->GetObjectShell(); TransferableDataHelper aHelper( rEvt.maDropEvent.Transferable ); @@ -351,11 +354,10 @@ SfxActionListBox::SfxActionListBox WinBits nWinBits ) -/* [Beschreibung] - - ListBox- Klasse, die im Command-Handler ein PopupMenu (Gestalter - spezifisch) startet. +/* [Description] + ListBox class that starts a PopupMenu (designer specific) in the + command handler. */ : DropListBox_Impl(pParent->GetWindow(), nWinBits, pParent) @@ -377,7 +379,7 @@ SfxActionListBox::SfxActionListBox( SfxCommonTemplateDialog_Impl* pParent, PopupMenu* SfxActionListBox::CreateContextMenu( void ) { - //added by BerryJia for fixing Bug102739 2002-9-9 17:00(Beijing Time) + if( !( GetSelectionCount() > 0 ) ) { pDialog->EnableEdit( sal_False ); @@ -410,11 +412,9 @@ void SfxTemplateDialogWrapper::SetParagraphFamily() SV_DECL_PTRARR_DEL(ExpandedEntries, StringPtr,16,8) SV_IMPL_PTRARR(ExpandedEntries, StringPtr) -/* [Beschreibung] - - TreeListBox- Klasse f"ur die Anzeige der hierarchischen View - der Vorlagen +/* [Description] + TreeListBox class for displaying the hierarchical view of the templates */ class StyleTreeListBox_Impl : public DropListBox_Impl @@ -474,12 +474,10 @@ PopupMenu* StyleTreeListBox_Impl::CreateContextMenu() sal_Bool StyleTreeListBox_Impl::DoubleClickHdl() -/* [Beschreibung] - - - DoubleClick-Handler; ruft entsprechenden Link. - Virtuelle Methode aus SV. +/* [Description] + DoubleClick-Handler; calls the link. + SV virtual method. */ { aDoubleClickLink.Call(this); @@ -490,12 +488,10 @@ sal_Bool StyleTreeListBox_Impl::DoubleClickHdl() void StyleTreeListBox_Impl::Command( const CommandEvent& rCEvt ) -/* [Beschreibung] - - Command Handler; dieser executed ein PopupMenu (Gestalter - spezifisch). - Virtuelle Methode aus SV. +/* [Description] + Command Handler; this executes a PopupMenu (designer-specific) + SV virtual method. */ { SvTreeListBox::Command(rCEvt); @@ -530,12 +526,10 @@ sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, SvLBoxEntry*& rpNewParent, sal_uIntPtr& lPos) -/* [Beschreibung] - - NotifyMoving Handler; dieser leitet per Link das Event an den Dialog - weiter. - Virtuelle Methode aus SV. +/* [Description] + NotifyMoving Handler; This leads via a link on the event to the dialog. + SV virtual method. */ { if(!pTarget || !pEntry) @@ -559,14 +553,13 @@ sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvLBoxEntry* pTarget, long StyleTreeListBox_Impl::ExpandingHdl() -/* [Beschreibung] +/* [Description] - ExpandingHdl Handler; der aktuelle Eintrag wird gemerkt. - Virtuelle Methode aus SV. + ExpandingHdl Handler; the current entry is noticed. + SV virtual method. - [Querverweise] + [Cross-reference] <StyleTreeListBox_Impl::ExpandedHdl()> - */ { pCurEntry = GetCurEntry(); @@ -577,14 +570,13 @@ long StyleTreeListBox_Impl::ExpandingHdl() void StyleTreeListBox_Impl::ExpandedHdl() -/* [Beschreibung] +/* [Description] ExpandedHdl Handler; - Virtuelle Methode aus SV. + SV virtual method. - [Querverweise] + [Cross-reference] <StyleTreeListBox_Impl::ExpandingHdl()> - */ { @@ -602,25 +594,22 @@ StyleTreeListBox_Impl::StyleTreeListBox_Impl( pCurEntry(0), pCommon(pParent) -/* [Beschreibung] - - Konstruktor StyleTreeListBox_Impl +/* [Description] + Constructor StyleTreeListBox_Impl */ { EnableContextMenuHandling(); } //------------------------------------------------------------------------- -//------------------------------------------------------------------------- class StyleTreeArr_Impl; -/* [Beschreibung] - - Interne Struktur f"ur den Aufbau der hierarchischen View +/* [Description] + Internal structure for the establishment of the hierarchical view */ struct StyleTree_Impl @@ -672,7 +661,12 @@ void StyleTree_Impl::Put(StyleTree_Impl* pIns, sal_uIntPtr lPos) StyleTreeArr_Impl &MakeTree_Impl(StyleTreeArr_Impl &rArr) { const sal_uInt16 nCount = rArr.Count(); - // Alle unter ihren Parents einordnen + + comphelper::string::NaturalStringSorter aSorter( + ::comphelper::getProcessComponentContext(), + Application::GetSettings().GetLocale()); + + // Arrange all under their Parents sal_uInt16 i; for(i = 0; i < nCount; ++i) { @@ -684,22 +678,18 @@ StyleTreeArr_Impl &MakeTree_Impl(StyleTreeArr_Impl &rArr) StyleTree_ImplPtr pCmp = rArr[j]; if(pCmp->aName == pEntry->aParent) { - // initial sortiert einfuegen - sal_uInt16 ii; - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator(); - for ( ii = 0; - ii < pCmp->Count() && COMPARE_LESS == - pCollator->compareString( (*pCmp->pChilds)[ii]->aName, - pEntry->aName);++ii) ; - pCmp->Put(pEntry,ii); + // Paste initial filter + sal_uInt16 nPos; + for( nPos = 0 ; nPos < pCmp->Count() && + aSorter.compare((*pCmp->pChilds)[nPos]->aName, pEntry->aName) < 0 ; nPos++) + {}; + pCmp->Put(pEntry,nPos); break; } } } } - // alle, die schon unter ihrem Parent eingeordnet wurden - // entfernen + for(i = 0; i < rArr.Count(); ) { if(rArr[i]->HasParent()) @@ -738,8 +728,7 @@ SvLBoxEntry* FillBox_Impl(SvTreeListBox *pBox, } //------------------------------------------------------------------------- - -// Konstruktor +// Constructor SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, SfxDockingWindow* pW ) : @@ -831,7 +820,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Mod sal_uInt16 SfxCommonTemplateDialog_Impl::StyleNrToInfoOffset(sal_uInt16 nId) { - const SfxStyleFamilyItem *pItem=pStyleFamilies->GetObject(nId); + const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nId ); return SfxFamilyIdToNId(pItem->GetFamily())-1; } @@ -849,21 +838,19 @@ void SfxTemplateDialog_Impl::EnableEdit(sal_Bool bEnable) sal_uInt16 SfxCommonTemplateDialog_Impl::InfoOffsetToStyleNr(sal_uInt16 nId) { - for ( sal_uInt16 i=0;i<pStyleFamilies->Count();i++ ) - if ( SfxFamilyIdToNId(pStyleFamilies->GetObject(i)->GetFamily()) == nId+1 ) + for ( size_t i = 0; i < pStyleFamilies->size(); i++ ) + if ( SfxFamilyIdToNId(pStyleFamilies->at( i )->GetFamily()) == nId+1 ) return i; - DBG_ERROR("Style Nummer nicht gefunden"); + OSL_FAIL("Style Nummer not found"); return 0; } - //------------------------------------------------------------------------- void SfxCommonTemplateDialog_Impl::ReadResource() { - // globale Benutzer-Resource auslesen - sal_uInt16 i; - for(i = 0; i < MAX_FAMILIES; ++i) + // Read global user resource + for(sal_uInt16 i = 0; i < MAX_FAMILIES; ++i) pFamilyState[i] = 0; SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); @@ -882,23 +869,24 @@ void SfxCommonTemplateDialog_Impl::ReadResource() if ( pCurObjShell && 0xFFFF == nActFilter ) nActFilter = pCurObjShell->GetAutoStyleFilterIndex(); - // Einfuegen in die Toolbox - // umgekehrte Reihenfolge, da immer vorne eingefuegt wird. - sal_uInt16 nCount = pStyleFamilies->Count(); + // Paste in the toolbox + // reverse order, since always inserted at the head + size_t nCount = pStyleFamilies->size(); pBindings->ENTERREGISTRATIONS(); + size_t i; for(i = 0; i < nCount; ++i) { sal_uInt16 nSlot = 0; - switch((sal_uInt16)pStyleFamilies->GetObject(i)->GetFamily()) + switch( (sal_uInt16)pStyleFamilies->at( i )->GetFamily() ) { case SFX_STYLE_FAMILY_CHAR: nSlot = SID_STYLE_FAMILY1; break; case SFX_STYLE_FAMILY_PARA: nSlot = SID_STYLE_FAMILY2; break; case SFX_STYLE_FAMILY_FRAME:nSlot = SID_STYLE_FAMILY3; break; case SFX_STYLE_FAMILY_PAGE: nSlot = SID_STYLE_FAMILY4; break; case SFX_STYLE_FAMILY_PSEUDO: nSlot = SID_STYLE_FAMILY5; break; - default: DBG_ERROR("unbekannte StyleFamily"); break; + default: OSL_FAIL("unknown StyleFamily"); break; } pBoundItems[i] = new SfxTemplateControllerItem(nSlot, *this, *pBindings); @@ -926,14 +914,13 @@ void SfxCommonTemplateDialog_Impl::ReadResource() StartListening(*pBindings); -//In umgekehrter Reihenfolge des Auftretens in den Stylefamilies einfuegen. -//Das ist fuer den Toolbar des Gestalters. Die Listbox des Kataloges achtet -//selbst auf korrekte Reihenfolge. +// Insert in the reverse order of occurrence in the Style Families. This is for +// the toolbar of the designer. The list box of the catalog respects the +// correct order by itself. -//Reihenfolgen: Reihenfolge in der Resource = Reihenfolge in Toolbar bzw. -//Listbox. -//Reihenfolge aufsteigender SIDs: Niedrige SIDs werden als erstes angezeigt, -//wenn Vorlagen mehrerer Familien aktiv sind. +// Sequences: the order of Resource = the order of Toolbar for example list box. +// Order of ascending SIDs: Low SIDs are displayed first when templates of +// several families are active. // in the Writer the UpdateStyleByExample Toolbox button is removed and // the NewStyle button gets a PopupMenu @@ -942,7 +929,7 @@ void SfxCommonTemplateDialog_Impl::ReadResource() for( ; nCount--; ) { - const SfxStyleFamilyItem *pItem = pStyleFamilies->GetObject( nCount ); + const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nCount ); sal_uInt16 nId = SfxFamilyIdToNId( pItem->GetFamily() ); InsertFamilyItem( nId, pItem ); } @@ -978,7 +965,7 @@ void SfxCommonTemplateDialog_Impl::ClearResource() void SfxCommonTemplateDialog_Impl::Initialize() { - // globale Benutzer-Resource auslesen + // Read global user resource ReadResource(); pBindings->Invalidate( SID_STYLE_FAMILY ); pBindings->Update( SID_STYLE_FAMILY ); @@ -1052,15 +1039,13 @@ void SfxCommonTemplateDialog_Impl::SetAutomaticFilter() } //------------------------------------------------------------------------- - -// Hilfsfunktion: Zugriff auf aktuelles Family-Item +// Helper function: Access to the current family item const SfxStyleFamilyItem *SfxCommonTemplateDialog_Impl::GetFamilyItem_Impl() const { - const sal_uInt16 nCount = pStyleFamilies->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) + const size_t nCount = pStyleFamilies->size(); + for(size_t i = 0; i < nCount; ++i) { - const SfxStyleFamilyItem *pItem = pStyleFamilies->GetObject(i); -// if(!pItem)continue; + const SfxStyleFamilyItem *pItem = pStyleFamilies->at( i ); sal_uInt16 nId = SfxFamilyIdToNId(pItem->GetFamily()); if(nId == nActFamily) return pItem; @@ -1068,6 +1053,15 @@ const SfxStyleFamilyItem *SfxCommonTemplateDialog_Impl::GetFamilyItem_Impl() con return 0; } +SfxStyleSheetBase *SfxCommonTemplateDialog_Impl::GetSelectedStyle() const +{ + if (!IsInitialized() || !pStyleSheetPool || !HasSelectedStyle()) + return NULL; + const String aTemplName( GetSelectedEntry() ); + const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl(); + return pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL ); +} + //------------------------------------------------------------------------- void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr) @@ -1115,7 +1109,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr) { aFmtLb.MakeVisible( pEntry ); aFmtLb.Select( pEntry ); - bWaterDisabled = !HasSelectedStyle(); //added by BerryJia for fixing Bug76391 2003-1-22 + bWaterDisabled = !HasSelectedStyle(); FmtSelectHdl( NULL ); } } @@ -1170,7 +1164,7 @@ void SfxCommonTemplateDialog_Impl::EnableTreeDrag( sal_Bool bEnable ) void SfxCommonTemplateDialog_Impl::FillTreeBox() { - DBG_ASSERT( pTreeBox, "FillTreeBox() without treebox"); + OSL_ENSURE( pTreeBox, "FillTreeBox() without treebox"); if(pStyleSheetPool && nActFamily != 0xffff) { const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); @@ -1198,8 +1192,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox() const sal_uInt16 nCount = aArr.Count(); for(sal_uInt16 i = 0; i < nCount; ++i) FillBox_Impl(pTreeBox, aArr[i], aEntries); - -// EnableEdit(sal_False); +; EnableItem(SID_STYLE_WATERCAN,sal_False); SfxTemplateItem* pState = pFamilyState[nActFamily-1]; @@ -1216,7 +1209,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox() pTreeBox->SetUpdateMode( sal_True ); String aStyle; - if(pState) //Aktuellen Eintrag selektieren + if(pState) // Select current entry aStyle = pState->GetStyleName(); SelectStyle(aStyle); EnableDelete(); @@ -1233,23 +1226,24 @@ sal_Bool SfxCommonTemplateDialog_Impl::HasSelectedStyle() const //------------------------------------------------------------------------- -// intern: Aktualisierung der Anzeige -void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // Flags, was aktualisiert werden soll (s.o.) +// internal: Refresh the display +// nFlags: what we should update. +void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) { - DBG_ASSERT(nFlags, "nichts zu tun"); + OSL_ENSURE(nFlags, "nothing to do"); const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); if (!pItem) { - // Ist beim Vorlagenkatalog der Fall + // Is the case for the template catalog SfxTemplateItem **ppItem = pFamilyState; - const sal_uInt16 nFamilyCount = pStyleFamilies->Count(); - sal_uInt16 n; - for(n=0;n<nFamilyCount;n++) - if(ppItem[StyleNrToInfoOffset(n)])break; + const size_t nFamilyCount = pStyleFamilies->size(); + size_t n; + for( n = 0; n < nFamilyCount; n++ ) + if( ppItem[ StyleNrToInfoOffset(n) ] ) break; if ( n == nFamilyCount ) - // passiert gelegentlich bei Beichten, Formularen etc.; weiss der Teufel warum + // It happens sometimes, God knows why return; - ppItem+=StyleNrToInfoOffset(n); + ppItem += StyleNrToInfoOffset(n); nAppFilter = (*ppItem)->GetValue(); FamilySelect( StyleNrToInfoOffset(n)+1 ); pItem = GetFamilyItem_Impl(); @@ -1257,29 +1251,29 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // F const SfxStyleFamily eFam = pItem->GetFamily(); - SfxFilterTupel *pT = pItem->GetFilterList().GetObject(nActFilter); - sal_uInt16 nFilter = pT ? pItem->GetFilterList().GetObject(nActFilter)->nFlags : 0; - if(!nFilter) // automatisch + SfxFilterTupel* pT = ( nActFilter < pItem->GetFilterList().size() ? pItem->GetFilterList()[nActFilter] : NULL ); + sal_uInt16 nFilter = pT ? pT->nFlags : 0; + if(!nFilter) // automatic nFilter = nAppFilter; - DBG_ASSERT(pStyleSheetPool, "kein StyleSheetPool"); + OSL_ENSURE(pStyleSheetPool, "no StyleSheetPool"); if(pStyleSheetPool) { pStyleSheetPool->SetSearchMask(eFam, nFilter); pItem = GetFamilyItem_Impl(); - if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY) + if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY) // Update view type list (Hierarchical, All, etc. { - CheckItem(nActFamily, sal_True); // Button in Toolbox checken + CheckItem(nActFamily, sal_True); // check Button in Toolbox aFilterLb.SetUpdateMode(sal_False); aFilterLb.Clear(); //insert hierarchical at the beginning sal_uInt16 nPos = aFilterLb.InsertEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL)), 0); aFilterLb.SetEntryData( nPos, (void*)(sal_uIntPtr)SFXSTYLEBIT_ALL ); const SfxStyleFilter& rFilter = pItem->GetFilterList(); - for(sal_uInt16 i = 0; i < rFilter.Count(); ++i) + for( size_t i = 0; i < rFilter.size(); ++i) { - sal_uIntPtr nFilterFlags = rFilter.GetObject(i)->nFlags; - nPos = aFilterLb.InsertEntry( rFilter.GetObject(i)->aName ); + sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags; + nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName ); aFilterLb.SetEntryData( nPos, (void*)nFilterFlags ); } if(nActFilter < aFilterLb.GetEntryCount() - 1) @@ -1288,12 +1282,12 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // F { nActFilter = 0; aFilterLb.SelectEntryPos(1); - SfxFilterTupel *pActT = rFilter.GetObject(nActFilter); - sal_uInt16 nFilterFlags = pActT ? rFilter.GetObject(nActFilter)->nFlags : 0; + SfxFilterTupel* pActT = ( nActFilter < rFilter.size() ) ? rFilter[ nActFilter ] : NULL; + sal_uInt16 nFilterFlags = pActT ? pActT->nFlags : 0; pStyleSheetPool->SetSearchMask(eFam, nFilterFlags); } - //Falls in Treedarstellung wieder Family Hierarchie selektieren + // if the tree view again, select family hierarchy if(pTreeBox) aFilterLb.SelectEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL))); @@ -1314,27 +1308,24 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // F if(nFlags & UPDATE_FAMILY_LIST) { -// EnableEdit(sal_False); EnableItem(SID_STYLE_WATERCAN,sal_False); SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); SvLBoxEntry* pEntry = aFmtLb.First(); SvStringsDtor aStrings; + comphelper::string::NaturalStringSorter aSorter( + ::comphelper::getProcessComponentContext(), + Application::GetSettings().GetLocale()); + while( pStyle ) { //Bubblesort - for( sal_uInt16 nPos = aStrings.Count() + 1 ; nPos-- ;) - { - if( !nPos || *aStrings[nPos-1] < pStyle->GetName() ) - { - // Die Namen stehen in den Styles, also nicht kopieren - // Reingefallen!: Writer hat insgesamt nur 1 Style - aStrings.Insert( - new String( pStyle->GetName() ), nPos ); - break; - } - } + sal_uInt16 nPos; + for( nPos = aStrings.Count() ; nPos && + aSorter.compare(*(aStrings[nPos-1]), pStyle->GetName()) > 0 ; nPos--) + {}; + aStrings.Insert( new String( pStyle->GetName() ), nPos ); pStyle = pStyleSheetPool->Next(); } @@ -1350,19 +1341,19 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // F if( nPos < nCount || pEntry ) { - // Box mit den Vorlagen fuellen + // Fills the display box aFmtLb.SetUpdateMode(sal_False); aFmtLb.Clear(); - nPos = 0; - while( nPos < nCount ) - aFmtLb.InsertEntry( *aStrings.GetObject( nPos++ )); - aFmtLb.SetUpdateMode(sal_True); + for(nPos = 0 ; nPos < nCount ; ++nPos ) + aFmtLb.InsertEntry( *aStrings.GetObject( nPos ), 0, sal_False, nPos); + + aFmtLb.SetUpdateMode(true); } - // aktuelle Vorlage anzeigen + // Selects the current style if any SfxTemplateItem *pState = pFamilyState[nActFamily-1]; String aStyle; - if(pState) //Aktuellen Eintrag selektieren + if(pState) aStyle = pState->GetStyleName(); SelectStyle(aStyle); EnableDelete(); @@ -1372,12 +1363,11 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) // F //------------------------------------------------------------------------- -// Aktualisierung Anzeige: Gie\skanne an/aus +// Updated display: Watering the house void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem) { -// EnableItem(SID_STYLE_WATERCAN, pItem != 0); bWaterDisabled = pItem == 0; -//added by BerryJia for fixing Bug76391 2003-1-7 + if(!bWaterDisabled) bWaterDisabled = !HasSelectedStyle(); @@ -1392,11 +1382,11 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem) else EnableItem(SID_STYLE_WATERCAN, sal_False); -//Waehrend Giesskannenmodus Statusupdates ignorieren. +// Ignore while in watercan mode statusupdates - sal_uInt16 nCount=pStyleFamilies->Count(); + size_t nCount = pStyleFamilies->size(); pBindings->EnterRegistrations(); - for(sal_uInt16 n=0; n<nCount; n++) + for(size_t n = 0; n < nCount; n++) { SfxControllerItem *pCItem=pBoundItems[n]; sal_Bool bChecked = pItem && pItem->GetValue(); @@ -1413,9 +1403,9 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem) //------------------------------------------------------------------------- -// Item mit dem Status einer Family wird kopiert und gemerkt -// (Aktualisierung erfolgt, wenn alle Stati aktualisiert worden sind. -// Siehe auch: <SfxBindings::AddDoneHdl(const Link &)> +// Item with the status of a Family is copied and noted +// (is updated when all states have also been updated.) +// See also: <SfxBindings::AddDoneHdl(const Link &)> void SfxCommonTemplateDialog_Impl::SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* pItem ) { @@ -1425,14 +1415,13 @@ void SfxCommonTemplateDialog_Impl::SetFamilyState( sal_uInt16 nSlotId, const Sfx pFamilyState[nIdx] = new SfxTemplateItem(*pItem); bUpdate = sal_True; - // Wenn verwendete Vorlagen ( wie zum Teufel findet man das heraus ?? ) + // If used templates (how the hell you find this out??) bUpdateFamily = sal_True; } //------------------------------------------------------------------------- - -// Benachrichtigung durch SfxBindings, da"s die Aktualisierung -// beendet ist. St"o\st die Aktualisierung der Anzeige an. +// Notice from SfxBindings that the update is completed. Pushes out the update +// of the display. void SfxCommonTemplateDialog_Impl::Update_Impl() { @@ -1463,7 +1452,6 @@ void SfxCommonTemplateDialog_Impl::Update_Impl() pStyleSheetPool = pNewPool; bDocChanged=sal_True; } -// InvalidateBindings(); } if (bUpdateFamily) @@ -1474,20 +1462,19 @@ void SfxCommonTemplateDialog_Impl::Update_Impl() if(pFamilyState[i]) break; if(i == MAX_FAMILIES || !pNewPool) - // nichts erlaubt + // nothing is allowed return; SfxTemplateItem *pItem = 0; - // aktueller Bereich nicht innerhalb der erlaubten Bereiche - // oder Default + // current region not within the allowed region or default if(nActFamily == 0xffff || 0 == (pItem = pFamilyState[nActFamily-1] ) ) { CheckItem(nActFamily, sal_False); SfxTemplateItem **ppItem = pFamilyState; - const sal_uInt16 nFamilyCount = pStyleFamilies->Count(); - sal_uInt16 n; - for(n=0;n<nFamilyCount;n++) - if(ppItem[StyleNrToInfoOffset(n)])break; + const size_t nFamilyCount = pStyleFamilies->size(); + size_t n; + for( n = 0; n < nFamilyCount; n++ ) + if( ppItem[ StyleNrToInfoOffset(n) ] ) break; ppItem+=StyleNrToInfoOffset(n); nAppFilter = (*ppItem)->GetValue(); @@ -1497,7 +1484,7 @@ void SfxCommonTemplateDialog_Impl::Update_Impl() } else if( bDocChanged ) { - // andere DocShell -> alles neu + // other DocShell -> all new CheckItem( nActFamily, sal_True ); nActFilter = static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pDocShell ) ); if ( 0xFFFF == nActFilter ) @@ -1513,14 +1500,10 @@ void SfxCommonTemplateDialog_Impl::Update_Impl() } else { - // anderer Filter fuer automatisch + // other filters for automatic CheckItem( nActFamily, sal_True ); const SfxStyleFamilyItem *pStyleItem = GetFamilyItem_Impl(); -#if OSL_DEBUG_LEVEL > 1 - SfxFilterTupel *pT; - pT = pStyleItem->GetFilterList().GetObject(nActFilter); -#endif - if(0 == pStyleItem->GetFilterList().GetObject(nActFilter)->nFlags + if ( 0 == pStyleItem->GetFilterList()[ nActFilter ]->nFlags && nAppFilter != pItem->GetValue()) { nAppFilter = pItem->GetValue(); @@ -1571,7 +1554,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, TimeOut, Timer *, pTim ) //------------------------------------------------------------------------- void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - // Aktualisierung anstossen + // tap update if(rHint.Type() == TYPE(SfxSimpleHint)) { switch(((SfxSimpleHint&) rHint ).GetId()) @@ -1616,10 +1599,10 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint } break; } - // noetig, wenn zwichen Dokumenten umgeschaltet wird, - // aber in beiden Dokumenten die gleiche Vorlage gilt. - // Nicht sofort Update_Impl rufen, fuer den Fall da\s eines - // der Dokumente ein internes InPlaceObjekt ist! + + // Necessary if switching between documents and in both documents + // the same template is used. Do not immediately call Update_Impl, + // for the case that one of the documents is an internal InPlaceObjekt! case SFX_HINT_DOCCHANGED: bUpdate = sal_True; break; @@ -1632,9 +1615,9 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint } } - // Timer nicht aufsetzen, wenn der StyleSheetPool in die Kiste geht, denn - // es kann sein, da\s sich ein neuer erst anmeldet, nachdem der Timer - // abgelaufen ist - macht sich schlecht in UpdateStyles_Impl() ! + // Do not set timer when the stylesheet pool is in the box, because it is + // possible that a new one is registered after the timer is up - + // works bad in UpdateStyles_Impl ()! sal_uIntPtr nId = rHint.ISA(SfxSimpleHint) ? ( (SfxSimpleHint&)rHint ).GetId() : 0; @@ -1657,12 +1640,12 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint //------------------------------------------------------------------------- -// Anderer Filter; kann durch den Benutzer umgeschaltet werden -// oder als Folge von Neu oder Bearbeiten, wenn die aktuelle -// Vorlage einem anderen Filter zugewiesen wurde. +// Other filters; can be switched by the users or as a result of new or +// editing, if the current document has been assigned a different filter. void SfxCommonTemplateDialog_Impl::FilterSelect( - sal_uInt16 nEntry, // Idx des neuen Filters - sal_Bool bForce ) // Aktualisierung erzwingen, auch wenn der neue Filter gleich dem aktuellen ist + sal_uInt16 nEntry, // Idx of the new Filters + sal_Bool bForce ) // Force update, even if the new filter is + // equal to the current { if( nEntry != nActFilter || bForce ) { @@ -1691,7 +1674,7 @@ void SfxCommonTemplateDialog_Impl::FilterSelect( //------------------------------------------------------------------------- -// Intern: Ausf"uhren von Funktionen "uber den Dispatcher +// Internal: Perform functions through the Dispatcher sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl( sal_uInt16 nId, const String &rStr, const String& rRefStr, sal_uInt16 nFamily, sal_uInt16 nMask, sal_uInt16 *pIdx, const sal_uInt16* pModifier) @@ -1711,7 +1694,7 @@ sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl( pItems[ nCount++ ] = &aMask; if(SID_STYLE_UPDATE_BY_EXAMPLE == nId) { - //Sonderloesung fuer Numerierungsupdate im Writer + // Special solution for Numbering update in Writer const String aTemplName(GetSelectedEntry()); aUpdName.SetValue(aTemplName); pItems[ nCount++ ] = &aUpdName; @@ -1735,17 +1718,16 @@ sal_Bool SfxCommonTemplateDialog_Impl::Execute_Impl( if ( nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId ) { SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem); - DBG_ASSERT(pFilterItem, "SfxUINT16Item erwartet"); + OSL_ENSURE(pFilterItem, "SfxUINT16Item expected"); sal_uInt16 nFilterFlags = pFilterItem->GetValue() & ~SFXSTYLEBIT_USERDEF; - if(!nFilterFlags) // Benutzervorlage? + if(!nFilterFlags) // User Template? nFilterFlags = pFilterItem->GetValue(); const SfxStyleFamilyItem *pFamilyItem = GetFamilyItem_Impl(); - const sal_uInt16 nFilterCount = (sal_uInt16) pFamilyItem->GetFilterList().Count(); + const size_t nFilterCount = pFamilyItem->GetFilterList().size(); - for ( sal_uInt16 i = 0; i < nFilterCount; ++i ) + for ( size_t i = 0; i < nFilterCount; ++i ) { - const SfxFilterTupel *pTupel = - pFamilyItem->GetFilterList().GetObject(i); + const SfxFilterTupel *pTupel = pFamilyItem->GetFilterList()[ i ]; if ( ( pTupel->nFlags & nFilterFlags ) == nFilterFlags && pIdx ) *pIdx = i; @@ -1768,11 +1750,10 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) { if ( !bHierarchical ) { - // TreeView einschalten + // Turn on treeView bHierarchical=sal_True; const String aSelectEntry( GetSelectedEntry()); aFmtLb.Hide(); - // aFilterLb.Disable(); pTreeBox = new StyleTreeListBox_Impl( this, WB_HASBUTTONS | WB_HASLINES | @@ -1790,7 +1771,10 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) ((StyleTreeListBox_Impl*)pTreeBox)-> SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl, DropHdl)); pTreeBox->SetIndent(10); - + SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + SfxObjectShell *pDocShell = pViewFrame->GetObjectShell(); + if (pDocShell) + SaveFactoryStyleFilter( pDocShell, HIERARCHICAL_FILTER_INDEX ); FillTreeBox(); SelectStyle(aSelectEntry); pTreeBox->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST)); @@ -1802,12 +1786,10 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) { DELETEZ(pTreeBox); aFmtLb.Show(); - // aFilterLb.Enable(); - // Falls bHierarchical, kann sich die Familie geaendert haben + // If bHierarchical, then the family can have changed // minus one since hierarchical is inserted at the start FilterSelect(pBox->GetSelectEntryPos() - 1, bHierarchical ); bHierarchical=sal_False; -// UpdateStyles_Impl(UPDATE_FAMILY_LIST); // Anzeige aktualisieren } return 0; @@ -1815,7 +1797,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) //------------------------------------------------------------------------- -// Select-Handler der Toolbox +// Select-Handler for the Toolbox void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry) { if( nEntry != nActFamily ) @@ -1843,7 +1825,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) const sal_Bool bState = IsCheckedItem(nEntry); sal_Bool bCheck; SfxBoolItem aBool; - // wenn eine Vorlage ausgewaehlt ist. + // when a template is chosen. if(!bState && aFmtLb.GetSelectionCount()) { const String aTemplName( @@ -1868,13 +1850,11 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) if(pStyleSheetPool && nActFamily != 0xffff) { const SfxStyleFamily eFam=GetFamilyItem_Impl()->GetFamily(); -//pStyleSheetPool->GetSearchFamily(); const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); sal_uInt16 nFilter; - if(pItem&&nActFilter!=0xffff) + if( pItem && nActFilter != 0xffff ) { - nFilter = pItem->GetFilterList().GetObject( - nActFilter)->nFlags; + nFilter = pItem->GetFilterList()[ nActFilter ]->nFlags; if(!nFilter) // automatisch nFilter = nAppFilter; } @@ -1882,9 +1862,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) nFilter=pStyleSheetPool->GetSearchMask(); pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF ); - SfxNewStyleDlg *pDlg = + SfxNewStyleDlg *pDlg = new SfxNewStyleDlg(pWindow, *pStyleSheetPool); // why? : FloatingWindow must not be parent of a modal dialog - new SfxNewStyleDlg(pWindow, *pStyleSheetPool); if(RET_OK == pDlg->Execute()) { pStyleSheetPool->SetSearchMask(eFam, nFilter); @@ -1909,7 +1888,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) case SID_TEMPLATE_LOAD: SFX_APP()->GetDispatcher_Impl()->Execute(nEntry); break; - default: DBG_ERROR("not implemented"); break; + default: OSL_FAIL("not implemented"); break; } } @@ -1917,8 +1896,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) static rtl::OUString getModuleIdentifier( const Reference< XModuleManager >& i_xModMgr, SfxObjectShell* i_pObjSh ) { - DBG_ASSERT( i_xModMgr.is(), "getModuleIdentifier(): no XModuleManager" ); - DBG_ASSERT( i_pObjSh, "getModuleIdentifier(): no ObjectShell" ); + OSL_ENSURE( i_xModMgr.is(), "getModuleIdentifier(): no XModuleManager" ); + OSL_ENSURE( i_pObjSh, "getModuleIdentifier(): no ObjectShell" ); ::rtl::OUString sIdentifier; @@ -1928,11 +1907,11 @@ static rtl::OUString getModuleIdentifier( const Reference< XModuleManager >& i_x } catch ( ::com::sun::star::frame::UnknownModuleException& ) { - DBG_WARNING( "getModuleIdentifier(): unknown module" ); + OSL_TRACE( "getModuleIdentifier(): unknown module" ); } catch ( Exception& ) { - DBG_ERRORFILE( "getModuleIdentifier(): exception of XModuleManager::identify()" ); + OSL_FAIL( "getModuleIdentifier(): exception of XModuleManager::identify()" ); } return sIdentifier; @@ -1942,7 +1921,7 @@ static rtl::OUString getModuleIdentifier( const Reference< XModuleManager >& i_x sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell* i_pObjSh ) { - DBG_ASSERT( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); + OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); sal_Int32 nFilter = -1; Sequence< PropertyValue > lProps; @@ -1962,7 +1941,7 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell* void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter ) { - DBG_ASSERT( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); + OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); Reference< ::com::sun::star::container::XNameReplace > xContainer( xModuleManager, UNO_QUERY ); if ( xContainer.is() ) { @@ -1987,7 +1966,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox //------------------------------------------------------------------------- -// Handler des Neu-Buttons +// Handler for the New-Buttons void SfxCommonTemplateDialog_Impl::NewHdl(void *) { String aEmpty; @@ -2003,11 +1982,10 @@ void SfxCommonTemplateDialog_Impl::NewHdl(void *) const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); const SfxStyleFamily eFam=pItem->GetFamily(); sal_uInt16 nMask; - if(pItem&&nActFilter!=0xffff) + if( pItem && nActFilter != 0xffff ) { - nMask = pItem->GetFilterList().GetObject( - nActFilter)->nFlags; - if(!nMask) // automatisch + nMask = pItem->GetFilterList()[ nActFilter ]->nFlags; + if(!nMask) // automatic nMask = nAppFilter; } else @@ -2021,46 +1999,21 @@ void SfxCommonTemplateDialog_Impl::NewHdl(void *) nMask); Application::SetDefDialogParent( pTmp ); - -/* { - DBG_ASSERT(nFilter < aFilterLb.GetEntryCount(), - "Filter ueberindiziert"); - - if(!pTreeBox) - { -// aFilterLb.SelectEntryPos(nFilter); - FilterSelect(nActFilter, sal_True); - } - else - { - FillTreeBox(); - SfxTemplateItem *pState = pFamilyState[nActFamily-1]; - if(pState) - { - const String aStyle(pState->GetStyleName()); - SelectStyle(aStyle); - } - EnableDelete(); - }*/ -// } } } //------------------------------------------------------------------------- -// Handler des Bearbeiten-Buttons +// Handler for the edit-Buttons void SfxCommonTemplateDialog_Impl::EditHdl(void *) { if(IsInitialized() && HasSelectedStyle()) { sal_uInt16 nFilter = nActFilter; String aTemplName(GetSelectedEntry()); - const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); - const SfxStyleFamily eFam = pItem->GetFamily(); - pStyleSheetPool->Find(aTemplName,eFam,SFXSTYLEBIT_ALL); // -Wall required?? + GetSelectedStyle(); // -Wall required?? Window* pTmp; - //DefModalDialogParent setzen fuer - //Modalitaet der nachfolgenden Dialoge + //DefModalDialogParent set for modality of the following dialogs pTmp = Application::GetDefDialogParent(); if ( ISA(SfxTemplateDialog_Impl) ) Application::SetDefDialogParent( pWindow->GetParent() ); @@ -2069,16 +2022,6 @@ void SfxCommonTemplateDialog_Impl::EditHdl(void *) if ( Execute_Impl( SID_STYLE_EDIT, aTemplName, String(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily(), 0, &nFilter ) ) { -// DBG_ASSERT(nFilter < aFilterLb.GetEntryCount(), "Filter ueberindiziert"); -// aTemplName = pStyle->GetName(); -// kann durch Bearbeiten umbenannt worden sein -/* if(!pTreeBox) - { - // aFilterLb.SelectEntryPos(nFilter); - // FilterSelect(nFilter, sal_True); - } - else - FillTreeBox();*/ } Application::SetDefDialogParent( pTmp ); } @@ -2086,15 +2029,13 @@ void SfxCommonTemplateDialog_Impl::EditHdl(void *) //------------------------------------------------------------------------- -// Handler des L"oschen-Buttons +// Handler for the Delete-Buttons void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) { if ( IsInitialized() && HasSelectedStyle() ) { const String aTemplName( GetSelectedEntry() ); - const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl(); - SfxStyleSheetBase* pStyle = - pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL ); + SfxStyleSheetBase* pStyle = GetSelectedStyle(); if ( pStyle ) { String aMsg; @@ -2111,7 +2052,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *) { PrepareDeleteAction(); - if ( pTreeBox ) // Damit die Treelistbox beim L"oschen nicht zuklappt + if ( pTreeBox ) // To prevent the Treelistbox to shut down while + // deleting. { bDontUpdate = sal_True; } @@ -2134,19 +2076,19 @@ void SfxCommonTemplateDialog_Impl::EnableDelete() { if(IsInitialized() && HasSelectedStyle()) { - DBG_ASSERT(pStyleSheetPool, "Kein StyleSheetPool"); + OSL_ENSURE(pStyleSheetPool, "No StyleSheetPool"); const String aTemplName(GetSelectedEntry()); const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); const SfxStyleFamily eFam = pItem->GetFamily(); sal_uInt16 nFilter = 0; - if(pItem->GetFilterList().Count() > nActFilter) - nFilter = pItem->GetFilterList().GetObject(nActFilter)->nFlags; - if(!nFilter) // automatisch + if(pItem->GetFilterList().size() > nActFilter) + nFilter = pItem->GetFilterList()[ nActFilter ]->nFlags; + if(!nFilter) // automatic nFilter = nAppFilter; const SfxStyleSheetBase *pStyle = - pStyleSheetPool->Find(aTemplName,eFam, - pTreeBox? SFXSTYLEBIT_ALL: nFilter); - DBG_ASSERT(pStyle, "Style nicht gefunden"); + pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL: nFilter); + + OSL_ENSURE(pStyle, "Style ot found"); if(pStyle && pStyle->IsUserDefined()) { EnableDel(sal_True); @@ -2160,14 +2102,10 @@ void SfxCommonTemplateDialog_Impl::EnableDelete() { EnableDel(sal_False); } -// rBindings.Invalidate( SID_STYLE_DELETE ); -// rBindings.Update( SID_STYLE_DELETE ); } //------------------------------------------------------------------------- - -// nach Selektion eines Eintrags den Focus gfs. wieder auf das App-Fenster -// setzen +// After selecting a focused item if possible again on the app window void SfxCommonTemplateDialog_Impl::ResetFocus() { if(ISA(SfxTemplateDialog_Impl)) @@ -2182,11 +2120,11 @@ void SfxCommonTemplateDialog_Impl::ResetFocus() //------------------------------------------------------------------------- -// Doppelclick auf ein StyleSheet in der ListBox, wird angewendet. +// Doppelclick on a style sheet in the ListBox is applied. IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl ) { (void)pControl; //unused - // nur, wenn dieser Bereich erlaubt ist + // only if that region is allowed if ( IsInitialized() && 0 != pFamilyState[nActFamily-1] && GetSelectedEntry().Len() ) { @@ -2204,16 +2142,16 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl ) //------------------------------------------------------------------------- -// Selektion einer Vorlage w"ahrend des Watercan-Status +// Selection of a template during the Watercan-Status IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox ) { - // HilfePI antriggern, wenn von Call als Handler und Bereich erlaubt ist + // Trigger Help PI, if this is permitted of call handlers and field if( !pListBox || pListBox->IsSelected( pListBox->GetHdlEntry() ) ) { - // nur, wenn Giesskanne an ist + // Only when the watercan is on if ( IsInitialized() && IsCheckedItem(SID_STYLE_WATERCAN) && - // nur, wenn dieser Bereich erlaubt ist + // only if that region is allowed 0 != pFamilyState[nActFamily-1] ) { String aEmpty; @@ -2223,7 +2161,6 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox GetSelectedEntry(), aEmpty, ( sal_uInt16 )GetFamilyItem_Impl()->GetFamily()); } -// EnableEdit(sal_True); EnableItem(SID_STYLE_WATERCAN, !bWaterDisabled); EnableDelete(); } @@ -2259,7 +2196,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, MenuSelectHdl, Menu *, pMenu ) void SfxCommonTemplateDialog_Impl::ExecuteContextMenu_Impl( const Point& rPos, Window* pWin ) { // Bug# 94152: This part should never be called, because before this happens, the TreeListBox should captured this! - DBG_ASSERT( sal_False, "+SfxCommonTemplateDialog_Impl::ExecuteContextMenu_Impl(): How could this happen? Please infirm developer ASAP!" ); + OSL_FAIL( "+SfxCommonTemplateDialog_Impl::ExecuteContextMenu_Impl(): How could this happen? Please infirm developer ASAP!" ); PopupMenu* pMenu = CreateContextMenu(); pMenu->Execute( pWin, rPos ); @@ -2325,6 +2262,9 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( { pDlgWindow->FreeResource(); + SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + pCurObjShell = pViewFrame->GetObjectShell(); + sal_uInt16 nSavedFilter = static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) ); Initialize(); m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect)); @@ -2336,6 +2276,12 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( aFont.SetWeight( WEIGHT_NORMAL ); aFilterLb.SetFont( aFont ); m_aActionTbL.SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT ); + if( nSavedFilter == HIERARCHICAL_FILTER_INDEX ) + { + bHierarchical = sal_False; // Force content refresh + aFilterLb.SelectEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL))); + FilterSelectHdl(&aFilterLb); + } } // ------------------------------------------------------------------------ @@ -2346,6 +2292,7 @@ void SfxTemplateDialog_Impl::EnableFamilyItem( sal_uInt16 nId, sal_Bool bEnable } //------------------------------------------------------------------------- +// Insert element into dropdown filter "Frame Styles", "List Styles", etc. void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamilyItem *pItem) { @@ -2357,7 +2304,7 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil case SFX_STYLE_FAMILY_FRAME: sHelpId = ".uno:FrameStyle"; break; case SFX_STYLE_FAMILY_PAGE: sHelpId = ".uno:PageStyle"; break; case SFX_STYLE_FAMILY_PSEUDO: sHelpId = ".uno:ListStyle"; break; - default: DBG_ERROR("unknown StyleFamily"); break; + default: OSL_FAIL("unknown StyleFamily"); break; } m_aActionTbL.InsertItem( nId, pItem->GetImage(), pItem->GetText(), 0, 0); m_aActionTbL.SetHelpId( nId, sHelpId ); @@ -2380,14 +2327,13 @@ void SfxTemplateDialog_Impl::updateFamilyImages() return; // let the families collection update the images - sal_Bool bIsHighContrast = m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode(); - pStyleFamilies->updateImages( *m_pStyleFamiliesId, bIsHighContrast ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ); + pStyleFamilies->updateImages( *m_pStyleFamiliesId ); // and set the new images on our toolbox - sal_uInt16 nLoop = pStyleFamilies->Count(); + size_t nLoop = pStyleFamilies->size(); for( ; nLoop--; ) { - const SfxStyleFamilyItem *pItem = pStyleFamilies->GetObject( nLoop ); + const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop ); sal_uInt16 nId = SfxFamilyIdToNId( pItem->GetFamily() ); m_aActionTbL.SetItemImage( nId, pItem->GetImage() ); } @@ -2396,9 +2342,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages() // ------------------------------------------------------------------------ void SfxTemplateDialog_Impl::updateNonFamilyImages() { - m_aActionTbR.SetImageList( ImageList( SfxResId( - m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_LST_STYLE_DESIGNER_HC - : DLG_STYLE_DESIGNER ) ) ); + m_aActionTbR.SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) ); } // ------------------------------------------------------------------------ @@ -2428,14 +2372,6 @@ void SfxCommonTemplateDialog_Impl::InvalidateBindings() SfxTemplateDialog_Impl::~SfxTemplateDialog_Impl() { -/* - SfxImageManager* pImgMgr = pBindings->GetImageManager(); - if ( pImgMgr ) - { - pImgMgr->ReleaseToolBox( &m_aActionTbL ); - pImgMgr->ReleaseToolBox( &m_aActionTbR ); - } -*/ } //------------------------------------------------------------------------- @@ -2448,17 +2384,13 @@ void SfxTemplateDialog_Impl::LoadedFamilies() //------------------------------------------------------------------------- -// "Uberladener Resize-Handler ( StarView ) -// Die Groesse der Listboxen wird angepasst +// Overloaded Resize-Handler ( StarView ) +// The size of the Listboxen is adjusted void SfxTemplateDialog_Impl::Resize() { FloatingWindow *pF = m_pFloat->GetFloatingWindow(); if ( pF ) { -// if(pF->IsZoomedIn() && m_bZoomIn==sal_False) -// pF->SetText(String(SfxResId( DLG_STYLE_DESIGNER ))); -// if(!pF->IsZoomedIn() && m_bZoomIn==sal_True && GetFamilyItem_Impl()) -// UpdateStyles_Impl(UPDATE_FAMILY); //Bereich wieder in Titel schreiben m_bZoomIn = pF->IsRollUp(); if ( m_bZoomIn ) return; @@ -2475,8 +2407,8 @@ void SfxTemplateDialog_Impl::Resize() m_aActionTbL.SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)), m_pFloat->LogicToPixel(aSizeATL)); - // Die Position der rechten Toolbox nur ver"andern, wenn das Fenster - // breit genug ist + // only change the position of the right toolbox, when the window is wide + // enough Point aPosATR(aDlgSize.Width()-SFX_TEMPLDLG_HFRAME-aSizeATR.Width(),SFX_TEMPLDLG_VTOPFRAME); if(aDlgSize.Width() >= aMinSize.Width()) m_aActionTbR.SetPosPixel(m_pFloat->LogicToPixel(aPosATR)); @@ -2503,8 +2435,7 @@ void SfxTemplateDialog_Impl::Resize() SFX_TEMPLDLG_VTOPFRAME - 2*SFX_TEMPLDLG_MIDVSPACE- nListHeight-aSizeATL.Height())) ); - // Die Position der Listboxen nur ver"andern, wenn das Fenster - // hoch genug ist + // only change the position of the listbox, when the window is high enough if(aDlgSize.Height() >= aMinSize.Height()) { aFilterLb.SetPosPixel(aFilterPos); @@ -2609,7 +2540,7 @@ IMPL_LINK_INLINE_END( SfxTemplateDialog_Impl, ToolBoxLSelect, ToolBox *, pBox ) { for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - if ( aPropSeq[i].Name.equalsAscii( "Label" )) + if ( aPropSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Label" ) )) { aPropSeq[i].Value >>= sRet; break; @@ -2636,15 +2567,15 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox ) TIB_DROPDOWN == (pBox->GetItemBits(nEntry)&TIB_DROPDOWN)) { //create a popup menu in Writer - PopupMenu *pMenu = new PopupMenu; + boost::scoped_ptr<PopupMenu> pMenu(new PopupMenu); uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()-> - createInstance( ::rtl::OUString::createFromAscii( - "com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.UICommandDescription")) ), uno::UNO_QUERY ); uno::Reference< container::XNameAccess > xUICommands; if ( xNameAccess.is() ) { - rtl::OUString sTextDoc = ::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument"); + rtl::OUString sTextDoc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument")); if(xNameAccess->hasByName(sTextDoc)) { uno::Any a = xNameAccess->getByName( sTextDoc ); @@ -2656,18 +2587,18 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox ) try { uno::Sequence< beans::PropertyValue > aPropSeq; - uno::Any aCommand = xUICommands->getByName(::rtl::OUString::createFromAscii(".uno:StyleNewByExample")); + uno::Any aCommand = xUICommands->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:StyleNewByExample"))); ::rtl::OUString sLabel = lcl_GetLabel( aCommand ); pMenu->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel ); pMenu->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE); - aCommand = xUICommands->getByName(::rtl::OUString::createFromAscii(".uno:StyleUpdateByExample")); + aCommand = xUICommands->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:StyleUpdateByExample"))); sLabel = lcl_GetLabel( aCommand ); pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel ); pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE); - aCommand = xUICommands->getByName(::rtl::OUString::createFromAscii(".uno:LoadStyles")); + aCommand = xUICommands->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LoadStyles"))); sLabel = lcl_GetLabel( aCommand ); pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel ); pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles"); @@ -2681,7 +2612,6 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox ) catch(uno::Exception&) { } - delete pMenu; pBox->Invalidate(); } return 0; @@ -2848,13 +2778,6 @@ void SfxTemplateCatalog_Impl::EnableItem( sal_uInt16 nMesId, sal_Bool bCheck ) aOkBtn.Enable( bCheck ); if ( nMesId > SFX_STYLE_FAMILY_PSEUDO || nMesId < SFX_STYLE_FAMILY_CHAR ) return; - -/* for(sal_uInt16 i=0;i<aFamIds.Count&&aFamIds[i]!=nMesId;i++); - if(i!=aFamIds.Count()) - aFamList.SelectEntry(aFamIds[i]); - else - DBG_ERROR("Entry nicht gefunden");*/ - } //------------------------------------------------------------------------- @@ -2881,9 +2804,8 @@ sal_Bool SfxTemplateCatalog_Impl::IsCheckedItem(sal_uInt16 nMesId) } //------------------------------------------------------------------------- - -// Der Katalog muss nur das Disablen beherrschen, da waehrend seiner -// Lebenszeit keine Selektionsaenderungen vorgenommen werden koennen +// The list has only to master the disabling, since during his life time no +// changes in selection can be made, void SfxTemplateCatalog_Impl::EnableFamilyItem( sal_uInt16 nId, sal_Bool bEnable ) { if ( !bEnable ) @@ -2965,7 +2887,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl() InvalidateBindings(); if ( IsCheckedItem( SID_STYLE_WATERCAN ) && - // nur, wenn dieser Bereich erlaubt ist + // only if that area is allowed 0 != pFamilyState[ nActFamily - 1 ] ) Execute_Impl( SID_STYLE_APPLY, GetSelectedEntry(), String(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() ); @@ -2994,24 +2916,17 @@ void SfxTemplateDialog::StateChanged( StateChangedType nStateChange ) SfxDockingWindow::StateChanged( nStateChange ); } -/*-- 10.12.2003 11:44:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ DropToolBox_Impl::DropToolBox_Impl(Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog) : ToolBox(pParent), DropTargetHelper(this), rParent(*pTemplateDialog) { } -/*-- 10.12.2003 11:44:35--------------------------------------------------- - -----------------------------------------------------------------------*/ DropToolBox_Impl::~DropToolBox_Impl() { } -/*-- 10.12.2003 11:44:35--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt ) { sal_Int8 nReturn = DND_ACTION_NONE; @@ -3031,11 +2946,10 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt ) } return nReturn; } -/*-- 10.12.2003 11:44:35--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Int8 DropToolBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) { return rParent.aFmtLb.ExecuteDrop(rEvt); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/templdlg.hrc b/sfx2/source/dialog/templdlg.hrc index e39108ce57a9..1a22fb2d50fc 100644..100755 --- a/sfx2/source/dialog/templdlg.hrc +++ b/sfx2/source/dialog/templdlg.hrc @@ -48,8 +48,3 @@ #define BT_FLIST 8 #define BT_VLIST 9 #define BT_TOOL 10 - -//IAccessibility2 Implementation 2009----- -#define STR_STYLE_ELEMTLIST 18 -//-----IAccessibility2 Implementation 2009 - diff --git a/sfx2/source/dialog/templdlg.src b/sfx2/source/dialog/templdlg.src index ff2661181434..7075d1963757 100644 --- a/sfx2/source/dialog/templdlg.src +++ b/sfx2/source/dialog/templdlg.src @@ -42,18 +42,7 @@ ImageList DLG_STYLE_DESIGNER }; IdCount = { 3 ; }; }; -ImageList IMG_LST_STYLE_DESIGNER_HC -{ - Prefix = "sch"; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - IdList = - { - SID_STYLE_WATERCAN ; - SID_STYLE_NEW_BY_EXAMPLE ; - SID_STYLE_UPDATE_BY_EXAMPLE ; - }; - IdCount = { 3 ; }; -}; + // RID_STYLECATALOG ------------------------------------------------------ ModalDialog RID_STYLECATALOG { @@ -142,6 +131,7 @@ ModalDialog RID_STYLECATALOG DropDown = TRUE ; }; }; + // Strings --------------------------------------------------------------- String STR_STYLE_ELEMTLIST { @@ -151,6 +141,7 @@ String STR_STYLE_FILTER_HIERARCHICAL { Text [ en-US ] = "Hierarchical" ; }; + // DLG_STYLE_DESIGNER ---------------------------------------------------- DockingWindow DLG_STYLE_DESIGNER { @@ -167,7 +158,6 @@ DockingWindow DLG_STYLE_DESIGNER Sizeable = TRUE ; Dockable = TRUE ; EnableResizing = TRUE ; - // HideWhenDeactivate = TRUE; Border = TRUE ; Moveable = TRUE ; ToolBox TB_ACTION diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 5d41fc214786..f017ad454063 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -246,12 +247,7 @@ namespace sfx2 // Get the closer bitmap and set it as right most button. Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) ); - Image aImageHC( SfxResId( SFX_IMG_CLOSE_DOC_HC ) ); - m_aToolbox.InsertItem( 1, - GetSettings().GetStyleSettings().GetHighContrastMode() - ? aImageHC - : aImage - ); + m_aToolbox.InsertItem( 1, aImage ); m_aToolbox.ShowItem( 1 ); } @@ -358,3 +354,5 @@ namespace sfx2 //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/titledockwin.src b/sfx2/source/dialog/titledockwin.src index 3f52e84ab75d..ede6c4b8c4d1 100644 --- a/sfx2/source/dialog/titledockwin.src +++ b/sfx2/source/dialog/titledockwin.src @@ -31,9 +31,3 @@ Image SFX_IMG_CLOSE_DOC { ImageBitmap = Bitmap { File = "closedoc.png" ; }; }; - -Image SFX_IMG_CLOSE_DOC_HC -{ - ImageBitmap = Bitmap { File = "closedochc.png" ; }; -}; - diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx index 2b815a260e3a..f4dcbd43470a 100644 --- a/sfx2/source/dialog/tplcitem.cxx +++ b/sfx2/source/dialog/tplcitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,11 +45,12 @@ // STATIC DATA ----------------------------------------------------------- -// Konstruktor +// Constructor SfxTemplateControllerItem::SfxTemplateControllerItem( sal_uInt16 nSlotId, // ID - SfxCommonTemplateDialog_Impl &rDlg, // Controller-Instanz, dem dieses Item zugeordnet ist. + SfxCommonTemplateDialog_Impl &rDlg, // Controller-Instance, + // which is assigned to this item. SfxBindings &rBindings): SfxControllerItem(nSlotId, rBindings), rTemplateDlg(rDlg), @@ -64,9 +66,8 @@ SfxTemplateControllerItem::~SfxTemplateControllerItem() } // ----------------------------------------------------------------------- - -// Benachrichtigung "uber Status"anderung; wird an den -// im Konstruktor "ubergebenen Controller propagiert +// Notice about change of status, is propagated through the Controller +// passed on by the constructor void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pItem ) @@ -85,11 +86,11 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta else { const SfxTemplateItem *pStateItem = PTR_CAST( SfxTemplateItem, pItem); - DBG_ASSERT(pStateItem != 0, "SfxTemplateItem erwartet"); + DBG_ASSERT(pStateItem != 0, "SfxTemplateItem expected"); rTemplateDlg.SetFamilyState( GetId(), pStateItem ); } sal_Bool bDisable = eState == SFX_ITEM_DISABLED; - // Familie Disablen + // Disable Familly sal_uInt16 nFamily = 0; switch( GetId()) { @@ -103,7 +104,8 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta nFamily = 4; break; case SID_STYLE_FAMILY5: nFamily = 5; break; - default: DBG_ERROR("unbekannte StyleFamily"); break; + + default: OSL_FAIL("unknown StyleFamily"); break; } rTemplateDlg.EnableFamilyItem( nFamily, !bDisable ); break; @@ -115,7 +117,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta else if( eState == SFX_ITEM_AVAILABLE ) { const SfxBoolItem *pStateItem = PTR_CAST(SfxBoolItem, pItem); - DBG_ASSERT(pStateItem != 0, "BoolItem erwartet"); + DBG_ASSERT(pStateItem != 0, "BoolItem expected"); nWaterCanState = pStateItem->GetValue() ? 1 : 0; } //not necessary if the last event is still on the way @@ -139,9 +141,6 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta { rTemplateDlg.EnableExample_Impl( GetId(), eState != SFX_ITEM_DISABLED ); - // Das Select Disabled dann, falls enabled und Style Readonly -/* String aStr = rTemplateDlg.GetSelectedEntry(); - if( aStr.Len() ) rTemplateDlg.SelectStyle( aStr ); */ break; } case SID_STYLE_NEW: @@ -163,9 +162,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta } } } -/* -----------------------------05.09.2001 10:48------------------------------ - ---------------------------------------------------------------------------*/ IMPL_STATIC_LINK(SfxTemplateControllerItem, SetWaterCanStateHdl_Impl, SfxTemplateControllerItem*, EMPTYARG) { @@ -183,3 +180,4 @@ IMPL_STATIC_LINK(SfxTemplateControllerItem, SetWaterCanStateHdl_Impl, return 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx index 774c7e44e7a7..0329d1a0395d 100644 --- a/sfx2/source/dialog/tplpitem.cxx +++ b/sfx2/source/dialog/tplpitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,8 +49,8 @@ SfxTemplateItem::SfxTemplateItem() : SfxTemplateItem::SfxTemplateItem ( sal_uInt16 nWhichId, // Slot-ID - const String& rStyle, // Name des aktuellen Styles - sal_uInt16 nValue // Flags f"ur das Filtern bei automatischer Anzeige + const String& rStyle, // Name of the current Styles + sal_uInt16 nValue // Flags for the filters of the automatic display ) : SfxFlagItem( nWhichId, nValue ), aStyle( rStyle ) { @@ -57,7 +58,7 @@ SfxTemplateItem::SfxTemplateItem //------------------------------------------------------------------------- -// copy ctor +// copy constuctor SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) : SfxFlagItem( rCopy ), @@ -84,7 +85,7 @@ SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const } //------------------------------------------------------------------------- -sal_Bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { ::com::sun::star::frame::status::Template aTemplate; @@ -92,11 +93,11 @@ sal_Bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 aTemplate.StyleName = aStyle; rVal <<= aTemplate; - return sal_True; + return true; } //------------------------------------------------------------------------- -sal_Bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { ::com::sun::star::frame::status::Template aTemplate; @@ -104,10 +105,10 @@ sal_Bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uI { SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) ); aStyle = aTemplate.StyleName; - return sal_True; + return true; } - return sal_False; + return false; } //------------------------------------------------------------------------- @@ -118,3 +119,4 @@ sal_uInt8 SfxTemplateItem::GetFlagCount() const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 51219608b75e..78b0c24fb6f5 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" #include <unotools/localedatawrapper.hxx> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include <svl/stritem.hxx> @@ -54,8 +53,10 @@ #include <sfx2/request.hxx> #include <sfx2/sfxuno.hxx> +#include <vector> using namespace com::sun::star; +using ::std::vector; // ************************************************************************** struct SfxVersionInfo @@ -78,16 +79,15 @@ struct SfxVersionInfo return *this; } }; -DECLARE_LIST( _SfxVersionTable, SfxVersionInfo* ) -class SfxVersionTableDtor : public _SfxVersionTable + +typedef vector< SfxVersionInfo* > _SfxVersionTable; + +class SfxVersionTableDtor { +private: + _SfxVersionTable aTableList; public: - SfxVersionTableDtor( const sal_uInt16 nInitSz=0, const sal_uInt16 nReSz=1 ) - : _SfxVersionTable( nInitSz, nReSz ) - {} - - SfxVersionTableDtor( const SfxVersionTableDtor &rCpy ) : - _SfxVersionTable( rCpy ) + SfxVersionTableDtor( const SfxVersionTableDtor &rCpy ) { *this = rCpy; } SfxVersionTableDtor( const uno::Sequence < util::RevisionTag >& rInfo ); @@ -100,6 +100,12 @@ public: SvStream& Read( SvStream & ); SvStream& Write( SvStream & ) const; SvStringsDtor* GetVersions() const; + + size_t size() const + { return aTableList.size(); } + + SfxVersionInfo* at( size_t i ) const + { return aTableList[ i ]; } }; SfxVersionTableDtor::SfxVersionTableDtor( const uno::Sequence < util::RevisionTag >& rInfo ) @@ -111,41 +117,33 @@ SfxVersionTableDtor::SfxVersionTableDtor( const uno::Sequence < util::RevisionTa pInfo->aComment = rInfo[n].Comment; pInfo->aAuthor = rInfo[n].Author; - Date aDate ( rInfo[n].TimeStamp.Day, rInfo[n].TimeStamp.Month, rInfo[n].TimeStamp.Year ); + Date aDate ( rInfo[n].TimeStamp.Day, rInfo[n].TimeStamp.Month, rInfo[n].TimeStamp.Year ); Time aTime ( rInfo[n].TimeStamp.Hours, rInfo[n].TimeStamp.Minutes, rInfo[n].TimeStamp.Seconds, rInfo[n].TimeStamp.HundredthSeconds ); pInfo->aCreationDate = DateTime( aDate, aTime ); - Insert( pInfo, Count() ); + aTableList.push_back( pInfo ); } } void SfxVersionTableDtor::DelDtor() { - SfxVersionInfo* pTmp = First(); - while( pTmp ) - { - delete pTmp; - pTmp = Next(); - } - Clear(); + for ( size_t i = 0, n = aTableList.size(); i < n; ++i ) + delete aTableList[ i ]; + aTableList.clear(); } SfxVersionTableDtor& SfxVersionTableDtor::operator=( const SfxVersionTableDtor& rTbl ) { DelDtor(); - SfxVersionInfo* pTmp = ((SfxVersionTableDtor&)rTbl).First(); - while( pTmp ) + for ( size_t i = 0, n = rTbl.size(); i < n; ++i ) { - SfxVersionInfo *pNew = new SfxVersionInfo( *pTmp ); - Insert( pNew, LIST_APPEND ); - pTmp = ((SfxVersionTableDtor&)rTbl).Next(); + SfxVersionInfo* pNew = new SfxVersionInfo( *(rTbl.at( i )) ); + aTableList.push_back( pNew ); } return *this; } //---------------------------------------------------------------- -//---------------------------------------------------------------- -//---------------------------------------------------------------- SfxVersionInfo::SfxVersionInfo() { } @@ -162,21 +160,20 @@ static String ConvertDateTime_Impl(const DateTime& rTime, const LocaleDataWrappe SvStringsDtor* SfxVersionTableDtor::GetVersions() const { SvStringsDtor *pList = new SvStringsDtor; - SfxVersionInfo* pInfo = ((SfxVersionTableDtor*) this)->First(); LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - while ( pInfo ) + + for ( size_t i = 0, n = aTableList.size(); i < n; ++i ) { + SfxVersionInfo* pInfo = aTableList[ i ]; String *pString = new String( pInfo->aComment ); (*pString) += DEFINE_CONST_UNICODE( "; " ); (*pString) += ConvertDateTime_Impl( pInfo->aCreationDate, aLocaleWrapper ); pList->Insert( pString, pList->Count() ); - pInfo = ((SfxVersionTableDtor*) this)->Next(); } - return pList; } -// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert +// Caution in the code this array si indexed directly (0, 1, ...) static long nTabs_Impl[] = { 3, // Number of Tabs @@ -242,7 +239,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVer aVersionBox.SetStyle( aVersionBox.GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN ); aVersionBox.SetSelectionMode( SINGLE_SELECTION ); aVersionBox.SetTabs( &nTabs_Impl[0], MAP_APPFONT ); - aVersionBox.Resize(); // OS: Hack fuer richtige Selektion + aVersionBox.Resize(); // OS: Hack for correct selection RecalcDateColumn(); // set dialog title (filename or docinfo title) @@ -285,9 +282,9 @@ void SfxVersionDialog::Init_Impl() delete mpTable; mpTable = new SfxVersionTableDtor( aVersions ); { - for ( sal_uInt16 n = 0; n < mpTable->Count(); ++n ) + for ( size_t n = 0; n < mpTable->size(); ++n ) { - SfxVersionInfo *pInfo = mpTable->GetObject(n); + SfxVersionInfo *pInfo = mpTable->at( n ); String aEntry = ConvertDateTime_Impl( pInfo->aCreationDate, *mpLocaleWrapper ); aEntry += '\t'; aEntry += pInfo->aAuthor; @@ -517,3 +514,4 @@ IMPL_LINK( SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton ) return 0L; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/versdlg.hrc b/sfx2/source/dialog/versdlg.hrc index 2de7596221e1..2de7596221e1 100644..100755 --- a/sfx2/source/dialog/versdlg.hrc +++ b/sfx2/source/dialog/versdlg.hrc diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src index 927c940e6506..a86de72fec81 100644 --- a/sfx2/source/dialog/versdlg.src +++ b/sfx2/source/dialog/versdlg.src @@ -33,7 +33,6 @@ ModalDialog DLG_VERSIONS Size = MAP_APPFONT ( 340 , 184 ) ; SvLook = TRUE ; Moveable = TRUE ; -//! Closeable = TRUE ; FixedLine GB_NEWVERSIONS { Pos = MAP_APPFONT ( 6 , 3 ) ; diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 0ff55513c547..e2c407138069 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,7 +44,6 @@ #include <com/sun/star/rdf/URI.hpp> #include <com/sun/star/rdf/Repository.hpp> -#include <rtl/uuid.h> #include <rtl/ustrbuf.hxx> #include <rtl/uri.hxx> #include <rtl/bootstrap.hxx> @@ -97,7 +97,6 @@ bool isValidNCName(::rtl::OUString const & i_rIdref) reinterpret_cast<const unsigned char*>(id.getStr()), 0)); } -//////////////////////////////////////////////////////////////////////////// static const char s_content [] = "content.xml"; static const char s_styles [] = "styles.xml"; @@ -107,27 +106,25 @@ static const char s_manifest[] = "manifest.rdf"; static const char s_rdfxml [] = "application/rdf+xml"; static const char s_odfmime [] = "application/vnd.oasis.opendocument."; -//////////////////////////////////////////////////////////////////////////// static bool isContentFile(::rtl::OUString const & i_rPath) { - return i_rPath.equalsAscii(s_content); + return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_content)); } static bool isStylesFile (::rtl::OUString const & i_rPath) { - return i_rPath.equalsAscii(s_styles); + return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_styles)); } static bool isReservedFile(::rtl::OUString const & i_rPath) { return isContentFile(i_rPath) || isStylesFile(i_rPath) - || i_rPath.equalsAscii(s_meta) - || i_rPath.equalsAscii(s_settings); + || i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_meta)) + || i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_settings)); } -//////////////////////////////////////////////////////////////////////////// uno::Reference<rdf::XURI> createBaseURI( uno::Reference<uno::XComponentContext> const & i_xContext, @@ -160,8 +157,8 @@ uno::Reference<rdf::XURI> createBaseURI( i_xContext->getServiceManager(), uno::UNO_SET_THROW); const uno::Reference<uri::XUriReferenceFactory> xUriFactory( xServiceFactory->createInstanceWithContext( - ::rtl::OUString::createFromAscii( - "com.sun.star.uri.UriReferenceFactory"), i_xContext), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uri.UriReferenceFactory")), i_xContext), uno::UNO_QUERY_THROW); uno::Reference< uri::XUriReference > xBaseURI; @@ -174,17 +171,6 @@ uno::Reference<rdf::XURI> createBaseURI( // if ( pkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(pkgURI) ) if (true) { xBaseURI.set( xPkgURI, uno::UNO_SET_THROW ); -#if 0 - } else { - const uno::Reference<uri::XVndSunStarPkgUrlReferenceFactory> - xPkgUriFactory( xServiceFactory->createInstanceWithContext( - ::rtl::OUString::createFromAscii( - "com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"), - i_xContext), - uno::UNO_QUERY_THROW); - xBaseURI.set( xPkgUriFactory->createVndSunStarPkgUrlReference(xPkgURI), - uno::UNO_SET_THROW ); -#endif } ::rtl::OUStringBuffer buf; if (!xBaseURI->getUriReference().endsWithAsciiL("/", 1)) @@ -216,7 +202,6 @@ uno::Reference<rdf::XURI> createBaseURI( return rdf::URI::create(i_xContext, xBaseURI->getUriReference()); } -//////////////////////////////////////////////////////////////////////////// struct DocumentMetadataAccess_Impl { @@ -260,8 +245,8 @@ static bool isFileNameValid(const ::rtl::OUString & i_rFileName) const ::rtl::OUString segment( i_rFileName.getToken(0, static_cast<sal_Unicode> ('/'), idx) ); if (!segment.getLength() || // no empty segments - segment.equalsAscii(".") || // no . segments - segment.equalsAscii("..") || // no .. segments + segment.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".")) || // no . segments + segment.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("..")) || // no .. segments !::comphelper::OStorageHelper::IsValidZipEntryFileName( segment, sal_False)) // no invalid characters return false; @@ -303,7 +288,6 @@ splitXmlId(::rtl::OUString const & i_XmlId, } } -//////////////////////////////////////////////////////////////////////////// static uno::Reference<rdf::XURI> getURIForStream(struct DocumentMetadataAccess_Impl& i_rImpl, @@ -345,8 +329,8 @@ addFile(struct DocumentMetadataAccess_Impl & i_rImpl, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "addFile: exception"), /*this*/0, uno::makeAny(e)); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "addFile: exception")), /*this*/0, uno::makeAny(e)); } } @@ -394,7 +378,7 @@ removeFile(struct DocumentMetadataAccess_Impl & i_rImpl, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii("removeFile: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("removeFile: exception")), 0, uno::makeAny(e)); } } @@ -423,7 +407,7 @@ getAllParts(struct DocumentMetadataAccess_Impl & i_rImpl) throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii("getAllParts: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAllParts: exception")), 0, uno::makeAny(e)); } } @@ -445,12 +429,11 @@ isPartOfType(struct DocumentMetadataAccess_Impl & i_rImpl, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii("isPartOfType: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("isPartOfType: exception")), 0, uno::makeAny(e)); } } -//////////////////////////////////////////////////////////////////////////// static ucb::InteractiveAugmentedIOException mkException( ::rtl::OUString const & i_rMessage, @@ -462,10 +445,10 @@ mkException( ::rtl::OUString const & i_rMessage, iaioe.Classification = task::InteractionClassification_ERROR; iaioe.Code = i_ErrorCode; - const beans::PropertyValue uriProp(::rtl::OUString::createFromAscii("Uri"), + const beans::PropertyValue uriProp(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")), -1, uno::makeAny(i_rUri), static_cast<beans::PropertyState>(0)); const beans::PropertyValue rnProp( - ::rtl::OUString::createFromAscii("ResourceName"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceName")), -1, uno::makeAny(i_rResource), static_cast<beans::PropertyState>(0)); iaioe.Arguments = ::comphelper::makeSequence( uno::makeAny(uriProp), uno::makeAny(rnProp)); @@ -485,8 +468,8 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException, const uno::Reference<task::XInteractionHandler> & i_xHandler) { if (!i_xHandler.is()) { - throw lang::WrappedTargetException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::loadMetadataFromStorage: exception"), + throw lang::WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::loadMetadataFromStorage: exception")), /* *this*/ 0, uno::makeAny(i_rException)); } @@ -498,11 +481,7 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException, new ::comphelper::OInteractionApprove ); ::rtl::Reference< ::comphelper::OInteractionAbort > pAbort( new ::comphelper::OInteractionAbort ); - /* this does not seem to work - if (i_rException.Code != ucb::IOErrorCode_WRONG_FORMAT) { - pRequest->addContinuation( pRetry.get() ); - } - */ + pRequest->addContinuation( pApprove.get() ); pRequest->addContinuation( pAbort.get() ); // actually call the handler @@ -513,8 +492,8 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException, return false; } else { OSL_ENSURE(pAbort->wasSelected(), "no continuation selected?"); - throw lang::WrappedTargetException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::loadMetadataFromStorage: exception"), + throw lang::WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::loadMetadataFromStorage: exception")), /* *this*/ 0, uno::makeAny(i_rException)); } } @@ -526,8 +505,8 @@ collectFilesFromStorage(uno::Reference<embed::XStorage> const& i_xStorage, ::rtl::OUString i_Path, std::set< ::rtl::OUString > & o_rFiles) { - static ::rtl::OUString content(::rtl::OUString::createFromAscii(s_content)); - static ::rtl::OUString styles (::rtl::OUString::createFromAscii(s_styles )); + static ::rtl::OUString content(RTL_CONSTASCII_USTRINGPARAM(s_content)); + static ::rtl::OUString styles(RTL_CONSTASCII_USTRINGPARAM(s_styles )); try { if (i_xStorage->hasByName(content) && i_xStorage->isStreamElement(content)) @@ -555,7 +534,7 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl, ::rtl::OUString rest; try { if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException(); - if (dir.equalsAscii("")) { + if (dir.getLength() == 0) { if (i_xStorage->isStreamElement(i_rPath)) { const uno::Reference<io::XStream> xStream( i_xStorage->openStreamElement(i_rPath, @@ -570,8 +549,8 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl, i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML, xInStream, xURI, xBaseURI); } else { - throw mkException(::rtl::OUString::createFromAscii( - "readStream: is not a stream"), + throw mkException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "readStream: is not a stream")), ucb::IOErrorCode_NO_FILE, i_rBaseURI + i_rPath, i_rPath); } } else { @@ -597,8 +576,8 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl, buf.append(dir).append(static_cast<sal_Unicode>('/')); readStream(i_rImpl, xDir, rest, buf.makeStringAndClear() ); } else { - throw mkException(::rtl::OUString::createFromAscii( - "readStream: is not a directory"), + throw mkException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "readStream: is not a directory")), ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir); } } @@ -631,7 +610,7 @@ retry: throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii("importFile: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("importFile: exception")), 0, uno::makeAny(e)); } } @@ -652,8 +631,8 @@ exportStream(struct DocumentMetadataAccess_Impl & i_rImpl, uno::UNO_QUERY); if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage xStreamProps->setPropertyValue( - ::rtl::OUString::createFromAscii("MediaType"), - uno::makeAny(::rtl::OUString::createFromAscii(s_rdfxml))); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), + uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s_rdfxml)))); } const uno::Reference<io::XOutputStream> xOutStream( xStream->getOutputStream(), uno::UNO_SET_THROW ); @@ -675,7 +654,7 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl, ::rtl::OUString rest; if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException(); try { - if (dir.equalsAscii("")) { + if (dir.getLength() == 0) { exportStream(i_rImpl, i_xStorage, i_xGraphName, i_rPath, i_rBaseURI); } else { @@ -772,9 +751,9 @@ retry: if (rterr.hasValue()) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "exception"), 0, rterr); + "exception")), 0, rterr); } if (err) { @@ -798,7 +777,7 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl) getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get()); } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii("init: unexpected exception"), 0, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("init: unexpected exception")), 0, uno::makeAny(e)); } @@ -814,7 +793,6 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl) } -//////////////////////////////////////////////////////////////////////////// DocumentMetadataAccess::DocumentMetadataAccess( uno::Reference< uno::XComponentContext > const & i_xContext, @@ -849,7 +827,6 @@ DocumentMetadataAccess::~DocumentMetadataAccess() { } - // ::com::sun::star::rdf::XRepositorySupplier: uno::Reference< rdf::XRepository > SAL_CALL DocumentMetadataAccess::getRDFRepository() throw (uno::RuntimeException) @@ -887,8 +864,8 @@ throw (uno::RuntimeException) const IXmlIdRegistry * pReg( m_pImpl->m_rXmlIdRegistrySupplier.GetXmlIdRegistry() ); if (!pReg) { - throw uno::RuntimeException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::getElementByXmlId: no registry"), *this); + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::getElementByXmlId: no registry")), *this); } return pReg->GetElementByMetadataReference(i_rReference); } @@ -899,8 +876,8 @@ DocumentMetadataAccess::getElementByURI( throw (uno::RuntimeException, lang::IllegalArgumentException) { if (!i_xURI.is()) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::getElementByURI: URI is null"), *this, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::getElementByURI: URI is null")), *this, 0); } const ::rtl::OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() ); @@ -925,9 +902,9 @@ DocumentMetadataAccess::getMetadataGraphsWithType( throw (uno::RuntimeException, lang::IllegalArgumentException) { if (!i_xType.is()) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::getMetadataGraphsWithType: " - "type is null"), *this, 0); + "type is null")), *this, 0); } ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > ret; @@ -948,21 +925,21 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { if (!isFileNameValid(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::addMetadataFile: invalid FileName"), + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::addMetadataFile: invalid FileName")), *this, 0); } if (isReservedFile(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::addMetadataFile:" - "invalid FileName: reserved"), *this, 0); + "invalid FileName: reserved")), *this, 0); } for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) { if (!i_rTypes[i].is()) { throw lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::addMetadataFile: " - "null type"), *this, 2); + "null type")), *this, 2); } } @@ -973,8 +950,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, m_pImpl->m_xRepository->createGraph(xGraphName); } catch (rdf::RepositoryException & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::addMetadataFile: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::addMetadataFile: exception")), *this, uno::makeAny(e)); // note: all other exceptions are propagated } @@ -994,20 +971,20 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException, rdf::ParseException, io::IOException) { if (!isFileNameValid(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::importMetadataFile: invalid FileName"), + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::importMetadataFile: invalid FileName")), *this, 0); } if (isReservedFile(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::importMetadataFile:" - "invalid FileName: reserved"), *this, 0); + "invalid FileName: reserved")), *this, 0); } for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) { if (!i_rTypes[i].is()) { throw lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::importMetadataFile: null type"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::importMetadataFile: null type")), *this, 5); } } @@ -1020,9 +997,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, i_Format, i_xInStream, xGraphName, i_xBaseURI); } catch (rdf::RepositoryException & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::importMetadataFile: " - "RepositoryException"), *this, uno::makeAny(e)); + "RepositoryException")), *this, uno::makeAny(e)); // note: all other exceptions are propagated } @@ -1041,9 +1018,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, m_pImpl->m_xRepository->destroyGraph(i_xGraphName); } catch (rdf::RepositoryException & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::removeMetadataFile: " - "RepositoryException"), *this, uno::makeAny(e)); + "RepositoryException")), *this, uno::makeAny(e)); // note: all other exceptions are propagated } @@ -1058,15 +1035,15 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { if (!isFileNameValid(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::addContentOrStylesFile: " - "invalid FileName"), *this, 0); + "invalid FileName")), *this, 0); } if (!addContentOrStylesFileImpl(*m_pImpl, i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::addContentOrStylesFile: " - "invalid FileName: must end with content.xml or styles.xml"), + "invalid FileName: must end with content.xml or styles.xml")), *this, 0); } } @@ -1078,9 +1055,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { if (!isFileNameValid(i_rFileName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::removeContentOrStylesFile: " - "invalid FileName"), *this, 0); + "invalid FileName")), *this, 0); } try { @@ -1093,9 +1070,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, uno::UNO_SET_THROW); if (!xEnum->hasMoreElements()) { throw container::NoSuchElementException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::removeContentOrStylesFile: " - "cannot find stream in manifest graph: ") + i_rFileName, + "cannot find stream in manifest graph: ")) + i_rFileName, *this); } @@ -1106,8 +1083,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "DocumentMetadataAccess::removeContentOrStylesFile: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "DocumentMetadataAccess::removeContentOrStylesFile: exception")), *this, uno::makeAny(e)); } } @@ -1120,32 +1097,32 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { if (!i_xStorage.is()) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "storage is null"), *this, 0); + "storage is null")), *this, 0); } if (!i_xBaseURI.is()) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "base URI is null"), *this, 1); + "base URI is null")), *this, 1); } const ::rtl::OUString baseURI( i_xBaseURI->getStringValue()); if (baseURI.indexOf('#') >= 0) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "base URI not absolute"), *this, 1); + "base URI not absolute")), *this, 1); } if (!baseURI.getLength() || !baseURI.endsWithAsciiL("/", 1)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "base URI does not end with slash"), *this, 1); + "base URI does not end with slash")), *this, 1); } initLoading(*m_pImpl, i_xStorage, i_xBaseURI, i_xHandler); std::set< ::rtl::OUString > StgFiles; collectFilesFromStorage(i_xStorage, - ::rtl::OUString::createFromAscii(""), StgFiles); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")), StgFiles); std::vector< ::rtl::OUString > MfstMetadataFiles; @@ -1212,9 +1189,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromStorage: " - "exception"), *this, uno::makeAny(e)); + "exception")), *this, uno::makeAny(e)); } std::for_each(StgFiles.begin(), StgFiles.end(), @@ -1231,9 +1208,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { if (!i_xStorage.is()) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::storeMetadataToStorage: " - "storage is null"), *this, 0); + "storage is null")), *this, 0); } // export manifest @@ -1247,12 +1224,12 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, } catch (uno::RuntimeException &) { throw; } catch (io::IOException & e) { - throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( - "storeMetadataToStorage: IO exception"), *this, uno::makeAny(e)); + throw lang::WrappedTargetException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "storeMetadataToStorage: IO exception")), *this, uno::makeAny(e)); } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "storeMetadataToStorage: exception"), *this, uno::makeAny(e)); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "storeMetadataToStorage: exception")), *this, uno::makeAny(e)); } // export metadata streams @@ -1285,20 +1262,20 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, throw; } catch (io::IOException & e) { throw lang::WrappedTargetException( - ::rtl::OUString::createFromAscii( - "storeMetadataToStorage: IO exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "storeMetadataToStorage: IO exception")), *this, uno::makeAny(e)); } catch (uno::Exception & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "storeMetadataToStorage: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "storeMetadataToStorage: exception")), *this, uno::makeAny(e)); } } } catch (rdf::RepositoryException & e) { throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "storeMetadataToStorage: exception"), *this, uno::makeAny(e)); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "storeMetadataToStorage: exception")), *this, uno::makeAny(e)); } } @@ -1317,10 +1294,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, if (md.addInputStream()) { md[ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xIn; } - if (!xIn.is() && URL.equalsAscii("")) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + if (!xIn.is() && (URL.getLength() == 0)) { + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromMedium: " - "inalid medium: no URL, no input stream"), *this, 0); + "inalid medium: no URL, no input stream")), *this, 0); } uno::Reference<embed::XStorage> xStorage; try { @@ -1339,14 +1316,14 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, throw; } catch (uno::Exception & e) { throw lang::WrappedTargetException( - ::rtl::OUString::createFromAscii( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromMedium: " - "exception"), *this, uno::makeAny(e)); + "exception")), *this, uno::makeAny(e)); } if (!xStorage.is()) { - throw uno::RuntimeException(::rtl::OUString::createFromAscii( + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::loadMetadataFromMedium: " - "cannot get Storage"), *this); + "cannot get Storage")), *this); } uno::Reference<rdf::XURI> xBaseURI; try { @@ -1356,7 +1333,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, try { xBaseURI = createBaseURI(m_pImpl->m_xContext, xStorage, URL); } catch (uno::Exception &) { - OSL_ENSURE(false, "cannot create base URI"); + OSL_FAIL("cannot create base URI"); } } uno::Reference<task::XInteractionHandler> xIH; @@ -1373,10 +1350,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, ::comphelper::MediaDescriptor md(i_rMedium); ::rtl::OUString URL; md[ ::comphelper::MediaDescriptor::PROP_URL() ] >>= URL; - if (URL.equalsAscii("")) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( + if (URL.getLength() == 0) { + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::storeMetadataToMedium: " - "invalid medium: no URL"), *this, 0); + "invalid medium: no URL")), *this, 0); } SfxMedium aMedium(i_rMedium); @@ -1393,9 +1370,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, } if (!xStorage.is()) { - throw uno::RuntimeException(::rtl::OUString::createFromAscii( + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentMetadataAccess::storeMetadataToMedium: " - "cannot get Storage"), *this); + "cannot get Storage")), *this); } // set MIME type of the storage ::comphelper::MediaDescriptor::const_iterator iter @@ -1430,3 +1407,4 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, } // namespace sfx2 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 94c5826569f2..ea1878f53d1c 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <sfx2/Metadatable.hxx> #include <sfx2/XmlIdRegistry.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> // solarmutex #include <rtl/random.h> @@ -38,7 +39,7 @@ #include <boost/bind.hpp> #include <memory> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <list> #include <algorithm> #if OSL_DEBUG_LEVEL > 0 @@ -126,12 +127,12 @@ static const char s_prefix [] = "id"; // prefix for generated xml:id static bool isContentFile(::rtl::OUString const & i_rPath) { - return i_rPath.equalsAscii(s_content); + return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_content)); } static bool isStylesFile (::rtl::OUString const & i_rPath) { - return i_rPath.equalsAscii(s_styles); + return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_styles)); } @@ -284,7 +285,7 @@ public: virtual bool IsInContent() const { return m_isInContent; } virtual ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable > MakeUnoObject() - { OSL_ENSURE(false, "MetadatableUndo::MakeUnoObject"); throw; } + { OSL_FAIL("MetadatableUndo::MakeUnoObject"); throw; } }; // MetadatableClipboard ---------------------------------------------- @@ -309,7 +310,7 @@ public: virtual bool IsInContent() const { return m_isInContent; } virtual ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable > MakeUnoObject() - { OSL_ENSURE(false, "MetadatableClipboard::MakeUnoObject"); throw; } + { OSL_FAIL("MetadatableClipboard::MakeUnoObject"); throw; } void OriginNoLongerInBusinessAnymore() { m_pReg = 0; } }; @@ -401,11 +402,11 @@ XmlIdRegistry::GetXmlIdForElement(const Metadatable& i_rObject) const /// generate unique xml:id template< typename T > /*static*/ ::rtl::OUString create_id(const - ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) + ::boost::unordered_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) { static rtlRandomPool s_Pool( rtl_random_createPool() ); - const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) ); - typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > + const ::rtl::OUString prefix(RTL_CONSTASCII_USTRINGPARAM(s_prefix)); + typename ::boost::unordered_map< ::rtl::OUString, T, ::rtl::OUStringHash > ::const_iterator iter; ::rtl::OUString id; do @@ -426,7 +427,7 @@ template< typename T > typedef ::std::list< Metadatable* > XmlIdList_t; /// Idref -> (content.xml element list, styles.xml element list) -typedef ::std::hash_map< ::rtl::OUString, +typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< XmlIdList_t, XmlIdList_t >, ::rtl::OUStringHash > XmlIdMap_t; /// pointer hash template @@ -439,7 +440,7 @@ template<typename T> struct PtrHash }; /// element -> (stream name, idref) -typedef ::std::hash_map< const Metadatable*, +typedef ::boost::unordered_map< const Metadatable*, ::std::pair< ::rtl::OUString, ::rtl::OUString>, PtrHash<Metadatable> > XmlIdReverseMap_t; @@ -521,8 +522,8 @@ XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupElement( { if (!isValidXmlId(i_rStreamName, i_rIdref)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId")), 0, 0); } const XmlIdList_t * pList( LookupElementList(i_rStreamName, i_rIdref) ); @@ -554,9 +555,9 @@ XmlIdRegistryDocument::XmlIdRegistry_Impl::LookupXmlId( m_XmlIdReverseMap.find(&i_rObject) ); if (iter != m_XmlIdReverseMap.end()) { - OSL_ENSURE(!iter->second.first.equalsAscii(""), + OSL_ENSURE(iter->second.first.getLength(), "null stream in m_XmlIdReverseMap"); - OSL_ENSURE(!iter->second.second.equalsAscii(""), + OSL_ENSURE(iter->second.second.getLength(), "null id in m_XmlIdReverseMap"); o_rStream = iter->second.first; o_rIdref = iter->second.second; @@ -599,9 +600,6 @@ XmlIdRegistryDocument::XmlIdRegistry_Impl::TryInsertMetadatable( ::boost::bind( &Metadatable::IsInClipboard, _1 ) ) ) ) ) { -// ??? this is not undoable -// pList->clear(); -// pList->push_back( &i_rObject ); pList->push_front( &i_rObject ); return true; } @@ -690,15 +688,15 @@ XmlIdRegistryDocument::TryRegisterMetadatable(Metadatable & i_rObject, if (!isValidXmlId(i_rStreamName, i_rIdref)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId")), 0, 0); } if (i_rObject.IsInContent() ? !isContentFile(i_rStreamName) : !isStylesFile(i_rStreamName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId: wrong stream"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId: wrong stream")), 0, 0); } ::rtl::OUString old_path; @@ -709,7 +707,7 @@ XmlIdRegistryDocument::TryRegisterMetadatable(Metadatable & i_rObject, return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject); } XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() ); - if (!old_idref.equalsAscii("")) + if (old_idref.getLength()) { old_id = m_pImpl->m_XmlIdMap.find(old_idref); OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found"); @@ -746,7 +744,7 @@ XmlIdRegistryDocument::RegisterMetadatableAndCreateID(Metadatable & i_rObject) m_pImpl->LookupXmlId(i_rObject, old_path, old_idref); XmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() ); - if (!old_idref.equalsAscii("")) + if (old_idref.getLength()) { old_id = m_pImpl->m_XmlIdMap.find(old_idref); OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found"); @@ -779,7 +777,7 @@ void XmlIdRegistryDocument::UnregisterMetadatable(const Metadatable& i_rObject) ::rtl::OUString idref; if (!m_pImpl->LookupXmlId(i_rObject, path, idref)) { - OSL_ENSURE(false, "unregister: no xml id?"); + OSL_FAIL("unregister: no xml id?"); return; } const XmlIdMap_t::iterator iter( m_pImpl->m_XmlIdMap.find(idref) ); @@ -797,7 +795,7 @@ void XmlIdRegistryDocument::RemoveXmlIdForElement(const Metadatable& i_rObject) m_pImpl->m_XmlIdReverseMap.find(&i_rObject) ); if (iter != m_pImpl->m_XmlIdReverseMap.end()) { - OSL_ENSURE(!iter->second.second.equalsAscii(""), + OSL_ENSURE(iter->second.second.getLength(), "null id in m_XmlIdReverseMap"); m_pImpl->m_XmlIdReverseMap.erase(iter); } @@ -822,7 +820,7 @@ void XmlIdRegistryDocument::RegisterCopy(Metadatable const& i_rSource, ::rtl::OUString idref; if (!m_pImpl->LookupXmlId( i_rSource, path, idref )) { - OSL_ENSURE(false, "no xml id?"); + OSL_FAIL("no xml id?"); return; } XmlIdList_t * pList ( m_pImpl->LookupElementList(path, idref) ); @@ -889,7 +887,7 @@ XmlIdRegistryDocument::JoinMetadatables( } else { - OSL_ENSURE(false, "JoinMetadatables: no xmlid?"); + OSL_FAIL("JoinMetadatables: no xmlid?"); return; } if (!mergedOwnsRef) @@ -922,13 +920,13 @@ struct RMapEntry }; /// element -> (stream name, idref, source) -typedef ::std::hash_map< const Metadatable*, +typedef ::boost::unordered_map< const Metadatable*, struct RMapEntry, PtrHash<Metadatable> > ClipboardXmlIdReverseMap_t; /// Idref -> (content.xml element, styles.xml element) -typedef ::std::hash_map< ::rtl::OUString, +typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< Metadatable*, Metadatable* >, ::rtl::OUStringHash > ClipboardXmlIdMap_t; @@ -993,8 +991,8 @@ XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupEntry( { if (!isValidXmlId(i_rStreamName, i_rIdref)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId")), 0, 0); } const ClipboardXmlIdMap_t::const_iterator iter( m_XmlIdMap.find(i_rIdref) ); @@ -1031,9 +1029,9 @@ XmlIdRegistryClipboard::XmlIdRegistry_Impl::LookupXmlId( m_XmlIdReverseMap.find(&i_rObject) ); if (iter != m_XmlIdReverseMap.end()) { - OSL_ENSURE(!iter->second.m_Stream.equalsAscii(""), + OSL_ENSURE(iter->second.m_Stream.getLength(), "null stream in m_XmlIdReverseMap"); - OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""), + OSL_ENSURE(iter->second.m_XmlId.getLength(), "null id in m_XmlIdReverseMap"); o_rStream = iter->second.m_Stream; o_rIdref = iter->second.m_XmlId; @@ -1055,8 +1053,6 @@ XmlIdRegistryClipboard::XmlIdRegistry_Impl::TryInsertMetadatable( OSL_ENSURE(isContentFile(i_rStreamName) || isStylesFile(i_rStreamName), "invalid stream"); - //wntmsci12 won't parse this: -// Metadatable ** ppEntry( LookupEntry(i_rStreamName, i_rIdref) ); Metadatable ** ppEntry = LookupEntry(i_rStreamName, i_rIdref); if (ppEntry) { @@ -1124,15 +1120,15 @@ XmlIdRegistryClipboard::TryRegisterMetadatable(Metadatable & i_rObject, if (!isValidXmlId(i_rStreamName, i_rIdref)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId")), 0, 0); } if (i_rObject.IsInContent() ? !isContentFile(i_rStreamName) : !isStylesFile(i_rStreamName)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId: wrong stream"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId: wrong stream")), 0, 0); } ::rtl::OUString old_path; @@ -1144,7 +1140,7 @@ XmlIdRegistryClipboard::TryRegisterMetadatable(Metadatable & i_rObject, return (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject); } ClipboardXmlIdMap_t::iterator old_id( m_pImpl->m_XmlIdMap.end() ); - if (!old_idref.equalsAscii("")) + if (old_idref.getLength()) { old_id = m_pImpl->m_XmlIdMap.find(old_idref); OSL_ENSURE(old_id != m_pImpl->m_XmlIdMap.end(), "old id not found"); @@ -1179,7 +1175,7 @@ XmlIdRegistryClipboard::RegisterMetadatableAndCreateID(Metadatable & i_rObject) ::rtl::OUString old_path; ::rtl::OUString old_idref; LookupXmlId(i_rObject, old_path, old_idref); - if (!old_idref.equalsAscii("") && + if (old_idref.getLength() && (m_pImpl->LookupElement(old_path, old_idref) == &i_rObject)) { return; @@ -1206,7 +1202,7 @@ void XmlIdRegistryClipboard::UnregisterMetadatable(const Metadatable& i_rObject) const MetadatableClipboard * pLink; if (!m_pImpl->LookupXmlId(i_rObject, path, idref, pLink)) { - OSL_ENSURE(false, "unregister: no xml id?"); + OSL_FAIL("unregister: no xml id?"); return; } const ClipboardXmlIdMap_t::iterator iter( m_pImpl->m_XmlIdMap.find(idref) ); @@ -1225,7 +1221,7 @@ void XmlIdRegistryClipboard::RemoveXmlIdForElement(const Metadatable& i_rObject) m_pImpl->m_XmlIdReverseMap.find(&i_rObject) ); if (iter != m_pImpl->m_XmlIdReverseMap.end()) { - OSL_ENSURE(!iter->second.m_XmlId.equalsAscii(""), + OSL_ENSURE(iter->second.m_XmlId.getLength(), "null id in m_XmlIdReverseMap"); m_pImpl->m_XmlIdReverseMap.erase(iter); } @@ -1261,8 +1257,8 @@ XmlIdRegistryClipboard::RegisterCopyClipboard(Metadatable & i_rCopy, if (!isValidXmlId(i_rReference.First, i_rReference.Second)) { - throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii( - "illegal XmlId"), 0, 0); + throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "illegal XmlId")), 0, 0); } if (!i_isLatent) @@ -1311,9 +1307,9 @@ void Metadatable::RemoveMetadataReference() m_pReg = 0; } } - catch (uno::Exception &) + catch (const uno::Exception &) { - OSL_ENSURE(false, "Metadatable::RemoveMetadataReference: exception"); + OSL_FAIL("Metadatable::RemoveMetadataReference: exception"); } } @@ -1332,14 +1328,14 @@ void Metadatable::SetMetadataReference( const ::com::sun::star::beans::StringPair & i_rReference) { - if (i_rReference.Second.equalsAscii("")) + if (i_rReference.Second.getLength() == 0) { RemoveMetadataReference(); } else { ::rtl::OUString streamName( i_rReference.First ); - if (streamName.equalsAscii("")) + if (streamName.getLength() == 0) { // handle empty stream name as auto-detect. // necessary for importing flat file format. @@ -1354,8 +1350,8 @@ Metadatable::SetMetadataReference( else { throw lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("Metadatable::" - "SetMetadataReference: argument is invalid"), /*this*/0, 0); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Metadatable::" + "SetMetadataReference: argument is invalid")), /*this*/0, 0); } } } @@ -1420,7 +1416,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, { beans::StringPair SourceRef( i_rSource.m_pReg->GetXmlIdForElement(i_rSource) ); - bool isLatent( SourceRef.Second.equalsAscii("") ); + bool isLatent( SourceRef.Second.getLength() == 0 ); XmlIdRegistryDocument * pSourceRegDoc( dynamic_cast<XmlIdRegistryDocument*>(i_rSource.m_pReg) ); OSL_ENSURE(pSourceRegDoc, "RegisterAsCopyOf: 2 clipboards?"); @@ -1469,26 +1465,13 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, } else { - OSL_ENSURE(false, "neither RegDoc nor RegClp cannot happen"); + OSL_FAIL("neither RegDoc nor RegClp cannot happen"); } -#if 0 - { - //FIXME: do we need this at all??? - XmlIdRegistryDocument & rRegDoc( - dynamic_cast<XmlIdRegistryDocument&>( rReg ) ); - { - if (rRegDoc.TryRegisterMetadatable(*this, SourceRef)) - { - this->m_pReg = &rRegDoc; - } - } - } -#endif } } - catch (uno::Exception &) + catch (const uno::Exception &) { - OSL_ENSURE(false, "Metadatable::RegisterAsCopyOf: exception"); + OSL_FAIL("Metadatable::RegisterAsCopyOf: exception"); } } @@ -1509,9 +1492,9 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, return pUndo; } } - catch (uno::Exception &) + catch (const uno::Exception &) { - OSL_ENSURE(false, "Metadatable::CreateUndo: exception"); + OSL_FAIL("Metadatable::CreateUndo: exception"); } return ::boost::shared_ptr<MetadatableUndo>(); } @@ -1579,9 +1562,9 @@ Metadatable::JoinMetadatable(Metadatable const & i_rOther, pRegDoc->JoinMetadatables(*this, i_rOther); } } - catch (uno::Exception &) + catch (const uno::Exception &) { - OSL_ENSURE(false, "Metadatable::JoinMetadatable: exception"); + OSL_FAIL("Metadatable::JoinMetadatable: exception"); } } @@ -1600,7 +1583,7 @@ Metadatable::JoinMetadatable(Metadatable const & i_rOther, ::rtl::OUString SAL_CALL MetadatableMixin::getLocalName() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; beans::StringPair mdref( getMetadataReference() ); if (!mdref.Second.getLength()) { @@ -1617,7 +1600,7 @@ Metadatable::JoinMetadatable(Metadatable const & i_rOther, ::rtl::OUString SAL_CALL MetadatableMixin::getNamespace() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const uno::Reference< frame::XModel > xModel( GetModel() ); const uno::Reference< rdf::XURI > xDMA( xModel, uno::UNO_QUERY_THROW ); return xDMA->getStringValue(); @@ -1628,7 +1611,7 @@ beans::StringPair SAL_CALL MetadatableMixin::getMetadataReference() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Metadatable *const pObject( GetCoreObject() ); if (!pObject) @@ -1646,7 +1629,7 @@ MetadatableMixin::setMetadataReference( const beans::StringPair & i_rReference) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Metadatable *const pObject( GetCoreObject() ); if (!pObject) @@ -1662,7 +1645,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException) void SAL_CALL MetadatableMixin::ensureMetadataReference() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Metadatable *const pObject( GetCoreObject() ); if (!pObject) @@ -1701,3 +1684,4 @@ static void dump(sfx2::XmlIdList_t * pList) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index 1907e54246ab..ae27713ce1ba 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,6 @@ #include <sfx2/sfxuno.hxx> #include "doc.hrc" #include <vcl/msgbox.hxx> - // ----------------------------------------------------------------------------- short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle) { @@ -47,3 +47,5 @@ short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle) return aQBox.Execute(); } // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 41b969fc1e59..66e1b049937d 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,6 +88,10 @@ #include <cstring> #include <limits> + +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/document/XCompatWriterDocProperties.hpp> + /** * This file contains the implementation of the service * com.sun.star.document.DocumentProperties. @@ -292,12 +297,12 @@ public: const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces) throw (css::uno::RuntimeException, css::xml::sax::SAXException); -private: +protected: SfxDocumentMetaData(SfxDocumentMetaData &); // not defined SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined virtual ~SfxDocumentMetaData() {} - + virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); }; const css::uno::Reference< css::uno::XComponentContext > m_xContext; /// for notification @@ -329,11 +334,8 @@ private: /// check if we are initialized properly void SAL_CALL checkInit() const; - // throw (css::uno::RuntimeException); /// initialize state from given DOM tree void SAL_CALL init(css::uno::Reference<css::xml::dom::XDocument> i_xDom); - // throw (css::uno::RuntimeException, css::io::WrongFormatException, - // css::uno::Exception); /// update element in DOM tree void SAL_CALL updateElement(const char *i_name, std::vector<std::pair<const char *, ::rtl::OUString> >* i_pAttrs = 0); @@ -344,35 +346,75 @@ private: /// extract base URL (necessary for converting relative links) css::uno::Reference<css::beans::XPropertySet> SAL_CALL getURLProperties( const css::uno::Sequence<css::beans::PropertyValue> & i_rMedium) const; - // throw (css::uno::RuntimeException); /// get text of standard meta data element ::rtl::OUString SAL_CALL getMetaText(const char* i_name) const; - // throw (css::uno::RuntimeException); /// set text of standard meta data element iff not equal to existing text bool SAL_CALL setMetaText(const char* i_name, const ::rtl::OUString & i_rValue); - // throw (css::uno::RuntimeException); /// set text of standard meta data element iff not equal to existing text void SAL_CALL setMetaTextAndNotify(const char* i_name, const ::rtl::OUString & i_rValue); - // throw (css::uno::RuntimeException); /// get text of standard meta data element's attribute ::rtl::OUString SAL_CALL getMetaAttr(const char* i_name, const char* i_attr) const; - // throw (css::uno::RuntimeException); /// get text of a list of standard meta data elements (multiple occ.) css::uno::Sequence< ::rtl::OUString > SAL_CALL getMetaList( const char* i_name) const; - // throw (css::uno::RuntimeException); /// set text of a list of standard meta data elements (multiple occ.) bool SAL_CALL setMetaList(const char* i_name, const css::uno::Sequence< ::rtl::OUString > & i_rValue, AttrVector const* = 0); - // throw (css::uno::RuntimeException); void createUserDefined(); }; -//////////////////////////////////////////////////////////////////////////// +typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE; + +class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE +{ + rtl::OUString msManager; + rtl::OUString msCategory; + rtl::OUString msCompany; +protected: + virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); }; +public: + CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {} +// XCompatWriterDocPropsImpl + virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; } + virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; } + virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; } + virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; } + virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; } + virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; } + +// XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) + { + return comp_CompatWriterDocProps::_getImplementationName(); + } + + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) + { + css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames(); + sal_Int32 nLen = sServiceNames.getLength(); + rtl::OUString* pIt = sServiceNames.getArray(); + rtl::OUString* pEnd = ( pIt + nLen ); + sal_Bool bRes = sal_False; + for ( ; pIt != pEnd; ++pIt ) + { + if ( pIt->equals( ServiceName ) ) + { + bRes = sal_True; + break; + } + } + return bRes; + } + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) + { + return comp_CompatWriterDocProps::_getSupportedServiceNames(); + } +}; bool operator== (const css::util::DateTime &i_rLeft, const css::util::DateTime &i_rRight) @@ -490,10 +532,10 @@ getQualifier(const char* i_name) { DBG_ASSERT(i_qname, "SfxDocumentMetaData: getNameSpace: argument is null"); const char * ns = ""; ::rtl::OUString n = getQualifier(i_qname).first; - if (n.equalsAscii("xlink" )) ns = s_nsXLink; - if (n.equalsAscii("dc" )) ns = s_nsDC; - if (n.equalsAscii("office")) ns = s_nsODF; - if (n.equalsAscii("meta" )) ns = s_nsODFMeta; + if (n.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("xlink"))) ns = s_nsXLink; + if (n.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dc"))) ns = s_nsDC; + if (n.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("office"))) ns = s_nsODF; + if (n.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("meta"))) ns = s_nsODFMeta; DBG_ASSERT(*ns, "SfxDocumentMetaData: unknown namespace prefix"); return ::rtl::OUString::createFromAscii(ns); } @@ -617,8 +659,8 @@ SfxDocumentMetaData::getURLProperties( css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference< css::beans::XPropertyContainer> xPropArg( - xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.beans.PropertyBag"), m_xContext), + xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.beans.PropertyBag")), m_xContext), css::uno::UNO_QUERY_THROW); try { ::rtl::OUString dburl = @@ -655,8 +697,8 @@ getNodeText(css::uno::Reference<css::xml::dom::XNode> i_xNode) throw (css::uno::RuntimeException) { if (!i_xNode.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::getNodeText: argument is null"), i_xNode); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::getNodeText: argument is null")), i_xNode); for (css::uno::Reference<css::xml::dom::XNode> c = i_xNode->getFirstChild(); c.is(); c = c->getNextSibling()) { @@ -697,7 +739,7 @@ SfxDocumentMetaData::setMetaText(const char* i_name, css::uno::Reference<css::xml::dom::XNode> xNode = m_meta.find(name)->second; try { - if (i_rValue.equalsAscii("")) { + if (i_rValue.getLength() == 0) { if (xNode.is()) { // delete m_xParent->removeChild(xNode); xNode.clear(); @@ -735,8 +777,8 @@ SfxDocumentMetaData::setMetaText(const char* i_name, } catch (css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::setMetaText: DOM exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::setMetaText: DOM exception")), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -757,7 +799,6 @@ SfxDocumentMetaData::setMetaTextAndNotify(const char* i_name, SfxDocumentMetaData::getMetaAttr(const char* i_name, const char* i_attr) const // throw (css::uno::RuntimeException) { -// checkInit(); ::rtl::OUString name = ::rtl::OUString::createFromAscii(i_name); DBG_ASSERT(m_meta.find(name) != m_meta.end(), "SfxDocumentMetaData::getMetaAttr: not found"); @@ -873,8 +914,8 @@ SfxDocumentMetaData::setMetaList(const char* i_name, } catch (css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::setMetaList: DOM exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::setMetaList: DOM exception")), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1014,8 +1055,8 @@ SfxDocumentMetaData::updateElement(const char *i_name, } catch (css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::updateElement: DOM exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::updateElement: DOM exception")), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1033,7 +1074,7 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes() // update elements with attributes std::vector<std::pair<const char *, ::rtl::OUString> > attributes; - if (!m_TemplateName.equalsAscii("") || !m_TemplateURL.equalsAscii("") + if (m_TemplateName.getLength() || m_TemplateURL.getLength() || isValidDateTime(m_TemplateDate)) { attributes.push_back(std::make_pair( static_cast<const char*>("xlink:type"), @@ -1056,7 +1097,7 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes() } attributes.clear(); - if (!m_AutoloadURL.equalsAscii("") || (0 != m_AutoloadSecs)) { + if (m_AutoloadURL.getLength() || (0 != m_AutoloadSecs)) { attributes.push_back(std::make_pair( static_cast<const char*>("xlink:href" ), m_AutoloadURL )); attributes.push_back(std::make_pair( @@ -1068,12 +1109,12 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes() } attributes.clear(); - if (!m_DefaultTarget.equalsAscii("")) { + if (m_DefaultTarget.getLength()) { attributes.push_back(std::make_pair( static_cast<const char*>("office:target-frame-name"), m_DefaultTarget)); // xlink:show: _blank -> new, any other value -> replace - const sal_Char* show = m_DefaultTarget.equalsAscii("_blank") + const sal_Char* show = m_DefaultTarget.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("_blank")) ? "new" : "replace"; attributes.push_back(std::make_pair( static_cast<const char*>("xlink:show"), @@ -1092,18 +1133,18 @@ SfxDocumentMetaData::createDOM() const // throw (css::uno::RuntimeException) css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference<css::xml::dom::XDocumentBuilder> xBuilder( - xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.xml.dom.DocumentBuilder"), m_xContext), + xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.dom.DocumentBuilder")), m_xContext), css::uno::UNO_QUERY_THROW ); if (!xBuilder.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::createDOM: " - "cannot create DocumentBuilder service"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::createDOM: " + "cannot create DocumentBuilder service")), *const_cast<SfxDocumentMetaData*>(this)); css::uno::Reference<css::xml::dom::XDocument> xDoc = xBuilder->newDocument(); if (!xDoc.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::createDOM: " - "cannot create new document"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::createDOM: " + "cannot create new document")), *const_cast<SfxDocumentMetaData*>(this)); return xDoc; } @@ -1112,8 +1153,8 @@ void SAL_CALL SfxDocumentMetaData::checkInit() const // throw (css::uno::RuntimeException) { if (!m_isInitialized) { - throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::checkInit: not initialized"), + throw css::uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::checkInit: not initialized")), *const_cast<SfxDocumentMetaData*>(this)); } DBG_ASSERT((m_xDoc.is() && m_xParent.is() ), @@ -1123,22 +1164,20 @@ SfxDocumentMetaData::checkInit() const // throw (css::uno::RuntimeException) // initialize state from DOM tree void SAL_CALL SfxDocumentMetaData::init( css::uno::Reference<css::xml::dom::XDocument> i_xDoc) -// throw (css::uno::RuntimeException, css::io::WrongFormatException, -// css::uno::Exception) { if (!i_xDoc.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::init: no DOM tree given"), *this); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::init: no DOM tree given")), *this); css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference<css::xml::xpath::XXPathAPI> xPath( - xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.xml.xpath.XPathAPI"), m_xContext), + xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.xpath.XPathAPI")), m_xContext), css::uno::UNO_QUERY_THROW ); if (!xPath.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::init:" - " cannot create XPathAPI service"), *this); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::init:" + " cannot create XPathAPI service")), *this); m_isInitialized = false; m_xDoc = i_xDoc; @@ -1155,16 +1194,14 @@ void SAL_CALL SfxDocumentMetaData::init( // NB: we do not handle the single-XML-file ODF variant, which would // have the root element office:document. // The root of such documents must be converted in the importer! - ::rtl::OUString prefix = ::rtl::OUString::createFromAscii( - "/child::office:document-meta/child::office:meta"); + ::rtl::OUString prefix(RTL_CONSTASCII_USTRINGPARAM( + "/child::office:document-meta/child::office:meta")); css::uno::Reference<css::xml::dom::XNode> xDocNode( m_xDoc, css::uno::UNO_QUERY_THROW); m_xParent.clear(); try { m_xParent = xPath->selectSingleNode(xDocNode, prefix); } catch (com::sun::star::uno::Exception &) { -// DBG_WARNING("SfxDocumentMetaData::init: " -// "caught RuntimeException from libxml!"); } if (!m_xParent.is()) { @@ -1198,27 +1235,27 @@ void SAL_CALL SfxDocumentMetaData::init( if (!xRElem.is()) { xRElem = i_xDoc->createElementNS( ::rtl::OUString::createFromAscii(s_nsODF), - ::rtl::OUString::createFromAscii("office:document-meta")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:document-meta"))); css::uno::Reference<css::xml::dom::XNode> xRNode(xRElem, css::uno::UNO_QUERY_THROW); i_xDoc->appendChild(xRNode); } xRElem->setAttributeNS(::rtl::OUString::createFromAscii(s_nsODF), - ::rtl::OUString::createFromAscii("office:version"), - ::rtl::OUString::createFromAscii("1.0")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:version")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1.0"))); // does not exist, otherwise m_xParent would not be null css::uno::Reference<css::xml::dom::XNode> xParent ( i_xDoc->createElementNS( ::rtl::OUString::createFromAscii(s_nsODF), - ::rtl::OUString::createFromAscii("office:meta")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("office:meta"))), css::uno::UNO_QUERY_THROW); xRElem->appendChild(xParent); m_xParent = xParent; } catch (css::xml::dom::DOMException & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::init: DOM exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::init: DOM exception")), css::uno::Reference<css::uno::XInterface>(*this), a); } } @@ -1235,7 +1272,7 @@ void SAL_CALL SfxDocumentMetaData::init( // application-specific. css::uno::Reference<css::xml::dom::XNode> xNode = xPath->selectSingleNode(m_xParent, - ::rtl::OUString::createFromAscii("child::") + name); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("child::")) + name); // Do not create an empty element if it is missing; // for certain elements, such as dateTime, this would be invalid m_meta[name] = xNode; @@ -1246,7 +1283,7 @@ void SAL_CALL SfxDocumentMetaData::init( ::rtl::OUString name = ::rtl::OUString::createFromAscii(*pName); css::uno::Reference<css::xml::dom::XNodeList> nodes = xPath->selectNodeList(m_xParent, - ::rtl::OUString::createFromAscii("child::") + name); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("child::")) + name); std::vector<css::uno::Reference<css::xml::dom::XNode> > v; for (sal_Int32 i = 0; i < nodes->getLength(); ++i) { v.push_back(nodes->item(i)); @@ -1267,7 +1304,7 @@ void SAL_CALL SfxDocumentMetaData::init( std::vector<css::uno::Reference<css::xml::dom::XNode> > & vec = - m_metaList[::rtl::OUString::createFromAscii("meta:user-defined")]; + m_metaList[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta:user-defined"))]; m_xUserDefined.clear(); // #i105826#: reset (may be re-initialization) if ( !vec.empty() ) { @@ -1285,9 +1322,9 @@ void SAL_CALL SfxDocumentMetaData::init( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name"))); ::rtl::OUString type = xElem->getAttributeNS( ::rtl::OUString::createFromAscii(s_nsODFMeta), - ::rtl::OUString::createFromAscii("value-type")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value-type"))); ::rtl::OUString text = getNodeText(*it); - if (type.equalsAscii("float")) { + if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("float"))) { double d; if (::sax::Converter::convertDouble(d, text)) { any <<= d; @@ -1296,7 +1333,7 @@ void SAL_CALL SfxDocumentMetaData::init( OUStringToOString(text, RTL_TEXTENCODING_UTF8).getStr()); continue; } - } else if (type.equalsAscii("date")) { + } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("date"))) { bool isDateTime; css::util::Date d; css::util::DateTime dt; @@ -1311,7 +1348,7 @@ void SAL_CALL SfxDocumentMetaData::init( OUStringToOString(text, RTL_TEXTENCODING_UTF8).getStr()); continue; } - } else if (type.equalsAscii("time")) { + } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("time"))) { css::util::Duration ud; if (textToDuration(ud, text)) { any <<= ud; @@ -1320,7 +1357,7 @@ void SAL_CALL SfxDocumentMetaData::init( OUStringToOString(text, RTL_TEXTENCODING_UTF8).getStr()); continue; } - } else if (type.equalsAscii("boolean")) { + } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("boolean"))) { bool b; if (::sax::Converter::convertBool(b, text)) { any <<= b; @@ -1329,7 +1366,7 @@ void SAL_CALL SfxDocumentMetaData::init( OUStringToOString(text, RTL_TEXTENCODING_UTF8).getStr()); continue; } - } else if (type.equalsAscii("string") || true) { // default + } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("string")) || true) { // default any <<= text; } try { @@ -1340,10 +1377,10 @@ void SAL_CALL SfxDocumentMetaData::init( OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr()); // ignore; duplicate } catch (css::beans::IllegalTypeException &) { - DBG_ERROR1("SfxDocumentMetaData: illegal type: %s", + OSL_TRACE("SfxDocumentMetaData: illegal type: %s", OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr()); } catch (css::lang::IllegalArgumentException &) { - DBG_ERROR1("SfxDocumentMetaData: illegal arg: %s", + OSL_TRACE("SfxDocumentMetaData: illegal arg: %s", OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr()); } } @@ -1353,7 +1390,6 @@ void SAL_CALL SfxDocumentMetaData::init( } -//////////////////////////////////////////////////////////////////////////// SfxDocumentMetaData::SfxDocumentMetaData( css::uno::Reference< css::uno::XComponentContext > const & context) @@ -1543,7 +1579,7 @@ SfxDocumentMetaData::setLanguage(const css::lang::Locale & the_value) { ::rtl::OUString text = the_value.Language; if (the_value.Country.getLength() > 0) { - text += ::rtl::OUString::createFromAscii("-").concat(the_value.Country); + text += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-")).concat(the_value.Country); } setMetaTextAndNotify("dc:language", text); } @@ -1701,8 +1737,8 @@ SfxDocumentMetaData::setAutoloadSecs(::sal_Int32 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::setAutoloadSecs: argument is negative"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::setAutoloadSecs: argument is negative")), *this, 0); ::osl::ClearableMutexGuard g(m_aMutex); checkInit(); @@ -1743,7 +1779,7 @@ SfxDocumentMetaData::getDocumentStatistics() throw (css::uno::RuntimeException) for (size_t i = 0; s_stdStats[i] != 0; ++i) { const char * aName = s_stdStatAttrs[i]; ::rtl::OUString text = getMetaAttr("meta:document-statistic", aName); - if (text.equalsAscii("")) continue; + if (text.getLength() == 0) continue; css::beans::NamedValue stat; stat.Name = ::rtl::OUString::createFromAscii(s_stdStats[i]); sal_Int32 val; @@ -1815,8 +1851,8 @@ SfxDocumentMetaData::setEditingCycles(::sal_Int16 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::setEditingCycles: argument is negative"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::setEditingCycles: argument is negative")), *this, 0); ::rtl::OUStringBuffer buf; ::sax::Converter::convertNumber(buf, the_value); @@ -1835,8 +1871,8 @@ SfxDocumentMetaData::setEditingDuration(::sal_Int32 the_value) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) { if (the_value < 0) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::setEditingDuration: argument is negative"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::setEditingDuration: argument is negative")), *this, 0); setMetaTextAndNotify("meta:editing-duration", durationToText(the_value)); } @@ -1860,7 +1896,7 @@ SfxDocumentMetaData::resetUserData(const ::rtl::OUString & the_value) dateTimeToText(css::util::DateTime())); bModified |= setMetaText("meta:editing-duration", durationToText(0)); bModified |= setMetaText("meta:editing-cycles", - ::rtl::OUString::createFromAscii("1")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"))); if (bModified) { g.clear(); @@ -1889,8 +1925,8 @@ SfxDocumentMetaData::loadFromStorage( css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" - " argument is null"), *this, 0); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::loadFromStorage:" + " argument is null")), *this, 0); ::osl::MutexGuard g(m_aMutex); // open meta data file @@ -1907,12 +1943,12 @@ SfxDocumentMetaData::loadFromStorage( css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference<css::xml::sax::XParser> xParser ( - xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.xml.sax.Parser"), m_xContext), + xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.sax.Parser")), m_xContext), css::uno::UNO_QUERY_THROW); if (!xParser.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" - " cannot create Parser service"), *this); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::loadFromStorage:" + " cannot create Parser service")), *this); css::xml::sax::InputSource input; input.aInputStream = xInStream; @@ -1929,7 +1965,7 @@ SfxDocumentMetaData::loadFromStorage( try { xPropArg->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI"))) >>= input.sSystemId; - input.sSystemId += ::rtl::OUString::createFromAscii("/").concat( + input.sSystemId += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")).concat( ::rtl::OUString::createFromAscii(s_metaXml)); } catch (css::uno::Exception &) { input.sSystemId = ::rtl::OUString::createFromAscii(s_metaXml); @@ -1942,8 +1978,8 @@ SfxDocumentMetaData::loadFromStorage( ::rtl::OUString::createFromAscii(pServiceName), args, m_xContext), css::uno::UNO_QUERY_THROW); if (!xDocHandler.is()) throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" - " cannot create XMLOasisMetaImporter service"), *this); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::loadFromStorage:" + " cannot create XMLOasisMetaImporter service")), *this); css::uno::Reference<css::document::XImporter> xImp (xDocHandler, css::uno::UNO_QUERY_THROW); xImp->setTargetDocument(css::uno::Reference<css::lang::XComponent>(this)); @@ -1951,12 +1987,11 @@ SfxDocumentMetaData::loadFromStorage( try { xParser->parseStream(input); } catch (css::xml::sax::SAXException &) { - throw css::io::WrongFormatException(::rtl::OUString::createFromAscii( + throw css::io::WrongFormatException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SfxDocumentMetaData::loadFromStorage:" - " XML parsing exception"), *this); + " XML parsing exception")), *this); } // NB: the implementation of XMLOasisMetaImporter calls initialize -// init(xDocBuilder->getDocument()); checkInit(); } @@ -1968,8 +2003,8 @@ SfxDocumentMetaData::storeToStorage( css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::storeToStorage:" - " argument is null"), *this, 0); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::storeToStorage:" + " argument is null")), *this, 0); ::osl::MutexGuard g(m_aMutex); checkInit(); @@ -1986,7 +2021,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::UNO_QUERY_THROW); xStreamProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), - css::uno::makeAny(::rtl::OUString::createFromAscii("text/xml"))); + css::uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("text/xml")))); xStreamProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed")), css::uno::makeAny(static_cast<sal_Bool> (sal_False))); @@ -1999,8 +2034,8 @@ SfxDocumentMetaData::storeToStorage( css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); css::uno::Reference<css::io::XActiveDataSource> xSaxWriter( - xMsf->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.xml.sax.Writer"), m_xContext), + xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.sax.Writer")), m_xContext), css::uno::UNO_QUERY_THROW); xSaxWriter->setOutputStream(xOutStream); css::uno::Reference<css::xml::sax::XDocumentHandler> xDocHandler ( @@ -2034,8 +2069,8 @@ SfxDocumentMetaData::storeToStorage( xTransaction->commit(); } } else { - throw css::io::IOException(::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::storeToStorage: cannot filter"), *this); + throw css::io::IOException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::storeToStorage: cannot filter")), *this); } } @@ -2048,7 +2083,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, css::uno::Reference<css::io::XInputStream> xIn; ::comphelper::MediaDescriptor md(Medium); // if we have an URL parameter, it replaces the one in the media descriptor - if (!URL.equalsAscii("")) { + if (URL.getLength()) { md[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= URL; } if (sal_True == md.addInputStream()) { @@ -2071,14 +2106,14 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, throw; } catch (css::uno::Exception & e) { throw css::lang::WrappedTargetException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::loadFromMedium: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::loadFromMedium: exception")), css::uno::Reference<css::uno::XInterface>(*this), css::uno::makeAny(e)); } if (!xStorage.is()) { - throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::loadFromMedium: cannot get Storage"), + throw css::uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::loadFromMedium: cannot get Storage")), *this); } loadFromStorage(xStorage, md.getAsConstPropertyValueList()); @@ -2091,7 +2126,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, css::lang::WrappedTargetException, css::io::IOException) { ::comphelper::MediaDescriptor md(Medium); - if (!URL.equalsAscii("")) { + if (URL.getLength()) { md[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= URL; } SfxMedium aMedium(md.getAsConstPropertyValueList()); @@ -2100,8 +2135,8 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, if (!xStorage.is()) { - throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::storeToMedium: cannot get Storage"), + throw css::uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::storeToMedium: cannot get Storage")), *this); } // set MIME type of the storage @@ -2150,14 +2185,14 @@ SfxDocumentMetaData::initialize( if (any >>= xDoc) { if (!xDoc.is()) { throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::" - "initialize: argument is null"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::" + "initialize: argument is null")), *this, static_cast<sal_Int16>(i)); } } else { throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("SfxDocumentMetaData::" - "initialize: argument must be XDocument"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxDocumentMetaData::" + "initialize: argument must be XDocument")), *this, static_cast<sal_Int16>(i)); } } @@ -2178,7 +2213,7 @@ SfxDocumentMetaData::createClone() ::osl::MutexGuard g(m_aMutex); checkInit(); - SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext); + SfxDocumentMetaData *pNew = createMe(m_xContext); // NB: do not copy the modification listeners, only DOM css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM(); @@ -2196,11 +2231,10 @@ SfxDocumentMetaData::createClone() } catch (css::uno::Exception & e) { css::uno::Any a(e); throw css::lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SfxDocumentMetaData::createClone: exception"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentMetaData::createClone: exception")), css::uno::Reference<css::uno::XInterface>(*this), a); } -// return static_cast< ::cppu::OWeakObject * > (pNew); return css::uno::Reference<css::util::XCloneable> (pNew); } @@ -2356,6 +2390,28 @@ void SfxDocumentMetaData::createUserDefined() // component helper namespace +namespace comp_CompatWriterDocProps { + + ::rtl::OUString SAL_CALL _getImplementationName() { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "CompatWriterDocPropsImpl")); +} + + css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames() + { + css::uno::Sequence< rtl::OUString > aServiceNames(1); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) ); + return aServiceNames; + } + css::uno::Reference< css::uno::XInterface > SAL_CALL _create( + const css::uno::Reference< css::uno::XComponentContext > & context) + SAL_THROW((css::uno::Exception)) + { + return static_cast< ::cppu::OWeakObject * > + (new CompatWriterDocPropsImpl(context)); + } + +} namespace comp_SfxDocumentMetaData { ::rtl::OUString SAL_CALL _getImplementationName() { @@ -2389,18 +2445,4 @@ static ::cppu::ImplementationEntry const entries[] = { { 0, 0, 0, 0, 0, 0 } }; -#if 0 -extern "C" void SAL_CALL component_getImplementationEnvironment( - const char ** envTypeName, uno_Environment **) -{ - *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -extern "C" void * SAL_CALL component_getFactory( - const char * implName, void * serviceManager, void * registryKey) -{ - return ::cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} -#endif - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index c3cbf01cfc9a..aca8a3a304fd 100644..100755 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -61,14 +61,6 @@ #define BMP_STYLES_FAMILY3 (RID_SFX_DOC_START+ 4) #define BMP_STYLES_FAMILY4 (RID_SFX_DOC_START+ 5) -#define BMP_STYLES_CLOSED_HC (RID_SFX_DOC_START+ 6) -#define BMP_STYLES_OPENED_HC (RID_SFX_DOC_START+ 7) - -#define BMP_STYLES_FAMILY1_HC (RID_SFX_DOC_START+ 8) -#define BMP_STYLES_FAMILY2_HC (RID_SFX_DOC_START+ 9) -#define BMP_STYLES_FAMILY3_HC (RID_SFX_DOC_START+ 10) -#define BMP_STYLES_FAMILY4_HC (RID_SFX_DOC_START+ 11) - #define STR_STYLES (RID_SFX_DOC_START+ 18) #define STR_MACROS (RID_SFX_DOC_START+ 19) @@ -76,7 +68,6 @@ #define STR_PRINT_STYLES_HEADER (RID_SFX_DOC_START+ 21) #define MSG_PRINT_ERROR (RID_SFX_DOC_START+ 22) #define STR_BACKUP_COPY (RID_SFX_DOC_START+ 23) -// #define MSG_WARNING_BACKUP (RID_SFX_DOC_START+ 24) #define MSG_CANT_OPEN_TEMPLATE (RID_SFX_DOC_START+ 25) #define MSG_VIEW_OPEN_CANT_SAVE (RID_SFX_DOC_START+ 26) #define STR_ERROR_SAVE (RID_SFX_DOC_START+ 27) @@ -97,7 +88,6 @@ #define MSG_TEMPLATE_DIR_NOT_EXIST (RID_SFX_DOC_START+ 40) #define MSG_DOCINFO_CANTREAD (RID_SFX_DOC_START+ 41) #define STR_ERROR_NOSTORAGE (RID_SFX_DOC_START+ 42) -// #define STR_QUERY_SAVEOWNFORMAT (RID_SFX_DOC_START+ 43) #define STR_QUERY_MUSTOWNFORMAT (RID_SFX_DOC_START+ 44) #define STR_SAVEDOC (RID_SFX_DOC_START+ 45) #define STR_UPDATEDOC (RID_SFX_DOC_START+ 46) @@ -169,18 +159,12 @@ // some icons are commented out since they are removed #define BMP_SIGNATURE (RID_SFX_DOC_START+97) -// #define BMP_128X128_BASE_DOC (RID_SFX_DOC_START+98) #define BMP_128X128_CALC_DOC (RID_SFX_DOC_START+99) -// #define BMP_128X128_CALC_TEMP (RID_SFX_DOC_START+100) #define BMP_128X128_CHART_DOC (RID_SFX_DOC_START+101) #define BMP_128X128_DRAW_DOC (RID_SFX_DOC_START+102) -// #define BMP_128X128_DRAW_TEMP (RID_SFX_DOC_START+103) #define BMP_128X128_IMPRESS_DOC (RID_SFX_DOC_START+104) -// #define BMP_128X128_IMPRESS_TEMP (RID_SFX_DOC_START+105) -// #define BMP_128X128_MASTER_DOC (RID_SFX_DOC_START+106) #define BMP_128X128_MATH_DOC (RID_SFX_DOC_START+107) #define BMP_128X128_WRITER_DOC (RID_SFX_DOC_START+108) -// #define BMP_128X128_WRITER_TEMP (RID_SFX_DOC_START+109) #define STR_HIDDENINFO_CONTAINS (RID_SFX_DOC_START+110) #define STR_HIDDENINFO_RECORDCHANGES (RID_SFX_DOC_START+111) @@ -193,9 +177,7 @@ #define STR_HIDDENINFO_CONTINUE_SIGNING (RID_SFX_DOC_START+118) #define STR_HIDDENINFO_CONTINUE_CREATEPDF (RID_SFX_DOC_START+119) -// #define MSG_WARNING_MACRO_ISDISABLED (RID_SFX_DOC_START+120) #define STR_NEW_FILENAME_SAVE (RID_SFX_DOC_START+121) -// #define STR_MACROS_DISABLED (RID_SFX_DOC_START+122) #define STR_ERROR_DELETE_TEMPLATE_DIR (RID_SFX_DOC_START+123) #define STR_DOCINFO_INFOFIELD (RID_SFX_DOC_START+124) diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index bbf3ccb33253..bb72e07691b6 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -28,7 +28,7 @@ #include "doc.hrc" #define __RSC #include <svl/inetdef.hxx> -//#include <so3/so2defs.hxx> + // ----------------------------------------------------------------------- QueryBox MSG_CONFIRM_FILTER @@ -64,9 +64,6 @@ String STR_QUERY_SAVE_DOCUMENT Bitmap BMP_STYLES_CLOSED { File = "newex.bmp" ; }; Bitmap BMP_STYLES_OPENED { File = "newex.bmp" ; }; -Bitmap BMP_STYLES_CLOSED_HC { File = "newex_h.bmp" ; }; -Bitmap BMP_STYLES_OPENED_HC { File = "newex_h.bmp" ; }; - String STR_STYLES { Text [ en-US ] = "Styles" ; @@ -92,11 +89,6 @@ Bitmap BMP_STYLES_FAMILY2 { File = "styfam2.bmp" ; }; Bitmap BMP_STYLES_FAMILY3 { File = "styfam3.bmp" ; }; Bitmap BMP_STYLES_FAMILY4 { File = "styfam4.bmp" ; }; -Bitmap BMP_STYLES_FAMILY1_HC { File = "styfam1_h.bmp" ; }; -Bitmap BMP_STYLES_FAMILY2_HC { File = "styfam2_h.bmp" ; }; -Bitmap BMP_STYLES_FAMILY3_HC { File = "styfam3_h.bmp" ; }; -Bitmap BMP_STYLES_FAMILY4_HC { File = "styfam4_h.bmp" ; }; - ErrorBox MSG_PRINT_ERROR { BUTTONS = WB_OK ; @@ -191,8 +183,6 @@ InfoBox MSG_DOCINFO_CANTREAD }; String STR_ERROR_NOSTORAGE { - /* ### ACHTUNG: Neuer Text in Resource? Die ausgew�hlte Datei besitzt ein falsches Format. : Die ausgew�hlte Datei besitzt ein falsches Format. */ - /* ### ACHTUNG: Neuer Text in Resource? Die ausgew�hlte Datei besitzt ein falsches Format. : Die ausgew�hlte Datei besitzt ein falsches Format. */ Text [ en-US ] = "The selected file has an incorrect format." ; }; String STR_QUERY_MUSTOWNFORMAT @@ -221,8 +211,6 @@ String STR_CLOSEDOC }; String STR_CLOSEDOC_ANDRETURN { - /* ### ACHTUNG: Neuer Text in Resource? S~chlie�en & zur�ck zu : S~chlie�en & zur�ck zu */ - /* ### ACHTUNG: Neuer Text in Resource? S~chlie�en & zur�ck zu : S~chlie�en & zur�ck zu */ Text [ en-US ] = "~Close & Return to " ; }; String STR_WIZARD @@ -300,7 +288,7 @@ String STR_FSET_FILTERNAME0 }; String STR_FSET_FILTERNAME1 { - // nur 'Dokument' "ubersetzen - only translate 'Document' + // only translate 'Document' Text [ en-US ] = "%PRODUCTNAME Frame Document" ; }; String STR_TEMPL_MOVED diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 1ef90b67b173..071b4db032e0 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,14 +74,12 @@ DECL_PTRARRAY( SfxViewFactoryArr_Impl, SfxViewFactory*, 2, 2 ) DBG_NAME(SfxObjectFactory) -//static SfxObjectFactoryArr_Impl* pObjFac = 0; - //======================================================================== struct SfxObjectFactory_Impl { - SfxViewFactoryArr_Impl aViewFactoryArr;// Liste von <SfxViewFactory>s - SfxFilterArr_Impl aFilterArr; // Liste von <SFxFilter>n + SfxViewFactoryArr_Impl aViewFactoryArr;// List of <SfxViewFactory>s + SfxFilterArr_Impl aFilterArr; // List of <SFxFilter>n ResId* pNameResId; ::rtl::OUString aServiceName; SfxFilterContainer* pFilterContainer; @@ -149,6 +148,7 @@ SfxObjectFactory::~SfxObjectFactory() for ( sal_uInt16 i = 0; i < nCount; ++i ) delete pImpl->aFilterArr[i]; delete pImpl->pNameResId; + delete pImpl->pFilterContainer; delete pImpl; } @@ -169,7 +169,7 @@ void SfxObjectFactory::RegisterViewFactory ByteString sMessage( "SfxObjectFactory::RegisterViewFactory: duplicate view name '" ); sMessage += ByteString( sViewName, RTL_TEXTENCODING_ASCII_US ); sMessage += "'!"; - OSL_ENSURE( false, sMessage.GetBuffer() ); + OSL_FAIL( sMessage.GetBuffer() ); break; } } @@ -212,16 +212,16 @@ void SfxObjectFactory::SetModule_Impl( SfxModule *pMod ) void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const String& rTemplateName ) { static const int nMaxPathSize = 16000; - static ::rtl::OUString SERVICE_FILTER_FACTORY = ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ); - static ::rtl::OUString SERVICE_TYPE_DECTECTION = ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ); - static ::rtl::OUString SERVICE_SIMPLE_ACCESS = ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ); + static ::rtl::OUString SERVICE_FILTER_FACTORY(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")); + static ::rtl::OUString SERVICE_TYPE_DECTECTION(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")); + static ::rtl::OUString SERVICE_SIMPLE_ACCESS(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")); - static ::rtl::OUString CONF_ROOT = ::rtl::OUString::createFromAscii( "/org.openoffice.Setup"); - static ::rtl::OUString CONF_PATH = ::rtl::OUString::createFromAscii( "Office/Factories/" ) + ::rtl::OUString( rServiceName ); - static ::rtl::OUString PROP_DEF_TEMPL_CHANGED = ::rtl::OUString::createFromAscii( "ooSetupFactorySystemDefaultTemplateChanged" ); - static ::rtl::OUString PROP_ACTUAL_FILTER = ::rtl::OUString::createFromAscii( "ooSetupFactoryActualFilter" ); + static ::rtl::OUString CONF_ROOT(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")); + static ::rtl::OUString CONF_PATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Office/Factories/" )) + ::rtl::OUString( rServiceName ); + static ::rtl::OUString PROP_DEF_TEMPL_CHANGED(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactorySystemDefaultTemplateChanged")); + static ::rtl::OUString PROP_ACTUAL_FILTER(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryActualFilter")); - static ::rtl::OUString DEF_TPL_STR = ::rtl::OUString::createFromAscii("/soffice."); + static ::rtl::OUString DEF_TPL_STR(RTL_CONSTASCII_USTRINGPARAM("/soffice.")); String sURL; String sPath; @@ -253,11 +253,11 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri uno::Sequence< beans::PropertyValue > aActuralFilterData; xFilterFactory->getByName( aActualFilter ) >>= aActuralFilterData; for ( sal_Int32 nInd = 0; nInd < aActuralFilterData.getLength(); nInd++ ) - if ( aActuralFilterData[nInd].Name.equalsAscii( "Type" ) ) + if ( aActuralFilterData[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Type" ) ) ) aActuralFilterData[nInd].Value >>= aActualFilterTypeName; ::comphelper::SequenceAsHashMap aProps1( xTypeDetection->getByName( aActualFilterTypeName ) ); uno::Sequence< ::rtl::OUString > aAllExt = - aProps1.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Extensions" ), uno::Sequence< ::rtl::OUString >() ); + aProps1.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extensions")), uno::Sequence< ::rtl::OUString >() ); //To-do: check if aAllExt is empty first ::rtl::OUString aExt = aAllExt[0]; @@ -269,7 +269,7 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri ::rtl::OUString aBackupURL; ::osl::Security().getConfigDir(aBackupURL); - aBackupURL += ::rtl::OUString::createFromAscii( "/temp" ); + aBackupURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/temp")); if ( !xSimpleFileAccess->exists( aBackupURL ) ) xSimpleFileAccess->createFolder( aBackupURL ); @@ -285,21 +285,21 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri uno::Reference< document::XTypeDetection > xTypeDetector( xTypeDetection, uno::UNO_QUERY ); ::comphelper::SequenceAsHashMap aProps2( xTypeDetection->getByName( xTypeDetector->queryTypeByURL( rTemplateName ) ) ); ::rtl::OUString aFilterName = - aProps2.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() ); + aProps2.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredFilter")), ::rtl::OUString() ); uno::Sequence< beans::PropertyValue > aArgs( 3 ); - aArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); aArgs[0].Value <<= aFilterName; - aArgs[1].Name = ::rtl::OUString::createFromAscii( "AsTemplate" ); + aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); aArgs[1].Value <<= sal_True; - aArgs[2].Name = ::rtl::OUString::createFromAscii( "URL" ); + aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); aArgs[2].Value <<= ::rtl::OUString( rTemplateName ); uno::Reference< frame::XLoadable > xLoadable( xFactory->createInstance( ::rtl::OUString( rServiceName ) ), uno::UNO_QUERY ); xLoadable->load( aArgs ); aArgs.realloc( 2 ); - aArgs[1].Name = ::rtl::OUString::createFromAscii( "Overwrite" ); + aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Overwrite")); aArgs[1].Value <<= sal_True; uno::Reference< frame::XStorable > xStorable( xLoadable, uno::UNO_QUERY ); @@ -317,7 +317,7 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri ::comphelper::ConfigurationHelper::flush( xConfig ); } } - catch( uno::Exception& ) + catch(const uno::Exception&) { } } @@ -348,42 +348,11 @@ String SfxObjectFactory::GetStandardTemplate( const String& rServiceName ) return sTemplate; } -/* -const SfxObjectFactory* SfxObjectFactory::GetFactory( const String& rFactoryURL ) -{ - const SfxObjectFactory* pFactory = 0; - String aFact( rFactoryURL ); - String aPrefix( DEFINE_CONST_UNICODE( "private:factory/" ) ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) - // Aufruf m"oglich mit z.B. "swriter" oder "private:factory/swriter" - aFact.Erase( 0, aPrefix.Len() ); - sal_uInt16 nPos = aFact.Search( '?' ); - - // Etwaige Parameter abschneiden - aFact.Erase( nPos, aFact.Len() ); - - SfxApplication *pApp = SFX_APP(); - - // "swriter4" durch "swriter" ersetzen, zum Vergleichen uppercase verwenden - WildCard aSearchedFac( aFact.EraseAllChars('4').ToUpperAscii() ); - for( sal_uInt16 n = GetObjectFactoryCount_Impl(); !pFactory && n--; ) - { - pFactory = &GetObjectFactory_Impl( n ); - String aCompareTo = String::CreateFromAscii( pFactory->GetShortName() ); - aCompareTo.ToUpperAscii(); - if( !aSearchedFac.Matches( aCompareTo ) ) - pFactory = 0; - } - - return pFactory; -} -*/ - const SfxFilter* SfxObjectFactory::GetTemplateFilter() const { sal_uInt16 nVersion=0; SfxFilterMatcher aMatcher ( String::CreateFromAscii( pShortName ) ); - SfxFilterMatcherIter aIter( &aMatcher ); + SfxFilterMatcherIter aIter( aMatcher ); const SfxFilter *pFilter = 0; const SfxFilter *pTemp = aIter.First(); while ( pTemp ) @@ -402,7 +371,7 @@ const SfxFilter* SfxObjectFactory::GetTemplateFilter() const void SfxObjectFactory::SetDocumentTypeNameResource( const ResId& rId ) { - DBG_ASSERT( !pImpl->pNameResId, "UI-Namensresource mehrfach gesetzt!" ); + DBG_ASSERT( !pImpl->pNameResId, "UI-Name resource set multiple times!" ); pImpl->pNameResId = new ResId( rId ); } @@ -438,8 +407,8 @@ String SfxObjectFactory::GetFactoryURL() const String SfxObjectFactory::GetModuleName() const { - static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); - static ::rtl::OUString PROP_MODULEUINAME = ::rtl::OUString::createFromAscii("ooSetupFactoryUIName"); + static ::rtl::OUString SERVICENAME_MODULEMANAGER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")); + static ::rtl::OUString PROP_MODULEUINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName")); try { @@ -455,9 +424,12 @@ String SfxObjectFactory::GetModuleName() const return String(sModuleName); } catch(const css::uno::RuntimeException&) - { throw; } + { + throw; + } catch(const css::uno::Exception&) - {} + { + } return String(); } @@ -489,3 +461,5 @@ SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rVie } return NULL; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 63b116ef75e8..2a1bc48c0b5e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,9 +72,7 @@ #include <com/sun/star/logging/XSimpleLogRing.hpp> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/beans/PropertyValue.hpp> -#ifndef _COM_SUN_STAR_SECURITY_DOCUMENTSIGNATURESINFORMATION_HPP_ #include <com/sun/star/security/DocumentSignatureInformation.hpp> -#endif #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> #include <tools/zcodec.hxx> #include <tools/cachestr.hxx> @@ -85,9 +84,7 @@ #include <framework/interaction.hxx> #include <unotools/streamhelper.hxx> #include <unotools/localedatawrapper.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <svl/lckbitem.hxx> @@ -147,14 +144,11 @@ using namespace ::com::sun::star::io; #include "openflag.hxx" // SFX_STREAM_READONLY etc. #include "sfx2/sfxresid.hxx" #include <sfx2/appuno.hxx> - -//#include "xmlversion.hxx" +#include "sfxacldetect.hxx" #define MAX_REDIRECT 5 -sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ); - //========================================================== namespace { @@ -422,7 +416,7 @@ void SfxMedium::AddLog( const ::rtl::OUString& aMessage ) if ( aContext.is() ) pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } @@ -481,7 +475,7 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate ) SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) {} } } @@ -506,7 +500,7 @@ util::DateTime SfxMedium::GetInitFileDate( sal_Bool bIgnoreOldValue ) aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DateModified" )) ) >>= pImp->m_aDateTime; pImp->m_bGotDateTime = sal_True; } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { } } @@ -532,13 +526,13 @@ Reference < XContent > SfxMedium::GetContent() const { pImp->aContent = ::ucbhelper::Content( xContent, xEnv ); } - catch ( Exception& ) + catch ( const Exception& ) { } } else { - // TODO: DBG_ERROR("SfxMedium::GetContent()\nCreate Content? This code exists as fallback only. Please clarify, why its used."); + // TODO: OSL_FAIL("SfxMedium::GetContent()\nCreate Content? This code exists as fallback only. Please clarify, why its used."); String aURL; if ( aName.Len() ) ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ); @@ -566,7 +560,7 @@ Reference < XContent > SfxMedium::GetContent() const Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI" )) ); aAny >>= aBaseURL; } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { } @@ -693,8 +687,6 @@ sal_Bool SfxMedium::CloseOutStream_Impl() //maybe we need a new flag when the storage was created from the outstream if ( pImp->xStorage.is() ) { - //const SvStream *pStorage = aStorage->GetSvStream(); - //if ( pStorage == pOutStream ) CloseStorage(); } @@ -777,7 +769,7 @@ sal_Bool SfxMedium::IsStorage() String aURL; if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ) ) { - DBG_ERROR("Physical name not convertable!"); + OSL_FAIL("Physical name not convertable!"); } pImp->bIsStorage = SotStorage::IsStorageFile( aURL ) && !SotStorage::IsOLEStorage( aURL); if ( !pImp->bIsStorage ) @@ -898,9 +890,9 @@ void SfxMedium::SetEncryptionDataToStorage_Impl() { ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( pImp->xStorage, aEncryptionData ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - OSL_ENSURE( sal_False, "It must be possible to set a common password for the storage" ); + OSL_FAIL( "It must be possible to set a common password for the storage" ); // TODO/LATER: set the error code in case of problem // SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } @@ -1017,135 +1009,164 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri return nResult; } +namespace +{ + bool isSuitableProtocolForLocking(const String & rLogicName) + { + INetURLObject aUrl( rLogicName ); + INetProtocol eProt = aUrl.GetProtocol(); + return eProt == INET_PROT_FILE || eProt == INET_PROT_SFTP; + } +} + //------------------------------------------------------------------ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) { // returns true if the document can be opened for editing ( even if it should be a copy ) // otherwise the document should be opened readonly // if user cancel the loading the ERROR_ABORT is set + sal_Bool bResult = sal_False; - if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + if ( !GetURLObject().HasError() ) try { - // if the document is already locked the system locking might be temporarely off after storing - // check whether the system file locking should be taken again - GetLockingStream_Impl(); - } - - sal_Bool bResult = pImp->m_bLocked; + if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + // if the document is already locked the system locking might be temporarely off after storing + // check whether the system file locking should be taken again + GetLockingStream_Impl(); + } - if ( !bResult ) - { - // no read-write access is necessary on loading if the document is explicitly opened as copy - SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); - } + bResult = pImp->m_bLocked; - if ( !bResult && !IsReadOnly() ) - { - sal_Bool bContentReadonly = sal_False; - if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + if ( !bResult ) { - // let the original document be opened to check the possibility to open it for editing - // and to let the writable stream stay open to hold the lock on the document - GetLockingStream_Impl(); + // no read-write access is necessary on loading if the document is explicitly opened as copy + SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); + bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); } - // "IsReadOnly" property does not allow to detect whether the file is readonly always - // so we try always to open the file for editing - // the file is readonly only in case the read-write stream can not be opened - if ( bLoading && !pImp->m_xLockingStream.is() ) + if ( !bResult && !IsReadOnly() ) { - try + sal_Bool bContentReadonly = sal_False; + if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) { - // MediaDescriptor does this check also, the duplication should be avoided in future - Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly; + // let the original document be opened to check the possibility to open it for editing + // and to let the writable stream stay open to hold the lock on the document + GetLockingStream_Impl(); } - catch( uno::Exception ) - {} - if ( !bContentReadonly ) + // "IsReadOnly" property does not allow to detect whether the file is readonly always + // so we try always to open the file for editing + // the file is readonly only in case the read-write stream can not be opened + if ( bLoading && !pImp->m_xLockingStream.is() ) { - // the file is not readonly, check the ACL + try + { + // MediaDescriptor does this check also, the duplication should be avoided in future + Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly; + } + catch( const uno::Exception& ) + {} + +#if EXTRA_ACL_CHECK + // This block was introduced as a fix to i#102464, but removing + // this does not make the problem re-appear. But leaving this + // part would interfere with documents saved in samba share. This + // affects Windows only. + if ( !bContentReadonly ) + { + // the file is not readonly, check the ACL - String aPhysPath; - if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) - bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); + String aPhysPath; + if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) + bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); + } +#endif } - } - // do further checks only if the file not readonly in fs - if ( !bContentReadonly ) - { - // the special file locking should be used only for file URLs - if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) + // do further checks only if the file not readonly in fs + if ( !bContentReadonly ) { - - // in case of storing the document should request the output before locking - if ( bLoading ) + // the special file locking should be used only for suitable URLs + if ( isSuitableProtocolForLocking( aLogicName ) ) { - // let the stream be opened to check the system file locking - GetMedium_Impl(); - } - sal_Int8 bUIStatus = LOCK_UI_NOLOCK; + // in case of storing the document should request the output before locking + if ( bLoading ) + { + // let the stream be opened to check the system file locking + GetMedium_Impl(); + } - // check whether system file locking has been used, the default value is false - sal_Bool bUseSystemLock = IsSystemFileLockingUsed(); + sal_Int8 bUIStatus = LOCK_UI_NOLOCK; - // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem - // if system lock is used the writeable stream should be available - sal_Bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream ); + // check whether system file locking has been used, the default value is false + sal_Bool bUseSystemLock = ::utl::LocalFileHelper::IsLocalFile( aLogicName ) && IsSystemFileLockingUsed(); - do - { - try + // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem + // if system lock is used the writeable stream should be available + sal_Bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream ); + + do { - ::svt::DocumentLockFile aLockFile( aLogicName ); - if ( !bHandleSysLocked ) + try { - try - { - bResult = aLockFile.CreateOwnLockFile(); - } - catch ( ucb::InteractiveIOException& e ) + ::svt::DocumentLockFile aLockFile( aLogicName ); + if ( !bHandleSysLocked ) { - // exception means that the lock file can not be successfuly accessed - // in this case it should be ignored if system file locking is anyway active - if ( bUseSystemLock || !IsOOoLockFileUsed() ) + try { - bResult = sal_True; - // take the ownership over the lock file - aLockFile.OverwriteOwnLockFile(); + bResult = aLockFile.CreateOwnLockFile(); } - else if ( e.Code == IOErrorCode_INVALID_PARAMETER ) + catch ( const ucb::InteractiveIOException& e ) { - // system file locking is not active, ask user whether he wants to open the document without any locking - uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - - if ( xHandler.is() ) + // exception means that the lock file can not be successfuly accessed + // in this case it should be ignored if system file locking is anyway active + if ( bUseSystemLock || !IsOOoLockFileUsed() ) + { + bResult = sal_True; + // take the ownership over the lock file + aLockFile.OverwriteOwnLockFile(); + } + else if ( e.Code == IOErrorCode_INVALID_PARAMETER ) { - ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl - = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); + // system file locking is not active, ask user whether he wants to open the document without any locking + uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); - xIgnoreRequestImpl->setContinuations( aContinuations ); + if ( xHandler.is() ) + { + ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl + = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); - xHandler->handle( xIgnoreRequestImpl.get() ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); + aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); + aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); + xIgnoreRequestImpl->setContinuations( aContinuations ); - ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); - bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + xHandler->handle( xIgnoreRequestImpl.get() ); + + ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); + bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + } } } - } - catch ( uno::Exception& ) - { - // exception means that the lock file can not be successfuly accessed - // in this case it should be ignored if system file locking is anyway active - if ( bUseSystemLock || !IsOOoLockFileUsed() ) + catch ( const uno::Exception& ) + { + // exception means that the lock file can not be successfuly accessed + // in this case it should be ignored if system file locking is anyway active + if ( bUseSystemLock || !IsOOoLockFileUsed() ) + { + bResult = sal_True; + // take the ownership over the lock file + aLockFile.OverwriteOwnLockFile(); + } + } + + // in case OOo locking is turned off the lock file is still written if possible + // but it is ignored while deciding whether the document should be opened for editing or not + if ( !bResult && !IsOOoLockFileUsed() ) { bResult = sal_True; // take the ownership over the lock file @@ -1153,89 +1174,85 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) } } - // in case OOo locking is turned off the lock file is still written if possible - // but it is ignored while deciding whether the document should be opened for editing or not - if ( !bResult && !IsOOoLockFileUsed() ) - { - bResult = sal_True; - // take the ownership over the lock file - aLockFile.OverwriteOwnLockFile(); - } - } - - if ( !bResult ) - { - uno::Sequence< ::rtl::OUString > aData; - try + if ( !bResult ) { - // impossibility to get data is no real problem - aData = aLockFile.GetLockData(); - } - catch( uno::Exception ) {} + uno::Sequence< ::rtl::OUString > aData; + try + { + // impossibility to get data is no real problem + aData = aLockFile.GetLockData(); + } + catch( const uno::Exception& ) + { + } - sal_Bool bOwnLock = sal_False; + sal_Bool bOwnLock = sal_False; - if ( !bHandleSysLocked ) - { - uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); - bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID - && aOwnData.getLength() > LOCKFILE_USERURL_ID - && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); - - if ( bOwnLock - && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) - && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + if ( !bHandleSysLocked ) { - // this is own lock from the same installation, it could remain because of crash - bResult = sal_True; + uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); + bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID + && aOwnData.getLength() > LOCKFILE_USERURL_ID + && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); + + if ( bOwnLock + && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) + && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + { + // this is own lock from the same installation, it could remain because of crash + bResult = sal_True; + } } - } - if ( !bResult && !bNoUI ) - { - bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); - if ( bUIStatus == LOCK_UI_SUCCEEDED ) + if ( !bResult && !bNoUI ) { - // take the ownership over the lock file - bResult = aLockFile.OverwriteOwnLockFile(); + bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); + if ( bUIStatus == LOCK_UI_SUCCEEDED ) + { + // take the ownership over the lock file + bResult = aLockFile.OverwriteOwnLockFile(); + } } - } - bHandleSysLocked = sal_False; + bHandleSysLocked = sal_False; + } } - } - catch( uno::Exception& ) - { - } - } while( !bResult && bUIStatus == LOCK_UI_TRY ); + catch( const uno::Exception& ) + { + } + } while( !bResult && bUIStatus == LOCK_UI_TRY ); - pImp->m_bLocked = bResult; - } - else - { - // this is no file URL, check whether the file is readonly - bResult = !bContentReadonly; + pImp->m_bLocked = bResult; + } + else + { + // this is no file URL, check whether the file is readonly + bResult = !bContentReadonly; + } } } - } - if ( !bResult && GetError() == ERRCODE_NONE ) - { - // the error should be set in case it is storing process - // or the document has been opened for editing explicitly + if ( !bResult && GetError() == ERRCODE_NONE ) + { + // the error should be set in case it is storing process + // or the document has been opened for editing explicitly SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, sal_False ); - if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) - SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - else - GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); - } - - // when the file is locked, get the current file date - if ( bResult && DocNeedsFileDateCheck() ) - GetInitFileDate( sal_True ); + if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) + SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); + else + GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); + } + // when the file is locked, get the current file date + if ( bResult && DocNeedsFileDateCheck() ) + GetInitFileDate( sal_True ); + } + catch( const uno::Exception& ) + { + OSL_FAIL( "Unexpected problem by locking, high probability, that the content could not be created" ); + } return bResult; } @@ -1275,9 +1292,9 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf new utl::ProgressHandlerWrap( xStatusIndicator ) ); uno::Sequence< beans::PropertyValue > aAddProps( 2 ); - aAddProps[0].Name = ::rtl::OUString::createFromAscii( "RepairPackage" ); + aAddProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")); aAddProps[0].Value <<= (sal_Bool)sal_True; - aAddProps[1].Name = ::rtl::OUString::createFromAscii( "StatusIndicator" ); + aAddProps[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator")); aAddProps[1].Value <<= xProgressHandler; // the first arguments will be filled later @@ -1313,7 +1330,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ), uno::UNO_QUERY ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { // impossibility to create the storage is no error } @@ -1340,13 +1357,13 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf sal_Bool bResetStorage = sal_False; if ( pVersion && pVersion->GetValue() ) { - // Alle verf"ugbaren Versionen einlesen + // Read all available versions if ( pImp->aVersions.getLength() ) { - // 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 + // Search for the version fits the comment + // The versions are numbered startign with 1, versions with + // negative versions numbers are counted backwards from the + // current version short nVersion = pVersion ? pVersion->GetValue() : 0; if ( nVersion<0 ) nVersion = ( (short) pImp->aVersions.getLength() ) + nVersion; @@ -1355,18 +1372,18 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf util::RevisionTag& rTag = pImp->aVersions[nVersion]; { - // SubStorage f"ur alle Versionen "offnen + // Open SubStorage for all versions uno::Reference < embed::XStorage > xSub = pImp->xStorage->openStorageElement( DEFINE_CONST_UNICODE( "Versions" ), embed::ElementModes::READ ); - DBG_ASSERT( xSub.is(), "Versionsliste, aber keine Versionen!" ); + DBG_ASSERT( xSub.is(), "Version list, but no Versions!" ); - // Dort ist die Version als gepackter Stream gespeichert + // There the version is stored as packed Stream uno::Reference < io::XStream > xStr = xSub->openStreamElement( rTag.Identifier, embed::ElementModes::READ ); SvStream* pStream = utl::UcbStreamHelper::CreateStream( xStr ); if ( pStream && pStream->GetError() == SVSTREAM_OK ) { - // Stream ins TempDir auspacken + // Unpack Stream in TempDir ::utl::TempFile aTempFile; String aTmpName = aTempFile.GetURL(); SvFileStream aTmpStream( aTmpName, SFX_STREAM_READWRITE ); @@ -1374,7 +1391,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf *pStream >> aTmpStream; aTmpStream.Close(); - // Datei als Storage "offnen + // Open data as Storage nStorOpenMode = SFX_STREAM_READONLY; pImp->xStorage = comphelper::OStorageHelper::GetStorageFromURL( aTmpName, embed::ElementModes::READ ); pImp->bStorageBasedOnInStream = sal_False; @@ -1411,8 +1428,6 @@ uno::Reference< embed::XStorage > SfxMedium::GetZipStorageToSign_Impl( sal_Bool { if ( !GetError() && !pImp->m_xZipStorage.is() ) { - // very careful!!! - // if bReadOnly == sal_False and there is no temporary file the original file might be used GetMedium_Impl(); try @@ -1428,9 +1443,9 @@ uno::Reference< embed::XStorage > SfxMedium::GetZipStorageToSign_Impl( sal_Bool pImp->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( ZIP_STORAGE_FORMAT_STRING, pImp->xInputStream ); } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - OSL_ENSURE( sal_False, "No possibility to get readonly version of storage from medium!\n" ); + OSL_FAIL( "No possibility to get readonly version of storage from medium!\n" ); } if ( GetError() ) // do not remove warnings @@ -1447,7 +1462,7 @@ void SfxMedium::CloseZipStorage_Impl() { try { pImp->m_xZipStorage->dispose(); - } catch( uno::Exception& ) + } catch( const uno::Exception& ) {} pImp->m_xZipStorage = uno::Reference< embed::XStorage >(); @@ -1465,9 +1480,9 @@ void SfxMedium::CloseStorage() { try { xComp->dispose(); - } catch( uno::Exception& ) + } catch( const uno::Exception& ) { - OSL_ENSURE( sal_False, "Medium's storage is already disposed!\n" ); + OSL_FAIL( "Medium's storage is already disposed!\n" ); } } @@ -1523,7 +1538,7 @@ sal_Bool SfxMedium::UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalCont aOriginalContent.writeStream( aOrigInput, sal_True ); return sal_True; } - catch( Exception& ) + catch( const Exception& ) { // in case of failure here the backup file should not be removed // TODO/LATER: a message should be used to let user know about the backup @@ -1555,7 +1570,7 @@ sal_Bool SfxMedium::StorageCommit_Impl() CloseZipStorage_Impl(); bResult = sal_True; } - catch ( embed::UseBackupException& aBackupExc ) + catch ( const embed::UseBackupException& aBackupExc ) { // since the temporary file is created always now, the scenario is close to be impossible if ( !pImp->pTempFile ) @@ -1582,7 +1597,7 @@ sal_Bool SfxMedium::StorageCommit_Impl() SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { //TODO/LATER: improve error handling SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); @@ -1608,11 +1623,11 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, { aOriginalContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv ); } - catch ( ::com::sun::star::ucb::CommandAbortedException& ) + catch ( const ::com::sun::star::ucb::CommandAbortedException& ) { eError = ERRCODE_ABORT; } - catch ( ::com::sun::star::ucb::CommandFailedException& ) + catch ( const ::com::sun::star::ucb::CommandFailedException& ) { eError = ERRCODE_ABORT; } @@ -1659,7 +1674,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, { Reference< XInputStream > aTempInput = aTempCont.openStream(); bTransactStarted = sal_True; - aOriginalContent.setPropertyValue( ::rtl::OUString::createFromAscii( "Size" ), + aOriginalContent.setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Size")), uno::makeAny( (sal_Int64)0 ) ); aOriginalContent.writeStream( aTempInput, bOverWrite ); bResult = sal_True; @@ -1676,15 +1691,15 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, bResult = sal_True; } } - catch ( ::com::sun::star::ucb::CommandAbortedException& ) + catch ( const ::com::sun::star::ucb::CommandAbortedException& ) { eError = ERRCODE_ABORT; } - catch ( ::com::sun::star::ucb::CommandFailedException& ) + catch ( const ::com::sun::star::ucb::CommandFailedException& ) { eError = ERRCODE_ABORT; } - catch ( ::com::sun::star::ucb::InteractiveIOException& r ) + catch ( const ::com::sun::star::ucb::InteractiveIOException& r ) { if ( r.Code == IOErrorCode_ACCESS_DENIED ) eError = ERRCODE_IO_ACCESSDENIED; @@ -1695,7 +1710,7 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, else eError = ERRCODE_IO_GENERAL; } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { eError = ERRCODE_IO_GENERAL; } @@ -1780,7 +1795,7 @@ sal_Bool SfxMedium::TryDirectTransfer( const ::rtl::OUString& aURL, SfxItemSet& return sal_True; } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } } @@ -1800,7 +1815,7 @@ void SfxMedium::Transfer_Impl() { // makes sence only in case logic name is set if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aNameURL ) ) - OSL_ENSURE( sal_False, "The medium name is not convertable!\n" ); + OSL_FAIL( "The medium name is not convertable!\n" ); } if ( aNameURL.Len() && ( !eError || (eError & ERRCODE_WARNING_MASK) ) ) @@ -1855,13 +1870,13 @@ void SfxMedium::Transfer_Impl() pImp->pTempFile = NULL; } } - catch( Exception& ) + catch( const Exception& ) {} } } else { - DBG_ERROR( "Illegal Output stream parameter!\n" ); + OSL_FAIL( "Illegal Output stream parameter!\n" ); SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } @@ -1903,7 +1918,7 @@ void SfxMedium::Transfer_Impl() xTrans->commit(); } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { //TODO/MBA: error handling } @@ -1987,15 +2002,15 @@ void SfxMedium::Transfer_Impl() if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash )) eError = ERRCODE_IO_GENERAL; } - catch ( ::com::sun::star::ucb::CommandAbortedException& ) + catch ( const ::com::sun::star::ucb::CommandAbortedException& ) { eError = ERRCODE_ABORT; } - catch ( ::com::sun::star::ucb::CommandFailedException& ) + catch ( const ::com::sun::star::ucb::CommandFailedException& ) { eError = ERRCODE_ABORT; } - catch ( ::com::sun::star::ucb::InteractiveIOException& r ) + catch ( const ::com::sun::star::ucb::InteractiveIOException& r ) { if ( r.Code == IOErrorCode_ACCESS_DENIED ) eError = ERRCODE_IO_ACCESSDENIED; @@ -2006,7 +2021,7 @@ void SfxMedium::Transfer_Impl() else eError = ERRCODE_IO_GENERAL; } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { eError = ERRCODE_IO_GENERAL; } @@ -2057,7 +2072,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont pImp->m_bRemoveBackup = sal_True; } } - catch( Exception& ) + catch( const Exception& ) {} } @@ -2144,7 +2159,7 @@ void SfxMedium::DoBackup_Impl() pImp->m_bRemoveBackup = sal_False; } } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { } } @@ -2167,7 +2182,6 @@ void SfxMedium::ClearBackup_Impl() if ( pImp->m_aBackupURL.getLength() ) { if ( ::utl::UCBContentHelper::Kill( pImp->m_aBackupURL ) ) - // || !::utl::UCBContentHelper::IsDocument( pImp->m_aBackupURL ) ); { pImp->m_bRemoveBackup = sal_False; pImp->m_aBackupURL = ::rtl::OUString(); @@ -2175,7 +2189,7 @@ void SfxMedium::ClearBackup_Impl() else { - DBG_ERROR("Couldn't remove backup file!"); + OSL_FAIL("Couldn't remove backup file!"); } } } @@ -2255,7 +2269,7 @@ void SfxMedium::GetMedium_Impl() { if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aFileName ) ) { - DBG_ERROR("Physical name not convertable!"); + OSL_FAIL("Physical name not convertable!"); } } else @@ -2280,8 +2294,6 @@ void SfxMedium::GetMedium_Impl() pImp->xInputStream->skipBytes(0); if(m_bIsReadOnly) GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); - - // m_xInputStreamToLoadFrom = 0; } else { @@ -2346,7 +2358,8 @@ void SfxMedium::GetMedium_Impl() pImp->bDownloadDone = sal_True; pImp->aDoneLink.ClearPendingCall(); - pImp->aDoneLink.Call( (void*) GetError() ); + sal_uIntPtr nError = GetError(); + pImp->aDoneLink.Call( (void*)nError ); } } @@ -2403,10 +2416,10 @@ void SfxMedium::DownLoad( const Link& aLink ) //------------------------------------------------------------------ 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. +/* [Description] + Includes a valid:: sun:: com:: star:: util:: URL (If a file name was + previously in there) in the logical name and if available sets the + physical name as the file name. */ { @@ -2428,7 +2441,7 @@ void SfxMedium::Init_Impl() INetProtocol eProt = aUrl.GetProtocol(); if ( eProt == INET_PROT_NOT_VALID ) { - DBG_ERROR ( "Unknown protocol!" ); + OSL_FAIL( "Unknown protocol!" ); } else { @@ -2463,7 +2476,7 @@ void SfxMedium::Init_Impl() || !aLogicName.CompareToAscii( "private:stream", 14 ) == COMPARE_EQUAL ) ) { pSet->ClearItem( SID_OUTPUTSTREAM ); - DBG_ERROR( "Unexpected Output stream parameter!\n" ); + OSL_FAIL( "Unexpected Output stream parameter!\n" ); } if ( aLogicName.Len() ) @@ -2504,7 +2517,7 @@ SfxMedium::SfxMedium( const SfxMedium& rMedium, sal_Bool bTemporary ) aName = rMedium.aName; pImp->bIsTemp = bTemporary; - DBG_ASSERT( ! rMedium.pImp->bIsTemp, "Temporaeres Medium darf nicht kopiert werden" ); + DBG_ASSERT( ! rMedium.pImp->bIsTemp, "Temporary Medium may not be copied" ); aLogicName = rMedium.aLogicName; pSet = rMedium.GetItemSet() ? new SfxItemSet(*rMedium.GetItemSet()) : 0; pFilter = rMedium.pFilter; @@ -2636,27 +2649,6 @@ void SfxMedium::Close() { if ( pImp->xStorage.is() ) { - // don't close the streams if they belong to the - // storage - //TODO/MBA: how to?! Do we need the flag?! - /* - const SvStream *pStream = aStorage->GetSvStream(); - if ( pStream && pStream == pInStream ) - { - CloseZipStorage_Impl(); - pInStream = NULL; - pImp->xInputStream = Reference < XInputStream >(); - pImp->xLockBytes.Clear(); - if ( pSet ) - pSet->ClearItem( SID_INPUTSTREAM ); - aStorage->SetDeleteStream( sal_True ); - } - else if ( pStream && pStream == pOutStream ) - { - pOutStream = NULL; - aStorage->SetDeleteStream( sal_True ); - } */ - CloseStorage(); } @@ -2669,27 +2661,6 @@ void SfxMedium::CloseAndRelease() { if ( pImp->xStorage.is() ) { - // don't close the streams if they belong to the - // storage - //TODO/MBA: how to?! Do we need the flag?! - /* - const SvStream *pStream = aStorage->GetSvStream(); - if ( pStream && pStream == pInStream ) - { - CloseZipStorage_Impl(); - pInStream = NULL; - pImp->xInputStream = Reference < XInputStream >(); - pImp->xLockBytes.Clear(); - if ( pSet ) - pSet->ClearItem( SID_INPUTSTREAM ); - aStorage->SetDeleteStream( sal_True ); - } - else if ( pStream && pStream == pOutStream ) - { - pOutStream = NULL; - aStorage->SetDeleteStream( sal_True ); - } */ - CloseStorage(); } @@ -2713,7 +2684,7 @@ void SfxMedium::UnlockFile( sal_Bool bReleaseLockStream ) if ( xOutStream.is() ) xOutStream->closeOutput(); } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } @@ -2729,7 +2700,7 @@ void SfxMedium::UnlockFile( sal_Bool bReleaseLockStream ) // TODO/LATER: A warning could be shown in case the file is not the own one aLockFile.RemoveFile(); } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } } @@ -2762,7 +2733,7 @@ void SfxMedium::CloseAndReleaseStreams_Impl() if ( xOutToClose.is() ) xOutToClose->closeOutput(); } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } } @@ -2784,18 +2755,6 @@ void SfxMedium::CloseStreams_Impl() void SfxMedium::RefreshName_Impl() { -#if 0 //(dv) - if ( pImp->aContent.get().is() ) - { - String aNameP = pImp->xAnchor->GetViewURL(); - pImp->aOrigURL = aNameP; - aLogicName = aNameP; - DELETEZ( pURLObj ); - if (aLogicName.Len()) - aLogicName = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); - SetIsRemote_Impl(); - } -#endif //(dv) } void SfxMedium::SetIsRemote_Impl() @@ -2809,7 +2768,6 @@ void SfxMedium::SetIsRemote_Impl() case INET_PROT_POP3: case INET_PROT_NEWS: case INET_PROT_IMAP: -// case INET_PROT_OUT: case INET_PROT_VIM: bRemote = sal_True; break; default: @@ -2817,8 +2775,8 @@ void SfxMedium::SetIsRemote_Impl() break; } - // Da Dateien, die Remote geschrieben werden zur Uebertragung auch - // gelesen werden koennen muessen + // As files that are written to the remote transmission must also be able + // to be read. if( bRemote ) nStorOpenMode |= STREAM_READ; } @@ -2880,7 +2838,7 @@ sal_Bool SfxMedium::IsTemporary() const sal_Bool SfxMedium::Exists( sal_Bool /*bForceSession*/ ) { - DBG_ERROR( "Not implemented!" ); + OSL_FAIL( "Not implemented!" ); return sal_True; } @@ -2967,12 +2925,10 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b aFilterName = pFilterNameItem->GetValue(); pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName ); - sal_Bool bSalvage = sal_False; SFX_ITEMSET_ARG( pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False ); if( pSalvageItem ) { // QUESTION: there is some treatment of Salvage in Init_Impl; align! - bSalvage = sal_True; if ( pSalvageItem->GetValue().Len() ) { // if an URL is provided in SalvageItem that means that the FileName refers to a temporary file @@ -2990,7 +2946,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b } else { - OSL_ENSURE( sal_False, "Can not create a new temporary file for crash recovery!\n" ); + OSL_FAIL( "Can not create a new temporary file for crash recovery!\n" ); } } } @@ -3034,13 +2990,6 @@ SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const Str SfxMedium::~SfxMedium() { - /* 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# - */ - //CancelTransfers(); - // if there is a requirement to clean the backup this is the last possibility to do it ClearBackup_Impl(); @@ -3053,12 +3002,12 @@ SfxMedium::~SfxMedium() String aTemp; if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aTemp )) { - DBG_ERROR("Physical name not convertable!"); + OSL_FAIL("Physical name not convertable!"); } if ( !::utl::UCBContentHelper::Kill( aTemp ) ) { - DBG_ERROR("Couldn't remove temporary file!"); + OSL_FAIL("Couldn't remove temporary file!"); } } @@ -3095,39 +3044,6 @@ const String& SfxMedium::GetPreRedirectedURL() const { return pImp->aPreRedirectionURL; } -//---------------------------------------------------------------- - -sal_uInt32 SfxMedium::GetMIMEAndRedirect( String& /*rName*/ ) -{ -/* 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 = sal_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; -*/ - return 0; -} //---------------------------------------------------------------- @@ -3207,13 +3123,13 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl() try { - Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ); + Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) ); ::rtl::OUString aContentType; aAny >>= aContentType; - pImp->xAttributes->Append( SvKeyValue( ::rtl::OUString::createFromAscii( "content-type" ), aContentType ) ); + pImp->xAttributes->Append( SvKeyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content-type")), aContentType ) ); } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { } } @@ -3247,14 +3163,14 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR ( aName.Len() || aLogicName.Len() ) && GetStorage().is() ) { uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")) ), uno::UNO_QUERY ); if ( xReader.is() ) { try { pImp->aVersions = xReader->load( GetStorage() ); } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } } @@ -3269,14 +3185,14 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR uno::Sequence < util::RevisionTag > SfxMedium::GetVersionList( const uno::Reference < embed::XStorage >& xStorage ) { uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")) ), uno::UNO_QUERY ); if ( xReader.is() ) { try { return xReader->load( xStorage ); } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } } @@ -3288,7 +3204,7 @@ sal_uInt16 SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision ) { if ( GetStorage().is() ) { - // Einen eindeutigen Namen f"ur den Stream ermitteln + // To determine a unique name for the stream SvULongs aLongs; sal_Int32 nLength = pImp->aVersions.getLength(); for ( sal_Int32 m=0; m<nLength; m++ ) @@ -3357,7 +3273,7 @@ sal_Bool SfxMedium::SaveVersionList_Impl( sal_Bool /*bUseXML*/ ) return sal_True; uno::Reference < document::XDocumentRevisionListPersistence > xWriter( comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentRevisionListPersistence") ), uno::UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")) ), uno::UNO_QUERY ); if ( xWriter.is() ) { try @@ -3365,7 +3281,7 @@ sal_Bool SfxMedium::SaveVersionList_Impl( sal_Bool /*bUseXML*/ ) xWriter->store( GetStorage(), pImp->aVersions ); return sal_True; } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } } @@ -3410,17 +3326,17 @@ sal_Bool SfxMedium::SetWritableForUserOnly( const ::rtl::OUString& aURL ) ::osl::DirectoryItem aDirItem; if ( ::osl::DirectoryItem::get( aURL, aDirItem ) == ::osl::FileBase::E_None ) { - ::osl::FileStatus aFileStatus( FileStatusMask_Attributes ); + ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_Attributes ); if ( aDirItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None - && aFileStatus.isValid( FileStatusMask_Attributes ) ) + && aFileStatus.isValid( osl_FileStatus_Mask_Attributes ) ) { sal_uInt64 nAttributes = aFileStatus.getAttributes(); - nAttributes &= ~(Attribute_OwnWrite | - Attribute_GrpWrite | - Attribute_OthWrite | - Attribute_ReadOnly); - nAttributes |= Attribute_OwnWrite; + nAttributes &= ~(osl_File_Attribute_OwnWrite | + osl_File_Attribute_GrpWrite | + osl_File_Attribute_OthWrite | + osl_File_Attribute_ReadOnly); + nAttributes |= osl_File_Attribute_OwnWrite; bResult = ( osl::File::setAttributes( aURL, nAttributes ) == ::osl::FileBase::E_None ); } @@ -3478,7 +3394,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace ) } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} if ( bTransferSuccess ) @@ -3563,7 +3479,7 @@ void SfxMedium::CreateTempFileNoCopy() try { - Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ); + Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) ); ::rtl::OUString aField; aAny >>= aField; @@ -3578,7 +3494,7 @@ void SfxMedium::CreateTempFileNoCopy() pImp->aCharset = pCharset->m_sValue; } } - catch ( ::com::sun::star::uno::Exception& ) + catch ( const ::com::sun::star::uno::Exception& ) { } } @@ -3681,9 +3597,9 @@ sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl:: } } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { - OSL_ENSURE( sal_False, "Couldn't use signing functionality!\n" ); + OSL_FAIL( "Couldn't use signing functionality!\n" ); } CloseAndRelease(); @@ -3697,9 +3613,9 @@ sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl:: else xSigner->showDocumentContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - OSL_ENSURE( sal_False, "Couldn't use signing functionality!\n" ); + OSL_FAIL( "Couldn't use signing functionality!\n" ); } } } @@ -3765,7 +3681,7 @@ sal_Bool SfxMedium::IsOpen() const aResult = aNewTempFileURL; } } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } } @@ -3852,7 +3768,7 @@ sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteraction pImp->xStorage = xStorage; aResult = aNewURL; } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } @@ -3914,7 +3830,7 @@ sal_Bool SfxMedium::SwitchDocumentToFile( ::rtl::OUString aURL ) pImp->xStorage = xStorage; bResult = sal_True; } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } @@ -3932,3 +3848,4 @@ sal_Bool SfxMedium::SwitchDocumentToFile( ::rtl::OUString aURL ) return bResult; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 516f6c549b4b..3b82bb5bec59 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,11 +32,10 @@ // 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 +#include <string> #include <sot/exchange.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -196,7 +196,7 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com: if ( xProps.is() ) { ::rtl::OUString aMediaType; - xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ) >>= aMediaType; + xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) ) >>= aMediaType; if ( aMediaType.getLength() ) { ::com::sun::star::datatransfer::DataFlavor aDataFlavor; @@ -249,3 +249,5 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com: return aRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index bd23bf5659d0..2f5995c4dbde 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,6 +35,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XCompatWriterDocProperties.hpp> #include <com/sun/star/uno/Exception.hpp> #include <rtl/ustring.hxx> @@ -43,7 +45,6 @@ #include <vcl/gdimtf.hxx> #include "oleprops.hxx" - // ============================================================================ // stream names @@ -172,6 +173,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet( } } + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY ); + if ( xWriterProps.is() ) + { + SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN ); + if ( xBuiltin.get() ) + { + try + { + String aStrValue; + if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) ) + xWriterProps->setManager( aStrValue ); + if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) ) + xWriterProps->setCategory( aStrValue ); + if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) ) + xWriterProps->setCompany( aStrValue ); + } + catch ( uno::Exception& ) + { + } + } + } + // return code return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError; } @@ -239,7 +262,7 @@ bool SFX2_DLLPUBLIC SaveOlePropertySet( const sal_Int32 nPropId = rCustomSect.GetFreePropertyId(); rCustomSect.SetBlobValue( nPropId, *i_pGuid ); rCustomSect.SetPropertyName( nPropId, - ::rtl::OUString::createFromAscii("_PID_GUID") ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_PID_GUID")) ); } // write hyperlinks @@ -247,7 +270,7 @@ bool SFX2_DLLPUBLIC SaveOlePropertySet( const sal_Int32 nPropId = rCustomSect.GetFreePropertyId(); rCustomSect.SetBlobValue( nPropId, *i_pHyperlinks ); rCustomSect.SetPropertyName( nPropId, - ::rtl::OUString::createFromAscii("_PID_HLINKS") ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_PID_HLINKS")) ); } uno::Reference<beans::XPropertySet> xUserDefinedProps( @@ -291,7 +314,6 @@ uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile(GDIMetaFile* i_pThumb) // magic value 160 taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() if( i_pThumb->CreateThumbnail( 160, aBitmap ) ) { aBitmap.GetBitmap().Write( aStream, sal_False, sal_False ); -// uno::Sequence<sal_uInt8> aSeq(aStream.GetSize()); // WRONG aStream.Seek(STREAM_SEEK_TO_END); uno::Sequence<sal_uInt8> aSeq(aStream.Tell()); const sal_uInt8* pBlob( @@ -307,3 +329,4 @@ uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile(GDIMetaFile* i_pThumb) } // namespace sfx2 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index e03f18691a09..6765c222fd22 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -161,7 +162,7 @@ SfxMediumList* DocumentInserter::CreateMediumList() DELETEZ( pMedium ); if( pMedium && CheckPasswd_Impl( 0, SFX_APP()->GetPool(), pMedium ) != ERRCODE_ABORT ) - pMediumList->Insert( pMedium ); + pMediumList->push_back( pMedium ); else delete pMedium; } @@ -234,7 +235,7 @@ IMPL_LINK( DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, EMPTYARG } } } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } if ( SFXWB_EXPORT == ( m_nDlgFlags & SFXWB_EXPORT ) ) @@ -246,9 +247,9 @@ IMPL_LINK( DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, EMPTYARG if ( aValue >>= bSelection ) m_pItemSet->Put( SfxBoolItem( SID_SELECTION, bSelection ) ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); + OSL_FAIL( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); } } @@ -267,9 +268,9 @@ IMPL_LINK( DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, EMPTYARG if ( ( aValue >>= bReadOnly ) && bReadOnly ) m_pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, bReadOnly ) ); } - catch( IllegalArgumentException ) + catch( const IllegalArgumentException& ) { - DBG_ERROR( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); + OSL_FAIL( "FileDialogHelper_Impl::execute: caught an IllegalArgumentException!" ); } } } @@ -285,7 +286,7 @@ IMPL_LINK( DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, EMPTYARG // open a special version; 0 == current version m_pItemSet->Put( SfxInt16Item( SID_VERSION, (short)nVersion ) ); } - catch( IllegalArgumentException ){} + catch( const IllegalArgumentException& ){} } } @@ -303,3 +304,4 @@ IMPL_LINK( DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, EMPTYARG // ======================================================================= +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 249ebbaf02ab..9ac9fdf64c78 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,6 +39,8 @@ #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> +#include <com/sun/star/script/XLibraryQueryExecutable.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> @@ -73,8 +76,11 @@ namespace sfx2 using ::com::sun::star::document::XEmbeddedScripts; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::script::XLibraryContainer; + using ::com::sun::star::script::XLibraryQueryExecutable; + using ::com::sun::star::script::vba::XVBACompatibility; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_QUERY; /** === end UNO using === **/ namespace MacroExecMode = ::com::sun::star::document::MacroExecMode; @@ -205,7 +211,7 @@ namespace sfx2 nMacroExecutionMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; break; default: - OSL_ENSURE( sal_False, "DocumentMacroMode::adjustMacroMode: unexpected macro security level!" ); + OSL_FAIL( "DocumentMacroMode::adjustMacroMode: unexpected macro security level!" ); nMacroExecutionMode = MacroExecMode::NEVER_EXECUTE; } @@ -289,7 +295,7 @@ namespace sfx2 return disallowMacroExecution(); } } - catch ( Exception& ) + catch ( const Exception& ) { if ( ( nMacroExecutionMode == MacroExecMode::FROM_LIST_NO_WARN ) || ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN ) @@ -336,6 +342,8 @@ namespace sfx2 if ( xScripts.is() ) xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW ); + Reference< XVBACompatibility > xDocVBAMode( xContainer, UNO_QUERY ); + sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatibilityMode() ); if ( xContainer.is() ) { // a library container exists; check if it's empty @@ -348,25 +356,47 @@ namespace sfx2 { ::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); Sequence< ::rtl::OUString > aElements = xContainer->getElementNames(); - if ( aElements.getLength() ) + sal_Int32 nElementCount = aElements.getLength(); + if ( nElementCount ) { - if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) ) + // old check, if more than 1 library or the first library isn't the expected 'Standard' + // trigger the security 'nag' dialog + if ( !bIsVBAMode && ( nElementCount > 1 || !aElements[0].equals( aStdLibName ) ) ) bHasMacroLib = sal_True; else { - // usually a "Standard" library is always present (design) - // for this reason we must check if it's empty - // - // Note: Since #i73229#, this is not true anymore. There's no default - // "Standard" lib anymore. Wouldn't it be time to get completely - // rid of the "Standard" thingie - this shouldn't be necessary - // anymore, should it? - // 2007-01-25 / frank.schoenheit@sun.com - Reference < XNameAccess > xLib; - Any aAny = xContainer->getByName( aStdLibName ); - aAny >>= xLib; + // other wise just check all libraries for executeable code + Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY ); if ( xLib.is() ) - bHasMacroLib = xLib->hasElements(); + { + const ::rtl::OUString* pElementName = aElements.getConstArray(); + for ( sal_Int32 index = 0; index < nElementCount; ++index ) + { + bHasMacroLib = xLib->HasExecutableCode( pElementName[index] ); + if ( bHasMacroLib ) + break; + } + } + } + } + } + } + if ( bIsVBAMode && !bHasMacroLib && xScripts.is() ) + { + Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY ); + if ( xDlgContainer.is() && xDlgContainer->hasElements() ) + { + Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames(); + sal_Int32 nElementCount = aElements.getLength(); + const ::rtl::OUString* pElementName = aElements.getConstArray(); + for ( sal_Int32 index = 0; index < nElementCount; ++index ) + { + Reference< XNameAccess > xNameAccess; + xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess; + if ( xNameAccess.is() && xNameAccess->hasElements() ) + { + bHasMacroLib = sal_True; + break; } } } @@ -434,3 +464,5 @@ namespace sfx2 //........................................................................ } // namespace sfx2 //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docstoragemodifylistener.cxx b/sfx2/source/doc/docstoragemodifylistener.cxx index 625aff0031fc..847cb15c2082 100644 --- a/sfx2/source/doc/docstoragemodifylistener.cxx +++ b/sfx2/source/doc/docstoragemodifylistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_sfx2.hxx" #include "sfx2/docstoragemodifylistener.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> /** === begin UNO includes === **/ /** === end UNO includes === **/ @@ -56,7 +57,7 @@ namespace sfx2 //= //==================================================================== //-------------------------------------------------------------------- - DocumentStorageModifyListener::DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::vos::IMutex& _rMutex ) + DocumentStorageModifyListener::DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex ) :m_pDocument( &_rDocument ) ,m_rMutex( _rMutex ) { @@ -70,14 +71,14 @@ namespace sfx2 //-------------------------------------------------------------------- void DocumentStorageModifyListener::dispose() { - ::vos::OGuard aGuard( m_rMutex ); + ::osl::SolarGuard aGuard( m_rMutex ); m_pDocument = NULL; } //-------------------------------------------------------------------- void SAL_CALL DocumentStorageModifyListener::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException) { - ::vos::OGuard aGuard( m_rMutex ); + ::osl::SolarGuard aGuard( m_rMutex ); // storageIsModified must not contain any locking! if ( m_pDocument ) m_pDocument->storageIsModified(); @@ -94,3 +95,5 @@ namespace sfx2 //........................................................................ } // namespace sfx2 //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctdlg.cxx b/sfx2/source/doc/doctdlg.cxx index 7a3c4a66f443..222cfaf328e7 100644 --- a/sfx2/source/doc/doctdlg.cxx +++ b/sfx2/source/doc/doctdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <svl/stritem.hxx> -#ifndef GCC -#endif #include <sfx2/doctdlg.hxx> #include "docvor.hxx" @@ -162,7 +159,7 @@ IMPL_LINK( SfxDocumentTemplateDlg, OrganizeHdl, Button *, pButton ) IMPL_LINK( SfxDocumentTemplateDlg, OkHdl, Control *, pControl ) { (void)pControl; //unused - // pruefen, ob eine Vorlage diesen Namens existiert + // Test whether a template with this name exists if(LISTBOX_ENTRY_NOTFOUND != aTemplateLb.GetEntryPos( GetTemplateName())) { QueryBox aQuery(this, SfxResId(MSG_CONFIRM_OVERWRITE_TEMPLATE)); @@ -236,3 +233,4 @@ void SfxDocumentTemplateDlg::NewTemplate(const String &rPath) aRegionLb.GetSelectEntryPos(), GetTemplateName(), rPath); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctdlg.hrc b/sfx2/source/doc/doctdlg.hrc index 8deed4699f3b..8deed4699f3b 100644..100755 --- a/sfx2/source/doc/doctdlg.hrc +++ b/sfx2/source/doc/doctdlg.hrc diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 5b9b03f4b673..d28d0e6c5c72 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,12 +31,10 @@ #include <limits.h> #include <com/sun/star/uno/Any.h> -#include <vos/mutex.hxx> -#include <vos/thread.hxx> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> -#ifndef _SV_RESARY_HXX #include <tools/resary.hxx> -#endif #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <unotools/localedatawrapper.hxx> @@ -102,6 +101,10 @@ using namespace ::ucbhelper; #include <comphelper/storagehelper.hxx> #include <unotools/ucbhelper.hxx> +#include <vector> +using ::std::vector; +using ::std::advance; + //======================================================================== // #define DONT_USE_HIERARCHY @@ -122,8 +125,6 @@ using namespace ::ucbhelper; #define SERVICENAME_TYPEDETECTION "com.sun.star.document.TypeDetection" #define TYPEDETECTION_PARAMETER "FileName" -//#define SERVICENAME_OLD_TYPEDETECTION "com.sun.star.frame.FrameLoaderFactory" -//#define PARAMETER_OLD_TYPEDETECTION "DeepDetection" #define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties" #define SERVICENAME_DOCTEMPLATES "com.sun.star.frame.DocumentTemplates" #define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop" @@ -177,15 +178,14 @@ using namespace ::DocTempl; class RegionData_Impl { - DECLARE_LIST( EntryList_Impl, DocTempl_EntryData_Impl* ) const SfxDocTemplate_Impl* mpParent; - EntryList_Impl maEntries; + vector< DocTempl_EntryData_Impl* > maEntries; OUString maTitle; OUString maOwnURL; OUString maTargetURL; private: - long GetEntryPos( const OUString& rTitle, + size_t GetEntryPos( const OUString& rTitle, sal_Bool& rFound ) const; const SfxDocTemplate_Impl* GetParent() const { return mpParent; } @@ -197,7 +197,7 @@ public: void SetTargetURL( const OUString& rURL ) { maTargetURL = rURL; } void SetHierarchyURL( const OUString& rURL) { maOwnURL = rURL; } - DocTempl_EntryData_Impl* GetEntry( sal_uIntPtr nIndex ) const; + DocTempl_EntryData_Impl* GetEntry( size_t nIndex ) const; DocTempl_EntryData_Impl* GetEntry( const OUString& rName ) const; DocTempl_EntryData_Impl* GetByTargetURL( const OUString& rName ) const; @@ -205,21 +205,21 @@ public: const OUString& GetTargetURL(); const OUString& GetHierarchyURL(); - sal_uIntPtr GetCount() const; + size_t GetCount() const; void SetTitle( const OUString& rTitle ) { maTitle = rTitle; } void AddEntry( const OUString& rTitle, const OUString& rTargetURL, - sal_uInt16 *pPos = NULL ); - void DeleteEntry( sal_uIntPtr nIndex ); + size_t *pPos = NULL ); + void DeleteEntry( size_t nIndex ); int Compare( const OUString& rTitle ) const { return maTitle.compareTo( rTitle ); } int Compare( RegionData_Impl* pCompareWith ) const; }; -DECLARE_LIST( RegionList_Impl, RegionData_Impl* ) +typedef vector< RegionData_Impl* > RegionList_Impl; // ------------------------------------------------------------------------ @@ -258,21 +258,20 @@ public: void Rescan(); - void DeleteRegion( sal_uIntPtr nIndex ); + void DeleteRegion( size_t nIndex ); - sal_uIntPtr GetRegionCount() const - { return maRegions.Count(); } + size_t GetRegionCount() const + { return maRegions.size(); } RegionData_Impl* GetRegion( const OUString& rName ) const; - RegionData_Impl* GetRegion( sal_uIntPtr nIndex ) const; + RegionData_Impl* GetRegion( size_t nIndex ) const; void GetTemplates( Content& rTargetFolder, Content& rParentFolder, RegionData_Impl* pRegion ); - long GetRegionPos( const OUString& rTitle, - sal_Bool& rFound ) const; + size_t GetRegionPos( const OUString& rTitle, sal_Bool& rFound ) const; sal_Bool GetTitleFromURL( const OUString& rURL, OUString& aTitle ); - sal_Bool InsertRegion( RegionData_Impl *pData, sal_uIntPtr nPos = LIST_APPEND ); + sal_Bool InsertRegion( RegionData_Impl *pData, size_t nPos = size_t(-1) ); OUString GetRootURL() const { return maRootURL; } uno::Reference< XDocumentTemplates > getDocTemplates() { return mxTemplates; } @@ -316,20 +315,17 @@ static sal_Bool getTextProperty_Impl( Content& rContent, OUString& rPropValue ); //======================================================================== -//======================================================================== -//======================================================================== String SfxDocumentTemplates::GetFullRegionName ( - sal_uInt16 nIdx // Index des Bereiches + sal_uInt16 nIdx // Region Index ) const -/* [Beschreibung] +/* [Description] - Liefert den logischen Namen eines Bereiches Plus seinem Pfad + Returns the logical name of a region and its path - - [R"uckgabewert] Referenz auf diesen Namen + [Return value] Reference to the Region name */ @@ -358,17 +354,16 @@ String SfxDocumentTemplates::GetFullRegionName const String& SfxDocumentTemplates::GetRegionName ( - sal_uInt16 nIdx // Index des Bereiches + sal_uInt16 nIdx // Region Index ) const -/* [Beschreibung] - - Liefert den logischen Namen eines Bereiches +/* [Description] + Returns the logical name of a region - [R"uckgabewert] + [Return value] - const String& Referenz auf diesen Namen + const String& Reference to the Region name */ { @@ -396,17 +391,16 @@ const String& SfxDocumentTemplates::GetRegionName sal_uInt16 SfxDocumentTemplates::GetRegionNo ( - const String &rRegion // Name der Region + const String &rRegion // Region Name ) const -/* [Beschreibung] - - Liefert den Index f"ur einen logischen Namen eines Bereiches. +/* [Description] + Returns the Index for a logical Region Name. - [R"uckgabewert] + [Return value] - sal_uInt16 Index von 'rRegion' oder USHRT_MAX falls unbekannt + sal_uInt16 Index of 'rRegion' or USHRT_MAX if unknown */ { @@ -416,7 +410,7 @@ sal_uInt16 SfxDocumentTemplates::GetRegionNo return USHRT_MAX; sal_Bool bFound; - sal_uIntPtr nIndex = pImp->GetRegionPos( rRegion, bFound ); + size_t nIndex = pImp->GetRegionPos( rRegion, bFound ); if ( bFound ) return (sal_uInt16) nIndex; @@ -429,15 +423,13 @@ sal_uInt16 SfxDocumentTemplates::GetRegionNo sal_uInt16 SfxDocumentTemplates::GetRegionCount() const -/* [Beschreibung] +/* [Description] - Liefert die Anzahl der Bereiche + Returns the number of Regions + [Return value] - [R"uckgabewert] - - sal_uInt16 Anzahl der Bereiche - + sal_uInt16 Number of Regions */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -471,20 +463,18 @@ sal_Bool SfxDocumentTemplates::IsRegionLoaded( sal_uInt16 nIdx ) const sal_uInt16 SfxDocumentTemplates::GetCount ( - const String& rName /* Name des Bereiches, dessen Eintrags- - anzahl ermittelt werden soll */ + const String& rName /* Region Name, for which the entries + should be counted */ ) const -/* [Beschreibung] - - Liefert die Anzahl der Eintr"age eines Bereiches +/* [Description] + Number of entries in Region - [R"uckgabewert] - - USHORT Anzahl der Eintr"age + [Return value] + sal_uInt16 Number of entries */ { @@ -506,18 +496,16 @@ sal_uInt16 SfxDocumentTemplates::GetCount sal_uInt16 SfxDocumentTemplates::GetCount ( - sal_uInt16 nRegion /* Index des Bereiches, dessen Eintrags- - anzahl ermittelt werden soll */ + sal_uInt16 nRegion /* Region index whose number is + to be determined */ ) const -/* [Beschreibung] - - Liefert die Anzahl der Eintr"age eines Bereiches - +/* [Description] - [R"uckgabewert] Anzahl der Eintr"age + Number of entries in Region + [Return value] Number of entries */ { @@ -539,19 +527,17 @@ sal_uInt16 SfxDocumentTemplates::GetCount const String& SfxDocumentTemplates::GetName ( - sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt - sal_uInt16 nIdx // Index des Eintrags + sal_uInt16 nRegion, // Region Index, in which the entry lies + sal_uInt16 nIdx // Index of the entry ) const -/* [Beschreibung] +/* [Description] - Liefert den logischen Namen eines Eintrags eines Bereiches + Returns the logical name of an entry in Region + [Return value] - [R"uckgabewert] - - const String& Name des Eintrags - + const String& Entry Name */ { @@ -582,16 +568,15 @@ const String& SfxDocumentTemplates::GetName String SfxDocumentTemplates::GetFileName ( - sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt - sal_uInt16 nIdx // Index des Eintrags + sal_uInt16 nRegion, // Region Index, in which the entry lies + sal_uInt16 nIdx // Index of the entry ) const -/* [Beschreibung] - - Liefert den Dateinamen eines Eintrags eines Bereiches +/* [Description] - [R"uckgabewert] Dateiname des Eintrags + Returns the file name of an entry in Region + [Return value] File name of the entry */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -619,20 +604,17 @@ String SfxDocumentTemplates::GetFileName String SfxDocumentTemplates::GetPath ( - sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt - sal_uInt16 nIdx // Index des Eintrags + sal_uInt16 nRegion, // Region Index, in which the entry lies + sal_uInt16 nIdx // Index of the entry ) const -/* [Beschreibung] +/* [Description] - Liefert den Dateinamen mit vollst"andigem Pfad zu der einem - Eintrag zugeordneten Datei + Returns the file name with full path to the file assigned to an entry + [Return value] - [R"uckgabewert] - - String Dateiname mit vollst"andigem Pfad - + String File name with full path */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -656,20 +638,17 @@ String SfxDocumentTemplates::GetPath String SfxDocumentTemplates::GetTemplatePath ( - sal_uInt16 nRegion, // Index des Bereiches, in dem der Eintrag liegt - const String& rLongName // logischer Name des Eintrags + sal_uInt16 nRegion, // Region Index, in which the entry lies + const String& rLongName // logical Entry Name ) const -/* [Beschreibung] - - Liefert den Dateinamen mit vollst"andigem Pfad zu der einem - Eintrag zugeordneten Datei +/* [Description] + Returns the file name with full path to the file assigned to an entry - [R"uckgabewert] - - String Dateiname mit vollst"andigem Pfad + [Return value] + String File name with full path */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -716,15 +695,13 @@ String SfxDocumentTemplates::GetDefaultTemplatePath const String& rLongName ) -/* [Beschreibung] - - Liefert den Standardpfad zu Dokumentvorlagen - +/* [Description] - [R"uckgabewert] + Returns the default location for templates - String Standardpfad zu Dokumentvorlagen + [Return value] + String Default location for templates */ { DocTemplLocker_Impl aLocker( *pImp ); @@ -763,25 +740,6 @@ String SfxDocumentTemplates::GetDefaultTemplatePath else return String(); -/* dv! missing: create the directory, if it doesn't exists - - - DBG_ASSERT(aDirs.GetTokenCount(cDelim), "Keine Bereiche"); - DirEntry aPath(aDirs.GetToken(0, cDelim)); - - // Verzeichnis anlegen - if(!aPath.MakeDir()) - return String(); - - MakeFileName_Impl(aPath, rLongName, sal_True); - SfxTemplateDir *pEntry = new SfxTemplateDir; - SfxTemplateDirEntryPtr pDirEntry = - new SfxTemplateDirEntry( String( '.' ), aPath.GetPath() ); - pDirEntry->SetContent(new SfxTemplateDir(aPath.GetPath())); - pEntry->Insert(pDirEntry, pEntry->Count()); - pDirs->Insert(pEntry, pDirs->Count()); - return aPath.GetFull(); -*/ } //------------------------------------------------------------------------ @@ -819,22 +777,17 @@ String SfxDocumentTemplates::GetDefaultTemplatePath sal_Bool SfxDocumentTemplates::SaveDir ( -// SfxTemplateDir& rDir // das zu speichernde Directory +// SfxTemplateDir& rDir // Save Directory ) -/* [Beschreibung] - - Speichert das Directory rDir +/* [Description] + Saves the Directory rDir - [R"uckgabewert] - - sal_Bool sal_False, - Schreibfehler - - sal_True - gespeichert + [Return value] + sal_Bool sal_False, Write error + sal_True, Saved */ { @@ -845,19 +798,17 @@ sal_Bool SfxDocumentTemplates::SaveDir void SfxDocumentTemplates::NewTemplate ( - sal_uInt16 nRegion, /* Index des Bereiches, in dem die Vorlage - angelegt werden soll */ + sal_uInt16 nRegion, /* Region Index, in which the template + should be applied */ - const String& rLongName, // logischer Name der neuen Vorlage - const String& rFileName // Dateiname der neuen Vorlage + const String& rLongName, // logical name of the new template + const String& rFileName // File name of the new template ) -/* [Beschreibung] - - Eintragen einer neuen Dokumentvorlage in die Verwaltungsstrukturen - Das "Uberschreiben einer Vorlage gleichen Namens wird - verhindert (!! Fehlermeldung) +/* [Description] + Submit a new template in the administrative structures + overwriting a template of the same name is prevented (! Error message) */ { @@ -889,26 +840,23 @@ void SfxDocumentTemplates::NewTemplate sal_Bool SfxDocumentTemplates::CopyOrMove ( - sal_uInt16 nTargetRegion, // Index des Zielbereiches - sal_uInt16 nTargetIdx, // Index Zielposition - sal_uInt16 nSourceRegion, // Index des Quellbereiches - sal_uInt16 nSourceIdx, /* Index der zu kopierenden / zu verschiebenden - Dokumentvorlage */ - sal_Bool bMove // kopieren / verschieben + sal_uInt16 nTargetRegion, // Target Region Index + sal_uInt16 nTargetIdx, // Target position Index + sal_uInt16 nSourceRegion, // Source Region Index + sal_uInt16 nSourceIdx, /* Index to be copied / to moved template */ + sal_Bool bMove // Copy / Move ) -/* [Beschreibung] +/* [Description] - Kopieren oder Verschieben einer Dokumentvorlage + Copy or move a document template - [R"uckgabewert] + [Return value] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_False - Aktion konnte nicht ausgef2uhrt werden - [Querverweise] + [Cross-references] <SfxDocumentTemplates::Move(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16)> <SfxDocumentTemplates::Copy(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16)> @@ -937,21 +885,6 @@ sal_Bool SfxDocumentTemplates::CopyOrMove { DBG_ERRORFILE( "Don't know, what to do!" ); return sal_False; -#if 0 - // Verschieben einer Vorlage innerhalb eines Bereiches - // --> nur Verwaltungsdaten aktualisieren - if ( bMove && nTargetRegion == nSourceRegion ) - { - if(nTargetIdx == USHRT_MAX) - nTargetIdx = 0; - const SfxTemplateDirEntryPtr pEntry = rTargetDir[nSourceIdx]; - rTargetDir.Insert(pEntry, nTargetIdx); - if(nTargetIdx < nSourceIdx) - ++nSourceIdx; - rTargetDir.Remove(nSourceIdx); - return SaveDir(rTargetDir); - } -#endif } RegionData_Impl *pSourceRgn = pImp->GetRegion( nSourceRegion ); @@ -999,13 +932,15 @@ sal_Bool SfxDocumentTemplates::CopyOrMove } } - pTargetRgn->AddEntry( aTitle, aNewTargetURL, &nTargetIdx ); + // todo: fix SfxDocumentTemplates to handle size_t instead of sal_uInt16 + size_t temp_nTargetIdx = nTargetIdx; + pTargetRgn->AddEntry( aTitle, aNewTargetURL, &temp_nTargetIdx ); return sal_True; } - // --**-- wenn aktuell das File geoeffnet ist, - // muss es hinterher wieder geoeffnet werden + // --**-- if the current file is opened, + // it must be re-opened afterwards. return sal_False; } @@ -1014,27 +949,22 @@ sal_Bool SfxDocumentTemplates::CopyOrMove sal_Bool SfxDocumentTemplates::Move ( - sal_uInt16 nTargetRegion, // Index des Zielbereiches - sal_uInt16 nTargetIdx, // Index Zielposition - sal_uInt16 nSourceRegion, // Index des Quellbereiches - sal_uInt16 nSourceIdx /* Index der zu kopierenden / zu verschiebenden - Dokumentvorlage */ + sal_uInt16 nTargetRegion, // Target Region Index + sal_uInt16 nTargetIdx, // Target position Index + sal_uInt16 nSourceRegion, // Source Region Index + sal_uInt16 nSourceIdx /* Index to be copied / to moved template */ ) -/* [Beschreibung] +/* [Description] - Verschieben einer Dokumentvorlage + Moving a template + [Return value] - [R"uckgabewert] + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden - - sal_False - Aktion konnte nicht ausgef2uhrt werden - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::CopyOrMove(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16,sal_Bool)> */ @@ -1049,27 +979,22 @@ sal_Bool SfxDocumentTemplates::Move sal_Bool SfxDocumentTemplates::Copy ( - sal_uInt16 nTargetRegion, // Index des Zielbereiches - sal_uInt16 nTargetIdx, // Index Zielposition - sal_uInt16 nSourceRegion, // Index des Quellbereiches - sal_uInt16 nSourceIdx /* Index der zu kopierenden / zu verschiebenden - Dokumentvorlage */ + sal_uInt16 nTargetRegion, // Target Region Index + sal_uInt16 nTargetIdx, // Target position Index + sal_uInt16 nSourceRegion, // Source Region Index + sal_uInt16 nSourceIdx /* Index to be copied / to moved template */ ) -/* [Beschreibung] - - Kopieren einer Dokumentvorlage +/* [Description] + Copying a template - [R"uckgabewert] + [Return value] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_False - Aktion konnte nicht ausgef"uhrt werden - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::CopyOrMove(sal_uInt16,sal_uInt16,sal_uInt16,sal_uInt16,sal_Bool)> */ @@ -1085,29 +1010,22 @@ sal_Bool SfxDocumentTemplates::Copy sal_Bool SfxDocumentTemplates::CopyTo ( - sal_uInt16 nRegion, /* Bereich der Vorlage, die exportiert werden - soll */ - sal_uInt16 nIdx, /* Index der Vorlage, die exportiert werden - soll */ - const String& rName /* Dateiname, unter dem die Vorlage angelegt - werden soll */ + sal_uInt16 nRegion, // Region of the template to be exported + sal_uInt16 nIdx, // Index of the template to be exported + const String& rName /* File name under which the template is to + be created */ ) const -/* [Beschreibung] - - Exportieren einer Dokumentvorlage in das Dateisystem - +/* [Description] - [R"uckgabewert] + Exporting a template into the file system - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + [Return value] - sal_False - Aktion konnte nicht ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::CopyFrom(sal_uInt16,sal_uInt16,String&)> */ @@ -1164,29 +1082,25 @@ sal_Bool SfxDocumentTemplates::CopyTo sal_Bool SfxDocumentTemplates::CopyFrom ( - sal_uInt16 nRegion, /* Bereich, in den die Vorlage importiert - werden soll */ - sal_uInt16 nIdx, // Index der neuen Vorlage in diesem Bereich - String& rName /* Dateiname der Vorlage, die importiert - werden soll, als out-Parameter der (auto- - matisch aus dem Dateinamen generierte) - logische Name der Vorlage */ + sal_uInt16 nRegion, /* Region in which the template is to be + imported */ + sal_uInt16 nIdx, // Index of the new template in this Region + String& rName /* File name of the template to be imported + as an out parameter of the (automatically + generated from the file name) logical name + of the template */ ) -/* [Beschreibung] - - Importieren einer Dokumentvorlage aus dem Dateisystem - +/* [Description] - [R"uckgabewert] Erfolg (sal_True) oder Mi"serfpTargetDirectory->GetContent()); + Import a template from the file system - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + [Return value] Sucess (sal_True) or serfpTargetDirectory->GetContent()); - sal_False - Aktion konnte nicht ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - [Querverweise] + [Cross-references] <SfxDocumentTemplates::CopyTo(sal_uInt16,sal_uInt16,const String&)> */ @@ -1220,7 +1134,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom UNO_QUERY ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = ::rtl::OUString::createFromAscii("Hidden"); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); aArgs[0].Value <<= sal_True; INetURLObject aTemplURL( rName ); @@ -1230,7 +1144,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom { xStorable = uno::Reference< XStorable >( xDesktop->loadComponentFromURL( aTemplURL.GetMainURL(INetURLObject::NO_DECODE), - OUString::createFromAscii( "_blank" ), + OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, aArgs ), UNO_QUERY ); @@ -1291,7 +1205,9 @@ sal_Bool SfxDocumentTemplates::CopyFrom else nIdx += 1; - pTargetRgn->AddEntry( aTitle, aTemplName, &nIdx ); + // todo: fix SfxDocumentTemplates to handle size_t instead of sal_uInt16 + size_t temp_nIdx = nIdx; + pTargetRgn->AddEntry( aTitle, aTemplName, &temp_nIdx ); rName = aTitle; return sal_True; } @@ -1313,26 +1229,21 @@ sal_Bool SfxDocumentTemplates::CopyFrom sal_Bool SfxDocumentTemplates::Delete ( - sal_uInt16 nRegion, // Index des Bereiches - sal_uInt16 nIdx /* Index des Eintrags oder USHRT_MAX, - wenn ein Verzeichnis gemeint ist. */ + sal_uInt16 nRegion, // Region Index + sal_uInt16 nIdx /* Index of the entry or USHRT_MAX, + if a directory is meant. */ ) -/* [Beschreibung] +/* [Description] - "oschen eines Eintrags oder eines Verzeichnisses + Deleting an entry or a directory + [Return value] - [R"uckgabewert] + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden - - sal_False - Aktion konnte nicht ausgef"uhrt werden - - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::InsertDir(const String&,sal_uInt16)> <SfxDocumentTemplates::KillDir(SfxTemplateDir&)> @@ -1383,24 +1294,20 @@ sal_Bool SfxDocumentTemplates::Delete sal_Bool SfxDocumentTemplates::InsertDir ( - const String& rText, // der logische Name des neuen Bereiches - sal_uInt16 nRegion // Index des Bereiches + const String& rText, // the logical name of the new Region + sal_uInt16 nRegion // Region Index ) -/* [Beschreibung] +/* [Description] - Einf"ugen eines Verzeichnisses + Insert an index + [Return value] - [R"uckgabewert] + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden - - sal_False - Aktion konnte nicht ausgef"uhrt werden - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::KillDir(SfxTemplateDir&)> <SfxDocumentTemplates::SaveDir(SfxTemplateDir&)> @@ -1438,23 +1345,19 @@ sal_Bool SfxDocumentTemplates::InsertDir sal_Bool SfxDocumentTemplates::SetName ( const String& rName, // Der zu setzende Name - sal_uInt16 nRegion, // Index des Bereiches - sal_uInt16 nIdx /* Index des Eintrags oder USHRT_MAX, - wenn ein Verzeichnis gemeint ist. */ + sal_uInt16 nRegion, // Region Index + sal_uInt16 nIdx /* Index of the entry oder USHRT_MAX, + if a directory is meant. */ ) -/* [Beschreibung] - - "Andern des Namens eines Eintrags oder eines Verzeichnisses +/* [Description] + Change the name of an entry or a directory - [R"uckgabewert] + [Return value] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden - - sal_False - Aktion konnte nicht ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed */ @@ -1515,24 +1418,18 @@ sal_Bool SfxDocumentTemplates::SetName sal_Bool SfxDocumentTemplates::Rescan() -/* [Beschreibung] - - Abgleich des Verwaltungsdaten mit dem aktuellen Zustand auf der Platte. - Die logischen Namen, zu denen keine Datei mit existiert, werden aus - der Verwaltungsstruktur entfernt; Dateien, zu denen kein Eintrag - existiert, werden aufgenommen. - - - [R"uckgabewert] +/* [Description] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + Comparison of administrative data with the current state on disk. + The logical name for which no file exists, will be removed from the + administrative structure. Files for which no record exists will be included. - sal_False - Aktion konnte nicht ausgef"uhrt werden + [Return value] + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - [Querverweise] + [Cross-references] <SfxTemplateDir::Scan(sal_Bool bDirectory, sal_Bool bSave)> <SfxTemplateDir::Freshen(const SfxTemplateDir &rNew)> @@ -1550,21 +1447,19 @@ sal_Bool SfxDocumentTemplates::Rescan() SfxObjectShellRef SfxDocumentTemplates::CreateObjectShell ( - sal_uInt16 nRegion, // Index des Bereiches - sal_uInt16 nIdx // Index des Eintrags + sal_uInt16 nRegion, // Region Index + sal_uInt16 nIdx // Index of the entry ) -/* [Beschreibung] +/* [Description] - Zugriff auf die DokumentShell eines Eintrags + Access to the document shell of an entry + [Return value] - [R"uckgabewert] + SfxObjectShellRef Referece to the ObjectShell - SfxObjectShellRef Referenz auf die ObjectShell - - - [Querverweise] + [Cross-references] <SfxTemplateDirEntry::CreateObjectShell()> <SfxDocumentTemplates::DeleteObjectShell(sal_uInt16, sal_uInt16)> @@ -1592,24 +1487,20 @@ SfxObjectShellRef SfxDocumentTemplates::CreateObjectShell sal_Bool SfxDocumentTemplates::DeleteObjectShell ( - sal_uInt16 nRegion, // Index des Bereiches - sal_uInt16 nIdx // Index des Eintrags + sal_uInt16 nRegion, // Region Index + sal_uInt16 nIdx // Index of the entry ) -/* [Beschreibung] - - Freigeben der ObjectShell eines Eintrags +/* [Description] + Releasing the ObjectShell of an entry - [R"uckgabewert] + [Return value] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - sal_False - Aktion konnte nicht ausgef"uhrt werden - - [Querverweise] + [Cross-references] <SfxTemplateDirEntry::DeleteObjectShell()> <SfxDocumentTemplates::CreateObjectShell(sal_uInt16, sal_uInt16)> @@ -1637,27 +1528,21 @@ sal_Bool SfxDocumentTemplates::DeleteObjectShell sal_Bool SfxDocumentTemplates::GetFull ( - const String &rRegion, // Der Name des Bereiches - const String &rName, // Der Name der Vorlage - String &rPath // Out: Pfad + Dateiname + const String &rRegion, // Region Name + const String &rName, // Template Name + String &rPath // Out: Path + File name ) -/* [Beschreibung] - - Liefert Pfad + Dateiname zu der durch rRegion und rName bezeichneten - Vorlage - +/* [Description] - [R"uckgabewert] + Returns Path + File name of the template specified by rRegion and rName. - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + [Return value] - sal_False - Aktion konnte nicht ausgef"uhrt werden + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - - [Querverweise] + [Cross-references] <SfxDocumentTemplates::GetLogicNames(const String&,String&,String&)> */ @@ -1699,26 +1584,21 @@ sal_Bool SfxDocumentTemplates::GetFull sal_Bool SfxDocumentTemplates::GetLogicNames ( - const String &rPath, // vollst"andiger Pfad zu der Vorlage - String &rRegion, // Out: der Bereichsname - String &rName // Out: der Vorlagenname + const String &rPath, // Full Path to the template + String &rRegion, // Out: Region name + String &rName // Out: Template name ) const -/* [Beschreibung] - - Liefert Pfad und logischen Namen zu der durch rPath bezeichneten - Vorlage - - [R"uckgabewert] +/* [Description] - sal_Bool sal_True - Aktion konnte ausgef"uhrt werden + Returns and logical path name to the template specified by rPath - sal_False - Aktion konnte nicht ausgef"uhrt werden + [Return value] + sal_Bool sal_True, Action could be performed + sal_False, Action could not be performed - [Querverweise] + [Cross-references] <SfxDocumentTemplates::GetFull(const String&,const String&,DirEntry&)> */ @@ -1772,9 +1652,9 @@ sal_Bool SfxDocumentTemplates::GetLogicNames SfxDocumentTemplates::SfxDocumentTemplates() -/* [Beschreibung] +/* [Description] - Konstruktor + Constructor */ { if ( !gpTemplateData ) @@ -1787,20 +1667,19 @@ SfxDocumentTemplates::SfxDocumentTemplates() void SfxDocumentTemplates::Construct() -// verz"ogerter Aufbau der Verwaltungsdaten +// Delayed build-up of administrative data { -// pImp->Construct(); } //------------------------------------------------------------------------ SfxDocumentTemplates::~SfxDocumentTemplates() -/* [Beschreibung] +/* [Description] - Destruktor - Freigeben der Verwaltungsdaten + Destructor + Release of administrative data */ { @@ -1878,8 +1757,6 @@ sal_Bool SfxDocumentTemplates::HasUserContents( sal_uInt16 nRegion, sal_uInt16 n } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- DocTempl_EntryData_Impl::DocTempl_EntryData_Impl( RegionData_Impl* pParent, const OUString& rTitle ) { @@ -1962,7 +1839,7 @@ sal_Bool DocTempl_EntryData_Impl::DeleteObjectShell() { if( mxObjShell->IsModified() ) { - //Hier speichern wir auch, falls die Vorlage in Bearbeitung ist... + // Here we also save, if the Template is being processed ... bRet = sal_False; if ( mbIsOwner ) @@ -2045,9 +1922,6 @@ const OUString& DocTempl_EntryData_Impl::GetTargetURL() } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- RegionData_Impl::RegionData_Impl( const SfxDocTemplate_Impl* pParent, const OUString& rTitle ) { @@ -2058,26 +1932,21 @@ RegionData_Impl::RegionData_Impl( const SfxDocTemplate_Impl* pParent, // ----------------------------------------------------------------------- RegionData_Impl::~RegionData_Impl() { - DocTempl_EntryData_Impl *pData = maEntries.First(); - - while ( pData ) - { - delete pData; - pData = maEntries.Next(); - } + for ( size_t i = 0, n = maEntries.size(); i < n; ++i ) + delete maEntries[ i ]; + maEntries.clear(); } // ----------------------------------------------------------------------- -long RegionData_Impl::GetEntryPos( const OUString& rTitle, - sal_Bool& rFound ) const +size_t RegionData_Impl::GetEntryPos( const OUString& rTitle, sal_Bool& rFound ) const { #if 1 // Don't use binary search today - sal_uIntPtr i; - sal_uIntPtr nCount = maEntries.Count(); + size_t i; + size_t nCount = maEntries.size(); for ( i=0; i<nCount; i++ ) { - DocTempl_EntryData_Impl *pData = maEntries.GetObject( i ); + DocTempl_EntryData_Impl *pData = maEntries[ i ]; if ( pData->Compare( rTitle ) == 0 ) { @@ -2094,9 +1963,9 @@ long RegionData_Impl::GetEntryPos( const OUString& rTitle, // in the maEntries list int nCompVal = 1; - long nStart = 0; - long nEnd = maEntries.Count() - 1; - long nMid; + size_t nStart = 0; + size_t nEnd = maEntries.size() - 1; + size_t nMid; DocTempl_EntryData_Impl* pMid; @@ -2105,7 +1974,7 @@ long RegionData_Impl::GetEntryPos( const OUString& rTitle, while ( nCompVal && ( nStart <= nEnd ) ) { nMid = ( nEnd - nStart ) / 2 + nStart; - pMid = maEntries.GetObject( nMid ); + pMid = maEntries[ nMid ]; nCompVal = pMid->Compare( rTitle ); @@ -2132,7 +2001,7 @@ long RegionData_Impl::GetEntryPos( const OUString& rTitle, // ----------------------------------------------------------------------- void RegionData_Impl::AddEntry( const OUString& rTitle, const OUString& rTargetURL, - sal_uInt16 *pPos ) + size_t *pPos ) { INetURLObject aLinkObj( GetHierarchyURL() ); aLinkObj.insertName( rTitle, false, @@ -2140,13 +2009,13 @@ void RegionData_Impl::AddEntry( const OUString& rTitle, INetURLObject::ENCODE_ALL ); OUString aLinkURL = aLinkObj.GetMainURL( INetURLObject::NO_DECODE ); - DocTempl_EntryData_Impl *pEntry; + DocTempl_EntryData_Impl* pEntry; sal_Bool bFound = sal_False; - long nPos = GetEntryPos( rTitle, bFound ); + size_t nPos = GetEntryPos( rTitle, bFound ); if ( bFound ) { - pEntry = maEntries.GetObject( nPos ); + pEntry = maEntries[ nPos ]; } else { @@ -2156,14 +2025,20 @@ void RegionData_Impl::AddEntry( const OUString& rTitle, pEntry = new DocTempl_EntryData_Impl( this, rTitle ); pEntry->SetTargetURL( rTargetURL ); pEntry->SetHierarchyURL( aLinkURL ); - maEntries.Insert( pEntry, nPos ); + if ( nPos < maEntries.size() ) { + vector< DocTempl_EntryData_Impl* >::iterator it = maEntries.begin(); + advance( it, nPos ); + maEntries.insert( it, pEntry ); + } + else + maEntries.push_back( pEntry ); } } // ----------------------------------------------------------------------- -sal_uIntPtr RegionData_Impl::GetCount() const +size_t RegionData_Impl::GetCount() const { - return maEntries.Count(); + return maEntries.size(); } // ----------------------------------------------------------------------- @@ -2197,9 +2072,8 @@ const OUString& RegionData_Impl::GetTargetURL() OUString aPropName( RTL_CONSTASCII_USTRINGPARAM( TARGET_DIR_URL ) ); getTextProperty_Impl( aRegion, aPropName, maTargetURL ); - // --> PB 2004-10-27 #i32656# - the targeturl must be substituted: $(baseinsturl) + // The targeturl must be substituted: $(baseinsturl) (#i32656#) maTargetURL = SvtPathOptions().SubstituteVariable( maTargetURL ); - // <-- } else { @@ -2217,7 +2091,7 @@ DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( const OUString& rName ) cons long nPos = GetEntryPos( rName, bFound ); if ( bFound ) - return maEntries.GetObject( nPos ); + return maEntries[ nPos ]; else return NULL; } @@ -2225,35 +2099,32 @@ DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( const OUString& rName ) cons // ----------------------------------------------------------------------- DocTempl_EntryData_Impl* RegionData_Impl::GetByTargetURL( const OUString& rName ) const { - DocTempl_EntryData_Impl *pEntry; - - sal_uIntPtr nCount = maEntries.Count(); - - for ( sal_uIntPtr i=0; i<nCount; i++ ) + for ( size_t i = 0, n = maEntries.size(); i < n; ++i ) { - pEntry = maEntries.GetObject( i ); - if ( pEntry && ( pEntry->GetTargetURL() == rName ) ) + DocTempl_EntryData_Impl *pEntry = maEntries[ i ]; + if ( pEntry->GetTargetURL() == rName ) return pEntry; } - return NULL; } // ----------------------------------------------------------------------- -DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( sal_uIntPtr nIndex ) const +DocTempl_EntryData_Impl* RegionData_Impl::GetEntry( size_t nIndex ) const { - return maEntries.GetObject( nIndex ); + if ( nIndex < maEntries.size() ) + return maEntries[ nIndex ]; + return NULL; } // ----------------------------------------------------------------------- -void RegionData_Impl::DeleteEntry( sal_uIntPtr nIndex ) +void RegionData_Impl::DeleteEntry( size_t nIndex ) { - DocTempl_EntryData_Impl *pEntry = maEntries.GetObject( nIndex ); - - if ( pEntry ) + if ( nIndex < maEntries.size() ) { - delete pEntry; - maEntries.Remove( (sal_uIntPtr) nIndex ); + delete maEntries[ nIndex ]; + vector< DocTempl_EntryData_Impl*>::iterator it = maEntries.begin(); + advance( it, nIndex ); + maEntries.erase( it ); } } @@ -2266,8 +2137,6 @@ int RegionData_Impl::Compare( RegionData_Impl* pCompare ) const } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- SfxDocTemplate_Impl::SfxDocTemplate_Impl() : mbConstructed( sal_False ) @@ -2299,38 +2168,35 @@ void SfxDocTemplate_Impl::DecrementLock() } // ----------------------------------------------------------------------- -RegionData_Impl* SfxDocTemplate_Impl::GetRegion( sal_uIntPtr nIndex ) const +RegionData_Impl* SfxDocTemplate_Impl::GetRegion( size_t nIndex ) const { - return maRegions.GetObject( nIndex ); + if ( nIndex < maRegions.size() ) + return maRegions[ nIndex ]; + return NULL; } // ----------------------------------------------------------------------- RegionData_Impl* SfxDocTemplate_Impl::GetRegion( const OUString& rName ) const { - sal_uIntPtr nCount = maRegions.Count(); - RegionData_Impl *pData; - - for ( sal_uIntPtr i=0; i<nCount; i++ ) + for ( size_t i = 0, n = maRegions.size(); i < n; ++i ) { - pData = maRegions.GetObject( i ); - - if ( pData->GetTitle() == rName ) + RegionData_Impl* pData = maRegions[ i ]; + if( pData->GetTitle() == rName ) return pData; } - return NULL; } // ----------------------------------------------------------------------- -void SfxDocTemplate_Impl::DeleteRegion( sal_uIntPtr nIndex ) +void SfxDocTemplate_Impl::DeleteRegion( size_t nIndex ) { - RegionData_Impl* pRegion = maRegions.GetObject( nIndex ); - - if ( pRegion ) + if ( nIndex < maRegions.size() ) { - delete pRegion; - maRegions.Remove( (sal_uIntPtr) nIndex ); + delete maRegions[ nIndex ]; + RegionList_Impl::iterator it = maRegions.begin(); + advance( it, nIndex ); + maRegions.erase( it ); } } @@ -2352,8 +2218,8 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle, // now get the content of the region uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(2); - aProps[0] = OUString::createFromAscii( TITLE ); - aProps[1] = OUString::createFromAscii( TARGET_URL ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); + aProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( TARGET_URL )); try { @@ -2389,7 +2255,7 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot ) { uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(1); - aProps[0] = OUString::createFromAscii( TITLE ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); try { @@ -2451,7 +2317,7 @@ sal_Bool SfxDocTemplate_Impl::Construct( ) Sequence< Any > aCompareArg(1); *(aCompareArg.getArray()) <<= xLocalizable->getLocale();; m_rCompareFactory = uno::Reference< XAnyCompareFactory >( - xFactory->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.ucb.AnyCompareFactory" ), + xFactory->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.AnyCompareFactory")), aCompareArg ), UNO_QUERY ); @@ -2497,7 +2363,7 @@ void SfxDocTemplate_Impl::GetTemplates( Content& rTargetFolder, uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(1); - aProps[0] = OUString::createFromAscii( TITLE ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); try { @@ -2549,20 +2415,19 @@ void SfxDocTemplate_Impl::GetTemplates( Content& rTargetFolder, // ----------------------------------------------------------------------- -long SfxDocTemplate_Impl::GetRegionPos( const OUString& rTitle, - sal_Bool& rFound ) const +size_t SfxDocTemplate_Impl::GetRegionPos( const OUString& rTitle, sal_Bool& rFound ) const { int nCompVal = 1; - long nStart = 0; - long nEnd = maRegions.Count() - 1; - long nMid = 0; + size_t nStart = 0; + size_t nEnd = maRegions.size() - 1; + size_t nMid = 0; RegionData_Impl* pMid; while ( nCompVal && ( nStart <= nEnd ) ) { nMid = ( nEnd - nStart ) / 2 + nStart; - pMid = maRegions.GetObject( nMid ); + pMid = maRegions[ nMid ]; nCompVal = pMid->Compare( rTitle ); @@ -2586,27 +2451,29 @@ long SfxDocTemplate_Impl::GetRegionPos( const OUString& rTitle, } // ----------------------------------------------------------------------- -sal_Bool SfxDocTemplate_Impl::InsertRegion( RegionData_Impl *pNew, - sal_uIntPtr nPos ) +sal_Bool SfxDocTemplate_Impl::InsertRegion( RegionData_Impl *pNew, size_t nPos ) { ::osl::MutexGuard aGuard( maMutex ); - RegionData_Impl *pData = maRegions.First(); - while ( pData && ( pData->Compare( pNew ) != 0 ) ) - pData = maRegions.Next(); + // return false (not inserted) if the entry already exists + for ( size_t i = 0, n = maRegions.size(); i < n; ++i ) + if ( maRegions[ i ]->Compare( pNew ) == 0 ) + return sal_False; - if ( ! pData ) - { - // compare with the name of the standard group here to insert it - // first + size_t newPos = nPos; + if ( pNew->GetTitle() == maStandardGroup ) + newPos = 0; - if ( pNew->GetTitle() == maStandardGroup ) - maRegions.Insert( pNew, (sal_uIntPtr) 0 ); - else - maRegions.Insert( pNew, nPos ); + if ( newPos < maRegions.size() ) + { + RegionList_Impl::iterator it = maRegions.begin(); + advance( it, newPos ); + maRegions.insert( it, pNew ); } + else + maRegions.push_back( pNew ); - return ( pData == NULL ); + return sal_True; } // ----------------------------------------------------------------------- @@ -2686,20 +2553,12 @@ void SfxDocTemplate_Impl::Clear() if ( mnLockCounter ) return; - RegionData_Impl *pRegData = maRegions.First(); - - while ( pRegData ) - { - delete pRegData; - pRegData = maRegions.Next(); - } - - maRegions.Clear(); + for ( size_t i = 0, n = maRegions.size(); i < n; ++i ) + delete maRegions[ i ]; + maRegions.clear(); } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- sal_Bool getTextProperty_Impl( Content& rContent, const OUString& rPropName, OUString& rPropValue ) @@ -2737,3 +2596,4 @@ sal_Bool getTextProperty_Impl( Content& rContent, return bGotProperty; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctempl.src b/sfx2/source/doc/doctempl.src index 2c91358f845e..e71e77ff2cb3 100644 --- a/sfx2/source/doc/doctempl.src +++ b/sfx2/source/doc/doctempl.src @@ -43,6 +43,7 @@ StringArray TEMPLATE_SHORT_NAMES_ARY < "layout" ; > ; < "presnt" ; > ; < "misc" ; > ; + < "labels" ; > ; }; }; @@ -60,6 +61,7 @@ StringArray TEMPLATE_LONG_NAMES_ARY < "Presentation Backgrounds" ; > ; < "Presentations" ; > ; < "Miscellaneous" ; > ; + < "Labels" ; > ; }; }; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index dd6218034bc7..dedc88f183b5 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,15 +30,13 @@ #include "precompiled_sfx2.hxx" #include "doctemplates.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> -#ifndef _SV_RESARY_HXX #include <tools/resary.hxx> -#endif #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -49,6 +48,7 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/document/XStandaloneDocumentInfo.hpp> @@ -73,6 +73,8 @@ #include <sfx2/docfile.hxx> #include "doc.hrc" +#include <vector> + //----------------------------------------------------------------------------- //============================================================================= @@ -124,6 +126,8 @@ using namespace ::rtl; using namespace ::ucbhelper; using namespace ::comphelper; +using ::std::vector; + //============================================================================= class WaitWindow_Impl : public WorkWindow @@ -149,13 +153,13 @@ struct NamePair_Impl OUString maLongName; }; -DECLARE_LIST( NameList_Impl, NamePair_Impl* ) - class Updater_Impl; -class GroupList_Impl; class DocTemplates_EntryData_Impl; class GroupData_Impl; +typedef vector< NamePair_Impl* > NameList_Impl; +typedef vector< GroupData_Impl* > GroupList_Impl; + //============================================================================= #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> @@ -276,7 +280,7 @@ public: ~SfxDocTplService_Impl(); sal_Bool init() { if ( !mbIsInitialized ) init_Impl(); return mbIsInitialized; } - Content getContent() { return maRootContent; } + Content getContent() const { return maRootContent; } void setLocale( const Locale & rLocale ); Locale getLocale(); @@ -306,7 +310,7 @@ public: //============================================================================= -class Updater_Impl : public ::vos::OThread +class Updater_Impl : public ::osl::Thread { private: SfxDocTplService_Impl *mpDocTemplates; @@ -360,8 +364,7 @@ public: class GroupData_Impl { - DECLARE_LIST( EntryList_Impl, DocTemplates_EntryData_Impl* ) - EntryList_Impl maEntries; + vector< DocTemplates_EntryData_Impl* > maEntries; OUString maTitle; OUString maHierarchyURL; OUString maTargetURL; @@ -377,8 +380,8 @@ public: void setHierarchyURL( const OUString& rURL ) { maHierarchyURL = rURL; } void setTargetURL( const OUString& rURL ) { maTargetURL = rURL; } - sal_Bool getInUse() { return mbInUse; } - sal_Bool getInHierarchy() { return mbInHierarchy; } + sal_Bool getInUse() const { return mbInUse; } + sal_Bool getInHierarchy() const { return mbInHierarchy; } const OUString& getHierarchyURL() const { return maHierarchyURL; } const OUString& getTargetURL() const { return maTargetURL; } const OUString& getTitle() const { return maTitle; } @@ -387,16 +390,10 @@ public: const OUString& rTargetURL, const OUString& rType, const OUString& rHierURL ); - sal_uIntPtr count() { return maEntries.Count(); } - DocTemplates_EntryData_Impl* getEntry( sal_uIntPtr nPos ) { return maEntries.GetObject( nPos ); } + size_t count() { return maEntries.size(); } + DocTemplates_EntryData_Impl* getEntry( size_t nPos ) { return maEntries[ nPos ]; } }; -DECLARE_LIST( GroupList_Impl, GroupData_Impl* ) - -//============================================================================= -//============================================================================= -//============================================================================= - //----------------------------------------------------------------------------- // private SfxDocTplService_Impl //----------------------------------------------------------------------------- @@ -460,7 +457,7 @@ void SfxDocTplService_Impl::init_Impl() mxInfo = uno::Reference< XStandaloneDocumentInfo > ( mxFactory->createInstance( aService ), UNO_QUERY ); } catch (uno::RuntimeException &) { - OSL_ENSURE(false, "SfxDocTplService_Impl::init_Impl: " + OSL_FAIL("SfxDocTplService_Impl::init_Impl: " "cannot create DocumentProperties service"); } @@ -473,7 +470,7 @@ void SfxDocTplService_Impl::init_Impl() if ( bNeedsUpdate ) { aGuard.clear(); - ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexClearableGuard aSolarGuard; WaitWindow_Impl* pWin = new WaitWindow_Impl(); @@ -483,7 +480,7 @@ void SfxDocTplService_Impl::init_Impl() update( sal_True ); anotherGuard.clear(); - ::vos::OGuard aSecondSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSecondSolarGuard; delete pWin; } @@ -543,7 +540,7 @@ void SfxDocTplService_Impl::getDefaultLocale() // ----------------------------------------------------------------------- void SfxDocTplService_Impl::readFolderList() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ResStringArray aShortNames( SfxResId( TEMPLATE_SHORT_NAMES_ARY ) ); ResStringArray aLongNames( SfxResId( TEMPLATE_LONG_NAMES_ARY ) ); @@ -558,7 +555,7 @@ void SfxDocTplService_Impl::readFolderList() pPair->maShortName = aShortNames.GetString( i ); pPair->maLongName = aLongNames.GetString( i ); - maNames.Insert( pPair, LIST_APPEND ); + maNames.push_back( pPair ); } } @@ -566,17 +563,15 @@ void SfxDocTplService_Impl::readFolderList() OUString SfxDocTplService_Impl::getLongName( const OUString& rShortName ) { OUString aRet; - NamePair_Impl *pPair = maNames.First(); - while ( pPair ) + for ( size_t i = 0, n = maNames.size(); i < n; ++i ) { + NamePair_Impl* pPair = maNames[ i ]; if ( pPair->maShortName == rShortName ) { aRet = pPair->maLongName; break; } - else - pPair = maNames.Next(); } if ( !aRet.getLength() ) @@ -599,11 +594,45 @@ void SfxDocTplService_Impl::getDirList() maTemplateDirs = Sequence< OUString >( nCount ); + uno::Reference< XComponentContext > xCtx; + uno::Reference< util::XMacroExpander > xExpander; + uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY ); + const rtl::OUString aPrefix( + RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ) ); + + if ( xPropSet.is() ) + { + xPropSet->getPropertyValue( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) + >>= xCtx; + } + + if ( xCtx.is() ) + { + xCtx->getValueByName( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.util.theMacroExpander" ) ) ) + >>= xExpander; + + OSL_ENSURE( xExpander.is(), + "Unable to obtain macro expander singleton!" ); + } + for ( sal_uInt16 i=0; i<nCount; i++ ) { aURL.SetSmartProtocol( INET_PROT_FILE ); aURL.SetURL( aDirs.GetToken( i, C_DELIM ) ); maTemplateDirs[i] = aURL.GetMainURL( INetURLObject::NO_DECODE ); + + sal_Int32 nIndex = maTemplateDirs[i].indexOf( aPrefix ); + if ( nIndex != -1 && xExpander.is() ) + { + maTemplateDirs[i] = maTemplateDirs[i].replaceAt(nIndex, + aPrefix.getLength(), + rtl::OUString()); + maTemplateDirs[i] = xExpander->expandMacros( maTemplateDirs[i] ); + } } aValue <<= maTemplateDirs; @@ -705,7 +734,7 @@ sal_Bool SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& uno::Reference< container::XNameAccess > xTypeDetection( mxType, uno::UNO_QUERY_THROW ); SequenceAsHashMap aTypeProps( xTypeDetection->getByName( aDocType ) ); aType = aTypeProps.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "MediaType" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), ::rtl::OUString() ); } catch( uno::Exception& ) @@ -1044,7 +1073,7 @@ sal_Bool SfxDocTplService_Impl::setProperty( Content& rContent, } else { - OSL_ENSURE( false, "Unsupported property value type" ); + OSL_FAIL( "Unsupported property value type" ); } } } @@ -1105,7 +1134,7 @@ sal_Bool SfxDocTplService_Impl::getProperty( Content& rContent, } else { - OSL_ENSURE( false, "Unsupported property value type" ); + OSL_FAIL( "Unsupported property value type" ); } } } @@ -1153,9 +1182,14 @@ SfxDocTplService_Impl::~SfxDocTplService_Impl() if ( mpUpdater ) { - mpUpdater->kill(); + mpUpdater->terminate(); + mpUpdater->join(); delete mpUpdater; } + + for ( size_t i = 0, n = maNames.size(); i < n; ++i ) + delete maNames[ i ]; + maNames.clear(); } //----------------------------------------------------------------------------- @@ -1236,9 +1270,9 @@ void SfxDocTplService_Impl::doUpdate() } // now check the list - GroupData_Impl *pGroup = aGroupList.First(); - while ( pGroup ) + for( size_t j = 0, n = aGroupList.size(); j < n; ++j ) { + GroupData_Impl *pGroup = aGroupList[ j ]; if ( pGroup->getInUse() ) { if ( pGroup->getInHierarchy() ) @@ -1249,8 +1283,8 @@ void SfxDocTplService_Impl::doUpdate() OUString( RTL_CONSTASCII_USTRINGPARAM( TARGET_DIR_URL ) ), makeAny( pGroup->getTargetURL() ) ); - sal_uIntPtr nCount = pGroup->count(); - for ( sal_uIntPtr i=0; i<nCount; i++ ) + size_t nCount = pGroup->count(); + for ( size_t i=0; i<nCount; i++ ) { DocTemplates_EntryData_Impl *pData = pGroup->getEntry( i ); if ( ! pData->getInUse() ) @@ -1276,10 +1310,10 @@ void SfxDocTplService_Impl::doUpdate() removeFromHierarchy( pGroup ); // delete group from hierarchy delete pGroup; - pGroup = aGroupList.Next(); } + aGroupList.clear(); - aValue <<= sal_False; + aValue <<= sal_False; setProperty( maRootContent, aPropName, aValue ); } @@ -1388,11 +1422,11 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU sal_Bool bResult = sal_False; try { uno::Reference< beans::XPropertySet > xTempFile( - mxFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + mxFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ), uno::UNO_QUERY_THROW ); ::rtl::OUString aTempURL; - uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) ); + uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")) ); aUrl >>= aTempURL; uno::Reference< io::XStream > xStream( xTempFile, uno::UNO_QUERY_THROW ); @@ -1601,7 +1635,7 @@ sal_Bool SfxDocTplService_Impl::removeGroup( const OUString& rGroupName ) uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps( 1 ); - aProps[0] = OUString::createFromAscii( TARGET_URL ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TARGET_URL )); try { @@ -1718,7 +1752,7 @@ sal_Bool SfxDocTplService_Impl::renameGroup( const OUString& rOldName, uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps( 1 ); - aProps[0] = OUString::createFromAscii( TARGET_URL ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TARGET_URL )); ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY; xResultSet = aGroup.createCursor( aProps, eInclude ); @@ -1824,7 +1858,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, // get document service name uno::Reference< frame::XModuleManager > xModuleManager( xFactory->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.frame.ModuleManager" ) ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")) ), uno::UNO_QUERY_THROW ); sDocServiceName = xModuleManager->identify( uno::Reference< uno::XInterface >( rStorable, uno::UNO_QUERY ) ); if ( !sDocServiceName.getLength() ) @@ -1835,18 +1869,18 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, uno::Reference< lang::XMultiServiceFactory > xConfigProvider( xFactory->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")) ), uno::UNO_QUERY_THROW ); uno::Sequence< uno::Any > aArgs( 1 ); beans::PropertyValue aPathProp; - aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" ); + aPathProp.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Setup/Office/Factories/" ) ); aArgs[0] <<= aPathProp; uno::Reference< container::XNameAccess > xSOFConfig( xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), aArgs ), uno::UNO_QUERY_THROW ); @@ -1862,13 +1896,13 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, // find the related type name ::rtl::OUString aTypeName; uno::Reference< container::XNameAccess > xFilterFactory( - xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), + xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), uno::UNO_QUERY_THROW ); uno::Sequence< beans::PropertyValue > aFilterData; xFilterFactory->getByName( aFilterName ) >>= aFilterData; for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ ) - if ( aFilterData[nInd].Name.equalsAscii( "Type" ) ) + if ( aFilterData[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Type" ) ) ) aFilterData[nInd].Value >>= aTypeName; if ( !aTypeName.getLength() ) @@ -1879,16 +1913,16 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, mxType.is() ? uno::Reference< container::XNameAccess >( mxType, uno::UNO_QUERY_THROW ) : uno::Reference< container::XNameAccess >( - xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), + xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ), uno::UNO_QUERY_THROW ); SequenceAsHashMap aTypeProps( xTypeDetection->getByName( aTypeName ) ); uno::Sequence< ::rtl::OUString > aAllExt = - aTypeProps.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Extensions" ), Sequence< ::rtl::OUString >() ); + aTypeProps.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extensions")), Sequence< ::rtl::OUString >() ); if ( !aAllExt.getLength() ) throw uno::RuntimeException(); - ::rtl::OUString aMediaType = aTypeProps.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "MediaType" ), ::rtl::OUString() ); + ::rtl::OUString aMediaType = aTypeProps.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), ::rtl::OUString() ); ::rtl::OUString aExt = aAllExt[0]; if ( !aMediaType.getLength() || !aExt.getLength() ) @@ -1914,9 +1948,9 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, // store template uno::Sequence< PropertyValue > aStoreArgs( 2 ); - aStoreArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aStoreArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); aStoreArgs[0].Value <<= aFilterName; - aStoreArgs[1].Name = ::rtl::OUString::createFromAscii( "DocumentTitle" ); + aStoreArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")); aStoreArgs[1].Value <<= rTemplateName; ::rtl::OUString aCurrentDocumentURL = rStorable->getLocation(); @@ -2013,7 +2047,6 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, INetURLObject aSourceObj( rSourceURL ); if ( rTemplateName.equals( aTitle ) ) { - ///////////////////////////////////////////////////// // addTemplate will sometimes be called just to add an entry in the // hierarchy; the target URL and the source URL will be the same in // this scenario @@ -2032,7 +2065,6 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, return addEntry( aGroup, rTemplateName, aTargetURL2, aType ); } - ///////////////////////////////////////////////////// // copy the template into the new group (targeturl) INetURLObject aTmpURL( aSourceObj ); @@ -2221,8 +2253,6 @@ sal_Bool SfxDocTplService_Impl::renameTemplate( const OUString& rGroupName, } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- SFX_IMPL_XSERVICEINFO( SfxDocTplService, TEMPLATE_SERVICE_NAME, TEMPLATE_IMPLEMENTATION_NAME ) SFX_IMPL_SINGLEFACTORY( SfxDocTplService ) @@ -2362,8 +2392,6 @@ void SAL_CALL SfxDocTplService::update() pImp->update( sal_True ); } -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- //------------------------------------------------------------------------ Updater_Impl::Updater_Impl( SfxDocTplService_Impl* pTemplates ) @@ -2390,8 +2418,6 @@ void SAL_CALL Updater_Impl::onTerminated() } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- WaitWindow_Impl::WaitWindow_Impl() : WorkWindow( NULL, WB_BORDER | WB_3DLOOK ) { @@ -2422,8 +2448,6 @@ void WaitWindow_Impl::Paint( const Rectangle& /*rRect*/ ) } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList, const OUString& rTitle, const OUString& rOwnURL ) @@ -2433,9 +2457,9 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList, uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(3); - aProps[0] = OUString::createFromAscii( TITLE ); - aProps[1] = OUString::createFromAscii( TARGET_URL ); - aProps[2] = OUString::createFromAscii( PROPERTY_TYPE ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); + aProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( TARGET_URL )); + aProps[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( PROPERTY_TYPE )); try { @@ -2454,7 +2478,7 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList, GroupData_Impl *pGroup = new GroupData_Impl( rTitle ); pGroup->setHierarchy( sal_True ); pGroup->setHierarchyURL( rOwnURL ); - rList.Insert( pGroup ); + rList.push_back( pGroup ); uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY ); uno::Reference< XRow > xRow( xResultSet, UNO_QUERY ); @@ -2519,15 +2543,20 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, if ( !aTitle.getLength() ) return; - GroupData_Impl *pGroup = rList.First(); - - while ( pGroup && pGroup->getTitle() != aTitle ) - pGroup = rList.Next(); + GroupData_Impl* pGroup = NULL; + for ( size_t i = 0, n = rList.size(); i < n; ++i ) + { + if ( rList[ i ]->getTitle() == aTitle ) + { + pGroup = rList[ i ]; + break; + } + } if ( !pGroup ) { pGroup = new GroupData_Impl( aTitle ); - rList.Insert( pGroup ); + rList.push_back( pGroup ); } if ( bWriteableGroup ) @@ -2539,7 +2568,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, Content aContent; uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(1); - aProps[0] = OUString::createFromAscii( TITLE ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); try { @@ -2607,7 +2636,7 @@ void SfxDocTplService_Impl::createFromContent( GroupList_Impl& rList, uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps(1); - aProps[0] = OUString::createFromAscii( TITLE ); + aProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( TITLE )); try { @@ -2749,8 +2778,6 @@ void SfxDocTplService_Impl::removeFromHierarchy( GroupData_Impl *pGroup ) } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- GroupData_Impl::GroupData_Impl( const OUString& rTitle ) { maTitle = rTitle; @@ -2761,12 +2788,9 @@ GroupData_Impl::GroupData_Impl( const OUString& rTitle ) // ----------------------------------------------------------------------- GroupData_Impl::~GroupData_Impl() { - DocTemplates_EntryData_Impl *pData = maEntries.First(); - while ( pData ) - { - delete pData; - pData = maEntries.Next(); - } + for ( size_t i = 0, n = maEntries.size(); i < n; ++i ) + delete maEntries[ i ]; + maEntries.clear(); } // ----------------------------------------------------------------------- @@ -2775,12 +2799,20 @@ DocTemplates_EntryData_Impl* GroupData_Impl::addEntry( const OUString& rTitle, const OUString& rType, const OUString& rHierURL ) { - DocTemplates_EntryData_Impl *pData = maEntries.First(); + DocTemplates_EntryData_Impl* pData = NULL; + bool EntryFound = false; - while ( pData && pData->getTitle() != rTitle ) - pData = maEntries.Next(); + for ( size_t i = 0, n = maEntries.size(); i < n; ++i ) + { + pData = maEntries[ i ]; + if ( pData->getTitle() == rTitle ) + { + EntryFound = true; + break; + } + } - if ( !pData ) + if ( !EntryFound ) { pData = new DocTemplates_EntryData_Impl( rTitle ); pData->setTargetURL( rTargetURL ); @@ -2790,7 +2822,7 @@ DocTemplates_EntryData_Impl* GroupData_Impl::addEntry( const OUString& rTitle, pData->setHierarchyURL( rHierURL ); pData->setHierarchy( sal_True ); } - maEntries.Insert( pData ); + maEntries.push_back( pData ); } else { @@ -2814,8 +2846,6 @@ DocTemplates_EntryData_Impl* GroupData_Impl::addEntry( const OUString& rTitle, } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- DocTemplates_EntryData_Impl::DocTemplates_EntryData_Impl( const OUString& rTitle ) { maTitle = rTitle; @@ -2922,3 +2952,4 @@ void SfxURLRelocator_Impl::makeAbsoluteURL( rtl::OUString & rURL ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 277199d30051..46c1c639159c 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,24 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/StringPair.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP #include <com/sun/star/io/XActiveDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP #include <com/sun/star/xml/sax/XParser.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP #include <com/sun/star/lang/IllegalArgumentException.hpp> -#endif #include <comphelper/attributelist.hxx> @@ -261,3 +250,4 @@ void SAL_CALL DocTemplLocaleHelper::setDocumentLocator( const uno::Reference< xm { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx index 84b1a9cc9611..720cb62b71c0 100644 --- a/sfx2/source/doc/doctemplateslocal.hxx +++ b/sfx2/source/doc/doctemplateslocal.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _SFX_DOCTEMPLATESLOCAL_HXX #define _SFX_DOCTEMPLATESLOCAL_HXX -#ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> @@ -86,3 +85,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx index 8fa7dd29ac39..8fa7dd29ac39 100755..100644 --- a/sfx2/source/doc/docundomanager.cxx +++ b/sfx2/source/doc/docundomanager.cxx diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index 9b67da63ab74..4a81f92e2c4c 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,7 @@ #include <stdio.h> -#ifndef _SV_PRNSETUP_HXX //autogen #include <svtools/prnsetup.hxx> -#endif #include <vcl/cmdevt.hxx> #include <vcl/menubtn.hxx> #include <vcl/msgbox.hxx> @@ -73,9 +72,7 @@ #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <svtools/localresaccess.hxx> -#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ #include <svtools/addresstemplate.hxx> -#endif #include <comphelper/processfactory.hxx> #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> @@ -107,19 +104,13 @@ public: inline void SfxOrganizeListBox_Impl::SetBitmaps( - const Image &rOFolder, const Image &rCFolder, const Image &rODoc, const Image &rCDoc, - const Image &rOFolderHC, const Image &rCFolderHC, const Image &rODocHC, const Image &rCDocHC ) + const Image &rOFolder, const Image &rCFolder, const Image &rODoc, const Image &rCDoc ) { aOpenedFolderBmp = rOFolder; aClosedFolderBmp = rCFolder; aOpenedDocBmp = rODoc; aClosedDocBmp = rCDoc; - aOpenedFolderBmpHC = rOFolderHC; - aClosedFolderBmpHC = rCFolderHC; - aOpenedDocBmpHC = rODocHC; - aClosedDocBmpHC = rCDocHC; - } //========================================================================= @@ -240,8 +231,8 @@ SfxOrganizeDlg_Impl::SfxOrganizeDlg_Impl( SfxTemplateOrganizeDlg* pParent, const_cast< SfxDocumentTemplates* >( aMgr.GetTemplates() )->Update( sal_True /* be smart */ ); // this const_cast is a hack - but the alternative would be to // * have a method which returns the templates non-const - // * use a new SfxDocumentTemplates instance for the update (knowing that they all share the same - // implementation class) + // * use a new SfxDocumentTemplates instance for the update + // (knowing that they all share the same implementation class) // * always work with an own instance, even if we get only NULL in this ctor } @@ -328,25 +319,18 @@ void SfxOrganizeDlg_Impl::InitBitmaps( void ) Image aOpenedDocBmp( SfxResId( IMG_OPENED_DOC ) ); Image aClosedDocBmp( SfxResId( IMG_CLOSED_DOC ) ); - Image aOpenedFolderBmpHC( SfxResId( IMG_OPENED_FOLDER_HC ) ); - Image aClosedFolderBmpHC( SfxResId( IMG_CLOSED_FOLDER_HC ) ); - Image aOpenedDocBmpHC( SfxResId( IMG_OPENED_DOC_HC ) ); - Image aClosedDocBmpHC( SfxResId( IMG_CLOSED_DOC_HC ) ); - - aLeftLb.SetBitmaps( aOpenedFolderBmp, aClosedFolderBmp, aOpenedDocBmp, aClosedDocBmp, - aOpenedFolderBmpHC, aClosedFolderBmpHC, aOpenedDocBmpHC, aClosedDocBmpHC ); - aRightLb.SetBitmaps( aOpenedFolderBmp, aClosedFolderBmp, aOpenedDocBmp, aClosedDocBmp, - aOpenedFolderBmpHC, aClosedFolderBmpHC, aOpenedDocBmpHC, aClosedDocBmpHC ); + aLeftLb.SetBitmaps( aOpenedFolderBmp, aClosedFolderBmp, aOpenedDocBmp, aClosedDocBmp ); + aRightLb.SetBitmaps( aOpenedFolderBmp, aClosedFolderBmp, aOpenedDocBmp, aClosedDocBmp ); } //========================================================================= -sal_Bool QueryDelete_Impl(Window *pParent, // Parent der QueryBox +sal_Bool QueryDelete_Impl(Window *pParent, // Parent to QueryBox sal_uInt16 nId, // Resource Id - const String &rTemplateName) // Name der zu l"oschenden Vorlage -/* [Beschreibung] + const String &rTemplateName) // Name of template to be deleted +/* [Description] - "oschabfrage + Delete Query */ { @@ -361,10 +345,9 @@ sal_Bool QueryDelete_Impl(Window *pParent, // Parent der QueryBox void ErrorDelete_Impl(Window *pParent, const String &rName, sal_Bool bFolder = sal_False ) -/* [Beschreibung] - - Benutzerinformation, da"s die Vorlage rName nicht gel"oscht werden konnte +/* [Description] + User information that the template rName could not be deleted. */ { if ( bFolder ) @@ -383,10 +366,9 @@ void ErrorDelete_Impl(Window *pParent, const String &rName, sal_Bool bFolder = s //========================================================================= -/* [Beschreibung] - - Implementierungsklasse; Referenzklasse f"ur USHORT-Array +/* [Description] + Implementation class, the benchmark for sal_uInt16-Array */ struct ImpPath_Impl @@ -420,17 +402,15 @@ ImpPath_Impl::ImpPath_Impl( const ImpPath_Impl& rCopy ) : //========================================================================== -/* [Beschreibung] - - Implementierungsklasse; Darstellung einer Position in der Outline- - Listbox als sal_uInt16-Array; dieses beschreibt die Position jeweil - als relative Postion zum "ubergeordneten Eintrag +/* [Description] + Implementation class, presentation of a position in the Outline- + Listbox ass sal_uInt16-Array, this describes the position of each as + Postions relative to the parent entry */ class Path { ImpPath_Impl *pData; - void NewImp(); public: Path(SvLBox *pBox, SvLBoxEntry *pEntry); Path(const Path &rPath): @@ -481,40 +461,28 @@ Path::Path(SvLBox *pBox, SvLBoxEntry *pEntry) : //------------------------------------------------------------------------- -void Path::NewImp() -{ - if(pData->nRef != 1) - { - pData->nRef--; - pData = new ImpPath_Impl(*pData); - } -} - -//------------------------------------------------------------------------- - SvLBoxEntry *GetIndices_Impl(SvLBox *pBox, SvLBoxEntry *pEntry, sal_uInt16 &rRegion, sal_uInt16 &rOffset) -/* [Beschreibung] +/* [Description] - Bereich und Position innerhalb eines Bereiches f"ur eine - Dokumentvorlage wird ermittelt. + Region and position within a range for a template is determined. [Parameter] - SvLBox *pBox Listbox, an der das Ereignis auftrat - SvLBoxEntry *pEntry Eintrag, dessen Position ermittelt werden soll - sal_uInt16 &rRegion der Bereich innerhalb der Bereiche der - Dokumentvorlagen (Out-Parameter) - sal_uInt16 &rOffset die Position innerhalb des Bereiches - Dokumentvorlagen (Out-Parameter) + SvLBox *pBox Listbox where the event occurred + SvLBoxEntry *pEntry Entry whose position is to be determined + sal_uInt16 &rRegion the region within the region of the + document template (Out-Parameter) + sal_uInt16 &rOffset the position within the region of the + document template (Out-Parameter) - [Querverweise] - <class Path> (unter Umst"anden kann auf diese Funktion zugunsten - von Path verzichtet werden.) + [Cross-references] + <class Path> (in certain circumstances this function can also be + dispensed in favor of the Path) */ { @@ -550,7 +518,7 @@ sal_Bool SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, sal_Bool bSelect // it is ok to use the SfxObjectShellRef here since the object that // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it GetObjectShell(aPath)->TriggerHelpPI( - aPath[nLevel+1], aPath[nLevel+2], aPath[nLevel+3]); + aPath[nLevel+1], aPath[nLevel+2]); return SvTreeListBox::Select(pEntry,bSelect); } @@ -562,24 +530,24 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy) -/* [Beschreibung] +/* [Description] - Verschieben oder Kopieren von Dokumentvorlagen + Move or copy a document templates [Parameter] - SvLBox *pSourceBox Quell-Listbox, an der das Ereignis auftrat - SvLBoxEntry *pSource Quell-Eintrag, der kopiert / verschoben werden soll - SvLBoxEntry* pTarget Ziel-Eintrag, auf den verschoben werden soll - SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten - Eintrags (Out-Parameter) - sal_uIntPtr &rIdx Index des Zieleintrags - sal_Bool bCopy Flag f"ur Kopieren / Verschieben + SvLBox *pSourceBox Source Listbox, at which the event occurred + SvLBoxEntry* pTarget Target entry, to where it will be moved + SvLBoxEntry *pSource Source entry, to be copied / moved + SvLBoxEntry *&pNewParent the parent of the target position generated + at entry (out parameter) + sal_uIntPtr &rIdx Index of the target entry + sal_Bool bCopy Flag for Copy / Move - [Returnwert] sal_Bool: Erfolg oder Mi"serfolg + [Return value] sal_Bool: Success or failure - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *pSource, @@ -653,24 +621,24 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, SvLBoxEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy) -/* [Beschreibung] +/* [Description] - Verschieben oder Kopieren von Dokumentinhalten + Move or copy document contents [Parameter] - SvLBox *pSourceBox Quell-Listbox, an der das Ereignis auftrat - SvLBoxEntry *pSource Quell-Eintrag, der kopiert / verschoben werden soll - SvLBoxEntry* pTarget Ziel-Eintrag, auf den verschoben werden soll - SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten - Eintrags (Out-Parameter) - sal_uIntPtr &rIdx Index des Zieleintrags - sal_Bool bCopy Flag f"ur Kopieren / Verschieben + SvLBox *pSourceBox Source Listbox, at which the event occurred + SvLBoxEntry* pTarget Target entry, to where it will be moved + SvLBoxEntry *pSource Source entry, to be copied / moved + SvLBoxEntry *&pNewParent the parent of the target position generated + at entry (out parameter) + sal_uIntPtr &rIdx Index of the target entry + sal_Bool bCopy Flag for Copy / Move - [Returnwert] sal_Bool: Erfolg oder Mi"serfolg + [Return value] sal_Bool: Success or failure - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *pSource, @@ -724,16 +692,16 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, *aSourceDoc, aSource[nSLevel+1], aSource[nSLevel+2], aSource[nSLevel+3], p[0], p[1], p[2], nIdxDeleted); - // Positionskorrektur auswerten - // a = Dokumentinhalt - // b = Position Sub-Inhalt 1 - // c = Position Sub-Inhalt 2 - // doppelte Eintraege loeschen + // Evaluate Position correction + // a = Document content + // b = Position Sub-content 1 + // c = Position Sub-content 2 + // Delete duplicate entries if(bOk) { SvLBoxEntry *pParentIter = pTarget; - // bis auf die DokumentEbene nach oben als - // allgemeiner Bezugspunkt + // Up to the document level as + // the general reference point while(GetModel()->GetDepth(pParentIter) != nTLevel) pParentIter = GetParent(pParentIter); if(pParentIter->HasChildsOnDemand() && @@ -745,12 +713,12 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, while(i < 2 && p[i+1] != INDEX_IGNORE) { pChildIter = FirstChild(pParentIter); - // bis zum Index der aktuellen Ebene + // To the index of the current level for(sal_uInt16 j = 0; j < p[i]; ++j) pChildIter = NextSibling(pChildIter); - // gfs Fuellen bei Items onDemand + // If possible, fill in Items onDemand ++i; - if(p[i+1] != INDEX_IGNORE && + if(i < 2 && p[i+1] != INDEX_IGNORE && pChildIter->HasChildsOnDemand() && !GetModel()->HasChilds(pChildIter)) RequestingChilds(pChildIter); @@ -766,8 +734,8 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, if(!bCopy) pSourceBox->GetModel()->Remove(pSource); } - // Geloeschte Eintraege entfernen - // (kann durch Ueberschreiben geschehen) + // Remove deleted items + // (can be done by overwriting) if(nIdxDeleted != INDEX_IGNORE) { pChildIter = FirstChild(pParentIter); @@ -783,7 +751,7 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, } if(!bCopy && &aSourceDoc != &aTargetDoc) { - //#109566# pool styles that are moved produce + //pool styles that are moved produce //an rIdx == INDEX_IGNORE //the method has to return true to keep the box content consistent bRemovedFromSource = aSourceDoc->Remove(aSource[nSLevel+1], @@ -792,7 +760,6 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, } } } -// rIdx++; return (((rIdx != INDEX_IGNORE)|| bRemovedFromSource) && bOk ) ? bKeepExpansion? (sal_Bool)2: sal_True: sal_False; } @@ -804,23 +771,23 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, SvLBoxEntry *&pNewParent, sal_uIntPtr &rIdx) -/* [Beschreibung] +/* [Description] - Benachrichtigung, da"s ein Eintrag verschoben werden soll + Notification that an item will be moved. (SV-Handler) [Parameter] - SvLBoxEntry* pTarget Ziel-Eintrag, auf den verschoben werden soll - SvLBoxEntry *pSource Quell-Eintrag, der verschoben werden soll - SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten - Eintrags (Out-Parameter) - sal_uIntPtr &rIdx Index des Zieleintrags + SvLBoxEntry* pTarget Target entry, to where it will be moved + SvLBoxEntry *pSource Source entry, to be moved + SvLBoxEntry *&pNewParent the parent of the target position generated + at entry (out parameter) + sal_uIntPtr &rIdx Index of the target entry - [Returnwert] sal_Bool: Erfolg oder Mi"serfolg + [Return value] sal_Bool: Sucess or failure - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *pSource, @@ -864,23 +831,22 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, SvLBoxEntry* pSource, SvLBoxEntry *&pNewParent, sal_uIntPtr &rIdx) -/* [Beschreibung] +/* [Description] - Benachrichtigung, da"s ein Eintrag kopiert werden soll + Notification that an item will be moved. (SV-Handler) [Parameter] - SvLBoxEntry* pTarget Ziel-Eintrag, auf den kopiert werden soll - SvLBoxEntry *pSource Quell-Eintrag, der kopiert werden soll - SvLBoxEntry *&pNewParent der Parent der an der Zielposition erzeugten - Eintrags (Out-Parameter) - sal_uIntPtr &rIdx Index des Zieleintrags + SvLBoxEntry* pTarget Target entry, to where it will be copied + SvLBoxEntry *pSource Source entry, to be copied + SvLBoxEntry *&pNewParent the parent of the target position generated + at entry (out parameter) + sal_uIntPtr &rIdx Index of the target entry + [Return value] sal_Bool: Sucess or failure - [Returnwert] sal_Bool: Erfolg oder Mi"serfolg - - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvLBox *pSourceBox, SvLBoxEntry *pSource, @@ -920,12 +886,12 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& ) -/* [Beschreibung] +/* [Description] - Nachfrage, ob ein Eintrag editierbar ist + Check whether an item can be edited (SV-Handler) - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rText)> */ @@ -943,23 +909,23 @@ sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rText) -/* [Beschreibung] +/* [Description] - Der Name eines Eintrags wurde bearbeitet; ist der eingegebene Name - ein g"ultiger Name ("ange > 0), wird das Model aktualisiert. + The name of an entry has been processed, if the name you entered is a + valid name (length> 0) then the model is updated. (SV-Handler) - [Returnwert] + [Return value] - sal_Bool sal_True: der Name soll in der Anzeige ge"andert werden - sal_False:der Name soll nicht ge"andert werden + sal_Bool sal_True: The name in the display should be changed + sal_False: The name should not be changed - [Querverweise] + [Cross-references] <SfxOrganizeListBox_Impl::EditingEntry(SvLBoxEntry* pEntry, const String& rText)> */ { - DBG_ASSERT(pEntry, "kein Entry selektiert"); + DBG_ASSERT(pEntry, "No Entry selected"); delete pDlg->pSuspend; pDlg->pSuspend = NULL; SvLBoxEntry* pParent = GetParent(pEntry); @@ -992,12 +958,7 @@ sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& ErrorBox( this, aResId ).Execute(); return sal_False; } -/* - else - { - SfxTemplateOrganizeDlg* pDlg = (SfxTemplateOrganizeDlg*)Window::GetParent(); - } -*/ + return sal_True; } @@ -1121,14 +1082,14 @@ void SfxOrganizeListBox_Impl::DragFinished( sal_Int8 nDropAction ) inline sal_uInt16 SfxOrganizeListBox_Impl::GetDocLevel() const -/* [Beschreibung] +/* [Description] - Ermittelt, auf welche Ebene sich Dokumente befinden (unterschiedlich - in der Dokumentvorlagensicht und der Dokumentensicht) + Determines on which level there are documents (in the template view or + the document view) - [Returnwert] + [Return value] - sal_uInt16 Die Ebene der Dokumente + sal_uInt16 Document level */ @@ -1140,20 +1101,19 @@ inline sal_uInt16 SfxOrganizeListBox_Impl::GetDocLevel() const SfxObjectShellRef SfxOrganizeListBox_Impl::GetObjectShell(const Path &rPath) -/* [Beschreibung] +/* [Description] - Zugriff auf die ObjectShell, die dem aktuellen Eintrag zugeordnet - ist. + Access to the ObjectShell to which the current entry is connected. [Parameter] - const Path &rPath Beschreibung des aktuellen Eintrags + const Path &rPath Description of the current entry - [Returnwert] + [Return value] - SfxObjectShellRef Referenz auf die ObjectShell + SfxObjectShellRef Reference to the ObjectShell - [Querverweise] + [Cross-references] <class Path> @@ -1172,37 +1132,26 @@ SfxObjectShellRef SfxOrganizeListBox_Impl::GetObjectShell(const Path &rPath) void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) -/* [Beschreibung] +/* [Description] - Aufforderung, der Childs eines Eintrags einzuf"ugen - ist. + Sent to the Childs of an entry that is going to be inserted. (SV-Handler) [Parameter] - SvLBoxEntry* pEntry der Eintrag, dessen Childs erfragt werden - - + SvLBoxEntry* pEntry the entry whose Childs is requested */ { - // wenn keine Childs vorhanden sind, gfs. Childs - // einfuegen - BmpColorMode eColorMode = BMP_COLOR_NORMAL; - - if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) - eColorMode = BMP_COLOR_HIGHCONTRAST; - - if ( !GetModel()->HasChilds( pEntry ) ) { WaitObject aWaitCursor( this ); - // Choose the correct mask color dependent from eColorMode. This must be adopted if - // we change the mask color for normal images, too! + // Choose the correct mask color dependent from eColorMode. This + // must be adopted if we change the mask color for normal images, too! Color aMaskColor( COL_LIGHTMAGENTA ); - // hier sind alle initial eingefuegt + // Here are all the initial inserted SfxErrorContext aEc(ERRCTX_SFX_CREATEOBJSH, pDlg->pDialog); if(VIEW_TEMPLATES == GetViewType() && 0 == GetModel()->GetDepth(pEntry)) { @@ -1221,19 +1170,18 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) SfxObjectShellRef aRef = GetObjectShell(aPath); if(aRef.Is()) { - const sal_uInt16 nCount = aRef->GetContentCount( - aPath[nDocLevel+1], aPath[nDocLevel+2]); + const sal_uInt16 nCount = aRef->GetContentCount(aPath[nDocLevel+1]); String aText; Bitmap aClosedBmp, aOpenedBmp; - const sal_Bool bCanHaveChilds = + const bool bCanHaveChilds = aRef->CanHaveChilds(aPath[nDocLevel+1], aPath[nDocLevel+2]); for(sal_uInt16 i = 0; i < nCount; ++i) { sal_Bool bDeletable; aRef->GetContent( - aText, aClosedBmp, aOpenedBmp, eColorMode, bDeletable, - i, aPath[nDocLevel+1], aPath[nDocLevel+2]); + aText, aClosedBmp, aOpenedBmp, bDeletable, + i, aPath[nDocLevel+1]); // Create image with the correct mask color Image aClosedImage( aClosedBmp, aMaskColor ); @@ -1253,14 +1201,11 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) long SfxOrganizeListBox_Impl::ExpandingHdl() -/* [Beschreibung] - - SV-Handler, der nach dem und vor dem Aufklappen eines Eintrags - gerufen wird. - Wird verwendet, um gfs. die ObjectShell wieder zu schlie"sen; - die Eintr"age mit den Inhalten dieser Shell werden ebenfalls - entfernt. +/* [Description] + SV-handler, before and after the unfolding of an entry is called. + Used if possibly to close the ObjectShell again, the entries with the + contents of this shell are also removed. */ { @@ -1272,12 +1217,12 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() (eViewType == VIEW_TEMPLATES && nLevel == 1)) { Path aPath(this, pEntry); - // Beim Schliessen des Files die ObjectShell freigeben + // Release ObjectShell when closing the files if(eViewType == VIEW_FILES && nLevel == 0) pMgr->DeleteObjectShell(aPath[0]); else pMgr->DeleteObjectShell(aPath[0], aPath[1]); - // alle SubEntries loeschen + // Delete all SubEntries SvLBoxEntry *pToDel = SvLBox::GetEntry(pEntry, 0); while(pToDel) { @@ -1294,18 +1239,18 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, SvLBoxEntry* pParent, SvLBoxEntry *pEntry) const -/* [Beschreibung] +/* [Description] - Pr"uft, ob eine Name auf seiner Ebene eindeutig ist. + Checks whether a name is unique at its level. [Parameter] - const String & Name des zu suchenden Eintrags - SvLBoxEntry* pSibling Geschwister (bezeichnet die Ebene) + const String & Name of the search entry + SvLBoxEntry* pSibling Siblings (referred to the level) - [Returnwert] + [Return value] - sal_Bool sal_True, wenn der Name eindeutig ist, sonst sal_False + sal_Bool sal_True, if the name is unique, otherwise sal_False */ { @@ -1334,39 +1279,37 @@ sal_uInt16 SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) con //------------------------------------------------------------------------- -SvLBoxEntry* SfxOrganizeListBox_Impl::InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, - SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uIntPtr nPos, void* pUserData ) +SvLBoxEntry* SfxOrganizeListBox_Impl::InsertEntryByBmpType( + const XubString& rText, + BMPTYPE eBmpType, + SvLBoxEntry* pParent, + sal_Bool bChildsOnDemand, + sal_uIntPtr nPos, + void* pUserData +) { SvLBoxEntry* pEntry = NULL; const Image* pExp = NULL; const Image* pCol = NULL; - const Image* pExpHC = NULL; - const Image* pColHC = NULL; switch( eBmpType ) { case BMPTYPE_FOLDER: pExp = &aOpenedFolderBmp; pCol = &aClosedFolderBmp; - pExpHC = &aOpenedFolderBmpHC; - pColHC = &aClosedFolderBmpHC; break; - default: - DBG_ERROR( "SfxOrganizeListBox_Impl::InsertEntryByBmpType(): something forgotten?!" ); case BMPTYPE_DOC: pExp = &aOpenedDocBmp; pCol = &aClosedDocBmp; - pExpHC = &aOpenedDocBmpHC; - pColHC = &aClosedDocBmpHC; break; + + default: + OSL_FAIL( "SfxOrganizeListBox_Impl::InsertEntryByBmpType(): something forgotten?!" ); } pEntry = SvTreeListBox::InsertEntry( rText, *pExp, *pCol, pParent, bChildsOnDemand, nPos, pUserData ); - SetExpandedEntryBmp( pEntry, *pExpHC, BMP_COLOR_HIGHCONTRAST ); - SetCollapsedEntryBmp( pEntry, *pColHC, BMP_COLOR_HIGHCONTRAST ); - return pEntry; } @@ -1386,9 +1329,9 @@ SfxOrganizeListBox_Impl::SfxOrganizeListBox_Impl pDlg ( pArgDlg ), eViewType ( eType ) -/* [Beschreibung] +/* [Description] - Konstruktor SfxOrganizeListBox + Constructor SfxOrganizeListBox */ @@ -1435,15 +1378,14 @@ IMPL_LINK( SfxOrganizeListBox_Impl, OnAsyncExecuteDrop, ExecuteDropEvent*, pEven void SfxOrganizeListBox_Impl::Reset() -/* [Beschreibung] - - Einf"ugen der Elemente in die ListBox +/* [Description] + Paste the items in the ListBox */ { - DBG_ASSERT( pMgr != 0, "kein Manager" ); - // Inhalte l"oschen + DBG_ASSERT( pMgr != 0, "No Manager" ); + // Delete contents SetUpdateMode(sal_False); Clear(); if ( VIEW_TEMPLATES == eViewType ) @@ -1469,31 +1411,30 @@ void SfxOrganizeListBox_Impl::Reset() const Image &SfxOrganizeListBox_Impl::GetClosedBmp(sal_uInt16 nLevel) const -/* [Beschreibung] +/* [Description] - Zugriff auf die Bitmap f"ur einen geschlossenen Eintrag - der jeweiligen Ebene + Access to the bitmap for a closed entry at each level [Parameter] - sal_uInt16 nLevel Angabe der Ebene, 2 Ebenen sind erlaubt + sal_uInt16 nLevel Indicator of the level, 2 levels are allowed - [Returnwert] - - const Image & das Image auf der Ebenen nLevel + [Return value] + const Image & The Image on level nLevel */ { - sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) { - default: DBG_ERROR( "Bitmaps ueberindiziert" ); + default: OSL_FAIL( "Bitmap index overflow" ); - case 0: pRet = bHC? &aClosedFolderBmpHC : &aClosedFolderBmp; break; - case 1: pRet = bHC? &aClosedDocBmpHC : &aClosedDocBmp; break; + case 0: pRet = &aClosedFolderBmp; + break; + case 1: pRet = &aClosedDocBmp; + break; } return *pRet; @@ -1503,33 +1444,31 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(sal_uInt16 nLevel) const const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(sal_uInt16 nLevel) const -/* [Beschreibung] +/* [Description] - Zugriff auf die Bitmap f"ur einen ge"offneten Eintrag - der jeweiligen Ebene + Access to the bitmap for an open entry at each level [Parameter] - sal_uInt16 nLevel Angabe der Ebene, 2 Ebenen sind erlaubt + sal_uInt16 nLevel Indicator of the level, 2 levels are allowed - [Returnwert] + [Return value] - const Image & das Image auf der Ebenen nLevel + const Image & the image on the level nLevel */ { - sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); const Image* pRet = NULL; switch( nLevel ) { case 0: - pRet = bHC ? &aOpenedFolderBmpHC : &aOpenedFolderBmp; break; + pRet = &aOpenedFolderBmp; break; case 1: - pRet = bHC ? &aOpenedDocBmpHC : &aOpenedDocBmp; break; + pRet = &aOpenedDocBmp; break; default: - pRet = bHC ? &aClosedFolderBmpHC : &aClosedFolderBmp; break; + pRet = &aClosedFolderBmp; break; } return *pRet; @@ -1546,18 +1485,17 @@ PopupMenu* SfxOrganizeListBox_Impl::CreateContextMenu() String SfxOrganizeDlg_Impl::GetPath_Impl( sal_Bool bOpen, const String& rFileName ) -/* [Beschreibung] +/* [Description] - Pfad per FileDialog erfragen, f"ur Import / Export von - Dokumentvorlagen + Get path from FileDialog, for Import / Export of Templates [Parameter] - sal_Bool bOpen Flag: "Offnen / Speichern - const String& rFileName aktueller Dateiname als Vorschlag + sal_Bool bOpen Flag: Open / Save + const String& rFileName Current file name as default - [R"uckgabewert] Dateiname mit Pfad oder Leerstring, wenn - der Benutzer 'Abbrechen' gedr"uckt hat + [Return value] File name with path or empty string if + users has pressed 'Cancel' */ { @@ -1741,12 +1679,12 @@ sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) pFocusBox->GetViewType()) nDepth++; if( (nDepth > 2 && !pEntry->GetUserData()) || - //Delete ueber GetContent verboten - nDepth==2 || //Vorlage / Konfigurtionsrubrik nicht loeshcen + //Delete using GetContent forbidden + nDepth==2 || // Template / Not deleting config header (nDepth==1 && SfxOrganizeListBox_Impl::VIEW_FILES == - pFocusBox->GetViewType()) || //Files nicht loeschen + pFocusBox->GetViewType()) || //Not deleting Files (0 == nDepth && pFocusBox->GetLevelCount_Impl(0) < 2)) - //Mindestens eine Vorlage behalten + //At least keep one template { return sal_True; } @@ -1813,17 +1751,16 @@ sal_Bool SfxOrganizeDlg_Impl::GetServiceName_Impl( String& rName, String& rFileU long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) -/* [Beschreibung] +/* [Description] - Verarbeiten der Events aus MenuButton oder Accelerator + Processing the events from MenuButton or Accelerator [Parameter] - sal_uInt16 nId ID des Events - - [R"uckgabewert] 1: Event wurde verarbeitet, - 0: Event wurde nicht verarbeitet (SV-Menu) + sal_uInt16 nId Event ID + [Return value] 1: Event has been processed, + 0: Event has not been processed (SV-Menu) */ { @@ -1889,7 +1826,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) ( nDeleteInd == USHRT_MAX && pFocusBox->GetChildCount(pEntry) ) ); } } - // Inhaltsformen + //Content Format else if(nDepth + pFocusBox->GetDocLevel() >= 2) { if(!QueryDelete_Impl(pDialog, STR_DELETE_TEMPLATE, pFocusBox->GetEntryText(pEntry))) @@ -2025,17 +1962,16 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) IMPL_LINK_INLINE_START( SfxOrganizeDlg_Impl, MenuSelect_Impl, Menu *, pMenu ) -/* [Beschreibung] +/* [Description] - SelectHandler des Men"us des Men"ubuttons (SV) + SelectHandler of Menu and Menubuttons (SV) [Parameter] - MenuButton *pBtn der das Event ausl"osende Button - - [R"uckgabewert] 1: Event wurde verarbeitet, - 0: Event wurde nicht verarbeitet (SV-Menu) + MenuButton *pBtn Button triggering the event + [Return value] 1: Event has been processed, + 0: Event has not been processed (SV-Menu) */ { return Dispatch_Impl( pMenu->GetCurItemId(), pMenu ); @@ -2046,17 +1982,16 @@ IMPL_LINK_INLINE_END( SfxOrganizeDlg_Impl, MenuSelect_Impl, Menu *, pMenu ) IMPL_LINK( SfxOrganizeDlg_Impl, AccelSelect_Impl, Accelerator *, pAccel ) -/* [Beschreibung] +/* [Description] - SelectHandler des Accelerators (SV) + SelectHandler of Accelerators (SV) [Parameter] - Accelerator *pAccel der das Event ausl"osende Accelerator - - [R"uckgabewert] 1: Event wurde verarbeitet, - 0: Event wurde nicht verarbeitet (SV) + Accelerator *pAccel Accelerator triggering the event + [Return value] 1: Event has been processed, + 0: Event has not been processed (SV) */ { @@ -2079,17 +2014,16 @@ void SfxOrganizeDlg_Impl::OkHdl(Button *pButton) IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) -/* [Beschreibung] +/* [Description] - ActivateHandler des Men"us des Men"ubuttons (SV) + ActivateHandler of Menu and Menubuttons (SV) [Parameter] - Menu *pMenu das das Event ausl"osende Men"u - - [R"uckgabewert] 1: Event wurde verarbeitet, - 0: Event wurde nicht verarbeitet (SV-Menu) + Menu *pMenu Event triggering the Menu + [Return value] 1: Event has been processed, + 0: Event has not been processed (SV-Menu) */ { if ( pFocusBox && pFocusBox->IsEditingActive() ) @@ -2100,11 +2034,11 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) ( bEnable && pFocusBox->GetSelectionCount() ) ? pFocusBox->GetModel()->GetDepth( pEntry ) : 0; const sal_uInt16 nDocLevel = bEnable ? pFocusBox->GetDocLevel() : 0; int eVT = pFocusBox ? pFocusBox->GetViewType() : 0; - // nur Vorlagen anlegen + // Create only Template pMenu->EnableItem( ID_NEW, bEnable && 0 == nDepth && SfxOrganizeListBox_Impl::VIEW_TEMPLATES == eVT ); - // Vorlagen: Loeschen Ebene 0,1,3ff - // ein Bereich mu"s mindestens erhalten bleiben - // Dateien : Loeschen Ebene > 2 + // Template: Delete level 0,1,3ff + // At least one region must be retained + // Files: Delete level> 2 pMenu->EnableItem( ID_DELETE, bEnable && !DontDelete_Impl( pEntry ) ); pMenu->EnableItem( ID_EDIT, @@ -2153,7 +2087,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) String aTitle = SvFileInformationManager::GetDescription( INetURLObject(aObjFacURL) ); pSubMenu->InsertItem( nItemId, aTitle, - SvFileInformationManager::GetImage(INetURLObject(aObjFacURL)) ); + SvFileInformationManager::GetImage(INetURLObject(aObjFacURL), false) ); pSubMenu->SetItemCommand( nItemId++, aObjFacURL ); DBG_ASSERT( nItemId <= ID_RESET_DEFAULT_TEMPLATE_END, "menu item id overflow" ); } @@ -2172,17 +2106,14 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) IMPL_LINK( SfxOrganizeDlg_Impl, GetFocus_Impl, SfxOrganizeListBox_Impl *, pBox ) -/* [Beschreibung] +/* [Description] - GetFocus-Handler, wird aus den Select-Handler der Listboxen - gerufen. - Wird verwendet, im die Listbox, die den Focus besitzt sowie - deren Zustand zu ermitteln. + GetFocus-Handler, is called from the Select-Handler of ListBox + Used in the listBox that has the focus and to determine its condition. [Parameter] - SfxOrganizeListBox *pBox die rufende Box - + SfxOrganizeListBox *pBox The calling Box */ { @@ -2198,17 +2129,15 @@ IMPL_LINK( SfxOrganizeDlg_Impl, GetFocus_Impl, SfxOrganizeListBox_Impl *, pBox ) IMPL_LINK( SfxOrganizeDlg_Impl, LeftListBoxSelect_Impl, ListBox *, pBox ) -/* [Beschreibung] +/* [Description] - Select-Handler, wird aus den Select-Handler der Listboxen - gerufen. - Wenn sich der Modus der Boxen (Dokumentsicht, Dokumentvorlagensicht) - unterscheiden, werden die Models getrennt; andernfalls zusammengefa"st. + Select-Handler, is called from the Select-Handler of ListBox. + If the mode of the Boxes are different (Document view or Template view) + then the models are separated, otherwise joined together. [Parameter] - ListBox *pBox die rufende Box - + ListBox *pBox The calling Box */ { const SfxOrganizeListBox_Impl::DataEnum @@ -2232,17 +2161,15 @@ IMPL_LINK( SfxOrganizeDlg_Impl, LeftListBoxSelect_Impl, ListBox *, pBox ) IMPL_LINK( SfxOrganizeDlg_Impl, RightListBoxSelect_Impl, ListBox *, pBox ) -/* [Beschreibung] +/* [Description] - Select-Handler, wird aus den Select-Handler der Listboxen - gerufen. - Wenn sich der Modus der Boxen (Dokumentsicht, Dokumentvorlagensicht) - unterscheiden, werden die Models getrennt; andernfalls zusammengefa"st. + Select-Handler, will be called by Select-Handler of the ListBox. + If the mode of the Boxes are different (Document view or Template view) + then the models are separated, otherwise joined together. [Parameter] - ListBox *pBox die rufende Box - + ListBox *pBox The calling Box */ { const SfxOrganizeListBox_Impl::DataEnum eViewType = @@ -2255,7 +2182,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, RightListBoxSelect_Impl, ListBox *, pBox ) aRightLb.SetModel(aLeftLb.GetModel()); else { - // Models trennen + // Separate models aRightLb.DisconnectFromModel(); aRightLb.Reset(); } @@ -2279,13 +2206,13 @@ IMPL_LINK( SfxOrganizeDlg_Impl, OnAddressTemplateClicked, Button *, pButton ) IMPL_LINK( SfxOrganizeDlg_Impl, AddFiles_Impl, Button *, pButton ) -/* [Beschreibung] +/* [Description] - Handler des Buttons f"ur das Hinzuf"ugen von Dateien per Dialog. + Handler of the button for adding files through Dialog. [Parameter] - Button * der Button, der dieses Events ausgel"ost hat. + Button * Button, triggering this Event */ { @@ -2432,10 +2359,9 @@ IMPL_LINK( SfxOrganizeDlg_Impl, AddFilesHdl, sfx2::FileDialogHelper *, EMPTYARG short SfxTemplateOrganizeDlg::Execute() -/* [Beschreibung] +/* [Description] - "Uberladene Execute- Methode; speichert gfs. "Anderungen an den - Dokumentvorlagen + Overloaded Execute method; stores changes to the document templates (SV-Methode) */ @@ -2460,10 +2386,9 @@ SfxTemplateOrganizeDlg::SfxTemplateOrganizeDlg(Window * pParent, : ModalDialog( pParent, SfxResId(DLG_ORGANIZE)), pImp( new SfxOrganizeDlg_Impl(this, pTempl) ) -/* [Beschreibung] - - Konstruktor +/* [Description] + Constructor */ { FreeResource(); @@ -2478,3 +2403,4 @@ SfxTemplateOrganizeDlg::~SfxTemplateOrganizeDlg() delete pImp; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docvor.hrc b/sfx2/source/doc/docvor.hrc index 842aa73fb8a3..c17f424a2a90 100644..100755 --- a/sfx2/source/doc/docvor.hrc +++ b/sfx2/source/doc/docvor.hrc @@ -29,10 +29,6 @@ #define IMG_CLOSED_FOLDER 1 #define IMG_OPENED_DOC 3 #define IMG_CLOSED_DOC 4 -#define IMG_OPENED_FOLDER_HC 5 -#define IMG_CLOSED_FOLDER_HC 6 -#define IMG_OPENED_DOC_HC 7 -#define IMG_CLOSED_DOC_HC 8 #define ACC_EDIT 1 #define ID_COPY 201 diff --git a/sfx2/source/doc/docvor.src b/sfx2/source/doc/docvor.src index 80ebed8b1708..595f349061a2 100644 --- a/sfx2/source/doc/docvor.src +++ b/sfx2/source/doc/docvor.src @@ -53,8 +53,6 @@ ModalDialog DLG_ORGANIZE { Pos = MAP_APPFONT ( 205 , 6 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */ - /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */ Text [ en-US ] = "Close" ; TabStop = TRUE ; DefButton = TRUE ; @@ -169,8 +167,6 @@ ModalDialog DLG_ORGANIZE { Identifier = ID_DELETE ; HelpId = HID_ORGANIZE_DELETE ; - /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */ - /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */ Text [ en-US ] = "~Delete" ; AccelKey = KeyCode { @@ -264,57 +260,4 @@ ModalDialog DLG_ORGANIZE MASKCOLOR ; ImageBitmap = Bitmap { File = "doccl.bmp" ; } ; }; - Image IMG_OPENED_FOLDER_HC - { - MASKCOLOR ; - ImageBitmap = Bitmap { File = "folderop_h.bmp" ; } ; - }; - Image IMG_CLOSED_FOLDER_HC - { - MASKCOLOR ; - ImageBitmap = Bitmap { File = "foldercl_h.bmp" ; } ; - }; - Image IMG_OPENED_DOC_HC - { - MASKCOLOR ; - ImageBitmap = Bitmap { File = "doccl_h.bmp" ; } ; - }; - Image IMG_CLOSED_DOC_HC - { - MASKCOLOR ; - ImageBitmap = Bitmap { File = "doccl_h.bmp" ; } ; - }; - /* FixedText FT_DEFAULT_TEMPLATE_LABEL - { - Pos = MAP_APPFONT ( 3 , 161 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Default template:" ; - }; - FixedText FT_DEFAULT_TEMPLATE - { - Pos = MAP_APPFONT ( 66 , 161 ) ; - Size = MAP_APPFONT ( 131 , 10 ) ; - };*/ }; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx index 848e042daa45..f8265e5825a3 100644 --- a/sfx2/source/doc/frmdescr.cxx +++ b/sfx2/source/doc/frmdescr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,8 +33,6 @@ #include <tools/stream.hxx> #include <vcl/splitwin.hxx> #include <svl/itemset.hxx> -#ifndef GCC -#endif #include <sfx2/frmdescr.hxx> #include <sfx2/app.hxx> @@ -163,7 +162,7 @@ SfxFrameDescriptor* SfxFrameDescriptor::Clone( sal_Bool bWithIds ) const pFrame->pImp->pWallpaper = new Wallpaper( *pImp->pWallpaper ); if( pImp->pArgs ) { - // Aktuell ist im Clone von SfxAllItemSets noch ein Bug... + // Currently in the clone of SfxAllItemSets there is still a bug ... pFrame->pImp->pArgs = new SfxAllItemSet( SFX_APP()->GetPool() ); pFrame->pImp->pArgs->Put(*pImp->pArgs); } @@ -327,3 +326,4 @@ SfxItemPresentation SfxFrameDescriptorItem::GetPresentation } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index eff1554526ea..9d72ce605c19 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,7 +118,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ) #ifdef WNT if ( pGDIMeta ) { - String aStr = ::rtl::OUString::createFromAscii( ".emf" ); + String aStr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".emf")); ::utl::TempFile aTempFile( ::rtl::OUString(), &aStr, NULL, @@ -463,32 +464,32 @@ sal_Bool GraphicHelper::getThumbnailReplacement_Impl( sal_Int32 nResID, const un { uno::Reference< graphic::XGraphicProvider > xGraphProvider( xServiceManager->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), uno::UNO_QUERY ); if ( xGraphProvider.is() ) { - ::rtl::OUString aURL = ::rtl::OUString::createFromAscii( "private:resource/sfx/bitmapex/" ); + ::rtl::OUString aURL(RTL_CONSTASCII_USTRINGPARAM("private:resource/sfx/bitmapex/")); aURL += ::rtl::OUString::valueOf( nResID ); uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString::createFromAscii( "URL" ); + aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); aMediaProps[0].Value <<= aURL; uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); if ( xGraphic.is() ) { uno::Sequence< beans::PropertyValue > aStoreProps( 2 ); - aStoreProps[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" ); + aStoreProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream")); aStoreProps[0].Value <<= xStream; - aStoreProps[1].Name = ::rtl::OUString::createFromAscii( "MimeType" ); - aStoreProps[1].Value <<= ::rtl::OUString::createFromAscii( "image/png" ); + aStoreProps[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MimeType")); + aStoreProps[1].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")); xGraphProvider->storeGraphic( xGraphic, aStoreProps ); bResult = sal_True; } } } - catch( uno::Exception& ) + catch(const uno::Exception&) { } } @@ -503,23 +504,23 @@ sal_uInt16 GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( const ::r { sal_uInt16 nResult = 0; - if ( aFactoryShortName.equalsAscii( "scalc" ) ) + if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "scalc" ) ) ) { nResult = BMP_128X128_CALC_DOC; } - else if ( aFactoryShortName.equalsAscii( "sdraw" ) ) + else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdraw" ) ) ) { nResult = BMP_128X128_DRAW_DOC; } - else if ( aFactoryShortName.equalsAscii( "simpress" ) ) + else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "simpress" ) ) ) { nResult = BMP_128X128_IMPRESS_DOC; } - else if ( aFactoryShortName.equalsAscii( "smath" ) ) + else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "smath" ) ) ) { nResult = BMP_128X128_MATH_DOC; } - else if ( aFactoryShortName.equalsAscii( "swriter" ) || aFactoryShortName.compareToAscii( "swriter/", 8 ) == 0 ) + else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "swriter" ) ) || aFactoryShortName.compareToAscii( "swriter/", 8 ) == 0 ) { nResult = BMP_128X128_WRITER_DOC; } @@ -527,3 +528,4 @@ sal_uInt16 GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( const ::r return nResult; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx index 22f8ad5a115e..0fce34e13171 100644 --- a/sfx2/source/doc/graphhelp.hxx +++ b/sfx2/source/doc/graphhelp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,4 @@ public: }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 1df7d2b01920..c1193a54570f 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,6 +68,7 @@ #include <svl/intitem.hxx> #include <unotools/useroptions.hxx> #include <unotools/saveopt.hxx> +#include <svtools/miscopt.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> @@ -106,10 +108,10 @@ #define STATUS_SAVEAS 2 #define STATUS_SAVEAS_STANDARDNAME 3 -const ::rtl::OUString aFilterNameString = ::rtl::OUString::createFromAscii( "FilterName" ); -const ::rtl::OUString aFilterOptionsString = ::rtl::OUString::createFromAscii( "FilterOptions" ); -const ::rtl::OUString aFilterDataString = ::rtl::OUString::createFromAscii( "FilterData" ); -const ::rtl::OUString aFilterFlagsString = ::rtl::OUString::createFromAscii( "FilterFlags" ); +const ::rtl::OUString aFilterNameString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); +const ::rtl::OUString aFilterOptionsString(RTL_CONSTASCII_USTRINGPARAM("FilterOptions")); +const ::rtl::OUString aFilterDataString(RTL_CONSTASCII_USTRINGPARAM("FilterData")); +const ::rtl::OUString aFilterFlagsString(RTL_CONSTASCII_USTRINGPARAM("FilterFlags")); using namespace ::com::sun::star; @@ -140,15 +142,15 @@ static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode ) static sal_uInt8 getStoreModeFromSlotName( const ::rtl::OUString& aSlotName ) { sal_uInt8 nResult = 0; - if ( aSlotName.equalsAscii( "ExportTo" ) ) + if ( aSlotName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportTo" ) ) ) nResult = EXPORT_REQUESTED; - else if ( aSlotName.equalsAscii( "ExportToPDF" ) ) + else if ( aSlotName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportToPDF" ) ) ) nResult = EXPORT_REQUESTED | PDFEXPORT_REQUESTED; - else if ( aSlotName.equalsAscii( "ExportDirectToPDF" ) ) + else if ( aSlotName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportDirectToPDF" ) ) ) nResult = EXPORT_REQUESTED | PDFEXPORT_REQUESTED | PDFDIRECTEXPORT_REQUESTED; - else if ( aSlotName.equalsAscii( "Save" ) ) + else if ( aSlotName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Save" ) ) ) nResult = SAVE_REQUESTED; - else if ( aSlotName.equalsAscii( "SaveAs" ) ) + else if ( aSlotName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SaveAs" ) ) ) nResult = SAVEAS_REQUESTED; else throw task::ErrorCodeIOException( ::rtl::OUString(), @@ -206,10 +208,10 @@ public: m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( bReadOnly ) ); m_bReadOnlySupported = sal_True; } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} } - catch( uno::Exception& ) + catch( const uno::Exception& ) {} if ( ( bReadOnly && !m_bReadOnlySupported ) ) @@ -227,9 +229,9 @@ public: if ( m_bReadOnlySupported ) m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - OSL_ASSERT( "Unexpected exception!" ); + OSL_FAIL( "Unexpected exception!" ); } } } @@ -271,7 +273,7 @@ public: ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } - sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; } + sal_Bool IsRecommendReadOnly() const { return m_bRecommendReadOnly; } const ::comphelper::SequenceAsHashMap& GetDocProps(); @@ -301,7 +303,7 @@ public: sal_Bool bSetStandardName, ::rtl::OUString& aSuggestedName, sal_Bool bPreselectPassword, - const ::rtl::OUString& aSuggestedDir, + ::rtl::OUString& aSuggestedDir, sal_Int16 nDialog, const ::rtl::OUString& rStandardDir, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList @@ -309,8 +311,7 @@ public: sal_Bool ShowDocumentInfoDialog(); - ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, - const sfx2::FileDialogHelper::Context& aCtxt ); + ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir ); ::rtl::OUString GetReccomendedName( const ::rtl::OUString& aSuggestedName, const ::rtl::OUString& aTypeName ); @@ -439,25 +440,25 @@ const ::comphelper::SequenceAsHashMap& ModelData_Impl::GetModuleProps() //------------------------------------------------------------------------- ::rtl::OUString ModelData_Impl::GetDocServiceName() { - return GetModuleProps().getUnpackedValueOrDefault(::rtl::OUString::createFromAscii( "ooSetupFactoryDocumentService" ), ::rtl::OUString()); + return GetModuleProps().getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDocumentService")), ::rtl::OUString()); } //------------------------------------------------------------------------- void ModelData_Impl::CheckInteractionHandler() { ::comphelper::SequenceAsHashMap::const_iterator aInteractIter = - m_aMediaDescrHM.find( ::rtl::OUString::createFromAscii( "InteractionHandler" ) ); + m_aMediaDescrHM.find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ); if ( aInteractIter == m_aMediaDescrHM.end() ) { try { - m_aMediaDescrHM[ ::rtl::OUString::createFromAscii( "InteractionHandler" ) ] + m_aMediaDescrHM[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ] <<= uno::Reference< task::XInteractionHandler >( m_pOwner->GetServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -474,7 +475,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter uno::Sequence< beans::PropertyValue > aProps; ::rtl::OUString aFilterName = GetModuleProps().getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "ooSetupFactoryDefaultFilter" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDefaultFilter")), ::rtl::OUString() ); m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aProps; @@ -491,7 +492,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter if ( aProps.getLength() ) { ::comphelper::SequenceAsHashMap aFiltHM( aProps ); - sal_Int32 nFlags = aFiltHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aFiltHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( ( ( nFlags & nMust ) == nMust ) && !( nFlags & nDont ) ) aFilterProps = aProps; @@ -505,7 +506,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceDefaultFilter uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceAnyFilter( sal_Int32 nMust, sal_Int32 nDont ) { uno::Sequence< beans::NamedValue > aSearchRequest( 1 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); aSearchRequest[0].Value <<= GetDocServiceName(); return ::comphelper::MimeConfigurationHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont ); @@ -523,9 +524,9 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetPreselectedFilter_Impl( { // Preselect PDF-Filter for EXPORT uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" ); - aSearchRequest[0].Value <<= ::rtl::OUString::createFromAscii( "pdf_Portable_Document_Format" ); - aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")); + aSearchRequest[0].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pdf_Portable_Document_Format")); + aSearchRequest[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); aSearchRequest[1].Value <<= GetDocServiceName(); aFilterProps = ::comphelper::MimeConfigurationHelper::SearchForFilter( m_pOwner->GetFilterQuery(), aSearchRequest, nMust, nDont ); @@ -556,7 +557,7 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const ::rtl::OUString& aFilte { sal_Int32 nPropertyCount = aProps.getLength(); for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty ) - if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii("UIComponent")) ) + if( aProps[nProperty].Name.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent"))) ) { ::rtl::OUString aServiceName; aProps[nProperty].Value >>= aServiceName; @@ -599,18 +600,18 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const ::rtl::OUString& aFilte } } } - catch( container::NoSuchElementException& ) + catch( const container::NoSuchElementException& ) { // the filter name is unknown throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER ); } - catch( task::ErrorCodeIOException& ) + catch( const task::ErrorCodeIOException& ) { throw; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } @@ -640,7 +641,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus ) // the saving is acceptable // in case the configuration entry is not set or set to false // or in case of version creation - ::rtl::OUString aVersionCommentString = ::rtl::OUString::createFromAscii( "VersionComment" ); + ::rtl::OUString aVersionCommentString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VersionComment")); if ( ( ::comphelper::ConfigurationHelper::readRelativeKey( xCommonConfig, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Save/Document/" ) ), @@ -658,7 +659,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus ) nResult = STATUS_NO_ACTION; } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { // impossibility to get the configuration access means normal saving flow for now } @@ -678,10 +679,10 @@ sal_Int8 ModelData_Impl::CheckStateForSave() sal_Bool bVersInfoNeedsStore = sal_False; ::comphelper::SequenceAsHashMap aAcceptedArgs; - ::rtl::OUString aVersionCommentString = ::rtl::OUString::createFromAscii( "VersionComment" ); - ::rtl::OUString aAuthorString = ::rtl::OUString::createFromAscii( "Author" ); - ::rtl::OUString aInteractionHandlerString = ::rtl::OUString::createFromAscii( "InteractionHandler" ); - ::rtl::OUString aStatusIndicatorString = ::rtl::OUString::createFromAscii( "StatusIndicator" ); + ::rtl::OUString aVersionCommentString(RTL_CONSTASCII_USTRINGPARAM("VersionComment")); + ::rtl::OUString aAuthorString(RTL_CONSTASCII_USTRINGPARAM("Author")); + ::rtl::OUString aInteractionHandlerString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); + ::rtl::OUString aStatusIndicatorString(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator")); if ( GetMediaDescr().find( aVersionCommentString ) != GetMediaDescr().end() ) { @@ -701,9 +702,14 @@ sal_Int8 ModelData_Impl::CheckStateForSave() if ( GetMediaDescr().size() != aAcceptedArgs.size() ) GetMediaDescr() = aAcceptedArgs; - // the document must be modified - if ( !GetModifiable()->isModified() && !bVersInfoNeedsStore ) - return STATUS_NO_ACTION; + // the document must be modified unless the always-save flag is set. + SvtMiscOptions aMiscOptions; + sal_Bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); + if (!bAlwaysAllowSave) + { + if ( !GetModifiable()->isModified() && !bVersInfoNeedsStore ) + return STATUS_NO_ACTION; + } // check that the old filter is acceptable ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( @@ -726,13 +732,13 @@ sal_Int8 ModelData_Impl::CheckFilter( const ::rtl::OUString& aFilterName ) m_pOwner->GetFilterConfiguration()->getByName( aFilterName ) >>= aFilterProps; aFiltPropsHM = ::comphelper::SequenceAsHashMap( aFilterProps ); - nFiltFlags = aFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); + nFiltFlags = aFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); } // only a temporary solution until default filter retrieving feature is implemented // then GetDocServiceDefaultFilter() must be used ::comphelper::SequenceAsHashMap aDefFiltPropsHM = GetDocServiceDefaultFilterCheckFlags( 3, 0 ); - sal_Int32 nDefFiltFlags = aDefFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); + sal_Int32 nDefFiltFlags = aDefFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); // if the old filter is not acceptable // and there is no default filter or it is not acceptable for requested parameters then proceed with saveAs @@ -752,12 +758,12 @@ sal_Int8 ModelData_Impl::CheckFilter( const ::rtl::OUString& aFilterName ) { // the default filter is acceptable and the old filter is alian one // so ask to make a saveAs operation - ::rtl::OUString aUIName = aFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString aUIName = aFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); - ::rtl::OUString aDefUIName = aDefFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString aDefUIName = aDefFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); ::rtl::OUString aPreusedFilterName = GetDocProps().getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "PreusedFilterName" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreusedFilterName")), ::rtl::OUString() ); if ( !aPreusedFilterName.equals( aFilterName ) && !aUIName.equals( aDefUIName ) ) { @@ -773,7 +779,7 @@ sal_Int8 ModelData_Impl::CheckFilter( const ::rtl::OUString& aFilterName ) sal_Bool ModelData_Impl::CheckFilterOptionsDialogExistence() { uno::Sequence< beans::NamedValue > aSearchRequest( 1 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); aSearchRequest[0].Value <<= GetDocServiceName(); uno::Reference< container::XEnumeration > xFilterEnum = @@ -786,7 +792,7 @@ sal_Bool ModelData_Impl::CheckFilterOptionsDialogExistence() { ::comphelper::SequenceAsHashMap aPropsHM( pProps ); ::rtl::OUString aUIServName = aPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIComponent" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent")), ::rtl::OUString() ); if ( aUIServName.getLength() ) return sal_True; @@ -802,7 +808,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, sal_Bool bSetStandardName, ::rtl::OUString& aSuggestedName, sal_Bool bPreselectPassword, - const ::rtl::OUString& aSuggestedDir, + ::rtl::OUString& aSuggestedDir, sal_Int16 nDialog, const ::rtl::OUString& rStandardDir, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) @@ -810,7 +816,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, sal_Bool bUseFilterOptions = sal_False; ::comphelper::SequenceAsHashMap::const_iterator aOverwriteIter = - GetMediaDescr().find( ::rtl::OUString::createFromAscii( "Overwrite" ) ); + GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Overwrite")) ); // the file name must be specified if overwrite option is set if ( aOverwriteIter != GetMediaDescr().end() ) @@ -864,7 +870,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, // this is a PDF export // the filter options has been shown already ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ), rStandardDir, rBlackList ); @@ -876,11 +882,11 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList ); } - if( aDocServiceName.equalsAscii( "com.sun.star.drawing.DrawingDocument" ) ) - eCtxt = sfx2::FileDialogHelper::SD_EXPORT; - if( aDocServiceName.equalsAscii( "com.sun.star.presentation.PresentationDocument" ) ) - eCtxt = sfx2::FileDialogHelper::SI_EXPORT; - if( aDocServiceName.equalsAscii( "com.sun.star.text.TextDocument" ) ) + if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) + eCtxt = sfx2::FileDialogHelper::SD_EXPORT; + else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) + eCtxt = sfx2::FileDialogHelper::SI_EXPORT; + else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) eCtxt = sfx2::FileDialogHelper::SW_EXPORT; if ( eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) @@ -914,7 +920,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, { // it is export, set the preselected filter ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); pFileDlg->SetCurrentFilter( aFilterUIName ); } @@ -930,29 +936,29 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, m_pOwner->GetFilterConfiguration()->getByName( aOldFilterName ) >>= aOldFilterProps; ::comphelper::SequenceAsHashMap aOldFiltPropsHM( aOldFilterProps ); - sal_Int32 nOldFiltFlags = aOldFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); + sal_Int32 nOldFiltFlags = aOldFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( bSetStandardName || ( nOldFiltFlags & nMust ) != nMust || nOldFiltFlags & nDont ) { // the suggested type will be changed, the extension should be adjusted aAdjustToType = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Type" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")), ::rtl::OUString() ); ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ); pFileDlg->SetCurrentFilter( aFilterUIName ); } else { pFileDlg->SetCurrentFilter( aOldFiltPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")), ::rtl::OUString() ) ); } } - ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir, eCtxt ); + ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir ); if ( aReccomendedDir.getLength() ) pFileDlg->SetDisplayDirectory( aReccomendedDir ); ::rtl::OUString aReccomendedName = GetReccomendedName( aSuggestedName, aAdjustToType ); @@ -961,7 +967,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, uno::Reference < view::XSelectionSupplier > xSel( GetModel()->getCurrentController(), uno::UNO_QUERY ); if ( xSel.is() && xSel->getSelection().hasValue() ) - GetMediaDescr()[::rtl::OUString::createFromAscii( "SelectionOnly" )] <<= sal_True; + GetMediaDescr()[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionOnly"))] <<= sal_True; // This is a temporary hardcoded solution must be removed when // dialogs do not need parameters in SidSet representation any more @@ -1010,6 +1016,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, INetURLObject aURL( pFileDlg->GetPath() ); // the path should be provided outside since it might be used for further calls to the dialog aSuggestedName = aURL.GetName( INetURLObject::DECODE_WITH_CHARSET ); + aSuggestedDir = pFileDlg->GetDisplayDirectory(); // old filter options should be cleared in case different filter is used @@ -1080,7 +1087,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ( GetMediaDescr().find( aFilterDataString ) == GetMediaDescr().end() && GetMediaDescr().find( aFilterOptionsString ) == GetMediaDescr().end() ); } - catch( lang::IllegalArgumentException& ) + catch( const lang::IllegalArgumentException& ) {} } } @@ -1088,7 +1095,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, delete pFileDlg; // merge in results of the dialog execution - GetMediaDescr()[::rtl::OUString::createFromAscii( "URL" )] <<= + GetMediaDescr()[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))] <<= ::rtl::OUString( aURL.GetMainURL( INetURLObject::NO_DECODE )); GetMediaDescr()[aFilterNameString] <<= aFilterName; @@ -1108,7 +1115,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() if ( xFrameDispatch.is() ) { util::URL aURL; - aURL.Complete = ::rtl::OUString::createFromAscii( ".uno:SetDocumentProperties" ); + aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SetDocumentProperties")); uno::Reference< util::XURLTransformer > xTransformer( m_pOwner->GetServiceFactory()->createInstance( @@ -1118,7 +1125,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() { uno::Reference< frame::XDispatch > xDispatch = xFrameDispatch->queryDispatch( aURL, - ::rtl::OUString::createFromAscii( "_self" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0 ); if ( xDispatch.is() ) { @@ -1129,7 +1136,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } @@ -1137,12 +1144,12 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } //------------------------------------------------------------------------- -::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& aCtxt ) +::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir ) { ::rtl::OUString aReccomendedDir; if ( ( aSuggestedDir.getLength() || GetStorable()->hasLocation() ) - && !GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "RepairPackage" ), + && !GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")), sal_False ) ) { INetURLObject aLocation; @@ -1168,9 +1175,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } else { - // pb: set graphic path if context == SD_EXPORT or SI_EXPORT else work path - ::rtl::OUString aConfigSuggestion( ( aCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) ? SvtPathOptions().GetGraphicPath() : SvtPathOptions().GetWorkPath() ); - aReccomendedDir = INetURLObject( aConfigSuggestion ).GetMainURL( INetURLObject::NO_DECODE ); + aReccomendedDir = INetURLObject( SvtPathOptions().GetWorkPath() ).GetMainURL( INetURLObject::NO_DECODE ); } return aReccomendedDir; @@ -1192,14 +1197,14 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() try { uno::Reference< frame::XTitle > xTitle( GetModel(), uno::UNO_QUERY_THROW ); aReccomendedName = xTitle->getTitle(); - } catch( uno::Exception& ) {} + } catch( const uno::Exception& ) {} } if ( aReccomendedName.getLength() && aTypeName.getLength() ) { // adjust the extension to the type uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >( - m_pOwner->GetServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), + m_pOwner->GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ), uno::UNO_QUERY ); if ( xTypeDetection.is() ) { @@ -1210,7 +1215,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() { ::comphelper::SequenceAsHashMap aTypeNamePropsHM( aTypeNameProps ); uno::Sequence< ::rtl::OUString > aExtensions = aTypeNamePropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Extensions" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extensions")), ::uno::Sequence< ::rtl::OUString >() ); if ( aExtensions.getLength() ) aObj.SetExtension( aExtensions[0] ); @@ -1253,7 +1258,7 @@ uno::Reference< container::XNameAccess > SfxStoringHelper::GetFilterConfiguratio if ( !m_xFilterCFG.is() ) { m_xFilterCFG = uno::Reference< container::XNameAccess >( - GetServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), + GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), uno::UNO_QUERY ); if ( !m_xFilterCFG.is() ) @@ -1283,7 +1288,7 @@ uno::Reference< ::com::sun::star::frame::XModuleManager > SfxStoringHelper::GetM { m_xModuleManager = uno::Reference< ::com::sun::star::frame::XModuleManager >( GetServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.frame.ModuleManager" ) ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")) ), uno::UNO_QUERY ); if ( !m_xModuleManager.is() ) @@ -1330,7 +1335,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& if ( nStoreMode & SAVEAS_REQUESTED ) { ::comphelper::SequenceAsHashMap::const_iterator aSaveToIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "SaveTo" ) ); + aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveTo")) ); if ( aSaveToIter != aModelData.GetMediaDescr().end() ) { sal_Bool bWideExport = sal_False; @@ -1398,15 +1403,15 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& { aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); } - catch( lang::IllegalArgumentException& ) + catch( const lang::IllegalArgumentException& ) { - OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); + OSL_FAIL( "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); aModelData.GetStorable()->store(); } } else { - OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" ); + OSL_FAIL( "XStorable2 is not supported by the model!\n" ); aModelData.GetStorable()->store(); } @@ -1424,7 +1429,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& ::comphelper::SequenceAsHashMap aFilterPropsHM( aFilterProps ); ::rtl::OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Name" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString() ); ::rtl::OUString aFilterFromMediaDescr = aModelData.GetMediaDescr().getUnpackedValueOrDefault( @@ -1435,7 +1440,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& ::rtl::OUString() ); sal_Bool bUseFilterOptions = sal_False; - ::comphelper::SequenceAsHashMap::const_iterator aFileNameIter = aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "URL" ) ); + ::comphelper::SequenceAsHashMap::const_iterator aFileNameIter = aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ); if ( ( nStoreMode & EXPORT_REQUESTED ) && ( nStoreMode & PDFEXPORT_REQUESTED ) && !( nStoreMode & PDFDIRECTEXPORT_REQUESTED ) ) { @@ -1455,7 +1460,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& { sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG; ::comphelper::SequenceAsHashMap::const_iterator aDlgIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "UseSystemDialog" ) ); + aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseSystemDialog")) ); if ( aDlgIter != aModelData.GetMediaDescr().end() ) { sal_Bool bUseSystemDialog = sal_True; @@ -1483,24 +1488,22 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& ::rtl::OUString sStandardDir; ::comphelper::SequenceAsHashMap::const_iterator aStdDirIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "StandardDir" ) ); + aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StandardDir")) ); if ( aStdDirIter != aModelData.GetMediaDescr().end() ) aStdDirIter->second >>= sStandardDir; ::com::sun::star::uno::Sequence< ::rtl::OUString > aBlackList; ::comphelper::SequenceAsHashMap::const_iterator aBlackListIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "BlackList" ) ); + aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BlackList")) ); if ( aBlackListIter != aModelData.GetMediaDescr().end() ) aBlackListIter->second >>= aBlackList; sal_Bool bExit = sal_False; while ( !bExit ) { + // in case the dialog is opened a second time the folder should be the same as previously navigated to by the user, not what was handed over by initial parameters bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aBlackList ); - - // in case the dialog is opend a second time the folder should be the same as before, not what was handed over by parameters - aSuggestedDir = ::rtl::OUString(); if ( nStoreMode == SAVEAS_REQUESTED ) { // in case of saving check filter for possible alien warning @@ -1524,7 +1527,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& } bDialogUsed = sal_True; - aFileNameIter = aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "URL" ) ); + aFileNameIter = aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ); } else { @@ -1571,7 +1574,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& } ::comphelper::SequenceAsHashMap::const_iterator aIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "FilterFlags" ) ); + aModelData.GetMediaDescr().find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterFlags")) ); sal_Bool bFilterFlagsSet = ( aIter != aModelData.GetMediaDescr().end() ); if( !( nStoreMode & PDFEXPORT_REQUESTED ) && !bFilterFlagsSet @@ -1611,7 +1614,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& bDialogUsed = sal_True; else { - DBG_ERROR( "Can't execute document info dialog!\n" ); + OSL_FAIL( "Can't execute document info dialog!\n" ); } try { @@ -1622,7 +1625,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& else aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aArgsSequence ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { if ( ( nStoreMode & EXPORT_REQUESTED ) ) SetDocInfoState( aModelData.GetModel(), xOldDocInfo, sal_True ); @@ -1667,13 +1670,13 @@ sal_Bool SfxStoringHelper::CheckFilterOptionsAppearence( { ::comphelper::SequenceAsHashMap aPropsHM( aProps ); ::rtl::OUString aServiceName = aPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIComponent" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent")), ::rtl::OUString() ); if( aServiceName.getLength() ) bUseFilterOptions = sal_True; } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -1722,7 +1725,7 @@ void SfxStoringHelper::SetDocInfoState( // it is possible that the propertysets from XML and binary files differ; we shouldn't break then xSet->setPropertyValue( pProps[i].Name, aValue ); } - catch ( uno::Exception& ) {} + catch ( const uno::Exception& ) {} } sal_Int16 nCount = i_xOldDocInfo->getUserFieldCount(); @@ -1735,7 +1738,7 @@ void SfxStoringHelper::SetDocInfoState( xDocInfoToFill->setUserFieldValue( nInd, aPropVal ); } } - catch ( uno::Exception& ) {} + catch ( const uno::Exception& ) {} // set the modified flag back if required if ( bNoModify && bIsModified != xModifiable->isModified() ) @@ -1758,7 +1761,6 @@ sal_Bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame:: return aDlg.Execute() == RET_OK; } -// static void SfxStoringHelper::ExecuteFilterDialog( SfxStoringHelper& _rStorageHelper ,const ::rtl::OUString& _sFilterName ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _xModel @@ -1769,7 +1771,6 @@ void SfxStoringHelper::ExecuteFilterDialog( SfxStoringHelper& _rStorageHelper _rArgsSequence = aModelData.GetMediaDescr().getAsConstPropertyValueList(); } -// static Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel ) { Window* pWin = 0; @@ -1793,10 +1794,11 @@ Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& } } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } return pWin; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 0bd63da878a3..0fdd22f70e3e 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,7 +74,6 @@ IFrameWindow_Impl::IFrameWindow_Impl( Window *pParent, sal_Bool bHasBorder, WinB SetBorderStyle( WINDOW_BORDER_NOBORDER ); else SetBorderStyle( WINDOW_BORDER_NORMAL ); - //SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); } void IFrameWindow_Impl::SetBorder( sal_Bool bNewBorder ) @@ -159,7 +159,7 @@ throw( uno::RuntimeException ) // we must destroy the IFrame before the parent is destroyed xWindow->addEventListener( this ); - mxFrame = uno::Reference< frame::XFrame >( mxFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Frame" ) ), + mxFrame = uno::Reference< frame::XFrame >( mxFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")) ), uno::UNO_QUERY ); uno::Reference < awt::XWindow > xWin( pWin->GetComponentInterface(), uno::UNO_QUERY ); mxFrame->initialize( xWin ); @@ -173,15 +173,15 @@ throw( uno::RuntimeException ) util::URL aTargetURL; aTargetURL.Complete = ::rtl::OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); - uno::Reference < util::XURLTransformer > xTrans( mxFact->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); + uno::Reference < util::XURLTransformer > xTrans( mxFact->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), uno::UNO_QUERY ); xTrans->parseStrict( aTargetURL ); uno::Sequence < beans::PropertyValue > aProps(2); - aProps[0].Name = ::rtl::OUString::createFromAscii("PluginMode"); + aProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginMode")); aProps[0].Value <<= (sal_Int16) 2; - aProps[1].Name = ::rtl::OUString::createFromAscii("ReadOnly"); + aProps[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); aProps[1].Value <<= (sal_Bool) sal_True; - uno::Reference < frame::XDispatch > xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_self"), 0 ); + uno::Reference < frame::XDispatch > xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0 ); if ( xDisp.is() ) xDisp->dispatch( aTargetURL, aProps ); @@ -384,7 +384,7 @@ void SAL_CALL IFrameObject::removeVetoableChangeListener(const ::rtl::OUString&, ::sal_Int16 SAL_CALL IFrameObject::execute() throw (::com::sun::star::uno::RuntimeException) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - VclAbstractDialog* pDlg = pFact->CreateEditObjectDialog( NULL, rtl::OUString::createFromAscii(".uno:InsertObjectFloatingFrame"), mxObj ); + VclAbstractDialog* pDlg = pFact->CreateEditObjectDialog( NULL, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:InsertObjectFloatingFrame")), mxObj ); if ( pDlg ) pDlg->Execute(); return 0; @@ -395,3 +395,5 @@ void SAL_CALL IFrameObject::setTitle( const ::rtl::OUString& ) throw (::com::sun } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 955d231898f9..c263b7521bba 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -156,9 +157,6 @@ void SfxPreviewWin_Impl::ImpPaint( pWindow->SetLineColor( aBlackCol ); pWindow->SetFillColor( aWhiteCol ); pWindow->DrawRect( Rectangle( aPoint + Point( FRAME, FRAME ), bPoint + Point( FRAME, FRAME ) ) ); -//! pFile->Move( Point( FRAME, FRAME ) ); -//! pFile->Scale( Fraction( aTmpSize.Width(), aSize.Width() ), -//! Fraction( aTmpSize.Height(), aSize.Height() ) ); pFile->WindStart(); pFile->Play( pWindow, aPoint + Point( FRAME, FRAME ), aSize ); } @@ -176,10 +174,9 @@ SfxPreviewWin::SfxPreviewWin( SetHelpId( HID_PREVIEW_FRAME ); // adjust contrast mode initially - bool bUseContrast = UseHighContrastSetting(); - SetDrawMode( bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( OUTPUT_DRAWMODE_COLOR ); - // #107818# This preview window is for document previews. Therefore + // This preview window is for document previews. Therefore // right-to-left mode should be off EnableRTL( sal_False ); } @@ -218,18 +215,10 @@ void SfxPreviewWin::DataChanged( const DataChangedEvent& rDCEvt ) if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - // adjust contrast mode - bool bUseContrast = UseHighContrastSetting(); - SetDrawMode( bUseContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetDrawMode( OUTPUT_DRAWMODE_COLOR ); } } -bool SfxPreviewWin::UseHighContrastSetting() const -{ - return GetSettings().GetStyleSettings().GetHighContrastMode(); -} - - class SfxNewFileDialog_Impl { FixedText aRegionFt; @@ -287,8 +276,8 @@ public: SfxNewFileDialog_Impl( SfxNewFileDialog* pAntiImplP, sal_uInt16 nFlags ); ~SfxNewFileDialog_Impl(); - // Liefert sal_False, wenn '- Keine -' als Vorlage eingestellt ist - // Nur wenn IsTemplate() sal_True liefert, koennen Vorlagennamen + // Returns sal_False if '- No -' is set as a template + // Template name can only be obtained if IsTemplate() is TRUE // erfragt werden sal_Bool IsTemplate() const; String GetTemplateRegion() const; @@ -447,12 +436,12 @@ IMPL_LINK( SfxNewFileDialog_Impl, PreviewClick, CheckBox *, pBox ) IMPL_LINK( SfxNewFileDialog_Impl, TemplateSelect, ListBox *, EMPTYARG ) { - // noch am Laden + // Still loading if ( xDocShell && xDocShell->GetProgress() ) return 0; if ( !MORE_BTN(GetState()) ) - // Dialog nicht aufgeklappt + // Dialog is not opened return 0; aPrevTimer.Start(); @@ -464,7 +453,7 @@ IMPL_LINK( SfxNewFileDialog_Impl, TemplateSelect, ListBox *, EMPTYARG ) IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, DoubleClick, ListBox *, pListBox ) { (void)pListBox; - // noch am Laden + // Still loadning if ( !xDocShell.Is() || !xDocShell->GetProgress() ) pAntiImpl->EndDialog(RET_OK); return 0; @@ -679,8 +668,6 @@ SfxNewFileDialog_Impl::SfxNewFileDialog_Impl( aPrevTimer.SetTimeout( 500 ); aPrevTimer.SetTimeoutHdl( LINK( this, SfxNewFileDialog_Impl, Update)); -// else -// aRegionLb.InsertEntry(String(SfxResId(STR_STANDARD))); aRegionLb.SelectEntryPos(0); RegionSelect(&aRegionLb); } @@ -739,3 +726,4 @@ void SfxNewFileDialog::SetTemplateFlags(sal_uInt16 nSet) pImpl->SetTemplateFlags(nSet); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/new.hrc b/sfx2/source/doc/new.hrc index dd8878bf0177..dd8878bf0177 100644..100755 --- a/sfx2/source/doc/new.hrc +++ b/sfx2/source/doc/new.hrc diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index b389f980185d..80401876d05f 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,8 +90,6 @@ using namespace ::com::sun::star::uno; //==================================================================== -//==================================================================== - static bool operator> (const util::DateTime& i_rLeft, const util::DateTime& i_rRight) { @@ -118,19 +117,17 @@ bool operator> (const util::DateTime& i_rLeft, const util::DateTime& i_rRight) return sal_False; } - ::boost::shared_ptr<GDIMetaFile> SfxObjectShell::GetPreviewMetaFile( sal_Bool bFullContent ) const { - return CreatePreviewMetaFile_Impl( bFullContent, sal_False ); + return CreatePreviewMetaFile_Impl( bFullContent ); } - ::boost::shared_ptr<GDIMetaFile> -SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHighContrast ) const +SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const { - // Nur wenn gerade nicht gedruckt wird, darf DoDraw aufgerufen - // werden, sonst wird u.U. der Printer abgeschossen ! + // DoDraw can only be called when no printing is done, otherwise + // the printer may be turned off SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame && pFrame->GetViewShell() && pFrame->GetViewShell()->GetPrinter() && @@ -142,10 +139,6 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig VirtualDevice aDevice; aDevice.EnableOutput( sal_False ); - // adjust the output device if HC-metafile is requested - if ( bHighContrast ) - aDevice.SetDrawMode( aDevice.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); - MapMode aMode( ((SfxObjectShell*)this)->GetMapUnit() ); aDevice.SetMapMode( aMode ); pFile->SetPrefMapMode( aMode ); @@ -170,10 +163,10 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig pFile->Record( &aDevice ); LanguageType eLang; - SvtCTLOptions* pCTLOptions = new SvtCTLOptions; - if ( SvtCTLOptions::NUMERALS_HINDI == pCTLOptions->GetCTLTextNumerals() ) + SvtCTLOptions aCTLOptions; + if ( SvtCTLOptions::NUMERALS_HINDI == aCTLOptions.GetCTLTextNumerals() ) eLang = LANGUAGE_ARABIC_SAUDI_ARABIA; - else if ( SvtCTLOptions::NUMERALS_ARABIC == pCTLOptions->GetCTLTextNumerals() ) + else if ( SvtCTLOptions::NUMERALS_ARABIC == aCTLOptions.GetCTLTextNumerals() ) eLang = LANGUAGE_ENGLISH; else eLang = (LanguageType) Application::GetSettings().GetLanguage(); @@ -240,7 +233,7 @@ lcl_add(util::Duration & rDur, Time const& rTime) rDur.Seconds += rTime.GetSec(); } -// Bearbeitungszeit aktualisieren +// Update the processing time void SfxObjectShell::UpdateTime_Impl( const uno::Reference<document::XDocumentProperties> & i_xDocProps) { @@ -328,11 +321,9 @@ void SfxObjectShell::SetOrganizerSearchMask( //-------------------------------------------------------------------- -sal_uInt16 SfxObjectShell::GetContentCount( - sal_uInt16 nIdx1, - sal_uInt16 /*nIdx2*/) +sal_uInt16 SfxObjectShell::GetContentCount(sal_uInt16 nIdx) { - switch(nIdx1) + switch(nIdx) { case INDEX_IGNORE: return DEF_CONTENT_COUNT; @@ -346,20 +337,14 @@ sal_uInt16 SfxObjectShell::GetContentCount( } case CONTENT_MACRO: break; -/* - case CONTENT_CONFIG: - return ( GetConfigManager() ) ? - GetConfigManager()->GetItemCount() : 0; - break; - */ } return 0; } //-------------------------------------------------------------------- -//TODO/CLEANUP: remove this method (it's virtual) -void SfxObjectShell::TriggerHelpPI(sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16) +//TODO/CLEANUP: remove this method +void SfxObjectShell::TriggerHelpPI(sal_uInt16 nIdx1, sal_uInt16 nIdx2) { if(nIdx1==CONTENT_STYLE && nIdx2 != INDEX_IGNORE) //StyleSheets { @@ -368,23 +353,18 @@ void SfxObjectShell::TriggerHelpPI(sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt } } -sal_Bool SfxObjectShell::CanHaveChilds(sal_uInt16 nIdx1, - sal_uInt16 nIdx2) +sal_Bool SfxObjectShell::CanHaveChilds(sal_uInt16 nIdx1, sal_uInt16 nIdx2) { - switch(nIdx1) { + switch(nIdx1) + { case INDEX_IGNORE: - return sal_True; + return true; case CONTENT_STYLE: - return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool()? sal_False: sal_True; + return INDEX_IGNORE == nIdx2 || !GetStyleSheetPool() ? false : true; case CONTENT_MACRO: -//!! return INDEX_IGNORE == nIdx2? sal_False: sal_True; - return sal_False; -/* - case CONTENT_CONFIG: - return INDEX_IGNORE == nIdx2 ? sal_False : sal_True; - */ + return false; } - return sal_False; + return false; } //-------------------------------------------------------------------- @@ -394,27 +374,12 @@ void SfxObjectShell::GetContent(String &rText, Bitmap &rOpenedBitmap, sal_Bool &bCanDel, sal_uInt16 i, - sal_uInt16 nIdx1, - sal_uInt16 nIdx2 ) -{ - DBG_ERRORFILE( "Non high contrast method called. Please update calling code!" ); - SfxObjectShell::GetContent( rText, rClosedBitmap, rOpenedBitmap, BMP_COLOR_NORMAL, bCanDel, i, nIdx1, nIdx2 ); -} - -//-------------------------------------------------------------------- - -void SfxObjectShell::GetContent(String &rText, - Bitmap &rClosedBitmap, - Bitmap &rOpenedBitmap, - BmpColorMode eColorMode, - sal_Bool &bCanDel, - sal_uInt16 i, - sal_uInt16 nIdx1, - sal_uInt16 /*nIdx2*/ ) + sal_uInt16 nIdx +) { - bCanDel=sal_True; + bCanDel=true; - switch(nIdx1) + switch(nIdx) { case INDEX_IGNORE: { @@ -425,37 +390,14 @@ void SfxObjectShell::GetContent(String &rText, { case CONTENT_STYLE: nTextResId = STR_STYLES; - if ( eColorMode == BMP_COLOR_NORMAL ) - { - nClosedBitmapResId= BMP_STYLES_CLOSED; - nOpenedBitmapResId= BMP_STYLES_OPENED; - } - else - { - nClosedBitmapResId= BMP_STYLES_CLOSED_HC; - nOpenedBitmapResId= BMP_STYLES_OPENED_HC; - } + nClosedBitmapResId= BMP_STYLES_CLOSED; + nOpenedBitmapResId= BMP_STYLES_OPENED; break; case CONTENT_MACRO: nTextResId = STR_MACROS; - if ( eColorMode == BMP_COLOR_NORMAL ) - { - nClosedBitmapResId= BMP_STYLES_CLOSED; - nOpenedBitmapResId= BMP_STYLES_OPENED; - } - else - { - nClosedBitmapResId= BMP_STYLES_CLOSED_HC; - nOpenedBitmapResId= BMP_STYLES_OPENED_HC; - } - break; -/* - case CONTENT_CONFIG: - nTextResId = STR_CONFIG; nClosedBitmapResId= BMP_STYLES_CLOSED; nOpenedBitmapResId= BMP_STYLES_OPENED; break; - */ } if ( nTextResId ) @@ -476,52 +418,32 @@ void SfxObjectShell::GetContent(String &rText, bCanDel=((pStyle->GetMask() & SFXSTYLEBIT_USERDEF) == SFXSTYLEBIT_USERDEF); rClosedBitmap = rOpenedBitmap = - GetStyleFamilyBitmap(pStyle->GetFamily(), eColorMode ); + GetStyleFamilyBitmap(pStyle->GetFamily()); } break; case CONTENT_MACRO: break; -/* - case CONTENT_CONFIG: - if ( GetConfigManager() ) - { - rText = GetConfigManager()->GetItem(i); - bCanDel = GetConfigManager()->CanDelete(i); - } - else - rText = String(); - rClosedBitmap = Bitmap(SfxResId(BMP_STYLES_CLOSED)); - rOpenedBitmap = Bitmap(SfxResId(BMP_STYLES_OPENED)); - break; -*/ } } //-------------------------------------------------------------------- -Bitmap SfxObjectShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily ) -{ - DBG_ERRORFILE( "Non high contrast method called. Please update calling code!" ); - return SfxObjectShell::GetStyleFamilyBitmap( eFamily, BMP_COLOR_NORMAL ); -} - -//-------------------------------------------------------------------- -Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily, BmpColorMode eColorMode ) +Bitmap SfxObjectShell::GetStyleFamilyBitmap(SfxStyleFamily eFamily) { sal_uInt16 nResId = 0; switch(eFamily) { case SFX_STYLE_FAMILY_CHAR: - nResId = ( eColorMode == BMP_COLOR_NORMAL ) ? BMP_STYLES_FAMILY1 : BMP_STYLES_FAMILY1_HC; + nResId = BMP_STYLES_FAMILY1; break; case SFX_STYLE_FAMILY_PARA: - nResId = ( eColorMode == BMP_COLOR_NORMAL ) ? BMP_STYLES_FAMILY2 : BMP_STYLES_FAMILY2_HC; + nResId = BMP_STYLES_FAMILY2; break; case SFX_STYLE_FAMILY_FRAME: - nResId = ( eColorMode == BMP_COLOR_NORMAL ) ? BMP_STYLES_FAMILY3 : BMP_STYLES_FAMILY3_HC; + nResId = BMP_STYLES_FAMILY3; break; case SFX_STYLE_FAMILY_PAGE : - nResId = ( eColorMode == BMP_COLOR_NORMAL ) ? BMP_STYLES_FAMILY4 : BMP_STYLES_FAMILY4_HC; + nResId = BMP_STYLES_FAMILY4; break; case SFX_STYLE_FAMILY_PSEUDO: case SFX_STYLE_FAMILY_ALL: @@ -562,8 +484,8 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, if ( pHisPool && pHisPool->Count() > nSourceIdx2 ) pHisSheet = (*pHisPool)[nSourceIdx2]; - // Einfuegen ist nur dann noetig, wenn ein StyleSheet - // zwischen unterschiedlichen(!) Pools bewegt wird + // Pasting is only needed if a style sheet is moved between + // different (!) Pools if ( pHisSheet && pMyPool != pHisPool ) { @@ -572,12 +494,11 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, nIdx2 = pMyPool->Count(); } - // wenn so eine Vorlage schon existiert: loeschen! + // if such a template already exists: delete! String aOldName(pHisSheet->GetName()); SfxStyleFamily eOldFamily = pHisSheet->GetFamily(); SfxStyleSheetBase* pExist = pMyPool->Find(aOldName, eOldFamily); - // sal_uInt16 nOldHelpId = pExist->GetHelpId(??? VB ueberlegt sich was); sal_Bool bUsedOrUserDefined; if( pExist ) { @@ -600,10 +521,11 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, aOldName, eOldFamily, pHisSheet->GetMask(), nIdx2); - // ItemSet der neuen Vorlage fuellen + // Fill the Itemset of the new template rNewSheet.GetItemSet().Set(pHisSheet->GetItemSet()); - // wer bekommt den Neuen als Parent? wer benutzt den Neuen als Follow? + // Who gets the new one as a Parent? + // Who is using the new one as Follow? SfxStyleSheetBase* pTestSheet = pMyPool->First(); while (pTestSheet) { @@ -612,7 +534,7 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, pTestSheet->GetParent() == aOldName) { pTestSheet->SetParent(aOldName); - // Verknuepfung neu aufbauen + // Rebuild Link } if (pTestSheet->GetFamily() == eOldFamily && @@ -620,7 +542,7 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, pTestSheet->GetFollow() == aOldName) { pTestSheet->SetFollow(aOldName); - // Verknuepfung neu aufbauen + // Rebuild Link } pTestSheet = pMyPool->Next(); @@ -629,7 +551,7 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, rNewSheet.IsUsed() || rNewSheet.IsUserDefined(); - // hat der Neue einen Parent? wenn ja, mit gleichem Namen bei uns suchen + // has a New Parent? if so, start search with the same name if (pHisSheet->HasParentSupport()) { const String& rParentName = pHisSheet->GetParent(); @@ -642,8 +564,8 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, } } - // hat der Neue einen Follow? wenn ja, mit gleichem - // Namen bei uns suchen + // Has the new got a Follow? if so start search + // with the same name. if (pHisSheet->HasFollowSupport()) { const String& rFollowName = pHisSheet->GetFollow(); @@ -664,29 +586,7 @@ sal_Bool SfxObjectShell::Insert(SfxObjectShell &rSource, else bRet = sal_False; } -/* - else if (nSourceIdx1 == CONTENT_CONFIG) - { - nIdx1 = CONTENT_CONFIG; - SfxConfigManager *pCfgMgr = SFX_CFGMANAGER(); - if ( !GetConfigManager() ) - { - SetConfigManager(new SfxConfigManager(0, pCfgMgr)); - SetTemplateConfig(sal_False); - if (this == Current()) - GetConfigManager()->Activate(pCfgMgr); - } - - if (GetConfigManager()->CopyItem( - nSourceIdx2, nIdx2, rSource.GetConfigManager())) - { - SetModified(sal_True); - bRet = sal_True; - SFX_APP()->GetDispatcher_Impl()->Update_Impl(sal_True); - } - } -*/ return bRet; } @@ -721,14 +621,14 @@ sal_Bool SfxObjectShell::Remove pTestSheet->HasParentSupport() && pTestSheet->GetParent() == aName) { - pTestSheet->SetParent(aEmpty); // Verknuepfung aufloesen + pTestSheet->SetParent(aEmpty); // Remove link } if (pTestSheet->GetFamily() == eFamily && pTestSheet->HasFollowSupport() && pTestSheet->GetFollow() == aName) { - pTestSheet->SetFollow(aEmpty); // Verknuepfung aufloesen + pTestSheet->SetFollow(aEmpty); // Remove link } pTestSheet = pMyPool->Next(); @@ -750,10 +650,6 @@ sal_Bool SfxObjectShell::Print sal_uInt16 /*nIdx3*/, const String* pObjectName ) - -/* [Beschreibung] -*/ - { switch(nIdx1) { @@ -763,12 +659,11 @@ sal_Bool SfxObjectShell::Print SetOrganizerSearchMask(pStylePool); SfxStyleSheetIterator* pIter = pStylePool->CreateIterator( pStylePool->GetSearchFamily(), pStylePool->GetSearchMask() ); - sal_uInt16 nStyles = pIter->Count(); SfxStyleSheetBase *pStyle = pIter->First(); if ( !pStyle ) return sal_True; - // pepare adaptor for old style StartPage/EndPage printing + // prepare adaptor for old style StartPage/EndPage printing boost::shared_ptr< Printer > pPrinter( new Printer( rPrt.GetJobSetup() ) ); vcl::OldStylePrintAdaptor* pAdaptor = new vcl::OldStylePrintAdaptor( pPrinter ); boost::shared_ptr< vcl::PrinterController > pController( pAdaptor ); @@ -793,7 +688,6 @@ sal_Bool SfxObjectShell::Print aOutPos.Y() += nTextHeight; aOutPos.Y() += nTextHeight/2; aFont.SetSize(Size(0, 35)); // 10pt - nStyles = 1; while(pStyle) { // print template name @@ -884,18 +778,17 @@ sal_Bool SfxObjectShell::Print void SfxObjectShell::LoadStyles ( - SfxObjectShell &rSource /* die Dokument-Vorlage, aus der - die Styles geladen werden sollen */ + SfxObjectShell &rSource /* the document template from which + the styles are to be loaded */ ) -/* [Beschreibung] +/* [Description] - 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. + This method is called by the SFx if template styles are to be loaded. + Existing styles are in this case overwritten. The document has then to be + newly formatted. Therefore, the application of this method is usually + overloaded and its implementation is calling the implementation in + the base class. */ { @@ -903,7 +796,6 @@ void SfxObjectShell::LoadStyles { SfxStyleSheetBase *pSource; SfxStyleSheetBase *pDest; -// Styles_Impl () : pSource(0), pDest(0) {} }; SfxStyleSheetBasePool *pSourcePool = rSource.GetStyleSheetPool(); @@ -923,7 +815,7 @@ void SfxObjectShell::LoadStyles { pDest = &pMyPool->Make( pSource->GetName(), pSource->GetFamily(), pSource->GetMask()); - // Setzen des Parents, der Folgevorlage + // Setting of Parents, the next style } pFound[nFound].pSource = pSource; pFound[nFound].pDest = pDest; @@ -934,7 +826,6 @@ void SfxObjectShell::LoadStyles for ( sal_uInt16 i = 0; i < nFound; ++i ) { pFound[i].pDest->GetItemSet().PutExtended(pFound[i].pSource->GetItemSet(), SFX_ITEM_DONTCARE, SFX_ITEM_DEFAULT); -// pFound[i].pDest->SetHelpId(pFound[i].pSource->GetHelpId()); if(pFound[i].pSource->HasParentSupport()) pFound[i].pDest->SetParent(pFound[i].pSource->GetParent()); if(pFound[i].pSource->HasFollowSupport()) @@ -947,13 +838,12 @@ void SfxObjectShell::LoadStyles void SfxObjectShell::UpdateFromTemplate_Impl( ) -/* [Beschreibung] +/* [Description] - Diese interne Methode pr"uft, ob das Dokument aus einem Template - erzeugt wurde, und ob dieses neuer ist als das Dokument. Ist dies - der Fall, wird der Benutzer gefragt, ob die Vorlagen (StyleSheets) - updated werden sollen. Wird dies positiv beantwortet, werden die - StyleSheets updated. + This internal method checks whether the document was created from a + template, and if this is newer than the document. If this is the case, + the user is asked if the Templates (StyleSheets) should be updated. + If this is answered positively, the StyleSheets are updated. */ { @@ -983,10 +873,10 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) if ( aTemplName.getLength() || (aTemplURL.getLength() && !IsReadOnly()) ) { - // try to locate template, first using filename - // this must be done because writer global document uses this "great" idea to manage the templates of all parts - // in the master document - // but it is NOT an error if the template filename points not to a valid file + // try to locate template, first using filename this must be done + // because writer global document uses this "great" idea to manage + // the templates of all parts in the master document but it is NOT + // an error if the template filename points not to a valid file SfxDocumentTemplates aTempl; aTempl.Construct(); if ( aTemplURL.getLength() ) @@ -997,7 +887,8 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) } if( !aFoundName.Len() && aTemplName.getLength() ) - // if the template filename did not lead to success, try to get a file name for the logical template name + // if the template filename did not lead to success, + // try to get a file name for the logical template name aTempl.GetFull( String(), aTemplName, aFoundName ); } @@ -1085,7 +976,6 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) // remember date/time of check xDocProps->setTemplateDate(aTemplDate); // TODO/LATER: new functionality to store document info is required ( didn't work for SO7 XML format ) -//REPLACE pInfo->Save(xDocStor); } } } @@ -1229,3 +1119,4 @@ sal_Bool SfxObjectShell::IsModifyPasswordEntered() return pImp->m_bModifyPasswordEntered; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index a83335ea9fcd..4c639717ab70 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -134,45 +135,6 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea ) SetModified( sal_True ); SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); - - /* - Size aSize (GetVisArea().GetSize()); - if ( GetIPEnv() && GetIPEnv()->GetEditWin() ) - ViewChanged( ASPECT_CONTENT ); - */ - - - // OutPlace die Gr"o\se des MDI-Fensters anpassen - // Unbedingt den Gr"o\senvergleich machen, spart nicht nur Zeit, sondern - // vermeidet auch Rundungsfehler ! - /* - // in case of ole outplace editing the frame should be found - SfxViewFrame* pFrameToResize = pFrame ? pFrame : SfxViewFrame::GetFirst( GetObjectShell() ); - - if ( pFrameToResize && !pIPF && rRect.GetSize() != aSize && - !pFrameToResize->IsAdjustPosSizePixelLocked_Impl() ) - - { - // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow - // ber"ucksichtigen - SfxViewShell *pShell = pFrameToResize->GetViewShell(); - Window *pWindow = pShell->GetWindow(); - - // Da in den Applikationen bei der R"ucktransformation immer die - // Eckpunkte tranformiert werden und nicht die Size (um die Ecken - // alignen zu k"onnen), transformieren wir hier auch die Punkte, um - // m"oglichst wenig Rundungsfehler zu erhalten. - Rectangle aRect = pWindow->LogicToPixel( rRect ); - Size aSize = aRect.GetSize(); - pShell->GetWindow()->SetSizePixel( aSize ); - pFrameToResize->DoAdjustPosSizePixel( pShell, Point(), aSize ); - } - - // bei InPlace die View skalieren - if ( GetIPEnv() && GetIPEnv()->GetEditWin() && !bDisableViewScaling && pIPF ) - pIPF->GetEnv_Impl()->MakeScale( rRect.GetSize(), GetMapUnit(), - pIPF->GetViewShell()->GetWindow()->GetOutputSizePixel() ); - */ } } } @@ -232,9 +194,6 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev, Fraction aXF( rSize.Width(), aSize.Width() ); Fraction aYF( rSize.Height(), aSize.Height() ); -//REMOVE Point aOrg = rObjPos; -//REMOVE aMod.SetMapUnit( MAP_100TH_MM ); -//REMOVE aSize = pDev->LogicToLogic( GetVisArea( nAspect ).GetSize(), &aMod, &aWilliMode ); DoDraw_Impl( pDev, rObjPos, aXF, aYF, rSetup, nAspect ); } } @@ -253,15 +212,15 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, aMapMode.SetScaleX( rScaleX ); aMapMode.SetScaleY( rScaleY ); - // Ziel in Pixel + // Target in Pixels Point aOrg = pDev->LogicToLogic( rViewPos, NULL, &aMapMode ); Point aDelta = aOrg - aVisArea.TopLeft(); - // Origin entsprechend zum sichtbaren Bereich verschieben - // Origin mit Scale setzen + // Origin moved according to the viewable area + // Origin set with Scale aMapMode.SetOrigin( aDelta ); - // Deviceeinstellungen sichern + // Secure the Device settings pDev->Push(); Region aRegion; @@ -280,9 +239,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, else pMtf = NULL; } -// #ifndef UNX if( pDev->IsClipRegion() && pDev->GetOutDevType() != OUTDEV_PRINTER ) -// #endif { aRegion = pDev->PixelToLogic( aRegion ); pDev->SetClipRegion( aRegion ); @@ -290,14 +247,9 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, if( pMtf ) pMtf->Record( pDev ); -//REMOVE SvOutPlaceObjectRef xOutRef( this ); -//REMOVE if ( xOutRef.Is() ) -//REMOVE xOutRef->DrawObject( pDev, rSetup, rSize, nAspect ); -//REMOVE else Draw( pDev, rSetup, nAspect ); -//REMOVE DrawHatch( pDev, aVisArea.TopLeft(), aVisArea.GetSize() ); - // Deviceeinstellungen wieder herstellen + // Restore Device settings pDev->Pop(); } @@ -315,3 +267,4 @@ void SfxObjectShell::ClearEmbeddedObjects() DELETEZ( pImp->mpObjectContainer ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index 01fb87f29eac..38517d378aae 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include <sfx2/objsh.hxx> -//#include "objshimp.hxx" #include <sfx2/objitem.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -64,7 +61,7 @@ SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const //-------------------------------------------------------------------- -sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { if ( pObjSh ) { @@ -76,12 +73,12 @@ sal_Bool SfxObjectShellItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uIn { rVal <<= ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >(); } - return sal_True; + return true; } //-------------------------------------------------------------------- -sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { // This item MUST have a model. Please don't change this, there are UNO-based // implementations which need it!! @@ -100,16 +97,16 @@ sal_Bool SfxObjectShellItem::PutValue( const com::sun::star::uno::Any& rVal, sal if ( nHandle ) { pObjSh = reinterpret_cast< SfxObjectShell* >(sal::static_int_cast<sal_IntPtr>( nHandle )); - return sal_True; + return true; } } } pObjSh = 0; - return sal_True; + return true; } - return sal_False; + return true; } //========================================================================= @@ -133,3 +130,5 @@ SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const { return new SfxObjectItem( Which(), _pSh ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index d961c2df3aef..b43001e03c69 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,15 +29,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _INETMSG_HXX //autogen #include <svl/inetmsg.hxx> -#endif #include <tools/diagnose_ex.h> #include <svl/eitem.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> #include <svtools/svparser.hxx> // SvKeyValue -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -48,9 +47,7 @@ #include <com/sun/star/script/InterruptReason.hpp> #include <com/sun/star/script/XEngineListener.hpp> #include <com/sun/star/script/XDebugging.hpp> -#ifndef _COM_SUN_STAR_SCRIPT_XINVOKATION_HPP_ #include <com/sun/star/script/XInvocation.hpp> -#endif #include <com/sun/star/script/ContextInformation.hpp> #include <com/sun/star/script/FinishReason.hpp> #include <com/sun/star/script/XEngine.hpp> @@ -63,15 +60,11 @@ #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> - - #include <com/sun/star/script/provider/XScript.hpp> #include <com/sun/star/script/provider/XScriptProvider.hpp> #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> -#endif #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Any.h> @@ -98,12 +91,8 @@ using namespace ::com::sun::star::script::provider; using namespace ::com::sun::star::container; #include <basic/sbuno.hxx> #include <basic/sbstar.hxx> -#ifndef _SB_BASMGR_HXX #include <basic/basmgr.hxx> -#endif -#ifndef _VCL_MSGBOX_HXX #include <vcl/msgbox.hxx> -#endif #include <basic/sbx.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> @@ -180,7 +169,7 @@ public: //========================================================================= -sal_uInt16 __READONLY_DATA aTitleMap_Impl[3][2] = +sal_uInt16 const aTitleMap_Impl[3][2] = { // local remote /* SFX_TITLE_CAPTION */ { SFX_TITLE_FILENAME, SFX_TITLE_TITLE }, @@ -238,25 +227,6 @@ void SfxObjectShell::FlushDocInfo() sal_Int32 delay(xDocProps->getAutoloadSecs()); SetAutoLoad( INetURLObject(url), delay * 1000, (delay > 0) || url.getLength() ); -/* - // bitte beachten: - // 1. Titel in DocInfo aber nicht am Doc (nach HTML-Import) - // => auch am Doc setzen - // 2. Titel in DocInfo leer (Briefumschlagsdruck) - // => nicht am Doc setzen, da sonst "unbenanntX" daraus wird - String aDocInfoTitle = GetDocInfo().GetTitle(); - if ( aDocInfoTitle.Len() ) - SetTitle( aDocInfoTitle ); - else - { - pImp->aTitle.Erase(); - SetNamedVisibility_Impl(); - if ( GetMedium() ) - { - SfxShell::SetName( GetTitle(SFX_TITLE_APINAME) ); - Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - } - }*/ } //------------------------------------------------------------------------- @@ -315,7 +285,7 @@ void SfxObjectShell::SetTemplate(sal_Bool bIs) { pImp->bIsTemplate=bIs; SfxFilterMatcher aMatcher( GetFactory().GetFactoryName() ); - SfxFilterMatcherIter aIter( &aMatcher, SFX_FILTER_TEMPLATEPATH ); + SfxFilterMatcherIter aIter( aMatcher, SFX_FILTER_TEMPLATEPATH ); SfxMedium* pMed = GetMedium(); if( pMed ) pMed->SetFilter( aIter.First() ); } @@ -326,7 +296,7 @@ void SfxObjectShell::EnableSetModified( sal_Bool bEnable ) { #ifdef DBG_UTIL if ( bEnable == pImp->m_bEnableSetModified ) - DBG_WARNING( "SFX_PERSIST: EnableSetModified 2x mit dem gleichen Wert gerufen" ); + DBG_WARNING( "SFX_PERSIST: EnableSetModified 2x called with the same value" ); #endif pImp->m_bEnableSetModified = bEnable; } @@ -384,7 +354,7 @@ void SfxObjectShell::SetModified( sal_Bool bModifiedP ) { #ifdef DBG_UTIL if ( !bModifiedP && !IsEnableSetModified() ) - DBG_WARNING( "SFX_PERSIST: SetModified( sal_False ), obwohl IsEnableSetModified() == sal_False" ); + DBG_WARNING( "SFX_PERSIST: SetModified( sal_False ), although IsEnableSetModified() == sal_False" ); #endif if( !IsEnableSetModified() ) @@ -402,7 +372,7 @@ void SfxObjectShell::SetModified( sal_Bool bModifiedP ) void SfxObjectShell::ModifyChanged() { if ( pImp->bClosing ) - // SetModified aus dem dispose des Models! + // SetModified dispose of the models! return; {DBG_CHKTHIS(SfxObjectShell, 0);} @@ -422,11 +392,10 @@ void SfxObjectShell::ModifyChanged() sal_Bool SfxObjectShell::IsReadOnlyUI() const -/* [Beschreibung] +/* [Description] - 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. + Returns sal_True if the document for the UI is treated as r/o. This is + regardless of the actual r/o, which can be checked with <IsReadOnly()>. */ { @@ -437,9 +406,9 @@ sal_Bool SfxObjectShell::IsReadOnlyUI() const sal_Bool SfxObjectShell::IsReadOnlyMedium() const -/* [Beschreibung] +/* [Description] - Liefert sal_True, wenn das Medium r/o ist bzw. r/o geoeffnet wurde. + Returns sal_True when the medium is r/o, for instance when opened as r/o. */ { @@ -452,10 +421,10 @@ sal_Bool SfxObjectShell::IsReadOnlyMedium() const void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly ) -/* [Beschreibung] +/* [Description] - 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. + Turns the document in an r/o and r/w state respectively without reloading + it and without changing the open mode of the medium. */ { @@ -464,8 +433,6 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly ) if ( bWasRO != IsReadOnly() ) { Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); - //if ( pImp->pDocInfo ) - // pImp->pDocInfo->SetReadOnly( IsReadOnly() ); } } @@ -509,12 +476,10 @@ sal_Bool SfxObjectShell::IsInModalMode() const return pImp->bModalMode || pImp->bRunningMacro; } -//<!--Added by PengYunQuan for Validity Cell Range Picker sal_Bool SfxObjectShell::AcceptStateUpdate() const { return !IsInModalMode(); } -//-->Added by PengYunQuan for Validity Cell Range Picker //------------------------------------------------------------------------- @@ -547,17 +512,18 @@ void SfxObjectShell::SetMacroMode_Impl( sal_Bool bModal ) void SfxObjectShell::SetModalMode_Impl( sal_Bool bModal ) { - // nur Broadcasten wenn modifiziert, sonst ggf. Endlosrekursion + // Broadcast only if modified, or otherwise it will possibly go into + // an endless loop if ( !pImp->bModalMode != !bModal ) { - // zentral mitz"ahlen + // Central count sal_uInt16 &rDocModalCount = SFX_APP()->Get_Impl()->nDocModalMode; if ( bModal ) ++rDocModalCount; else --rDocModalCount; - // umschalten + // Switch pImp->bModalMode = bModal; Broadcast( SfxSimpleHint( SFX_HINT_MODECHANGED ) ); } @@ -809,52 +775,39 @@ IndexBitSet& SfxObjectShell::GetNoSet_Impl() void SfxObjectShell::SetTitle ( - const String& rTitle // der neue Titel des Dokuments + const String& rTitle // the new Document Title ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann der Titel des Dokuments gesetzt werden. - Dieser entspricht initial dem kompletten Dateinamen. Ein Setzen - des Titels wirkt jedoch nicht zu"uck auf den Dateinamen; er wird - jedoch in den Caption-Bars der MDI-Fenster angezeigt. + With this method, the title of the document can be set. + This corresponds initially to the full file name. A setting of the + title does not affect the file name, but it will be shown in the + Caption-Bars of the MDI-window. */ { DBG_CHKTHIS(SfxObjectShell, 0); - // nix zu tun? + // Nothing to do? if ( ( ( HasName() && pImp->aTitle == rTitle ) || ( !HasName() && GetTitle() == rTitle ) ) && !IsDocShared() ) return; SfxApplication *pSfxApp = SFX_APP(); -#if 0 - // wird 'unbenannt#' als Titel gesetzt - String aNoName(SfxResId(STR_NONAME)); - if ( rTitle.Match(aNoName) <= aNoName.Len() ) - { - // er ist es selbst => ignorieren - pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); - pImp->bIsNamedVisible=0; - } -#endif - // ggf. die unbenannt-Nummer freigeben + // If possible relase the unnamed number. if ( pImp->bIsNamedVisible && USHRT_MAX != pImp->nVisualDocumentNumber ) { pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); pImp->bIsNamedVisible = 0; } - // Title setzen + // Set Title pImp->aTitle = rTitle; -// Wieso denn in der DocInfo? -// GetDocInfo().SetTitle( rTitle ); -// FlushDocInfo(); - // Benachrichtigungen + // Notification if ( GetMedium() ) { SfxShell::SetName( GetTitle(SFX_TITLE_APINAME) ); @@ -876,73 +829,64 @@ String X(const String &rRet) #endif //-------------------------------------------------------------------- -//-------------------------------------------------------------------- String SfxObjectShell::GetTitle ( sal_uInt16 nMaxLength /* 0 (default) - der Titel selbst, so wie er ist + the title itself, as it is 1 (==SFX_TITLE_FILENAME) - liefert den logischen Dateinamen ohne Pfad - (unter WNT je nach Systemeinstellung ohne - Extension) + provides the logical file name without path + (under WNT depending on the system settings + without extension) 2 (==SFX_TITLE_FULLNAME) - liefert den mit komplettem logischen Dateinamen - mit Pfad (remote => ::com::sun::star::util::URL) + provides the logical file names with full path + (remote =>:: com:: sun:: star:: util:: URL) 3 (==SFX_TITLE_APINAME) - liefert den logischen Dateinamen ohne Pfad - und Extension + provides the logical filname without path + and extension 4 (==SFX_TITLE_DETECT) - liefert den kompletten Titel, falls noch - nicht gesetzt wird aber aus DocInfo oder - dem Namen des Medium erzeugt + provides the complete title, if not set yet + it will be created from DocInfo or the name of + the medium. 5 (==SFX_TITLE_CAPTION) - liefert den Titel so, wie MB ihn heute in - der CaptionBar anzeigen m"ochte + provides the Title just like MB now in the + CaptionBar view 6 (==SFX_TITLE_PICKLIST) - liefert den Titel so, wie MB ihn heute in - der PickList anzeigen m"ochte + returns the Title, just like MB now would + display it in the in the PickList 7 (==SFX_TITLE_HISTORY) - liefert den Titel so, wie MB ihn heute in - der History anzeigen m"ochte + returns the Title just like MB now would + display it in the in the History 10 bis USHRT_MAX - liefert maximal 'nMaxLength' Zeichen vom logischen - Dateinamen inkl. Pfad (remote => ::com::sun::star::util::URL) + provides the 'nMaxLength' of the logical + file name including the path + (remote => ::com::sun::star::util::URL) */ ) const -/* [Beschreibung] +/* [Description] - Liefert den Titel bzw. logischen Dateinamen des Dokuments, je nach + Returns the title or logical file name of the document, depending on the '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. + If the file name with path is used, the Name shortened by replacing one or + more directory names with "...", URLs are currently always returned + in complete form. */ { -// if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// return String(); SfxMedium *pMed = GetMedium(); if ( IsLoading() ) return String(); -/* if ( !nMaxLength && pImp->pDocInfo ) - { - String aTitle = pImp->pDocInfo->GetTitle(); - if ( aTitle.Len() ) - return aTitle; - } */ - - // Titel erzeugen? + // Create Title? if ( SFX_TITLE_DETECT == nMaxLength && !pImp->aTitle.Len() ) { static sal_Bool bRecur = sal_False; @@ -971,38 +915,37 @@ String SfxObjectShell::GetTitle else if (SFX_TITLE_APINAME == nMaxLength ) return X(GetAPIName()); - // Sonderfall Vorlagen: + // Special case templates: if( IsTemplate() && pImp->aTitle.Len() && ( nMaxLength == SFX_TITLE_CAPTION || nMaxLength == SFX_TITLE_PICKLIST ) ) return X(pImp->aTitle); - // Picklist/Caption wird gemappt + // Picklist/Caption is mapped if ( pMed && ( nMaxLength == SFX_TITLE_CAPTION || nMaxLength == SFX_TITLE_PICKLIST ) ) { - // Wenn ein spezieller Titel beim "Offnen mitgegeben wurde; - // wichtig bei URLs, die INET_PROT_FILE verwenden, denn bei denen - // wird der gesetzte Titel nicht beachtet. - // (s.u., Auswertung von aTitleMap_Impl) + // If a specific title was given at open: + // important for URLs: use INET_PROT_FILE for which the set title is not + // considered. (See below, analysis of aTitleMap_Impl) SFX_ITEMSET_ARG( pMed->GetItemSet(), pNameItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); if ( pNameItem ) return X( pNameItem->GetValue() ); } - // noch unbenannt? - DBG_ASSERT( !HasName() || pMed, "HasName() aber kein Medium?!?" ); + // Still unnamed? + DBG_ASSERT( !HasName() || pMed, "HasName() but no Medium?!?" ); if ( !HasName() || !pMed ) { - // schon Titel gesezt? + // Title already set? if ( pImp->aTitle.Len() ) return X(pImp->aTitle); - // mu\s es durchnumeriert werden? + // must it be numbered? String aNoName( SfxResId( STR_NONAME ) ); if ( pImp->bIsNamedVisible ) - // Nummer hintenanh"angen + // Append number aNoName += String::CreateFromInt32( pImp->nVisualDocumentNumber ); - // Dokument hei\st vorerst 'unbenannt#' + // Document called "noname" for the time being return X(aNoName); } @@ -1017,7 +960,7 @@ String SfxObjectShell::GetTitle nMaxLength = aTitleMap_Impl[nMaxLength-SFX_TITLE_CAPTION][nRemote]; } - // lokale Datei? + // Local file? if ( aURL.GetProtocol() == INET_PROT_FILE ) { String aName( aURL.HasMark() ? INetURLObject( aURL.GetURLNoMark() ).PathToFileName() : aURL.PathToFileName() ); @@ -1032,7 +975,7 @@ String SfxObjectShell::GetTitle } else { - // ::com::sun::star::util::URL-Versionen + // ::com::sun::star::util::URL-Versions if ( nMaxLength >= SFX_TITLE_MAXLEN ) { String aComplete( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); @@ -1056,7 +999,7 @@ String SfxObjectShell::GetTitle else if ( nMaxLength == SFX_TITLE_FULLNAME ) return X(aURL.GetMainURL( INetURLObject::DECODE_TO_IURI )); - // ggf. Titel aus Dateiname generieren + // Generate Title from file name if possible if ( !pImp->aTitle.Len() ) pImp->aTitle = aURL.GetBase(); @@ -1065,7 +1008,7 @@ String SfxObjectShell::GetTitle pImp->aTitle = aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); } - // ganzer Titel + // Complete Title return X(pImp->aTitle); } @@ -1073,20 +1016,16 @@ String SfxObjectShell::GetTitle void SfxObjectShell::InvalidateName() -/* [Beschreibung] +/* [Description] - Ermittelt den Titel des Dokuments neu aus 'unbenannt', DocInfo-Titel - bzw. Dateinamen. Wird nach Laden aus Template oder SaveAs ben"otigt. + Returns the title of the new document, DocInfo-Title or + File name. Is required for loading from template or SaveAs. */ { - // Title neu erzeugen pImp->aTitle.Erase(); -// pImp->nVisualDocumentNumber = USHRT_MAX; - //GetTitle( SFX_TITLE_DETECT ); SetName( GetTitle( SFX_TITLE_APINAME ) ); - // Benachrichtigungen Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) ); } @@ -1096,9 +1035,7 @@ void SfxObjectShell::SetNamedVisibility_Impl() { if ( !pImp->bIsNamedVisible ) { - // Nummer verpassen pImp->bIsNamedVisible = sal_True; - // ggf. neue Nummer verpassen if ( !HasName() && USHRT_MAX == pImp->nVisualDocumentNumber && !pImp->aTitle.Len() ) { pImp->nVisualDocumentNumber = SFX_APP()->GetFreeIndex(); @@ -1133,14 +1070,14 @@ SfxProgress* SfxObjectShell::GetProgress() const void SfxObjectShell::SetProgress_Impl ( - SfxProgress *pProgress /* zu startender <SfxProgress> oder 0, falls - der Progress zur"uckgesetzt werden soll */ + SfxProgress *pProgress /* to started <SfxProgress> or 0, + if the progress is to be reset */ ) -/* [Beschreibung] +/* [Description] - Interne Methode zum setzen oder zur"ucksetzen des Progress-Modes - f"ur diese SfxObjectShell. + Internal method to set or reset the Progress modes for + SfxObjectShell. */ { @@ -1181,10 +1118,11 @@ void SfxObjectShell::SetActivateEvent_Impl(sal_uInt16 nId ) //-------------------------------------------------------------------- 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. */ +/* [Description] + + All media, which are placed in order to load parts of a document must be + registered by a related SfxObjectShell. Thus documents can be canceled. +*/ { rMedium.SetReferer( GetMedium()->GetName() ); } @@ -1192,9 +1130,10 @@ void SfxObjectShell::RegisterTransfer( SfxMedium& rMedium ) //------------------------------------------------------------------------- void SfxObjectShell::PrepareReload( ) -/* [Beschreibung ] - Wird vor dem Reload gerufen und gibt die Moeglichkeit, - etwaige Caches zu leeren. */ +/* [Description] + + Is called before the Reload and gives the opportunity to clear any caches. +*/ { } @@ -1202,8 +1141,10 @@ void SfxObjectShell::PrepareReload( ) void SfxObjectShell::LockAutoLoad( sal_Bool bLock ) -/* Verhindert ein evtl. eintreffendes AutoLoad. Wird auch vor AutoLoad - eines umgebenden FrameSet beruecksichtigt. +/* [Description] + + Prevents an possible occuring autoload. Takes also FrameSet into account. + before the autoload. */ { @@ -1215,21 +1156,21 @@ void SfxObjectShell::LockAutoLoad( sal_Bool bLock ) //------------------------------------------------------------------------- -// kann nach frame.cxx gemoved werden, wenn 358+36x-Stand gemerged sind +// Can be moved to frame.cxx, when 358+36x-State have been merged sal_Bool SfxFrame::IsAutoLoadLocked_Impl() const { - // sein einges Doc gelockt? + // Its own Docucument is locked? const SfxObjectShell* pObjSh = GetCurrentDocument(); if ( !pObjSh || !pObjSh->IsAutoLoadLocked() ) return sal_False; - // seine Childs gelockt? + // Its Childs are locked? for ( sal_uInt16 n = GetChildFrameCount(); n--; ) if ( !GetChildFrame(n)->IsAutoLoadLocked_Impl() ) return sal_False; - // sonst ist AutoLoad erlaubt + // otherwise allow AutoLoad return sal_True; } @@ -1237,8 +1178,8 @@ sal_Bool SfxFrame::IsAutoLoadLocked_Impl() const sal_Bool SfxObjectShell::IsAutoLoadLocked() const -/* Liefert, ob ein eintreffendes AutoLoad ausgefuehrt werden darf. Wird auch - vor AutoLoad eines umgebenden FrameSet beruecksichtigt. +/* Returns whether an Autoload is allowed to be executed. Before the + surrounding FrameSet of the AutoLoad is also taken into account as well. */ { @@ -1488,7 +1429,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad() else { // !TODO/LATER: what's this?! - // Interaktiv ( DClick, Contextmenu ) kommt kein Langname mit + // Interactiv ( DClick, Contextmenu ) no long name is included aTemplateName = getDocProperties()->getTitle(); if ( !aTemplateName.Len() ) { @@ -1578,8 +1519,10 @@ void SfxObjectShell::PositionView_Impl() //------------------------------------------------------------------------- sal_Bool SfxObjectShell::IsLoading() const -/* [Beschreibung ] - Has FinishedLoading been called? */ +/* [Description] + + Has FinishedLoading been called? +*/ { return !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ); } @@ -1587,23 +1530,17 @@ sal_Bool SfxObjectShell::IsLoading() const //------------------------------------------------------------------------- void SfxObjectShell::CancelTransfers() -/* [Beschreibung ] - Hier koennen Transfers gecanceled werden, die nicht mit - RegisterTransfer registiert wurden */ +/* [Description] + + Here can Transfers get canceled, which were not regestered + by RegisterTransfer. +*/ { if( ( pImp->nLoadedFlags & SFX_LOADED_ALL ) != SFX_LOADED_ALL ) { AbortImport(); if( IsLoading() ) FinishedLoading( SFX_LOADED_ALL ); - -/* - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - while( pFrame ) - { - pFrame->CancelTransfers(); - pFrame = SfxViewFrame::GetNext( *pFrame, this ); - }*/ } } @@ -1624,10 +1561,10 @@ void AutoReloadTimer_Impl::Timeout() if ( pFrame ) { - // momentan nicht m"oglich/sinnvoll? + // Not possible/meanigfull at the moment? if ( !pObjSh->CanReload_Impl() || pObjSh->IsAutoLoadLocked() || Application::IsUICaptured() ) { - // erneuten Versuch erlauben + // Allow a retry Start(); return; } @@ -1694,7 +1631,7 @@ namespace } ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL, - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError ) + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller ) { OSL_TRACE( "in CallXScript" ); ErrCode nErr = ERRCODE_NONE; @@ -1728,6 +1665,16 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon // obtain the script, and execute it Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW ); + if ( pCaller && pCaller->hasValue() ) + { + Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); + if ( xProps.is() ) + { + Sequence< uno::Any > aArgs( 1 ); + aArgs[ 0 ] = *pCaller; + xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Caller")), uno::makeAny( aArgs ) ); + } + } aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam ); } catch ( const uno::Exception& ) @@ -1760,10 +1707,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam - , bool bRaiseError ) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& + aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller ) { - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError ); + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller ); } //------------------------------------------------------------------------- @@ -1829,7 +1776,6 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) } else { -// DBG_ERROR( "Schlechtes ::com::sun::star::util::DateTime fuer Expired" ); pDoc->GetMedium()->SetExpired_Impl( Date( 1, 1, 1970 ) ); } } @@ -1858,7 +1804,7 @@ SvKeyValueIterator* SfxObjectShell::GetHeaderAttributes() { if( !pImp->xHeaderAttributes.Is() ) { - DBG_ASSERT( pMedium, "Kein Medium" ); + DBG_ASSERT( pMedium, "No Medium" ); pImp->xHeaderAttributes = new SfxHeaderAttributes_Impl( this ); } return ( SvKeyValueIterator*) &pImp->xHeaderAttributes; @@ -1886,7 +1832,7 @@ sal_Bool SfxObjectShell::IsPreview() const SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFlags, SfxStringItem, SID_OPTIONS, sal_False); if ( pFlags ) { - // Werte auf einzelne Items verteilen + // Distributed values among individual items String aFileFlags = pFlags->GetValue(); aFileFlags.ToUpperAscii(); if ( STRING_NOTFOUND != aFileFlags.Search( 'B' ) ) @@ -1905,11 +1851,11 @@ sal_Bool SfxObjectShell::IsPreview() const sal_Bool SfxObjectShell::IsSecure() { - // Wenn globale Warnung an ist, nach Secure-Referer-Liste gehen + // When global warning is on, go to Secure-Referer-Liste String aReferer = GetMedium()->GetName(); if ( !aReferer.Len() ) { - // bei neuen Dokumenten das Template als Referer nehmen + // for new documents use the template as reference ::rtl::OUString aTempl( getDocProperties()->getTemplateURL() ); if ( aTempl.getLength() ) aReferer = INetURLObject( aTempl ).GetMainURL( INetURLObject::NO_DECODE ); @@ -1929,7 +1875,6 @@ sal_Bool SfxObjectShell::IsSecure() return sal_False; if ( aOpt.IsSecureURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aReferer ) ) - //if ( SvtSecurityOptions().IsSecureURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aReferer ) ) { if ( GetMedium()->GetContent().is() ) { @@ -2038,7 +1983,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) String SfxObjectShell::UpdateTitle( SfxMedium* pMed, sal_uInt16 nDocViewNumber ) { - // Titel des Fensters + // Title of the windows String aTitle; if ( pMed ) { @@ -2411,3 +2356,4 @@ void SfxObjectShell::StoreLog() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 73d836938183..cef38fe0416a 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,6 +47,7 @@ #include <com/sun/star/frame/XDocumentTemplates.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <com/sun/star/security/CertificateValidity.hpp> #include <com/sun/star/security/DocumentSignatureInformation.hpp> @@ -63,8 +65,9 @@ #include <basic/sbx.hxx> #include <unotools/pathoptions.hxx> #include <unotools/useroptions.hxx> -#include <svtools/asynclink.hxx> #include <unotools/saveopt.hxx> +#include <svtools/asynclink.hxx> +#include <svtools/miscopt.hxx> #include <comphelper/documentconstants.hxx> #include <sfx2/app.hxx> @@ -83,7 +86,6 @@ #include <sfx2/objsh.hxx> #include "objshimp.hxx" #include "sfxtypes.hxx" -//#include "interno.hxx" #include <sfx2/module.hxx> #include <sfx2/viewfrm.hxx> #include "versdlg.hxx" @@ -226,7 +228,7 @@ sal_Bool SfxInstanceCloseGuard_Impl::Init_Impl( const uno::Reference< util::XClo } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Could not register close listener!\n" ); + OSL_FAIL( "Could not register close listener!\n" ); } } @@ -452,7 +454,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) aSet.Put( SfxStringItem( SID_EXPLORER_PROPS_START, aTitle ) ); aSet.Put( SfxStringItem( SID_BASEURL, GetMedium()->GetBaseURL() ) ); - // creating dialog is done via virtual method; application will add its own statistics page + // creating dialog is done via virtual method; application will + // add its own statistics page SfxDocumentInfoDialog *pDlg = CreateDocumentInfoDialog(0, aSet); if ( RET_OK == pDlg->Execute() ) { @@ -496,7 +499,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) return; } - //!! detaillierte Auswertung eines Fehlercodes + //!! detailed analysis of an error code SfxObjectShellRef xLock( this ); // the model can not be closed till the end of this method @@ -722,9 +725,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SfxViewFrame *pFrame = GetFrame(); if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { - // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das - // aktuelle Dokument aber in einem Frame liegt, soll eigentlich - // das FrameSetDocument geclosed werden + // If SID_CLOSEDOC is excecuted through menu and so on, but + // the current document is in a frame, then the + // FrameSetDocument should actually be closed. pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); rReq.Done(); return; @@ -737,8 +740,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) { if ( pFrame->GetFrame().GetParentFrame() ) { - // Auf dieses Dokument existiert noch eine Sicht, die - // in einem FrameSet liegt; diese darf nat"urlich nicht + // In this document there still exists a view that is + // in a FrameSet , which of course may not be closed // geclosed werden bInFrameSet = sal_True; } @@ -750,7 +753,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( bInFrameSet ) { - // Alle Sichten, die nicht in einem FrameSet liegen, closen + // Close all views that are not in a FrameSet. pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { @@ -760,7 +763,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } } - // Parameter auswerten + // Evaluate Parameter SFX_REQUEST_ARG(rReq, pSaveItem, SfxBoolItem, SID_CLOSEDOC_SAVE, sal_False); SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_CLOSEDOC_FILENAME, sal_False); if ( pSaveItem ) @@ -788,7 +791,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SetModified(sal_False); } - // Benutzer bricht ab? + // Cancelled by the user? if ( !PrepareClose( 2 ) ) { rReq.SetReturnValue( SfxBoolItem(0, sal_False) ); @@ -802,7 +805,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) rReq.SetReturnValue( SfxBoolItem(0, sal_True) ); rReq.Done(); - rReq.ReleaseArgs(); // da der Pool in Close zerst"ort wird + rReq.ReleaseArgs(); // because the pool is destroyed in Close DoClose(); return; } @@ -810,7 +813,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_DOCTEMPLATE: { - // speichern als Dokumentvorlagen + // save as document templates SfxDocumentTemplateDlg *pDlg = 0; SfxErrorContext aEc(ERRCTX_SFX_DOCTEMPLATE,GetTitle()); SfxDocumentTemplates *pTemplates = new SfxDocumentTemplates; @@ -874,7 +877,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) rReq.SetReturnValue( SfxBoolItem( 0, bOk ) ); if ( bOk ) { - // update the Organizer runtime cache from the template component if the cache has already been created + // update the Organizer runtime cache from the template + // component if the cache has already been created // TODO/LATER: get rid of this cache duplication SfxDocumentTemplates aTemplates; aTemplates.ReInitFromComponent(); @@ -889,7 +893,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } } - // Picklisten-Eintrag verhindern + // Prevent entry in the Pick-lists if ( rReq.IsAPI() ) GetMedium()->SetUpdatePickList( sal_False ); else if ( rReq.GetArgs() ) @@ -899,7 +903,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) GetMedium()->SetUpdatePickList( pPicklistItem->GetValue() ); } - // Ignore()-Zweige haben schon returnt + // Ignore()-branches have already returned rReq.Done(); } @@ -938,14 +942,16 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) if ( !pFrame || !pDoc->HasName() || !IsOwnStorageFormat_Impl( *pDoc->GetMedium() ) ) -//REMOVE || pDoc->GetMedium()->GetStorage()->GetVersion() < SOFFICE_FILEFORMAT_50 ) rSet.DisableItem( nWhich ); break; } case SID_SAVEDOC: { - sal_Bool bMediumRO = IsReadOnlyMedium(); - if ( !bMediumRO && GetMedium() && IsModified() ) + SvtMiscOptions aMiscOptions; + bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed(); + bool bAllowSave = (bAlwaysAllowSave || IsModified()); + bool bMediumRO = IsReadOnlyMedium(); + if ( !bMediumRO && GetMedium() && bAllowSave ) rSet.Put(SfxStringItem( nWhich, String(SfxResId(STR_SAVEDOC)))); else @@ -964,9 +970,10 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) SfxViewFrame *pFrame = GetFrame(); if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { - // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das - // aktuelle Dokument aber in einem Frame liegt, soll eigentlich - // das FrameSetDocument geclosed werden + + // If SID_CLOSEDOC is excecuted through menu and so on, but + // the current document is in a frame, then the + // FrameSetDocument should actually be closed. pDoc = pFrame->GetTopViewFrame()->GetObjectShell(); } @@ -984,18 +991,6 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) rSet.DisableItem( nWhich ); break; } -/* - const SfxFilter* pCombinedFilters = NULL; - SfxFilterContainer* pFilterContainer = GetFactory().GetFilterContainer(); - - if ( pFilterContainer ) - { - SfxFilterFlags nMust = SFX_FILTER_IMPORT | SFX_FILTER_EXPORT; - SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED | SFX_FILTER_INTERNAL; - - pCombinedFilters = pFilterContainer->GetAnyFilter( nMust, nDont ); - } -*/ if ( /*!pCombinedFilters ||*/ !GetMedium() ) rSet.DisableItem( nWhich ); else @@ -1006,31 +1001,12 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) case SID_EXPORTDOCASPDF: case SID_DIRECTEXPORTDOCASPDF: { - /* - - search for filter cant work correctly ... - Because it's not clear, which export filter for which office module - must be searched. On the other side it can be very expensive doing so. - The best solution would be: on installation time we should know if pdf feature - was installed or not!!! (e.g. by writing a bool inside cfg) - - SfxFilterContainer* pFilterContainer = GetFactory().GetFilterContainer(); - if ( pFilterContainer ) - { - String aPDFExtension = String::CreateFromAscii( "pdf" ); - const SfxFilter* pFilter = pFilterContainer->GetFilter4Extension( aPDFExtension, SFX_FILTER_EXPORT ); - if ( pFilter != NULL ) - break; - } - - rSet.DisableItem( nWhich ); - */ break; } case SID_DOC_MODIFIED: { - rSet.Put( SfxStringItem( SID_DOC_MODIFIED, IsModified() ? '*' : ' ' ) ); + rSet.Put( SfxBoolItem( SID_DOC_MODIFIED, IsModified() ) ); break; } @@ -1145,7 +1121,7 @@ void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet) case SID_DOCPATH: { - DBG_ERROR( "Not supported anymore!" ); + OSL_FAIL( "Not supported anymore!" ); break; } @@ -1404,8 +1380,9 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) } else { - //When the document is modified then we must not show the digital signatures dialog - //If we have come here then the user denied to save. + // When the document is modified then we must not show the + // digital signatures dialog + // If we have come here then the user denied to save. if (!bHasSign) bNoSig = true; } @@ -1490,19 +1467,14 @@ void SfxObjectShell::SignScriptingContent() ImplSign( sal_True ); } -// static +namespace +{ + class theSfxObjectShellUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSfxObjectShellUnoTunnelId > {}; +} + const uno::Sequence<sal_Int8>& SfxObjectShell::getUnoTunnelId() { - static uno::Sequence<sal_Int8> * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theSfxObjectShellUnoTunnelId::get().getSeq(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 38f30b78974a..2124c322a261 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <svl/eitem.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> @@ -135,12 +134,6 @@ #include "appbaslib.hxx" #include "appdata.hxx" -#ifdef OS2 -#include <osl/file.hxx> -#include <stdio.h> -#include <sys/ea.h> -#endif - #include "../appl/app.hrc" extern sal_uInt32 CheckPasswd_Impl( SfxObjectShell*, SfxItemPool&, SfxMedium* ); @@ -167,7 +160,7 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >& css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::container::XSet > xModelCollection( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster")), + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))), css::uno::UNO_QUERY); if (xModelCollection.is()) { @@ -177,7 +170,7 @@ void impl_addToModelCollection(const css::uno::Reference< css::frame::XModel >& } catch ( uno::Exception& ) { - OSL_ENSURE( sal_False, "The document seems to be in the collection already!\n" ); + OSL_FAIL( "The document seems to be in the collection already!\n" ); } } } @@ -241,7 +234,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl( try { uno::Reference< embed::XStorage > xVersion = xDocStorage->openStorageElement( - ::rtl::OUString::createFromAscii( "Versions" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Versions")), embed::ElementModes::READWRITE ); DBG_ASSERT( xVersion.is(), @@ -309,7 +302,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl( } catch ( uno::Exception& ) { - DBG_ERROR( "Creation of a storage copy is failed!" ); + OSL_FAIL( "Creation of a storage copy is failed!" ); ::utl::UCBContentHelper::Kill( aTempURL ); aTempURL = ::rtl::OUString(); @@ -353,7 +346,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto { try { - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ), uno::makeAny( aDataFlavor.MimeType ) ); + xProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), uno::makeAny( aDataFlavor.MimeType ) ); } catch( uno::Exception& ) { @@ -377,7 +370,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto try { // older versions can not have this property set, it exists only starting from ODF1.2 - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), uno::makeAny( ODFVER_012_TEXT ) ); + xProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Version" )), uno::makeAny( ODFVER_012_TEXT ) ); } catch( uno::Exception& ) { @@ -449,7 +442,7 @@ sal_Bool SfxObjectShell::GeneralInit_Impl( const uno::Reference< embed::XStorage } catch ( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can't check storage's mediatype!\n" ); + OSL_FAIL( "Can't check storage's mediatype!\n" ); } } else @@ -471,25 +464,24 @@ sal_Bool SfxObjectShell::Load( SfxMedium& rMedium ) } sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) -/* [Beschreibung] +/* [Description] - Diese von SvPersist geerbte virtuelle Methode wird gerufen, um - die SfxObjectShell-Instanz aus einem Storage (pStor != 0) bzw. - (pStor == 0) ganz neu zu initialisieren. + This from SvPersist inherited virtual method is called to initialize + the SfxObjectShell instance from a storage (PStore! = 0) or (PStore == 0) - 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. + Like with all Do...-methods there is a from a control, the actual + implementation is done by the virtual method in which also the + InitNew(SvStorate *) from the SfxObjectShell-Subclass is implemented. - 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. + For pStore == 0 the SfxObjectShell-instance is connected to an empty + SfxMedium, otherwise a SfxMedium, which refers to the SvStorage + passed as a parameter. - Erst nach InitNew() oder Load() ist das Objekt korrekt initialisiert. + The object is only initialized correctly after InitNew() or Load(). - [R"uckgabewert] - sal_True Das Objekt wurde initialisiert. - sal_False Das Objekt konnte nicht initialisiert werden + [Return value] + sal_True The object has been initialized. + sal_False The object could not be initialized */ { @@ -643,6 +635,9 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) sal_uInt32 nError = HandleFilter( pMedium, this ); if ( nError != ERRCODE_NONE ) SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); + + if (pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARTPRESENTATION) + pSet->Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, sal_True) ); } EnableSetModified( sal_False ); @@ -728,7 +723,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) { uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY ); - ::rtl::OUString sLockUpdates(::rtl::OUString::createFromAscii("LockUpdates")); + ::rtl::OUString sLockUpdates(RTL_CONSTASCII_USTRINGPARAM("LockUpdates")); bool bSetProperty = true; try { @@ -738,7 +733,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) { bSetProperty = false; } - bOk = ImportFrom(*pMedium); + bOk = ImportFrom( *pMedium, false ); if(bSetProperty) { try @@ -803,7 +798,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) { } - // Falls nicht asynchron geladen wird selbst FinishedLoading aufrufen + // If not loaded asynchronously call FinishedLoading if ( !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) && ( !pMedium->GetFilter() || pMedium->GetFilter()->UsesStorage() ) ) @@ -811,8 +806,6 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if( IsOwnStorageFormat_Impl(*pMed) && pMed->GetFilter() ) { -//???? dv DirEntry aDirEntry( pMed->GetPhysicalName() ); -//???? dv SetFileName( aDirEntry.GetFull() ); } Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) ); @@ -828,71 +821,19 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) && !( pPreviewItem && pPreviewItem->GetValue() ) && !( pHiddenItem && pHiddenItem->GetValue() ) ) { - INetURLObject aUrl( pMedium->GetOrigURL() ); - - if ( aUrl.GetProtocol() == INET_PROT_FILE ) - { - const SfxFilter* pOrgFilter = pMedium->GetOrigFilter(); - Application::AddToRecentDocumentList( - aUrl.GetURLNoPass( INetURLObject::NO_DECODE ), - (pOrgFilter) ? pOrgFilter->GetMimeType() : String() ); - } + AddToRecentlyUsedList(); } } - if ( pMedium->HasStorage_Impl() ) - { - uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() ); - if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater ) - { - uno::Reference<beans::XPropertySet> xStorageProps( pMedium->GetStorage(), uno::UNO_QUERY_THROW ); - ::rtl::OUString sVersion; - try - { - xStorageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion; - } - catch( const uno::Exception& ) - { - // Custom Property "ODFVersion" does not exist - } - - if ( sVersion.getLength() ) - { - double nVersion = sVersion.toDouble(); - if ( nVersion > 1.20001 && SfxObjectShell_Impl::NeedsOfficeUpdateDialog() ) - // ODF version greater than 1.2 - added some decimal places to be safe against floating point conversion errors (hack) - { - ::rtl::OUString sDocumentURL( pMedium->GetOrigURL() ); - ::rtl::OUString aSystemFileURL; - if ( osl::FileBase::getSystemPathFromFileURL( sDocumentURL, aSystemFileURL ) == osl::FileBase::E_None ) - sDocumentURL = aSystemFileURL; - - FutureDocumentVersionProductUpdateRequest aUpdateRequest; - aUpdateRequest.Classification = InteractionClassification_QUERY; - aUpdateRequest.DocumentURL = sDocumentURL; - - ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest = new ::comphelper::OInteractionRequest( makeAny( aUpdateRequest ) ); - pRequest->addContinuation( new ::comphelper::OInteractionApprove ); - pRequest->addContinuation( new ::comphelper::OInteractionAbort ); + const SfxBoolItem* pDdeReconnectItem = static_cast<const SfxBoolItem*>( + SfxRequest::GetItem(pMedium->GetItemSet(), SID_DDE_RECONNECT_ONLOAD, false, TYPE(SfxBoolItem))); - typedef ::comphelper::OInteraction< XInteractionAskLater > OInteractionAskLater; - OInteractionAskLater* pLater = new OInteractionAskLater; - pRequest->addContinuation( pLater ); + bool bReconnectDde = true; // by default, we try to auto-connect DDE connections. + if (pDdeReconnectItem) + bReconnectDde = pDdeReconnectItem->GetValue(); - try - { - xHandler->handle( pRequest.get() ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - if ( pLater->wasSelected() ) - SFX_APP()->Get_Impl()->bODFVersionWarningLater = true; - } - } - } - } + if (bReconnectDde) + ReconnectDdeLinks(*this); } else GetpApp()->HideStatusText(); @@ -913,7 +854,7 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo if( xServiceManager.is() ) { xFilterCFG = com::sun::star::uno::Reference< XNameAccess >( - xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), + xServiceManager->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), UNO_QUERY ); } @@ -928,7 +869,7 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo { sal_Int32 nPropertyCount = aProps.getLength(); for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty ) - if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii("UIComponent")) ) + if( aProps[nProperty].Name.equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent"))) ) { ::rtl::OUString aServiceName; aProps[nProperty].Value >>= aServiceName; @@ -1030,9 +971,9 @@ sal_Bool SfxObjectShell::IsPackageStorageFormat_Impl(const SfxMedium &rMedium) c //------------------------------------------------------------------------- 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 +// DoSave is only invoked for OLE. Save your own documents in the SFX through +// DoSave_Impl order to allow for the creation of backups. +// Save in your own format again. { sal_Bool bOk = sal_False ; { @@ -1105,9 +1046,6 @@ sal_Bool SfxObjectShell::DoSave() bOk = pMedium->Commit(); } -//#88046 -// if ( bOk ) -// SetModified( sal_False ); return bOk; } @@ -1127,18 +1065,17 @@ void Lock_Impl( SfxObjectShell* pDoc, sal_Bool bLock ) sal_Bool SfxObjectShell::SaveTo_Impl ( - SfxMedium &rMedium, // Medium, in das gespeichert werden soll + SfxMedium &rMedium, // Medium, in which it will be stored const SfxItemSet* pSet ) -/* [Beschreibung] +/* [Description] - 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. + Writes the current contents to the medium rMedium. If the target medium is + no storage, then saving to a temporary storage, or directly if the medium + is transacted, if we ourselves have opened it, and if we are a server + either the container a transacted storage provides or created a + temporary storage by one self. */ { @@ -1158,7 +1095,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl { // if no filter was set, use the default filter // this should be changed in the feature, it should be an error! - DBG_ERROR("No filter set!"); + OSL_FAIL("No filter set!"); pFilter = GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT ); rMedium.SetFilter(pFilter); } @@ -1243,7 +1180,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl if ( bCopyTo && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) { - // export to the same location is vorbidden + // export to the same location is forbidden SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } else @@ -1393,7 +1330,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl if ( !xProps.is() ) throw uno::RuntimeException(); - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ), + xProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), uno::makeAny( aDataFlavor.MimeType ) ); } catch( uno::Exception& ) @@ -1441,7 +1378,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl } catch( uno::Exception& ) { - DBG_ERROR( "Setting of common encryption key failed!" ); + OSL_FAIL( "Setting of common encryption key failed!" ); SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } @@ -1491,7 +1428,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl xMedStorage ) ) { // TODO: error handling - OSL_ENSURE( sal_False, "Couldn't store thumbnail representation!" ); + OSL_FAIL( "Couldn't store thumbnail representation!" ); } } @@ -1530,7 +1467,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl catch( uno::Exception& ) { AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Preserve versions has failed." ) ) ); - DBG_ERROR( "Couldn't copy versions!\n" ); + OSL_FAIL( "Couldn't copy versions!\n" ); bOk = sal_False; // TODO/LATER: a specific error could be set } @@ -1691,7 +1628,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl { // it should not happen, the copies signature is invalid! // throw the changes away - OSL_ASSERT( "An invalid signature was copied!" ); + OSL_FAIL( "An invalid signature was copied!" ); } } } @@ -1793,66 +1730,6 @@ sal_Bool SfxObjectShell::SaveTo_Impl catch( Exception& ) { } - -#ifdef OS2 - { -#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer - // Header for a single-valued ASCII EA data item - typedef struct _EA_ASCII_header { - sal_uInt16 usAttr; /* value: EAT_ASCII */ - sal_uInt16 usLen; /* length of data */ - CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */ - } EA_ASCII_HEADER; - char filePath[_MAX_PATH]; - char fileExt[_MAX_PATH]; - char docType[_MAX_PATH]; - int rc; - oslFileError eRet; - ::rtl::OUString aSystemFileURL; - const ::rtl::OUString aFileURL = rMedium.GetName(); - // close medium - rMedium.Close(); - - // convert file URL to system path - if (osl::FileBase::getSystemPathFromFileURL( aFileURL, aSystemFileURL) == osl::FileBase::E_None) { - EA_ASCII_HEADER eaAscii; - struct _ea eaType; - strcpy( filePath, CHAR_POINTER( aSystemFileURL)); - strcpy( docType, CHAR_POINTER( rMedium.GetFilter()->GetServiceName())); -#if OSL_DEBUG_LEVEL>1 - printf( "file name: %s\n", filePath); - printf( "filter name: %s\n", CHAR_POINTER(rMedium.GetFilter()->GetFilterName())); - printf( "service name: %s\n", docType); -#endif - // initialize OS/2 EA data structure - eaAscii.usAttr = EAT_ASCII; - _splitpath ( filePath, NULL, NULL, NULL, fileExt); - if (!stricmp( fileExt, ".pdf")) - strcpy( eaAscii.szType, "Acrobat Document"); - else if (!strcmp( docType, "com.sun.star.text.TextDocument")) - strcpy( eaAscii.szType, "OpenOfficeOrg Writer Document"); - else if (!strcmp( docType, "com.sun.star.sheet.SpreadsheetDocument")) - strcpy( eaAscii.szType, "OpenOfficeOrg Calc Document"); - else if (!strcmp( docType, "com.sun.star.presentation.PresentationDocument")) - strcpy( eaAscii.szType, "OpenOfficeOrg Impress Document"); - else if (!strcmp( docType, "com.sun.star.drawing.DrawingDocument")) - strcpy( eaAscii.szType, "OpenOfficeOrg Draw Document"); - else - strcpy( eaAscii.szType, "OpenOfficeOrg Document"); - eaAscii.usLen = strlen( eaAscii.szType); - // fill libc EA data structure - eaType.flags = 0; - eaType.size = sizeof(sal_uInt16)*2 + eaAscii.usLen; - eaType.value = &eaAscii; - // put EA to file - rc = _ea_put( &eaType, filePath, 0, ".TYPE"); -#if OSL_DEBUG_LEVEL>1 - printf( "ea name: %s, rc %d, errno %d\n", eaAscii.szType, rc, errno); -#endif - } - } -#endif - } return bOk; @@ -1913,14 +1790,12 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( const uno::Reference< embed::XStorage >& xStorage, SfxMedium* pMediumArg ) -/* [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. +/* [Description] - */ + If the application operates on a temporary storage, then it may not take + the temporary storage from the SaveCompleted. Therefore the new storage + is connected already here in this case and SaveCompleted then does nothing. +*/ { RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxObjectShell::ConnectTmpStorage_Impl" ); @@ -1957,7 +1832,6 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( // TODO/LATER: may be it should be done in SwitchPersistence also // TODO/LATER: find faster way to copy storage; perhaps sharing with backup?! xStorage->copyToStorage( xTmpStorage ); - //CopyStoragesOfUnknownMediaType( xStorage, xTmpStorage ); bResult = SaveCompleted( xTmpStorage ); if ( bResult ) @@ -2013,7 +1887,7 @@ sal_Bool SfxObjectShell::DoSaveObjectAs( SfxMedium& rMedium, sal_Bool bCommit ) ::rtl::OUString aMediaType; if ( !(a>>=aMediaType) || !aMediaType.getLength() ) { - OSL_ENSURE( sal_False, "The mediatype must be set already!\n" ); + OSL_FAIL( "The mediatype must be set already!\n" ); SetupStorage( xNewStor, SOFFICE_FILEFORMAT_CURRENT, sal_False ); } @@ -2028,7 +1902,7 @@ sal_Bool SfxObjectShell::DoSaveObjectAs( SfxMedium& rMedium, sal_Bool bCommit ) } catch( uno::Exception& ) { - DBG_ERROR( "The strotage was not commited on DoSaveAs!\n" ); + OSL_FAIL( "The strotage was not commited on DoSaveAs!\n" ); } } } @@ -2041,7 +1915,7 @@ sal_Bool SfxObjectShell::DoSaveObjectAs( SfxMedium& rMedium, sal_Bool bCommit ) // TODO/LATER: may be the call must be removed completelly sal_Bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium ) { - // hier kommen nur Root-Storages rein, die via Temp-File gespeichert werden + // here only root storages are included, which are stored via temp file rMedium.CreateTempFileNoCopy(); SetError(rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if ( GetError() ) @@ -2065,11 +1939,7 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) sal_Bool bOk = sal_True; sal_Bool bMedChanged = pNewMed && pNewMed!=pMedium; -/* sal_Bool bCreatedTempStor = pNewMed && pMedium && - IsPackageStorageFormat_Impl(*pMedium) && - !IsPackageStorageFormat_Impl(*pNewMed) && - pMedium->GetName().Len(); -*/ + DBG_ASSERT( !pNewMed || pNewMed->GetError() == ERRCODE_NONE, "DoSaveCompleted: Medium has error!" ); // delete Medium (and Storage!) after all notifications @@ -2110,7 +1980,8 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } catch( uno::Exception& ) { // the storage is disposed already - // can happen during reload scenario when the medium has disposed it during the closing + // can happen during reload scenario when the medium has + // disposed it during the closing // will be fixed in one of the next milestones } } @@ -2154,7 +2025,7 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) else bOk = SaveCompleted( NULL ); } - // entweder Save oder ConvertTo + // either Save or ConvertTo else bOk = SaveCompleted( NULL ); } @@ -2188,14 +2059,15 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) // TODO/LATER: in future the medium must control own signature state, not the document pNewMed->SetCachedSignatureState_Impl( SIGNATURESTATE_NOSIGNATURES ); // set the default value back - // Titel neu setzen + // Set new title if ( pNewMed->GetName().Len() && SFX_CREATE_MODE_EMBEDDED != eCreateMode ) InvalidateName(); - SetModified(sal_False); // nur bei gesetztem Medium zur"ucksetzen + SetModified(sal_False); // reset only by set medium Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); - // this is the end of the saving process, it is possible that the file was changed - // between medium commit and this step ( attributes change and so on ) + // this is the end of the saving process, it is possible that + // the file was changed + // between medium commit and this step (attributes change and so on) // so get the file date again if ( pNewMed->DocNeedsFileDateCheck() ) pNewMed->GetInitFileDate( sal_True ); @@ -2205,42 +2077,54 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) pMedium->ClearBackup_Impl(); pMedium->LockOrigFileOnDemand( sal_True, sal_False ); + AddToRecentlyUsedList(); + return bOk; } +void SfxObjectShell::AddToRecentlyUsedList() +{ + INetURLObject aUrl( pMedium->GetOrigURL() ); + + if ( aUrl.GetProtocol() == INET_PROT_FILE ) + { + const SfxFilter* pOrgFilter = pMedium->GetOrigFilter(); + Application::AddToRecentDocumentList( aUrl.GetURLNoPass( INetURLObject::NO_DECODE ), + (pOrgFilter) ? pOrgFilter->GetMimeType() : String() ); + } +} + //------------------------------------------------------------------------- sal_Bool SfxObjectShell::ConvertFrom ( - SfxMedium& /*rMedium*/ /* <SfxMedium>, welches die Quell-Datei beschreibt - (z.B. Dateiname, <SfxFilter>, Open-Modi etc.) */ + SfxMedium& /*rMedium*/ /* <SfxMedium>, which describes the source file + (for example file name, <SfxFilter>, + Open-Modi and so on) */ ) -/* [Beschreibung] +/* [Description] - 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. + This method is called for loading of documents over all filters which are + not SFX_FILTER_OWN or for which no clipboard format has been registered + (thus no storage format that is used). In other words, whith this method + it is imported. - 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. + Files which are to be opened here should be opened through 'rMedium' + to guarantee the right open modes. Especially if the format is retained + (only possible with SFX_FILTER_SIMULATE or SFX_FILTER_ONW) file which must + be opened STREAM_SHARE_DENYWRITE. - - [R"uckgabewert] + [Return value] sal_Bool sal_True - Das Dokument konnte geladen werden. + The document could be loaded. sal_False - Das Dokument konnte nicht geladen werden, ein - Fehlercode ist mit <SvMedium::GetError()const> zu - erhalten. - + The document could not be loaded, an error code + received through <SvMedium::GetError()const> - [Beispiel] + [Example] sal_Bool DocSh::ConvertFrom( SfxMedium &rMedium ) { @@ -2250,15 +2134,14 @@ sal_Bool SfxObjectShell::ConvertFrom xStream->SetBufferSize(4096); *xStream >> ...; - // NICHT 'rMedium.CloseInStream()' rufen! File gelockt halten! + // Do not call 'rMedium.CloseInStream()'! Keep File locked! return SVSTREAM_OK == rMedium.GetError(); } return sal_False; } - - [Querverweise] + [Cross-references] <SfxObjectShell::ConvertTo(SfxMedium&)> <SFX_FILTER_REGISTRATION> @@ -2267,7 +2150,7 @@ sal_Bool SfxObjectShell::ConvertFrom return sal_False; } -sal_Bool SfxObjectShell::InsertFrom( SfxMedium& rMedium ) +sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert ) { ::rtl::OUString aTypeName( rMedium.GetFilter()->GetTypeName() ); ::rtl::OUString aFilterName( rMedium.GetFilter()->GetFilterName() ); @@ -2307,7 +2190,7 @@ sal_Bool SfxObjectShell::InsertFrom( SfxMedium& rMedium ) } if ( xLoader.is() ) { - // #131744#: it happens that xLoader does not support xImporter! + // it happens that xLoader does not support xImporter! try{ uno::Reference< lang::XComponent > xComp( GetModel(), uno::UNO_QUERY_THROW ); uno::Reference< document::XImporter > xImporter( xLoader, uno::UNO_QUERY_THROW ); @@ -2350,99 +2233,10 @@ sal_Bool SfxObjectShell::InsertFrom( SfxMedium& rMedium ) aArgs[nEnd-1].Value <<= rMedium.GetBaseURL(); } - aArgs.realloc( ++nEnd ); - aArgs[nEnd-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "InsertMode" ) ); - aArgs[nEnd-1].Value <<= (sal_Bool) sal_True; - - return xLoader->filter( aArgs ); - }catch(const uno::Exception&) - {} - } - - return sal_False; -} - -sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium ) -{ - ::rtl::OUString aTypeName( rMedium.GetFilter()->GetTypeName() ); - ::rtl::OUString aFilterName( rMedium.GetFilter()->GetFilterName() ); - - uno::Reference< lang::XMultiServiceFactory > xMan = ::comphelper::getProcessServiceFactory(); - uno::Reference < lang::XMultiServiceFactory > xFilterFact ( - xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY ); - - uno::Sequence < beans::PropertyValue > aProps; - uno::Reference < container::XNameAccess > xFilters ( xFilterFact, uno::UNO_QUERY ); - if ( xFilters->hasByName( aFilterName ) ) - { - xFilters->getByName( aFilterName ) >>= aProps; - rMedium.GetItemSet()->Put( SfxStringItem( SID_FILTER_NAME, aFilterName ) ); - } - - ::rtl::OUString aFilterImplName; - sal_Int32 nFilterProps = aProps.getLength(); - for ( sal_Int32 nFilterProp = 0; nFilterProp<nFilterProps; nFilterProp++ ) - { - const beans::PropertyValue& rFilterProp = aProps[nFilterProp]; - if ( rFilterProp.Name.compareToAscii("FilterService") == COMPARE_EQUAL ) - { - rFilterProp.Value >>= aFilterImplName; - break; - } - } - - uno::Reference< document::XFilter > xLoader; - if ( aFilterImplName.getLength() ) - { - try{ - xLoader = uno::Reference< document::XFilter > - ( xFilterFact->createInstanceWithArguments( aFilterName, uno::Sequence < uno::Any >() ), uno::UNO_QUERY ); - }catch(const uno::Exception&) - { xLoader.clear(); } - } - if ( xLoader.is() ) - { - // #131744#: it happens that xLoader does not support xImporter! - try{ - uno::Reference< lang::XComponent > xComp( GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< document::XImporter > xImporter( xLoader, uno::UNO_QUERY_THROW ); - xImporter->setTargetDocument( xComp ); - - uno::Sequence < beans::PropertyValue > lDescriptor; - rMedium.GetItemSet()->Put( SfxStringItem( SID_FILE_NAME, rMedium.GetName() ) ); - TransformItems( SID_OPENDOC, *rMedium.GetItemSet(), lDescriptor ); - - com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aArgs ( lDescriptor.getLength() ); - com::sun::star::beans::PropertyValue * pNewValue = aArgs.getArray(); - const com::sun::star::beans::PropertyValue * pOldValue = lDescriptor.getConstArray(); - const OUString sInputStream ( RTL_CONSTASCII_USTRINGPARAM ( "InputStream" ) ); - - sal_Bool bHasInputStream = sal_False; - sal_Bool bHasBaseURL = sal_False; - sal_Int32 i; - sal_Int32 nEnd = lDescriptor.getLength(); - - for ( i = 0; i < nEnd; i++ ) - { - pNewValue[i] = pOldValue[i]; - if ( pOldValue [i].Name == sInputStream ) - bHasInputStream = sal_True; - else if ( pOldValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "DocumentBaseURL" ) ) ) - bHasBaseURL = sal_True; - } - - if ( !bHasInputStream ) - { - aArgs.realloc ( ++nEnd ); - aArgs[nEnd-1].Name = sInputStream; - aArgs[nEnd-1].Value <<= com::sun::star::uno::Reference < com::sun::star::io::XInputStream > ( new utl::OSeekableInputStreamWrapper ( *rMedium.GetInStream() ) ); - } - - if ( !bHasBaseURL ) - { - aArgs.realloc ( ++nEnd ); - aArgs[nEnd-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "DocumentBaseURL" ) ); - aArgs[nEnd-1].Value <<= rMedium.GetBaseURL(); + if ( bInsert ) { + aArgs.realloc( ++nEnd ); + aArgs[nEnd-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "InsertMode" ) ); + aArgs[nEnd-1].Value <<= (sal_Bool) sal_True; } return xLoader->filter( aArgs ); @@ -2562,36 +2356,34 @@ sal_Bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) sal_Bool SfxObjectShell::ConvertTo ( - SfxMedium& /*rMedium*/ /* <SfxMedium>, welches die Ziel-Datei beschreibt - (z.B. Dateiname, <SfxFilter>, Open-Modi etc.) */ + SfxMedium& /*rMedium*/ /* <SfxMedium>, which describes the target file + (for example file name, <SfxFilter>, + Open-Modi and so on) */ ) -/* [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. +/* [Description] - 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. + This method is called for saving of documents over all filters which are + not SFX_FILTER_OWN or for which no clipboard format has been registered + (thus no storage format that is used). In other words, with this method + it is exported. + Files which are to be opened here should be opened through 'rMedium' + to guarantee the right open modes. Especially if the format is retained + (only possible with SFX_FILTER_SIMULATE or SFX_FILTER_ONW) file which must + be opened STREAM_SHARE_DENYWRITE. - [R"uckgabewert] + [Return value] sal_Bool sal_True - Das Dokument konnte gespeichert werden. + The document could be saved. sal_False - Das Dokument konnte nicht gespeichert werden, ein - Fehlercode ist mit <SvMedium::GetError()const> zu - erhalten. + The document could not be saved, an error code is + received by <SvMedium::GetError()const> - [Beispiel] + [Example] sal_Bool DocSh::ConvertTo( SfxMedium &rMedium ) { @@ -2601,14 +2393,13 @@ sal_Bool SfxObjectShell::ConvertTo xStream->SetBufferSize(4096); *xStream << ...; - rMedium.CloseOutStream(); // "offnet automatisch wieder den InStream + rMedium.CloseOutStream(); // opens the InStream automatically return SVSTREAM_OK == rMedium.GetError(); } return sal_False ; } - - [Querverweise] + [Cross-references] <SfxObjectShell::ConvertFrom(SfxMedium&)> <SFX_FILTER_REGISTRATION> @@ -2631,11 +2422,11 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) pSet->ClearItem( SID_VERSION ); pSet->ClearItem( SID_DOC_BASEURL ); - // create a medium as a copy; this medium is only for writingm, because it uses the same name as the original one - // writing is done through a copy, that will be transferred to the target ( of course after calling HandsOff ) + // create a medium as a copy; this medium is only for writingm, because it + // uses the same name as the original one writing is done through a copy, + // that will be transferred to the target (of course after calling HandsOff) SfxMedium* pMediumTmp = new SfxMedium( pRetrMedium->GetName(), pRetrMedium->GetOpenMode(), pRetrMedium->IsDirect(), pFilter, pSet ); pMediumTmp->SetLongName( pRetrMedium->GetLongName() ); -// pMediumTmp->CreateTempFileNoCopy(); if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE ) { SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); @@ -2645,10 +2436,6 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // copy version list from "old" medium to target medium, so it can be used on saving pMediumTmp->TransferVersionList_Impl( *pRetrMedium ); -/* - if ( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PACKED ) ) - SetError( GetMedium()->Unpack_Impl( pRetrMedium->GetPhysicalName() ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); -*/ // an interaction handler here can aquire only in case of GUI Saving // and should be removed after the saving is done @@ -2672,7 +2459,9 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) sal_Bool bOpen( sal_False ); bOpen = DoSaveCompleted( pMediumTmp ); - DBG_ASSERT(bOpen,"Fehlerbehandlung fuer DoSaveCompleted nicht implementiert"); + + DBG_ASSERT(bOpen,"Error handling for DoSaveCompleted not implemented"); + (void)bOpen; } else { @@ -2753,7 +2542,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl if ( aURL != INetURLObject( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ) ) ) { - // gibt es schon ein Doc mit dem Namen? + // Is there already a Document with this name? SfxObjectShell* pDoc = 0; for ( SfxObjectShell* pTmp = SfxObjectShell::GetFirst(); pTmp && !pDoc; @@ -2768,14 +2557,14 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl } if ( pDoc ) { - // dann Fehlermeldeung: "schon offen" + // Then error message: "already opened" SetError(ERRCODE_SFX_ALREADYOPEN, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )); return sal_False; } } DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL!" ); - DBG_ASSERT( aParams->Count() != 0, "fehlerhafte Parameter"); + DBG_ASSERT( aParams->Count() != 0, "Incorrect Parameter"); SFX_ITEMSET_ARG( aParams, pSaveToItem, SfxBoolItem, SID_SAVETO, sal_False ); sal_Bool bSaveTo = pSaveToItem ? pSaveToItem->GetValue() : sal_False; @@ -2804,16 +2593,13 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl sal_Bool bWasReadonly = IsReadOnly(); - if ( aURL == aActName && aURL != INetURLObject( OUString::createFromAscii( "private:stream" ) ) + if ( aURL == aActName && aURL != INetURLObject( OUString(RTL_CONSTASCII_USTRINGPARAM("private:stream")) ) && IsReadOnly() ) { SetError(ERRCODE_SFX_DOCUMENTREADONLY, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )); return sal_False; } - // this notification should be already sent by caller in sfxbasemodel - // SFX_APP()->NotifyEvent(SfxEventHint( bSaveTo? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC,this)); - if( SFX_ITEM_SET != aParams->GetItemState(SID_UNPACK) && SvtSaveOptions().IsSaveUnpacked() ) aParams->Put( SfxBoolItem( SID_UNPACK, sal_False ) ); @@ -2825,7 +2611,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl { pImp->bWaitingForPicklist = sal_True; - // Daten am Medium updaten + // Update Data on media SfxItemSet *pSet = GetMedium()->GetItemSet(); pSet->ClearItem( SID_INTERACTIONHANDLER ); pSet->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); @@ -2842,7 +2628,6 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl pSet->ClearItem( SID_CHARSET ); pSet->ClearItem( SID_FILTER_NAME ); pSet->ClearItem( SID_OPTIONS ); - //pSet->ClearItem( SID_FILE_FILTEROPTIONS ); pSet->ClearItem( SID_VERSION ); pSet->ClearItem( SID_EDITDOC ); pSet->ClearItem( SID_OVERWRITE ); @@ -2917,11 +2702,10 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl // all values present in both itemsets will be overwritten by the new parameters if( pParams ) pMergedParams->Put( *pParams ); - //DELETEZ( pParams ); #ifdef DBG_UTIL if ( pMergedParams->GetItemState( SID_DOC_SALVAGE) >= SFX_ITEM_SET ) - DBG_ERROR("Salvage item present in Itemset, check the parameters!"); + OSL_FAIL("Salvage item present in Itemset, check the parameters!"); #endif // should be unneccessary - too hot to handle! @@ -2958,13 +2742,6 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl if ( pImp->bPreserveVersions ) pNewFile->TransferVersionList_Impl( *pMedium ); -/* - if ( GetMedium()->GetFilter() && ( GetMedium()->GetFilter()->GetFilterFlags() & SFX_FILTER_PACKED ) ) - { - SfxMedium *pMed = bCopyTo ? pMedium : pNewFile; - pNewFile->SetError( GetMedium()->Unpack_Impl( pMed->GetPhysicalName() ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - } -*/ // Save the document ( first as temporary file, then transfer to the target URL by committing the medium ) sal_Bool bOk = sal_False; if ( !pNewFile->GetErrorCode() && SaveTo_Impl( *pNewFile, NULL ) ) @@ -3001,6 +2778,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl sal_Bool bRet( sal_False ); bRet = DoSaveCompleted( pMedium ); DBG_ASSERT( bRet, "Error in DoSaveCompleted, can't be handled!"); + (void)bRet; } // TODO/LATER: disconnect the new file from the storage for the case when pure saving is done @@ -3031,7 +2809,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl sal_Bool SfxObjectShell::LoadFrom( SfxMedium& /*rMedium*/ ) { - DBG_ERROR( "Base implementation, must not be called in general!" ); + OSL_FAIL( "Base implementation, must not be called in general!" ); return sal_True; } @@ -3043,9 +2821,9 @@ sal_Bool SfxObjectShell::IsInformationLost() ::rtl::OUString aPreusedFilterName; for ( sal_Int32 nInd = 0; nInd < aProps.getLength(); nInd++ ) { - if ( aProps[nInd].Name.equalsAscii( "FilterName" ) ) + if ( aProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) ) aProps[nInd].Value >>= aFilterName; - else if ( aProps[nInd].Name.equalsAscii( "PreusedFilterName" ) ) + else if ( aProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreusedFilterName" ) ) ) aProps[nInd].Value >>= aPreusedFilterName; } @@ -3064,11 +2842,10 @@ sal_Bool SfxObjectShell::IsInformationLost() //------------------------------------------------------------------------- sal_Bool SfxObjectShell::CanReload_Impl() -/* [Beschreibung] +/* [Description] - Interne Methode zum Feststellen, ob eine erneutes Laden des - Dokuments (auch als RevertToSaved oder LastVersion bekannt) - m"oglich ist. + Internal method for determining whether a reload of the document + (as RevertToSaved or last known version) is possible. */ { @@ -3398,7 +3175,8 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& { if ( xStorage.is() && pImp->m_xDocStorage != xStorage ) { - // make sure that until the storage is assigned the object container is not created by accident! + // make sure that until the storage is assigned the object + // container is not created by accident! DBG_ASSERT( bHasContainer == (pImp->mpObjectContainer != 0), "Wrong storage in object container!" ); xOldStorageHolder = pImp->m_xDocStorage; pImp->m_xDocStorage = xStorage; @@ -3512,7 +3290,7 @@ sal_Bool StoragesOfUnknownMediaTypeAreCopied_Impl( const uno::Reference< embed:: } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Cant check storage consistency!\n" ); + OSL_FAIL( "Cant check storage consistency!\n" ); } return sal_True; @@ -3645,7 +3423,7 @@ sal_Bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< e default: { OSL_ENSURE( - aSubElements[nInd].equalsAscii( "Configurations2" ) || !xTarget->hasByName( aSubElements[nInd] ), + aSubElements[nInd].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Configurations2" ) ) || !xTarget->hasByName( aSubElements[nInd] ), "The target storage is an output storage, the element should not exist in the target!\n" ); if ( !xTarget->hasByName( aSubElements[nInd] ) ) @@ -3678,12 +3456,12 @@ sal_Bool SfxObjectShell::GenerateAndStoreThumbnail( sal_Bool bEncrypted, try { uno::Reference< embed::XStorage > xThumbnailStor = - xStor->openStorageElement( ::rtl::OUString::createFromAscii( "Thumbnails" ), + xStor->openStorageElement( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Thumbnails")), embed::ElementModes::READWRITE ); if ( xThumbnailStor.is() ) { uno::Reference< io::XStream > xStream = xThumbnailStor->openStreamElement( - ::rtl::OUString::createFromAscii( "thumbnail.png" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("thumbnail.png")), embed::ElementModes::READWRITE ); if ( xStream.is() && WriteThumbnail( bEncrypted, bSigned, bIsTemplate, xStream ) ) @@ -3714,6 +3492,10 @@ sal_Bool SfxObjectShell::WriteThumbnail( sal_Bool bEncrypted, uno::Reference< io::XTruncate > xTruncate( xStream->getOutputStream(), uno::UNO_QUERY_THROW ); xTruncate->truncate(); + uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY ); + if ( xSet.is() ) + xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), + uno::makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")) ) ); if ( bEncrypted ) { sal_uInt16 nResID = GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( @@ -3756,6 +3538,22 @@ void SfxObjectShell::UpdateLinks() { } +void SfxObjectShell::CheckConfigOptions() +{ + // not handled. Each app's shell needs to overwrite this method to add handler. + SetConfigOptionsChecked(true); +} + +sal_Bool SfxObjectShell::IsConfigOptionsChecked() const +{ + return pImp->m_bConfigOptionsChecked; +} + +void SfxObjectShell::SetConfigOptionsChecked( sal_Bool bChecked ) +{ + pImp->m_bConfigOptionsChecked = bChecked; +} + sal_Bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< task::XInteractionHandler >& xHandler ) { if ( !HasBasic() ) @@ -3785,3 +3583,5 @@ uno::Reference< task::XInteractionHandler > SfxObjectShell::getInteractionHandle xRet = GetMedium()->GetInteractionHandler(); return xRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx index 8573c4afc0f4..cd14844a73d7 100644 --- a/sfx2/source/doc/objuno.cxx +++ b/sfx2/source/doc/objuno.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,6 +46,7 @@ #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XCompatWriterDocProperties.hpp> #include <unotools/configmgr.hxx> #include <tools/inetdef.hxx> @@ -53,7 +55,7 @@ #include <osl/mutex.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/errcode.hxx> #include <svl/cntwids.hrc> @@ -104,6 +106,9 @@ const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap() { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, @@ -200,7 +205,7 @@ void Copy( const uno::Reference < document::XStandaloneDocumentInfo >& rSource, // it is possible that the propertysets from XML and binary files differ; we shouldn't break then xTarget->setPropertyValue( pProps[i].Name, aValue ); } - catch ( uno::Exception& ) {} + catch ( const uno::Exception& ) {} } sal_Int16 nCount = rSource->getUserFieldCount(); @@ -213,7 +218,7 @@ void Copy( const uno::Reference < document::XStandaloneDocumentInfo >& rSource, rTarget->setUserFieldValue( nInd, aPropVal ); } } - catch ( uno::Exception& ) {} + catch ( const uno::Exception& ) {} } class MixedPropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo > @@ -389,16 +394,16 @@ void SfxDocumentInfoObject_Impl::Reset(uno::Reference<document::XDocumentPropert : sName + ::rtl::OUString::valueOf(i+1); while (std::find(names.begin(), names.end(), name) != names.end()) { - name += ::rtl::OUString::createFromAscii("'"); + name += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); } // FIXME there is a race condition here try { xPropContainer->addProperty(name, beans::PropertyAttribute::REMOVEABLE, - uno::makeAny(::rtl::OUString::createFromAscii(""))); - } catch (uno::RuntimeException) { + uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")))); + } catch (const uno::RuntimeException&) { throw; - } catch (uno::Exception) { + } catch (const uno::Exception&) { // ignore } } @@ -438,14 +443,14 @@ SfxDocumentInfoObject::initialize(const uno::Sequence< uno::Any > & aArguments) uno::Any any = aArguments[0]; uno::Reference<document::XDocumentProperties> xDoc; if (!(any >>= xDoc) || !xDoc.is()) throw lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "SfxDocumentInfoObject::initialize: no XDocumentProperties given"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentInfoObject::initialize: no XDocumentProperties given")), *this, 0); _pImp->Reset(xDoc); } else { throw lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( - "SfxDocumentInfoObject::initialize: no argument given"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxDocumentInfoObject::initialize: no argument given")), *this, 0); } } @@ -740,24 +745,6 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co break; case WID_FROM : { - // QUESTION: do we still need this? - /* - // String aStrVal( sTemp ); - if ( aStrVal.Len() > TIMESTAMP_MAXLENGTH ) - { - SvAddressParser aParser( aStrVal ); - if ( aParser.Count() > 0 ) - { - String aEmail = aParser.GetEmailAddress(0); - String aRealname = aParser.GetRealName(0); - - if ( aRealname.Len() <= TIMESTAMP_MAXLENGTH ) - aStrVal = aRealname; - else if ( aEmail.Len() <= TIMESTAMP_MAXLENGTH ) - aStrVal = aEmail; - } - } */ - if ( _pImp->m_xDocProps->getAuthor() != sTemp ) _pImp->m_xDocProps->setAuthor(sTemp); break; @@ -806,7 +793,22 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co if ( _pImp->m_xDocProps->getDefaultTarget() != sTemp ) _pImp->m_xDocProps->setDefaultTarget(sTemp); break; -// case WID_CONTENT_TYPE : // this is readonly! + case MID_CATEGORY: + case MID_MANAGER: + case MID_COMPANY: + { + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY ); + if ( xWriterProps.is() ) + { + if ( nHandle == MID_CATEGORY ) + xWriterProps->setCategory( sTemp ); + else if ( nHandle == MID_MANAGER ) + xWriterProps->setManager( sTemp ); + else + xWriterProps->setCompany( sTemp ); + break; + } + } default: break; } @@ -867,7 +869,7 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co _pImp->m_xDocProps->setAutoloadSecs(60); // default } else if ( !bBoolVal && (0 != _pImp->m_xDocProps->getAutoloadSecs()) ) { _pImp->m_xDocProps->setAutoloadSecs(0); - _pImp->m_xDocProps->setAutoloadURL(::rtl::OUString::createFromAscii("")); + _pImp->m_xDocProps->setAutoloadURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(""))); } break; default: @@ -1007,7 +1009,7 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co case MID_DOCINFO_AUTOLOADENABLED: aValue <<= static_cast<sal_Bool> ( (_pImp->m_xDocProps->getAutoloadSecs() != 0) - || !(_pImp->m_xDocProps->getAutoloadURL().equalsAscii(""))); + || _pImp->m_xDocProps->getAutoloadURL().getLength()); break; case MID_DOCINFO_AUTOLOADURL: aValue <<= _pImp->m_xDocProps->getAutoloadURL(); @@ -1024,6 +1026,23 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co case MID_DOCINFO_CHARLOCALE: aValue <<= _pImp->m_xDocProps->getLanguage(); break; + case MID_CATEGORY: + case MID_MANAGER: + case MID_COMPANY: + { + uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY ); + if ( xWriterProps.is() ) + { + if ( nHandle == MID_CATEGORY ) + aValue <<= xWriterProps->getCategory(); + else if ( nHandle == MID_MANAGER ) + aValue <<= xWriterProps->getManager(); + else + aValue <<= xWriterProps->getCompany(); + break; + } + } + default: aValue <<= ::rtl::OUString(); break; @@ -1036,9 +1055,6 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co sal_Int16 SAL_CALL SfxDocumentInfoObject::getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException ) { -// uno::Reference<beans::XPropertyAccess> xPropSet( -// _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); -// return xPropSet->getPropertyValues().getLength(); return FOUR; } @@ -1066,9 +1082,9 @@ sal_Int16 SAL_CALL SfxDocumentInfoObject::getUserFieldCount() throw( ::com::sun try { xPropSet->getPropertyValue(name) >>= val; return val; - } catch (uno::RuntimeException &) { + } catch (const uno::RuntimeException &) { throw; - } catch (uno::Exception &) { + } catch (const uno::Exception &) { return ::rtl::OUString(); // ignore } } else @@ -1099,26 +1115,26 @@ void SAL_CALL SfxDocumentInfoObject::setUserFieldName(sal_Int16 nIndex, const : xPropContainer->addProperty(aName, beans::PropertyAttribute::REMOVEABLE, value); _pImp->m_UserDefined[nIndex] = aName; - } catch (beans::UnknownPropertyException) { + } catch (const beans::UnknownPropertyException&) { try { xPropContainer->addProperty(aName, beans::PropertyAttribute::REMOVEABLE, - uno::makeAny(::rtl::OUString::createFromAscii(""))); + uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")))); _pImp->m_UserDefined[nIndex] = aName; - } catch (beans::PropertyExistException) { + } catch (const beans::PropertyExistException&) { _pImp->m_UserDefined[nIndex] = aName; // ignore } - } catch (beans::PropertyExistException) { + } catch (const beans::PropertyExistException&) { try { xPropContainer->addProperty(name, beans::PropertyAttribute::REMOVEABLE, value); - } catch (beans::PropertyExistException) { + } catch (const beans::PropertyExistException&) { // bugger... } - } catch (uno::RuntimeException &) { + } catch (const uno::RuntimeException &) { throw; - } catch (uno::Exception &) { + } catch (const uno::Exception &) { // ignore everything else; xPropSet _may_ be corrupted } } @@ -1146,19 +1162,19 @@ void SAL_CALL SfxDocumentInfoObject::setUserFieldValue( sal_Int16 nIndex, const if (value != aAny) { xPropSet->setPropertyValue(name, aAny); } - } catch (beans::UnknownPropertyException) { + } catch (const beans::UnknownPropertyException&) { try { // someone removed it, add it back again xPropContainer->addProperty(name, beans::PropertyAttribute::REMOVEABLE, aAny); - } catch (uno::RuntimeException &) { + } catch (const uno::RuntimeException &) { throw; - } catch (uno::Exception &) { + } catch (const uno::Exception &) { // ignore everything else } - } catch (uno::RuntimeException &) { + } catch (const uno::RuntimeException &) { throw; - } catch (uno::Exception &) { + } catch (const uno::Exception &) { // ignore everything else } } @@ -1181,7 +1197,6 @@ SfxStandaloneDocumentInfoObject::SfxStandaloneDocumentInfoObject( const ::com::s uno::Reference< lang::XInitialization > xDocProps( _xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentProperties"))), uno::UNO_QUERY_THROW); -// xDocProps->initialize(uno::Sequence<uno::Any>()); uno::Any a; a <<= xDocProps; uno::Sequence<uno::Any> args(1); @@ -1203,7 +1218,7 @@ uno::Reference< embed::XStorage > GetStorage_Impl( const ::rtl::OUString& rName, // Client code checks the returned reference but is not interested on error details. try { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; return ::comphelper::OStorageHelper::GetStorageFromURL( rName, bWrite ? embed::ElementModes::READWRITE : embed::ElementModes::READ, @@ -1261,8 +1276,6 @@ void SAL_CALL SfxStandaloneDocumentInfoObject::loadFromURL(const ::rtl::OUStrin uno::Reference< document::XDocumentProperties > xDocProps( _xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentProperties"))), uno::UNO_QUERY_THROW); -// uno::Reference< lang::XInitialization > xInit(xDocProps, uno::UNO_QUERY_THROW); -// xInit->initialize(uno::Sequence<uno::Any>()); _pImp->Reset(xDocProps); aGuard.clear(); @@ -1272,15 +1285,15 @@ void SAL_CALL SfxStandaloneDocumentInfoObject::loadFromURL(const ::rtl::OUStrin try { uno::Sequence<beans::PropertyValue> medium(2); - medium[0].Name = ::rtl::OUString::createFromAscii("DocumentBaseURL"); + medium[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentBaseURL")); medium[0].Value <<= aURL; - medium[1].Name = ::rtl::OUString::createFromAscii("URL"); + medium[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); medium[1].Value <<= aURL; _pImp->m_xDocProps->loadFromStorage(xStorage, medium); _pImp->Reset(_pImp->m_xDocProps); bOK = sal_True; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -1312,23 +1325,23 @@ void SAL_CALL SfxStandaloneDocumentInfoObject::storeIntoURL(const ::rtl::OUStri try { uno::Sequence<beans::PropertyValue> medium(2); - medium[0].Name = ::rtl::OUString::createFromAscii("DocumentBaseURL"); + medium[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentBaseURL")); medium[0].Value <<= aURL; - medium[1].Name = ::rtl::OUString::createFromAscii("URL"); + medium[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); medium[1].Value <<= aURL; _pImp->m_xDocProps->storeToStorage(xStorage, medium); bOK = sal_True; } - catch( io::IOException & ) + catch( const io::IOException & ) { throw; } - catch( uno::RuntimeException& ) + catch( const uno::RuntimeException& ) { throw; } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -1348,3 +1361,4 @@ void SAL_CALL SfxStandaloneDocumentInfoObject::storeIntoURL(const ::rtl::OUStri throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_CANTWRITE ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 19169e90b984..afa666c168f2 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XTitle.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/resary.hxx> #include <vcl/msgbox.hxx> @@ -156,9 +157,6 @@ static VBAConstantNameMap s_aRegisteredVBAConstants; //========================================================================= - -//========================================================================= - class SfxModelListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener > { SfxObjectShell* mpDoc; @@ -178,15 +176,14 @@ void SAL_CALL SfxModelListener_Impl::queryClosing( const com::sun::star::lang::E void SAL_CALL SfxModelListener_Impl::notifyClosing( const com::sun::star::lang::EventObject& ) throw ( com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; mpDoc->Broadcast( SfxSimpleHint(SFX_HINT_DEINITIALIZING) ); } void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::EventObject& _rEvent ) throw ( com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - // am I ThisComponent in AppBasic? + SolarMutexGuard aSolarGuard; if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source ) { // remove ThisComponent reference from AppBasic @@ -207,8 +204,13 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even } } - if ( !mpDoc->Get_Impl()->bClosing ) - // GCC stuerzt ab, wenn schon im dtor, also vorher Flag abfragen + if ( mpDoc->Get_Impl()->bHiddenLockedByAPI ) + { + mpDoc->Get_Impl()->bHiddenLockedByAPI = sal_False; + mpDoc->OwnerLock(sal_False); + } + else if ( !mpDoc->Get_Impl()->bClosing ) + // GCC crashes when already in the destructor, so first query the Flag mpDoc->DoClose(); } @@ -255,6 +257,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bSaveVersionOnClose( sal_False ) ,m_bSharedXMLFlag( sal_False ) ,m_bAllowShareControlFileClean( sal_True ) + ,m_bConfigOptionsChecked( sal_False ) ,lErr(ERRCODE_NONE) ,nEventId ( 0) ,pReloadTimer ( 0) @@ -319,30 +322,28 @@ SfxObjectShell::SfxObjectShell( const sal_uInt64 i_nCreationFlags ) SfxObjectShell::SfxObjectShell ( - SfxObjectCreateMode eMode /* Zweck, zu dem die SfxObjectShell - erzeugt wird: + SfxObjectCreateMode eMode /* Purpose, io which the SfxObjectShell + is created: SFX_CREATE_MODE_EMBEDDED (default) - als SO-Server aus einem anderen - Dokument heraus + as SO-Server from within another + Document SFX_CREATE_MODE_STANDARD, - als normales, selbst"aendig ge"offnetes - Dokument + as a normal Document open stand-alone SFX_CREATE_MODE_PREVIEW - um ein Preview durchzuf"uhren, - ggf. werden weniger Daten ben"otigt + to enable a Preview, if possible are + only little information is needed SFX_CREATE_MODE_ORGANIZER - um im Organizer dargestellt zu - werden, hier werden keine Inhalte - ben"otigt */ + to be displayed in the Organizer, here + notning of the contents is used */ ) -/* [Beschreibung] +/* [Description] - Konstruktor der Klasse SfxObjectShell. + Constructor of the class SfxObjectShell. */ : pImp( new SfxObjectShell_Impl( *this ) ), @@ -356,7 +357,7 @@ SfxObjectShell::SfxObjectShell //-------------------------------------------------------------------- -// virtual dtor of typical base-class SfxObjectShell +// virtual destructor of typical base-class SfxObjectShell SfxObjectShell::~SfxObjectShell() { @@ -365,9 +366,8 @@ SfxObjectShell::~SfxObjectShell() if ( IsEnableSetModified() ) EnableSetModified( sal_False ); - // Niemals GetInPlaceObject() aufrufen, der Zugriff auf den - // Ableitungszweig SfxInternObject ist wegen eines Compiler Bugs nicht - // erlaubt + // Never call GetInPlaceObject(), the access to the derivative branch + // SfxInternObject is not allowed because of a compiler bug SfxObjectShell::Close(); pImp->pBaseModel.set( NULL ); @@ -377,7 +377,7 @@ SfxObjectShell::~SfxObjectShell() if ( USHRT_MAX != pImp->nVisualDocumentNumber ) pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); - // Basic-Manager zerst"oren + // Destroy Basic-Manager pImp->pBasicManager->reset( NULL ); if ( pSfxApp->GetDdeService() ) @@ -437,9 +437,9 @@ sal_Bool SfxObjectShell::Stamp_GetPrintCancelState() const void SfxObjectShell::ViewAssigned() -/* [Beschreibung] +/* [Description] - Diese Methode wird gerufen, wenn eine View zugewiesen wird. + This method is called when a view is assigned. */ { @@ -454,7 +454,7 @@ sal_Bool SfxObjectShell::Close() SfxObjectShellRef aRef(this); if ( !pImp->bClosing ) { - // falls noch ein Progress l"auft, nicht schlie\sen + // Do not close if a progress is still running if ( !pImp->bDisposing && GetProgress() ) return sal_False; @@ -475,7 +475,7 @@ sal_Bool SfxObjectShell::Close() if ( pImp->bClosing ) { - // aus Document-Liste austragen + // remove from Document list SfxApplication *pSfxApp = SFX_APP(); SfxObjectShellArr_Impl &rDocs = pSfxApp->GetObjectShells_Impl(); const SfxObjectShell *pThis = this; @@ -576,7 +576,8 @@ struct BoolEnv_Impl sal_uInt16 SfxObjectShell::PrepareClose ( - sal_Bool bUI, // sal_True: Dialoge etc. erlaubt, sal_False: silent-mode + sal_Bool bUI, // sal_True: Dialog and so on is allowed + // sal_False: silent-mode sal_Bool bForBrowsing ) { @@ -596,7 +597,7 @@ sal_uInt16 SfxObjectShell::PrepareClose for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); pFrm; pFrm = SfxViewFrame::GetNext( *pFrm, this ) ) { - DBG_ASSERT(pFrm->GetViewShell(),"KeineShell"); + DBG_ASSERT(pFrm->GetViewShell(),"No Shell"); if ( pFrm->GetViewShell() ) { sal_uInt16 nRet = pFrm->GetViewShell()->PrepareClose( bUI, bForBrowsing ); @@ -614,24 +615,20 @@ sal_uInt16 SfxObjectShell::PrepareClose return sal_True; } - // ggf. nachfragen, ob gespeichert werden soll - // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen + // Ask if possible if it should be saved + // only ask for the Document in the visable window SfxViewFrame *pFrame = SfxObjectShell::Current() == this ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this ); - sal_Bool bClose = sal_False; if ( bUI && IsModified() && pFrame ) { - // minimierte restoren + // restore minimized SfxFrame& rTop = pFrame->GetTopFrame(); SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() ); pFrame->GetFrame().Appear(); - // fragen, ob gespeichert werden soll + // Ask if to save short nRet = RET_YES; - //TODO/CLEANUP - //brauchen wir UI=2 noch? - //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) { //initiate help agent to inform about "print modifies the document" SvtPrintWarningOptions aPrintOptions; @@ -648,7 +645,7 @@ sal_uInt16 SfxObjectShell::PrepareClose if ( RET_YES == nRet ) { - // per Dispatcher speichern + // Save by each Dispatcher const SfxPoolItem *pPoolItem; if ( IsSaveVersionOnClose() ) { @@ -666,21 +663,14 @@ sal_uInt16 SfxObjectShell::PrepareClose if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) return sal_False; - else - bClose = sal_True; } else if ( RET_CANCEL == nRet ) - // abgebrochen + // Cancelled return sal_False; else if ( RET_NEWTASK == nRet ) { return RET_NEWTASK; } - else - { - // Bei Nein nicht noch Informationlost - bClose = sal_True; - } } pImp->bPreparedForClose = sal_True; @@ -793,7 +783,7 @@ Reference< XLibraryContainer > SfxObjectShell::GetDialogContainer() if ( pBasMgr ) return pBasMgr->GetDialogLibraryContainer().get(); - OSL_ENSURE( false, "SfxObjectShell::GetDialogContainer: falling back to the application - is this really expected here?" ); + OSL_FAIL( "SfxObjectShell::GetDialogContainer: falling back to the application - is this really expected here?" ); return SFX_APP()->GetDialogContainer(); } @@ -808,7 +798,7 @@ Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer() if ( pBasMgr ) return pBasMgr->GetScriptLibraryContainer().get(); - OSL_ENSURE( false, "SfxObjectShell::GetBasicContainer: falling back to the application - is this really expected here?" ); + OSL_FAIL( "SfxObjectShell::GetBasicContainer: falling back to the application - is this really expected here?" ); return SFX_APP()->GetBasicContainer(); } @@ -822,16 +812,16 @@ StarBASIC* SfxObjectShell::GetBasic() const //-------------------------------------------------------------------- void SfxObjectShell::InitBasicManager_Impl() -/* [Beschreibung] +/* [Description] - creates a document's BasicManager and loads it, if we are already based on + Creates a document's BasicManager and loads it, if we are already based on a storage. - [Anmerkung] + [Note] - 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. + This method has to be called through the overloading of + <SvPersist::Load()> (With the PStore from the parameters of load ()) + and from the overloading of <SvPersist::InitNew()> (with PStore = 0). */ { @@ -893,7 +883,7 @@ uno::Sequence< ::rtl::OUString > SfxObjectShell::GetEventNames() if ( !pEventNameContainer ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !pEventNameContainer ) { static uno::Sequence< ::rtl::OUString > aEventNameContainer = GlobalEventConfig().getElementNames(); @@ -927,9 +917,7 @@ void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) { return pImp->pBaseModel.get(); } -/* -----------------------------10.09.2001 15:56------------------------------ - ---------------------------------------------------------------------------*/ void SfxObjectShell::SetAutoStyleFilterIndex(sal_uInt16 nSet) { pImp->nStyleFilter = nSet; @@ -1013,43 +1001,43 @@ String SfxObjectShell::GetServiceNameFromFactory( const String& rFact ) if ( aFact.EqualsAscii("swriter") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument")); } else if ( aFact.EqualsAscii("sweb") || aFact.EqualsAscii("swriter/web") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.text.WebDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.WebDocument")); } else if ( aFact.EqualsAscii("sglobal") || aFact.EqualsAscii("swriter/globaldocument") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.text.GlobalDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalDocument")); } else if ( aFact.EqualsAscii("scalc") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")); } else if ( aFact.EqualsAscii("sdraw") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.drawing.DrawingDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument")); } else if ( aFact.EqualsAscii("simpress") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.presentation.PresentationDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); } else if ( aFact.EqualsAscii("schart") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.chart.ChartDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart.ChartDocument")); } else if ( aFact.EqualsAscii("smath") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.formula.FormulaProperties"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.formula.FormulaProperties")); } else if ( aFact.EqualsAscii("sbasic") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.script.BasicIDE"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.BasicIDE")); } else if ( aFact.EqualsAscii("sdatabase") ) { - aServiceName = ::rtl::OUString::createFromAscii("com.sun.star.sdb.OfficeDatabaseDocument"); + aServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument")); } return aServiceName; @@ -1086,12 +1074,18 @@ SfxObjectShell* SfxObjectShell::CreateObject( const String& rServiceName, SfxObj SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, SfxFrame* pFrame ) { + Reference<lang::XComponent> xComp = CreateAndLoadComponent(rSet, pFrame); + return GetShellFromComponent(xComp); +} + +Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame ) +{ uno::Sequence < beans::PropertyValue > aProps; TransformItems( SID_OPENDOC, rSet, aProps ); SFX_ITEMSET_ARG(&rSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False); SFX_ITEMSET_ARG(&rSet, pTargetItem, SfxStringItem, SID_TARGETNAME, sal_False); ::rtl::OUString aURL; - ::rtl::OUString aTarget = rtl::OUString::createFromAscii("_blank"); + ::rtl::OUString aTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); if ( pFileNameItem ) aURL = pFileNameItem->GetValue(); if ( pTargetItem ) @@ -1104,22 +1098,33 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx } else xLoader = uno::Reference < frame::XComponentLoader >( comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") ), uno::UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY ); - uno::Reference < lang::XUnoTunnel > xObj; + Reference <lang::XComponent> xComp; try { - xObj = uno::Reference< lang::XUnoTunnel >( xLoader->loadComponentFromURL( aURL, aTarget, 0, aProps ), uno::UNO_QUERY ); + xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, aProps); } catch( uno::Exception& ) {} - if ( xObj.is() ) + return xComp; +} + +SfxObjectShell* SfxObjectShell::GetShellFromComponent( const Reference<lang::XComponent>& xComp ) +{ + try + { + Reference<lang::XUnoTunnel> xTunnel(xComp, UNO_QUERY_THROW); + Sequence <sal_Int8> aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); + sal_Int64 nHandle = xTunnel->getSomething( aSeq ); + if (!nHandle) + return NULL; + + return reinterpret_cast< SfxObjectShell* >(sal::static_int_cast< sal_IntPtr >( nHandle )); + } + catch (const Exception&) { - ::com::sun::star::uno::Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); - sal_Int64 nHandle = xObj->getSomething( aSeq ); - if ( nHandle ) - return reinterpret_cast< SfxObjectShell* >(sal::static_int_cast< sal_IntPtr >( nHandle )); } return NULL; @@ -1178,3 +1183,4 @@ bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< return false; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 2e0df56ba141..0e6113f94f99 100755..100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1225,3 +1226,5 @@ const SvGlobalName& SfxOlePropertySet::GetSectionGuid( SfxOleSectionType eSectio // ============================================================================ //} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx index 5bd586576ac8..7e441a7e8909 100755..100644 --- a/sfx2/source/doc/oleprops.hxx +++ b/sfx2/source/doc/oleprops.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,6 +81,10 @@ const sal_Int32 PROPID_CREATED = 12; const sal_Int32 PROPID_LASTSAVED = 13; const sal_Int32 PROPID_THUMBNAIL = 17; +// some Builtin properties +const sal_Int32 PROPID_CATEGORY = 0x2; +const sal_Int32 PROPID_COMPANY = 0xf; +const sal_Int32 PROPID_MANAGER = 0xe; // predefined codepages const sal_uInt16 CODEPAGE_UNKNOWN = 0; const sal_uInt16 CODEPAGE_UNICODE = 1200; @@ -92,7 +97,6 @@ const sal_Int32 CLIPFMT_WIN = -1; const sal_Int32 CLIPDATAFMT_DIB = 8; // ============================================================================ -// ============================================================================ /** Helper for classes that need text encoding settings. @@ -163,8 +167,6 @@ private: void ImplSaveString16( SvStream& rStrm, const String& rValue ) const; }; - -// ============================================================================ // ============================================================================ /** Base class for all classes related to OLE property sets. @@ -208,7 +210,6 @@ private: }; // ============================================================================ -// ============================================================================ /** Base class for all OLE property objects. */ class SfxOlePropertyBase : public SfxOleObjectBase @@ -244,7 +245,6 @@ private: }; // ============================================================================ -// ============================================================================ /** Property containing custom names for other properties in the property set. */ class SfxOleDictionaryProperty : public SfxOlePropertyBase, public SfxOleStringHelper @@ -272,7 +272,6 @@ private: }; // ============================================================================ -// ============================================================================ /** A section in a property set. Contains properties with unique identifiers. */ class SfxOleSection : public SfxOleObjectBase @@ -356,7 +355,6 @@ private: typedef ::boost::shared_ptr< SfxOleSection > SfxOleSectionRef; // ============================================================================ -// ============================================================================ /** Enumerates different section types in OLE property sets. */ enum SfxOleSectionType @@ -401,4 +399,5 @@ private: SfxOleSectionMap maSectionMap; }; -//}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index 9cab42889b6e..de28259e2391 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,15 +54,15 @@ OwnSubFilterService::~OwnSubFilterService() uno::Sequence< ::rtl::OUString > SAL_CALL OwnSubFilterService::impl_getStaticSupportedServiceNames() { uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.document.OwnSubFilter"); - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.document.OwnSubFilter"); + aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OwnSubFilter")); + aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.document.OwnSubFilter")); return aRet; } //------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OwnSubFilterService::impl_getStaticImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.document.OwnSubFilter"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.document.OwnSubFilter")); } //------------------------------------------------------------------------- @@ -163,3 +164,4 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OwnSubFilterService::getSupportedServi } // namespace sfx2 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index 8c731845554f..279c6ae3f930 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,7 +104,7 @@ sal_Bool SAL_CALL PluginObject::load( const uno::Reference < frame::XFrame >& xFrame ) throw( uno::RuntimeException ) { - uno::Reference< plugin::XPluginManager > xPMgr( mxFact->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.plugin.PluginManager") ), uno::UNO_QUERY ); + uno::Reference< plugin::XPluginManager > xPMgr( mxFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginManager")) ), uno::UNO_QUERY ); if (!xPMgr.is() ) return sal_False; @@ -115,14 +116,13 @@ throw( uno::RuntimeException ) pWin->SetBackground(); pWin->Show(); - sal_uIntPtr nCount = maCmdList.Count(); + size_t nCount = maCmdList.size(); uno::Sequence < ::rtl::OUString > aCmds( nCount ), aArgs( nCount ); ::rtl::OUString *pCmds = aCmds.getArray(), *pArgs = aArgs.getArray(); - for( sal_uIntPtr i = 0; i < nCount; i++ ) + for( size_t i = 0; i < nCount; i++ ) { - SvCommand & rCmd = maCmdList.GetObject( i ); - pCmds[i] = rCmd.GetCommand(); - pArgs[i] = rCmd.GetArgument(); + pCmds[i] = maCmdList[ i ].GetCommand(); + pArgs[i] = maCmdList[ i ].GetArgument(); } mxPlugin = xPMgr->createPluginFromURL( @@ -155,7 +155,7 @@ throw( uno::RuntimeException ) } } } - catch( uno::Exception& ) + catch( const uno::Exception& ) { } } @@ -205,17 +205,17 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL PluginObject::getPropertySetI void SAL_CALL PluginObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny) throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if ( aPropertyName.equalsAscii("PluginURL") ) + if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginURL")) ) { aAny >>= maURL; } - else if ( aPropertyName.equalsAscii("PluginMimeType") ) + else if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginMimeType")) ) { aAny >>= maMimeType; } - else if ( aPropertyName.equalsAscii("PluginCommands") ) + else if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginCommands")) ) { - maCmdList.Clear(); + maCmdList.clear(); uno::Sequence < beans::PropertyValue > aCommandSequence; if( aAny >>= aCommandSequence ) maCmdList.FillFromSequence( aCommandSequence ); @@ -228,15 +228,15 @@ uno::Any SAL_CALL PluginObject::getPropertyValue(const ::rtl::OUString& aPropert throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { uno::Any aAny; - if ( aPropertyName.equalsAscii("PluginURL") ) + if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginURL")) ) { aAny <<= maURL; } - else if ( aPropertyName.equalsAscii("PluginMimeType") ) + else if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginMimeType")) ) { aAny <<= maMimeType; } - else if ( aPropertyName.equalsAscii("PluginCommands") ) + else if ( aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PluginCommands")) ) { uno::Sequence< beans::PropertyValue > aCommandSequence; maCmdList.FillSequence( aCommandSequence ); @@ -264,3 +264,5 @@ void SAL_CALL PluginObject::removeVetoableChangeListener(const ::rtl::OUString&, } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 8bf97ba5b435..abc3b0d38a3b 100755..100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ #include <tools/urlobj.hxx> #include <ucbhelper/content.hxx> #include <cppuhelper/interfacecontainer.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <cppuhelper/implbase1.hxx> #include <sfx2/viewfrm.hxx> @@ -263,7 +264,7 @@ namespace uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() throw(::com::sun::star::uno::RuntimeException) { // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // search for any view of this document that is currently printing const Printer *pPrinter = NULL; @@ -322,7 +323,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter,SfxPrinter*& pPrinter,sal_uInt16& nChangeFlags,SfxViewShell*& pViewSh) { - // alten Printer beschaffen + // Get old Printer SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) @@ -435,13 +436,12 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } } - //os 12.11.98: die PaperSize darf nur gesetzt werden, wenn tatsaechlich - //PAPER_USER gilt, sonst koennte vom Treiber ein falsches Format gewaehlt werden + // The PaperSize may be set only when actually PAPER_USER + // applies, otherwise the driver could choose a invalid format. if(nPaperFormat == view::PaperFormat_USER && aSetPaperSize.Width()) { - //JP 23.09.98 - Bug 56929 - MapMode von 100mm in die am - // Device gesetzten umrechnen. Zusaetzlich nur dann - // setzen, wenn sie wirklich veraendert wurden. + // Bug 56929 - MapMode of 100mm which recalculated when + // the device is set. Additionally only set if they were really changed. aSetPaperSize = pPrinter->LogicToPixel( aSetPaperSize, MAP_100TH_MM ); if( aSetPaperSize != pPrinter->GetPaperSizePixel() ) { @@ -450,7 +450,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } } - // #96772#: wait until printing is done + //wait until printing is done SfxPrinter* pDocPrinter = pViewSh->GetPrinter(); while ( pDocPrinter->IsPrinting() ) Application::Yield(); @@ -460,7 +460,7 @@ void SAL_CALL SfxPrintHelper::setPrinter(const uno::Sequence< beans::PropertyVal throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxViewShell* pViewSh = NULL; SfxPrinter* pPrinter = NULL; @@ -505,7 +505,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread { /* SAFE { */ { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; while( m_pPrinter->IsPrinting() ) Application::Yield(); m_pPrinter = NULL; // don't delete it! It's borrowed only :-) @@ -559,10 +559,10 @@ class ImplUCBPrintWatcher : public ::osl::Thread ::com::sun::star::ucb::NameClash::OVERWRITE); } } - catch( ::com::sun::star::ucb::ContentCreationException& ) { DBG_ERROR("content create exception"); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) { DBG_ERROR("command abort exception"); } - catch( ::com::sun::star::uno::RuntimeException& ) { DBG_ERROR("runtime exception"); } - catch( ::com::sun::star::uno::Exception& ) { DBG_ERROR("unknown exception"); } + catch( ::com::sun::star::ucb::ContentCreationException& ) { OSL_FAIL("content create exception"); } + catch( ::com::sun::star::ucb::CommandAbortedException& ) { OSL_FAIL("command abort exception"); } + catch( ::com::sun::star::uno::RuntimeException& ) { OSL_FAIL("runtime exception"); } + catch( ::com::sun::star::uno::Exception& ) { OSL_FAIL("unknown exception"); } // kill the temp file! delete *ppTempFile; @@ -583,7 +583,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // object already disposed? // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // get view for sfx printing capabilities SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? @@ -593,8 +593,6 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& SfxViewShell* pView = pViewFrm->GetViewShell(); if ( !pView ) return; - -// SfxAllItemSet aArgs( pView->GetPool() ); sal_Bool bMonitor = sal_False; // We need this information at the end of this method, if we start the vcl printer // by executing the slot. Because if it is a ucb relevant URL we must wait for @@ -648,7 +646,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& aCheckedArgs[nProps++].Value <<= sFileURL; // and append the local filename aCheckedArgs.realloc( aCheckedArgs.getLength()+1 ); - aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalFileName")); aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sTemp ); } else @@ -664,7 +662,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& aCheckedArgs[nProps++].Value <<= sTemp; // and append the local filename aCheckedArgs.realloc( aCheckedArgs.getLength()+1 ); - aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalFileName")); aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sPath ); } else @@ -682,7 +680,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& pUCBPrintTempFile->EnableKillingFile(); //FIXME: does it work? - aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalFileName")); aCheckedArgs[nProps++].Value <<= ::rtl::OUString( pUCBPrintTempFile->GetFileName() ); sUcbUrl = sURL; } @@ -707,7 +705,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& sal_Bool bTemp = sal_Bool(); if ( rProp.Value >>= bTemp ) { - aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("Collate"); + aCheckedArgs[nProps].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Collate")); aCheckedArgs[nProps++].Value <<= bTemp; } else @@ -819,14 +817,15 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin void SAL_CALL SfxPrintHelper::addPrintJobListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XPrintJobListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference < view::XPrintJobListener>*)0), xListener ); } void SAL_CALL SfxPrintHelper::removePrintJobListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XPrintJobListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference < view::XPrintJobListener>*)0), xListener ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/printhelper.hxx b/sfx2/source/doc/printhelper.hxx index 9ba05fc20cee..d5b5ba83dffd 100755..100644 --- a/sfx2/source/doc/printhelper.hxx +++ b/sfx2/source/doc/printhelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,5 @@ private: IMPL_PrintListener_DataContainer* m_pData ; virtual void impl_setPrinter(const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rPrinter,SfxPrinter*& pPrinter,sal_uInt16& nChangeFlags,SfxViewShell*& pViewSh); } ; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/querytemplate.cxx b/sfx2/source/doc/querytemplate.cxx index a2adce45d239..076780971e2b 100644 --- a/sfx2/source/doc/querytemplate.cxx +++ b/sfx2/source/doc/querytemplate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,4 @@ QueryTemplateBox::QueryTemplateBox( Window* pParent, const String& rMessage ) : } // end of namespace sfx2 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/querytemplate.hxx b/sfx2/source/doc/querytemplate.hxx index 92e9f26da0a7..ef27654cc922 100644 --- a/sfx2/source/doc/querytemplate.hxx +++ b/sfx2/source/doc/querytemplate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,4 @@ namespace sfx2 #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx index ded9d3000fc8..289a44a44237 100644 --- a/sfx2/source/doc/sfxacldetect.cxx +++ b/sfx2/source/doc/sfxacldetect.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,6 +30,9 @@ #include "precompiled_sfx2.hxx" + +#if EXTRA_ACL_CHECK + #ifdef WNT // necessary to include system headers without warnings @@ -107,3 +111,6 @@ sal_Bool IsReadonlyAccordingACL( const sal_Unicode* ) #endif +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/sfxacldetect.hxx b/sfx2/source/doc/sfxacldetect.hxx new file mode 100644 index 000000000000..40112f3b8bad --- /dev/null +++ b/sfx2/source/doc/sfxacldetect.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Kohei Yoshida <kyoshida@novell.com> + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SFXACLDETECT_HXX__ +#define __SFXACLDETECT_HXX__ + +// Let's check if this extra ACL check is still necessary... If disabling it +// causes no regressions, then we can safely remove this code. +#define EXTRA_ACL_CHECK 0 + +#if EXTRA_ACL_CHECK +sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ); +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 32b46bb67e4d..ccfa7409252a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,7 +81,7 @@ #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> #include <unotools/tempfile.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/salctype.hxx> #include <sot/clsids.hxx> #include <sot/storinfo.hxx> @@ -134,10 +135,6 @@ #include <sfx2/sfxresid.hxx> //________________________________________________________________________________________________________ -// const -static const ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAscii ("com.sun.star.frame.Desktop"); - -//________________________________________________________________________________________________________ // namespaces //________________________________________________________________________________________________________ @@ -186,7 +183,7 @@ SfxDocInfoListener_Impl::~SfxDocInfoListener_Impl() void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& ) throw ( uno::RuntimeException ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; // notify changes to the SfxObjectShell m_rShell.FlushDocInfo(); @@ -293,8 +290,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument const uno::Reference<frame:: XTransientDocumentsDocumentContentFactory> xTDDCF( xMsf->createInstanceWithContext( - ::rtl::OUString::createFromAscii( "com.sun.star.frame." - "TransientDocumentsDocumentContentFactory"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame." + "TransientDocumentsDocumentContentFactory")), xContext), uno::UNO_QUERY_THROW); const uno::Reference<ucb::XContent> xContent( @@ -308,7 +305,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument OSL_ENSURE(uri.getLength(), "GetDMA: empty uri?"); if (uri.getLength() && !uri.endsWithAsciiL("/", 1)) { - uri = uri + ::rtl::OUString::createFromAscii("/"); + uri = uri + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); } m_xDocumentMetadata = new ::sfx2::DocumentMetadataAccess( @@ -411,7 +408,7 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell ) } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); + OSL_FAIL( "Not possible to lock the frame window!\n" ); } } } @@ -455,7 +452,7 @@ void SfxOwnFramesLocker::UnlockFrames() } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can't unlock the frame window!\n" ); + OSL_FAIL( "Can't unlock the frame window!\n" ); } } } @@ -482,8 +479,8 @@ SfxSaveGuard::SfxSaveGuard(const uno::Reference< frame::XModel >& xM , m_pData (pData ) , m_pFramesLock(0 ) { - static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Object already disposed." ); - static ::rtl::OUString MSG_2 = ::rtl::OUString::createFromAscii("Concurrent save requests on the same document are not possible."); + static ::rtl::OUString MSG_1(RTL_CONSTASCII_USTRINGPARAM("Object already disposed.")); + static ::rtl::OUString MSG_2(RTL_CONSTASCII_USTRINGPARAM("Concurrent save requests on the same document are not possible.")); if ( m_pData->m_bClosed ) throw ::com::sun::star::lang::DisposedException( @@ -808,8 +805,6 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept { // as long as an SfxObjectShell is assigned to an SfxBaseModel it is still existing here // so we can't dispose the shared DocumentInfoObject here - // uno::Reference < lang::XComponent > xComp( m_pData->m_xDocumentInfo, uno::UNO_QUERY ); - // xComp->dispose(); m_pData->m_xDocumentInfo = 0; } @@ -879,17 +874,17 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo } catch (uno::RuntimeException &) { throw; } catch (uno::Exception & e) { - throw lang::WrappedTargetRuntimeException(::rtl::OUString::createFromAscii( - "SfxBaseModel::getDocumentInfo: cannot initialize"), *this, + throw lang::WrappedTargetRuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "SfxBaseModel::getDocumentInfo: cannot initialize")), *this, uno::makeAny(e)); } try { - rtl::OUString aName = rtl::OUString::createFromAscii("MediaType"); + rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("MediaType")); uno::Reference < beans::XPropertySet > xSet( - getDocumentStorage(), uno::UNO_QUERY ); + getDocumentStorage(), uno::UNO_QUERY_THROW ); uno::Any aMediaType = xSet->getPropertyValue( aName ); uno::Reference < beans::XPropertySet > xDocSet( - m_pData->m_xDocumentInfo, uno::UNO_QUERY ); + m_pData->m_xDocumentInfo, uno::UNO_QUERY_THROW ); xDocSet->setPropertyValue( aName, aMediaType ); } catch (uno::Exception &) { //ignore @@ -898,7 +893,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo return m_pData->m_xDocumentInfo; } - +void +SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps ) +{ + // object already disposed? + ::SolarMutexGuard aGuard; + if ( impl_isDisposed() ) + throw lang::DisposedException(); + m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW); +} // document::XDocumentPropertiesSupplier: uno::Reference< document::XDocumentProperties > SAL_CALL SfxBaseModel::getDocumentProperties() @@ -911,7 +914,6 @@ SfxBaseModel::getDocumentProperties() ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.document.DocumentProperties") ), uno::UNO_QUERY_THROW); -// xDocProps->initialize(uno::Sequence<uno::Any>()); m_pData->m_xDocumentProperties.set(xDocProps, uno::UNO_QUERY_THROW); uno::Reference<util::XModifyBroadcaster> xMB(m_pData->m_xDocumentProperties, uno::UNO_QUERY_THROW); xMB->addModifyListener(new SfxDocInfoListener_Impl(*m_pData->m_pObjectShell)); @@ -928,7 +930,7 @@ SfxBaseModel::getDocumentProperties() void SAL_CALL SfxBaseModel::disposing( const lang::EventObject& aObject ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( impl_isDisposed() ) return; @@ -953,7 +955,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& throw(::com::sun::star::uno::RuntimeException) { SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); - if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) ) + if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SetEmbedded")) ) { // allows to set a windowless document to EMBEDDED state // but _only_ before load() or initNew() methods @@ -1079,13 +1081,13 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c aRectSeq[3] = aTmpRect.Bottom(); seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString::createFromAscii( "WinExtent" ); + seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WinExtent")); seqArgsNew[ nNewLength - 1 ].Value <<= aRectSeq; if ( m_pData->m_aPreusedFilterName.getLength() ) { seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString::createFromAscii( "PreusedFilterName" ); + seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreusedFilterName")); seqArgsNew[ nNewLength - 1 ].Value <<= m_pData->m_aPreusedFilterName; } @@ -1101,7 +1103,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c aBorderSeq[3] = aBorder.Bottom(); seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString::createFromAscii( "DocumentBorder" ); + seqArgsNew[ nNewLength - 1 ].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentBorder")); seqArgsNew[ nNewLength - 1 ].Value <<= aBorderSeq; } @@ -1435,9 +1437,9 @@ void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLI void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException) { - static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving."); + static ::rtl::OUString MSG_1(RTL_CONSTASCII_USTRINGPARAM("Cant close while saving.")); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( impl_isDisposed() || m_pData->m_bClosed || m_pData->m_bClosing ) return; @@ -1859,23 +1861,9 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& throw frame::IllegalArgumentIOException(); } - // !TODO: currently not working - //SFX_ITEMSET_ARG( pParams, pFrameItem, SfxFrameItem, SID_DOCFRAME, sal_False ); - //if( pFrameItem && pFrameItem->GetFrame() ) - //{ - // SfxFrame* pFrame = pFrameItem->GetFrame(); - // pMedium->SetLoadTargetFrame( pFrame ); - //} - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False ); sal_Bool bSalvage = pSalvageItem ? sal_True : sal_False; - // SFX_ITEMSET_ARG( pMedium->GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - // sal_Bool bTemplate = pTemplateItem && pTemplateItem->GetValue(); - // - // does already happen in DoLoad call - //m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); - // load document sal_uInt32 nError = ERRCODE_NONE; if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) @@ -1967,7 +1955,7 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& if ( m_pData->m_pObjectShell->GetMedium() != pMedium ) { // for whatever reason document now has another medium - DBG_ERROR("Document has rejected the medium?!"); + OSL_FAIL("Document has rejected the medium?!"); delete pMedium; } @@ -2008,7 +1996,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) if ( m_pData->m_pObjectShell.Is() ) { - if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"" ) ) + if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2037,7 +2025,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2062,7 +2050,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2083,12 +2071,12 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { ::boost::shared_ptr<GDIMetaFile> pMetaFile = - m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( sal_True, sal_True ); + m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( sal_True ); if ( pMetaFile ) { @@ -2103,7 +2091,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-emf;windows_formatname=\"Image EMF\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2138,7 +2126,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2178,7 +2166,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2202,7 +2190,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) else throw datatransfer::UnsupportedFlavorException(); } - else if ( aFlavor.MimeType.equalsAscii( "image/png" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("image/png")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) { @@ -2312,17 +2300,17 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor { SfxModelGuard aGuard( *this ); - if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) + if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-emf;windows_formatname=\"Image EMF\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; @@ -2330,7 +2318,7 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor && aFlavor.DataType == getCppuType( (const sal_uInt64*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; @@ -2338,22 +2326,22 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor && aFlavor.DataType == getCppuType( (const sal_uInt64*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; } - else if ( aFlavor.MimeType.equalsAscii( "image/png" ) ) + else if ( aFlavor.MimeType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("image/png")) ) { if ( aFlavor.DataType == getCppuType( (const Sequence< sal_Int8 >*) 0 ) ) return sal_True; @@ -2508,7 +2496,7 @@ void addTitle_Impl( Sequence < ::com::sun::star::beans::PropertyValue >& rSeq, c for ( nArg = 0; nArg < nCount; nArg++ ) { ::com::sun::star::beans::PropertyValue& rProp = rSeq[nArg]; - if ( rProp.Name.equalsAscii("Title") ) + if ( rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Title")) ) { rProp.Value <<= rTitle; break; @@ -2573,11 +2561,6 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , { case SFX_EVENT_STORAGECHANGED: { - // for now this event is sent only on creation of a new storage for new document - // and in case of reload of medium without document reload - // other events are used to detect storage change - // NotifyStorageListeners_Impl(); - if ( m_pData->m_xUIConfigurationManager.is() && m_pData->m_pObjectShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) { @@ -2596,7 +2579,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } else { - OSL_ENSURE( sal_False, "Unexpected scenario!\n" ); + OSL_FAIL( "Unexpected scenario!\n" ); } } @@ -2656,14 +2639,6 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , { postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_MODECHANGED ) ); } -/* - else if ( pSimpleHint->GetId() == SFX_HINT_DYING - || pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING ) - { - SfxObjectShellLock pShellLock = m_pData->m_pObjectShellLock; - m_pData->m_pObjectShellLock = SfxObjectShellLock(); - } -*/ } } } @@ -2728,7 +2703,7 @@ sal_Bool SfxBaseModel::IsInitialized() const { if ( !m_pData || !m_pData->m_pObjectShell ) { - OSL_ENSURE( false, "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); + OSL_FAIL( "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); return sal_False; } @@ -2772,8 +2747,6 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if( !sURL.getLength() ) throw frame::IllegalArgumentIOException(); - //sal_Bool aSaveAsTemplate = sal_False; - sal_Bool bSaved = sal_False; if ( !bSaveTo && m_pData->m_pObjectShell && sURL.getLength() && sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL @@ -3028,7 +3001,7 @@ void SfxBaseModel::postEvent_Impl( const ::rtl::OUString& aName, const uno::Refe #ifdef DBG_UTIL ByteString aTmp( "SfxDocumentEvent: " ); aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + OSL_TRACE( aTmp.GetBuffer() ); #endif document::DocumentEvent aDocumentEvent( (frame::XModel*)this, aName, xController, uno::Any() ); @@ -3045,7 +3018,7 @@ void SfxBaseModel::postEvent_Impl( const ::rtl::OUString& aName, const uno::Refe #ifdef DBG_UTIL ByteString aTmp( "SfxEvent: " ); aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + OSL_TRACE( "%s", aTmp.GetBuffer() ); #endif document::EventObject aEvent( (frame::XModel*)this, aName ); @@ -3151,8 +3124,6 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPr if ( xPJB.is() ) xPJB->addPrintJobListener( xListener ); } -// else -// m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< view::XPrintJobListener >*)0), xListener ); } void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) @@ -3165,8 +3136,6 @@ void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view:: if ( xPJB.is() ) xPJB->removePrintJobListener( xListener ); } -// else -// m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< view::XPrintJobListener >*)0), xListener ); } // simple declaration of class SvObject is enough @@ -3175,7 +3144,7 @@ void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view:: class SvObject; sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( GetObjectShell() ) { SvGlobalName aName( aIdentifier ); @@ -3238,7 +3207,6 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() SfxModelGuard aGuard( *this ); Sequence< ::rtl::OUString > aResult; - sal_Int32 nResultSize = 0; sal_Bool bSuccess = sal_False; if ( m_pData->m_pObjectShell.Is() ) { @@ -3247,6 +3215,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() if ( xAccess.is() ) { Sequence< ::rtl::OUString > aTemp = xAccess->getElementNames(); + sal_Int32 nResultSize = 0; for ( sal_Int32 n = 0; n < aTemp.getLength(); n++ ) { if ( xStorage->isStorageElement( aTemp[n] ) ) @@ -3316,7 +3285,7 @@ rtl::OUString SfxBaseModel::getRuntimeUID() const sal_Bool SfxBaseModel::hasValidSignatures() const { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pObjectShell.Is() ) return ( m_pData->m_pObjectShell->ImplGetSignatureState( sal_False ) == SIGNATURESTATE_SIGNATURES_OK ); return sal_False; @@ -3329,7 +3298,7 @@ static void GetCommandFromSequence( rtl::OUString& rCommand, sal_Int32& nIndex, for ( sal_Int32 i = 0; i < rSeqPropValue.getLength(); i++ ) { - if ( rSeqPropValue[i].Name.equalsAsciiL( "Command", 7 )) + if ( rSeqPropValue[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Command")) ) { rSeqPropValue[i].Value >>= rCommand; nIndex = i; @@ -3386,7 +3355,7 @@ uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfig { uno::Reference< ui::XUIConfigurationManager > xNewUIConfMan( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.ui.UIConfigurationManager" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager"))), uno::UNO_QUERY ); Reference< ui::XUIConfigurationStorage > xUIConfigStorage( xNewUIConfMan, uno::UNO_QUERY ); @@ -3508,7 +3477,6 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz Size aWinSize = pWindow->GetSizePixel(); awt::Size aCurrent = getVisualAreaSize( nAspect ); Size aDiff( aSize.Width-aCurrent.Width, aSize.Height-aCurrent.Height ); - Size aWrongDiff = OutputDevice::LogicToLogic( aDiff , m_pData->m_pObjectShell->GetMapUnit(), pWindow->GetMapMode() ); aDiff = pViewFrm->GetViewShell()->GetWindow()->LogicToPixel( aDiff ); aWinSize.Width() += aDiff.Width(); aWinSize.Height() += aDiff.Height(); @@ -3535,20 +3503,6 @@ awt::Size SAL_CALL SfxBaseModel::getVisualAreaSize( sal_Int64 /*nAspect*/ ) Rectangle aTmpRect = m_pData->m_pObjectShell->GetVisArea( ASPECT_CONTENT ); -#if 0 - Window* pWindow = NULL; - SfxViewFrame* pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; - - if ( pWindow ) - { - MapMode aInternalMapMode( pViewFrm->GetWindow().GetMapMode() ); - MapMode aExternalMapMode( m_pData->m_pObjectShell->GetMapUnit() ); - - aTmpRect = OutputDevice::LogicToLogic( aTmpRect, aInternalMapMode, aExternalMapMode ); - } -#endif - return awt::Size( aTmpRect.GetWidth(), aTmpRect.GetHeight() ); } @@ -3574,8 +3528,8 @@ embed::VisualRepresentation SAL_CALL SfxBaseModel::getPreferredVisualRepresentat SfxModelGuard aGuard( *this ); datatransfer::DataFlavor aDataFlavor( - ::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ), - ::rtl::OUString::createFromAscii( "GDIMetaFile" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GDIMetaFile")), ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) ); embed::VisualRepresentation aVisualRepresentation; @@ -3703,15 +3657,23 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x throw IOEXCEPTION(); // TODO: // the persistence should be switched only if the storage is different - if ( xStorage != m_pData->m_pObjectShell->GetStorage() - && !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) ) + if ( xStorage != m_pData->m_pObjectShell->GetStorage() ) { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); - throw task::ErrorCodeIOException( ::rtl::OUString(), - uno::Reference< uno::XInterface >(), - nError ? nError : ERRCODE_IO_GENERAL ); + if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) ) + { + sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + throw task::ErrorCodeIOException( ::rtl::OUString(), + uno::Reference< uno::XInterface >(), + nError ? nError : ERRCODE_IO_GENERAL ); + } + else + { + // UICfgMgr has a reference to the old storage, update it + uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY ); + if ( xUICfgMgrStorage.is() ) + xUICfgMgrStorage->setStorage( xStorage ); + } } - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = sal_False; } @@ -3794,6 +3756,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () if ( ! m_pData->m_xTitleHelper.is ()) { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory (); + static const ::rtl::OUString SERVICENAME_DESKTOP(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); css::uno::Reference< css::frame::XUntitledNumbers > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW); @@ -3819,7 +3782,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl m_pData->m_xNumberedControllers = css::uno::Reference< css::frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), css::uno::UNO_QUERY_THROW); pHelper->setOwner (xThis); - pHelper->setUntitledPrefix (::rtl::OUString::createFromAscii(" : ")); + pHelper->setUntitledPrefix (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : "))); } return m_pData->m_xNumberedControllers; @@ -3960,10 +3923,10 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewCon SfxModelGuard aGuard( *this ); const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); - const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); + const sal_Int16 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); - for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) + for ( sal_Int16 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetAPIViewName(); return aViewNames; } @@ -4063,7 +4026,7 @@ SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame // destroyed later, and the new one, which we're going to create continue; - OSL_ENSURE( false, "SfxBaseModel::FindOrCreateViewFrame_Impl: there already is an SfxFrame for the given XFrame, but no view in it!" ); + OSL_FAIL( "SfxBaseModel::FindOrCreateViewFrame_Impl: there already is an SfxFrame for the given XFrame, but no view in it!" ); // nowadays, we're the only instance allowed to create an SfxFrame for an XFrame, so this case here should not happen break; } @@ -4181,8 +4144,8 @@ SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getRDFRepository(); @@ -4196,8 +4159,8 @@ SfxBaseModel::getStringValue() throw (uno::RuntimeException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getStringValue(); @@ -4211,8 +4174,8 @@ SfxBaseModel::getNamespace() throw (uno::RuntimeException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getNamespace(); @@ -4225,8 +4188,8 @@ SfxBaseModel::getLocalName() throw (uno::RuntimeException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getLocalName(); @@ -4242,8 +4205,8 @@ throw (uno::RuntimeException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getElementByMetadataReference(i_rReference); @@ -4257,8 +4220,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getElementByURI(i_xURI); @@ -4273,8 +4236,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException) const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->getMetadataGraphsWithType(i_xType); @@ -4290,8 +4253,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->addMetadataFile(i_rFileName, i_rTypes); @@ -4311,8 +4274,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->importMetadataFile(i_Format, @@ -4329,8 +4292,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->removeMetadataFile(i_xGraphName); @@ -4345,8 +4308,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->addContentOrStylesFile(i_rFileName); @@ -4361,8 +4324,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->removeContentOrStylesFile(i_rFileName); @@ -4381,8 +4344,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } try { @@ -4408,8 +4371,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->storeMetadataToStorage(i_xStorage); @@ -4426,8 +4389,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } try { @@ -4452,8 +4415,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { - throw uno::RuntimeException( ::rtl::OUString::createFromAscii( - "model has no document metadata"), *this ); + throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "model has no document metadata")), *this ); } return xDMA->storeMetadataToMedium(i_rMedium); @@ -4472,3 +4435,4 @@ void SfxModelSubComponent::disposing() // nothing to do here } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index 714dfc2ea824..93dbfa15c420 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -148,9 +149,9 @@ namespace sfx2 { static bool isSpecialArgumentName( const ::rtl::OUString& _rValueName ) { - return _rValueName.equalsAscii( "EmbeddedObject" ) - || _rValueName.equalsAscii( "EmbeddedScriptSupport" ) - || _rValueName.equalsAscii( "DocumentRecoverySupport" ); + return _rValueName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EmbeddedObject" ) ) + || _rValueName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EmbeddedScriptSupport" ) ) + || _rValueName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentRecoverySupport" ) ); } bool operator()( const Any& _rArgument ) const @@ -237,3 +238,5 @@ namespace sfx2 //........................................................................ } // namespace sfx2 //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx index a1025370ed24..af77c0b5f93f 100644 --- a/sfx2/source/doc/syspath.cxx +++ b/sfx2/source/doc/syspath.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * -* $RCSfile: shutdowniconw32.cxx,v $ -* $Revision: 1.48 $ -* * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -46,3 +44,5 @@ bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) return false; #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/syspath.hxx b/sfx2/source/doc/syspath.hxx index 015c16f18d26..7287032ef74d 100644 --- a/sfx2/source/doc/syspath.hxx +++ b/sfx2/source/doc/syspath.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * -* $RCSfile: shutdowniconw32.cxx,v $ -* $Revision: 1.48 $ -* * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,3 +40,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 167dadea2e38..819e59344de8 100755..100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * -* $RCSfile: shutdowniconw32.cxx,v $ -* $Revision: 1.48 $ -* * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -85,3 +83,5 @@ extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) return false; #endif } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/explorer/nochaos.cxx b/sfx2/source/explorer/nochaos.cxx index 32d1cf2cf6fd..6b255678f014 100644 --- a/sfx2/source/explorer/nochaos.cxx +++ b/sfx2/source/explorer/nochaos.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,9 +38,7 @@ #define WID_CHAOS_START 500 //========================================================================= -// // class CntStaticPoolDefaults_Impl -// //========================================================================= class CntItemPool; @@ -102,9 +101,7 @@ sal_uInt16 NoChaos::ReleaseItemPool() } //========================================================================= -// // CntItemPool implementation -// //========================================================================= static CntStaticPoolDefaults_Impl* pPoolDefs_Impl = NULL; @@ -174,9 +171,7 @@ sal_uInt16 CntItemPool::Release() } //========================================================================= -// // CntStaticPoolDefaults_Impl implementation. -// //========================================================================= inline void CntStaticPoolDefaults_Impl::Insert( @@ -213,3 +208,5 @@ CntStaticPoolDefaults_Impl::CntStaticPoolDefaults_Impl( CntItemPool* /*pPool*/ ) 0, SFX_ITEM_POOLABLE ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/SfxDocumentMetaData.hxx b/sfx2/source/inc/SfxDocumentMetaData.hxx index ec573cf007a7..d53d85595e8c 100644 --- a/sfx2/source/inc/SfxDocumentMetaData.hxx +++ b/sfx2/source/inc/SfxDocumentMetaData.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,5 +46,17 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL _create( } // closing component helper namespace +namespace comp_CompatWriterDocProps { + +namespace css = ::com::sun::star; + +// component and service helper functions: +::rtl::OUString SAL_CALL _getImplementationName(); +css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames(); +css::uno::Reference< css::uno::XInterface > SAL_CALL _create( + css::uno::Reference< css::uno::XComponentContext > const & context ); + +} #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index f7c38173fceb..e34a2d2846bf 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,9 +28,7 @@ #ifndef _SFX_ALIENWARN_HXX #define _SFX_ALIENWARN_HXX -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/fixed.hxx> #include <sfx2/basedlgs.hxx> @@ -54,3 +53,4 @@ public: #endif // #ifndef _SFX_ALIENWARN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appbas.hxx b/sfx2/source/inc/appbas.hxx index 05c182419514..6f3809d5674c 100644 --- a/sfx2/source/inc/appbas.hxx +++ b/sfx2/source/inc/appbas.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,3 +43,4 @@ SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject, #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appbaslib.hxx b/sfx2/source/inc/appbaslib.hxx index 5bc7662e8f9b..dd47c79273aa 100644 --- a/sfx2/source/inc/appbaslib.hxx +++ b/sfx2/source/inc/appbaslib.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,3 +139,4 @@ public: #endif // APPBASLIB_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 92a56655a27d..dfcf9bacc09d 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,10 @@ #define _SFX_APPDATA_HXX #include <tools/link.hxx> -#include <tools/list.hxx> #include <svl/lstner.hxx> #include <vcl/timer.hxx> #include <tools/string.hxx> +#include <svtools/ehdl.hxx> #include "rtl/ref.hxx" #include <com/sun/star/frame/XModel.hpp> @@ -112,6 +113,12 @@ public: SfxFilterMatcher* pMatcher; ResMgr* pBasicResMgr; ResMgr* pSvtResMgr; +#ifdef DBG_UTIL + SimpleErrorHandler *m_pSimpleErrorHdl; +#endif + SfxErrorHandler *m_pToolsErrorHdl; + SfxErrorHandler *m_pSoErrorHdl; + SfxErrorHandler *m_pSbxErrorHdl; SfxStatusDispatcher* pAppDispatch; SfxDocumentTemplates* pTemplates; @@ -150,14 +157,14 @@ public: SfxViewFrame* pViewFrame; SfxSlotPool* pSlotPool; SfxResourceManager* pResMgr; - SfxDispatcher* pAppDispat; // Dispatcher falls kein Doc + SfxDispatcher* pAppDispat; // Dispatcher if no document SfxInterface** pInterfaces; - sal_uInt16 nDocNo; // Laufende Doc-Nummer (AutoName) + sal_uInt16 nDocNo; // current Doc-Number (AutoName) sal_uInt16 nInterfaces; - sal_Bool bDispatcherLocked:1; // nichts ausf"uhren - sal_Bool bDowning:1; // sal_True ab Exit und danach + sal_Bool bDispatcherLocked:1; // do nothing + sal_Bool bDowning:1; // sal_True on Exit and afterwards sal_Bool bInQuit : 1; sal_Bool bInvalidateOnUnlock : 1; sal_Bool bODFVersionWarningLater : 1; @@ -165,7 +172,6 @@ public: SfxAppData_Impl( SfxApplication* ); ~SfxAppData_Impl(); - void UpdateApplicationSettings( sal_Bool bDontHide ); SfxDocumentTemplates* GetDocumentTemplates(); void DeInitDDE(); @@ -179,3 +185,4 @@ public: #endif // #ifndef _SFX_APPDATA_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/doctemplates.hxx b/sfx2/source/inc/doctemplates.hxx index 5e962b93a117..f34f0fde4aeb 100644 --- a/sfx2/source/inc/doctemplates.hxx +++ b/sfx2/source/inc/doctemplates.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -100,3 +101,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx index 9b37671662fd..9b37671662fd 100755..100644 --- a/sfx2/source/inc/docundomanager.hxx +++ b/sfx2/source/inc/docundomanager.hxx diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index 4964cf30233d..87e1c54a7c1a 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ #include <comphelper/sequenceasvector.hxx> #include <sfx2/sfxuno.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <svl/lstner.hxx> #include <unotools/eventcfg.hxx> @@ -271,3 +272,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/fltfnc.hxx b/sfx2/source/inc/fltfnc.hxx index bac498b6f765..d9f10a52882d 100644 --- a/sfx2/source/inc/fltfnc.hxx +++ b/sfx2/source/inc/fltfnc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,3 +34,4 @@ sal_Bool SfxIsHelpEntryURL( const String &rURL, const String &rExtMask ); #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/fltoptint.hxx b/sfx2/source/inc/fltoptint.hxx index d674c7620d54..4c5c570cefa5 100644 --- a/sfx2/source/inc/fltoptint.hxx +++ b/sfx2/source/inc/fltoptint.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,4 @@ public: }; #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx index 6e0061a69cf2..ad180e067fa5 100644 --- a/sfx2/source/inc/helper.hxx +++ b/sfx2/source/inc/helper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,3 +77,4 @@ public: #endif // #ifndef _SFX_HELPER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/hexplwnd.hxx b/sfx2/source/inc/hexplwnd.hxx index 228ce78949b9..501b2bbef242 100644 --- a/sfx2/source/inc/hexplwnd.hxx +++ b/sfx2/source/inc/hexplwnd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -99,3 +100,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/iframe.hxx b/sfx2/source/inc/iframe.hxx index 041ffac822b7..b0a98b740a0b 100644 --- a/sfx2/source/inc/iframe.hxx +++ b/sfx2/source/inc/iframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,5 @@ public: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/intro.hxx b/sfx2/source/inc/intro.hxx index 1b09008c0778..8eb741bc7a97 100644 --- a/sfx2/source/inc/intro.hxx +++ b/sfx2/source/inc/intro.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,3 +54,4 @@ public: #endif // #ifndef _SFX_INTRO_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/mailmodel.hxx b/sfx2/source/inc/mailmodel.hxx index 148c99095edb..1a8193111470 100644 --- a/sfx2/source/inc/mailmodel.hxx +++ b/sfx2/source/inc/mailmodel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,5 @@ public: sal_Bool CreateFromAddress_Impl( String& rFrom ); #endif // INCLUDED_SFX_MAILMODEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/mnucfga.hxx b/sfx2/source/inc/mnucfga.hxx index 609661e638e9..72884e319bc3 100644 --- a/sfx2/source/inc/mnucfga.hxx +++ b/sfx2/source/inc/mnucfga.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #define _SFXMNUCFGA_HXX #include <tools/string.hxx> -#ifndef _SFXMINARRAY_HXX #include <sfx2/minarray.hxx> -#endif //================================================================== @@ -40,7 +39,7 @@ struct SfxMenuCfgItem { sal_uInt16 nId; // id of the binding or 0 if none String aTitle; // title of the item - String aHelpText; // Hilfetext + String aHelpText; String aCommand; SfxMenuCfgItemArr* pPopup; // pointer to a popup menu (if any) }; @@ -50,3 +49,4 @@ DECL_PTRARRAY(SfxMenuCfgItemArr, SfxMenuCfgItem*, 4, 4 ) #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/nfltdlg.hxx b/sfx2/source/inc/nfltdlg.hxx index 09a5c0a2c5ec..2a1e6b421bdd 100644 --- a/sfx2/source/inc/nfltdlg.hxx +++ b/sfx2/source/inc/nfltdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <vcl/dialog.hxx> #include <vcl/lstbox.hxx> -#ifndef _SV_BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif #include <vcl/fixed.hxx> class SfxFilterMatcher; @@ -64,3 +63,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/nochaos.hxx b/sfx2/source/inc/nochaos.hxx index daa06f8e4371..473980578742 100644 --- a/sfx2/source/inc/nochaos.hxx +++ b/sfx2/source/inc/nochaos.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/objmnctl.hxx b/sfx2/source/inc/objmnctl.hxx index cac1da05fd48..4d744ccd957c 100644 --- a/sfx2/source/inc/objmnctl.hxx +++ b/sfx2/source/inc/objmnctl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #define _SFX_OBJMNCTL_HXX -#ifndef _SFX_HXX #include <sfx2/mnuitem.hxx> -#endif class SfxBindings; class PopupMenu; @@ -54,3 +53,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index b5087fb46294..023031334fd3 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,8 +28,6 @@ #ifndef _SFX_OBJSHIMP_HXX #define _SFX_OBJSHIMP_HXX -//#include <hash_map> - #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> @@ -79,18 +78,18 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_uInt16 nVisualDocumentNumber; sal_Int16 nDocumentSignatureState; sal_Int16 nScriptingSignatureState; - sal_Bool bInList:1, // ob per First/Next erreichbar - bClosing:1, // sal_True w"aehrend Close(), um Benachrichtigungs-Rekursionen zu verhindern + sal_Bool bInList:1, // if reachable by First/Next + bClosing:1, // sal_True while Close(), to prevent recurrences Notification bIsSaving:1, bPasswd:1, bIsTmp:1, bIsNamedVisible:1, bIsTemplate:1, - bIsAbortingImport:1, // Importvorgang soll abgebrochen werden. - bImportDone : 1, //Import schon fertig? Fuer AutoReload von Docs. + bIsAbortingImport:1, // Import operation should be canceled. + bImportDone : 1, // Import finished already? For auto reload of Docs. bInPrepareClose : 1, bPreparedForClose : 1, - bWaitingForPicklist : 1,// Muss noch in die Pickliste + bWaitingForPicklist : 1, // Must go into pick list bForbidReload : 1, bBasicInitialized :1, bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! @@ -108,12 +107,13 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bUseUserData:1, bSaveVersionOnClose:1, m_bSharedXMLFlag:1, // whether the flag should be stored in xml file - m_bAllowShareControlFileClean:1; // whether the flag should be stored in xml file + m_bAllowShareControlFileClean:1, // whether the flag should be stored in xml file + m_bConfigOptionsChecked:1; // whether or not the user options are checked after the Options dialog is closed. IndexBitSet aBitSet; sal_uInt32 lErr; - sal_uInt16 nEventId; // falls vor Activate noch ein - // Open/Create gesendet werden mu/s + sal_uInt16 nEventId; // If Open/Create as to be sent + // before Activate AutoReloadTimer_Impl *pReloadTimer; MarkData_Impl* pMarkData; sal_uInt16 nLoadedFlags; @@ -174,3 +174,4 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/openflag.hxx b/sfx2/source/inc/openflag.hxx index 5b719095eae8..7d9d881dc709 100644 --- a/sfx2/source/inc/openflag.hxx +++ b/sfx2/source/inc/openflag.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,15 +28,16 @@ #ifndef _SFX_OPENFLAG_HXX #define _SFX_OPENFLAG_HXX -// Datei zum Bearbeiten "offnen, anschliessend funktioniert nur noch -// die dritte Variante (Lesen einer Kopie) +// Open file for editing, then only the third option (reading a copy) works #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 +// I work on the original, not a copy +// -> file then can not be opened for editing #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 +// Someone else is editing the file, a copy it created +// -> the file can then be opened for editing #define SFX_STREAM_READONLY_MAKECOPY (STREAM_READ | STREAM_SHARE_DENYNONE) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/ownsubfilterservice.hxx b/sfx2/source/inc/ownsubfilterservice.hxx index f800e1e253ae..51bdaf23d35a 100644 --- a/sfx2/source/inc/ownsubfilterservice.hxx +++ b/sfx2/source/inc/ownsubfilterservice.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#ifndef _COM_SUN_STAR_LANG_XPSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/io/XStream.hpp> @@ -88,3 +87,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx index 4a485e3cc91f..269d879e3414 100644 --- a/sfx2/source/inc/partwnd.hxx +++ b/sfx2/source/inc/partwnd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -88,3 +89,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/plugin.hxx b/sfx2/source/inc/plugin.hxx index a9d3ce2f1e72..852e32b80449 100644 --- a/sfx2/source/inc/plugin.hxx +++ b/sfx2/source/inc/plugin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,5 @@ public: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/preview.hxx b/sfx2/source/inc/preview.hxx index f247a2570cf9..483e651fa604 100644 --- a/sfx2/source/inc/preview.hxx +++ b/sfx2/source/inc/preview.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #include <sfx2/basedlgs.hxx> class SfxObjectShell; -//REMOVE class SvStorageRef; class SfxFrameWindow; class SfxFrame; @@ -71,3 +71,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx index b8e5bb35068c..c9458310e464 100644 --- a/sfx2/source/inc/recfloat.hxx +++ b/sfx2/source/inc/recfloat.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -67,3 +68,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/referers.hxx b/sfx2/source/inc/referers.hxx index 6c938861d013..cf58771396d1 100644 --- a/sfx2/source/inc/referers.hxx +++ b/sfx2/source/inc/referers.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,3 +35,5 @@ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index 615445bd919e..f2afb54b161c 100644..100755 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -63,9 +63,7 @@ // Images ---------------------------------------------------------------- #define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 0) -#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 1) #define SFX_IMG_CLOSE_DOC (RID_SFX_SFXLOCAL_START + 2) -#define SFX_IMG_CLOSE_DOC_HC (RID_SFX_SFXLOCAL_START + 3) #endif diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx index 830ba2e3b810..2ac9d8b2d2c5 100644 --- a/sfx2/source/inc/sfxpicklist.hxx +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,6 @@ class SfxPickList : public SfxListener }; static SfxPickList* pUniqueInstance; - static osl::Mutex* pMutex; std::vector< PickListEntry* > m_aPicklistVector; sal_uInt32 m_nAllowedMenuSize; @@ -61,17 +61,13 @@ class SfxPickList : public SfxListener SfxPickList( sal_uInt32 nMenuSize ); ~SfxPickList(); - static osl::Mutex* GetOrCreateMutex(); - void CreatePicklistMenuTitle( Menu* pMenu, sal_uInt16 nItemId, const String& aURL, sal_uInt32 nNo ); PickListEntry* GetPickListEntry( sal_uInt32 nIndex ); void CreatePickListEntries(); void RemovePickListEntries(); public: - static SfxPickList* GetOrCreate( const sal_uInt32 nMenuSize ); - static SfxPickList* Get(); - static void Delete(); + static SfxPickList& Get(); sal_uInt32 GetAllowedMenuSize() { return m_nAllowedMenuSize; } sal_uInt32 GetNumOfEntries() const { return m_aPicklistVector.size(); } @@ -84,3 +80,5 @@ class SfxPickList : public SfxListener }; #endif // _SFX_PICKLIST_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxtypes.hxx b/sfx2/source/inc/sfxtypes.hxx index 5c01b0d53259..41f060e4fad7 100644 --- a/sfx2/source/inc/sfxtypes.hxx +++ b/sfx2/source/inc/sfxtypes.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,24 +29,14 @@ #define _SFX_SFXTYPES_HXX #include <tools/debug.hxx> -#ifndef _RC_HXX //autogen #include <tools/rc.hxx> -#endif -#ifndef _RCID_H //autogen #include <tools/rcid.h> -#endif -#ifndef _RESID_HXX //autogen #include <tools/resid.hxx> -#endif #include <tools/link.hxx> -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif #include <vcl/wrkwin.hxx> -#ifndef _VOS_MUTEX_HXX //autogen -#include <vos/mutex.hxx> -#endif +#include <osl/mutex.hxx> #ifndef DELETEZ #define DELETEZ(pPtr) ( delete pPtr, pPtr = 0 ) @@ -64,8 +55,8 @@ class Timer; //------------------------------------------------------------------------ -// Macro fuer den Call-Profiler unter WinNT -// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden +// Macro for the Call-Profiler under WinNT +// with S_CAP a measurement can be started, and stopped with E_CAP #if defined( WNT ) && defined( PROFILE ) extern "C" { @@ -113,7 +104,7 @@ String SfxShellIdent_Impl( const SfxShell *pSh ); //------------------------------------------------------------------------ -#if defined(DBG_UTIL) && ( defined(WNT) || defined(OS2) ) +#if defined(DBG_UTIL) && defined(WNT) class SfxStack { @@ -191,3 +182,4 @@ public: #endif // #ifndef _SFX_SFXTYPES_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx index 5ab1125b7cb6..83ade822a9cb 100644 --- a/sfx2/source/inc/sfxurlrelocator.hxx +++ b/sfx2/source/inc/sfxurlrelocator.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,4 @@ private: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/slotserv.hxx b/sfx2/source/inc/slotserv.hxx index afef5e926f5f..79431630aa9a 100644 --- a/sfx2/source/inc/slotserv.hxx +++ b/sfx2/source/inc/slotserv.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,3 +83,5 @@ inline const SfxSlot* SfxSlotServer::GetSlot() const #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx index 4c4ad9cf9390..00794ae944d8 100644 --- a/sfx2/source/inc/splitwin.hxx +++ b/sfx2/source/inc/splitwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,9 +28,7 @@ #ifndef _SFXSPLITWIN_HXX #define _SFXSPLITWIN_HXX -#ifndef _SPLITWIN_HXX //autogen #include <vcl/splitwin.hxx> -#endif #include <sfx2/childwin.hxx> class SfxWorkWindow; @@ -131,3 +130,4 @@ public: #endif // #ifndef _SFXSPLITWIN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx index 19e1c3e12587..4ac20e430dd3 100644 --- a/sfx2/source/inc/statcach.hxx +++ b/sfx2/source/inc/statcach.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,13 +39,9 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <cppuhelper/weak.hxx> -#ifndef _SFXBINDINGS_HXX #include <sfx2/bindings.hxx> -#endif -#ifndef _SFXMSGSERV_HXX #include "slotserv.hxx" -#endif #include <sfx2/sfxuno.hxx> @@ -84,17 +81,17 @@ friend class BindDispatch_Impl; sal_uInt16 nId; // Slot-Id SfxControllerItem* pInternalController; com::sun::star::uno::Reference < com::sun::star::frame::XDispatch > xMyDispatch; - SfxControllerItem* pController; // Ptr auf 1. gebundenen Controller (untereinander verkettet) - SfxSlotServer aSlotServ; // SlotServer, SlotPtr = 0 -> Nicht auf Stack - SfxPoolItem* pLastItem; // zuletzt verschicktes Item, nie -1 - SfxItemState eLastState; // zuletzt verschickter State - sal_Bool bCtrlDirty:1; // Controller aktualisiert? - sal_Bool bSlotDirty:1; // Funktion gfs. vorhanden, muss aktualisiert werden - sal_Bool bItemVisible:1;// item visibility - sal_Bool bItemDirty; // G"ultigkeit von pLastItem + SfxControllerItem* pController; // Pointer to first bound Controller (interlinked with each other) + SfxSlotServer aSlotServ; // SlotServer, SlotPtr = 0 -> not on Stack + SfxPoolItem* pLastItem; // Last sent Item, never -1 + SfxItemState eLastState; // Last sent State + sal_Bool bCtrlDirty:1; // Update Controller? + sal_Bool bSlotDirty:1; // Present Funktion, must be updated + sal_Bool bItemVisible:1; // item visibility + sal_Bool bItemDirty; // Validity of pLastItem private: - SfxStateCache( const SfxStateCache& rOrig ); // n.i. + SfxStateCache( const SfxStateCache& rOrig ); // inward void SetState_Impl( SfxItemState, const SfxPoolItem*, sal_Bool bMaybeDirty=sal_False ); public: @@ -134,14 +131,6 @@ public: //-------------------------------------------------------------------- -// checks wheather this function is in the stack of active SfxObjectInterface - -//inline sal_Bool SfxStateCache::IsCallable( SfxDispatcher &rDispat ) -//{ -// return GetSlotServer(rDispat) != 0; -//} -//-------------------------------------------------------------------- - // clears Cached-Item inline void SfxStateCache::ClearCache() @@ -180,3 +169,5 @@ inline sal_uInt16 SfxStateCache::GetId() const } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 64c9b539d2be..aa4c7a05776b 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,15 +30,9 @@ class SfxTemplateControllerItem; -#ifndef _BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif -#ifndef _TOOLBOX_HXX //autogen #include <vcl/toolbox.hxx> -#endif -#ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> -#endif #include <svl/lstner.hxx> #include <svtools/svtreebx.hxx> #include <svl/eitem.hxx> @@ -55,6 +50,7 @@ class SfxStyleFamilies; class SfxStyleFamilyItem; class SfxTemplateItem; class SfxBindings; +class SfxStyleSheetBase; class SfxStyleSheetBasePool; class SvTreeListBox ; class StyleTreeListBox_Impl; @@ -166,9 +162,9 @@ protected: ListBox aFilterLb; Size aSize; - sal_uInt16 nActFamily; // Id in der ToolBox = Position - 1 + sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1 sal_uInt16 nActFilter; // FilterIdx - sal_uInt16 nAppFilter; // Filter, den die Applikation gesetzt hat (fuer automatisch) + sal_uInt16 nAppFilter; // Filter, which has set the application (for automatic) sal_Bool bDontUpdate :1, bIsWater :1, @@ -213,7 +209,7 @@ protected: void UpdateStyles_Impl(sal_uInt16 nFlags); const SfxStyleFamilyItem* GetFamilyItem_Impl() const; - sal_Bool IsInitialized() { return nActFamily != 0xffff; } + sal_Bool IsInitialized() const { return nActFamily != 0xffff; } void ResetFocus(); void EnableDelete(); void Initialize(); @@ -223,13 +219,14 @@ protected: void SetWaterCanState( const SfxBoolItem* pItem ); void SelectStyle( const String& rStyle ); - sal_Bool HasSelectedStyle() const; + sal_Bool HasSelectedStyle() const; + SfxStyleSheetBase *GetSelectedStyle() const; void FillTreeBox(); void Update_Impl(); void UpdateFamily_Impl(); - // In welchem FamilyState muss ich nachsehen, um die Info der i-ten - // Family in der pStyleFamilies zu bekommen. + // In which FamilyState do I have to look , in order to get the + // information of the ith Family in the pStyleFamilies. sal_uInt16 StyleNrToInfoOffset( sal_uInt16 i ); sal_uInt16 InfoOffsetToStyleNr( sal_uInt16 i ); @@ -274,14 +271,11 @@ public: // normaly for derivates from SvTreeListBoxes, but in this case the dialog handles context menus virtual PopupMenu* CreateContextMenu( void ); - // Rechnet von den SFX_STYLE_FAMILY Ids auf 1-5 um + // converts from SFX_STYLE_FAMILY Ids to 1-5 static sal_uInt16 SfxFamilyIdToNId( SfxStyleFamily nFamily ); void SetAutomaticFilter(); }; -/* -----------------10.12.2003 11:42----------------- - - --------------------------------------------------*/ class DropToolBox_Impl : public ToolBox, public DropTargetHelper { @@ -392,3 +386,4 @@ friend class SfxTemplateCatalog; #endif // #ifndef _SFX_TEMPDLGI_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/tplcitem.hxx b/sfx2/source/inc/tplcitem.hxx index af2ede51701d..ee02d409ffc0 100644 --- a/sfx2/source/inc/tplcitem.hxx +++ b/sfx2/source/inc/tplcitem.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/tplcomp.hxx b/sfx2/source/inc/tplcomp.hxx index c172efb15d87..ba090e87cb67 100644 --- a/sfx2/source/inc/tplcomp.hxx +++ b/sfx2/source/inc/tplcomp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,15 +30,6 @@ #define _TPLCOMP_HXX #include <osl/mutex.hxx> -//ASDBG #ifndef _USR_UNO_HXX -//ASDBG #include <usr/uno.hxx> -//ASDBG #endif -//ASDBG #ifndef _USR_LSTCOMP_HXX -//ASDBG #include <usr/iterhlp.hxx> -//ASDBG #endif -//ASDBG #ifndef _USR_SERVICES_HXX -//ASDBG #include <usr/services.hxx> -//ASDBG #endif #include <com/sun/star/chaos/XCommandExecutor.hpp> #include <com/sun/star/chaos/XStatusCallback.hpp> #include <com/sun/star/chaos/UnknownCommandException.hpp> @@ -222,3 +214,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index 0203d7744e9e..d70e9046f3f4 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,15 +29,9 @@ #ifndef _VERSDLG_HXX #define _VERSDLG_HXX -// #include ***************************************************************** - -#ifndef _SV_BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif #include <vcl/fixed.hxx> -#ifndef _SVTREEBOX_HXX //autogen #include <svtools/svtabbx.hxx> -#endif #include <svtools/svmedit.hxx> #include <sfx2/basedlgs.hxx> @@ -107,3 +102,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/virtmenu.hxx b/sfx2/source/inc/virtmenu.hxx index c54a627e2a78..3d3270d51a37 100644 --- a/sfx2/source/inc/virtmenu.hxx +++ b/sfx2/source/inc/virtmenu.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,7 +54,7 @@ private: PopupMenu* pWindowMenu; PopupMenu* pPickMenu; PopupMenu* pAddonsMenu; - Timer* pAutoDeactivate; // Hack fuer QAP-Bug + Timer* pAutoDeactivate; // Hack for QAP-Bug sal_uInt16 nVisibleItems; sal_uInt16 nId; sal_uInt16 nCount; @@ -63,12 +64,11 @@ private: sal_Bool bHelpInitialized : 1; sal_Bool bIsActive : 1; sal_Bool bControllersUnBound : 1; - sal_Bool bWasHighContrast : 1; sal_Bool bIsAddonPopupMenu : 1; private: void Construct_Impl(); - bool Bind_Impl( Menu *pMenu ); + bool Bind_Impl( Menu *pMenu ); inline SfxMenuCtrlArr_Impl& GetAppCtrl_Impl() { return pAppCtrl? *pAppCtrl: *(pAppCtrl = new SfxMenuCtrlArr_Impl) ; @@ -108,9 +108,7 @@ public: sal_uInt16 GetItemId( sal_uInt16 nPos ) const; SfxVirtualMenu* GetPopupMenu( sal_uInt16 nId ) const; String GetItemText( sal_uInt16 nId ) const; - String GetItemHelpText( sal_uInt16 nId ) const; - //void InvalidateKeyCodes(); SfxVirtualMenu* GetParentMenu() const { return pParent; } void SetParentMenu( SfxVirtualMenu* pNewParent ) @@ -124,7 +122,6 @@ public: void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; } ResMgr* GetResMgr() { return pResMgr; } void SetHelpIds( ResMgr* ); - sal_Bool IsHiContrastMode() const; void UpdateImages(); DECL_LINK( Select, Menu * ); @@ -140,7 +137,6 @@ inline sal_uInt16 SfxVirtualMenu::GetItemCount() const } //-------------------------------------------------------------------- -// inline SfxMenuControl& SfxVirtualMenu::operator[]( sal_uInt16 nPos ) const { @@ -157,3 +153,5 @@ inline sal_uInt16 SfxVirtualMenu::GetItemId( sal_uInt16 nPos ) const #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index 8c06e1233297..0acaf892f93b 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,18 +32,16 @@ #include <deque> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XFrame.hpp> -#ifndef _COM_SUN_STAR_UI_XUILEMENT_HPP_ #include <com/sun/star/ui/XUIElement.hpp> -#endif #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/frame/XLayoutManagerListener.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/propshlp.hxx> -#define _SVSTDARR_USHORTS +#define _SVSTDARR_sal_uInt16S #include <svl/svstdarr.hxx> // SvUShorts #include <rtl/ustring.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <sfx2/sfx.hrc> #include <sfx2/childwin.hxx> @@ -57,12 +56,12 @@ class SfxSplitWindow; class SfxWorkWindow; //==================================================================== -// Dieser struct h"alt alle relevanten Informationen "uber Toolboxen bereit. +// This struct makes all relevant Informationen available of Toolboxes struct SfxObjectBar_Impl { - sal_uInt16 nId; // Resource - und ConfigId der Toolbox - sal_uInt16 nMode; // spezielle Sichtbarkeitsflags + sal_uInt16 nId; // Resource - and ConfigId of Toolbox + sal_uInt16 nMode; // special visibility flags sal_uInt16 nPos; sal_uInt16 nIndex; sal_Bool bDestroy; @@ -78,7 +77,8 @@ struct SfxObjectBar_Impl }; //------------------------------------------------------------------------------ -// Dieser struct h"alt alle relevanten Informationen "uber die Statuszeile bereit. +// This struct makes all relevant Informationen available of the status bar + struct SfxStatBar_Impl { sal_uInt16 nId; @@ -95,9 +95,9 @@ struct SfxStatBar_Impl //------------------------------------------------------------------------------ #define CHILD_NOT_VISIBLE 0 -#define CHILD_ACTIVE 1 // nicht durch HidePopups ausgeschaltet -#define CHILD_NOT_HIDDEN 2 // nicht durch HideChildWindow ausgeschaltet -#define CHILD_FITS_IN 4 // nicht zu gro\s f"ur OutputSize des parent +#define CHILD_ACTIVE 1 // not disabled through HidePopups +#define CHILD_NOT_HIDDEN 2 // not disabled through HideChildWindow +#define CHILD_FITS_IN 4 // not too large for output size of the parent #define CHILD_VISIBLE (CHILD_NOT_HIDDEN | CHILD_ACTIVE | CHILD_FITS_IN) #define CHILD_ISVISIBLE (CHILD_NOT_HIDDEN | CHILD_ACTIVE) @@ -133,13 +133,13 @@ class SfxChildWinController_Impl : public SfxControllerItem struct SfxChildWin_Impl { - sal_uInt16 nSaveId; // die ChildWindow-Id - sal_uInt16 nInterfaceId; // der aktuelle Context - sal_uInt16 nId; // aktuelle Id + sal_uInt16 nSaveId; // the ChildWindow-Id + sal_uInt16 nInterfaceId; // the current context + sal_uInt16 nId; // current Id SfxChildWindow* pWin; sal_Bool bCreate; SfxChildWinInfo aInfo; - SfxChild_Impl* pCli; // != 0 bei direkten Children + SfxChild_Impl* pCli; // != 0 at direct Children sal_uInt16 nVisibility; sal_Bool bEnable; sal_Bool bDisabled; @@ -308,7 +308,7 @@ public: { return pParent; } ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > CreateDispatch( const String& ); - // Methoden f"ur alle Child-Fenster + // Methods for all Child windows void DataChanged_Impl( const DataChangedEvent& rDCEvt ); void ReleaseChild_Impl( Window& rWindow ); SfxChild_Impl* RegisterChild_Impl( Window& rWindow, SfxChildAlignment eAlign, sal_Bool bCanGetFocus=sal_False ); @@ -329,7 +329,7 @@ public: void SetFullScreen_Impl( sal_Bool bSet ) { bIsFullScreen = bSet; } sal_Bool IsFullScreen_Impl() const { return bIsFullScreen; } - // Methoden f"ur Objectbars + // Methods for Objectbars virtual void UpdateObjectBars_Impl(); void ResetObjectBars_Impl(); void SetObjectBar_Impl( sal_uInt16 nPos, sal_uInt32 nResId, @@ -345,7 +345,7 @@ public: sal_uInt16 HasNextObjectBar_Impl( sal_uInt16 nPos, String* pStr=0 ); void SetObjectBarCustomizeMode_Impl( sal_Bool ); - // Methoden f"ur ChildWindows + // Methods for ChildWindows void UpdateChildWindows_Impl(); void ResetChildWindows_Impl(); void SetChildWindowVisible_Impl( sal_uInt32, sal_Bool, sal_uInt16 ); @@ -367,7 +367,7 @@ public: virtual sal_Bool ActivateNextChild_Impl( sal_Bool bForward = sal_True ); bool AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const; - // Methoden f"ur StatusBar + // Methods for StatusBar void SetTempStatusBar_Impl( sal_Bool bSet ); void ResetStatusBar_Impl(); void SetStatusBar_Impl(sal_uInt32 nResId, SfxShell *pShell, SfxBindings& ); @@ -389,3 +389,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index e420f5a04b5b..9504049e5ec5 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,27 +31,17 @@ #include "inettbc.hxx" -#ifndef GCC -#endif #include <com/sun/star/uno/Any.h> -#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPLLIER_HPP_ #include <com/sun/star/frame/XFramesSupplier.hpp> -#endif #include <com/sun/star/task/XInteractionHandler.hpp> #include <svl/eitem.hxx> #include <svl/stritem.hxx> #include <unotools/historyoptions.hxx> #include <svl/folderrestriction.hxx> #include <vcl/toolbox.hxx> -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> -#endif -#ifndef _VOS_THREAD_HXX //autogen -#include <vos/thread.hxx> -#endif -#ifndef _VOS_MUTEX_HXX //autogen -#include <vos/mutex.hxx> -#endif +#include <osl/thread.hxx> +#include <osl/mutex.hxx> #include <rtl/ustring.hxx> #include <svl/itemset.hxx> @@ -123,7 +114,7 @@ void SfxURLToolBoxControl_Impl::OpenURL( const String& rName, sal_Bool /*bNew*/ if ( xDispatchProvider.is() && m_xServiceManager.is() ) { URL aTargetURL; - ::rtl::OUString aTarget( ::rtl::OUString::createFromAscii( "_default" )); + ::rtl::OUString aTarget( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default"))); aTargetURL.Complete = aName; @@ -132,17 +123,17 @@ void SfxURLToolBoxControl_Impl::OpenURL( const String& rName, sal_Bool /*bNew*/ if ( xDispatch.is() ) { Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = ::rtl::OUString::createFromAscii( "Referer" ); - aArgs[0].Value = makeAny( ::rtl::OUString::createFromAscii( SFX_REFERER_USER )); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); + aArgs[0].Value = makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ))); aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" )); aArgs[1].Value = makeAny( ::rtl::OUString( aName )); if ( aFilter.Len() ) { aArgs.realloc( 4 ); - aArgs[2].Name = ::rtl::OUString::createFromAscii( "FilterOptions" ); + aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterOptions")); aArgs[2].Value = makeAny( ::rtl::OUString( aOptions )); - aArgs[3].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); aArgs[3].Value = makeAny( ::rtl::OUString( aFilter )); } @@ -203,7 +194,7 @@ IMPL_LINK( SfxURLToolBoxControl_Impl, OpenHdl, void*, EMPTYARG ) if ( m_xServiceManager.is() ) { Reference< XFramesSupplier > xDesktop( m_xServiceManager->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY ); Reference< XFrame > xFrame( xDesktop->getActiveFrame(), UNO_QUERY ); if ( xFrame.is() ) @@ -247,7 +238,7 @@ void SfxURLToolBoxControl_Impl::StateChanged { if ( nSID == SID_OPENURL ) { - // Disable URL box if command is disabled #111014# + // Disable URL box if command is disabled GetURLBox()->Enable( SFX_ITEM_DISABLED != eState ); } @@ -301,3 +292,4 @@ void SfxURLToolBoxControl_Impl::StateChanged } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/factory.cxx b/sfx2/source/layout/factory.cxx index e572ffb2b76e..a5a00227eecf 100644 --- a/sfx2/source/layout/factory.cxx +++ b/sfx2/source/layout/factory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,7 +58,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow (VCLXWindow** vcl, OUString const& nam { ; } - else if (name.equalsAscii ("sfxmodelessdialog")) + else if (name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sfxmodelessdialog"))) { window = new SfxModelessDialog_unprotect (parent, ImplGetWinBits (attributes, 0)); *vcl = new layoutimpl::VCLXDialog (); @@ -66,3 +67,5 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow (VCLXWindow** vcl, OUString const& nam } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxdialog.cxx b/sfx2/source/layout/sfxdialog.cxx index f3a76c489b7e..e8eb980c0466 100644 --- a/sfx2/source/layout/sfxdialog.cxx +++ b/sfx2/source/layout/sfxdialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,3 +37,5 @@ SfxDialog::SfxDialog(::Window* parent, char const* xml_file, char const* id, Sfx } } // end namespace layout + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxtabdialog.cxx b/sfx2/source/layout/sfxtabdialog.cxx index 7909d404b524..da2dc738ae4e 100644 --- a/sfx2/source/layout/sfxtabdialog.cxx +++ b/sfx2/source/layout/sfxtabdialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,3 +71,5 @@ using namespace ::com::sun::star; #define TabDlgCmpUS_Impl layout__TabDlgCmpUS_Impl #include "../dialog/tabdlg.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/layout/sfxtabpage.cxx b/sfx2/source/layout/sfxtabpage.cxx index 7df739a38bb3..7c40d6f0b190 100644 --- a/sfx2/source/layout/sfxtabpage.cxx +++ b/sfx2/source/layout/sfxtabpage.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,29 +36,6 @@ namespace layout using namespace ::com::sun::star; -#if 0 -SfxTabDialog::SfxTabDialog (::Window *parent, char const* xml_file, char const* id, ResId const& res_id, SfxItemSet const* set) - : ::SfxTabDialog (parent, res_id, set) - , InPlug (parent, xml_file, id) -{ -} - -::Window* SfxTabDialog::GetParent () const -{ - return Window::GetParent (); -} - -::Window* SfxTabDialog::GetWindow () const -{ - return Window::GetParent (); -} - -void SfxTabDialog::FreeResource () -{ - //::Window::FreeResource (); -} -#endif - SfxTabPage::SfxTabPage (::Window *parent, char const* xml_file, char const* id, SfxItemSet const* set) : ::SfxTabPage (parent, 0, *set) , InPlug (parent, xml_file, id) @@ -77,7 +55,6 @@ SfxTabPage::SfxTabPage (::Window *parent, char const* xml_file, char const* id, void SfxTabPage::FreeResource () { - //::Window::FreeResource (); } Size SfxTabPage::GetOptimalSize (WindowSizeType) const @@ -87,3 +64,5 @@ Size SfxTabPage::GetOptimalSize (WindowSizeType) const } } // end namespace layout + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/menu.hrc b/sfx2/source/menu/menu.hrc index b437f797c26e..b437f797c26e 100644..100755 --- a/sfx2/source/menu/menu.hrc +++ b/sfx2/source/menu/menu.hrc diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index c93fa116172b..b34625820fae 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,32 +30,25 @@ #include "precompiled_sfx2.hxx" #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 includes +#include <string> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <com/sun/star/util/XURLTransformer.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <tools/urlobj.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> #include <svtools/imagemgr.hxx> #include <svtools/menuoptions.hxx> #include <framework/menuconfiguration.hxx> -#ifndef GCC -#endif #include <sfx2/app.hxx> #include <sfx2/sfx.hrc> @@ -144,13 +138,11 @@ void SfxMenuControl::Bind( SfxVirtualMenu* pOwn, sal_uInt16 nSlotId, const String& rTitle, - const String &rHelpText, SfxBindings &rBindings ) { DBG_MEMTEST(); aTitle = rTitle; - aHelpText = rHelpText; pOwnMenu = pOwn; pSubMenu = 0; if ( pOwn ) @@ -171,7 +163,6 @@ void SfxMenuControl::Bind( sal_uInt16 nSlotId, SfxVirtualMenu& rMenu, const String& rTitle, - const String &rHelpText, SfxBindings &rBindings ) { DBG_MEMTEST(); @@ -180,12 +171,11 @@ void SfxMenuControl::Bind( pOwnMenu = pOwn; pSubMenu = &rMenu; aTitle = rTitle; - aHelpText = rHelpText; } //-------------------------------------------------------------------- -// ctor for explicit registration +// Constructor for explicit registration SfxMenuControl::SfxMenuControl( sal_Bool bShowStrings ) : pOwnMenu(0), @@ -197,8 +187,7 @@ SfxMenuControl::SfxMenuControl( sal_Bool bShowStrings ) //-------------------------------------------------------------------- -// ctor for array - +// Constructor for array SfxMenuControl::SfxMenuControl(): pOwnMenu(0), pSubMenu(0), @@ -217,18 +206,16 @@ SfxMenuControl::SfxMenuControl(sal_uInt16 nSlotId, SfxBindings& rBindings): { DBG_MEMTEST(); - // Dieser Ctor soll es erm"oglichen, w"ahrend der Konstruktion schon - // auf die Bindings zur"uckgreifen zu k"onnen, aber gebunden wird - // wie immer erst sp"ater. Anwendung z.B. wenn im ctor der abgeleiteten - // Klasse z.B. ein StatusForwarder erzeugt werden soll. + // This constructor should make it possible already during the design + // to fall back to the bindings, but can as always be bound later. + // The usefullness of this is for example if a StatusForwarder should + // be created in the constructor of a derived class. UnBind(); } //-------------------------------------------------------------------- -// dtor - SfxMenuControl::~SfxMenuControl() { delete pSubMenu; @@ -250,7 +237,7 @@ void SfxMenuControl::StateChanged const SfxPoolItem* pState ) { - (void)nSID; //unused + (void)nSID; DBG_MEMTEST(); DBG_ASSERT( nSID == GetId(), "strange SID" ); DBG_ASSERT( pOwnMenu != 0, "setting state to dangling SfxMenuControl" ); @@ -258,7 +245,7 @@ void SfxMenuControl::StateChanged bool bIsObjMenu = GetId() >= SID_OBJECTMENU0 && GetId() < SID_OBJECTMENU_LAST; - // enabled/disabled-Flag pauschal korrigieren + // Fix inclusion of enabled/disabled-Flag #ifdef UNIX if (nSID == SID_PASTE) @@ -271,27 +258,21 @@ void SfxMenuControl::StateChanged if ( eState != SFX_ITEM_AVAILABLE ) { - // checken nur bei nicht-Object-Menus + // check only for non-Object Menus if ( !bIsObjMenu ) pOwnMenu->CheckItem( GetId(), sal_False ); - // SetItemText flackert in MenuBar insbes. unter OS/2 (Bug #20658) - if ( // !bIsObjMenu && nicht wegen "Format/Datenbank" - pOwnMenu->GetSVMenu()->GetItemText( GetId() ) != GetTitle() ) + if ( pOwnMenu->GetSVMenu()->GetItemText( GetId() ) != GetTitle() ) { DBG_WARNING("Title of menu item changed - please check if this needs correction!"); - // pOwnMenu->SetItemText( GetId(), GetTitle() ); } return; } - // ggf. das alte Enum-Menu entfernen/loeschen - //! delete pOwnMenu->GetMenu().ChangePopupMenu( GetId(), 0 ); - bool bCheck = false; if ( pState->ISA(SfxBoolItem) ) { - // BoolItem fuer checken + // BoolItem for check DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, "SfxBoolItem not allowed for SID_OBJECTMENUx" ); bCheck = ((const SfxBoolItem*)pState)->GetValue(); @@ -299,14 +280,14 @@ void SfxMenuControl::StateChanged else if ( pState->ISA(SfxEnumItemInterface) && ((SfxEnumItemInterface *)pState)->HasBoolValue() ) { - // EnumItem wie Bool behandeln + // Treat EnumItem as Bool DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, "SfxEnumItem not allowed for SID_OBJECTMENUx" ); bCheck = ((SfxEnumItemInterface *)pState)->GetBoolValue(); } else if ( ( b_ShowStrings || bIsObjMenu ) && pState->ISA(SfxStringItem) ) { - // MenuText aus SfxStringItem holen + // Get MenuText from SfxStringItem String aStr( ((const SfxStringItem*)pState)->GetValue() ); if ( aStr.CompareToAscii("($1)",4) == COMPARE_EQUAL ) { @@ -445,7 +426,6 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl( // Determine the current background color setting for menus const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); m_nSymbolsStyle = rSettings.GetSymbolsStyle(); - m_bWasHiContrastMode = rSettings.GetHighContrastMode(); m_bShowMenuImages = rSettings.GetUseImagesInMenus(); Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); @@ -471,15 +451,12 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); sal_uIntPtr nSymbolsStyle = rSettings.GetSymbolsStyle(); - sal_Bool bIsHiContrastMode = rSettings.GetHighContrastMode(); sal_Bool bShowMenuImages = rSettings.GetUseImagesInMenus(); if (( nSymbolsStyle != m_nSymbolsStyle ) || - ( bIsHiContrastMode != m_bWasHiContrastMode ) || ( bShowMenuImages != m_bShowMenuImages )) { m_nSymbolsStyle = nSymbolsStyle; - m_bWasHiContrastMode = bIsHiContrastMode; m_bShowMenuImages = bShowMenuImages; sal_uInt16 nCount = pActMenu->GetItemCount(); @@ -501,7 +478,7 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu ) if ( aImageId.getLength() > 0 ) { Reference< ::com::sun::star::frame::XFrame > xFrame; - Image aImage = GetImage( xFrame, aImageId, sal_False, bIsHiContrastMode ); + Image aImage = GetImage( xFrame, aImageId, false ); if ( !!aImage ) { bImageSet = sal_True; @@ -513,7 +490,7 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu ) if ( !bImageSet && aCmd.Len() ) { Image aImage = SvFileInformationManager::GetImage( - INetURLObject(aCmd), sal_False, bIsHiContrastMode ); + INetURLObject(aCmd), false ); if ( !!aImage ) pActMenu->SetItemImage( nItemId, aImage ); } @@ -537,18 +514,17 @@ SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, } SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, - sal_uInt16 nId, Menu& rMenu, const String& sItemText, const String& sHelpText, + sal_uInt16 nId, Menu& rMenu, const String& sItemText, SfxBindings& rBindings, SfxVirtualMenu* pVirt) { - return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, sHelpText, rBindings, pVirt); + return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, rBindings, pVirt); } SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, sal_uInt16 nSlotId, Menu& rMenu, SfxBindings& rBindings, SfxVirtualMenu* pVirt ) : SfxMenuControl( nSlotId, rBindings ) { - Bind( pVirt, nSlotId, rMenu.GetItemText(nSlotId), - rMenu.GetHelpText(nSlotId), rBindings); + Bind( pVirt, nSlotId, rMenu.GetItemText(nSlotId), rBindings); UnBind(); pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); pUnoCtrl->acquire(); @@ -557,11 +533,11 @@ SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, sal_uInt16 nSlotId, SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, sal_uInt16 nSlotId, Menu& /*rMenu*/, - const String& rItemText, const String& rHelpText, + const String& rItemText, SfxBindings& rBindings, SfxVirtualMenu* pVirt) : SfxMenuControl( nSlotId, rBindings ) { - Bind( pVirt, nSlotId, rItemText, rHelpText, rBindings); + Bind( pVirt, nSlotId, rItemText, rBindings); UnBind(); pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); pUnoCtrl->acquire(); @@ -578,3 +554,5 @@ void SfxUnoMenuControl::Select() { pUnoCtrl->Execute(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index ed3bd40fb558..b82aeeb6bd6f 100755..100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,18 +34,13 @@ #include <com/sun/star/container/XNamed.hpp> #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 +#include <string> #include <cstdarg> // std::va_list -#ifndef _POINTR_HXX //autogen #include <vcl/pointr.hxx> -#endif -#ifndef GCC -#endif #include <unotools/streamwrap.hxx> #include <sfx2/objsh.hxx> @@ -164,13 +160,11 @@ void InsertVerbs_Impl( SfxBindings* pBindings, const com::sun::star::uno::Sequen if ( !(aVerbs[n].VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU) ) continue; - // neue Id vergeben sal_uInt16 nId = SID_VERB_START + nr++; - DBG_ASSERT(nId <= SID_VERB_END, "Zuviele Verben!"); + DBG_ASSERT(nId <= SID_VERB_END, "Too many verbs!"); if ( nId > SID_VERB_END ) break; - // einf"ugen pMenu->InsertItem( nId, aVerbs[n].VerbName ); } } @@ -199,9 +193,9 @@ static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl ) PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) { - // + // build thesaurus sub menu if look-up string is available - // + PopupMenu* pThesSubMenu = 0; SfxPoolItem *pItem = 0; pBindings->QueryState( SID_THES, pItem ); @@ -230,11 +224,10 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) if (nNumSynonyms > 0) { SvtLinguConfig aCfg; - const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); Image aImage; String sThesImplName( aHelper.GetThesImplName( aLocale ) ); - ::rtl::OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName, bHC ) ); + ::rtl::OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName ) ); if (sThesImplName.Len() > 0 && aSynonymsImageUrl.getLength() > 0) aImage = Image( lcl_GetImageFromPngUrl( aSynonymsImageUrl ) ); @@ -245,7 +238,7 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) String aItemText( linguistic::GetThesaurusReplaceText( aSynonyms[i] ) ); pThesSubMenu->InsertItem( nId, aItemText ); - ::rtl::OUString aCmd( ::rtl::OUString::createFromAscii( ".uno:ThesaurusFromContext?WordReplace:string=" ) ); + ::rtl::OUString aCmd(RTL_CONSTASCII_USTRINGPARAM(".uno:ThesaurusFromContext?WordReplace:string=") ); aCmd += aItemText; pThesSubMenu->SetItemCommand( nId, aCmd ); @@ -261,7 +254,7 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) pThesSubMenu->InsertSeparator(); const String sThesaurus( SfxResId( STR_MENU_THESAURUS ) ); pThesSubMenu->InsertItem( 100, sThesaurus ); - pThesSubMenu->SetItemCommand( 100, ::rtl::OUString::createFromAscii( ".uno:ThesaurusDialog" ) ); + pThesSubMenu->SetItemCommand( 100, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:ThesaurusDialog")) ); pSVMenu->InsertSeparator(); const String sSynonyms( SfxResId( STR_MENU_SYNONYMS ) ); @@ -292,7 +285,6 @@ void SfxMenuManager::UseDefault() ResId aResId(GetType(),*pResMgr); aResId.SetRT(RSC_MENU); Menu *pSVMenu = new PopupMenu( aResId ); - //SfxMenuManager::EraseItemCmds( pSVMenu ); // Remove .uno cmds to be compatible with 6.0/src641 if ( bAddClipboardFuncs ) { @@ -368,7 +360,7 @@ void SfxMenuManager::Construct_Impl( Menu* pSVMenu, sal_Bool bWithHelp ) SfxVirtualMenu *pOldVirtMenu=0; if ( pMenu ) { - // Es wird umkonfiguriert + // It is reconfigured pOldVirtMenu = pMenu; pBindings->ENTERREGISTRATIONS(); } @@ -638,3 +630,4 @@ Menu* SfxPopupMenuManager::GetSVMenu() return (Menu*) GetMenu()->GetSVMenu(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/objmnctl.cxx b/sfx2/source/menu/objmnctl.cxx index 639669ab90c3..1042d48bf354 100644 --- a/sfx2/source/menu/objmnctl.cxx +++ b/sfx2/source/menu/objmnctl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,15 +31,8 @@ #include <com/sun/star/embed/VerbDescriptor.hpp> #include <com/sun/star/embed/VerbAttributes.hpp> -#include <tools/list.hxx> -#ifndef _MENU_HXX //autogen #include <vcl/menu.hxx> -#endif -#ifndef _SXSTRITEM_HXX //autogen #include <svl/stritem.hxx> -#endif -#ifndef GCC -#endif #include <sfx2/sfxsids.hrc> #include "objmnctl.hxx" @@ -55,8 +49,8 @@ using namespace com::sun::star; //-------------------------------------------------------------------- /* - Ctor; setzt Select-Handler am Menu und traegt Menu - in seinen Parent ein. + Constructor; sets the Select-Handler for the Menu and inserts it into + its Parent. */ SfxObjectVerbsControl::SfxObjectVerbsControl(sal_uInt16 nSlotId, Menu &rMenu, SfxBindings &rBindings) @@ -72,7 +66,7 @@ SfxObjectVerbsControl::SfxObjectVerbsControl(sal_uInt16 nSlotId, Menu &rMenu, Sf //-------------------------------------------------------------------- /* - Fuellt das Menu mit den aktuellen Verben aus der ViewShell. + Make up a menu with the current view of the verbs from ViewShell. */ void SfxObjectVerbsControl::FillMenu() @@ -96,7 +90,7 @@ void SfxObjectVerbsControl::FillMenu() if ( !(aVerbs[n].VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU) ) continue; - DBG_ASSERT(nSlotId <= SID_VERB_END, "Zuviele Verben!"); + DBG_ASSERT(nSlotId <= SID_VERB_END, "Too many Verbs!"); if (nSlotId > SID_VERB_END) break; @@ -111,11 +105,10 @@ void SfxObjectVerbsControl::FillMenu() //-------------------------------------------------------------------- /* - Statusbenachrichtigung; - fuellt gfs. das Menu mit den aktuellen Verben aus der ViewShell. - der DocumentShell. - Ist die Funktionalit"at disabled, wird der entsprechende - Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. + Status notification: + Fill the menu with the current verbs from the ViewShell of the + the DocumentShell. If the functionality is disabled, the corresponding + menu entry in Parent menu is disabled, otherwise it is enabled. */ void SfxObjectVerbsControl::StateChanged( @@ -131,8 +124,8 @@ void SfxObjectVerbsControl::StateChanged( //-------------------------------------------------------------------- /* - Select-Handler des Menus; - das selektierte Verb mit ausgef"uhrt, + Select-Handler for Menus; + run the selected Verb, */ IMPL_LINK_INLINE_START( SfxObjectVerbsControl, MenuSelect, Menu *, pSelMenu ) @@ -147,7 +140,7 @@ IMPL_LINK_INLINE_END( SfxObjectVerbsControl, MenuSelect, Menu *, pSelMenu ) //-------------------------------------------------------------------- /* - Dtor; gibt das Menu frei. + Destructor; releases the Menu. */ SfxObjectVerbsControl::~SfxObjectVerbsControl() @@ -163,3 +156,4 @@ PopupMenu* SfxObjectVerbsControl::GetPopup() const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 501d3e35f326..c6c2eb8bc056 100755..100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: thessubmenu.cxx,v $ - * $Revision: 1.0 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -59,12 +57,11 @@ using ::rtl::OUString; SFX_IMPL_MENU_CONTROL(SfxThesSubMenuControl, SfxStringItem); -//////////////////////////////////////////////////////////// /* - Ctor; setzt Select-Handler am Menu und traegt Menu - in seinen Parent ein. + Constructor; sets the Select-Handler for the Menu and inserts it into + its Parent. */ SfxThesSubMenuControl::SfxThesSubMenuControl( sal_uInt16 nSlotId, Menu &rMenu, SfxBindings &rBindings ) : SfxMenuControl( nSlotId, rBindings ), @@ -85,9 +82,9 @@ SfxThesSubMenuControl::~SfxThesSubMenuControl() /* - Statusbenachrichtigung; - Ist die Funktionalit"at disabled, wird der entsprechende - Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. + Status notification: + If the functionality is disabled, the corresponding + menu entry in Parentmenu is disabled, otherwise it is enabled. */ void SfxThesSubMenuControl::StateChanged( sal_uInt16 /*nSID*/, @@ -99,8 +96,8 @@ void SfxThesSubMenuControl::StateChanged( /* - Select-Handler des Menus; - das selektierte Verb mit ausgef"uhrt, + Select-Handler for Menus; + run the selected Verb, */ IMPL_LINK_INLINE_START( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) { @@ -118,7 +115,6 @@ PopupMenu* SfxThesSubMenuControl::GetPopup() const } -//////////////////////////////////////////////////////////// OUString SfxThesSubMenuHelper::GetText( const String &rLookUpString, @@ -227,7 +223,7 @@ String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) cons if (m_xLngMgr.is()) { uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( - OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.Thesaurus")), rLocale ); // there should be at most one thesaurus configured for each language DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); if (aServiceNames.getLength() == 1) @@ -236,6 +232,6 @@ String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) cons return aRes; } -//////////////////////////////////////////////////////////// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index 394c22b6e497..8ec3977f318b 100644 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: thessubmenu.hxx,v $ - * $Revision: 1.0 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -44,8 +42,6 @@ class Menu; namespace css = ::com::sun::star; -//////////////////////////////////////////////////////////// - class SfxThesSubMenuControl : public SfxMenuControl { PopupMenu* pMenu; @@ -64,7 +60,6 @@ public: SFX_DECL_MENU_CONTROL(); }; -//////////////////////////////////////////////////////////// class SfxThesSubMenuHelper { @@ -73,7 +68,7 @@ class SfxThesSubMenuHelper private: - // don't use copy c-tor and assignment operator + // don't use copy constructor and assignment operator SfxThesSubMenuHelper( const SfxThesSubMenuHelper & ); SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & ); @@ -95,9 +90,9 @@ public: String GetThesImplName( const css::lang::Locale &rLocale ) const; }; -//////////////////////////////////////////////////////////// #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 76be183057c0..e427b052b2b4 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,9 +62,7 @@ #include <sfx2/objsh.hxx> #include <framework/addonsoptions.hxx> -#ifndef __FRAMEWORK_CLASSES_ADDONMENUS_HXX_ #include <framework/addonmenu.hxx> -#endif #include <framework/menuconfiguration.hxx> using namespace ::com::sun::star::container; @@ -134,30 +133,30 @@ void SfxMenuImageControl_Impl::Update() static Image RetrieveAddOnImage( Reference< com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& aImageId, const rtl::OUString& aURL, - sal_Bool bBigImage, - sal_Bool bHiContrast ) + bool bBigImage +) { Image aImage; if ( aImageId.getLength() > 0 ) { - aImage = GetImage( rFrame, aImageId, bBigImage, bHiContrast ); + aImage = GetImage( rFrame, aImageId, bBigImage ); if ( !!aImage ) return aImage; } - aImage = GetImage( rFrame, aURL, bBigImage, bHiContrast ); + aImage = GetImage( rFrame, aURL, bBigImage ); if ( !aImage ) - aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage, bHiContrast ); + aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage ); return aImage; } //========================================================================= -/* Diese Hilfsfunktion pr"uft, ob eine Slot-Id im aktuellen Applikations- - Status sichtbar ist oder nicht. Dabei bezieht sich der Applikations-Status - darauf, ob die Applikation OLE-Server ist oder nicht. +/* This helper function checks whether a Slot-id in the current application + status is visible or not. This relates to the application status to see + if the OLE server application exist or not. */ sal_Bool IsItemHidden_Impl( sal_uInt16 nItemId, int bOleServer, int bMac ) @@ -181,10 +180,6 @@ void SfxVirtualMenu::Construct_Impl() pSVMenu->SetDeactivateHdl( LINK(this, SfxVirtualMenu, Deactivate) ); pSVMenu->SetSelectHdl( LINK(this, SfxVirtualMenu, Select) ); - // #107258# accelerator keys are needed for accessibility - //if ( bOLE ) - // InvalidateKeyCodes(); - if ( !pResMgr && pParent ) pResMgr = pParent->pResMgr; } @@ -201,7 +196,6 @@ SfxVirtualMenu::SfxVirtualMenu( sal_uInt16 nOwnId, pAutoDeactivate(0), nLocks(0), bHelpInitialized( bWithHelp ), - bWasHighContrast( sal_False ), bIsAddonPopupMenu( bIsAddonMenu ) { DBG_MEMTEST(); @@ -237,7 +231,6 @@ SfxVirtualMenu::SfxVirtualMenu( Menu *pStarViewMenu, sal_Bool bWithHelp, pAutoDeactivate(0), nLocks(0), bHelpInitialized( bWithHelp ), - bWasHighContrast( sal_False ), bIsAddonPopupMenu( bIsAddonMenu ) { DBG_MEMTEST(); @@ -263,10 +256,9 @@ SfxVirtualMenu::SfxVirtualMenu( Menu *pStarViewMenu, sal_Bool bWithHelp, //-------------------------------------------------------------------- -/* Der Destruktor der Klasse SfxVirtualMenu gib die gebundenen Items frei - und klinkt das zugeh"orige StarView-PopupMenu aus seinem Parent aus. - Falls es sich um das Pickmenu oder das MDI-Menu handelt, wird es - dort abgemeldet. +/* The destructor of the class SfxVirtualMenu releases bounded items and + the associated StarView-PopupMenu is released from its parent. + If it is related to the Pickmenu or the MDI-menu, it is unregistered here. */ SfxVirtualMenu::~SfxVirtualMenu() @@ -298,10 +290,10 @@ SfxVirtualMenu::~SfxVirtualMenu() delete pAppCtrl; pBindings = 0; - // Alle Menues, die von SV erzeugt wurden, werden auch dort wieder - // gel"oscht (also die beim Laden aus der Resource erzeugten). - // Das Top-Level-Menu wird nie von SV gel"oscht, da die Allocierung - // im SFX erfolgt + // All the menus, which were created by SV, will also be there deleted + // again (i.e. created by loading them from the resource) + // The top-level menu is never deleted by SV, since the allocation + // in done in the SFX if ( !bResCtor || !pParent) { if ( pParent ) @@ -323,14 +315,6 @@ SfxVirtualMenu::~SfxVirtualMenu() DBG_ASSERT( !nLocks, "destroying active menu" ); } //-------------------------------------------------------------------- - -sal_Bool SfxVirtualMenu::IsHiContrastMode() const -{ - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - return rSettings.GetHighContrastMode(); -} - -//-------------------------------------------------------------------- // internal: creates the virtual menu from the pSVMenu void SfxVirtualMenu::CreateFromSVMenu() @@ -340,7 +324,6 @@ void SfxVirtualMenu::CreateFromSVMenu() // Merge Addon popup menus into the SV Menu SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame(); - SfxSlotPool* pSlotPool = pViewFrame->GetObjectShell()->GetModule()->GetSlotPool(); Reference< com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if ( pSVMenu->IsMenuBar() ) @@ -378,9 +361,9 @@ void SfxVirtualMenu::CreateFromSVMenu() // get and store the number of items nCount = pSVMenu->GetItemCount(); - // Achtung: nur zu diesem Zeitpunkt ist garantiert, da\s nCount und - // der ItemCount des SV-Menues "ubereinstimmen; sp"ater kann das SvMenue - // auch mehr Eintr"age haben (Pickliste!) + // Note: only this time it is guaranteed that nCount and the ItemCount + // the SV-menus match; later on the SvMenu can have more entries + // (Pick list!) if (nCount) pItems = new SfxMenuControl[nCount]; @@ -395,9 +378,6 @@ void SfxVirtualMenu::CreateFromSVMenu() pBindings->ENTERREGISTRATIONS(); ++nLocks; pImageControl = new SfxMenuImageControl_Impl( SID_IMAGE_ORIENTATION, *pBindings, this ); - // Update high contrast state - bWasHighContrast = IsHiContrastMode(); - sal_uInt16 nSVPos = 0; for ( sal_uInt16 nPos=0; nPos<nCount; ++nPos, ++nSVPos ) { @@ -411,7 +391,6 @@ void SfxVirtualMenu::CreateFromSVMenu() } const String sItemText = pSVMenu->GetItemText(nSlotId); - const String sHelpText = pSVMenu->GetHelpText(nSlotId); if ( pPopup ) { @@ -421,9 +400,8 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( pMnuCtrl ) { - // Das Popup war offensichtlich kein "echtes"; solche werden - // niemals aus der Resource geladen und m"ussen daher explizit - // gel"oscht werden + // The pop was obviously not "real" and such are never loaded + // from the resource and need thus to be explicitly deleted. if ( pSVMenu->GetPopupMenu( nSlotId ) == pPopup ) pSVMenu->SetPopupMenu( nSlotId, NULL ); delete pPopup; @@ -431,36 +409,27 @@ void SfxVirtualMenu::CreateFromSVMenu() SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count() ); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); - pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) { rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlotId )); - Image aImage = GetImage( xFrame, aSlotURL, sal_False, bWasHighContrast ); + Image aImage = GetImage( xFrame, aSlotURL, false ); pSVMenu->SetItemImage( nSlotId, aImage ); } } else { - const SfxSlot* pSlot = pSlotPool->GetSlot( nSlotId ); - if ( pSlot ) - { - rtl::OString aCmd(".uno:"); - aCmd += pSlot->GetUnoName(); - pSVMenu->SetHelpId( nSlotId, pSlot->GetUnoName() ); - } - pMnuCtrl = pItems+nPos; - // normalerweise jetzt erst im Activate-Handler + // Normally only now in Activate-Handler if ( bOLE ) { pMnuCtrl->Bind( this, nSlotId, *new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor), - sItemText, sHelpText, - *pBindings ); + sItemText, *pBindings ); } } @@ -478,12 +447,12 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) { // try to create control via comand name - pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, sHelpText, *pBindings, this ); + pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, *pBindings, this ); if ( pMnuCtrl ) { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); } } @@ -495,13 +464,13 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); } else // take default control pMnuCtrl = (pItems+nPos); - pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); } if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) @@ -517,13 +486,13 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - aImage = RetrieveAddOnImage( xFrame, aImageId, aCmd, sal_False, bWasHighContrast ); + aImage = RetrieveAddOnImage( xFrame, aImageId, aCmd, false ); } else { rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlotId )); - aImage = GetImage( xFrame, aSlotURL, sal_False, bWasHighContrast ); + aImage = GetImage( xFrame, aSlotURL, false ); } if ( !!aImage ) @@ -561,11 +530,10 @@ IMPL_LINK( SfxVirtualMenu, Highlight, Menu *, pMenu ) DBG_MEMTEST(); DBG_CHKTHIS(SfxVirtualMenu, 0); - // eigenes StarView-Menu + // own StarView-Menu if ( pMenu == pSVMenu ) { - // AutoDeactivate ist jetzt nicht mehr n"otig - //sal_uInt16 nSlotId = pMenu->GetCurItemId(); + // AutoDeactivate is not necessary anymore if ( pAutoDeactivate ) pAutoDeactivate->Stop(); } @@ -578,7 +546,6 @@ IMPL_LINK( SfxVirtualMenu, SettingsChanged, void*, EMPTYARG ) sal_uInt16 nItemCount = pSVMenu->GetItemCount(); SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); sal_Bool bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); - sal_Bool bIsHiContrastMode = IsHiContrastMode(); Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if ( !bIsAddonPopupMenu ) @@ -601,13 +568,13 @@ IMPL_LINK( SfxVirtualMenu, SettingsChanged, void*, EMPTYARG ) if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - pSVMenu->SetItemImage( nSlotId, RetrieveAddOnImage( xFrame, aImageId, aCmd, sal_False, bIsHiContrastMode )); + pSVMenu->SetItemImage( nSlotId, RetrieveAddOnImage( xFrame, aImageId, aCmd, false )); } else { rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlotId )); - pSVMenu->SetItemImage( nSlotId, GetImage( xFrame, aSlotURL, sal_False, bWasHighContrast )); + pSVMenu->SetItemImage( nSlotId, GetImage( xFrame, aSlotURL, false )); } } else if( nType == MENUITEM_STRINGIMAGE && !bIcons ) @@ -648,7 +615,6 @@ void SfxVirtualMenu::UpdateImages() if ( bIcons ) { - sal_Bool bIsHiContrastMode = IsHiContrastMode(); sal_uInt16 nItemCount = pSVMenu->GetItemCount(); SfxViewFrame * pViewFrame = pBindings->GetDispatcher()->GetFrame(); Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); @@ -670,13 +636,13 @@ void SfxVirtualMenu::UpdateImages() if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - pSVMenu->SetItemImage( nSlotId, RetrieveAddOnImage( xFrame, aImageId, aCmd, sal_False, bIsHiContrastMode )); + pSVMenu->SetItemImage( nSlotId, RetrieveAddOnImage( xFrame, aImageId, aCmd, false )); } else { rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlotId )); - pSVMenu->SetItemImage( nSlotId, GetImage( xFrame, aSlotURL, sal_False, bWasHighContrast )); + pSVMenu->SetItemImage( nSlotId, GetImage( xFrame, aSlotURL, false )); } } } @@ -698,7 +664,6 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) sal_Bool bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); if ( bIcons ) { - sal_Bool bIsHiContrastMode = IsHiContrastMode(); sal_uInt16 nItemCount = pMenu->GetItemCount(); Reference<com::sun::star::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); @@ -716,7 +681,7 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - pMenu->SetItemImage( nSlotId, RetrieveAddOnImage( aXFrame, aImageId, pMenu->GetItemCommand( nSlotId ), sal_False, bIsHiContrastMode )); + pMenu->SetItemImage( nSlotId, RetrieveAddOnImage( aXFrame, aImageId, pMenu->GetItemCommand( nSlotId ), false )); } if ( pPopup ) @@ -751,14 +716,14 @@ void SfxVirtualMenu::RemoveMenuImages( Menu* pMenu ) bool SfxVirtualMenu::Bind_Impl( Menu *pMenu ) { - // Selber suchen, da SV mit 'sal_uInt16 nSID = pSVMenu->GetCurItemId();' immer - // 0 liefert. Das ist so, weil die Event-Weiterleitung lt. TH nichts mit - // CurItem des Parent-Menus zu tun hat. + // Search , as SV with 'sal_uInt16 nSID = pSVMenu->GetCurItemId();' always + // returns 0. It is like this, since the Event-Forwarding has nothing to do + // with the Parent-Menus CurItem. sal_uInt32 nAddonsPopupPrefixLen = ADDONSPOPUPMENU_URL_PREFIX.getLength(); for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) { - // angesprochenes Sub-Menu gefunden? + // found the Sub-Menu in question? bool bFound = false; sal_uInt16 nSID = pSVMenu->GetItemId(nPos); SfxMenuControl &rCtrl = pItems[nPos]; @@ -767,11 +732,11 @@ bool SfxVirtualMenu::Bind_Impl( Menu *pMenu ) if ( bFound ) { - // Nur ein gebundener Menu-Controller hat schon seine Id! + // Only a binded Menu-Controller as already an Id! if ( !rCtrl.GetId() ) { bIsAddonPopupMenu = sal_False; - DBG_ASSERT( !pSubMenu, "Popup schon vorhanden!"); + DBG_ASSERT( !pSubMenu, "Popup already exists!"); // Check if the popup is an Add-On popup menu // Either the popup menu has a special ID or a special command URL prefix! @@ -782,33 +747,32 @@ bool SfxVirtualMenu::Bind_Impl( Menu *pMenu ) ( aCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 )) ) bIsAddonPopupMenu = sal_True; - // VirtualMenu f"ur Sub-Menu erzeugen + // Create VirtualMenu for Sub-Menu sal_Bool bRes = bResCtor; pSubMenu = new SfxVirtualMenu( nSID, this, *pMenu, sal_False, *pBindings, bOLE, bRes, bIsAddonPopupMenu ); - DBG_OUTF( ("Neues VirtualMenu %lx erzeugt", pSubMenu) ); + DBG_OUTF( ("New VirtualMenu %lx created", pSubMenu) ); - rCtrl.Bind( this, nSID, *pSubMenu, - pSVMenu->GetItemText(nSID), pSVMenu->GetHelpText(nSID), - *pBindings ); + rCtrl.Bind( this, nSID, *pSubMenu, pSVMenu->GetItemText(nSID), *pBindings ); - // Activate weiterleiten + // Forward Activate pSubMenu->Bind_Impl( pMenu ); pSubMenu->Activate( pMenu ); } } - // rekursiv weitersuchen (SV Activate nur am Menu selbst und Top-Menu) + // continue searching recursively (SV Activate only the menu itself + // and Top-Menu) if ( !bFound && pSubMenu ) bFound = pSubMenu->Bind_Impl( pMenu ); - // gefunden, dann abbrechen + // If found, break if ( bFound ) return true; } - // nicht in diesem Untermenu gefunden + // Not found in this submenu return false; } @@ -854,7 +818,7 @@ void SfxVirtualMenu::UnbindControllers() { SfxMenuControl* pCtrl = rCtrlArr[nPos]; if ( pCtrl->IsBound() ) - // UnoController sind nicht gebunden! + // UnoController is not binded! pCtrl->UnBind(); } @@ -876,7 +840,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) { pAddonMenu = framework::AddonMenuManager::CreateAddonMenu( xFrame ); } - catch ( ::com::sun::star::lang::WrappedTargetException ) + catch ( const ::com::sun::star::lang::WrappedTargetException& ) { } @@ -894,7 +858,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) { rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( SID_ADDONS )); - pMenu->SetItemImage( SID_ADDONS, GetImage( xFrame, aSlotURL, sal_False, bWasHighContrast )); + pMenu->SetItemImage( SID_ADDONS, GetImage( xFrame, aSlotURL, false )); } } else @@ -911,10 +875,8 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu ) DBG_CHKTHIS(SfxVirtualMenu, 0); DBG_OUTF( ("SfxVirtualMenu %lx activated %lx, own %lx", this, pMenu, pSVMenu)); - // MI: wozu war der noch gut? - // MBA: scheint ein alter QAP-Hack gewesen zu sein ( in rev.1.41 eingecheckt ! ) -// if ( Application::IsInModalMode() ) -// return TRUE; // abw"urgen + // MI: for what was it still good for? + // MBA: seemes to be an old QAP-Hack( checked-in in rev.1.41 ! ) if ( pMenu ) { @@ -927,17 +889,17 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu ) pMenu->SetMenuFlags( nFlag ); } - // eigenes StarView-Menu + // Own StarView-Menu if ( pMenu == pSVMenu ) { - // doppelt-Activate verhindern + // Prevent Double Activate if ( bIsActive ) return sal_True; // ggf. Pick-Menu erzeugen if ( pParent && pSVMenu == pParent->pPickMenu ) { - SfxPickList::Get()->CreateMenuEntries( pParent->pPickMenu ); + SfxPickList::Get().CreateMenuEntries( pParent->pPickMenu ); } else pPickMenu = pSVMenu->GetPopupMenu(SID_PICKLIST); @@ -1013,11 +975,10 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu ) pAddonsMenu = pSVMenu->GetPopupMenu( SID_ADDONLIST ); } - // f"ur konstistenten Status sorgen + // Provides consistency to the Status if ( bControllersUnBound ) BindControllers(); - //InvalidateKeyCodes(); pBindings->GetDispatcher_Impl()->Flush(); for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) { @@ -1028,39 +989,22 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu ) pBindings->Update( SID_IMAGE_ORIENTATION ); - // HelpText on-demand - if ( !bHelpInitialized ) - { - // TODO/CLEANUP: do we need help texts in context menus? - // old way with SlotInfo doesn't work anymore - } - - // bis zum Deactivate die Statusupdates unterdr"ucken + // Supress the Status updates until Deactivate pBindings->ENTERREGISTRATIONS(); ++nLocks; bIsActive = sal_True; if ( pAutoDeactivate ) // QAP-Hack pAutoDeactivate->Start(); - if ( IsHiContrastMode() != bWasHighContrast ) - { - // Refresh images as our background color changed and remember it!! - bWasHighContrast = IsHiContrastMode(); - if ( bIsAddonPopupMenu ) - UpdateImages( pSVMenu ); - else - UpdateImages(); - } - - // erledigt return sal_True; } else { - // VirtualMenu fuer SubMenu finden und ggf. an VirtualMenu binden + // Find the VirtualMenu for the SubMenu and if possible, bind a + // VirtualMenu bool bRet = Bind_Impl( pMenu ); #ifdef DBG_UTIL if ( !bRet) - DBG_WARNING( "W1: Virtual menu konnte nicht erzeugt werden!" ); + DBG_WARNING( "W1: Virtual menu could not be created!" ); #endif return bRet; } @@ -1077,8 +1021,8 @@ IMPL_LINK( SfxVirtualMenu, Deactivate, Menu *, pMenu ) if ( pAutoDeactivate ) pAutoDeactivate->Stop(); - // Bis auf die Menubar k"onnen alle Controller unbinded werden, wenn - // das Menue deaktiviert ( = zugeklappt ) wird + // All controllers can be unbinded all the way up to the Menubar, + // when the menu is disabled (= closed) if ( pParent ) UnbindControllers(); pBindings->LEAVEREGISTRATIONS(); --nLocks; bIsActive = sal_False; @@ -1093,22 +1037,7 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu ) { sal_uInt16 nSlotId = (sal_uInt16) pMenu->GetCurItemId(); DBG_OUTF( ("SfxVirtualMenu %lx selected %u from %lx", this, nSlotId, pMenu) ); -/* - if ( pSVMenu->GetItemCommand( nSlotId ).Len() ) - { - SfxMenuCtrlArr_Impl& rCtrlArr = GetAppCtrl_Impl(); - for ( sal_uInt16 nPos=0; nPos<rCtrlArr.Count(); nPos++ ) - { - SfxMenuControl* pCtrl = rCtrlArr[nPos]; - if ( pCtrl->GetId() == nSlotId ) - { - SfxUnoMenuControl *pUnoCtrl = (SfxUnoMenuControl*) pCtrl; - pUnoCtrl->Select(); - return sal_True; - } - } - } -*/ + if ( nSlotId >= START_ITEMID_WINDOWLIST && nSlotId <= END_ITEMID_WINDOWLIST ) { // window list menu item selected @@ -1139,7 +1068,7 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu ) } else if ( nSlotId >= START_ITEMID_PICKLIST && nSlotId <= END_ITEMID_PICKLIST ) { - SfxPickList::Get()->ExecuteMenuEntry( nSlotId ); + SfxPickList::Get().ExecuteMenuEntry( nSlotId ); return sal_True; } @@ -1208,21 +1137,6 @@ String SfxVirtualMenu::GetItemText( sal_uInt16 nSlotId ) const } //-------------------------------------------------------------------- -// returns the text of the item as currently shown in the menu - -String SfxVirtualMenu::GetItemHelpText( sal_uInt16 nSlotId ) const -{ - DBG_MEMTEST(); - DBG_CHKTHIS(SfxVirtualMenu, 0); - - sal_uInt16 nPos = GetItemPos(nSlotId); - if ( nPos != MENU_ITEM_NOTFOUND ) - return (pItems+nPos)->GetHelpText(); - return String(); -} - -//-------------------------------------------------------------------- - // set the checkmark of the specified item void SfxVirtualMenu::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck ) @@ -1264,7 +1178,6 @@ void SfxVirtualMenu::SetItemText( sal_uInt16 nItemId, const String& rText ) //-------------------------------------------------------------------- -// void SfxVirtualMenu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu *pMenu ) { @@ -1283,7 +1196,7 @@ void SfxVirtualMenu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu *pMenu ) //-------------------------------------------------------------------- -// Erzwingt die Initialisierung, die sonst nur im Activate kommt +// Forces the initialization, which is otherwise only happens in Activate void SfxVirtualMenu::InitPopup( sal_uInt16 nPos, sal_Bool /*bOLE*/ ) { @@ -1293,21 +1206,19 @@ void SfxVirtualMenu::InitPopup( sal_uInt16 nPos, sal_Bool /*bOLE*/ ) sal_uInt16 nSID = pSVMenu->GetItemId(nPos); PopupMenu *pMenu = pSVMenu->GetPopupMenu( nSID ); - DBG_ASSERT( pMenu, "Hier gibt es kein Popup!"); + DBG_ASSERT( pMenu, "No popup exist here!"); SfxMenuControl &rCtrl = pItems[nPos]; if ( !rCtrl.GetId() ) { - // VirtualMenu f"ur Sub-Menu erzeugen + // Generate VirtualMenu for Sub-Menu sal_Bool bRes = bResCtor; SfxVirtualMenu *pSubMenu = new SfxVirtualMenu(nSID, this, *pMenu, sal_False, *pBindings, bOLE, bRes); - DBG_OUTF( ("Neues VirtualMenu %lx erzeugt", pSubMenu) ); + DBG_OUTF( ("New VirtualMenu %lx created", pSubMenu) ); - rCtrl.Bind( this, nSID, *pSubMenu, - pSVMenu->GetItemText(nSID), pSVMenu->GetHelpText(nSID), - *pBindings ); + rCtrl.Bind( this, nSID, *pSubMenu, pSVMenu->GetItemText(nSID), *pBindings ); } } @@ -1316,9 +1227,6 @@ void SfxVirtualMenu::InitializeHelp() for ( sal_uInt16 nPos = 0; nPos<pSVMenu->GetItemCount(); ++nPos ) { sal_uInt16 nSlotId = pSVMenu->GetItemId(nPos); - // TODO/CLEANUP: this code does nothing! -// if ( !bHelpInitialized ) -// pSVMenu->SetHelpText( nId, rSlotPool.GetSlotHelpText_Impl( nId ) ); SfxMenuControl &rCtrl = pItems[nPos]; if ( nSlotId && !rCtrl.GetId() ) { @@ -1340,3 +1248,4 @@ void SfxVirtualMenu::SetHelpIds( ResMgr *pRes ) pResMgr = pRes; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index fd1327e423ca..630bff153351 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,13 +32,9 @@ //-------------------------------------------------------------------------------------------------------- #include <com/sun/star/beans/PropertyValue.hpp> -#ifndef _COM_SUN_STAR_UTL_URL_HPP_ #include <com/sun/star/util/URL.hpp> -#endif -#ifndef _COM_SUN_STAR_UTL_XURLTRANSFORMER_HPP_ #include <com/sun/star/util/XURLTransformer.hpp> -#endif #include <tools/urlobj.hxx> #include <svl/macitem.hxx> #include <sfx2/appuno.hxx> @@ -104,7 +101,7 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY & ::rtl::OUString sType; if ( ( aNormalizedDescriptor.size() == 1 ) - && ( aNormalizedDescriptor.has( PROP_EVENT_TYPE ) == 0 ) + && ( aNormalizedDescriptor.has( PROP_EVENT_TYPE) == 0 ) && ( aNormalizedDescriptor.get( PROP_EVENT_TYPE ) >>= sType ) && ( sType.getLength() == 0 ) ) @@ -217,27 +214,27 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg sal_Int32 nIndex = 0; while ( nIndex < nCount ) { - if ( aProperties[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) + if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_EVENT_TYPE))) aProperties[ nIndex ].Value >>= aType; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_SCRIPT ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_SCRIPT))) aProperties[ nIndex ].Value >>= aScript; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_LIBRARY ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_LIBRARY))) aProperties[ nIndex ].Value >>= aLibrary; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_MACRO_NAME ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_MACRO_NAME))) aProperties[ nIndex ].Value >>= aMacroName; else { - DBG_ERROR("Unknown property value!"); + OSL_FAIL("Unknown property value!"); } nIndex += 1; } - if ( aType.compareToAscii( STAR_BASIC ) == 0 && aScript.getLength() ) + if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(STAR_BASIC)) && aScript.getLength()) { com::sun::star::uno::Any aAny; SfxMacroLoader::loadMacro( aScript, aAny, pDoc ); } - else if ( aType.compareToAscii( "Service" ) == 0 || - aType.compareToAscii( "Script" ) == 0 ) + else if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Service")) || + aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Script"))) { if ( aScript.getLength() ) { @@ -248,8 +245,8 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg ::com::sun::star::uno::Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.util.URLTransformer" ) ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.util.URLTransformer" )) ), UNO_QUERY ); ::com::sun::star::util::URL aURL; @@ -270,8 +267,8 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > ( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.frame.Desktop" ) ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); } @@ -281,10 +278,6 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg if ( xDisp.is() ) { - //::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aArgs(1); - //aArgs[0].Name = rtl::OUString::createFromAscii("Referer"); - //aArs[0].Value <<= ::rtl::OUString( pDoc->GetMedium()->GetName() ); - //xDisp->dispatch( aURL, aArgs ); css::beans::PropertyValue aEventParam; aEventParam.Value <<= aTrigger; @@ -349,7 +342,6 @@ void SAL_CALL SfxEvents_Impl::disposing( const EVENTOBJECT& /*Source*/ ) throw( } //-------------------------------------------------------------------------------------------------------- -// //-------------------------------------------------------------------------------------------------------- SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell, REFERENCE< XEVENTBROADCASTER > xBroadcaster ) @@ -400,27 +392,27 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* p while ( nIndex < nCount ) { - if ( aProperties[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) + if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_EVENT_TYPE))) aProperties[ nIndex ].Value >>= aType; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_SCRIPT ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_SCRIPT))) aProperties[ nIndex ].Value >>= aScriptURL; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_LIBRARY ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_LIBRARY))) aProperties[ nIndex ].Value >>= aLibrary; - else if ( aProperties[ nIndex ].Name.compareToAscii( PROP_MACRO_NAME ) == 0 ) + else if (aProperties[ nIndex ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(PROP_MACRO_NAME))) aProperties[ nIndex ].Value >>= aMacroName; else { - DBG_ERROR("Unknown propery value!"); + OSL_FAIL("Unknown propery value!"); } nIndex += 1; } // Get the type ScriptType eType( STARBASIC ); - if ( aType.compareToAscii( STAR_BASIC ) == COMPARE_EQUAL ) + if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(STAR_BASIC))) eType = STARBASIC; - else if ( aType.compareToAscii( "Script" ) == COMPARE_EQUAL && aScriptURL.getLength() ) + else if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Script")) && aScriptURL.getLength()) eType = EXTENDED_STYPE; - else if ( aType.compareToAscii( SVX_MACRO_LANGUAGE_JAVASCRIPT ) == COMPARE_EQUAL ) + else if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT))) eType = JAVASCRIPT; else { DBG_ERRORFILE( "ConvertToMacro: Unknown macro type" ); @@ -428,7 +420,7 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* p if ( aMacroName.getLength() ) { - if ( aLibrary.compareToAscii("application") == 0 ) + if (aLibrary.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application"))) aLibrary = SFX_APP()->GetName(); else aLibrary = ::rtl::OUString(); @@ -468,7 +460,7 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i if ( aScript.getLength() ) o_normalizedDescriptor.put( PROP_SCRIPT, aScript ); - if ( aType.compareToAscii( STAR_BASIC ) == 0 ) + if (aType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(STAR_BASIC))) { if ( aScript.getLength() ) { @@ -479,12 +471,8 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i 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 ) + if (aBasMgrName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("."))) aLibrary = pDoc->GetTitle(); -/* - else if ( aBasMgrName.getLength() ) - aLibrary = aBasMgrName; - */ else aLibrary = SFX_APP()->GetName(); @@ -500,7 +488,7 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i else if ( aMacroName.getLength() ) { aScript = OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_PRFIX ) ); - if ( aLibrary.compareTo( SFX_APP()->GetName() ) != 0 && aLibrary.compareToAscii("StarDesktop") != 0 && aLibrary.compareToAscii("application") != 0 ) + if ( aLibrary.compareTo( SFX_APP()->GetName() ) != 0 && !aLibrary.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("StarDesktop")) && !aLibrary.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("application")) ) aScript += String('.'); aScript += String('/'); @@ -511,7 +499,7 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i // wrong properties return; - if ( aLibrary.compareToAscii("document") != 0 ) + if (!aLibrary.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("document"))) { if ( !aLibrary.getLength() || (pDoc && ( String(aLibrary) == pDoc->GetTitle( SFX_TITLE_APINAME ) || String(aLibrary) == pDoc->GetTitle() )) ) aLibrary = String::CreateFromAscii("document"); @@ -564,7 +552,7 @@ css::uno::Any SAL_CALL ModelCollectionEnumeration::nextElement() ::osl::ResettableMutexGuard aLock(m_aLock); if (m_pEnumerationIt == m_lModels.end()) throw css::container::NoSuchElementException( - ::rtl::OUString::createFromAscii("End of model enumeration reached."), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("End of model enumeration reached.")), static_cast< css::container::XEnumeration* >(this)); css::uno::Reference< css::frame::XModel > xModel(*m_pEnumerationIt, UNO_QUERY); ++m_pEnumerationIt; @@ -590,7 +578,7 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const com::sun::star::uno::Reference pImp = new GlobalEventConfig(); m_xEvents = pImp; m_xJobExecutorListener = css::uno::Reference< css::document::XEventListener >( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.task.JobExecutor")), + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.JobExecutor"))), UNO_QUERY); m_refCount--; } @@ -713,7 +701,7 @@ void SAL_CALL SfxGlobalEvents_Impl::insert( const css::uno::Any& aElement ) aElement >>= xDoc; if (!xDoc.is()) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("Cant locate at least the model parameter."), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cant locate at least the model parameter.")), static_cast< css::container::XSet* >(this), 0); @@ -750,7 +738,7 @@ void SAL_CALL SfxGlobalEvents_Impl::remove( const css::uno::Any& aElement ) aElement >>= xDoc; if (!xDoc.is()) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("Cant locate at least the model parameter."), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cant locate at least the model parameter.")), static_cast< css::container::XSet* >(this), 0); @@ -882,3 +870,4 @@ TModelList::iterator SfxGlobalEvents_Impl::impl_searchDoc(const css::uno::Refere return pIt; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx index d541f5542e3e..09299a152102 100644 --- a/sfx2/source/notify/hintpost.cxx +++ b/sfx2/source/notify/hintpost.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - #include "arrdecl.hxx" #include <sfx2/hintpost.hxx> #include <sfx2/app.hxx> @@ -100,11 +98,5 @@ void SfxHintPoster::SetEventHdl( const GenLink& rLink ) #define LOG( x ) -#if 0 -#define LOG( x ) \ -{ \ - SvFileStream aStrm( "f:\\temp\\log", STREAM_READWRITE ); \ - aStrm.Seek( STREAM_SEEK_TO_END ); \ - aStrm << x.GetStr() << '\n'; \ -} -#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 387a6d09f89a..739362ed50f0 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" #include <svl/stritem.hxx> -#ifndef GCC -#endif #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XController.hpp> @@ -57,9 +56,7 @@ #include <svl/eitem.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> -#endif #include <toolkit/helper/convert.hxx> using namespace ::com::sun::star; @@ -88,12 +85,12 @@ svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory( unsigned short nID, const ::rtl::OUString& aCommandURL ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; util::URL aTargetURL; aTargetURL.Complete = aCommandURL; uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( "com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), uno::UNO_QUERY ); xTrans->parseStrict( aTargetURL ); SfxObjectShell* pObjShell = NULL; @@ -147,24 +144,26 @@ svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory( SfxStatusBarControl::SfxStatusBarControl ( - sal_uInt16 nSlotID, /* Slot-Id, mit der diese Instanz - verbunden wird. Wurde bei der - Registrierung eine Slot-Id != 0 - angegeben, ist dies immer die dort - angegebene. */ + sal_uInt16 nSlotID, /* Slot-Id which is connected to this + instance. If a Slot-Id is set to != 0 at + registration it will always be set there. + */ + + sal_uInt16 nCtrlID, /* ID of this controller in the status bar */ - StatusBar& rBar /* Referenz auf die StatusBar, f"ur die - dieses Control erzeugt wurde. */ + StatusBar& rBar /* Reference to the StatusBar,for which + this Control was created. */ ) -/* [Beschreibung] - Konstruktor der Klasse SfxStatusBarControl. Die Subclasses werden - bei Bedarf per Factory vom SFx erzeugt. +/* [Description] - Instanzen dieser Basisklasse werden f"ur alle StatusBar-Felder - erzeugt, f"ur die keine speziellen registriert wurden. + Constructor of the SfxStatusBarControl Class. The Subclasses are + created at the Factory if necessary. + + Instances of this base class are created for all StatusBar-fields + for which no specific ones have been registered. */ : svt::StatusbarController(), @@ -178,10 +177,10 @@ SfxStatusBarControl::SfxStatusBarControl SfxStatusBarControl::~SfxStatusBarControl() -/* [Beschreibung] +/* [Description] - Destruktor der Klasse SfxStatusBarControl. Die Instanzen dieser - Klasse und deren Subklassen werden vom SFx zerst"ort. + Destructor of the SfxStatusBarControl Class. The Class and its Subclasses + are destroyed by SFx. */ {} @@ -228,7 +227,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) SfxViewFrame* pViewFrame = NULL; uno::Reference < frame::XController > xController; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_xFrame.is() ) xController = m_xFrame->getController(); @@ -333,7 +332,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) const awt::MouseEvent& rMouseEvent ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, @@ -351,7 +350,7 @@ throw ( uno::RuntimeException ) const awt::MouseEvent& rMouseEvent ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, @@ -368,7 +367,7 @@ throw (uno::RuntimeException) const ::awt::MouseEvent& rMouseEvent ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::Point aPos( rMouseEvent.X, rMouseEvent.Y ); ::MouseEvent aMouseEvent( aPos, @@ -388,7 +387,7 @@ void SAL_CALL SfxStatusBarControl::command( const ::com::sun::star::uno::Any& /*aData*/ ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::Point aPos( rPos.X, rPos.Y ); CommandEvent aCmdEvent( aPos, (sal_uInt16)nCommand, sal_True, NULL ); @@ -404,7 +403,7 @@ void SAL_CALL SfxStatusBarControl::paint( ::sal_Int32 nStyle ) throw ( ::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );; if ( pOutDev ) @@ -420,7 +419,7 @@ throw ( ::uno::RuntimeException ) void SAL_CALL SfxStatusBarControl::click() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Click(); } @@ -429,7 +428,7 @@ throw ( uno::RuntimeException ) void SAL_CALL SfxStatusBarControl::doubleClick() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DoubleClick(); } @@ -441,20 +440,20 @@ void SfxStatusBarControl::StateChanged ( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState /* Zeiger auf ein SfxPoolItem, welches nur - innerhalb dieses Methodenaufrufs g"ultig - ist. Es kann ein 0-Pointer, ein Pointer - auf ein SfxVoidItem oder auf den Typ, f"ur - den die Subclass von SfxStatusBarControl - registriert ist vorkommen. */ + const SfxPoolItem* pState /* Pointer to SfxPoolItem, is only valid + withih this Method call. This can be a + Null-Pointer, a Pointer to SfxVoidItem + or of this Type found registered by the + Subclass of SfxStatusBarControl. + */ ) -/* [Beschreibung] +/* [Description] - Die Basisimplementation versteht Items vom Type SfxStringItem, bei - denen der Text in das Status-Zeilen-Feld eingetragen wird und - SfxVoidItem, bei denen das Feld geleert wird. Die Basisimplementierng - sollte in "uberladenen Methoden nicht gerufen werden. + The base implementation includes items of type SfxStringItem + where the text is entered in the status row field and + SfxVoidItem, where the field is emptied. The base implementation + should not be called in overloaded methods. */ { @@ -476,25 +475,23 @@ void SfxStatusBarControl::StateChanged sal_Bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & ) -/* [Beschreibung] - - Diese virtuelle Methode ist eine Weiterleitung des Events - MouseButtonDown() der StatusBar, falls die Maus-Position innerhalb - des Bereichs des betreffenden Items ist, oder die Maus von diesem - Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde. +/* [Description] - Die Defaultimplementierung ist leer und gibt FALSE zur"uck. + This virtual method forwards the Event MouseButtonDown() of the + StatusBar if the mouse position is within the range of the items, + or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()> + The default implementation is empty and returns FALSE. - [Rueckgabewert] + [Return value] sal_Bool TRUE - das Event wurde bearbeitet und soll nicht an - die StatusBar weitergeleitet werden + The event has been processed and is not intended to + be forwarded to StatusBar FALSE - das Event wurde nicht bearbeitet und soll an - die StatusBar weitergeleitet werden + The event was not processed and is to be + be forwarded to StatusBar */ { @@ -505,25 +502,23 @@ sal_Bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & ) sal_Bool SfxStatusBarControl::MouseMove( const MouseEvent & ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode ist eine Weiterleitung des Events - MouseMove() der StatusBar, falls die Maus-Position innerhalb - des Bereichs des betreffenden Items ist, oder die Maus von diesem - Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde. + This virtual method forwards the Event MouseMove() of the + StatusBar if the mouse position is within the range of the items, + or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()> - Die Defaultimplementierung ist leer und gibt FALSE zur"uck. + The default implementation is empty and returns FALSE. - - [Rueckgabewert] + [Return value] sal_Bool TRUE - das Event wurde bearbeitet und soll nicht an - die StatusBar weitergeleitet werden + The event has been processed and is not intended to + be forwarded to StatusBar FALSE - das Event wurde nicht bearbeitet und soll an - die StatusBar weitergeleitet werden + The event was not processed and is to be + be forwarded to StatusBar */ { @@ -534,25 +529,23 @@ sal_Bool SfxStatusBarControl::MouseMove( const MouseEvent & ) sal_Bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & ) -/* [Beschreibung] - - Diese virtuelle Methode ist eine Weiterleitung des Events - MouseButtonUp() der StatusBar, falls die Maus-Position innerhalb - des Bereichs des betreffenden Items ist, oder die Maus von diesem - Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde. +/* [Description] - Die Defaultimplementierung ist leer und gibt FALSE zur"uck. + This virtual method forwards the Event MouseButtonUp() of the + StatusBar if the mouse position is within the range of the items, + or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()> + The default implementation is empty and returns FALSE. - [Rueckgabewert] + [Return value] sal_Bool TRUE - das Event wurde bearbeitet und soll nicht an - die StatusBar weitergeleitet werden + The event has been processed and is not intended to + be forwarded to StatusBar FALSE - das Event wurde nicht bearbeitet und soll an - die StatusBar weitergeleitet werden + The event was not processed and is to be + be forwarded to StatusBar */ { @@ -563,12 +556,12 @@ sal_Bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & ) void SfxStatusBarControl::Command( const CommandEvent& ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird gerufen, wenn f"ur dieses SfxStatusBarControl - ein CommandEvent f"ur erkannt wurde. + This virtual method is called when a CommandEvent is recived by + SfxStatusBarControl. - Die Defaultimplementierung ist leer. + The default implementation is empty. */ { @@ -578,12 +571,12 @@ void SfxStatusBarControl::Command( const CommandEvent& ) void SfxStatusBarControl::Click() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus - in das zu diesem Control geh"orige Feld der Statuszeile klickt. + This virtual method is called when the user clicks on the + field in the status row that belongs to this control. - Die Defaultimplementierung ist leer. + The default implementation is empty. */ { @@ -593,10 +586,10 @@ void SfxStatusBarControl::Click() void SfxStatusBarControl::DoubleClick() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus - in das zu diesem Control geh"orige Feld der Statuszeile doppel-klickt. + This virtual method is called when the user double-clicks on the + field in the status row that belongs to this control. */ { @@ -608,18 +601,17 @@ void SfxStatusBarControl::DoubleClick() void SfxStatusBarControl::Paint ( - const UserDrawEvent& /* Referenz auf einen UserDrawEvent */ + const UserDrawEvent& /* Reference to an UserDrawEvent */ ) -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird gerufen, falls das betreffende Feld - mit SIB_USERDRAW gekennzeichnet ist, um den Inhalt zu zeichnen. - Die Ausgabe mu"s auf dem in durch rUDEvt.GetDevice() erh"altlichen - OutputDevice innerhalb des durch rUDEvt.GetRect() angegebenenen - Rechtecks erfolgen. + This virtual method is called to paint the contents if the field + at hand is marked with SIB_USERDRAW. The output must be obtained + within the Rectangle of rUDEvt.GetRect() by the OutputDevice + given by rUDEvt.GetDevice(). - Die Defaultimplementierung ist leer. + The default implementation is empty. */ { @@ -647,7 +639,7 @@ SfxStatusBarControl* SfxStatusBarControl::CreateControl SfxModule* pMod ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxApplication *pApp = SFX_APP(); SfxSlotPool *pSlotPool; @@ -690,3 +682,5 @@ void SfxStatusBarControl::RegisterStatusBarControl(SfxModule* pMod, SfxStbCtrlFa SFX_APP()->RegisterStatusBarControl_Impl( pMod, pFact ); } //-------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx index 3afea8890535..e6419cc09ee3 100644 --- a/sfx2/source/toolbox/imgmgr.cxx +++ b/sfx2/source/toolbox/imgmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,8 @@ #include "precompiled_sfx2.hxx" #include <stdio.h> -#include <hash_map> +#include <boost/unordered_map.hpp> +#include <boost/shared_ptr.hpp> #include "sfx2/imgmgr.hxx" #include <sfx2/sfx.hrc> @@ -44,14 +46,10 @@ #include <tools/rcid.h> #include <tools/link.hxx> #include <svtools/miscopt.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> +#include <rtl/instance.hxx> -#ifndef GCC -#endif - -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif const sal_uInt32 IMAGELIST_COUNT = 4; // small, small-hi, large, large-hi @@ -64,112 +62,106 @@ struct ToolBoxInf_Impl class SfxImageManager_Impl { public: - sal_Int16 m_nSymbolsSize; SvtMiscOptions m_aOpt; std::vector< ToolBoxInf_Impl* > m_aToolBoxes; + sal_Int16 m_nSymbolsSize; ImageList* m_pImageList[IMAGELIST_COUNT]; SfxModule* m_pModule; + bool m_bAppEventListener; - ImageList* GetImageList( sal_Bool bBig, sal_Bool bHiContrast ); - Image GetImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiContrast ); + ImageList* GetImageList( bool bBig ); + Image GetImage( sal_uInt16 nId, bool bBig ); void SetSymbolsSize_Impl( sal_Int16 ); DECL_LINK( OptionsChanged_Impl, void* ); - DECL_LINK( SettingsChanged_Impl, void* ); + DECL_LINK( SettingsChanged_Impl, VclWindowEvent* ); SfxImageManager_Impl( SfxModule* pModule ); ~SfxImageManager_Impl(); }; -typedef std::hash_map< sal_Int64, sal_Int64 > SfxImageManagerMap; +namespace +{ + typedef boost::unordered_map< SfxModule*, boost::shared_ptr<SfxImageManager_Impl> > SfxImageManagerImplMap; + + class theImageManagerImplMap : + public rtl::Static<SfxImageManagerImplMap, theImageManagerImplMap> {}; -// global image lists -static SfxImageManager_Impl* pGlobalImageManager = 0; -static SfxImageManagerMap m_ImageManager_ImplMap; -static SfxImageManagerMap m_ImageManagerMap; -static ImageList* pImageListSmall=0; -static ImageList* pImageListBig=0; -static ImageList* pImageListHiSmall=0; -static ImageList* pImageListHiBig=0; + class theGlobalImageManager : + public rtl::StaticWithArg<SfxImageManager_Impl, SfxModule*, + theGlobalImageManager> {}; +} static SfxImageManager_Impl* GetImageManager( SfxModule* pModule ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( pModule == 0 ) { - if ( !pGlobalImageManager ) - pGlobalImageManager = new SfxImageManager_Impl( 0 ); - return pGlobalImageManager; + return &theGlobalImageManager::get(NULL); } else { + SfxImageManagerImplMap &rImageManager_ImplMap = + theImageManagerImplMap::get(); SfxImageManager_Impl* pImpl( 0 ); - SfxImageManagerMap::const_iterator pIter = m_ImageManager_ImplMap.find( sal::static_int_cast< sal_Int64>( reinterpret_cast< sal_IntPtr >( pModule ))); - if ( pIter != m_ImageManager_ImplMap.end() ) - pImpl = reinterpret_cast< SfxImageManager_Impl* >( sal::static_int_cast< sal_IntPtr >( pIter->second )); + SfxImageManagerImplMap::const_iterator pIter = rImageManager_ImplMap.find(pModule); + if ( pIter != rImageManager_ImplMap.end() ) + pImpl = pIter->second.get(); else { - pImpl = new SfxImageManager_Impl( pModule ); - m_ImageManager_ImplMap.insert( - SfxImageManagerMap::value_type( - sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )), - sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pImpl )) )); + rImageManager_ImplMap[pModule].reset(new SfxImageManager_Impl(pModule)); + pImpl = rImageManager_ImplMap[pModule].get(); } return pImpl; } } // Global image list -static ImageList* GetImageList( sal_Bool bBig, sal_Bool bHiContrast ) +static ImageList* GetImageList( bool bBig ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; + ImageList* rpList = NULL; - // Has to be changed if we know how the IDs are named!!! - ImageList*& rpList = bBig ? ( bHiContrast ? pImageListHiBig : pImageListBig ) : - ( bHiContrast ? pImageListHiSmall : pImageListSmall ); - if ( !rpList ) - { - ResMgr *pResMgr = SfxApplication::GetOrCreate()->GetOffResManager_Impl(); + ResMgr *pResMgr = SfxApplication::GetOrCreate()->GetOffResManager_Impl(); - ResId aResId( bBig ? ( bHiContrast ? RID_DEFAULTIMAGELIST_LCH : RID_DEFAULTIMAGELIST_LC ) : - ( bHiContrast ? RID_DEFAULTIMAGELIST_SCH : RID_DEFAULTIMAGELIST_SC ), *pResMgr); + ResId aResId( bBig ? ( RID_DEFAULTIMAGELIST_LC ) : ( RID_DEFAULTIMAGELIST_SC ), *pResMgr); - aResId.SetRT( RSC_IMAGELIST ); + aResId.SetRT( RSC_IMAGELIST ); - DBG_ASSERT( pResMgr->IsAvailable(aResId), "No default ImageList!" ); + DBG_ASSERT( pResMgr->IsAvailable(aResId), "No default ImageList!" ); - if ( pResMgr->IsAvailable(aResId) ) - rpList = new ImageList( aResId ); - else - rpList = new ImageList(); - } + if ( pResMgr->IsAvailable(aResId) ) + rpList = new ImageList( aResId ); + else + rpList = new ImageList(); return rpList; } -static sal_Int16 impl_convertBools( sal_Bool bLarge, sal_Bool bHiContrast ) +static sal_Int16 impl_convertBools( sal_Bool bLarge ) { sal_Int16 nIndex( 0 ); if ( bLarge ) nIndex += 1; - if ( bHiContrast ) - nIndex += 2; return nIndex; } //========================================================================= -SfxImageManager_Impl::SfxImageManager_Impl( SfxModule* pModule ) : - m_nSymbolsSize( SvtMiscOptions().GetCurrentSymbolsSize() ), - m_pModule( pModule ) +SfxImageManager_Impl::SfxImageManager_Impl( SfxModule* pModule ) + : m_pModule(pModule) + , m_bAppEventListener(false) { + m_nSymbolsSize = m_aOpt.GetCurrentSymbolsSize(); + for ( sal_uInt32 i = 0; i < IMAGELIST_COUNT; i++ ) m_pImageList[i] = 0; m_aOpt.AddListenerLink( LINK( this, SfxImageManager_Impl, OptionsChanged_Impl ) ); Application::AddEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) ); + m_bAppEventListener = true; } //------------------------------------------------------------------------- @@ -177,23 +169,23 @@ SfxImageManager_Impl::SfxImageManager_Impl( SfxModule* pModule ) : SfxImageManager_Impl::~SfxImageManager_Impl() { m_aOpt.RemoveListenerLink( LINK( this, SfxImageManager_Impl, OptionsChanged_Impl ) ); - Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) ); - + if (m_bAppEventListener) + Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) ); for ( sal_uInt32 i = 0; i < m_aToolBoxes.size(); i++ ) delete m_aToolBoxes[i]; } //------------------------------------------------------------------------- -ImageList* SfxImageManager_Impl::GetImageList( sal_Bool bBig, sal_Bool bHiContrast ) +ImageList* SfxImageManager_Impl::GetImageList( bool bBig ) { - sal_Int32 nIndex = impl_convertBools( bBig, bHiContrast ); + sal_Int32 nIndex = impl_convertBools( bBig ); if ( !m_pImageList[nIndex] ) { if ( !m_pModule ) - m_pImageList[nIndex] = ::GetImageList( bBig, bHiContrast ); + m_pImageList[nIndex] = ::GetImageList( bBig ); else - m_pImageList[nIndex] = m_pModule->GetImageList_Impl( bBig, bHiContrast ); + m_pImageList[nIndex] = m_pModule->GetImageList_Impl( bBig ); } return m_pImageList[nIndex]; @@ -201,9 +193,9 @@ ImageList* SfxImageManager_Impl::GetImageList( sal_Bool bBig, sal_Bool bHiContra //------------------------------------------------------------------------- -Image SfxImageManager_Impl::GetImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiContrast ) +Image SfxImageManager_Impl::GetImage( sal_uInt16 nId, bool bBig ) { - ImageList* pImageList = GetImageList( bBig, bHiContrast ); + ImageList* pImageList = GetImageList( bBig ); if ( pImageList ) return pImageList->GetImage( nId ); return Image(); @@ -213,7 +205,7 @@ Image SfxImageManager_Impl::GetImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bH void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( nNewSymbolsSize != m_nSymbolsSize ) { @@ -226,14 +218,13 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize ) if ( pInf->nFlags & SFX_TOOLBOX_CHANGESYMBOLSET ) { ToolBox *pBox = pInf->pToolBox; - sal_Bool bHiContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode(); sal_uInt16 nCount = pBox->GetItemCount(); for ( sal_uInt16 nPos=0; nPos<nCount; nPos++ ) { sal_uInt16 nId = pBox->GetItemId( nPos ); if ( pBox->GetItemType(nPos) == TOOLBOXITEM_BUTTON ) { - pBox->SetItemImage( nId, GetImage( nId, bLarge, bHiContrast ) ); + pBox->SetItemImage( nId, GetImage( nId, bLarge ) ); SfxStateCache *pCache = SfxViewFrame::Current()->GetBindings().GetStateCache( nId ); if ( pCache ) pCache->SetCachedState(); @@ -260,18 +251,37 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize ) IMPL_LINK( SfxImageManager_Impl, OptionsChanged_Impl, void*, EMPTYARG ) { - SetSymbolsSize_Impl( SvtMiscOptions().GetCurrentSymbolsSize() ); + SetSymbolsSize_Impl( m_aOpt.GetCurrentSymbolsSize() ); return 0L; } //------------------------------------------------------------------------- -IMPL_LINK( SfxImageManager_Impl, SettingsChanged_Impl, void*, EMPTYARG ) +IMPL_LINK( SfxImageManager_Impl, SettingsChanged_Impl, VclWindowEvent*, pEvent) { - // Check if toolbar button size have changed and we have to use system settings - sal_Int16 nSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); - if ( m_nSymbolsSize != nSymbolsSize ) - SetSymbolsSize_Impl( nSymbolsSize ); + if (pEvent) + { + switch (pEvent->GetId()) + { + case VCLEVENT_OBJECT_DYING: + if (m_bAppEventListener) + { + Application::RemoveEventListener( LINK( this, SfxImageManager_Impl, SettingsChanged_Impl ) ); + m_bAppEventListener = false; + } + break; + case VCLEVENT_APPLICATION_DATACHANGED: + // Check if toolbar button size have changed and we have to use system settings + { + sal_Int16 nSymbolsSize = m_aOpt.GetCurrentSymbolsSize(); + if (m_nSymbolsSize != nSymbolsSize) + SetSymbolsSize_Impl(nSymbolsSize); + } + break; + default: + break; + } + } return 0L; } @@ -292,29 +302,37 @@ SfxImageManager::~SfxImageManager() //------------------------------------------------------------------------- +namespace +{ + typedef boost::unordered_map< SfxModule*, boost::shared_ptr<SfxImageManager> > SfxImageManagerMap; + + class theImageManagerMap : + public rtl::Static<SfxImageManagerMap, theImageManagerMap> {}; +} + SfxImageManager* SfxImageManager::GetImageManager( SfxModule* pModule ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; + SfxImageManager* pSfxImageManager(0); + + SfxImageManagerMap &rImageManagerMap = theImageManagerMap::get(); - SfxImageManagerMap::const_iterator pIter = - m_ImageManagerMap.find( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule ))); - if ( pIter != m_ImageManagerMap.end() ) - return reinterpret_cast< SfxImageManager* >( sal::static_int_cast< sal_IntPtr >( pIter->second )); + SfxImageManagerMap::const_iterator pIter = rImageManagerMap.find(pModule); + if ( pIter != rImageManagerMap.end() ) + pSfxImageManager = pIter->second.get(); else { - SfxImageManager* pSfxImageManager = new SfxImageManager( pModule ); - m_ImageManagerMap.insert( SfxImageManagerMap::value_type( - sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )), - sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pSfxImageManager )) )); - return pSfxImageManager; + rImageManagerMap[pModule].reset(new SfxImageManager(pModule)); + pSfxImageManager = rImageManagerMap[pModule].get(); } + return pSfxImageManager; } //------------------------------------------------------------------------- -Image SfxImageManager::GetImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiContrast ) const +Image SfxImageManager::GetImage( sal_uInt16 nId, bool bBig ) const { - ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast ); + ImageList* pImageList = pImp->GetImageList( bBig ); if ( pImageList && pImageList->HasImageAtPos( nId ) ) return pImageList->GetImage( nId ); return Image(); @@ -322,23 +340,23 @@ Image SfxImageManager::GetImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiCont //------------------------------------------------------------------------- -Image SfxImageManager::GetImage( sal_uInt16 nId, sal_Bool bHiContrast ) const +Image SfxImageManager::GetImage( sal_uInt16 nId ) const { sal_Bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge(); - return GetImage( nId, bLarge, bHiContrast ); + return GetImage( nId, bLarge ); } //------------------------------------------------------------------------- -Image SfxImageManager::SeekImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiContrast ) const +Image SfxImageManager::SeekImage( sal_uInt16 nId, bool bBig ) const { sal_Bool bGlobal = ( pImp->m_pModule == 0 ); - ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast ); + ImageList* pImageList = pImp->GetImageList( bBig ); if ( pImageList && pImageList->HasImageAtPos( nId ) ) return pImageList->GetImage( nId ); else if ( !bGlobal ) { - pImageList = ::GetImageManager( 0 )->GetImageList( bBig, bHiContrast ); + pImageList = ::GetImageManager( 0 )->GetImageList( bBig ); if ( pImageList ) return pImageList->GetImage( nId ); } @@ -347,17 +365,17 @@ Image SfxImageManager::SeekImage( sal_uInt16 nId, sal_Bool bBig, sal_Bool bHiCon //------------------------------------------------------------------------- -Image SfxImageManager::SeekImage( sal_uInt16 nId, sal_Bool bHiContrast ) const +Image SfxImageManager::SeekImage( sal_uInt16 nId ) const { sal_Bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge(); - return SeekImage( nId, bLarge, bHiContrast ); + return SeekImage( nId, bLarge ); } //------------------------------------------------------------------------- void SfxImageManager::RegisterToolBox( ToolBox *pBox, sal_uInt16 nFlags ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ToolBoxInf_Impl* pInf = new ToolBoxInf_Impl; pInf->pToolBox = pBox; @@ -369,7 +387,7 @@ void SfxImageManager::RegisterToolBox( ToolBox *pBox, sal_uInt16 nFlags ) void SfxImageManager::ReleaseToolBox( ToolBox *pBox ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; for ( sal_uInt32 n=0; n < pImp->m_aToolBoxes.size(); n++ ) { @@ -384,16 +402,16 @@ void SfxImageManager::ReleaseToolBox( ToolBox *pBox ) //------------------------------------------------------------------------- -void SfxImageManager::SetImages( ToolBox& rToolBox, sal_Bool bHiContrast, sal_Bool bLarge ) +void SfxImageManager::SetImages( ToolBox& rToolBox, bool bLarge ) { - SetImagesForceSize( rToolBox, bLarge, bHiContrast ); + SetImagesForceSize( rToolBox, bLarge ); } //------------------------------------------------------------------------- -void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, sal_Bool bHiContrast, sal_Bool bLarge ) +void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, bool bLarge ) { - ImageList* pImageList = pImp->GetImageList( bLarge, bHiContrast ); + ImageList* pImageList = pImp->GetImageList( bLarge ); sal_uInt16 nCount = rToolBox.GetItemCount(); for (sal_uInt16 n=0; n<nCount; n++) @@ -421,6 +439,7 @@ void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, sal_Bool bHiContras void SfxImageManager::SetImages( ToolBox& rToolBox ) { sal_Bool bLarge = ( pImp->m_nSymbolsSize == SFX_SYMBOLS_SIZE_LARGE ); - sal_Bool bHiContrast = rToolBox.GetSettings().GetStyleSettings().GetHighContrastMode(); - SetImagesForceSize( rToolBox, bHiContrast, bLarge ); + SetImagesForceSize( rToolBox, bLarge ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 730926351a05..da3042599ae7 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,6 @@ #include "precompiled_sfx2.hxx" #ifdef SOLARIS -// HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8 #include <ctime> #endif @@ -71,15 +71,10 @@ #include <framework/menuconfiguration.hxx> #include <framework/sfxhelperfunctions.hxx> #include <vcl/taskpanelist.hxx> -#ifndef _TOOLKIT_UNOHLP_HXX #include <toolkit/helper/vclunohelper.hxx> -#endif #include <svtools/menuoptions.hxx> #include <svtools/miscopt.hxx> -#ifndef GCC -#endif - #include <sfx2/tbxctrl.hxx> #include <sfx2/mnumgr.hxx> #include <sfx2/dispatch.hxx> @@ -111,7 +106,6 @@ #include <comphelper/uieventslogger.hxx> #include <com/sun/star/frame/XModuleManager.hpp> -//using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::frame::status; @@ -152,11 +146,11 @@ static Window* GetTopMostParentSystemWindow( Window* pWindow ) svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; URL aTargetURL; aTargetURL.Complete = aCommandURL; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); if ( aTargetURL.Arguments.getLength() ) return NULL; @@ -296,7 +290,7 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime svt::ToolboxController::dispose(); // Remove and destroy our item window at our toolbox - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window* pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId ); pImpl->pBox->SetItemWindow( pImpl->nTbxId, 0 ); delete pWindow; @@ -305,7 +299,7 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime // sub toolbar while we get disposed. Therefore we have to dispose // it now! Not doing so would result in a crash. The sub toolbar // gets destroyed asynchronously and would access a non-existing - // parent toolbar! See #126569# + // parent toolbar! if ( pImpl->mxUIElement.is() ) { Reference< XComponent > xComponent( pImpl->mxUIElement, UNO_QUERY ); @@ -329,7 +323,7 @@ void SfxToolBoxControl::RegisterToolBoxControl( SfxModule* pMod, SfxTbxCtrlFacto SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule* pMod ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxToolBoxControl *pCtrl; SfxApplication *pApp = SFX_APP(); @@ -404,33 +398,31 @@ SfxToolBoxControl* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId, sal_uIn SfxItemState SfxToolBoxControl::GetItemState( const SfxPoolItem* pState ) -/* [Beschreibung] +/* [Description] - Statische Methode zum Ermitteln des Status des SfxPoolItem-Pointers, - in der Methode <SfxControllerItem::StateChanged(const SfxPoolItem*)> - zu verwenden. + Static method for determining the status of the SfxPoolItem-pointer, + used in the method <SfxControllerItem::StateChanged(const SfxPoolItem*)>. - [R"uckgabewert] + [Return value] SfxItemState SFX_ITEM_UNKNOWN - Enabled, aber keine weitere Statusinformation - verf"ugbar. Typisch f"ur <Slot>s, die allenfalls - zeitweise disabled sind, aber ihre Darstellung sonst - nicht "andern. + Enabled, however no further status information is available. + Typical for <Slot>s, which are temporarily disabled a + anyway but other than that do not change their appearance. SFX_ITEM_DISABLED - Disabled und keine weiter Statusinformation - verf"ugbar. Alle anderen ggf. angezeigten Werte sollten - auf den Default zur"uckgesetzt werden. + Disabled, no further status information is available. + All other displayed values should be reset to the default + if possible. SFX_ITEM_DONTCARE - Enabled aber es waren nur uneindeutige Werte - verf"ugbar (also keine, die abgefragt werden k"onnen). + Enabled but there were only ambiguous values available + (i.e. none that could be queried). SFX_ITEM_AVAILABLE - Enabled und mit verf"ugbarem Wert, der von 'pState' - erfragbar ist. Der Typ ist dabei im gesamten - Programm eindeutig und durch den Slot festgelegt. + Enabled and with available values which can be queried + through'pState'. The type is thus by the Slot clearly + defined in the entire Program. */ { @@ -453,7 +445,7 @@ void SfxToolBoxControl::Dispatch( ::com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rCommand; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); @@ -467,7 +459,7 @@ void SfxToolBoxControl::Dispatch( const ::rtl::OUString& aCommand, ::com::sun::s { Reference < XController > xController; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getFrameInterface().is() ) xController = getFrameInterface()->getController(); @@ -486,7 +478,7 @@ void SfxToolBoxControl::Dispatch( const ::rtl::OUString& aCommand, ::com::sun::s ::rtl::OUString sAppName; try { - static ::rtl::OUString our_aModuleManagerName = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); + static ::rtl::OUString our_aModuleManagerName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager( @@ -497,7 +489,7 @@ void SfxToolBoxControl::Dispatch( const ::rtl::OUString& aCommand, ::com::sun::s sAppName = xModuleManager->identify(xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence<PropertyValue> source; - ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString::createFromAscii("SfxToolBoxControl")); + ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxToolBoxControl"))); ::comphelper::UiEventsLogger::logDispatch(aTargetURL, source); } xDispatch->dispatch( aTargetURL, aArgs ); @@ -538,7 +530,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) SfxViewFrame* pViewFrame = NULL; Reference < XController > xController; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getFrameInterface().is() ) xController = getFrameInterface()->getController(); @@ -668,24 +660,24 @@ void SAL_CALL SfxToolBoxControl::updateImage() throw (::com::sun::star::uno::Run // XToolbarController void SAL_CALL SfxToolBoxControl::execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Select( (sal_uInt16)KeyModifier ); } void SAL_CALL SfxToolBoxControl::click() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Click(); } void SAL_CALL SfxToolBoxControl::doubleClick() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; DoubleClick(); } Reference< ::com::sun::star::awt::XWindow > SAL_CALL SfxToolBoxControl::createPopupWindow() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window* pWindow = CreatePopupWindow(); if ( pWindow ) return VCLUnoHelper::GetInterface( pWindow ); @@ -695,7 +687,7 @@ Reference< ::com::sun::star::awt::XWindow > SAL_CALL SfxToolBoxControl::createPo Reference< ::com::sun::star::awt::XWindow > SAL_CALL SfxToolBoxControl::createItemWindow( const Reference< ::com::sun::star::awt::XWindow >& rParent ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return VCLUnoHelper::GetInterface( CreateItemWindow( VCLUnoHelper::GetWindow( rParent ))); } @@ -734,7 +726,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL SfxToolBoxControl::endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aSubToolBarResName; if ( pImpl->mxUIElement.is() ) @@ -782,11 +774,8 @@ throw (::com::sun::star::uno::RuntimeException) try { Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); - ToolBox* pToolBar( 0 ); if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX ) { - pToolBar = (ToolBox *)pTbxWindow; - Any a; a = xProp->getPropertyValue( aPersistentString ); xProp->setPropertyValue( aPersistentString, makeAny( sal_False )); @@ -820,7 +809,7 @@ throw (::com::sun::star::uno::RuntimeException) void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSubToolBarResName ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( pImpl->pBox ) { @@ -972,7 +961,7 @@ void SfxToolBoxControl::StateChanged if ( GetId() >= SID_OBJECTMENU0 && GetId() <= SID_OBJECTMENU_LAST ) return; - // enabled/disabled-Flag pauschal korrigieren + // enabled/disabled-Flag correcting the lump sum pImpl->pBox->EnableItem( GetId(), eState != SFX_ITEM_DISABLED ); sal_uInt16 nItemBits = pImpl->pBox->GetItemBits( GetId() ); @@ -984,7 +973,7 @@ void SfxToolBoxControl::StateChanged { if ( pState->ISA(SfxBoolItem) ) { - // BoolItem fuer checken + // BoolItem for checking if ( ((const SfxBoolItem*)pState)->GetValue() ) eTri = STATE_CHECK; nItemBits |= TIB_CHECKABLE; @@ -992,7 +981,7 @@ void SfxToolBoxControl::StateChanged else if ( pState->ISA(SfxEnumItemInterface) && ((SfxEnumItemInterface *)pState)->HasBoolValue()) { - // EnumItem wie Bool behandeln + // EnumItem is handled as Bool if ( ((const SfxEnumItemInterface *)pState)->GetBoolValue() ) eTri = STATE_CHECK; nItemBits |= TIB_CHECKABLE; @@ -1030,7 +1019,7 @@ void SfxToolBoxControl::Select( sal_Bool /*bMod1*/ ) ::rtl::OUString sAppName; try { - static ::rtl::OUString our_aModuleManagerName = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); + static ::rtl::OUString our_aModuleManagerName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager( @@ -1039,7 +1028,7 @@ void SfxToolBoxControl::Select( sal_Bool /*bMod1*/ ) sAppName = xModuleManager->identify(m_xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence<PropertyValue> vSource; - ::comphelper::UiEventsLogger::appendDispatchOrigin(vSource, sAppName, ::rtl::OUString::createFromAscii("SfxToolBoxControl")); + ::comphelper::UiEventsLogger::appendDispatchOrigin(vSource, sAppName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SfxToolBoxControl"))); URL aURL; aURL.Complete = m_aCommandURL; ::comphelper::UiEventsLogger::logDispatch(aURL, vSource); @@ -1111,7 +1100,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) SfxViewFrame* pViewFrame = NULL; Reference < XController > xController; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_xFrame.is() ) xController = m_xFrame->getController(); @@ -1398,7 +1387,7 @@ void SfxPopupWindow::PopupModeEnd() if ( IsVisible() ) { - // wurde abgerissen + // was teared-off DeleteFloatingWindow(); m_bFloating = sal_True; } @@ -1425,7 +1414,7 @@ void SfxPopupWindow::MouseMove( const ::MouseEvent& rMEvt ) FloatingWindow::MouseMove( rMEvt ); else { - // MouseMove-Event an die Children forwarden + // Forward MouseMove-Event to Children ::Point aPos = rMEvt.GetPosPixel(); ::Point aScrPos = OutputToScreenPixel( aPos ); sal_uInt16 i = 0; @@ -1459,14 +1448,14 @@ void SfxPopupWindow::EndCascading() SfxPopupWindow* SfxPopupWindow::Clone() const -/* [Beschreibung] +/* [Description] - Diese Methode mu\s "uberladen werden, um dieses Popup auch im - Presentations-Modus anzuzeigen. Sie wird gerufen, wenn ein Show() - sinnlos w"are, da der Parent nicht das Presentations-Window ist. - Beim neu erzeugen wird automatisch das neue Top-Window verwendet, so - da\s der Parent das Presentations-Window ist und das neue Popup somit - sichtbar ist. + This method must be overloaded to show this Popup also in the + Presentation-mode. It is called when a Show() would be meaningless + since the parent is no presentation window. + When create a new window the bew Top-Window will be used automatically, + so that the Parent becomes the presentation window and and that the new + Popup therefore becomes visible. */ { @@ -1479,16 +1468,14 @@ void SfxPopupWindow::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ ) -/* [Bescheibung] +/* [Description] - Siehe auch <SfxControllerItem::StateChanged()>. Au\serdem wird - bei eState==SFX_ITEM_DISABLED das Popup gehided und in allen anderen - F"allen, falls es floating ist, wieder angezeigt. Daher mu\s die - Basisklasse i.d.R. gerufen werden. - - Es findet wegen des Parents eine Sonderbehandlung f"ur den - Presentationsmodus statt. + See also <SfxControllerItem::StateChanged()>. In addition the Popup + will become hidden when eState==SFX_ITEM_DISABLED and in all other + cases it will be shown again if it is floating. In general this requires + to call the Base class. + Due to the parent the presentation mode is handled in a special way. */ { @@ -1525,7 +1512,6 @@ SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uI // Determine the current background color of the menus const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); m_nSymbolsStyle = rSettings.GetSymbolsStyle(); - m_bWasHiContrastMode = rSettings.GetHighContrastMode(); m_bShowMenuImages = rSettings.GetUseImagesInMenus(); SetImage( String() ); @@ -1614,7 +1600,7 @@ SfxPopupWindow* SfxAppToolBoxControl_Impl::CreatePopupWindow() if ( !pMenu ) { ::framework::MenuConfiguration aConf( m_xServiceManager ); - if ( m_aCommandURL.equalsAscii( ".uno:AddDirect" )) + if ( m_aCommandURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".uno:AddDirect" ) )) pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_NEWMENU ); else pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_WIZARDMENU ); @@ -1650,11 +1636,10 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL ) aURL = sFallback; sal_Bool bBig = SvtMiscOptions().AreCurrentSymbolsLarge(); - sal_Bool bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode(); - Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig, bHC ); + Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig ); if ( !aImage ) aImage = !!aMenuImage ? aMenuImage : - SvFileInformationManager::GetImage( INetURLObject( aURL ), bBig, bHC ); + SvFileInformationManager::GetImage( INetURLObject( aURL ), bBig ); Size aBigSize( GetToolBox().GetDefaultImageSize() ); if ( bBig && aImage.GetSizePixel() != aBigSize ) { @@ -1712,7 +1697,7 @@ void SfxAppToolBoxControl_Impl::Select( sal_Bool bMod1 ) aTargetURL.Complete = aLastURL; getURLTransformer()->parseStrict( aTargetURL ); - ::rtl::OUString aTarget( ::rtl::OUString::createFromAscii( "_default" )); + ::rtl::OUString aTarget( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default"))); if ( pMenu ) { ::framework::MenuConfiguration::Attributes* pMenuAttributes = @@ -1728,8 +1713,8 @@ void SfxAppToolBoxControl_Impl::Select( sal_Bool bMod1 ) { Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = ::rtl::OUString::createFromAscii( "Referer" ); - aArgs[0].Value = makeAny( ::rtl::OUString::createFromAscii( SFX_REFERER_USER )); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); + aArgs[0].Value = makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER )) ); ExecuteInfo* pExecuteInfo = new ExecuteInfo; pExecuteInfo->xDispatch = xDispatch; @@ -1760,7 +1745,7 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) URL aTargetURL; aTargetURL.Complete = aURL; Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); @@ -1772,7 +1757,7 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); else { - ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii( "_blank" ) ); + ::rtl::OUString aTargetFrame( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")) ); ::framework::MenuConfiguration::Attributes* pMenuAttributes = (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() ); @@ -1801,15 +1786,12 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); sal_uIntPtr nSymbolsStyle = rSettings.GetSymbolsStyle(); - sal_Bool bIsHiContrastMode = rSettings.GetHighContrastMode(); sal_Bool bShowMenuImages = rSettings.GetUseImagesInMenus(); if (( nSymbolsStyle != m_nSymbolsStyle ) || - ( bIsHiContrastMode != m_bWasHiContrastMode ) || ( bShowMenuImages != m_bShowMenuImages )) { m_nSymbolsStyle = nSymbolsStyle; - m_bWasHiContrastMode = bIsHiContrastMode; m_bShowMenuImages = bShowMenuImages; sal_uInt16 nCount = pActMenu->GetItemCount(); @@ -1831,7 +1813,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) if ( aImageId.getLength() > 0 ) { Reference< ::com::sun::star::frame::XFrame > xFrame; - Image aImage = GetImage( xFrame, aImageId, sal_False, bIsHiContrastMode ); + Image aImage = GetImage( xFrame, aImageId, false ); if ( !!aImage ) { bImageSet = sal_True; @@ -1843,7 +1825,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu ) if ( !bImageSet && aCmd.Len() ) { Image aImage = SvFileInformationManager::GetImage( - INetURLObject(aCmd), sal_False, bIsHiContrastMode ); + INetURLObject(aCmd), false ); if ( !!aImage ) pActMenu->SetItemImage( nId, aImage ); } @@ -1873,16 +1855,6 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, Execute // Framework can recycle our current frame and the layout manager disposes all user interface // elements if a component gets detached from its frame! pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); -/* -} - catch (const ::com::sun::star::document::CorruptedFilterConfigurationException& exFilters) - { - throw exFilters; - } - catch (const Exception& ) - { - } -*/ delete pExecuteInfo; return 0; } @@ -1892,3 +1864,5 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, Execute void SfxAppToolBoxControl_Impl::Click( ) { } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 1b9260474938..7b429e5bcf58 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,28 +38,17 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/container/XChild.hpp> -#ifndef _MENU_HXX //autogen #include <vcl/menu.hxx> -#endif #include <svl/intitem.hxx> -#ifndef _SPLITWIN_HXX //autogen #include <vcl/splitwin.hxx> -#endif #include <svl/eitem.hxx> #include <svl/stritem.hxx> -#ifndef _TOOLKIT_UNOHLP_HXX #include <toolkit/helper/vclunohelper.hxx> -#endif #include <com/sun/star/awt/PosSize.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <vcl/msgbox.hxx> -#ifndef GCC -#endif - -// wg. pTopFrames +// due to pTopFrames #include "appdata.hxx" #include <sfx2/app.hxx> #include <sfx2/event.hxx> @@ -135,7 +125,7 @@ SfxFrame::~SfxFrame() if ( pChildArr ) { - DBG_ASSERT( !pChildArr->Count(), "Childs nicht entfernt!" ); + DBG_ASSERT( !pChildArr->Count(), "Children are not removed!" ); delete pChildArr; } @@ -144,7 +134,7 @@ SfxFrame::~SfxFrame() sal_Bool SfxFrame::DoClose() { - // Eigentlich wird noch ein PrepareClose gebraucht !!! + // Actually, one more PrepareClose is still needed! sal_Bool bRet = sal_False; if ( !pImp->bClosing ) { @@ -187,7 +177,7 @@ sal_Bool SfxFrame::DoClose_Impl() if ( pImp->pCurrentViewFrame ) pBindings = &pImp->pCurrentViewFrame->GetBindings(); - // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden + // For internal tasks Controllers and Tools must be cleared if ( pImp->pWorkWin ) pImp->pWorkWin->DeleteControllers_Impl(); @@ -267,7 +257,7 @@ SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const { if ( pChildArr && pChildArr->Count() > nPos ) { - DBG_ASSERT( nPos < pChildArr->Count(), "Falscher Index!"); + DBG_ASSERT( nPos < pChildArr->Count(), "Wrong Index!"); return (*pChildArr)[nPos]; } @@ -276,7 +266,7 @@ SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) { - DBG_ASSERT( pChildArr, "Unbekannter Frame!"); + DBG_ASSERT( pChildArr, "Unknown Frame!"); sal_uInt16 nPos = pChildArr->GetPos(pFrame); pChildArr->Remove( nPos ); }; @@ -316,7 +306,7 @@ void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) for( pFrm = SfxViewFrame::GetFirst( pObj ); pFrm && &pFrm->GetFrame() == this; pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ; - // Keine anderer Frame mehr auf Doc -> Cancel + // No more Frame in Document -> Cancel if( !pFrm ) { pObj->CancelTransfers(); @@ -324,12 +314,12 @@ void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) } } - // zuerst Nachladende Frames stoppen + // First stop multiload Frames sal_uInt16 nCount = GetChildFrameCount(); for( sal_uInt16 n = 0; n<nCount; n++ ) GetChildFrame( n )->CancelTransfers(); - // ggf. StarOne-Loader canceln + // Check if StarOne-Loader should be canceled SfxFrameWeak wFrame( this ); if (wFrame.Is()) pImp->bInCancelTransfers = sal_False; @@ -372,9 +362,10 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) void SfxFrame::GetViewData_Impl() { - // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die - // festen Daten werden nur einmal ( nach PrepareForDoc_Impl in UpdateDescriptor ) - // geholt, um Zeit zu sparen. + // Update all modifiable data between load and unload, the + // fixed data is only processed once (after PrepareForDoc_Impl in + // updateDescriptor) to save time. + SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) { @@ -395,7 +386,7 @@ void SfxFrame::GetViewData_Impl() pSet->Put( SfxUInt16Item( SID_VIEW_ID, pViewFrame->GetCurViewId() ) ); if ( pChildArr ) { - // Bei Framesets m"ussen auch die Daten der ChildViews geholt werden + // For Framesets also the data from the ChildViews hace to be processed sal_uInt16 nCount = pChildArr->Count(); for ( sal_uInt16 n=nCount; n>0; n--) { @@ -410,15 +401,15 @@ void SfxFrame::GetViewData_Impl() void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { - // Beim PrepareForDoc_Impl wird der Descriptor des Frames aktualisiert - // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres - // Restaurieren der View n"otig sind, sind damit festgehalten. - // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) - // die neueste Information hinzugef"ugt. Alles zusammen wird dann in der - // Browse-History gesichert. Beim Aktivieren eines solchen FramePickEntry - // wird das komplette ItemSet und der Descriptor im OpenDoc mitgeschickt. - // Hier werden nur die festen Eigenschaften gesichert; die "anderbaren werden - // durch GetViewData geholt ( spart Zeit ). + // For PrepareForDoc_Impl frames, the descriptor of the updated + // and new itemset to be initialized. All data fir restoring the view + // are thus saved. If the document be replaced, GetViewData_Impl (so) + // the latest information hinzugef by "added. All together then the + // browser-history saved in. When you activate such frame pick entry + // is complete itemsets and the descriptor in the OpenDoc sent;. + // Here only the fixed properties identified "other adjustable, the + // retrieved by GetViewData (saves time). + DBG_ASSERT( pDoc, "NULL-Document inserted ?!" ); GetParentFrame(); @@ -430,7 +421,7 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) GetDescriptor()->SetEditable( bEditable ); - // FileOpen-Parameter merken + // Mark FileOpen parameter SfxItemSet* pItemSet = pMed->GetItemSet(); String aMedName( pMed->GetName() ); @@ -445,7 +436,7 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) SfxItemSet *pSet = GetDescriptor()->GetArgs(); - // Alle alten Items l"oschen + // Delete all old Items pSet->ClearItem(); if ( pRefererItem ) @@ -466,13 +457,13 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD ) { - DBG_ASSERT( pD, "Kein Descriptor!" ); - DBG_ASSERT( pD != pImp->pDescr, "Descriptor ist schon gesetzt!" ); + DBG_ASSERT( pD, "No Descriptor!" ); + DBG_ASSERT( pD != pImp->pDescr, "Descriptor is already set!" ); if ( pImp->pDescr ) { - // Nur TopLevel-Frames verwalten ihren Descriptor selbst, bei den - // anderen tut es das Frameset + // Only TopLevel-Frames handels their Descriptor, for the others + // this is done by the Frameset if ( !pParentFrame ) delete pImp->pDescr; } @@ -483,12 +474,12 @@ void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD ) SfxFrameDescriptor* SfxFrame::GetDescriptor() const { - // On Demand einen FrameDescriptor anlegen; wenn es kein TopLevel-Frame - // ist, f"uhrt es zu Fehlern, da keine g"ulige Verkettung hergestellt wird + // Create a FrameDescriptor On Demand; if there is no TopLevel-Frame + // will result in an error, as no valid link is created. if ( !pImp->pDescr ) { - DBG_ASSERT( !GetParentFrame(), "Kein TopLevel-Frame, aber kein Descriptor!" ); + DBG_ASSERT( !GetParentFrame(), "No TopLevel-Frame, but no Descriptor!" ); pImp->pDescr = new SfxFrameDescriptor; if ( GetCurrentDocument() ) pImp->pDescr->SetURL( GetCurrentDocument()->GetMedium()->GetOrigURL() ); @@ -502,12 +493,12 @@ void SfxFrame::GetTargetList( TargetList& rList ) const { if ( !GetParentFrame() ) { - // Einen Leerstring f"ur 'Kein Target' - rList.Insert( new String() ); - rList.Insert( new String( DEFINE_CONST_UNICODE( "_top" ) ) ); - rList.Insert( new String( DEFINE_CONST_UNICODE( "_parent" ) ) ); - rList.Insert( new String( DEFINE_CONST_UNICODE( "_blank" ) ) ); - rList.Insert( new String( DEFINE_CONST_UNICODE( "_self" ) ) ); + // An empty string for 'No Target' + rList.push_back( new String() ); + rList.push_back( new String( DEFINE_CONST_UNICODE( "_top" ) ) ); + rList.push_back( new String( DEFINE_CONST_UNICODE( "_parent" ) ) ); + rList.push_back( new String( DEFINE_CONST_UNICODE( "_blank" ) ) ); + rList.push_back( new String( DEFINE_CONST_UNICODE( "_self" ) ) ); } SfxViewFrame* pView = GetCurrentViewFrame(); @@ -592,7 +583,7 @@ SfxPoolItem* SfxFrameItem::Clone( SfxItemPool *) const return pNew; } -sal_Bool SfxFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const +bool SfxFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const { if ( wFrame ) { @@ -603,7 +594,7 @@ sal_Bool SfxFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) c return sal_False; } -sal_Bool SfxFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) +bool SfxFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 ) { Reference < XFrame > xFrame; if ( (rVal >>= xFrame) && xFrame.is() ) @@ -634,7 +625,6 @@ SfxUsrAnyItem::SfxUsrAnyItem( sal_uInt16 nWhichId, const ::com::sun::star::uno:: int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const { -// return rItem.ISA( SfxUsrAnyItem ) && ((SfxUsrAnyItem&)rItem).aValue == aValue; return sal_False; } @@ -643,13 +633,13 @@ SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const return new SfxUsrAnyItem( Which(), aValue ); } -sal_Bool SfxUsrAnyItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SfxUsrAnyItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal = aValue; return sal_True; } -sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { aValue = rVal; return sal_True; @@ -677,13 +667,13 @@ SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const return new SfxUnoFrameItem( Which(), m_xFrame ); } -sal_Bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= m_xFrame; return sal_True; } -sal_Bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { return ( rVal >>= m_xFrame ); } @@ -695,19 +685,19 @@ SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur ) SfxFrame* SfxFrameIterator::FirstFrame() { - // GetFirst beginnt die Iteration beim ersten ChildFrame + // GetFirst starts the iteration at the first child frame return pFrame->GetChildFrame( 0 ); } SfxFrame* SfxFrameIterator::NextFrame( SfxFrame& rPrev ) { - // Zuerst auf Kinder testen, wenn Rekursion erw"unscht + // If recursion is requested testing is done first on Children. SfxFrame *pRet = NULL; if ( bRecursive ) pRet = rPrev.GetChildFrame( 0 ); if ( !pRet ) { - // Anderenfalls mit den Geschwistern von rPrev weitermachen + // In other case continue with the siblings of rPrev pRet = NextSibling_Impl( rPrev ); } @@ -883,7 +873,7 @@ void SfxFrame::CreateWorkWindow_Impl() } catch(Exception&) { - OSL_ENSURE(0,"SfxFrame::CreateWorkWindow_Impl: Exception cachted. Please try to submit a repoducable bug !"); + OSL_FAIL("SfxFrame::CreateWorkWindow_Impl: Exception cachted. Please try to submit a repoducable bug !"); } } @@ -992,3 +982,4 @@ const SfxPoolItem* SfxFrame::OpenDocumentSynchron( SfxItemSet& i_rSet, const Ref return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, i_rSet ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index ea6ab3abfb74..924d2bd7e557 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,7 +122,7 @@ long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt ) { if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) { - DBG_TRACE("SfxFrame: GotFocus"); + OSL_TRACE("SfxFrame: GotFocus"); pView->MakeActive_Impl( sal_False ); } @@ -154,7 +155,6 @@ long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt ) } else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) { - //EnableInput( sal_True, sal_True ); pView->SetModalMode( sal_False ); return sal_True; } @@ -437,7 +437,6 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const { Window *pWin = pImp->pExternalContainerWindow; - // Groesse setzen const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); Point aPos( rWinArea.TopLeft() ); Size aSz( rWinArea.GetSize() ); @@ -479,3 +478,5 @@ bool SfxFrame::IsMarkedHidden_Impl() const { return pImp->bHidden; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 958f37f12916..a72b49ad1dc6 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" +#include <sal/macros.h> #include "frmload.hxx" #include "objshimp.hxx" #include "sfx2/app.hxx" @@ -74,7 +76,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> #include <ucbhelper/simpleinteractionrequest.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> /** === begin UNO using === **/ using ::com::sun::star::beans::PropertyValue; @@ -322,7 +324,7 @@ SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XM } } - DBG_ERROR( "SfxFrameLoader_Impl::impl_findObjectShell: model is not based on SfxObjectShell - wrong frame loader usage!" ); + OSL_FAIL( "SfxFrameLoader_Impl::impl_findObjectShell: model is not based on SfxObjectShell - wrong frame loader usage!" ); return NULL; } @@ -438,7 +440,7 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo }; ::comphelper::NamedValueCollection aViewArgs; - for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pKnownViewArgs ); ++i ) { if ( io_rDescriptor.has( pKnownViewArgs[i] ) ) { @@ -524,7 +526,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA { ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); @@ -695,14 +697,14 @@ UNOSEQUENCE< UNOOUSTRING > SfxFrameLoader_Impl::impl_getStaticSupportedServiceNa { UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() ); UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = UNOOUSTRING::createFromAscii( "com.sun.star.frame.SynchronousFrameLoader" ); + seqServiceNames.getArray() [0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.SynchronousFrameLoader" )); return seqServiceNames ; } /* Helper for XServiceInfo */ UNOOUSTRING SfxFrameLoader_Impl::impl_getStaticImplementationName() { - return UNOOUSTRING::createFromAscii( "com.sun.star.comp.office.FrameLoader" ); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.office.FrameLoader" )); } /* Helper for registry */ @@ -711,3 +713,4 @@ UNOREFERENCE< UNOXINTERFACE > SAL_CALL SfxFrameLoader_Impl::impl_createInstance( return UNOREFERENCE< UNOXINTERFACE >( *new SfxFrameLoader_Impl( xServiceManager ) ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 72f322036efb..b49f9dd777a4 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index 8fea153aed52..c4b3d081843e 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -96,3 +97,4 @@ public: #endif // SFX2_IMPVIEWFRAME_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 30f2d568a3a8..bcbb1e349058 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -196,29 +197,13 @@ throw (::com::sun::star::uno::RuntimeException) xDocument = m_pClient->GetViewShell()->GetObjectShell()->GetModel(); SfxObjectShell::SetCurrentComponent( xDocument ); } - else if ( m_pClient && nNewState == embed::EmbedStates::UI_ACTIVE ) - { -/* - uno::Reference < lang::XUnoTunnel > xObj( m_xObject->getComponent(), uno::UNO_QUERY ); - uno::Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); - sal_Int64 nHandle = xObj.is() ? xObj->getSomething( aSeq ) : 0; - if ( nHandle ) - { - // currently needs SFX code - SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); - SfxWorkWindow *pWorkWin = pFrame->GetFrame().GetWorkWindow_Impl(); - pWorkWin->UpdateObjectBars_Impl(); - } -*/ - } } void SAL_CALL SfxInPlaceClient_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; - if ( m_pClient && aEvent.EventName.equalsAscii("OnVisAreaChanged") && m_nAspect != embed::Aspects::MSOLE_ICON ) + if ( m_pClient && aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnVisAreaChanged")) && m_nAspect != embed::Aspects::MSOLE_ICON ) { m_pClient->FormatChanged(); // for Writer when format of the object is changed with the area m_pClient->ViewChanged(); @@ -354,7 +339,7 @@ void SAL_CALL SfxInPlaceClient_Impl::visibilityChanged( sal_Bool bVisible ) throw ( embed::WrongStateException, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_pClient || !m_pClient->GetViewShell() ) throw uno::RuntimeException(); @@ -438,7 +423,7 @@ uno::Reference< ::com::sun::star::frame::XLayoutManager > SAL_CALL SfxInPlaceCli uno::Reference< ::com::sun::star::frame::XLayoutManager > xMan; try { - uno::Any aAny = xFrame->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); + uno::Any aAny = xFrame->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ); aAny >>= xMan; } catch ( uno::Exception& ) @@ -692,7 +677,7 @@ void SfxInPlaceClient::SetObjectState( sal_Int32 nState ) if ( m_pImp->m_nAspect == embed::Aspects::MSOLE_ICON && ( nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::INPLACE_ACTIVE ) ) { - OSL_ENSURE( sal_False, "Iconified object should not be activated inplace!\n" ); + OSL_FAIL( "Iconified object should not be activated inplace!\n" ); return; } @@ -737,7 +722,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can not clean the client site!\n" ); + OSL_FAIL( "Can not clean the client site!\n" ); } } } @@ -761,7 +746,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can not set the client site!\n" ); + OSL_FAIL( "Can not set the client site!\n" ); } m_pImp->m_aTimer.Start(); @@ -1167,3 +1152,5 @@ sal_Bool SfxInPlaceClient::IsUIActive() { return m_pImp->m_bUIActive; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx index 21bc74affd70..b33684a4e6f4 100644 --- a/sfx2/source/view/orgmgr.cxx +++ b/sfx2/source/view/orgmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,16 +32,10 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/ElementModes.hpp> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <tools/urlobj.hxx> -#ifndef GCC -#endif -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <unotools/intlwrapper.hxx> #include <comphelper/storagehelper.hxx> @@ -62,26 +57,22 @@ using namespace ::com::sun::star; //========================================================================= -/* [Beschreibung] - - Implementierungsklasse; einzelner Eintrag in der Dateiansicht +/* [Description] + Implementation class, single entry in the file view. */ struct _FileListEntry { - String aFileName; // Dateiname mit komplettem Pfad - String aBaseName; // Dateiname + String aFileName; // File Name with complete path + String aBaseName; // File Name const CollatorWrapper* pCollator; - SfxObjectShellLock aDocShell; // ObjectShell als Ref-Klasse - -//REMOVE SvStorageRef aStor; // Referenz auf Storage, wenn wir diesen geoeffnet haben - //uno::Reference< embed::XStorage > xStorage; + SfxObjectShellLock aDocShell; // ObjectShell as reference class - sal_Bool bFile; // als Datei auf Platte - // (!= unbenannt1, nicht als Dok. geladen; - // diese werden nicht gespeichert!) - sal_Bool bOwner; // selbst erzeugt + sal_Bool bFile; // As File on disk + // (!= not processed, not loaded as document + // these are not saved!) + sal_Bool bOwner; // self-generated sal_Bool bNoName; sal_Bool bOwnFormat; @@ -147,22 +138,21 @@ SV_IMPL_OP_PTRARR_SORT(_SfxObjectList, _FileListEntry*) sal_Bool _FileListEntry::DeleteObjectShell() -/* [Beschreibung] - - Freigabe der DokumentShell +/* [Description] - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release of ther DocumentShell + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { sal_Bool bRet = sal_True; - //Falls wir die Shell angelegt haben und sie veraendert wurde + if(bOwner && aDocShell.Is() && aDocShell->IsModified()) { - //Mussten wir konvertieren? + // Converted? if( bOwnFormat ) { if(!aDocShell->Save() ) @@ -181,12 +171,11 @@ sal_Bool _FileListEntry::DeleteObjectShell() { } -// aDocShell->SfxObjectShell::DoSaveCompleted(); } } else { - // Falls konvertiert im eigenen Format speichern + // If converted save in native format INetURLObject aObj( aFileName ); String aTitle = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); @@ -242,13 +231,9 @@ SfxOrganizeMgr::SfxOrganizeMgr( SfxOrganizeListBox_Impl *pLeft, bDeleteTemplates(pTempl == 0), bModified(0) -/* [Beschreibung] - - Konstruktor - - Das aktuelle Dokument wird in die Liste der Dokumente - aufgenommen. +/* [Description] + Constructor. The current document is added to the list of documents. */ { pImpl->pDocList = new SfxObjectList; @@ -283,20 +268,19 @@ SfxOrganizeMgr::~SfxOrganizeMgr() SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell( sal_uInt16 nIdx ) -/* [Beschreibung] +/* [Description] - Zugriff auf die DokumentShell an der Position nIdx + Access to the DocumentShell at the position nIdx. - [Returnwert] Referenz auf die DokumentShell + [Return value] Reference to the DocumentShell */ { _FileListEntry* pEntry = (*pImpl->pDocList)[nIdx]; - // andernfalls Doc-Shell anlegen + // otherwise create Doc-Shell if ( !pEntry->aDocShell.Is() ) { -//(mba)/task SfxWaitCursor aWaitCursor; INetURLObject aFileObj( pEntry->aFileName ); sal_Bool bDum = sal_False; SfxApplication* pSfxApp = SFX_APP(); @@ -345,14 +329,13 @@ SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell( sal_uInt16 nIdx ) sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - Freigabe der DokumentShell an der Position nIdx - - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release DocumentShell at position nIdx + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { return (*pImpl->pDocList)[nIdx]->DeleteObjectShell(); @@ -362,16 +345,15 @@ sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nIdx) SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - Zugriff auf die DokumentShell an der Position nIdx im Bereich - nRegion (Dokumentvorlage) + Access to the DocumentShell at Position nIdx in Region + nRegion (Document template) - [Returnwert] Referenz auf die DokumentShell + [Return value] Reference to the DocumentShell */ { -//(mba)/task SfxWaitCursor aWaitCursor; return pTemplates->CreateObjectShell(nRegion, nIdx); } @@ -379,15 +361,14 @@ SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell(sal_uInt16 nRegion, sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] - - Freigabe der DokumentShell an der Position nIdx im Bereich - nRegion (Dokumentvorlage) +/* [Description] - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release of the DocumentShell at Position nIdx in Region + nRegion (Document template) + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { @@ -401,22 +382,22 @@ sal_Bool SfxOrganizeMgr::Copy(sal_uInt16 nTargetRegion, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx) -/* [Beschreibung] +/* [Description] - Kopieren einer Dokumentvorlage + Copy of a Document Template [Parameter] - sal_uInt16 nTargetRegion Index des Zielbereiches - sal_uInt16 nTargetIdx Index Zielposition - sal_uInt16 nSourceRegion Index des Quellbereiches - sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden - Dokumentvorlage + sal_uInt16 nTargetRegion Index of the Target Region + sal_uInt16 nTargetIdx Index of the Target Position + sal_uInt16 nSourceRegion Index of the Source Region + sal_uInt16 nSourceIdx Index of the template to be + copied/moved. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Copy(sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, @@ -426,7 +407,7 @@ sal_Bool SfxOrganizeMgr::Copy(sal_uInt16 nTargetRegion, */ { - if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse kopieren + if(nSourceIdx == USHRT_MAX) // No directories copied return sal_False ; const sal_Bool bOk = pTemplates->Copy(nTargetRegion, nTargetIdx, nSourceRegion, nSourceIdx); @@ -442,32 +423,30 @@ sal_Bool SfxOrganizeMgr::Move(sal_uInt16 nTargetRegion, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx) -/* [Beschreibung] +/* [Description] - Verschieben einer Dokumentvorlage + Moving a template [Parameter] - sal_uInt16 nTargetRegion Index des Zielbereiches - sal_uInt16 nTargetIdx Index Zielposition - sal_uInt16 nSourceRegion Index des Quellbereiches - sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden - Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nTargetRegion Index of the Target Region + sal_uInt16 nTargetIdx Index of the Target Position + sal_uInt16 nSourceRegion Index of the Source Region + sal_uInt16 nSourceIdx Index of the template to be + copied/moved. + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Move(sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx)> - */ { - if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse verschieben + if(nSourceIdx == USHRT_MAX) // No directory moved return sal_False ; const sal_Bool bOk = pTemplates->Move(nTargetRegion, nTargetIdx, nSourceRegion, nSourceIdx); @@ -481,24 +460,21 @@ sal_Bool SfxOrganizeMgr::Move(sal_uInt16 nTargetRegion, sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - "oschen einer Dokumentvorlage + Delete a Document Template [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u oder - durch das Keyboard angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. + sal_uInt16 nRegion Index for Region + sal_uInt16 nIdx Index of Document template + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Delete(sal_uInt16 nRegion, sal_uInt16 nIdx)> @@ -515,26 +491,22 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, if ( pGroupToDelete ) { sal_uInt16 nItemNum = (sal_uInt16)( pCaller->GetModel()->GetChildCount( pGroupToDelete ) ); - sal_uInt16 nToDeleteNum = 0; - SvLBoxEntry **pEntriesToDelete = new SvLBoxEntry*[nItemNum]; + typedef std::deque<SvLBoxEntry*> BoxEntries; + BoxEntries pEntriesToDelete; sal_uInt16 nInd = 0; for ( nInd = 0; nInd < nItemNum; nInd++ ) - pEntriesToDelete[nInd] = NULL; - - for ( nInd = 0; nInd < nItemNum; nInd++ ) { // TODO/LATER: check that nInd is the same index that is used in pTemplates if ( pTemplates->Delete( nRegion, nInd ) ) { bModified = 1; - pEntriesToDelete[nToDeleteNum++] = pCaller->SvLBox::GetEntry( pGroupToDelete, nInd ); + pEntriesToDelete.push_back( pCaller->SvLBox::GetEntry( pGroupToDelete, nInd ) ); } } - for ( nInd = 0; nInd < nToDeleteNum; nInd++ ) - if ( pEntriesToDelete[nInd] ) - pCaller->GetModel()->Remove( pEntriesToDelete[nInd] ); + for ( BoxEntries::const_iterator aIt( pEntriesToDelete.begin() ), aEnd( pEntriesToDelete.end() ); aIt != aEnd; ++aIt ) + pCaller->GetModel()->Remove( *aIt ); if ( !pCaller->GetModel()->GetChildCount( pGroupToDelete ) ) { @@ -551,7 +523,7 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, if(bOk) { bModified = 1; - // zu loeschender Eintrag + // Entry to be deleted. SvLBoxEntry *pEntryToDelete = pCaller->SvLBox::GetEntry(pCaller->SvLBox::GetEntry(nRegion), nIdx); pCaller->GetModel()->Remove(pEntryToDelete); @@ -565,26 +537,20 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, sal_Bool SfxOrganizeMgr::InsertDir ( - SfxOrganizeListBox_Impl* pCaller,/* rufende ListBox; da dieses Event - durch das Men"u oder durch das - Keyboard angetriggert wird, - mu\s das Model der ListBox - anschlie\send aktualisiert werden */ - const String& rText, // logischer Name des Bereiches - sal_uInt16 nRegion // Index des Bereiches + SfxOrganizeListBox_Impl* pCaller, /* calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. */ + const String& rText, // logical Name of Region + sal_uInt16 nRegion // Index of Region ) -/* [Beschreibung] - - Einf"ugen eines Bereiches +/* [Description] + Insert Region. - [R"uckgabewert] + [Return value] Success (TRUE) or Failure (FALSE) - Erfolg (sal_True) oder Mi\serfolg (sal_False) - - - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::InsertDir(const String &, sal_uInt16 nRegion)> */ @@ -609,23 +575,21 @@ sal_Bool SfxOrganizeMgr::InsertDir sal_Bool SfxOrganizeMgr::SetName(const String &rName, sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - "Andern eines (logischen) Namens + Set (logical) Name [Parameter] - const String &rName der neue Name - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + const String &rName The new Name + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document template + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::SetName(const String &, sal_uInt16 nRegion, sal_uInt16 nIdx)> - */ { @@ -639,23 +603,21 @@ sal_Bool SfxOrganizeMgr::SetName(const String &rName, sal_Bool SfxOrganizeMgr::CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const -/* [Beschreibung] +/* [Description] - Export einer Vorlage + Export of a Template [Parameter] - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - const String &rName Dateiname - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document Template + const String &rName File name + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::CopyTo( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)> - */ { @@ -667,27 +629,25 @@ sal_Bool SfxOrganizeMgr::CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const Strin sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName) -/* [Beschreibung] +/* [Description] - Import einer Vorlage + Import of Document Template [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - String &rName Dateiname + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document Template + String &rName File name + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::CopyFrom( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)> - */ { @@ -696,7 +656,7 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, pParent = pCaller->GetParent(pParent); if( pTemplates->CopyFrom( nRegion, nIdx, rName ) ) { - // pCaller aktualisieren + // Update pCaller if( nIdx == USHRT_MAX ) nIdx = 0; else nIdx++; @@ -708,7 +668,6 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_True, nIdx); pCaller->Update(); - // pCaller->EditEntry( pEntry ); pCaller->Expand( pParent ); bModified = sal_True; return sal_True; @@ -720,20 +679,19 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const String& rFileName ) -/* [Beschreibung] +/* [Description] - Eine Datei in der Dateiansicht hinzuf"ugen + Insert a file in the file view. [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - const String &rFileName Name der hinzuf"ugenden Datei + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + const String &rFileName Name of inserted File. + [Return value] Success (TRUE) or Failure (FALSE) */ { @@ -754,16 +712,16 @@ sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const Str sal_Bool SfxOrganizeMgr::Rescan() -/* [Beschreibung] +/* [Description] - Aktualisieren der Datenbasis + Updating the database. - [R"uckgabewert] + [Return value] - sal_True es bestanden Unterschiede - FALSE keine "Anderung + TRUE Changes were made + FALSE No changes - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Rescan()> */ @@ -781,14 +739,13 @@ sal_Bool SfxOrganizeMgr::Rescan() void SfxOrganizeMgr::SaveAll(Window *pParent) -/* [Beschreibung] +/* [Description] - Schreiben aller ge"anderten Dokumente + Save all Documents that have been modified [Parameter] - Window *pParent Parent der Boxen f"ur Fehlermeldungen - + Window *pParent Parent of the Error message Box */ { @@ -830,3 +787,4 @@ void SfxOrganizeMgr::SaveAll(Window *pParent) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx index 470b96106184..5f044c94dc0b 100644 --- a/sfx2/source/view/printer.cxx +++ b/sfx2/source/view/printer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,6 @@ #include <svtools/printoptions.hxx> #include <vector> -#ifndef GCC -#endif - #include <sfx2/printer.hxx> #include <sfx2/printopt.hxx> #include "sfxtypes.hxx" @@ -75,23 +73,23 @@ struct SfxPrintOptDlg_Impl SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions ) -/* [Beschreibung] +/* [Description] - 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. + Creates a <SfxPrinter> from the stream. Loading is really only a jobsetup. + If such a printer is not available on the system, then the original is + marked as the original Job-setup and a comparable printer is selected from + existing ones. - Die 'pOptions' werden in den erzeugten SfxPrinter "ubernommen, - der Returnwert geh"ort dem Caller. + The 'pOptions' are taken over in the generated SfxPrinter, the return + value belongs to the caller. */ { - // JobSetup laden + // Load JobSetup JobSetup aFileJobSetup; rStream >> aFileJobSetup; - // Drucker erzeugen + // Get printers SfxPrinter *pPrinter = new SfxPrinter( pOptions, aFileJobSetup ); return pPrinter; } @@ -100,9 +98,9 @@ SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions ) SvStream& SfxPrinter::Store( SvStream& rStream ) const -/* [Beschreibung] +/* [Description] - Speichert das verwendete JobSetup des <SfxPrinter>s. + Saves the used JobSetup of <SfxPrinter>s. */ { @@ -113,9 +111,9 @@ SvStream& SfxPrinter::Store( SvStream& rStream ) const SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions ) : -/* [Beschreibung] +/* [Description] - Dieser Ctor erzeugt einen Standard-Drucker. + This constructor creates a default printer. */ pOptions( pTheOptions ), @@ -228,7 +226,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent, { SetText( SfxResId( STR_PRINT_OPTIONS_TITLE ) ); - // TabPage einh"angen + // Insert TabPage pPage = pViewSh->CreatePrintOptionsPage( this, *pOptions ); DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" ); if( pPage ) @@ -238,7 +236,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent, pPage->Show(); } - // Dialoggr"o\se bestimmen + // Set dialog size Size a6Sz = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); Size aBtnSz = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); Size aOutSz( pPage ? pPage->GetSizePixel() : Size() ); @@ -247,7 +245,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent, nWidth += a6Sz.Width(); aOutSz.Width() += nWidth; if ( aOutSz.Height() < 90 ) - // mindestens die H"ohe der 3 Buttons + // at least the height of the 3 buttons aOutSz.Height() = 90; SetOutputSizePixel( aOutSz ); @@ -310,3 +308,4 @@ void SfxPrintOptionsDialog::DisableHelp() aHelpBtn.Disable(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index b3a7bea50946..58f1cfa64676 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,7 +81,7 @@ #include <workwin.hxx> #include <sfx2/objface.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <osl/mutex.hxx> #include <tools/diagnose_ex.h> #include <comphelper/sequence.hxx> @@ -90,7 +91,7 @@ #include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <sfx2/event.hxx> #include "sfx2/viewfac.hxx" @@ -177,7 +178,7 @@ static GroupIDToCommandGroup GroupIDCommandGroupMap[] = { 0 , 0 } }; -typedef std::hash_map< sal_Int16, sal_Int16 > GroupHashMap; +typedef boost::unordered_map< sal_Int16, sal_Int16 > GroupHashMap; sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID ) @@ -275,7 +276,7 @@ public: void SAL_CALL SfxStatusIndicator::start(const ::rtl::OUString& aText, sal_Int32 nRange) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xOwner.is() ) { _nRange = nRange; @@ -294,7 +295,7 @@ void SAL_CALL SfxStatusIndicator::start(const ::rtl::OUString& aText, sal_Int32 void SAL_CALL SfxStatusIndicator::end(void) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xOwner.is() ) { if ( !xProgress.is() ) @@ -309,7 +310,7 @@ void SAL_CALL SfxStatusIndicator::end(void) throw(::com::sun::star::uno::Runtime void SAL_CALL SfxStatusIndicator::setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xOwner.is() ) { if ( !xProgress.is() ) @@ -324,7 +325,7 @@ void SAL_CALL SfxStatusIndicator::setText(const ::rtl::OUString& aText) throw(:: void SAL_CALL SfxStatusIndicator::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xOwner.is() ) { _nValue = nValue; @@ -343,7 +344,7 @@ void SAL_CALL SfxStatusIndicator::setValue( sal_Int32 nValue ) throw(::com::sun: void SAL_CALL SfxStatusIndicator::reset() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xOwner.is() ) { if ( !xProgress.is() ) @@ -358,13 +359,12 @@ void SAL_CALL SfxStatusIndicator::reset() throw(::com::sun::star::uno::RuntimeEx void SAL_CALL SfxStatusIndicator::disposing( const com::sun::star::lang::EventObject& /*Source*/ ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; xOwner = 0; xProgress.clear(); } //________________________________________________________________________________________________________ -//________________________________________________________________________________________________________ // declaration IMPL_SfxBaseController_ListenerHelper //________________________________________________________________________________________________________ @@ -420,7 +420,7 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::disposing( const EVENT void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const EVENTOBJECT& aEvent, sal_Bool bDeliverOwnership ) throw (RUNTIMEEXCEPTION, com::sun::star::util::CloseVetoException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; SfxViewShell* pShell = m_pController->GetViewShell_Impl(); if ( m_pController != NULL && pShell ) { @@ -437,7 +437,7 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::queryClosing( const EV pShell->TakeFrameOwnerShip_Impl(); } - throw com::sun::star::util::CloseVetoException(::rtl::OUString::createFromAscii("Controller disagree ..."),static_cast< ::cppu::OWeakObject*>(this)); + throw com::sun::star::util::CloseVetoException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Controller disagree ...")),static_cast< ::cppu::OWeakObject*>(this)); } } } @@ -504,7 +504,7 @@ IMPL_SfxBaseController_ListenerHelper::~IMPL_SfxBaseController_ListenerHelper() void SAL_CALL IMPL_SfxBaseController_ListenerHelper::frameAction( const FRAMEACTIONEVENT& aEvent ) throw( RUNTIMEEXCEPTION ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( ( m_pController != NULL ) && ( aEvent.Frame == m_pController->getFrame() ) && @@ -529,7 +529,7 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::frameAction( const FRAMEACT void SAL_CALL IMPL_SfxBaseController_ListenerHelper::disposing( const EVENTOBJECT& /*aEvent*/ ) throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pController && m_pController->getFrame().is() ) m_pController->getFrame()->removeFrameActionListener( this ) ; } @@ -561,7 +561,7 @@ SfxBaseController::~SfxBaseController() Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_pData->m_pViewShell ) throw DisposedException(); @@ -570,7 +570,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run ::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) throw DisposedException(); @@ -587,7 +587,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) throw DisposedException(); @@ -616,7 +616,7 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame { REFERENCE< XFRAME > xTemp( getFrame() ) ; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( xTemp.is() ) { xTemp->removeFrameActionListener( m_pData->m_xListener ) ; @@ -654,7 +654,7 @@ sal_Bool SAL_CALL SfxBaseController::attachModel( const REFERENCE< XMODEL >& xMo if ( m_pData->m_pViewShell && xModel.is() && xModel != m_pData->m_pViewShell->GetObjectShell()->GetModel() ) { // don't allow to reattach a model! - DBG_ERROR("Can't reattach model!"); + OSL_FAIL("Can't reattach model!"); return sal_False; } @@ -670,7 +670,7 @@ sal_Bool SAL_CALL SfxBaseController::attachModel( const REFERENCE< XMODEL >& xMo sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // ignore dublicate calls, which doesnt change anything real if (bSuspend == m_pData->m_bSuspendState) @@ -691,7 +691,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: getFrame()->removeFrameActionListener( m_pData->m_xListener ) ; SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - // weitere View auf dasselbe Doc? + // More Views on the same document? SfxObjectShell* pDocShell = m_pData->m_pViewShell->GetObjectShell() ; sal_Bool bOther = sal_False ; @@ -730,7 +730,7 @@ ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeExcept { ANY aAny; String sData1; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { m_pData->m_pViewShell->WriteUserData( sData1 ) ; @@ -747,7 +747,7 @@ ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeExcept void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { ::rtl::OUString sData; @@ -762,7 +762,7 @@ void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::c REFERENCE< XFRAME > SAL_CALL SfxBaseController::getFrame() throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_pData->m_xFrame; } @@ -772,7 +772,7 @@ REFERENCE< XFRAME > SAL_CALL SfxBaseController::getFrame() throw( ::com::sun::st REFERENCE< XMODEL > SAL_CALL SfxBaseController::getModel() throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return m_pData->m_pViewShell ? m_pData->m_pViewShell->GetObjectShell()->GetModel() : REFERENCE < XMODEL > () ; } @@ -784,14 +784,14 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU const ::rtl::OUString& sTargetFrameName, sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; REFERENCE< XDISPATCH > xDisp; if ( m_pData->m_pViewShell ) { SfxViewFrame* pAct = m_pData->m_pViewShell->GetViewFrame() ; if ( !m_pData->m_bDisposing ) { - if ( sTargetFrameName.compareToAscii( "_beamer" ) == COMPARE_EQUAL ) + if ( sTargetFrameName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("_beamer")) ) { SfxViewFrame *pFrame = m_pData->m_pViewShell->GetViewFrame(); if ( eSearchFlags & ( ::com::sun::star::frame::FrameSearchFlag::CREATE )) @@ -808,7 +808,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU return xProv->queryDispatch( aURL, sTargetFrameName, ::com::sun::star::frame::FrameSearchFlag::SELF ); } - if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL ) + if ( aURL.Protocol.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".uno:")) ) { rtl::OUString aMasterCommand = SfxOfficeDispatch::GetMasterUnoCommand( aURL ); sal_Bool bMasterCommand( aMasterCommand.getLength() > 0 ); @@ -864,7 +864,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU } } } - else if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL ) + else if ( aURL.Protocol.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("slot:")) ) { sal_uInt16 nId = (sal_uInt16) aURL.Path.toInt32(); @@ -916,7 +916,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU } } } - else if( sTargetFrameName.compareToAscii( "_self" )==COMPARE_EQUAL || sTargetFrameName.getLength()==0 ) + else if( sTargetFrameName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("_self")) || sTargetFrameName.getLength()==0 ) { // check for already loaded URL ... but with additional jumpmark! REFERENCE< XMODEL > xModel = getModel(); @@ -964,7 +964,7 @@ frame::BorderWidths SAL_CALL SfxBaseController::getBorder() { frame::BorderWidths aResult; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { SvBorder aBorder = m_pData->m_pViewShell->GetBorderPixel(); @@ -994,7 +994,7 @@ void SAL_CALL SfxBaseController::removeBorderResizeListener( const uno::Referenc awt::Rectangle SAL_CALL SfxBaseController::queryBorderedArea( const awt::Rectangle& aPreliminaryRectangle ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { Rectangle aTmpRect = VCLRectangle( aPreliminaryRectangle ); @@ -1035,7 +1035,7 @@ void SfxBaseController::BorderWidthsChanged_Impl() void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Reference< XController > xTmp( this ); m_pData->m_bDisposing = sal_True ; @@ -1120,7 +1120,7 @@ void SAL_CALL SfxBaseController::removeEventListener( const REFERENCE< XEVENTLIS void SfxBaseController::ReleaseShell_Impl() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { SfxObjectShell* pDoc = m_pData->m_pViewShell->GetObjectShell() ; @@ -1146,7 +1146,7 @@ SfxViewShell* SfxBaseController::GetViewShell_Impl() const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL SfxBaseController::getStatusIndicator( ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() ) m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() ); return m_pData->m_xIndicator; @@ -1157,7 +1157,7 @@ void SAL_CALL SfxBaseController::registerContextMenuInterceptor( const REFERENCE { m_pData->m_aInterceptorContainer.addInterface( xInterceptor ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) m_pData->m_pViewShell->AddContextMenuInterceptor_Impl( xInterceptor ); } @@ -1167,39 +1167,39 @@ void SAL_CALL SfxBaseController::releaseContextMenuInterceptor( const REFERENCE< { m_pData->m_aInterceptorContainer.removeInterface( xInterceptor ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) m_pData->m_pViewShell->RemoveContextMenuInterceptor_Impl( xInterceptor ); } void SAL_CALL SfxBaseController::addKeyHandler( const ::com::sun::star::uno::Reference< XKEYHANDLER >& xHandler ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aUserInputInterception.addKeyHandler( xHandler ); } void SAL_CALL SfxBaseController::removeKeyHandler( const ::com::sun::star::uno::Reference< XKEYHANDLER >& xHandler ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aUserInputInterception.removeKeyHandler( xHandler ); } void SAL_CALL SfxBaseController::addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aUserInputInterception.addMouseClickHandler( xHandler ); } void SAL_CALL SfxBaseController::removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pData->m_aUserInputInterception.removeMouseClickHandler( xHandler ); } ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL SfxBaseController::getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; std::list< sal_Int16 > aGroupList; SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() ); @@ -1208,7 +1208,7 @@ throw (::com::sun::star::uno::RuntimeException) SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL(); const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG ); - // Gruppe anw"ahlen ( Gruppe 0 ist intern ) + // Select Group ( Group 0 is internal ) for ( sal_uInt16 i=0; i<pSlotPool->GetGroupCount(); i++ ) { String aName = pSlotPool->SeekGroup( i ); @@ -1235,7 +1235,7 @@ throw (::com::sun::star::uno::RuntimeException) { std::list< ::com::sun::star::frame::DispatchInformation > aCmdList; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG ); @@ -1399,7 +1399,7 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) rFrame.GetWindow().Show(); } - // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! + // UpdateTitle now, hidden TopFrames have otherwise no Name! pViewFrame->UpdateTitle(); if ( !rFrame.IsInPlace() ) @@ -1487,7 +1487,7 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( ! m_pData->m_xTitleHelper.is ()) { @@ -1540,3 +1540,5 @@ void SAL_CALL SfxBaseController::removeTitleChangeListener(const css::uno::Refer if (xBroadcaster.is ()) xBroadcaster->removeTitleChangeListener (xListener); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index 97c9e7926e39..19c6ff50e5c9 100644 --- a/sfx2/source/view/userinputinterception.cxx +++ b/sfx2/source/view/userinputinterception.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -266,7 +267,7 @@ namespace sfx2 break; default: - OSL_ENSURE( false, "UserInputInterception::handleNotifyEvent: illegal event type!" ); + OSL_FAIL( "UserInputInterception::handleNotifyEvent: illegal event type!" ); break; } @@ -276,3 +277,5 @@ namespace sfx2 //........................................................................ } // namespace sfx2 //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/view.hrc b/sfx2/source/view/view.hrc index 3dce1ec795bb..3dce1ec795bb 100644..100755 --- a/sfx2/source/view/view.hrc +++ b/sfx2/source/view/view.hrc diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index 1b48d716ff79..16fd68505ad9 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,4 @@ SfxViewFactory::~SfxViewFactory() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index eb8fb8cf6125..f7950f650e5d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,6 +49,7 @@ #include <svl/undo.hxx> #include <vcl/msgbox.hxx> #include <svtools/sfxecode.hxx> +#include <svtools/miscopt.hxx> #include <svtools/ehdl.hxx> #include <tools/diagnose_ex.h> #include <com/sun/star/container/XIndexAccess.hpp> @@ -109,7 +111,7 @@ using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::container::XIndexContainer; namespace css = ::com::sun::star; -// wg. ViewFrame::Current +// Due to ViewFrame::Current #include "appdata.hxx" #include <sfx2/taskpane.hxx> #include <sfx2/app.hxx> @@ -170,8 +172,6 @@ SFX_IMPL_INTERFACE(SfxViewFrame,SfxShell,SfxResId(0)) TYPEINIT2(SfxViewFrame,SfxShell,SfxListener); TYPEINIT1(SfxViewFrameItem, SfxPoolItem); -//========================================================================= - //------------------------------------------------------------------------- namespace { @@ -307,7 +307,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SfxFrame *pParent = GetFrame().GetParentFrame(); if ( rReq.GetSlot() == SID_RELOAD ) { - // Bei CTRL-Reload den aktiven Frame reloaden + // When CTRL-Reload, reload the active Frame SfxViewFrame* pActFrame = this; while ( pActFrame ) pActFrame = pActFrame->GetActiveChildFrame_Impl(); @@ -322,8 +322,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } } - // Wenn nur ein Reload der Graphiken eines oder mehrerer ChildFrames - // gemacht werden soll + // If only a reload of the graphics for one or more child frames + // should be made SfxFrame& rFrame = GetFrame(); if ( pParent == &rFrame && rFrame.GetChildFrameCount() ) { @@ -342,14 +342,14 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pChild = pNext; } - // Der TopLevel-Frame selbst het keine Graphiken! + // The top level frame itself has no graphics! if ( bReloadAvailable ) return; } } else { - // Bei CTRL-Edit den TopFrame bearbeiten + // When CTRL-Edit, edit the TopFrame. sal_uInt16 nModifier = rReq.GetModifier(); if ( ( nModifier & KEY_MOD1 ) && pParent ) @@ -368,9 +368,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if ( GetFrame().HasComponent() ) break; - // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch - // m"oglich, da\s der Slot zwar enabled ist, aber Ctrl-Click - // trotzdem nicht geht! + // Due to Double occupancy in toolboxes (with or without Ctrl), + // it is also possible that the slot is enabled, but Ctrl-click + // despite this is not! if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT )) break; @@ -407,7 +407,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) sal_Bool bNeedsReload = sal_False; if ( !pSh->IsReadOnly() ) { - // Speichern und Readonly Reloaden + // Save and reload Readonly if( pSh->IsModified() ) { if ( pSh->PrepareClose() ) @@ -450,11 +450,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) return; } - // Parameter auswerten - // sal_Bool bReload = sal_True; if ( rReq.IsAPI() ) { - // per API steuern ob r/w oder r/o + // Control through API if r/w or r/o SFX_REQUEST_ARG(rReq, pEditItem, SfxBoolItem, SID_EDITDOC, sal_False); if ( pEditItem ) nOpenMode = pEditItem->GetValue() ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY; @@ -518,12 +516,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pSh->DoSaveCompleted( pMed ); } - // r/o-Doc kann nicht in Editmode geschaltet werden? + // Readonly document can not be switched to edit mode? rReq.Done( sal_False ); if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) { - // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen + // ::com::sun::star::sdbcx::User offering to open it as a template QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); if ( RET_YES == aBox.Execute() ) { @@ -564,8 +562,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) ); rReq.Done( sal_True ); - // if( nOpenMode == SFX_STREAM_READONLY ) - // pMed->Close(); return; } } @@ -576,9 +572,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) case SID_RELOAD: { - // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch - // m"oglich, da\s der Slot zwar enabled ist, aber Ctrl-Click - // trotzdem nicht geht! + // Due to Double occupancy in toolboxes (with or without Ctrl), + // it is also possible that the slot is enabled, but Ctrl-click + // despite this is not! if ( !pSh || !pSh->CanReload_Impl() ) break; SfxApplication* pApp = SFX_APP(); @@ -590,7 +586,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if( pImp->bReloading || pSh->IsInModalMode() ) return; - // AutoLoad ist ggf. verboten + // AutoLoad is prohibited if possible SFX_REQUEST_ARG(rReq, pAutoLoadItem, SfxBoolItem, SID_AUTOLOAD, sal_False); if ( pAutoLoadItem && pAutoLoadItem->GetValue() && GetFrame().IsAutoLoadLocked_Impl() ) @@ -600,12 +596,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pImp->bReloading = sal_True; SFX_REQUEST_ARG(rReq, pURLItem, SfxStringItem, SID_FILE_NAME, sal_False); - // editierbar "offnen? + // Open as editable? sal_Bool bForEdit = !pSh->IsReadOnly(); if ( rReq.GetSlot() == SID_EDITDOC ) bForEdit = !bForEdit; - // ggf. beim User nachfragen + // If possible ask the User sal_Bool bDo = ( GetViewShell()->PrepareClose() != sal_False ); SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False); if ( bDo && GetFrame().DocIsModified_Impl() && @@ -619,15 +615,15 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { SfxMedium *pMedium = xOldObj->GetMedium(); - // Frameset abziehen, bevor FramesetView evtl. verschwindet + // Remove Frameset before the FramesetView may disappear String aURL = pURLItem ? pURLItem->GetValue() : pMedium->GetName(); sal_Bool bHandsOff = ( pMedium->GetURLObject().GetProtocol() == INET_PROT_FILE && !xOldObj->IsDocShared() ); - // bestehende SfxMDIFrames f"ur dieses Doc leeren - // eigenes Format oder R/O jetzt editierbar "offnen? + // Emty existing SfxMDIFrames for this Document + // in native format or R/O, open it now for editing? SfxObjectShellLock xNewObj; // collect the views of the document @@ -680,9 +676,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pNewSet->ClearItem( SID_DOC_READONLY ); } - // Falls eine salvagede Datei vorliegt, nicht nochmals die - // OrigURL mitschicken, denn die Tempdate ist nach Reload - // ungueltig + // If a salvaged file is present, do not enclose the OrigURL + // again, since the Tempdate is invalid after reload. SFX_ITEMSET_ARG( pNewSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); if( pSalvageItem ) { @@ -691,12 +686,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } // TODO/LATER: Temporary solution, the SfxMedium must know the original URL as aLogicName - // SfxMedium::Transfer_Impl() will be vorbidden then. + // SfxMedium::Transfer_Impl() will be forbidden then. if ( xOldObj->IsDocShared() ) pNewSet->Put( SfxStringItem( SID_FILE_NAME, xOldObj->GetSharedFileURL() ) ); - //pNewMedium = new SfxMedium( aURL, nMode, pMedium->IsDirect(), bUseFilter ? pMedium->GetFilter() : 0, pNewSet ); - //pNewSet = pNewMedium->GetItemSet(); if ( pURLItem ) pNewSet->Put( SfxStringItem( SID_REFERER, pMedium->GetName() ) ); else @@ -704,8 +697,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) xOldObj->CancelTransfers(); - // eigentliches Reload - //pNewSet->Put( SfxFrameItem ( SID_DOCFRAME, GetFrame() ) ); if ( pSilentItem && pSilentItem->GetValue() ) pNewSet->Put( SfxBoolItem( SID_SILENT, sal_True ) ); @@ -716,7 +707,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if (!pInteractionItem) { - Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY ); + Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler"))), UNO_QUERY ); if (xHdl.is()) pNewSet->Put( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) ); } @@ -727,8 +718,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pNewSet->Put( SfxUInt16Item(SID_UPDATEDOCMODE,::com::sun::star::document::UpdateDocMode::ACCORDING_TO_CONFIG) ); xOldObj->SetModified( sal_False ); - // Altes Dok nicht cachen! Gilt nicht, wenn anderes - // Doc geladen wird. + // Do not chache the old Document! Is invalid when loading + // another document. SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False); SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False); @@ -797,12 +788,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); } } - else - { - // an error handling should be done here?! - // if ( !pSilentItem || !pSilentItem->GetValue() ) - // ErrorHandler::HandleError( nLoadError ); - } } else { @@ -857,14 +842,14 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); } - // als erledigt recorden + // Record as done rReq.Done( sal_True ); rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True)); return; } else { - // als nicht erledigt recorden + // Record as not done rReq.Done(); rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_False)); pImp->bReloading = sal_False; @@ -879,7 +864,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) { SfxObjectShell* pSh = GetObjectShell(); if ( !pSh ) - // Ich bin gerade am Reloaden und Yielde so vor mich hin ... + // I'm just on reload and am yielding myself ... return; GetFrame().GetParentFrame(); @@ -888,8 +873,8 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) { if ( GetFrame().HasComponent() ) { - // Wenn die Komponente es nicht selbst dispatched, dann - // macht es auch keinen Sinn! + // If the component is not self-dispatched, then + // it makes no sense! rSet.DisableItem( nWhich ); continue; } @@ -920,8 +905,8 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) rSet.DisableItem(nWhich); else { - // Wenn irgendein ChildFrame reloadable ist, wird der Slot - // enabled, damit man CTRL-Reload machen kann + // If any ChildFrame is reloadable, the slot is enabled, + // so you can perfom CTRL-Reload sal_Bool bReloadAvailable = sal_False; SfxFrameIterator aFrameIter( *pFrame, sal_True ); for( SfxFrame* pNextFrame = aFrameIter.FirstFrame(); @@ -951,7 +936,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) //-------------------------------------------------------------------- void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) { - // gibt es an der obersten Shell einen Undo-Manager? + // Is there an Undo-Manager on the top Shell? SfxShell *pSh = GetDispatcher()->GetShell(0); ::svl::IUndoManager* pShUndoMgr = pSh->GetUndoManager(); sal_Bool bOK = sal_False; @@ -985,7 +970,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) } else if ( GetViewShell() ) { - // der SW hat eigenes Undo an der View + // The SW has its own undo in the View const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq ); if ( pRet ) bOK = ((SfxBoolItem*)pRet)->GetValue(); @@ -998,16 +983,16 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) //-------------------------------------------------------------------- void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) { - // Undo-Manager suchen + // Search for Undo-Manager SfxShell *pSh = GetDispatcher()->GetShell(0); if ( !pSh ) - // Ich bin gerade am Reloaden und Yielde so vor mich hin ... + // I'm just on reload and am yielding myself ... return; ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager(); if ( !pShUndoMgr ) { - // der SW hat eigenes Undo an der View + // The SW has its own undo in the View SfxWhichIter aIter( rSet ); SfxViewShell *pViewSh = GetViewShell(); if( !pViewSh ) return; @@ -1076,20 +1061,19 @@ void SfxViewFrame::PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ) //-------------------------------------------------------------------- void SfxViewFrame::ReleaseObjectShell_Impl() -/* [Beschreibung] - - Diese Methode entleert den SfxViewFrame, d.h. nimmt die <SfxObjectShell> - vom Dispatcher und beendet seine <SfxListener>-Beziehung zu dieser - SfxObjectShell (wodurch sie sich ggf. selbst zerst"ort). +/* [Description] - Somit kann durch Aufruf von ReleaseObjectShell() und SetObjectShell() - die SfxObjectShell ausgetauscht werden. + This method empties the SfxViewFrame, i.e. takes the <SfxObjectShell> + from the dispatcher and ends its <SfxListener> Relationship to this + SfxObjectShell (by which they may even destroy themselves). - Zwischen RealeaseObjectShell() und SetObjectShell() darf die Kontrolle - nicht an das System abgegeben werden. + Thus, by invoking ReleaseObjectShell() and SetObjectShell() the + SfxObjectShell can be replaced. + Between RealeaseObjectShell() and SetObjectShell() can the control not + be handed over to the system. - [Querverweise] + [Cross-reference] <SfxViewFrame::SetObjectShell(SfxObjectShell&)> */ @@ -1114,7 +1098,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl() } #ifdef DBG_UTIL else - DBG_ERROR("Keine Shell"); + OSL_FAIL("No Shell"); #endif if ( xObjSh.Is() ) @@ -1153,8 +1137,8 @@ sal_Bool SfxViewFrame::Close() DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" ); - // Wenn bis jetzt noch nicht gespeichert wurde, sollen eingebettete Objekte - // auch nicht mehr automatisch gespeichert werden! + // If no saving have been made up until now, then embedded Objects should + // not be saved automatically anymore. if ( GetViewShell() ) GetViewShell()->DiscardClients_Impl(); Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); @@ -1162,8 +1146,8 @@ sal_Bool SfxViewFrame::Close() if (SfxViewFrame::Current() == this) SfxViewFrame::SetViewFrame( NULL ); - // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr - // vern"unftig verwenden - also besser still legen + // Since the Dispatcher is emptied, it can not be used in any reasnable + // manner, thus it is better to let the dispatcher be. GetDispatcher()->Lock(sal_True); delete this; @@ -1179,26 +1163,10 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame ) pDispatcher->DoActivate_Impl( bUI, pOldFrame ); - // Wenn ich einen parent habe und dieser ist kein parent des alten - // ViewFrames, erh"alt er ein ParentActivate + // If this ViewFrame has got a parent and this is not a parent of the + // old ViewFrames, it gets a ParentActivate. if ( bUI ) { -/* - SfxMedium* pMed = GetObjectShell() ? GetObjectShell()->GetMedium() : NULL; - if( pMed ) - { - SFX_ITEMSET_ARG( - pMed->GetItemSet(), pInterceptorItem, SfxSlotInterceptorItem, - SID_INTERCEPTOR, sal_False ); - if( pInterceptorItem ) - { - SfxSlotInterceptor* pInter = pInterceptorItem->GetValue(); - if( !pInter->GetBindings() ) - pInter->SetBindings( &GetBindings() ); - pInter->Activate( sal_True ); - } - } - */ SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { @@ -1216,23 +1184,10 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) SFX_APP(); pDispatcher->DoDeactivate_Impl( bUI, pNewFrame ); - // Wenn ich einen parent habe und dieser ist kein parent des neuen - // ViewFrames, erh"alt er ein ParentDeactivate + // If this ViewFrame has got a parent and this is not a parent of the + // new ViewFrames, it gets a ParentDeactivate. if ( bUI ) { -// if ( GetFrame().GetWorkWindow_Impl() ) -// GetFrame().GetWorkWindow_Impl()->SaveStatus_Impl(); -/* - SfxMedium* pMed = GetObjectShell() ? GetObjectShell()->GetMedium() : NULL; - if( pMed ) - { - SFX_ITEMSET_ARG( - pMed->GetItemSet(), pInterceptorItem, SfxSlotInterceptorItem, - SID_INTERCEPTOR, sal_False ); - if( pInterceptorItem ) - pInterceptorItem->GetValue()->Activate( sal_False ); - } -*/ SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { @@ -1252,13 +1207,6 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) { if ( GetFrame().IsInPlace() ) { - /* - Size aSize( GetViewShell()->GetWindow()->GetSizePixel() ); - - //Size aBorderSz( pEnv->GetBorderWin()->GetHatchBorderPixel() ); - Point aOfs; //( aBorderSz.Width(), aBorderSz.Height() ); - - DoAdjustPosSizePixel( GetViewShell(), aOfs, aSize );*/ return; } @@ -1341,7 +1289,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if ( !xObjSh.Is() ) break; - // r/o Umschaltung? + // Switch r/o? SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); SfxDispatcher *pDispat = GetDispatcher(); @@ -1349,7 +1297,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) sal_Bool bIsReadOnly = xObjSh->IsReadOnly(); if ( !bWasReadOnly != !bIsReadOnly ) { - // Dann auch TITLE_CHANGED + // Then also TITLE_CHANGED UpdateTitle(); rBind.Invalidate( SID_FILE_NAME ); rBind.Invalidate( SID_DOCINFO_TITLE ); @@ -1358,11 +1306,12 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pDispat->GetBindings()->InvalidateAll(sal_True); pDispat->SetReadOnly_Impl( bIsReadOnly ); - // Dispatcher-Update nur erzwingen, wenn es nicht sowieso - // demn"achst kommt, anderenfalls ist Zappelei oder gar - // GPF m"oglich, da Writer z.B. gerne mal im Resize irgendwelche - // Aktionen t"atigt, die ein SetReadOnlyUI am Dispatcher zur - // Folge haben! + // Only force and Dispatcher-Update, if it is done next + // anyway, otherwise flickering or GPF is possibel since + // the Writer for example prefers in Resize preform some + // actions which has a SetReadOnlyUI in Dispatcher as a + // result! + if ( pDispat->IsUpdated_Impl() ) pDispat->Update_Impl(sal_True); } @@ -1397,9 +1346,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } else if ( rHint.IsA(TYPE(SfxEventHint)) ) { - // Wenn das Document asynchron geladen wurde, wurde der Dispatcher - // auf ReadOnly gesetzt, was zur"?ckgenommen werden mu\s, wenn - // das Document selbst nicht ReadOnly ist und das Laden fertig ist. + // When the Document is loaded asynchronously, was the Dispatcher + // set as ReadOnly, to what must be returned when the document itself + // is not read only, and the loading is finished. switch ( ((SfxEventHint&)rHint).GetEventId() ) { case SFX_EVENT_MODIFYCHANGED: @@ -1423,8 +1372,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rBind.Invalidate( SID_EDITDOC ); if ( !xObjSh->IsReadOnly() ) { - // Im Gegensatz zu oben (TITLE_CHANGED) mu\s das UI nicht - // upgedated werden, da es nicht gehidet war! + // In contrast to above (TITLE_CHANGED) does the UI not + // have to be updated because it was not obstructed // #i21560# InvalidateAll() causes the assertion // 'SfxBindings::Invalidate while in update" when @@ -1432,7 +1381,6 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // via API from another thread (Java). // According to MBA this call is not necessary anymore, // because each document has its own SfxBindings. - // //GetDispatcher()->GetBindings()->InvalidateAll(sal_True); } @@ -1497,7 +1445,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) pDispatcher->Flush(); } - SfxViewFrame *pThis = this; // wegen der kranken Array-Syntax + SfxViewFrame *pThis = this; // this due to the sick Array syntax SfxViewFrameArr_Impl &rViewArr = SFX_APP()->GetViewFrames_Impl(); rViewArr.C40_INSERT(SfxViewFrame, pThis, rViewArr.Count() ); } @@ -1508,11 +1456,11 @@ SfxViewFrame::SfxViewFrame SfxObjectShell* pObjShell ) -/* [Beschreibung] +/* [Description] - Ctor des SfxViewFrame f"ur eine <SfxObjectShell> aus der Ressource. - Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden - (default ist die zuerst registrierte SfxViewShell-Subklasse). + Constructor of SfxViewFrame for a <SfxObjectShell> from the Resource. + The 'nViewId' to the created <SfxViewShell> can be returned. + (default is the SfxViewShell-Subclass that was registered first). */ : pImp( new SfxViewFrame_Impl( rFrame ) ) @@ -1545,7 +1493,7 @@ SfxViewFrame::~SfxViewFrame() ReleaseObjectShell_Impl(); if ( GetFrame().OwnsBindings_Impl() ) - // Die Bindings l"oscht der Frame! + // The Bindings delete the Frame! KillDispatcher_Impl(); delete pImp->pWindow; @@ -1553,13 +1501,13 @@ SfxViewFrame::~SfxViewFrame() if ( GetFrame().GetCurrentViewFrame() == this ) GetFrame().SetCurrentViewFrame_Impl( NULL ); - // von Frame-Liste abmelden + // Unregister from the Frame List. SfxApplication *pSfxApp = SFX_APP(); SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); const SfxViewFrame *pThis = this; rFrames.Remove( rFrames.GetPos(pThis) ); - // Member l"oschen + // Delete Member KillDispatcher_Impl(); delete pImp; @@ -1568,7 +1516,7 @@ SfxViewFrame::~SfxViewFrame() //------------------------------------------------------------------------ void SfxViewFrame::KillDispatcher_Impl() -// Dispatcher abr"aumen und l"oschen +// Remove and delete the Dispatcher. { DBG_CHKTHIS(SfxViewFrame, 0); @@ -1595,9 +1543,9 @@ SfxViewFrame* SfxViewFrame::Current() //-------------------------------------------------------------------- sal_uInt16 SfxViewFrame::Count() -/* [Beschreibung] +/* [Description] - Liefert die Anzahl der sichtbaren <SfxViewFrame>-Instanzen. + Returns the number of visable <SfxViewFrame> instances. */ { @@ -1692,48 +1640,23 @@ SfxProgress* SfxViewFrame::GetProgress() const //-------------------------------------------------------------------- void SfxViewFrame::ShowStatusText( const String& /*rText*/) { -/* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & - framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be - extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); - SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); - if ( pMgr ) - { - pMgr->GetStatusBar()->HideItems(); - pMgr->GetStatusBar()->SetText( rText ); - } -*/ } //-------------------------------------------------------------------- void SfxViewFrame::HideStatusText() { -/* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & - framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be - extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); - SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); - if ( pMgr ) - pMgr->GetStatusBar()->ShowItems(); -*/ } - //-------------------------------------------------------------------- #ifdef ENABLE_INIMANAGER//MUSTINI SfxIniManager* SfxViewFrame::GetIniManager() const { -/* SfxIniManager *pIniMgr = GetObjectShell() - ? GetObjectShell()->GetFactory().GetIniManager() - : 0; - if ( !pIniMgr )*/ //! return SFX_APP()->GetAppIniManager(); -// return pIniMgr; } #endif //-------------------------------------------------------------------- -void SfxViewFrame::DoAdjustPosSizePixel //! teilen in Inner.../Outer... +void SfxViewFrame::DoAdjustPosSizePixel //! divide on Inner.../Outer... ( SfxViewShell* pSh, const Point& rPos, @@ -1742,7 +1665,7 @@ void SfxViewFrame::DoAdjustPosSizePixel //! teilen in Inner.../Outer... { DBG_CHKTHIS(SfxViewFrame, 0); - // Components benutzen diese Methode nicht! + // Components do not use this Method! if( pSh && pSh->GetWindow() && !nAdjustPosPixelLock ) { nAdjustPosPixelLock++; @@ -1776,10 +1699,10 @@ SfxPoolItem* SfxViewFrameItem::Clone( SfxItemPool *) const //-------------------------------------------------------------------- void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) -/* [Beschreibung] +/* [Description] - Interne Methode zum setzen der jeweils aktuellen <SfxViewShell>-Instanz, - die in diesem SfxViewFrame aktiv ist. + Internal Method to set the current <SfxViewShell> Instance, + that is active int this SfxViewFrame at the moment. */ { @@ -1791,9 +1714,9 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) } //-------------------------------------------------------------------- -/* - Beschreibung: - Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace +/* [Description] + + The ParentViewFrame of the Containers ViewFrame in the internal InPlace */ //TODO/LATER: is it still necessary? is there a replacement for GetParentViewFrame_Impl? @@ -1836,7 +1759,7 @@ void SfxViewFrame::DoAdjustPosSize( SfxViewShell *pSh, //-------------------------------------------------------------------- void SfxViewFrame::GetDocNumber_Impl() { - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); + DBG_ASSERT( GetObjectShell(), "No Document!" ); GetObjectShell()->SetNamedVisibility_Impl(); pImp->nDocViewNo = GetObjectShell()->GetNoSet_Impl().GetFreeIndex()+1; } @@ -1878,35 +1801,29 @@ void SfxViewFrame::Enable( sal_Bool bEnable ) if ( pViewSh ) pViewSh->ShowCursor(sal_False); } -/* - if ( !bEnable ) - GetBindings().ENTERREGISTRATIONS(); - GetDispatcher()->Lock( !bEnable ); - if ( bEnable ) - GetBindings().LEAVEREGISTRATIONS(); -*/ } } //-------------------------------------------------------------------- void SfxViewFrame::Show() -/* [Beschreibung] +/* [Description] - Diese Methode macht das Frame-Window sichtbar und ermittelt vorher - den Fenstername. Au\serdem wird das Dokument festgehalten. Man darf - i.d.R. nie das Window direkt showen! + This method makes the Frame-Window visible and before transmitts the + window name. In addition, the document is held. In general one can never + show the window directly! */ { - // zuerst locken damit in UpdateTitle() gilt: IsVisible() == sal_True (:#) + // First lock the objectShell so that UpdateTitle() is valid: + // IsVisible() == sal_True (:#) if ( xObjSh.Is() ) { xObjSh->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN ); if ( !pImp->bObjLocked ) LockObjectShell_Impl( sal_True ); - // Doc-Shell Titel-Nummer anpassen, get unique view-no + // Adjust Doc-Shell titel nummer, get unique view-no if ( 0 == pImp->nDocViewNo ) { GetDocNumber_Impl(); @@ -1916,18 +1833,12 @@ void SfxViewFrame::Show() else UpdateTitle(); - // Frame-Window anzeigen, aber nur wenn der ViewFrame kein eigenes Window - // hat oder wenn er keine Component enth"alt + // Display Frame-window, but only if the ViewFrame has no window of its + // own or if it does not contain a Component if ( &GetWindow() == &GetFrame().GetWindow() || !GetFrame().HasComponent() ) GetWindow().Show(); GetFrame().GetWindow().Show(); -/* SfxViewFrame* pCurrent = SfxViewFrame::Current(); - if ( GetFrame().GetFrameInterface()->isActive() && - pCurrent != this && - ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) && - !GetActiveChildFrame_Impl() ) - MakeActive_Impl( sal_False );*/ if ( xObjSh.Is() && xObjSh->Get_Impl()->bHiddenLockedByAPI ) { xObjSh->Get_Impl()->bHiddenLockedByAPI = sal_False; @@ -1952,9 +1863,9 @@ void SfxViewFrame::Hide() //-------------------------------------------------------------------- void SfxViewFrame::LockObjectShell_Impl( sal_Bool bLock ) { - DBG_ASSERT( pImp->bObjLocked != bLock, "Falscher Locked-Status!" ); + DBG_ASSERT( pImp->bObjLocked != bLock, "Wrong Locked status!" ); - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); + DBG_ASSERT( GetObjectShell(), "No Document!" ); GetObjectShell()->OwnerLock(bLock); pImp->bObjLocked = bLock; } @@ -2044,7 +1955,7 @@ void SfxViewFrame::SetActiveChildFrame_Impl( SfxViewFrame *pViewFrame ) if ( pViewFrame ) xActive = pViewFrame->GetFrame().GetFrameInterface(); - if ( xFrame.is() ) // PB: #74432# xFrame cann be NULL + if ( xFrame.is() ) // xFrame can be NULL xFrame->setActiveFrame( xActive ); } } @@ -2052,21 +1963,6 @@ void SfxViewFrame::SetActiveChildFrame_Impl( SfxViewFrame *pViewFrame ) SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const { SfxViewFrame *pViewFrame = pImp->pActiveChild; -/* - if ( !pViewFrame ) - { - // Wenn es keinen aktiven ChildFrame gibt, irgendeinen nehmen - for ( sal_uInt16 n=0; n<GetChildFrameCount(); n++ ) - { - pViewFrame = - PTR_CAST( SfxViewFrame, GetChildFrame(n)->GetChildFrame(0) ); - if ( pViewFrame ) - break; - } - } - - pImp->pActiveChild = pViewFrame; -*/ return pViewFrame; } @@ -2164,7 +2060,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc sURL = i_rDoc.GetFactory().GetFactoryURL(); Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); - xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, + xLoader->loadComponentFromURL( sURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0, aTransformLoadArgs.getPropertyValues() ); SfxViewShell* pViewShell = SfxViewShell::Get( i_rFrame->getController() ); @@ -2266,7 +2162,7 @@ void SfxViewFrame::SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId ) { // can't say anything about the view, the respective application did not yet migrate its code to // named view factories => bail out - OSL_ENSURE( false, "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" ); + OSL_FAIL( "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" ); return; } OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" ); @@ -2320,38 +2216,35 @@ void SfxViewFrame::SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId ) sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( sal_uInt16 nViewIdOrNo, /* > 0 - Registrierungs-Id der View, auf die umge- - schaltet werden soll, bzw. die erstmalig - erzeugt werden soll. + Registration-Id of the View, to which the + the method should switch, for example the one + that will be created. == 0 - Es soll die Default-View verwendet werden. */ + First use the Default view. */ sal_Bool bIsIndex /* sal_True - 'nViewIdOrNo' ist keine Registrations-Id sondern - ein Index in die f"ur die in diesem - <SfxViewFrame> dargestellte <SfxObjectShell>. + 'nViewIdOrNo' is no Registration-Id instead + an Index of <SfxViewFrame> in <SfxObjectShell>. */ ) -/* [Beschreibung] +/* [Description] - Interne Methode zum Umschalten auf eine andere <SfxViewShell>-Subklasse, - die in diesem SfxMDIFrame erzeugt werden soll. Existiert noch - keine SfxViewShell in diesem SfxMDIFrame, so wird erstmalig eine - erzeugt. + Internal Method for switching to another <SfxViewShell> subclass, + which should be created in this SfxMDIFrame. If no SfxViewShell exist + in this SfxMDIFrame, then one will first be created. - [R"uckgabewert] + [Return Value] sal_Bool sal_True - die angeforderte SfxViewShell wurde erzeugt - und eine ggf. bestehende gel"oscht + requested SfxViewShell was created and a + possibly existing one deleted sal_False - die angeforderte SfxViewShell konnte nicht - erzeugt werden, die bestehende SfxViewShell - existiert daher weiterhin + SfxViewShell requested could not be created, + the existing SfxViewShell thus continue to exist */ { @@ -2427,19 +2320,19 @@ sal_uInt16 SfxViewFrame::GetCurViewId() const //------------------------------------------------------------------------- void SfxViewFrame::ExecView_Impl ( - SfxRequest& rReq // der auszuf"uhrende <SfxRequest> + SfxRequest& rReq // The executable <SfxRequest> ) -/* [Beschreibung] +/* [Description] - Interne Methode zum Ausf"uhren der f"ur die <SfxShell> Subklasse - SfxViewFrame in der <SVIDL> beschriebenen Slots. + Internal method to run the slot for the <SfxShell> Subclass in the + SfxViewFrame <SVIDL> described slots. */ { DBG_CHKTHIS(SfxViewFrame, 0); - // Wenn gerade die Shells ausgetauscht werden... + // If the Shells are just being replaced... if ( !GetObjectShell() || !GetViewShell() ) return; @@ -2481,14 +2374,14 @@ void SfxViewFrame::ExecView_Impl case SID_NEWWINDOW: { - // Hack. demnaechst virtuelle Funktion + // Hack. at the moment a virtual Function if ( !GetViewShell()->NewWindowAllowed() ) { - OSL_ENSURE( false, "You should have disabled the 'Window/New Window' slot!" ); + OSL_FAIL( "You should have disabled the 'Window/New Window' slot!" ); return; } - // ViewData bei FrameSets rekursiv holen + // Get ViewData of FrameSets recursivly. GetFrame().GetViewData_Impl(); SfxMedium* pMed = GetObjectShell()->GetMedium(); @@ -2536,16 +2429,16 @@ void SfxViewFrame::ExecView_Impl */ sal_Bool impl_maxOpenDocCountReached() { - static ::rtl::OUString SERVICE_DESKTOP = ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"); + static ::rtl::OUString SERVICE_DESKTOP(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); try { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( xSMGR, - ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/"), - ::rtl::OUString::createFromAscii("Misc"), - ::rtl::OUString::createFromAscii("MaxOpenDocuments"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Misc")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxOpenDocuments")), ::comphelper::ConfigurationHelper::E_READONLY); // NIL means: count of allowed documents = infinite ! @@ -2572,15 +2465,16 @@ sal_Bool impl_maxOpenDocCountReached() continue; // a) do not count the help window - if (xFrame->getName().equalsAscii("OFFICE_HELP_TASK")) + if (xFrame->getName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OFFICE_HELP_TASK"))) continue; // b) count all other frames ++nOpenDocs; } catch(const css::uno::Exception&) - // A IndexOutOfBoundException can happen in multithreaded environments, - // where any other thread can change this container ! + // A IndexOutOfBoundException can happen in multithreaded + // environments, where any other thread can change this + // container ! { continue; } } @@ -2598,22 +2492,20 @@ sal_Bool impl_maxOpenDocCountReached() //------------------------------------------------------------------------- void SfxViewFrame::StateView_Impl ( - SfxItemSet& rSet /* leeres <SfxItemSet> mit <Which-Ranges>, - welche die Ids der zu erfragenden - Slots beschreiben. */ + SfxItemSet& rSet /* empty <SfxItemSet> with <Which-Ranges>, + which describes the Slot Ids */ ) -/* [Beschreibung] +/* [Description] - Diese interne Methode liefert in 'rSet' die Status der f"ur die - <SfxShell> Subklasse SfxViewFrame in der <SVIDL> beschriebenen <Slots>. + This internal methode returns in 'rSet' the Status for the <SfxShell> + Subclass SfxViewFrame in the <SVIDL> described <Slots>. - In 'rSet' sind dabei genau die vom SFx als ung"ultig erkannten - Slot-Ids als Which-ranges enthalten. Falls der an dieser Shell gesetzte - <SfxItemPool> f"ur einzelne Slot-Ids ein Mapping hat, werden die - entsprechenden Which-Ids verwendet, so da\s Items ggf. direkt mit - einer mit Which-Ids arbeitenden Core-::com::sun::star::script::Engine ausgetauscht werden - k"onnen. + Thus exactly those Slots-IDs that are recognized as beeing invalid by Sfx + are included as Which-ranges in 'rSet'. If there exists a mapping for + single slot-IDs of the <SfxItemPool> set in the shell, then the respective + Which-IDs are used so that items can be replaced directly with a working + Core::sun::com::star::script::Engine of the Which-IDs if possible. . */ { @@ -2622,11 +2514,11 @@ void SfxViewFrame::StateView_Impl SfxObjectShell *pDocSh = GetObjectShell(); if ( !pDocSh ) - // Ich bin gerade am Reloaden und Yielde so vor mich hin ... + // I'm just on reload and am yielding myself ... return; const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set ohne Bereich"); + DBG_ASSERT(pRanges, "Set with no Range"); while ( *pRanges ) { for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) @@ -2689,9 +2581,9 @@ void SfxViewFrame::ToTop() //------------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::GetParentViewFrame() const -/* - Beschreibung: - Der ParentViewFrame ist der ViewFrame des ParentFrames +/* [Description] + + The ParentViewFrame is the ViewFrame of the ParentFrames. */ { SfxFrame *pFrame = GetFrame().GetParentFrame(); @@ -2700,9 +2592,9 @@ SfxViewFrame* SfxViewFrame::GetParentViewFrame() const //------------------------------------------------------------------------- SfxFrame& SfxViewFrame::GetFrame() const -/* - Beschreibung: - GetFrame liefert den Frame, in dem sich der ViewFrame befindet +/* [Description] + + GetFrame returns the Frame, in which the ViewFrame is located. */ { return pImp->rFrame; @@ -2775,26 +2667,25 @@ void SfxViewFrame::Resize( sal_Bool bForce ) void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, sal_Bool bEraseTrailingEmptyLines ) { sal_Int32 nStartPos = 0; - sal_Int32 nEndPos = 0; sal_Int32 nLine = 0; while ( nLine < nStartLine ) { nStartPos = rStr.indexOf( LINE_SEP, nStartPos ); if( nStartPos == -1 ) break; - nStartPos++; // nicht das \n. + nStartPos++; // not the \n. nLine++; } - DBG_ASSERTWARNING( nStartPos != STRING_NOTFOUND, "CutLines: Startzeile nicht gefunden!" ); + DBG_ASSERTWARNING( nStartPos != STRING_NOTFOUND, "CutLines: Start row not found!" ); if ( nStartPos != -1 ) { - nEndPos = nStartPos; + sal_Int32 nEndPos = nStartPos; for ( sal_Int32 i = 0; i < nLines; i++ ) nEndPos = rStr.indexOf( LINE_SEP, nEndPos+1 ); - if ( nEndPos == -1 ) // kann bei letzter Zeile passieren + if ( nEndPos == -1 ) // Can happen at the last row. nEndPos = rStr.getLength(); else nEndPos++; @@ -2820,20 +2711,12 @@ void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, sa } /* - add new recorded dispatch macro script into the application global basic lib container - It generates a new unique id for it and insert the macro by using this number as name for - the modul + add new recorded dispatch macro script into the application global basic + lib container. It generates a new unique id for it and insert the macro + by using this number as name for the modul */ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro ) { - /* - // get lib and modul name from dialog - SfxModule *pMod = GetObjectShell()->GetModule(); - SfxRequest aReq( SID_BASICCHOOSER, SFX_CALLMODE_SYNCHRON, pMod->GetPool() ); - const SfxPoolItem* pRet = pMod->ExecuteSlot( aReq ); - if ( pRet ) - ::rtl::OUString = ((SfxStringItem*)pRet)->GetValue(); - */ if ( !sMacro.getLength() ) return; @@ -2853,7 +2736,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro ) String aLocation; Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); Reference< com::sun::star::uri::XUriReferenceFactory > xFactory( xSMgr->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.UriReferenceFactory")) ), UNO_QUERY ); if ( xFactory.is() ) { Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); @@ -2870,7 +2753,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro ) aMacroName = aName.getToken( 0, cTok, nIndex ); // get location - ::rtl::OUString aLocKey = ::rtl::OUString::createFromAscii( "location" ); + ::rtl::OUString aLocKey(RTL_CONSTASCII_USTRINGPARAM("location")); if ( xUrl->hasParameter( aLocKey ) ) aLocation = xUrl->getParameter( aLocKey ); } @@ -3024,7 +2907,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_RECORDMACRO : { // try to find any active recorder on this frame - ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); + ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("DispatchRecorderSupplier")); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); @@ -3069,11 +2952,11 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) com::sun::star::uno::UNO_QUERY); xRecorder = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder >( - xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.frame.DispatchRecorder")), + xFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchRecorder"))), com::sun::star::uno::UNO_QUERY); xSupplier = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorderSupplier >( - xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.frame.DispatchRecorderSupplier")), + xFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchRecorderSupplier"))), com::sun::star::uno::UNO_QUERY); xSupplier->setDispatchRecorder(xRecorder); @@ -3111,7 +2994,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) if ( xLayoutManager.is() ) { rtl::OUString aStatusbarResString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )); - // Parameter auswerten + // Evaluate parameter. SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, rReq.GetSlot(), sal_False); sal_Bool bShow( sal_True ); if ( !pShowItem ) @@ -3203,7 +3086,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) DBG_MEMTEST(); const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); + DBG_ASSERT(pRanges && *pRanges, "Set without range"); while ( *pRanges ) { for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) @@ -3212,7 +3095,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) { case SID_CURRENT_URL: { - // Bei internem InPlace den ContainerFrame nehmen + // Get the ContainerFrame, when internal InPlace. SfxViewFrame *pFrame = this; if ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); @@ -3222,14 +3105,17 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_RECORDMACRO : { + SvtMiscOptions aMiscOptions; const char* pName = GetObjectShell()->GetFactory().GetShortName(); - if ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) + if ( !aMiscOptions.IsExperimentalMode() || + ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) ) { rSet.DisableItem( nWhich ); + rSet.Put(SfxVisibilityItem(nWhich, sal_False)); break; } - ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); + ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("DispatchRecorderSupplier")); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); @@ -3245,14 +3131,16 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_STOP_RECORDING : { + SvtMiscOptions aMiscOptions; const char* pName = GetObjectShell()->GetFactory().GetShortName(); - if ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) + if ( !aMiscOptions.IsExperimentalMode() || + ( strcmp(pName,"swriter") && strcmp(pName,"scalc") ) ) { rSet.DisableItem( nWhich ); break; } - ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); + ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("DispatchRecorderSupplier")); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); @@ -3303,13 +3191,12 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_FORMATMENUSTATE : { - DBG_ERROR("Outdated slot!"); + OSL_FAIL("Outdated slot!"); rSet.DisableItem( nWhich ); break; } default: - //! DBG_ASSERT(FALSE, "Falscher Server fuer GetState"); break; } } @@ -3320,17 +3207,16 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) -/* [Beschreibung] +/* [Description] - Diese Methode kann in der Execute-Methode f"ur das ein- und ausschalten - von Child-Windows eingesetzt werden, um dieses inkl. API-Anbindung zu - implementieren. + This method can be included in the Execute method for the on- and off- + switching of ChildWindows, to implement this and API-bindings. - Einfach in der IDL als 'ExecuteMethod' eintragen. + Simply include as 'ExecuteMethod' in the IDL. */ { - // Parameter auswerten + // Evaluate Parameter sal_uInt16 nSID = rReq.GetSlot(); SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSID, sal_False); @@ -3358,20 +3244,20 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) else { ::com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = ::rtl::OUString::createFromAscii(".component:DB/DataSourceBrowser"); - Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + aTargetURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".component:DB/DataSourceBrowser")); + Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); Reference < ::com::sun::star::frame::XDispatch > xDisp; if ( xProv.is() ) - xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_beamer"), 31 ); + xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_beamer")), 31 ); if ( xDisp.is() ) { Sequence < ::com::sun::star::beans::PropertyValue > aArgs(1); ::com::sun::star::beans::PropertyValue* pArg = aArgs.getArray(); - pArg[0].Name = rtl::OUString::createFromAscii("Referer"); - pArg[0].Value <<= ::rtl::OUString::createFromAscii("private:user"); + pArg[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); + pArg[0].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:user")); xDisp->dispatch( aTargetURL, aArgs ); } } @@ -3384,14 +3270,14 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) sal_Bool bHasChild = HasChildWindow(nSID); bShow = pShowItem ? pShowItem->GetValue() : !bHasChild; - // ausf"uhren + // Perform action. if ( !pShowItem || bShow != bHasChild ) ToggleChildWindow( nSID ); GetBindings().Invalidate( nSID ); GetDispatcher()->Update_Impl( sal_True ); - // ggf. recorden + // Record if possible. if ( nSID == SID_HYPERLINK_DIALOG || nSID == SID_SEARCH_DLG ) { rReq.Ignore(); @@ -3407,12 +3293,12 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) -/* [Beschreibung] +/* [Description] - Diese Methode kann in der Status-Methode f"ur das Ein- und Ausschalt- - Zustand von Child-Windows eingesetzt werden, um dieses zu implementieren. + This method can be used in the state method for the on and off-state + of child-windows, in order to implement this. - Einfach in der IDL als 'StateMethod' eintragen. + Just register the IDL as 'StateMethod'. */ { @@ -3450,7 +3336,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) { if ( !KnowsChildWindow( nSID ) ) { - OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); + OSL_FAIL( "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); rState.DisableItem( nSID ); } else if ( !moduleHasToolPanels( *pImp ) ) @@ -3477,12 +3363,6 @@ SfxWorkWindow* SfxViewFrame::GetWorkWindow_Impl( sal_uInt16 /*nId*/ ) return pWork; } -/* -void SfxViewFrame::SetChildWindow(sal_uInt16 nId, sal_Bool bOn) -{ - SetChildWindow( nId, bOn, sal_True ); -}*/ - void SfxViewFrame::SetChildWindow(sal_uInt16 nId, sal_Bool bOn, sal_Bool bSetFocus ) { SfxWorkWindow* pWork = GetWorkWindow_Impl( nId ); @@ -3553,7 +3433,7 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) // --------------------------------------------------------------------------------------------------------------------- void SfxViewFrame::ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // look up the SfxFrame for the given XFrame SfxFrame* pFrame = NULL; @@ -3583,3 +3463,5 @@ void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ) ENSURE_OR_RETURN_VOID( pPanelAccess, "SfxViewFrame::ActivateToolPanel_Impl: task pane child window does not implement a required interface!" ); pPanelAccess->ActivateToolPanel( i_rPanelURL ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 6352adfb53e4..57c64187a839 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -76,7 +77,7 @@ using ::com::sun::star::lang::XComponent; static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) { - uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); + uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager"))), uno::UNO_QUERY ); ::rtl::OUString sVar; if ( !xMM.is() ) return sVar; @@ -128,7 +129,7 @@ static String _getTabString() Sequence< NamedValue > sMaterial; if (xHolder->getMaterial() >>= sMaterial) { for (int i=0; i < sMaterial.getLength(); i++) { - if ((sMaterial[i].Name.equalsAscii("title")) && + if ((sMaterial[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("title"))) && (sMaterial[i].Value >>= aTabString)) { result += ' '; @@ -145,21 +146,20 @@ static String _getTabString() //-------------------------------------------------------------------- String SfxViewFrame::UpdateTitle() -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort - den neuen Titel vom der <SfxObjectShell> zu besorgen. + With this method, can the SfxViewFrame be forced to immediately provide + the new title from the <SfxObjectShell>. - [Anmerkung] + [Note] - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. + This is for example necessary if one listens to the SfxObjectShell as + SfxListener and then react on the <SfxSimpleHint> SFX_HINT_TITLECHANGED, + then query the title of his views. However these views (SfxTopViewFrames) + are also SfxListener and because the order of notifications might not be + fixed, the title update will be enforced in advance. - - [Beispiel] + [Example] void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { @@ -192,9 +192,6 @@ String SfxViewFrame::UpdateTitle() if ( !pObjSh ) return String(); -// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// // kein UpdateTitle mit Embedded-ObjectShell -// return String(); const SfxMedium *pMedium = pObjSh->GetMedium(); String aURL; @@ -206,10 +203,10 @@ String SfxViewFrame::UpdateTitle() } if ( aURL != pImp->aActualURL ) - // URL hat sich ge"andert + // URL has changed pImp->aActualURL = aURL; - // gibt es noch eine weitere View? + // Is there another view? sal_uInt16 nViews=0; for ( SfxViewFrame *pView= GetFirst(pObjSh); pView && nViews<2; @@ -218,15 +215,15 @@ String SfxViewFrame::UpdateTitle() !IsDowning_Impl()) nViews++; - // Titel des Fensters + // Window Title String aTitle; if ( nViews == 2 || pImp->nDocViewNo > 1 ) - // dann die Nummer dranh"angen + // Then attach the number aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); else aTitle = pObjSh->UpdateTitle(); - // Name des SbxObjects + // SbxObjects name String aSbxName = pObjSh->SfxShell::GetName(); if ( IsVisible() ) { @@ -260,17 +257,12 @@ String SfxViewFrame::UpdateTitle() GetBindings().Invalidate( SID_NEWDOCDIRECT ); - /* AS_TITLE - Window* pWindow = GetFrame()->GetTopWindow_Impl(); - if ( pWindow && pWindow->GetText() != aTitle ) - pWindow->SetText( aTitle ); - */ return aTitle; } void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) { - // Wenn gerade die Shells ausgetauscht werden... + // If presently the shells are replaced... if ( !GetObjectShell() || !GetViewShell() ) return; @@ -283,20 +275,19 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, sal_False); sal_uInt16 nId = pIdItem ? pIdItem->GetValue() : 0; - // ausfuehren SfxWorkWindow *pWorkWin = GetFrame().GetWorkWindow_Impl(); if ( bShow ) { - // Zuerst die Floats auch anzeigbar machen + // First, make the floats viewable pWorkWin->MakeChildsVisible_Impl( bShow ); GetDispatcher()->Update_Impl( sal_True ); - // Dann anzeigen + // Then view it GetBindings().HidePopups( !bShow ); } else { - // Alles hiden + // Hide all SfxBindings *pBind = &GetBindings(); while ( pBind ) { @@ -330,7 +321,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) aFactName = pImp->aFactoryName; else { - DBG_ERROR("Missing argument!"); + OSL_FAIL("Missing argument!"); break; } @@ -356,7 +347,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) if ( GetViewShell()->PrepareClose() ) { - // weitere Views auf dasselbe Doc? + // More Views on the same Document? SfxObjectShell *pDocSh = GetObjectShell(); int bOther = sal_False; for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); @@ -364,14 +355,14 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) bOther = (pFrame != this); - // Doc braucht nur gefragt zu werden, wenn keine weitere View + // Document only needs to be queried, if no other View present. sal_Bool bClosed = sal_False; sal_Bool bUI = sal_True; if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) { if ( !bOther ) pDocSh->SetModified( sal_False ); - rReq.Done(); // unbedingt vor Close() rufen! + rReq.Done(); // Must call this before Close()! bClosed = sal_False; try { @@ -401,7 +392,7 @@ void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) return; const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set ohne Bereich"); + DBG_ASSERT(pRanges, "Set without Range"); while ( *pRanges ) { for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) @@ -447,7 +438,7 @@ void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) break; default: - DBG_ERROR( "invalid message-id" ); + OSL_FAIL( "invalid message-id" ); } } ++pRanges; @@ -461,7 +452,7 @@ void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) { case SID_BROWSE_FORWARD: case SID_BROWSE_BACKWARD: - OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); + OSL_FAIL( "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); break; case SID_CREATELINK: { @@ -493,7 +484,7 @@ void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) rItemSet.DisableItem( SID_BROWSE_FORWARD ); rItemSet.DisableItem( SID_BROWSE_BACKWARD ); - // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen + // Add/SaveToBookmark at BASIC-IDE, QUERY-EDITOR etc. disable SfxObjectShell *pDocSh = GetObjectShell(); sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; @@ -508,16 +499,18 @@ void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY void SfxViewFrame::Activate( sal_Bool bMDI ) { - DBG_ASSERT(GetViewShell(), "Keine Shell"); + DBG_ASSERT(GetViewShell(), "No Shell"); if ( bMDI ) pImp->bActive = sal_True; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +//(mba): here maybe as in Beanframe NotifyEvent ?! } void SfxViewFrame::Deactivate( sal_Bool bMDI ) { - DBG_ASSERT(GetViewShell(), "Keine Shell"); + DBG_ASSERT(GetViewShell(), "No Shell"); if ( bMDI ) pImp->bActive = sal_False; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +//(mba): here maybe as in Beanframe NotifyEvent ?! } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 83c916d3071e..edd5495a33ef 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -83,3 +84,4 @@ struct SfxViewShell_Impl #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index b91e8b4848ba..877005eb908c 100755..100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -153,7 +154,7 @@ SfxPrinterController::SfxPrinterController( const boost::shared_ptr<Printer>& i_ int nProps = aRenderParms.getLength(); for( int i = 0; i < nProps; i++ ) { - if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + if( aRenderParms[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExtraPrintUIOptions" ) ) ) { Sequence< beans::PropertyValue > aUIProps; aRenderParms[i].Value >>= aUIProps; @@ -387,13 +388,12 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt class SfxDialogExecutor_Impl -/* [Beschreibung] +/* [Description] - Eine Instanz dieser Klasse wird f"ur die Laufzeit des Printer-Dialogs - erzeugt, um im dessen Click-Handler f"ur die Zus"atze den per - virtueller Methode von der abgeleiteten SfxViewShell erzeugten - Print-Options-Dialog zu erzeugen und die dort eingestellten Optionen - als SfxItemSet zu zwischenzuspeichern. + An instance of this class is created for the life span of the + printer dialogue, to create in its click handler for the additions by the + virtual method of the derived SfxViewShell generated print options dialogue + and to cache the options set there as SfxItemSet. */ { @@ -432,7 +432,7 @@ SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSe IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG ) { - // Options lokal merken + // Options noted locally if ( !_pOptions ) { DBG_ASSERT( _pSetupParent, "no dialog parent" ); @@ -440,7 +440,7 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG ) _pOptions = ( (SfxPrinter*)_pSetupParent->GetPrinter() )->GetOptions().Clone(); } - // Dialog ausf"uhren + // Create Dialog SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( static_cast<Window*>(_pSetupParent), _pViewSh, _pOptions ); if ( _bHelpDisabled ) @@ -458,45 +458,18 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG ) //------------------------------------------------------------------------- -sal_Bool UseStandardPrinter_Impl( Window* /*pParent*/, SfxPrinter* pDocPrinter ) -{ - // Optionen abfragen, ob gewarnt werden soll (Doc uebersteuert App) - sal_Bool bWarn = sal_False; - const SfxItemSet *pDocOptions = &pDocPrinter->GetOptions(); - if ( pDocOptions ) - { - sal_uInt16 nWhich = pDocOptions->GetPool()->GetWhich(SID_PRINTER_NOTFOUND_WARN); - const SfxBoolItem* pBoolItem = NULL; - pDocPrinter->GetOptions().GetItemState( nWhich, sal_False, (const SfxPoolItem**) &pBoolItem ); - if ( pBoolItem ) - bWarn = pBoolItem->GetValue(); - } -/* - // ggf. den User fragen - if ( bWarn ) - { - // Geht nicht mehr ohne OrigJobSetup! - String aTmp( SfxResId( STR_PRINTER_NOTAVAIL ) ); - QueryBox aBox( pParent, WB_OK_CANCEL | WB_DEF_OK, aTmp ); - return RET_OK == aBox.Execute(); - } -*/ - // nicht gewarnt => einfach so den StandardDrucker nehmen - return sal_True; -} -//------------------------------------------------------------------------- - SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) -/* Interne Methode zum Setzen der Unterschiede von 'pNewPrinter' zum - aktuellen Printer. pNewPrinter wird entweder "ubernommen oder gel"oscht. + +/* Internal method for setting the differences between 'pNewPrinter' to the + current printer. pNewPrinter is either taken over or deleted. */ { - // aktuellen Printer holen + // get current Printer SfxPrinter *pDocPrinter = GetPrinter(); - // Printer-Options auswerten + // Evaluate Printer Options bool bOriToDoc = false; bool bSizeToDoc = false; if ( &pDocPrinter->GetOptions() ) @@ -508,15 +481,15 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) bSizeToDoc = pFlagItem ? (pFlagItem->GetValue() & SFX_PRINTER_CHG_SIZE) : sal_False; } - // vorheriges Format und Size feststellen + // Determine the previous format and size Orientation eOldOri = pDocPrinter->GetOrientation(); Size aOldPgSz = pDocPrinter->GetPaperSizePixel(); - // neues Format und Size feststellen + // Determine the new format and size Orientation eNewOri = pNewPrinter->GetOrientation(); Size aNewPgSz = pNewPrinter->GetPaperSizePixel(); - // "Anderungen am Seitenformat feststellen + // Determine the changes in page format sal_Bool bOriChg = (eOldOri != eNewOri) && bOriToDoc; sal_Bool bPgSzChg = ( aOldPgSz.Height() != ( bOriChg ? aNewPgSz.Width() : aNewPgSz.Height() ) || @@ -524,7 +497,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) ( bOriChg ? aNewPgSz.Height() : aNewPgSz.Width() ) ) && bSizeToDoc; - // Message und Flags f"ur Seitenformat-"Anderung zusammenstellen + // Message and Flags for page format, summaries changes String aMsg; sal_uInt16 nNewOpt=0; if( bOriChg && bPgSzChg ) @@ -543,49 +516,45 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) nNewOpt = SFX_PRINTER_CHG_SIZE; } - // in dieser Variable sammeln, was sich so ge"aendert hat + // Summaries in this variable what has been changed. sal_uInt16 nChangedFlags = 0; - // ggf. Nachfrage, ob Seitenformat vom Drucker "ubernommen werden soll + // Ask if possible, if page format should be taken over from printer. if ( ( bOriChg || bPgSzChg ) && RET_YES == QueryBox(0, WB_YES_NO | WB_DEF_OK, aMsg).Execute() ) - // Flags mit "Anderungen f"ur <SetPrinter(SfxPrinter*)> mitpflegen + // Flags wich changes for <SetPrinter(SfxPrinter*)> are maintained nChangedFlags |= nNewOpt; - // fuer den MAC sein "temporary of class String" im naechsten if() + // For the MAC to have its "temporary of class String" in next if() String aTempPrtName = pNewPrinter->GetName(); String aDocPrtName = pDocPrinter->GetName(); - // Wurde der Drucker gewechselt oder von Default auf Specific - // oder umgekehrt geaendert? + // Was the printer selection changed from Default to Specific + // or the other way around? if ( (aTempPrtName != aDocPrtName) || (pDocPrinter->IsDefPrinter() != pNewPrinter->IsDefPrinter()) ) { - // neuen Printer "ubernehmen - // pNewPrinter->SetOrigJobSetup( pNewPrinter->GetJobSetup() ); nChangedFlags |= SFX_PRINTER_PRINTER|SFX_PRINTER_JOBSETUP; pDocPrinter = pNewPrinter; } else { - // Extra-Optionen vergleichen + // Compare extra options if ( ! (pNewPrinter->GetOptions() == pDocPrinter->GetOptions()) ) { - // Options haben sich geaendert + // Option have changed pDocPrinter->SetOptions( pNewPrinter->GetOptions() ); nChangedFlags |= SFX_PRINTER_OPTIONS; } - // JobSetups vergleichen + // Compare JobSetups JobSetup aNewJobSetup = pNewPrinter->GetJobSetup(); JobSetup aOldJobSetup = pDocPrinter->GetJobSetup(); if ( aNewJobSetup != aOldJobSetup ) { - // JobSetup hat sich geaendert (=> App mu\s neu formatieren) - // pDocPrinter->SetOrigJobSetup( aNewJobSetup ); nChangedFlags |= SFX_PRINTER_JOBSETUP; } - // alten, ver"anderten Printer behalten + // Keep old changed Printer. pDocPrinter->SetPrinterProps( pNewPrinter ); delete pNewPrinter; } @@ -597,10 +566,9 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) } //------------------------------------------------------------------------- -// Unter WIN32 tritt leider das Problem auf, dass nichts gedruckt -// wird, wenn SID_PRINTDOCDIRECT auflaueft; bisher bekannte, -// einzige Abhilfe ist in diesem Fall das Abschalten der Optimierungen -// (KA 17.12.95) +// Sadly enough the problem arises with WIN32 that nothing is printed when +// SID_PRINTDOCDIRECT auflaueft. At the moment the only known solution in this +// case is to turn off the optimazation. #ifdef _MSC_VER #pragma optimize ( "", off ) #endif @@ -667,9 +635,7 @@ Printer* SfxViewShell::GetActivePrinter() const void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { - // sal_uInt16 nCopies=1; sal_uInt16 nDialogRet = RET_CANCEL; - // sal_Bool bCollate=sal_False; SfxPrinter* pPrinter = 0; SfxDialogExecutor_Impl* pExecutor = 0; bool bSilent = false; @@ -683,7 +649,8 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) //FIXME: how to transport "bPrintOnHelp"? // no help button in dialogs if called from the help window - // (pressing help button would exchange the current page inside the help document that is going to be printed!) + // (pressing help button would exchange the current page inside the help + // document that is going to be printed!) String aHelpFilterName( DEFINE_CONST_UNICODE("writer_web_HTML_help") ); SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium(); const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : NULL; @@ -731,20 +698,20 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) TransformItems( nId, *rReq.GetArgs(), aProps, GetInterface()->GetSlot(nId) ); for ( sal_Int32 nProp=0; nProp<aProps.getLength(); nProp++ ) { - if ( aProps[nProp].Name.equalsAscii("Copies") ) - aProps[nProp]. Name = rtl::OUString::createFromAscii("CopyCount"); - else if ( aProps[nProp].Name.equalsAscii("RangeText") ) - aProps[nProp]. Name = rtl::OUString::createFromAscii("Pages"); - if ( aProps[nProp].Name.equalsAscii("Asynchron") ) + if ( aProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Copies")) ) + aProps[nProp]. Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CopyCount")); + else if ( aProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("RangeText")) ) + aProps[nProp]. Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Pages")); + if ( aProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Asynchron")) ) { - aProps[nProp]. Name = rtl::OUString::createFromAscii("Wait"); + aProps[nProp]. Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Wait")); sal_Bool bAsynchron = sal_False; aProps[nProp].Value >>= bAsynchron; aProps[nProp].Value <<= (sal_Bool) (!bAsynchron); } - if ( aProps[nProp].Name.equalsAscii("Silent") ) + if ( aProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Silent")) ) { - aProps[nProp]. Name = rtl::OUString::createFromAscii("MonitorVisible"); + aProps[nProp]. Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MonitorVisible")); sal_Bool bPrintSilent = sal_False; aProps[nProp].Value >>= bPrintSilent; aProps[nProp].Value <<= (sal_Bool) (!bPrintSilent); @@ -814,13 +781,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) ErrorBox( NULL, WB_OK | WB_DEF_OK, String( SfxResId( STR_NODEFPRINTER ) ) ).Execute(); } - if ( !pPrinter->IsOriginal() && rReq.GetArgs() && !UseStandardPrinter_Impl( NULL, pPrinter ) ) - { - // printer is not available, but standard printer should not be used - rReq.SetReturnValue(SfxBoolItem(0,sal_False)); - break; - } - // FIXME: printer isn't used for printing anymore! if( pPrinter->IsPrinting() ) { @@ -879,6 +839,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) aReq.AppendItem( SfxStringItem( SID_PRINTER_NAME, pDlgPrinter->GetName() ) ); aReq.Done(); } + if ( nId == SID_SETUPPRINTER ) + { + rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, sal_True ) ); + } // take the changes made in the dialog pPrinter = SetPrinter_Impl( pDlgPrinter ); @@ -895,6 +859,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) rReq.Ignore(); if ( SID_PRINTDOC == nId ) rReq.SetReturnValue(SfxBoolItem(0,sal_False)); + if ( nId == SID_SETUPPRINTER ) + { + rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, sal_False ) ); + } } } } @@ -903,7 +871,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) } } -// Optimierungen wieder einschalten +// Turn on optimazation again. #ifdef _MSC_VER #pragma optimize ( "", on ) #endif @@ -967,3 +935,4 @@ JobSetup SfxViewShell::GetJobSetup() const return JobSetup(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 88b185482abb..eb5f98905cbb 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,7 @@ #include <cppuhelper/implbase1.hxx> #include <osl/file.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <unotools/pathoptions.hxx> @@ -89,10 +90,7 @@ #include <sfx2/objface.hxx> #include <sfx2/docfilt.hxx> -// #110897# -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -175,7 +173,7 @@ SfxClipboardChangeListener::~SfxClipboardChangeListener() void SfxClipboardChangeListener::ChangedContents() { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; if( m_pViewShell ) { SfxBindings& rBind = m_pViewShell->GetViewFrame()->GetBindings(); @@ -283,7 +281,7 @@ static ::rtl::OUString RetrieveLabelFromCommand( { for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - if ( aPropSeq[i].Name.equalsAscii( "Label" )) + if ( aPropSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Label" ) )) { aPropSeq[i].Value >>= aStr; break; @@ -350,11 +348,11 @@ static ::rtl::OUString impl_retrieveFilterNameFromTypeAndModule( { ::comphelper::SequenceAsHashMap aFilterPropsHM( xEnumeration->nextElement() ); ::rtl::OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Name" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString() ); sal_Int32 nFilterFlags = aFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Flags" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), sal_Int32( 0 ) ); if ( nFilterFlags & nFlags ) @@ -380,7 +378,7 @@ enum ETypeFamily ::rtl::OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame >& xFrame , ETypeFamily eTypeFamily) { - static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); + static ::rtl::OUString SERVICENAME_MODULEMANAGER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")); try { @@ -394,32 +392,32 @@ enum ETypeFamily { case E_MS_DOC: { - if (sModule.equalsAscii( "com.sun.star.text.TextDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "writer_MS_Word_97" )); else - if (sModule.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "calc_MS_Excel_97" )); else - if (sModule.equalsAscii( "com.sun.star.drawing.DrawingDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "impress_MS_PowerPoint_97" )); else - if (sModule.equalsAscii( "com.sun.star.presentation.PresentationDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "impress_MS_PowerPoint_97" )); } break; case E_OOO_DOC: { - if (sModule.equalsAscii( "com.sun.star.text.TextDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "writer8" )); else - if (sModule.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "calc8" )); else - if (sModule.equalsAscii( "com.sun.star.drawing.DrawingDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "draw8" )); else - if (sModule.equalsAscii( "com.sun.star.presentation.PresentationDocument" )) + if (sModule.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) )) sType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "impress8" )); } break; @@ -437,6 +435,24 @@ enum ETypeFamily //-------------------------------------------------------------------- +SAL_DLLPRIVATE void SfxViewShell::IPClientGone_Impl( SfxInPlaceClient *pIPClient ) +{ + SfxInPlaceClientList* pClientList = GetIPClientList_Impl(sal_True); + + for( SfxInPlaceClientList::iterator it = pClientList->begin(); it < pClientList->end(); ++it ) + { + if ( *it == pIPClient ) + { + pClientList->erase( it ); + break; + } + } +} + + + +//-------------------------------------------------------------------- + void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) { const sal_uInt16 nId = rReq.GetSlot(); @@ -714,7 +730,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) } ::com::sun::star::uno::Reference< XSystemShellExecute > xSystemShellExecute( xSMGR->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), css::uno::UNO_QUERY ); sal_Bool bRet( sal_True ); @@ -727,7 +743,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) } catch ( uno::Exception& ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window *pParent = SFX_APP()->GetTopWindow(); ErrorBox( pParent, SfxResId( MSG_ERROR_NO_WEBBROWSER_FOUND )).Execute(); bRet = sal_False; @@ -788,9 +804,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) SfxInPlaceClientList *pClients = pView->GetIPClientList_Impl(sal_False); if ( pClients ) { - for (sal_uInt16 n=0; n < pClients->Count(); n++) + for ( size_t n = 0; n < pClients->size(); n++) { - SfxInPlaceClient* pIPClient = pClients->GetObject(n); + SfxInPlaceClient* pIPClient = pClients->at( n ); if ( pIPClient ) pView->CheckIPClient_Impl( pIPClient, aVisArea ); } @@ -819,100 +835,78 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) SfxWhichIter aIter( rSet ); for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() ) { - switch ( nSID ) - { - case SID_STYLE_CATALOG: - { - if ( !GetViewFrame()->KnowsChildWindow( SID_STYLE_DESIGNER ) ) - rSet.DisableItem( nSID ); - break; - } - - // Printer-Funktionen - case SID_PRINTDOC: - case SID_PRINTDOCDIRECT: - case SID_SETUPPRINTER: - case SID_PRINTER_NAME: - { - bool bEnabled = pImp->m_bCanPrint && !pImp->m_nPrinterLocks; - bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); - if ( bEnabled ) - { - SfxPrinter *pPrinter = GetPrinter(sal_False); + switch ( nSID ) + { + case SID_STYLE_CATALOG: + { + if ( !GetViewFrame()->KnowsChildWindow( SID_STYLE_DESIGNER ) ) + rSet.DisableItem( nSID ); + break; + } - if ( SID_PRINTDOCDIRECT == nSID ) + // Printer functions + case SID_PRINTDOC: + case SID_PRINTDOCDIRECT: + case SID_SETUPPRINTER: + case SID_PRINTER_NAME: { - rtl::OUString aPrinterName; - if ( pPrinter != NULL ) - aPrinterName = pPrinter->GetName(); - else - aPrinterName = Printer::GetDefaultPrinterName(); - if ( aPrinterName.getLength() > 0 ) + bool bEnabled = pImp->m_bCanPrint && !pImp->m_nPrinterLocks; + bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); + if ( bEnabled ) { - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); + SfxPrinter *pPrinter = GetPrinter(sal_False); + + if ( SID_PRINTDOCDIRECT == nSID ) + { + rtl::OUString aPrinterName; + if ( pPrinter != NULL ) + aPrinterName = pPrinter->GetName(); + else + aPrinterName = Printer::GetDefaultPrinterName(); + if ( aPrinterName.getLength() > 0 ) + { + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); - ::rtl::OUStringBuffer aBuffer( 60 ); - aBuffer.append( RetrieveLabelFromCommand( + ::rtl::OUStringBuffer aBuffer( 60 ); + aBuffer.append( RetrieveLabelFromCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintDefault" )), xFrame )); - aBuffer.appendAscii( " (" ); - aBuffer.append( aPrinterName ); - aBuffer.appendAscii( ")" ); + aBuffer.appendAscii( " (" ); + aBuffer.append( aPrinterName ); + aBuffer.appendAscii( ")" ); - rSet.Put( SfxStringItem( SID_PRINTDOCDIRECT, aBuffer.makeStringAndClear() ) ); - } - } - bEnabled = !pPrinter || !pPrinter->IsPrinting(); - } - if ( !bEnabled ) - { - // will now be handled by requeing the request - /* rSet.DisableItem( SID_PRINTDOC ); - rSet.DisableItem( SID_PRINTDOCDIRECT ); - rSet.DisableItem( SID_SETUPPRINTER ); */ + rSet.Put( SfxStringItem( SID_PRINTDOCDIRECT, aBuffer.makeStringAndClear() ) ); } - break; - } - - // Mail-Funktionen - case SID_MAIL_SENDDOCASPDF: - case SID_MAIL_SENDDOC: - case SID_MAIL_SENDDOCASFORMAT: - { - sal_Bool bEnable = !GetViewFrame()->HasChildWindow( SID_MAIL_CHILDWIN ); - if ( !bEnable ) - rSet.DisableItem( nSID ); - break; + } + bEnabled = !pPrinter || !pPrinter->IsPrinting(); } + break; + } - // PlugIns running - case SID_PLUGINS_ACTIVE: - { - rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE, - !pImp->m_bPlugInsActive) ); - break; - } -/* - // SelectionText - case SID_SELECTION_TEXT: - { - rSet.Put( SfxStringItem( SID_SELECTION_TEXT, GetSelectionText() ) ); - break; - } + // Mail functions + case SID_MAIL_SENDDOCASPDF: + case SID_MAIL_SENDDOC: + case SID_MAIL_SENDDOCASFORMAT: + { + sal_Bool bEnable = !GetViewFrame()->HasChildWindow( SID_MAIL_CHILDWIN ); + if ( !bEnable ) + rSet.DisableItem( nSID ); + break; + } - // SelectionTextExt - case SID_SELECTION_TEXT_EXT: - { - rSet.Put( SfxStringItem( SID_SELECTION_TEXT_EXT, GetSelectionText(sal_True) ) ); - break; - } -*/ - case SID_STYLE_FAMILY : - { - rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->m_nFamily ) ); - break; - } - } + // PlugIns running + case SID_PLUGINS_ACTIVE: + { + rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE, + !pImp->m_bPlugInsActive) ); + break; + } + case SID_STYLE_FAMILY : + { + rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->m_nFamily ) ); + break; + } + } } } @@ -931,12 +925,11 @@ void SfxViewShell::SetZoomFactor( const Fraction &rZoomX, //-------------------------------------------------------------------- ErrCode SfxViewShell::DoVerb(long /*nVerb*/) -/* [Beschreibung] - - Virtuelle Methode, um am selektierten Objekt ein Verb auszuf"uhren. - Da dieses Objekt nur den abgeleiteten Klassen bekannt ist, muss DoVerb - dort "uberschrieben werden. +/* [Description] + Virtual Method used to perform a Verb on a selected Object. + Since this Object is just known by the derived classes, DoVerb + must be overloaded. */ { @@ -988,10 +981,6 @@ void SfxViewShell::UIDeactivated( SfxInPlaceClient* /*pClient*/ ) pFrame->GetDispatcher()->Update_Impl( sal_True ); pFrame->GetBindings().HidePopups(sal_False); - // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); - // uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); - // if ( xParentFrame.is() ) - // xParentFrame->setActiveFrame( uno::Reference < frame::XFrame >() ); } //-------------------------------------------------------------------- @@ -1008,14 +997,14 @@ SfxInPlaceClient* SfxViewShell::FindIPClient if( !pObjParentWin ) pObjParentWin = GetWindow(); - for (sal_uInt16 n=0; n < pClients->Count(); n++) - { - SfxInPlaceClient *pIPClient = (SfxInPlaceClient*) pClients->GetObject(n); + for ( size_t n = 0; n < pClients->size(); n++) + { + SfxInPlaceClient *pIPClient = (SfxInPlaceClient*) pClients->at( n ); if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin ) - return pIPClient; - } + return pIPClient; + } - return 0; + return 0; } //-------------------------------------------------------------------- @@ -1034,12 +1023,12 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const if ( !pClients ) return 0; - for (sal_uInt16 n=0; n < pClients->Count(); n++) - { - SfxInPlaceClient* pIPClient = pClients->GetObject(n); + for ( size_t n = 0; n < pClients->size(); n++) + { + SfxInPlaceClient* pIPClient = pClients->at( n ); if ( pIPClient->IsUIActive() ) return pIPClient; - } + } return NULL; } @@ -1050,9 +1039,9 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const if ( !pClients ) return 0; - for (sal_uInt16 n=0; n < pClients->Count(); n++) + for ( size_t n = 0; n < pClients->size(); n++) { - SfxInPlaceClient* pIPClient = pClients->GetObject(n); + SfxInPlaceClient* pIPClient = pClients->at( n ); if ( pIPClient->IsObjectUIActive() ) return pIPClient; } @@ -1086,8 +1075,8 @@ void SfxViewShell::Deactivate(sal_Bool /*bMDI*/) void SfxViewShell::AdjustPosSizePixel ( - const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window - const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se + const Point& /*rToolOffset*/,// Upper left corner Tools in Frame-Window + const Size& /*rSize*/ // All available sizes. ) { @@ -1098,20 +1087,19 @@ void SfxViewShell::AdjustPosSizePixel void SfxViewShell::Move() -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode wird gerufen, wenn das Fenster, in dem die - SfxViewShell dargestellt wird eine StarView-Move() Nachricht erh"alt. + This virtual Method is called when the window displayed in the + SfxViewShell gets a StarView-Move() notification. - Die Basisimplementierung braucht nicht gerufen zu werden. + This base implementation does not have to be called. . + [Note] - [Anmerkung] + This Method can be used to cancel a selection, in order to catch the + mouse movement which is due to moving a window. - Diese Methode kann dazu verwendet werden, eine Selektion abzubrechen, - um durch das Moven des Fensters erzeugte Maus-Bewegungen anzufangen. - - Zur Zeit funktioniert die Benachrichtigung nicht In-Place. + For now the notification does not work In-Place. */ { @@ -1121,48 +1109,45 @@ void SfxViewShell::Move() void SfxViewShell::OuterResizePixel ( - const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window - const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se + const Point& /*rToolOffset*/,// Upper left corner Tools in Frame-Window + const Size& /*rSize*/ // All available sizes. ) -/* [Beschreibung] +/* [Description] - Diese Methode muss ueberladen werden, um auf "Anderungen der Groesse - der View zu reagieren. Dabei definieren wir die View als das Edit-Window - zuz"uglich der um das Edit-Window angeordnenten Tools (z.B. Lineale). + This Method has to be overloaded to be able to react to the size-change of + the View. Thus the View is defined as the Edit window and also the + attached Tools are defined (for example the ruler). - Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden. + The Edit window must not be changed either in size or position. - Die Vis-Area der SfxObjectShell, dessen Skalierung und Position - d"urfen hier ver"andert werden. Der Hauptanwendungsfall ist dabei, - das Ver"andern der Gr"o\se der Vis-Area. + The Vis-Area of SfxObjectShell, its scale and position can be changed + here. The mainuse is to change the size of the Vis-Area. - "Andert sich durch die neue Berechnung der Border, so mu\s dieser - mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden. - Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von - Tools erlaubt. + If the Border is changed due to the new calculation then this has to be set + by <SfxViewShell::SetBorderPixel(const SvBorder&)>. The Postioning of Tools + is only allowed after the calling of 'SetBorderPixel'. + [Example] - [Beispiel] + void AppViewSh::OuterViewResizePixel( const Point &rOfs, const Size &rSz ) - void AppViewSh::OuterViewResizePixel( const Point &rOfs, const Size &rSz ) - { - // Tool-Positionen und Gr"o\sen von au\sen berechnen, NICHT setzen! - // (wegen folgender Border-Berechnung) - Point aHLinPos...; Size aHLinSz...; - ... - - // Border f"ur Tools passend zu rSize berechnen und setzen - SvBorder aBorder... - SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt - - // Tools anordnen - pHLin->SetPosSizePixel( aHLinPos, aHLinSz ); - ... - } +{ + // Calculate Tool position and size externally, do not set! + // (due to the following Border calculation) + Point aHLinPos...; Size aHLinSz...; + ... + + // Calculate and Set a Border of Tools which matches rSize. + SvBorder aBorder... + SetBorderPixel( aBorder ); // Allow Positioning from here on. + // Arrange Tools + pHLin->SetPosSizePixel( aHLinPos, aHLinSz ); + ... + } - [Querverweise] + [Cross-reference] <SfxViewShell::InnerResizePixel(const Point&,const Size& rSize)> */ @@ -1176,45 +1161,44 @@ void SfxViewShell::OuterResizePixel void SfxViewShell::InnerResizePixel ( - const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window - const Size& /*rSize*/ // dem Edit-Win zur Verf"ugung stehende Gr"o\se + const Point& /*rToolOffset*/,// Upper left corner Tools in Frame-Window + const Size& /*rSize*/ // All available sizes. ) -/* [Beschreibung] +/* [Description] - Diese Methode muss ueberladen werden, um auf "Anderungen der Groesse - des Edit-Windows zu reagieren. + This Method has to be overloaded to be able to react to the size-change of + the Edit window. - Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden. - Weder die Vis-Area der SfxObjectShell noch dessen Skalierung oder - Position d"urfen ver"andert werden. + The Edit window must not be changed either in size or position. + Neither the Vis-Area of SfxObjectShell nor its scale or position are + allowed to be changed - "Andert sich durch die neue Berechnung der Border, so mu\s dieser - mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden. - Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von - Tools erlaubt. + If the Border is changed due to the new calculation then is has to be set + by <SfxViewShell::SetBorderPixel(const SvBorder&)>. + The Postioning of Tools is only allowed after the calling of + 'SetBorderPixel'. - [Beispiel] - - void AppViewSh::InnerViewResizePixel( const Point &rOfs, const Size &rSz ) - { - // Tool-Positionen und Gr"o\sen von innen berechnen, NICHT setzen! - // (wegen folgender Border-Berechnung) - Point aHLinPos...; Size aHLinSz...; - ... - - // Border f"ur Tools passend zu rSz berechnen und setzen - SvBorder aBorder... - SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt - - // Tools anordnen - pHLin->SetPosSizePixel( aHLinPos, aHLinSz ); - ... - } + [Note] + void AppViewSh::InnerViewResizePixel( const Point &rOfs, const Size &rSz ) + { + // Calculate Tool position and size internally, do not set! + // (due to the following Border calculation) + Point aHLinPos...; Size aHLinSz...; + ... + + // Calculate and Set a Border of Tools which matches rSize. + SvBorder aBorder... + SetBorderPixel( aBorder ); // Allow Positioning from here on. + + // Arrange Tools + pHLin->SetPosSizePixel( aHLinPos, aHLinSz ); + ... + } - [Querverweise] + [Cross-reference] <SfxViewShell::OuterResizePixel(const Point&,const Size& rSize)> */ @@ -1245,7 +1229,6 @@ void SfxViewShell::SetBorderPixel( const SvBorder &rBorder ) DBG_CHKTHIS(SfxViewShell, 0); DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" ); - //if ( rBorder != GetBorderPixel()) { GetViewFrame()->SetBorderPixelImpl( this, rBorder ); @@ -1271,29 +1254,28 @@ const SvBorder& SfxViewShell::GetBorderPixel() const void SfxViewShell::SetWindow ( - Window* pViewPort // Pointer auf das Datenfenster bzw. 0 im Destruktor + Window* pViewPort // For example Null pointer in the Destructor. ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode wird der SfxViewShell das Datenfenster mitgeteilt. - Dieses wird f"ur den In-Place-Container und f"ur das korrekte - Wiederherstellen des Focus ben"otigt. + With this method the SfxViewShell is set in the data window. This is + needed for the in-place container and for restoring the proper focus. - Selbst In-Place-aktiv ist das Umsetzen des ViewPort-Windows verboten. + Even in-place-active the conversion of the ViewPort Windows is forbidden. */ { if( pWindow == pViewPort ) return; - // ggf. vorhandene IP-Clients disconnecten + // Disconnect existing IP-Clients if possible DisconnectAllClients(); //TODO: should we have a "ReconnectAllClients" method? DiscardClients_Impl(); - // View-Port austauschen + // Switch View-Port sal_Bool bHadFocus = pWindow ? pWindow->HasChildPathFocus( sal_True ) : sal_False; pWindow = pViewPort; @@ -1306,7 +1288,7 @@ void SfxViewShell::SetWindow if ( bHadFocus && pWindow ) pWindow->GrabFocus(); //TODO/CLEANUP - //brauchen wir die Methode doch noch?! + //Do we still need this Method?! //SFX_APP()->GrabFocus( pWindow ); } @@ -1314,7 +1296,7 @@ void SfxViewShell::SetWindow Size SfxViewShell::GetOptimalSizePixel() const { - DBG_ERROR( "Useless call!" ); + OSL_FAIL( "Useless call!" ); return Size(); } @@ -1322,8 +1304,9 @@ Size SfxViewShell::GetOptimalSizePixel() const SfxViewShell::SfxViewShell ( - SfxViewFrame* pViewFrame, /* <SfxViewFrame>, in dem diese View dargestellt wird */ - sal_uInt16 nFlags /* siehe <SfxViewShell-Flags> */ + SfxViewFrame* pViewFrame, /* <SfxViewFrame>, which will be + displayed in this View */ + sal_uInt16 nFlags /* See <SfxViewShell-Flags> */ ) : SfxShell(this) @@ -1336,8 +1319,6 @@ SfxViewShell::SfxViewShell { DBG_CTOR(SfxViewShell, 0); - //pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this ); - if ( pViewFrame->GetParentViewFrame() ) { pImp->m_bPlugInsActive = pViewFrame->GetParentViewFrame() @@ -1348,8 +1329,8 @@ SfxViewShell::SfxViewShell SetPool( &pViewFrame->GetObjectShell()->GetPool() ); StartListening(*pViewFrame->GetObjectShell()); - // in Liste eintragen - const SfxViewShell *pThis = this; // wegen der kranken Array-Syntax + // Insert into list + const SfxViewShell *pThis = this; // due to the sick Array syntax SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl(); rViewArr.Insert(pThis, rViewArr.Count() ); } @@ -1360,7 +1341,7 @@ SfxViewShell::~SfxViewShell() { DBG_DTOR(SfxViewShell, 0); - // aus Liste austragen + // Remove from list const SfxViewShell *pThis = this; SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl(); rViewArr.Remove( rViewArr.GetPos(pThis) ); @@ -1377,7 +1358,6 @@ SfxViewShell::~SfxViewShell() pImp->m_pController.clear(); } - //DELETEZ( pImp->pPrinterCommandQueue ); DELETEZ( pImp ); DELETEZ( pIPClientList ); } @@ -1386,7 +1366,7 @@ SfxViewShell::~SfxViewShell() sal_uInt16 SfxViewShell::PrepareClose ( - sal_Bool bUI, // sal_True: Dialoge etc. erlaubt, sal_False: silent-mode + sal_Bool bUI, // TRUE: Allow Dialog and so on, FALSE: silent-mode sal_Bool /*bForBrowsing*/ ) { @@ -1441,12 +1421,12 @@ SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) SdrView* SfxViewShell::GetDrawView() const -/* [Beschreibung] +/* [Description] - Diese virtuelle Methode mu\s von den Subklassen "uberladen werden, wenn - der Property-Editor zur Verf"ugung stehen soll. + This virtual Method has to be overloded by the sub classes, to be able + make the Property-Editor available. - Die Default-Implementierung liefert immer 0. + The default implementation does always return zero. */ { @@ -1457,27 +1437,26 @@ SdrView* SfxViewShell::GetDrawView() const String SfxViewShell::GetSelectionText ( - sal_Bool /*bCompleteWords*/ /* sal_False (default) - Nur der tats"achlich selektierte Text wird - zur"uckgegeben. - - TRUE - Der selektierte Text wird soweit erweitert, - da\s nur ganze W"orter zur"uckgegeben werden. - Als Worttrenner gelten White-Spaces und die - Satzzeichen ".,;" sowie einfache und doppelte - Anf"uhrungszeichen. - */ + sal_Bool /*bCompleteWords*/ /* FALSE (default) + Only the actual selected text is returned. + + TRUE + The selected text is expanded so that only + whole words are returned. As word separators + these are used: white spaces and punctuation + ".,;" and single and double quotes. + */ ) -/* [Beschreibung] +/* [Description] - Diese Methode kann von Anwendungsprogrammierer "uberladen werden, - um einen Text zur"uckzuliefern, der in der aktuellen Selektion - steht. Dieser wird z.B. beim Versenden (email) verwendet. + This Method can be overloaded by the programmers to return a text that + is included in the current selection. This is for example used when + sending emails. - Mit "CompleteWords == TRUE" ger"ufen, reicht z.B. auch der Cursor, - der in einer URL steht, um die gesamte URL zu liefern. + When called with "CompleteWords == TRUE", it is for example sufficent + with having the Cursor positioned somewhere within an URL in-order + to have the entire URL returned. */ { @@ -1488,11 +1467,11 @@ String SfxViewShell::GetSelectionText sal_Bool SfxViewShell::HasSelection( sal_Bool ) const -/* [Beschreibung] +/* [Description] - Mit dieser virtuellen Methode kann z.B. ein Dialog abfragen, ob in der - aktuellen View etwas selektiert ist. Wenn der Parameter <sal_Bool> sal_True ist, - wird abgefragt, ob Text selektiert ist. + With this virtual Method can a for example a Dialog be queried, to + check if something is selected in the current view. If the Parameter + is <BOOL> TRUE then it is checked wether some text is selected. */ { @@ -1503,26 +1482,25 @@ sal_Bool SfxViewShell::HasSelection( sal_Bool ) const void SfxViewShell::SetSubShell( SfxShell *pShell ) -/* [Beschreibung] +/* [Description] - Mit dieser Methode kann eine Selektions- oder Cursor-Shell angemeldet - werden, die automatisch unmittelbar nach der SfxViewShell auf den - SfxDispatcher gepusht wird, und automatisch umittelbar vor ihr - gepoppt wird. + With this method a selection or cursor Shell can be registered, which are + automatically pushed to SfxDispatcher immediately after SfxViewShell, and + and automatically popped immediately before SfxViewShell. - Ist die SfxViewShell-Instanz bereits gepusht, dann wird pShell - sofort ebenfalls gepusht. Wird mit SetSubShell eine andere SfxShell - Instanz angemeldet, als vorher angemeldet war, wird die zuvor angemeldete - ggf. automatisch gepoppt. Mit pShell==0 kann daher die aktuelle - Sub-Shell abgemeldet werden. + If the SfxViewShell instance is already pushed, then pShell will be + immediately pushed as well. Is another SfxShell instance registered by + using SetSubShell, which was previously registered, the previously + registered shell is popped automatically if possible. With pShell==0 + the current sub-shell be can thus be unregistered. */ { - // ist diese ViewShell "uberhaupt aktiv? + // Is this ViewShell even active? SfxDispatcher *pDisp = pFrame->GetDispatcher(); if ( pDisp->IsActive(*this) ) { - // Dispatcher updaten + // Update Dispatcher if ( pSubShell ) pDisp->Pop(*pSubShell); if ( pShell ) @@ -1758,28 +1736,27 @@ sal_Bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) //-------------------------------------------------------------------- -FASTBOOL SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) +bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) -/* [Beschreibung] +/* [Description] - Diese Methode f"uhrt das KeyEvent 'rKeyEvent' "uber die an dieser - SfxViewShell direkt oder indirekt (z.B. via Applikation) konfigurierten - Tasten (Accelerator) aus. + This Method executes the KeyEvent 'rKeyEvent' of the Keys (Accelerator) + configured either direct or indirect (for example by the Application) + in the SfxViewShell. + [Return value] - [R"uckgabewert] + bool TRUE + The Key (Accelerator) is configured and the + the associated Handler was called - FASTBOOL sal_True - die Taste ist konfiguriert, der betreffende - Handler wurde gerufen + FALSE + The Key (Accelerator) is not configured and + subsequently no Handler was called - FALSE - die Taste ist nicht konfiguriert, es konnte - also kein Handler gerufen werden + [Cross-reference] - - [Querverweise] - <SfxApplication::KeyInput(const KeyEvent&)> + <SfxApplication::KeyInput(const KeyEvent&)> */ { return ExecKey_Impl(rKeyEvent); @@ -1792,13 +1769,13 @@ bool SfxViewShell::GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ) //-------------------------------------------------------------------- -void SfxViewShell::ShowCursor( FASTBOOL /*bOn*/ ) +void SfxViewShell::ShowCursor( bool /*bOn*/ ) -/* [Beschreibung] +/* [Description] - Diese Methode mu\s von Subklassen "uberladen werden, damit vom SFx - aus der Cursor ein- und ausgeschaltet werden kann. Dies geschieht - z.B. bei laufendem <SfxProgress>. + This Method has to be overloaded by the subclasses so that SFx from + the Cursor can be switched on and off. This happes for example with + with the running <SfxProgress>. */ { @@ -1808,17 +1785,16 @@ void SfxViewShell::ShowCursor( FASTBOOL /*bOn*/ ) void SfxViewShell::GotFocus() const -/* [Beschreibung] - - Diese Methode mu\s vom Applikationsentwickler gerufen werden, wenn - das Edit-Window den Focus erhalten hat. Der SFx hat so z.B. die - M"oglichkeit, den Accelerator einzuschalten. +/* [Description] + This Method has to be called by the programmer, when the + Edit window has received the focus. This gives for example the SFx + the power to turn on the accelerator. - [Anmerkung] + [Note] - <StarView> liefert leider keine M"oglichkeit, solche Events - 'von der Seite' einzuh"angen. + <StarView> does sadly enough not provide the possibillity to attach + such "side-way" events. */ { @@ -1832,9 +1808,9 @@ void SfxViewShell::ResetAllClients_Impl( SfxInPlaceClient *pIP ) if ( !pClients ) return; - for ( sal_uInt16 n=0; n < pClients->Count(); n++ ) + for ( size_t n = 0; n < pClients->size(); n++ ) { - SfxInPlaceClient* pIPClient = pClients->GetObject(n); + SfxInPlaceClient* pIPClient = pClients->at( n ); if( pIPClient != pIP ) pIPClient->ResetObject(); } @@ -1848,9 +1824,9 @@ void SfxViewShell::DisconnectAllClients() if ( !pClients ) return; - for ( sal_uInt16 n=0; n<pClients->Count(); ) + for ( size_t n = 0; n < pClients->size(); ) // clients will remove themselves from the list - delete pClients->GetObject(n); + delete pClients->at( n ); } //-------------------------------------------------------------------- @@ -1863,7 +1839,7 @@ void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const void SfxViewShell::AdjustVisArea(const Rectangle& rRect) { - DBG_ASSERT (pFrame, "Kein Frame?"); + DBG_ASSERT (pFrame, "No Frame?"); GetObjectShell()->SetVisArea( rRect ); } @@ -1875,9 +1851,9 @@ void SfxViewShell::VisAreaChanged(const Rectangle& /*rVisArea*/) if ( !pClients ) return; - for (sal_uInt16 n=0; n < pClients->Count(); n++) + for ( size_t n = 0; n < pClients->size(); n++) { - SfxInPlaceClient* pIPClient = pClients->GetObject(n); + SfxInPlaceClient* pIPClient = pClients->at( n ); if ( pIPClient->IsObjectInPlaceActive() ) // client is active, notify client that the VisArea might have changed pIPClient->VisAreaChanged(); @@ -1932,11 +1908,10 @@ sal_Bool SfxViewShell::PlugInsActive() const //-------------------------------------------------------------------- void SfxViewShell::DiscardClients_Impl() -/* [Beschreibung] +/* [Description] - Diese Methode dient dazu, vor dem Schlie\sen eines Dokuments das - Speichern der Objekte zu verhindern, wenn der Benutzer Schlie\en ohne - Speichern gew"ahlt hatte. + The purpose of this Method is to prevent the saving of Objects when closing + the Document, if the user has chosen to close without saving. */ { @@ -1944,8 +1919,8 @@ void SfxViewShell::DiscardClients_Impl() if ( !pClients ) return; - for (sal_uInt16 n=0; n < pClients->Count(); ) - delete pClients->GetObject(n); + for ( size_t n = 0; n < pClients->size(); ) + delete pClients->at( n ); } //-------------------------------------------------------------------- @@ -2002,7 +1977,7 @@ const Size& SfxViewShell::GetMargin() const void SfxViewShell::SetMargin( const Size& rSize ) { - // Der default-Margin wurde "geeicht" mit www.apple.com !! + // the default margin was verified using www.apple.com !! Size aMargin = rSize; if ( aMargin.Width() == -1 ) aMargin.Width() = DEFAULT_MARGIN_WIDTH; @@ -2137,8 +2112,6 @@ sal_Bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUStr sal_Bool bModified = sal_False; // create container from menu - // #110897# - // aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( &rIn ); aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( ::comphelper::getProcessServiceFactory(), &rIn, &rMenuIdentifier ); @@ -2170,7 +2143,7 @@ sal_Bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUStr // interceptor is indifferent continue; default: - DBG_ERROR("Wrong return value of ContextMenuInterceptor!"); + OSL_FAIL("Wrong return value of ContextMenuInterceptor!"); continue; } } @@ -2269,7 +2242,6 @@ sal_Bool SfxViewShell::HasMouseClickListeners_Impl() void SfxViewShell::SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts ) { pImp->aPrintOpts = rOpts; -// GetObjectShell()->Broadcast( SfxPrintingHint( -3, NULL, NULL, rOpts ) ); } sal_Bool SfxViewShell::Escape() @@ -2324,3 +2296,4 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/util/make_tco.btm b/sfx2/util/make_tco.btm index d25dad24a692..d25dad24a692 100644..100755 --- a/sfx2/util/make_tco.btm +++ b/sfx2/util/make_tco.btm diff --git a/sfx2/util/mkdemo.pl b/sfx2/util/mkdemo.pl index fd4a2d9cecbe..fd4a2d9cecbe 100644..100755 --- a/sfx2/util/mkdemo.pl +++ b/sfx2/util/mkdemo.pl diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index 1c28afd4177f..dfa3d208a169 100644..100755 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -31,6 +31,9 @@ <implementation name="SfxDocumentMetaData"> <service name="com.sun.star.document.DocumentProperties"/> </implementation> + <implementation name="CompatWriterDocPropsImpl"> + <service name="com.sun.star.writer.DocumentProperties"/> + </implementation> <implementation name="com.sun.star.comp.desktop.QuickstartWrapper"> <service name="com.sun.star.office.Quickstart"/> </implementation> diff --git a/sfx2/util/sfx.xml b/sfx2/util/sfx.xml index c16e75206001..971981cc5171 100644..100755 --- a/sfx2/util/sfx.xml +++ b/sfx2/util/sfx.xml @@ -68,7 +68,6 @@ <project-build-dependency> cppu </project-build-dependency> <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> vos </project-build-dependency> <project-build-dependency> sal </project-build-dependency> <project-build-dependency> tools </project-build-dependency> <project-build-dependency> svtools </project-build-dependency> @@ -82,7 +81,6 @@ <runtime-module-dependency> cppu2 </runtime-module-dependency> <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> vos2$(COM) </runtime-module-dependency> <runtime-module-dependency> sal2 </runtime-module-dependency> <runtime-module-dependency> tl </runtime-module-dependency> <runtime-module-dependency> svt </runtime-module-dependency> diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx index 54880cc5fcc7..c49e5279ebbd 100644 --- a/sfx2/workben/custompanel/ctp_factory.cxx +++ b/sfx2/workben/custompanel/ctp_factory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -94,7 +95,7 @@ namespace sd { namespace colortoolpanel const PropertyValue* pArgEnd = i_rArgs.getConstArray() + i_rArgs.getLength(); for ( ; pArg != pArgEnd; ++pArg ) { - if ( pArg->Name.equalsAscii( "ParentWindow" ) ) + if ( pArg->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) ) { xParentWindow.set( pArg->Value, UNO_QUERY ); break; @@ -102,7 +103,7 @@ namespace sd { namespace colortoolpanel } if ( !xParentWindow.is() ) { - OSL_ENSURE( false, "ToolPanelFactory::createUIElement: no parent window in the args!" ); + OSL_FAIL( "ToolPanelFactory::createUIElement: no parent window in the args!" ); throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No parent window provided in the creation arguments. Cannot create tool panel." ) ), *this, @@ -165,3 +166,5 @@ namespace sd { namespace colortoolpanel //...................................................................................................................... } } // namespace sd::colortoolpanel //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/workben/custompanel/ctp_factory.hxx b/sfx2/workben/custompanel/ctp_factory.hxx index 8a359f59caaf..471485f1e0ea 100644 --- a/sfx2/workben/custompanel/ctp_factory.hxx +++ b/sfx2/workben/custompanel/ctp_factory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -81,3 +82,5 @@ namespace sd { namespace colortoolpanel //...................................................................................................................... #endif // SD_WORKBENCH_CTP_FACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx index ee94287bedbf..e7f36edcf0ff 100644 --- a/sfx2/workben/custompanel/ctp_panel.cxx +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -268,3 +269,5 @@ namespace sd { namespace colortoolpanel //...................................................................................................................... } } // namespace sd::colortoolpanel //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx index 39c46c9d93a5..ed844f3a3ee5 100644 --- a/sfx2/workben/custompanel/ctp_panel.hxx +++ b/sfx2/workben/custompanel/ctp_panel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -122,3 +123,5 @@ namespace sd { namespace colortoolpanel //...................................................................................................................... #endif // SD_WORKBENCH_CTP_PANEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/workben/custompanel/ctp_services.cxx b/sfx2/workben/custompanel/ctp_services.cxx index 4164e8bc1629..7f67b65d698c 100644 --- a/sfx2/workben/custompanel/ctp_services.cxx +++ b/sfx2/workben/custompanel/ctp_services.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -73,7 +74,7 @@ namespace sd { namespace colortoolpanel extern "C" { //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) + SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -85,8 +86,10 @@ extern "C" } //------------------------------------------------------------------------------------------------------------------ - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/workben/custompanel/delzip b/sfx2/workben/custompanel/delzip index e69de29bb2d1..e69de29bb2d1 100644..100755 --- a/sfx2/workben/custompanel/delzip +++ b/sfx2/workben/custompanel/delzip diff --git a/sfx2/workben/custompanel/description.xml b/sfx2/workben/custompanel/description.xml index a90aa73a77f6..a90aa73a77f6 100644..100755 --- a/sfx2/workben/custompanel/description.xml +++ b/sfx2/workben/custompanel/description.xml diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml index 9122d16a4189..9122d16a4189 100644..100755 --- a/sfx2/workben/custompanel/manifest.xml +++ b/sfx2/workben/custompanel/manifest.xml |