diff options
author | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-10-22 17:29:01 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-10-22 17:29:01 +0200 |
commit | 1e7cd1ecd7a6b730daf90bae9ec9bd9b1b19c9e6 (patch) | |
tree | 53a78aaa7367b718070df14bec3290c120faa745 /svtools | |
parent | #i105655# Last MetaFile changes; moved GDI_LINEDASHDOT_ACTION to the more com... (diff) | |
parent | Create DEV300_m62 milestone tag from trunk@277034 (diff) | |
download | core-1e7cd1ecd7a6b730daf90bae9ec9bd9b1b19c9e6.tar.gz core-1e7cd1ecd7a6b730daf90bae9ec9bd9b1b19c9e6.zip |
commit after rebase to DEV300m62
Diffstat (limited to 'svtools')
37 files changed, 846 insertions, 839 deletions
diff --git a/svtools/inc/dialogcontrolling.hxx b/svtools/inc/dialogcontrolling.hxx index 9efb098ee013..edb425f78b00 100644 --- a/svtools/inc/dialogcontrolling.hxx +++ b/svtools/inc/dialogcontrolling.hxx @@ -52,7 +52,15 @@ namespace svt class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowOperator { public: - virtual void operateOn( Window& _rOperateOn ) const = 0; + /** called when an event happened which should be reacted to + + @param _rTrigger + the event which triggered the call. If the Id of the event is 0, then this is the initial + call which is made when ->_rOperateOn is added to the responsibility of the DialogController. + @param _rOperateOn + the window on which to operate + */ + virtual void operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const = 0; virtual ~IWindowOperator(); }; @@ -61,13 +69,13 @@ namespace svt //===================================================================== //= IWindowEventFilter //===================================================================== - /** an abstract interface for deciding whether a ->VclSimpleEvent + /** an abstract interface for deciding whether a ->VclWindowEvent is worth paying attention to */ class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowEventFilter { public: - virtual bool payAttentionTo( const VclSimpleEvent& _rEvent ) const = 0; + virtual bool payAttentionTo( const VclWindowEvent& _rEvent ) const = 0; virtual ~IWindowEventFilter(); }; @@ -96,7 +104,7 @@ namespace svt ::std::auto_ptr< DialogController_Data > m_pImpl; public: - DialogController( Window& _rInstigator, const PWindowEventFilter _pEventFilter, const PWindowOperator _pOperator ); + DialogController( Window& _rInstigator, const PWindowEventFilter& _pEventFilter, const PWindowOperator& _pOperator ); virtual ~DialogController(); /** adds a window to the list of dependent windows @@ -117,10 +125,10 @@ namespace svt private: void impl_Init(); - void impl_updateAll(); - void impl_update( Window& _rWindow ); + void impl_updateAll( const VclWindowEvent& _rTriggerEvent ); + void impl_update( const VclWindowEvent& _rTriggerEvent, Window& _rWindow ); - DECL_LINK( OnWindowEvent, const VclSimpleEvent* ); + DECL_LINK( OnWindowEvent, const VclWindowEvent* ); private: DialogController( const DialogController& ); // never implemented @@ -184,10 +192,9 @@ namespace svt /** adds a non-standard controller whose functionality is not covered by the other methods @param _pController - the controller to add to the manager. Must not be <NULL/>. The manager takes ownership - of the controller. + the controller to add to the manager. Must not be <NULL/>. */ - void addController( DialogController* _pController ); + void addController( const PDialogController& _pController ); private: ControlDependencyManager( const ControlDependencyManager& ); // never implemented @@ -224,7 +231,7 @@ namespace svt { } - virtual void operateOn( Window& _rOperateOn ) const + virtual void operateOn( const VclWindowEvent& /*_rTrigger*/, Window& _rOperateOn ) const { _rOperateOn.Enable( m_rCheckable.IsChecked() ); } @@ -248,12 +255,11 @@ namespace svt { } - bool payAttentionTo( const VclSimpleEvent& _rEvent ) const + bool payAttentionTo( const VclWindowEvent& _rEvent ) const { - const VclWindowEvent& rWindowEvent = dynamic_cast< const VclWindowEvent& >( _rEvent ); - if ( ( rWindowEvent.GetWindow() == &m_rWindow ) - && ( ( rWindowEvent.GetId() == VCLEVENT_RADIOBUTTON_TOGGLE ) - || ( rWindowEvent.GetId() == VCLEVENT_CHECKBOX_TOGGLE ) + if ( ( _rEvent.GetWindow() == &m_rWindow ) + && ( ( _rEvent.GetId() == VCLEVENT_RADIOBUTTON_TOGGLE ) + || ( _rEvent.GetId() == VCLEVENT_CHECKBOX_TOGGLE ) ) ) return true; diff --git a/svtools/inc/docmspasswdrequest.hxx b/svtools/inc/docmspasswdrequest.hxx deleted file mode 100644 index 684bffe71760..000000000000 --- a/svtools/inc/docmspasswdrequest.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright IBM Corporation 2009. - * Copyright 2009 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docmspasswdrequest.hxx,v $ - * $Revision: 1.0 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General 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 INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX -#define INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX - -#include "svtools/svldllapi.h" -#include <com/sun/star/task/DocumentMSPasswordRequest.hpp> -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> - -class MSAbortContinuation; -class MSPasswordContinuation; - -class SVL_DLLPUBLIC RequestMSDocumentPassword : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - ::com::sun::star::uno::Any m_aRequest; - - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > m_lContinuations; - - MSAbortContinuation* m_pAbort; - MSPasswordContinuation* m_pPassword; - -public: - RequestMSDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ); - - sal_Bool isAbort(); - sal_Bool isPassword(); - - ::rtl::OUString getPassword(); - - 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 ); -}; - -#endif /* INCLUDED_SVTOOLS_DOCMSPASSWDREQUEST_HXX */ diff --git a/svtools/inc/docpasswdrequest.hxx b/svtools/inc/docpasswdrequest.hxx deleted file mode 100644 index 69095fbe5a5c..000000000000 --- a/svtools/inc/docpasswdrequest.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docpasswdrequest.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX -#define INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX - -#include "svtools/svldllapi.h" -#include <com/sun/star/task/DocumentPasswordRequest.hpp> -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> - -class AbortContinuation; -class PasswordContinuation; - -class SVL_DLLPUBLIC RequestDocumentPassword : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > -{ - ::com::sun::star::uno::Any m_aRequest; - - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > - > m_lContinuations; - - AbortContinuation* m_pAbort; - PasswordContinuation* m_pPassword; - -public: - RequestDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ); - - sal_Bool isAbort(); - sal_Bool isPassword(); - - ::rtl::OUString getPassword(); - - 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 ); -}; - -#endif /* INCLUDED_SVTOOLS_DOCPASSWDREQUEST_HXX */ diff --git a/svtools/inc/eventcfg.hxx b/svtools/inc/eventcfg.hxx index 4478d3f48028..4ee175f5b7e0 100644 --- a/svtools/inc/eventcfg.hxx +++ b/svtools/inc/eventcfg.hxx @@ -40,6 +40,35 @@ #include <hash_map> #include <vector> +#define STR_EVENT_STARTAPP 0 +#define STR_EVENT_CLOSEAPP 1 +#define STR_EVENT_DOCCREATED 2 +#define STR_EVENT_CREATEDOC 3 +#define STR_EVENT_LOADFINISHED 4 +#define STR_EVENT_OPENDOC 5 +#define STR_EVENT_PREPARECLOSEDOC 6 +#define STR_EVENT_CLOSEDOC 7 +#define STR_EVENT_SAVEDOC 8 +#define STR_EVENT_SAVEDOCDONE 9 +#define STR_EVENT_SAVEDOCFAILED 10 +#define STR_EVENT_SAVEASDOC 11 +#define STR_EVENT_SAVEASDOCDONE 12 +#define STR_EVENT_SAVEASDOCFAILED 13 +#define STR_EVENT_SAVETODOC 14 +#define STR_EVENT_SAVETODOCDONE 15 +#define STR_EVENT_SAVETODOCFAILED 16 +#define STR_EVENT_ACTIVATEDOC 17 +#define STR_EVENT_DEACTIVATEDOC 18 +#define STR_EVENT_PRINTDOC 19 +#define STR_EVENT_VIEWCREATED 20 +#define STR_EVENT_PREPARECLOSEVIEW 21 +#define STR_EVENT_CLOSEVIEW 22 +#define STR_EVENT_MODIFYCHANGED 23 +#define STR_EVENT_TITLECHANGED 24 +#define STR_EVENT_VISAREACHANGED 25 +#define STR_EVENT_MODECHANGED 26 +#define STR_EVENT_STORAGECHANGED 27 + typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector; typedef ::std::vector< ::rtl::OUString > SupportedEventsVector; @@ -67,7 +96,7 @@ public: ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - + ::rtl::OUString GetEventName( sal_Int32 nID ); }; class SVL_DLLPUBLIC GlobalEventConfig: @@ -86,7 +115,7 @@ class SVL_DLLPUBLIC GlobalEventConfig: ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - + static ::rtl::OUString GetEventName( sal_Int32 nID ); private: static GlobalEventConfig_Impl* m_pImpl; diff --git a/svtools/inc/sfxecode.hxx b/svtools/inc/sfxecode.hxx index 01292f1c87fa..d87fff819748 100644 --- a/svtools/inc/sfxecode.hxx +++ b/svtools/inc/sfxecode.hxx @@ -85,6 +85,7 @@ #define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52) #define ERRCODE_SFX_BROKENSIGNATURE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 53) #define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54) +#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55) diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx index 08fe3c7d162a..f4cccd3115b8 100644 --- a/svtools/inc/svtools/embedhlp.hxx +++ b/svtools/inc/svtools/embedhlp.hxx @@ -131,6 +131,7 @@ namespace svt BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method }; } diff --git a/svtools/inc/svtools/loginerr.hxx b/svtools/inc/svtools/loginerr.hxx deleted file mode 100644 index f04e569b41e0..000000000000 --- a/svtools/inc/svtools/loginerr.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loginerr.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _LOGINERR_HXX -#define _LOGINERR_HXX - -#include <tools/string.hxx> -#include <tools/errcode.hxx> -#include <svtools/hint.hxx> - -//========================================================================= - -#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1 -#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2 -#define LOGINERROR_FLAG_MODIFY_USER_NAME 4 -#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8 - -class LoginErrorInfo -{ -private: - String _aTitle; - String _aServer; - String _aAccount; - String _aUserName; - String _aPassword; - String _aPath; - String _aErrorText; - BYTE _nFlags; - USHORT _nRet; - -public: - LoginErrorInfo() - : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), - _nRet( ERRCODE_BUTTON_CANCEL ) - { - } - - const String& GetTitle() const { return _aTitle; } - const String& GetServer() const { return _aServer; } - const String& GetAccount() const { return _aAccount; } - const String& GetUserName() const { return _aUserName; } - const String& GetPassword() const { return _aPassword; } - const String& GetPath() const { return _aPath; } - const String& GetErrorText() const { return _aErrorText; } - BOOL GetIsPersistentPassword() const - { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); } - BOOL GetIsSavePassword() const - { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); } - BYTE GetFlags() const { return _nFlags; } - USHORT GetResult() const { return _nRet; } - - void SetTitle( const String& aTitle ) - { _aTitle = aTitle; } - void SetServer( const String& aServer ) - { _aServer = aServer; } - void SetAccount( const String& aAccount ) - { _aAccount = aAccount; } - void SetUserName( const String& aUserName ) - { _aUserName = aUserName; } - void SetPassword( const String& aPassword ) - { _aPassword = aPassword; } - void SetPath( const String& aPath ) - { _aPath = aPath; } - void SetErrorText( const String& aErrorText ) - { _aErrorText = aErrorText; } - void SetFlags( BYTE nFlags ) - { _nFlags = nFlags; } - inline void SetSavePassword( BOOL bSet ); - inline void SetPersistentPassword( BOOL bSet ); - inline void SetModifyAccount( BOOL bSet ); - inline void SetModifyUserName( BOOL bSet ); - void SetResult( USHORT nRet ) - { _nRet = nRet; } -}; - -inline void LoginErrorInfo::SetSavePassword( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD; - else - _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD; -} - -inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD; - else - _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD; -} - -inline void LoginErrorInfo::SetModifyAccount( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; - else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; -} - -inline void LoginErrorInfo::SetModifyUserName( BOOL bSet ) -{ - if ( bSet ) - _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; - else - _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; -} - -//========================================================================= - -class CntLoginErrorHint : public SfxHint -{ -private: - LoginErrorInfo* _pInfo; - - CntLoginErrorHint( const CntLoginErrorHint& ); // n.i. - CntLoginErrorHint& operator=( const CntLoginErrorHint& ); // n.i. - -public: - TYPEINFO(); - - CntLoginErrorHint( LoginErrorInfo* pInfo ) - : _pInfo( pInfo ) - { - } - - LoginErrorInfo& GetErrorInfo() const { return *_pInfo; } -}; - -#endif diff --git a/svtools/inc/svtools/saveopt.hxx b/svtools/inc/svtools/saveopt.hxx index 6dfd083a3ca2..2966e2f24aba 100644 --- a/svtools/inc/svtools/saveopt.hxx +++ b/svtools/inc/svtools/saveopt.hxx @@ -60,12 +60,16 @@ public: E_ODFDEFAULTVERSION }; + // keep enum values sorted that a less or greater compare maps to older and newer versions! enum ODFDefaultVersion { ODFVER_UNKNOWN = 0, // unknown - ODFVER_010, // ODF 1.0 - ODFVER_011, // ODF 1.1 - ODFVER_012 // ODF 1.2 + ODFVER_010 = 1, // ODF 1.0 + ODFVER_011 = 2, // ODF 1.1 + DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration + ODFVER_012 = 4, // ODF 1.2 + + ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements }; SvtSaveOptions(); diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 4ff74419b9d4..3dc9c0b013bb 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -311,8 +311,6 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx -..\inc\docpasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docpasswdrequest.hxx -..\inc\docmspasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docmspasswdrequest.hxx ..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx ..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx ..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 767283a8e425..4ebed0d70f3f 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -538,7 +538,7 @@ void BrowseBox::SetColumnPos( USHORT nColumnId, USHORT nPos ) aScrollArea = Rectangle(Point(aNextRect.Left(),0), Point(aToRect.Right(),aDataWinSize.Height())); - pDataWin->Scroll( nScroll, 0, aScrollArea, SCROLL_FLAGS ); + pDataWin->Scroll( nScroll, 0, aScrollArea ); aToRect.Top() = 0; aToRect.Bottom() = aScrollArea.Bottom(); Invalidate( aToRect ); diff --git a/svtools/source/config/eventcfg.cxx b/svtools/source/config/eventcfg.cxx index ae2041356fd3..6026c3d4a3a0 100644 --- a/svtools/source/config/eventcfg.cxx +++ b/svtools/source/config/eventcfg.cxx @@ -62,24 +62,70 @@ using namespace ::com::sun::star; #define SETNODE_BINDINGS OUString(RTL_CONSTASCII_USTRINGPARAM("Bindings" )) #define PROPERTYNAME_BINDINGURL OUString(RTL_CONSTASCII_USTRINGPARAM("BindingURL")) +const char* pEventAsciiNames[] = +{ +"OnStartApp", +"OnCloseApp", +"OnCreate", +"OnNew", +"OnLoadFinished", +"OnLoad", +"OnPrepareUnload", +"OnUnload", +"OnSave", +"OnSaveDone", +"OnSaveFailed", +"OnSaveAs", +"OnSaveAsDone", +"OnSaveAsFailed", +"OnCopyTo", +"OnCopyToDone", +"OnCopyToFailed", +"OnFocus", +"OnUnfocus", +"OnPrint", +"OnViewCreated", +"OnPrepareViewClosing", +"OnViewClosed", +"OnModifyChanged", +"OnTitleChanged", +"OnVisAreaChanged", +"OnModeChanged", +"OnStorageChanged" +}; + GlobalEventConfig_Impl::GlobalEventConfig_Impl() : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE ) { // the supported event names - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnStartApp")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnCloseApp")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnNew")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnUnload")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnPrepareUnload")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnLoad")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSave")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveAs")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveDone")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnSaveAsDone")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnFocus")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnUnfocus")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnPrint")); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii("OnModifyChanged")); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) ); initBindingInfo(); @@ -103,6 +149,14 @@ GlobalEventConfig_Impl::~GlobalEventConfig_Impl() } } +::rtl::OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) +{ + if ( nIndex < (sal_Int32) m_supportedEvents.size() ) + return m_supportedEvents[nIndex]; + else + return rtl::OUString(); +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** @@ -396,3 +450,9 @@ Mutex& GlobalEventConfig::GetOwnStaticMutex() // Return new created or already existing mutex object. return *pMutex; } + +::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) +{ + return GlobalEventConfig().m_pImpl->GetEventName( nIndex ); +} + diff --git a/svtools/source/config/lingucfg.cxx b/svtools/source/config/lingucfg.cxx index 263ced16cd50..2b4e4d482c3f 100644 --- a/svtools/source/config/lingucfg.cxx +++ b/svtools/source/config/lingucfg.cxx @@ -72,27 +72,6 @@ static osl::Mutex & GetOwnMutex() /////////////////////////////////////////////////////////////////////////// -static lang::Locale lcl_CreateLocale( LanguageType eLang ) -{ - lang::Locale aLocale; - if ( eLang != LANGUAGE_NONE ) - MsLangId::convertLanguageToLocale( eLang, aLocale ); - - return aLocale; -} - - -static INT16 lcl_LocaleToLanguage( const lang::Locale& rLocale ) -{ - // empty Locale -> LANGUAGE_NONE - if ( rLocale.Language.getLength() == 0 ) - return LANGUAGE_NONE; - - // Variant of Locale is ignored - return MsLangId::convertLocaleToLanguage( rLocale ); -} - - static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) { BOOL bSucc = FALSE; @@ -100,41 +79,31 @@ static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) lang::Locale aNew; if (rVal >>= aNew) // conversion successful? { - INT16 nNew = lcl_LocaleToLanguage( aNew ); + INT16 nNew = MsLangId::convertLocaleToLanguage( aNew ); if (nNew != rLanguage) { rLanguage = nNew; bSucc = TRUE; } } - return bSucc; } -static inline INT16 lcl_CfgLocaleStrToLanguage( const OUString &rCfgLocaleStr ) -{ - INT16 nRes = LANGUAGE_NONE; - if (0 != rCfgLocaleStr.getLength()) - nRes = MsLangId::convertIsoStringToLanguage( rCfgLocaleStr ); - return nRes; -} - - static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) { OUString aRes; - if (LANGUAGE_NONE != nLanguage) + if (LANGUAGE_SYSTEM != nLanguage) aRes = MsLangId::convertLanguageToIsoString( nLanguage ); return aRes; } -static void lcl_CfgAnyToLanguage( const uno::Any &rVal, INT16& rLanguage ) +static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) { OUString aTmp; - if ((rVal >>= aTmp) && 0 != aTmp.getLength()) - rLanguage = MsLangId::convertIsoStringToLanguage( aTmp ); + rVal >>= aTmp; + return (aTmp.getLength() == 0) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp ); } @@ -143,7 +112,6 @@ static void lcl_CfgAnyToLanguage( const uno::Any &rVal, INT16& rLanguage ) SvtLinguOptions::SvtLinguOptions() { nDefaultLanguage = LANGUAGE_NONE; - nDefaultLanguage_CJK = LANGUAGE_NONE; nDefaultLanguage_CTL = LANGUAGE_NONE; @@ -428,19 +396,19 @@ uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const } case UPH_DEFAULT_LOCALE : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } case UPH_DEFAULT_LOCALE_CJK : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage_CJK ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } case UPH_DEFAULT_LOCALE_CTL : { - lang::Locale aLocale( lcl_CreateLocale( rOpt.nDefaultLanguage_CTL ) ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) ); aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); break; } @@ -654,7 +622,7 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN switch ( nPropertyHandle ) { case UPH_DEFAULT_LOCALE : - { rOpt.bRODefaultLanguage = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage ); } break; + { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_ACTIVE_DICTIONARIES : { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break; case UPH_IS_USE_DICTIONARY_LIST : @@ -662,9 +630,9 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN case UPH_IS_IGNORE_CONTROL_CHARACTERS : { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break; case UPH_DEFAULT_LOCALE_CJK : - { rOpt.bRODefaultLanguage_CJK = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage_CJK ); } break; + { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_DEFAULT_LOCALE_CTL : - { rOpt.bRODefaultLanguage_CTL = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage_CTL ); } break; + { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break; case UPH_IS_SPELL_UPPER_CASE : { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break; diff --git a/svtools/source/config/saveopt.cxx b/svtools/source/config/saveopt.cxx index 6ce1be8441a4..2b18d1bf4767 100644 --- a/svtools/source/config/saveopt.cxx +++ b/svtools/source/config/saveopt.cxx @@ -437,7 +437,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bRODoPrettyPrinting( CFG_READONLY_DEFAULT ) , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) - , eODFDefaultVersion( SvtSaveOptions::ODFVER_012 ) + , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) { Sequence< OUString > aNames = GetPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); @@ -474,11 +474,16 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() { sal_Int16 nTmp = 0; if ( pValues[nProp] >>= nTmp ) - eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + { + if( nTmp == 3 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; + else + eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + } else { DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" ); }; - bROAutoSaveTime = pROStates[nProp]; + bROODFDefaultVersion = pROStates[nProp]; break; } @@ -729,7 +734,7 @@ void SvtSaveOptions_Impl::Commit() case ODFDEFAULTVERSION: if (!bROODFDefaultVersion) { - pValues[nRealCount] <<= sal_Int16( eODFDefaultVersion ); + pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion ); pNames[nRealCount] = pOrgNames[i]; ++nRealCount; } diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 7485efec7c7c..b0e178e631d9 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -201,6 +201,17 @@ namespace svt m_pImpl->InCompleteHyperLabel = NULL; m_pImpl->setCurItemID(-1 ); m_pImpl->setComplete( sal_True ); + + // Roadmap control should be reachable as one unit with a Tab key + // the next Tab key should spring out of the control. + // To reach it the control itself should get focus and set it + // on entries. The entries themself should not be reachable with + // the Tab key directly. So each entry should have WB_NOTABSTOP. + // + // In other words the creator should create the control with the following + // flags: + // SetStyle( ( GetStyle() | WB_TABSTOP ) & ~WB_DIALOGCONTROL ); + // TODO: if somebody sets a new font from outside (OutputDevice::SetFont), we would have to react // on this with calculating a new bold font. // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font. @@ -725,11 +736,9 @@ namespace svt //--------------------------------------------------------------------- IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel) { - return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); } - - void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt ) { if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || @@ -753,7 +762,7 @@ namespace svt ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& ) { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } @@ -761,7 +770,7 @@ namespace svt { mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpDescHyperLabel = new HyperLabel(_pParent, WB_TABSTOP | WB_WORDBREAK); + mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); } //--------------------------------------------------------------------- diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index afdb728f450e..96eb8bb39e99 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -37,6 +37,7 @@ #include <vcl/svapp.hxx> #include <svtools/valueset.hxx> #include "valueimp.hxx" +#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -92,7 +93,8 @@ void ValueSetItem::ClearAccessible() ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) : ValueSetAccComponentBase (m_aMutex), mpParent( pParent ), - mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ) + mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ), + mbIsFocused(false) { } @@ -166,6 +168,35 @@ ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterfa } } + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::GetFocus (void) +{ + mbIsFocused = true; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::LoseFocus (void) +{ + mbIsFocused = false; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + // ----------------------------------------------------------------------------- uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext() @@ -321,6 +352,9 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAc pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE); if ( !mbIsTransientChildrenDisabled ) pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS); + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE); + if (mbIsFocused) + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED); return pStateSet; } diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 8d7951da0dfc..c176629953ae 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -150,6 +150,17 @@ public: public: + /** Called by the corresponding ValueSet when it gets the focus. + Stores the new focus state and broadcasts a state change event. + */ + void GetFocus (void); + + /** Called by the corresponding ValueSet when it loses the focus. + Stores the new focus state and broadcasts a state change event. + */ + void LoseFocus (void); + + // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); @@ -201,6 +212,8 @@ private: ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners; ValueSet* mpParent; bool mbIsTransientChildrenDisabled; + /// The current FOCUSED state. + bool mbIsFocused; static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 7326f540c654..4033a9df7bb5 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1683,13 +1683,10 @@ void ValueSet::GetFocus() ImplDrawSelect(); Control::GetFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); - + // Tell the accessible object that we got the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->GetFocus(); } // ----------------------------------------------------------------------- @@ -1703,12 +1700,10 @@ void ValueSet::LoseFocus() HideFocus(); Control::LoseFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); + // Tell the accessible object that we lost the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->LoseFocus(); } // ----------------------------------------------------------------------- diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index ddb34d5d4fd2..14ede88482a6 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -97,6 +97,22 @@ namespace svt DECLARE_STL_VECTOR( String, StringArray ); DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringBag ); DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, MapString2String ); + + namespace + { + String lcl_getSelectedDataSource( const ComboBox& _dataSourceCombo ) + { + String selectedDataSource = _dataSourceCombo.GetText(); + if ( _dataSourceCombo.GetEntryPos( selectedDataSource ) == LISTBOX_ENTRY_NOTFOUND ) + { + // none of the pre-selected entries -> assume a path to a database document + OFileNotation aFileNotation( selectedDataSource, OFileNotation::N_SYSTEM ); + selectedDataSource = aFileNotation.get( OFileNotation::N_URL ); + } + return selectedDataSource; + } + } + // =================================================================== // = IAssigmentData // =================================================================== @@ -857,9 +873,7 @@ public: Reference< XCompletedConnection > xDS; if ( m_pImpl->bWorkingPersistent ) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); // get the data source the user has chosen and let it build a connection INetURLObject aURL( sSelectedDS ); @@ -1179,9 +1193,7 @@ public: // ------------------------------------------------------------------- IMPL_LINK(AddressBookSourceDialog, OnOkClicked, Button*, EMPTYARG) { - String sSelectedDS = m_aDatasource.GetText(); - OFileNotation aFileNotation( sSelectedDS ,OFileNotation::N_SYSTEM); - sSelectedDS = aFileNotation.get(OFileNotation::N_URL); + String sSelectedDS = lcl_getSelectedDataSource( m_aDatasource ); if ( m_pImpl->bWorkingPersistent ) { m_pImpl->pConfigData->setDatasourceName(sSelectedDS); @@ -1231,7 +1243,6 @@ public: Reference<XPropertySet> xProp(xAdminDialog,UNO_QUERY); if ( xProp.is() ) { - String sOldDS = m_aDatasource.GetText(); ::rtl::OUString sName; xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName"))) >>= sName; diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index f0c69a24e4e4..aa0e62046ea6 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -303,8 +303,9 @@ void WizardDialog::ImplPosTabPage() } else if ( meViewAlign == WINDOWALIGN_LEFT ) { - nOffX += aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X; - aDlgSize.Width() -= aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X; + long nViewOffset = mbEmptyViewMargin ? 0 : WIZARDDIALOG_VIEW_DLGOFFSET_X; + nOffX += aViewSize.Width() + nViewOffset; + aDlgSize.Width() -= nOffX; } else if ( meViewAlign == WINDOWALIGN_BOTTOM ) aDlgSize.Height() -= aViewSize.Height()+WIZARDDIALOG_VIEW_DLGOFFSET_Y; diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index 9b712e6f020c..32aae84696c4 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -439,16 +439,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) BYTE nPitchFamily; WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT); - - if ( !rFont.GetSize().Width() ) - { - VirtualDevice aDev; - FontMetric aMetric( aDev.GetFontMetric( rFont ) ); - WriteHeightWidth(Size(aMetric.GetWidth(),-rFont.GetSize().Height())); - } - else - WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); - + WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); *pWMF << (short)rFont.GetOrientation() << (short)rFont.GetOrientation(); switch (rFont.GetWeight()) { diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx index a6edea49f699..a067672f3cf6 100644 --- a/svtools/source/inc/passwordcontainer.hxx +++ b/svtools/source/inc/passwordcontainer.hxx @@ -34,13 +34,14 @@ #include <vector> #include <map> #include <com/sun/star/task/XPasswordContainer.hpp> +#include <com/sun/star/task/XUrlContainer.hpp> #include <com/sun/star/task/PasswordRequestMode.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/task/XMasterPasswordHandling2.hpp> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/factory.hxx> @@ -52,6 +53,8 @@ #include <rtl/ref.hxx> #include <osl/mutex.hxx> +#include "syscreds.hxx" + #define MEMORY_RECORD 0 #define PERSISTENT_RECORD 1 @@ -241,9 +244,10 @@ enum PasswordState { cancelled }; -class PasswordContainer : public ::cppu::WeakImplHelper4< +class PasswordContainer : public ::cppu::WeakImplHelper5< ::com::sun::star::task::XPasswordContainer, ::com::sun::star::task::XMasterPasswordHandling2, + ::com::sun::star::task::XUrlContainer, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XEventListener > { @@ -253,6 +257,7 @@ private: ::osl::Mutex mMutex; ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; + SysCredentialsConfig mUrlContainer; ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( const ::std::list< NamePassRecord >& original, @@ -269,6 +274,19 @@ private: const ::rtl::OUString& name, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); +bool createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, + ::com::sun::star::task::UrlRecord & rRec ) + throw( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::task::UrlRecord find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString GetDefaultMasterPassword(); @@ -369,6 +387,12 @@ public: virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); + // XUrlContainer + virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); + void Notify(); }; diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index 01f9d4ed0eef..d461e5898227 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -79,8 +79,8 @@ namespace svt //= DialogController //===================================================================== //--------------------------------------------------------------------- - DialogController::DialogController( Window& _rInstigator, const PWindowEventFilter _pEventFilter, - const PWindowOperator _pOperator ) + DialogController::DialogController( Window& _rInstigator, const PWindowEventFilter& _pEventFilter, + const PWindowOperator& _pOperator ) :m_pImpl( new DialogController_Data( _rInstigator, _pEventFilter, _pOperator ) ) { DBG_ASSERT( m_pImpl->pEventFilter.get() && m_pImpl->pOperator.get(), @@ -108,31 +108,33 @@ namespace svt void DialogController::addDependentWindow( Window& _rWindow ) { m_pImpl->aConcernedWindows.push_back( &_rWindow ); - impl_update( _rWindow ); + + VclWindowEvent aEvent( &_rWindow, 0, NULL ); + impl_update( aEvent, _rWindow ); } //--------------------------------------------------------------------- - IMPL_LINK( DialogController, OnWindowEvent, const VclSimpleEvent*, _pEvent ) + IMPL_LINK( DialogController, OnWindowEvent, const VclWindowEvent*, _pEvent ) { if ( m_pImpl->pEventFilter->payAttentionTo( *_pEvent ) ) - impl_updateAll(); + impl_updateAll( *_pEvent ); return 0L; } //--------------------------------------------------------------------- - void DialogController::impl_updateAll() + void DialogController::impl_updateAll( const VclWindowEvent& _rTriggerEvent ) { for ( ::std::vector< Window* >::iterator loop = m_pImpl->aConcernedWindows.begin(); loop != m_pImpl->aConcernedWindows.end(); ++loop ) - impl_update( *(*loop) ); + impl_update( _rTriggerEvent, *(*loop) ); } //--------------------------------------------------------------------- - void DialogController::impl_update( Window& _rWindow ) + void DialogController::impl_update( const VclWindowEvent& _rTriggerEvent, Window& _rWindow ) { - m_pImpl->pOperator->operateOn( _rWindow ); + m_pImpl->pOperator->operateOn( _rTriggerEvent, _rWindow ); } //===================================================================== @@ -177,6 +179,13 @@ namespace svt } //--------------------------------------------------------------------- + void ControlDependencyManager::addController( const PDialogController& _pController ) + { + OSL_ENSURE( _pController.get() != NULL, "ControlDependencyManager::addController: invalid controller, this will crash, sooner or later!" ); + m_pImpl->aControllers.push_back( _pController ); + } + + //--------------------------------------------------------------------- void ControlDependencyManager::enableOnRadioCheck( RadioButton& _rRadio, Window& _rDependentWindow ) { PDialogController pController( new RadioDependentEnabler( _rRadio ) ); diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 8eaf915f3b0c..6bd1126f8082 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp> #include <cppuhelper/implbase4.hxx> #include "vcl/svapp.hxx" #include <rtl/logfile.hxx> @@ -249,6 +250,7 @@ struct EmbeddedObjectRef_Impl sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member }; void EmbeddedObjectRef::Construct_Impl() @@ -260,6 +262,7 @@ void EmbeddedObjectRef::Construct_Impl() mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000); } EmbeddedObjectRef::EmbeddedObjectRef() @@ -286,6 +289,7 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) mpImp->aPersistName = rObj.mpImp->aPersistName; mpImp->aMediaType = rObj.mpImp->aMediaType; mpImp->bNeedUpdate = rObj.mpImp->bNeedUpdate; + mpImp->aDefaultSizeForChart_In_100TH_MM = rObj.mpImp->aDefaultSizeForChart_In_100TH_MM; if ( rObj.mpImp->pGraphic && !rObj.mpImp->bNeedUpdate ) mpImp->pGraphic = new Graphic( *rObj.mpImp->pGraphic ); @@ -334,6 +338,14 @@ void EmbeddedObjectRef::Assign( const NS_UNO::Reference < NS_EMBED::XEmbeddedObj mpImp->nViewAspect = nAspect; mxObj = xObj; mpImp->xListener = EmbedEventListener_Impl::Create( this ); + + //#i103460# + { + ::com::sun::star::uno::Reference < ::com::sun::star::chart2::XDefaultSizeTransmitter > xSizeTransmitter( xObj, uno::UNO_QUERY ); + DBG_ASSERT( xSizeTransmitter.is(), "Object does not support XDefaultSizeTransmitter -> will cause #i103460#!" ); + if( xSizeTransmitter.is() ) + xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); + } } void EmbeddedObjectRef::Clear() @@ -902,4 +914,18 @@ BOOL EmbeddedObjectRef::IsChart() const return sal_False; } +void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) +{ + //#i103460# charts do not necessaryly have an own size within ODF files, + //for this case they need to use the size settings from the surrounding frame, + //which is made available with this method + + mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size( rSizeIn_100TH_MM.getWidth(), rSizeIn_100TH_MM.getHeight() ); + + ::com::sun::star::uno::Reference < ::com::sun::star::chart2::XDefaultSizeTransmitter > xSizeTransmitter( mxObj, uno::UNO_QUERY ); + DBG_ASSERT( xSizeTransmitter.is(), "Object does not support XDefaultSizeTransmitter -> will cause #i103460#!" ); + if( xSizeTransmitter.is() ) + xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); +} + } diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 033ecefc10e7..ebd922bfedf7 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -478,6 +478,10 @@ Resource RID_ERRHDL { Text [ en-US ] = "The digitally signed document content and/or macros do not match the current document signature.\n\nThis could be the result of document manipulation or of structural document damage due to data transmission.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ; }; + String ERRCODE_SFX_INCOMPLETE_ENCRYPTION + { + Text [ en-US ] = "The encrypted document contains unexpected non-encrypted streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ; + }; String ERRCODE_IO_INVALIDLENGTH { diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 21953d25d92a..4458d4b0f132 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -302,6 +302,14 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Maltese" ; LANGUAGE_MALTESE ; > ; < "Tok Pisin" ; LANGUAGE_USER_TOK_PISIN ; > ; < "Shuswap" ; LANGUAGE_USER_SHUSWAP ; > ; + < "Oromo" ; LANGUAGE_OROMO ; > ; + < "Greek, Ancient" ; LANGUAGE_USER_ANCIENT_GREEK ; > ; + < "Yiddish" ; LANGUAGE_YIDDISH ; > ; + < "Quechua (Ecuador)" ; LANGUAGE_QUECHUA_ECUADOR ; > ; + < "Uyghur" ; LANGUAGE_UIGHUR_CHINA ; > ; + < "Asturian" ; LANGUAGE_USER_ASTURIAN ; > ; + < "Sorbian, Upper" ; LANGUAGE_UPPER_SORBIAN_GERMANY ; > ; + < "Sorbian, Lower" ; LANGUAGE_LOWER_SORBIAN_GERMANY ; > ; }; }; diff --git a/svtools/source/misc1/docmspasswdrequest.cxx b/svtools/source/misc1/docmspasswdrequest.cxx deleted file mode 100644 index e892d3a57d1a..000000000000 --- a/svtools/source/misc1/docmspasswdrequest.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright IBM Corporation 2009. - * Copyright 2009 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docmspasswdrequest.cxx,v $ - * $Revision: 1.0 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General 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_svtools.hxx" - -#include "docmspasswdrequest.hxx" -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionPassword.hpp> - -//========================================================================== - -class MSAbortContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionAbort > -{ - sal_Bool mbSelected; - -public: - MSAbortContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException) { mbSelected = sal_True; } -}; - -//========================================================================== - -class MSPasswordContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionPassword > -{ - sal_Bool mbSelected; - ::rtl::OUString maPassword; - -public: - MSPasswordContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPassword( const ::rtl::OUString& aPass ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException); -}; - -void SAL_CALL MSPasswordContinuation::select() - throw(::com::sun::star::uno::RuntimeException) -{ - mbSelected = sal_True; -} - -void SAL_CALL MSPasswordContinuation::setPassword( const ::rtl::OUString& aPass ) - throw (::com::sun::star::uno::RuntimeException) -{ - maPassword = aPass; -} - -::rtl::OUString SAL_CALL MSPasswordContinuation::getPassword() - throw (::com::sun::star::uno::RuntimeException) -{ - return maPassword; -} - -//========================================================================== - -RequestMSDocumentPassword::RequestMSDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ) -{ - ::rtl::OUString temp; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; - ::com::sun::star::task::DocumentMSPasswordRequest - aDocumentMSPasswordRequest( temp, - temp2, - ::com::sun::star::task::InteractionClassification_QUERY, - nMode, - aName ); - - m_aRequest <<= aDocumentMSPasswordRequest; - - m_pAbort = new MSAbortContinuation; - m_pPassword = new MSPasswordContinuation; - - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pPassword ); -} - -sal_Bool RequestMSDocumentPassword::isAbort() -{ - return m_pAbort->isSelected(); -} - -sal_Bool RequestMSDocumentPassword::isPassword() -{ - return m_pPassword->isSelected(); -} - -::rtl::OUString RequestMSDocumentPassword::getPassword() -{ - return m_pPassword->getPassword(); -} - -::com::sun::star::uno::Any SAL_CALL RequestMSDocumentPassword::getRequest() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_aRequest; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > - SAL_CALL RequestMSDocumentPassword::getContinuations() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_lContinuations; -} - - diff --git a/svtools/source/misc1/docpasswdrequest.cxx b/svtools/source/misc1/docpasswdrequest.cxx deleted file mode 100644 index 37ceb85ec132..000000000000 --- a/svtools/source/misc1/docpasswdrequest.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: docpasswdrequest.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "docpasswdrequest.hxx" -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionPassword.hpp> - -//========================================================================== - -class AbortContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionAbort > -{ - sal_Bool mbSelected; - -public: - AbortContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException) { mbSelected = sal_True; } -}; - -//========================================================================== - -class PasswordContinuation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionPassword > -{ - sal_Bool mbSelected; - ::rtl::OUString maPassword; - -public: - PasswordContinuation() : mbSelected( sal_False ) {} - - sal_Bool isSelected() { return mbSelected; } - - void reset() { mbSelected = sal_False; } - - virtual void SAL_CALL select() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPassword( const ::rtl::OUString& aPass ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException); -}; - -void SAL_CALL PasswordContinuation::select() - throw(::com::sun::star::uno::RuntimeException) -{ - mbSelected = sal_True; -} - -void SAL_CALL PasswordContinuation::setPassword( const ::rtl::OUString& aPass ) - throw (::com::sun::star::uno::RuntimeException) -{ - maPassword = aPass; -} - -::rtl::OUString SAL_CALL PasswordContinuation::getPassword() - throw (::com::sun::star::uno::RuntimeException) -{ - return maPassword; -} - -//========================================================================== - -RequestDocumentPassword::RequestDocumentPassword( ::com::sun::star::task::PasswordRequestMode nMode, ::rtl::OUString aName ) -{ - ::rtl::OUString temp; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; - ::com::sun::star::task::DocumentPasswordRequest - aDocumentPasswordRequest( temp, - temp2, - ::com::sun::star::task::InteractionClassification_QUERY, - nMode, - aName ); - - m_aRequest <<= aDocumentPasswordRequest; - - m_pAbort = new AbortContinuation; - m_pPassword = new PasswordContinuation; - - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pPassword ); -} - -sal_Bool RequestDocumentPassword::isAbort() -{ - return m_pAbort->isSelected(); -} - -sal_Bool RequestDocumentPassword::isPassword() -{ - return m_pPassword->isSelected(); -} - -::rtl::OUString RequestDocumentPassword::getPassword() -{ - return m_pPassword->getPassword(); -} - -::com::sun::star::uno::Any SAL_CALL RequestDocumentPassword::getRequest() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_aRequest; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > - SAL_CALL RequestDocumentPassword::getContinuations() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return m_lContinuations; -} - - diff --git a/svtools/source/misc1/loginerr.cxx b/svtools/source/misc1/loginerr.cxx deleted file mode 100644 index b9802a8be535..000000000000 --- a/svtools/source/misc1/loginerr.cxx +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loginerr.cxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include <svtools/loginerr.hxx> - -//============================================================================ -// -// CntLoginErrorHint Implementation. -// -//============================================================================ - -TYPEINIT1( CntLoginErrorHint, SfxHint ); - diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk index 3ca57ff36f92..dd143ea4e972 100644 --- a/svtools/source/misc1/makefile.mk +++ b/svtools/source/misc1/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -49,14 +49,11 @@ EXCEPTIONSFILES=\ SLOFILES=\ $(EXCEPTIONSFILES) \ $(SLO)$/adrparse.obj \ - $(SLO)$/docpasswdrequest.obj \ - $(SLO)$/docmspasswdrequest.obj \ $(SLO)$/filenotation.obj \ $(SLO)$/inethist.obj \ $(SLO)$/inettype.obj \ $(SLO)$/iniadrtk.obj \ $(SLO)$/lngmisc.obj \ - $(SLO)$/loginerr.obj \ $(SLO)$/PasswordHelper.obj SRS1NAME=$(TARGET) diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx index 7417367ec124..d65a2fd696ce 100644 --- a/svtools/source/numbers/numfmuno.cxx +++ b/svtools/source/numbers/numfmuno.cxx @@ -774,7 +774,7 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPro else if (aString.EqualsAscii( PROPERTYNAME_LOCALE )) { lang::Locale aLocale( MsLangId::convertLanguageToLocale( - pFormat->GetLanguage())); + pFormat->GetLanguage())); aRet <<= aLocale; } else if (aString.EqualsAscii( PROPERTYNAME_TYPE )) diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx index d6ce04c4da2a..77b33226559c 100644 --- a/svtools/source/numbers/zforscan.cxx +++ b/svtools/source/numbers/zforscan.cxx @@ -491,6 +491,8 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) if ( j < NF_MAX_DEFAULT_COLORS ) i = j; } + + Color* pResult = NULL; if (i >= NF_MAX_DEFAULT_COLORS) { const String& rColorWord = pKeyword[NF_KEY_COLOR]; @@ -516,15 +518,9 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) { long nIndex = sString.ToInt32(); if (nIndex > 0 && nIndex <= 64) - return pFormatter->GetUserDefColor((USHORT)nIndex-1); - else - return NULL; + pResult = pFormatter->GetUserDefColor((USHORT)nIndex-1); } - else - return NULL; } - else - return NULL; } else { @@ -538,8 +534,9 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) else sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; - return &(StandardColor[i]); + pResult = &(StandardColor[i]); } + return pResult; } diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk index 70692ecbf06b..31e1336ad966 100644 --- a/svtools/source/passwordcontainer/makefile.mk +++ b/svtools/source/passwordcontainer/makefile.mk @@ -43,7 +43,8 @@ DLLPRE= # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/passwordcontainer.obj + $(SLO)$/passwordcontainer.obj\ + $(SLO)$/syscreds.obj SHL1TARGET= $(TARGET) SHL1IMPLIB= i$(TARGET) diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx index 9855e7e3c487..cebde0705f12 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svtools/source/passwordcontainer/passwordcontainer.cxx @@ -152,10 +152,17 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) static sal_Bool shorterUrl( ::rtl::OUString& aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 ) + + if( aInd > 0 ) { - aURL = aURL.copy( 0, aInd ); - return sal_True; + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return sal_True; + } } return sal_False; @@ -753,37 +760,14 @@ void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUS UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( mMutex ); - - if( !m_aContainer.empty() ) - { - ::rtl::OUString aUrl( aURL ); - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - - // each iteration remove last '/...' section from the aUrl - // while it's possible, up to the most left '://' - while( shorterUrl( aUrl ) ) - { - // first look for <url>/somename and then look for <url>/somename/... - aIter = m_aContainer.find( aUrl ); - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - else - { - ::rtl::OUString tmpUrl( aUrl ); - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + return find( aURL, rtl::OUString(), false, aHandler ); +} - aIter = m_aContainer.lower_bound( aUrl ); - if( aIter != m_aContainer.end() ) - return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) ); - } - } - } +//------------------------------------------------------------------------- - return UrlRecord(); +UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + return find( aURL, aName, true, aHandler ); } //------------------------------------------------------------------------- @@ -810,48 +794,76 @@ Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >& //------------------------------------------------------------------------- -UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +bool PasswordContainer::createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const Reference< XInteractionHandler >& aHandler, + UrlRecord & rRec ) + throw( RuntimeException ) { + if ( bName ) + { + Sequence< UserRecord > aUsrRec + = FindUsr( rIter->second, aName, aHandler ); + if( aUsrRec.getLength() ) + { + rRec = UrlRecord( rIter->first, aUsrRec ); + return true; + } + } + else + { + rRec = UrlRecord( + rIter->first, + CopyToUserRecordSequence( rIter->second, aHandler ) ); + return true; + } + return false; +} + +//------------------------------------------------------------------------- +UrlRecord PasswordContainer::find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ ::osl::MutexGuard aGuard( mMutex ); - if( !m_aContainer.empty() ) + + if( !m_aContainer.empty() && aURL.getLength() ) { ::rtl::OUString aUrl( aURL ); - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter != m_aContainer.end() ) - { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); - } // each iteration remove last '/...' section from the aUrl // while it's possible, up to the most left '://' - while( shorterUrl( aUrl ) ) + do { // first look for <url>/somename and then look for <url>/somename/... - aIter = m_aContainer.find( aUrl ); + PassMap::iterator aIter = m_aContainer.find( aUrl ); if( aIter != m_aContainer.end() ) { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; } else { ::rtl::OUString tmpUrl( aUrl ); - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); - aIter = m_aContainer.lower_bound( aUrl ); - if( aIter != m_aContainer.end() ) + aIter = m_aContainer.lower_bound( tmpUrl ); + if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) ) { - Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - return UrlRecord( aIter->first, aUsrRec ); + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; } } } + while( shorterUrl( aUrl ) && aUrl.getLength() ); } return UrlRecord(); @@ -1355,6 +1367,35 @@ void SAL_CALL PasswordContainer::removeMasterPassword() return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() ); } + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) + throw (uno::RuntimeException) +{ + mUrlContainer.add( Url, MakePersistent ); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + return mUrlContainer.find( Url ); +} + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + mUrlContainer.remove( Url ); +} + +//------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent ) + throw (uno::RuntimeException) +{ + return mUrlContainer.list( OnlyPersistent ); +} + //------------------------------------------------------------------------- void PasswordContainer::Notify() @@ -1487,7 +1528,9 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode aRememberModes, // rRememberPasswordModes RememberAuthentication_NO, // eDefaultRememberPasswordMode aRememberModes, // rRememberAccountModes - RememberAuthentication_NO // eDefaultRememberAccountMode + RememberAuthentication_NO, // eDefaultRememberAccountMode + sal_False, // bCanUseSystemCredentials + sal_False // bDefaultUseSystemCredentials ); Sequence< diff --git a/svtools/source/passwordcontainer/syscreds.cxx b/svtools/source/passwordcontainer/syscreds.cxx new file mode 100644 index 000000000000..b8c223040e6d --- /dev/null +++ b/svtools/source/passwordcontainer/syscreds.cxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General 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 "syscreds.hxx" +#include "com/sun/star/beans/PropertyValue.hpp" + +using namespace com::sun::star; + +SysCredentialsConfigItem::SysCredentialsConfigItem( + SysCredentialsConfig * pOwner ) +: utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Common/Passwords" ), + CONFIG_MODE_IMMEDIATE_UPDATE ), + m_bInited( false ), + m_pOwner( pOwner ) +{ + uno::Sequence< ::rtl::OUString > aNode( 1 ); + aNode[ 0 ] = rtl::OUString::createFromAscii( + "Office.Common/Passwords/AuthenticateUsingSystemCredentials" ); + EnableNotification( aNode ); +} + +//virtual +void SysCredentialsConfigItem::Notify( + const uno::Sequence< rtl::OUString > & /*seqPropertyNames*/ ) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_bInited = false; + // rebuild m_seqURLs + getSystemCredentialsURLs(); + } + m_pOwner->persistentConfigChanged(); +} + +uno::Sequence< rtl::OUString > +SysCredentialsConfigItem::getSystemCredentialsURLs() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bInited ) + { + // read config item + uno::Sequence< ::rtl::OUString > aPropNames( 1 ); + aPropNames[ 0 ] = rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + uno::Sequence< uno::Any > aAnyValues( + utl::ConfigItem::GetProperties( aPropNames ) ); + + OSL_ENSURE( + aAnyValues.getLength() == 1, + "SysCredentialsConfigItem::getSystemCredentialsURLs: " + "Error reading config item!" ); + + uno::Sequence< rtl::OUString > aValues; + if ( ( aAnyValues[ 0 ] >>= aValues ) || + ( !aAnyValues[ 0 ].hasValue() ) ) + { + m_seqURLs = aValues; + m_bInited = true; + } + } + return m_seqURLs; +} + +void SysCredentialsConfigItem::setSystemCredentialsURLs( + const uno::Sequence< rtl::OUString > & seqURLList ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // write config item. + uno::Sequence< rtl::OUString > aPropNames( 1 ); + uno::Sequence< uno::Any > aPropValues( 1 ); + aPropNames[ 0 ] + = ::rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + aPropValues[ 0 ] <<= seqURLList; + + utl::ConfigItem::SetModified(); + utl::ConfigItem::PutProperties( aPropNames, aPropValues ); + + m_seqURLs = seqURLList; + m_bInited = true; +} + +//============================================================================ + +namespace +{ + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + bool removeLastSegment( ::rtl::OUString & aURL ) + { + sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); + + if( aInd > 0 ) + { + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return true; + } + } + + return false; + } + + bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) + { + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + if( !rContainer.empty() && aURL.getLength() ) + { + ::rtl::OUString aUrl( aURL ); + + // each iteration remove last '/...' section from the aUrl + // while it's possible, up to the most left '://' + do + { + // first look for <url>/somename and then look for <url>/somename/... + StringSet::const_iterator aIter = rContainer.find( aUrl ); + if( aIter != rContainer.end() ) + { + aResult = *aIter; + return true; + } + else + { + ::rtl::OUString tmpUrl( aUrl ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = rContainer.lower_bound( tmpUrl ); + if( aIter != rContainer.end() && aIter->match( tmpUrl ) ) + { + aResult = *aIter; + return true; + } + } + } + while( removeLastSegment( aUrl ) && aUrl.getLength() ); + } + aResult = rtl::OUString(); + return false; + } + +} // namespace + +SysCredentialsConfig::SysCredentialsConfig() +: m_aConfigItem( this ), + m_bCfgInited( false ) +{ +} + +void SysCredentialsConfig::initCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bCfgInited ) + { + uno::Sequence< rtl::OUString > aURLs( + m_aConfigItem.getSystemCredentialsURLs() ); + for ( sal_Int32 n = 0; n < aURLs.getLength(); ++n ) + m_aCfgContainer.insert( aURLs[ n ] ); + + m_bCfgInited = true; + } +} + +void SysCredentialsConfig::writeCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + + OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" ); + + uno::Sequence< rtl::OUString > aURLs( m_aCfgContainer.size() ); + StringSet::const_iterator it = m_aCfgContainer.begin(); + const StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aURLs[ n ] = *it; + ++it; + ++n; + } + + m_aConfigItem.setSystemCredentialsURLs( aURLs ); +} + +rtl::OUString SysCredentialsConfig::find( rtl::OUString const & aURL ) +{ + osl::MutexGuard aGuard( m_aMutex ); + rtl::OUString aResult; + if ( findURL( m_aMemContainer, aURL, aResult ) ) + return aResult; + + initCfg(); + if ( findURL( m_aCfgContainer, aURL, aResult ) ) + return aResult; + + return rtl::OUString(); +} + +void SysCredentialsConfig::add( rtl::OUString const & rURL, bool bPersistent ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( bPersistent ) + { + m_aMemContainer.erase( rURL ); + + initCfg(); + m_aCfgContainer.insert( rURL ); + writeCfg(); + } + else + { + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); + + m_aMemContainer.insert( rURL ); + } +} + +void SysCredentialsConfig::remove( rtl::OUString const & rURL ) +{ + m_aMemContainer.erase( rURL ); + + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); +} + +uno::Sequence< rtl::OUString > SysCredentialsConfig::list( bool bOnlyPersistent ) +{ + initCfg(); + sal_Int32 nCount = m_aCfgContainer.size() + + ( bOnlyPersistent ? 0 : m_aMemContainer.size() ); + uno::Sequence< rtl::OUString > aResult( nCount ); + + StringSet::const_iterator it = m_aCfgContainer.begin(); + StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + + if ( !bOnlyPersistent ) + { + it = m_aMemContainer.begin(); + end = m_aMemContainer.end(); + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + } + return aResult; +} + +void SysCredentialsConfig::persistentConfigChanged() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + m_bCfgInited = false; // re-init on demand. +} diff --git a/svtools/source/passwordcontainer/syscreds.hxx b/svtools/source/passwordcontainer/syscreds.hxx new file mode 100644 index 000000000000..b037e17c348e --- /dev/null +++ b/svtools/source/passwordcontainer/syscreds.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General 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 INCLUDED_SVTOOLS_SYSCREDS_HXX +#define INCLUDED_SVTOOLS_SYSCREDS_HXX + +#include <set> +#include <memory> +#include "osl/mutex.hxx" +#include "rtl/ustring.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "unotools/configitem.hxx" + +class SysCredentialsConfig; + +class SysCredentialsConfigItem : public utl::ConfigItem +{ + public: + SysCredentialsConfigItem( SysCredentialsConfig * pOwner ); + //virtual ~SysCredentialsConfigItem(); + + virtual void Notify( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqPropertyNames ); + //virtual void Commit(); + + com::sun::star::uno::Sequence< rtl::OUString > + getSystemCredentialsURLs(); + + void setSystemCredentialsURLs( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqURLList ); + + //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const; + +private: + ::osl::Mutex m_aMutex; + bool m_bInited; + com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs; + SysCredentialsConfig * m_pOwner; +}; + +typedef std::set< rtl::OUString > StringSet; + +class SysCredentialsConfig +{ + public: + SysCredentialsConfig(); + + rtl::OUString find( rtl::OUString const & rURL ); + void add( rtl::OUString const & rURL, bool bPersistent ); + void remove( rtl::OUString const & rURL ); + com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent ); + + void persistentConfigChanged(); + + private: + void initCfg(); + void writeCfg(); + + ::osl::Mutex m_aMutex; + StringSet m_aMemContainer; + StringSet m_aCfgContainer; + SysCredentialsConfigItem m_aConfigItem; + bool m_bCfgInited; +}; + +#endif // INCLUDED_SVTOOLS_SYSCREDS_HXX diff --git a/svtools/source/syslocale/syslocale.cxx b/svtools/source/syslocale/syslocale.cxx index abe236bb46d0..9811d97fd964 100644 --- a/svtools/source/syslocale/syslocale.cxx +++ b/svtools/source/syslocale/syslocale.cxx @@ -66,18 +66,18 @@ public: virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + CharClass* GetCharClass(); + }; // ----------------------------------------------------------------------- -SvtSysLocale_Impl::SvtSysLocale_Impl() +SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { const lang::Locale& rLocale = Application::GetSettings().GetLocale(); pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), rLocale ); - pCharClass = new CharClass( - ::comphelper::getProcessServiceFactory(), rLocale ); aSysLocaleOptions.AddListener( *this ); } @@ -89,7 +89,15 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() delete pLocaleData; } - +CharClass* SvtSysLocale_Impl::GetCharClass() +{ + if ( !pCharClass ) + { + const lang::Locale& rLocale = Application::GetSettings().GetLocale(); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); + } + return pCharClass; +} void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) { const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); @@ -98,7 +106,7 @@ void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) MutexGuard aGuard( SvtSysLocale::GetMutex() ); const lang::Locale& rLocale = Application::GetSettings().GetLocale(); pLocaleData->setLocale( rLocale ); - pCharClass->setLocale( rLocale ); + GetCharClass()->setLocale( rLocale ); } } @@ -158,11 +166,11 @@ const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const const CharClass& SvtSysLocale::GetCharClass() const { - return *(pImpl->pCharClass); + return *(pImpl->GetCharClass()); } const CharClass* SvtSysLocale::GetCharClassPtr() const { - return pImpl->pCharClass; + return pImpl->GetCharClass(); } diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index e6922aa4f099..54cc448ff89e 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -133,7 +133,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: } else if (aServiceName.EqualsIgnoreCaseAscii("roadmap") ) { - pWindow = new ::svt::ORoadmap( pParent, WB_DIALOGCONTROL); + pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP ); *ppNewComp = new SVTXRoadmap; } else if ( aServiceName.EqualsIgnoreCaseAscii( "ProgressBar" ) ) |