diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
commit | d773cda7d126918249f43776b2d6053d4bc73f33 (patch) | |
tree | 126336aad16b5e52d24e3bf3b5c947d17475dda2 | |
parent | c61aa274cb5631305cfbaea6f1894db756e911c8 (diff) | |
parent | 273fa6a6aa0d56660807ab29892f0618cfbb2e63 (diff) |
CWS changehid: resync to m84
221 files changed, 6070 insertions, 3684 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx index 957b0a508bd8..cb2c4f6628c8 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx @@ -56,7 +56,7 @@ protected: AccessibleGridControl( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, - ::svt::table::IAccessibleTable& _rTable + ::svt::table::IAccessibleTable& _rTable ); virtual ~AccessibleGridControl(); @@ -177,8 +177,7 @@ private: <p>The instance holds it's XAccessibleContext with a hard reference, while the contxt holds this instance weak.</p> */ -typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible - > AccessibleGridControlAccess_Base; +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base; class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base ,public ::svt::table::IAccessibleTableControl @@ -191,7 +190,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > m_xContext; - AccessibleGridControl* m_pContext; + AccessibleGridControl* m_pContext; // note that this pointer is valid as long as m_xContext is valid! public: @@ -253,7 +252,7 @@ protected: private: AccessibleGridControlAccess(); // never implemented - AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented + AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented }; diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx index 3bdd5abe8912..c6a26d8c4548 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -96,8 +96,8 @@ public: @param eDescrText The constant for the description text. */ AccessibleGridControlBase( const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, ::svt::table::AccessibleTableControlObjType eObjType ); protected: @@ -135,14 +135,14 @@ public: The relation set (the GridControl does not have one). */ virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL - getAccessibleRelationSet() + ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet() throw ( ::com::sun::star::uno::RuntimeException ); /** @return The set of current states. */ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL - getAccessibleStateSet() + getAccessibleStateSet() throw ( ::com::sun::star::uno::RuntimeException ); /** @return The parent's locale. */ @@ -407,7 +407,7 @@ protected: private: GridControlAccessibleElement(); // never implemented - GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented + GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented }; diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx index b45ad5bdae5a..90306435bd4b 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx @@ -51,7 +51,7 @@ public: AccessibleGridControlHeader( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, + ::svt::table::IAccessibleTable& rTable, ::svt::table::AccessibleTableControlObjType eObjType ); protected: diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx index 648614a9e214..0672ca28a151 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx @@ -36,9 +36,9 @@ namespace accessibility sal_Int32 m_nColumnRowId; public: AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& _rTable, - ::svt::table::AccessibleTableControlObjType _eObjType); + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& _rTable, + ::svt::table::AccessibleTableControlObjType _eObjType); /** @return The count of visible children. */ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); @@ -56,8 +56,8 @@ namespace accessibility /** Queries for a new interface. */ ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); /** Aquires the object (calls acquire() on base class). */ virtual void SAL_CALL acquire() throw (); diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx index 35b7a69f5aa6..bee42d85e2a2 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx @@ -57,9 +57,9 @@ public: @param eDescrText The constant for the description text. */ AccessibleGridControlTableBase( const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType ); + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); protected: virtual ~AccessibleGridControlTableBase(); @@ -174,14 +174,6 @@ protected: // internal helper methods ------------------------------------------------ /** @attention This method requires locked mutex's and a living object. - @param nColumn - the position of the column in the Accessible world - @return - the position of the column in VCL the Accessible world - */ - sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; - - /** @attention This method requires locked mutex's and a living object. @return The number of cells of the table. */ sal_Int32 implGetChildCount() const; diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx index dd44927d7fc1..dd44927d7fc1 100644..100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx new file mode 100755 index 000000000000..10c6520b6a3d --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * 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 ACC_ACCESSIBLETOOLPANELDECK_HXX +#define ACC_ACCESSIBLETOOLPANELDECK_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class ToolPanelDeck; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeck + //================================================================================================================== + class AccessibleToolPanelDeck_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelDeck_Base; + class AccessibleToolPanelDeck : public AccessibleToolPanelDeck_Base + { + public: + AccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + + using AccessibleToolPanelDeck_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelDeck(); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelDeck_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECK_HXX diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx new file mode 100644 index 000000000000..cc2d39c5acbf --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * 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 ACC_ACCESSIBLETOOLPANELTABBAR_HXX +#define ACC_ACCESSIBLETOOLPANELTABBAR_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelTabBar + //================================================================================================================== + class AccessibleToolPanelTabBar_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelTabBar_Base; + class AccessibleToolPanelTabBar : public AccessibleToolPanelTabBar_Base + { + public: + AccessibleToolPanelTabBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + + using AccessibleToolPanelTabBar_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelTabBar(); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelTabBar_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELTABBAR_HXX diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx new file mode 100644 index 000000000000..80b2ccaaf104 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * 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 ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX +#define ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem + //================================================================================================================== + class AccessibleToolPanelDeckTabBarItem_Impl; + typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleToolPanelDeckTabBarItem_Base; + class AccessibleToolPanelDeckTabBarItem : public AccessibleToolPanelDeckTabBarItem_Base + { + public: + AccessibleToolPanelDeckTabBarItem( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos + ); + + using AccessibleToolPanelDeckTabBarItem_Base::NotifyAccessibleEvent; + using AccessibleToolPanelDeckTabBarItem_Base::lateInit; + + protected: + virtual ~AccessibleToolPanelDeckTabBarItem(); + + public: + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + protected: + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + protected: + ::boost::scoped_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX diff --git a/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc index 859da828beb1..1f936e678b98 100644 --- a/accessibility/inc/accessibility/helper/accessiblestrings.hrc +++ b/accessibility/inc/accessibility/helper/accessiblestrings.hrc @@ -45,7 +45,8 @@ #define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 ) -#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 1000 ) +#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 ) +#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 ) // ----------------------------------------------------------------------------- diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx index 168938d50a6c..7283cec6a95c 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx @@ -57,6 +57,7 @@ private: void UpdateAllItems_Impl(); void UpdateItemName_Impl( sal_Int32 _nPos ); void UpdateItemEnabled_Impl( sal_Int32 _nPos ); + void UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ); void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ); void ReleaseSubToolBox( ToolBox* _pSubToolBox ); diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index e8111657d7d0..f0aa406b62bf 100644..100755 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -33,7 +33,6 @@ #include <svtools/accessibletable.hxx> #include <comphelper/types.hxx> #include <toolkit/helper/vclunohelper.hxx> -//#include "svtools/table/tablecontrol.hxx" // ============================================================================ @@ -61,21 +60,19 @@ public: /** The data table child. */ Reference< ::com::sun::star::accessibility::XAccessible > m_xTable; - AccessibleGridControlTable* m_pTable; + AccessibleGridControlTable* m_pTable; /** The header bar for rows. */ Reference< ::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar; - AccessibleGridControlHeader* m_pRowHeaderBar; + AccessibleGridControlHeader* m_pRowHeaderBar; /** The header bar for columns (first row of the table). */ Reference< ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar; - AccessibleGridControlHeader* m_pColumnHeaderBar; + AccessibleGridControlHeader* m_pColumnHeaderBar; }; -// Ctor/Dtor/disposing -------------------------------------------------------- - DBG_NAME( AccessibleGridControl ) AccessibleGridControl::AccessibleGridControl( @@ -83,7 +80,6 @@ AccessibleGridControl::AccessibleGridControl( IAccessibleTable& _rTable ) : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL ) { -// DBG_CTOR( AccessibleTableControl, NULL ); m_pImpl.reset( new AccessibleGridControl_Impl() ); m_pImpl->m_aCreator = _rxCreator; } @@ -91,7 +87,6 @@ AccessibleGridControl::AccessibleGridControl( // ----------------------------------------------------------------------------- AccessibleGridControl::~AccessibleGridControl() { - DBG_DTOR( AccessibleGridControl, NULL ); } // ----------------------------------------------------------------------------- @@ -99,7 +94,7 @@ void SAL_CALL AccessibleGridControl::disposing() { ::osl::MutexGuard aGuard( getOslMutex() ); - m_pImpl->m_pTable = NULL; + m_pImpl->m_pTable = NULL; m_pImpl->m_pColumnHeaderBar = NULL; m_pImpl->m_pRowHeaderBar = NULL; m_pImpl->m_aCreator = Reference< XAccessible >(); @@ -143,7 +138,8 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) { if(nChildIndex == 0 && m_aTable.HasColHeader()) { - if(!m_pImpl->m_xColumnHeaderBar.is()){ + if(!m_pImpl->m_xColumnHeaderBar.is()) + { AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR); m_pImpl->m_xColumnHeaderBar = pColHeaderBar; } @@ -151,7 +147,8 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) } else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0)) { - if(!m_pImpl->m_xRowHeaderBar.is()){ + if(!m_pImpl->m_xRowHeaderBar.is()) + { AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR); m_pImpl->m_xRowHeaderBar = pRowHeaderBar; } @@ -164,7 +161,6 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) xChild = m_pImpl->m_xTable; } } - return xChild; } // ----------------------------------------------------------------------------- @@ -200,11 +196,11 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) { Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); Reference< XAccessibleComponent > - xCurrChildComp( xCurrChild, uno::UNO_QUERY ); + xCurrChildComp( xCurrChild, uno::UNO_QUERY ); if( xCurrChildComp.is() && - VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) ) - xChild = xCurrChild; + VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) ) + xChild = xCurrChild; } } return xChild; @@ -217,7 +213,7 @@ void SAL_CALL AccessibleGridControl::grabFocus() TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); - m_aTable.GrabFocus(); + m_aTable.GrabFocus(); } // ----------------------------------------------------------------------------- @@ -260,7 +256,6 @@ Reference< XAccessible > AccessibleGridControl::implGetTable() { m_pImpl->m_pTable = createAccessibleTable(); m_pImpl->m_xTable = m_pImpl->m_pTable; - } return m_pImpl->m_xTable; } @@ -302,7 +297,7 @@ AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex ) Reference< XAccessible > xRet; switch( nChildIndex ) { - case TCINDEX_COLUMNHEADERBAR: + case TCINDEX_COLUMNHEADERBAR: xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR ); break; case TCINDEX_ROWHEADERBAR: @@ -318,7 +313,7 @@ AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex ) AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable() { Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; - DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" ); + DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" ); return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE ); } // ============================================================================ @@ -331,13 +326,11 @@ AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAcce ,m_rTable( _rTable ) ,m_pContext( NULL ) { - DBG_CTOR( AccessibleGridControlAccess, NULL ); } // ----------------------------------------------------------------------------- AccessibleGridControlAccess::~AccessibleGridControlAccess() { - DBG_DTOR( AccessibleGridControlAccess, NULL ); } // ----------------------------------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index 12d4a7d141a4..ea81bd350426 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -57,8 +57,6 @@ namespace accessibility { using namespace com::sun::star::accessibility::AccessibleStateType; // ============================================================================ -// Ctor/Dtor/disposing -------------------------------------------------------- - DBG_NAME( AccessibleGridControlBase ) AccessibleGridControlBase::AccessibleGridControlBase( @@ -73,13 +71,10 @@ AccessibleGridControlBase::AccessibleGridControlBase( m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ), m_aClientId(0) { - DBG_CTOR( AccessibleGridControlBase, NULL ); } AccessibleGridControlBase::~AccessibleGridControlBase() { -// DBG_DTOR( AccessibleGridControlBase, NULL ); - if( isAlive() ) { // increment ref count to prevent double call of Dtor @@ -122,20 +117,19 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() xParentContext( m_xParent->getAccessibleContext() ); if( xParentContext.is() ) { - Reference< uno::XInterface > xChild; + Reference< uno::XInterface > xChild; sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild ) { - xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) ); - - if ( xMeMyselfAndI.get() == xChild.get() ) - { - nRet = nChild; - break; - } + xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) ); + if ( xMeMyselfAndI.get() == xChild.get() ) + { + nRet = nChild; + break; } } + } } return nRet; } @@ -160,9 +154,9 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleGridControlBase::getAccessibleRelationSet() throw ( uno::RuntimeException ) { - ensureIsAlive(); - // GridControl does not have relations. - return new utl::AccessibleRelationSetHelper; + ensureIsAlive(); + // GridControl does not have relations. + return new utl::AccessibleRelationSetHelper; } Reference< XAccessibleStateSet > SAL_CALL @@ -185,7 +179,7 @@ lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() Reference< XAccessibleContext > xParentContext( m_xParent->getAccessibleContext() ); if( xParentContext.is() ) - return xParentContext->getLocale(); + return xParentContext->getLocale(); } throw IllegalAccessibleComponentStateException(); } @@ -268,19 +262,18 @@ void SAL_CALL AccessibleGridControlBase::removeEventListener( { if( _rxListener.is() && getClientId( ) ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + ::osl::MutexGuard aGuard( getOslMutex() ); sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - - AccessibleEventNotifier::TClientId nId( getClientId( ) ); - setClientId( 0 ); - AccessibleEventNotifier::revokeClient( nId ); - } + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + AccessibleEventNotifier::TClientId nId( getClientId( ) ); + setClientId( 0 ); + AccessibleEventNotifier::revokeClient( nId ); + } } } @@ -310,7 +303,6 @@ sal_Bool SAL_CALL AccessibleGridControlBase::supportsService( for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString ) ; - return pString != pArrEnd; } @@ -351,7 +343,6 @@ sal_Bool AccessibleGridControlBase::implIsShowing() } else pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - return pStateSetHelper; } @@ -382,7 +373,7 @@ Rectangle AccessibleGridControlBase::getBoundingBox() } return aRect; } -// + Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() throw ( lang::DisposedException ) { @@ -436,22 +427,22 @@ sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole() switch ( m_eObjType ) { case TCTYPE_ROWHEADERCELL: - nRole = AccessibleRole::ROW_HEADER; - break; - case TCTYPE_COLUMNHEADERCELL: - nRole = AccessibleRole::COLUMN_HEADER; - break; - case TCTYPE_COLUMNHEADERBAR: - case TCTYPE_ROWHEADERBAR: - case TCTYPE_TABLE: - nRole = AccessibleRole::TABLE; - break; - case TCTYPE_TABLECELL: - nRole = AccessibleRole::TABLE_CELL; - break; - case TCTYPE_GRIDCONTROL: - nRole = AccessibleRole::PANEL; - break; + nRole = AccessibleRole::ROW_HEADER; + break; + case TCTYPE_COLUMNHEADERCELL: + nRole = AccessibleRole::COLUMN_HEADER; + break; + case TCTYPE_COLUMNHEADERBAR: + case TCTYPE_ROWHEADERBAR: + case TCTYPE_TABLE: + nRole = AccessibleRole::TABLE; + break; + case TCTYPE_TABLECELL: + nRole = AccessibleRole::TABLE_CELL; + break; + case TCTYPE_GRIDCONTROL: + nRole = AccessibleRole::PANEL; + break; } return nRole; } @@ -480,17 +471,16 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::su { if ( pInst->IsControlForeground() ) nColor = pInst->GetControlForeground().GetColor(); + else + { + Font aFont; + if ( pInst->IsControlFont() ) + aFont = pInst->GetControlFont(); else - { - Font aFont; - if ( pInst->IsControlFont() ) - aFont = pInst->GetControlFont(); - else - aFont = pInst->GetFont(); - nColor = aFont.GetColor().GetColor(); - } + aFont = pInst->GetFont(); + nColor = aFont.GetColor().GetColor(); + } } - return nColor; } // ----------------------------------------------------------------------------- @@ -505,20 +495,18 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::su { if ( pInst->IsControlBackground() ) nColor = pInst->GetControlBackground().GetColor(); - else + else nColor = pInst->GetBackground().GetColor().GetColor(); } - return nColor; } //// ============================================================================ GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent, - IAccessibleTable& rTable, - AccessibleTableControlObjType eObjType ) + IAccessibleTable& rTable, + AccessibleTableControlObjType eObjType ) :AccessibleGridControlBase( rxParent, rTable, eObjType ) { -// DBG_CTOR( GridControlAccessibleElement, NULL ); } // XInterface ----------------------------------------------------------------- @@ -537,7 +525,6 @@ Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccess // ---------------------------------------------------------------------------- GridControlAccessibleElement::~GridControlAccessibleElement( ) { -// DBG_DTOR( GridControlAccessibleElement, NULL ); } // ============================================================================ diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index c7622c18981e..1870eebc8e3e 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -56,8 +56,6 @@ namespace accessibility { // ============================================================================ -// Ctor/Dtor/disposing -------------------------------------------------------- - DBG_NAME( AccessibleGridControlHeader ) AccessibleGridControlHeader::AccessibleGridControlHeader( @@ -66,15 +64,12 @@ AccessibleGridControlHeader::AccessibleGridControlHeader( ::svt::table::AccessibleTableControlObjType eObjType): AccessibleGridControlTableBase( rxParent, rTable, eObjType ) { -// DBG_CTOR( AccessibleGridControlHeaderBar, NULL ); - DBG_ASSERT( isRowBar() || isColumnBar(), "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" ); } AccessibleGridControlHeader::~AccessibleGridControlHeader() { -// DBG_DTOR( AccessibleGridControlHeader, NULL ); } // XAccessibleContext --------------------------------------------------------- @@ -83,11 +78,11 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - TCSolarGuard aSolarGuard; + TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); ensureIsAlive(); Reference< XAccessible > xChild; if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR) @@ -106,11 +101,11 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex ) sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent() throw ( uno::RuntimeException ) { - ensureIsAlive(); - if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader()) - return 1; - else - return 0; + ensureIsAlive(); + if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader()) + return 1; + else + return 0; } // XAccessibleComponent ------------------------------------------------------- @@ -126,8 +121,8 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint ) sal_Int32 nRow = 0; sal_Int32 nColumnPos = 0; sal_Bool bConverted = isRowBar() ? - m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) : - m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ); + m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) : + m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ); return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); } @@ -181,35 +176,24 @@ Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibl ensureIsAlive(); return NULL; // no headers in headers } - +//not selectable Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows() throw ( uno::RuntimeException ) { - TCSolarGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Sequence< sal_Int32 > aSelSeq; - // row of column header bar not selectable - if( isRowBar() ) - implGetSelectedRows( aSelSeq ); + Sequence< sal_Int32 > aSelSeq(0); return aSelSeq; } //columns aren't selectable Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns() throw ( uno::RuntimeException ) { - return NULL; + Sequence< sal_Int32 > aSelSeq(0); + return aSelSeq; } -//To Do - not yet implemented -sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 nRow ) +//row headers not selectable +sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - TCSolarGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - //return isRowBar() ? implIsRowSelected( nRow ) : sal_False; return sal_False; } //columns aren't selectable @@ -219,28 +203,19 @@ sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_I (void)nColumn; return sal_False; } - +//not implemented Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt( - sal_Int32 nRow, sal_Int32 nColumn ) + sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - TCSolarGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return implGetChild( nRow, implToVCLColumnPos( nColumn ) ); + return NULL; } -// TO DO - not implemented yet +// not selectable sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected( - sal_Int32 nRow, sal_Int32 nColumn ) + sal_Int32 /*nRow*/, sal_Int32 /*nColumn */) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - TCSolarGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return FALSE; - // return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn ); + return sal_False; } // XServiceInfo --------------------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx index 485c57c40ae1..485c57c40ae1 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx index efd78fc8634a..461e776f1392 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -51,8 +51,6 @@ namespace accessibility { // ============================================================================ -// Ctor/Dtor/disposing -------------------------------------------------------- - DBG_NAME( AccessibleGridControlTable ) AccessibleGridControlTable::AccessibleGridControlTable( @@ -61,12 +59,10 @@ AccessibleGridControlTable::AccessibleGridControlTable( AccessibleTableControlObjType _eType) : AccessibleGridControlTableBase( rxParent, rTable, _eType ) { - DBG_CTOR( AccessibleGridControlTable, NULL ); } AccessibleGridControlTable::~AccessibleGridControlTable() { - DBG_DTOR( AccessibleGridControlTable, NULL ); } // XAccessibleContext --------------------------------------------------------- @@ -92,7 +88,6 @@ sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent() return 1; else return 2; - } // XAccessibleComponent ------------------------------------------------------- @@ -177,7 +172,6 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); - Sequence< sal_Int32 > aSelSeq; implGetSelectedRows( aSelSeq ); return aSelSeq; @@ -187,38 +181,34 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns() throw ( uno::RuntimeException ) { -// TCSolarGuard aSolarGuard; -// ::osl::MutexGuard aGuard( getOslMutex() ); -// ensureIsAlive(); -// -// Sequence< sal_Int32 > aSelSeq; -// implGetSelectedColumns( aSelSeq ); -// return aSelSeq; - return NULL; + Sequence< sal_Int32 > aSelSeq(0); + return aSelSeq; } -//To Do: not implemented yet sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - //TCSolarGuard aSolarGuard; - //::osl::MutexGuard aGuard( getOslMutex() ); - //ensureIsAlive(); - //ensureIsValidRow( nRow ); - //return implIsRowSelected( nRow ); - (void) nRow; - return sal_False; + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + sal_Bool bSelected = sal_False; + Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); + for(int i=0; i<selectedRows.getLength(); i++) + { + if(nRow == selectedRows[i]) + { + bSelected = sal_True; + continue; + } + } + return bSelected; } //columns aren't selectable sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - /*TCSolarGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return implIsColumnSelected( nColumn );*/ (void) nColumn; return sal_False; } @@ -238,16 +228,14 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - /*TCSolarGuard aSolarGuard; + TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); - return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );*/ - (void) nRow; (void) nColumn; - return sal_False; + //selection of single cells not possible, so if row is selected, the cell will be selected too + return isAccessibleRowSelected(nRow); } -//To Do: not implemented yet void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { @@ -255,48 +243,51 @@ void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChil ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); ensureIsValidIndex( nChildIndex ); - //if( isRowBar() ) - // implSelectRow( nChildIndex, sal_True ); - //else - // implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True ); + sal_Int32 nColumns = m_aTable.GetColumnCount(); + sal_Int32 nRow = (nChildIndex / nColumns); + std::vector< sal_Int32 > selectedRows = m_aTable.GetSelectedRows(); + selectedRows.push_back(nRow); } -//To Do - not implemented yet sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { - // using interface methods - no mutex - /*return isRowBar() ? - isAccessibleRowSelected( nChildIndex ) : - isAccessibleColumnSelected( nChildIndex );*/ - (void)nChildIndex; - return FALSE; + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + sal_Int32 nColumns = m_aTable.GetColumnCount(); + sal_Int32 nRow = (nChildIndex / nColumns); + return isAccessibleRowSelected(nRow); } -//To Do - not implemented yet void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection() throw ( uno::RuntimeException ) { TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); + for(unsigned int i=0;i<m_aTable.GetSelectedRows().size();i++) + m_aTable.RemoveSelectedRow((sal_Int32)i); } -//To Do - not implemented yet void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren() throw ( uno::RuntimeException ) { TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); + Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); + for(int i=0;i<m_aTable.GetRowCount();i++) + selectedRows[i]=i; } -//To Do - not implemented yet sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount() throw ( uno::RuntimeException ) { TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); - return 0; + Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); + sal_Int32 nColumns = m_aTable.GetColumnCount(); + return selectedRows.getLength()*nColumns; } -//To Do - not implemented yet Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) @@ -304,10 +295,12 @@ AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChild TCSolarGuard aSolarGuard; ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); - (void)nSelectedChildIndex; - return NULL; + if(isAccessibleChildSelected(nSelectedChildIndex)) + return getAccessibleChild(nSelectedChildIndex); + else + return NULL; } -//To Do - not implemented yet +//not implemented yet, because only row selection possible void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) @@ -316,14 +309,6 @@ void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); (void)nSelectedChildIndex; - // method may throw lang::IndexOutOfBoundsException - //if ( isAccessibleChildSelected(nSelectedChildIndex) ) - //{ - // if( isRowBar() ) - // implSelectRow( nSelectedChildIndex, sal_False ); - // else - // implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False ); - //} } // XInterface ----------------------------------------------------------------- @@ -364,14 +349,6 @@ Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() return m_aTable.calcTableRect(); } // internal helper methods ---------------------------------------------------- -//To Do - not implemented yet -//sal_Int32 AccessibleGridControlTable::implGetChildIndexFromSelectedIndex( -// sal_Int32 nSelectedChildIndex ) -// throw ( lang::IndexOutOfBoundsException ) -//{ -// (void)nSelectedChildIndex; -// return 0; -//} Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( sal_Int32 nChildIndex ) throw ( uno::RuntimeException ) diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx index 8a7e3102bdf7..f6d1147ad309 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx @@ -53,8 +53,6 @@ namespace accessibility { // ============================================================================ -// Ctor/Dtor/disposing -------------------------------------------------------- - DBG_NAME( AccessibleGridControlTableBase ) AccessibleGridControlTableBase::AccessibleGridControlTableBase( @@ -63,12 +61,10 @@ AccessibleGridControlTableBase::AccessibleGridControlTableBase( AccessibleTableControlObjType eObjType ) : GridControlAccessibleElement( rxParent, rTable, eObjType ) { - DBG_CTOR( AccessibleGridControlTableBase, NULL ); } AccessibleGridControlTableBase::~AccessibleGridControlTableBase() { - DBG_DTOR( AccessibleGridControlTableBase, NULL ); } // XAccessibleContext --------------------------------------------------------- @@ -224,19 +220,6 @@ Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationI // internal helper methods ---------------------------------------------------- -sal_uInt16 AccessibleGridControlTableBase::implToVCLColumnPos( sal_Int32 nColumn ) const -{ - sal_uInt16 nVCLPos = 0; - if( (0 <= nColumn) && (nColumn < m_aTable.GetColumnCount()) ) - { - // regard "handle column" - if( m_aTable.HasRowHeader() ) - ++nColumn; - nVCLPos = static_cast< sal_uInt16 >( nColumn ); - } - return nVCLPos; -} - sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const { return m_aTable.GetRowCount()*m_aTable.GetColumnCount(); diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index f511eb43cbf8..43b9400e9050 100644..100755 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -65,7 +65,6 @@ namespace accessibility // ============================================================================= // = AccessibleGridControlCell // ============================================================================= - //DBG_NAME( svt_AccessibleGridControlCell ) // ----------------------------------------------------------------------------- AccessibleGridControlCell::AccessibleGridControlCell( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable, @@ -74,7 +73,6 @@ namespace accessibility ,m_nRowPos( _nRowPos ) ,m_nColPos( _nColPos ) { -// DBG_CTOR( svt_AccessibleGridControlCell, NULL ); // set accessible name here, because for that we need the position of the cell // and so the base class isn't capable of doing this ::rtl::OUString aAccName; @@ -104,8 +102,7 @@ namespace accessibility ::rtl::OUString AccessibleGridControlTableCell::implGetText() { ensureIsAlive(); - //return mpTable->GetAccessibleCellText( getRowPos(), static_cast< USHORT >( getColumnPos() ) ); - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test" )); + return m_aTable.GetAccessibleCellText( getRowPos(), getColumnPos() ); } ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale() @@ -166,10 +163,7 @@ namespace accessibility ::com::sun::star::awt::Rectangle aRect; if ( &m_aTable ) - { aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) ); - } - return aRect; } @@ -363,12 +357,12 @@ namespace accessibility //!!! don't know how to put a string into the clipboard return sal_False; } + Rectangle AccessibleGridControlTableCell::implGetBoundingBox() { return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle } // ----------------------------------------------------------------------------- - Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() { return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx new file mode 100755 index 000000000000..6976b221a8b5 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeck.cxx @@ -0,0 +1,412 @@ +/************************************************************************* + * 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 "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleToolPanelDeck.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <tools/diagnose_ex.h> + +#include <boost/noncopyable.hpp> +#include <vector> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::accessibility::XAccessibleContext; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::lang::IndexOutOfBoundsException; + using ::com::sun::star::lang::Locale; + using ::com::sun::star::accessibility::XAccessibleRelationSet; + using ::com::sun::star::accessibility::XAccessibleStateSet; + using ::com::sun::star::accessibility::IllegalAccessibleComponentStateException; + using ::com::sun::star::awt::XFont; + /** === end UNO using === **/ + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + typedef ::com::sun::star::awt::Point UnoPoint; + + //================================================================================================================== + //= AccessibleToolPanelDeck_Impl - declaration + //================================================================================================================== + class AccessibleToolPanelDeck_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelDeck_Impl( + AccessibleToolPanelDeck& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + + void checkDisposed(); + bool isDisposed() const { return m_pPanelDeck == NULL; } + void dispose(); + + ~AccessibleToolPanelDeck_Impl(); + + Reference< XAccessible > getOwnAccessible() const; + Reference< XAccessible > getActivePanelAccessible(); + + protected: + // IToolPanelDeckListener + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + public: + AccessibleToolPanelDeck& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::ToolPanelDeck* m_pPanelDeck; + + typedef ::std::vector< Reference< XAccessible > > AccessibleChildren; + Reference< XAccessible > m_xActivePanelAccessible; + }; + + //================================================================================================================== + //= MethodGuard + //================================================================================================================== + namespace + { + class MethodGuard + { + public: + MethodGuard( AccessibleToolPanelDeck_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~MethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + } + + //================================================================================================================== + //= AccessibleToolPanelDeck_Impl - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck_Impl::AccessibleToolPanelDeck_Impl( AccessibleToolPanelDeck& i_rAntiImpl, const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_xActivePanelAccessible() + { + m_pPanelDeck->AddListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck_Impl::~AccessibleToolPanelDeck_Impl() + { + if ( !isDisposed() ) + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + m_xAccessibleParent.clear(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::checkDisposed() + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck_Impl::getOwnAccessible() const + { + Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); + OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), + "AccessibleToolPanelDeck_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); + return xOwnAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck_Impl::getActivePanelAccessible() + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: already disposed!", NULL ); + + if ( !m_xActivePanelAccessible.is() ) + { + ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); + ENSURE_OR_RETURN( !!aActivePanel, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: this should not be called without an active panel!", NULL ); + ::svt::PToolPanel pActivePanel( m_pPanelDeck->GetPanel( *aActivePanel ) ); + ENSURE_OR_RETURN( pActivePanel.get() != NULL, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: no active panel!", NULL ); + m_xActivePanelAccessible = pActivePanel->CreatePanelAccessible( getOwnAccessible() ); + OSL_ENSURE( m_xActivePanelAccessible.is(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: illegal accessible returned by the panel!" ); + } + + return m_xActivePanelAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + (void)i_pPanel; + (void)i_nPosition; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) + { + (void)i_nPosition; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( !!i_rOldActive ) + { + if ( !m_xActivePanelAccessible.is() ) + { + // again, this might in theory happen if the XAccessible for the active panel has never before been requested. + // In this case, just say that all our children are invalid, so they all must be re-requested. + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); + } + else + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( m_xActivePanelAccessible ), Any() ); + } + } + + m_xActivePanelAccessible.clear(); + + if ( !!i_rNewActive ) + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getActivePanelAccessible() ) ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + MethodGuard aGuard( *this ); + + (void)i_rNewLayouter; + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::Dying() + { + // the tool panel deck is dying, so dispose ourself + m_rAntiImpl.dispose(); + } + + //================================================================================================================== + //= AccessibleToolPanelDeck + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck::AccessibleToolPanelDeck( const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck ) + :AccessibleToolPanelDeck_Base( i_rPanelDeck.GetWindowPeer() ) + ,m_pImpl( new AccessibleToolPanelDeck_Impl( *this, i_rAccessibleParent, i_rPanelDeck ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck::~AccessibleToolPanelDeck() + { + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int32 SAL_CALL AccessibleToolPanelDeck::getAccessibleChildCount( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + sal_Int32 nChildCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); + + ::boost::optional< size_t > aActivePanel( m_pImpl->m_pPanelDeck->GetActivePanel() ); + if ( !!aActivePanel ) + return ++nChildCount; + + return nChildCount; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const sal_Int32 nChildCount( getAccessibleChildCount() ); + if ( ( i_nIndex < 0 ) || ( i_nIndex >= nChildCount ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + + // first "n" children are provided by the layouter + const size_t nLayouterCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); + if ( size_t( i_nIndex ) < nLayouterCount ) + return m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChild( + size_t( i_nIndex ), + m_pImpl->getOwnAccessible() + ); + + // the last child is the XAccessible of the active panel + return m_pImpl->getActivePanelAccessible(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleParent( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + const Reference< XAccessible > xParent = implGetForeignControlledParent(); + if ( xParent.is() ) + return xParent; + return m_pImpl->m_xAccessibleParent; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 SAL_CALL AccessibleToolPanelDeck::getAccessibleRole( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return AccessibleRole::PANEL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const ::Point aRequestedPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); + // check the panel window itself + const ::Window& rActivePanelAnchor( m_pImpl->m_pPanelDeck->GetPanelWindowAnchor() ); + const Rectangle aPanelAnchorArea( rActivePanelAnchor.GetPosPixel(), rActivePanelAnchor.GetOutputSizePixel() ); + if ( aPanelAnchorArea.IsInside( aRequestedPoint ) ) + // note that this assumes that the Window which actually implements the concrete panel covers + // the complete area of its "anchor" Window. But this is ensured by the ToolPanelDeck implementation. + return m_pImpl->getActivePanelAccessible(); + + // check the XAccessible instances provided by the layouter + try + { + const ::svt::PDeckLayouter pLayouter( m_pImpl->m_pPanelDeck->GetLayouter() ); + ENSURE_OR_THROW( pLayouter.get() != NULL, "invalid layouter" ); + + const size_t nLayouterChildren = pLayouter->GetAccessibleChildCount(); + for ( size_t i=0; i<nLayouterChildren; ++i ) + { + const Reference< XAccessible > xLayoutItemAccessible( pLayouter->GetAccessibleChild( i, m_pImpl->getOwnAccessible() ), UNO_SET_THROW ); + const Reference< XAccessibleComponent > xLayoutItemComponent( xLayoutItemAccessible->getAccessibleContext(), UNO_QUERY_THROW ); + const ::Rectangle aLayoutItemBounds( VCLUnoHelper::ConvertToVCLRect( xLayoutItemComponent->getBounds() ) ); + if ( aLayoutItemBounds.IsInside( aRequestedPoint ) ) + return xLayoutItemAccessible; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelDeck::grabFocus( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + m_pImpl->m_pPanelDeck->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelDeck::disposing() + { + AccessibleToolPanelDeck_Base::disposing(); + m_pImpl->dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) + { + // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those + // A11Y events ourself + (void)i_rVclWindowEvent; + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) + { + AccessibleToolPanelDeck_Base::FillAccessibleStateSet( i_rStateSet ); + if ( m_pImpl->isDisposed() ) + { + i_rStateSet.AddState( AccessibleStateType::DEFUNC ); + } + else + { + i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + } + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx new file mode 100644 index 000000000000..7e97e3714172 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx @@ -0,0 +1,459 @@ +/************************************************************************* + * 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 "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleToolPanelDeckTabBar.hxx" +#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" +#include "accessibility/helper/accresmgr.hxx" +#include "accessibility/helper/accessiblestrings.hrc" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/paneltabbar.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> +#include <vcl/button.hxx> +#include <vos/mutex.hxx> +#include <tools/diagnose_ex.h> + +#include <vector> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::lang::IndexOutOfBoundsException; + using ::com::sun::star::accessibility::XAccessibleContext; + /** === end UNO using === **/ + + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + + typedef ::com::sun::star::awt::Point UnoPoint; + typedef ::com::sun::star::awt::Size UnoSize; + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + + //================================================================================================================== + //= AccessibleWrapper + //================================================================================================================== + typedef ::cppu::WeakImplHelper1< XAccessible > AccessibleWrapper_Base; + class AccessibleWrapper : public AccessibleWrapper_Base + { + public: + AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + // XAccessible + virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException) + { + return m_xContext; + } + + private: + const Reference< XAccessibleContext > m_xContext; + }; + + //================================================================================================================== + //= AccessibleToolPanelTabBar_Impl + //================================================================================================================== + class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelTabBar_Impl( + AccessibleToolPanelTabBar& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + ~AccessibleToolPanelTabBar_Impl(); + + void checkDisposed(); + bool isDisposed() const { return m_pPanelDeck == NULL; } + void dispose(); + + ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } + ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } + const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; } + Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition ); + Reference< XAccessible > getOwnAccessible() const; + + protected: + // IToolPanelDeckListener + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + DECL_LINK( OnWindowEvent, const VclSimpleEvent* ); + + private: + AccessibleToolPanelTabBar& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::IToolPanelDeck* m_pPanelDeck; + ::svt::PanelTabBar* m_pTabBar; + ::std::vector< Reference< XAccessible > > m_aChildren; + }; + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_pTabBar( &i_rTabBar ) + ,m_aChildren() + { + m_pPanelDeck->AddListener( *this ); + m_aChildren.resize( m_pPanelDeck->GetPanelCount() ); + + const String sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) ); + i_rTabBar.SetAccessibleName( sAccessibleDescription ); + i_rTabBar.SetAccessibleDescription( sAccessibleDescription ); + + i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::checkDisposed() + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl() + { + if ( !isDisposed() ) + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + + m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + m_pTabBar = NULL; + + m_xAccessibleParent.clear(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition ) + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", NULL ); + ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", NULL ); + + Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] ); + if ( !rAccessibleChild.is() ) + { + ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem( + getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) ); + rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) ); + pAccesibleItemContext->lateInit( rAccessibleChild ); + } + return rAccessibleChild; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const + { + Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); + OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), + "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); + return xOwnAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); + (void)i_pPanel; + m_aChildren.insert( m_aChildren.begin() + i_nPosition, NULL ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition ) + { + ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); + + const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) ); + m_aChildren.erase( m_aChildren.begin() + i_nPosition ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + (void)i_rOldActive; + (void)i_rNewActive; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + (void)i_rNewLayouter; + m_rAntiImpl.dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::Dying() + { + m_rAntiImpl.dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent ) + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L ); + + const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) ); + if ( !pWindowEvent ) + return 0L; + + const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) ); + const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) ); + ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L ); + + const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW ); + const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE ); + if ( !bShow && !bHide ) + // not interested in events other than visibility changes + return 0L; + + const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() ); + const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() ); + const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild ); + + return 1L; + } + + //================================================================================================================== + //= MethodGuard + //================================================================================================================== + namespace + { + class MethodGuard + { + public: + MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~MethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + } + + //================================================================================================================== + //= AccessibleToolPanelTabBar + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + :AccessibleToolPanelTabBar_Base( i_rTabBar.GetWindowPeer() ) + ,m_pImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar() + { + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + + return m_pImpl->getPanelDeck()->GetPanelCount() + + ( bHasScrollBack ? 1 : 0 ) + + ( bHasScrollForward ? 1 : 0 ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + + const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) ); + const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) ); + OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" ); + + if ( bScrollBackRequested || bScrollForwardRequested ) + { + Reference< XAccessible > xScrollButtonAccessible( m_pImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() ); + ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", NULL ); + #if OSL_DEBUG_LEVEL > 0 + Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() ); + ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible ); + OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_pImpl->getOwnAccessible(), + "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accesible!" ); + #endif + return xScrollButtonAccessible; + } + + return m_pImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return m_pImpl->getAccessibleParent(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return AccessibleRole::PAGE_TAB_LIST; + } + + //------------------------------------------------------------------------------------------------------------------ + namespace + { + bool lcl_covers( const ::Window& i_rWindow, const ::Point& i_rPoint ) + { + const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) ); + return aWindowBounds.IsInside( i_rPoint ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + // check the tab items + const UnoPoint aOwnScreenPos( getLocationOnScreen() ); + const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y ); + + for ( size_t i=0; i<m_pImpl->getPanelDeck()->GetPanelCount(); ++i ) + { + const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect(i) ); + if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) ) + return m_pImpl->getAccessiblePanelItem(i); + } + + // check the scroll buttons + const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + if ( bHasScrollBack && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) ) + return m_pImpl->getTabBar()->GetScrollButton( false ).GetAccessible(); + + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + if ( bHasScrollForward && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) ) + return m_pImpl->getTabBar()->GetScrollButton( true ).GetAccessible(); + + // no hit + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelTabBar::disposing() + { + AccessibleToolPanelTabBar_Base::disposing(); + m_pImpl->dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) + { + // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those + // A11Y events ourself + (void)i_rVclWindowEvent; + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) + { + AccessibleToolPanelTabBar_Base::FillAccessibleStateSet( i_rStateSet ); + i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + + ENSURE_OR_RETURN_VOID( !m_pImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" ); + if ( m_pImpl->getTabBar()->IsVertical() ) + i_rStateSet.AddState( AccessibleStateType::VERTICAL ); + else + i_rStateSet.AddState( AccessibleStateType::HORIZONTAL ); + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx new file mode 100644 index 000000000000..0cdfd8480457 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx @@ -0,0 +1,455 @@ +/************************************************************************* + * 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 "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/paneltabbar.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <unotools/accessiblerelationsethelper.hxx> +#include <tools/diagnose_ex.h> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + typedef ::com::sun::star::awt::Point UnoPoint; + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::lang::IndexOutOfBoundsException; + using ::com::sun::star::accessibility::XAccessibleRelationSet; + using ::com::sun::star::accessibility::XAccessibleStateSet; + using ::com::sun::star::accessibility::XAccessibleComponent; + using ::com::sun::star::accessibility::XAccessibleExtendedComponent; + using ::com::sun::star::awt::XFont; + /** === end UNO using === **/ + + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem_Impl + //================================================================================================================== + class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelDeckTabBarItem_Impl( + AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos + ); + ~AccessibleToolPanelDeckTabBarItem_Impl(); + + ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } + + // IToolPanelDeckListener + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + public: + bool isDisposed() const { return m_pPanelDeck == NULL; } + void checkDisposed() const; + void dispose(); + + const Reference< XAccessible >& + getAccessibleParent() const { return m_xAccessibleParent; } + size_t getItemPos() const { return m_nItemPos; } + + Reference< XAccessibleComponent > getParentAccessibleComponent() const; + ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } + ::rtl::OUString getPanelDisplayName(); + + private: + void impl_notifyBoundRectChanges(); + void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); + + private: + AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::IToolPanelDeck* m_pPanelDeck; + ::svt::PanelTabBar* m_pTabBar; + size_t m_nItemPos; + }; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem_Impl + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_pTabBar( &i_rTabBar ) + ,m_nItemPos( i_nItemPos ) + { + m_pPanelDeck->AddListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" ); + + m_xAccessibleParent.clear(); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + m_pTabBar = NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const + { + Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW ); + return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName() + { + const ::svt::PToolPanel pPanel( m_pPanelDeck->GetPanel( getItemPos() ) ); + if ( pPanel.get() == NULL ) + throw DisposedException(); + return pPanel->GetDisplayName(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges() + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ) + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, + i_nLostState > -1 ? makeAny( i_nLostState ) : Any(), + i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any() + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + (void)i_pPanel; + if ( i_nPosition <= m_nItemPos ) + ++m_nItemPos; + impl_notifyBoundRectChanges(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition ) + { + if ( i_nPosition == m_nItemPos ) + { + m_rAntiImpl.dispose(); + } + else if ( i_nPosition < m_nItemPos ) + { + --m_nItemPos; + impl_notifyBoundRectChanges(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( m_nItemPos == i_rOldActive ) + { + impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 ); + impl_notifyStateChange( AccessibleStateType::SELECTED, -1 ); + } + else if ( m_nItemPos == i_rNewActive ) + { + impl_notifyStateChange( -1, AccessibleStateType::ACTIVE ); + impl_notifyStateChange( -1, AccessibleStateType::SELECTED ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + (void)i_rNewLayouter; + // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was + // responsible for, died. So do we. + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::Dying() + { + // if the tool panel deck is dying, then its layouter dies, so should we. + dispose(); + } + + //================================================================================================================== + //= ItemMethodGuard + //================================================================================================================== + class ItemMethodGuard + { + public: + ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~ItemMethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) + :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem() + { + } + + //-------------------------------------------------------------------- + sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException) + { + return 0; + } + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) + { + (void)i; + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + } + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getAccessibleParent(); + } + + //-------------------------------------------------------------------- + sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException) + { + return AccessibleRole::PAGE_TAB; + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; + return pRelationSet; + } + + //-------------------------------------------------------------------- + Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + + ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); + pStateSet->AddState( AccessibleStateType::FOCUSABLE ); + pStateSet->AddState( AccessibleStateType::SELECTABLE ); + pStateSet->AddState( AccessibleStateType::ICONIFIED ); + + if ( m_pImpl->getItemPos() == m_pImpl->getPanelDeck()->GetActivePanel() ) + { + pStateSet->AddState( AccessibleStateType::ACTIVE ); + pStateSet->AddState( AccessibleStateType::SELECTED ); + } + + if ( m_pImpl->getItemPos() == m_pImpl->getTabBar()->GetFocusedPanelItem() ) + pStateSet->AddState( AccessibleStateType::FOCUSED ); + + if ( m_pImpl->getTabBar()->IsEnabled() ) + pStateSet->AddState( AccessibleStateType::ENABLED ); + + if ( m_pImpl->getTabBar()->IsVisible() ) + { + pStateSet->AddState( AccessibleStateType::SHOWING ); + pStateSet->AddState( AccessibleStateType::VISIBLE ); + } + + return pStateSet; + } + + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const UnoPoint& i_rLocation ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + // we do not have children ... + (void)i_rLocation; + return NULL; + } + + //-------------------------------------------------------------------- + void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + m_pImpl->getTabBar()->FocusPanelItem( m_pImpl->getItemPos() ); + } + + //-------------------------------------------------------------------- + ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + return xParentComponent->getForeground(); + } + + //-------------------------------------------------------------------- + ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + return xParentComponent->getBackground(); + } + + //-------------------------------------------------------------------- + Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleExtendedComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_QUERY_THROW ); + // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use + // a different font ... + return xParentComponent->getFont(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + // no support + return ::rtl::OUString(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + UnoRectangle SAL_CALL AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + + const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect( m_pImpl->getItemPos() ) ); + + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + const UnoPoint aParentLocation( xParentComponent->getLocationOnScreen() ); + return UnoRectangle( + aItemScreenRect.Left() - aParentLocation.X, + aItemScreenRect.Top() - aParentLocation.Y, + aItemScreenRect.GetWidth(), + aItemScreenRect.GetHeight() + ); + } + + //-------------------------------------------------------------------- + void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing() + { + ItemMethodGuard aGuard( *m_pImpl ); + m_pImpl->dispose(); + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index a352ed51a78c..0468cce97d94 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -131,8 +131,8 @@ namespace accessibility break; // --> OD 2009-04-01 #i92103# - case VCLEVENT_LISTBOX_ENTRY_EXPANDED : - case VCLEVENT_LISTBOX_ENTRY_COLLAPSED : + case VCLEVENT_ITEM_EXPANDED : + case VCLEVENT_ITEM_COLLAPSED : { SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); if ( pEntry ) @@ -141,7 +141,7 @@ namespace accessibility new AccessibleListBoxEntry( *getListBox(), pEntry, this ); Reference< XAccessible > xChild = pAccListBoxEntry; const short nAccEvent = - ( rVclWindowEvent.GetId() == VCLEVENT_LISTBOX_ENTRY_EXPANDED ) + ( rVclWindowEvent.GetId() == VCLEVENT_ITEM_EXPANDED ) ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; uno::Any aListBoxEntry; diff --git a/accessibility/source/extended/accessibletabbarbase.cxx b/accessibility/source/extended/accessibletabbarbase.cxx index 5f290178ea25..5c26185f6b03 100644 --- a/accessibility/source/extended/accessibletabbarbase.cxx +++ b/accessibility/source/extended/accessibletabbarbase.cxx @@ -63,7 +63,7 @@ IMPL_LINK( AccessibleTabBarBase, WindowEventListener, VclSimpleEvent*, pEvent ) DBG_ASSERT( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" ); if( ( pWinEvent->GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) && - ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TABBAR_PAGE_NOTFOUND ) && + ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TabBar::PAGE_NOT_FOUND ) && ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) ) { return 0; diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index e852e0ed54cc..51c86003b0c2 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -313,7 +313,7 @@ namespace accessibility { sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - if ( nPageId == TABBAR_PAGE_NOTFOUND ) + if ( nPageId == TabBar::PAGE_NOT_FOUND ) { for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) RemoveChild( i ); diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk index 446ec73ec1b7..27f4403c8210 100644..100755 --- a/accessibility/source/extended/makefile.mk +++ b/accessibility/source/extended/makefile.mk @@ -70,7 +70,10 @@ SLOFILES=\ $(SLO)$/AccessibleGridControlHeader.obj \ $(SLO)$/AccessibleGridControlTableCell.obj \ $(SLO)$/AccessibleGridControlHeaderCell.obj \ - $(SLO)$/AccessibleGridControlTable.obj + $(SLO)$/AccessibleGridControlTable.obj \ + $(SLO)$/AccessibleToolPanelDeck.obj \ + $(SLO)$/AccessibleToolPanelDeckTabBar.obj \ + $(SLO)$/AccessibleToolPanelDeckTabBarItem.obj # --- Targets ------------------------------------------------------- diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 50d3ac682377..7279b5e2ff60 100644..100755 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -29,18 +29,12 @@ #include "precompiled_accessibility.hxx" #include <accessibility/helper/acc_factory.hxx> -#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX #include <toolkit/awt/vclxwindows.hxx> -#endif #include <accessibility/standard/vclxaccessiblebutton.hxx> #include <accessibility/standard/vclxaccessiblecheckbox.hxx> -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWCOMBOBOX_HXX #include <accessibility/standard/vclxaccessibledropdowncombobox.hxx> -#endif #include <accessibility/standard/vclxaccessiblecombobox.hxx> -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWLISTBOX_HXX #include <accessibility/standard/vclxaccessibledropdownlistbox.hxx> -#endif #include <accessibility/standard/vclxaccessibleedit.hxx> #include <accessibility/standard/vclxaccessiblefixedhyperlink.hxx> #include <accessibility/standard/vclxaccessiblefixedtext.hxx> @@ -67,13 +61,17 @@ #include <accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx> #include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx> #include <accessibility/extended/accessibleeditbrowseboxcell.hxx> +#include <accessibility/extended/AccessibleToolPanelDeck.hxx> +#include <accessibility/extended/AccessibleToolPanelDeckTabBar.hxx> +#include <accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> #include <accessibility/extended/AccessibleGridControl.hxx> #include <svtools/accessibletable.hxx> -#include "vcl/popupmenuwindow.hxx" +#include <vcl/popupmenuwindow.hxx> +#include <cppuhelper/implbase1.hxx> -#include <floatingwindowaccessible.hxx> +#include "floatingwindowaccessible.hxx" //........................................................................ namespace accessibility @@ -227,6 +225,18 @@ inline bool hasFloatingChild(Window *pWindow) sal_uInt16 _nColPos ) const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelTabBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + protected: virtual ~AccessibleFactory(); }; @@ -508,6 +518,20 @@ inline bool hasFloatingChild(Window *pWindow) _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos ); } + //-------------------------------------------------------------------- + Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck( + const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck ) + { + return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck ); + } + + //-------------------------------------------------------------------- + Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar( + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + { + return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar ); + } + //........................................................................ } // namespace accessibility //........................................................................ diff --git a/accessibility/source/helper/accessiblestrings.src b/accessibility/source/helper/accessiblestrings.src index 4df1391f3c1d..ee7f77f9b502 100644 --- a/accessibility/source/helper/accessiblestrings.src +++ b/accessibility/source/helper/accessiblestrings.src @@ -70,3 +70,7 @@ String RID_STR_ACC_NAME_BROWSEBUTTON Text [ en-US ] = "Browse"; }; +String RID_STR_ACC_DESC_PANELDECL_TABBAR +{ + Text [ en-US ] = "Panel Deck Tab Bar"; +}; diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 52b7a7f83cab..ce796af77ab4 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -441,6 +441,26 @@ void VCLXAccessibleToolBox::UpdateAllItems_Impl() } } } + +// ----------------------------------------------------------------------------- + +void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ) +{ + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if( pWindow && pToolBox ) + { + Reference< XAccessible > xChild( pWindow->GetAccessible() ); + if( xChild.is() ) + { + Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( pToolBox->GetDownItemId() ) ) ) ); + VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() ); + + pItem->SetChild( xChild ); + pItem->NotifyChildEvent( xChild, bOpen ); + } + } +} + // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::UpdateItemName_Impl( sal_Int32 _nPos ) { @@ -582,6 +602,13 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow break; } + case VCLEVENT_DROPDOWN_OPEN: + case VCLEVENT_DROPDOWN_CLOSE: + { + UpdateCustomPopupItemp_Impl( static_cast< Window* >( rVclWindowEvent.GetData() ), rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN ); + break; + } + case VCLEVENT_OBJECT_DYING : { // if this toolbox is a subtoolbox, we have to relese it from its parent diff --git a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java index 02ec7fea2232..6e8e45bc4e82 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java @@ -588,28 +588,39 @@ public class AccessibilityWorkBench javax.swing.tree.TreePath aPath = aEvent.getPath(); maTree.scrollPathToVisible (aPath); Object aObject = aPath.getLastPathComponent(); - if (aObject instanceof XAccessible) { - XAccessible xAccessible = (XAccessible) aObject; - if (maObjectViewContainer != null) { - ((AccessibilityModel) maTree.getModel()).addEventListener((TreeNode) aObject, maObjectViewContainer); - maObjectViewContainer.SetObject (xAccessible.getAccessibleContext()); - } + implSetCurrentObject( aObject ); + if (aObject instanceof XAccessible) + { + if (maObjectViewContainer != null) + maObjectViewContainer.SetObject( ((XAccessible)aObject).getAccessibleContext() ); } if (maCanvas != null) maCanvas.SelectObject ((TreeNode) aObject); setCursor (aCursor); } else { - if (maObjectViewContainer != null) { - ((AccessibilityModel) maTree.getModel()).removeEventListener((TreeNode) aEvent.getPath().getLastPathComponent(), maObjectViewContainer); + implSetCurrentObject( aEvent.getPath().getLastPathComponent() ); + if (maObjectViewContainer != null) maObjectViewContainer.SetObject (null); - } if (maCanvas != null) maCanvas.SelectObject (null); } } - + private void implSetCurrentObject( Object i_object ) + { + if ( maObjectViewContainer == null ) + return; + if ( maCurrentObject != null ) + { + AccessibilityModel.removeEventListener( (TreeNode)maCurrentObject, maObjectViewContainer ); + } + maCurrentObject = i_object; + if ( maCurrentObject != null ) + { + AccessibilityModel.addEventListener( (TreeNode)maCurrentObject, maObjectViewContainer ); + } + } // XEventListener public void disposing (EventObject aSourceObj) @@ -687,4 +698,5 @@ public class AccessibilityWorkBench maShapesButton; private JMenuBar maMenuBar; private boolean mbInitialized; + private Object maCurrentObject = null; } diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java index 93823e9a1941..81a499aabf0d 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java @@ -75,8 +75,7 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible, if (xAccessibleContext != null) { try { XAccessibleEventBroadcaster xAccessibleEventBroadcaster = - (XAccessibleEventBroadcaster) UnoRuntime.queryInterface( - XAccessibleEventBroadcaster.class, xAccessibleContext); + UnoRuntime.queryInterface( XAccessibleEventBroadcaster.class, xAccessibleContext ); if (xAccessibleEventBroadcaster != null) { if (attach) { xAccessibleEventBroadcaster.addEventListener(this); @@ -91,9 +90,9 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible, } public void disposing(com.sun.star.lang.EventObject eventObject) { - XAccessibleEventListener listener = this.listener; - if (listener != null) { - listener.disposing(eventObject); + XAccessibleEventListener localListener = this.listener; + if (localListener != null) { + localListener.disposing(eventObject); } treeModel.removeNode(userObject); @@ -135,22 +134,20 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible, public void notifyEvent(AccessibleEventObject accessibleEventObject) { if (accessibleEventObject.EventId == AccessibleEventId.CHILD) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( - XAccessible.class, accessibleEventObject.OldValue); + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.OldValue ); if (xAccessible != null) { handleChildRemoved(xAccessible); } - xAccessible = (XAccessible) UnoRuntime.queryInterface( - XAccessible.class, accessibleEventObject.NewValue); + xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.NewValue ); if (xAccessible != null) { handleChildAdded(xAccessible); } } - XAccessibleEventListener listener = this.listener; - if (listener != null) { - listener.notifyEvent(accessibleEventObject); + XAccessibleEventListener localListener = this.listener; + if (localListener != null) { + localListener.notifyEvent(accessibleEventObject); } } diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java index 5b4bdcdcc4e4..67e8091e027f 100644 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java @@ -64,6 +64,7 @@ class EventMonitorView public EventMonitorView (ObjectViewContainer aContainer) { super (aContainer); + mnLineNo = 0; Layout(); } @@ -85,7 +86,7 @@ class EventMonitorView maScrollPane = new JScrollPane (maText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - maScrollPane.setPreferredSize (new Dimension (300,80)); + maScrollPane.setPreferredSize (new Dimension (300,200)); GridBagConstraints aConstraints = new GridBagConstraints (); aConstraints.weightx = 1; @@ -112,7 +113,7 @@ class EventMonitorView public void notifyEvent (AccessibleEventObject aEvent) { - maText.append (NameProvider.getEventName (aEvent.EventId) + " : " + maText.append ((mnLineNo++) + ". " + NameProvider.getEventName (aEvent.EventId) + " : " + aEvent.OldValue.toString() + " -> " + aEvent.NewValue.toString() + "\n"); @@ -120,5 +121,6 @@ class EventMonitorView } private JTextArea maText; + private int mnLineNo; private JScrollPane maScrollPane; } diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx index 829dd320beb6..7313603096b4 100644 --- a/automation/source/inc/rcontrol.hxx +++ b/automation/source/inc/rcontrol.hxx @@ -305,7 +305,7 @@ #define RC_Profile ( M_SOFFICE | M_MOZILLA | 9 ) // (Popup)Menu #define RC_MenuSelect ( M_SOFFICE | M_MOZILLA | 10 ) -#define RC_SetControlType ( M_SOFFICE | 11 ) +#define RC_SetControlType ( M_SOFFICE | 11 ) // deprecated since RTTI // RemoteFileAccess #define RC_Kill ( M_SOFFICE | 12 ) #define RC_RmDir ( M_SOFFICE | 13 ) @@ -429,14 +429,14 @@ -// Konstanten die im Basic zur Verfgung stehen sollen +// Constants which are available in VCLTestTool scripts -// Verschiedene Typen von Controls fr den Befehl SetControlType -// !!!!!!!!!!! Mssen alle bei SetControlType eingetragen werden !!!!!!!!!!!! +// Different types of controls recognized via RTTI #define CONST_CTBrowseBox 100 #define CONST_CTValueSet 103 #define CONST_CTORoadmap 104 #define CONST_CTIExtensionListBox 105 +#define CONST_CTTableControl 106 #define CONST_CTUnknown 199 // Konstanten fr das ALignment des gesuchten Splitters diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx index fedec0f77b76..9d7fb5597068 100644 --- a/automation/source/server/sta_list.cxx +++ b/automation/source/server/sta_list.cxx @@ -53,6 +53,7 @@ #include <svtools/valueset.hxx> #include <svtools/roadmap.hxx> #include <svtools/extensionlistbox.hxx> +#include <svtools/table/tablecontrol.hxx> #define WINDOW_ANYTYPE WINDOW_BASE @@ -1007,6 +1008,8 @@ String StatementList::ClientTree(Window *pBase, int Indent) WRITEc("/RoadMap") else if ( dynamic_cast< svt::IExtensionListBox* >(pBase) ) WRITEc("/ExtensionListBox") + else if ( dynamic_cast< svt::table::TableControl* >(pBase) ) + WRITEc("/TableControl") else WRITEc("/Unknown") } diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx index 98d9bd31d0e0..56f1871791fd 100644 --- a/automation/source/server/statemnt.cxx +++ b/automation/source/server/statemnt.cxx @@ -82,6 +82,7 @@ #include <vcl/wintypes.hxx> #include <svtools/valueset.hxx> #include <svtools/roadmap.hxx> +#include <svtools/table/tablecontrol.hxx> #include <svl/poolitem.hxx> #include <svtools/extensionlistbox.hxx> // Hat keinen Includeschutz @@ -96,6 +97,7 @@ #include <basic/ttstrhlp.hxx> #endif #include <basic/dispdefs.hxx> +#include <basic/sbuno.hxx> #include <vos/socket.hxx> #include <svl/pickerhistory.hxx> #include <com/sun/star/util/XCancellable.hpp> @@ -128,9 +130,10 @@ using namespace com::sun::star::frame; using namespace com::sun::star::uno; -using namespace com::sun::star::util; +//using namespace com::sun::star::util; geht wegen Color nicht using namespace com::sun::star::beans; using namespace svt; +//using namespace svt::table; #ifndef SBX_VALUE_DECL_DEFINED @@ -625,7 +628,7 @@ BOOL StatementSlot::Execute() AddReferer(); if ( !aUnoUrl.Len() ) aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) ); - URL aTargetURL; + ::com::sun::star::util::URL aTargetURL; aTargetURL.Complete = aUnoUrl; Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY ); Reference < XFrame > xFrame; @@ -671,7 +674,7 @@ BOOL StatementSlot::Execute() ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) ); else { - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); @@ -872,6 +875,13 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst if ( bFirst ) pRet->GenReturn ( RET_WinInfo, rtl::OString(), (comm_ULONG)nConf | DH_MODE_DATA_VALID, UniString(), TRUE ); + if ( bFirst ) + { + if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL && + dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) ) + pBase = pBase->GetParent(); + } + { // Klammerung, so da der String nicht whrend der Rekursion bestehen bleibt String aName; BOOL bSkip = FALSE; @@ -969,6 +979,8 @@ void StatementCommand::WriteControlData( Window *pBase, ULONG nConf, BOOL bFirst aTypeSuffix.AppendAscii( "/RoadMap", 8 ); else if ( dynamic_cast< IExtensionListBox* >(pBase) ) aTypeSuffix.AppendAscii( "/ExtensionListBox" ); + else if ( dynamic_cast< svt::table::TableControl* >(pBase) ) + aTypeSuffix.AppendAscii( "/TableControl" ); else aTypeSuffix.AppendAscii( "/Unknown", 8 ); } @@ -3438,17 +3450,17 @@ BOOL StatementCommand::Execute() { if( (nParams & PARAM_USHORT_1) ) { - Reference < XCancellable > xPicker; + Reference < ::com::sun::star::util::XCancellable > xPicker; switch( nNr1 ) { case CONST_FilePicker: { - xPicker.set( Reference < XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) ); + xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) ); } break; case CONST_FolderPicker: { - xPicker.set( Reference < XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) ); + xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) ); } break; default: @@ -5365,6 +5377,7 @@ BOOL StatementControl::Execute() break; } break; +#if 0 case C_ToolBox: { ToolBox *pTB = ((ToolBox*)pControl); @@ -5376,13 +5389,13 @@ BOOL StatementControl::Execute() { // Wir flschen einen Parameter if ( aUId.HasNumeric() ) { - nParams = PARAM_ULONG_1; + nParams |= PARAM_ULONG_1; nLNr1 = USHORT( aUId.GetNum() ); DBG_ASSERT( nLNr1 <= 0xFFFF, "ID on ToolBox > 0xFFFF" ); } else { - nParams = PARAM_STR_1; + nParams |= PARAM_STR_1; aString1 = aUId.GetStr(); } } @@ -5397,23 +5410,23 @@ BOOL StatementControl::Execute() BOOL bItemFound = FALSE;\ {\ rtl::OString aButtonId;\ - if( nParams == PARAM_STR_1 )\ - aButtonId = rtl::OString( rtl::OUStringToOString( aString1, RTL_TEXTENCODING_UTF8 ) );\ - if( nParams == PARAM_ULONG_1 )\ - aButtonId = rtl::OString( ""/*nLNr1*/ );\ - for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && 1/*!aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos)))*/ &&\ - 1/*!aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos)))*/ ; nItemPos++ ) {}\ - bItemFound = 1/*aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos)))*/ || 1/*aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos)))*/;\ + if( nParams & PARAM_STR_1 )\ + aButtonId = rtlOUStringToOString( aString1, RTL_TEXTENCODING_UTF8 );\ + if( nParams & PARAM_ULONG_1 )\ + aButtonId = SmartId( nLNr1 );\ + for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && !aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos))) &&\ + !aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos))) ; nItemPos++ ) {}\ + bItemFound = aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos))) || aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos)));\ if ( !bItemFound )\ ReportError( aUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\ else\ {\ - if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled )\ + if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled && nMethodId != M_GetState )\ {\ ReportError( aUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\ bItemFound = FALSE;\ }\ - else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) )\ + else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) && nMethodId != M_GetState )\ {\ ReportError( aUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\ bItemFound = FALSE;\ @@ -5446,7 +5459,6 @@ BOOL StatementControl::Execute() }\ }\ }\ - switch( nMethodId ) { case M_AnimateMouse : @@ -5808,19 +5820,28 @@ BOOL StatementControl::Execute() pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pItem->GetButtonFlags() & ~SV_STATE_MASK )); break; case M_Check : - pItem->SetStateChecked(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); + if ( !pItem->IsStateChecked() ) + { + pItem->SetStateChecked(); + pTree->CheckButtonHdl(); + pTree->InvalidateEntry( pThisEntry ); + } break; case M_UnCheck : - pItem->SetStateUnchecked(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); + if ( pItem->IsStateChecked() || pItem->IsStateTristate() ) + { + pItem->SetStateUnchecked(); + pTree->CheckButtonHdl(); + pTree->InvalidateEntry( pThisEntry ); + } break; case M_TriState : - pItem->SetStateTristate(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); + if ( !pItem->IsStateTristate() ) + { + pItem->SetStateTristate(); + pTree->CheckButtonHdl(); + pTree->InvalidateEntry( pThisEntry ); + } break; default: ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); @@ -5878,6 +5899,7 @@ BOOL StatementControl::Execute() break; } break; +#endif case C_Control: { USHORT nRealControlType = 0; @@ -5889,6 +5911,8 @@ BOOL StatementControl::Execute() nRealControlType = CONST_CTORoadmap; else if ( dynamic_cast< IExtensionListBox* >(pControl) ) nRealControlType = CONST_CTIExtensionListBox; + else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) ) + nRealControlType = CONST_CTTableControl; else nRealControlType = CONST_CTUnknown; @@ -6230,6 +6254,165 @@ protected: } } break; + + case CONST_CTTableControl: + { + ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl); + switch ( nMethodId ) + { + case M_GetItemType : + { + if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) && + ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() )) + { + ::svt::table::PTableModel pModel = pTC->GetModel(); + Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1]; + pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() )); + } + } + break; + case M_GetItemText : + { + if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) && + ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() )) + { + ::svt::table::PTableModel pModel = pTC->GetModel(); + Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1]; + /* doesn't work ATM since it gets casted to SbxDATE in VCLTestTool unfortunately + SbxVariableRef xRes = new SbxVariable( SbxVARIANT ); + unoToSbxValue( xRes, aCell ); + pRet->GenReturn ( RET_Value, aUId, *xRes );*/ + + Type aType = aCell.getValueType(); + TypeClass eTypeClass = aType.getTypeClass(); + switch( eTypeClass ) + { + /*case TypeClass_ENUM: + { + sal_Int32 nEnum = 0; + enum2int( nEnum, aValue ); + pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)nEnum ); + } + break;*/ + case TypeClass_BOOLEAN: + pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() ); + break; + case TypeClass_CHAR: + { + ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() ); + pRet->GenReturn ( RET_Value, aUId, aContent ); + } + break; + case TypeClass_STRING: + { + ::rtl::OUString aContent; + aCell >>= aContent; + pRet->GenReturn ( RET_Value, aUId, aContent ); + } + break; + //case TypeClass_FLOAT: break; + //case TypeClass_DOUBLE: break; + //case TypeClass_OCTET: break; + case TypeClass_BYTE: + case TypeClass_SHORT: + case TypeClass_LONG: + case TypeClass_HYPER: + case TypeClass_UNSIGNED_LONG: + case TypeClass_UNSIGNED_HYPER: + { + comm_ULONG val = 0; + aCell >>= val; + pRet->GenReturn ( RET_Value, aUId, val ); + } + break; + //case TypeClass_UNSIGNED_OCTET:break; + case TypeClass_UNSIGNED_SHORT: + { + comm_USHORT val = 0; + aCell >>= val; + pRet->GenReturn ( RET_Value, aUId, val ); + } + break; + default: + pRet->GenReturn ( RET_Value, aUId, comm_USHORT(0) ); + break; + } + } + } + break; + case M_GetColumnCount : + { + pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetColumnCount() ); + } + break; + case M_GetRowCount : + { + pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetRowCount() ); + } + break; + case M_Select : + { + if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() )) + { + if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) ) + { + Size aSize( pTC->GetSizePixel() ); +// DirectLog( S_QAError, UniString::CreateFromInt32( aSize.Width() ).Append( UniString::CreateFromInt32( aSize.Height() ) ) ); + Point aPos( aSize.Width() / 2, aSize.Height() / 2 ); + long nStep = aSize.Height() / 4; + ::svt::table::RowPos nLastPos; + while ( ( nLastPos = pTC->GetCurrentRow( aPos ) ) != nNr1-1 && nStep > 0 ) + { + if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID ) + aPos.Y() -= nStep; + else + aPos.Y() += nStep; + nStep /= 2; + } + if ( pTC->GetCurrentRow( aPos ) == nNr1-1 ) + { + MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1); + pTC->getSelEngine()->SelMouseButtonDown( aMEvnt ); + pTC->getSelEngine()->SelMouseButtonUp( aMEvnt ); + if ( pTC->IsRowSelected( nNr1-1 ) ) + pTC->Select(); + } + else + ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) ); + } + else + ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) ); + } + } + break; + case M_GetSelCount : + pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows().size() )); + break; + case M_GetSelIndex : + if ( ! (nParams & PARAM_USHORT_1) ) + nNr1 = 1; + if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRows().size() ) ) + pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows()[nNr1-1] +1 ) ); + break; +/* case M_GetSelText : + if ( ! (nParams & PARAM_USHORT_1) ) + nNr1 = 1; + if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) ) + { + nNr1--; + COUNT_LBOX( FirstSelected, NextSelected, nNr1); + GetFirstValidTextItem( pThisEntry ); + pRet->GenReturn ( RET_Value, aUId, pItem->GetText() ); + } + break; + */ + default: + ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) ); + break; + } + } + break; + case CONST_CTUnknown: ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) ); break; diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk index e683e73631b8..756a3d6a62e4 100644 --- a/automation/util/makefile.mk +++ b/automation/util/makefile.mk @@ -136,7 +136,7 @@ DEF3DES =Communication APP1TARGET=testtool -.IF "$(GUI)" == "UNX" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") APP1DEPN+=$(SHL2TARGETN) $(SHL3TARGETN) .ELSE APP1DEPN+=$(SHL2IMPLIBN) $(SHL3IMPLIBN) @@ -228,7 +228,7 @@ APP3STDLIBS+= \ .ENDIF .ENDIF # $(AUTOMATIONLIB) is build in SHL1TARGET -.IF "$(GUI)"=="UNX" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") APP3DEPN=$(SHL1TARGETN) .ELSE APP3DEPN=$(SHL1IMPLIBN) diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index 51d1ed2be6fc..8bf7d3316cd0 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -182,6 +182,10 @@ #define RID_STR_DLGIMP_MISMATCH_OMIT ( RID_BASICIDE_START + 115 ) #define RID_STR_DLGIMP_MISMATCH_TITLE ( RID_BASICIDE_START + 116 ) #define RID_STR_DLGIMP_MISMATCH_TEXT ( RID_BASICIDE_START + 117 ) +#define RID_STR_DOCUMENT_OBJECTS ( RID_BASICIDE_START + 118 ) +#define RID_STR_USERFORMS ( RID_BASICIDE_START + 119 ) +#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 120 ) +#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 121 ) #endif // _SVX_NOIDERESIDS diff --git a/basctl/prj/d.lst b/basctl/prj/d.lst index ffd8e07b1e36..d05ff35bdabc 100644 --- a/basctl/prj/d.lst +++ b/basctl/prj/d.lst @@ -4,8 +4,6 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\menubar mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\toolbar -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\accelerator -mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\accelerator\en-US mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\statusbar ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid @@ -22,5 +20,4 @@ mkdir: %_DEST%\inc%_EXT%\basctl ..\uiconfig\basicide\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\menubar\*.xml ..\uiconfig\basicide\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\toolbar\*.xml -..\uiconfig\basicide\accelerator\en-US\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\accelerator\en-US\*.xml ..\uiconfig\basicide\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\BasicIDE\statusbar\*.xml diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 9fc700948249..9f97e1766c3b 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -46,6 +46,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #endif #include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/script/ModuleType.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <sfx2/docfile.hxx> #include <basic/basrdll.hxx> @@ -202,21 +203,35 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc pLayout = pParent; aXEditorWindow.Show(); - BasicManager* pBasMgr = rDocument.getBasicManager(); - if ( pBasMgr ) + SetBackground(); +} + +SbModuleRef ModulWindow::XModule() +{ + // ModuleWindows can now be created as a result of the + // modules getting created via the api. This is a result of an + // elementInserted event from the BasicLibrary container. + // However the SbModule is also created from a different listener to + // the same event ( in basmgr ) Therefore it is possible when we look + // for xModule it may not yet be available, here we keep tring to access + // the module until such time as it exists + + if ( !xModule.Is() ) { - StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); - if ( pBasic ) + BasicManager* pBasMgr = GetDocument().getBasicManager(); + if ( pBasMgr ) { - xBasic = pBasic; - xModule = (SbModule*)pBasic->FindModule( aName ); + StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() ); + if ( pBasic ) + { + xBasic = pBasic; + xModule = (SbModule*)pBasic->FindModule( GetName() ); + } } } - - SetBackground(); + return xModule; } - __EXPORT ModulWindow::~ModulWindow() { DBG_DTOR( ModulWindow, 0 ); @@ -266,7 +281,7 @@ void ModulWindow::CheckCompileBasic() { DBG_CHKTHIS( ModulWindow, 0 ); - if ( xModule.Is() ) + if ( XModule().Is() ) { // Zur Laufzeit wird niemals compiliert! BOOL bRunning = StarBASIC::IsRunning(); @@ -322,7 +337,7 @@ BOOL ModulWindow::BasicExecute() CheckCompileBasic(); - if ( xModule.Is() && xModule->IsCompiled() && !aStatus.bError ) + if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError ) { if ( GetBreakPoints().Count() ) aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK; @@ -332,6 +347,9 @@ BOOL ModulWindow::BasicExecute() DBG_ASSERT( xModule.Is(), "Kein Modul!" ); AddStatus( BASWIN_RUNNINGBASIC ); USHORT nStart, nEnd, nCurMethodStart = 0; + TextSelection aSel = GetEditView()->GetSelection(); + if ( aDocument.isInVBAMode() ) + nCurMethodStart = ( aSel.GetStart().GetPara() + 1 ); SbMethod* pMethod = 0; // erstes Macro, sonst blind "Main" (ExtSearch?) for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ ) @@ -339,15 +357,27 @@ BOOL ModulWindow::BasicExecute() SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro ); DBG_ASSERT( pM, "Method?" ); pM->GetLineRange( nStart, nEnd ); - if ( !pMethod || ( nStart < nCurMethodStart ) ) + if ( aDocument.isInVBAMode() ) + { + if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd ) + { + pMethod = pM; + break; + } + } + else if ( !pMethod || ( nStart < nCurMethodStart ) ) { pMethod = pM; nCurMethodStart = nStart; } } if ( !pMethod ) - pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD ); - + { + if ( aDocument.isInVBAMode() ) + return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE; + else + pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD ); + } if ( pMethod ) { pMethod->SetDebugFlags( aStatus.nBasicFlags ); @@ -374,7 +404,7 @@ BOOL ModulWindow::CompileBasic() CheckCompileBasic(); BOOL bIsCompiled = FALSE; - if ( xModule.Is() ) + if ( XModule().Is() ) bIsCompiled = xModule->IsCompiled(); return bIsCompiled; @@ -551,11 +581,11 @@ BOOL ModulWindow::ImportDialog() BOOL ModulWindow::ToggleBreakPoint( ULONG nLine ) { - DBG_ASSERT( xModule.Is(), "Kein Modul!" ); + DBG_ASSERT( XModule().Is(), "Kein Modul!" ); BOOL bNewBreakPoint = FALSE; - if ( xModule.Is() ) + if ( XModule().Is() ) { CheckCompileBasic(); if ( aStatus.bError ) @@ -597,9 +627,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine ) void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk ) { - DBG_ASSERT( xModule.Is(), "Kein Modul!" ); + DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - if ( xModule.Is() ) + if ( XModule().Is() ) { CheckCompileBasic(); @@ -823,9 +853,9 @@ void ModulWindow::BasicRemoveWatch() void ModulWindow::EditMacro( const String& rMacroName ) { DBG_CHKTHIS( ModulWindow, 0 ); - DBG_ASSERT( xModule.Is(), "Kein Modul!" ); + DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - if ( xModule.Is() ) + if ( XModule().Is() ) { CheckCompileBasic(); @@ -895,12 +925,12 @@ BOOL __EXPORT ModulWindow::AllowUndo() void __EXPORT ModulWindow::UpdateData() { DBG_CHKTHIS( ModulWindow, 0 ); - DBG_ASSERT( xModule.Is(), "Kein Modul!" ); + DBG_ASSERT( XModule().Is(), "Kein Modul!" ); // UpdateData wird gerufen, wenn sich der Source von aussen // geaendert hat. // => Keine Unterbrechungen erwuenscht! - if ( xModule.Is() ) + if ( XModule().Is() ) { SetModule( xModule->GetSource32() ); @@ -1193,19 +1223,6 @@ void __EXPORT ModulWindow::DoScroll( ScrollBar* pCurScrollBar ) } -BOOL ModulWindow::RenameModule( const String& rNewName ) -{ - if ( !BasicIDE::RenameModule( this, GetDocument(), GetLibName(), GetName(), rNewName ) ) - return FALSE; - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - - return TRUE; -} - - BOOL __EXPORT ModulWindow::IsModified() { return GetEditEngine() ? GetEditEngine()->IsModified() : FALSE; @@ -1221,7 +1238,7 @@ void __EXPORT ModulWindow::GoOnTop() String ModulWindow::GetSbModuleName() { String aModuleName; - if ( xModule.Is() ) + if ( XModule().Is() ) aModuleName = xModule->GetName(); return aModuleName; } @@ -1343,7 +1360,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions() void __EXPORT ModulWindow::BasicStarted() { - if ( xModule.Is() ) + if ( XModule().Is() ) { aStatus.bIsRunning = TRUE; BreakPointList& rList = GetBreakPoints(); @@ -1372,7 +1389,39 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor() ScriptDocument aDocument( GetDocument() ); String aLibName( GetLibName() ); LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE ); + String aModName( GetName() ); + String aLibSubName; + if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() ) + { + switch( xModule->GetModuleType() ) + { + case script::ModuleType::DOCUMENT: + { + aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ); + uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); + if( xLib.is() ) + { + String sObjName; + ModuleInfoHelper::getObjectName( xLib, aModName, sObjName ); + if( sObjName.Len() ) + { + aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); + } + } + break; + } + case script::ModuleType::FORM: + aLibSubName = String( IDEResId( RID_STR_USERFORMS ) ); + break; + case script::ModuleType::NORMAL: + aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) ); + break; + case script::ModuleType::CLASS: + aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) ); + break; + } + } + return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE ); } void ModulWindow::SetReadOnly( BOOL b ) diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 6d35f0a027a8..280bb6ee3ab6 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -357,6 +357,7 @@ private: void AssertValidEditEngine(); sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 ); + SbModuleRef XModule(); protected: virtual void Resize(); virtual void GetFocus(); @@ -389,7 +390,7 @@ public: virtual void SetReadOnly( BOOL bReadOnly ); virtual BOOL IsReadOnly(); - StarBASIC* GetBasic() { return xBasic; } + StarBASIC* GetBasic() { XModule(); return xBasic; } SbModule* GetSbModule() { return xModule; } void SetSbModule( SbModule* pModule ) { xModule = pModule; } @@ -417,7 +418,6 @@ public: // void InsertFromObjectCatalog( ObjectCatalog* pObjDlg ); BOOL ToggleBreakPoint( ULONG nLine ); - BOOL RenameModule( const String& rNewName ); BasicStatus& GetBasicStatus() { return aStatus; } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index afbe3daf5be1..f4a3c1d48fc7 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1297,8 +1297,9 @@ BasicEntryDescriptor DialogWindow::CreateEntryDescriptor() { ScriptDocument aDocument( GetDocument() ); String aLibName( GetLibName() ); + String aLibSubName; LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_DIALOG ); + return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG ); } void DialogWindow::SetReadOnly( BOOL b ) diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 4432de9aa282..351186325b09 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -109,7 +109,6 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) { if ( aDocument.removeModule( aLibName, aName ) ) { - RemoveWindow( pCurWin, TRUE ); BasicIDE::MarkDocumentModified( aDocument ); } } @@ -430,11 +429,31 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) { String aNewName( rModName.GetValue() ); String aOldName( pWin->GetName() ); - if ( aNewName != aOldName ) { - if ( ( pWin->IsA( TYPE( ModulWindow ) ) && ((ModulWindow*)pWin)->RenameModule( aNewName ) ) - || ( pWin->IsA( TYPE( DialogWindow ) ) && ((DialogWindow*)pWin)->RenameDialog( aNewName ) ) ) + bool bRenameOk = false; + if ( pWin->IsA( TYPE( ModulWindow ) ) ) + { + ModulWindow* pModWin = (ModulWindow*)pWin; + String aLibName = ( pModWin->GetLibName() ); + ScriptDocument aDocument( pWin->GetDocument() ); + + if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) + { + bRenameOk = true; + // Because we listen for container events for script + // modules, rename will delete the 'old' window + // pWin has been invalidated, restore now + pWin = FindBasWin( aDocument, aLibName, aNewName, TRUE ); + } + + } + else if ( pWin->IsA( TYPE( DialogWindow ) ) ) + { + DialogWindow* pDlgWin = (DialogWindow*)pWin; + bRenameOk = pDlgWin->RenameDialog( aNewName ); + } + if ( bRenameOk ) { BasicIDE::MarkDocumentModified( pWin->GetDocument() ); } diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 20de8e9aafba..bef969db9266 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -51,6 +51,10 @@ #include <tools/diagnose_ex.h> #include <sfx2/sfxdefs.hxx> #include <sfx2/signaturestate.hxx> +#include <com/sun/star/script/XVBAModuleInfo.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -235,7 +239,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const if ( !aLibName.Len() ) aLibName = String::CreateFromAscii( "Standard" ); - rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); + uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); if ( !aModName.Len() ) aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); @@ -254,9 +258,15 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const if ( bSuccess ) { - // new module window - pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule ); - nKey = InsertWindowInTable( pWin ); + pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE ); + if( !pWin ) + { + // new module window + pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule ); + nKey = InsertWindowInTable( pWin ); + } + else // we've gotten called recursively ( via listener from createModule above ), get outta here + return pWin; } } else @@ -271,6 +281,17 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const } DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); } + if( nKey && xLib.is() && rDocument.isInVBAMode() ) + { + // display a nice friendly name in the ObjectModule tab, + // combining the objectname and module name, e.g. Sheet1 ( Financials ) + String sObjName; + ModuleInfoHelper::getObjectName( xLib, rModName, sObjName ); + if( sObjName.Len() ) + { + aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); + } + } pTabBar->InsertPage( (USHORT)nKey, aModName ); pTabBar->Sort(); pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 23978f4df10b..2f9303756e09 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -77,6 +77,9 @@ #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> #include <svx/xmlsecctrl.hxx> @@ -84,6 +87,71 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using ::rtl::OUString; +static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") ); + +typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE; + +class ContainerListenerImpl : public ContainerListenerBASE +{ + BasicIDEShell* mpShell; +public: + + ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {} + + ~ContainerListenerImpl() + { + } + + void addContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName ) + { + try + { + uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY ); + if ( xContainer.is() ) + { + uno::Reference< container::XContainerListener > xContainerListener( this ); + xContainer->addContainerListener( xContainerListener ); + } + } + catch( uno::Exception& ) {} + } + void removeContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName ) + { + try + { + uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, FALSE ), uno::UNO_QUERY ); + if ( xContainer.is() ) + { + uno::Reference< container::XContainerListener > xContainerListener( this ); + xContainer->removeContainerListener( xContainerListener ); + } + } + catch( uno::Exception& ) {} + } + + // XEventListener + virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {} + + // XContainerListener + virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException ) + { + rtl::OUString sModuleName; + if( mpShell && ( Event.Accessor >>= sModuleName ) ) + mpShell->FindBasWin( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, TRUE, FALSE ); + } + virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { } + virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException ) + { + rtl::OUString sModuleName; + if( mpShell && ( Event.Accessor >>= sModuleName ) ) + { + IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE ); + if( pWin ) + mpShell->RemoveWindow( pWin, TRUE, TRUE ); + } + } + +}; TYPEINIT1( BasicIDEShell, SfxViewShell ); @@ -121,6 +189,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell m_bAppBasicModified( FALSE ), m_aNotifier( *this ) { + m_xLibListener = new ContainerListenerImpl( this ); Init(); GnBasicIDEShellCount++; } @@ -212,6 +281,12 @@ __EXPORT BasicIDEShell::~BasicIDEShell() delete pTabBar; delete pObjectCatalog; DestroyModulWindowLayout(); + + ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() ); + // Destroy all ContainerListeners for Basic Container. + if ( pListener ) + pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); + // MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war. // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); @@ -828,9 +903,22 @@ void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, BOOL bDestroy, BOOL b { pWindow_->AddStatus( BASWIN_TOBEKILLED ); pWindow_->Hide(); - StarBASIC::Stop(); - // Es kommt kein Notify... - pWindow_->BasicStopped(); + // In normal mode stop basic in windows to be deleted + // In VBA stop basic only if the running script is trying to delete + // its parent module + bool bStop = true; + if ( pWindow_->GetDocument().isInVBAMode() ) + { + SbModule* pMod = StarBASIC::GetActiveModule(); + if ( !pMod || ( pMod && ( pMod->GetName() != pWindow_->GetName() ) ) ) + bStop = false; + } + if ( bStop ) + { + StarBASIC::Stop(); + // Es kommt kein Notify... + pWindow_->BasicStopped(); + } aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen } } @@ -918,8 +1006,17 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, { if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) ) { + ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() ); + + if ( pListener ) + pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); + m_aCurDocument = rDocument; + + pListener->addContainerListener( m_aCurDocument, aLibName ); + m_aCurLibName = aLibName; + if ( bUpdateWindows ) UpdateWindows(); diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src index 949732389709..e114c04bc898 100644 --- a/basctl/source/basicide/basidesh.src +++ b/basctl/source/basicide/basidesh.src @@ -638,6 +638,22 @@ String RID_STR_TRANSLATION_DEFAULT { Text [ en-US ] = "[Default Language]" ; }; +String RID_STR_DOCUMENT_OBJECTS +{ + Text [ en-US ] = "Document Objects" ; +}; +String RID_STR_USERFORMS +{ + Text [ en-US ] = "Forms" ; +}; +String RID_STR_NORMAL_MODULES +{ + Text [ en-US ] = "Modules" ; +}; +String RID_STR_CLASS_MODULES +{ + Text [ en-US ] = "Class Modules" ; +}; String RID_STR_DLGIMP_CLASH_RENAME diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index d2672f39928f..3604866b4202 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -191,7 +191,7 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); if ( pIDEShell ) { - IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_MODULE, FALSE ); + IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, TRUE ); if ( pWin ) { // set new name in window diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index a37eb752e2ea..0709fe38cbe2 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -50,10 +50,51 @@ #include <com/sun/star/frame/XModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> +#include <map> +#include <com/sun/star/script/ModuleType.hpp> +#include <com/sun/star/script/XVBAModuleInfo.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/script/XVBAModuleInfo.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star; +void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName ) +{ + try + { + uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); + if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) + { + script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); + uno::Any aObject( aModuleInfo.ModuleObject ); + uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY ); + if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) ) + { + uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY ); + if( xNamed.is() ) + rObjName = xNamed->getName(); + } + } + } + catch( uno::Exception& ) + { + } +} + +sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName ) +{ + sal_Int32 nType = com::sun::star::script::ModuleType::NORMAL; + uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); + if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) + { + script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); + nType = aModuleInfo.ModuleType; + } + return nType; +} BasicEntry::~BasicEntry() { @@ -88,20 +129,22 @@ BasicEntryDescriptor::BasicEntryDescriptor() { } -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType ) +BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType ) :m_aDocument( rDocument ) ,m_eLocation( eLocation ) ,m_aLibName( rLibName ) + ,m_aLibSubName( rLibSubName ) ,m_aName( rName ) ,m_eType( eType ) { OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" ); } -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType ) +BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType ) :m_aDocument( rDocument ) ,m_eLocation( eLocation ) ,m_aLibName( rLibName ) + ,m_aLibSubName( rLibSubName ) ,m_aName( rName ) ,m_aMethodName( rMethodName ) ,m_eType( eType ) @@ -117,6 +160,7 @@ BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ) :m_aDocument( rDesc.m_aDocument ) ,m_eLocation( rDesc.m_eLocation ) ,m_aLibName( rDesc.m_aLibName ) + ,m_aLibSubName( rDesc.m_aLibSubName ) ,m_aName( rDesc.m_aName ) ,m_aMethodName( rDesc.m_aMethodName ) ,m_eType( rDesc.m_eType ) @@ -128,6 +172,7 @@ BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescripto m_aDocument = rDesc.m_aDocument; m_eLocation = rDesc.m_eLocation; m_aLibName = rDesc.m_aLibName; + m_aLibSubName = rDesc.m_aLibSubName; m_aName = rDesc.m_aName; m_aMethodName = rDesc.m_aMethodName; m_eType = rDesc.m_eType; @@ -140,6 +185,7 @@ bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const return m_aDocument == rDesc.m_aDocument && m_eLocation == rDesc.m_eLocation && m_aLibName == rDesc.m_aLibName && + m_aLibSubName == rDesc.m_aLibSubName && m_aName == rDesc.m_aName && m_aMethodName == rDesc.m_aMethodName && m_eType == rDesc.m_eType; @@ -284,41 +330,46 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const { try { - // get a sorted list of module names - Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) + if( rDocument.isInVBAMode() ) + ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName ); + else { - String aModName = pModNames[ i ]; - SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE ); - if ( !pModuleEntry ) - pModuleEntry = AddEntry( - aModName, - Image( IDEResId( RID_IMG_MODULE ) ), - Image( IDEResId( RID_IMG_MODULE_HC ) ), - pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + // get a sorted list of module names + Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); + sal_Int32 nModCount = aModNames.getLength(); + const ::rtl::OUString* pModNames = aModNames.getConstArray(); - // methods - if ( nMode & BROWSEMODE_SUBS ) + for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + String aModName = pModNames[ i ]; + SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE ); + if ( !pModuleEntry ) + pModuleEntry = AddEntry( + aModName, + Image( IDEResId( RID_IMG_MODULE ) ), + Image( IDEResId( RID_IMG_MODULE_HC ) ), + pLibRootEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + + // methods + if ( nMode & BROWSEMODE_SUBS ) { - String aName = pNames[ j ]; - SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); - if ( !pEntry ) - pEntry = AddEntry( - aName, - Image( IDEResId( RID_IMG_MACRO ) ), - Image( IDEResId( RID_IMG_MACRO_HC ) ), - pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); + sal_Int32 nCount = aNames.getLength(); + const ::rtl::OUString* pNames = aNames.getConstArray(); + + for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + { + String aName = pNames[ j ]; + SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); + if ( !pEntry ) + pEntry = AddEntry( + aName, + Image( IDEResId( RID_IMG_MACRO ) ), + Image( IDEResId( RID_IMG_MACRO_HC ) ), + pModuleEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + } } } } @@ -365,6 +416,140 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const } } +void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ) +{ + + ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries; + aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ); + aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) ); + aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) ); + aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) ); + + ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter; + for( iter = aEntries.begin(); iter != aEntries.end(); ++iter ) + { + BasicEntryType eType = iter->first; + ::rtl::OUString aEntryName = iter->second; + SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType ); + if( pLibSubRootEntry ) + { + SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) ); + if ( IsExpanded( pLibSubRootEntry ) ) + ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName ); + } + else + { + pLibSubRootEntry = AddEntry( + aEntryName, + Image( IDEResId( RID_IMG_MODLIB ) ), + Image( IDEResId( RID_IMG_MODLIB_HC ) ), + pLibRootEntry, true, + std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) ); + } + } +} + +void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName ) +{ + uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName ); + if( !xLib.is() ) + return; + + try + { + // get a sorted list of module names + Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); + sal_Int32 nModCount = aModNames.getLength(); + const ::rtl::OUString* pModNames = aModNames.getConstArray(); + + BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) ); + BasicEntryType eCurrentType( aDesc.GetType() ); + + for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) + { + String aModName = pModNames[ i ]; + BasicEntryType eType = OBJ_TYPE_UNKNOWN; + switch( ModuleInfoHelper::getModuleType( xLib, aModName ) ) + { + case script::ModuleType::DOCUMENT: + eType = OBJ_TYPE_DOCUMENT_OBJECTS; + break; + case script::ModuleType::FORM: + eType = OBJ_TYPE_USERFORMS; + break; + case script::ModuleType::NORMAL: + eType = OBJ_TYPE_NORMAL_MODULES; + break; + case script::ModuleType::CLASS: + eType = OBJ_TYPE_CLASS_MODULES; + break; + } + if( eType != eCurrentType ) + continue; + + // display a nice friendly name in the ObjectModule tab, + // combining the objectname and module name, e.g. Sheet1 ( Financials ) + String aEntryName( aModName ); + if( eType == OBJ_TYPE_DOCUMENT_OBJECTS ) + { + String sObjName; + ModuleInfoHelper::getObjectName( xLib, aModName, sObjName ); + if( sObjName.Len() ) + { + aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); + } + } + SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE ); + if ( !pModuleEntry ) + pModuleEntry = AddEntry( + aEntryName, + Image( IDEResId( RID_IMG_MODULE ) ), + Image( IDEResId( RID_IMG_MODULE_HC ) ), + pLibSubRootEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + + // methods + if ( nMode & BROWSEMODE_SUBS ) + { + Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); + sal_Int32 nCount = aNames.getLength(); + const ::rtl::OUString* pNames = aNames.getConstArray(); + + for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + { + String aName = pNames[ j ]; + SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); + if ( !pEntry ) + pEntry = AddEntry( + aName, + Image( IDEResId( RID_IMG_MACRO ) ), + Image( IDEResId( RID_IMG_MACRO_HC ) ), + pModuleEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + } + } + } + } + catch ( const container::NoSuchElementException& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText ) +{ + ULONG nRootPos = 0; + SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos ); + while ( pEntry ) + { + if ( GetEntryText( pEntry ) == rText ) + return pEntry; + + pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos ); + } + return 0; +} + void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) { UpdateEntries(); @@ -477,10 +662,11 @@ long BasicTreeListBox::ExpandingHdl() if ( aDocument.isAlive() ) { String aLibName( aDesc.GetLibName() ); + String aLibSubName( aDesc.GetLibSubName() ); String aName( aDesc.GetName() ); String aMethodName( aDesc.GetMethodName() ); - if ( aLibName.Len() && !aName.Len() && !aMethodName.Len() ) + if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() ) { // check password, if library is password protected and not verified ::rtl::OUString aOULibName( aLibName ); @@ -633,7 +819,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) aDesc = BasicEntryDescriptor( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ), - String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN ); + String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN ); } ScriptDocument aDocument( aDesc.GetDocument() ); OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" ); @@ -650,14 +836,24 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) if ( pLibEntry ) { pCurEntry = pLibEntry; + String aLibSubName( aDesc.GetLibSubName() ); + if( aLibSubName.Len() ) + { + Expand( pLibEntry ); + SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName ); + if( pLibSubEntry ) + { + pCurEntry = pLibSubEntry; + } + } String aName( aDesc.GetName() ); if ( aName.Len() ) { - Expand( pLibEntry ); + Expand( pCurEntry ); BasicEntryType eType = OBJ_TYPE_MODULE; if ( aDesc.GetType() == OBJ_TYPE_DIALOG ) eType = OBJ_TYPE_DIALOG; - SvLBoxEntry* pEntry = FindEntry( pLibEntry, aName, eType ); + SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType ); if ( pEntry ) { pCurEntry = pEntry; diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 401282f7e1bf..4b4d42f477d0 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -39,7 +39,7 @@ #include <sbxitem.hxx> #include "basobj.hxx" -enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD }; +enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES }; #define BROWSEMODE_MODULES 0x01 #define BROWSEMODE_SUBS 0x02 @@ -98,14 +98,15 @@ class BasicEntryDescriptor ScriptDocument m_aDocument; LibraryLocation m_eLocation; String m_aLibName; + String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules String m_aName; String m_aMethodName; BasicEntryType m_eType; public: BasicEntryDescriptor(); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType ); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType ); + BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType ); + BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType ); virtual ~BasicEntryDescriptor(); BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ); @@ -122,6 +123,9 @@ public: const String& GetLibName() const { return m_aLibName; } void SetLibName( const String& aLibName ) { m_aLibName = aLibName; } + const String& GetLibSubName() const { return m_aLibSubName; } + void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; } + const String& GetName() const { return m_aName; } void SetName( const String& aName ) { m_aName = aName; } @@ -161,6 +165,9 @@ protected: void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation ); void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ); + void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ); + void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName ); + SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText ); // DocumentEventListener virtual void onDocumentCreated( const ScriptDocument& _rDocument ); diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index a0320d89e88a..de9eff56ca24 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -131,6 +131,14 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry ) } } } + else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS + || eType == OBJ_TYPE_USERFORMS + || eType == OBJ_TYPE_NORMAL_MODULES + || eType == OBJ_TYPE_CLASS_MODULES ) + { + String aLibName( aDesc.GetLibName() ); + ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName ); + } else { DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" ); } @@ -201,6 +209,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) } SbxVariable* pVar = 0; + bool bDocumentObjects = false; if ( aEntries.Count() ) { for ( USHORT n = 0; n < aEntries.Count(); n++ ) @@ -223,6 +232,12 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) case OBJ_TYPE_MODULE: { DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" ); + // extract the module name from the string like "Sheet1 (Example1)" + if( bDocumentObjects ) + { + sal_uInt16 nIndex = 0; + aName = aName.GetToken( 0, ' ', nIndex ); + } pVar = ((StarBASIC*)pVar)->FindModule( aName ); } break; @@ -237,6 +252,15 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) // sbx dialogs removed } break; + case OBJ_TYPE_DOCUMENT_OBJECTS: + bDocumentObjects = true; + case OBJ_TYPE_USERFORMS: + case OBJ_TYPE_NORMAL_MODULES: + case OBJ_TYPE_CLASS_MODULES: + { + // skip, to find the child entry. + continue; + } default: { DBG_ERROR( "FindVariable: Unbekannter Typ!" ); @@ -257,12 +281,13 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN; String aLibName; + String aLibSubName; String aName; String aMethodName; BasicEntryType eType = OBJ_TYPE_UNKNOWN; if ( !pEntry ) - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType ); + return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); EntryArray aEntries; @@ -329,6 +354,15 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) eType = pBE->GetType(); } break; + case OBJ_TYPE_DOCUMENT_OBJECTS: + case OBJ_TYPE_USERFORMS: + case OBJ_TYPE_NORMAL_MODULES: + case OBJ_TYPE_CLASS_MODULES: + { + aLibSubName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; default: { DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" ); @@ -342,7 +376,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) } } - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType ); + return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); } USHORT BasicTreeListBox::ConvertType( BasicEntryType eType ) @@ -424,6 +458,14 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName ); } break; + case OBJ_TYPE_DOCUMENT_OBJECTS: + case OBJ_TYPE_USERFORMS: + case OBJ_TYPE_NORMAL_MODULES: + case OBJ_TYPE_CLASS_MODULES: + { + bIsValid = true; + } + break; default: ; } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index af42503a5dae..150e10a5a76f 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #endif #include <com/sun/star/script/XLibraryContainerPassword.hpp> +#include <com/sun/star/script/ModuleType.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star; @@ -584,8 +585,32 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt ) aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE ); aPopup.RemoveDisabledEntries(); } + if ( aDocument.isInVBAMode() ) + { + // disable to delete or remove object modules in IDE + BasicManager* pBasMgr = aDocument.getBasicManager(); + if ( pBasMgr ) + { + StarBASIC* pBasic = pBasMgr->GetLib( aOULibName ); + if( pBasic ) + { + IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); + IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() ); + if( pWin && pWin->ISA( ModulWindow ) ) + { + SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() ); + if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) ) + { + aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE ); + aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE ); + } + } + } + } + } } + SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; if ( pDispatcher ) diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index f3e41e60d34b..41a5fa488950 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -382,7 +382,15 @@ SbMethod* MacroChooser::CreateMacro() SbModule* pModule = 0; String aModName( aDesc.GetName() ); if ( aModName.Len() ) + { + // extract the module name from the string like "Sheet1 (Example1)" + if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) + { + sal_uInt16 nIndex = 0; + aModName = aModName.GetToken( 0, ' ', nIndex ); + } pModule = pBasic->FindModule( aModName ); + } else if ( pBasic->GetModules()->Count() ) pModule = (SbModule*)pBasic->GetModules()->Get( 0 ); @@ -710,6 +718,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) BasicManager* pBasMgr = aDocument.getBasicManager(); String aLib( aDesc.GetLibName() ); String aMod( aDesc.GetName() ); + // extract the module name from the string like "Sheet1 (Example1)" + if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) + { + sal_uInt16 nIndex = 0; + aMod = aMod.GetToken( 0, ' ', nIndex ); + } String aSub( aDesc.GetMethodName() ); SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() ); if ( pButton == &aEditButton ) diff --git a/basctl/source/basicide/makefile.mk b/basctl/source/basicide/makefile.mk index 8854e6bfc927..452d698d0428 100644 --- a/basctl/source/basicide/makefile.mk +++ b/basctl/source/basicide/makefile.mk @@ -49,6 +49,7 @@ CDEFS+=-DBASICDEBUG EXCEPTIONSFILES=$(SLO)$/basicrenderable.obj \ $(SLO)$/scriptdocument.obj \ + $(SLO)$/basicbox.obj \ $(SLO)$/basidesh.obj \ $(SLO)$/basides1.obj \ $(SLO)$/basides2.obj \ @@ -75,7 +76,6 @@ EXCEPTIONSFILES=$(SLO)$/basicrenderable.obj \ $(SLO)$/documentenumeration.obj SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/basicbox.obj \ $(SLO)$/baside2b.obj \ $(SLO)$/brkdlg.obj \ $(SLO)$/objdlg.obj \ diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 478d56546f41..0f66a6ebe120 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -84,7 +84,7 @@ BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& if ( pEntry ) { USHORT nDepth = GetModel()->GetDepth( pEntry ); - if ( nDepth == 2 ) + if ( nDepth >= 2 ) { BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); ScriptDocument aDocument( aDesc.GetDocument() ); @@ -162,7 +162,7 @@ DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContaine if ( pEntry ) { USHORT nDepth = GetModel()->GetDepth( pEntry ); - if ( nDepth == 2 ) + if ( nDepth >= 2 ) { nMode_ = SV_DRAGDROP_CTRL_COPY; BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); @@ -210,7 +210,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) // don't drop on a library, which is not loaded, readonly or password protected // or which already has a module/dialog with this name - if ( bValid && ( nDepth == 1 || nDepth == 2 ) ) + if ( bValid && ( nDepth > 0 ) ) { // get source module/dialog name BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) ); @@ -348,7 +348,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, Sv rpNewParent = pTarget; rNewChildPos = 0; } - else if ( nDepth == 2 ) + else if ( nDepth >= 2 ) { // Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen... rpNewParent = GetParent( pTarget ); @@ -623,20 +623,29 @@ void ObjectPage::CheckButtons() { // enable/disable edit button SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); + BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + ScriptDocument aDocument( aDesc.GetDocument() ); + ::rtl::OUString aOULibName( aDesc.GetLibName() ); + String aLibSubName( aDesc.GetLibSubName() ); + sal_Bool bVBAEnabled = aDocument.isInVBAMode(); + USHORT nMode = aBasicBox.GetMode(); + USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0; - if ( nDepth == 2 ) + if ( nDepth >= 2 ) + { + if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) ) + aEditButton.Disable(); + else aEditButton.Enable(); + } else aEditButton.Disable(); // enable/disable new module/dialog buttons - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); LibraryLocation eLocation( aDesc.GetLocation() ); BOOL bReadOnly = FALSE; - if ( nDepth == 1 || nDepth == 2 ) + if ( nDepth > 0 ) { - ScriptDocument aDocument( aDesc.GetDocument() ); - ::rtl::OUString aOULibName( aDesc.GetLibName() ); Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || @@ -657,8 +666,13 @@ void ObjectPage::CheckButtons() } // enable/disable delete button - if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE ) + if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE ) + { + if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) ) + aDelButton.Disable(); + else aDelButton.Enable(); + } else aDelButton.Disable(); } @@ -685,13 +699,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton ) SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); DBG_ASSERT( pCurEntry, "Entry?!" ); - if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 2 ) + if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 ) { BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); if ( pDispatcher ) { + String aModName( aDesc.GetName() ); + // extract the module name from the string like "Sheet1 (Example1)" + if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) + { + sal_uInt16 nIndex = 0; + aModName = aModName.GetToken( 0, ' ', nIndex ); + } SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), - aDesc.GetName(), aBasicBox.ConvertType( aDesc.GetType() ) ); + aModName, aBasicBox.ConvertType( aDesc.GetType() ) ); pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); } } @@ -973,14 +994,14 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, try { ::rtl::OUString sModuleCode; + // the module has existed + if( rDocument.hasModule( aLibName, aModName ) ) + return NULL; rDocument.createModule( aLibName, aModName, bMain, sModuleCode ); BasicManager* pBasMgr = rDocument.getBasicManager(); - if ( pBasMgr ) - { - StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); + StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0; if ( pBasic ) pModule = pBasic->FindModule( aModName ); - } SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE ); BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; @@ -1002,14 +1023,27 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, { if ( !rBasicBox.IsExpanded( pLibEntry ) ) rBasicBox.Expand( pLibEntry ); - SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE ); + SvLBoxEntry* pSubRootEntry = pLibEntry; + if( pBasic && rDocument.isInVBAMode() ) + { + // add the new module in the "Modules" entry + SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES ); + if( pLibSubEntry ) + { + if( !rBasicBox.IsExpanded( pLibSubEntry ) ) + rBasicBox.Expand( pLibSubEntry ); + pSubRootEntry = pLibSubEntry; + } + } + + SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE ); if ( !pEntry ) { pEntry = rBasicBox.AddEntry( aModName, Image( IDEResId( RID_IMG_MODULE ) ), Image( IDEResId( RID_IMG_MODULE_HC ) ), - pLibEntry, false, + pSubRootEntry, false, std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" ); } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index dd10a00e2bde..1f1d8ab6145b 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -53,6 +53,8 @@ #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/script/XVBAModuleInfo.hpp> +#include <com/sun/star/script/XVBACompat.hpp> /** === end UNO includes === **/ #include <sfx2/objsh.hxx> @@ -139,6 +141,9 @@ namespace basctl using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::document::XEventBroadcaster; using ::com::sun::star::document::XEmbeddedScripts; + using ::com::sun::star::script::ModuleInfo; + using ::com::sun::star::script::XVBAModuleInfo; + using ::com::sun::star::script::XVBACompat; /** === end UNO using === **/ namespace MacroExecMode = ::com::sun::star::document::MacroExecMode; namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; @@ -272,6 +277,7 @@ namespace basctl // versions with the same signature/semantics as in ScriptDocument itself bool isReadOnly() const; + bool isInVBAMode() const; BasicManager* getBasicManager() const; Reference< XModel > @@ -444,6 +450,20 @@ namespace basctl return bIsReadOnly; } + bool ScriptDocument_Impl::isInVBAMode() const + { + bool bResult = false; +#ifdef FUTURE_VBA_CWS + if ( !isApplication() ) + { + Reference< XVBACompat > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + if ( xVBACompat.is() ) + bResult = xVBACompat->getVBACompatModeOn(); + } +#endif + return bResult; + } + //-------------------------------------------------------------------- BasicManager* ScriptDocument_Impl::getBasicManager() const { @@ -671,6 +691,16 @@ namespace basctl } // insert element by new name in container + else if ( _eType == E_SCRIPTS ) + { + Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY ); + if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) ) + { + ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName ); + xVBAModuleInfo->removeModuleInfo( _rOldName ); + xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo ); + } + } xLib->insertByName( _rNewName, aElement ); return true; } @@ -735,7 +765,6 @@ namespace basctl Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW ); if ( !xLib->hasByName( _rModName ) ) return false; - xLib->replaceByName( _rModName, makeAny( _rModuleCode ) ); return true; } @@ -987,8 +1016,11 @@ namespace basctl ::rtl::OUString aSearchURL1( RTL_CONSTASCII_USTRINGPARAM( "share/basic" ) ); ::rtl::OUString aSearchURL2( RTL_CONSTASCII_USTRINGPARAM( "share/uno_packages" ) ); - if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 ) - bIsShared = true; + ::rtl::OUString aSearchURL3( RTL_CONSTASCII_USTRINGPARAM( "share/extensions" ) ); + if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || + aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 || + aCanonicalFileURL.indexOf( aSearchURL3 ) != -1 ) + bIsShared = true; } } catch( const Exception& ) @@ -1351,6 +1383,11 @@ namespace basctl return m_pImpl->isApplication(); } + bool ScriptDocument::isInVBAMode() const + { + return m_pImpl->isInVBAMode(); + } + //-------------------------------------------------------------------- BasicManager* ScriptDocument::getBasicManager() const { diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index cf21d3488dd3..07bc2dfa3149 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -46,6 +46,7 @@ #include <com/sun/star/io/XInputStreamProvider.hpp> #endif +#include <com/sun/star/container/XContainerListener.hpp> //---------------------------------------------------------------------------- @@ -105,6 +106,8 @@ friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const Strin BOOL m_bAppBasicModified; ::basctl::DocumentEventNotifier m_aNotifier; +friend class ContainerListenerImpl; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener; #if _SOLAR__PRIVATE void Init(); diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index c9981001e456..bc588fccaf14 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -328,5 +328,13 @@ BOOL QueryDelModule( const String& rName, Window* pParent = 0 ); BOOL QueryDelLib( const String& rName, BOOL bRef = FALSE, Window* pParent = 0 ); BOOL QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, BOOL bRepeat = FALSE, BOOL bNewTitle = FALSE ); - +class ModuleInfoHelper +{ +ModuleInfoHelper(); +ModuleInfoHelper(const ModuleInfoHelper&); +ModuleInfoHelper& operator = (const ModuleInfoHelper&); +public: + static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName, String& rObjName ); + static sal_Int32 getModuleType( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName ); +}; #endif // _BASTYPES_HXX diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx index 34d1a72963ce..9439c05f7249 100644 --- a/basctl/source/inc/scriptdocument.hxx +++ b/basctl/source/inc/scriptdocument.hxx @@ -212,6 +212,7 @@ namespace basctl */ bool isAlive() const; + bool isInVBAMode() const; /// returns the BasicManager associated with this instance BasicManager* getBasicManager() const; diff --git a/basctl/uiconfig/basicide/accelerator/en-GB/default.xml b/basctl/uiconfig/basicide/accelerator/en-GB/default.xml deleted file mode 100644 index 94d5e84a8413..000000000000 --- a/basctl/uiconfig/basicide/accelerator/en-GB/default.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE accel:acceleratorlist PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "accelerator.dtd"> -<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> - <accel:item accel:code="KEY_F5" xlink:href=".uno:RunBasic"/> - <accel:item accel:code="KEY_F5" accel:shift="true" xlink:href=".uno:BasicStop"/> - <accel:item accel:code="KEY_F7" xlink:href=".uno:AddWatch"/> - <accel:item accel:code="KEY_F8" xlink:href=".uno:BasicStepInto"/> - <accel:item accel:code="KEY_F8" accel:shift="true" xlink:href=".uno:BasicStepOver"/> - <accel:item accel:code="KEY_F9" xlink:href=".uno:ToggleBreakPoint"/> - <accel:item accel:code="KEY_F9" accel:shift="true" xlink:href=".uno:ToggleBreakPointEnabled"/> -</accel:acceleratorlist> diff --git a/basctl/uiconfig/basicide/accelerator/en-US/default.xml b/basctl/uiconfig/basicide/accelerator/en-US/default.xml deleted file mode 100644 index 94d5e84a8413..000000000000 --- a/basctl/uiconfig/basicide/accelerator/en-US/default.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE accel:acceleratorlist PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "accelerator.dtd"> -<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> - <accel:item accel:code="KEY_F5" xlink:href=".uno:RunBasic"/> - <accel:item accel:code="KEY_F5" accel:shift="true" xlink:href=".uno:BasicStop"/> - <accel:item accel:code="KEY_F7" xlink:href=".uno:AddWatch"/> - <accel:item accel:code="KEY_F8" xlink:href=".uno:BasicStepInto"/> - <accel:item accel:code="KEY_F8" accel:shift="true" xlink:href=".uno:BasicStepOver"/> - <accel:item accel:code="KEY_F9" xlink:href=".uno:ToggleBreakPoint"/> - <accel:item accel:code="KEY_F9" accel:shift="true" xlink:href=".uno:ToggleBreakPointEnabled"/> -</accel:acceleratorlist> diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index e7d70dd9d396..9b5453553ef3 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -296,6 +296,11 @@ void _SvxMacroTabPage::InitResources() aDisplayNames.push_back( EventDisplayName( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED ) ); aDisplayNames.push_back( EventDisplayName( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED ) ); // aDisplayNames.push_back( EventDisplayName( "OnLayoutFinished", RID_SVXSTR_EVENT_LAYOUT_FINISHED ) ); + aDisplayNames.push_back( EventDisplayName( "OnSelect", RID_SVXSTR_EVENT_SELECTIONCHANGED ) ); + aDisplayNames.push_back( EventDisplayName( "OnDoubleClick", RID_SVXSTR_EVENT_DOUBLECLICK ) ); + aDisplayNames.push_back( EventDisplayName( "OnRightClick", RID_SVXSTR_EVENT_RIGHTCLICK ) ); + aDisplayNames.push_back( EventDisplayName( "OnCalculate", RID_SVXSTR_EVENT_CALCULATE ) ); + aDisplayNames.push_back( EventDisplayName( "OnChange", RID_SVXSTR_EVENT_CONTENTCHANGED ) ); // the event name to UI string mappings for forms & dialogs // diff --git a/cui/source/customize/macropg.src b/cui/source/customize/macropg.src index 26aaea2c34db..10d9149233e0 100644 --- a/cui/source/customize/macropg.src +++ b/cui/source/customize/macropg.src @@ -457,3 +457,29 @@ String RID_SVXSTR_EVENT_LAYOUT_FINISHED { Text [ en-US ] = "Document layout finished" ; }; + +String RID_SVXSTR_EVENT_SELECTIONCHANGED +{ + Text [ en-US ] = "Selection changed" ; +}; + +String RID_SVXSTR_EVENT_DOUBLECLICK +{ + Text [ en-US ] = "Double click" ; +}; + +String RID_SVXSTR_EVENT_RIGHTCLICK +{ + Text [ en-US ] = "Right click" ; +}; + +String RID_SVXSTR_EVENT_CALCULATE +{ + Text [ en-US ] = "Formulas calculated" ; +}; + +String RID_SVXSTR_EVENT_CONTENTCHANGED +{ + Text [ en-US ] = "Content changed" ; +}; + diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index d243ce96f27c..303b54688eea 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -389,14 +389,14 @@ void SpellDialog::UpdateBoxes_Impl() } // ----------------------------------------------------------------------- -void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence) +void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrentError ) { //initially or after the last error of a sentence MarkNextError will fail //then GetNextSentence() has to be called followed again by MarkNextError() //MarkNextError is not initally called if the UndoEdit mode is active bool bNextSentence = false; - if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) || - true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError())) + if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) || + true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false ))) { const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); if( pSpellErrorDescription ) @@ -473,7 +473,7 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG ) } else { - if( SvtLinguConfig().HasAnyVendorImages() ) + if( SvtLinguConfig().HasVendorImages( "SpellAndGrammarDialogImage" ) ) { pThis->aVendorImageFI.Show(); Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); @@ -795,14 +795,12 @@ IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG ) } else { - //in case the error has been changed manually it has to be restored + //in case the error has been changed manually it has to be restored, + // since the users choice now was to ignore the error aSentenceED.RestoreCurrentError(); - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true)); - aSentenceED.ResetModified(); // the word is being ignored - SpellContinue_Impl(); - bModified = false; + SpellContinue_Impl( false, true ); } return 1; } @@ -1074,11 +1072,8 @@ IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd) -----------------------------------------------------------------------*/ IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG ) { - //apply changes first - if there are any - if(aSentenceED.IsModified()) - { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); - } + //apply changes and ignored text parts first - if there are any + rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), false); Close(); return 0; } @@ -1158,15 +1153,17 @@ void SpellDialog::InvalidateDialog() /*-- 10.09.2003 08:35:56--------------------------------------------------- -----------------------------------------------------------------------*/ -bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence) +bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) { bool bRet = false; - if(!bUseSavedSentence && aSentenceED.IsModified()) + if(!bUseSavedSentence /*&& aSentenceED.IsModified()*/) { - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false)); + //apply changes and ignored text parts + rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck); } + aSentenceED.ResetIgnoreErrorsAt(); aSentenceED.ResetModified(); - SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence(); + SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck ); if(!bUseSavedSentence) m_aSavedSentence = aSentence; bool bHasReplaced = false; @@ -1177,8 +1174,8 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence) if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced)) { - rParent.ApplyChangedSentence(aSentence); - aSentence = rParent.GetNextWrongSentence(); + rParent.ApplyChangedSentence(aSentence, bRecheck); + aSentence = rParent.GetNextWrongSentence( bRecheck ); } else break; @@ -1642,8 +1639,10 @@ long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) /*-- 10.09.2003 13:38:14--------------------------------------------------- -----------------------------------------------------------------------*/ -bool SentenceEditWindow_Impl::MarkNextError() +bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError ) { + if (bIgnoreCurrentError) + m_aIgnoreErrorsAt.insert( m_nErrorStart ); ExtTextEngine* pTextEngine = GetTextEngine(); USHORT nTextLen = pTextEngine->GetTextLen(0); if(m_nErrorEnd >= nTextLen - 1) @@ -1981,7 +1980,8 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore aPortion1.eLanguage = eLang; aPortion1.sText = pTextEngine->GetText( TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition))); - if( bSetIgnoreFlag && m_nErrorStart == nStart ) + bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end(); + if( bSetIgnoreFlag && bIsIgnoreError /*m_nErrorStart == nStart*/ ) { aPortion1.bIgnoreThisError = true; } diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index db4a3d15f4a4..297b1ad921c4 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -107,6 +107,7 @@ SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings) mbReadOnly ( sal_False ), mbIsHTMLDoc ( sal_False ) { + SetUniqueId( HID_HYPERLINK_DIALOG ); mbGrabFocus = sal_True; // insert pages Image aImage; diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index 91136b607a22..16026aaff6d1 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -28,52 +28,51 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cui.hxx" -// include --------------------------------------------------------------- -#include <tools/shl.hxx> -#include <tools/list.hxx> -#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#include <vcl/msgbox.hxx> -#include "cuires.hrc" -#include "hyphen.hrc" -#include <editeng/svxenum.hxx> #include "hyphen.hxx" +#include "hyphen.hrc" +#include "cuires.hrc" +#include "dialmgr.hxx" + #include <editeng/splwrap.hxx> -#include <svx/dlgutil.hxx> -#include <svx/dialmgr.hxx> +#include <editeng/svxenum.hxx> #include <editeng/unolingu.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" +#include <svx/dialmgr.hxx> +#include <svx/dlgutil.hxx> +#include <tools/list.hxx> +#include <tools/shl.hxx> +#include <vcl/msgbox.hxx> -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +#include <com/sun/star/linguistic2/XPossibleHyphens.hpp> -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) +using namespace ::com::sun::star; -// define ---------------------------------------------------------------- -#define HYPHHERE '-' +#define HYPH_POS_CHAR '=' #define CONTINUE_HYPH USHRT_MAX -// Dies ist nur ein Hack, weil an dieser Stelle das extern char aus hmwrap -// nicht bekannt ist, wird demnaechst in hmwrap durch ein define ersetzt. -#define SW_SOFT_HYPHEN '=' +#define CUR_HYPH_POS_CHAR '-' + + +// class HyphenEdit_Impl ------------------------------------------------------- -// class SvxHyphenEdit --------------------------------------------------- +class HyphenEdit_Impl : public Edit +{ +public: + HyphenEdit_Impl( Window* pParent, const ResId& rResId ); + +protected: + virtual void KeyInput( const KeyEvent &rKEvt ); +}; -SvxHyphenEdit::SvxHyphenEdit( Window* pParent, const ResId& rResId ) : +HyphenEdit_Impl::HyphenEdit_Impl( Window* pParent, const ResId& rResId ) : Edit( pParent, rResId ) { } -// ----------------------------------------------------------------------- -void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) +void HyphenEdit_Impl::KeyInput( const KeyEvent& rKEvt ) { // sal_uInt16 nMod = rKEvt.GetKeyCode().GetModifier(); sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); @@ -99,123 +98,143 @@ void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) } } -// class SvxHyphenWordDialog --------------------------------------------- -SvxHyphenWordDialog::SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - Reference< XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ), - - aWordFT ( this, CUI_RES( FT_WORD ) ), - aWordEdit ( this, CUI_RES( ED_WORD ) ), - aLeftBtn ( this, CUI_RES( BTN_LEFT ) ), - aRightBtn ( this, CUI_RES( BTN_RIGHT ) ), - aOkBtn ( this, CUI_RES( BTN_HYPH_CUT ) ), - aCancelBtn ( this, CUI_RES( BTN_HYPH_CANCEL ) ), - aContBtn ( this, CUI_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( this, CUI_RES( BTN_HYPH_DELETE ) ), - aHelpBtn ( this, CUI_RES( BTN_HYPH_HELP ) ), - aLabel ( GetText() ), - pHyphWrapper ( pWrapper ), - xHyphenator ( xHyphen ), - aActWord ( rWord ), - nActLanguage ( nLang ), +// struct SvxHyphenWordDialog_Impl --------------------------------------------- + +struct SvxHyphenWordDialog_Impl +{ + SvxHyphenWordDialog * m_pDialog; +// Window * m_pParent; + + FixedText aWordFT; + HyphenEdit_Impl aWordEdit; + ImageButton aLeftBtn; + ImageButton aRightBtn; + OKButton aOkBtn; + PushButton aContBtn; + PushButton aDelBtn; + FixedLine aFLBottom; + HelpButton aHelpBtn; + PushButton aHyphAll; + CancelButton aCancelBtn; + String aLabel; + SvxSpellWrapper* pHyphWrapper; + uno::Reference< linguistic2::XHyphenator > xHyphenator; + uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; + String aEditWord; // aEditWord and aWordEdit.GetText() differ only by the character for the current selected hyphenation position + String aActWord; // actual word to be hyphenated + LanguageType nActLanguage; // and its language + sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos + sal_uInt16 nHyphPos; + sal_uInt16 nOldPos; + sal_Int32 nHyphenationPositionsOffset; + sal_Bool bBusy; + + + void EnableLRBtn_Impl(); + String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); + + void InitControls_Impl(); + void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); + sal_uInt16 GetHyphIndex_Impl(); + void SelLeft_Impl(); + void SelRight_Impl(); + + DECL_LINK( Left_Impl, Button* ); + DECL_LINK( Right_Impl, Button* ); + DECL_LINK( CutHdl_Impl, Button* ); + DECL_LINK( ContinueHdl_Impl, Button* ); + DECL_LINK( DeleteHdl_Impl, Button* ); + DECL_LINK( HyphenateAllHdl_Impl, Button* ); + DECL_LINK( CancelHdl_Impl, Button* ); + DECL_LINK( GetFocusHdl_Impl, Edit* ); + + + SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ); + ~SvxHyphenWordDialog_Impl(); +}; + + +SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( + SvxHyphenWordDialog * pDialog, + const String &rWord, + LanguageType nLang, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + m_pDialog ( pDialog ), + aWordFT ( pDialog, CUI_RES( FT_WORD ) ), + aWordEdit ( pDialog, CUI_RES( ED_WORD ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aRightBtn ( pDialog, CUI_RES( BTN_RIGHT ) ), + aOkBtn ( pDialog, CUI_RES( BTN_HYPH_CUT ) ), + aContBtn ( pDialog, CUI_RES( BTN_HYPH_CONTINUE ) ), + aDelBtn ( pDialog, CUI_RES( BTN_HYPH_DELETE ) ), + aFLBottom ( pDialog, CUI_RES( FL_BOTTOM ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_HYPH_HELP ) ), + aHyphAll ( pDialog, CUI_RES( BTN_HYPH_ALL ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_HYPH_CANCEL ) ), + aLabel ( pDialog->GetText() ), + pHyphWrapper ( NULL ), + xHyphenator ( NULL ), + xPossHyph ( NULL ), + aActWord ( ), + nActLanguage ( LANGUAGE_NONE ), + nMaxHyphenationPos ( 0 ), nHyphPos ( 0 ), nOldPos ( 0 ), + nHyphenationPositionsOffset( 0 ), bBusy ( sal_False ) { - aContBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) ); - aCancelBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) ); - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) ); - - aWordEdit.SetGetFocusHdl( - LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) ); - - Reference< XHyphenatedWord > xHyphWord( pWrapper ? - pWrapper->GetLast() : Reference< XInterface > () , UNO_QUERY ); - DBG_ASSERT(xHyphWord.is(), "missing hyphenated word"); - nMaxHyphenationPos = xHyphWord.is() ? xHyphWord->getHyphenationPos() : 0; - SetLabel_Impl( nLang ); + aActWord = rWord; + nActLanguage = nLang; + xHyphenator = xHyphen; + pHyphWrapper = pWrapper; + + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ? + pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY ); + DBG_ASSERT( xHyphWord.is(), "hyphenation result missing" ); + if (xHyphWord.is()) + { + DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" ); + DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" ); + nMaxHyphenationPos = xHyphWord->getHyphenationPos(); + } InitControls_Impl(); aWordEdit.GrabFocus(); - FreeResource(); - - // disable controls if service is not available - if (!xHyphenator.is()) - Enable( sal_False ); + aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Left_Impl ) ); + aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Right_Impl ) ); + aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CutHdl_Impl ) ); + aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, ContinueHdl_Impl ) ); + aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, DeleteHdl_Impl ) ); + aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl ) ); + aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CancelHdl_Impl ) ); + aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog_Impl, GetFocusHdl_Impl ) ); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::SelLeft() +SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() { - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i-- > 0 ; ) - { - DBG_ASSERT(i <= aTxt.Len(), "index out of range"); - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); -} - -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SelRight() -{ - String aTxt( aWordEdit.GetText() ); - - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) - { - if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) - { - aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::EnableLRBtn_Impl() +void SvxHyphenWordDialog_Impl::EnableLRBtn_Impl() { - String aTxt( aWordEdit.GetText() ); + String aTxt( aEditWord ); xub_StrLen nLen = aTxt.Len(); xub_StrLen i; aRightBtn.Disable(); for ( i = nOldPos + 2; i < nLen; ++i ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aRightBtn.Enable(); break; @@ -228,7 +247,7 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() aLeftBtn.Disable(); for ( i = nOldPos; i-- > 0; ) { - if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) + if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) { aLeftBtn.Enable(); break; @@ -236,42 +255,55 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() } } -// ----------------------------------------------------------------------- - -void SvxHyphenWordDialog::SetLabel_Impl( LanguageType nLang ) -{ - String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); - String aTmp( aLabel ); - aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - aTmp.Append( aLangStr ); - aTmp.Append( sal_Unicode( ')' ) ); - SetText( aTmp ); -} - -// ----------------------------------------------------------------------- - -String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( - Reference< XPossibleHyphens > &rxPossHyph, +String SvxHyphenWordDialog_Impl::EraseUnusableHyphens_Impl( + uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 _nMaxHyphenationPos ) { // returns a String showing only those hyphen positions which will result // in a line break if hyphenation is done there + // 1) we will need to discard all hyphenation positions at th end that + // will not result in a line break where the text to the left still fits + // on the line. + // 2) since as from OOo 3.2 '-' are part of a word an thus text like + // 'multi-line-editor' is regarded as single word we also need to discard those + // hyphenation positions to the left of the rightmost '-' that is still left of + // the rightmost valid hyphenation position according to 1) + // + // Example: + // If the possible hyphenation position in 'multi-line-editor' are to eb marked + // by '=' then the text will look like this 'mul=ti-line-ed=it=or'. + // If now the first line is only large enough for 'multi-line-edi' we need to discard + // the last possible hyphnation point because of 1). The the right most valid + // hyphenation position is "ed=itor". The first '-' left of this position is + // "line-ed", thus because of 2) we now need to discard all possible hyphneation + // positions to the left of that as well. Thus in the end leaving us with just + // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation + // position for the user too choose from. However ALL the '-' characters in the word + // will ALWAYS be valid implicit hyphenation positions for the core to choose from! + // And thus even if this word is skipped in the hyphenation dialog it will still be broken + // right after 'multi-line-' (actually it might already be broken up that way before + // the hyphenation dialog is called!). + // Thus rule 2) just eliminates those positions which will not be used by the core at all + // even if the user were to select one of them. String aTxt; DBG_ASSERT(rxPossHyph.is(), "missing possible hyphens"); if (rxPossHyph.is()) { + DBG_ASSERT( aActWord == String( rxPossHyph->getWord() ), "word mismatch" ); + aTxt = String( rxPossHyph->getPossibleHyphens() ); - Sequence< sal_Int16 > aHyphenationPositions( + nHyphenationPositionsOffset = 0; + uno::Sequence< sal_Int16 > aHyphenationPositions( rxPossHyph->getHyphenationPositions() ); sal_Int32 nLen = aHyphenationPositions.getLength(); const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); // find position nIdx after which all hyphen positions are unusable - xub_StrLen nIdx = STRING_NOTFOUND, - nPos; + xub_StrLen nIdx = STRING_NOTFOUND; + xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; if (nLen) { xub_StrLen nStart = 0; @@ -282,7 +314,7 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( else { // find corresponding hyphen pos in string - nPos = aTxt.Search( sal_Unicode( SW_SOFT_HYPHEN ), nStart ); + nPos = aTxt.Search( sal_Unicode( HYPH_POS_CHAR ), nStart ); if (nStart == STRING_NOTFOUND) break; @@ -296,66 +328,77 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( } DBG_ASSERT(nIdx != STRING_NOTFOUND, "no usable hyphenation position"); - // remove not usable hyphens from string + // 1) remove all not usable hyphenation positions from the end of the string nPos = nIdx == STRING_NOTFOUND ? 0 : nIdx + 1; - String aTmp( sal_Unicode( SW_SOFT_HYPHEN ) ), - aEmpty; + nPos1 = nPos; //save for later use in 2) below + const String aTmp( sal_Unicode( HYPH_POS_CHAR ) ); + const String aEmpty; while (nPos != STRING_NOTFOUND) nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + + // 2) remove all hyphenation positions from the start that are not considered by the core + const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); + nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default + if (nPos2 != STRING_NOTFOUND) + { + String aLeft( aSearchRange.Copy( 0, nPos2 ) ); + nPos = 0; + while (nPos != STRING_NOTFOUND) + { + nPos = aLeft.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); + if (nPos != STRING_NOTFOUND) + ++nHyphenationPositionsOffset; + } + aTxt.Replace( 0, nPos2, aLeft ); + } } return aTxt; } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::InitControls_Impl() +void SvxHyphenWordDialog_Impl::InitControls_Impl() { - String aTxt; xPossHyph = NULL; if (xHyphenator.is()) { lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - Sequence< PropertyValue >() ); + uno::Sequence< beans::PropertyValue >() ); if (xPossHyph.is()) - { - aTxt = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); - } - SetLabel_Impl( nActLanguage ); + aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); } - aWordEdit.SetText( aTxt ); + aWordEdit.SetText( aEditWord ); - nOldPos = aTxt.Len(); - SelLeft(); + nOldPos = aEditWord.Len(); + SelLeft_Impl(); EnableLRBtn_Impl(); } -// ----------------------------------------------------------------------- -void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) +void SvxHyphenWordDialog_Impl::ContinueHyph_Impl( sal_uInt16 nInsPos ) { if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) { if (nInsPos) { - //String aTmp( U2S( xPossHyph->getPossibleHyphens() ) ); - String aTmp( aWordEdit.GetText() ); + String aTmp( aEditWord ); DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); - sal_uInt16 nIdxPos = 0; - sal_uInt16 i = 0; - sal_Unicode c; - while (i < aTmp.Len() && HYPHHERE != (c = aTmp.GetChar(i++)) ) + sal_Int16 nIdxPos = -1; + for (sal_uInt16 i = 0; i <= nInsPos; ++i) { - if (SW_SOFT_HYPHEN == c) + if (HYPH_POS_CHAR == aTmp.GetChar( i )) nIdxPos++; } + // take the possible hyphenation positions that got removed from the + // start of the wor dinot account: + nIdxPos += nHyphenationPositionsOffset; - Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); + uno::Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); sal_Int32 nLen = aSeq.getLength(); DBG_ASSERT(nLen, "empty sequence"); - DBG_ASSERT(nIdxPos < nLen, "index out of range"); - if (nLen && nIdxPos < nLen) + DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range"); + if (nLen && 0 <= nIdxPos && nIdxPos < nLen) { nInsPos = aSeq.getConstArray()[ nIdxPos ]; pHyphWrapper->InsertHyphen( nInsPos ); @@ -370,58 +413,130 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) if ( pHyphWrapper->FindSpellError() ) { - Reference< XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), UNO_QUERY ); + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), uno::UNO_QUERY ); // adapt actual word and language to new found hyphenation result if(xHyphWord.is()) { - aActWord = String( xHyphWord->getWord() ); + aActWord = String( xHyphWord->getWord() ); nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); nMaxHyphenationPos = xHyphWord->getHyphenationPos(); InitControls_Impl(); + m_pDialog->SetWindowTitle( nActLanguage ); } } else - EndDialog( RET_OK ); + m_pDialog->EndDialog( RET_OK ); } -// ----------------------------------------------------------------------- -sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() +sal_uInt16 SvxHyphenWordDialog_Impl::GetHyphIndex_Impl() { sal_uInt16 nPos = 0; - String aTxt(aWordEdit.GetText()); + String aTxt( aWordEdit.GetText() ); for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) { - sal_Unicode nChar = aTxt.GetChar( i ); - - if ( nChar == HYPHHERE ) + sal_Unicode cChar = aTxt.GetChar( i ); + if ( cChar == CUR_HYPH_POS_CHAR ) break; - - if ( nChar != SW_SOFT_HYPHEN ) + if ( cChar != HYPH_POS_CHAR ) nPos++; } return nPos; } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) +void SvxHyphenWordDialog_Impl::SelLeft_Impl() +{ + DBG_ASSERT( nOldPos > 0, "invalid hyphenation position" ); + if (nOldPos > 0) + { + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos - 1; i > 0; --i) + { + DBG_ASSERT(i <= aTxt.Len(), "index out of range"); + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); + } +} + + +void SvxHyphenWordDialog_Impl::SelRight_Impl() +{ + String aTxt( aEditWord ); + for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) + { + if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) + { + aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); + + nOldPos = i; + aWordEdit.SetText( aTxt ); + aWordEdit.GrabFocus(); + aWordEdit.SetSelection( Selection( i, i + 1 ) ); + break; + } + } + nHyphPos = GetHyphIndex_Impl(); + EnableLRBtn_Impl(); +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, CutHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - ContinueHyph_Impl( nHyphPos ); + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) +{ + if( !bBusy ) + { + try + { + uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); + const rtl::OUString aName( rtl::OUString::createFromAscii( "IsHyphAuto" ) ); + uno::Any aAny; + + aAny <<= sal_True; + xProp->setPropertyValue( aName, aAny ); + + bBusy = sal_True; + ContinueHyph_Impl( /*nHyphPos*/nOldPos ); + bBusy = sal_False; + + aAny <<= sal_False; + xProp->setPropertyValue( aName, aAny ); + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "Hyphenate All failed" ); + } + } + return 0; +} + + +IMPL_LINK( SvxHyphenWordDialog_Impl, DeleteHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -431,11 +546,9 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, ContinueHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { @@ -445,69 +558,100 @@ IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYAR } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, CancelHdl_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; pHyphWrapper->SpellEnd(); - EndDialog( RET_CANCEL ); + m_pDialog->EndDialog( RET_CANCEL ); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Left_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelLeft(); + SelLeft_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, Right_Impl, Button *, EMPTYARG ) { if( !bBusy ) { bBusy = sal_True; - SelRight(); + SelRight_Impl(); bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog_Impl, GetFocusHdl_Impl, Edit *, EMPTYARG ) { aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) -// ----------------------------------------------------------------------- -IMPL_LINK( SvxHyphenWordDialog, LangError_Impl, void *, nLang ) +// class SvxHyphenWordDialog --------------------------------------------- + +SvxHyphenWordDialog::SvxHyphenWordDialog( + const String &rWord, LanguageType nLang, + Window* pParent, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ) { - // Status anzeigen - String aErr( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_IntPtr)nLang ) ); - aErr += CUI_RESSTR( RID_SVXSTR_HMERR_CHECKINSTALL ); - InfoBox( this, aErr ).Execute(); - return 0; + m_pImpl = std::auto_ptr< SvxHyphenWordDialog_Impl >( + new SvxHyphenWordDialog_Impl( this, rWord, nLang, xHyphen, pWrapper ) ); + + FreeResource(); + + SetWindowTitle( nLang ); + + // disable controls if service is not available + if (!m_pImpl->xHyphenator.is()) + Enable( sal_False ); +} + + +SvxHyphenWordDialog::~SvxHyphenWordDialog() +{ +} + + +void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) +{ + String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); + String aTmp( m_pImpl->aLabel ); + aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); + aTmp.Append( aLangStr ); + aTmp.Append( sal_Unicode( ')' ) ); + SetText( aTmp ); +} + + +void SvxHyphenWordDialog::SelLeft() +{ + m_pImpl->SelRight_Impl(); +} + + +void SvxHyphenWordDialog::SelRight() +{ + m_pImpl->SelLeft_Impl(); } diff --git a/cui/source/dialogs/hyphen.hrc b/cui/source/dialogs/hyphen.hrc index 2c6722298655..f76e2aa75770 100644 --- a/cui/source/dialogs/hyphen.hrc +++ b/cui/source/dialogs/hyphen.hrc @@ -33,13 +33,14 @@ #define BTN_LEFT 11 #define BTN_RIGHT 12 #define FT_WORD 13 +#define FL_BOTTOM 14 #define BTN_HYPH_CONTINUE 20 #define BTN_HYPH_DELETE 21 #define BTN_HYPH_CUT 22 #define BTN_HYPH_CANCEL 23 #define BTN_HYPH_HELP 24 - +#define BTN_HYPH_ALL 25 #endif diff --git a/cui/source/dialogs/hyphen.src b/cui/source/dialogs/hyphen.src index 71720867fcc9..f10e94626f31 100644 --- a/cui/source/dialogs/hyphen.src +++ b/cui/source/dialogs/hyphen.src @@ -40,104 +40,87 @@ String RID_SVXSTR_HMERR_CHECKINSTALL ModalDialog RID_SVXDLG_HYPHENATE { HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 188 , 100 ) ; + Size = MAP_APPFONT ( 200 , 111 ) ; OutputSize = TRUE ; SvLook = TRUE ; Text [ en-US ] = "Hyphenation" ; Moveable = TRUE ; + + FixedText FT_WORD + { + Pos = MAP_APPFONT ( 5 , 5 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "~Word" ; + }; Edit ED_WORD { BORDER = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 17 ) ; + Size = MAP_APPFONT ( 132 , 12 ) ; TABSTOP = TRUE ; LEFT = TRUE ; }; ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 6 , 33 ) ; + Pos = MAP_APPFONT ( 56 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; ImageButton BTN_RIGHT { - Pos = MAP_APPFONT ( 22 , 33 ) ; + Pos = MAP_APPFONT ( 75 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; Symbol = IMAGEBUTTON_ARROW_RIGHT ; }; - FixedText FT_WORD + OKButton BTN_HYPH_CUT { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 144 , 17 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "H~yphenate" ; + TABSTOP = TRUE ; + DEFBUTTON = TRUE ; }; PushButton BTN_HYPH_CONTINUE { - Pos = MAP_APPFONT ( 132 , 43 ) ; + Pos = MAP_APPFONT ( 144 , 35 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Next" ; + Text [ en-US ] = "~Skip" ; TABSTOP = TRUE ; }; PushButton BTN_HYPH_DELETE { - Pos = MAP_APPFONT ( 132 , 60 ) ; + Pos = MAP_APPFONT ( 144 , 52 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; Text [ en-US ] = "~Remove" ; TABSTOP = TRUE ; }; - OKButton BTN_HYPH_CUT + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 0 , 81 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + }; + HelpButton BTN_HYPH_HELP { - Pos = MAP_APPFONT ( 132 , 6 ) ; + Pos = MAP_APPFONT ( 5 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Hyphenate" ; TABSTOP = TRUE ; - DEFBUTTON = TRUE ; }; - CancelButton BTN_HYPH_CANCEL + PushButton BTN_HYPH_ALL { - Pos = MAP_APPFONT ( 132 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 63 , 93 ) ; + Size = MAP_APPFONT ( 74 , 14 ) ; + Text [ en-US ] = "Hyphenate ~All" ; TABSTOP = TRUE ; }; - HelpButton BTN_HYPH_HELP + CancelButton BTN_HYPH_CANCEL { - Pos = MAP_APPFONT ( 132 , 80 ) ; + Pos = MAP_APPFONT ( 144 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Close"; TABSTOP = TRUE ; }; }; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/makefile.mk b/cui/source/dialogs/makefile.mk index 0c5b90aff202..12239a1ac781 100644..100755 --- a/cui/source/dialogs/makefile.mk +++ b/cui/source/dialogs/makefile.mk @@ -57,6 +57,7 @@ SRC1FILES = \ insrc.src \ multipat.src \ newtabledlg.src \ + passwdomdlg.src \ postdlg.src \ scriptdlg.src \ sdrcelldlg.src \ @@ -95,6 +96,7 @@ SLOFILES+=\ $(SLO)$/multifil.obj \ $(SLO)$/multipat.obj \ $(SLO)$/newtabledlg.obj \ + $(SLO)$/passwdomdlg.obj \ $(SLO)$/pastedlg.obj \ $(SLO)$/plfilter.obj \ $(SLO)$/postdlg.obj \ diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx new file mode 100755 index 000000000000..5b768c756654 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.cxx @@ -0,0 +1,343 @@ +/************************************************************************* + * + * 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_cui.hxx" + +// include --------------------------------------------------------------- + +#include "passwdomdlg.hrc" +#include "passwdomdlg.hxx" + +#include "cuires.hrc" +#include "dialmgr.hxx" + +#include <sfx2/tabdlg.hxx> +#include <tools/debug.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/button.hxx> +#include <vcl/morebtn.hxx> +#include <vcl/settings.hxx> +#include <vcl/msgbox.hxx> + + +////////////////////////////////////////////////////////////////////// + +class PasswordReenterEdit_Impl : public Edit +{ + String m_aDefaultTxt; + + // disallow use of copy c-tor and assignment operator + PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & ); + PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & ); + +public: + PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ); + virtual ~PasswordReenterEdit_Impl(); + + // Edit + virtual void Paint( const Rectangle& rRect ); +}; + + +PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) : + Edit( pParent, rResId ) +{ +// currently the spec does not want to display this text anymore... +// m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) ); +} + + +PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl() +{ +} + + +void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect ) +{ + if (GetText().Len() == 0) + { + Push( /*PUSH_FILLCOLOR | PUSH_TEXTFILLCOLOR |*/ PUSH_TEXTCOLOR ); +/* + Color aFillColor( GetParent()->GetBackground().GetColor() ); + SetLineColor(); // don't draw a border when painting the Edit field rectangle with the new background color + SetFillColor( aFillColor ); + SetTextFillColor( aFillColor ); + SetTextColor( GetParent()->GetTextColor() ); // use plain text color even if the Edit field is disabled (it is hard to read the text otherwise) + + DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); +*/ + SetTextColor( Color( COL_GRAY ) ); + DrawText( Point(), m_aDefaultTxt ); + + Pop(); + } + else + Edit::Paint( rRect ); +} + + +////////////////////////////////////////////////////////////////////// + +struct PasswordToOpenModifyDialog_Impl +{ + PasswordToOpenModifyDialog * m_pParent; + + FixedLine m_aFileEncryptionFL; + FixedText m_aPasswdToOpenFT; + Edit m_aPasswdToOpenED; + FixedText m_aReenterPasswdToOpenFT; + PasswordReenterEdit_Impl m_aReenterPasswdToOpenED; +// FixedImage m_aPasswdToOpenMatchFI; + FixedText m_aPasswdNoteFT; + FixedLine m_aButtonsFL; + MoreButton m_aMoreFewerOptionsBTN; + OKButton m_aOk; + CancelButton m_aCancel; + FixedLine m_aFileSharingOptionsFL; + CheckBox m_aOpenReadonlyCB; + FixedText m_aPasswdToModifyFT; + Edit m_aPasswdToModifyED; + FixedText m_aReenterPasswdToModifyFT; + PasswordReenterEdit_Impl m_aReenterPasswdToModifyED; +// FixedImage m_aPasswdToModifyMatchFI; + + String m_aOneMismatch; + String m_aTwoMismatch; + String m_aInvalidStateForOkButton; + String m_aInvalidStateForOkButton_v2; + + bool m_bIsPasswordToModify; + + +// DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( OkBtnClickHdl, OKButton * ); + + PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent, + sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); + ~PasswordToOpenModifyDialog_Impl(); +}; + + +PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( + PasswordToOpenModifyDialog * pParent, + sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen, + bool bIsPasswordToModify ) : + m_pParent( pParent ), + m_aFileEncryptionFL ( pParent, CUI_RES( FL_FILE_ENCRYPTION ) ), + m_aPasswdToOpenFT ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ), + m_aPasswdToOpenED ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ), + m_aReenterPasswdToOpenFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ), + m_aReenterPasswdToOpenED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ) ), +// m_aPasswdToOpenMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_OPEN_MATCH ) ), + m_aPasswdNoteFT ( pParent, CUI_RES( FT_PASSWD_NOTE ) ), + m_aButtonsFL ( pParent, CUI_RES( FL_BUTTONS ) ), + m_aMoreFewerOptionsBTN ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ), + m_aOk ( pParent, CUI_RES( BTN_OK ) ), + m_aCancel ( pParent, CUI_RES( BTN_CANCEL ) ), + m_aFileSharingOptionsFL ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ), + m_aOpenReadonlyCB ( pParent, CUI_RES( CB_OPEN_READONLY ) ), + m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ), + m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ), + m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ), + m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ), +// m_aPasswdToModifyMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_MODIFY_MATCH ) ) + m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ), + m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ), + m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ), + m_aInvalidStateForOkButton_v2( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON_V2 ) ), + m_bIsPasswordToModify( bIsPasswordToModify ) +{ +/* + const sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); + const Image aImage( CUI_RES( bHighContrast ? IMG_PASSWD_MATCH_HC : IMG_PASSWD_MATCH ) ); + m_aPasswdToOpenMatchFI.SetImage( aImage ); + m_aPasswdToModifyMatchFI.SetImage( aImage ); +*/ + + m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) ); + m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) ); + +#if 0 + Link aModifyLink = LINK( this, PasswordToOpenModifyDialog_Impl, ModifyHdl ); + m_aPasswdToOpenED.SetModifyHdl( aModifyLink ); + m_aReenterPasswdToOpenED.SetModifyHdl( aModifyLink ); + m_aPasswdToModifyED.SetModifyHdl( aModifyLink ); + m_aReenterPasswdToModifyED.SetModifyHdl( aModifyLink ); +#endif + + m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) ); + +// m_aOk.Enable( FALSE ); + + if (nMaxPasswdLen) + { + m_aPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); + m_aReenterPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); + m_aPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); + m_aReenterPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); + } + + (void) nMinPasswdLen; // currently not supported + + m_aPasswdToOpenED.GrabFocus(); + +// ModifyHdl( NULL ); + + m_aMoreFewerOptionsBTN.Enable( bIsPasswordToModify ); + if (!bIsPasswordToModify) + m_aMoreFewerOptionsBTN.Hide( TRUE ); +} + + +PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl() +{ +} + +#if 0 +IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, EMPTYARG /*pEdit*/ ) +{ + // force repaints to get the m_aDefaultTxt displayed again + if (m_aReenterPasswdToOpenED.GetText().Len() == 0) + m_aReenterPasswdToOpenED.Invalidate(); + if (m_aReenterPasswdToModifyED.GetText().Len() == 0) + m_aReenterPasswdToModifyED.Invalidate(); + + const sal_Int32 nPasswdToOpenLen = m_aPasswdToOpenED.GetText().Len(); + const sal_Int32 nPasswdToModifyLen = m_aPasswdToModifyED.GetText().Len(); + + const bool bBothEmpty = nPasswdToOpenLen == 0 && nPasswdToModifyLen == 0; + const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); + const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); + + m_aOk.Enable( bToOpenMatch && bToModifyMatch && !bBothEmpty ); + +// m_aPasswdToOpenMatchFI.Enable( bToOpenMatch && !bBothEmpty ); +// m_aPasswdToModifyMatchFI.Enable( bToModifyMatch && !bBothEmpty ); + + return 0; +} +#endif + + +IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ ) +{ + bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() && + m_aPasswdToOpenED.GetText().Len() == 0 && + m_aPasswdToModifyED.GetText().Len() == 0; + if (bInvalidState) + { + ErrorBox aErrorBox( m_pParent, WB_OK, + m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2 ); + aErrorBox.Execute(); + } + else // check for mismatched passwords... + { + const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); + const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); + const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); + if (nMismatch > 0) + { + ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch ); + aErrorBox.Execute(); + + Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED; + PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED; + String aEmpty; + if (nMismatch == 1) + { + rEdit.SetText( aEmpty ); + rRepeatEdit.SetText( aEmpty ); + } + else if (nMismatch == 2) + { + m_aPasswdToOpenED.SetText( aEmpty ); + m_aReenterPasswdToOpenED.SetText( aEmpty ); + m_aPasswdToModifyED.SetText( aEmpty ); + m_aReenterPasswdToModifyED.SetText( aEmpty ); + } + rEdit.GrabFocus(); + } + else + { + m_pParent->EndDialog( RET_OK ); + } + } + + return 0; +} + +////////////////////////////////////////////////////////////////////// + + +PasswordToOpenModifyDialog::PasswordToOpenModifyDialog( + Window * pParent, + sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen, + bool bIsPasswordToModify ) : + SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) ) +{ + m_pImpl = std::auto_ptr< PasswordToOpenModifyDialog_Impl >( + new PasswordToOpenModifyDialog_Impl( this, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ) ); + + FreeResource(); +} + + +PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog() +{ +} + + +String PasswordToOpenModifyDialog::GetPasswordToOpen() const +{ + const bool bPasswdOk = + m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 && + m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText(); + return bPasswdOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String(); +} + + +String PasswordToOpenModifyDialog::GetPasswordToModify() const +{ + const bool bPasswdOk = + m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 && + m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText(); + return bPasswdOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String(); +} + + +bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const +{ + return m_pImpl->m_aOpenReadonlyCB.IsChecked(); +} + + +////////////////////////////////////////////////////////////////////// + diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc new file mode 100755 index 000000000000..522e4edf1da2 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.hrc @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CUI_PASSWDOMDLG_HRC_ +#define _CUI_PASSWDOMDLG_HRC_ + +#define FL_FILE_ENCRYPTION 10 +#define FT_PASSWD_TO_OPEN 11 +#define ED_PASSWD_TO_OPEN 12 +#define FT_REENTER_PASSWD_TO_OPEN 13 +#define ED_REENTER_PASSWD_TO_OPEN 14 +#define IMG_PASSWD_MATCH 15 +#define IMG_PASSWD_MATCH_HC 16 +#define FT_PASSWD_NOTE 17 +#define FL_BUTTONS 18 +#define BTN_MORE_FEWER_OPTIONS 19 +#define BTN_OK 20 +#define BTN_CANCEL 21 +#define FL_FILE_SHARING_OPTIONS 22 +#define FT_PASSWD_TO_MODIFY 23 +#define ED_PASSWD_TO_MODIFY 24 +#define FT_REENTER_PASSWD_TO_MODIFY 25 +#define ED_REENTER_PASSWD_TO_MODIFY 26 +#define FI_PASSWD_TO_OPEN_MATCH 27 +#define FI_PASSWD_TO_MODIFY_MATCH 28 +#define CB_OPEN_READONLY 29 + +#define STR_MORE_OPTIONS 51 +#define STR_FEWER_OPTIONS 52 +#define STR_PASSWD_MUST_BE_CONFIRMED 53 +#define STR_ONE_PASSWORD_MISMATCH 54 +#define STR_TWO_PASSWORDS_MISMATCH 55 +#define STR_INVALID_STATE_FOR_OK_BUTTON 56 +#define STR_INVALID_STATE_FOR_OK_BUTTON_V2 57 + +#endif + diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src new file mode 100755 index 000000000000..edb84813d387 --- /dev/null +++ b/cui/source/dialogs/passwdomdlg.src @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <cuires.hrc> +#include "passwdomdlg.hrc" +#include "helpid.hrc" + + +ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY +{ + Size = MAP_APPFONT( 171, 150 ); + Text [ en-US ] = "Set Password"; + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY; + Border = TRUE ; + Moveable = TRUE ; + OutputSize = TRUE ; + SVLook = TRUE ; + + FixedLine FL_FILE_ENCRYPTION + { + Pos = MAP_APPFONT( 3, 3 ); + Size = MAP_APPFONT( 165, 8 ); + Text [ en-US ] = "File encryption password"; + }; + + FixedText FT_PASSWD_TO_OPEN + { + Pos = MAP_APPFONT( 6, 17 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "~Enter password to open"; + WordBreak = TRUE; + }; + + Edit ED_PASSWD_TO_OPEN + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN; + Pos = MAP_APPFONT( 6, 28 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; + + FixedText FT_REENTER_PASSWD_TO_OPEN + { + Pos = MAP_APPFONT( 6, 45 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Confirm password"; + WordBreak = TRUE; + }; + + Edit ED_REENTER_PASSWD_TO_OPEN + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN; + Pos = MAP_APPFONT( 6, 56 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; +/* + FixedImage FI_PASSWD_TO_OPEN_MATCH + { + Pos = MAP_APPFONT ( 150, 42 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + }; +*/ + FixedText FT_PASSWD_NOTE + { + Pos = MAP_APPFONT( 6, 80 ); + Size = MAP_APPFONT( 159, 4*8 ); // some extra space for translation in other languages + Text [ en-US ] = "Note: After a password has been set, the document will only open with "\ + "the password. Should you lose the password, there will be no way to "\ + "recover the document. Please also note that this password is case-sensitive."; + WordBreak = TRUE; + }; + + FixedLine FL_BUTTONS + { + Pos = MAP_APPFONT( 0, 117 ); + Size = MAP_APPFONT( 171, 8 ); + }; + + MoreButton BTN_MORE_FEWER_OPTIONS + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE; + Pos = MAP_APPFONT( 6 , 130 ) ; + Size = MAP_APPFONT( 50 , 14 ) ; + Delta = 92 ; + MapUnit = MAP_APPFONT ; + State = FALSE ; + }; + + OKButton BTN_OK + { + Pos = MAP_APPFONT( 62, 130 ); + Size = MAP_APPFONT( 50, 14 ); + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT( 115, 130 ); + Size = MAP_APPFONT( 50, 14 ); + }; + + FixedLine FL_FILE_SHARING_OPTIONS + { + Pos = MAP_APPFONT( 3, 154 ); + Size = MAP_APPFONT( 165, 8 ); + Text [ en-US ] = "File sharing password"; + }; + + CheckBox CB_OPEN_READONLY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY; + Pos = MAP_APPFONT( 6, 170 ); + Size = MAP_APPFONT( 159, 8 ); + + Text [ en-US ] = "Open file read-only"; + }; + + FixedText FT_PASSWD_TO_MODIFY + { + Pos = MAP_APPFONT( 6, 186 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Enter password to allow editing"; + WordBreak = TRUE; + }; + + Edit ED_PASSWD_TO_MODIFY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY; + Pos = MAP_APPFONT( 6, 196 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; + + FixedText FT_REENTER_PASSWD_TO_MODIFY + { + Pos = MAP_APPFONT( 6, 214 ); + Size = MAP_APPFONT( 159, 8 ); + Text [ en-US ] = "Confirm password"; + WordBreak = TRUE; + }; + + Edit ED_REENTER_PASSWD_TO_MODIFY + { + HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY; + Pos = MAP_APPFONT( 6, 224 ); + Size = MAP_APPFONT( 159, 12 ); + Border = TRUE ; + PassWord = TRUE ; + }; +/* + FixedImage FI_PASSWD_TO_MODIFY_MATCH + { + Pos = MAP_APPFONT ( 150, 224 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + }; +*/ + + String STR_PASSWD_MUST_BE_CONFIRMED + { + Text [ en-US ] = "Password must be confirmed" ; + }; + + String STR_MORE_OPTIONS + { + Text [ en-US ] = "More ~Options" ; + }; + + String STR_FEWER_OPTIONS + { + Text [ en-US ] = "Fewer ~Options" ; + }; + + String STR_ONE_PASSWORD_MISMATCH + { + Text [ en-US ] = "The confirmation password did not match the password. Set the password again by entering the same password in both boxes." ; + }; + + String STR_TWO_PASSWORDS_MISMATCH + { + Text [ en-US ] = "The confirmation passwords did not match the original passwords. Set the passwords again." ; + }; + + String STR_INVALID_STATE_FOR_OK_BUTTON + { + Text [ en-US ] = "Please enter a password to open or to modify, or check the open read-only option to continue." ; + }; +/* + Image IMG_PASSWD_MATCH + { + ImageBitmap = Bitmap { File = "apply.png"; }; + }; + + Image IMG_PASSWD_MATCH_HC + { + ImageBitmap = Bitmap { File = "apply_h.png"; }; + }; +*/ +}; + diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index c1a96541c5b7..bf617b126747 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -26,10 +26,21 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_cui.hxx" +#include "thesdlg.hrc" +#include "thesdlg.hxx" +#include "thesdlg_impl.hxx" +#include "cuires.hrc" +#include "dialmgr.hxx" + +#include <editeng/unolingu.hxx> #include <tools/shl.hxx> #include <svl/lngmisc.hxx> +#include <svtools/filter.hxx> +#include <svtools/svlbitm.hxx> +#include <svtools/svtreebx.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> @@ -39,25 +50,28 @@ #include <svx/dlgutil.hxx> #include <svx/dialmgr.hxx> #include <svx/svxerr.hxx> -#include "cuires.hrc" -#include "thesdlg.hrc" #include <editeng/unolingu.hxx> #include <svx/langbox.hxx> #include <svtools/langtab.hxx> -#include "dialmgr.hxx" -#include <svx/dialogs.hrc> -#include <editeng/editerr.hxx> +#include <unotools/lingucfg.hxx> +#include <i18npool/mslangid.hxx> +#include <comphelper/processfactory.hxx> +#include <osl/file.hxx> + + +#include <stack> +#include <algorithm> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; +using ::rtl::OUString; + + +#define A2S(x) String::CreateFromAscii( x ) -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) // GetReplaceEditString ------------------------------- @@ -89,171 +103,237 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } -// struct ThesDlg_Impl --------------------------------------------------- +// class LookUpComboBox_Impl -------------------------------------------------- -struct ThesDlg_Impl +LookUpComboBox_Impl::LookUpComboBox_Impl( + Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : + ComboBox (pParent, rResId), + m_rDialogImpl( rImpl ) { - Reference< XThesaurus > xThesaurus; - ::rtl::OUString aLookUpText; - sal_Int16 nLookUpLanguage; + m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); + m_aModifyTimer.SetTimeout( 500 ); + + EnableAutocomplete( FALSE ); +} - ThesDlg_Impl( Reference< XThesaurus > & xThes ); - SfxErrorContext* pErrContext; // ErrorContext, - // w"ahrend der Dialog oben ist -}; -ThesDlg_Impl::ThesDlg_Impl(Reference< XThesaurus > & xThes) : - xThesaurus (xThes) +LookUpComboBox_Impl::~LookUpComboBox_Impl() { - pErrContext = NULL; - nLookUpLanguage = LANGUAGE_NONE; } -// class SvxThesaurusLanguageDlg_Impl ------------------------------------ +void LookUpComboBox_Impl::Modify() +{ + m_aModifyTimer.Start(); +} + -class SvxThesaurusLanguageDlg_Impl : public ModalDialog +IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) { -private: - SvxLanguageBox aLangLB; - FixedLine aLangFL; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; + m_rDialogImpl.LookUp( GetText() ); + m_aModifyTimer.Stop(); + return 0; +} - DECL_LINK( DoubleClickHdl_Impl, ListBox * ); -public: - SvxThesaurusLanguageDlg_Impl( Window* pParent ); +// class ReplaceEdit_Impl -------------------------------------------------- - sal_uInt16 GetLanguage() const; - void SetLanguage( sal_uInt16 nLang ); -}; +ReplaceEdit_Impl::ReplaceEdit_Impl( + Window *pParent, const ResId &rResId ) : + Edit (pParent, rResId) +{ +} -// ----------------------------------------------------------------------- +ReplaceEdit_Impl::~ReplaceEdit_Impl() +{ +} -SvxThesaurusLanguageDlg_Impl::SvxThesaurusLanguageDlg_Impl( Window* pParent ) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_THES_LANGUAGE ) ), +void ReplaceEdit_Impl::Modify() +{ + if (m_pBtn) + m_pBtn->Enable( GetText().Len() > 0 ); +} - aLangLB ( this, CUI_RES( LB_THES_LANGUAGE ) ), - aLangFL ( this, CUI_RES( FL_THES_LANGUAGE ) ), - aOKBtn ( this, CUI_RES( BTN_LANG_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_LANG_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_LANG_HELP ) ) +void ReplaceEdit_Impl::SetText( const XubString& rStr ) { - FreeResource(); + Edit::SetText( rStr ); + Modify(); +} - aLangLB.SetLanguageList( LANG_LIST_THES_USED, FALSE, FALSE ); - aLangLB.SetDoubleClickHdl( - LINK( this, SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl ) ); + +void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) +{ + Edit::SetText( rStr, rNewSelection ); + Modify(); } -// ----------------------------------------------------------------------- +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- -sal_uInt16 SvxThesaurusLanguageDlg_Impl::GetLanguage() const +void AlternativesString_Impl::Paint( + const Point& rPos, + SvLBox& rDev, USHORT, + SvLBoxEntry* pEntry ) { - sal_uInt16 nLang = aLangLB.GetSelectLanguage(); - return nLang; + AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); + Point aPos( rPos ); + Font aOldFont( rDev.GetFont()); + if (pData && pData->IsHeader()) + { + Font aFont( aOldFont ); + aFont.SetWeight( WEIGHT_BOLD ); + rDev.SetFont( aFont ); + aPos.X() = 0; + } + else + aPos.X() += 5; + rDev.DrawText( aPos, GetText() ); + rDev.SetFont( aOldFont ); } -// ----------------------------------------------------------------------- -void SvxThesaurusLanguageDlg_Impl::SetLanguage( sal_uInt16 nLang ) +ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( + Window* pParent, + SvxThesaurusDialog_Impl &rImpl ) : + SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), + m_rDialogImpl( rImpl ) { - aLangLB.SelectLanguage( nLang ); + SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetHighlightRange(); } -// ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) +ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() { - EndDialog( RET_OK ); - return 0; + ClearUserData(); } -IMPL_LINK_INLINE_END( SvxThesaurusLanguageDlg_Impl, DoubleClickHdl_Impl, ListBox *, EMPTYARG ) -// class SvxThesaurusDialog ---------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::ClearUserData() +{ + for (USHORT i = 0; i < GetEntryCount(); ++i) + delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); +} -// ----------------------------------------------------------------------- - - -SvxThesaurusDialog::SvxThesaurusDialog( Window* pParent, Reference< XThesaurus > xThes, - const String &rWord, sal_Int16 nLanguage) : - - SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ), - - aWordText ( this, CUI_RES( FT_WORD ) ), - aWordLB ( this, CUI_RES( LB_WORD ) ), - aReplaceText( this, CUI_RES( FT_REPL ) ), - aReplaceEdit( this, CUI_RES( ED_REPL ) ), - aMeanText ( this, CUI_RES( FT_MEAN ) ), - aMeanLB ( this, CUI_RES( LB_MEAN ) ), - aSynonymText( this, CUI_RES( FT_SYNON ) ), - aSynonymLB ( this, CUI_RES( LB_SYNON ) ), - aVarFL ( this, CUI_RES( FL_VAR ) ), - aOkBtn ( this, CUI_RES( BTN_THES_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_THES_CANCEL ) ), - aLookUpBtn ( this, CUI_RES( BTN_LOOKUP ) ), - aLangBtn ( this, CUI_RES( BTN_LANGUAGE ) ), - aHelpBtn ( this, CUI_RES( BTN_THES_HELP ) ), - aErrStr ( CUI_RES( STR_ERR_WORDNOTFOUND ) ) -{ - pImpl = new ThesDlg_Impl( xThes ); - pImpl->aLookUpText = ::rtl::OUString( rWord ); - pImpl->nLookUpLanguage = nLanguage; - pImpl->pErrContext = - new SfxErrorContext( ERRCTX_SVX_LINGU_THESAURUS, String(), this, - RID_SVXERRCTX, &DIALOG_MGR() ); - - aLangBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); - aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); - aMeanLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, EntryHdl_Impl ) ); - aSynonymLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, SynonymHdl_Impl ) ); - Link aLink = LINK( this, SvxThesaurusDialog, SelectHdl_Impl ); - aMeanLB.SetDoubleClickHdl( aLink ); - aSynonymLB.SetDoubleClickHdl( aLink ); - aWordLB.SetSelectHdl( aLink ); - FreeResource(); +SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + String aText; + if (bIsHeader && nVal >= 0) + { + aText = String::CreateFromInt32( nVal ); + aText += A2S( ". " ); + } + pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column + aText += rText; + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash + pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, aText ) ); - ::rtl::OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - aReplaceEdit.SetText( aTmp ); - aWordLB.InsertEntry( aTmp ); - aWordLB.SelectEntry( aTmp ); + AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); + pEntry->SetUserData( pUserData ); + GetModel()->Insert( pEntry ); - Init_Impl( nLanguage ); + if (bIsHeader) + GetViewDataEntry( pEntry )->SetSelectable( false ); - // disable controls if service is missing - if (!pImpl->xThesaurus.is()) - Enable( sal_False ); + return pEntry; } -// ----------------------------------------------------------------------- +void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode& rKey = rKEvt.GetKeyCode(); + + if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) + GetParent()->KeyInput( rKEvt ); // parent will close dialog... + else if (rKey.GetCode() == KEY_SPACE) + m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry + else if (GetEntryCount()) + SvxCheckListBox::KeyInput( rKEvt ); +} -SvxThesaurusDialog::~SvxThesaurusDialog() + +void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) +{ + if (!m_rDialogImpl.m_bWordFound) + { +/* Push( PUSH_FONT ); + + Font aFont( GetFont() ); + aFont.SetHeight( 2 * aFont.GetHeight() ); + SetFont( aFont ); +*/ + Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); + aTextSize = LogicToPixel( aTextSize ); + Point aPos; + aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; + aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; + aPos = PixelToLogic( aPos ); + DrawText( aPos, m_rDialogImpl.aErrStr ); + +// Pop(); + } + else + SvxCheckListBox::Paint( rRect ); +} + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : + m_pDialog ( pDialog ), + aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), + aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), + aWordText ( pDialog, CUI_RES( FT_WORD ) ), + aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), + m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), + m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), + aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), + aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), + aFL ( pDialog, CUI_RES( FL_VAR ) ), + aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), + aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), + aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), + aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), + aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), + aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), + aVendorDefaultImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ), + xThesaurus ( NULL ), + aLookUpText (), + nLookUpLanguage ( LANGUAGE_NONE ), + m_bWordFound( false ) +{ + // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog + + aReplaceEdit.SetButton( &aReplaceBtn ); + + aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); + aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); + aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); + m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); + m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); + + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); +} + + +SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() { - delete pImpl->pErrContext; - delete pImpl; + delete aLangMBtn.GetPopupMenu(); } -// ----------------------------------------------------------------------- -uno::Sequence< Reference< XMeaning > > SAL_CALL - SvxThesaurusDialog::queryMeanings_Impl( - ::rtl::OUString& rTerm, - const Locale& rLocale, - const beans::PropertyValues& rProperties ) - throw(lang::IllegalArgumentException, uno::RuntimeException) +uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( + OUString& rTerm, + const lang::Locale& rLocale, + const beans::PropertyValues& rProperties ) + throw(lang::IllegalArgumentException, uno::RuntimeException) { - uno::Sequence< Reference< XMeaning > > aMeanings( - pImpl->xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( + xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); // text with '.' at the end? if (0 == aMeanings.getLength() && rTerm.getLength() && @@ -263,7 +343,7 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL // end of a sentence and not an abbreviation... String aTxt( rTerm ); aTxt.EraseTrailingChars( '.' ); - aMeanings = pImpl->xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); + aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); if (aMeanings.getLength()) { rTerm = aTxt; @@ -273,220 +353,394 @@ uno::Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; } -// ----------------------------------------------------------------------- -sal_uInt16 SvxThesaurusDialog::GetLanguage() const +bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() { - return pImpl->nLookUpLanguage; + lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( + aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); + const sal_Int32 nMeanings = aMeanings.getLength(); + const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); + + m_pAlternativesCT->SetUpdateMode( FALSE ); + + // clear old user data of control before creating new ones via AddEntry below + m_pAlternativesCT->ClearUserData(); + + m_pAlternativesCT->Clear(); + for (sal_Int32 i = 0; i < nMeanings; ++i) + { + OUString rMeaningTxt = pMeanings[i]->getMeaning(); + uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); + const sal_Int32 nSynonyms = aSynonyms.getLength(); + const OUString *pSynonyms = aSynonyms.getConstArray(); + DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); + DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); + + m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); + for (sal_Int32 k = 0; k < nSynonyms; ++k) + m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); + } + + m_pAlternativesCT->SetUpdateMode( TRUE ); + + return nMeanings > 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateMeaningBox_Impl( uno::Sequence< Reference< XMeaning > > *pMeaningSeq ) +void SvxThesaurusDialog_Impl::LookUp( const String &rText ) { - // create temporary meaning list if not supplied from somewhere else - sal_Bool bTmpSeq = sal_False; - if (!pMeaningSeq && pImpl->xThesaurus.is()) - { - bTmpSeq = sal_True; - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - uno::Sequence< Reference< XMeaning > > aTmpMean = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ); + if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same + aWordCB.SetText( rText ); + LookUp_Impl(); +} - pMeaningSeq = new Sequence< Reference< XMeaning > > ( aTmpMean ); - // set new replace edit text if a different look up text was used - // see: queryMeanings_Impl - aReplaceEdit.SetText( pImpl->aLookUpText ); +IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) +{ + if (pBtn && aLookUpHistory.size() >= 2) + { + aLookUpHistory.pop(); // remove current look up word from stack + aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word + aLookUpHistory.pop(); + LookUp_Impl(); } + return 0; +} - sal_Int32 nMeaningCount = pMeaningSeq ? pMeaningSeq->getLength() : 0; - const Reference< XMeaning > *pMeaning = pMeaningSeq ? pMeaningSeq->getConstArray() : NULL; - aMeanLB.Clear(); - for ( sal_Int32 i = 0; i < nMeaningCount; ++i ) - aMeanLB.InsertEntry( pMeaning[i]->getMeaning() ); - - // remove temporary meaning list - if (bTmpSeq) - delete pMeaningSeq; - if (aMeanLB.GetEntryCount() > 0) - aMeanLB.SelectEntryPos(0); - UpdateSynonymBox_Impl(); +IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) +{ + PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); + if (pMenu && pBtn) + { + USHORT nItem = pBtn->GetCurItemId(); + String aLangText( pMenu->GetItemText( nItem ) ); + LanguageType nLang = SvtLanguageTable().GetType( aLangText ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + nLookUpLanguage = nLang; + m_pDialog->SetWindowTitle( nLang ); + UpdateVendorImage(); + LookUp_Impl(); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::UpdateSynonymBox_Impl() +void SvxThesaurusDialog_Impl::LookUp_Impl() { + String aText( aWordCB.GetText() ); + + aLookUpText = OUString( aText ); + if (aLookUpText.getLength() > 0 && + (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) + aLookUpHistory.push( aLookUpText ); + + m_bWordFound = UpdateAlternativesBox_Impl(); + m_pAlternativesCT->Enable( m_bWordFound ); - aSynonymLB.Clear(); + if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) + aWordCB.InsertEntry( aText ); - sal_uInt16 nPos = aMeanLB.GetSelectEntryPos(); // active meaning pos - if (nPos != LISTBOX_ENTRY_NOTFOUND && pImpl->xThesaurus.is()) + aReplaceEdit.SetText( String() ); + aLeftBtn.Enable( aLookUpHistory.size() > 1 ); +} + + +IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) +{ + if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys { - // get Reference< XMeaning > for selected meaning - lang::Locale aLocale( SvxCreateLocale( pImpl->nLookUpLanguage ) ); - Reference< XMeaning > xMeaning = queryMeanings_Impl( - pImpl->aLookUpText, aLocale, Sequence< PropertyValue >() ) - .getConstArray()[ nPos ]; - - uno::Sequence< ::rtl::OUString > aSynonyms; - if (xMeaning.is()) - aSynonyms = xMeaning->querySynonyms(); - - sal_Int32 nSynonymCount = aSynonyms.getLength(); - const ::rtl::OUString *pSynonym = aSynonyms.getConstArray(); - for ( sal_Int32 i=0; i < nSynonymCount; ++i ) - aSynonymLB.InsertEntry( pSynonym[i] ); + USHORT nPos = pBox->GetSelectEntryPos(); + String aStr( pBox->GetEntry( nPos ) ); + GetReplaceEditString( aStr ); + aWordCB.SetText( aStr ); + LookUp_Impl(); } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Apply() +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) { + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } + aReplaceEdit.SetText( aStr ); + } + return 0; } -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::Init_Impl(sal_Int16 nLanguage) + +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) { - // Sprache anpassen - String aStr( GetText() ); - aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); - aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); - //aStr += GetLanguageString( (LanguageType)pImpl->pThesaurus->GetLanguage() ); - aStr += SvtLanguageTable::GetLanguageString( (LanguageType) nLanguage ); - aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // Text der Window-Leiste setzen (Wort + Sprache) + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; + if (pEntry) + { + AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } - // adapt meanings according to (new) language - UpdateMeaningBox_Impl(); + aWordCB.SetText( aStr ); + if (aStr.Len() > 0) + LookUp_Impl(); + } + + //! workaround to set the selection since calling SelectEntryPos within + //! the double click handler does not work + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); + return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { + (void) pThis; + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; +} - EnterWait(); +//////////////////////////////////////////////////////////// - String aText( aReplaceEdit.GetText() ); +static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) +{ + Image aRes; + + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} - ::rtl::OUString aOldLookUpText = pImpl->aLookUpText; - pImpl->aLookUpText = ::rtl::OUString( aText ); - uno::Sequence< Reference< XMeaning > > aMeanings; - if (pImpl->xThesaurus.is()) - aMeanings = queryMeanings_Impl( - pImpl->aLookUpText, - SvxCreateLocale( pImpl->nLookUpLanguage ), - Sequence< PropertyValue >() ); +static String lcl_GetThesImplName( const lang::Locale &rLocale ) +{ + String aRes; - LeaveWait(); - if ( aMeanings.getLength() == 0 ) + uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; + try { - if( pBtn == &aCancelBtn ) // called via double click - { - pImpl->aLookUpText = aOldLookUpText; - } - else + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + + DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); + if (xLngMgr.is()) { - UpdateMeaningBox_Impl( &aMeanings ); - if( pBtn == &aLookUpBtn ) - InfoBox( this, aErrStr ).Execute(); + uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; } - return 0; + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); } - UpdateMeaningBox_Impl( &aMeanings ); + return aRes; +} - if ( aWordLB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - aWordLB.InsertEntry( aText ); - aWordLB.SelectEntry( aText ); - aMeanLB.SelectEntryPos( 0 ); +void SvxThesaurusDialog_Impl::UpdateVendorImage() +{ + m_pDialog->SetUpdateMode( sal_False ); - String aStr( aMeanLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); - aSynonymLB.SetNoSelection(); + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) + { + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - return 0; + Image aImage; + String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); + OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); + else + aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; + aVendorImageFI.SetImage( aImage ); + } + + m_pDialog->SetUpdateMode( sal_True ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, Button *, EMPTYARG ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) { - if (!pImpl->xThesaurus.is()) - return 0; + pThis->m_pDialog->SetUpdateMode( sal_False ); - SvxThesaurusLanguageDlg_Impl aDlg( this ); - sal_uInt16 nLang = pImpl->nLookUpLanguage; - aDlg.SetLanguage( nLang ); - - if ( aDlg.Execute() == RET_OK ) + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) { - nLang = aDlg.GetLanguage(); - if (pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - pImpl->nLookUpLanguage = nLang; - UpdateMeaningBox_Impl(); - Init_Impl( nLang ); + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); + pThis->aVendorImageFI.SetImage( aImage ); + pThis->aVendorImageFI.Show(); + + // move down visible controls according to the vendor images height + Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); + Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); + if (aImageSize.Height()) + { + aVendorSize.Height() = aImageSize.Height(); + if(aVendorSize.Width() < aImageSize.Width()) + aVendorSize.Width() = aImageSize.Width(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + } + const sal_Int32 nDiff = aVendorSize.Height(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + Control* aControls[] = { + &pThis->aLeftBtn, + &pThis->aWordText, + &pThis->aWordCB, + &pThis->m_aAlternativesText, + pThis->m_pAlternativesCT.get(), + &pThis->aReplaceText, + &pThis->aReplaceEdit, + &pThis->aFL, + &pThis->aHelpBtn, + &pThis->aLangMBtn, + &pThis->aReplaceBtn, + &pThis->aCancelBtn, + 0 + }; + sal_Int32 nControl = 0; + while (aControls[nControl]) + { + Point aPos = aControls[nControl]->GetPosPixel(); + aPos.Y() += nDiff; + aControls[nControl]->SetPosPixel(aPos); + ++nControl; + } + Size aDlgSize = pThis->m_pDialog->GetSizePixel(); + aDlgSize.Height() += nDiff; + pThis->m_pDialog->SetSizePixel( aDlgSize ); + pThis->m_pDialog->Invalidate(); } + pThis->UpdateVendorImage(); + pThis->m_pDialog->SetUpdateMode( sal_True ); + return 0; -} +}; -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SynonymHdl_Impl, ListBox *, EMPTYARG ) +// class SvxThesaurusDialog ---------------------------------------------- + +SvxThesaurusDialog::SvxThesaurusDialog( + Window* pParent, + uno::Reference< linguistic2::XThesaurus > xThes, + const String &rWord, + LanguageType nLanguage ) : + + SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) { - if ( aSynonymLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); + + m_pImpl->xThesaurus = xThes; + m_pImpl->aLookUpText = OUString( rWord ); + m_pImpl->nLookUpLanguage = nLanguage; + if (rWord.Len() > 0) + m_pImpl->aLookUpHistory.push( rWord ); + + FreeResource(); + + OUString aTmp( rWord ); + linguistic::RemoveHyphens( aTmp ); + linguistic::ReplaceControlChars( aTmp ); + String aTmp2( aTmp ); + m_pImpl->aReplaceEdit.SetText( aTmp2 ); + m_pImpl->aWordCB.InsertEntry( aTmp2 ); + + m_pImpl->LookUp( aTmp2 ); + m_pImpl->m_pAlternativesCT->GrabFocus(); + m_pImpl->aLeftBtn.Enable( sal_False ); + + // fill language menu button list + SvtLanguageTable aLangTab; + uno::Sequence< lang::Locale > aLocales; + if (m_pImpl->xThesaurus.is()) + aLocales = m_pImpl->xThesaurus->getLocales(); + const sal_Int32 nLocales = aLocales.getLength(); + const lang::Locale *pLocales = aLocales.getConstArray(); + delete m_pImpl->aLangMBtn.GetPopupMenu(); + PopupMenu* pMenu = new PopupMenu; + pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); + std::vector< OUString > aLangVec; + for (sal_Int32 i = 0; i < nLocales; ++i ) { - String aStr( aSynonymLB.GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); + const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + aLangVec.push_back( aLangTab.GetString( nLang ) ); } - return 0; + std::sort( aLangVec.begin(), aLangVec.end() ); + for (size_t i = 0; i < aLangVec.size(); ++i) + pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); + + SetWindowTitle( nLanguage ); + + // disable controls if service is missing + if (!m_pImpl->xThesaurus.is()) + Enable( sal_False ); } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SelectHdl_Impl, ListBox *, pBox ) +SvxThesaurusDialog::~SvxThesaurusDialog() { - String aStr( pBox->GetSelectEntry() ); - GetReplaceEditString( aStr ); - aReplaceEdit.SetText( aStr ); +} - //! 'aCancelBtn' is used to indicate that the handler is called as result - //! of a double click action. - LookUpHdl_Impl( &aCancelBtn /* ??? &aLookUpBtn */ ); - return 0; +void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) +{ + // Sprache anpassen + String aStr( GetText() ); + aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); + aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); + aStr += SvtLanguageTable().GetLanguageString( nLanguage ); + aStr.Append( sal_Unicode( ')' ) ); + SetText( aStr ); // set window title } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, EntryHdl_Impl, ListBox *, EMPTYARG ) +String SvxThesaurusDialog::GetWord() { + return m_pImpl->aReplaceEdit.GetText(); +} - UpdateSynonymBox_Impl(); - return 0; +sal_uInt16 SvxThesaurusDialog::GetLanguage() const +{ + return m_pImpl->nLookUpLanguage; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, SpellErrorHdl_Impl, void *, pError ) +void SvxThesaurusDialog::Apply() { - // Der "ubergebene Pointer pError ist die falsche Sprachen-Nummer - LanguageType eLang = (LanguageType)(sal_uIntPtr)pError; - String aErr( SvtLanguageTable::GetLanguageString( eLang ) ); - // Fehlermeldung ausgeben - ErrorHandler::HandleError( - *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) ); - return 0; } + diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc index 9621422a1894..994c933246de 100644 --- a/cui/source/dialogs/thesdlg.hrc +++ b/cui/source/dialogs/thesdlg.hrc @@ -29,30 +29,23 @@ // defines --------------------------------------------------------------- +#define BTN_LEFT 9 #define BTN_THES_OK 10 #define BTN_THES_CANCEL 11 -#define BTN_LANGUAGE 12 +#define MB_LANGUAGE 12 #define BTN_THES_HELP 13 -#define BTN_LOOKUP 14 #define FT_WORD 15 -#define LB_WORD 16 -#define FT_MEAN 17 -#define LB_MEAN 18 -#define FT_SYNON 19 -#define LB_SYNON 20 +#define CB_WORD 16 #define FT_REPL 21 #define ED_REPL 22 -#define FL_VAR 23 - -#define STR_ERR_WORDNOTFOUND 30 - -// LanguageDialog -------------------------------------------------------- - -#define LB_THES_LANGUAGE 10 -#define FL_THES_LANGUAGE 11 -#define BTN_LANG_OK 12 -#define BTN_LANG_CANCEL 12 -#define BTN_LANG_HELP 13 +#define FL_VAR 23 +#define FT_THES_ALTERNATIVES 24 +#define CT_THES_ALTERNATIVES 25 +#define IMG_VENDOR 26 +#define IMG_DEFAULT_VENDOR 27 +#define IMG_DEFAULT_VENDOR_HC 28 + +#define STR_ERR_TEXTNOTFOUND 101 #endif diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src index 84671c050e9a..cf5eac8e5a02 100644 --- a/cui/source/dialogs/thesdlg.src +++ b/cui/source/dialogs/thesdlg.src @@ -24,185 +24,123 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - // include --------------------------------------------------------------- + #include "cuires.hrc" #include "thesdlg.hrc" #include "helpid.hrc" #include <svx/svxids.hrc> // SID_THESAURUS -// pragma ---------------------------------------------------------------- // RID_SVXDLG_THES ------------------------------------------------------- ModalDialog RID_SVXDLG_THESAURUS { HelpId = CMD_SID_THESAURUS ; OutputSize = TRUE ; - Size = MAP_APPFONT ( 285 , 116 ) ; + Size = MAP_APPFONT ( 235, 230 ) ; Text [ en-US ] = "Thesaurus" ; - Moveable = TRUE ; SvLook = TRUE ; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 219 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL - { - Pos = MAP_APPFONT ( 219 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - PushButton BTN_LOOKUP + Moveable = TRUE ; + + FixedImage IMG_VENDOR { - Pos = MAP_APPFONT ( 219 , 40 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Search" ; + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime + Hide = TRUE; }; - PushButton BTN_LANGUAGE + + ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 219 , 57 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language..." ; - }; - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 219 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; + Pos = MAP_APPFONT ( 5 , 15 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + TABSTOP = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; FixedText FT_WORD { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 24 , 5 ) ; + Size = MAP_APPFONT ( 143 , 8 ) ; + Text [ en-US ] = "Current ~word" ; LEFT = TRUE ; }; - ListBox LB_WORD + ComboBox CB_WORD { DropDown = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 96 , 65 ) ; + Pos = MAP_APPFONT ( 24 , 16 ) ; + Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines }; - FixedText FT_MEAN + MenuButton MB_LANGUAGE { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Meaning " ; - LEFT = TRUE ; - }; - ListBox LB_MEAN - { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( 170 , 16 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Language" ; }; - FixedText FT_SYNON + + FixedText FT_THES_ALTERNATIVES { - Pos = MAP_APPFONT ( 111 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Sy~nonym" ; + Pos = MAP_APPFONT ( 5 , 33 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "~Alternatives" ; LEFT = TRUE ; }; - ListBox LB_SYNON + Control CT_THES_ALTERNATIVES { - BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; - AutoHScroll = TRUE ; + HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control + Pos = MAP_APPFONT ( 5 , 45 ) ; + Size = MAP_APPFONT ( 225 , 121 ) ; + Border = TRUE; + TabStop = TRUE ; }; + FixedText FT_REPL { - Pos = MAP_APPFONT ( 111 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Replace" ; + Pos = MAP_APPFONT ( 5 , 173 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; + Text [ en-US ] = "Replace ~with" ; LEFT = TRUE ; }; Edit ED_REPL { BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 25 ) ; - Size = MAP_APPFONT ( 96 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 184 ) ; + Size = MAP_APPFONT ( 225 , 12 ) ; LEFT = TRUE ; }; FixedLine FL_VAR { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 207 , 8 ) ; - Text [ en-US ] = "Variations" ; + Pos = MAP_APPFONT ( 0 , 200 ) ; + Size = MAP_APPFONT ( 235 , 8 ) ; }; - String STR_ERR_WORDNOTFOUND + + HelpButton BTN_THES_HELP { - Text [ en-US ] = "Word not found in thesaurus" ; + Pos = MAP_APPFONT ( 5 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; -}; - // RID_SVXDLG_THES_LANGUAGE ---------------------------------------------- -ModalDialog RID_SVXDLG_THES_LANGUAGE -{ - HelpId = HID_THES_LANGUAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 170 , 86 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswhlen : Sprache auswhlen */ - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswhlen : Sprache auswhlen */ - Text [ en-US ] = "Select Language" ; - Moveable = TRUE ; - ListBox LB_THES_LANGUAGE + OkButton BTN_THES_OK { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 90 , 60 ) ; - Sort = TRUE ; + Pos = MAP_APPFONT ( 105 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Replace" ; + DefButton = TRUE ; }; - FixedLine FL_THES_LANGUAGE + CancelButton BTN_THES_CANCEL { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 102 , 8 ) ; - Text [ en-US ] = "Selection" ; + Pos = MAP_APPFONT ( 170 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; }; - OKButton BTN_LANG_OK + + String STR_ERR_TEXTNOTFOUND { - Pos = MAP_APPFONT ( 114 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; + Text [ en-US ] = "No alternatives found." ; }; - CancelButton BTN_LANG_CANCEL + + Image IMG_DEFAULT_VENDOR { - Pos = MAP_APPFONT ( 114 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01.png"; }; }; - HelpButton BTN_LANG_HELP + Image IMG_DEFAULT_VENDOR_HC { - Pos = MAP_APPFONT ( 114 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + ImageBitmap = Bitmap { File = "vendor01h.png"; }; }; }; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx new file mode 100644 index 000000000000..70ce91391456 --- /dev/null +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * 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 _SVX_THESDLG_IMPL_HXX +#define _SVX_THESDLG_IMPL_HXX + +#include "thesdlg.hxx" + +#include <svtools/ehdl.hxx> +#include <svx/checklbx.hxx> +#include <vcl/button.hxx> +#include <vcl/combobox.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/image.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/timer.hxx> +#include <vcl/wrkwin.hxx> + +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XMeaning.hpp> + +#include <stack> +#include <algorithm> + +using namespace ::com::sun::star; +using ::rtl::OUString; + +// class LookUpComboBox_Impl -------------------------------------------------- + +class LookUpComboBox_Impl : public ComboBox +{ + Timer m_aModifyTimer; + Selection m_aSelection; + Button * m_pBtn; + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + LookUpComboBox_Impl( const LookUpComboBox_Impl & ); + LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); + +public: + LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); + virtual ~LookUpComboBox_Impl(); + + DECL_LINK( ModifyTimer_Hdl, Timer * ); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // ComboBox + virtual void Modify(); +}; + +// class ReplaceEdit_Impl -------------------------------------------------- + +class ReplaceEdit_Impl : public Edit +{ + Button * m_pBtn; + + // disable copy c-tor and assignment operator + ReplaceEdit_Impl( const ReplaceEdit_Impl & ); + ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); + +public: + ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); + virtual ~ReplaceEdit_Impl(); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // Edit + virtual void Modify(); + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); +}; + +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- + +class AlternativesUserData_Impl +{ + String sText; + bool bHeader; + + // disable copy c-tor and assignment operator + AlternativesUserData_Impl( const AlternativesUserData_Impl & ); + AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & ); + +public: + AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + sText(rText), + bHeader(bIsHeader) + { + } + + bool IsHeader() const { return bHeader; } + const String& GetText() const { return sText; } +}; + + +class AlternativesString_Impl : public SvLBoxString +{ +public: + + AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) + : SvLBoxString( pEntry, nFlags, rStr ) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); +}; + + +class ThesaurusAlternativesCtrl_Impl : + public SvxCheckListBox +{ + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); + ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); + +public: + ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); + virtual ~ThesaurusAlternativesCtrl_Impl(); + + + SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); + void ClearUserData(); + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); +}; + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +struct SvxThesaurusDialog_Impl +{ + SvxThesaurusDialog * m_pDialog; + + FixedImage aVendorImageFI; + ImageButton aLeftBtn; + FixedText aWordText; + LookUpComboBox_Impl aWordCB; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + ReplaceEdit_Impl aReplaceEdit; + FixedLine aFL; + HelpButton aHelpBtn; + MenuButton aLangMBtn; + OKButton aReplaceBtn; + CancelButton aCancelBtn; + + String aErrStr; + Image aVendorDefaultImage; + Image aVendorDefaultImageHC; + + uno::Reference< linguistic2::XThesaurus > xThesaurus; + OUString aLookUpText; + LanguageType nLookUpLanguage; + std::stack< OUString > aLookUpHistory; + bool m_bWordFound; + + + // Handler + DECL_LINK( LeftBtnHdl_Impl, Button * ); + DECL_LINK( LanguageHdl_Impl, MenuButton * ); + DECL_LINK( LookUpHdl_Impl, Button * ); + DECL_LINK( WordSelectHdl_Impl, ComboBox * ); + DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); + DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); + + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); + + + SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ); + ~SvxThesaurusDialog_Impl(); + + uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL + queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); + + bool UpdateAlternativesBox_Impl(); + void UpdateVendorImage(); + void LookUp( const String &rText ); + void LookUp_Impl(); +}; + +#endif + diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 00412e7bf400..1f441d728d63 100644..100755 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -100,6 +100,7 @@ #include "macroass.hxx" #include "acccfg.hxx" #include "insrc.hxx" +#include "passwdomdlg.hxx" #include "hyphen.hxx" #include "thesdlg.hxx" @@ -162,6 +163,7 @@ IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl); IMPL_ABSTDLG_BASE(AbstractLinksDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSpellDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxPostItDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl); ////////////////////////////////////////////////////////////////////////// // VclAbstractDialog2_Impl @@ -983,6 +985,19 @@ Window * AbstractSvxPostItDialog_Impl::GetWindow() return (Window *)pDlg; } +String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToOpen() const +{ + return pDlg->GetPasswordToOpen(); +} +String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToModify() const +{ + return pDlg->GetPasswordToModify(); +} +bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const +{ + return pDlg->IsRecommendToOpenReadonly(); +} + // Create dialogs with simplest interface VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( Window* pParent, sal_uInt32 nResId ) { @@ -1946,3 +1961,13 @@ SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Wind { return new SvxInsRowColDlg( pParent, bCol, sHelpId ); } + +AbstractPasswordToOpenModifyDialog * AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( + Window * pParent, + sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) +{ + PasswordToOpenModifyDialog * pDlg = new PasswordToOpenModifyDialog( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ); + return new AbstractPasswordToOpenModifyDialog_Impl( pDlg ); +} + + diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index d57057501fe0..ac875d6fe24c 100644..100755 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -589,6 +589,19 @@ private: }; //add for SvxPostItDialog end +//for PasswordToOpenModifyDialog begin +class PasswordToOpenModifyDialog; +class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenModifyDialog +{ + DECL_ABSTDLG_BASE( AbstractPasswordToOpenModifyDialog_Impl, PasswordToOpenModifyDialog ) + + virtual String GetPasswordToOpen() const; + virtual String GetPasswordToModify() const; + virtual bool IsRecommendToOpenReadonly() const; +}; +//for PasswordToOpenModifyDialog end + + //------------------------------------------------------------------------ //AbstractDialogFactory_Impl implementations class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory @@ -796,6 +809,8 @@ public: Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext ); virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, const rtl::OString& sHelpId ); + + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); }; #endif diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index a2deb5192389..8d233b71e890 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -50,6 +50,8 @@ #include <svtools/xtextedt.hxx> #include <editeng/SpellPortions.hxx> +#include <set> + class ScrollBar; class TextEngine; class ExtTextView; @@ -72,11 +74,12 @@ class SentenceEditWindow_Impl : public MultiLineEdit/*, public SfxListener*/ using MultiLineEdit::SetText; private: + std::set< USHORT > m_aIgnoreErrorsAt; USHORT m_nErrorStart; USHORT m_nErrorEnd; bool m_bIsUndoEditMode; - Link m_aModifyLink; + Link m_aModifyLink; void CallModifyLink() {m_aModifyLink.Call(this);} @@ -93,7 +96,7 @@ public: void SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd ); void SetText( const String& rStr ); - bool MarkNextError(); + bool MarkNextError( bool bIgnoreCurrentError ); void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage); void MoveErrorMarkTo(USHORT nErrorStart, USHORT nErrorEnd, bool bGrammar); String GetErrorText() const; @@ -121,6 +124,8 @@ public: void UndoActionEnd( USHORT nId ); void MoveErrorEnd(long nOffset); + + void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); } }; @@ -221,7 +226,7 @@ private: void InitUserDicts(); void UpdateBoxes_Impl(); void Init_Impl(); - void SpellContinue_Impl(bool UseSavedSentence = false); + void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false ); void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;} void Impl_Restore(); @@ -230,7 +235,7 @@ private: /** Retrieves the next sentence. */ - bool GetNextSentence_Impl(bool bUseSavedSentence); + bool GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the curretn sentence*/); /** Corrects all errors that have been selected to be changed always */ bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced); diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index e7cc7e1ca2f4..52549e934ecc 100644..100755 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -284,6 +284,9 @@ #define RID_SVXSTR_ARCHIVE_HEADLINE (RID_SVX_START + 485) #define RID_SVXSTR_MULTIFILE_DBL_ERR (RID_SVX_START + 486) +// password to open/modify dialog +#define RID_DLG_PASSWORD_TO_OPEN_MODIFY (RID_SVX_START + 500) + // multi path dialog #define RID_SVXDLG_MULTIPATH (RID_SVX_START + 201) #define RID_MULTIPATH_DBL_ERR (RID_SVX_START + 207) @@ -428,4 +431,12 @@ #define RID_SVXSTR_EVENT_FIELDMERGE_FINISHED (RID_SVX_START + 1188) #define RID_SVXSTR_EVENT_LAYOUT_FINISHED (RID_SVX_START + 1189) +// For now, keep new IDs unique only within cui. +// Later, cui should perhaps get an own range of IDs. +#define RID_SVXSTR_EVENT_SELECTIONCHANGED (RID_SVX_START + 1190) +#define RID_SVXSTR_EVENT_DOUBLECLICK (RID_SVX_START + 1191) +#define RID_SVXSTR_EVENT_RIGHTCLICK (RID_SVX_START + 1192) +#define RID_SVXSTR_EVENT_CALCULATE (RID_SVX_START + 1193) +#define RID_SVXSTR_EVENT_CONTENTCHANGED (RID_SVX_START + 1194) + #endif diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index 1a5bd8562f20..22a2b92f32bd 100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -376,5 +376,16 @@ #define HID_OFAPAGE_QUOTE_SW_CLB "CUI_HID_OFAPAGE_QUOTE_SW_CLB" #define HID_OFAPAGE_QUOTE_CLB "CUI_HID_OFAPAGE_QUOTE_CLB" #define HID_POSTIT_DIALOG "CUI_HID_POSTIT_DIALOG" +#define HID_CT_THES_ALTERNATIVES "CUI_HID_CT_THES_ALTERNATIVES" + +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY" +#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY" +#define HID_HYPERLINK_DIALOG "CUI_HID_HYPERLINK_DIALOG" + #endif diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx index 42ec38e31331..502b212c8a91 100644 --- a/cui/source/inc/hyphen.hxx +++ b/cui/source/inc/hyphen.hxx @@ -29,6 +29,8 @@ // include --------------------------------------------------------------- +#include <memory> + #include <vcl/edit.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> @@ -45,73 +47,24 @@ namespace linguistic2{ class SvxSpellWrapper; -// class SvxHyphenEdit --------------------------------------------------- - -class SvxHyphenEdit : public Edit -{ -public: - SvxHyphenEdit( Window* pParent, const ResId& rResId ); - -protected: - virtual void KeyInput( const KeyEvent &rKEvt ); -}; - // class SvxHyphenWordDialog --------------------------------------------- +struct SvxHyphenWordDialog_Impl; + class SvxHyphenWordDialog : public SfxModalDialog { + std::auto_ptr< SvxHyphenWordDialog_Impl > m_pImpl; + public: SvxHyphenWordDialog( const String &rWord, LanguageType nLang, Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > &xHyphen, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, SvxSpellWrapper* pWrapper ); + virtual ~SvxHyphenWordDialog(); + void SetWindowTitle( LanguageType nLang ); void SelLeft(); void SelRight(); - -private: - FixedText aWordFT; - SvxHyphenEdit aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aContBtn; - PushButton aDelBtn; - HelpButton aHelpBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > xHyphenator; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > xPossHyph; - String aActWord; // actual (to be displayed) word - LanguageType nActLanguage; // and language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Bool bBusy; - - void EnableLRBtn_Impl(); - void SetLabel_Impl( LanguageType nLang ); - String EraseUnusableHyphens_Impl( - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 nMaxHyphenationPos ); - - void InitControls_Impl(); - void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); - - DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); - DECL_LINK( ContinueHdl_Impl, Button* ); - DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); - DECL_LINK( GetFocusHdl_Impl, Edit* ); - DECL_LINK( LangError_Impl, void* ); }; diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx new file mode 100755 index 000000000000..337c9b84da11 --- /dev/null +++ b/cui/source/inc/passwdomdlg.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CUI_PASSWDOMDLG_HXX_ +#define _CUI_PASSWDOMDLG_HXX_ + + +#include <sfx2/basedlgs.hxx> + +#include <memory> + +////////////////////////////////////////////////////////////////////// + +struct PasswordToOpenModifyDialog_Impl; + +class PasswordToOpenModifyDialog : public SfxModalDialog +{ + std::auto_ptr< PasswordToOpenModifyDialog_Impl > m_pImpl; + + // disallow use of copy c-tor and assignment operator + PasswordToOpenModifyDialog( const PasswordToOpenModifyDialog & ); + PasswordToOpenModifyDialog & operator = ( const PasswordToOpenModifyDialog & ); + +public: + PasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, + sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */, + bool bIsPasswordToModify ); + virtual ~PasswordToOpenModifyDialog(); + + // AbstractPasswordToOpenModifyDialog + virtual String GetPasswordToOpen() const; + virtual String GetPasswordToModify() const; + virtual bool IsRecommendToOpenReadonly() const; +}; + +////////////////////////////////////////////////////////////////////// + +#endif + diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx index d46c2ce5affa..99b292b560a5 100644 --- a/cui/source/inc/thesdlg.hxx +++ b/cui/source/inc/thesdlg.hxx @@ -27,94 +27,34 @@ #ifndef _SVX_THESDLG_HXX #define _SVX_THESDLG_HXX -// include --------------------------------------------------------------- -#include <vcl/edit.hxx> -#include <vcl/button.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <svx/stddlg.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> -// forward --------------------------------------------------------------- +#include "svx/stddlg.hxx" +#include "svx/svxdllapi.h" -struct ThesDlg_Impl; +#include <memory> -class SvxThesaurusLanguageDlg_Impl; -namespace com { namespace sun { namespace star { - namespace linguistic2 { - class XThesaurus; - class XMeaning; - } - namespace lang { - struct Locale; - } -}}} +///////////////////////////////////////////////////////////////// -// class SvxThesaurusDialog ---------------------------------------------- +struct SvxThesaurusDialog_Impl; class SvxThesaurusDialog : public SvxStandardDialog { -public: - friend class SvxThesaurusLanguageDlg_Impl; + std::auto_ptr< SvxThesaurusDialog_Impl > m_pImpl; + + SVX_DLLPRIVATE virtual void Apply(); +public: SvxThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, + const String &rWord, LanguageType nLanguage ); ~SvxThesaurusDialog(); - String GetWord() { return aReplaceEdit.GetText(); } - + void SetWindowTitle( LanguageType nLanguage ); + String GetWord(); sal_uInt16 GetLanguage() const; - -private: - FixedText aWordText; - ListBox aWordLB; - FixedText aReplaceText; - Edit aReplaceEdit; - FixedText aMeanText; - ListBox aMeanLB; - FixedText aSynonymText; - ListBox aSynonymLB; - FixedLine aVarFL; - - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aLookUpBtn; - PushButton aLangBtn; - HelpButton aHelpBtn; - - String aErrStr; - - ThesDlg_Impl* pImpl; // always != NULL - - virtual void Apply(); - - void UpdateSynonymBox_Impl(); - void UpdateMeaningBox_Impl( - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XMeaning > > *pMeaningSeq = NULL ); - void Init_Impl(sal_Int16 nLanguage); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > - SAL_CALL queryMeanings_Impl( - ::rtl::OUString& rTerm, - const ::com::sun::star::lang::Locale& rLocale, - const ::com::sun::star::beans::PropertyValues& rProperties ) - throw(::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - // Handler - DECL_LINK( SelectHdl_Impl, ListBox * ); - DECL_LINK( SynonymHdl_Impl, ListBox * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( LanguageHdl_Impl, Button * ); - DECL_LINK( EntryHdl_Impl, ListBox * ); - DECL_LINK( SpellErrorHdl_Impl, void * ); }; #endif diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx index 1c4f12b6eb75..38b9897ad4e9 100644 --- a/cui/source/options/dbregisterednamesconfig.cxx +++ b/cui/source/options/dbregisterednamesconfig.cxx @@ -38,8 +38,9 @@ #include <comphelper/processfactory.hxx> #include <svl/eitem.hxx> #include <svl/itemset.hxx> -#include <tools/diagnose_ex.h> +#include <unotools/pathoptions.hxx> #include <unotools/confignode.hxx> +#include <tools/diagnose_ex.h> //........................................................................ namespace svx diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src index a9091926e3c2..35659dd71f5b 100644 --- a/cui/source/options/optfltr.src +++ b/cui/source/options/optfltr.src @@ -147,19 +147,19 @@ TabPage RID_OFAPAGE_MSFILTEROPT2 }; String ST_CHG_MATH { - Text [ en-US ] = "MathType to %PRODUCTNAME Math / %PRODUCTNAME Math to MathType"; + Text [ en-US ] = "MathType to %PRODUCTNAME Math or reverse"; }; String ST_CHG_WRITER { - Text [ en-US ] = "WinWord to %PRODUCTNAME Writer / %PRODUCTNAME Writer to WinWord"; + Text [ en-US ] = "WinWord to %PRODUCTNAME Writer or reverse"; }; String ST_CHG_CALC { - Text [ en-US ] = "Excel to %PRODUCTNAME Calc / %PRODUCTNAME Calc to Excel"; + Text [ en-US ] = "Excel to %PRODUCTNAME Calc or reverse"; }; String ST_CHG_IMPRESS { - Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress / %PRODUCTNAME Impress to PowerPoint"; + Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress or reverse"; }; }; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 685fa024fa62..b360a5cedfde 100644..100755 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -1329,17 +1329,10 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet ,maMacroSecFL ( this, CUI_RES( FL_SEC_MACROSEC ) ) ,maMacroSecFI ( this, CUI_RES( FI_SEC_MACROSEC ) ) ,maMacroSecPB ( this, CUI_RES( PB_SEC_MACROSEC ) ) - ,maFilesharingFL ( this, CUI_RES( FL_SEC_FILESHARING ) ) - ,maRecommReadOnlyCB ( this, CUI_RES( CB_SEC_RECOMMREADONLY ) ) - ,maRecordChangesCB ( this, CUI_RES( CB_SEC_RECORDCHANGES ) ) - ,maProtectRecordsPB ( this, CUI_RES( PB_SEC_PROTRECORDS ) ) ,mpSecOptions ( new SvtSecurityOptions ) ,mpSecOptDlg ( NULL ) - ,meRedlingMode ( RL_NONE ) - ,msProtectRecordsStr( CUI_RES( STR_SEC_PROTRECORDS ) ) - ,msUnprotectRecordsStr( CUI_RES( STR_SEC_UNPROTRECORDS ) ) ,msPasswordStoringDeactivateStr( CUI_RES( STR_SEC_NOPASSWDSAVE ) ) { @@ -1353,8 +1346,6 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) ); maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) ); maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) ); - maProtectRecordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ProtectRecordsPBHdl ) ); - maRecordChangesCB.SetClickHdl( LINK( this, SvxSecurityTabPage, RecordChangesCBHdl ) ); ActivatePage( rSet ); } @@ -1524,127 +1515,6 @@ IMPL_LINK( SvxSecurityTabPage, MacroSecPBHdl, void*, EMPTYARG ) return 0; } -namespace -{ - enum RedlineFunc { RF_ON, RF_PROTECT }; - - const SfxBoolItem* ExecuteRecordChangesFunc( SvxSecurityTabPage::RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) - { - const SfxBoolItem* pRet = NULL; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot; - if ( _eMode == SvxSecurityTabPage::RL_WRITER ) - nSlot = ( _eFunc == RF_ON )? FN_REDLINE_ON : FN_REDLINE_PROTECT; - else - nSlot = ( _eFunc == RF_ON )? FID_CHG_RECORD : SID_CHG_PROTECT; - - // execute - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - bool bNeedItem = ( _eMode == SvxSecurityTabPage::RL_WRITER || _eFunc != RF_ON ); - SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if ( _pParent ) - { - OfaPtrItem aParentItem( SID_ATTR_PARENTWINDOW, _pParent ); - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); - } - else - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); - delete pItem; - } - } - - return pRet; - } - - bool QueryState( USHORT _nSlot, bool& _rValue ) - { - bool bRet = false; - - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - const SfxPoolItem* pItem; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); - if( bRet ) - _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); - } - - return bRet; - } - - bool QueryRecordChangesProtectionState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue ) - { - bool bRet = false; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_PROTECT : SID_CHG_PROTECT; - bRet = QueryState( nSlot, _rValue ); - } - - return bRet; - } - - bool QueryRecordChangesState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue ) - { - bool bRet = false; - - if( _eMode != SvxSecurityTabPage::RL_NONE ) - { - USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_ON : FID_CHG_RECORD; - bRet = QueryState( nSlot, _rValue ); - } - - return bRet; - } -} - -IMPL_LINK( SvxSecurityTabPage, RecordChangesCBHdl, void*, EMPTYARG ) -{ - ExecuteRecordChangesFunc( meRedlingMode, RF_ON, maRecordChangesCB.IsChecked(), this ); - CheckRecordChangesState(); - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, ProtectRecordsPBHdl, void*, EMPTYARG ) -{ - bool bProt; - QueryRecordChangesProtectionState( meRedlingMode, bProt ); - ExecuteRecordChangesFunc( meRedlingMode, RF_PROTECT, !bProt, this ); - CheckRecordChangesState(); - - if ( QueryRecordChangesProtectionState( meRedlingMode, bProt ) ) - { - // RecordChangesCB is enabled if protection is off - maRecordChangesCB.Enable( !bProt ); - // toggle text of button "Protect" <-> "Unprotect" - String sNewText = bProt ? msUnprotectRecordsStr : msProtectRecordsStr; - maProtectRecordsPB.SetText( sNewText ); - } - return 0; -} - -void SvxSecurityTabPage::CheckRecordChangesState( void ) -{ - bool bVal; - if( QueryRecordChangesState( meRedlingMode, bVal ) ) - { - maRecordChangesCB.Enable(); - maRecordChangesCB.Check( bVal ); - } - else - maRecordChangesCB.Disable(); // because now we don't know the state! - - maProtectRecordsPB.Enable( QueryRecordChangesProtectionState( meRedlingMode, bVal ) ); -} void SvxSecurityTabPage::InitControls() { @@ -1661,30 +1531,13 @@ void SvxSecurityTabPage::InitControls() maMacroSecFL.Hide(); maMacroSecFI.Hide(); maMacroSecPB.Hide(); - - // rearrange the following controls - Point aNewPos = maFilesharingFL.GetPosPixel(); - long nDelta = aNewPos.Y() - maMacroSecFL.GetPosPixel().Y(); - - Window* pWins[] = - { - &maFilesharingFL, &maRecommReadOnlyCB, &maRecordChangesCB, &maProtectRecordsPB - }; - Window** pCurrent = pWins; - const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] ); - for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent ) - { - aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } } // one button too small for its text? sal_Int32 i = 0; long nBtnTextWidth = 0; Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB, - &maShowConnectionsPB, &maMacroSecPB, &maProtectRecordsPB }; + &maShowConnectionsPB, &maMacroSecPB }; Window** pButton = pButtons; const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] ); for ( ; i < nBCount; ++i, ++pButton ) @@ -1724,8 +1577,7 @@ void SvxSecurityTabPage::InitControls() } Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB, - &maMasterPasswordFI, &maMacroSecFI, - &maRecommReadOnlyCB, &maRecordChangesCB }; + &maMasterPasswordFI, &maMacroSecFI }; Window** pControl = pControls; const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[ 0 ] ); for ( i = 0; i < nCCount; ++i, ++pControl ) @@ -1844,15 +1696,6 @@ BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& ) CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); } - // document options - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - if( pCurDocShell ) - { - if( pCurDocShell->HasSecurityOptOpenReadOnly() ) - pCurDocShell->SetSecurityOptOpenReadOnly( maRecommReadOnlyCB.IsChecked() ); - - } - return bModified; } @@ -1860,65 +1703,10 @@ BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& ) void SvxSecurityTabPage::Reset( const SfxItemSet& ) { - String sNewText = msProtectRecordsStr; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); if( pCurDocShell ) { - bool bIsHTMLDoc = false; - SfxViewShell* pViewSh = SfxViewShell::Current(); - if( pViewSh ) - { - const SfxPoolItem* pItem; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if ( SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem ) ) - { - USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); - bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 ); - } - } - - sal_Bool bIsReadonly = pCurDocShell->IsReadOnly(); - if( pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc ) - { - maRecommReadOnlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() ); - maRecommReadOnlyCB.Enable( !bIsReadonly ); - } - else - maRecommReadOnlyCB.Disable(); - - bool bVal; - if ( QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc ) - meRedlingMode = RL_WRITER; - else if( QueryRecordChangesState( RL_CALC, bVal ) ) - meRedlingMode = RL_CALC; - else - meRedlingMode = RL_NONE; - - if ( meRedlingMode != RL_NONE ) - { - maRecordChangesCB.Check( bVal ); - maRecordChangesCB.Enable( !bVal && !bIsReadonly ); - maProtectRecordsPB.Enable( - QueryRecordChangesProtectionState( meRedlingMode, bVal ) && !bIsReadonly ); - // set the right text - if ( bVal ) - sNewText = msUnprotectRecordsStr; - } - else - { - // only Writer and Calc support redlining - maRecordChangesCB.Disable(); - maProtectRecordsPB.Disable(); - } } - else - { // no doc -> hide document settings - maRecommReadOnlyCB.Disable(); - maRecordChangesCB.Disable(); - maProtectRecordsPB.Disable(); - } - - maProtectRecordsPB.SetText( sNewText ); } //added by jmeng begin diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc index 09de829ae132..1bd09225ac9b 100644..100755 --- a/cui/source/options/optinet2.hrc +++ b/cui/source/options/optinet2.hrc @@ -116,13 +116,7 @@ #define FL_SEC_MACROSEC 19 #define FI_SEC_MACROSEC 20 #define PB_SEC_MACROSEC 21 -#define FL_SEC_FILESHARING 22 -#define CB_SEC_RECOMMREADONLY 23 -#define CB_SEC_RECORDCHANGES 24 -#define PB_SEC_PROTRECORDS 25 -#define STR_SEC_PROTRECORDS 10 -#define STR_SEC_UNPROTRECORDS 11 #define STR_SEC_NOPASSWDSAVE 12 #define TP_WIDTH 260 diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index 588549787d99..f75ff7d05c44 100644..100755 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -232,8 +232,6 @@ class SvxSecurityTabPage : public SfxTabPage { using TabPage::ActivatePage; using TabPage::DeactivatePage; -public: - enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; private: FixedLine maSecurityOptionsFL; @@ -251,17 +249,10 @@ private: FixedInfo maMacroSecFI; PushButton maMacroSecPB; - FixedLine maFilesharingFL; - CheckBox maRecommReadOnlyCB; - CheckBox maRecordChangesCB; - PushButton maProtectRecordsPB; SvtSecurityOptions* mpSecOptions; svx::SecurityOptionsDialog* mpSecOptDlg; - RedliningMode meRedlingMode; - String msProtectRecordsStr; - String msUnprotectRecordsStr; String msPasswordStoringDeactivateStr; DECL_LINK( SecurityOptionsHdl, PushButton* ); @@ -270,10 +261,7 @@ private: DECL_LINK( MasterPasswordCBHdl, void* ); DECL_LINK( ShowPasswordsHdl, PushButton* ); DECL_LINK( MacroSecPBHdl, void* ); - DECL_LINK( RecordChangesCBHdl, void* ); - DECL_LINK( ProtectRecordsPBHdl, void* ); - void CheckRecordChangesState( void ); void InitControls(); SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet ); diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src index 2b2829d9f2e5..9023dfa52394 100644..100755 --- a/cui/source/options/optinet2.src +++ b/cui/source/options/optinet2.src @@ -507,37 +507,6 @@ TabPage RID_SVXPAGE_INET_SECURITY Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); Text [ en-US ] = "Macro Security..."; }; - FixedLine FL_SEC_FILESHARING - { - Pos = MAP_APPFONT( COL_0, ROW_7 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "File sharing options for this document"; - }; - CheckBox CB_SEC_RECOMMREADONLY - { - Pos = MAP_APPFONT( COL_1, ROW_8 ); - Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Open this document in read-only mode"; - }; - CheckBox CB_SEC_RECORDCHANGES - { - Pos = MAP_APPFONT( COL_1, ROW_9 ); - Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Record changes"; - }; - PushButton PB_SEC_PROTRECORDS - { - Pos = MAP_APPFONT( COL_3, ROW_9-2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - }; - String STR_SEC_PROTRECORDS - { - Text [ en-US ] = "Protect..."; - }; - String STR_SEC_UNPROTRECORDS - { - Text [ en-US ] = "Unprotect..."; - }; String STR_SEC_NOPASSWDSAVE { Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?"; diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index b63d9afc647e..880f8d263c6b 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1830,7 +1830,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) while ( _pViewFrame ) { _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - _pViewFrame = SfxViewFrame::GetNext( *pViewFrame ); + _pViewFrame = SfxViewFrame::GetNext( *_pViewFrame ); } } } diff --git a/cui/util/hidother.src b/cui/util/hidother.src index ddce17eebb23..258d6404f19a 100644 --- a/cui/util/hidother.src +++ b/cui/util/hidother.src @@ -127,6 +127,7 @@ hidspecial HID_HANGULDLG_EDIT_NEWWORD { HelpID = HID_HANGULDLG_EDIT_NEWWO hidspecial HID_HANGULDLG_SUGGESTIONS { HelpId = HID_HANGULDLG_SUGGESTIONS; }; hidspecial HID_HANGULDLG_SUGGESTIONS_GRID { HelpId = HID_HANGULDLG_SUGGESTIONS_GRID; }; hidspecial HID_HANGULDLG_SUGGESTIONS_LIST { HelpId = HID_HANGULDLG_SUGGESTIONS_LIST; }; +hidspecial HID_HYPERLINK_DIALOG { HelpID = HID_HYPERLINK_DIALOG ;}; hidspecial HID_HYPERDLG_DOC_PATH { HelpID = HID_HYPERDLG_DOC_PATH ;}; hidspecial HID_HYPERDLG_INET_PATH { HelpID = HID_HYPERDLG_INET_PATH ;}; hidspecial HID_HYPERDLG_MAIL_PATH { HelpID = HID_HYPERDLG_MAIL_PATH ;}; @@ -199,4 +200,5 @@ hidspecial HID_WARN_NAME_DUPLICATE { HelpID = HID_WARN_NAME_DUPLICA hidspecial UID_OFA_CONNPOOL_DRIVERLIST_BACK { HelpId = UID_OFA_CONNPOOL_DRIVERLIST_BACK; }; hidspecial UID_SEARCH_RECORDSTATUS { HelpID = UID_SEARCH_RECORDSTATUS ;}; hidspecial HID_MACRO_HEADERTABLISTBOX { HelpID = HID_MACRO_HEADERTABLISTBOX ;}; +hidspecial HID_DLG_PASSWORD_TO_OPEN_MODIFY { HelpID = HID_DLG_PASSWORD_TO_OPEN_MODIFY ;}; diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst index 0885b3021c61..1489e2a4e0e4 100644 --- a/extensions/prj/build.lst +++ b/extensions/prj/build.lst @@ -34,4 +34,3 @@ ex extensions\source\update\feed nmake - all ex_updchkfeed ex ex extensions\source\update\check nmake - all ex_updchk ex_inc NULL ex extensions\source\update\ui nmake - all ex_updchkui ex_inc NULL ex extensions\util nmake - all ex_util ex_preload ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil ex_oooimprovecore NULL -ex extensions\qa\unoapi nmake - all ex_qa_unoapi NULL diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index d633b597878d..2ffeb0d09739 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -141,12 +141,12 @@ namespace abp } //--------------------------------------------------------------------- - sal_Bool FinalPage::commitPage( CommitPageReason _eReason ) + sal_Bool FinalPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) return sal_False; - if ( ( eTravelBackward != _eReason ) + if ( ( ::svt::WizardTypes::eTravelBackward != _eReason ) && ( !m_aLocationController.prepareCommit() ) ) return sal_False; diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index 415bc31f2bc1..27d6522d7df6 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -66,7 +66,7 @@ namespace abp protected: // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); // TabDialog overridables virtual void ActivatePage(); diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index b315893b6447..d8007873a2c4 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -213,14 +213,11 @@ namespace abp } //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::onFinish(sal_Int32 _nResult) + sal_Bool OAddessBookSourcePilot::onFinish() { - if (!OAddessBookSourcePilot_Base::onFinish(_nResult)) + if ( !OAddessBookSourcePilot_Base::onFinish() ) return sal_False; - if (RET_OK != _nResult) - return sal_True; - implCommitAll(); addressconfig::markPilotSuccess( getORB() ); @@ -283,9 +280,7 @@ namespace abp if ( aTables.empty() ) { - if ( ( _eReason == eValidateNoUI ) - || ( RET_YES != QueryBox( this, ModuleRes( RID_QRY_NOTABLES ) ).Execute() ) - ) + if ( RET_YES != QueryBox( this, ModuleRes( RID_QRY_NOTABLES ) ).Execute() ) { // cannot ask the user, or the user chose to use this data source, though there are no tables bAllow = sal_False; diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx index b0f3b900871b..0abdacd0281d 100644 --- a/extensions/source/abpilot/abspilot.hxx +++ b/extensions/source/abpilot/abspilot.hxx @@ -79,7 +79,7 @@ namespace abp virtual ::svt::OWizardPage* createPage( WizardState _nState ); virtual void enterState( WizardState _nState ); virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); - virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual sal_Bool onFinish(); // RoadmapWizard virtual String getStateDisplayName( WizardState _nState ) const; diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 07bca1490e35..178948ae0d3a 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -347,25 +347,6 @@ namespace abp //= ODataSource //===================================================================== //--------------------------------------------------------------------- - ODataSource::ODataSource( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName ) - :m_pImpl(new ODataSourceImpl(_rxORB)) - { - try - { - // get the data source context - Reference< XNameAccess > xContext = lcl_getDataSourceContext( m_pImpl->xORB ); - - // retrieve the UNO data source - if (xContext.is()) - xContext->getByName( _rName ) >>= m_pImpl->xDataSource; - } - catch(const Exception&) - { - DBG_ERROR("ODataSource::ODataSource: could not access the requested data source (caught an exception)!"); - } - } - - //--------------------------------------------------------------------- ODataSource::ODataSource( const ODataSource& _rSource ) :m_pImpl( NULL ) { diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx index bcd4e64fd885..54819b9b9628 100644 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ b/extensions/source/abpilot/datasourcehandling.hxx @@ -125,17 +125,6 @@ namespace abp // ---------------------------------------------------------------- // - ctor/dtor/assignment // ---------------------------------------------------------------- - /** ctor - @param _rxORB - the service factory to use to access the UNO objects - @param _rName - the name of the data source the object should represent - */ - ODataSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rName - ); - /// constructs an object which is initially invalid ODataSource( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB diff --git a/extensions/source/abpilot/tableselectionpage.cxx b/extensions/source/abpilot/tableselectionpage.cxx index 0cefba92ab5a..869c806ea819 100644 --- a/extensions/source/abpilot/tableselectionpage.cxx +++ b/extensions/source/abpilot/tableselectionpage.cxx @@ -109,7 +109,7 @@ namespace abp } //--------------------------------------------------------------------- - sal_Bool TableSelectionPage::commitPage( CommitPageReason _eReason ) + sal_Bool TableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) return sal_False; diff --git a/extensions/source/abpilot/tableselectionpage.hxx b/extensions/source/abpilot/tableselectionpage.hxx index 36bc792fd0e7..d2d878c65d5f 100644 --- a/extensions/source/abpilot/tableselectionpage.hxx +++ b/extensions/source/abpilot/tableselectionpage.hxx @@ -51,7 +51,7 @@ namespace abp protected: // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); // TabDialog overridables virtual void ActivatePage(); diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index 6188b7d21628..fd83630e81d9 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -207,18 +207,15 @@ namespace abp } //--------------------------------------------------------------------- - sal_Bool TypeSelectionPage::commitPage( CommitPageReason _eReason ) + sal_Bool TypeSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) return sal_False; if (AST_INVALID == getSelectedType( )) { - if ( _eReason != eValidateNoUI ) - { - ErrorBox aError(this, ModuleRes(RID_ERR_NEEDTYPESELECTION)); - aError.Execute(); - } + ErrorBox aError(this, ModuleRes(RID_ERR_NEEDTYPESELECTION)); + aError.Execute(); return sal_False; } diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx index 18c8d6b9697d..9df17bb1d77f 100644 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ b/extensions/source/abpilot/typeselectionpage.hxx @@ -83,7 +83,7 @@ namespace abp protected: // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); // TabDialog overridables virtual void ActivatePage(); diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx index 7b58c8de8560..88d8e2eb352e 100644 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ b/extensions/source/dbpilots/commonpagesdbp.cxx @@ -164,7 +164,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OTableSelectionPage::commitPage( CommitPageReason _eReason ) + sal_Bool OTableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OControlWizardPage::commitPage(_eReason)) return sal_False; @@ -493,7 +493,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool ODBFieldPage::commitPage( CommitPageReason _eReason ) + sal_Bool ODBFieldPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OMaybeListSelectionPage::commitPage(_eReason)) return sal_False; diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx index 3cbe1ac2b514..a20587b36d72 100644 --- a/extensions/source/dbpilots/commonpagesdbp.hxx +++ b/extensions/source/dbpilots/commonpagesdbp.hxx @@ -64,7 +64,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); protected: DECL_LINK( OnListboxSelection, ListBox* ); @@ -131,7 +131,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); // own overridables virtual String& getDBFieldSetting() = 0; diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index b97eb60504b4..c5d816486ecc 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -156,7 +156,7 @@ namespace dbp _rList.Clear(); const ::rtl::OUString* pItems = _rItems.getConstArray(); const ::rtl::OUString* pEnd = pItems + _rItems.getLength(); - WizardState nPos; + ::svt::WizardTypes::WizardState nPos; sal_Int32 nIndex = 0; for (;pItems < pEnd; ++pItems, ++nIndex) { @@ -172,7 +172,7 @@ namespace dbp _rList.Clear(); const ::rtl::OUString* pItems = _rItems.getConstArray(); const ::rtl::OUString* pEnd = pItems + _rItems.getLength(); - WizardState nPos; + ::svt::WizardTypes::WizardState nPos; sal_Int32 nIndex = 0; for (;pItems < pEnd; ++pItems) { @@ -254,7 +254,7 @@ namespace dbp m_pFormDatasource->SetText(sDataSource); m_pFormTable->SetText(sCommand); - WizardState nCommandTypeResourceId = 0; + ::svt::WizardTypes::WizardState nCommandTypeResourceId = 0; switch (nCommandType) { case CommandType::TABLE: diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 6e28567aef62..7606fc7bec65 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -33,6 +33,7 @@ #include <comphelper/stl_types.hxx> #include <tools/string.hxx> #include <com/sun/star/form/XGridColumnFactory.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <tools/debug.hxx> #include "dbptools.hxx" @@ -52,6 +53,7 @@ namespace dbp using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::form; + using namespace ::com::sun::star::awt; using namespace ::svt; //===================================================================== @@ -111,6 +113,7 @@ namespace dbp static const ::rtl::OUString s_sDataFieldProperty = ::rtl::OUString::createFromAscii("DataField"); static const ::rtl::OUString s_sLabelProperty = ::rtl::OUString::createFromAscii("Label"); static const ::rtl::OUString s_sWidthProperty = ::rtl::OUString::createFromAscii("Width"); + static const ::rtl::OUString s_sMouseWheelBehavior = ::rtl::OUString::createFromAscii("MouseWheelBehavior"); static const ::rtl::OUString s_sEmptyString; // collect "descriptors" for the to-be-created (grid)columns @@ -202,23 +205,24 @@ namespace dbp // create a (grid)column for the (resultset)column try { - Reference< XPropertySet > xColumn = xColumnFactory->createColumn(*pColumnServiceName); + Reference< XPropertySet > xColumn( xColumnFactory->createColumn(*pColumnServiceName), UNO_SET_THROW ); + Reference< XPropertySetInfo > xColumnPSI( xColumn->getPropertySetInfo(), UNO_SET_THROW ); ::rtl::OUString sColumnName(*pColumnServiceName); disambiguateName(xExistenceChecker, sColumnName); - if (xColumn.is()) - { - // the data field the column should be bound to - xColumn->setPropertyValue(s_sDataFieldProperty, makeAny(*pFormFieldName)); - // the label - xColumn->setPropertyValue(s_sLabelProperty, makeAny(::rtl::OUString(*pFormFieldName) += *pColumnLabelPostfix)); - // the width (<void/> => column will be auto-sized) - xColumn->setPropertyValue(s_sWidthProperty, Any()); - - // insert the column - xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); - } + // the data field the column should be bound to + xColumn->setPropertyValue(s_sDataFieldProperty, makeAny(*pFormFieldName)); + // the label + xColumn->setPropertyValue(s_sLabelProperty, makeAny(::rtl::OUString(*pFormFieldName) += *pColumnLabelPostfix)); + // the width (<void/> => column will be auto-sized) + xColumn->setPropertyValue(s_sWidthProperty, Any()); + + if ( xColumnPSI->hasPropertyByName( s_sMouseWheelBehavior ) ) + xColumn->setPropertyValue( s_sMouseWheelBehavior, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); + + // insert the column + xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); } catch(Exception&) { @@ -285,9 +289,9 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OGridWizard::onFinish(sal_Int32 _nResult) + sal_Bool OGridWizard::onFinish() { - if (!OControlWizard::onFinish(_nResult)) + if ( !OControlWizard::onFinish() ) return sal_False; implApplySettings(); @@ -362,7 +366,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OGridFieldsSelection::commitPage( CommitPageReason _eReason ) + sal_Bool OGridFieldsSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OGridPage::commitPage(_eReason)) return sal_False; diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx index d0f255ede729..85b91d274345 100644 --- a/extensions/source/dbpilots/gridwizard.hxx +++ b/extensions/source/dbpilots/gridwizard.hxx @@ -68,8 +68,7 @@ namespace dbp virtual WizardState determineNextState( WizardState _nCurrentState ) const; virtual void enterState( WizardState _nState ); virtual sal_Bool leaveState( WizardState _nState ); - - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); virtual sal_Bool approveControl(sal_Int16 _nClassId); @@ -114,7 +113,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; protected: diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index 7bf3138bf5fe..9956cfe86428 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -79,7 +79,7 @@ namespace dbp } //--------------------------------------------------------------------- - OWizardPage* OGroupBoxWizard::createPage(WizardState _nState) + OWizardPage* OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState) { switch (_nState) { @@ -106,7 +106,7 @@ namespace dbp } //--------------------------------------------------------------------- - WizardTypes::WizardState OGroupBoxWizard::determineNextState( WizardState _nCurrentState ) const + WizardTypes::WizardState OGroupBoxWizard::determineNextState( ::svt::WizardTypes::WizardState _nCurrentState ) const { switch (_nCurrentState) { @@ -133,7 +133,7 @@ namespace dbp } //--------------------------------------------------------------------- - void OGroupBoxWizard::enterState(WizardState _nState) + void OGroupBoxWizard::enterState(::svt::WizardTypes::WizardState _nState) { // some stuff to do before calling the base class (modifying our settings) switch (_nState) @@ -187,18 +187,15 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OGroupBoxWizard::onFinish(sal_Int32 _nResult) + sal_Bool OGroupBoxWizard::onFinish() { - if (RET_OK != _nResult) - return OControlWizard::onFinish(_nResult); - // commit the basic control setttings commitControlSettings(&m_aSettings); // create the radio buttons createRadios(); - return OControlWizard::onFinish(_nResult); + return OControlWizard::onFinish(); } //===================================================================== @@ -265,7 +262,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool ORadioSelectionPage::commitPage( CommitPageReason _eReason ) + sal_Bool ORadioSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OGBWPage::commitPage(_eReason)) return sal_False; @@ -277,7 +274,7 @@ namespace dbp rSettings.aValues.clear(); rSettings.aLabels.reserve(m_aExistingRadios.GetEntryCount()); rSettings.aValues.reserve(m_aExistingRadios.GetEntryCount()); - for (WizardState i=0; i<m_aExistingRadios.GetEntryCount(); ++i) + for (::svt::WizardTypes::WizardState i=0; i<m_aExistingRadios.GetEntryCount(); ++i) { rSettings.aLabels.push_back(m_aExistingRadios.GetEntry(i)); rSettings.aValues.push_back(String::CreateFromInt32((sal_Int32)(i + 1))); @@ -393,7 +390,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool ODefaultFieldSelectionPage::commitPage( CommitPageReason _eReason ) + sal_Bool ODefaultFieldSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OMaybeListSelectionPage::commitPage(_eReason)) return sal_False; @@ -416,7 +413,7 @@ namespace dbp ,m_aValue (this, ModuleRes(ET_OPTIONVALUE)) ,m_aOptionsLabel (this, ModuleRes(FT_RADIOBUTTONS)) ,m_aOptions (this, ModuleRes(LB_RADIOBUTTONS)) - ,m_nLastSelection((WizardState)-1) + ,m_nLastSelection((::svt::WizardTypes::WizardState)-1) { FreeResource(); @@ -440,7 +437,7 @@ namespace dbp //--------------------------------------------------------------------- void OOptionValuesPage::implTraveledOptions() { - if ((WizardState)-1 != m_nLastSelection) + if ((::svt::WizardTypes::WizardState)-1 != m_nLastSelection) { // save the value for the last option DBG_ASSERT((size_t)m_nLastSelection < m_aUncommittedValues.size(), "OOptionValuesPage::implTraveledOptions: invalid previous selection index!"); @@ -480,7 +477,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OOptionValuesPage::commitPage( CommitPageReason _eReason ) + sal_Bool OOptionValuesPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OGBWPage::commitPage(_eReason)) return sal_False; @@ -548,7 +545,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OFinalizeGBWPage::commitPage( CommitPageReason _eReason ) + sal_Bool OFinalizeGBWPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OGBWPage::commitPage(_eReason)) return sal_False; diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx index 97a2cd1a3109..de0f9767f3a4 100644 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ b/extensions/source/dbpilots/groupboxwiz.hxx @@ -73,8 +73,7 @@ namespace dbp virtual ::svt::OWizardPage* createPage( WizardState _nState ); virtual WizardState determineNextState( WizardState _nCurrentState ) const; virtual void enterState( WizardState _nState ); - - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); virtual sal_Bool approveControl(sal_Int16 _nClassId); @@ -117,7 +116,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; DECL_LINK( OnMoveEntry, PushButton* ); @@ -145,7 +144,7 @@ namespace dbp protected: // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); } }; @@ -164,7 +163,8 @@ namespace dbp ListBox m_aOptions; StringArray m_aUncommittedValues; - WizardState m_nLastSelection; + ::svt::WizardTypes::WizardState + m_nLastSelection; public: OOptionValuesPage( OControlWizard* _pParent ); @@ -175,7 +175,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); void implTraveledOptions(); @@ -217,7 +217,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; }; diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index 2e810654baa4..bf3f56781d63 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -226,14 +226,11 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OListComboWizard::onFinish(sal_Int32 _nResult) + sal_Bool OListComboWizard::onFinish() { - if (!OControlWizard::onFinish(_nResult)) + if ( !OControlWizard::onFinish() ) return sal_False; - if (RET_OK != _nResult) - return sal_True; - implApplySettings(); return sal_True; } @@ -362,14 +359,14 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OContentTableSelection::commitPage( CommitPageReason _eReason ) + sal_Bool OContentTableSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OLCPage::commitPage(_eReason)) return sal_False; OListComboSettings& rSettings = getSettings(); rSettings.sListContentTable = m_aSelectTable.GetSelectEntry(); - if (!rSettings.sListContentTable.Len() && (eTravelBackward != _eReason)) + if (!rSettings.sListContentTable.Len() && (::svt::WizardTypes::eTravelBackward != _eReason)) // need to select a table return sal_False; @@ -440,7 +437,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OContentFieldSelection::commitPage( CommitPageReason _eReason ) + sal_Bool OContentFieldSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OLCPage::commitPage(_eReason)) return sal_False; @@ -518,7 +515,7 @@ namespace dbp } //--------------------------------------------------------------------- - sal_Bool OLinkFieldsPage::commitPage( CommitPageReason _eReason ) + sal_Bool OLinkFieldsPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) { if (!OLCPage::commitPage(_eReason)) return sal_False; diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx index 7dcf32316236..05f7f70ea65d 100644 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ b/extensions/source/dbpilots/listcombowizard.hxx @@ -80,8 +80,7 @@ namespace dbp virtual WizardState determineNextState( WizardState _nCurrentState ) const; virtual void enterState( WizardState _nState ); virtual sal_Bool leaveState( WizardState _nState ); - - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); virtual sal_Bool approveControl(sal_Int16 _nClassId); @@ -129,7 +128,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; protected: @@ -163,7 +162,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; }; @@ -190,7 +189,7 @@ namespace dbp // OWizardPage overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); + virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); virtual bool canAdvance() const; private: diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx index 4cce0f98cd4f..5e86da9726b9 100644 --- a/extensions/source/nsplugin/source/so_env.cxx +++ b/extensions/source/nsplugin/source/so_env.cxx @@ -340,27 +340,6 @@ const char* findProgramDir() return sProgram; } -// Return: "/home/build/staroffice/program" + original system library path -const char* getNewLibraryPath() -{ - static char pLPATH[NPP_PATH_MAX*4] = {0}; - - if (!pLPATH[0]) - { - const char* pProgram = findProgramDir(); - strcpy(pLPATH, "LD_LIBRARY_PATH="); - strcat(pLPATH, pProgram); - - char* pLD = getenv("LD_LIBRARY_PATH"); - if (pLD) - { - strcat(pLPATH, ":"); - strcat(pLPATH, pLD); - } - } - return pLPATH; -} - #ifdef WNT // Return SO executable absolute path, like "/home/build/staroffice/program/soffice" const char* findSofficeExecutable() diff --git a/extensions/source/nsplugin/source/so_env.hxx b/extensions/source/nsplugin/source/so_env.hxx index a4e98a878f2a..0cf1194c2dc2 100644 --- a/extensions/source/nsplugin/source/so_env.hxx +++ b/extensions/source/nsplugin/source/so_env.hxx @@ -69,9 +69,6 @@ // return the install path of staroffice, return value like "/home/build/staroffice" const char* findInstallDir(); -// return original system library path + "/home/build/staroffice/program" -const char* getNewLibraryPath(); - // return SO program dir absolute path, like "/home/build/staroffice/program" const char* findProgramDir(); diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx index 65e511dfcc35..4b1e41f724bd 100644 --- a/extensions/source/nsplugin/source/so_instance.cxx +++ b/extensions/source/nsplugin/source/so_instance.cxx @@ -366,14 +366,6 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent) return sal_True; } -sal_Bool SoPluginInstance::SetSODir(char * sDir) -{ - if(strlen(sDir) >= NPP_PATH_MAX) return sal_False; - - strcpy(sSO_Dir, sDir); - return sal_True; -} - sal_Bool SoPluginInstance::SetWindow(NSP_HWND hParent, int x, int y, int w, int h) { sal_Bool bRetval(sal_True); diff --git a/extensions/source/nsplugin/source/so_instance.hxx b/extensions/source/nsplugin/source/so_instance.hxx index 17266fcefc71..e95bb7c024ec 100644 --- a/extensions/source/nsplugin/source/so_instance.hxx +++ b/extensions/source/nsplugin/source/so_instance.hxx @@ -103,7 +103,6 @@ public: virtual sal_Bool Print(void) ; static sal_Bool ShutDown(void); - static sal_Bool SetSODir(char * sDir); static char* GetSODir(void) {return sSO_Dir;}; long GetParent(void) {return m_pParent;}; }; diff --git a/extensions/source/nsplugin/source/so_main.cxx b/extensions/source/nsplugin/source/so_main.cxx index c60da777689a..49c899994424 100644 --- a/extensions/source/nsplugin/source/so_main.cxx +++ b/extensions/source/nsplugin/source/so_main.cxx @@ -148,16 +148,6 @@ sal_Bool dump_plugin_message(PLUGIN_MSG* pMsg) return sal_True; } -int prepareEnviron() -{ - // if child process inherit the chdir() property from parent process, if yes, no getNewLibraryPath() needed - const char* pNewLibraryPath = getNewLibraryPath(); - putenv( (char*) pNewLibraryPath ); - SoPluginInstance::SetSODir((char *)findProgramDir()); - - return 0; -} - int Set_Window(PLUGIN_MSG* pMsg) { dump_plugin_message(pMsg); diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index b678f15515a7..e67e466c5d24 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -320,12 +320,6 @@ namespace pcr } //------------------------------------------------------------------ - sal_Bool OBrowserLine::IsPropertyInputEnabled( ) const - { - return ( m_nEnableFlags & PropertyLineElement::InputControl ) != 0; - } - - //------------------------------------------------------------------ void OBrowserLine::SetReadOnly( bool _bReadOnly ) { if ( m_bReadOnly != _bReadOnly ) diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index 565f2516fbe2..ac65993c0e12 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -115,7 +115,6 @@ namespace pcr void EnablePropertyControls( sal_Int16 _nControls, bool _bEnable ); void EnablePropertyLine( bool _bEnable ); - sal_Bool IsPropertyInputEnabled( ) const; void SetReadOnly( bool _bReadOnly ); diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 55afa4ac0043..27d97868bcf2 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -682,16 +682,6 @@ namespace pcr } //------------------------------------------------------------------------ - Any OBrowserListBox::GetPropertyValue( const ::rtl::OUString& _rEntryName ) const - { - Any aValue; - ListBoxLines::const_iterator line = m_aLines.find( _rEntryName ); - if ( line != m_aLines.end() ) - aValue = impl_getControlAsPropertyValue( line->second ); - return aValue; - } - - //------------------------------------------------------------------------ sal_uInt16 OBrowserListBox::GetPropertyPos( const ::rtl::OUString& _rEntryName ) const { sal_uInt16 nRet = LISTBOX_ENTRY_NOTFOUND; @@ -722,15 +712,6 @@ namespace pcr } //------------------------------------------------------------------------ - sal_Bool OBrowserListBox::IsPropertyInputEnabled( const ::rtl::OUString& _rEntryName ) const - { - BrowserLinePointer pLine; - if ( impl_getBrowserLineForName( _rEntryName, pLine ) ) - return pLine->IsPropertyInputEnabled(); - return sal_False; - } - - //------------------------------------------------------------------------ void OBrowserListBox::EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ) { BrowserLinePointer pLine; diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index de0ebc9dd6b6..edd9d9bd40eb 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -163,13 +163,11 @@ namespace pcr void ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos ); void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue ); - ::com::sun::star::uno::Any GetPropertyValue( const ::rtl::OUString& rEntryName ) const; sal_uInt16 GetPropertyPos( const ::rtl::OUString& rEntryName ) const; ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > GetPropertyControl( const ::rtl::OUString& rEntryName ); void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ); void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ); - sal_Bool IsPropertyInputEnabled( const ::rtl::OUString& _rEntryName ) const; sal_Int32 GetMinimumWidth(); sal_Int32 GetMinimumHeight(); diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 8afe4c889c92..24fb4e8b88db 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -594,7 +594,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( false, "EventHandler::EventHandler: caught an exception while classifying the component!" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -825,7 +825,7 @@ namespace pcr } catch( const Exception& ) { - DBG_ERROR( "EventHandler::getSupportedProperties: caught an exception !" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1048,7 +1048,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( false, "EventHandler::impl_getFormComponentScriptEvents_nothrow: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1080,7 +1080,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( false, "EventHandler::impl_getCopmonentListenerTypes_nothrow: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1105,7 +1105,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( false, "EventHandler::impl_getDialogElementScriptEvents_nothrow: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1120,7 +1120,7 @@ namespace pcr { Reference< XTabControllerModel > xComponentAsTCModel( m_xComponent, UNO_QUERY_THROW ); Reference< XFormController > xController( - m_aContext.createComponent( (const rtl::OUString&)SERVICE_FORMCONTROLLER ), UNO_QUERY_THROW ); + m_aContext.createComponent( "com.sun.star.form.runtime.FormController" ), UNO_QUERY_THROW ); xController->setModel( xComponentAsTCModel ); xReturn = xController; @@ -1212,7 +1212,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( false, "EventHandler::impl_setFormComponentScriptEvent_nothrow: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx index 0e82397dae2c..ae87a85a3722 100644 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ b/extensions/source/propctrlr/handlerhelper.cxx @@ -161,14 +161,6 @@ namespace pcr //-------------------------------------------------------------------- Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const Sequence< ::rtl::OUString >& _rInitialListEntries, sal_Bool _bReadOnlyControl, sal_Bool _bSorted ) - { - ::std::vector< ::rtl::OUString > aAsVector( _rInitialListEntries.getConstArray(), _rInitialListEntries.getConstArray() + _rInitialListEntries.getLength() ); - return lcl_implCreateListLikeControl( _rxControlFactory, aAsVector, _bReadOnlyControl, _bSorted, sal_True ); - } - - //-------------------------------------------------------------------- - Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, const ::std::vector< ::rtl::OUString >& _rInitialListEntries, sal_Bool _bReadOnlyControl, sal_Bool _bSorted ) { return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, sal_True ); diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx index bf42c5555f1b..e55cbf207526 100644 --- a/extensions/source/propctrlr/handlerhelper.hxx +++ b/extensions/source/propctrlr/handlerhelper.hxx @@ -105,14 +105,6 @@ namespace pcr static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > createListBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rInitialListEntries, - sal_Bool _bReadOnlyControl, - sal_Bool _bSorted - ); - - static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - createListBoxControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory, const ::std::vector< ::rtl::OUString >& _rInitialListEntries, sal_Bool _bReadOnlyControl, sal_Bool _bSorted diff --git a/extensions/source/propctrlr/pcrstrings.hxx b/extensions/source/propctrlr/pcrstrings.hxx index 9a611f5fce7f..e2a81c9920ca 100644 --- a/extensions/source/propctrlr/pcrstrings.hxx +++ b/extensions/source/propctrlr/pcrstrings.hxx @@ -38,9 +38,6 @@ namespace pcr // properties PCR_CONSTASCII_STRING( PROPERTY_TABBINGMODEL, "TabbingModel" ); - // services - PCR_CONSTASCII_STRING( SERVICE_FORMCONTROLLER, "com.sun.star.form.FormController" ); - //............................................................................ } // namespace pcr //............................................................................ diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index af1a8d91c8fd..43c50e6f8451 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -642,6 +642,11 @@ BOOL Sane::Start( BitmapTransporter& rBitmap ) nStatus = p_get_parameters( maHandle, &aParams ); DUMP_STATE( nStatus, "sane_get_parameters" ); CheckConsistency( "sane_get_parameters" ); + if (nStatus != SANE_STATUS_GOOD || aParams.bytes_per_line == 0) + { + bSuccess = FALSE; + break; + } #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL const char* ppFormats[] = { "SANE_FRAME_GRAY", "SANE_FRAME_RGB", "SANE_FRAME_RED", "SANE_FRAME_GREEN", diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index dd7da492ff57..09d90f1eaa83 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -169,7 +169,9 @@ progress_callback( void *clientp, double dltotal, double dlnow, double ultotal, if( ! out->StopCondition.check() ) { - double fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset); + double fPercent = 0; + if ( dltotal + out->Offset ) + fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset); if( fPercent < 0 ) fPercent = 0; @@ -262,6 +264,9 @@ bool curl_run(const rtl::OUString& rURL, OutData& out, const rtl::OString& aProx rtl::OString aURL(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); curl_easy_setopt(pCURL, CURLOPT_URL, aURL.getStr()); + // abort on http errors + curl_easy_setopt(pCURL, CURLOPT_FAILONERROR, 1); + // enable redirection curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1); @@ -300,6 +305,19 @@ bool curl_run(const rtl::OUString& rURL, OutData& out, const rtl::OString& aProx ret = true; } + if ( CURLE_PARTIAL_FILE == cc ) + { + // this sometimes happens, when a user throws away his user data, but has already + // completed the download of an update. + double fDownloadSize; + curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize ); + if ( -1 == fDownloadSize ) + { + out.Handler->downloadFinished(out.File); + ret = true; + } + } + // Avoid target file being removed else if( (CURLE_ABORTED_BY_CALLBACK == cc) || out.StopCondition.check() ) ret = true; @@ -313,7 +331,30 @@ bool curl_run(const rtl::OUString& rURL, OutData& out, const rtl::OString& aProx if( NULL != error_message ) aMessage = error_message; - out.Handler->downloadStalled( rtl::OStringToOUString(aMessage, RTL_TEXTENCODING_UTF8) ); + if ( CURLE_HTTP_RETURNED_ERROR == cc ) + { + long nError; + curl_easy_getinfo( pCURL, CURLINFO_RESPONSE_CODE, &nError ); + + if ( 403 == nError ) + aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " 403: Access denied!" ) ); + else if ( 404 == nError ) + aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " 404: File not found!" ) ); + else if ( 416 == nError ) + { + // we got this error probably, because we already downloaded the file + out.Handler->downloadFinished(out.File); + ret = true; + } + else + { + aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( ":error code = " ) ); + aMessage += aMessage.valueOf( nError ); + aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " !" ) ); + } + } + if ( !ret ) + out.Handler->downloadStalled( rtl::OStringToOUString(aMessage, RTL_TEXTENCODING_UTF8) ); } curl_easy_cleanup(pCURL); @@ -330,14 +371,52 @@ Download::start(const rtl::OUString& rURL, const rtl::OUString& rFile, const rtl OSL_ASSERT( m_aHandler.is() ); OutData out(m_aCondition); + rtl::OUString aFile( rFile ); + + // when rFile is empty, there is no remembered file name. If there is already a file with the + // same name ask the user if she wants to resume a download or restart the download + if ( !aFile.getLength() ) + { + // GetFileName() + rtl::OUString aURL( rURL ); + // ensure no trailing '/' + sal_Int32 nLen = aURL.getLength(); + while( (nLen > 0) && ('/' == aURL[ nLen-1 ]) ) + aURL = aURL.copy( 0, --nLen ); + + // extract file name last '/' + sal_Int32 nIndex = aURL.lastIndexOf('/'); + aFile = rDestinationDir + aURL.copy( nIndex ); + + // check for existing file + oslFileError rc = osl_openFile( aFile.pData, &out.FileHandle, osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); + osl_closeFile(out.FileHandle); + out.FileHandle = NULL; + + if( osl_File_E_EXIST == rc ) + { + if ( m_aHandler->checkDownloadDestination( aURL.copy( nIndex+1 ) ) ) + { + osl_removeFile( aFile.pData ); + aFile = rtl::OUString(); + } + else + m_aHandler->downloadStarted( aFile, 0 ); + } + else + { + osl_removeFile( aFile.pData ); + aFile = rtl::OUString(); + } + } - out.File = rFile; + out.File = aFile; out.DestinationDir = rDestinationDir; out.Handler = m_aHandler; - if( rFile.getLength() > 0 ) + if( aFile.getLength() > 0 ) { - oslFileError rc = osl_openFile(rFile.pData, &out.FileHandle, osl_File_OpenFlag_Write); + oslFileError rc = osl_openFile(aFile.pData, &out.FileHandle, osl_File_OpenFlag_Write); if( osl_File_E_None == rc ) { diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx index 1b2fb678417b..ff16ef52f7fb 100644 --- a/extensions/source/update/check/download.hxx +++ b/extensions/source/update/check/download.hxx @@ -35,6 +35,8 @@ struct DownloadInteractionHandler : public rtl::IReference { + virtual bool checkDownloadDestination(const rtl::OUString& rFileName) = 0; + // called if the destination file already exists, but resume is false virtual bool downloadTargetExists(const rtl::OUString& rFileName) = 0; diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 10632cd23fbd..8419569bd949 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -800,6 +800,8 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, aModel.getUpdateEntry(m_aUpdateInfo); bool obsoleteUpdateInfo = isObsoleteUpdateInfo(aUpdateEntryVersion); + bool bContinueDownload = false; + bool bDownloadAvailable = false; m_bHasExtensionUpdate = checkForPendingUpdates( xContext ); m_bShowExtUpdDlg = false; @@ -808,10 +810,7 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, if( aLocalFileName.getLength() > 0 ) { - bool downloadPaused = aModel.isDownloadPaused(); - - enableDownload(true, downloadPaused); - setUIState(downloadPaused ? UPDATESTATE_DOWNLOAD_PAUSED : UPDATESTATE_DOWNLOADING); + bContinueDownload = true; // Try to get the number of bytes already on disk osl::DirectoryItem aDirectoryItem; @@ -820,16 +819,36 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, osl::FileStatus aFileStatus(FileStatusMask_FileSize); if( osl::DirectoryItem::E_None == aDirectoryItem.getFileStatus(aFileStatus) ) { - // Calculate initial percent value. - if( aModel.getDownloadSize() > 0 ) + sal_Int64 nDownloadSize = aModel.getDownloadSize(); + sal_Int64 nFileSize = aFileStatus.getFileSize(); + + if( nDownloadSize > 0 ) { - sal_Int32 nPercent = (sal_Int32) (100 * aFileStatus.getFileSize() / aModel.getDownloadSize()); - getUpdateHandler()->setProgress(nPercent); + if ( nDownloadSize <= nFileSize ) // we have already downloaded everthing + { + bContinueDownload = false; + bDownloadAvailable = true; + m_aImageName = getImageFromFileName( aLocalFileName ); + } + else // Calculate initial percent value. + { + sal_Int32 nPercent = (sal_Int32) (100 * nFileSize / nDownloadSize); + getUpdateHandler()->setProgress( nPercent ); + } } } } + + if ( bContinueDownload ) + { + bool downloadPaused = aModel.isDownloadPaused(); + + enableDownload(true, downloadPaused); + setUIState(downloadPaused ? UPDATESTATE_DOWNLOAD_PAUSED : UPDATESTATE_DOWNLOADING); + } + } - else + if ( !bContinueDownload ) { // We do this intentionally only if no download is in progress .. if( obsoleteUpdateInfo ) @@ -842,13 +861,21 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, // Data is outdated, probably due to installed update rtl::Reference< UpdateCheckConfig > aConfig = UpdateCheckConfig::get( xContext, *this ); aConfig->clearUpdateFound(); + aConfig->clearLocalFileName(); + m_aUpdateInfo = UpdateInfo(); + // Remove outdated release notes + storeReleaseNote( 1, rtl::OUString() ); + storeReleaseNote( 2, rtl::OUString() ); } else { enableAutoCheck(aModel.isAutoCheckEnabled()); - setUIState(getUIState(m_aUpdateInfo)); + if ( bDownloadAvailable ) + setUIState( UPDATESTATE_DOWNLOAD_AVAIL ); + else + setUIState(getUIState(m_aUpdateInfo)); } } } @@ -937,6 +964,10 @@ UpdateCheck::install() aParameter += UNISTRING(" &"); #endif + + rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); + rModel->clearLocalFileName(); + xShellExecute->execute(aInstallImage, aParameter, nFlags); ShutdownThread *pShutdownThread = new ShutdownThread( m_xContext ); (void) pShutdownThread; @@ -1102,6 +1133,23 @@ UpdateCheck::downloadTargetExists(const rtl::OUString& rFileName) } //------------------------------------------------------------------------------ +bool UpdateCheck::checkDownloadDestination( const rtl::OUString& rFileName ) +{ + osl::ClearableMutexGuard aGuard(m_aMutex); + + rtl::Reference< UpdateHandler > aUpdateHandler( getUpdateHandler() ); + + bool bReload = false; + + if( aUpdateHandler->isVisible() ) + { + bReload = aUpdateHandler->showOverwriteWarning( rFileName ); + } + + return bReload; +} + +//------------------------------------------------------------------------------ void UpdateCheck::downloadStalled(const rtl::OUString& rErrorMessage) @@ -1132,15 +1180,18 @@ UpdateCheck::downloadProgressAt(sal_Int8 nPercent) void UpdateCheck::downloadStarted(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize) { - osl::MutexGuard aGuard(m_aMutex); + if ( nFileSize > 0 ) + { + osl::MutexGuard aGuard(m_aMutex); - rtl::Reference< UpdateCheckConfig > aModel(UpdateCheckConfig::get(m_xContext)); - aModel->storeLocalFileName(rLocalFileName, nFileSize); + rtl::Reference< UpdateCheckConfig > aModel(UpdateCheckConfig::get(m_xContext)); + aModel->storeLocalFileName(rLocalFileName, nFileSize); - // Bring-up release note for position 1 .. - const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 1, aModel->isAutoDownloadEnabled())); - if( aURL.getLength() > 0 ) - showReleaseNote(aURL); + // Bring-up release note for position 1 .. + const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 1, aModel->isAutoDownloadEnabled())); + if( aURL.getLength() > 0 ) + showReleaseNote(aURL); + } } //------------------------------------------------------------------------------ @@ -1153,9 +1204,6 @@ UpdateCheck::downloadFinished(const rtl::OUString& rLocalFileName) // no more retries m_pThread->terminate(); - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext); - rModel->clearLocalFileName(); - m_aImageName = getImageFromFileName(rLocalFileName); UpdateInfo aUpdateInfo(m_aUpdateInfo); @@ -1163,6 +1211,7 @@ UpdateCheck::downloadFinished(const rtl::OUString& rLocalFileName) setUIState(UPDATESTATE_DOWNLOAD_AVAIL); // Bring-up release note for position 2 .. + rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); const rtl::OUString aURL(getReleaseNote(aUpdateInfo, 2, rModel->isAutoDownloadEnabled())); if( aURL.getLength() > 0 ) showReleaseNote(aURL); diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx index 59a1727f4bd9..7283288769e0 100644 --- a/extensions/source/update/check/updatecheck.hxx +++ b/extensions/source/update/check/updatecheck.hxx @@ -111,6 +111,8 @@ public: virtual void downloadProgressAt(sal_Int8 nProcent); virtual void downloadStarted(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize); virtual void downloadFinished(const rtl::OUString& rLocalFileName); + // checks if the download target already exists and asks user what to do next + virtual bool checkDownloadDestination( const rtl::OUString& rFile ); // Cancels the download action (and resumes checking if enabled) void cancelDownload(); diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index b3e559c5f136..9f78b33270c2 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -398,7 +398,7 @@ UpdateCheckConfig::storeLocalFileName(const rtl::OUString& rLocalFileName, sal_I if( m_xContainer->hasByName(aNameList[i]) ) m_xContainer->replaceByName(aNameList[i], aValueList[i]); else - m_xContainer->insertByName(aNameList[i],aValueList[i]); + m_xContainer->insertByName(aNameList[i], aValueList[i]); } commitChanges(); diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 78ebae14b31b..97bca3cc4c98 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -52,6 +52,7 @@ #include "com/sun/star/awt/XThrobber.hpp" #include "com/sun/star/awt/XTopWindow.hpp" #include "com/sun/star/awt/XVclWindowPeer.hpp" +#include "com/sun/star/awt/XVclContainer.hpp" #include "com/sun/star/awt/XWindow.hpp" #include "com/sun/star/awt/XWindow2.hpp" @@ -101,7 +102,8 @@ UpdateHandler::UpdateHandler( const uno::Reference< uno::XComponentContext > & r mbVisible( false ), mbStringsLoaded( false ), mbMinimized( false ), - mbListenerAdded(false) + mbListenerAdded(false), + mbShowsMessageBox(false) { } @@ -232,6 +234,11 @@ void UpdateHandler::setVisible( bool bVisible ) //-------------------------------------------------------------------- void UpdateHandler::setProgress( sal_Int32 nPercent ) { + if ( nPercent > 100 ) + nPercent = 100; + else if ( nPercent < 0 ) + nPercent = 0; + if ( nPercent != mnPercent ) { osl::MutexGuard aGuard( maMutex ); @@ -478,7 +485,18 @@ void SAL_CALL UpdateHandler::handle( uno::Reference< task::XInteractionRequest > void SAL_CALL UpdateHandler::queryTermination( const lang::EventObject& ) throw ( frame::TerminationVetoException, uno::RuntimeException ) { - setVisible( false ); + if ( mbShowsMessageBox ) + { + uno::Reference< awt::XTopWindow > xTopWindow( mxUpdDlg, uno::UNO_QUERY ); + if ( xTopWindow.is() ) + xTopWindow->toFront(); + + throw frame::TerminationVetoException( + UNISTRING("The office cannot be closed while displaying a warning!"), + uno::Reference<XInterface>(static_cast<frame::XTerminateListener*>(this), uno::UNO_QUERY)); + } + else + setVisible( false ); } //------------------------------------------------------------------------------ @@ -707,6 +725,9 @@ void UpdateHandler::loadStrings() msInstallError = loadString( xBundle, RID_UPDATE_STR_INSTALL_ERROR ); msOverwriteWarning = loadString( xBundle, RID_UPDATE_STR_OVERWRITE_WARNING ); msPercent = loadString( xBundle, RID_UPDATE_STR_PERCENT ); + msReloadWarning = loadString( xBundle, RID_UPDATE_STR_RELOAD_WARNING ); + msReloadReload = loadString( xBundle, RID_UPDATE_STR_RELOAD_RELOAD ); + msReloadContinue = loadString( xBundle, RID_UPDATE_STR_RELOAD_CONTINUE ); msStatusFL = loadString( xBundle, RID_UPDATE_FT_STATUS ); msDescription = loadString( xBundle, RID_UPDATE_FT_DESCRIPTION ); @@ -943,12 +964,14 @@ bool UpdateHandler::showWarning( const rtl::OUString &rWarningText ) const uno::Reference< awt::XMessageBox > xMsgBox( xToolkit->createWindow( aDescriptor ), uno::UNO_QUERY ); if ( xMsgBox.is() ) { + mbShowsMessageBox = true; sal_Int16 nRet; // xMsgBox->setCaptionText( msCancelTitle ); xMsgBox->setMessageText( rWarningText ); nRet = xMsgBox->execute(); if ( nRet == 2 ) // RET_YES == 2 bRet = true; + mbShowsMessageBox = false; } uno::Reference< lang::XComponent > xComponent( xMsgBox, uno::UNO_QUERY ); @@ -959,6 +982,86 @@ bool UpdateHandler::showWarning( const rtl::OUString &rWarningText ) const } //-------------------------------------------------------------------- +bool UpdateHandler::showWarning( const rtl::OUString &rWarningText, + const rtl::OUString &rBtnText_1, + const rtl::OUString &rBtnText_2 ) const +{ + bool bRet = false; + + uno::Reference< awt::XControl > xControl( mxUpdDlg, uno::UNO_QUERY ); + if ( !xControl.is() ) return bRet; + + uno::Reference< awt::XWindowPeer > xPeer = xControl->getPeer(); + if ( !xPeer.is() ) return bRet; + + uno::Reference< awt::XToolkit > xToolkit = xPeer->getToolkit(); + if ( !xToolkit.is() ) return bRet; + + awt::WindowDescriptor aDescriptor; + + sal_Int32 nWindowAttributes = awt::WindowAttribute::BORDER | awt::WindowAttribute::MOVEABLE | awt::WindowAttribute::CLOSEABLE; + nWindowAttributes |= awt::VclWindowPeerAttribute::YES_NO; + nWindowAttributes |= awt::VclWindowPeerAttribute::DEF_NO; + + aDescriptor.Type = awt::WindowClass_MODALTOP; + aDescriptor.WindowServiceName = UNISTRING( "warningbox" ); + aDescriptor.ParentIndex = -1; + aDescriptor.Parent = xPeer; + aDescriptor.Bounds = awt::Rectangle( 10, 10, 250, 150 ); + aDescriptor.WindowAttributes = nWindowAttributes; + + uno::Reference< awt::XMessageBox > xMsgBox( xToolkit->createWindow( aDescriptor ), uno::UNO_QUERY ); + if ( xMsgBox.is() ) + { + uno::Reference< awt::XVclContainer > xMsgBoxCtrls( xMsgBox, uno::UNO_QUERY ); + if ( xMsgBoxCtrls.is() ) + { + uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows(); + + for ( long i=0; i < xChildren.getLength(); i++ ) + { + uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( xChildren[i], uno::UNO_QUERY ); + if ( xMsgBoxCtrl.is() ) + { + bool bIsDefault = true; + uno::Any aValue = xMsgBoxCtrl->getProperty( UNISTRING("DefaultButton") ); + aValue >>= bIsDefault; + if ( bIsDefault ) + xMsgBoxCtrl->setProperty( UNISTRING("Text"), uno::Any( rBtnText_1 ) ); + else + xMsgBoxCtrl->setProperty( UNISTRING("Text"), uno::Any( rBtnText_2 ) ); + } + } + } + + sal_Int16 nRet; + // xMsgBox->setCaptionText( msCancelTitle ); + mbShowsMessageBox = true; + xMsgBox->setMessageText( rWarningText ); + nRet = xMsgBox->execute(); + if ( nRet == 2 ) // RET_YES == 2 + bRet = true; + + mbShowsMessageBox = false; + } + + uno::Reference< lang::XComponent > xComponent( xMsgBox, uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->dispose(); + + return bRet; +} + +//-------------------------------------------------------------------- +bool UpdateHandler::showOverwriteWarning( const rtl::OUString& rFileName ) const +{ + rtl::OUString aMsg( msReloadWarning ); + searchAndReplaceAll( aMsg, UNISTRING( "%FILENAME" ), rFileName ); + searchAndReplaceAll( aMsg, UNISTRING( "%DOWNLOAD_PATH" ), msDownloadPath ); + return showWarning( aMsg, msReloadContinue, msReloadReload ); +} + +//-------------------------------------------------------------------- bool UpdateHandler::showOverwriteWarning() const { return showWarning( msOverwriteWarning ); diff --git a/extensions/source/update/check/updatehdl.hrc b/extensions/source/update/check/updatehdl.hrc index 6389a661bf6c..ad3d472eaf68 100644 --- a/extensions/source/update/check/updatehdl.hrc +++ b/extensions/source/update/check/updatehdl.hrc @@ -47,6 +47,9 @@ #define RID_UPDATE_STR_PERCENT RID_UPDATE_HDL_START + 18 #define RID_UPDATE_STR_DOWNLOAD_DESCR RID_UPDATE_HDL_START + 19 #define RID_UPDATE_STR_INSTALL_ERROR RID_UPDATE_HDL_START + 20 + #define RID_UPDATE_STR_RELOAD_WARNING RID_UPDATE_HDL_START + 21 + #define RID_UPDATE_STR_RELOAD_RELOAD RID_UPDATE_HDL_START + 22 + #define RID_UPDATE_STR_RELOAD_CONTINUE RID_UPDATE_HDL_START + 23 #define RID_UPDATE_FT_DESCRIPTION RID_UPDATE_HDL_START + 25 #define RID_UPDATE_FT_STATUS RID_UPDATE_HDL_START + 26 diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 696e2cdda0cf..bd525853dda1 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -98,6 +98,7 @@ private: bool mbStringsLoaded; bool mbMinimized; bool mbListenerAdded; + mutable bool mbShowsMessageBox; osl::Mutex maMutex; @@ -125,6 +126,9 @@ private: rtl::OUString msInstallError; // RID_UPDATE_STR_INSTALL_ERROR rtl::OUString msOverwriteWarning; // RID_UPDATE_STR_OVERWRITE_WARNING rtl::OUString msPercent; // RID_UPDATE_STR_PERCENT + rtl::OUString msReloadWarning; // RID_UPDATE_STR_OVERWRITE_WARNING + rtl::OUString msReloadReload; // RID_UPDATE_STR_OVERWRITE_WARNING + rtl::OUString msReloadContinue; // RID_UPDATE_STR_OVERWRITE_WARNING rtl::OUString msStatusFL; // RID_UPDATE_FT_STATUS rtl::OUString msDescription; // RID_UPDATE_FT_DESCRIPTION rtl::OUString msClose; // RID_UPDATE_BTN_CLOSE @@ -184,6 +188,8 @@ public: rtl::OUString getBubbleTitle( UpdateState eState ); rtl::OUString getDefaultInstErrMsg(); bool showWarning( const rtl::OUString &rWarning ) const; + bool showWarning( const rtl::OUString &rWarning, const rtl::OUString& rBtnText_1, const rtl::OUString& rBtnText_2 ) const; + bool showOverwriteWarning( const rtl::OUString &rFileName ) const; bool showOverwriteWarning() const; // Allows runtime exceptions to be thrown by const methods diff --git a/extensions/source/update/check/updatehdl.src b/extensions/source/update/check/updatehdl.src index d371a80b33cb..58f88b7e4852 100644 --- a/extensions/source/update/check/updatehdl.src +++ b/extensions/source/update/check/updatehdl.src @@ -122,6 +122,21 @@ String RID_UPDATE_STR_OVERWRITE_WARNING Text [ en-US ] = "A file with that name already exists! Do you want to overwrite the existing file?"; }; +String RID_UPDATE_STR_RELOAD_WARNING +{ + Text [ en-US ] = "A file with the name '%FILENAME' already exists in '%DOWNLOAD_PATH'! Do you want to continue with the download or delete and reload the file?"; +}; + +String RID_UPDATE_STR_RELOAD_RELOAD +{ + Text [ en-US ] = "Reload File"; +}; + +String RID_UPDATE_STR_RELOAD_CONTINUE +{ + Text [ en-US ] = "Continue"; +}; + String RID_UPDATE_STR_PERCENT { Text [ en-US ] = "%PERCENT%"; diff --git a/forms/prj/build.lst b/forms/prj/build.lst index 99f6b29d208b..cc71868b734d 100644 --- a/forms/prj/build.lst +++ b/forms/prj/build.lst @@ -1,4 +1,4 @@ -fm forms : l10n oovbaapi svx sfx2 QADEVOOO:qadevOOo NULL +fm forms : l10n oovbaapi svx sfx2 qadevOOo NULL fm forms usr1 - all fm_mkofrm NULL fm forms\inc nmake - all fm_inc NULL fm forms\source\inc get - all fm_sinc NULL diff --git a/forms/qa/makefile.mk b/forms/qa/makefile.mk index 1f12a8cf4a74..afafcca427aa 100644 --- a/forms/qa/makefile.mk +++ b/forms/qa/makefile.mk @@ -32,8 +32,6 @@ PRJNAME = forms # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk - -.IF "$(BUILD_QADEVOOO)" == "YES" #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar @@ -54,7 +52,6 @@ JARCOMPRESS = TRUE # classpath and argument list RUNNER_CLASSPATH = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar" RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex -.END # --- Targets ------------------------------------------------------ @@ -72,7 +69,6 @@ ALL: ALLDEP test: echo $(SOLARBINDIR) -.IF "$(BUILD_QADEVOOO)" == "YES" show_targets: +@$(AUGMENT_LIBRARY_PATH) java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//)) @@ -81,11 +77,3 @@ run: run_%: +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && $(AUGMENT_LIBRARY_PATH) java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o integration.$(PRJNAME).$(@:s/run_//) - -.ELSE -run: show_targets - -show_targets: - +@echo "Built without qadevOOo, no QA tests" - -.ENDIF diff --git a/forms/qa/unoapi/forms.sce b/forms/qa/unoapi/forms.sce index 97e9c7422f35..073472f03126 100644 --- a/forms/qa/unoapi/forms.sce +++ b/forms/qa/unoapi/forms.sce @@ -1,5 +1,5 @@ -o forms.OButtonControl --o forms.OButtonModel +#i111285 -o forms.OButtonModel -o forms.OCheckBoxControl -o forms.OCheckBoxModel -o forms.OComboBoxControl @@ -11,10 +11,10 @@ -o forms.ODateModel -o forms.OEditControl -o forms.OEditModel --o forms.OFileControlModel +#i109939 -o forms.OFileControlModel -o forms.OFixedTextModel -o forms.OFormattedControl --o forms.OFormattedFieldWrapper +#i109939 -o forms.OFormattedFieldWrapper # LSST EIN DOKUMENT OFFEN -o forms.OFormsCollection -o forms.OGridControlModel -o forms.OGroupBoxControl diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl index 1cec8ac106a2..2e10a269c681 100644 --- a/forms/qa/unoapi/knownissues.xcl +++ b/forms/qa/unoapi/knownissues.xcl @@ -116,3 +116,14 @@ forms.OListBoxModel::com::sun::star::form::XUpdateBroadcaster forms.OFormattedFieldWrapper::com::sun::star::form::XUpdateBroadcaster forms.ODateModel::com::sun::star::form::XUpdateBroadcaster forms.OComboBoxModel::com::sun::star::form::XUpdateBroadcaster + +### i111006 ### +forms.OFileControlModel::com::sun::star::beans::XFastPropertySet +forms.OFileControlModel::com::sun::star::form::FormControlModel + +### i111148 ### +forms.OImageControlModel::com::sun::star::beans::XMultiPropertySet +forms.OImageControlModel::com::sun::star::beans::XPropertySet + +### i111333 ### +forms.OImageControlControl::com::sun::star::awt::XControl diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index 4dfdb61cbb2b..278e561de251 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -532,26 +532,11 @@ void OComboBoxModel::loadData( bool _bForce ) else { // otherwise look for the alias - Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - break; - - Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer(); - try - { - Reference<XPropertySet> xFormAsSet(xForm, UNO_QUERY); - ::rtl::OUString aStatement; - xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement; - xComposer->setQuery(aStatement); - } - catch(Exception&) - { - disposeComponent(xComposer); - break; - } + Reference<XPropertySet> xFormProp(xForm,UNO_QUERY); + Reference< XColumnsSupplier > xSupplyFields; + xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupplyFields; // search the field - Reference< XColumnsSupplier > xSupplyFields(xComposer, UNO_QUERY); DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !"); Reference< XNameAccess > xFieldNames = xSupplyFields->getColumns(); @@ -562,8 +547,6 @@ void OComboBoxModel::loadData( bool _bForce ) if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet)) xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName; } - - disposeComponent(xComposer); } if (!aFieldName.getLength()) diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 5f3f04d45618..154ed4b00272 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2403,6 +2403,7 @@ void ODatabaseForm::_propertyChanged(const PropertyChangeEvent& evt) throw( Runt //------------------------------------------------------------------------------ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) { + // SYNCHRONIZED -----> ::osl::ResettableMutexGuard aGuard(m_aMutex); Reference<XForm> xParentForm(getParent(), UNO_QUERY); @@ -2447,14 +2448,15 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com } } + Reference< XPropertySet > xAggregateProperties( m_xAggregateSet ); + aGuard.clear(); + // <----- SYNCHRONIZED + Reference< XConnection > xOuterConnection; sal_Bool bIsEmbedded = ::dbtools::isEmbeddedInDatabase( Parent, xOuterConnection ); - // clear the guard before setting property values, because of the notifications - // which are triggered there - aGuard.clear(); if ( bIsEmbedded ) - m_xAggregateSet->setPropertyValue( PROPERTY_DATASOURCE, makeAny( ::rtl::OUString() ) ); + xAggregateProperties->setPropertyValue( PROPERTY_DATASOURCE, makeAny( ::rtl::OUString() ) ); } //============================================================================== diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index b4c7eddf81d8..9cbc5237cf95 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -397,17 +397,10 @@ namespace frm const Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW ); // create a query composer - const Reference< XConnection > xConnection( ::dbtools::getConnection( xForm ), UNO_SET_THROW ); - const Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY_THROW ); - const Reference< XSQLQueryComposer > xComposer( xFactory->createQueryComposer(), UNO_SET_THROW ); - - // set the statement on the composer - ::rtl::OUString sStatement; - xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sStatement; - xComposer->setQuery( sStatement ); + Reference< XColumnsSupplier > xSuppColumns; + xFormProps->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSuppColumns; - // the field we're bound to - const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW ); + const Reference< XConnection > xConnection( ::dbtools::getConnection( xForm ), UNO_SET_THROW ); const Reference< XNameAccess > xFieldNames( xSuppColumns->getColumns(), UNO_SET_THROW ); if ( !xFieldNames->hasByName( sFieldName ) ) return; @@ -417,7 +410,7 @@ namespace frm xComposerFieldProps->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName; // obtain the table of the field - const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW ); + const Reference< XTablesSupplier > xSuppTables( xSuppColumns, UNO_QUERY_THROW ); const Reference< XNameAccess > xTablesNames( xSuppTables->getTables(), UNO_SET_THROW ); const Reference< XNamed > xNamedTable( xTablesNames->getByName( sTableName ), UNO_QUERY_THROW ); sTableName = xNamedTable->getName(); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 6e11fa7c9dbb..a35a300dda78 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -580,7 +580,7 @@ void OFormattedModel::_propertyChanged( const com::sun::star::beans::PropertyCha // as m_aSaveValue (which is used by commitControlValueToDbColumn) is format dependent we have // to recalc it, which is done by translateDbColumnToControlValue - if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast()) + if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast()) { setControlValue( translateDbColumnToControlValue(), eOther ); } diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 88135c040d71..d2de4882dead 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -174,6 +174,8 @@ namespace frm m_eListSourceType = ListSourceType_VALUELIST; m_aBoundColumn <<= (sal_Int16)1; initValueProperty( PROPERTY_SELECT_SEQ, PROPERTY_ID_SELECT_SEQ); + + startAggregatePropertyListening( PROPERTY_STRINGITEMLIST ); } //------------------------------------------------------------------ @@ -191,6 +193,8 @@ namespace frm ,m_nBoundColumnType( DataType::SQLNULL ) { DBG_CTOR(OListBoxModel,NULL); + + startAggregatePropertyListening( PROPERTY_STRINGITEMLIST ); } //------------------------------------------------------------------ @@ -453,6 +457,22 @@ namespace frm } //------------------------------------------------------------------------------ + void OListBoxModel::_propertyChanged( const PropertyChangeEvent& i_rEvent ) throw ( RuntimeException ) + { + if ( i_rEvent.PropertyName == PROPERTY_STRINGITEMLIST ) + { + ControlModelLock aLock( *this ); + // SYNCHRONIZED -----> + // our aggregate internally changed its StringItemList property - reflect this in our "overridden" + // version of the property + setNewStringItemList( i_rEvent.NewValue, aLock ); + // <----- SYNCHRONIZED + return; + } + OBoundControlModel::_propertyChanged( i_rEvent ); + } + + //------------------------------------------------------------------------------ void OListBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const { OBoundControlModel::describeAggregateProperties( _rAggregateProps ); @@ -700,25 +720,10 @@ namespace frm else { // otherwise look for the alias - Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - break; - - Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer(); - try - { - ::rtl::OUString aStatement; - xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= aStatement; - xComposer->setQuery( aStatement ); - } - catch(Exception&) - { - disposeComponent(xComposer); - break; - } + Reference< XColumnsSupplier > xSupplyFields; + xFormProps->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupplyFields; // search the field - Reference<XColumnsSupplier> xSupplyFields(xComposer, UNO_QUERY); DBG_ASSERT(xSupplyFields.is(), "OListBoxModel::loadData : invalid query composer !"); Reference<XNameAccess> xFieldNames = xSupplyFields->getColumns(); @@ -729,7 +734,6 @@ namespace frm if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet)) xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName; } - disposeComponent(xComposer); } } if (!aFieldName.getLength()) diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index 04db6069d89e..46ab6b872fb8 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -134,6 +134,9 @@ protected: // XEventListener virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); + // OPropertyChangeListener + virtual void _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& _rEvt ) throw ( ::com::sun::star::uno::RuntimeException ); + // prevent method hiding using OBoundControlModel::getFastPropertyValue; using OBoundControlModel::setPropertyValues; diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx index 427d0c6ed190..90e508f43ca8 100644 --- a/forms/source/inc/InterfaceContainer.hxx +++ b/forms/source/inc/InterfaceContainer.hxx @@ -273,7 +273,7 @@ protected: private: // hack for Vba Events - void fakeVbaEventsHack( sal_Int32 _nIndex ); + void impl_addVbEvents_nolck_nothrow( const sal_Int32 i_nIndex ); // the runtime event format has changed from version SO5.2 to OOo enum EventFormat diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index b594df158d17..e494406f87ef 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -31,6 +31,7 @@ #include "frm_resource.hrc" #include "frm_resource.hxx" #include "InterfaceContainer.hxx" +#include "componenttools.hxx" #include "property.hrc" #include "services.hxx" @@ -40,6 +41,7 @@ #include <com/sun/star/io/XMarkableStream.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/form/XForm.hpp> #include <comphelper/container.hxx> #include <comphelper/enumhelper.hxx> @@ -119,54 +121,52 @@ lcl_stripVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents ) return sStripped; } -void -OInterfaceContainer::fakeVbaEventsHack( sal_Int32 _nIndex ) +void OInterfaceContainer::impl_addVbEvents_nolck_nothrow( const sal_Int32 i_nIndex ) { // we are dealing with form controls try { - Reference< XFormComponent > xForm( static_cast< XContainer* >(this), UNO_QUERY_THROW ); - // grand-parent should be the model, no parent ? if not - // we'll ignore, we'll get called back here anyway ) - Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW ); - Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY ); - OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" ); - if ( xDocOwner.is() ) + do { - bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) ); + Reference< XModel > xDoc( getXModel( static_cast< XContainer *> ( this ) ) ); + if ( !xDoc.is() ) + break; + + Reference< XMultiServiceFactory > xDocFac( xDoc, UNO_QUERY_THROW ); + Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY ); + if ( !xNameQuery.is() ) + break; + + ::osl::MutexGuard aGuard( m_rMutex ); + bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( i_nIndex ) ); if ( hasVBABindings ) - { - OSL_TRACE("Has VBA bindings already, returning "); - return; - } - Reference< XMultiServiceFactory > xFac( comphelper::getProcessServiceFactory(), UNO_QUERY ); - Reference< XMultiServiceFactory > xDocFac( xDocOwner, UNO_QUERY ); - if ( xFac.is() && xDocFac.is() ) - { - try - { - Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW ); - Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW ); - Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY_THROW ); - - rtl::OUString sCodeName; - sCodeName = xNameQuery->getCodeNameForObject( xIf ); - Reference< XPropertySet > xProps( xIf, UNO_QUERY ); - rtl::OUString sServiceName; - xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName; - - Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xFac->createInstance( sServiceName ), sCodeName ); - // register the vba script events - if ( m_xEventAttacher.is() ) - m_xEventAttacher->registerScriptEvents( _nIndex, vbaEvents ); - } - catch( Exception& ){ OSL_TRACE("lcl_fakevbaevents - Caught Exception trying to create control eventstuff "); } - } + break; + + Reference< XInterface > xElement( getByIndex( i_nIndex ) , UNO_QUERY_THROW ); + Reference< XForm > xElementAsForm( xElement, UNO_QUERY ); + if ( xElementAsForm.is() ) + break; + ::rtl::OUString sCodeName( xNameQuery->getCodeNameForObject( xElement ) ); + + Reference< XPropertySet > xProps( xElement, UNO_QUERY_THROW ); + ::rtl::OUString sServiceName; + xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName; + + Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( m_xServiceFactory->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW ); + Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( m_xServiceFactory->createInstance( sServiceName ), sCodeName ); + // register the vba script events + m_xEventAttacher->registerScriptEvents( i_nIndex, vbaEvents ); } + while ( false ); + } + catch ( const ServiceNotRegisteredException& ) + { + // silence this, not all document types support the ooo.vba.VBACodeNameProvider service } - catch( Exception& ) + catch( const Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } @@ -827,8 +827,9 @@ void OInterfaceContainer::approveNewElement( const Reference< XPropertySet >& _r void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XPropertySet >& _rxElement, sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException ) { - RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert" ); + const bool bHandleEvents = _bEvents && m_xEventAttacher.is(); + // SYNCHRONIZED -----> ::osl::ClearableMutexGuard aGuard( m_rMutex ); ::std::auto_ptr< ElementDescription > aAutoDeleteMetaData; @@ -866,17 +867,24 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper m_aMap.insert( ::std::pair< const ::rtl::OUString, InterfaceRef >( sName, pElementMetaData->xInterface ) ); // announce ourself as parent to the new element - { - RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert::settingParent" ); - pElementMetaData->xChild->setParent(static_cast<XContainer*>(this)); - } + pElementMetaData->xChild->setParent(static_cast<XContainer*>(this)); // handle the events - if ( _bEvents && m_xEventAttacher.is() ) + if ( bHandleEvents ) { m_xEventAttacher->insertEntry(_nIndex); m_xEventAttacher->attach( _nIndex, pElementMetaData->xInterface, makeAny( _rxElement ) ); - // insert fake events? + } + + // notify derived classes + implInserted( pElementMetaData ); + + aGuard.clear(); + // <----- SYNCHRONIZED + + // insert faked VBA events? + if ( bHandleEvents ) + { Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY ); if ( xMgr.is() ) { @@ -885,19 +893,16 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper for ( sal_Int32 i = 0; (i < nLen) && pIfcMgr ; ++i ) { // add fake events to the control at index i - pIfcMgr->fakeVbaEventsHack( i ); + pIfcMgr->impl_addVbEvents_nolck_nothrow( i ); } } else { // add fake events to the control at index i - fakeVbaEventsHack( _nIndex ); + impl_addVbEvents_nolck_nothrow( _nIndex ); } } - // notify derived classes - implInserted( pElementMetaData ); - // fire the notification about the change if ( _bFire ) { @@ -1187,29 +1192,30 @@ void SAL_CALL OInterfaceContainer::removeByName(const ::rtl::OUString& Name) thr //------------------------------------------------------------------------ void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const ScriptEventDescriptor& aScriptEvent ) throw(IllegalArgumentException, RuntimeException) { - OSL_TRACE("*** registerScriptEvent %d", nIndex); + ::osl::ClearableMutexGuard aGuard( m_rMutex ); if ( m_xEventAttacher.is() ) { m_xEventAttacher->registerScriptEvent( nIndex, aScriptEvent ); - fakeVbaEventsHack( nIndex ); // add fake vba events + aGuard.clear(); + impl_addVbEvents_nolck_nothrow( nIndex ); // add fake vba events } } //------------------------------------------------------------------------ void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const Sequence< ScriptEventDescriptor >& aScriptEvents ) throw(IllegalArgumentException, RuntimeException) { - OSL_TRACE("*** registerScriptEvent(s) %d", nIndex); + ::osl::ClearableMutexGuard aGuard( m_rMutex ); if ( m_xEventAttacher.is() ) { m_xEventAttacher->registerScriptEvents( nIndex, aScriptEvents ); - fakeVbaEventsHack( nIndex ); // add fake vba events + aGuard.clear(); + impl_addVbEvents_nolck_nothrow( nIndex ); // add fake vba events } } //------------------------------------------------------------------------ void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(IllegalArgumentException, RuntimeException) { - OSL_TRACE("*** revokeScriptEvent %d listenertype %s, eventMethod %s", nIndex, rtl::OUStringToOString( aListenerType, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aEventMethod, RTL_TEXTENCODING_UTF8 ).getStr()); if ( m_xEventAttacher.is() ) m_xEventAttacher->revokeScriptEvent( nIndex, aListenerType, aEventMethod, aRemoveListenerParam ); } @@ -1238,7 +1244,6 @@ void SAL_CALL OInterfaceContainer::removeEntry( sal_Int32 nIndex ) throw(Illegal //------------------------------------------------------------------------ Sequence< ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException) { - OSL_TRACE("getScriptEvents"); Sequence< ScriptEventDescriptor > aReturn; if ( m_xEventAttacher.is() ) { diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 48e6159585ab..68f3e0e7773f 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -48,6 +48,8 @@ #include <com/sun/star/form/XConfirmDeleteListener.hpp> #include <com/sun/star/sdb/RowChangeEvent.hpp> #include <com/sun/star/sdb/RowChangeAction.hpp> +#include <com/sun/star/sdb/SQLFilterOperator.hpp> +#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/form/XReset.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> @@ -94,6 +96,7 @@ namespace frm using ::com::sun::star::form::runtime::FeatureState; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::sdbc::SQLException; + using namespace ::com::sun::star::sdbc; using ::com::sun::star::form::XForm; using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::util::XModifyBroadcaster; @@ -112,6 +115,7 @@ namespace frm using ::com::sun::star::sdbcx::XRowLocate; using ::com::sun::star::form::XConfirmDeleteListener; using ::com::sun::star::sdb::RowChangeEvent; + using namespace ::com::sun::star::sdb; using ::com::sun::star::form::XReset; using ::com::sun::star::beans::XMultiPropertySet; using ::com::sun::star::uno::makeAny; @@ -1684,7 +1688,23 @@ namespace frm void FormOperations::impl_appendFilterByColumn_throw( const void* _pActionParam ) const { const param_appendFilterByColumn* pParam = static_cast< const param_appendFilterByColumn* >( _pActionParam ); - m_xParser->appendFilterByColumn( pParam->xField, sal_True ); + sal_Int32 nOp = SQLFilterOperator::EQUAL; + if ( pParam->xField.is() ) + { + sal_Int32 nType = 0; + pParam->xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nType; + switch(nType) + { + case DataType::VARCHAR: + case DataType::CHAR: + case DataType::LONGVARCHAR: + nOp = SQLFilterOperator::LIKE; + break; + default: + nOp = SQLFilterOperator::EQUAL; + } + } + m_xParser->appendFilterByColumn( pParam->xField, sal_True,nOp ); } //------------------------------------------------------------------------------ diff --git a/javainstaller2/src/Properties/setupfiles_template.properties b/javainstaller2/src/Properties/setupfiles_template.properties index 66fb366e536a..04852635e784 100755..100644 --- a/javainstaller2/src/Properties/setupfiles_template.properties +++ b/javainstaller2/src/Properties/setupfiles_template.properties @@ -1,6 +1,7 @@ # # setupfiles_${LANGUAGE}.properties # +# x-no-translate String_Helpfile_AcceptLicense=AcceptLicense_${LANGUAGE}.html String_Helpfile_ChooseComponents=ChooseComponents_${LANGUAGE}.html diff --git a/javainstaller2/src/Properties/setupstrings_template.properties b/javainstaller2/src/Properties/setupstrings_template.properties index d74113e66213..07bfa3ec192f 100755..100644 --- a/javainstaller2/src/Properties/setupstrings_template.properties +++ b/javainstaller2/src/Properties/setupstrings_template.properties @@ -1,6 +1,7 @@ # # setupstrings_${LANGUAGE}.properties # +# x-no-translate String_Previous=${STRING_PREVIOUS} String_Next=${STRING_NEXT} diff --git a/lingucomponent/prj/build.lst b/lingucomponent/prj/build.lst index 138e5858f70e..045aaee82999 100644 --- a/lingucomponent/prj/build.lst +++ b/lingucomponent/prj/build.lst @@ -1,9 +1,8 @@ -lc lingucomponent : linguistic libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell NULL +lc lingucomponent : linguistic libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell MYTHES:mythes NULL lc lingucomponent usr1 - all lc_mkout NULL lc lingucomponent\inc nmake - all lc_inc NULL lc lingucomponent\source\lingutil nmake - all lc_util lc_inc NULL -lc lingucomponent\source\thesaurus\mythes nmake - all lc_mythes lc_util lc_inc NULL -lc lingucomponent\source\thesaurus\libnth nmake - all lc_libnth lc_mythes lc_util lc_inc NULL +lc lingucomponent\source\thesaurus\libnth nmake - all lc_libnth lc_util lc_inc NULL lc lingucomponent\source\spellcheck\spell nmake - all lc_libspell lc_util lc_inc NULL lc lingucomponent\source\hyphenator\altlinuxhyph\hyphen nmake - all lc_libhyphen lc_util lc_inc NULL lc lingucomponent\source\languageguessing nmake - all lc_languageguessing lc_util lc_inc NULL diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx index 8486f4fb38fd..0cb6ad8ec3da 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx @@ -452,17 +452,14 @@ Reference< XSpellAlternatives > count = pMS->suggest(&suglst, (const char *) aWrd.getStr()); if (count) { - aStr.realloc( numsug + count ); OUString *pStr = aStr.getArray(); - for (int ii=0; ii < count; ii++) + for (int ii=0; ii < count; ++ii) { - // if needed add: if (suglst[ii] == NULL) continue; OUString cvtwrd(suglst[ii],strlen(suglst[ii]),aEnc); pStr[numsug + ii] = cvtwrd; - free(suglst[ii]); } - free(suglst); + pMS->free_list(&suglst, count); numsug += count; } } diff --git a/lingucomponent/source/thesaurus/mythes/Makefile b/lingucomponent/source/thesaurus/mythes/Makefile deleted file mode 100644 index b1d811296714..000000000000 --- a/lingucomponent/source/thesaurus/mythes/Makefile +++ /dev/null @@ -1,39 +0,0 @@ - -CXX=g++ - -CXXFLAGS= -O2 -Wall -ansi -pedantic -I. - -LDFLAGS=-L. -lmythes - -LIBS=libmythes.a - -AR=ar rc -RANLIB=ranlib - -OBJS = mythes.o - -all: example - -libmythes.a: $(OBJS) - $(AR) $@ $(OBJS) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -example: example.o $(LIBS) - $(CXX) $(CXXFLAGS) -o $@ example.o $(LDFLAGS) - -%.o: %.cxx - $(CXX) $(CXXFLAGS) -c $< - -clean: - rm -f *.o *~ example libthes.a - -distclean: clean - -depend: - makedepend -- $(CXXFLAGS) -- *.[ch]xx - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -mythes.o: mythes.hxx -example.o: mythes.hxx - diff --git a/lingucomponent/source/thesaurus/mythes/README b/lingucomponent/source/thesaurus/mythes/README deleted file mode 100644 index 421f16a712fe..000000000000 --- a/lingucomponent/source/thesaurus/mythes/README +++ /dev/null @@ -1,60 +0,0 @@ -MyThes is a simple thesaurus that uses a structured -text data file and an index file with binary search -to lookup words and phrases and return information -on part of speech, meanings, and synonyms - -MyThes was written to provide a thesaurus for the -OpenOffice.org project - -The Main features of MyThes are: - -1. written in C++ to make it easier to interface with - Pspell, OpenOffice, AbiWord, etc - -2. it is stateless, uses no static variables and - should be completely reentrant with no ifdefs - -3. it compiles with -ansi and -pedantic and -Wall - with no warnings so it should be quite portable - -4. it uses a perl program to read the structured - text file and create the index needed for bianry - searching (see dictionaries/en_US/th_gen_idx.pl) - -5. it is very simple with *lots* of comments. - The main "smarts" are in the structure of the - text file that makes up the thesaurus data - -6. It comes with a ready-to-go structured thesaurus - data file for en_US extracted from the WordNet-2.0 data. - (see dictioanries/en_US/th_en_US_new.dat) - - Please see WordNet_license.txt and WordNet_readme.txt - for more information on the very useful project! - (found in dictionaries/en_US/) - -7. The source code has a BSD license (and no advertising clause) - - -MyThes has the world's simplest Makefile and no -configure support. It does come with a simple example -program that looks up some words and returns meanings -and synonyms. - -To build it simply do the following: - -unzip mythes.zip -cd mythes -make - -To run the example program: -./example th_en_US_new.idx th_en_US_new.dat checkme.lst - -Please play around with it and let me know -what you think. - -Thanks, - -Kevin Hendricks -kevin.hendricks@sympatico.ca - diff --git a/lingucomponent/source/thesaurus/mythes/checkme.lst b/lingucomponent/source/thesaurus/mythes/checkme.lst deleted file mode 100644 index 120d343a9e0f..000000000000 --- a/lingucomponent/source/thesaurus/mythes/checkme.lst +++ /dev/null @@ -1,4 +0,0 @@ -simple -complex -junk -jhjhjh diff --git a/lingucomponent/source/thesaurus/mythes/data_layout.txt b/lingucomponent/source/thesaurus/mythes/data_layout.txt deleted file mode 100644 index ef4bc255d96a..000000000000 --- a/lingucomponent/source/thesaurus/mythes/data_layout.txt +++ /dev/null @@ -1,131 +0,0 @@ -Description of the Structure of the Data needed by MyThes --------------------------------------------------------- - -MyThes is very simple. Almost all of the "smarts" are really -in the thesaurus data file itself. - -The format for this file is at follows: - -- no binary data - -- line ending is a newline '\n' and not carriage return/linefeeds - -- Line 1 is a character string that describes the encoding -used for the file. It is up to the calling program to convert -to and from this encoding if necessary. - - ISO8859-1 is used by the th_en_US_new.dat file. - - Strings currently recognized by OpenOffice.org are: - - UTF-8 - ISO8859-1 - ISO8859-2 - ISO8859-3 - ISO8859-4 - ISO8859-5 - ISO8859-6 - ISO8859-7 - ISO8859-8 - ISO8859-9 - ISO8859-10 - KOI8-R - CP-1251 - ISO8859-14 - ISCII-DEVANAGARI - - -- All of the remaning lines of the file follow this structure - -entry|num_mean -pos|syn1_mean|syn2|... -. -. -. -pos|mean_syn1|syn2|... - - -where: - - entry - all lowercase version of the word or phrase being described - num_mean - number of meanings for this entry - - There is one meaning per line and each meaning is comprised of - - pos - part of speech or other meaning specific description - syn1_mean - synonym 1 also used to describe the meaning itself - syn2 - synonym 2 for that meaning etc. - - -To make this even more clearer, here is actual data for the -entry "simple". - -simple|9 -(adj)|simple |elemental|ultimate|oversimplified|simplistic|simplex|simplified|unanalyzable| -undecomposable|uncomplicated|unsophisticated|easy|plain|unsubdivided -(adj)|elementary|uncomplicated|unproblematic|easy -(adj)|bare|mere|plain -(adj)|childlike|wide-eyed|dewy-eyed|naive |naif -(adj)|dim-witted|half-witted|simple-minded|retarded -(adj)|simple |unsubdivided|unlobed|smooth -(adj)|plain -(noun)|herb|herbaceous plant -(noun)|simpleton|person|individual|someone|somebody|mortal|human|soul - - -It says that "simple" has 9 different meanings and each -meaning will have its part of speech and at least 1 synonym -with other if presetn following on the same line. - - - -Once you ahve created your own structured text file you can use -the perl program "th_gen_idx.pl" which can be found in this -directory to create an index file that is used to seek into -your data file by the MyThes code. - -The correct way to run the perl program is as follows: - -cat th_en_US_new.dat | ./th_gen_idx.pl > th_en_US_new.idx - - - -Then if you head the resulting index file you should see the -following: - -ISO8859-1 -142689 -'hood|10 -'s gravenhage|88 -'tween|173 -'tween decks|196 -.22|231 -.22 caliber|319 -.22 calibre|365 -.38 caliber|411 -.38 calibre|457 -.45 caliber|503 -.45 calibre|549 -0|595 -1|666 -1 chronicles|6283 -1 esdras|6336 - - -Line 1 is the same encoding string taken from the -structured thesaurus data file. - -Line 2 is a count of the total number of entries -in your thesaurus. - -All of the remaining lines are of the form - -entry|byte_offset_into_data_file_where_entry_is_found - - -That's all there is too it. - - -Kevin -kevin.hendricks@sympatico.ca - diff --git a/lingucomponent/source/thesaurus/mythes/example.cxx b/lingucomponent/source/thesaurus/mythes/example.cxx deleted file mode 100644 index 31c85989cf26..000000000000 --- a/lingucomponent/source/thesaurus/mythes/example.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_lingucomponent.hxx" -#include <cstring> -#include <cstdlib> -#include <cstdio> - -#include "mythes.hxx" - -extern char * mystrdup(const char * s); - -using namespace std; - -int -main(int argc, char** argv) -{ - - char * af; - char * df; - char * wtc; - FILE* wtclst; - - /* first parse the command line options */ - /* arg1 - index file, arg2 thesaurus data file, arg3 - file of words to check */ - - if (argv[1]) { - af = mystrdup(argv[1]); - } else { - fprintf(stderr,"correct syntax is:\n"); - fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n"); - exit(1); - } - if (argv[2]) { - df = mystrdup(argv[2]); - } else { - fprintf(stderr,"correct syntax is:\n"); - fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n"); - exit(1); - } - if (argv[3]) { - wtc = mystrdup(argv[3]); - } else { - fprintf(stderr,"correct syntax is:\n"); - fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n"); - exit(1); - } - - - /* open the words to check list */ - wtclst = fopen(wtc,"r"); - if (!wtclst) { - fprintf(stderr,"Error - could not open file of words to check\n"); - exit(1); - } - - // open a new thesaurus object - MyThes * pMT= new MyThes(af,df); - - // get the encoding used for the thesaurus data - char * encoding = pMT->get_th_encoding(); - fprintf(stdout,"Thesaurus uses encoding %s\n\n",encoding); - - int k; - char buf[101]; - mentry * pmean; - - while(fgets(buf,100,wtclst)) { - k = strlen(buf); - *(buf + k - 1) = '\0'; - int len = strlen(buf); - int count = pMT->Lookup(buf,len,&pmean); - // don't change value of pmean - // or count since needed for CleanUpAfterLookup routine - mentry* pm = pmean; - if (count) { - fprintf(stdout,"%s has %d meanings\n",buf,count); - for (int i=0; i < count; i++) { - fprintf(stdout," meaning %d: %s\n",i,pm->defn); - for (int j=0; j < pm->count; j++) { - fprintf(stdout," %s\n",pm->psyns[j]); - } - fprintf(stdout,"\n"); - pm++; - } - fprintf(stdout,"\n\n"); - // now clean up all allocated memory - pMT->CleanUpAfterLookup(&pmean,count); - } else { - fprintf(stdout,"\"%s\" is not in thesaurus!\n",buf); - } - } - - delete pMT; - fclose(wtclst); - free(wtc); - free(df); - free(af); - - return 0; -} - diff --git a/lingucomponent/source/thesaurus/mythes/license.readme b/lingucomponent/source/thesaurus/mythes/license.readme deleted file mode 100644 index b6bf70a0c7fe..000000000000 --- a/lingucomponent/source/thesaurus/mythes/license.readme +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2003 Kevin B. Hendricks, Stratford, Ontario, Canada - * And Contributors. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All modifications to the source code must be clearly marked as - * such. Binary redistributions based on modified source code - * must be clearly marked as modified versions in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY KEVIN B. HENDRICKS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * KEVIN B. HENDRICKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ diff --git a/lingucomponent/source/thesaurus/mythes/makefile.mk b/lingucomponent/source/thesaurus/mythes/makefile.mk deleted file mode 100644 index ac45219b97a0..000000000000 --- a/lingucomponent/source/thesaurus/mythes/makefile.mk +++ /dev/null @@ -1,59 +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. -# -#************************************************************************* - -PRJ = ..$/..$/.. - -PRJNAME = lingucomponent -TARGET = mythes -LIBTARGET=NO - -#----- Settings --------------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(SYSTEM_MYTHES)" == "YES" -@all: - @echo "Using system mythes..." -.ENDIF - -all_target: ALLTAR - - - -SLOFILES= \ - $(SLO)$/mythes.obj - -LIB1TARGET= $(SLB)$/lib$(TARGET).lib -LIB1ARCHIV= $(LB)/lib$(TARGET).a -LIB1OBJFILES= $(SLOFILES) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/lingucomponent/source/thesaurus/mythes/mythes.cxx b/lingucomponent/source/thesaurus/mythes/mythes.cxx deleted file mode 100644 index ebb224d92140..000000000000 --- a/lingucomponent/source/thesaurus/mythes/mythes.cxx +++ /dev/null @@ -1,403 +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. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_lingucomponent.hxx" -#include "license.readme" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> - -#include "mythes.hxx" - - - -MyThes::MyThes(const char* idxpath, const char * datpath) -{ - nw = 0; - encoding = NULL; - list = NULL; - offst = NULL; - - if (thInitialize(idxpath, datpath) != 1) { - fprintf(stderr,"Error - can't open %s or %s\n",idxpath, datpath); - fflush(stderr); - thCleanup(); - // did not initialize properly - throw exception? - } -} - - -MyThes::~MyThes() -{ - thCleanup(); -} - - -int MyThes::thInitialize(const char* idxpath, const char* datpath) -{ - - // open the index file - FILE * pifile = fopen(idxpath,"r"); - if (!pifile) { - return 0; - } - - // parse in encoding and index size */ - char * wrd; - wrd = (char *)calloc(1, MAX_WD_LEN); - if (!wrd) { - fprintf(stderr,"Error - bad memory allocation\n"); - fflush(stderr); - fclose(pifile); - return 0; - } - int len = readLine(pifile,wrd,MAX_WD_LEN); - encoding = mystrdup(wrd); - len = readLine(pifile,wrd,MAX_WD_LEN); - int idxsz = atoi(wrd); - - - // now allocate list, offst for the given size - list = (char**) calloc(idxsz,sizeof(char*)); - offst = (unsigned int*) calloc(idxsz,sizeof(unsigned int)); - - if ( (!(list)) || (!(offst)) ) { - fprintf(stderr,"Error - bad memory allocation\n"); - fflush(stderr); - fclose(pifile); - return 0; - } - - // now parse the remaining lines of the index - len = readLine(pifile,wrd,MAX_WD_LEN); - while (len > 0) - { - int np = mystr_indexOfChar(wrd,'|'); - if (nw < idxsz) { - if (np >= 0) { - *(wrd+np) = '\0'; - list[nw] = (char *)calloc(1,(np+1)); - if (!list[nw]) { - fprintf(stderr,"Error - bad memory allocation\n"); - fflush(stderr); - fclose(pifile); - return 0; - } - memcpy((list[nw]),wrd,np); - offst[nw] = atoi(wrd+np+1); - nw++; - } - } - len = readLine(pifile,wrd,MAX_WD_LEN); - } - - free((void *)wrd); - fclose(pifile); - - /* next open the data file */ - pdfile = fopen(datpath,"r"); - if (!pdfile) { - return 0; - } - - return 1; -} - - -void MyThes::thCleanup() -{ - /* first close the data file */ - if (pdfile) { - fclose(pdfile); - pdfile=NULL; - } - - if (list) - { - /* now free up all the allocated strings on the list */ - for (int i=0; i < nw; i++) - { - if (list[i]) { - free(list[i]); - list[i] = 0; - } - } - free((void*)list); - } - - if (encoding) free((void*)encoding); - if (offst) free((void*)offst); - - encoding = NULL; - list = NULL; - offst = NULL; - nw = 0; -} - - - -// lookup text in index and count of meanings and a list of meaning entries -// with each entry having a synonym count and pointer to an -// array of char * (i.e the synonyms) -// -// note: calling routine should call CleanUpAfterLookup with the original -// meaning point and count to properly deallocate memory - -int MyThes::Lookup(const char * pText, int len, mentry** pme) -{ - - *pme = NULL; - - // handle the case of missing file or file related errors - if (! pdfile) return 0; - - long offset = 0; - - /* copy search word and make sure null terminated */ - char * wrd = (char *) calloc(1,(len+1)); - memcpy(wrd,pText,len); - - /* find it in the list */ - int idx = nw > 0 ? binsearch(wrd,list,nw) : -1; - free(wrd); - if (idx < 0) return 0; - - // now seek to the offset - offset = (long) offst[idx]; - int rc = fseek(pdfile,offset,SEEK_SET); - if (rc) { - return 0; - } - - // grab the count of the number of meanings - // and allocate a list of meaning entries - char * buf = NULL; - buf = (char *) malloc( MAX_LN_LEN ); - if (!buf) return 0; - readLine(pdfile, buf, (MAX_LN_LEN-1)); - int np = mystr_indexOfChar(buf,'|'); - if (np < 0) { - free(buf); - return 0; - } - int nmeanings = atoi(buf+np+1); - *pme = (mentry*) malloc( nmeanings * sizeof(mentry) ); - if (!(*pme)) { - free(buf); - return 0; - } - - // now read in each meaning and parse it to get defn, count and synonym lists - mentry* pm = *(pme); - char dfn[MAX_WD_LEN]; - - for (int j = 0; j < nmeanings; j++) { - readLine(pdfile, buf, (MAX_LN_LEN-1)); - - pm->count = 0; - pm->psyns = NULL; - pm->defn = NULL; - - // store away the part of speech for later use - char * p = buf; - char * pos = NULL; - np = mystr_indexOfChar(p,'|'); - if (np >= 0) { - *(buf+np) = '\0'; - pos = mystrdup(p); - p = p + np + 1; - } else { - pos = mystrdup(""); - } - - // count the number of fields in the remaining line - int nf = 1; - char * d = p; - np = mystr_indexOfChar(d,'|'); - while ( np >= 0 ) { - nf++; - d = d + np + 1; - np = mystr_indexOfChar(d,'|'); - } - pm->count = nf; - pm->psyns = (char **) malloc(nf*sizeof(char*)); - - // fill in the synonym list - d = p; - for (int jj = 0; jj < nf; jj++) - { - np = mystr_indexOfChar(d,'|'); - if (np > 0) - { - *(d+np) = '\0'; - pm->psyns[jj] = mystrdup(d); - d = d + np + 1; - } - else - { - pm->psyns[jj] = mystrdup(d); - } - } - - // add pos to first synonym to create the definition - int k = strlen(pos); - int m = strlen(pm->psyns[0]); - if ((k+m) < (MAX_WD_LEN - 1)) { - strncpy(dfn,pos,k); - *(dfn+k) = ' '; - strncpy((dfn+k+1),(pm->psyns[0]),m+1); - pm->defn = mystrdup(dfn); - } else { - pm->defn = mystrdup(pm->psyns[0]); - } - free(pos); - pm++; - - } - free(buf); - - return nmeanings; -} - - - -void MyThes::CleanUpAfterLookup(mentry ** pme, int nmeanings) -{ - - if (nmeanings == 0) return; - if ((*pme) == NULL) return; - - mentry * pm = *pme; - - for (int i = 0; i < nmeanings; i++) { - int count = pm->count; - for (int j = 0; j < count; j++) { - if (pm->psyns[j]) free(pm->psyns[j]); - pm->psyns[j] = NULL; - } - if (pm->psyns) free(pm->psyns); - pm->psyns = NULL; - if (pm->defn) free(pm->defn); - pm->defn = NULL; - pm->count = 0; - pm++; - } - pm = *pme; - free(pm); - *pme = NULL; - return; -} - - -// read a line of text from a text file stripping -// off the line terminator and replacing it with -// a null string terminator. -// returns: -1 on error or the number of characters in -// in the returning string - -// A maximum of nc characters will be returned - -int MyThes::readLine(FILE * pf, char * buf, int nc) -{ - - if (fgets(buf,nc,pf)) { - mychomp(buf); - return strlen(buf); - } - return -1; -} - - - -// performs a binary search on null terminated character -// strings -// -// returns: -1 on not found -// index of wrd in the list[] - -int MyThes::binsearch(char * sw, char* _list[], int nlst) -{ - int lp, up, mp, j, indx; - lp = 0; - up = nlst-1; - indx = -1; - if (strcmp(sw,_list[lp]) < 0) return -1; - if (strcmp(sw,_list[up]) > 0) return -1; - while (indx < 0 ) { - mp = (int)((lp+up) >> 1); - j = strcmp(sw,_list[mp]); - if ( j > 0) { - lp = mp + 1; - } else if (j < 0 ) { - up = mp - 1; - } else { - indx = mp; - } - if (lp > up) return -1; - } - return indx; -} - -char * MyThes::get_th_encoding() -{ - if (encoding) return encoding; - return NULL; -} - - -// string duplication routine -char * MyThes::mystrdup(const char * p) -{ - int sl = strlen(p) + 1; - char * d = (char *)malloc(sl); - if (d) { - memcpy(d,p,sl); - return d; - } - return NULL; -} - -// remove cross-platform text line end characters -void MyThes::mychomp(char * s) -{ - int k = strlen(s); - if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0'; - if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0'; -} - - -// return index of char in string -int MyThes::mystr_indexOfChar(const char * d, int c) -{ - char * p = strchr((char *)d,c); - if (p) return (int)(p-d); - return -1; -} - diff --git a/lingucomponent/source/thesaurus/mythes/mythes.hxx b/lingucomponent/source/thesaurus/mythes/mythes.hxx deleted file mode 100644 index 539e6723c42d..000000000000 --- a/lingucomponent/source/thesaurus/mythes/mythes.hxx +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _MYTHES_HXX_ -#define _MYTHES_HXX_ - -// some maximum sizes for buffers -#define MAX_WD_LEN 200 -#define MAX_LN_LEN 16384 - - -// a meaning with definition, count of synonyms and synonym list -struct mentry { - char* defn; - int count; - char** psyns; -}; - - -class MyThes -{ - - int nw; /* number of entries in thesaurus */ - char** list; /* stores word list */ - unsigned int* offst; /* stores offset list */ - char * encoding; /* stores text encoding; */ - - FILE *pdfile; - - // disallow copy-constructor and assignment-operator for now - MyThes(); - MyThes(const MyThes &); - MyThes & operator = (const MyThes &); - -public: - MyThes(const char* idxpath, const char* datpath); - ~MyThes(); - - // lookup text in index and return number of meanings - // each meaning entry has a defintion, synonym count and pointer - // when complete return the *original* meaning entry and count via - // CleanUpAfterLookup to properly handle memory deallocation - - int Lookup(const char * pText, int len, mentry** pme); - - void CleanUpAfterLookup(mentry** pme, int nmean); - - char* get_th_encoding(); - -private: - // Open index and dat files and load list array - int thInitialize (const char* indxpath, const char* datpath); - - // internal close and cleanup dat and idx files - void thCleanup (); - - // read a text line (\n terminated) stripping off line terminator - int readLine(FILE * pf, char * buf, int nc); - - // binary search on null terminated character strings - int binsearch(char * wrd, char* list[], int nlst); - - // string duplication routine - char * mystrdup(const char * p); - - // remove cross-platform text line end characters - void mychomp(char * s); - - // return index of char in string - int mystr_indexOfChar(const char * d, int c); - -}; - -#endif - - - - - diff --git a/package/inc/PackageConstants.hxx b/package/inc/PackageConstants.hxx index e088dceef126..a23a22fcb888 100644 --- a/package/inc/PackageConstants.hxx +++ b/package/inc/PackageConstants.hxx @@ -33,10 +33,6 @@ const sal_Int32 n_ConstBufferSize = 32768; const sal_Int32 n_ConstMaxMemoryStreamSize = 20480; const sal_Int32 n_ConstDigestLength = 1024; -#define PACKAGE_FORMAT 1 -#define ZIP_FORMAT 2 -#define OFOPXML_FORMAT 3 - // the constants related to the manifest.xml entries #define PKG_MNFST_MEDIATYPE 0 #define PKG_MNFST_VERSION 1 diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx index 367bd1d80de5..e3b8d44be183 100644 --- a/package/inc/ZipPackage.hxx +++ b/package/inc/ZipPackage.hxx @@ -93,7 +93,7 @@ protected: sal_Bool m_bForceRecovery; sal_Bool m_bMediaTypeFallbackUsed; - sal_Int16 m_nFormat; + sal_Int32 m_nFormat; sal_Bool m_bAllowRemoveOnInsert; InitialisationMode m_eMode; @@ -125,7 +125,7 @@ public: virtual ~ZipPackage( void ); ZipFile& getZipFile() { return *m_pZipFile;} const com::sun::star::uno::Sequence < sal_Int8 > & getEncryptionKey ( ) {return m_aEncryptionKey;} - sal_Int16 getFormat() const { return m_nFormat; } + sal_Int32 getFormat() const { return m_nFormat; } SotMutexHolderRef GetSharedMutexRef() { return m_aMutexHolder; } diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index 85823ba97c2c..89414f18ce65 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -58,13 +58,13 @@ class ZipPackageFolder : public cppu::ImplInheritanceHelper2 protected: ContentHash maContents; const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory; - sal_Int16 m_nFormat; + sal_Int32 m_nFormat; ::rtl::OUString m_sVersion; public: ZipPackageFolder( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory, - sal_Int16 nFormat, + sal_Int32 nFormat, sal_Bool bAllowRemoveOnInsert ); virtual ~ZipPackageFolder(); @@ -87,7 +87,7 @@ public: return aImplementationId; } - void setPackageFormat_Impl( sal_Int16 nFormat ) { m_nFormat = nFormat; } + void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; } void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; } // Recursive functions diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 45bf7c01eb2f..fcb118f4b967 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -29,6 +29,7 @@ #include "precompiled_package.hxx" #include "ocompinstream.hxx" +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <osl/diagnose.h> @@ -41,7 +42,7 @@ using namespace ::com::sun::star; OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl, uno::Reference < io::XInputStream > xStream, const uno::Sequence< beans::PropertyValue >& aProps, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_pImpl( &aImpl ) , m_rMutexRef( m_pImpl->m_rMutexRef ) , m_xStream( xStream ) @@ -60,7 +61,7 @@ OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl, //----------------------------------------------- OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > xStream, const uno::Sequence< beans::PropertyValue >& aProps, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_pImpl( NULL ) , m_rMutexRef( new SotMutexHolder ) , m_xStream( xStream ) @@ -107,7 +108,7 @@ uno::Any SAL_CALL OInputCompStream::queryInterface( const uno::Type& rType ) if ( aReturn.hasValue() == sal_True ) return aReturn ; - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { aReturn <<= ::cppu::queryInterface ( rType @@ -356,7 +357,7 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); try @@ -384,7 +385,7 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -409,7 +410,7 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -434,7 +435,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByI throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); // TODO/LATER: in future the unification of the ID could be checked @@ -464,7 +465,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< uno::Sequence< beans::StringPair > > aResult; @@ -499,7 +500,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); // TODO/LATER: in future the information could be taken directly from m_pImpl when possible @@ -530,7 +531,7 @@ void SAL_CALL OInputCompStream::insertRelationshipByID( const ::rtl::OUString& throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); throw io::IOException(); // TODO: Access denied @@ -550,7 +551,7 @@ void SAL_CALL OInputCompStream::removeRelationshipByID( const ::rtl::OUString& throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); throw io::IOException(); // TODO: Access denied @@ -570,7 +571,7 @@ void SAL_CALL OInputCompStream::insertRelationships( const uno::Sequence< uno:: throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); throw io::IOException(); // TODO: Access denied @@ -589,7 +590,7 @@ void SAL_CALL OInputCompStream::clearRelationships() throw lang::DisposedException(); } - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); throw io::IOException(); // TODO: Access denied diff --git a/package/source/xstor/ocompinstream.hxx b/package/source/xstor/ocompinstream.hxx index 047c8dc90758..fcb472e3f92a 100644 --- a/package/source/xstor/ocompinstream.hxx +++ b/package/source/xstor/ocompinstream.hxx @@ -60,17 +60,17 @@ protected: sal_Bool m_bDisposed; - sal_Int16 m_nStorageType; + sal_Int32 m_nStorageType; public: OInputCompStream( OWriteStream_Impl& pImpl, ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); OInputCompStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); virtual ~OInputCompStream(); diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx index 6419889d9d11..0cd3f595c2b3 100644 --- a/package/source/xstor/oseekinstream.cxx +++ b/package/source/xstor/oseekinstream.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star; OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl, uno::Reference < io::XInputStream > xStream, const uno::Sequence< beans::PropertyValue >& aProps, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : OInputCompStream( pImpl, xStream, aProps, nStorageType ) { if ( m_xStream.is() ) @@ -51,7 +51,7 @@ OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl, OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > xStream, const uno::Sequence< beans::PropertyValue >& aProps, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : OInputCompStream( xStream, aProps, nStorageType ) { if ( m_xStream.is() ) diff --git a/package/source/xstor/oseekinstream.hxx b/package/source/xstor/oseekinstream.hxx index f8572d717956..92a611af16aa 100644 --- a/package/source/xstor/oseekinstream.hxx +++ b/package/source/xstor/oseekinstream.hxx @@ -42,11 +42,11 @@ public: OInputSeekStream( OWriteStream_Impl& pImpl, ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); OInputSeekStream( ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); virtual ~OInputSeekStream(); diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index c5381a11cfea..be11586bc4fb 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -244,7 +245,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, const uno::Reference< lang::XSingleServiceFactory >& xPackage, const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bForceEncrypted, - sal_Int16 nStorageType, + sal_Int32 nStorageType, sal_Bool bDefaultCompress, const uno::Reference< io::XInputStream >& xRelInfoStream ) : m_pAntiImpl( NULL ) @@ -254,7 +255,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, , m_xFactory( xFactory ) , m_pParent( pParent ) , m_bForceEncrypted( bForceEncrypted ) -, m_bUseCommonPass( !bForceEncrypted && nStorageType == PACKAGE_STORAGE ) +, m_bUseCommonPass( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE ) , m_bHasCachedPassword( sal_False ) , m_bCompressedSetExplicit( !bDefaultCompress ) , m_xPackage( xPackage ) @@ -269,7 +270,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, OSL_ENSURE( xPackage.is(), "No package component is provided!\n" ); OSL_ENSURE( m_xFactory.is(), "No package stream is provided!\n" ); OSL_ENSURE( pParent, "No parent storage is provided!\n" ); - OSL_ENSURE( m_nStorageType == OFOPXML_STORAGE || !m_xOrigRelInfoStream.is(), "The Relations info makes sence only for OFOPXML format!\n" ); + OSL_ENSURE( m_nStorageType == embed::StorageFormats::OFOPXML || !m_xOrigRelInfoStream.is(), "The Relations info makes sence only for OFOPXML format!\n" ); } //----------------------------------------------- @@ -359,7 +360,7 @@ void OWriteStream_Impl::InsertIntoPackageFolder( const ::rtl::OUString& aName, //----------------------------------------------- sal_Bool OWriteStream_Impl::IsEncrypted() { - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) return sal_False; if ( m_bForceEncrypted || m_bHasCachedPassword ) @@ -419,8 +420,8 @@ sal_Bool OWriteStream_Impl::IsEncrypted() //----------------------------------------------- void OWriteStream_Impl::SetDecrypted() { - OSL_ENSURE( m_nStorageType == PACKAGE_STORAGE, "The encryption is supported only for package storages!\n" ); - if ( m_nStorageType != PACKAGE_STORAGE ) + OSL_ENSURE( m_nStorageType == embed::StorageFormats::PACKAGE, "The encryption is supported only for package storages!\n" ); + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); GetStreamProperties(); @@ -444,8 +445,8 @@ void OWriteStream_Impl::SetDecrypted() //----------------------------------------------- void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) { - OSL_ENSURE( m_nStorageType == PACKAGE_STORAGE, "The encryption is supported only for package storages!\n" ); - if ( m_nStorageType != PACKAGE_STORAGE ) + OSL_ENSURE( m_nStorageType == embed::StorageFormats::PACKAGE, "The encryption is supported only for package storages!\n" ); + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); GetStreamProperties(); @@ -789,12 +790,12 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt bCompressedIsSet = sal_True; aProps[nInd].Value >>= bCompressed; } - else if ( ( m_nStorageType == OFOPXML_STORAGE || m_nStorageType == PACKAGE_STORAGE ) + else if ( ( m_nStorageType == embed::StorageFormats::OFOPXML || m_nStorageType == embed::StorageFormats::PACKAGE ) && aProps[nInd].Name.equals( aMedTypePropName ) ) { xPropertySet->setPropertyValue( aProps[nInd].Name, aProps[nInd].Value ); } - else if ( m_nStorageType == PACKAGE_STORAGE && aProps[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) + else if ( m_nStorageType == embed::StorageFormats::PACKAGE && aProps[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) aProps[nInd].Value >>= m_bUseCommonPass; else throw lang::IllegalArgumentException(); @@ -816,7 +817,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt if ( m_bUseCommonPass ) { - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); // set to be encrypted but do not use encryption key @@ -915,7 +916,7 @@ void OWriteStream_Impl::Commit() if ( m_bUseCommonPass ) { - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); // set to be encrypted but do not use encryption key @@ -926,7 +927,7 @@ void OWriteStream_Impl::Commit() } else if ( m_bHasCachedPassword ) { - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "EncryptionKey" ), @@ -972,7 +973,7 @@ void OWriteStream_Impl::Revert() m_bHasCachedPassword = sal_False; m_aPass = ::rtl::OUString(); - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // currently the relations storage is changed only on commit m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); @@ -1011,7 +1012,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( uno::Sequence< beans::PropertyValue > aResult( aProps ); sal_Int32 nLen = aResult.getLength(); - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) if ( aResult[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) @@ -1024,7 +1025,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( aResult[nLen - 1].Name = ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ); aResult[nLen - 1].Value <<= bUseCommonPass; } - else if ( m_nStorageType == OFOPXML_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { ReadRelInfoIfNecessary(); @@ -1061,7 +1062,7 @@ sal_Bool OWriteStream_Impl::IsTransacted() void OWriteStream_Impl::ReadRelInfoIfNecessary() { - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) return; if ( m_nRelInfoStatus == RELINFO_NO_INIT ) @@ -1114,24 +1115,24 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary() uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProperties() { sal_Int32 nPropNum = 0; - if ( m_nStorageType == ZIP_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::ZIP ) nPropNum = 2; - else if ( m_nStorageType == OFOPXML_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) nPropNum = 3; - else if ( m_nStorageType == PACKAGE_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::PACKAGE ) nPropNum = 4; uno::Sequence< beans::PropertyValue > aResult( nPropNum ); // The "Compressed" property must be set after "MediaType" property, // since the setting of the last one can change the value of the first one - if ( m_nStorageType == OFOPXML_STORAGE || m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML || m_nStorageType == embed::StorageFormats::PACKAGE ) { aResult[0].Name = ::rtl::OUString::createFromAscii("MediaType"); aResult[1].Name = ::rtl::OUString::createFromAscii("Compressed"); aResult[2].Name = ::rtl::OUString::createFromAscii("Size"); - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) aResult[3].Name = ::rtl::OUString::createFromAscii("Encrypted"); } else @@ -1177,7 +1178,7 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream OSL_ENSURE( !m_bUseCommonPass, "The stream can not be encrypted!" ); - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException(); if ( m_pAntiImpl ) @@ -1201,7 +1202,7 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream //----------------------------------------------- uno::Sequence< uno::Sequence< beans::StringPair > > OWriteStream_Impl::GetAllRelationshipsIfAny() { - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) return uno::Sequence< uno::Sequence< beans::StringPair > >(); ReadRelInfoIfNecessary(); @@ -1516,7 +1517,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; - if ( m_nStorageType != PACKAGE_STORAGE || !m_pParent ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE || !m_pParent ) throw packages::NoEncryptionException(); return m_pParent->GetCommonRootPass(); @@ -1702,9 +1703,9 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStorage >& xRelStorage, const ::rtl::OUString& aOrigStreamName, const ::rtl::OUString& aNewStreamName ) { // at this point of time the old stream must be already cleaned - OSL_ENSURE( m_nStorageType == OFOPXML_STORAGE, "The method should be used only with OFOPXML format!\n" ); + OSL_ENSURE( m_nStorageType == embed::StorageFormats::OFOPXML, "The method should be used only with OFOPXML format!\n" ); - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { OSL_ENSURE( aOrigStreamName.getLength() && aNewStreamName.getLength() && xRelStorage.is(), "Wrong relation persistence information is provided!\n" ); @@ -1972,12 +1973,12 @@ void OWriteStream::CopyToStreamInternally_Impl( const uno::Reference< io::XStrea // the order of the properties setting is not important for StorageStream API ::rtl::OUString aPropName = ::rtl::OUString::createFromAscii( "Compressed" ); xDestProps->setPropertyValue( aPropName, getPropertyValue( aPropName ) ); - if ( m_pData->m_nStorageType == PACKAGE_STORAGE || m_pData->m_nStorageType == OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE || m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { aPropName = ::rtl::OUString::createFromAscii( "MediaType" ); xDestProps->setPropertyValue( aPropName, getPropertyValue( aPropName ) ); - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { aPropName = ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ); xDestProps->setPropertyValue( aPropName, getPropertyValue( aPropName ) ); @@ -2023,13 +2024,13 @@ uno::Any SAL_CALL OWriteStream::queryInterface( const uno::Type& rType ) if ( aReturn.hasValue() == sal_True ) return aReturn ; - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { aReturn <<= ::cppu::queryInterface ( rType , static_cast<embed::XEncryptionProtectedSource*> ( this ) ); } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { aReturn <<= ::cppu::queryInterface ( rType @@ -2077,7 +2078,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() { if ( m_bTransacted ) { - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2093,7 +2094,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2109,7 +2110,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } - else // if ( m_pData->m_nStorageType == ZIP_STORAGE ) + else // if ( m_pData->m_nStorageType == embed::StorageFormats::ZIP ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2127,7 +2128,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() } else { - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2140,7 +2141,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2153,7 +2154,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< embed::XRelationshipAccess >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } - else // if ( m_pData->m_nStorageType == ZIP_STORAGE ) + else // if ( m_pData->m_nStorageType == embed::StorageFormats::ZIP ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2752,7 +2753,7 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); try @@ -2783,7 +2784,7 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -2808,7 +2809,7 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -2833,7 +2834,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OWriteStream::getRelationshipByID( throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); // TODO/LATER: in future the unification of the ID could be checked @@ -2863,7 +2864,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getRe throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< uno::Sequence< beans::StringPair > > aResult; @@ -2898,7 +2899,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getAl throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); return m_pImpl->GetAllRelationshipsIfAny(); @@ -2918,7 +2919,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID( const ::rtl::OUString& sID, throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); @@ -2983,7 +2984,7 @@ void SAL_CALL OWriteStream::removeRelationshipByID( const ::rtl::OUString& sID throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -3025,7 +3026,7 @@ void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequ throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); @@ -3107,7 +3108,7 @@ void SAL_CALL OWriteStream::clearRelationships() throw lang::DisposedException(); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); m_pImpl->m_aNewRelInfo.realloc( 0 ); @@ -3144,7 +3145,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa m_pImpl->GetStreamProperties(); ::rtl::OUString aCompressedString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ); ::rtl::OUString aMediaTypeString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); - if ( m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equals( aMediaTypeString ) ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equals( aMediaTypeString ) ) { // if the "Compressed" property is not set explicitly, the MediaType can change the default value sal_Bool bCompressedValueFromType = sal_True; @@ -3177,7 +3178,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa m_pImpl->m_aProps[nInd].Value = aValue; } } - else if ( m_pData->m_nStorageType == PACKAGE_STORAGE + else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) { sal_Bool bUseCommonPass = sal_False; @@ -3202,7 +3203,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa else throw lang::IllegalArgumentException(); //TODO } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aPropertyName.equals( aMediaTypeString ) ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aPropertyName.equals( aMediaTypeString ) ) { for ( sal_Int32 nInd = 0; nInd < m_pImpl->m_aProps.getLength(); nInd++ ) { @@ -3210,7 +3211,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa m_pImpl->m_aProps[nInd].Value = aValue; } } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aPropertyName.equalsAscii( "RelationsInfoStream" ) ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aPropertyName.equalsAscii( "RelationsInfoStream" ) ) { uno::Reference< io::XInputStream > xInRelStream; if ( ( aValue >>= xInRelStream ) && xInRelStream.is() ) @@ -3231,7 +3232,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa else throw lang::IllegalArgumentException(); // TODO } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aPropertyName.equalsAscii( "RelationsInfo" ) ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aPropertyName.equalsAscii( "RelationsInfo" ) ) { if ( aValue >>= m_pImpl->m_aNewRelInfo ) { @@ -3241,7 +3242,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa } else if ( aPropertyName.equalsAscii( "Size" ) ) throw beans::PropertyVetoException(); // TODO - else if ( m_pData->m_nStorageType == PACKAGE_STORAGE + else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName.equalsAscii( "IsEncrypted" ) || aPropertyName.equalsAscii( "Encrypted" ) ) ) throw beans::PropertyVetoException(); // TODO else @@ -3277,9 +3278,9 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp ) else aPropertyName = aProp; - if ( ( ( m_pData->m_nStorageType == PACKAGE_STORAGE || m_pData->m_nStorageType == OFOPXML_STORAGE ) + if ( ( ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE || m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) && aPropertyName.equalsAscii( "MediaType" ) ) - || m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equalsAscii( "Encrypted" ) + || ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "Encrypted" ) ) || aPropertyName.equalsAscii( "Compressed" ) ) { m_pImpl->GetStreamProperties(); @@ -3290,7 +3291,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp ) return m_pImpl->m_aProps[nInd].Value; } } - else if ( m_pData->m_nStorageType == PACKAGE_STORAGE + else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) return uno::makeAny( m_pImpl->m_bUseCommonPass ); else if ( aPropertyName.equalsAscii( "Size" ) ) diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 94b97fb09eb2..0d4a29893887 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -83,10 +83,10 @@ struct WSInternalData_Impl SotMutexHolderRef m_rSharedMutexRef; ::cppu::OTypeCollection* m_pTypeCollection; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners - sal_Int16 m_nStorageType; + sal_Int32 m_nStorageType; // the mutex reference MUST NOT be empty - WSInternalData_Impl( const SotMutexHolderRef rMutexRef, sal_Int16 nStorageType ) + WSInternalData_Impl( const SotMutexHolderRef rMutexRef, sal_Int32 nStorageType ) : m_rSharedMutexRef( rMutexRef ) , m_pTypeCollection( NULL ) , m_aListenersContainer( rMutexRef->GetMutex() ) @@ -137,7 +137,7 @@ struct OWriteStream_Impl : public PreCreationStruct sal_Bool m_bHasInsertedStreamOptimization; - sal_Int16 m_nStorageType; + sal_Int32 m_nStorageType; // Relations info related data, stored in *.rels file in OFOPXML format ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOrigRelInfoStream; @@ -175,7 +175,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >& xPackage, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, sal_Bool bForceEncrypted, - sal_Int16 nStorageType, + sal_Int32 nStorageType, sal_Bool bDefaultCompress, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xRelInfoStream = ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >() ); diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index e78742641a0b..12aa89e03db0 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -29,9 +29,11 @@ #include "precompiled_package.hxx" #include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/io/XSeekable.hpp> +#include <comphelper/storagehelper.hxx> #include "xfactory.hxx" #include "xstorage.hxx" @@ -101,7 +103,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance() embed::ElementModes::READWRITE, uno::Sequence< beans::PropertyValue >(), m_xFactory, - PACKAGE_STORAGE ) ), + embed::StorageFormats::PACKAGE ) ), uno::UNO_QUERY ); } @@ -184,7 +186,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr uno::Sequence< beans::PropertyValue > aDescr; uno::Sequence< beans::PropertyValue > aPropsToSet; - sal_Int16 nStorageType = PACKAGE_STORAGE; + sal_Int32 nStorageType = embed::StorageFormats::PACKAGE; if ( nArgNum >= 3 ) { @@ -212,15 +214,29 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr else if ( aDescr[nInd].Name.equalsAscii( "StorageFormat" ) ) { ::rtl::OUString aFormatName; - aDescr[nInd].Value >>= aFormatName; - if ( aFormatName.equalsAscii( "PackageFormat" ) ) - nStorageType = PACKAGE_STORAGE; - else if ( aFormatName.equalsAscii( "ZipFormat" ) ) - nStorageType = ZIP_STORAGE; - else if ( aFormatName.equalsAscii( "OFOPXMLFormat" ) ) - nStorageType = OFOPXML_STORAGE; + sal_Int32 nFormatID = 0; + if ( aDescr[nInd].Value >>= aFormatName ) + { + if ( aFormatName.equals( PACKAGE_STORAGE_FORMAT_STRING ) ) + nStorageType = embed::StorageFormats::PACKAGE; + else if ( aFormatName.equals( ZIP_STORAGE_FORMAT_STRING ) ) + nStorageType = embed::StorageFormats::ZIP; + else if ( aFormatName.equals( OFOPXML_STORAGE_FORMAT_STRING ) ) + nStorageType = embed::StorageFormats::OFOPXML; + else + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); + } + else if ( aDescr[nInd].Value >>= nFormatID ) + { + if ( nFormatID != embed::StorageFormats::PACKAGE + && nFormatID != embed::StorageFormats::ZIP + && nFormatID != embed::StorageFormats::OFOPXML ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); + + nStorageType = nFormatID; + } else - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); } else OSL_ENSURE( sal_False, "Unacceptable property, will be ignored!\n" ); @@ -257,7 +273,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr } else if ( xStream.is() ) { - if ( ( nStorageMode & embed::ElementModes::WRITE ) && !xStream->getOutputStream().is() + if ( ( ( nStorageMode & embed::ElementModes::WRITE ) && !xStream->getOutputStream().is() ) || !xStream->getInputStream().is() ) throw uno::Exception(); // TODO: access denied diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 55ff5a87e78d..9c90c4ce35dd 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/UseBackupException.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> @@ -72,7 +73,7 @@ struct StorInternalData_Impl ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners ::cppu::OTypeCollection* m_pTypeCollection; sal_Bool m_bIsRoot; - sal_Int16 m_nStorageType; // the mode in wich the storage is used + sal_Int32 m_nStorageType; // the mode in wich the storage is used sal_Bool m_bReadOnlyWrap; OChildDispListener_Impl* m_pSubElDispListener; @@ -82,12 +83,12 @@ struct StorInternalData_Impl ::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder; // the mutex reference MUST NOT be empty - StorInternalData_Impl( const SotMutexHolderRef& rMutexRef, sal_Bool bRoot, sal_Int16 nStorType, sal_Bool bReadOnlyWrap ) + StorInternalData_Impl( const SotMutexHolderRef& rMutexRef, sal_Bool bRoot, sal_Int32 nStorageType, sal_Bool bReadOnlyWrap ) : m_rSharedMutexRef( rMutexRef ) , m_aListenersContainer( rMutexRef->GetMutex() ) , m_pTypeCollection( NULL ) , m_bIsRoot( bRoot ) - , m_nStorageType( nStorType ) + , m_nStorageType( nStorageType ) , m_bReadOnlyWrap( bReadOnlyWrap ) , m_pSubElDispListener( NULL ) {} @@ -102,7 +103,7 @@ struct StorInternalData_Impl void OStorage_Impl::completeStorageStreamCopy_Impl( const uno::Reference< io::XStream >& xSource, const uno::Reference< io::XStream >& xDest, - sal_Int16 nStorageType, + sal_Int32 nStorageType, const uno::Sequence< uno::Sequence< beans::StringPair > >& aRelInfo ) { uno::Reference< beans::XPropertySet > xSourceProps( xSource, uno::UNO_QUERY ); @@ -124,13 +125,13 @@ void OStorage_Impl::completeStorageStreamCopy_Impl( uno::Sequence< ::rtl::OUString > aPropNames( 1 ); aPropNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ); - if ( nStorageType == PACKAGE_STORAGE ) + if ( nStorageType == embed::StorageFormats::PACKAGE ) { aPropNames.realloc( 3 ); aPropNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); aPropNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); } - else if ( nStorageType == OFOPXML_STORAGE ) + else if ( nStorageType == embed::StorageFormats::OFOPXML ) { // TODO/LATER: in future it might make sence to provide the stream if there is one uno::Reference< embed::XRelationshipAccess > xRelAccess( xDest, uno::UNO_QUERY_THROW ); @@ -195,7 +196,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream, sal_Int32 nMode, uno::Sequence< beans::PropertyValue > xProperties, uno::Reference< lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_rMutexRef( new SotMutexHolder ) , m_pAntiImpl( NULL ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) @@ -235,7 +236,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream, sal_Int32 nMode, uno::Sequence< beans::PropertyValue > xProperties, uno::Reference< lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_rMutexRef( new SotMutexHolder ) , m_pAntiImpl( NULL ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) @@ -278,7 +279,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, uno::Reference< container::XNameContainer > xPackageFolder, uno::Reference< lang::XSingleServiceFactory > xPackage, uno::Reference< lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_rMutexRef( new SotMutexHolder ) , m_pAntiImpl( NULL ) , m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE ) @@ -356,7 +357,7 @@ OStorage_Impl::~OStorage_Impl() m_aDeletedList.clear(); - if ( m_nStorageType == OFOPXML_STORAGE && m_pRelStorElement ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_pRelStorElement ) { delete m_pRelStorElement; m_pRelStorElement = NULL; @@ -500,7 +501,7 @@ void OStorage_Impl::OpenOwnPackage() } } - if ( m_nStorageType == ZIP_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::ZIP ) { // let the package support only plain zip format beans::NamedValue aNamedValue; @@ -509,7 +510,7 @@ void OStorage_Impl::OpenOwnPackage() aArguments.realloc( ++nArgNum ); aArguments[nArgNum-1] <<= aNamedValue; } - else if ( m_nStorageType == OFOPXML_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // let the package support OFOPXML media type handling beans::NamedValue aNamedValue; @@ -562,7 +563,7 @@ SotElementList_Impl& OStorage_Impl::GetChildrenList() //----------------------------------------------- void OStorage_Impl::GetStorageProperties() { - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { uno::Reference< beans::XPropertySet > xProps( m_xPackageFolder, uno::UNO_QUERY_THROW ); @@ -588,7 +589,7 @@ void OStorage_Impl::GetStorageProperties() //----------------------------------------------- void OStorage_Impl::ReadRelInfoIfNecessary() { - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) return; if ( m_nRelInfoStatus == RELINFO_NO_INIT ) @@ -662,7 +663,7 @@ void OStorage_Impl::ReadContents() uno::Reference< container::XNameContainer > xNameContainer( xNamed, uno::UNO_QUERY ); SotElement_Impl* pNewElement = new SotElement_Impl( aName, xNameContainer.is(), sal_False ); - if ( m_nStorageType == OFOPXML_STORAGE && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) { if ( !pNewElement->m_bIsStorage ) throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Unexpected format @@ -730,7 +731,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes } // move storage properties to the destination one ( means changeable properties ) - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { ::rtl::OUString aMediaTypeString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); ::rtl::OUString aVersionString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); @@ -738,7 +739,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes xPropSet->setPropertyValue( aVersionString, uno::makeAny( m_aVersion ) ); } - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { // if this is a root storage, the common key from current one should be moved there sal_Bool bIsRoot = sal_False; @@ -759,7 +760,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes } } } - else if ( m_nStorageType == OFOPXML_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // TODO/LATER: currently the optimization is not active @@ -850,13 +851,13 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, } } - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { aStrProps.realloc( ++nNum ); aStrProps[nNum-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); aStrProps[nNum-1].Value <<= (sal_Bool)( pElement->m_pStream->UsesCommonPass_Impl() ); } - else if ( m_nStorageType == OFOPXML_STORAGE ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // TODO/LATER: currently the optimization is not active // uno::Reference< io::XInputStream > xInStream = GetRelInfoStreamForName( ::rtl::OUString() ); // own rels stream @@ -907,7 +908,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, pElement->m_pStream->CopyInternallyTo_Impl( xSubStr ); } } - else if ( m_nStorageType != PACKAGE_STORAGE ) + else if ( m_nStorageType != embed::StorageFormats::PACKAGE ) { OSL_ENSURE( sal_False, "Encryption is only supported in package storage!\n" ); throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); @@ -994,7 +995,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, //----------------------------------------------- uno::Sequence< uno::Sequence< beans::StringPair > > OStorage_Impl::GetAllRelationshipsIfAny() { - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) return uno::Sequence< uno::Sequence< beans::StringPair > >(); ReadRelInfoIfNecessary(); @@ -1088,7 +1089,7 @@ void OStorage_Impl::Commit() pDeletedIter++ ) { - if ( m_nStorageType == OFOPXML_STORAGE && !(*pDeletedIter)->m_bIsStorage ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && !(*pDeletedIter)->m_bIsStorage ) RemoveStreamRelInfo( (*pDeletedIter)->m_aOriginalName ); // the removed elements are not in new temporary storage @@ -1108,7 +1109,7 @@ void OStorage_Impl::Commit() if ( (*pElementIter)->m_bIsRemoved ) { - if ( m_nStorageType == OFOPXML_STORAGE && !(*pElementIter)->m_bIsStorage ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && !(*pElementIter)->m_bIsStorage ) RemoveStreamRelInfo( (*pElementIter)->m_aOriginalName ); // the removed elements are not in new temporary storage @@ -1158,7 +1159,7 @@ void OStorage_Impl::Commit() } else if ( !(*pElementIter)->m_bIsStorage && (*pElementIter)->m_pStream && (*pElementIter)->m_pStream->m_bFlushed ) { - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) CommitStreamRelInfo( *pElementIter ); // the renamed elements are not in new temporary storage @@ -1184,7 +1185,7 @@ void OStorage_Impl::Commit() xNewPackageFolder->removeByName( (*pElementIter)->m_aOriginalName ); xNewPackageFolder->insertByName( (*pElementIter)->m_aName, aPackageElement ); - if ( m_nStorageType == OFOPXML_STORAGE && !(*pElementIter)->m_bIsStorage ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && !(*pElementIter)->m_bIsStorage ) { if ( !(*pElementIter)->m_pStream ) { @@ -1233,7 +1234,7 @@ void OStorage_Impl::Commit() if ( (*pElementIter)->m_pStream->m_bFlushed ) { - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) CommitStreamRelInfo( *pElementIter ); (*pElementIter)->m_pStream->InsertIntoPackageFolder( (*pElementIter)->m_aName, xNewPackageFolder ); @@ -1244,7 +1245,7 @@ void OStorage_Impl::Commit() } } - if ( m_nStorageType == PACKAGE_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { // move properties to the destination package folder uno::Reference< beans::XPropertySet > xProps( xNewPackageFolder, uno::UNO_QUERY ); @@ -1255,7 +1256,7 @@ void OStorage_Impl::Commit() xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), uno::makeAny( m_aVersion ) ); } - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) CommitRelInfo( xNewPackageFolder ); // store own relations and commit complete relations storage if ( m_bIsRoot ) @@ -1349,7 +1350,7 @@ void OStorage_Impl::Revert() GetStorageProperties(); - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { // currently the relations storage is changed only on commit m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); @@ -1364,7 +1365,7 @@ void OStorage_Impl::Revert() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_bIsRoot ) @@ -1422,8 +1423,8 @@ SotElement_Impl* OStorage_Impl::InsertStream( ::rtl::OUString aName, sal_Bool bE if ( !xPackageSubStream.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - OSL_ENSURE( m_nStorageType == PACKAGE_STORAGE || !bEncr, "Only package storage supports encryption!\n" ); - if ( m_nStorageType != PACKAGE_STORAGE && bEncr ) + OSL_ENSURE( m_nStorageType == embed::StorageFormats::PACKAGE || !bEncr, "Only package storage supports encryption!\n" ); + if ( m_nStorageType != embed::StorageFormats::PACKAGE && bEncr ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the mode is not needed for storage stream internal implementation @@ -1445,7 +1446,7 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un if ( !m_xPackage.is() ) throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( m_nStorageType != PACKAGE_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY ); @@ -1726,7 +1727,7 @@ void OStorage_Impl::RemoveStreamRelInfo( const ::rtl::OUString& aOriginalName ) // this method should be used only in OStorage_Impl::Commit() method // the aOriginalName can be empty, in this case the storage relation info should be removed - if ( m_nStorageType == OFOPXML_STORAGE && m_xRelStorage.is() ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_xRelStorage.is() ) { ::rtl::OUString aRelStreamName = aOriginalName; aRelStreamName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".rels" ) ); @@ -1739,7 +1740,7 @@ void OStorage_Impl::RemoveStreamRelInfo( const ::rtl::OUString& aOriginalName ) //----------------------------------------------- void OStorage_Impl::CreateRelStorage() { - if ( m_nStorageType != OFOPXML_STORAGE ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) return; if ( !m_xRelStorage.is() ) @@ -1772,7 +1773,7 @@ void OStorage_Impl::CommitStreamRelInfo( SotElement_Impl* pStreamElement ) if ( !pStreamElement ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( m_nStorageType == OFOPXML_STORAGE && pStreamElement->m_pStream ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && pStreamElement->m_pStream ) { OSL_ENSURE( pStreamElement->m_aName.getLength(), "The name must not be empty!\n" ); @@ -1789,7 +1790,7 @@ void OStorage_Impl::CommitStreamRelInfo( SotElement_Impl* pStreamElement ) //----------------------------------------------- uno::Reference< io::XInputStream > OStorage_Impl::GetRelInfoStreamForName( const ::rtl::OUString& aName ) { - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { ReadContents(); if ( m_xRelStorage.is() ) @@ -1817,7 +1818,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain if ( !xNewPackageFolder.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( m_nStorageType == OFOPXML_STORAGE ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN ) throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); @@ -1923,7 +1924,7 @@ OStorage::OStorage( uno::Reference< io::XInputStream > xInputStream, sal_Int32 nMode, uno::Sequence< beans::PropertyValue > xProperties, uno::Reference< lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xFactory, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; @@ -1935,7 +1936,7 @@ OStorage::OStorage( uno::Reference< io::XStream > xStream, sal_Int32 nMode, uno::Sequence< beans::PropertyValue > xProperties, uno::Reference< lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ) + sal_Int32 nStorageType ) : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xFactory, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; @@ -2259,7 +2260,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) if ( aReturn.hasValue() == sal_True ) return aReturn ; - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_pData->m_bIsRoot ) { @@ -2275,7 +2276,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) , static_cast<embed::XStorageRawAccess*> ( this ) ); } } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { aReturn <<= ::cppu::queryInterface ( rType @@ -2314,7 +2315,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() if ( m_pData->m_pTypeCollection == NULL ) { - if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_pData->m_bIsRoot ) { @@ -2340,7 +2341,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) @@ -2482,7 +2483,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name @@ -2583,7 +2584,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) packages::NoEncryptionException(); if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) @@ -2693,7 +2694,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name @@ -2848,7 +2849,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const ::rtl if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name @@ -2930,7 +2931,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStreamElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) packages::NoEncryptionException(); if ( !aPass.getLength() ) @@ -3087,7 +3088,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name @@ -3181,7 +3182,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const ::rtl::OUString& aElementName if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable name @@ -3250,7 +3251,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const ::rtl::OUString& aElementNam if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); @@ -3323,7 +3324,7 @@ void SAL_CALL OStorage::removeElement( const ::rtl::OUString& aElementName ) if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name @@ -3418,7 +3419,7 @@ void SAL_CALL OStorage::renameElement( const ::rtl::OUString& aElementName, cons || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // TODO: unacceptable element name @@ -3529,7 +3530,7 @@ void SAL_CALL OStorage::copyElementTo( const ::rtl::OUString& aElementName, // || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name @@ -3633,7 +3634,7 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name @@ -3743,7 +3744,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface is not supported and must not be accessible if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) @@ -3853,7 +3854,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) @@ -3973,7 +3974,7 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const ::rtl::OUString& aStre throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) @@ -4334,7 +4335,7 @@ uno::Any SAL_CALL OStorage::getByName( const ::rtl::OUString& aName ) if ( !aName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name @@ -4439,7 +4440,7 @@ sal_Bool SAL_CALL OStorage::hasByName( const ::rtl::OUString& aName ) if ( !aName.getLength() ) return sal_False; - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) return sal_False; @@ -4616,7 +4617,7 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionPassword() method is not available for nonroot storages!\n" ); @@ -4682,7 +4683,7 @@ void SAL_CALL OStorage::removeEncryption() throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); @@ -4783,9 +4784,9 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, if ( m_pData->m_bReadOnlyWrap && !aPropertyName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) ) throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Access denied - if ( m_pData->m_nStorageType == ZIP_STORAGE ) + if ( m_pData->m_nStorageType == embed::StorageFormats::ZIP ) throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - else if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( aPropertyName.equalsAscii( "MediaType" ) ) { @@ -4807,18 +4808,18 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, m_pImpl->m_bIsModified = sal_True; } } - else if ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) + else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) || aPropertyName.equalsAscii( "HasNonEncryptedEntries" ) || aPropertyName.equalsAscii( "IsInconsistent" ) || aPropertyName.equalsAscii( "URL" ) - || aPropertyName.equalsAscii( "RepairPackage" ) ) + || aPropertyName.equalsAscii( "RepairPackage" ) ) ) || aPropertyName.equalsAscii( "IsRoot" ) || aPropertyName.equalsAscii( "MediaTypeFallbackUsed" ) ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) + else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { if ( aPropertyName.equalsAscii( "RelationsInfoStream" ) ) { @@ -4855,8 +4856,8 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, else throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); } - else if ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "URL" ) - || aPropertyName.equalsAscii( "RepairPackage" ) ) + else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "URL" ) + || aPropertyName.equalsAscii( "RepairPackage" ) ) ) || aPropertyName.equalsAscii( "IsRoot" ) ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else @@ -4885,7 +4886,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType == PACKAGE_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName.equalsAscii( "MediaType" ) || aPropertyName.equalsAscii( "MediaTypeFallbackUsed" ) || aPropertyName.equalsAscii( "Version" ) ) ) @@ -4943,7 +4944,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa return uno::makeAny( sal_False ); // RepairPackage } - else if ( m_pData->m_nStorageType == PACKAGE_STORAGE + else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) || aPropertyName.equalsAscii( "HasNonEncryptedEntries" ) || aPropertyName.equalsAscii( "IsInconsistent" ) ) ) @@ -5078,7 +5079,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try @@ -5109,7 +5110,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -5134,7 +5135,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -5159,7 +5160,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO/LATER: in future the unification of the ID could be checked @@ -5189,7 +5190,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Sequence< beans::StringPair > > aResult; @@ -5225,7 +5226,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_pImpl->GetAllRelationshipsIfAny(); @@ -5245,7 +5246,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const ::rtl::OUString& sID, con throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); @@ -5310,7 +5311,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const ::rtl::OUString& sID ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -5352,7 +5353,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); @@ -5434,7 +5435,7 @@ void SAL_CALL OStorage::clearRelationships() throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->m_aRelInfo.realloc( 0 ); @@ -5487,7 +5488,7 @@ void SAL_CALL OStorage::insertStreamElementDirect( if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name @@ -5584,7 +5585,7 @@ void SAL_CALL OStorage::copyElementDirectlyTo( if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable name @@ -5840,7 +5841,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const ::rtl::OUString& aEle if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name @@ -5851,7 +5852,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const ::rtl::OUString& aEle throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO/LATER: Currently it is only implemented for MediaType property of substorages, might be changed in future - if ( !pElement->m_bIsStorage || m_pData->m_nStorageType != PACKAGE_STORAGE || !aPropertyName.equalsAscii( "MediaType" ) ) + if ( !pElement->m_bIsStorage || m_pData->m_nStorageType != embed::StorageFormats::PACKAGE || !aPropertyName.equalsAscii( "MediaType" ) ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !pElement->m_pStorage ) @@ -5943,7 +5944,7 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( m_pData->m_nStorageType == OFOPXML_STORAGE + if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable name @@ -6090,7 +6091,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index bc90b71e4d93..f1c50e4d67bd 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -57,11 +57,6 @@ #include "mutexholder.hxx" - -#define PACKAGE_STORAGE 0 -#define ZIP_STORAGE 1 -#define OFOPXML_STORAGE 2 - #define RELINFO_NO_INIT 1 #define RELINFO_READ 2 #define RELINFO_CHANGED 3 @@ -177,9 +172,9 @@ struct OStorage_Impl SwitchablePersistenceStream* m_pSwitchStream; - sal_Int16 m_nStorageType; // the mode in wich the storage is used + sal_Int32 m_nStorageType; // the mode in wich the storage is used - // the _rels substorage that is handled in a special way in OFOPXML_STORAGE + // the _rels substorage that is handled in a special way in embed::StorageFormats::OFOPXML SotElement_Impl* m_pRelStorElement; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xRelStorage; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aRelInfo; @@ -193,13 +188,13 @@ struct OStorage_Impl sal_Int32 nMode, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); OStorage_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream, sal_Int32 nMode, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); // constructor for a substorage OStorage_Impl( OStorage_Impl* pParent, @@ -207,7 +202,7 @@ struct OStorage_Impl ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xPackageFolder, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xPackage, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); ~OStorage_Impl(); @@ -287,7 +282,7 @@ struct OStorage_Impl static void completeStorageStreamCopy_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSource, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDest, - sal_Int16 nStorageType, + sal_Int32 nStorageType, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aRelInfo ); }; @@ -330,13 +325,13 @@ public: sal_Int32 nMode, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); OStorage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream, sal_Int32 nMode, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, - sal_Int16 nStorageType ); + sal_Int32 nStorageType ); OStorage( OStorage_Impl* pImpl, sal_Bool bReadOnlyWrap ); diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 14ef46190f3d..2238cf870d02 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -787,14 +787,14 @@ sal_Int32 ZipFile::readCEN() aEntry.nOffset += nLocPos; aEntry.nOffset *= -1; - if ( aEntry.nPathLen < 0 || aEntry.nPathLen > ZIP_MAXNAMELEN ) - throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "name length exceeds ZIP_MAXNAMELEN bytes" ) ), Reference < XInterface > () ); + if ( aEntry.nPathLen < 0 ) + throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), Reference < XInterface > () ); - if ( nCommentLen < 0 || nCommentLen > ZIP_MAXNAMELEN ) - throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "comment length exceeds ZIP_MAXNAMELEN bytes" ) ), Reference < XInterface > () ); + if ( nCommentLen < 0 ) + throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), Reference < XInterface > () ); - if ( aEntry.nExtraLen < 0 || aEntry.nExtraLen > ZIP_MAXEXTRA ) - throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "extra header info exceeds ZIP_MAXEXTRA bytes") ), Reference < XInterface > () ); + if ( aEntry.nExtraLen < 0 ) + throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), Reference < XInterface > () ); // read always in UTF8, some tools seem not to set UTF8 bit aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(), @@ -879,7 +879,7 @@ sal_Int32 ZipFile::recover() sal_Int32 nDataSize = ( aEntry.nMethod == DEFLATED ) ? aEntry.nCompressedSize : aEntry.nSize; sal_Int32 nBlockLength = nDataSize + aEntry.nPathLen + aEntry.nExtraLen + 30 + nDescrLength; - if ( aEntry.nPathLen <= ZIP_MAXNAMELEN && aEntry.nExtraLen < ZIP_MAXEXTRA + if ( aEntry.nPathLen >= 0 && aEntry.nExtraLen >= 0 && ( nGenPos + nPos + nBlockLength ) <= nLength ) { // read always in UTF8, some tools seem not to set UTF8 bit diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 5c22bad46a6a..9ba26e0100c5 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/io/XActiveDataStreamer.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/UseBackupException.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <cppuhelper/implbase1.hxx> #include <ContentInfo.hxx> @@ -183,7 +184,7 @@ ZipPackage::ZipPackage (const uno::Reference < XMultiServiceFactory > &xNewFacto , m_bUseManifest ( sal_True ) , m_bForceRecovery ( sal_False ) , m_bMediaTypeFallbackUsed ( sal_False ) -, m_nFormat( PACKAGE_FORMAT ) // package is the default format +, m_nFormat( embed::StorageFormats::PACKAGE ) // package is the default format , m_bAllowRemoveOnInsert( sal_True ) , m_eMode ( e_IMode_None ) , m_xFactory( xNewFactory ) @@ -217,7 +218,7 @@ ZipPackage::~ZipPackage( void ) void ZipPackage::parseManifest() { - if ( m_nFormat == PACKAGE_FORMAT ) + if ( m_nFormat == embed::StorageFormats::PACKAGE ) { sal_Bool bManifestParsed = sal_False; const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) ); @@ -427,7 +428,7 @@ void ZipPackage::parseManifest() void ZipPackage::parseContentType() { - if ( m_nFormat == OFOPXML_FORMAT ) + if ( m_nFormat == embed::StorageFormats::OFOPXML ) { const ::rtl::OUString aContentTypes( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml" ) ); try { @@ -507,7 +508,14 @@ void ZipPackage::getZipFileContents() nIndex = nOldIndex = 0; pCurrent = m_pRootFolder; const ZipEntry & rEntry = *pEnum->nextElement(); - const OUString & rName = rEntry.sPath; + OUString rName = rEntry.sPath; + + if ( m_bForceRecovery ) + { + // the PKZIP Application note version 6.2 does not allows to use '\' as separator + // unfortunately it is used by some implementations, so we have to support it in recovery mode + rName = rName.replace( '\\', '/' ); + } nStreamIndex = rName.lastIndexOf ( '/' ); if ( nStreamIndex != -1 ) @@ -551,9 +559,9 @@ void ZipPackage::getZipFileContents() } } - if ( m_nFormat == PACKAGE_FORMAT ) + if ( m_nFormat == embed::StorageFormats::PACKAGE ) parseManifest(); - else if ( m_nFormat == OFOPXML_FORMAT ) + else if ( m_nFormat == embed::StorageFormats::OFOPXML ) parseContentType(); } @@ -593,13 +601,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) } else if ( aCommand.equals( OUString::createFromAscii( "purezip" ) ) ) { - m_nFormat = ZIP_FORMAT; + m_nFormat = embed::StorageFormats::ZIP; m_pRootFolder->setPackageFormat_Impl( m_nFormat ); break; } else if ( aCommand.equals( OUString::createFromAscii( "ofopxml" ) ) ) { - m_nFormat = OFOPXML_FORMAT; + m_nFormat = embed::StorageFormats::OFOPXML; m_pRootFolder->setPackageFormat_Impl( m_nFormat ); break; } @@ -654,20 +662,34 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) sal_Bool bPackFormat = sal_True; aNamedValue.Value >>= bPackFormat; if ( !bPackFormat ) - m_nFormat = ZIP_FORMAT; + m_nFormat = embed::StorageFormats::ZIP; m_pRootFolder->setPackageFormat_Impl( m_nFormat ); } else if ( aNamedValue.Name.equalsAscii( "StorageFormat" ) ) { ::rtl::OUString aFormatName; - aNamedValue.Value >>= aFormatName; - if ( aFormatName.equals( PACKAGE_STORAGE_FORMAT_STRING ) ) - m_nFormat = PACKAGE_FORMAT; - else if ( aFormatName.equals( ZIP_STORAGE_FORMAT_STRING ) ) - m_nFormat = ZIP_FORMAT; - else if ( aFormatName.equals( OFOPXML_STORAGE_FORMAT_STRING ) ) - m_nFormat = OFOPXML_FORMAT; + sal_Int32 nFormatID = 0; + if ( aNamedValue.Value >>= aFormatName ) + { + if ( aFormatName.equals( PACKAGE_STORAGE_FORMAT_STRING ) ) + m_nFormat = embed::StorageFormats::PACKAGE; + else if ( aFormatName.equals( ZIP_STORAGE_FORMAT_STRING ) ) + m_nFormat = embed::StorageFormats::ZIP; + else if ( aFormatName.equals( OFOPXML_STORAGE_FORMAT_STRING ) ) + m_nFormat = embed::StorageFormats::OFOPXML; + else + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); + } + else if ( aNamedValue.Value >>= nFormatID ) + { + if ( nFormatID != embed::StorageFormats::PACKAGE + && nFormatID != embed::StorageFormats::ZIP + && nFormatID != embed::StorageFormats::OFOPXML ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); + + m_nFormat = nFormatID; + } else throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); @@ -1135,7 +1157,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() try { - if ( m_nFormat == PACKAGE_FORMAT ) + if ( m_nFormat == embed::StorageFormats::PACKAGE ) { // Remove the old manifest.xml file as the // manifest will be re-generated and the @@ -1157,7 +1179,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() // Write a magic file with mimetype WriteMimetypeMagicFile( aZipOut ); } - else if ( m_nFormat == OFOPXML_FORMAT ) + else if ( m_nFormat == embed::StorageFormats::OFOPXML ) { // Remove the old [Content_Types].xml file as the // file will be re-generated @@ -1175,7 +1197,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() const OUString sVersion ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) ); const OUString sFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) ); - if ( m_nFormat == PACKAGE_FORMAT ) + if ( m_nFormat == embed::StorageFormats::PACKAGE ) { Sequence < PropertyValue > aPropSeq ( PKG_SIZE_NOENCR_MNFST ); aPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType; @@ -1204,11 +1226,11 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() // Clean up random pool memory rtl_random_destroyPool ( aRandomPool ); - if( m_bUseManifest && m_nFormat == PACKAGE_FORMAT ) + if( m_bUseManifest && m_nFormat == embed::StorageFormats::PACKAGE ) { WriteManifest( aZipOut, aManList ); } - else if( m_nFormat == OFOPXML_FORMAT ) + else if( m_nFormat == embed::StorageFormats::OFOPXML ) { WriteContentTypes( aZipOut, aManList ); } @@ -1618,7 +1640,7 @@ uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo( ) void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - if ( m_nFormat != PACKAGE_FORMAT ) + if ( m_nFormat != embed::StorageFormats::PACKAGE ) throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") ) @@ -1643,7 +1665,7 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // TODO/LATER: Activate the check when zip-ucp is ready - // if ( m_nFormat != PACKAGE_FORMAT ) + // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Any aAny; diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 0bed74128467..f0c4a11d22f4 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -34,6 +34,7 @@ #include <PackageConstants.hxx> #include <ZipPackageFolderEnumeration.hxx> #include <com/sun/star/packages/zip/ZipConstants.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <vos/diagnose.hxx> #include <osl/time.h> #include <rtl/digest.h> @@ -61,7 +62,7 @@ using vos::ORef; Sequence < sal_Int8 > ZipPackageFolder::aImplementationId = Sequence < sal_Int8 > (); ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory, - sal_Int16 nFormat, + sal_Int32 nFormat, sal_Bool bAllowRemoveOnInsert ) : m_xFactory( xFactory ) , m_nFormat( nFormat ) @@ -317,7 +318,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr sal_Bool bHaveEncryptionKey = rEncryptionKey.getLength() ? sal_True : sal_False; - if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != OFOPXML_FORMAT ) + if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML ) { // it is an empty subfolder, use workaround to store it ZipEntry* pTempEntry = new ZipEntry(); @@ -539,11 +540,11 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr // If the entry is already stored in the zip file in the format we // want for this write...copy it raw - if ( !bUseNonSeekableAccess && - ( bRawStream || bTransportOwnEncrStreamAsRaw || - ( pStream->IsPackageMember() && !bToBeEncrypted && - ( pStream->aEntry.nMethod == DEFLATED && bToBeCompressed ) || - ( pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) + if ( !bUseNonSeekableAccess + && ( bRawStream || bTransportOwnEncrStreamAsRaw + || ( pStream->IsPackageMember() && !bToBeEncrypted + && ( ( pStream->aEntry.nMethod == DEFLATED && bToBeCompressed ) + || ( pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) ) { // If it's a PackageMember, then it's an unbuffered stream and we need // to get a new version of it as we can't seek backwards. @@ -689,7 +690,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr } // folder can have a mediatype only in package format - if ( m_nFormat == PACKAGE_FORMAT || ( m_nFormat == OFOPXML_FORMAT && !rInfo.bFolder ) ) + if ( m_nFormat == embed::StorageFormats::PACKAGE || ( m_nFormat == embed::StorageFormats::OFOPXML && !rInfo.bFolder ) ) rManList.push_back( aPropSet ); } @@ -741,7 +742,7 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType"))) { // TODO/LATER: activate when zip ucp is ready - // if ( m_nFormat != PACKAGE_FORMAT ) + // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); aValue >>= sMediaType; @@ -759,7 +760,7 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName ) if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ) { // TODO/LATER: activate when zip ucp is ready - // if ( m_nFormat != PACKAGE_FORMAT ) + // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return makeAny ( sMediaType ); @@ -775,11 +776,18 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName ) void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) { - if ( pEntry->IsFolder() ) - maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageFolder *> ( pEntry ) ); - else - maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) ); - + try + { + if ( pEntry->IsFolder() ) + maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageFolder *> ( pEntry ) ); + else + maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) ); + } + catch(const uno::Exception& rEx) + { + (void)rEx; + throw; + } if ( bSetParent ) pEntry->setParent ( *this ); } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index b6893b5cb2ad..6343607c8711 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_package.hxx" #include <com/sun/star/packages/zip/ZipConstants.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/packages/zip/ZipIOException.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> @@ -611,7 +612,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, { if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType"))) { - if ( rZipPackage.getFormat() != PACKAGE_FORMAT && rZipPackage.getFormat() != OFOPXML_FORMAT ) + if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && rZipPackage.getFormat() != embed::StorageFormats::OFOPXML ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( aValue >>= sMediaType ) @@ -640,7 +641,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Encrypted") ) ) { - if ( rZipPackage.getFormat() != PACKAGE_FORMAT ) + if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); sal_Bool bEnc = sal_False; @@ -664,7 +665,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) ) { - if ( rZipPackage.getFormat() != PACKAGE_FORMAT ) + if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE ) throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Sequence < sal_Int8 > aNewKey; diff --git a/setup_native/prj/d.lst b/setup_native/prj/d.lst index 67e9573107b3..6aa6460d1823 100644 --- a/setup_native/prj/d.lst +++ b/setup_native/prj/d.lst @@ -33,9 +33,11 @@ mkdir: %_DEST%\bin%_EXT%\osolsmf ..\source\mac\*.icns %_DEST%\bin%_EXT%\*.icns ..\source\mac\Info.plist.langpack %_DEST%\bin%_EXT%\Info.plist.langpack ..\source\mac\ooo\osxdndinstall.png %_DEST%\bin%_EXT%\osl\osxdndinstall.png +..\source\mac\ooo\osxdndinstall_nologo.png %_DEST%\bin%_EXT%\osl\osxdndinstall_nologo.png ..\source\mac\ooo\DS_Store %_DEST%\bin%_EXT%\osl\DS_Store ..\source\mac\ooo\DS_Store_Langpack %_DEST%\bin%_EXT%\osl\DS_Store_Langpack ..\source\mac\broffice\osxdndinstall.png %_DEST%\bin%_EXT%\broffice\osxdndinstall.png +..\source\mac\broffice\osxdndinstall_nologo.png %_DEST%\bin%_EXT%\broffice\osxdndinstall_nologo.png ..\source\mac\broffice\DS_Store %_DEST%\bin%_EXT%\broffice\DS_Store ..\source\java\openofficeorg_setup.gif %_DEST%\bin%_EXT%\osl\Setup.gif ..\source\java\brofficeorg_setup.gif %_DEST%\bin%_EXT%\broffice\Setup.gif diff --git a/setup_native/source/mac/broffice/osxdndinstall_nologo.png b/setup_native/source/mac/broffice/osxdndinstall_nologo.png Binary files differnew file mode 100644 index 000000000000..8c5636ec05ca --- /dev/null +++ b/setup_native/source/mac/broffice/osxdndinstall_nologo.png diff --git a/setup_native/source/mac/ooo/osxdndinstall_nologo.png b/setup_native/source/mac/ooo/osxdndinstall_nologo.png Binary files differnew file mode 100644 index 000000000000..7133e7387ac1 --- /dev/null +++ b/setup_native/source/mac/ooo/osxdndinstall_nologo.png diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index fb04b347fcdf..903e1834e764 100755 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -477,7 +477,6 @@ End Start module = "gid_Module_Root_Extension_Oooimprovement" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" @@ -493,7 +492,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Af" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-af" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" @@ -509,7 +507,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ca" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ca" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ca" @@ -525,7 +522,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Cs" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" @@ -541,7 +537,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Da" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-da" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" @@ -557,7 +552,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_AT" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" @@ -573,7 +567,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_CH" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" @@ -589,7 +582,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_DE" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" @@ -605,7 +597,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_En" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-en" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" @@ -621,7 +612,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Es" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-es" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" @@ -637,7 +627,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Et" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-et" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" @@ -653,7 +642,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Fr" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" @@ -669,7 +657,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Gl" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-gl" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-gl" @@ -685,7 +672,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_He" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-he" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" @@ -701,7 +687,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Hu" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" @@ -717,7 +702,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_It" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-it" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" @@ -733,7 +717,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ku_Tr" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ku-TR" @@ -749,7 +732,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Lt" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" @@ -765,7 +747,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ne" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" @@ -781,7 +762,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Nl" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" @@ -797,7 +777,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_No" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-no" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-no" @@ -813,7 +792,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pl" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" @@ -829,7 +807,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pt" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" @@ -845,7 +822,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ro" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ro" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ro" @@ -861,7 +837,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ru" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" @@ -877,7 +852,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sk" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" @@ -893,7 +867,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sl" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" @@ -909,7 +882,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sr" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" @@ -925,7 +897,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sv" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" @@ -941,7 +912,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sw" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" @@ -957,7 +927,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Th" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-th" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" @@ -973,7 +942,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Vi" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-vi" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-vi" @@ -989,7 +957,6 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Zu" -script = "shellscripts_extensions.txt" solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx index 86cba0908bbb..9a933eea0334 100755 --- a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx +++ b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx @@ -177,8 +177,8 @@ static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, D extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); - std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sResourceDir = sInstDir + TEXT("Basis\\program\\resource\\"); std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); WIN32_FIND_DATA aFindFileData; diff --git a/setup_native/source/win32/customactions/languagepacks/exports.dxp b/setup_native/source/win32/customactions/languagepacks/exports.dxp index 7461090d7233..d01befd5d0d9 100644 --- a/setup_native/source/win32/customactions/languagepacks/exports.dxp +++ b/setup_native/source/win32/customactions/languagepacks/exports.dxp @@ -2,6 +2,3 @@ SetProductInstallationPath RegisterLanguagePack GetUserInstallMode IsOfficeRunning -RegisterExtensions -DeregisterExtensions -RemoveExtensions diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk index 8da47ab1cc4f..69526077c509 100644 --- a/setup_native/source/win32/customactions/languagepacks/makefile.mk +++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk @@ -77,7 +77,6 @@ STDSHL+= \ #SHL1LIBS = $(SLB)$/$(TARGET).lib SHL1OBJS = $(SLOFILES) \ - $(SLO)$/registerextensions.obj \ $(SLO)$/seterror.obj SHL1TARGET = $(TARGET) diff --git a/setup_native/source/win32/customactions/languagepacks/respintest.cxx b/setup_native/source/win32/customactions/languagepacks/respintest.cxx index bdfb97dfb3e1..6a98af8a3f30 100644 --- a/setup_native/source/win32/customactions/languagepacks/respintest.cxx +++ b/setup_native/source/win32/customactions/languagepacks/respintest.cxx @@ -88,7 +88,7 @@ namespace extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle) { - string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + string sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); // MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK); diff --git a/setup_native/source/win32/customactions/patch/exports.dxp b/setup_native/source/win32/customactions/patch/exports.dxp index b5f7bfcd099a..b57f2838bf34 100755 --- a/setup_native/source/win32/customactions/patch/exports.dxp +++ b/setup_native/source/win32/customactions/patch/exports.dxp @@ -7,6 +7,3 @@ IsOfficeRunning SetFeatureState SetNewFeatureState ShowOnlineUpdateDialog -RegisterExtensions -DeregisterExtensions -RemoveExtensions diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk index 6af0ddf9ab2a..cb8733de20b6 100755 --- a/setup_native/source/win32/customactions/patch/makefile.mk +++ b/setup_native/source/win32/customactions/patch/makefile.mk @@ -76,7 +76,6 @@ SHL1OBJS = $(SLOFILES) \ $(SLO)$/shutdown_quickstart.obj \ $(SLO)$/quickstarter.obj \ $(SLO)$/upgrade.obj \ - $(SLO)$/registerextensions.obj \ $(SLO)$/seterror.obj SHL1TARGET = $(TARGET) diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx index d6f0933077fc..6285d64ebe3f 100755 --- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx +++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx @@ -544,8 +544,7 @@ static std::queue< std::_tstring > getProfileKeys( const std::_tstring& aFileNam extern "C" UINT __stdcall InstallPatchedFiles( MSIHANDLE handle ) { std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); - std::_tstring sBasisInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); - std::_tstring sProgramDir = sBasisInstDir + TEXT("program\\"); + std::_tstring sProgramDir = sInstDir + TEXT("Basis\\program\\"); std::_tstring sPatchFile = sProgramDir + TEXT("patchlist.txt"); std::queue< std::_tstring > aSectionNames; @@ -605,16 +604,11 @@ extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) HKEY hKey; std::_tstring sInstDir; - std::_tstring sBasisInstDir; std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") ); if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sBasisInstDir = szValue; - } if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; @@ -623,10 +617,6 @@ extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) } else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sBasisInstDir = szValue; - } if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; @@ -636,7 +626,7 @@ extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) else return ERROR_SUCCESS; - std::_tstring sProgramDir = sBasisInstDir + TEXT("program\\"); + std::_tstring sProgramDir = sInstDir + TEXT("Basis\\program\\"); std::_tstring sPatchFile = sProgramDir + TEXT("patchlist.txt"); std::queue< std::_tstring > aSectionNames; @@ -689,8 +679,8 @@ extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); - std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sResourceDir = sInstDir + TEXT("Basis\\program\\resource\\"); std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); WIN32_FIND_DATA aFindFileData; @@ -733,8 +723,8 @@ extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle ) // 1. Reading Product Code from setup.ini of installed Office - std::_tstring sInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); - // MessageBox(NULL, sInstallPath.c_str(), "BASISINSTALLLOCATION", MB_OK); + std::_tstring sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); + // MessageBox(NULL, sInstallPath.c_str(), "INSTALLLOCATION", MB_OK); std::_tstring sSetupiniPath = sInstallPath + TEXT("program\\setup.ini"); TCHAR szProductCode[32767]; @@ -869,8 +859,8 @@ extern "C" UINT __stdcall ShowOnlineUpdateDialog( MSIHANDLE handle ) // Online Update functionality is always available. Then the dialog // that offers the Online Update is superfluous. - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); - std::_tstring sProgramDir = sInstDir + TEXT("program\\"); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sProgramDir = sInstDir + TEXT("Basis\\program\\"); std::_tstring sSearchFile = sProgramDir + TEXT("updchk.uno.dll"); WIN32_FIND_DATA data; diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx index f732a3a8ad57..25659a0b4109 100644 --- a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx +++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx @@ -15,13 +15,13 @@ std::string GetOfficeInstallationPath(MSIHANDLE handle) DWORD sz = 0; LPTSTR dummy = TEXT(""); - if (MsiGetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), dummy, &sz) == ERROR_MORE_DATA) + if (MsiGetProperty(handle, TEXT("INSTALLLOCATION"), dummy, &sz) == ERROR_MORE_DATA) { sz++; // space for the final '\0' DWORD nbytes = sz * sizeof(TCHAR); LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); ZeroMemory(buff, nbytes); - MsiGetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), buff, &sz); + MsiGetProperty(handle, TEXT("INSTALLLOCATION"), buff, &sz); progpath = buff; } return progpath; diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx index 4d031bee908a..dfe1e82e1e9b 100644 --- a/setup_native/source/win32/customactions/rebase/rebase.cxx +++ b/setup_native/source/win32/customactions/rebase/rebase.cxx @@ -126,13 +126,11 @@ static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LP static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress ) { - std::string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); - std::string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); - std::string sUreInstallPath = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); + std::string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); - std::string sBasisDir = sBasisInstallPath + TEXT("program\\"); - std::string sOfficeDir = sOfficeInstallPath + TEXT("program\\"); - std::string sUreDir = sUreInstallPath + TEXT("bin\\"); + std::string sBasisDir = sInstallPath + TEXT("Basis\\program\\"); + std::string sOfficeDir = sInstallPath + TEXT("program\\"); + std::string sUreDir = sInstallPath + TEXT("URE\\bin\\"); BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress ); bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress ); diff --git a/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx b/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx index 8cfc1fb08597..2941ba5a8e27 100644 --- a/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx +++ b/setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx @@ -52,7 +52,7 @@ bool IsAllUserInstallation(MSIHANDLE handle) std::wstring GetOfficeInstallationPath(MSIHANDLE handle) { std::wstring progpath; - GetMsiProp(handle, TEXT("OFFICEINSTALLLOCATION"), progpath); + GetMsiProp(handle, TEXT("INSTALLLOCATION"), progpath); return progpath; } diff --git a/setup_native/source/win32/customactions/reg64/reg64.cxx b/setup_native/source/win32/customactions/reg64/reg64.cxx index 2264a228030d..53eb16a99583 100644..100755 --- a/setup_native/source/win32/customactions/reg64/reg64.cxx +++ b/setup_native/source/win32/customactions/reg64/reg64.cxx @@ -56,13 +56,14 @@ WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY,LPCWSTR,REGSAM,DWORD); // in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. // Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and // extensions\source\activex\main\so_activex.cpp + #ifndef KEY_WOW64_64KEY #define KEY_WOW64_64KEY (0x0100) #endif #define TABLE_NAME L"Reg64" -#define BASISINSTALLLOCATION L"[BASISINSTALLLOCATION]" +#define INSTALLLOCATION L"[INSTALLLOCATION]" bool isInstall4AllUsers; wchar_t * sBasisInstallLocation; @@ -214,9 +215,10 @@ wchar_t* GetBasisInstallLocation( MSIHANDLE hMSI ) OutputDebugStringFormat(L"GetBasisInstallLocation - START\n" ); bool bResult = FALSE; wchar_t* pVal = NULL; - GetMsiProp( hMSI, L"BASISINSTALLLOCATION", &pVal); + GetMsiProp( hMSI, L"INSTALLLOCATION", &pVal); OutputDebugStringFormat(L"GetBasisInstallLocation - ENDE\n" ); + return pVal; } @@ -325,14 +327,14 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) - wchar_t* nPos = wcsstr(szValue , BASISINSTALLLOCATION); + wchar_t* nPos = wcsstr(szValue , INSTALLLOCATION); if ( NULL != nPos) { DWORD nPrefixSize = nPos - szValue; DWORD nPropSize = wcslen(sBasisInstallLocation); - DWORD nPostfixSize = dwValue - wcslen( BASISINSTALLLOCATION ); + DWORD nPostfixSize = dwValue - wcslen( INSTALLLOCATION ); DWORD nNewValueBytes = (nPropSize + nPostfixSize + 1) * sizeof( wchar_t ); wchar_t* newValue = reinterpret_cast<wchar_t*>( malloc( nNewValueBytes ) ); @@ -345,7 +347,7 @@ bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t )); // postfix - wcsncat(newValue, nPos + ( wcslen( BASISINSTALLLOCATION ) ), nPropSize * sizeof( wchar_t )); + wcsncat(newValue, nPos + ( wcslen( INSTALLLOCATION ) ), nPropSize * sizeof( wchar_t )); wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024); diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx index 1e91ccbd8599..037824689a47 100644 --- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -170,7 +170,7 @@ BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath ) { wchar_t* pProgPath = NULL; - if ( GetMsiProp( hMSI, L"OFFICEINSTALLLOCATION", &pProgPath ) && pProgPath ) + if ( GetMsiProp( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath ) { char* pCharProgPath = UnicodeToAnsiString( pProgPath ); #ifdef OWN_DEBUG_PRINT diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx index 09f60b7a66d5..9a028953fef1 100755 --- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx +++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx @@ -184,12 +184,12 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) // renaming the vcl resource doesn't work reliable with OS >= Windows Vista if (osverinfo.dwMajorVersion < 6 ) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("BASISINSTALLLOCATION") ); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); // Property empty -> no office installed if ( sInstDir.length() == 0 ) return ERROR_SUCCESS; - std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); + std::_tstring sResourceDir = sInstDir + TEXT("Basis\\program\\resource\\"); std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); // std::_tstring mystr; @@ -233,7 +233,7 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) } else { - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); // Property empty -> no office installed if ( sOfficeInstallPath.length() == 0 ) return ERROR_SUCCESS; diff --git a/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx b/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx index 28dfcc0e18b6..7dc5194a18cb 100644 --- a/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx +++ b/setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx @@ -100,7 +100,7 @@ extern "C" UINT __stdcall copyEditionData(MSIHANDLE install) { wchar_t * end; boost::scoped_array<wchar_t> to( getProperty( - install, L"OFFICEINSTALLLOCATION", + install, L"INSTALLLOCATION", LCL_STRING0(L"program\\edition\0"), &end)); if (!to) { return ERROR_INSTALL_FAILURE; diff --git a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx index 522c52a9aac9..517915cb831f 100644 --- a/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx +++ b/setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx @@ -93,7 +93,7 @@ extern "C" UINT __stdcall copyExtensionData(MSIHANDLE handle) { bool fSuccess = true; bool bFailIfExist = true; - std::_tstring sDestDir = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ); + std::_tstring sDestDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); std::_tstring sShareInstallDir = sDestDir + TEXT("share\\extension\\install\\"); // creating directories diff --git a/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx index 2b022cfb3b8e..f7cf0247c631 100644 --- a/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx +++ b/setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx @@ -161,18 +161,6 @@ extern "C" UINT __stdcall ShowProperties(MSIHANDLE handle) string myText = TEXT("INSTALLLOCATION: ") + property; MessageBox(NULL, myText.c_str(), "INSTALLLOCATION", MB_OK); - property = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); - myText = TEXT("UREINSTALLLOCATION: ") + property; - MessageBox(NULL, myText.c_str(), "UREINSTALLLOCATION", MB_OK); - - property = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); - myText = TEXT("BASISINSTALLLOCATION: ") + property; - MessageBox(NULL, myText.c_str(), "BASISINSTALLLOCATION", MB_OK); - - property = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); - myText = TEXT("OFFICEINSTALLLOCATION: ") + property; - MessageBox(NULL, myText.c_str(), "OFFICEINSTALLLOCATION", MB_OK); - property = GetMsiProperty(handle, TEXT("Installed")); myText = TEXT("Installed: ") + property; MessageBox(NULL, myText.c_str(), "Installed", MB_OK); diff --git a/setup_native/source/win32/customactions/shellextensions/exports.dxp b/setup_native/source/win32/customactions/shellextensions/exports.dxp index cafa011057c9..0e53492e460f 100644 --- a/setup_native/source/win32/customactions/shellextensions/exports.dxp +++ b/setup_native/source/win32/customactions/shellextensions/exports.dxp @@ -6,9 +6,6 @@ SetProductInstallMode RebuildShellIconCache ExecutePostUninstallScript MigrateInstallPath -RegisterExtensions -DeregisterExtensions -RemoveExtensions CheckInstallDirectory SetAdminInstallProperty CreateLayerLinks diff --git a/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx index 114e24955820..fb0897e728fe 100644 --- a/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx +++ b/setup_native/source/win32/customactions/shellextensions/layerlinks.cxx @@ -98,12 +98,14 @@ namespace extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle) { - string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); - string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISINSTALLLOCATION")); - string sUreInstallPath = GetMsiProperty(handle, TEXT("UREINSTALLLOCATION")); + string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); - string sBasisLinkPath = sOfficeInstallPath + TEXT("basis-link"); - string sUreLinkPath = sBasisInstallPath + TEXT("ure-link"); + string sOfficeInstallPath = sInstallPath; + string sBasisInstallPath = sInstallPath + TEXT("Basis\\"); + string sUreInstallPath = sInstallPath + TEXT("URE\\"); + + string sBasisLinkPath = sInstallPath + TEXT("basis-link"); + string sUreLinkPath = sInstallPath + TEXT("Basis\\ure-link"); if ( IsSetMsiProperty(handle, TEXT("ADMININSTALL")) ) { @@ -208,9 +210,11 @@ extern "C" UINT __stdcall CreateLayerLinks(MSIHANDLE handle) extern "C" UINT __stdcall RemoveLayerLinks(MSIHANDLE handle) { - string sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEUNINSTALLLOCATION")); - string sBasisInstallPath = GetMsiProperty(handle, TEXT("BASISUNINSTALLLOCATION")); - string sUreInstallPath = GetMsiProperty(handle, TEXT("UREUNINSTALLLOCATION")); + string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); + + string sOfficeInstallPath = sInstallPath; + string sBasisInstallPath = sInstallPath + TEXT("Basis\\"); + string sUreInstallPath = sInstallPath + TEXT("URE\\"); string sBasisLinkPath = sOfficeInstallPath + TEXT("basis-link"); string sUreLinkPath = sBasisInstallPath + TEXT("ure-link"); diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk index 220ac727b774..9eef136a82a4 100644 --- a/setup_native/source/win32/customactions/shellextensions/makefile.mk +++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk @@ -62,7 +62,6 @@ SLOFILES = \ $(SLO)$/setadmininstall.obj \ $(SLO)$/layerlinks.obj \ $(SLO)$/dotnetcheck.obj \ - $(SLO)$/registerextensions.obj \ $(SLO)$/copyeditiondata.obj \ $(SLO)$/vistaspecial.obj \ $(SLO)$/checkrunningoffice.obj \ diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx index 1d3692e456b0..c8035799a539 100755 --- a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx +++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx @@ -91,27 +91,6 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle ) if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); - } - - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("BASISINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); - } - - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("UREINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("UREINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_CURRENT_USER", MB_OK ); - } - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; @@ -123,27 +102,6 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle ) } else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("OFFICEINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); - } - - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("BASISINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("BASISINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); - } - - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("UREINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) - { - sInstDir = szValue; - MsiSetProperty(handle, TEXT("UREINSTALLLOCATION"), sInstDir.c_str()); - // MessageBox( NULL, sInstDir.c_str(), "Found in HKEY_LOCAL_MACHINE", MB_OK ); - } - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; diff --git a/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx index bb339953ff34..ea9bfae3864b 100755 --- a/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx +++ b/setup_native/source/win32/customactions/shellextensions/postuninstall.cxx @@ -115,7 +115,7 @@ extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle ) if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } @@ -123,7 +123,7 @@ extern "C" UINT __stdcall ExecutePostUninstallScript( MSIHANDLE handle ) } else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx index 191bb5fad393..3906d2584fd1 100644 --- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -317,7 +317,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe"); std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\"); std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt"); @@ -415,7 +415,7 @@ extern "C" UINT __stdcall DeregisterExtensions(MSIHANDLE handle) if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } @@ -423,7 +423,7 @@ extern "C" UINT __stdcall DeregisterExtensions(MSIHANDLE handle) } else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } @@ -533,7 +533,7 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle) if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } @@ -541,7 +541,7 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle) } else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("OFFICEINSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { sInstDir = szValue; } diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx index 49d5e50be426..5adab408139d 100644 --- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx +++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx @@ -78,7 +78,7 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle ) // MessageBox(NULL, sDesktopFile.c_str(), TEXT("OfficeMenuFolder"), MB_OK | MB_ICONINFORMATION); - std::_tstring sIconFile = GetMsiProperty( handle, TEXT("OFFICEINSTALLLOCATION") ) + TEXT("program\\soffice.exe"); + std::_tstring sIconFile = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ) + TEXT("program\\soffice.exe"); OSVERSIONINFO osverinfo; osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx index d9c271133ac0..70064b58807c 100644 --- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx +++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx @@ -183,12 +183,12 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) { - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program"); std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old"); -// MessageBox(NULL, sRenameSrc.c_str(), "OFFICEINSTALLLOCATION", MB_OK); +// MessageBox(NULL, sRenameSrc.c_str(), "INSTALLLOCATION", MB_OK); bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() ); if ( !bSuccess ) @@ -216,7 +216,7 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle ) extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle ) { - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION")); + std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old"); // MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK); diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index c8471214ec46..cb183eb29c25 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -201,6 +201,7 @@ public class NumberFormatter Locale oLocale = (Locale) Helper.getUnoPropertyValue(xNumberFormat, "Locale"); int NewFormatKey = defineNumberFormat(FormatString, oLocale); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject); + xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier()); if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat")) { xPSet.setPropertyValue("NumberFormat", new Integer(NewFormatKey)); diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 16f8587e535c..f46c3fd657d4 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -108,7 +108,6 @@ public class DBMetaData public com.sun.star.sdb.tools.XConnectionTools ConnectionTools; public com.sun.star.lang.XMultiServiceFactory xMSF; public XComponent xConnectionComponent; - public SQLQueryComposer oSQLQueryComposer; private XNameAccess m_xTableNames; private XInteractionHandler oInteractionHandler; @@ -1117,7 +1116,6 @@ public class DBMetaData ConnectionTools = null; xMSF = null; xConnectionComponent = null; - oSQLQueryComposer = null; CommandObjects = null; } } diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 2c49de15696b..bad14c2faa20 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -36,6 +36,7 @@ import com.sun.star.wizards.common.*; public class QueryMetaData extends CommandMetaData { + private SQLQueryComposer oSQLQueryComposer = null; FieldColumn CurFieldColumn; public String Command; // Vector CommandNamesV; @@ -290,4 +291,10 @@ public class QueryMetaData extends CommandMetaData } return iAggregate; } + public SQLQueryComposer getSQLQueryComposer() + { + if ( oSQLQueryComposer == null ) + oSQLQueryComposer = new SQLQueryComposer(this); + return oSQLQueryComposer; + } } diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index a6a63c5a4fc7..0a52f6a3a7a9 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -60,7 +60,7 @@ public class SQLQueryComposer // String m_sFromClause; public XSingleSelectQueryAnalyzer m_xQueryAnalyzer; Vector composedCommandNames = new Vector(1); - public XSingleSelectQueryComposer m_xQueryComposer; + private XSingleSelectQueryComposer m_xQueryComposer; XMultiServiceFactory xMSF; boolean bincludeGrouping = true; @@ -160,10 +160,8 @@ public class SQLQueryComposer { for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++) { - String sCurFieldName = CurDBMetaData.getFilterConditions()[i][0].Name; m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); } - String s = m_xQueryAnalyzer.getQuery(); } catch (Exception exception) { @@ -270,9 +268,10 @@ public class SQLQueryComposer return m_xQueryAnalyzer.getQuery(); } - private String getFromClause() + public String getFromClause() { String sFromClause = "FROM"; + composedCommandNames.clear(); String[] sCommandNames = CurDBMetaData.getIncludedCommandNames(); for (int i = 0; i < sCommandNames.length; i++) { @@ -291,20 +290,27 @@ public class SQLQueryComposer public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) { + return setQueryCommand(_xParentWindow,_bincludeGrouping, _baddAliasFieldNames,true); + } + public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery) + { try { String s; bincludeGrouping = _bincludeGrouping; - String sFromClause = getFromClause(); - String sSelectClause = getSelectClause(_baddAliasFieldNames); - String queryclause = sSelectClause + " " + sFromClause; - m_xQueryAnalyzer.setQuery(queryclause); - if (CurDBMetaData.getFilterConditions() != null) + if ( addQuery ) { - if (CurDBMetaData.getFilterConditions().length > 0) + String sFromClause = getFromClause(); + String sSelectClause = getSelectClause(_baddAliasFieldNames); + String queryclause = sSelectClause + " " + sFromClause; + m_xQueryAnalyzer.setQuery(queryclause); + if (CurDBMetaData.getFilterConditions() != null) { - CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions())); - m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); + if (CurDBMetaData.getFilterConditions().length > 0) + { + CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions())); + m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); + } } } s = m_xQueryAnalyzer.getQuery(); @@ -333,6 +339,8 @@ public class SQLQueryComposer { FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname); CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName()); + if ( curComposedCommandName == null ) + return _fieldname; String curAliasName = curComposedCommandName.getAliasName(); return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName()); } @@ -418,4 +426,8 @@ public class SQLQueryComposer typeexception.printStackTrace(System.out); } } + public XSingleSelectQueryComposer getQueryComposer() + { + return m_xQueryComposer; + } } diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index 3ed03e47b1ee..fb4191277b8c 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -33,6 +33,7 @@ import com.sun.star.awt.XControlModel; import com.sun.star.awt.XLayoutConstrains; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.container.XNamed; @@ -97,8 +98,13 @@ public class Control extends Shape icontroltype = _icontroltype; sServiceName = oFormHandler.sModelServices[getControlType()]; Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName); - xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oControlModel); - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oControlModel); + xControlModel = UnoRuntime.queryInterface( XControlModel.class, oControlModel ); + xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oControlModel ); + + XPropertySetInfo xPSI = xPropertySet.getPropertySetInfo(); + if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) ) + xPropertySet.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) ); + insertControlInContainer(_FieldName); xControlShape.setControl(xControlModel); if (_xGroupShapes == null) @@ -110,7 +116,7 @@ public class Control extends Shape _xGroupShapes.add(xShape); } xControl = oFormHandler.xControlAccess.getControl(xControlModel); - xControlPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl); + xControlPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xControl ); xWindowPeer = xControl.getPeer(); } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index 66d9195c0c2f..b0b1523840a9 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -29,6 +29,7 @@ package com.sun.star.wizards.document; import com.sun.star.awt.Point; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; import com.sun.star.container.XNameContainer; import com.sun.star.drawing.XShapes; import com.sun.star.sdbc.DataType; @@ -92,6 +93,11 @@ public class DatabaseControl extends Control xPropColumn.setPropertyValue("DataField", sFieldName); xPropColumn.setPropertyValue("Label", _columntitle); xPropColumn.setPropertyValue("Width", new Integer(0)); // Width of column is adjusted to Columname + + XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo(); + if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) ) + xPropColumn.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) ); + setNumericLimits(); _oGridControl.xNameContainer.insertByName(sFieldName, xPropColumn); } diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java index d946d592ffc0..66bae37e1ed3 100644 --- a/wizards/com/sun/star/wizards/document/GridControl.java +++ b/wizards/com/sun/star/wizards/document/GridControl.java @@ -60,15 +60,15 @@ public class GridControl extends Shape { fieldcolumns = _fieldcolumns; Object oGridModel = oFormHandler.xMSFDoc.createInstance(oFormHandler.sModelServices[FormHandler.SOGRIDCONTROL]); - xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oGridModel); - xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oGridModel); + xNameContainer = UnoRuntime.queryInterface( XNameContainer.class, oGridModel ); + xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, oGridModel ); _xFormName.insertByName(_sname, oGridModel); - xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oGridModel); + xControlModel = UnoRuntime.queryInterface( XControlModel.class, oGridModel ); xControlShape.setControl(xControlModel); - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGridModel); + xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oGridModel ); oFormHandler.xDrawPage.add(xShape); - xGridColumnFactory = (XGridColumnFactory) UnoRuntime.queryInterface(XGridColumnFactory.class, oGridModel); - xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oGridModel); + xGridColumnFactory = UnoRuntime.queryInterface( XGridColumnFactory.class, oGridModel ); + xComponent = UnoRuntime.queryInterface( XComponent.class, oGridModel ); // Helper.setUnoPropertyValue(oGridModel, "Name", _sname); for (int i = 0; i < fieldcolumns.length; i++) diff --git a/wizards/com/sun/star/wizards/letter/LocaleCodes.java b/wizards/com/sun/star/wizards/letter/LocaleCodes.java index bf0292c4d6af..82994f40dc6b 100644 --- a/wizards/com/sun/star/wizards/letter/LocaleCodes.java +++ b/wizards/com/sun/star/wizards/letter/LocaleCodes.java @@ -41,7 +41,7 @@ public class LocaleCodes extends Resource public LocaleCodes(XMultiServiceFactory xmsf) { super(xmsf, UNIT_NAME, MODULE_NAME); - allLanguageStrings = getStringList(16750); // STR_ARR_SVT_LANGUAGE_TABLE from svtools/source/misc/langtab.src + allLanguageStrings = getStringList(16635); // STR_ARR_SVT_LANGUAGE_TABLE from svtools/source/misc/langtab.src } public String getLanguageString(String MSID) diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index ca2a232c8ef8..35d1edf37bde 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -169,10 +169,9 @@ public class Finalizer public String finish() { - CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData); String queryName = getTitle(); - if ( CurDBMetaData.oSQLQueryComposer.setQueryCommand( m_queryWizard.xWindow, true, true ) - && CurDBMetaData.createQuery( CurDBMetaData.oSQLQueryComposer, queryName ) + if ( CurDBMetaData.getSQLQueryComposer().setQueryCommand( m_queryWizard.xWindow, true, true ) + && CurDBMetaData.createQuery( CurDBMetaData.getSQLQueryComposer(), queryName ) ) return queryName; diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 9c8180a05c2d..05f7ad2a6a5b 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -256,13 +256,12 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(""))) { - getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser()); DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) { getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); - getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command); - getRecordParser().oSQLQueryComposer.prependSortingCriteria(); + getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command); + getRecordParser().getSQLQueryComposer().prependSortingCriteria(); } else { diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 61ab85c6094d..2bffd2b4bea3 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -268,10 +268,10 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, boolean bQueryCreated = false; if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = m_reportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(this.xWindow, false, false); + bQueryCreated = m_reportDocument.getRecordParser().getSQLQueryComposer().setQueryCommand(this.xWindow, false, false); m_reportDocument.setCommandType(CommandType.COMMAND); - String sQuery = m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery(); + String sQuery = m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery(); m_reportDocument.setCommand(sQuery); } else @@ -286,11 +286,11 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); bQueryCreated = (!sCommand.equals("")); - m_reportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); - m_reportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria(); + m_reportDocument.getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(sCommand); + m_reportDocument.getRecordParser().getSQLQueryComposer().prependSortingCriteria(); // TODO: check with query m_reportDocument.setCommandType(CommandType.COMMAND); - m_reportDocument.setCommand(m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery()); + m_reportDocument.setCommand(m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery()); bQueryCreated = true; } else @@ -479,7 +479,6 @@ public static XLogger getLogger() if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) ) { - m_reportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(m_reportDocument.getRecordParser()); buildSteps(); m_reportDocument.checkInvariants(); diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 8b40528fe832..85b797d3b640 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -33,13 +33,19 @@ import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XControl; import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; +import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertyContainer; import com.sun.star.beans.XPropertySet; import com.sun.star.lang.EventObject; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lib.uno.helper.PropertySet; import com.sun.star.sdbc.DataType; +import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Exception; +import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.wizards.common.NumberFormatter; @@ -48,6 +54,8 @@ import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.db.FieldColumn; import com.sun.star.wizards.db.QueryMetaData; +import java.util.logging.Level; +import java.util.logging.Logger; public class FilterComponent { @@ -112,10 +120,10 @@ public class FilterComponent final int SO_SECONDBOOLFIELDNAME = 256 + 2; final int SO_THIRDBOOLFIELDNAME = 256 + 3; final int SO_FOURTHBOOLFIELDNAME = 256 + 4; - int SO_BOOLEANLIST[] = { + int SO_BOOLEANLIST[] = + { SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME }; - final int SO_OPTQUERYMODE = 5; int SOI_MATCHALL = 0; int SOI_MATCHANY = 1; @@ -127,25 +135,23 @@ public class FilterComponent public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) { - try + int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); + String sControlName = ""; + switch (iKey) { - int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); - String sControlName = ""; - switch (iKey) - { - // case SOOPTQUERYMODE: - // getfilterstate(); - case SO_FIRSTFIELDNAME: - case SO_SECONDFIELDNAME: - case SO_THIRDFIELDNAME: - case SO_FOURTHFIELDNAME: - sControlName = getControlName(EventObject.Source); - String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName); - XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName)); - String CurDisplayFieldName = xCurFieldListBox.getSelectedItem(); - FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName); - - String sControlNameTextValue = "txtValue" + sControlNameSuffix; + // case SOOPTQUERYMODE: + // getfilterstate(); + case SO_FIRSTFIELDNAME: + case SO_SECONDFIELDNAME: + case SO_THIRDFIELDNAME: + case SO_FOURTHFIELDNAME: + sControlName = getControlName(EventObject.Source); + String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName); + XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName)); + String CurDisplayFieldName = xCurFieldListBox.getSelectedItem(); + FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName); + + String sControlNameTextValue = "txtValue" + sControlNameSuffix; // String sControlNameBooleanList = "lstBoolean" + sControlNameSuffix; // if (aFieldColumn.FieldType == DataType.BOOLEAN) // { @@ -158,41 +164,36 @@ public class FilterComponent // CurUnoDialog.setControlVisible(sControlNameTextValue, true); // CurUnoDialog.setControlVisible(sControlNameBooleanList, false); - XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue); - XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); - Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat())); - final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); - aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter); + XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue); + XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); + Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat())); + final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); + aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter); // } - break; - case SO_FIRSTCONDITION: - case SO_SECONDCONDITION: - case SO_THIRDCONDITION: - case SO_FOURTHCONDITION: - sControlName = getControlName(EventObject.Source); - break; - case SOOPTORMODE: - case SOOPTANDMODE: - // getfilterstate(); - return; + break; + case SO_FIRSTCONDITION: + case SO_SECONDCONDITION: + case SO_THIRDCONDITION: + case SO_FOURTHCONDITION: + sControlName = getControlName(EventObject.Source); + break; + case SOOPTORMODE: + case SOOPTANDMODE: + // getfilterstate(); + return; case SO_FIRSTBOOLFIELDNAME: case SO_SECONDBOOLFIELDNAME: case SO_THIRDBOOLFIELDNAME: case SO_FOURTHBOOLFIELDNAME: - sControlName = getControlName(EventObject.Source); + sControlName = getControlName(EventObject.Source); break; - default: - break; - } - togglefollowingControlRow(sControlName); - } - catch (Exception exception) - { - exception.printStackTrace(System.out); + default: + break; } + togglefollowingControlRow(sControlName); } public void disposing(com.sun.star.lang.EventObject eventObject) @@ -205,15 +206,8 @@ public class FilterComponent public void textChanged(TextEvent EventObject) { - try - { - String sName = getControlName(EventObject.Source); - togglefollowingControlRow(sName); - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } + String sName = getControlName(EventObject.Source); + togglefollowingControlRow(sName); } public void disposing(EventObject EventObject) @@ -245,10 +239,10 @@ public class FilterComponent } public static String getIndexNumber(String _sStr) - { - String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length()); - return sLastNumber; - } + { + String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length()); + return sLastNumber; + } /** * Enable the next ControlRow if the Condition is complete in the current line @@ -290,102 +284,67 @@ public class FilterComponent int nFilterCount = getFilterCount(); if (nFilterCount > 0) { - if (this.getfilterstate() == this.SOI_MATCHALL) - { - filterconditions = new PropertyValue[1][nFilterCount]; - } - else - { - filterconditions = new PropertyValue[nFilterCount][1]; - } - int a = 0; - for (int i = 0; i < RowCount; i++) + try { - ControlRow CurControlRow = oControlRows[i]; - if (CurControlRow.isEnabled()) + final String serviceName = "com.sun.star.beans.PropertyBag"; + final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName)); + + column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR); + column.addProperty("Name", PropertyAttribute.BOUND, ""); + final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column); + + if ( oQueryMetaData.getSQLQueryComposer().getQuery().length() == 0) + { + final String fromClause = oQueryMetaData.getSQLQueryComposer().getFromClause(); + StringBuffer sql = new StringBuffer(); + sql.append(oQueryMetaData.getSQLQueryComposer().getSelectClause(true)); + sql.append(' '); + sql.append(fromClause); + oQueryMetaData.getSQLQueryComposer().getQueryComposer().setElementaryQuery(sql.toString()); + } + int a = 0; + for (int i = 0; i < RowCount; i++) { - if (CurControlRow.isConditionComplete()) + ControlRow CurControlRow = oControlRows[i]; + if (CurControlRow.isEnabled()) { - Object aValue; - String sFieldName = CurControlRow.getSelectedFieldName(); - int nOperator = (int) CurControlRow.getSelectedOperator(); - FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); - if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTextFormatKey()) - { - aValue = "'" + CurControlRow.getValue() + "'"; - } -//// TODO the following code is bound to be deprecated as soon as the query composer is able to handle date/time values as numbers - else if ((aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || - (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())) - { - String sDate = CurControlRow.getDateTimeString(true); - aValue = "{D '" + sDate + "' }"; // FormatsSupplier - } - else if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTimeFormatKey()) - { - String sTime = CurControlRow.getDateTimeString(true); - aValue = "'{T '" + sTime + "' }"; - } - else - { - aValue = CurControlRow.getValue(); - // if void - if (! AnyConverter.isVoid(aValue)) - { - switch (aFieldColumn.getFieldType()) - { - case DataType.TINYINT: - case DataType.BIGINT: - case DataType.INTEGER: - case DataType.SMALLINT: - if ( AnyConverter.isDouble(aValue) ) - aValue = String.valueOf(((Double) aValue).intValue()); - break; - case DataType.BIT: - case DataType.BOOLEAN: - // curValue = CurControlRow.getText(); // wrong! (creates something like 'WAHR'/'FALSCH' if german locale is used. - - // double dblvalue = ((Double) curValue).doubleValue(); - //curValue = new Boolean(dblvalue == 1.0); // wrong! we need a string, not a boolean value - - // converts the '1.0'/'0.0' (EffectiveValue) to a 'boolean' String like 'true'/'false' - if ( AnyConverter.isDouble(aValue) ) - aValue = String.valueOf(((Double) aValue).intValue() == 1); - break; - default: - aValue = String.valueOf(aValue); - break; - } - } - } - - PropertyValue oPropertyValue = Properties.createProperty(sFieldName, aValue, nOperator); - if (getfilterstate()/*this.ifilterstate*/ == this.SOI_MATCHALL) + if (CurControlRow.isConditionComplete()) { - if (i == 0) + String sFieldName = CurControlRow.getSelectedFieldName(); + int nOperator = (int) CurControlRow.getSelectedOperator(); + FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); + columnSet.setPropertyValue("Name", aFieldColumn.getFieldName()); + columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type")); + Object value = CurControlRow.getValue(); + switch(aFieldColumn.getFieldType()) { - filterconditions[0] = new PropertyValue[nFilterCount]; + case DataType.TIMESTAMP: + case DataType.DATE: + value = ((Double)value) - oQueryMetaData.getNullDateCorrection(); + break; } - filterconditions[0][a] = oPropertyValue; + column.addProperty("Value", PropertyAttribute.MAYBEVOID, value); + columnSet.setPropertyValue("Value", value); + oQueryMetaData.getSQLQueryComposer().getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator); } - else - { - filterconditions[a][0] = oPropertyValue; - } - a++; } } + filterconditions = oQueryMetaData.getSQLQueryComposer().getQueryComposer().getStructuredFilter(); + int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions); + if (iduplicate[0] != -1) + { + PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]]; + String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null); + CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition); + CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", Integer.valueOf(1), Integer.valueOf(2))); + return new PropertyValue[][] + { + }; + } } - int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions); - if (iduplicate[0] != -1) + catch (Exception ex) { - PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]]; - String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null); - CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition); - CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", Integer.valueOf(1), Integer.valueOf(2))); - return new PropertyValue[][] - { - }; + Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex); } } else @@ -413,8 +372,10 @@ public class FilterComponent String soperator = sLogicOperators[_filtercondition.Handle - 1]; sreturn = JavaTools.replaceSubString(sreturn, soperator, "<LOGICOPERATOR>"); String sDisplayValue = ""; - if ( !AnyConverter.isVoid(_filtercondition.Value) ) + if (!AnyConverter.isVoid(_filtercondition.Value)) + { sDisplayValue = AnyConverter.toString(_filtercondition.Value); + } sreturn = JavaTools.replaceSubString(sreturn, sDisplayValue, "<VALUE>"); return sreturn; } @@ -443,24 +404,17 @@ public class FilterComponent private void addfiltercondition(int _index, String _curFieldName, Object _curValue, int _curOperator) { - try + String ValString = String.valueOf(_curValue); + PropertyValue oPropertyValue = Properties.createProperty(_curFieldName, ValString, _curOperator); + getfilterstate(); + if (getfilterstate() == this.SOI_MATCHALL) { - String ValString = String.valueOf(_curValue); - PropertyValue oPropertyValue = Properties.createProperty(_curFieldName, ValString, _curOperator); - getfilterstate(); - if (getfilterstate() == this.SOI_MATCHALL) + if (_index == 0) { - if (_index == 0) - { - filterconditions[0] = new PropertyValue[getFilterCount()]; - } - filterconditions[0][_index] = new PropertyValue(); - filterconditions[0][_index] = oPropertyValue; + filterconditions[0] = new PropertyValue[getFilterCount()]; } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); + filterconditions[0][_index] = new PropertyValue(); + filterconditions[0][_index] = oPropertyValue; } } @@ -475,8 +429,8 @@ public class FilterComponent } } return a; - // FilterCount = a; - // return FilterCount; + // FilterCount = a; + // return FilterCount; } /** Creates a new instance of FilterComponent @@ -492,95 +446,88 @@ public class FilterComponent */ public FilterComponent(WizardDialog CurUnoDialog, XMultiServiceFactory _xMSF, int iStep, int iPosX, int iPosY, int iWidth, int FilterCount, QueryMetaData _oQueryMetaData, int _firstHelpID) { - try - { - this.curHelpID = _firstHelpID; - this.xMSF = _xMSF; - this.IStep = Integer.valueOf(iStep); - - curtabindex = UnoDialog.setInitialTabindex(iStep); - this.CurUnoDialog = CurUnoDialog; - this.RowCount = FilterCount; - this.oQueryMetaData = _oQueryMetaData; - boolean bEnabled; - sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "optMatchAll"); - // iStartPosX = iPosX; - // iStartPosY = iPosY; - - String soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9); - String soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10); - slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17); - slblOperators = CurUnoDialog.m_oResource.getResText(BaseID + 24); - slblValue = CurUnoDialog.m_oResource.getResText(BaseID + 25); - sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 10 /* 7 */); // =, <>, <, >, <=, >=, like, !like, is null, !is null - sBooleanValues = CurUnoDialog.m_oResource.getResArray(BaseID + 36, 2); // true, false - - sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89); - - // create Radiobuttons - // * match all - // * match one - optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(), - new String[] - { - "Height", - "HelpURL", - "Label", - "PositionX", - "PositionY", - "State", - "Step", - "TabIndex", - "Width" - }, - new Object[] - { - Integer.valueOf(9), - "HID:" + curHelpID++, - soptMatchAll, - Integer.valueOf(iPosX), - Integer.valueOf(iPosY), - Short.valueOf((short) 1), - IStep, - Short.valueOf(curtabindex++), - Integer.valueOf(203) - }); - optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(), - new String[] - { - "Height", - "HelpURL", - "Label", - "PositionX", - "PositionY", - "Step", - "TabIndex", - "Width" - }, - new Object[] - { - Integer.valueOf(9), - "HID:" + curHelpID++, - soptMatchAny, - Integer.valueOf(iPosX), - Integer.valueOf(iPosY + 12), - IStep, - Short.valueOf(curtabindex++), - Integer.valueOf(203) - }); - getfilterstate(); - - oControlRows = new ControlRow[FilterCount]; - for (int i = 0; i < FilterCount; i++) - { - bEnabled = (i == 0); - oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (this.curHelpID + (i * 3))); - iPosY += 43; - } - } - catch (Exception exception) + this.curHelpID = _firstHelpID; + this.xMSF = _xMSF; + this.IStep = Integer.valueOf(iStep); + + curtabindex = UnoDialog.setInitialTabindex(iStep); + this.CurUnoDialog = CurUnoDialog; + this.RowCount = FilterCount; + this.oQueryMetaData = _oQueryMetaData; + boolean bEnabled; + sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "optMatchAll"); + // iStartPosX = iPosX; + // iStartPosY = iPosY; + + String soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9); + String soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10); + slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17); + slblOperators = CurUnoDialog.m_oResource.getResText(BaseID + 24); + slblValue = CurUnoDialog.m_oResource.getResText(BaseID + 25); + sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 10 /* 7 */); // =, <>, <, >, <=, >=, like, !like, is null, !is null + sBooleanValues = CurUnoDialog.m_oResource.getResArray(BaseID + 36, 2); // true, false + + sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89); + + // create Radiobuttons + // * match all + // * match one + optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(), + new String[] + { + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "State", + "Step", + "TabIndex", + "Width" + }, + new Object[] + { + Integer.valueOf(9), + "HID:" + curHelpID++, + soptMatchAll, + Integer.valueOf(iPosX), + Integer.valueOf(iPosY), + Short.valueOf((short) 1), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(203) + }); + optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(), + new String[] + { + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" + }, + new Object[] + { + Integer.valueOf(9), + "HID:" + curHelpID++, + soptMatchAny, + Integer.valueOf(iPosX), + Integer.valueOf(iPosY + 12), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(203) + }); + getfilterstate(); + + oControlRows = new ControlRow[FilterCount]; + for (int i = 0; i < FilterCount; i++) { - exception.printStackTrace(System.out); + bEnabled = (i == 0); + oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (this.curHelpID + (i * 3))); + iPosY += 43; } } @@ -636,29 +583,21 @@ public class FilterComponent public void addNumberFormats() { - try - { - iDateFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD"); - iTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("HH:MM:SS"); - iDateTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD HH:MM:SS"); - } - catch (Exception e) - { - e.printStackTrace(System.out); - } + iDateFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD"); + iTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("HH:MM:SS"); + iDateTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD HH:MM:SS"); } // ------------------------------------------------------------------------- // // // ------------------------------------------------------------------------- - class ControlRow { + private final static int SOLSTFIELDNAME = 3; private final static int SOLSTOPERATOR = 4; private final static int SOTXTVALUE = 5; - protected XInterface[] ControlElements = new XInterface[6]; private boolean m_bEnabled; String[] FieldNames; @@ -775,7 +714,7 @@ public class FilterComponent Boolean.TRUE, Integer.valueOf(13), "HID:" + _firstRowHelpID++, - Short.valueOf(UnoDialog.getListBoxLineCount() /* 7 */) , + Short.valueOf(UnoDialog.getListBoxLineCount() /* 7 */), Integer.valueOf(nPosX1), Integer.valueOf(iCompPosY + 23), IStep, @@ -805,7 +744,7 @@ public class FilterComponent Boolean.TRUE, Integer.valueOf(13), "HID:" + _firstRowHelpID++, - Short.valueOf((short) sLogicOperators.length /* 7 */ ), + Short.valueOf((short) sLogicOperators.length /* 7 */), Integer.valueOf(nPosX2), Integer.valueOf(iCompPosY + 23), IStep, @@ -880,8 +819,9 @@ public class FilterComponent { int nSelOperator = getSelectedOperator(); // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); - if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL || /* is null */ - nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */ + if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL + || /* is null */ nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */ + { // disable value field Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[2]), "Enabled", Boolean.FALSE); @@ -943,13 +883,27 @@ public class FilterComponent { sValue = JavaTools.replaceSubString(sValue, "", "{D '"); sValue = JavaTools.replaceSubString(sValue, "", "' }"); - oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue); + try + { + oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue); + } + catch (java.lang.Exception ex) + { + Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex); + } } else if (sValue.indexOf("{T '") > -1) { sValue = JavaTools.replaceSubString(sValue, "", "{T '"); sValue = JavaTools.replaceSubString(sValue, "", "' }"); - oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue); + try + { + oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue); + } + catch (java.lang.Exception ex) + { + Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex); + } } } else if (AnyConverter.isBoolean(_filtercondition.Value)) @@ -1001,7 +955,9 @@ public class FilterComponent m_bEnabled = _bEnabled; if (isEnabled()) { - short[] iselected = new short[] {}; + short[] iselected = new short[] + { + }; try { iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); @@ -1012,7 +968,10 @@ public class FilterComponent } if ((iselected.length) == 0) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[] + { + 0 + }); } } else if (!isConditionComplete()) @@ -1044,28 +1003,28 @@ public class FilterComponent short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); switch (SelFields[0]) { - case 0: - return com.sun.star.sdb.SQLFilterOperator.EQUAL; - case 1: - return com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL; - case 2: - return com.sun.star.sdb.SQLFilterOperator.LESS; - case 3: - return com.sun.star.sdb.SQLFilterOperator.GREATER; - case 4: - return com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL; - case 5: - return com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL; - case 6: - return com.sun.star.sdb.SQLFilterOperator.LIKE; - case 7: - return com.sun.star.sdb.SQLFilterOperator.NOT_LIKE; - case 8: - return com.sun.star.sdb.SQLFilterOperator.SQLNULL; - case 9: - return com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL; - default: - return -1; + case 0: + return com.sun.star.sdb.SQLFilterOperator.EQUAL; + case 1: + return com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL; + case 2: + return com.sun.star.sdb.SQLFilterOperator.LESS; + case 3: + return com.sun.star.sdb.SQLFilterOperator.GREATER; + case 4: + return com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL; + case 5: + return com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL; + case 6: + return com.sun.star.sdb.SQLFilterOperator.LIKE; + case 7: + return com.sun.star.sdb.SQLFilterOperator.NOT_LIKE; + case 8: + return com.sun.star.sdb.SQLFilterOperator.SQLNULL; + case 9: + return com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL; + default: + return -1; } } catch (Exception exception) @@ -1078,43 +1037,19 @@ public class FilterComponent // TODO make a difference between Text and Numbers protected Object getValue() { - try - { - return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue")); - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - return null; + return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue")); } protected Object getText() { - try - { - return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text")); - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - return null; + return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text")); } protected String getDateTimeString(boolean bgetDate) { - try - { double dblValue = ((Double) getValue()).doubleValue(); NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter(); return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue); - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - return null; - } } } } diff --git a/wizards/prj/build.lst b/wizards/prj/build.lst index c98f4561577c..c4d635a921a8 100644 --- a/wizards/prj/build.lst +++ b/wizards/prj/build.lst @@ -1,4 +1,4 @@ -wz wizards : l10n rsc javaunohelper unoil QADEVOOO:qadevOOo NULL +wz wizards : l10n rsc javaunohelper unoil NULL wz wizards\util nmake - all wz_util NULL wz wizards\source\config nmake - all wz_config NULL wz wizards\source\configshare nmake - all wz_configshare NULL diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src index 065008c40cec..c04d77b9fcdd 100644 --- a/wizards/source/formwizard/dbwizres.src +++ b/wizards/source/formwizard/dbwizres.src @@ -2856,7 +2856,7 @@ String RID_WEBWIZARDDIALOG_START +110 String RID_WEBWIZARDDIALOG_START +111 { - Text [ en-US ] = "A security error acoccurred while exporting the document '%FILENAME'."; + Text [ en-US ] = "A security error occurred while exporting the document '%FILENAME'."; }; String RID_WEBWIZARDDIALOG_START +112 diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx index 60093fc37137..4d48aad47555 100644 --- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx +++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx @@ -94,7 +94,6 @@ private: FixedLine maBottomSepFL; OKButton maOKBtn; - CancelButton maCancelBtn; HelpButton maHelpBtn; ::rtl::OUString m_sODFVersion; diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 5ea3fbb47a38..df032dcbe5ef 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -203,7 +203,6 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( ,maRemoveBtn ( this, XMLSEC_RES( BTN_REMOVECERT ) ) ,maBottomSepFL ( this, XMLSEC_RES( FL_BOTTOM_SEP ) ) ,maOKBtn ( this, XMLSEC_RES( BTN_OK ) ) - ,maCancelBtn ( this, XMLSEC_RES( BTN_CANCEL ) ) ,maHelpBtn ( this, XMLSEC_RES( BTN_HELP ) ) ,m_sODFVersion (sODFVersion) ,m_bHasDocumentSignature(bHasDocumentSignature) @@ -212,7 +211,10 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( // --> PB #i48253 the tablistbox needs its own unique id maSignaturesLB.Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG ); // <-- - static long nTabs[] = { 4, 0, 6*DS_LB_WIDTH/100, 36*DS_LB_WIDTH/100, 74*DS_LB_WIDTH/100 }; + Size aControlSize( maSignaturesLB.GetSizePixel() ); + aControlSize = maSignaturesLB.PixelToLogic( aControlSize, MapMode( MAP_APPFONT ) ); + const long nControlWidth = aControlSize.Width(); + static long nTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 }; maSignaturesLB.SetTabs( &nTabs[ 0 ] ); maSignaturesLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) ); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src index e0cada1d0d5c..87d2de520103 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src @@ -32,7 +32,7 @@ ModalDialog RID_XMLSECDLG_DIGSIG { HelpId = HID_XMLSEC_DLG_DIGSIG; - Size = MAP_APPFONT( DS_WIDTH, DS_HEIGHT ); + Size = MAP_APPFONT( 234, 191 ); OutputSize = TRUE; Closeable = TRUE; Moveable = TRUE; @@ -42,30 +42,30 @@ ModalDialog RID_XMLSECDLG_DIGSIG FixedText FT_HINT_DOC { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_0 ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 3 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "The following have signed the document content:"; }; FixedText FT_HINT_BASIC { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_0 ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 3 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "The following have signed the document macro:"; }; FixedText FT_HINT_PACK { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_0 ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 3 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "The following have signed this package:"; }; Control LB_SIGNATURES { HelpId = HID_XMLSEC_CTRL_SIGNATURESDLG; - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_1 ); - Size = MAP_APPFONT( DS_LB_WIDTH, DS_ROW_2-DS_ROW_1 ); + Pos = MAP_APPFONT( 6, 14 ); + Size = MAP_APPFONT( 222, 109 ); SVLook = TRUE; Border = TRUE; }; @@ -88,8 +88,8 @@ ModalDialog RID_XMLSECDLG_DIGSIG FixedImage IMG_STATE_VALID { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 33, 22 ); Fixed = Image { ImageBitmap = Bitmap { File = "signet_11x16.png"; }; @@ -98,22 +98,22 @@ ModalDialog RID_XMLSECDLG_DIGSIG }; FixedText FI_STATE_VALID { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "The signatures in this document are valid"; }; FixedText FI_STATE_OLDSIGNATURE { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "Not all parts of the document are signed"; }; FixedImage IMG_STATE_BROKEN { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 33, 22 ); Fixed = Image { ImageBitmap = Bitmap { File = "caution_11x16.png"; }; @@ -122,15 +122,15 @@ ModalDialog RID_XMLSECDLG_DIGSIG }; FixedText FI_STATE_BROKEN { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; Text [ en-US ] = "The signatures in this document are invalid"; }; FixedImage IMG_STATE_NOTVALIDATED { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 33, 22 ); Fixed = Image { ImageBitmap = Bitmap { File = "notcertificate_16.png"; }; @@ -139,48 +139,44 @@ ModalDialog RID_XMLSECDLG_DIGSIG }; FixedText FI_STATE_NOTVALIDATED { - Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A ); - Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); + Pos = MAP_APPFONT( 6, 127 ); + Size = MAP_APPFONT( 222, 8 ); Hide = TRUE; }; PushButton BTN_VIEWCERT { - Pos = MAP_APPFONT( DS_COL_1, DS_ROW_3 ); - Size = MAP_APPFONT( DS_COL_2-DS_COL_1, RSC_CD_PUSHBUTTON_HEIGHT ); + Pos = MAP_APPFONT( 6, 142 ); + Size = MAP_APPFONT( 70, 14 ); Text [ en-US ] = "View Certificate..."; }; PushButton BTN_ADDCERT { - Pos = MAP_APPFONT( DS_COL_3, DS_ROW_3 ); - Size = MAP_APPFONT( DS_COL_4-DS_COL_3, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Add..."; + Pos = MAP_APPFONT( 82, 142 ); + Size = MAP_APPFONT( 70, 14 ); + Text [ en-US ] = "Sign Document..."; }; PushButton BTN_REMOVECERT { - Pos = MAP_APPFONT( DS_COL_5, DS_ROW_3 ); - Size = MAP_APPFONT( DS_COL_6-DS_COL_5, RSC_CD_PUSHBUTTON_HEIGHT ); + Pos = MAP_APPFONT( 158, 142 ); + Size = MAP_APPFONT( 70, 14 ); Text [ en-US ] = "Remove"; }; FixedLine FL_BOTTOM_SEP { - Pos = MAP_APPFONT( 0, DLGS_BOTTOM_FL_Y( DS_HEIGHT ) ); - Size = MAP_APPFONT( DS_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); + Pos = MAP_APPFONT( 0, 160 ); + Size = MAP_APPFONT( 234, 8 ); }; OKButton BTN_OK { DefButton = TRUE; - Pos = MAP_APPFONT( DLGS_BOTTOM_OK_X( DS_WIDTH ), DLGS_BOTTOM_BTN_Y( DS_HEIGHT ) ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT( DLGS_BOTTOM_CANCEL_X( DS_WIDTH ), DLGS_BOTTOM_BTN_Y( DS_HEIGHT ) ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + Pos = MAP_APPFONT( 178, 171 ); + Size = MAP_APPFONT( 50, 14 ); + Text [ en-US ] = "Close"; }; HelpButton BTN_HELP { - Pos = MAP_APPFONT( DLGS_BOTTOM_HELP_X( DS_WIDTH ), DLGS_BOTTOM_BTN_Y( DS_HEIGHT ) ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + Pos = MAP_APPFONT( 6, 171 ); + Size = MAP_APPFONT( 50, 14 ); }; Image IMG_STATE_VALID_HC { diff --git a/xmlsecurity/test_docs/tools/httpserv/nbproject/genfiles.properties b/xmlsecurity/test_docs/tools/httpserv/nbproject/genfiles.properties index 562eec670951..d8139c888981 100755..100644 --- a/xmlsecurity/test_docs/tools/httpserv/nbproject/genfiles.properties +++ b/xmlsecurity/test_docs/tools/httpserv/nbproject/genfiles.properties @@ -1,3 +1,4 @@ +# x-no-translate build.xml.data.CRC32=8071b819 build.xml.script.CRC32=deb21e95 build.xml.stylesheet.CRC32=958a1d3e@1.26.2.45 diff --git a/xmlsecurity/test_docs/tools/httpserv/nbproject/project.properties b/xmlsecurity/test_docs/tools/httpserv/nbproject/project.properties index 9addce600715..049b5539fda3 100755..100644 --- a/xmlsecurity/test_docs/tools/httpserv/nbproject/project.properties +++ b/xmlsecurity/test_docs/tools/httpserv/nbproject/project.properties @@ -1,3 +1,4 @@ +# x-no-translate application.title=httpserv application.vendor=jochen build.classes.dir=${build.dir}/classes |