diff options
318 files changed, 6048 insertions, 2746 deletions
diff --git a/RepositoryFixes.mk b/RepositoryFixes.mk index f5776f7949d4..e1df50782a81 100755 --- a/RepositoryFixes.mk +++ b/RepositoryFixes.mk @@ -75,7 +75,7 @@ gb_Library_FILENAMES := $(patsubst tl:itl%,tl:itools%,$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst vbahelper:ivbahelper%,vbahelper:vbahelper%,$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst vos3:ivos3%,vos3:ivos%,$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst xml2:ixml2%,xml2:libxml2$(gb_Library_IARCEXT),$(gb_Library_FILENAMES)) -gb_Library_FILENAMES := $(patsubst xslt:ixslt%,xslt:libxslt$(gb_Library_IARCEXT),$(gb_Library_FILENAMES)) +gb_Library_FILENAMES := $(patsubst xslt:ixslt%,xslt:libxslt.dll$(gb_Library_IARCEXT),$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst rdf:irdf%,rdf:librdf.dll$(gb_Library_IARCEXT),$(gb_Library_FILENAMES)) gb_Library_FILENAMES := $(patsubst z:iz%,z:zlib%,$(gb_Library_FILENAMES)) ifeq ($(gb_PRODUCT),$(true)) @@ -99,7 +99,6 @@ gb_Library_DLLFILENAMES := $(filter-out $(foreach lib,$(gb_Library_ILIBFILENAMES gb_Library_DLLFILENAMES += $(foreach lib,$(gb_Library_ILIBFILENAMES),$(lib):$(PSDK_HOME)/lib/$(lib)$(gb_Library_ILIBEXT)) gb_Library_DLLFILENAMES := $(patsubst comphelper:comphelper%,comphelper:comphelp%,$(gb_Library_DLLFILENAMES)) -gb_Library_DLLFILENAMES := $(patsubst cppunit:cppunit%,cppunit:cygcppunit-1-12-1%,$(gb_Library_DLLFILENAMES)) gb_Library_DLLFILENAMES := $(patsubst icuuc:icuuc%,icuuc:icuuc40%,$(gb_Library_DLLFILENAMES)) gb_Library_DLLFILENAMES := $(patsubst ucbhelper:ucbhelper%,ucbhelper:ucbhelper4%,$(gb_Library_DLLFILENAMES)) gb_Library_DLLFILENAMES := $(patsubst z:z%,z:zlib%,$(gb_Library_DLLFILENAMES)) diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx index cb2c4f6628c8..5f8976b905a3 100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx @@ -34,7 +34,6 @@ #include <cppuhelper/weakref.hxx> #include <svtools/accessibletable.hxx> - #include <memory> using namespace ::svt::table; @@ -111,6 +110,28 @@ protected: public: // helper functions + + /** commitCellEvent commit the event at all listeners of the table + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + void commitCellEvent(sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue); + + /** commitTableEvent commit the event at all listeners of the table + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + void commitTableEvent(sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue); /** returns the accessible object for the row or the column header bar */ inline ::com::sun::star::uno::Reference< @@ -242,6 +263,20 @@ protected: xAccessible = pContext->getTable(); return xAccessible; } + virtual void commitCellEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + pContext->commitCellEvent( nEventId, rNewValue, rOldValue ); + } + virtual void commitTableEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + pContext->commitTableEvent( nEventId, rNewValue, rOldValue ); + } virtual void commitEvent( sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) { diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx index c6a26d8c4548..651a58e182ce 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -47,7 +47,6 @@ #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/awt/XFocusListener.hpp> #include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/uno3.hxx> diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx index 8058594d2938..4c13df132968 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx @@ -32,6 +32,7 @@ #include "accessibility/extended/AccessibleGridControlTableBase.hxx" #include <cppuhelper/implbase1.hxx> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <accessibility/extended/AccessibleGridControlTableCell.hxx> // ============================================================================ @@ -55,7 +56,9 @@ public: protected: virtual ~AccessibleGridControlTable(); - +private: + std::vector< AccessibleGridControlTableCell* > m_pCellVector; + std::vector< com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible> > m_pAccessCellVector; public: // XAccessibleContext ----------------------------------------------------- @@ -196,6 +199,11 @@ public: virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + /**@return m_pCellVector*/ + std::vector< AccessibleGridControlTableCell* >& getCellVector(); + /**@return m_xAccessCellVector*/ + std::vector< com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > >& getAccessibleCellVector(); + protected: // internal virtual methods ----------------------------------------------- diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx index bee42d85e2a2..4ea1b7826c2f 100755..100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx @@ -173,6 +173,14 @@ public: 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..f210e7dd01e6 100755 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx @@ -73,9 +73,6 @@ namespace accessibility ,public AccessibleTextHelper_BASE ,public ::comphelper::OCommonAccessibleText { - private: - sal_Int32 m_nOffset; - protected: // OCommonAccessibleText virtual ::rtl::OUString implGetText(); diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index f0aa406b62bf..208be0b5c08b 100755 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -30,6 +30,9 @@ #include "accessibility/extended/AccessibleGridControl.hxx" #include "accessibility/extended/AccessibleGridControlTable.hxx" #include "accessibility/extended/AccessibleGridControlHeader.hxx" +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp> +#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp> #include <svtools/accessibletable.hxx> #include <comphelper/types.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -71,6 +74,11 @@ public: Reference< ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar; AccessibleGridControlHeader* m_pColumnHeaderBar; + + /** The table cell child. */ + Reference< + ::com::sun::star::accessibility::XAccessible > m_xCell; + AccessibleGridControlTableCell* m_pCell; }; DBG_NAME( AccessibleGridControl ) @@ -97,6 +105,7 @@ void SAL_CALL AccessibleGridControl::disposing() m_pImpl->m_pTable = NULL; m_pImpl->m_pColumnHeaderBar = NULL; m_pImpl->m_pRowHeaderBar = NULL; + m_pImpl->m_pCell = NULL; m_pImpl->m_aCreator = Reference< XAccessible >(); Reference< XAccessible > xTable = m_pImpl->m_xTable; @@ -106,7 +115,16 @@ void SAL_CALL AccessibleGridControl::disposing() { xComp->dispose(); } + Reference< XAccessible > xCell = m_pImpl->m_xCell; + + Reference< XComponent > xCellComp( m_pImpl->m_xCell, UNO_QUERY ); + if ( xCellComp.is() ) + { + xCellComp->dispose(); + } + ::comphelper::disposeComponent(m_pImpl->m_xRowHeaderBar); + ::comphelper::disposeComponent(m_pImpl->m_xColumnHeaderBar); AccessibleGridControlBase::disposing(); } // ----------------------------------------------------------------------------- @@ -156,8 +174,12 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) } else { + if(!m_pImpl->m_xTable.is()) + { AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE); m_pImpl->m_xTable = pTable; + m_pImpl->m_pTable = pTable; + } xChild = m_pImpl->m_xTable; } } @@ -316,6 +338,65 @@ AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable() DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" ); return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE ); } +// ----------------------------------------------------------------------------- +void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue) +{ + sal_Int32 nChildCount = getAccessibleChildCount(); + if(nChildCount != 0) + { + for(sal_Int32 i=0;i<nChildCount;i++) + { + Reference< XAccessible > xAccessible = getAccessibleChild(i); + com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext > xAccessibleChild = xAccessible->getAccessibleContext(); + if(m_pImpl->m_xTable == xAccessible) + { + std::vector< AccessibleGridControlTableCell* > xCellCont = m_pImpl->m_pTable->getCellVector(); + int nIndex = m_aTable.GetCurrentRow()*m_aTable.GetColumnCount()+m_aTable.GetCurrentColumn(); + if(!xCellCont.empty() && xCellCont[nIndex]) + { + m_pImpl->m_pCell = xCellCont[nIndex]; + m_pImpl->m_pCell->commitEvent( _nEventId, _rNewValue, _rOldValue ); + } + } + } + } + else + { + if ( m_pImpl->m_xTable.is() ) + m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + } +} +void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue) +{ + if ( m_pImpl->m_xTable.is() ) + { + if(_nEventId == AccessibleEventId::ACTIVE_DESCENDANT_CHANGED) + { + Reference< XAccessible > xChild = m_pImpl->m_pTable->getAccessibleChild(m_aTable.GetCurrentRow()*m_aTable.GetColumnCount()+m_aTable.GetCurrentColumn()); + m_pImpl->m_pTable->commitEvent(_nEventId, makeAny(xChild),_rOldValue); + } + else if(_nEventId == AccessibleEventId::TABLE_MODEL_CHANGED) + { + AccessibleTableModelChange aChange; + if(_rNewValue >>= aChange) + { + if(aChange.Type == AccessibleTableModelChangeType::DELETE) + { + std::vector< AccessibleGridControlTableCell* >::iterator m_pCell = m_pImpl->m_pTable->getCellVector().begin(); + std::vector< Reference< XAccessible > >::iterator m_xAccessibleVector = m_pImpl->m_pTable->getAccessibleCellVector().begin(); + int nColCount = m_aTable.GetColumnCount(); + m_pImpl->m_pTable->getCellVector().erase(m_pCell+nColCount*aChange.FirstRow, m_pCell+nColCount*aChange.LastRow ); + m_pImpl->m_pTable->getAccessibleCellVector().erase(m_xAccessibleVector+nColCount*aChange.FirstRow, m_xAccessibleVector+nColCount*aChange.LastRow); + m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + } + else + m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + } + } + else + m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + } +} // ============================================================================ // = AccessibleGridControlAccess // ============================================================================ diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index ea81bd350426..2e000c68533d 100755 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -86,7 +86,16 @@ AccessibleGridControlBase::~AccessibleGridControlBase() void SAL_CALL AccessibleGridControlBase::disposing() { ::osl::MutexGuard aGuard( getOslMutex() ); + + if ( getClientId( ) ) + { + AccessibleEventNotifier::TClientId nId( getClientId( ) ); + setClientId( 0 ); + AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); + } + m_xParent = NULL; + //m_aTable = NULL; } // XAccessibleContext --------------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index 1870eebc8e3e..4b59a83906ab 100755 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -239,12 +239,24 @@ Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId() Rectangle AccessibleGridControlHeader::implGetBoundingBox() { - return m_aTable.calcHeaderRect(isColumnBar()); + Window* pParent = m_aTable.GetAccessibleParentWindow(); + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) ); + Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar())); + if(isColumnBar()) + return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight())); + else + return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight())); + } Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() { - return m_aTable.calcHeaderRect(isColumnBar()); + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) ); + Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar())); + if(isColumnBar()) + return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight())); + else + return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight())); } sal_Int32 AccessibleGridControlHeader::implGetRowCount() const diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx index 485c57c40ae1..f54379970206 100755 --- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx @@ -146,13 +146,28 @@ void SAL_CALL AccessibleGridControlHeaderCell::grabFocus() // ----------------------------------------------------------------------------- Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox() { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + Window* pParent = m_aTable.GetAccessibleParentWindow(); + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) ); + sal_Int32 nIndex = getAccessibleIndexInParent(); + Rectangle aCellRect; + if(m_eObjType == TCTYPE_COLUMNHEADERCELL) + aCellRect = m_aTable.calcHeaderCellRect(true, nIndex); + else + aCellRect = m_aTable.calcHeaderCellRect(false, nIndex); + return Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize()); } // ----------------------------------------------------------------------------- Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) ); + sal_Int32 nIndex = getAccessibleIndexInParent(); + Rectangle aCellRect; + if(m_eObjType == TCTYPE_COLUMNHEADERCELL) + aCellRect = m_aTable.calcHeaderCellRect(true, nIndex); + else + aCellRect = m_aTable.calcHeaderCellRect(false, nIndex); + return Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize()); } // ----------------------------------------------------------------------------- sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent() diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx index 406baeb2973c..76e8a691c72f 100755 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -58,6 +58,8 @@ AccessibleGridControlTable::AccessibleGridControlTable( IAccessibleTable& rTable, AccessibleTableControlObjType _eType) : AccessibleGridControlTableBase( rxParent, rTable, _eType ) + ,m_pCellVector( ) + ,m_pAccessCellVector( ) { } @@ -75,7 +77,19 @@ AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex ) ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); ensureIsValidIndex( nChildIndex ); - return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL); + sal_Int32 nCount = getAccessibleChildCount(); + if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount) + { + m_pAccessCellVector.resize(nCount); + m_pCellVector.resize(nCount); + } + if(!m_pAccessCellVector[nChildIndex].is()) + { + AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL); + m_pCellVector[nChildIndex] = pCell; + m_pAccessCellVector[nChildIndex] = pCell; + } + return m_pAccessCellVector[nChildIndex]; } sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent() @@ -105,7 +119,6 @@ AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) sal_Int32 nColumnPos = 0; if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) ) xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL); - return xChild; } @@ -221,7 +234,20 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellA ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); - return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL); + sal_Int32 nCount = getAccessibleChildCount(); + sal_Int32 nChildIndex = nRow*m_aTable.GetColumnCount() + nColumn; + if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount) + { + m_pAccessCellVector.resize(nCount); + m_pCellVector.resize(nCount); + } + if(!m_pAccessCellVector[nChildIndex].is()) + { + AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL); + m_pCellVector[nChildIndex] = pCell; + m_pAccessCellVector[nChildIndex] = pCell; + } + return m_pAccessCellVector[nChildIndex]; } sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( @@ -339,12 +365,28 @@ OUString SAL_CALL AccessibleGridControlTable::getImplementationName() Rectangle AccessibleGridControlTable::implGetBoundingBox() { - return m_aTable.calcTableRect(); + Window* pParent = m_aTable.GetAccessibleParentWindow(); + DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent )); + Rectangle aTableRect( m_aTable.calcTableRect() ); + long nX = aGridRect.Left() + aTableRect.Left(); + long nY = aGridRect.Top() + aTableRect.Top(); + long nWidth = aGridRect.GetSize().Width()-aTableRect.Left(); + long nHeight = aGridRect.GetSize().Height()-aTableRect.Top(); + Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight )); + return aTable; } Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() { - return m_aTable.calcTableRect(); + Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL )); + Rectangle aTableRect( m_aTable.calcTableRect() ); + long nX = aGridRect.Left() + aTableRect.Left(); + long nY = aGridRect.Top() + aTableRect.Top(); + long nWidth = aGridRect.GetSize().Width()-aTableRect.Left(); + long nHeight = aGridRect.GetSize().Height()-aTableRect.Top(); + Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight )); + return aTable; } // internal helper methods ---------------------------------------------------- Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( @@ -368,6 +410,15 @@ Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); } +std::vector< AccessibleGridControlTableCell* >& AccessibleGridControlTable::getCellVector() +{ + return m_pCellVector; +} + +std::vector< Reference< XAccessible > >& AccessibleGridControlTable::getAccessibleCellVector() +{ + return m_pAccessCellVector; +} // ============================================================================ } // namespace accessibility diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index 43b9400e9050..1efc369dfbc3 100755 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -360,11 +360,25 @@ namespace accessibility Rectangle AccessibleGridControlTableCell::implGetBoundingBox() { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + Window* pParent = m_aTable.GetAccessibleParentWindow(); + DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); + Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( pParent ); + sal_Int32 nIndex = getAccessibleIndexInParent(); + Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount()); + long nX = aGridRect.Left() + aCellRect.Left(); + long nY = aGridRect.Top() + aCellRect.Top(); + Rectangle aCell( Point( nX, nY ), aCellRect.GetSize()); + return aCell; } // ----------------------------------------------------------------------------- Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( NULL ); + sal_Int32 nIndex = getAccessibleIndexInParent(); + Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount()); + long nX = aGridRect.Left() + aCellRect.Left(); + long nY = aGridRect.Top() + aCellRect.Top(); + Rectangle aCell( Point( nX, nY ), aCellRect.GetSize()); + return aCell; } } diff --git a/automation/source/simplecm/simplecm.cxx b/automation/source/simplecm/simplecm.cxx index 74a86f343677..55dc26665bfc 100644 --- a/automation/source/simplecm/simplecm.cxx +++ b/automation/source/simplecm/simplecm.cxx @@ -41,7 +41,7 @@ #include <stdio.h> void debug_printf( const char *chars ) { - static BOOL bPrint = (getenv("DEBUG") != NULL); + static sal_Bool bPrint = (getenv("DEBUG") != NULL); if ( bPrint ) { printf( chars ); diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx index 49a6d9695fbc..daf64d80ed25 100644 --- a/avmedia/source/gstreamer/gstframegrabber.cxx +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -45,12 +45,18 @@ const gulong GRAB_TIMEOUT = 10000000; // ---------------- FrameGrabber::FrameGrabber( GString* pURI ) : - Player( pURI ), mpFrameMutex( g_mutex_new() ), mpFrameCond( g_cond_new() ), mpLastPixbuf( NULL ), mbIsInGrabMode( false ) { + if( pURI ) + { + OSL_TRACE( ">>> --------------------------------" ); + OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str ); + + mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL ); + } } // ------------------------------------------------------------------------------ diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx index 9a7ec1b74102..fac2e298fb2c 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -34,6 +34,7 @@ #ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ #include "com/sun/star/media/XFrameGrabber.hdl" #endif +#include <cppuhelper/implbase1.hxx> namespace avmedia { namespace gst { @@ -41,9 +42,8 @@ namespace avmedia { namespace gst { // - FrameGrabber - // ---------------- -class FrameGrabber : public Player, - public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber, - ::com::sun::star::lang::XServiceInfo > +class FrameGrabber : + public ::cppu::ImplInheritanceHelper1 < Player,::com::sun::star::media::XFrameGrabber > { public: diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 614ff80ce352..a056b14b2b99 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -156,6 +156,7 @@ lcl_implHandleCreateWindowFunc( GstBus* pBus, GstMessage* pMsg, gpointer pData ) // - Player - // --------------- Player::Player( GString* pURI ) : + Player_BASE(m_aMutex), mpMutex( g_mutex_new() ), mpCond( g_cond_new() ), mpThread( NULL ), @@ -274,6 +275,7 @@ Player* Player::create( const ::rtl::OUString& rURL ) void SAL_CALL Player::start() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && !isPlaying() ) { gst_element_set_state( mpPlayer, GST_STATE_PLAYING ); @@ -284,6 +286,7 @@ void SAL_CALL Player::start() void SAL_CALL Player::stop() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && isPlaying() ) { gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); @@ -295,7 +298,7 @@ sal_Bool SAL_CALL Player::isPlaying() throw( uno::RuntimeException ) { GstState aState = GST_STATE_NULL; - + ::osl::MutexGuard aGuard(m_aMutex); if( mpPlayer ) { gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ); @@ -308,6 +311,7 @@ sal_Bool SAL_CALL Player::isPlaying() double SAL_CALL Player::getDuration() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); gint64 nDuration = 0; if( implInitPlayer() ) @@ -329,6 +333,7 @@ double SAL_CALL Player::getDuration() void SAL_CALL Player::setMediaTime( double fTime ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() ); @@ -344,7 +349,7 @@ double SAL_CALL Player::getMediaTime() throw( uno::RuntimeException ) { double fRet = 0.0; - + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { GstFormat aFormat = GST_FORMAT_TIME; @@ -384,7 +389,7 @@ double SAL_CALL Player::getStopTime() Currently no need for implementation since higher levels of code don't set a stop time ATM !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time */ - + ::osl::MutexGuard aGuard(m_aMutex); return( getDuration() ); } @@ -415,6 +420,7 @@ double SAL_CALL Player::getRate() void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if (bSet) { g_atomic_int_compare_and_exchange(&mnLooping, 0, 1); @@ -429,6 +435,7 @@ void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) sal_Bool SAL_CALL Player::isPlaybackLoop() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); return( g_atomic_int_get( &mnLooping ) > 0 ); } @@ -436,6 +443,7 @@ sal_Bool SAL_CALL Player::isPlaybackLoop() void SAL_CALL Player::setMute( sal_Bool bSet ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && ( bSet != isMute() ) ) { if( bSet ) @@ -454,6 +462,7 @@ sal_Bool SAL_CALL Player::isMute() throw( uno::RuntimeException ) { gdouble fGstVolume = 1.0; + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { @@ -467,6 +476,7 @@ sal_Bool SAL_CALL Player::isMute() void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() ) { g_mutex_lock( mpMutex ); @@ -485,6 +495,7 @@ void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) sal_Int16 SAL_CALL Player::getVolumeDB() throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) ); } @@ -493,6 +504,7 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() throw( uno::RuntimeException ) { awt::Size aSize( 0, 0 ); + ::osl::MutexGuard aGuard(m_aMutex); if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) ) { @@ -517,6 +529,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments ) throw( uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); uno::Reference< ::media::XPlayerWindow > xRet; awt::Size aSize( getPreferredPlayerWindowSize() ); @@ -560,6 +573,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() throw( ::com::sun::star::uno::RuntimeException ) { + ::osl::MutexGuard aGuard(m_aMutex); FrameGrabber* pFrameGrabber = NULL; const awt::Size aPrefSize( getPreferredPlayerWindowSize() ); @@ -572,9 +586,9 @@ uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() } // ------------------------------------------------------------------------------ -void SAL_CALL Player::dispose() - throw( uno::RuntimeException ) +void SAL_CALL Player::disposing() { + ::osl::MutexGuard aGuard(m_aMutex); if( mpPlayer ) { stop(); @@ -585,16 +599,6 @@ void SAL_CALL Player::dispose() } // ------------------------------------------------------------------------------ -void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} - -// ------------------------------------------------------------------------------ -void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ ) - throw( uno::RuntimeException ) -{} - -// ------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL Player::getImplementationName() throw( uno::RuntimeException ) { diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index 0793eaf8caf2..2127e87a93ec 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -46,6 +46,8 @@ typedef struct _GOptionGroup GOptionGroup; #include <gst/gst.h> #include "com/sun/star/media/XPlayer.hdl" +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/basemutex.hxx> namespace avmedia { @@ -56,10 +58,11 @@ class Window; // --------------- // - Player_Impl - // --------------- +typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XServiceInfo > Player_BASE; -class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer, - ::com::sun::star::lang::XComponent, - ::com::sun::star::lang::XServiceInfo > +class Player : public cppu::BaseMutex, + public Player_BASE { public: @@ -67,7 +70,7 @@ public: static Player* create( const ::rtl::OUString& rURL ); ~Player(); - +//protected: // XPlayer virtual void SAL_CALL start() throw( ::com::sun::star::uno::RuntimeException ); @@ -127,18 +130,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber() throw( ::com::sun::star::uno::RuntimeException ); - // XComponent - virtual void SAL_CALL dispose() - throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL addEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removeEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) - throw( ::com::sun::star::uno::RuntimeException ); - // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); @@ -150,6 +141,7 @@ public: throw( ::com::sun::star::uno::RuntimeException ); // these are public because the C callbacks call them + virtual gboolean busCallback( GstBus* pBus, GstMessage* pMsg ); @@ -162,6 +154,9 @@ public: protected: + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + Player( GString* pURI = NULL ); void implQuitThread(); @@ -173,6 +168,7 @@ protected: return( g_atomic_int_get( &mnInitialized ) > 0 ); } + static gpointer implThreadFunc( gpointer pData ); private: diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx index 12606ad5e88b..417525c1946e 100644 --- a/avmedia/source/gstreamer/gstwindow.cxx +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -271,7 +271,7 @@ value in sequence of arguments" ); if( pParentWindow ) { - meZoomLevel = media::ZoomLevel_ORIGINAL; + meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW; mpPlayerWindow = new PlayerChildWindow( pParentWindow ); mpPlayerWindow->SetBackground( Color( COL_BLACK ) ); diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 94a6c36ed064..cd9ac849132a 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -207,17 +207,11 @@ void MediaWindowBaseImpl::setPlayerWindow( const uno::Reference< media::XPlayerW void MediaWindowBaseImpl::cleanUp() { - if( mxPlayer.is() ) - { - mxPlayer->stop(); - - uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY ); + if( xComponent.is() ) // this stops the player + xComponent->dispose(); - if( xComponent.is() ) - xComponent->dispose(); - - mxPlayer.clear(); - } + mxPlayer.clear(); mpMediaWindow = NULL; } diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx index d27b2b55ff93..56efbe6b107b 100644 --- a/avmedia/source/win/player.cxx +++ b/avmedia/source/win/player.cxx @@ -52,6 +52,30 @@ using namespace ::com::sun::star; namespace avmedia { namespace win { +LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) +{ + Player* pPlayer = (Player*) ::GetWindowLong( hWnd, 0 ); + bool bProcessed = true; + + if( pPlayer ) + { + switch( nMsg ) + { + case( WM_GRAPHNOTIFY ): + pPlayer->processEvent(); + break; + default: + bProcessed = false; + break; + } + } + else + bProcessed = false; + + return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) ); +} + + bool isWindowsVistaOrHigher() { // POST: return true if we are at least on Windows Vista @@ -59,10 +83,7 @@ bool isWindowsVistaOrHigher() ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); - if ( osvi.dwMajorVersion >= 6 ) - return true; - - return false; + return osvi.dwMajorVersion >= 6; } // ---------------- @@ -70,6 +91,7 @@ bool isWindowsVistaOrHigher() // ---------------- Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + Player_BASE(m_aMutex), mxMgr( rxMgr ), mpGB( NULL ), mpOMF( NULL ), @@ -82,8 +104,10 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : mpVW( NULL ), mpEV( NULL ), mnUnmutedVolume( 0 ), + mnFrameWnd( 0 ), mbMuted( false ), - mbLooping( false ) + mbLooping( false ), + mbAddWindow(sal_True) { ::CoInitialize( NULL ); } @@ -92,6 +116,18 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : Player::~Player() { + if( mnFrameWnd ) + ::DestroyWindow( (HWND) mnFrameWnd ); + + ::CoUninitialize(); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + stop(); if( mpBA ) mpBA->Release(); @@ -108,7 +144,11 @@ Player::~Player() mpMS->Release(); if( mpME ) + { + mpME->SetNotifyWindow( 0, WM_GRAPHNOTIFY, 0); mpME->Release(); + } + if( mpMC ) mpMC->Release(); @@ -121,12 +161,8 @@ Player::~Player() if( mpGB ) mpGB->Release(); - - ::CoUninitialize(); } - // ------------------------------------------------------------------------------ - bool Player::create( const ::rtl::OUString& rURL ) { HRESULT hR; @@ -137,15 +173,12 @@ bool Player::create( const ::rtl::OUString& rURL ) // Don't use the overlay mixer on Windows Vista // It disables the desktop composition as soon as RenderFile is called // also causes some other problems: video rendering is not reliable - if( !isWindowsVistaOrHigher() ) + if( !isWindowsVistaOrHigher() && SUCCEEDED( CoCreateInstance( CLSID_OverlayMixer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**) &mpOMF ) ) ) { - if( SUCCEEDED( CoCreateInstance( CLSID_OverlayMixer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**) &mpOMF ) ) ) - { - mpGB->AddFilter( mpOMF, L"com_sun_star_media_OverlayMixerFilter" ); + mpGB->AddFilter( mpOMF, L"com_sun_star_media_OverlayMixerFilter" ); - if( !SUCCEEDED( mpOMF->QueryInterface( IID_IDDrawExclModeVideo, (void**) &mpEV ) ) ) - mpEV = NULL; - } + if( !SUCCEEDED( mpOMF->QueryInterface( IID_IDDrawExclModeVideo, (void**) &mpEV ) ) ) + mpEV = NULL; } if( SUCCEEDED( hR = mpGB->RenderFile( reinterpret_cast<LPCWSTR>(rURL.getStr()), NULL ) ) && @@ -187,6 +220,7 @@ const IVideoWindow* Player::getVideoWindow() const void Player::setNotifyWnd( int nNotifyWnd ) { + mbAddWindow = sal_False; if( mpME ) mpME->SetNotifyWindow( (OAHWND) nNotifyWnd, WM_GRAPHNOTIFY, reinterpret_cast< LONG_PTR>( this ) ); } @@ -208,7 +242,7 @@ long Player::processEvent() { long nCode, nParam1, nParam2; - if( mpME && SUCCEEDED( mpME->GetEvent( &nCode, &nParam1, &nParam2, 0 ) ) ) + while( mpME && SUCCEEDED( mpME->GetEvent( &nCode, &nParam1, &nParam2, 0 ) ) ) { if( EC_COMPLETE == nCode ) { @@ -235,8 +269,44 @@ long Player::processEvent() void SAL_CALL Player::start( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); if( mpMC ) + { + if ( mbAddWindow ) + { + static WNDCLASS* mpWndClass = NULL; + if ( !mpWndClass ) + { + mpWndClass = new WNDCLASS; + + memset( mpWndClass, 0, sizeof( *mpWndClass ) ); + mpWndClass->hInstance = GetModuleHandle( NULL ); + mpWndClass->cbWndExtra = sizeof( DWORD ); + mpWndClass->lpfnWndProc = MediaPlayerWndProc_2; + mpWndClass->lpszClassName = "com_sun_star_media_Sound_Player"; + mpWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH ); + mpWndClass->hCursor = ::LoadCursor( NULL, IDC_ARROW ); + + ::RegisterClass( mpWndClass ); + } + if ( !mnFrameWnd ) + { + mnFrameWnd = (int) ::CreateWindow( mpWndClass->lpszClassName, NULL, + 0, + 0, 0, 0, 0, + (HWND) NULL, NULL, mpWndClass->hInstance, 0 ); + if ( mnFrameWnd ) + { + ::ShowWindow((HWND) mnFrameWnd, SW_HIDE); + ::SetWindowLong( (HWND) mnFrameWnd, 0, (DWORD) this ); + // mpVW->put_Owner( (OAHWND) mnFrameWnd ); + setNotifyWnd( mnFrameWnd ); + } + } + } + mpMC->Run(); + } } // ------------------------------------------------------------------------------ @@ -244,6 +314,8 @@ void SAL_CALL Player::start( ) void SAL_CALL Player::stop( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + if( mpMC ) mpMC->Stop(); } @@ -253,6 +325,8 @@ void SAL_CALL Player::stop( ) sal_Bool SAL_CALL Player::isPlaying() throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + OAFilterState eFilterState; bool bRet = false; @@ -267,6 +341,8 @@ sal_Bool SAL_CALL Player::isPlaying() double SAL_CALL Player::getDuration( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + REFTIME aRefTime( 0.0 ); if( mpMP ) @@ -280,6 +356,8 @@ double SAL_CALL Player::getDuration( ) void SAL_CALL Player::setMediaTime( double fTime ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + if( mpMP ) { const bool bPlaying = isPlaying(); @@ -296,6 +374,8 @@ void SAL_CALL Player::setMediaTime( double fTime ) double SAL_CALL Player::getMediaTime( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + REFTIME aRefTime( 0.0 ); if( mpMP ) @@ -309,6 +389,8 @@ double SAL_CALL Player::getMediaTime( ) void SAL_CALL Player::setStopTime( double fTime ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + if( mpMP ) mpMP->put_StopTime( fTime ); } @@ -318,6 +400,8 @@ void SAL_CALL Player::setStopTime( double fTime ) double SAL_CALL Player::getStopTime( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + REFTIME aRefTime( 0.0 ); if( mpMP ) @@ -331,6 +415,8 @@ double SAL_CALL Player::getStopTime( ) void SAL_CALL Player::setRate( double fRate ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + if( mpMP ) mpMP->put_Rate( fRate ); } @@ -340,6 +426,8 @@ void SAL_CALL Player::setRate( double fRate ) double SAL_CALL Player::getRate( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + double fRet( 0.0 ); if( mpMP ) @@ -353,6 +441,8 @@ double SAL_CALL Player::getRate( ) void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + mbLooping = bSet; } @@ -361,6 +451,8 @@ void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) sal_Bool SAL_CALL Player::isPlaybackLoop( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + return mbLooping; } @@ -369,6 +461,8 @@ sal_Bool SAL_CALL Player::isPlaybackLoop( ) void SAL_CALL Player::setMute( sal_Bool bSet ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + if( mpBA && ( mbMuted != bSet ) ) { mbMuted = bSet; @@ -381,6 +475,8 @@ void SAL_CALL Player::setMute( sal_Bool bSet ) sal_Bool SAL_CALL Player::isMute( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + return mbMuted; } @@ -389,6 +485,8 @@ sal_Bool SAL_CALL Player::isMute( ) void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + mnUnmutedVolume = static_cast< long >( nVolumeDB ) * 100; if( !mbMuted && mpBA ) @@ -400,6 +498,8 @@ void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) sal_Int16 SAL_CALL Player::getVolumeDB( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + return( static_cast< sal_Int16 >( mnUnmutedVolume / 100 ) ); } @@ -408,6 +508,8 @@ sal_Int16 SAL_CALL Player::getVolumeDB( ) awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + awt::Size aSize( 0, 0 ); if( mpBV ) @@ -427,6 +529,8 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + uno::Reference< ::media::XPlayerWindow > xRet; awt::Size aSize( getPreferredPlayerWindowSize() ); @@ -448,6 +552,8 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( ) throw (uno::RuntimeException) { + ::osl::MutexGuard aGuard(m_aMutex); + uno::Reference< media::XFrameGrabber > xRet; if( maURL.getLength() > 0 ) diff --git a/avmedia/source/win/player.hxx b/avmedia/source/win/player.hxx index 34a567750b74..eee9b52ee94b 100644 --- a/avmedia/source/win/player.hxx +++ b/avmedia/source/win/player.hxx @@ -30,9 +30,10 @@ #include "wincommon.hxx" -#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ #include "com/sun/star/media/XPlayer.hdl" -#endif + +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/basemutex.hxx> struct IGraphBuilder; struct IBaseFilter; @@ -52,9 +53,11 @@ namespace avmedia { namespace win { // ---------- // - Player - // ---------- +typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XServiceInfo > Player_BASE; -class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer, - ::com::sun::star::lang::XServiceInfo > +class Player : public cppu::BaseMutex, + public Player_BASE { public: @@ -95,6 +98,9 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; @@ -111,8 +117,11 @@ private: IVideoWindow* mpVW; IDDrawExclModeVideo* mpEV; long mnUnmutedVolume; + int mnFrameWnd; + sal_Bool mbMuted; sal_Bool mbLooping; + sal_Bool mbAddWindow; void ImplLayoutVideoWindow(); }; diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index 1170505b440b..8d4aeb73a65c 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -179,7 +179,25 @@ LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM n // - Window - // --------------- -WNDCLASS* Window::mpWndClass = NULL; +WNDCLASS* lcl_getWndClass() +{ + static WNDCLASS* s_pWndClass = NULL; + if ( !s_pWndClass ) + { + s_pWndClass = new WNDCLASS; + + memset( s_pWndClass, 0, sizeof( *s_pWndClass ) ); + s_pWndClass->hInstance = GetModuleHandle( NULL ); + s_pWndClass->cbWndExtra = sizeof( DWORD ); + s_pWndClass->lpfnWndProc = MediaPlayerWndProc; + s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd"; + s_pWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH ); + s_pWndClass->hCursor = ::LoadCursor( NULL, IDC_ARROW ); + + ::RegisterClass( s_pWndClass ); + } + return s_pWndClass; +} // ------------------------------------------------------------------------------ @@ -194,20 +212,7 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Playe { ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); - if( !mpWndClass ) - { - mpWndClass = new WNDCLASS; - - memset( mpWndClass, 0, sizeof( *mpWndClass ) ); - mpWndClass->hInstance = GetModuleHandle( NULL ); - mpWndClass->cbWndExtra = sizeof( DWORD ); - mpWndClass->lpfnWndProc = MediaPlayerWndProc; - mpWndClass->lpszClassName = "com_sun_star_media_PlayerWnd"; - mpWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH ); - mpWndClass->hCursor = ::LoadCursor( NULL, IDC_ARROW ); - - ::RegisterClass( mpWndClass ); - } + lcl_getWndClass(); } // ------------------------------------------------------------------------------ @@ -310,6 +315,8 @@ void Window::ImplLayoutVideoWindow() bool Window::create( const uno::Sequence< uno::Any >& rArguments ) { IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() ); + WNDCLASS* mpWndClass = lcl_getWndClass(); + if( !mnFrameWnd && pVideoWindow && mpWndClass ) { @@ -374,7 +381,7 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments ) mrPlayer.setNotifyWnd( mnFrameWnd ); - meZoomLevel = media::ZoomLevel_ORIGINAL; + meZoomLevel = media::ZoomLevel_FIT_TO_WINDOW; ImplLayoutVideoWindow(); #ifdef DDRAW_TEST_OUTPUT } diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx index 36cff49a742a..3605ba970f7a 100644 --- a/avmedia/source/win/window.hxx +++ b/avmedia/source/win/window.hxx @@ -114,8 +114,6 @@ private: int mnParentWnd; int mnPointerType; - static WNDCLASS* mpWndClass; - void ImplLayoutVideoWindow(); }; diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index e7687222d5da..2878d736e493 100644 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -108,7 +108,7 @@ void BreakpointWindow::SetBPsInModule() { pModule->SetBP( (sal_uInt16)pBrk->nLine ); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); + DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (sal_uInt16)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ); #endif pBrk = Next(); } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 24b031e8f4e9..a9e378d69d9d 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1017,8 +1017,22 @@ sal_Bool SbModule::IsVBACompat() const void SbModule::SetVBACompat( sal_Bool bCompat ) { - mbVBACompat = bCompat; + if( mbVBACompat != bCompat ) + { + mbVBACompat = bCompat; + // initialize VBA document API + if( mbVBACompat ) try + { + StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() ); + uno::Reference< lang::XMultiServiceFactory > xFactory( getDocumentModel( pBasic ), uno::UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + } + } } + // Ausfuehren eines BASIC-Unterprogramms sal_uInt16 SbModule::Run( SbMethod* pMeth ) { diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx index a86174daf08e..d01363e6656a 100755..100644 --- a/comphelper/source/misc/anycompare.cxx +++ b/comphelper/source/misc/anycompare.cxx @@ -29,6 +29,9 @@ #include "comphelper/anycompare.hxx" /** === begin UNO includes === **/ +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/DateTime.hpp> /** === end UNO includes === **/ //...................................................................................................................... @@ -63,9 +66,128 @@ namespace comphelper using ::com::sun::star::uno::TypeClass_TYPE; using ::com::sun::star::uno::TypeClass_ENUM; using ::com::sun::star::uno::TypeClass_INTERFACE; + using ::com::sun::star::uno::TypeClass_STRUCT; using ::com::sun::star::i18n::XCollator; + using ::com::sun::star::util::Date; + using ::com::sun::star::util::Time; + using ::com::sun::star::util::DateTime; /** === end UNO using === **/ + //================================================================================================================== + //= DatePredicateLess + //================================================================================================================== + class DatePredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + Date lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + + if ( lhs.Year < rhs.Year ) + return true; + if ( lhs.Year > rhs.Year ) + return false; + + if ( lhs.Month < rhs.Month ) + return true; + if ( lhs.Month > rhs.Month ) + return false; + + if ( lhs.Day < rhs.Day ) + return true; + return false; + } + }; + + //================================================================================================================== + //= TimePredicateLess + //================================================================================================================== + class TimePredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + Time lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + + if ( lhs.Hours < rhs.Hours ) + return true; + if ( lhs.Hours > rhs.Hours ) + return false; + + if ( lhs.Minutes < rhs.Minutes ) + return true; + if ( lhs.Minutes > rhs.Minutes ) + return false; + + if ( lhs.Seconds < rhs.Seconds ) + return true; + if ( lhs.Seconds > rhs.Seconds ) + return false; + + if ( lhs.HundredthSeconds < rhs.HundredthSeconds ) + return true; + return false; + } + }; + + //================================================================================================================== + //= DateTimePredicateLess + //================================================================================================================== + class DateTimePredicateLess : public IKeyPredicateLess + { + public: + virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const + { + DateTime lhs, rhs; + if ( !( _lhs >>= lhs ) + || !( _rhs >>= rhs ) + ) + throw ::com::sun::star::lang::IllegalArgumentException(); + + if ( lhs.Year < rhs.Year ) + return true; + if ( lhs.Year > rhs.Year ) + return false; + + if ( lhs.Month < rhs.Month ) + return true; + if ( lhs.Month > rhs.Month ) + return false; + + if ( lhs.Day < rhs.Day ) + return true; + if ( lhs.Day > rhs.Day ) + return false; + + if ( lhs.Hours < rhs.Hours ) + return true; + if ( lhs.Hours > rhs.Hours ) + return false; + + if ( lhs.Minutes < rhs.Minutes ) + return true; + if ( lhs.Minutes > rhs.Minutes ) + return false; + + if ( lhs.Seconds < rhs.Seconds ) + return true; + if ( lhs.Seconds > rhs.Seconds ) + return false; + + if ( lhs.HundredthSeconds < rhs.HundredthSeconds ) + return true; + return false; + } + }; + //------------------------------------------------------------------------------------------------------------------ ::std::auto_ptr< IKeyPredicateLess > getStandardLessPredicate( Type const & i_type, Reference< XCollator > const & i_collator ) { @@ -120,6 +242,14 @@ namespace comphelper case TypeClass_INTERFACE: pComparator.reset( new InterfacePredicateLess() ); break; + case TypeClass_STRUCT: + if ( i_type.equals( ::cppu::UnoType< Date >::get() ) ) + pComparator.reset( new DatePredicateLess() ); + else if ( i_type.equals( ::cppu::UnoType< Time >::get() ) ) + pComparator.reset( new TimePredicateLess() ); + else if ( i_type.equals( ::cppu::UnoType< DateTime >::get() ) ) + pComparator.reset( new DateTimePredicateLess() ); + break; default: break; } diff --git a/configure.in b/configure.in index 10dcbb3cba17..444ce8710fdc 100644 --- a/configure.in +++ b/configure.in @@ -6717,6 +6717,8 @@ fi AC_SUBST(USE_XINERAMA) AC_SUBST(XINERAMA_LINK) +if test "$ENABLE_LIBRSVG" = "TRUE" +then dnl =================================================================== dnl Test whether to build librsvg or rely on the system version dnl =================================================================== @@ -6859,6 +6861,22 @@ case "$_os" in ;; esac AC_SUBST(SYSTEM_LIBGSF) +else + SYSTEM_LIBGSF=YES + AC_SUBST(SYSTEM_LIBGSF) + SYSTEM_LIBRSVG=YES + AC_SUBST(SYSTEM_LIBRSVG) + SYSTEM_GDKPIXBUF=YES + AC_SUBST(SYSTEM_GDKPIXBUF) + SYSTEM_GLIB=YES + AC_SUBST(SYSTEM_GLIB) + SYSTEM_GETTEXT=YES + AC_SUBST(SYSTEM_GETTEXT) + SYSTEM_LIBCROCO=YES + AC_SUBST(SYSTEM_LIBCROCO) + SYSTEM_PANGO=YES + AC_SUBST(SYSTEM_PANGO) +fi dnl =================================================================== dnl Test whether to build libpng or rely on the system version diff --git a/curl/makefile.mk b/curl/makefile.mk index cb6ac50dc705..de550333cd33 100644 --- a/curl/makefile.mk +++ b/curl/makefile.mk @@ -100,7 +100,7 @@ CONFIGURE_FLAGS= --without-ssl --enable-ftp --enable-ipv6 --disable-http --disab BUILD_DIR=$(CONFIGURE_DIR)$/lib BUILD_ACTION=make OUT2BIN=$(BUILD_DIR)$/.libs$/libcurl*.dll -OUT2LIB=$(BUILD_DIR)$/.libs$/libcurl*.a +OUT2LIB=$(BUILD_DIR)$/.libs$/libcurl*.dll.a .ELSE # make use of stlport headerfiles EXT_USE_STLPORT=TRUE diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java index 1facca3d8497..0da7775e7c30 100755 --- a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java @@ -59,6 +59,7 @@ public class CopyTableWizard extends CRMBasedTestCase { private DatabaseApplication source; + private DbaseDatabase destinationDB = null; private DatabaseApplication dest; public CopyTableWizard() @@ -73,6 +74,9 @@ public class CopyTableWizard extends CRMBasedTestCase public void after() { dest.store(); + if ( destinationDB != null ) + destinationDB.close(); + destinationDB = null; super.after(); } @@ -83,8 +87,9 @@ public class CopyTableWizard extends CRMBasedTestCase try { createTestCase(); - source = new DatabaseApplication(this.m_database.getDatabase()); - dest = new DatabaseApplication(new DbaseDatabase(getMSF())); + source = new DatabaseApplication(m_database.getDatabase()); + destinationDB = new DbaseDatabase( getMSF() ); + dest = new DatabaseApplication( destinationDB ); } catch (java.lang.Exception ex) { diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 8e7c75418875..e5b8a13fb149 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2191,12 +2191,13 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce { if( !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent)) { - Reference<XNameAccess> xChild(_xNameAccess->getByName(*pIter),UNO_QUERY); DBTreeListUserData* pEntryData = new DBTreeListUserData; pEntryData->eType = _eEntryType; - if ( _eEntryType == etQuery && xChild.is() ) + if ( _eEntryType == etQuery ) { - pEntryData->eType = etQueryContainer; + Reference<XNameAccess> xChild(_xNameAccess->getByName(*pIter),UNO_QUERY); + if ( xChild.is() ) + pEntryData->eType = etQueryContainer; } implAppendEntry( _pParent, *pIter, pEntryData, pEntryData->eType ); } diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index a08f718e4283..3ed8d135ffbd 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -408,7 +408,9 @@ namespace drawinglayer } catch(const uno::Exception&) { - DBG_UNHANDLED_EXCEPTION(); + // #i116763# removing since there is a good alternative when the xControlView + // is not found and it is allowed to happen + // DBG_UNHANDLED_EXCEPTION(); // process recursively and use the decomposition as Bitmap process(rCandidate.get2DDecomposition(getViewInformation2D())); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 352fb8ace115..b9e00cf89008 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2948,6 +2948,27 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // Ueber die Portions der Zeile... // -------------------------------------------------- nIndex = pLine->GetStart(); + + // #i108052# When stripping a callback for empty paragraphs is needed. This + // was somehow lost/removed/killed by making the TextPortions with empty + // paragraph to type PORTIONKIND_TAB instead of PORTIONKIND_TEXT. Adding here + // since I could not find out who and why this has changed. + if(bStripOnly && pLine->GetStartPortion() == pLine->GetEndPortion()) + { + const Color aOverlineColor(pOutDev->GetOverlineColor()); + const Color aTextLineColor(pOutDev->GetTextLineColor()); + + GetEditEnginePtr()->DrawingText( + aTmpPos, String(), 0, 0, 0, + aTmpFont, n, nIndex, 0, + 0, + 0, + false, true, false, // support for EOL/EOP TEXT comments + 0, + aOverlineColor, + aTextLineColor); + } + for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ ) { DBG_ASSERT( pPortion->GetTextPortions().Count(), "Zeile ohne Textportion im Paint!" ); diff --git a/extras/source/palettes/standard.soc b/extras/source/palettes/standard.soc index 83cffa5d8edd..1bc29d09ebfd 100644 --- a/extras/source/palettes/standard.soc +++ b/extras/source/palettes/standard.soc @@ -49,7 +49,7 @@ <draw:color draw:name="Blue 6" draw:color="#0099ff"/> <draw:color draw:name="Blue 7" draw:color="#00b8ff"/> <draw:color draw:name="Blue 8" draw:color="#99ccff"/> - <draw:color draw:name="Blue 9" draw:color="#CFE7E5"/> + <draw:color draw:name="Blue 9" draw:color="#CFE7F5"/> <draw:color draw:name="Turquoise 1" draw:color="#00dcff"/> <draw:color draw:name="Turquoise 2" draw:color="#00cccc"/> <draw:color draw:name="Turquoise 3" draw:color="#23b8dc"/> diff --git a/forms/qa/integration/forms/XMLFormSettings.java b/forms/qa/integration/forms/XMLFormSettings.java index e3881bfa861d..d7c98fdf17ce 100644 --- a/forms/qa/integration/forms/XMLFormSettings.java +++ b/forms/qa/integration/forms/XMLFormSettings.java @@ -85,17 +85,14 @@ public class XMLFormSettings extends complexlib.ComplexTestCase // create a simple structure in the DOM tree: an element with two attributes String[] modelNames = m_document.getXFormModelNames(); m_defaultModel = m_document.getXFormModel( modelNames[0] ); - Instance defaultInstance = m_defaultModel.getDefaultInstance(); + final Instance defaultInstance = m_defaultModel.getDefaultInstance(); + // remove the default root node + defaultInstance.removeNode( "instanceData" ); + // create test structures XNode stringElement = defaultInstance.createElement( "stringElement" ); XNode booleanAttrib = defaultInstance.createAttribute( stringElement, "booleanAttribute", "true" ); XNode dateAttrib = defaultInstance.createAttribute( stringElement, "dateAttribute" ); - // when it comes to saving and loading, only one child of the root element of the instance - // is handled (is this a bug? see xmloff/source/xforms/XFormsInstanceContext.cxx, method - // CreateChildContext). - // So, we remove the default node of the instance which it has all the time - defaultInstance.removeNode( "instanceData" ); - assure( "booleanAttrib's parent is wrong", UnoRuntime.areSame( stringElement, booleanAttrib.getParentNode() ) ); assure( "dateAttrib's parent is wrong", diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java index 5e4e04741995..954ca6157f83 100644 --- a/forms/qa/org/openoffice/xforms/Instance.java +++ b/forms/qa/org/openoffice/xforms/Instance.java @@ -43,23 +43,6 @@ public class Instance /** creates a new element in the instance * - * The element will be inserted immediately below the root node of the instance. - * - * @param _elementName - * the name of the to-be-created element - * @param _initialNodeValue - * the initial value to set at the node. Might be null, in this case no value is set. - * @return - * the node of the newly created element - * @throws com.sun.star.xml.dom.DOMException - */ - public XNode createElement( String _elementName, String _initialNodeValue ) throws DOMException - { - return createElement( m_domInstance, _elementName, _initialNodeValue ); - } - - /** creates a new element in the instance - * * The element will be inserted immediately below a given XNode. * * @param _parentElement diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx index 85cf066d6343..63ef50cdc454 100644 --- a/forms/source/xforms/submission/serialization_app_xml.cxx +++ b/forms/source/xforms/submission/serialization_app_xml.cxx @@ -31,91 +31,117 @@ #include "serialization.hxx" #include "serialization_app_xml.hxx" -#include <unotools/processfactory.hxx> +/** === begin UNO includes === **/ #include <com/sun/star/xml/dom/XNode.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/dom/XNodeList.hpp> #include <com/sun/star/xml/dom/NodeType.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/xml/xpath/XPathObjectType.hpp> +#include <com/sun/star/xml/sax/XSAXSerializable.hpp> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +/** === end UNO includes === **/ -#include <libxml/tree.h> +#include <tools/diagnose_ex.h> +#include <comphelper/processfactory.hxx> + +#include <boost/scoped_ptr.hpp> +#include <limits> + +/** === begin UNO using === **/ +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::RuntimeException; +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::xml::dom::XNode; +using ::com::sun::star::xml::dom::XDocument; +using ::com::sun::star::xml::sax::XSAXSerializable; +using ::com::sun::star::beans::StringPair; +using ::com::sun::star::io::XActiveDataSource; +using ::com::sun::star::xml::dom::NodeType_DOCUMENT_NODE; +using ::com::sun::star::xml::dom::NodeType_ELEMENT_NODE; +using ::com::sun::star::xml::dom::XDocumentBuilder; +using ::com::sun::star::xml::sax::XDocumentHandler; +/** === end UNO using === **/ CSerializationAppXML::CSerializationAppXML() - : m_aFactory(utl::getProcessServiceFactory()) - , m_aPipe(CSS::uno::Reference< CSS::io::XOutputStream > (m_aFactory->createInstance( - rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), CSS::uno::UNO_QUERY)) + :m_aContext( ::comphelper::getProcessServiceFactory() ) { - OSL_ENSURE(m_aPipe.is(), "cannot create Pipe"); + m_aContext.createComponent( "com.sun.star.io.Pipe", m_xBuffer ); } -CSS::uno::Reference< CSS::io::XInputStream > +Reference< CSS::io::XInputStream > CSerializationAppXML::getInputStream() { // The pipes output is provided through it's // XOutputStream interface aspect - return CSS::uno::Reference< CSS::io::XInputStream >(m_aPipe, CSS::uno::UNO_QUERY); + return Reference< CSS::io::XInputStream >(m_xBuffer, UNO_QUERY); } void -CSerializationAppXML::serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& rNode) +CSerializationAppXML::serialize_node(const Reference< XNode >& rNode) { - CSS::uno::Reference< CSS::xml::dom::XNode > aNode = rNode; - if (aNode->getNodeType() == CSS::xml::dom::NodeType_DOCUMENT_NODE) + try { - CSS::uno::Reference< CSS::xml::dom::XDocument > aDoc(rNode, CSS::uno::UNO_QUERY_THROW); - aNode = CSS::uno::Reference< CSS::xml::dom::XNode >(aDoc->getDocumentElement(), CSS::uno::UNO_QUERY_THROW); - } - if (aNode->getNodeType() != CSS::xml::dom::NodeType_ELEMENT_NODE) - return; + Reference< XSAXSerializable > xSerializer( rNode, UNO_QUERY ); + if ( !xSerializer.is() ) + { + // ensure we have a "real" node + Reference< XNode > xNode = rNode; + if ( xNode->getNodeType() == NodeType_DOCUMENT_NODE ) + { + Reference< XDocument > const xDoc( xNode, UNO_QUERY_THROW ); + xNode.set( xDoc->getDocumentElement(), UNO_QUERY_THROW ); + } + ENSURE_OR_RETURN_VOID( xNode->getNodeType() == NodeType_ELEMENT_NODE, + "CSerializationAppXML::serialize_node: invalid node type!" ); - // clone the node to a new document and serialize that document - CSS::uno::Reference< CSS::lang::XUnoTunnel > aTunnel(aNode, CSS::uno::UNO_QUERY); - if (aTunnel.is()) - { - xmlNodePtr aNodePtr = reinterpret_cast< xmlNodePtr >( aTunnel->getSomething(CSS::uno::Sequence< sal_Int8 >()) ); - xmlDocPtr aDocPtr = xmlNewDoc((xmlChar*)"1.0"); - xmlNodePtr aDocNodePtr = xmlDocCopyNode(aNodePtr, aDocPtr, 1); - if (aDocNodePtr != NULL) { - xmlAddChild((xmlNodePtr)aDocPtr, aDocNodePtr); - xmlChar *buffer = NULL; - sal_Int32 size = 0; - xmlDocDumpMemory(aDocPtr, &buffer, (int*)&size); - - // write the xml into the pipe through it's XOutputStream interface - m_aPipe->writeBytes(CSS::uno::Sequence< sal_Int8 >((sal_Int8*)buffer, size)); - xmlFree(buffer); + // create a new document + Reference< XDocumentBuilder > const xDocBuilder( + m_aContext.createComponent( "com.sun.star.xml.dom.DocumentBuilder" ), UNO_QUERY_THROW ); + Reference< XDocument > const xDocument( xDocBuilder->newDocument(), UNO_SET_THROW ); + + // copy the to-be-serialized node + Reference< XNode > const xImportedNode( xDocument->importNode( xNode, true ), UNO_SET_THROW ); + xDocument->appendChild( xImportedNode ); + + // ask the doc for the serializer + xSerializer.set( xDocument, UNO_QUERY ); } - } else { - // can't get tunnel to native backend - // logic for generic implementation could be implemented here... - OSL_ENSURE(sal_False, "unkown dom implementation, cannot serialize"); - return; - } -} + ENSURE_OR_RETURN_VOID( xSerializer.is(), + "CSerializationAppXML::serialize_node: no serialization access to the node/document!" ); -/* -void -CSerializationAppXML::serialize_nodeset() -{ - CSS::uno::Reference< CSS::xml::dom::XNodeList > aNodeList = m_aXPathObject->getNodeList(); - for (sal_Int32 i=0; i<aNodeList->getLength(); i++) - serialize_node(aNodeList->item(i)); - m_aPipe->closeOutput(); + // create a SAXWriter to take the serialization events, and connect it to our pipe + Reference< XDocumentHandler > const xSaxWriter( + m_aContext.createComponent( "com.sun.star.xml.sax.Writer" ), UNO_QUERY_THROW ); + Reference< XActiveDataSource > const xDataSource( xSaxWriter, UNO_QUERY_THROW ); + xDataSource->setOutputStream( m_xBuffer ); + + // do the serialization + xSerializer->serialize( xSaxWriter, Sequence< StringPair >() ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } -*/ void CSerializationAppXML::serialize() { if (!m_aFragment.is()) return; - CSS::uno::Reference< CSS::xml::dom::XNode > cur = m_aFragment->getFirstChild(); + Reference< XNode > cur = m_aFragment->getFirstChild(); while (cur.is()) { serialize_node(cur); cur = cur->getNextSibling(); } - m_aPipe->closeOutput(); + m_xBuffer->closeOutput(); } diff --git a/forms/source/xforms/submission/serialization_app_xml.hxx b/forms/source/xforms/submission/serialization_app_xml.hxx index 338df6aea083..7380b5834ed1 100644 --- a/forms/source/xforms/submission/serialization_app_xml.hxx +++ b/forms/source/xforms/submission/serialization_app_xml.hxx @@ -33,12 +33,13 @@ #include "serialization.hxx" +#include <comphelper/componentcontext.hxx> class CSerializationAppXML : public CSerialization { private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; - CSS::uno::Reference< CSS::io::XOutputStream > m_aPipe; + ::comphelper::ComponentContext m_aContext; + CSS::uno::Reference< CSS::io::XOutputStream > m_xBuffer; void serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& aNode); void serialize_nodeset(); diff --git a/forms/source/xforms/submission/submission_put.cxx b/forms/source/xforms/submission/submission_put.cxx index 9ed37470ba93..02bd1f485091 100644 --- a/forms/source/xforms/submission/submission_put.cxx +++ b/forms/source/xforms/submission/submission_put.cxx @@ -35,6 +35,7 @@ #include "serialization_urlencoded.hxx" #include <osl/file.hxx> +#include <tools/diagnose_ex.h> #include <unotools/processfactory.hxx> #include <ucbhelper/content.hxx> @@ -58,7 +59,8 @@ CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::uno::Reference< XCommandEnvironment > aEnvironment; auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment)); - try { + try + { ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment); // insert serialized data to content -> PUT @@ -68,10 +70,10 @@ CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< // no content as a result of put... - } catch (Exception&) + } + catch ( const Exception& ) { - // XXX - OSL_ENSURE(sal_False, "Exception during UCB operatration."); + DBG_UNHANDLED_EXCEPTION(); return UNKNOWN_ERROR; } diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 1a33ebf91d7e..1585fb7b1342 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -48,6 +48,7 @@ // includes of other projects #include <unotools/processfactory.hxx> #include <vcl/svapp.hxx> +#include <tools/diagnose_ex.h> //_______________________________________________ // namespace @@ -153,7 +154,7 @@ void FrameListAnalyzer::impl_analyze() // check, if the reference frame includes the backing component. // But look, if this analyze step is realy needed. - if ((m_eDetectMode & E_BACKINGCOMPONENT) == E_BACKINGCOMPONENT) + if (((m_eDetectMode & E_BACKINGCOMPONENT) == E_BACKINGCOMPONENT) && m_xReferenceFrame.is() ) { try { @@ -162,8 +163,13 @@ void FrameListAnalyzer::impl_analyze() ::rtl::OUString sModule = xModuleMgr->identify(m_xReferenceFrame); m_bReferenceIsBacking = (sModule.equals(SERVICENAME_STARTMODULE)); } + catch(const css::frame::UnknownModuleException&) + { + } catch(const css::uno::Exception&) - {} + { + DBG_UNHANDLED_EXCEPTION(); + } } // check, if the reference frame includes the help module. diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx index 891504adbe71..9e3b6c7265e0 100755 --- a/framework/source/fwe/helper/undomanagerhelper.cxx +++ b/framework/source/fwe/helper/undomanagerhelper.cxx @@ -220,6 +220,7 @@ namespace framework bool m_disposed; bool m_bAPIActionRunning; bool m_bProcessingEvents; + sal_Int32 m_nLockCount; ::cppu::OInterfaceContainerHelper m_aUndoListeners; ::cppu::OInterfaceContainerHelper m_aModifyListeners; IUndoManagerImplementation& m_rUndoManagerImplementation; @@ -241,6 +242,7 @@ namespace framework ,m_disposed( false ) ,m_bAPIActionRunning( false ) ,m_bProcessingEvents( false ) + ,m_nLockCount( 0 ) ,m_aUndoListeners( m_aMutex ) ,m_aModifyListeners( m_aMutex ) ,m_rUndoManagerImplementation( i_undoManagerImpl ) @@ -290,6 +292,9 @@ namespace framework void clearRedo( IMutexGuard& i_instanceLock ); void reset( IMutexGuard& i_instanceLock ); + void lock(); + void unlock(); + void addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) { m_aUndoListeners.addInterface( i_listener ); @@ -480,6 +485,37 @@ namespace framework } //------------------------------------------------------------------------------------------------------------------ + void UndoManagerHelper_Impl::lock() + { + // SYNCHRONIZED ---> + ::osl::MutexGuard aGuard( getMutex() ); + + if ( ++m_nLockCount == 1 ) + { + IUndoManager& rUndoManager = getUndoManager(); + rUndoManager.EnableUndo( false ); + } + // <--- SYNCHRONIZED + } + + //------------------------------------------------------------------------------------------------------------------ + void UndoManagerHelper_Impl::unlock() + { + // SYNCHRONIZED ---> + ::osl::MutexGuard aGuard( getMutex() ); + + if ( m_nLockCount == 0 ) + throw NotLockedException( ::rtl::OUString::createFromAscii( "Undo manager is not locked" ), getXUndoManager() ); + + if ( --m_nLockCount == 0 ) + { + IUndoManager& rUndoManager = getUndoManager(); + rUndoManager.EnableUndo( true ); + } + // <--- SYNCHRONIZED + } + + //------------------------------------------------------------------------------------------------------------------ void UndoManagerHelper_Impl::impl_processRequest( ::boost::function0< void > const& i_request, IMutexGuard& i_instanceLock ) { // create the request, and add it to our queue @@ -1100,25 +1136,13 @@ namespace framework //------------------------------------------------------------------------------------------------------------------ void UndoManagerHelper::lock() { - // SYNCHRONIZED ---> - ::osl::MutexGuard aGuard( m_pImpl->getMutex() ); - - IUndoManager& rUndoManager = m_pImpl->getUndoManager(); - rUndoManager.EnableUndo( false ); - // <--- SYNCHRONIZED + m_pImpl->lock(); } //------------------------------------------------------------------------------------------------------------------ void UndoManagerHelper::unlock() { - // SYNCHRONIZED ---> - ::osl::MutexGuard aGuard( m_pImpl->getMutex() ); - - IUndoManager& rUndoManager = m_pImpl->getUndoManager(); - if ( rUndoManager.IsUndoEnabled() ) - throw NotLockedException( ::rtl::OUString::createFromAscii( "Undo manager is not locked" ), m_pImpl->getXUndoManager() ); - rUndoManager.EnableUndo( true ); - // <--- SYNCHRONIZED + m_pImpl->unlock(); } //------------------------------------------------------------------------------------------------------------------ diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 9b6501af4c20..a8282c135062 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -104,37 +104,15 @@ // other includes //_________________________________________________________________________________________________________________ -#ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX #include <comphelper/sequenceashashmap.hxx> -#endif - -#ifndef _UTL_CONFIGMGR_HXX #include <unotools/configmgr.hxx> -#endif - -#ifndef _UTL_BOOTSTRAP_HXX #include <unotools/bootstrap.hxx> -#endif - -#ifndef _SV_WINDOW_HXX #include <vcl/window.hxx> -#endif - -#ifndef _SV_SYSWIN_HXX #include <vcl/syswin.hxx> -#endif - -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> -#endif - -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif - -#ifndef _SV_WRKWIN_HXX #include <vcl/wrkwin.hxx> -#endif +#include <tools/diagnose_ex.h> //_________________________________________________________________________________________________________________ // namespace @@ -332,10 +310,14 @@ void TitleBarUpdate::impl_updateIcon(const css::uno::Reference< css::frame::XFra { try { - xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID ) >>= nIcon; + css::uno::Reference< css::beans::XPropertySetInfo > const xPSI( xSet->getPropertySetInfo(), css::uno::UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( CONTROLLER_PROPNAME_ICONID ) ) + xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID ) >>= nIcon; } catch(const css::uno::Exception&) - {} + { + DBG_UNHANDLED_EXCEPTION(); + } } // c) if b) failed ... identify the used module and retrieve set icon from module config. diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index b9dd626cf06d..a2de01b9c333 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -103,6 +103,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <comphelper/processfactory.hxx> #include <unotools/moduleoptions.hxx> +#include <tools/diagnose_ex.h> #ifdef ENABLE_ASSERTIONS #ifndef _RTL_STRBUF_HXX_ @@ -2882,10 +2883,13 @@ void Frame::implts_setIconOnWindow() { try { - xSet->getPropertyValue( DECLARE_ASCII("IconId") )>>= nIcon; + css::uno::Reference< css::beans::XPropertySetInfo > const xPSI( xSet->getPropertySetInfo(), css::uno::UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( CONTROLLER_PROPNAME_ICONID ) ) + xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID ) >>= nIcon; } - catch( css::beans::UnknownPropertyException& ) + catch( css::uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index 352fc1ad21f7..1b510a294952 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -55,6 +55,7 @@ #include <rtl/ustrbuf.hxx> #include <cppuhelper/weak.hxx> #include <tools/urlobj.hxx> +#include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> //_________________________________________________________________________________________________________________ @@ -242,11 +243,9 @@ throw (uno::Exception, uno::RuntimeException) { xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context ); } - catch ( uno::RuntimeException& ) - { - } catch ( uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } } diff --git a/glib/glib-2.28.1-win32.patch b/glib/glib-2.28.1-win32.patch index 6e7c06d68465..60aabb6cea1b 100644 --- a/glib/glib-2.28.1-win32.patch +++ b/glib/glib-2.28.1-win32.patch @@ -144,7 +144,7 @@ { --- misc/glib-2.28.1/gio/makefile.msc 2011-02-11 16:23:12.000000000 +0100 +++ misc/build/glib-2.28.1/gio/makefile.msc 2011-03-04 12:43:54.423706900 +0100 -@@ -3,9 +3,9 @@ +@@ -3,28 +3,22 @@ PRJ_TOP = .. PACKAGE = gio PKG_VER = 2.0 @@ -152,11 +152,16 @@ +!INCLUDE ..\build\win32\make.msc -SUBDIRS = win32 -+SUBDIRS = win32 gvdb +- +-sub-all: +- for %d in ($(SUBDIRS)) do nmake -nologo -f makefile.msc sub-one THIS=%d +- +-sub-one: +- cd $(THIS) +- nmake -nologo -f makefile.msc +- cd .. ++SUBDIRS_ALL = win32.all gvdb.all - sub-all: - for %d in ($(SUBDIRS)) do nmake -nologo -f makefile.msc sub-one THIS=%d -@@ -18,13 +18,15 @@ INCLUDES = \ -FImsvc_recommended_pragmas.h \ -I .. -I ..\glib -I ..\gmodule -I . \ @@ -173,7 +178,7 @@ appinfo_sources = \ gwin32appinfo.c gwin32appinfo.h -@@ -75,19 +77,50 @@ +@@ -75,19 +69,50 @@ $(NULL) OBJECTS = \ @@ -224,7 +229,7 @@ gemblem.obj \ gemblemedicon.obj \ gfile.obj \ -@@ -112,20 +145,39 @@ +@@ -112,20 +137,39 @@ giomodule.obj \ gioscheduler.obj \ giostream.obj \ @@ -264,7 +269,7 @@ gsocket.obj \ gsocketaddress.obj \ gsocketaddressenumerator.obj \ -@@ -135,13 +187,22 @@ +@@ -135,13 +179,22 @@ gsocketcontrolmessage.obj \ gsocketlistener.obj \ gsocketservice.obj \ @@ -287,7 +292,7 @@ gunionvolumemonitor.obj \ gvfs.obj \ gvolume.obj \ -@@ -156,11 +217,15 @@ +@@ -156,11 +209,15 @@ glocalfilemonitor.obj \ glocaldirectorymonitor.obj \ gwin32appinfo.obj \ @@ -304,35 +309,39 @@ libgio_2_0_la_LIBADD = \ $(top_builddir)/glib/libglib-2.0.la \ -@@ -190,14 +255,14 @@ - +@@ -191,13 +248,13 @@ gio-marshal.h: gio-marshal.list $(GLIB_GEN_MARSHAL) --prefix=_gio_marshal gio-marshal.list --header >> xgen-gwmh \ -- && copy /y xgen-gwmh gio-marshal.h \ + && copy /y xgen-gwmh gio-marshal.h \ - && del xgen-gwmh xgen-gwmh~ -+ && $(GNUCOPY) /y xgen-gwmh gio-marshal.h \ + && rm xgen-gwmh xgen-gwmh~ gio-marshal.c: gio-marshal.h echo #include "gio-marshal.h" >> xgen-gwmc \ && $(GLIB_GEN_MARSHAL) --prefix=_gio_marshal gio-marshal.list --body >> xgen-gwmc \ -- && copy xgen-gwmc gio-marshal.c \ + && copy xgen-gwmc gio-marshal.c \ - && del xgen-gwmc xgen-gwmc~ -+ && $(GNUCOPY) xgen-gwmc gio-marshal.c \ + && rm xgen-gwmc xgen-gwmc~ local_sources = \ glocaldirectorymonitor.c \ -@@ -228,7 +293,7 @@ +@@ -220,12 +277,14 @@ + + all : \ + $(PRJ_TOP)\config.h \ +- sub-all \ ++ $(SUBDIRS_ALL) \ + gio-marshal.c \ + gioenumtypes.h \ + gioenumtypes.c \ + libgio-$(PKG_VER)-0.dll ++$(SUBDIRS_ALL): ++ cmd /C "cd $* & nmake -nologo -f makefile.msc all" $(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32 -- copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h -+ $(GNUCOPY) $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h - - gioenumtypes.h: $(gio_headers) gioenumtypes.h.template - $(PERL) ..\gobject\glib-mkenums --template gioenumtypes.h.template $(gio_headers) > gioenumtypes.h -@@ -245,14 +310,14 @@ + copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h +@@ -245,14 +304,14 @@ RESOURCE = $(PACKAGE).res $(PACKAGE).res : $(PACKAGE).rc @@ -451,7 +460,7 @@ gprimes.obj \ gprintf.obj \ gqsort.obj \ -@@ -88,22 +89,29 @@ +@@ -88,19 +89,26 @@ gthread.obj \ gthreadpool.obj \ gtimer.obj \ @@ -479,14 +488,10 @@ -..\glibconfig.h: ..\glibconfig.h.win32 - copy ..\glibconfig.h.win32 ..\glibconfig.h +glibconfig.h: glibconfig.h.win32 -+ $(GNUCOPY) glibconfig.h.win32 glibconfig.h ++ copy glibconfig.h.win32 glibconfig.h ..\config.h: ..\config.h.win32 -- copy ..\config.h.win32 ..\config.h -+ $(GNUCOPY) ..\config.h.win32 ..\config.h - - localcharset.obj : libcharset\localcharset.c - $(CC) $(CFLAGS) -DLIBDIR=\".\" -c libcharset\localcharset.c + copy ..\config.h.win32 ..\config.h @@ -115,7 +123,7 @@ -DG_GNUC_PRINTF=;G_GNUC_PRINTF -DG_GNUC_FORMAT=;G_GNUC_FORMAT glib.symbols >> glib.def @@ -587,8 +592,7 @@ + gmoduleconf.h: gmoduleconf.h.win32 -- copy gmoduleconf.h.win32 gmoduleconf.h -+ $(GNUCOPY) gmoduleconf.h.win32 gmoduleconf.h + copy gmoduleconf.h.win32 gmoduleconf.h gmodule.res : gmodule.rc - rc -DBUILDNUMBER=0 -r -fo gmodule.res gmodule.rc @@ -602,8 +606,6 @@ - del gmoduleconf.h + rm gmoduleconf.h --- misc/glib-2.28.1/gobject/makefile.msc 2011-02-18 16:35:05.000000000 +0100 -+++ misc/build/glib-2.28.1/gobject/makefile.msc 2011-03-04 12:33:52.399273100 +0100 ---- misc/glib-2.28.1/gobject/makefile.msc 2011-02-18 16:35:05.000000000 +0100 +++ misc/build/glib-2.28.1/gobject/makefile.msc 2011-03-09 09:29:52.712284300 +0100 @@ -7,7 +7,7 @@ @@ -622,7 +624,7 @@ gmarshal.strings \ gobject-query.exe \ libgobject-2.0-0.dll \ -@@ -24,8 +23,10 @@ +@@ -24,6 +23,8 @@ testgobject.exe gobject_OBJECTS = \ @@ -631,9 +633,7 @@ gboxed.obj \ gclosure.obj \ genums.obj \ - gobject.obj \ - gparam.obj \ -@@ -47,21 +49,18 @@ +@@ -47,7 +48,7 @@ -DG_GNUC_PRINTF=;G_GNUC_PRINTF gobject.symbols >> gobject.def gobject.res : gobject.rc @@ -642,15 +642,13 @@ gmarshal.h : gmarshal.list glib-genmarshal.exe echo #ifndef __G_MARSHAL_H__ > xgen-gmh - echo #define __G_MARSHAL_H__ >> xgen-gmh - glib-genmarshal --nostdinc --prefix=g_cclosure_marshal gmarshal.list --header >> xgen-gmh +@@ -56,12 +57,9 @@ echo #endif /* __G_MARSHAL_H__ */ >> xgen-gmh -- copy xgen-gmh gmarshal.h -- + copy xgen-gmh gmarshal.h + -gmarshal.c: gmarshal.list gmarshal.h glib-genmarshal.exe - glib-genmarshal --nostdinc --prefix=g_cclosure_marshal gmarshal.list --body > gmarshal.c -+ $(GNUCOPY) xgen-gmh gmarshal.h - +- libgobject-2.0-0.dll : $(gobject_OBJECTS) gobject.def gobject.res $(CC) $(CFLAGS) -Fm -LD -Fe$@ $(gobject_OBJECTS) gobject.res \ - ..\glib\glib-2.0.lib $(LDFLAGS) /implib:gobject-2.0.lib /def:gobject.def || del $@ @@ -658,7 +656,7 @@ gobject-2.28s.lib : $(gobject_OBJECTS) lib /out:$@ $(gobject_OBJECTS) -@@ -69,7 +68,7 @@ +@@ -69,7 +67,7 @@ # link glib's static version to avoid installing glib-genmarshal.exe : glib-genmarshal.c gmarshal.strings $(CC) -Fe$@ $(CFLAGS) -UGOBJECT_COMPILATION glib-genmarshal.c \ @@ -689,26 +687,47 @@ $(CC) $(CFLAGS) -LD -Fe$@ $(gthread_OBJECTS) gthread.res \ --- misc/glib-2.28.1/makefile.msc 2009-04-01 01:04:20.000000000 +0200 +++ misc/build/glib-2.28.1/makefile.msc 2011-03-04 09:11:06.663432800 +0100 -@@ -1,7 +1,7 @@ +@@ -1,28 +1,25 @@ ## Makefile for building the GLib dlls with Microsoft C ## Use: nmake -f makefile.msc -PARTS = glib gmodule gthread gobject gio tests -+PARTS = "build\win32\dirent" glib gmodule gthread gobject gio tests ++PARTS_ALL = "build\win32\dirent.all" glib.all gmodule.all gthread.all gobject.all gio.all tests.all ++ ++PARTS_CLEAN = "build\win32\dirent.clean" glib.clean gmodule.clean gthread.clean gobject.clean gio.clean tests.clean all : \ config.h \ -@@ -22,7 +22,7 @@ - @cd .. +- glibconfig.h \ +- sub-all +- +-sub-all: +- for %d in ($(PARTS)) do nmake -nologo -f makefile.msc sub-one THIS=%d TARGET=all ++ glib/glibconfig.h \ ++ $(PARTS_ALL) + +-clean : sub-clean ++$(PARTS_ALL): ++ cmd /C "cd $* & nmake -nologo -f makefile.msc all" + +-sub-clean: +- for %d in ($(PARTS)) do nmake -nologo -f makefile.msc sub-one THIS=%d TARGET=clean ++clean : $(PARTS_ALL) + +-sub-one: +- @cd $(THIS) +- @nmake -nologo -f makefile.msc $(TARGET) +- @cd .. ++$(PARTS_CLEAN): ++ cmd /C "cd $* & nmake -nologo -f makefile.msc clean" config.h: config.h.win32 -- copy config.h.win32 config.h -+ $(GNUCOPY) config.h.win32 config.h + copy config.h.win32 config.h -glibconfig.h: glibconfig.h.win32 - copy glibconfig.h.win32 glibconfig.h -+glibconfig.h: glib/glibconfig.h.win32 -+ $(GNUCOPY) glib/glibconfig.h.win32 glib/glibconfig.h ++glib/glibconfig.h: glib/glibconfig.h.win32 ++ copy glib/glibconfig.h.win32 glib/glibconfig.h --- misc/glib-2.28.1/tests/makefile.msc 2011-02-18 16:35:43.000000000 +0100 +++ misc/build/glib-2.28.1/tests/makefile.msc 2011-03-04 08:33:02.079762100 +0100 @@ -7,7 +7,7 @@ @@ -1966,17 +1985,17 @@ + --- misc/glib-2.28.1/gobject/gmarshal.c Wed Aug 20 14:33:55 2008 +++ misc/build/glib-2.28.1/gobject/gmarshal.c Wed Aug 20 14:26:42 2008 -@@ -1,4 +1,13 @@
-+#include "config.h"
-
-+#include "gsourceclosure.h"
-+#include "gboxed.h"
-+#include "genums.h"
-+#include "gmarshal.h"
-+#include "gvalue.h"
-+#include "gvaluetypes.h"
-+#include "gparam.h"
-+#include "gobject.h"
-
- #ifdef G_ENABLE_DEBUG
- #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+@@ -1,4 +1,13 @@ ++#include "config.h" + ++#include "gsourceclosure.h" ++#include "gboxed.h" ++#include "genums.h" ++#include "gmarshal.h" ++#include "gvalue.h" ++#include "gvaluetypes.h" ++#include "gparam.h" ++#include "gobject.h" + + #ifdef G_ENABLE_DEBUG + #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx index 8ce6098d21a9..fa2676c3bac1 100755 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -107,7 +107,7 @@ namespace fs { ::rtl::OUString ustrSystemPath; osl::File::getSystemPathFromFileURL(data, ustrSystemPath); - return ustrSystemPath.getStr(); + return reinterpret_cast< wchar_t const * >(ustrSystemPath.getStr()); } #endif std::string native_directory_string() const { return native_file_string(); } diff --git a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl index c802db2f870e..5fce0f1ae325 100644 --- a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl @@ -45,7 +45,7 @@ @since OOo 3.3 */ -service DefaultGridDataModel : ::com::sun::star::awt::grid::XMutableGridDataModel; +published service DefaultGridDataModel : ::com::sun::star::awt::grid::XMutableGridDataModel; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl index 0fe19dfea71a..cec141027cd8 100644 --- a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl +++ b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl @@ -40,9 +40,8 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -published struct GridColumnEvent: com::sun::star::lang::EventObject +published struct GridColumnEvent : ::com::sun::star::lang::EventObject { - /** Contains the name of the attributes whose value changed. **/ string AttributeName; /** Contains the old value **/ diff --git a/offapi/com/sun/star/awt/grid/GridDataEvent.idl b/offapi/com/sun/star/awt/grid/GridDataEvent.idl index 7430f3d97e66..738b11ed745a 100644 --- a/offapi/com/sun/star/awt/grid/GridDataEvent.idl +++ b/offapi/com/sun/star/awt/grid/GridDataEvent.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -struct GridDataEvent: com::sun::star::lang::EventObject +published struct GridDataEvent: com::sun::star::lang::EventObject { /** denotes the first column affected by a change. diff --git a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl index e9b87c2fe7ed..9ff468f5697e 100644 --- a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl +++ b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl @@ -31,37 +31,26 @@ #include <com/sun/star/lang/EventObject.idl> #endif -#ifndef __com_sun_star_awt_grid_SelectionEventType_idl__ -#include <com/sun/star/awt/grid/SelectionEventType.idl> -#endif - //============================================================================= module com { module sun { module star { module awt { module grid { //============================================================================= -/** An event used by a <type>XGridControl</type> to notify changes in the selection. +/** An event used by a <type>XGridControl</type> to notify changes in its row selection. - @see XGridControl + @see XGridRowSelection @see XGridSelectionListener */ -struct GridSelectionEvent: com::sun::star::lang::EventObject +published struct GridSelectionEvent: com::sun::star::lang::EventObject { - //------------------------------------------------------------------------- - - /** the selected row*/ - long Row; - - /** the selected column*/ - long Column; - - /**number of selected rows, if multiple rows selected*/ - long Range; - - /** Contains the action <type>SelectionEventType</types> that was performed **/ - SelectionEventType Action; + /** denotes the indexes of the rows being selected at the time the event was fired. + */ + sequence< long > SelectedRowIndexes; + /** denotes the indexes of the columns being selected at the time the event was fired. + */ + sequence< long > SelectedColumnIndexes; }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/SelectionEventType.idl b/offapi/com/sun/star/awt/grid/SelectionEventType.idl deleted file mode 100644 index c7ee61498cc3..000000000000 --- a/offapi/com/sun/star/awt/grid/SelectionEventType.idl +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_awt_grid_SelectionEventType_idl__ -#define __com_sun_star_awt_grid_SelectionEventType_idl__ - - -//============================================================================= - -module com { module sun { module star { module awt { module grid { - -//============================================================================= - -/** specifies the type of a selection event, as used by - <type>GridSelectionEvent</type>. - */ -enum SelectionEventType -{ - //------------------------------------------------------------------------- - - /** This value indicates that a selection was added to the grid control - */ - ADD, - - //------------------------------------------------------------------------- - - /** This value indicates that a selection was removed from the grid control - */ - REMOVE, - - //------------------------------------------------------------------------- - - /** This value indicates that a selection was changed - */ - CHANGE - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl index 5141e8a52cce..0c7cbd76fa70 100644 --- a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl +++ b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl @@ -35,6 +35,10 @@ #include <com/sun/star/awt/grid/XGridControl.idl> #endif +#ifndef __com_sun_star_awt_grid_XGridRowSelection_idl__ +#include <com/sun/star/awt/grid/XGridRowSelection.idl> +#endif + //============================================================================= module com { module sun { module star { module awt { module grid { @@ -45,12 +49,12 @@ /** A control that displays a set of tabular data. - <p> <h4>The Column Model</h4> + <p>The horizontal structure of the grid is defined by the <type>XGridColumnModel</type> implemented in <type>DefaultGridColumnModel</type> The <type>XGridColumn</type> implemented in <typeGridColumn</type> describes the properties and behavior of a single column. Use the <member>XGridColumnModel::addColumn()</member> to add a column to the column model. </p> - <p> + <h4>The Data Model</h4> <p> All row data are stored in the <type>XGridDataModel</type>. Use the <type>DefaultGridDataModel</type> to add <member>XGridDataModel::addRow()</member> or remove <member>XGridDataModel::removeRow()</member> rows. @@ -61,18 +65,19 @@ <h4>Selection</h4> <p>If you are interested in knowing when the selection changes implement a <type>XGridSelectionListener</type> and add the instance with the method - <member>XGridSelection::addSelectionListener()</member>. - You than will be notified for any selection change. + <member>XGridRowSelection::addSelectionListener()</member>. + You than will be notified for any selection change.</p> - The <type>XGridSelection</type> interface provides a bunch of methods to set and get selection for the grid control. - </p> + <p>The <type>XGridSelection</type> interface provides a bunch of methods to set and get selection for the grid control.</p> @since OOo 3.3 */ service UnoControlGrid { service com::sun::star::awt::UnoControl; - interface com::sun::star::awt::grid::XGridControl; + interface ::com::sun::star::awt::grid::XGridControl; + + interface ::com::sun::star::awt::grid::XGridRowSelection; }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl index 02b4d93f621d..6f373aea580f 100644 --- a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl +++ b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -service UnoControlGridModel +published service UnoControlGridModel { /** specifies the standard model of an <type scope="com::sun::star::awt">UnoControl</type>. */ service com::sun::star::awt::UnoControlModel; @@ -132,14 +132,14 @@ service UnoControlGridModel /** controls whether or not to paint horizontal and vertical lines between the grid cells. - @see LineColor + @see GridLineColor */ [property] boolean UseGridLines; /** specifies the color to be used when drawing lines between cells <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, - depending on the system's style settings.</p> + depending on the control's style settings.</p> @see UseGridLines */ @@ -148,17 +148,47 @@ service UnoControlGridModel /** specifies the color to be used when drawing the background of row or column headers <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, - depending on the system's style settings.</p> + depending on the control's style settings.</p> */ [property, maybevoid] ::com::sun::star::util::Color HeaderBackgroundColor; /** specifies the color to be used when drawing the text within row or column headers <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, - depending on the system's style settings.</p> + depending on the control's style settings.</p> */ [property, maybevoid] ::com::sun::star::util::Color HeaderTextColor; + /** specifies the color to be used when drawing the background of selected cells, while the control has the focus. + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the control's style settings.</p> + */ + [property, maybevoid] ::com::sun::star::util::Color ActiveSelectionBackgroundColor; + + /** specifies the color to be used when drawing the background of selected cells, while the control does not have + the focus. + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the control's style settings.</p> + */ + [property, maybevoid] ::com::sun::star::util::Color InactiveSelectionBackgroundColor; + + /** specifies the color to be used when drawing the text of selected cells, while the control has the focus. + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the control's style settings.</p> + */ + [property, maybevoid] ::com::sun::star::util::Color ActiveSelectionTextColor; + + /** specifies the color to be used when drawing the text of selected cells, while the control does not have + the focus. + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the control's style settings.</p> + */ + [property, maybevoid] ::com::sun::star::util::Color InactiveSelectionTextColor; + /** specifies the colors to be used as background for data rows. <p>If this sequence is non-empty, the data rows will be rendered with alternating background colors: Assuming @@ -167,19 +197,13 @@ service UnoControlGridModel <p>If this sequence is empty, all rows will use the same background color as the control as whole.</p> - <p>If this property does not exist at a particular implementation, or is <VOID/>, rows will be painted + <p>If this property has a value of <VOID/>, rows will be painted in alternating background colors, every second row having a background color derived from the control's selection color.</p> */ [property, maybevoid] sequence< ::com::sun::star::util::Color > RowBackgroundColors; /** specifies the vertical alignment of the content in the control. - - <pre> - TOP - MIDDLE - BOTTOM - </pre> */ [property] com::sun::star::style::VerticalAlignment VerticalAlign; @@ -190,14 +214,14 @@ service UnoControlGridModel /** specifies the color to be used when drawing cell texts <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, - depending on the system's style settings.</p> + depending on the control's style settings.</p> */ [property, maybevoid] ::com::sun::star::util::Color TextColor; /** specifies the color to be used when drawing text lines (underlining and strikethrough) <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, - depending on the system's style settings.</p> + depending on the control's style settings.</p> */ [property, maybevoid] com::sun::star::util::Color TextLineColor; diff --git a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl index 434be67ed3f8..4604920e56a3 100644 --- a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl +++ b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -interface XGridColumnModel +published interface XGridColumnModel { /** implements life time control for the component */ diff --git a/offapi/com/sun/star/awt/grid/XGridControl.idl b/offapi/com/sun/star/awt/grid/XGridControl.idl index b742c1acb484..f8413046839a 100644 --- a/offapi/com/sun/star/awt/grid/XGridControl.idl +++ b/offapi/com/sun/star/awt/grid/XGridControl.idl @@ -27,7 +27,9 @@ #ifndef __com_sun_star_awt_grid_XGridControl_idl__ #define __com_sun_star_awt_grid_XGridControl_idl__ -#include <com/sun/star/awt/grid/XGridSelection.idl> +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> +#include <com/sun/star/util/VetoException.idl> //============================================================================= @@ -41,7 +43,7 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -interface XGridControl : XGridSelection +published interface XGridControl { /** retrieves the column which a given point belongs to @@ -78,6 +80,24 @@ interface XGridControl : XGridSelection columns, or if grid data model does not contain any rows), then <code>-1</code> is returned.</p> */ long getCurrentRow(); + + /** moves the cursor to the given cell + @param ColumnIndex + the column index of the cell to activate. + @param RowIndex + the row index of the cell to activate. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if either <code>ColumnIndex</code> or <code>RowIndex</code> are out of range. + @throws ::com::sun::star::util::VetoException + if moving the cursor to another cell is vetoed. + */ + void goToCell( + [in] long ColumnIndex, + [in] long RowIndex + ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException + , ::com::sun::star::util::VetoException + ); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridDataListener.idl b/offapi/com/sun/star/awt/grid/XGridDataListener.idl index 9a324aee2668..9840ff9bf779 100644 --- a/offapi/com/sun/star/awt/grid/XGridDataListener.idl +++ b/offapi/com/sun/star/awt/grid/XGridDataListener.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -interface XGridDataListener: com::sun::star::lang::XEventListener +published interface XGridDataListener: com::sun::star::lang::XEventListener { /** is called when one or more rows of data have been inserted into a grid control's data model. diff --git a/offapi/com/sun/star/awt/grid/XGridDataModel.idl b/offapi/com/sun/star/awt/grid/XGridDataModel.idl index 469a4d1eb3bf..dee29a1a8f10 100644 --- a/offapi/com/sun/star/awt/grid/XGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/XGridDataModel.idl @@ -46,13 +46,13 @@ module com { module sun { module star { module awt { module grid { @since OOo 3.3 */ -interface XGridDataModel +published interface XGridDataModel { /** implements life time control for the component */ interface ::com::sun::star::lang::XComponent; - /** allows cloning the complete column model + /** allows cloning the complete data model */ interface ::com::sun::star::util::XCloneable; @@ -69,7 +69,7 @@ interface XGridDataModel @throws ::com::sun::star::lang::IndexOutOfBoundsException if the column or row index do not denote a valid cell position. */ - any getCellData( [in] long Column, [in] long Row ) + any getCellData( [in] long Column, [in] long RowIndex ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** retrieves the tool tip to be displayed when the mouse hovers over a given cell @@ -82,7 +82,7 @@ interface XGridDataModel @throws ::com::sun::star::lang::IndexOutOfBoundsException if the column or row index do not denote a valid cell position. */ - any getCellToolTip( [in] long Column, [in] long Row ) + any getCellToolTip( [in] long Column, [in] long RowIndex ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** retrieves the heading of a given row @@ -97,6 +97,20 @@ interface XGridDataModel any getRowHeading( [in] long RowIndex ) raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** retrieves the data for a complete row + + <p>This method is provided for performance and convenience reasons, it delivers the same result + as subsequent calls to <member>getCellData</member> would.</p> + + @param Row + the index of the row whose data should is to be retrieved. + @raises ::com::sun::star::lang::IndexOutOfBoundsException + of the given row index does not denote a valid row. + */ + sequence< any > + getRowData( [in] long RowIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridSelection.idl b/offapi/com/sun/star/awt/grid/XGridRowSelection.idl index aa7fd5e42b4b..7dd4903ef218 100644 --- a/offapi/com/sun/star/awt/grid/XGridSelection.idl +++ b/offapi/com/sun/star/awt/grid/XGridRowSelection.idl @@ -27,9 +27,8 @@ #ifndef __com_sun_star_awt_grid_XGridSelection_idl__ #define __com_sun_star_awt_grid_XGridSelection_idl__ -#include <com/sun/star/uno/XInterface.idl> #include <com/sun/star/awt/grid/XGridSelectionListener.idl> -#include <com/sun/star/view/SelectionType.idl> +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> //============================================================================= @@ -38,8 +37,10 @@ module com { module sun { module star { module awt { module grid { //============================================================================= /** This interfaces provides access to the selection of row for <type>UnoControlGrid</type>. + + @since OpenOffice.org 3.4 */ -interface XGridSelection +published interface XGridRowSelection { /** Selects all rows. */ @@ -49,8 +50,12 @@ interface XGridSelection @param RowIndex denotes the index of the row to select + + @raises ::com::sun::star::lang::IndexOutOfBoundsException + if <code>RowIndex</code> does not denote a valid row index */ - void selectRow( [in] long RowIndex ); + void selectRow( [in] long RowIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** Deselects all selected rows. */ @@ -61,27 +66,31 @@ interface XGridSelection @param RowIndex denotes the index of the row to deselect */ - void deselectRow( [in] long RowIndex ); + void deselectRow( [in] long RowIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** Returns the indicies of all selected rows. @returns a sequence of indicies. */ - sequence< long > getSelection(); + sequence< long > getSelectedRows(); /** Returns whether rows are selected. @returns - <true/> if rows are selected otherwise <false/>. + <true/> if and only if at least one row is selected. */ - boolean isSelectionEmpty(); + boolean hasSelectedRows(); /** Returns whether a specific row is selected. - @param - the index of a row. + + @param RowIndex + the index of a row. If the value does not denote a valid row index, i.e. is smaller than <code>0</code> + or greater than the number of rows, this is silently ignored, and <false/> is returned. + @returns - <true/> if row are selected otherwise <false/>. + <true/> if and only if there is a row with the given index, and it is selected currently. */ - boolean isSelectedIndex( [in] long index); + boolean isRowSelected( [in] long RowIndex ); /** Adds a listener for the <type>GridSelectionEvent</type> posted after the grid changes. @param listener @@ -89,15 +98,11 @@ interface XGridSelection */ void addSelectionListener( [in] XGridSelectionListener listener); - //------------------------------------------------------------------------- - /** Removes a listener previously added with <method>addSelectionListener()</method>. @param listener the listener to remove. */ void removeSelectionListener( [in] XGridSelectionListener listener); - - }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl b/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl index 61e8d3050b0d..61f36c267dae 100644 --- a/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl +++ b/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl @@ -41,13 +41,10 @@ module com { module sun { module star { module awt { module grid { //============================================================================= -/** An instance of this interface is used by the <type>XGridSelection</type> to +/** An instance of this interface is used by the <type>XGridRowSelection</type> to get notifications about selection changes. - - <p>Usually you must not implement this interface yourself, but you must notify it correctly if - you implement the <type>XGridSelection</type> yourself</p>. */ -interface XGridSelectionListener: com::sun::star::lang::XEventListener +published interface XGridSelectionListener: com::sun::star::lang::XEventListener { //------------------------------------------------------------------------- /** Invoked after a selection was changed. diff --git a/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl index 5e10820ff9ef..3c0fbf6b654a 100755..100644 --- a/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl @@ -39,9 +39,9 @@ module com { module sun { module star { module awt { module grid { /** allows to modify the data represented by a <type>XGridDataModel</type> */ -interface XMutableGridDataModel : XGridDataModel +published interface XMutableGridDataModel : XGridDataModel { - /** adds a row to the model. + /** appends a row to the model. @param Heading denotes the heading of the row. @@ -50,7 +50,7 @@ interface XMutableGridDataModel : XGridDataModel */ void addRow( [in] any Heading, [in] sequence< any > Data ); - /** adds multiple rows of data to the model. + /** appends multiple rows of data to the model. @param Headings denotes the headings of the to-be-added rows. @param Data @@ -61,6 +61,38 @@ interface XMutableGridDataModel : XGridDataModel void addRows( [in] sequence< any > Headings, [in] sequence< sequence< any > > Data ) raises ( ::com::sun::star::lang::IllegalArgumentException ); + /** inserts a row into the set of data rows + + @param Index + denotes the position at which the row is to be inserted + @param Heading + denotes the heading of the row. + @param Data + specifies the content of the row. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if <code>Index</code> is smaller than <code>0</code> or greater than the number of + rows in the model. + */ + void insertRow( [in] long Index, [in] any Heading, [in] sequence< any > Data ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** inserts multiple rows of data into the model. + @param Index + denotes the position at which the rows are to be inserted + @param Headings + denotes the headings of the to-be-added rows. + @param Data + specifies the data of the rows to be added. + @throws ::com::sun::star::lang::IllegalArgumentException + if <code>Titles</code> and <code>Data</code> are of different length. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if <code>Index</code> is smaller than <code>0</code> or greater than the number of + rows in the model. + */ + void insertRows( [in] long Index, [in] sequence< any > Headings, [in] sequence< sequence< any > > Data ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException + , ::com::sun::star::lang::IllegalArgumentException ); + /** removes a row of data from the model @param RowIndex diff --git a/offapi/com/sun/star/awt/grid/makefile.mk b/offapi/com/sun/star/awt/grid/makefile.mk index 8499dca27d82..67a566edcdce 100644 --- a/offapi/com/sun/star/awt/grid/makefile.mk +++ b/offapi/com/sun/star/awt/grid/makefile.mk @@ -40,10 +40,9 @@ PACKAGE=com$/sun$/star$/awt$/grid IDLFILES=\ GridColumnEvent.idl\ GridDataEvent.idl\ - SelectionEventType.idl\ GridSelectionEvent.idl\ XGridSelectionListener.idl\ - XGridSelection.idl\ + XGridRowSelection.idl\ XGridColumn.idl\ XGridColumnListener.idl\ XGridDataListener.idl\ diff --git a/offapi/com/sun/star/awt/tab/UnoControlTabPage.idl b/offapi/com/sun/star/awt/tab/UnoControlTabPage.idl index 6244b18e0c77..b4ba2d156314 100644 --- a/offapi/com/sun/star/awt/tab/UnoControlTabPage.idl +++ b/offapi/com/sun/star/awt/tab/UnoControlTabPage.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module awt { module tab { @since OOo 3.4 */ -service UnoControlTabPage +published service UnoControlTabPage { service com::sun::star::awt::UnoControlContainer; diff --git a/offapi/com/sun/star/awt/tab/UnoControlTabPageContainer.idl b/offapi/com/sun/star/awt/tab/UnoControlTabPageContainer.idl index 488ce4b5354a..081d5dda5f65 100644 --- a/offapi/com/sun/star/awt/tab/UnoControlTabPageContainer.idl +++ b/offapi/com/sun/star/awt/tab/UnoControlTabPageContainer.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module awt { module tab { @since OOo 3.4 */ -service UnoControlTabPageContainer +published service UnoControlTabPageContainer { service com::sun::star::awt::UnoControl; diff --git a/offapi/com/sun/star/awt/tab/UnoControlTabPageModel.idl b/offapi/com/sun/star/awt/tab/UnoControlTabPageModel.idl index 266f6a56119a..b669375b811e 100644 --- a/offapi/com/sun/star/awt/tab/UnoControlTabPageModel.idl +++ b/offapi/com/sun/star/awt/tab/UnoControlTabPageModel.idl @@ -38,15 +38,9 @@ module com { module sun { module star { module awt { module tab { /** specifies the standard model of a XTabPageModel. @since OOo 3.4 */ -published service UnoControlTabPageModel : XTabPageModel +published service UnoControlTabPageModel { - /** Creates a new XTabPageModel with a given ID. - */ - create([in] short tabPageID); - - /** Creates a new XTabPageModel with a given ID and a url which is used to load the tab page model. - */ - load([in] short tabPageID,[in] string url); + interface XTabPageModel; }; //============================================================================= diff --git a/offapi/com/sun/star/awt/tab/XTabPage.idl b/offapi/com/sun/star/awt/tab/XTabPage.idl index 0c79d34075d5..c66c305da699 100644 --- a/offapi/com/sun/star/awt/tab/XTabPage.idl +++ b/offapi/com/sun/star/awt/tab/XTabPage.idl @@ -28,6 +28,7 @@ #define __com_sun_star_awt_tab_XTabPage_idl__ #include <com/sun/star/awt/tab/XTabPageModel.idl> + //============================================================================= module com { module sun { module star { module awt { module tab { diff --git a/offapi/com/sun/star/awt/tab/XTabPageContainer.idl b/offapi/com/sun/star/awt/tab/XTabPageContainer.idl index 0349b04cc637..cc4f9ebc9e3c 100644 --- a/offapi/com/sun/star/awt/tab/XTabPageContainer.idl +++ b/offapi/com/sun/star/awt/tab/XTabPageContainer.idl @@ -47,7 +47,7 @@ published interface XTabPageContainer @returns the number of tab pages. */ - long getTabPageCount(); + short getTabPageCount(); //------------------------------------------------------------------------- @@ -86,7 +86,7 @@ published interface XTabPageContainer @param listener the listener to add. */ - [oneway] void addTabPageListener( [in] XTabPageContainerListener listener); + [oneway] void addTabPageContainerListener( [in] XTabPageContainerListener listener); //------------------------------------------------------------------------- @@ -94,7 +94,7 @@ published interface XTabPageContainer @param listener the listener to remove. */ - [oneway] void removeTabPageListener( [in] XTabPageContainerListener listener); + [oneway] void removeTabPageContainerListener( [in] XTabPageContainerListener listener); //------------------------------------------------------------------------- /** Specifies the ID of the current active tab page. diff --git a/offapi/com/sun/star/awt/tab/XTabPageContainerModel.idl b/offapi/com/sun/star/awt/tab/XTabPageContainerModel.idl index 8b3bf2d9afbd..e2ac2633363f 100644 --- a/offapi/com/sun/star/awt/tab/XTabPageContainerModel.idl +++ b/offapi/com/sun/star/awt/tab/XTabPageContainerModel.idl @@ -34,6 +34,8 @@ module com { module sun { module star { module awt { module tab { +published interface XTabPageModel; + //============================================================================= /** specifies an interface for a UnoControlTabPageContainerModel. @@ -44,6 +46,21 @@ published interface XTabPageContainerModel { interface com::sun::star::container::XIndexContainer; interface com::sun::star::container::XContainer; + + /** creates a TabPageModel which can be inserted into the container. + @param TabPageID + the id of the tab page + */ + XTabPageModel createTabPage( [in] short TabPageID ); + + /** creates a TabPageModel which can be inserted into the container, by loading it from a user interface + resource file. + @param TabPageID + the id of the tab page + @param ResourceURL + the URL of the user interface resource to load + */ + XTabPageModel loadTabPage( [in] short TabPageID, [in] string ResourceURL ); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/tab/XTabPageModel.idl b/offapi/com/sun/star/awt/tab/XTabPageModel.idl index b07c3ea4ec6d..9d98322a9449 100644 --- a/offapi/com/sun/star/awt/tab/XTabPageModel.idl +++ b/offapi/com/sun/star/awt/tab/XTabPageModel.idl @@ -76,7 +76,7 @@ published interface XTabPageModel /** specifies a tooltip text that should be displayed in the tab bar. */ - [attribute] string Tooltip; + [attribute] string ToolTip; }; diff --git a/offapi/com/sun/star/sheet/ExternalLinkType.idl b/offapi/com/sun/star/sheet/ExternalLinkType.idl index 976524506775..09bcd68ff70e 100644 --- a/offapi/com/sun/star/sheet/ExternalLinkType.idl +++ b/offapi/com/sun/star/sheet/ExternalLinkType.idl @@ -54,6 +54,15 @@ constants ExternalLinkType */ const long DDE = 2; + /** Reference to the own document. + */ + const long SELF = 3; + + /** For special use cases. Behaviour is dependent on the implementation of + the formula parser. + */ + const long SPECIAL = 4; + }; //============================================================================= diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 2616566225b9..c61dc303dff1 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -863,6 +863,12 @@ <value xml:lang="en-US">.uno:Redo</value> </prop> </node> + <node oor:name="C_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"> + <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">.uno:InsertAnnotation</value> + </prop> + </node> </node> <node oor:name="com.sun.star.chart2.ChartDocument" oor:op="replace"> <node oor:name="9_SHIFT_MOD1_MOD2" oor:op="replace"> diff --git a/officecfg/registry/data/org/openoffice/Office/Canvas.xcu b/officecfg/registry/data/org/openoffice/Office/Canvas.xcu index a51ff5b244c8..bbabdce6c6f2 100755 --- a/officecfg/registry/data/org/openoffice/Office/Canvas.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Canvas.xcu @@ -77,6 +77,34 @@ </value> </prop> </node> + <node oor:name="com.sun.star.rendering.Canvas.MultiScreen" oor:op="replace"> + <prop oor:name="PreferredImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.Canvas.VCL + </value> + </prop> + <prop oor:name="AcceleratedImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.Canvas.VCL + </value> + </prop> + <prop oor:name="AntialiasingImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.Canvas.VCL + </value> + </prop> + </node> + <node oor:name="com.sun.star.rendering.SpriteCanvas.MultiScreen" oor:op="replace"> + <prop oor:name="PreferredImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.SpriteCanvas.VCL + </value> + </prop> + <prop oor:name="AcceleratedImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.SpriteCanvas.VCL + </value> + </prop> + <prop oor:name="AntialiasingImplementations" oor:type="oor:string-list"> + <value oor:separator=",">com.sun.star.comp.rendering.SpriteCanvas.VCL + </value> + </prop> + </node> </node> </oor:component-data> diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index bb9877008e89..ed1b2ec4cd72 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -198,7 +198,7 @@ template< typename Type > class OptValue { public: - inline explicit OptValue() : mbHasValue( false ) {} + inline explicit OptValue() : maValue(), mbHasValue( false ) {} inline explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {} inline explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {} diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index d108eb06aff8..b16c49c975fc 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -181,9 +181,6 @@ void Shape::addShape( if ( xShapes.is() ) addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); } - Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY ); - if( xLockable.is() ) - xLockable->removeActionLock(); } catch( const Exception& ) { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 553af0d723f8..c4b4a4c34853 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -478,6 +478,7 @@ VerticalSplitMode VerticalSplitPositionTwips ViewBox Visible +VisibleFlag VisibleSize VisualArea VisualEffect diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index aa4d7a068530..23177d09cf1d 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -681,10 +681,19 @@ ExternalLinkInfo ExternalLink::getLinkInfo() const ExternalLinkInfo aLinkInfo; switch( meLinkType ) { + case LINKTYPE_SELF: + case LINKTYPE_SAME: + case LINKTYPE_INTERNAL: + aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::SELF; + break; case LINKTYPE_EXTERNAL: aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DOCUMENT; aLinkInfo.Data <<= maTargetUrl; break; + case LINKTYPE_LIBRARY: + // parser will return library function names in OPCODE_BAD string tokens + aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::SPECIAL; + break; case LINKTYPE_DDE: { aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DDE; @@ -1041,8 +1050,8 @@ void ExternalLinkBuffer::importExternSheet8( BiffInputStream& rStrm ) Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const { ::std::vector< ExternalLinkInfo > aLinkInfos; - // should not be used for BIFF12 documents - OSL_ENSURE( (getFilterType() == FILTER_OOXML) && !mbUseRefSheets, "ExternalLinkBuffer::getLinkInfos - unexpected file format" ); + // XML formula parser also used in BIFF12 documents, e.g. replacement formulas in unsupported conditional formattings + OSL_ENSURE( getFilterType() == FILTER_OOXML, "ExternalLinkBuffer::getLinkInfos - unexpected file format" ); // add entry for implicit index 0 (self reference to this document) aLinkInfos.push_back( mxSelfRef->getLinkInfo() ); for( ExternalLinkVec::const_iterator aIt = maExtLinks.begin(), aEnd = maExtLinks.end(); aIt != aEnd; ++aIt ) diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index 25398f9aa133..366e4a0dbde7 100755 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -1283,7 +1283,7 @@ bool OpCodeProviderImpl::initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, c // set API opcode from ODF function name bIsValid &= initFuncOpCode( *xFuncInfo, xFuncInfo->mbExternal ? rExtFuncTokenMap : rIntFuncTokenMap ); // insert the function info into the maps - if( xFuncInfo->mnApiOpCode != OPCODE_NONAME ) + if( (xFuncInfo->mnApiOpCode != OPCODE_NONAME) && (xFuncInfo->mnApiOpCode != OPCODE_BAD) ) { if( (xFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (xFuncInfo->maExtProgName.getLength() > 0) ) maExtProgFuncs[ xFuncInfo->maExtProgName ] = xFuncInfo; diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx index 782c138d43e2..8484b28326b1 100644 --- a/oox/source/xls/numberformatsbuffer.cxx +++ b/oox/source/xls/numberformatsbuffer.cxx @@ -1851,14 +1851,16 @@ sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts, catch( Exception& ) { // BIFF2-BIFF4 stores standard format explicitly in stream - static const OUString saGeneral = CREATE_OUSTRING( "general" ); - if( rFmtCode.equalsIgnoreAsciiCase( saGeneral ) ) + if( rFmtCode.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "general" ) ) ) { nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale ); } else { - OSL_ENSURE( false, + // do not assert fractional number formats with fixed denominator + OSL_ENSURE( rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?/" ) ) || + rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?/" ) ) || + rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?\?/" ) ), OStringBuffer( "lclCreateFormat - cannot create number format '" ). append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ). append( '\'' ).getStr() ); diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index eddb5463be4e..53216c4d4890 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -2712,9 +2712,9 @@ const sal_Char* const sppcStyleNames[] = "Followed Hyperlink", "Note", // new in OOX "Warning Text", - "", - "", - "", + 0, + 0, + 0, "Title", "Heading 1", "Heading 2", @@ -2762,7 +2762,7 @@ OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sa OSL_ENSURE( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount), "lclGetBuiltinStyleName - unknown built-in style" ); OUStringBuffer aStyleName; aStyleName.appendAscii( spcStyleNamePrefix ); - if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ][ 0 ] != 0) ) + if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ] != 0) ) aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] ); else if( rName.getLength() > 0 ) aStyleName.append( rName ); @@ -2773,11 +2773,9 @@ OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sa return aStyleName.makeStringAndClear(); } -OUString lclGetBuiltInStyleName( const OUString& rName ) +OUString lclCreateStyleName( const CellStyleModel& rModel ) { - OUStringBuffer aStyleName; - aStyleName.appendAscii( spcStyleNamePrefix ).append( rName ); - return aStyleName.makeStringAndClear(); + return rModel.mbBuiltin ? lclGetBuiltinStyleName( rModel.mnBuiltinId, rModel.maName, rModel.mnLevel ) : rModel.maName; } bool lclIsBuiltinStyleName( const OUString& rStyleName, sal_Int32* pnBuiltinId, sal_Int32* pnNextChar ) @@ -2792,12 +2790,15 @@ bool lclIsBuiltinStyleName( const OUString& rStyleName, sal_Int32* pnBuiltinId, OUString aShortName; for( sal_Int32 nId = 0; nId < snStyleNamesCount; ++nId ) { - aShortName = OUString::createFromAscii( sppcStyleNames[ nId ] ); - if( rStyleName.matchIgnoreAsciiCase( aShortName, nPrefixLen ) && - (nNextChar < nPrefixLen + aShortName.getLength()) ) + if( sppcStyleNames[ nId ] != 0 ) { - nFoundId = nId; - nNextChar = nPrefixLen + aShortName.getLength(); + aShortName = OUString::createFromAscii( sppcStyleNames[ nId ] ); + if( rStyleName.matchIgnoreAsciiCase( aShortName, nPrefixLen ) && + (nNextChar < nPrefixLen + aShortName.getLength()) ) + { + nFoundId = nId; + nNextChar = nPrefixLen + aShortName.getLength(); + } } } } @@ -3043,10 +3044,11 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = maBuiltinStyles.begin(), aEnd = maBuiltinStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); - OUString aStyleName = lclGetBuiltinStyleName( rModel.mnBuiltinId, rModel.maName, rModel.mnLevel ); - OSL_ENSURE( bReserveAll || (aCellStyles.count( aStyleName ) == 0), - "CellStyleBuffer::finalizeImport - multiple styles with equal built-in identifier" ); - if( aCellStyles.count( aStyleName ) > 0 ) + OUString aStyleName = lclCreateStyleName( rModel ); + /* If a builtin style entry already exists, and we do not reserve all + existing styles, we just stick with the last definition and ignore + the preceding ones. */ + if( bReserveAll && (aCellStyles.count( aStyleName ) > 0) ) aConflictNameStyles.push_back( *aIt ); else aCellStyles[ aStyleName ] = *aIt; @@ -3057,13 +3059,14 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = maUserStyles.begin(), aEnd = maUserStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); + OUString aStyleName = lclCreateStyleName( rModel ); // #i1624# #i1768# ignore unnamed user styles - if( rModel.maName.getLength() > 0 ) + if( aStyleName.getLength() > 0 ) { - if( aCellStyles.count( rModel.maName ) > 0 ) + if( aCellStyles.count( aStyleName ) > 0 ) aConflictNameStyles.push_back( *aIt ); else - aCellStyles[ rModel.maName ] = *aIt; + aCellStyles[ aStyleName ] = *aIt; } } @@ -3071,11 +3074,12 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = aConflictNameStyles.begin(), aEnd = aConflictNameStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); + OUString aStyleName = lclCreateStyleName( rModel ); OUString aUnusedName; sal_Int32 nIndex = 0; do { - aUnusedName = OUStringBuffer( rModel.maName ).append( sal_Unicode( ' ' ) ).append( ++nIndex ).makeStringAndClear(); + aUnusedName = OUStringBuffer( aStyleName ).append( sal_Unicode( ' ' ) ).append( ++nIndex ).makeStringAndClear(); } while( aCellStyles.count( aUnusedName ) > 0 ); aCellStyles[ aUnusedName ] = *aIt; diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 69d17b47a570..fc382954a376 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -1241,7 +1241,10 @@ void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels, if( rModel.mbHidden ) { PropertySet aPropSet( getRows( rRowRange ) ); - aPropSet.setProperty( PROP_IsVisible, false ); + /* #i116460# Use VisibleFlag instead of IsVisible: directly set the + flag, without drawing layer update etc. (only possible before + shapes are inserted). */ + aPropSet.setProperty( PROP_VisibleFlag, false ); } // outline settings for this row range diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index 65a17eb1352d..9adf6926f80d 100755 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -78,7 +78,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod //on Windows XP and ERROR_INSUFFICIENT_BUFFER on Windows 7 (64bit) if (hInstance == NULL && Module->length > 260) { - std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(Module->length + 1); + std::vector<WCHAR, rtl::Allocator<WCHAR> > vec(Module->length + 1); DWORD len = GetShortPathNameW(reinterpret_cast<LPCWSTR>(Module->buffer), &vec[0], Module->length + 1); if (len ) diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index a2f86422df2a..164afe37b85b 100755 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -314,7 +314,7 @@ namespace /* private */ std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(path.getLength() + 1); //GetShortPathNameW only works if the file can be found! const DWORD len = GetShortPathNameW( - path.getStr(), &vec[0], path.getLength() + 1); + reinterpret_cast<LPCWSTR>(path.getStr()), reinterpret_cast<LPWSTR>(&vec[0]), path.getLength() + 1); if (!len && GetLastError() == ERROR_FILE_NOT_FOUND && extension.getLength()) @@ -323,7 +323,7 @@ namespace /* private */ std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec2( extPath.getLength() + 1); const DWORD len2 = GetShortPathNameW( - extPath.getStr(), &vec2[0], extPath.getLength() + 1); + reinterpret_cast<LPCWSTR>(extPath.getStr()), reinterpret_cast<LPWSTR>(&vec2[0]), extPath.getLength() + 1); ret = rtl::OUString(&vec2[0], len2); } else diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index a9c08c2884fd..2b97ede1ba55 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -175,6 +175,8 @@ #define SC_UNONAME_AUTOPRINT "AutomaticPrintArea" #define SC_UNONAME_TABCOLOR "TabColor" +#define SC_UNONAME_VISFLAG "VisibleFlag" + // LinkTarget #define SC_UNO_LINKDISPBIT "LinkDisplayBitmap" #define SC_UNO_LINKDISPNAME "LinkDisplayName" diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 4ca9b14d8f5d..9ad38c171489 100755 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -214,6 +214,7 @@ void ScDocument::UpdateDrawDefaults() { SfxItemPool& rDrawPool = pDrawLayer->GetItemPool(); rDrawPool.SetPoolDefaultItem( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) ); + pDrawLayer->SetDrawingLayerPoolDefaults(); } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 68cbef5e8e94..aff31a956cae 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5308,6 +5308,7 @@ ScRowBreakIterator* ScDocument::GetRowBreakIterator(SCTAB nTab) const void ScDocument::EnableUndo( bool bVal ) { GetUndoManager()->EnableUndo(bVal); + if( pDrawLayer ) pDrawLayer->EnableUndo(bVal); mbUndoEnabled = bVal; } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index c3f8edbbc265..80cac5616f33 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -283,6 +283,10 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) : if ( pHitOutlinerPool ) pHitOutlinerPool->SetPoolDefaultItem(SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT )); // 12Pt + // initial undo mode as in Calc document + if( pDoc ) + EnableUndo( pDoc->IsUndoEnabled() ); + // URL-Buttons haben keinen Handler mehr, machen alles selber if( !nInst++ ) @@ -1119,6 +1123,15 @@ void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips ) if (!bAdjustEnabled) return; + SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab)); + DBG_ASSERT(pPage,"Page not found"); + if (!pPage) + return; + + // for an empty page, there's no need to calculate the row heights + if (!pPage->GetObjCount()) + return; + Rectangle aRect; Point aTopLeft; @@ -1148,6 +1161,15 @@ sal_Bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndR if ( !pDoc ) return sal_False; + SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab)); + DBG_ASSERT(pPage,"Page not found"); + if (!pPage) + return sal_False; + + // for an empty page, there's no need to calculate the row heights + if (!pPage->GetObjCount()) + return sal_False; + Rectangle aTestRect; aTestRect.Top() += pDoc->GetRowHeight( 0, nStartRow-1, nTab); @@ -1170,11 +1192,6 @@ sal_Bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndR if ( bNegativePage ) MirrorRectRTL( aTestRect ); - SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab)); - DBG_ASSERT(pPage,"Page nicht gefunden"); - if (!pPage) - return sal_False; - sal_Bool bFound = sal_False; Rectangle aObjRect; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index be7cab80508b..31b9c0fb9ed6 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -337,6 +337,8 @@ sal_Bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n } } + IncRecalcLevel(); // #i116460# avoid problems with Excel files + SCROW nRngStart = 0; SCROW nRngEnd = 0; sal_uInt16 nLast = 0; @@ -391,6 +393,8 @@ sal_Bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n if (nLast) bChanged |= SetRowHeightRange( nRngStart, nRngEnd, nLast, nPPTX, nPPTY ); + DecRecalcLevel(); // #i116460# avoid problems with Excel files + delete[] pHeight; if ( pProgress != pOuterProgress ) delete pProgress; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index e24a4ff4158e..aff7a6ab21aa 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -377,14 +377,13 @@ const sal_Unicode* ScRange::Parse_XL_Header( } ++p; - // 1-based, sequence starts with an empty element. - if (pExternalLinks && pExternalLinks->getLength() > 1) + if (pExternalLinks && pExternalLinks->hasElements()) { // A numeric "document name" is an index into the sequence. if (CharClass::isAsciiNumeric( rExternDocName)) { sal_Int32 i = rExternDocName.ToInt32(); - if (i <= 0 || i >= pExternalLinks->getLength()) + if (i < 0 || i >= pExternalLinks->getLength()) return start; const sheet::ExternalLinkInfo & rInfo = (*pExternalLinks)[i]; switch (rInfo.Type) @@ -400,6 +399,11 @@ const sal_Unicode* ScRange::Parse_XL_Header( rExternDocName = aStr; } break; + case sheet::ExternalLinkType::SELF : + return start; // ??? + case sheet::ExternalLinkType::SPECIAL : + // silently return nothing (do not assert), caller has to handle this + return NULL; default: DBG_ERROR2( "ScRange::Parse_XL_Header: unhandled ExternalLinkType %d for index %d", rInfo.Type, i); diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 575093f48d2a..b469ea5de49c 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -278,6 +278,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) { ScDocument& rDoc = GetDoc(); + rDoc.IncSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows // hide the columns for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol ) @@ -304,7 +305,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) if( ::get_flag( maRowFlags[ nScRow ], EXC_COLROW_HIDDEN ) ) { // hide the row - rDoc.ShowRow( nScRow, nScTab, sal_False ); + rDoc.SetRowHidden(nScRow, nScRow, nScTab, true); // #i116460# SetRowHidden instead of ShowRow // #i38093# rows hidden by filter need extra flag if( (nFirstFilterScRow <= nScRow) && (nScRow <= nLastFilterScRow) ) rDoc.SetRowFiltered(nScRow, nScRow, nScTab, true); @@ -314,5 +315,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // #i47438# if default row format is hidden, hide remaining rows if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) ) rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, sal_False ); + + rDoc.DecSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows } diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 6aab83a050f7..1a171466f53a 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -212,7 +212,7 @@ sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit ) return EXC_CHDATERANGE_DAYS; } -bool lclConvertTimeInterval( sal_uInt16 rnValue, sal_uInt16& rnTimeUnit, const Any& rAny ) +bool lclConvertTimeInterval( sal_uInt16& rnValue, sal_uInt16& rnTimeUnit, const Any& rAny ) { cssc::TimeInterval aInterval; bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny ); diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx index 5e2503f94e15..f358fc4a29ab 100644 --- a/sc/source/ui/docshell/olinefun.cxx +++ b/sc/source/ui/docshell/olinefun.cxx @@ -392,6 +392,8 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel ) ); } + pDoc->IncSizeRecalcLevel( nTab ); + ScSubOutlineIterator aIter( pArray ); // alle Eintraege ScOutlineEntry* pEntry; while ((pEntry=aIter.GetNext()) != NULL) @@ -420,11 +422,19 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 if ( bColumns ) pDoc->ShowCol( static_cast<SCCOL>(i), nTab, bShow ); else - if ( !bShow || !pDoc->RowFiltered( i,nTab ) ) - pDoc->ShowRow( i, nTab, bShow ); + { + // show several rows together, don't show filtered rows + SCROW nFilterEnd = i; + bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd ); + nFilterEnd = std::min( nThisEnd, nFilterEnd ); + if ( !bShow || !bFiltered ) + pDoc->ShowRows( i, nFilterEnd, nTab, bShow ); + i = nFilterEnd; + } } } + pDoc->DecSizeRecalcLevel( nTab ); pDoc->UpdatePageBreaks( nTab ); if (bPaint) @@ -478,6 +488,8 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, sal_True ) ); } + pDoc->IncSizeRecalcLevel( nTab ); + // Spalten nMin=MAXCOL; @@ -518,9 +530,17 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b } } for ( i=nMin; i<=nMax; i++ ) - if ( !pDoc->RowFiltered( i,nTab ) ) // weggefilterte nicht einblenden - pDoc->ShowRow( i, nTab, sal_True ); + { + // show several rows together, don't show filtered rows + SCROW nFilterEnd = i; + bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd ); + nFilterEnd = std::min( nMax, nFilterEnd ); + if ( !bFiltered ) + pDoc->ShowRows( i, nFilterEnd, nTab, sal_True ); + i = nFilterEnd; + } + pDoc->DecSizeRecalcLevel( nTab ); pDoc->UpdatePageBreaks( nTab ); rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP ); @@ -590,6 +610,8 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, sal_False ) ); } + pDoc->IncSizeRecalcLevel( nTab ); + // Spalten nCount = pColArray->GetCount(nColLevel); @@ -616,6 +638,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b HideOutline( nTab, sal_False, nRowLevel, i, sal_False, sal_False, bApi ); } + pDoc->DecSizeRecalcLevel( nTab ); pDoc->UpdatePageBreaks( nTab ); rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP ); @@ -671,6 +694,8 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 //! HideCursor(); + pDoc->IncSizeRecalcLevel( nTab ); + pEntry->SetHidden(sal_False); SCCOLROW i; for ( i = nStart; i <= nEnd; i++ ) @@ -678,8 +703,15 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 if ( bColumns ) pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_True ); else - if ( !pDoc->RowFiltered( i,nTab ) ) // weggefilterte nicht einblenden - pDoc->ShowRow( i, nTab, sal_True ); + { + // show several rows together, don't show filtered rows + SCROW nFilterEnd = i; + bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd ); + nFilterEnd = std::min( nEnd, nFilterEnd ); + if ( !bFiltered ) + pDoc->ShowRows( i, nFilterEnd, nTab, sal_True ); + i = nFilterEnd; + } } ScSubOutlineIterator aIter( pArray, nLevel, nEntry ); @@ -689,18 +721,17 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 { SCCOLROW nSubStart = pEntry->GetStart(); SCCOLROW nSubEnd = pEntry->GetEnd(); - for ( i = nSubStart; i <= nSubEnd; i++ ) - { - if ( bColumns ) + if ( bColumns ) + for ( i = nSubStart; i <= nSubEnd; i++ ) pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_False ); - else - pDoc->ShowRow( i, nTab, sal_False ); - } + else + pDoc->ShowRows( nSubStart, nSubEnd, nTab, sal_False ); } } pArray->SetVisibleBelow( nLevel, nEntry, sal_True, sal_True ); + pDoc->DecSizeRecalcLevel( nTab ); pDoc->InvalidatePageBreaks(nTab); pDoc->UpdatePageBreaks( nTab ); @@ -755,18 +786,19 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 //! HideCursor(); + pDoc->IncSizeRecalcLevel( nTab ); + pEntry->SetHidden(sal_True); SCCOLROW i; - for ( i = nStart; i <= nEnd; i++ ) - { - if ( bColumns ) + if ( bColumns ) + for ( i = nStart; i <= nEnd; i++ ) pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_False ); - else - pDoc->ShowRow( i, nTab, sal_False ); - } + else + pDoc->ShowRows( nStart, nEnd, nTab, sal_False ); pArray->SetVisibleBelow( nLevel, nEntry, sal_False ); + pDoc->DecSizeRecalcLevel( nTab ); pDoc->InvalidatePageBreaks(nTab); pDoc->UpdatePageBreaks( nTab ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index f5a94df0bfba..8165d92888e4 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1098,6 +1098,11 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); + /* #164410# Use double allocation, which will speed up import filters + using XCellRangeData::setDataArray() significantly. */ + bool bDoubleAlloc = ScColumn::bDoubleAlloc; + ScColumn::bDoubleAlloc = true; + sal_Bool bError = sal_False; SCROW nDocRow = nStartRow; for (long nRow=0; nRow<nRows; nRow++) @@ -1173,6 +1178,7 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, ++nDocRow; } + ScColumn::bDoubleAlloc = bDoubleAlloc; sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab ); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index daed78e09e82..0d39e944b194 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3309,6 +3309,12 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True ); // SC_SIZE_DIRECT with size 0: hide } + else if ( aNameString.EqualsAscii( SC_UNONAME_VISFLAG ) ) + { + // #i116460# Shortcut to only set the flag, without drawing layer update etc. + // Should only be used from import filters. + pDoc->SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue )); + } else if ( aNameString.EqualsAscii( SC_UNONAME_CELLFILT ) ) { //! undo etc. diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index fa278e527d91..d7d0ae733ab7 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -281,8 +281,8 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException ) sal_Int32 nCursorX = pTabView->GetCurX(); sal_Int32 nCursorY = pTabView->GetCurY(); - uno::Reference< XHelperInterface > xParent( excel::getUnoSheetModuleObj( xRange ), uno::UNO_QUERY_THROW ); - return new ScVbaRange( xParent, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) ); + // #i117392# excel::getUnoSheetModuleObj() may return null in documents without global VBA mode enabled + return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) ); } uno::Any SAL_CALL diff --git a/scripting/source/dlgprov/dlgprov.component b/scripting/source/dlgprov/dlgprov.component index f7ceed336cf6..ba58de62fde4 100644 --- a/scripting/source/dlgprov/dlgprov.component +++ b/scripting/source/dlgprov/dlgprov.component @@ -33,4 +33,7 @@ <service name="com.sun.star.awt.DialogProvider"/> <service name="com.sun.star.awt.DialogProvider2"/> </implementation> + <implementation name="com.sun.star.comp.scripting.DialogModelProvider"> + <service name="com.sun.star.awt.UnoControlDialogModelProvider"/> + </implementation> </component> diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 8a577ab03e1c..e80647cb1068 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -75,7 +75,7 @@ namespace comp_DialogModelProvider ::rtl::OUString SAL_CALL _getImplementationName() { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogModelProvider")); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.scripting.DialogModelProvider")); } uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames() diff --git a/sd/inc/EffectMigration.hxx b/sd/inc/EffectMigration.hxx index eb173f495de2..3dd0e0dfe8ad 100644..100755 --- a/sd/inc/EffectMigration.hxx +++ b/sd/inc/EffectMigration.hxx @@ -36,6 +36,7 @@ class SdPage; class SvxShape; class SdAnimationInfo; class SdrObject; +class SdrPathObj; namespace sd { @@ -76,6 +77,8 @@ public: static void UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo* pInfo ); static ::rtl::OUString GetSoundFile( SvxShape* pShape ); static sal_Bool GetSoundOn( SvxShape* pShape ); + + static void SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj ); }; } // end of namespace sd diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 33b9c233909b..9ce0084ddbd3 100755 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -72,6 +72,8 @@ #include <cppuhelper/implbase1.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <svx/sdr/contact/viewcontact.hxx> #include <svx/svdopath.hxx> #include <svx/svdpage.hxx> #include <svx/unoapi.hxx> @@ -1738,7 +1740,19 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() ); if( pObj ) { - const Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); + Rectangle aBoundRect(0,0,0,0); + + const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(pObj->GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::geometry::ViewInformation2D aViewInformation2D; + const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D)); + + if(!aRange.isEmpty()) + { + aBoundRect = Rectangle( + (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()), + (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY())); + } + const Point aCenter( aBoundRect.Center() ); xPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index 4d29833e637a..c512ab084da9 100755 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -645,7 +645,7 @@ Reference< XAnimationNode > CustomAnimationPresets::getRandomPreset( sal_Int16 n sal_Int32 nCategory = (rand() * pCategoryList->size() / RAND_MAX); PresetCategoryPtr pCategory = (*pCategoryList)[nCategory]; - if( pCategory.get() && pCategory->maEffects.size() ) + if( pCategory.get() && !pCategory->maEffects.empty() ) { sal_Int32 nDescriptor = (rand() * pCategory->maEffects.size() / RAND_MAX); CustomAnimationPresetPtr pPreset = pCategory->maEffects[nDescriptor]; @@ -654,7 +654,7 @@ Reference< XAnimationNode > CustomAnimationPresets::getRandomPreset( sal_Int16 n UStringList aSubTypes = pPreset->getSubTypes(); OUString aSubType; - if( aSubTypes.size() ) + if( !aSubTypes.empty() ) { sal_Int32 nSubType = (rand() * aSubTypes.size() / RAND_MAX); aSubType = aSubTypes[nSubType]; diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index cbb9a1019baf..26d032d8bb6f 100644..100755 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/presentation/ParagraphTarget.hpp> #include <svx/unoshape.hxx> #include <svx/svdotext.hxx> +#include <svx/svdopath.hxx> #include "drawdoc.hxx" #include "sdpage.hxx" #include <CustomAnimationPreset.hxx> @@ -1342,3 +1343,28 @@ sal_Bool EffectMigration::GetSoundOn( SvxShape* pShape ) return GetSoundFile( pShape ).getLength() != 0; } +// -------------------------------------------------------------------- + +void EffectMigration::SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj ) +{ + if( pShape && pPathObj ) + { + SdrObject* pObj = pShape->GetSdrObject(); + + if( pObj ) + { + //sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence(); + + const Reference< XShape > xShape( pShape ); + SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : 0 ); + if( pPage ) + { + boost::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() ); + if( pMainSequence.get() ) + CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, makeAny( xShape ), -1.0 ) ); + } + } + } +} + + diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index a2abfd199fe9..5ab07b5f82e4 100755 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -1099,32 +1099,33 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, switch(i) { case 0: - case 1: { nFontSize = 32; nFirstLineOffset = -900; } break; - case 2: + case 1: { - nFontSize = 28; - nFirstLineOffset = -800; aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150 aNumberFormat.SetBulletRelSize(75); + nFontSize = 32; + nFirstLineOffset = -900; } break; - case 3: + case 2: { - nFontSize = 24; + nFontSize = 28; + nFirstLineOffset = -800; } break; - case 4: + case 3: { - aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150 + aNumberFormat.SetBulletChar( 0x2013 ); // StarBats: 0xF000 + 150 aNumberFormat.SetBulletRelSize(75); + nFontSize = 24; } break; } diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index 6c766ed19fe3..5abc7eed6c43 100755 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -59,8 +59,6 @@ #define PUB_HIGHRES_WIDTH 1024 #define PUB_HIGHRES_HEIGHT 768 -#define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons"; - class List; class SfxProgress; class SdrOutliner; diff --git a/sd/source/ui/accessibility/AccessibleTreeNode.cxx b/sd/source/ui/accessibility/AccessibleTreeNode.cxx index 71e4c74dd70f..28ef807b0ebc 100755 --- a/sd/source/ui/accessibility/AccessibleTreeNode.cxx +++ b/sd/source/ui/accessibility/AccessibleTreeNode.cxx @@ -134,8 +134,11 @@ void SAL_CALL AccessibleTreeNode::disposing (void) // probably are by now more or less dead and we must not call them to // unregister. - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); - mnClientId = 0; + if (mnClientId != 0) + { + comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); + mnClientId = 0; + } } @@ -361,9 +364,10 @@ void SAL_CALL AccessibleTreeNode::addEventListener( } else { - if ( ! mnClientId) + if (mnClientId == 0) mnClientId = comphelper::AccessibleEventNotifier::registerClient(); - comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); + if (mnClientId != 0) + comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener); } } } @@ -387,8 +391,11 @@ void SAL_CALL AccessibleTreeNode::removeEventListener( // -> 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 - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; + if (mnClientId != 0) + { + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; + } } } } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 73d595a8eb1e..b83285647256 100755 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -2044,7 +2044,7 @@ void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTarge void CustomAnimationPane::onRemove() { - if( maListSelection.size() ) + if( !maListSelection.empty() ) { addUndo(); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index cea71438ee4f..dc10b355de27 100755 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -48,6 +48,8 @@ #include <unotools/syslocale.hxx> #include <unotools/saveopt.hxx> +#include <tools/datetime.hxx> + #include <sfx2/imagemgr.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> @@ -152,11 +154,8 @@ static SfxDispatcher* getDispatcher( ViewShellBase& rBase ) com::sun::star::util::DateTime getCurrentDateTime() { - TimeValue osltime; - osl_getSystemTime( &osltime ); - oslDateTime osldt; - osl_getDateTimeFromTimeValue( &osltime, &osldt ); - return com::sun::star::util::DateTime( 0, osldt.Seconds, osldt.Minutes, osldt.Hours, osldt.Day, osldt.Month, osldt.Year ); + DateTime aCurrentDate; + return com::sun::star::util::DateTime( 0, aCurrentDate.GetSec(), aCurrentDate.GetMin(), aCurrentDate.GetHour(), aCurrentDate.GetDay(), aCurrentDate.GetMonth(), aCurrentDate.GetYear() ); } OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation ) diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 48a1f35436e9..475f3d489bfd 100755 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -123,6 +123,7 @@ SdTransferable::SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, , mbPageTransferable( sal_False ) , mbPageTransferablePersistent( sal_False ) , mbIsUnoObj( false ) +, maUserData() { if( mpSourceDoc ) StartListening( *mpSourceDoc ); @@ -345,7 +346,9 @@ void SdTransferable::CreateData() if( 1 == mpSdDrawDocumentIntern->GetPageCount() ) { - Point aOrigin( ( maVisArea = mpSdViewIntern->GetAllMarkedRect() ).TopLeft() ); + // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get + // fat lines correctly + Point aOrigin( ( maVisArea = mpSdViewIntern->GetAllMarkedBoundRect() ).TopLeft() ); Size aVector( -aOrigin.X(), -aOrigin.Y() ); for( sal_uLong nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; nObj++ ) @@ -798,6 +801,52 @@ sal_Int64 SAL_CALL SdTransferable::getSomething( const ::com::sun::star::uno::Se return nRet; } + + + +SdDrawDocument* SdTransferable::GetSourceDoc (void) const +{ + return mpSourceDoc; +} + + + + +void SdTransferable::AddUserData (const ::boost::shared_ptr<UserData>& rpData) +{ + maUserData.push_back(rpData); +} + + + + +void SdTransferable::RemoveUserData (const ::boost::shared_ptr<UserData>& rpData) +{ + maUserData.erase(::std::find(maUserData.begin(), maUserData.end(), rpData)); +} + + + + +sal_Int32 SdTransferable::GetUserDataCount (void) const +{ + return maUserData.size(); +} + + + + +::boost::shared_ptr<SdTransferable::UserData> SdTransferable::GetUserData (const sal_Int32 nIndex) const +{ + if (nIndex>=0 && nIndex<sal_Int32(maUserData.size())) + return maUserData[nIndex]; + else + return ::boost::shared_ptr<UserData>(); +} + + + + // ----------------------------------------------------------------------------- const ::com::sun::star::uno::Sequence< sal_Int8 >& SdTransferable::getUnoTunnelId() diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx index aa93635c4032..2121ffbe2a50 100755 --- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -108,7 +108,7 @@ void SpellDialogChildWindow::InvalidateSpellDialog (void) // Close the spell check dialog when there are no more sentences to // check. - if (aResult.size() == 0) + if (aResult.empty()) { SfxBoolItem aItem (SID_SPELL_DIALOG, sal_False); GetBindings().GetDispatcher()->Execute( diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 074ab49d97bb..3e56f747766f 100755 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -907,7 +907,7 @@ void AssistentDlgImpl::TemplateScanDone ( // HACK! presnt directory is always initially selected. // We have to look at the first entry to get a URL. - if (pDir->maEntries.size() > 0) + if (!pDir->maEntries.empty() ) { TemplateEntry* pEntry = pDir->maEntries.front(); if (pEntry != NULL) @@ -932,7 +932,7 @@ void AssistentDlgImpl::TemplateScanDone ( // HACK! layout directory is always initially selected. // We have to look at the first entry to get a URL. - if (pDir->maEntries.size() > 0) + if (!pDir->maEntries.empty() ) { TemplateEntry* pEntry = pDir->maEntries.front(); if (pEntry != NULL) diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx index aa44dd340a00..51f49bc03032 100755..100644 --- a/sd/source/ui/dlg/present.cxx +++ b/sd/source/ui/dlg/present.cxx @@ -207,38 +207,60 @@ void SdStartPresentationDlg::InitMonitorSettings() else { sal_Bool bMultiscreen = false; - sal_Int32 nPrimaryIndex = 0; + sal_Int32 nDefaultDisplay (0); Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY ); if( xMonProps.is() ) try { const OUString sPropName1( RTL_CONSTASCII_USTRINGPARAM( "MultiDisplay" ) ); xMonProps->getPropertyValue( sPropName1 ) >>= bMultiscreen; const OUString sPropName2( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); - xMonProps->getPropertyValue( sPropName2 ) >>= nPrimaryIndex; + xMonProps->getPropertyValue( sPropName2 ) >>= nDefaultDisplay; } catch( Exception& ) { } + sal_Int32 nSelectedIndex (-1); + sal_Int32 nDefaultDisplayIndex (-1); + const sal_Int32 nDefaultSelectedDisplay ( + ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue()); const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ ) { - String aName( nDisplay == nPrimaryIndex ? msPrimaryMonitor : msMonitor ); + String aName( nDisplay == nDefaultDisplay ? msPrimaryMonitor : msMonitor ); const String aNumber( String::CreateFromInt32( nDisplay + 1 ) ); aName.SearchAndReplace( sPlaceHolder, aNumber ); maLBMonitor.InsertEntry( aName ); + + // Store display index together with name. + const sal_uInt32 nEntryIndex (maLBMonitor.GetEntryCount()-1); + maLBMonitor.SetEntryData(nEntryIndex, (void*)nDisplay); + + // Remember the index of the default selection. + if (nDefaultSelectedDisplay == nDisplay) + nSelectedIndex = nEntryIndex; + + // Remember index of the default display. + if (nDisplay == nDefaultDisplay) + nDefaultDisplayIndex = nEntryIndex; } if( !bMultiscreen ) + { maLBMonitor.InsertEntry( msAllMonitors ); + const sal_uInt32 nEntryIndex (maLBMonitor.GetEntryCount()-1); + maLBMonitor.SetEntryData(nEntryIndex, (void*)-1); + if (nDefaultSelectedDisplay == -1) + nSelectedIndex = nEntryIndex; + } - sal_Int32 nSelected = ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue(); - if( nSelected <= 0 ) - nSelected = nPrimaryIndex; - else - nSelected--; + if (nSelectedIndex < 0) + if (nDefaultSelectedDisplay < 0) + nSelectedIndex = 0; + else + nSelectedIndex = nDefaultDisplayIndex; - maLBMonitor.SelectEntryPos( (sal_uInt16)nSelected ); + maLBMonitor.SelectEntryPos((sal_uInt16)nSelectedIndex); } } catch( Exception& ) @@ -268,7 +290,7 @@ void SdStartPresentationDlg::GetAttr( SfxItemSet& rAttr ) sal_uInt16 nPos = maLBMonitor.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) - rAttr.Put( SfxInt32Item ( ATTR_PRESENT_DISPLAY, nPos + 1 ) ); + rAttr.Put( SfxInt32Item ( ATTR_PRESENT_DISPLAY, (sal_Int32)(sal_IntPtr)maLBMonitor.GetEntryData(nPos)) ); nPos = aLbCustomshow.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 263f221332d6..c8c794a40041 100755 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -53,11 +53,16 @@ #include "strings.hrc" #endif #include "res_bmp.hrc" +#include "ViewShell.hxx" +#include "DrawController.hxx" +#include "ViewShellBase.hxx" #include <com/sun/star/embed/XEmbedPersist.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> #include <svtools/embedtransfer.hxx> +#include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> -#include <ViewShell.hxx> using namespace com::sun::star; @@ -153,6 +158,7 @@ sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star: void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction ) { mrParent.OnDragFinished( nDropAction ); + SdTransferable::DragFinished(nDropAction); } // ----------------------------------------------------------------------------- @@ -234,6 +240,9 @@ sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void) return mnListBoxDropFormatId; } + + + /************************************************************************* |* |* Ctor1 SdPageObjsTLB @@ -1049,6 +1058,11 @@ void SdPageObjsTLB::DoDrag() if( eDragType == NAVIGATOR_DRAGTYPE_LINK ) nDNDActions = DND_ACTION_LINK; // #93240# Either COPY *or* LINK, never both! + else if (mpDoc->GetSdPageCount(PK_STANDARD) == 1) + { + // Can not move away the last slide in a document. + nDNDActions = DND_ACTION_COPY; + } SvTreeListBox::ReleaseMouse(); @@ -1066,16 +1080,15 @@ void SdPageObjsTLB::DoDrag() // object is destroyed by internal reference mechanism SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable( *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData); - OSL_TRACE("created new SdPageObjsTransferable at %x", pTransferable); // Get the view. - sd::View* pView = NULL; - if (pDocShell != NULL) + ::sd::ViewShell* pViewShell = GetViewShellForDocShell(*pDocShell); + if (pViewShell == NULL) { - ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); - if (pViewShell != NULL) - pView = pViewShell->GetView(); + OSL_ASSERT(pViewShell!=NULL); + return; } + sd::View* pView = pViewShell->GetView(); if (pView == NULL) { OSL_ASSERT(pView!=NULL); @@ -1086,27 +1099,32 @@ void SdPageObjsTLB::DoDrag() void* pUserData = GetCurEntry()->GetUserData(); if (pUserData != NULL && pUserData != (void*)1) pObject = reinterpret_cast<SdrObject*>(pUserData); - if (pObject == NULL) - return; + if (pObject != NULL) + { + // For shapes without a user supplied name (the automatically + // created name does not count), a different drag and drop technique + // is used. + if (GetObjectName(pObject, false).Len() == 0) + { + AddShapeToTransferable(*pTransferable, *pObject); + pTransferable->SetView(pView); + SD_MOD()->pTransferDrag = pTransferable; + } - // For shapes without a user supplied name (the automatically - // created name does not count), a different drag and drop technique - // is used. - if (GetObjectName(pObject, false).Len() == 0) + // Unnamed shapes have to be selected to be recognized by the + // current drop implementation. In order to have a consistent + // behaviour for all shapes, every shape that is to be dragged is + // selected first. + SdrPageView* pPageView = pView->GetSdrPageView(); + pView->UnmarkAllObj(pPageView); + pView->MarkObj(pObject, pPageView); + } + else { - AddShapeToTransferable(*pTransferable, *pObject); pTransferable->SetView(pView); SD_MOD()->pTransferDrag = pTransferable; } - // Unnamed shapes have to be selected to be recognized by the - // current drop implementation. In order to have a consistent - // behaviour for all shapes, every shape that is to be dragged is - // selected first. - SdrPageView* pPageView = pView->GetSdrPageView(); - pView->UnmarkAllObj(pPageView); - pView->MarkObj(pObject, pPageView); - pTransferable->StartDrag( this, nDNDActions ); } } @@ -1337,8 +1355,6 @@ SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation) if (pEntry == NULL) return NULL; - OSL_TRACE("entry is %s", - ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr()); if (GetParent(pEntry) == NULL) { // Use page entry as insertion position. @@ -1361,8 +1377,6 @@ SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation) else break; } - OSL_TRACE("returning %s", - ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr()); } return pEntry; @@ -1441,6 +1455,66 @@ void SdPageObjsTLB::AddShapeToTransferable ( +::sd::ViewShell* SdPageObjsTLB::GetViewShellForDocShell (::sd::DrawDocShell& rDocShell) +{ + { + ::sd::ViewShell* pViewShell = rDocShell.GetViewShell(); + if (pViewShell != NULL) + return pViewShell; + } + + try + { + // Get a component enumeration from the desktop and search it for documents. + uno::Reference<lang::XMultiServiceFactory> xFactory ( + ::comphelper::getProcessServiceFactory ()); + if ( ! xFactory.is()) + return NULL; + + uno::Reference<frame::XDesktop> xDesktop (xFactory->createInstance ( + ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), uno::UNO_QUERY); + if ( ! xDesktop.is()) + return NULL; + + uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, uno::UNO_QUERY); + if ( ! xFrameSupplier.is()) + return NULL; + + uno::Reference<container::XIndexAccess> xFrameAccess (xFrameSupplier->getFrames(), uno::UNO_QUERY); + if ( ! xFrameAccess.is()) + return NULL; + + for (sal_Int32 nIndex=0,nCount=xFrameAccess->getCount(); nIndex<nCount; ++nIndex) + { + uno::Reference<frame::XFrame> xFrame; + if ( ! (xFrameAccess->getByIndex(nIndex) >>= xFrame)) + continue; + + ::sd::DrawController* pController = dynamic_cast<sd::DrawController*>(xFrame->getController().get()); + if (pController == NULL) + continue; + ::sd::ViewShellBase* pBase = pController->GetViewShellBase(); + if (pBase == NULL) + continue; + if (pBase->GetDocShell() != &rDocShell) + continue; + + const ::boost::shared_ptr<sd::ViewShell> pViewShell (pBase->GetMainViewShell()); + if (pViewShell) + return pViewShell.get(); + } + } + catch (uno::Exception e) + { + // When there is an exception then simply use the default value of + // bIsEnabled and disable the controls. + } + return NULL; +} + + + + //===== IconProvider ========================================================== SdPageObjsTLB::IconProvider::IconProvider (void) diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index f1e77526d7e3..47e8f62c6468 100755 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -298,6 +298,7 @@ sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::s if (bRet) { + mpDoc->SetDrawingLayerPoolDefaults(); if( !mbSdDataObj ) mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling // NewOrLoadCompleted(NEW_LOADED) in diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx index ff167f07520a..6056d434068c 100755 --- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx @@ -184,14 +184,14 @@ void ConfigurationControllerBroadcaster::DisposeAndClear (void) { lang::EventObject aEvent; aEvent.Source = mxConfigurationController; - while (maListenerMap.size() > 0) + while (!maListenerMap.empty()) { ListenerMap::iterator iMap (maListenerMap.begin()); if (iMap == maListenerMap.end()) break; // When the first vector is empty then remove it from the map. - if (iMap->second.size() == 0) + if (iMap->second.empty()) { maListenerMap.erase(iMap); continue; diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index 4ab361a9490d..78d1e394c94a 100755 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -256,7 +256,7 @@ void ConfigurationUpdater::CleanRequestedConfiguration (void) // Request the deactivation of pure anchors that have no child. vector<Reference<XResourceId> > aResourcesToDeactivate; CheckPureAnchors(mxRequestedConfiguration, aResourcesToDeactivate); - if (aResourcesToDeactivate.size() > 0) + if (!aResourcesToDeactivate.empty() ) { Reference<XConfigurationController> xCC ( mxControllerManager->getConfigurationController()); @@ -327,7 +327,7 @@ void ConfigurationUpdater::UpdateCore (const ConfigurationClassifier& rClassifie // Deactivate pure anchors that have no child. vector<Reference<XResourceId> > aResourcesToDeactivate; CheckPureAnchors(mxCurrentConfiguration, aResourcesToDeactivate); - if (aResourcesToDeactivate.size() > 0) + if (!aResourcesToDeactivate.empty() ) mpResourceManager->DeactivateResources(aResourcesToDeactivate, mxCurrentConfiguration); } catch(RuntimeException) diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx index 15d7c3a6f4ec..25be1d1dfaf2 100755 --- a/sd/source/ui/framework/configuration/ResourceId.cxx +++ b/sd/source/ui/framework/configuration/ResourceId.cxx @@ -183,7 +183,7 @@ OUString SAL_CALL ResourceId::getResourceURL (void) throw(com::sun::star::uno::RuntimeException) { - if (maResourceURLs.size() > 0) + if (!maResourceURLs.empty()) return maResourceURLs[0]; else return OUString(); @@ -200,7 +200,7 @@ util::URL SAL_CALL return *mpURL; Reference<util::XURLTransformer> xURLTransformer (mxURLTransformerWeak); - if (xURLTransformer.is() && maResourceURLs.size() > 0) + if (xURLTransformer.is() && !maResourceURLs.empty() ) { mpURL.reset(new util::URL); mpURL->Complete = maResourceURLs[0]; @@ -209,7 +209,7 @@ util::URL SAL_CALL } util::URL aURL; - if (maResourceURLs.size() > 0) + if (!maResourceURLs.empty()) aURL.Complete = maResourceURLs[0]; return aURL; } @@ -268,7 +268,7 @@ OUString SAL_CALL ResourceId::getResourceTypePrefix (void) throw (RuntimeException) { - if (maResourceURLs.size() > 0) + if (!maResourceURLs.empty() ) { // Return the "private:resource/<type>/" prefix. @@ -298,7 +298,7 @@ sal_Int16 SAL_CALL if ( ! rxResourceId.is()) { // The empty reference is interpreted as empty resource id object. - if (maResourceURLs.size() > 0) + if (!maResourceURLs.empty()) nResult = +1; else nResult = 0; @@ -610,7 +610,7 @@ void ResourceId::ParseResourceURL (void) Reference<XInterface>(xURLTransformer,UNO_QUERY)); } - if (xURLTransformer.is() && maResourceURLs.size() > 0) + if (xURLTransformer.is() && !maResourceURLs.empty() ) { mpURL.reset(new util::URL); mpURL->Complete = maResourceURLs[0]; diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 95c2833a2d12..de8bf54ab514 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -524,7 +524,7 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r if (xResource.is()) { static ::std::vector<Reference<XResourceId> > maCacheableResources; - if (maCacheableResources.size() == 0) + if (maCacheableResources.empty() ) { ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*mpBase)); diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 4d068e1fde90..d8736d9b8ccb 100755 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -38,20 +38,14 @@ #include <svx/svxids.hrc> #include <svx/dialogs.hrc> #include <svl/itempool.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <sfx2/request.hxx> #include <svl/stritem.hxx> #include <vcl/prntypes.hxx> #include <svl/style.hxx> #include <stlsheet.hxx> -#ifndef _SVX_SVDORECT_HXX #include <svx/svdorect.hxx> -#endif -#ifndef _SVX_SVDUNDO_HXX #include <svx/svdundo.hxx> -#endif #include <editeng/eeitem.hxx> #include <editeng/frmdiritem.hxx> #include <svx/xbtmpit.hxx> @@ -59,6 +53,7 @@ #include <svl/itempool.hxx> #include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> +#include <svx/sdr/properties/properties.hxx> #include "glob.hrc" #include <editeng/shaditem.hxx> @@ -393,7 +388,11 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) if(!mpPage->IsMasterPage()) { // on normal pages, switch off fill attribute usage - mpPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE)); + SdrPageProperties& rPageProperties = mpPage->getSdrPageProperties(); + rPageProperties.ClearItem( XATTR_FILLBITMAP ); + rPageProperties.ClearItem( XATTR_FILLGRADIENT ); + rPageProperties.ClearItem( XATTR_FILLHATCH ); + rPageProperties.PutItem(XFillStyleItem(XFILL_NONE)); } } } @@ -409,6 +408,7 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyleSheet, &(*pTempSet.get())); mpDocSh->GetUndoManager()->AddUndoAction(pAction); pStyleSheet->GetItemSet().Put( *(pTempSet.get()) ); + sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() ); pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); } else if( bSetToAllPages ) @@ -430,6 +430,7 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyle, &(*pTempSet.get())); pUndoGroup->AddAction(pAction); pStyle->GetItemSet().Put( *(pTempSet.get()) ); + sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() ); pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); } @@ -444,7 +445,13 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) { SdBackgroundObjUndoAction *pBackgroundObjUndoAction = new SdBackgroundObjUndoAction(*mpDoc, *pPage, rFillAttributes); pUndoGroup->AddAction(pBackgroundObjUndoAction); - pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE)); + + SdrPageProperties& rPageProperties = pPage->getSdrPageProperties(); + rPageProperties.ClearItem( XATTR_FILLBITMAP ); + rPageProperties.ClearItem( XATTR_FILLGRADIENT ); + rPageProperties.ClearItem( XATTR_FILLHATCH ); + rPageProperties.PutItem(XFillStyleItem(XFILL_NONE)); + pPage->ActionChanged(); } } @@ -606,8 +613,10 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) delete mpBackgroundObjUndoAction; mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction( *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()); + SfxItemSet aSet( *pArgs ); + sdr::properties::CleanupFillProperties(aSet); mpPage->getSdrPageProperties().ClearItem(); - mpPage->getSdrPageProperties().PutItemSet(*pArgs); + mpPage->getSdrPageProperties().PutItemSet(aSet); } } diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index d7a251cee531..363eba2f6dab 100755 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -49,6 +49,7 @@ #include <editeng/lrspitem.hxx> #include <svx/svdopage.hxx> #include <svx/svditer.hxx> +#include <svx/sdr/properties/properties.hxx> #include <sfx2/viewfrm.hxx> #include <svx/xlndsit.hxx> @@ -454,6 +455,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) sStyleName.Append( sal_Unicode( ' ' )); pStyleSheet->GetItemSet().Put(aTempSet); + SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet(); pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); @@ -477,45 +479,8 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) SfxItemSet& rAttr = pStyleSheet->GetItemSet(); -/* #i35937# - if ( rAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON ) - { - // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen - if ( aOriSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON || - (const SvxLRSpaceItem&) aOriSet.Get( EE_PARA_LRSPACE ) != - (const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) ) - { - SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rAttr.Get(EE_PARA_NUMBULLET) ); - - sal_uInt16 nLevel = 0; - if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) ) - nLevel = (sal_uInt16)(ePO - PO_OUTLINE_1 + 1); - - EditEngine::ImportBulletItem( aNumBullet, nLevel, NULL, - &(const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) ); + sdr::properties::CleanupFillProperties( rAttr ); - // the numbering bullet item is not valid in styles Outline 2 to Outline 9 - if( nLevel != 0 ) - { - // so put it into Outline 1 then.. - String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE))); - sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); - SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO); - - if(pFirstStyleSheet) - { - pFirstStyleSheet->GetItemSet().Put( aNumBullet); - SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet(); - pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); - } - } - else - { - ( (SfxItemSet&) rAttr).Put( aNumBullet ); - } - } - } -*/ // check for unique names of named items for xml if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET ) { diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 9681e9ba4230..478a7eb5e550 100755 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -40,6 +40,8 @@ #include <svl/urlbmk.hxx> #include <tools/ref.hxx> #include "sdxfer.hxx" +#include <boost/scoped_ptr.hpp> +#include <boost/function.hpp> class SdDrawDocument; class SfxMedium; @@ -51,6 +53,8 @@ class SdPage; class SvLBoxEntry; namespace sd { +class ViewShell; + class DrawDocShell; #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED #define SV_DECL_DRAW_DOC_SHELL_DEFINED @@ -104,7 +108,6 @@ public: ::sd::DrawDocShell& mrDocShell; NavigatorDragType meDragType; const ::com::sun::star::uno::Any maTreeListBoxData; - SD_DLLPRIVATE virtual ~SdPageObjsTransferable(); SD_DLLPRIVATE virtual void AddSupportedFormats(); @@ -219,6 +222,17 @@ public: using SvLBox::ExecuteDrop; using SvTreeListBox::SelectEntry; + + /** Return the view shell that is linked to the given doc shell. + Call this method when the there is a chance that the doc shell + has been disconnected from the view shell (but not the other + way round.) + @return + May return <NULL/> when the link between view shell and + doc shell has been severed. + */ + static ::sd::ViewShell* GetViewShellForDocShell (::sd::DrawDocShell &rDocShell); + private: /** This flag controls whether all shapes are shown as children of pages and group shapes or only the named shapes. diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index f29b1d28936a..9ba1ce2cf7de 100755 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -89,12 +89,41 @@ public: // SfxListener virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void DragFinished( sal_Int8 nDropAction ); + SdDrawDocument* GetSourceDoc (void) const; + + /** User data objects can be used to store information temporarily + at the transferable. The slide sorter uses this to store + previews of the slides that are referenced by the + transferable. + */ + class UserData {public:virtual~UserData(){}}; + + /** Add a user data object. When it was added before (and not + removed) then this call is ignored. + */ + void AddUserData (const ::boost::shared_ptr<UserData>& rpData); + + /** Remove a previously added user data object. When the object + was never added or removed before then this call is ignored. + */ + void RemoveUserData (const ::boost::shared_ptr<UserData>& rpData); + + /** Return the number of user data objects. + */ + sal_Int32 GetUserDataCount (void) const; + + /** Return the specified user data object. When the index is not + valid, ie not in the range [0,count) then an empty pointer is + returned. + */ + ::boost::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const; + protected: virtual void AddSupportedFormats(); virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - virtual void DragFinished( sal_Int8 nDropAction ); virtual void ObjectReleased(); virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ); @@ -124,6 +153,7 @@ private: sal_Bool mbPageTransferable : 1; sal_Bool mbPageTransferablePersistent : 1; bool mbIsUnoObj : 1; + ::std::vector<boost::shared_ptr<UserData> > maUserData; // not available SdTransferable(); diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 84962348d693..0f01f0658cbb 100755 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -109,6 +109,26 @@ namespace { private: ::boost::shared_ptr<SlideShowRestarter> mpRestarter; }; + + /** Return the default display id (or -1 when that can not be + determined.) + */ + sal_Int32 GetDefaultDisplay (void) + { + try + { + Reference< XMultiServiceFactory > xFactory(::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XPropertySet > xMonProps(xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + const OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); + sal_Int32 nPrimaryIndex (-1); + if (xMonProps->getPropertyValue( sPropertyName ) >>= nPrimaryIndex) + return nPrimaryIndex; + } + catch( Exception& ) + { + } + return -1; + } } @@ -553,6 +573,14 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const sal_Int32 nDisplay = 0; if( aValue >>= nDisplay ) { + // Convert value to true display id. + if (nDisplay == 0) + nDisplay = GetDefaultDisplay(); + else if (nDisplay < 0) + nDisplay = -1; + else + --nDisplay; + bIllegalArgument = false; SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); @@ -632,7 +660,14 @@ Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(U case ATTR_PRESENT_DISPLAY: { SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); - return Any( pOptions->GetDisplay() ); + const sal_Int32 nDisplay (pOptions->GetDisplay()); + // Convert true display id to the previously used schema. + if (nDisplay == GetDefaultDisplay()) + return Any(sal_Int32(0)); + else if (nDisplay < 0) + return Any(sal_Int32(-1)); + else + return Any(nDisplay+1); } default: @@ -1228,28 +1263,6 @@ sal_Int32 SlideShow::GetDisplay() if( pOptions ) nDisplay = pOptions->GetDisplay(); - if (nDisplay <= 0 ) - { - try - { - Reference<XMultiServiceFactory > xFactory( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW); - Reference<XPropertySet> xMonitorProperties( - xFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess"))), - UNO_QUERY_THROW); - const OUString sPropertyName (RTL_CONSTASCII_USTRINGPARAM("DefaultDisplay")); - xMonitorProperties->getPropertyValue(sPropertyName) >>= nDisplay; - } - catch( Exception& ) - { - } - } - else - { - nDisplay--; - } - return nDisplay; } diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src index 78cd2aae0d9f..0b6217028d91 100755 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -74,7 +74,7 @@ Menu RID_SLIDESHOW_CONTEXTMENU MenuItem { Identifier = CM_PEN_MODE; - Text [ en-US ] = "Mouse pointer as ~pen"; + Text [ en-US ] = "Mouse pointer as ~Pen"; }; MenuItem { @@ -115,12 +115,12 @@ Menu RID_SLIDESHOW_CONTEXTMENU MenuItem { Identifier = CM_COLOR_PEN ; - Text [ en-US ] = "~Change Pen Color..." ; + Text [ en-US ] = "~Change pen Color..." ; }; MenuItem { Identifier = CM_ERASE_ALLINK ; - Text [ en-US ] = "~Erase All Ink On Slide" ; + Text [ en-US ] = "~Erase all ink on Slide" ; }; MenuItem { diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 1aef702d63f3..b3a16b48c3a9 100755 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1913,6 +1913,7 @@ IMPL_LINK( SlideshowImpl, PostYieldListener, void*, EMPTYARG ) Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); if (mbDisposed) return 0; + Application::Reschedule(true); return updateSlideShow(); } diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 390ade9c7a7e..153ec43a1ad6 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -43,7 +43,7 @@ #include "controller/SlsScrollBarManager.hxx" #include "controller/SlsSelectionManager.hxx" #include "controller/SlsSlotManager.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsTransferableData.hxx" #include "controller/SlsVisibleAreaManager.hxx" #include "model/SlideSorterModel.hxx" #include "model/SlsPageEnumerationProvider.hxx" @@ -427,8 +427,7 @@ bool SlideSorterController::Command ( // indicator so that the user knows where a page insertion // would take place. mpInsertionIndicatorHandler->Start(false); - mpInsertionIndicatorHandler->UpdateIndicatorIcon( - dynamic_cast<Transferable*>(SD_MOD()->pTransferClip)); + mpInsertionIndicatorHandler->UpdateIndicatorIcon(SD_MOD()->pTransferClip); mpInsertionIndicatorHandler->UpdatePosition( pWindow->PixelToLogic(rEvent.GetMousePosPixel()), InsertionIndicatorHandler::MoveMode); diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 28756b3766d9..dfc672e33802 100755 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -303,7 +303,7 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) // Unlock the draw lock. This should lead to a repaint. mpDrawLock.reset(); - if (maAnimations.size() > 0) + if (!maAnimations.empty()) RequestNextFrame(); return 0; diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 823112166bf4..4545e371ea37 100755 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -44,11 +44,12 @@ #include "controller/SlsScrollBarManager.hxx" #include "controller/SlsFocusManager.hxx" #include "controller/SlsSelectionManager.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsTransferableData.hxx" #include "controller/SlsSelectionObserver.hxx" #include "cache/SlsPageCache.hxx" #include "ViewShellBase.hxx" +#include "View.hxx" #include "DrawViewShell.hxx" #include "Window.hxx" #include "fupoor.hxx" @@ -69,6 +70,7 @@ #include "drawdoc.hxx" #include "DrawDocShell.hxx" #include "sdpage.hxx" +#include "sdtreelb.hxx" #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> #include <sfx2/request.hxx> @@ -82,9 +84,12 @@ #include <rtl/ustring.hxx> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> +#include <boost/bind.hpp> + namespace sd { namespace slidesorter { namespace controller { + class Clipboard::UndoContext { public: @@ -412,7 +417,7 @@ void Clipboard::CreateSlideTransferable ( // previews are included into the transferable so that an insertion // indicator can be rendered. aSelectedPages.Rewind(); - ::std::vector<Transferable::Representative> aRepresentatives; + ::std::vector<TransferableData::Representative> aRepresentatives; aRepresentatives.reserve(3); ::boost::shared_ptr<cache::PageCache> pPreviewCache ( mrSlideSorter.GetView().GetPreviewCache()); @@ -422,7 +427,7 @@ void Clipboard::CreateSlideTransferable ( if ( ! pDescriptor || pDescriptor->GetPage()==NULL) continue; Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false)); - aRepresentatives.push_back(Transferable::Representative( + aRepresentatives.push_back(TransferableData::Representative( aPreview, pDescriptor->HasState(model::PageDescriptor::ST_Excluded))); if (aRepresentatives.size() >= 3) @@ -433,7 +438,7 @@ void Clipboard::CreateSlideTransferable ( { mrSlideSorter.GetView().BrkAction(); SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument(); - SdTransferable* pTransferable = new Transferable ( + SdTransferable* pTransferable = TransferableData::CreateTransferable ( pDocument, NULL, sal_False, @@ -491,6 +496,95 @@ void Clipboard::CreateSlideTransferable ( +::boost::shared_ptr<SdTransferable::UserData> Clipboard::CreateTransferableUserData (SdTransferable* pTransferable) +{ + do + { + SdPageObjsTLB::SdPageObjsTransferable* pTreeListBoxTransferable + = dynamic_cast<SdPageObjsTLB::SdPageObjsTransferable*>(pTransferable); + if (pTreeListBoxTransferable == NULL) + break; + + // Find view shell for the document of the transferable. + ::sd::ViewShell* pViewShell + = SdPageObjsTLB::GetViewShellForDocShell(pTreeListBoxTransferable->GetDocShell()); + if (pViewShell == NULL) + break; + + // Find slide sorter for the document of the transferable. + SlideSorterViewShell* pSlideSorterViewShell + = SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase()); + if (pSlideSorterViewShell == NULL) + break; + SlideSorter& rSlideSorter (pSlideSorterViewShell->GetSlideSorter()); + + // Get bookmark from transferable. + TransferableDataHelper aDataHelper (pTransferable); + INetBookmark aINetBookmark; + if ( ! aDataHelper.GetINetBookmark(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark)) + break; + const rtl::OUString sURL (aINetBookmark.GetURL()); + const sal_Int32 nIndex (sURL.indexOf((sal_Unicode)'#')); + if (nIndex == -1) + break; + String sBookmark (sURL.copy(nIndex+1)); + + // Make sure that the bookmark points to a page. + SdDrawDocument* pTransferableDocument = rSlideSorter.GetModel().GetDocument(); + if (pTransferableDocument == NULL) + break; + sal_Bool bIsMasterPage = sal_False; + const sal_uInt16 nPageIndex (pTransferableDocument->GetPageByName(sBookmark, bIsMasterPage)); + if (nPageIndex == SDRPAGE_NOTFOUND) + break; + + // Create preview. + ::std::vector<TransferableData::Representative> aRepresentatives; + aRepresentatives.reserve(1); + ::boost::shared_ptr<cache::PageCache> pPreviewCache ( + rSlideSorter.GetView().GetPreviewCache()); + model::SharedPageDescriptor pDescriptor (rSlideSorter.GetModel().GetPageDescriptor((nPageIndex-1)/2)); + if ( ! pDescriptor || pDescriptor->GetPage()==NULL) + break; + Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false)); + aRepresentatives.push_back(TransferableData::Representative( + aPreview, + pDescriptor->HasState(model::PageDescriptor::ST_Excluded))); + + // Remember the page in maPagesToRemove so that it can be removed + // when drag and drop action is "move". + Clipboard& rOtherClipboard (pSlideSorterViewShell->GetSlideSorter().GetController().GetClipboard()); + rOtherClipboard.maPagesToRemove.clear(); + rOtherClipboard.maPagesToRemove.push_back(pDescriptor->GetPage()); + + // Create the new transferable. + ::boost::shared_ptr<SdTransferable::UserData> pNewTransferable ( + new TransferableData( + pSlideSorterViewShell, + aRepresentatives)); + pTransferable->SetWorkDocument( dynamic_cast<SdDrawDocument*>( + pTreeListBoxTransferable->GetSourceDoc()->AllocModel())); + // pTransferable->SetView(&mrSlideSorter.GetView()); + + // Set page bookmark list. + List aPageBookmarks; + aPageBookmarks.Insert(new String(sBookmark)); + pTransferable->SetPageBookmarks(aPageBookmarks, false); + + // Replace the view referenced by the transferable with the + // corresponding slide sorter view. + pTransferable->SetView(&pSlideSorterViewShell->GetSlideSorter().GetView()); + + return pNewTransferable; + } + while (false); + + return ::boost::shared_ptr<SdTransferable::UserData>(); +} + + + + void Clipboard::StartDrag ( const Point& rPosition, ::Window* pWindow) @@ -510,9 +604,7 @@ void Clipboard::StartDrag ( void Clipboard::DragFinished (sal_Int8 nDropAction) { - SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; - if (pDragTransferable != NULL) - pDragTransferable->SetView (NULL); + // SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; if (mnDragFinishedUserEventId == 0) { @@ -590,11 +682,12 @@ sal_Int8 Clipboard::AcceptDrop ( { sal_Int8 nAction (DND_ACTION_NONE); - const Clipboard::DropType eDropType (IsDropAccepted()); + const Clipboard::DropType eDropType (IsDropAccepted(rTargetHelper)); switch (eDropType) { case DT_PAGE: + case DT_PAGE_FROM_NAVIGATOR: { // Accept a drop. nAction = rEvent.mnAction; @@ -602,7 +695,7 @@ sal_Int8 Clipboard::AcceptDrop ( // Use the copy action when the drop action is the default, i.e. not // explicitly set to move or link, and when the source and // target models are not the same. - const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; if (pDragTransferable != NULL && pDragTransferable->IsPageTransferable() && ((rEvent.maDragEvent.DropAction @@ -612,13 +705,12 @@ sal_Int8 Clipboard::AcceptDrop ( { nAction = DND_ACTION_COPY; } - else if (mrController.GetInsertionIndicatorHandler()->IsInsertionTrivial(nAction)) + else if (IsInsertionTrivial(pDragTransferable, nAction)) { nAction = DND_ACTION_NONE; } // Show the insertion marker and the substitution for a drop. - Point aPosition = pTargetWindow->PixelToLogic (rEvent.maPosPixel); SelectionFunction* pSelectionFunction = dynamic_cast<SelectionFunction*>( mrSlideSorter.GetViewShell()->GetCurrentFunction().get()); if (pSelectionFunction != NULL) @@ -641,6 +733,7 @@ sal_Int8 Clipboard::AcceptDrop ( break; default: + case DT_NONE: nAction = DND_ACTION_NONE; break; } @@ -660,12 +753,14 @@ sal_Int8 Clipboard::ExecuteDrop ( { sal_Int8 nResult = DND_ACTION_NONE; mpUndoContext.reset(); + const Clipboard::DropType eDropType (IsDropAccepted(rTargetHelper)); - switch (IsDropAccepted()) + switch (eDropType) { case DT_PAGE: + case DT_PAGE_FROM_NAVIGATOR: { - const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; const Point aEventModelPosition ( pTargetWindow->PixelToLogic (rEvent.maPosPixel)); const sal_Int32 nXOffset (labs (pDragTransferable->GetStartPos().X() @@ -684,7 +779,7 @@ sal_Int8 Clipboard::ExecuteDrop ( // Do not process the insertion when it is trivial, // i.e. would insert pages at their original place. - if (pInsertionIndicatorHandler->IsInsertionTrivial(rEvent.mnAction)) + if (IsInsertionTrivial(pDragTransferable, rEvent.mnAction)) bContinue = false; // Tell the insertion indicator handler to hide before the model @@ -713,6 +808,19 @@ sal_Int8 Clipboard::ExecuteDrop ( // well as the ones above. } + // When the pages originated in another slide sorter then + // only that is notified automatically about the drag + // operation being finished. Because the target slide sorter + // has be notified, too, add a callback for that. + ::boost::shared_ptr<TransferableData> pSlideSorterTransferable ( + TransferableData::GetFromTransferable(pDragTransferable)); + BOOST_ASSERT(pSlideSorterTransferable); + if (pSlideSorterTransferable + && pSlideSorterTransferable->GetSourceViewShell() != mrSlideSorter.GetViewShell()) + { + DragFinished(nResult); + } + // Notify the receiving selection function that drag-and-drop is // finished and the substitution handler can be released. ::rtl::Reference<SelectionFunction> pFunction ( @@ -732,7 +840,9 @@ sal_Int8 Clipboard::ExecuteDrop ( nPage, nLayer); break; + default: + case DT_NONE: break; } @@ -742,6 +852,21 @@ sal_Int8 Clipboard::ExecuteDrop ( +bool Clipboard::IsInsertionTrivial ( + SdTransferable* pTransferable, + const sal_Int8 nDndAction) const +{ + ::boost::shared_ptr<TransferableData> pSlideSorterTransferable ( + TransferableData::GetFromTransferable(pTransferable)); + if (pSlideSorterTransferable + && pSlideSorterTransferable->GetSourceViewShell() != mrSlideSorter.GetViewShell()) + return false; + return mrController.GetInsertionIndicatorHandler()->IsInsertionTrivial(nDndAction); +} + + + + void Clipboard::Abort (void) { if (mpSelectionObserverContext) @@ -797,25 +922,26 @@ sal_uInt16 Clipboard::InsertSlides ( -Clipboard::DropType Clipboard::IsDropAccepted (void) const +Clipboard::DropType Clipboard::IsDropAccepted (DropTargetHelper&) const { - DropType eResult (DT_NONE); - const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; - if (pDragTransferable != NULL) + if (pDragTransferable == NULL) + return DT_NONE; + + if (pDragTransferable->IsPageTransferable()) { - if (pDragTransferable->IsPageTransferable()) - { - if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE) - eResult = DT_PAGE; - } + if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE) + return DT_PAGE; else - { - eResult = DT_SHAPE; - } + return DT_NONE; } - return eResult; + const SdPageObjsTLB::SdPageObjsTransferable* pPageObjsTransferable + = dynamic_cast<const SdPageObjsTLB::SdPageObjsTransferable*>(pDragTransferable); + if (pPageObjsTransferable != NULL) + return DT_PAGE_FROM_NAVIGATOR; + + return DT_SHAPE; } diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx index 76a5f583f4a5..b55c2c261645 100644 --- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx +++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx @@ -39,10 +39,12 @@ #include "controller/SlsProperties.hxx" #include "controller/SlsSelectionFunction.hxx" #include "controller/SlsSelectionManager.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsClipboard.hxx" +#include "controller/SlsTransferableData.hxx" #include "DrawDocShell.hxx" #include "drawdoc.hxx" #include "app.hrc" +#include "sdtreelb.hxx" #include <sfx2/bindings.hxx> #include <boost/bind.hpp> @@ -58,8 +60,19 @@ DragAndDropContext::DragAndDropContext (SlideSorter& rSlideSorter) if (rSlideSorter.GetModel().GetEditMode() != EM_PAGE) return; - rSlideSorter.GetController().GetInsertionIndicatorHandler()->UpdateIndicatorIcon( - dynamic_cast<Transferable*>(SD_MOD()->pTransferDrag)); + // For poperly handling transferables created by the navigator we + // need additional information. For this a user data object is + // created that contains the necessary information. + SdTransferable* pTransferable = SD_MOD()->pTransferDrag; + SdPageObjsTLB::SdPageObjsTransferable* pTreeListBoxTransferable + = dynamic_cast<SdPageObjsTLB::SdPageObjsTransferable*>(pTransferable); + if (pTreeListBoxTransferable!=NULL && !TransferableData::GetFromTransferable(pTransferable)) + { + pTransferable->AddUserData( + rSlideSorter.GetController().GetClipboard().CreateTransferableUserData(pTransferable)); + } + + rSlideSorter.GetController().GetInsertionIndicatorHandler()->UpdateIndicatorIcon(pTransferable); } diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx index 882adab932a8..d663d106f6bf 100644 --- a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx +++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx @@ -120,7 +120,7 @@ void InsertionIndicatorHandler::ForceEnd (void) -void InsertionIndicatorHandler::UpdateIndicatorIcon (const Transferable* pTransferable) +void InsertionIndicatorHandler::UpdateIndicatorIcon (const SdTransferable* pTransferable) { mpInsertionIndicatorOverlay->Create(pTransferable); maIconSize = mpInsertionIndicatorOverlay->GetSize(); diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index fc5687e0afc0..938289046043 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -32,7 +32,7 @@ #include "SlideSorter.hxx" #include "SlideSorterViewShell.hxx" #include "SlsDragAndDropContext.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsTransferableData.hxx" #include "controller/SlideSorterController.hxx" #include "controller/SlsPageSelector.hxx" #include "controller/SlsFocusManager.hxx" diff --git a/sd/source/ui/slidesorter/controller/SlsTransferable.cxx b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx index 1f03c70759b6..682b4c7f741c 100755 --- a/sd/source/ui/slidesorter/controller/SlsTransferable.cxx +++ b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx @@ -28,21 +28,48 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsTransferableData.hxx" #include "SlideSorterViewShell.hxx" #include "View.hxx" namespace sd { namespace slidesorter { namespace controller { -Transferable::Transferable ( +SdTransferable* TransferableData::CreateTransferable ( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData, SlideSorterViewShell* pViewShell, const ::std::vector<Representative>& rRepresentatives) - : SdTransferable (pSrcDoc, pWorkView, bInitOnGetData), - mpViewShell(pViewShell), +{ + SdTransferable* pTransferable = new SdTransferable (pSrcDoc, pWorkView, bInitOnGetData); + ::boost::shared_ptr<TransferableData> pData (new TransferableData(pViewShell, rRepresentatives)); + pTransferable->AddUserData(pData); + return pTransferable; +} + + + + +::boost::shared_ptr<TransferableData> TransferableData::GetFromTransferable (const SdTransferable* pTransferable) +{ + ::boost::shared_ptr<TransferableData> pData; + for (sal_Int32 nIndex=0,nCount=pTransferable->GetUserDataCount(); nIndex<nCount; ++nIndex) + { + pData = ::boost::dynamic_pointer_cast<TransferableData>(pTransferable->GetUserData(nIndex)); + if (pData) + return pData; + } + return ::boost::shared_ptr<TransferableData>(); +} + + + + +TransferableData::TransferableData ( + SlideSorterViewShell* pViewShell, + const ::std::vector<Representative>& rRepresentatives) + : mpViewShell(pViewShell), maRepresentatives(rRepresentatives) { if (mpViewShell != NULL) @@ -52,7 +79,7 @@ Transferable::Transferable ( -Transferable::~Transferable (void) +TransferableData::~TransferableData (void) { if (mpViewShell != NULL) EndListening(*mpViewShell); @@ -61,16 +88,28 @@ Transferable::~Transferable (void) -void Transferable::DragFinished (sal_Int8 nDropAction) +void TransferableData::DragFinished (sal_Int8 nDropAction) { if (mpViewShell != NULL) mpViewShell->DragFinished(nDropAction); + /* + for (CallbackContainer::const_iterator + iCallback(maDragFinishCallbacks.begin()), + iEnd(maDragFinishCallbacks.end()); + iCallback!=iEnd; + ++iCallback) + { + if (*iCallback) + (*iCallback)(nDropAction); + } + maDragFinishCallbacks.clear(); + */ } -void Transferable::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) +void TransferableData::Notify (SfxBroadcaster&, const SfxHint& rHint) { if (rHint.ISA(SfxSimpleHint) && mpViewShell!=NULL) { @@ -85,17 +124,22 @@ void Transferable::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) mpViewShell = NULL; } } - - SdTransferable::Notify(rBroadcaster, rHint); } -const ::std::vector<Transferable::Representative>& Transferable::GetRepresentatives (void) const +const ::std::vector<TransferableData::Representative>& TransferableData::GetRepresentatives (void) const { return maRepresentatives; } + + +SlideSorterViewShell* TransferableData::GetSourceViewShell (void) const +{ + return mpViewShell; +} + } } } // end of namespace ::sd::slidesorter::controller diff --git a/sd/source/ui/slidesorter/controller/makefile.mk b/sd/source/ui/slidesorter/controller/makefile.mk index 460ef16ed3f1..18479cc86aa0 100755 --- a/sd/source/ui/slidesorter/controller/makefile.mk +++ b/sd/source/ui/slidesorter/controller/makefile.mk @@ -60,7 +60,7 @@ SLOFILES = \ $(SLO)$/SlsSelectionManager.obj \ $(SLO)$/SlsSelectionObserver.obj \ $(SLO)$/SlsSlotManager.obj \ - $(SLO)$/SlsTransferable.obj \ + $(SLO)$/SlsTransferableData.obj \ $(SLO)$/SlsVisibleAreaManager.obj # --- Tagets ------------------------------------------------------- diff --git a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx index 1bf5b8eae177..622bed457464 100755 --- a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx @@ -30,6 +30,8 @@ #include "ViewClipboard.hxx" #include "controller/SlsSelectionObserver.hxx" +#include "sdxfer.hxx" + #include <sal/types.h> #include <tools/solar.h> #include <svx/svdpage.hxx> @@ -58,6 +60,8 @@ namespace sd { namespace slidesorter { namespace model { class PageDescriptor; } } } +namespace { class NavigatorDropEvent; } + namespace sd { namespace slidesorter { namespace controller { class SlideSorterController; @@ -69,6 +73,12 @@ public: Clipboard (SlideSorter& rSlideSorter); ~Clipboard (void); + /** Create a slide sorter transferable from the given sd + transferable. The returned transferable is set up with all + information necessary so that it can be dropped on a slide sorter. + */ + ::boost::shared_ptr<SdTransferable::UserData> CreateTransferableUserData (SdTransferable* pTransferable); + void HandleSlotCall (SfxRequest& rRequest); void DoCut (::Window* pWindow = 0); @@ -189,8 +199,8 @@ private: transferable is not accepted. The reason is the missing implementation of proper handling master pages copy-and-paste. */ - enum DropType { DT_PAGE, DT_SHAPE, DT_NONE }; - DropType IsDropAccepted (void) const; + enum DropType { DT_PAGE, DT_PAGE_FROM_NAVIGATOR, DT_SHAPE, DT_NONE }; + DropType IsDropAccepted (DropTargetHelper& rTargetHelper) const; /** This method contains the code for AcceptDrop() and ExecuteDrop() shapes. There are only minor differences for the two cases at this level. @@ -221,10 +231,19 @@ private: sal_uInt16 nPage, sal_uInt16 nLayer); + /** Return whether the insertion defined by the transferable is + trivial, ie would not change either source nor target document. + */ + bool IsInsertionTrivial ( + SdTransferable* pTransferable, + const sal_Int8 nDndAction) const; + /** Asynchronous part of DragFinished. The argument is the sal_Int8 nDropAction, disguised as void*. */ DECL_LINK(ProcessDragFinished, void*); + + DECL_LINK(ExecuteNavigatorDrop, NavigatorDropEvent*); }; } } } // end of namespace ::sd::slidesorter::controller diff --git a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx index e257c5729b10..1492e707d42d 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx @@ -31,6 +31,8 @@ #include "view/SlsInsertAnimator.hxx" #include "view/SlsLayouter.hxx" +#include "sdxfer.hxx" + namespace sd { namespace slidesorter { class SlideSorter; } } namespace sd { namespace slidesorter { namespace model { @@ -83,7 +85,7 @@ public: /** Update the indicator icon from the current transferable (from the clipboard or an active drag and drop operation.) */ - void UpdateIndicatorIcon (const Transferable* pTransferable); + void UpdateIndicatorIcon (const SdTransferable* pTransferable); /** Set the position of the insertion marker to the given coordinates. */ diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx index c0a09e73bfe9..775e759f891a 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx @@ -25,10 +25,12 @@ * ************************************************************************/ -#ifndef SD_SLIDESORTER_TRANSFERABLE_HXX -#define SD_SLIDESORTER_TRANSFERABLE_HXX +#ifndef SD_SLIDESORTER_TRANSFERABLE_DATA_HXX +#define SD_SLIDESORTER_TRANSFERABLE_DATA_HXX #include "sdxfer.hxx" +#include <boost/function.hpp> +#include <vector> class SdDrawDocument; namespace sd { namespace slidesorter { @@ -37,12 +39,12 @@ class SlideSorterViewShell; namespace sd { namespace slidesorter { namespace controller { - -/** This class exists to have DragFinished call the correct object: the - SlideSorterViewShell instead of the old SlideView. +/** Represent previews and other information so that they can be + attached to an existing transferable. */ -class Transferable - : public SdTransferable +class TransferableData + : public SdTransferable::UserData, + public SfxListener { public: class Representative @@ -61,23 +63,32 @@ public: bool mbIsExcluded; }; - - Transferable ( + static SdTransferable* CreateTransferable ( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData, SlideSorterViewShell* pViewShell, - const ::std::vector<Representative>& rRepresentatives); + const ::std::vector<TransferableData::Representative>& rRepresentatives); - virtual ~Transferable (void); + static ::boost::shared_ptr<TransferableData> GetFromTransferable (const SdTransferable* pTransferable); + + TransferableData ( + SlideSorterViewShell* pViewShell, + const ::std::vector<TransferableData::Representative>& rRepresentatives); + ~TransferableData (void); virtual void DragFinished (sal_Int8 nDropAction); const ::std::vector<Representative>& GetRepresentatives (void) const; + /** Return the view shell for which the transferable was created. + */ + SlideSorterViewShell* GetSourceViewShell (void) const; + private: SlideSorterViewShell* mpViewShell; const ::std::vector<Representative> maRepresentatives; + typedef ::std::vector<boost::function<void(sal_uInt8)> > CallbackContainer; virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); }; diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx index f28287b15a0e..8840f3732367 100644 --- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx @@ -258,6 +258,8 @@ public: ButtonBar& GetButtonBar (void) const; ToolTip& GetToolTip (void) const; + virtual void DragFinished (sal_Int8 nDropAction); + protected: virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx index a9a640d978cf..a48d5fe9986a 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx @@ -30,7 +30,8 @@ #include "model/SlsSharedPageDescriptor.hxx" #include "view/SlsILayerPainter.hxx" -#include "controller/SlsTransferable.hxx" +#include "controller/SlsTransferableData.hxx" +#include "sdxfer.hxx" #include <tools/gen.hxx> #include <vcl/bitmapex.hxx> @@ -71,7 +72,7 @@ public: virtual void SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator); - void Create (const controller::Transferable* pTransferable); + void Create (const SdTransferable* pTransferable); /** Given a position in model coordinates this method calculates the insertion marker both as an index in the document and as a location @@ -110,7 +111,7 @@ private: OutputDevice& rContent, const Size aPreviewSize, const sal_Int32 nOffset, - const ::std::vector<controller::Transferable::Representative>& rPages) const; + const ::std::vector<controller::TransferableData::Representative>& rPages) const; void PaintPageCount ( OutputDevice& rDevice, const sal_Int32 nSelectionCount, @@ -120,7 +121,7 @@ private: scaled down previews of some of the selected pages. */ void Create ( - const ::std::vector<controller::Transferable::Representative>& rPages, + const ::std::vector<controller::TransferableData::Representative>& rPages, const sal_Int32 nSelectionCount); }; diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index 728eff5ee384..58d3b1167fb5 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -43,6 +43,7 @@ #include "view/SlsToolTip.hxx" #include "controller/SlideSorterController.hxx" #include "controller/SlsProperties.hxx" +#include "controller/SlsClipboard.hxx" #include "model/SlideSorterModel.hxx" #include "model/SlsPageEnumerationProvider.hxx" #include "model/SlsPageDescriptor.hxx" @@ -177,7 +178,6 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter) // Hide the page that contains the page objects. SetPageVisible (sal_False); - // Register the background painter on level 1 to avoid the creation of a // background buffer. mpLayeredDevice->RegisterPainter(mpBackgroundPainter, 1); @@ -901,6 +901,16 @@ ToolTip& SlideSorterView::GetToolTip (void) const +void SlideSorterView::DragFinished (sal_Int8 nDropAction) +{ + mrSlideSorter.GetController().GetClipboard().DragFinished(nDropAction); + + View::DragFinished(nDropAction); +} + + + + void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) { ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh(); diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index abaa5a43b215..6b5620655dbe 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -103,11 +103,15 @@ InsertionIndicatorOverlay::~InsertionIndicatorOverlay (void) -void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransferable) +void InsertionIndicatorOverlay::Create (const SdTransferable* pTransferable) { if (pTransferable == NULL) return; + ::boost::shared_ptr<controller::TransferableData> pData ( + controller::TransferableData::GetFromTransferable(pTransferable)); + if ( ! pData) + return; sal_Int32 nSelectionCount (0); if (pTransferable->HasPageBookmarks()) nSelectionCount = pTransferable->GetPageBookmarks().Count(); @@ -121,14 +125,14 @@ void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransfe nSelectionCount = pDataDocument->GetSdPageCount(PK_STANDARD); } } - Create(pTransferable->GetRepresentatives(), nSelectionCount); + Create(pData->GetRepresentatives(), nSelectionCount); } void InsertionIndicatorOverlay::Create ( - const ::std::vector<controller::Transferable::Representative>& rRepresentatives, + const ::std::vector<controller::TransferableData::Representative>& rRepresentatives, const sal_Int32 nSelectionCount) { view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter()); @@ -196,7 +200,7 @@ Point InsertionIndicatorOverlay::PaintRepresentatives ( OutputDevice& rContent, const Size aPreviewSize, const sal_Int32 nOffset, - const ::std::vector<controller::Transferable::Representative>& rRepresentatives) const + const ::std::vector<controller::TransferableData::Representative>& rRepresentatives) const { const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0); diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 957c9da398c6..7e017fbdbe1e 100755 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -185,6 +185,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq) } } + GetParentWindow()->GrabFocus(); if( pPickObj ) mpView->ReplaceObjectAtView(pPickObj, *pPV, pObj, sal_True ); else @@ -192,6 +193,10 @@ void DrawViewShell::FuTable(SfxRequest& rReq) Invalidate(SID_DRAWTBX_INSERT); rReq.Ignore(); +SfxViewShell* pViewShell = GetViewShell(); + OSL_ASSERT (pViewShell!=NULL); + SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate( SID_INSERT_TABLE, sal_True, sal_False ); break; } case SID_TABLEDESIGN: diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx index 8ed46a90dbba..3bff5f5e7a4b 100755 --- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx +++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx @@ -338,7 +338,7 @@ void DocumentHelper::AssignMasterPageToPageList ( aCleanedList.push_back(*iPage); } } - if (aCleanedList.size() == 0) + if (aCleanedList.empty() ) break; ::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager(); diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 681aad8f44ed..ae148ec547cf 100755 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -658,36 +658,17 @@ void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, case WID_MASTERDEPEND: SetMasterDepend( ::cppu::any2bool(aValue) ); break; -/* todo case WID_ANIMPATH: { - uno::Reference< drawing::XShape > xShape; - aValue >>= xShape; + uno::Reference< drawing::XShape > xShape( aValue, uno::UNO_QUERY ); + SdrPathObj* pObj2 = xShape.is() ? dynamic_cast< SdrPathObj* >( GetSdrObjectFromXShape( xShape ) ) : NULL; - SdrObject* pObj = NULL; - if(xShape.is()) - pObj = GetSdrObjectFromXShape( xShape ); - - if( pObj == NULL || !pObj->ISA( SdrPathObj ) ) + if( pObj2 == NULL ) throw lang::IllegalArgumentException(); - pInfo->mpPathObj = (SdrPathObj*)pObj; - - SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; - if( pDoc ) - { - pInfo = pDoc->GetAnimationInfo(pObj); - if( pInfo == NULL ) - { - pInfo = new SdAnimationInfo(pDoc); - pObj->InsertUserData( pInfo ); - } - pInfo->mbInvisibleInPresentation = sal_True; - } - + EffectMigration::SetAnimationPath( mpShape, pObj2 ); break; } -*/ case WID_IMAGEMAP: { SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 7f67a549fc10..d6fbc27d9b3f 100755 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1949,7 +1949,6 @@ private: // Distribute pages to handout pages. ::std::vector<sal_uInt16> aPageIndices; - std::vector<SdPage*> aPagesVector; for (sal_uInt16 nIndex=0, nCount= nPageCount, @@ -1966,8 +1965,7 @@ private: // Create a printer page when we have found one page for each // placeholder or when this is the last (and special) loop. - if (aPageIndices.size() == nShapeCount - || nIndex==nCount) + if (!aPageIndices.empty() && (aPageIndices.size() == nShapeCount || nIndex==nCount)) { maPrinterPages.push_back( ::boost::shared_ptr<PrinterPage>( diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 0c0cd2b9836e..fa0c699778c1 100755 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -486,7 +486,7 @@ int ViewTabBar::GetHeight (void) { int nHeight (0); - if (maTabBarButtons.size() > 0) + if (!maTabBarButtons.empty()) { TabPage* pActivePage (mpTabControl->GetTabPage( mpTabControl->GetCurPageId())); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 73f48323312f..0236af7d5fcf 100755 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -136,7 +136,9 @@ struct SdNavigatorDropEvent : public ExecuteDropEvent pTransferable->SetWorkDocument( (SdDrawDocument*) GetAllMarkedModel() ); mpDoc->CreatingDataObj( NULL ); - const Rectangle aMarkRect( GetAllMarkedRect() ); + // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get + // fat lines correctly + const Rectangle aMarkRect( GetAllMarkedBoundRect() ); TransferableObjectDescriptor aObjDesc; String aDisplayName; SdrOle2Obj* pSdrOleObj = NULL; diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index a9830295a9ec..38dfe79af9cd 100755 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -359,7 +359,7 @@ long Window::Notify( NotifyEvent& rNEvt ) nResult = mpViewShell->Notify(rNEvt, this); } if( !nResult ) - ::Window::Notify( rNEvt ); + nResult = ::Window::Notify( rNEvt ); return nResult; } diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx index 22a1b2fe623f..d47f0aea4077 100644..100755 --- a/sdext/source/presenter/PresenterScreen.cxx +++ b/sdext/source/presenter/PresenterScreen.cxx @@ -496,6 +496,13 @@ sal_Int32 PresenterScreen::GetScreenNumber ( sal_Int32 nDisplayNumber (-1); if ( ! (xProperties->getPropertyValue(A2S("Display")) >>= nDisplayNumber)) return -1; + if (nDisplayNumber == -1) + { + // The special value -1 indicates that the slide show + // spans all available displays. That leaves no room for + // the presenter screen. + return -1; + } Reference<XComponentContext> xContext (mxContextWeak); if ( ! xContext.is()) diff --git a/sdext/source/presenter/description.xml b/sdext/source/presenter/description.xml index 19fefec6de8a..fbe039e610be 100644 --- a/sdext/source/presenter/description.xml +++ b/sdext/source/presenter/description.xml @@ -17,7 +17,7 @@ </simple-license> </registration> - <version value="1.1.0" /> + <version value="1.1.1" /> <platform value="UPDATED_PLATFORM" /> diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk index 800612a6c55d..eac148a112d9 100755 --- a/sfx2/JunitTest_sfx2_complex.mk +++ b/sfx2/JunitTest_sfx2_complex.mk @@ -51,6 +51,8 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\ sfx2/qa/complex/sfx2/DocumentInfo \ sfx2/qa/complex/sfx2/StandaloneDocumentInfo \ sfx2/qa/complex/sfx2/UndoManager \ + sfx2/qa/complex/sfx2/JUnitBasedTest \ + sfx2/qa/complex/sfx2/DocumentEvents \ sfx2/qa/complex/sfx2/standalonedocinfo/StandaloneDocumentInfoTest \ sfx2/qa/complex/sfx2/standalonedocinfo/TestHelper \ sfx2/qa/complex/sfx2/standalonedocinfo/Test01 \ @@ -69,6 +71,7 @@ $(eval $(call gb_JunitTest_add_classes,sfx2_complex,\ complex.sfx2.DocumentProperties \ complex.sfx2.DocumentMetadataAccess \ complex.sfx2.UndoManager \ + complex.sfx2.DocumentEvents \ )) # #i115674# fails currently: misses some OnUnfocus event # complex.sfx2.GlobalEventBroadcaster \ diff --git a/sfx2/qa/complex/sfx2/DocumentEvents.java b/sfx2/qa/complex/sfx2/DocumentEvents.java new file mode 100755 index 000000000000..a38e13756551 --- /dev/null +++ b/sfx2/qa/complex/sfx2/DocumentEvents.java @@ -0,0 +1,206 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package complex.sfx2; + +import com.sun.star.document.DocumentEvent; +import com.sun.star.document.XDocumentEventBroadcaster; +import com.sun.star.document.XDocumentEventListener; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.XEventListener; +import com.sun.star.uno.Exception; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.CloseVetoException; +import com.sun.star.util.XCloseListener; +import com.sun.star.util.XCloseable; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import org.openoffice.test.tools.OfficeDocument; + +/** + * + * @author frank.shoenheit@oracle.com + */ +public class DocumentEvents extends JUnitBasedTest +{ + @Before + public void beforeTest() throws Exception + { + m_document = OfficeDocument.blankTextDocument( this.getORB() ); + } + + @After + public void afterTest() + { + if ( m_document != null ) + { + assertTrue( "closing the test document failed", m_document.close() ); + m_document = null; + } + } + + /** + * sets up the environment for a test which checks the behavior upon closing a doc + */ + private void impl_setupDocCloseTest() + { + m_observedCloseEvents.clear(); + + final XDocumentEventBroadcaster docEventBroadcaster = UnoRuntime.queryInterface( + XDocumentEventBroadcaster.class, m_document.getDocument() ); + docEventBroadcaster.addDocumentEventListener( new DocumentEventListener() ); + + final XCloseable docCloseable = UnoRuntime.queryInterface( XCloseable.class, + m_document.getDocument() ); + docCloseable.addCloseListener( new CloseListener() ); + + m_document.getDocument().addEventListener( new DocDisposeListener() ); + } + + /** + * sets up the environment for a test which checks the behavior upon closing a doc + */ + private void impl_tearDownDocCloseTest( final String i_docCloseMethod ) + { + synchronized( m_document ) + { + try + { + m_document.wait(10000); + } + catch (InterruptedException ex) + { + // don't continue the test if somebody interrupted us ... + return; + } + } + + m_document = null; + synchronized( m_observedCloseEvents ) + { + assertArrayEquals( + "wrong order of events when closing a doc " + i_docCloseMethod, + new CloseEventType[] { CloseEventType.OnUnload, CloseEventType.NotifyClosing, CloseEventType.Disposing }, + m_observedCloseEvents.toArray( new CloseEventType[0] ) + ); + } + } + + @Test + public void testCloseWinEvents() throws Exception + { + impl_setupDocCloseTest(); + m_document.getCurrentView().dispatch( ".uno:CloseWin" ); + impl_tearDownDocCloseTest( "via .uno:CloseWin" ); + } + + //@Test + public void testCloseDocEvents() throws Exception + { + impl_setupDocCloseTest(); + m_document.getCurrentView().dispatch( ".uno:CloseDoc" ); + impl_tearDownDocCloseTest( "via .uno:CloseDoc" ); + } + + //@Test + public void testCloseByAPI() throws Exception + { + impl_setupDocCloseTest(); + // closing the doc by API is synchronous, so do this in a separate thread, else we will get a deadlock + // when the document tries to call back our listener (well, I admit I didn't understand *why* we get this + // deadlock ... :-\ ) + (new DocCloser()).start(); + impl_tearDownDocCloseTest( "by API" ); + } + + private class DocumentEventListener implements XDocumentEventListener + { + + public void documentEventOccured( DocumentEvent i_documentEvent ) + { + if ( i_documentEvent.EventName.equals( "OnUnload" ) ) + { + synchronized( m_observedCloseEvents ) + { + m_observedCloseEvents.add( CloseEventType.OnUnload ); + } + } + } + + public void disposing(EventObject eo) + { + // not interested in + } + }; + + private class CloseListener implements XCloseListener + { + + public void queryClosing(EventObject eo, boolean bln) throws CloseVetoException + { + // not interested in + } + + public void notifyClosing(EventObject eo) + { + synchronized( m_observedCloseEvents ) + { + m_observedCloseEvents.add( CloseEventType.NotifyClosing ); + } + } + + public void disposing(EventObject eo) + { + // not interested in + } + }; + + private class DocDisposeListener implements XEventListener + { + public void disposing(EventObject eo) + { + synchronized( m_observedCloseEvents ) + { + m_observedCloseEvents.add( CloseEventType.Disposing ); + } + synchronized ( m_document ) + { + m_document.notifyAll(); + } + } + }; + + private class DocCloser extends Thread + { + @Override + public void run() + { + try + { + final XCloseable docCloseable = UnoRuntime.queryInterface(XCloseable.class, m_document.getDocument()); + docCloseable.close(true); + } + catch (CloseVetoException ex) + { + Logger.getLogger(DocumentEvents.class.getName()).log(Level.SEVERE, null, ex); + } + } + }; + + private enum CloseEventType + { + OnUnload, + NotifyClosing, + Disposing + }; + + private OfficeDocument m_document = null; + final private Vector< CloseEventType > m_observedCloseEvents = new Vector<DocumentEvents.CloseEventType>(); +} diff --git a/sfx2/qa/complex/sfx2/JUnitBasedTest.java b/sfx2/qa/complex/sfx2/JUnitBasedTest.java new file mode 100755 index 000000000000..a43493712c31 --- /dev/null +++ b/sfx2/qa/complex/sfx2/JUnitBasedTest.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package complex.sfx2; + +import org.openoffice.test.OfficeConnection; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XComponentContext; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * + * @author Frank + */ +public class JUnitBasedTest +{ + // ----------------------------------------------------------------------------------------------------------------- + protected XComponentContext getContext() + { + return m_connection.getComponentContext(); + } + + // ----------------------------------------------------------------------------------------------------------------- + protected XMultiServiceFactory getORB() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface( + XMultiServiceFactory.class, getContext().getServiceManager() ); + return xMSF1; + } + + // ----------------------------------------------------------------------------------------------------------------- + @BeforeClass + public static void setUpConnection() throws Exception + { + System.out.println( "--------------------------------------------------------------------------------" ); + System.out.println( "connecting ..." ); + m_connection.setUp(); + } + + // ----------------------------------------------------------------------------------------------------------------- + @AfterClass + public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println(); + System.out.println( "tearing down connection" ); + m_connection.tearDown(); + System.out.println( "--------------------------------------------------------------------------------" ); + } + + private static final OfficeConnection m_connection = new OfficeConnection(); +} diff --git a/sfx2/qa/complex/sfx2/UndoManager.java b/sfx2/qa/complex/sfx2/UndoManager.java index f37530aba726..a50cff82a4bf 100755 --- a/sfx2/qa/complex/sfx2/UndoManager.java +++ b/sfx2/qa/complex/sfx2/UndoManager.java @@ -159,7 +159,7 @@ public class UndoManager } // ----------------------------------------------------------------------------------------------------------------- -//#i116813# disabled @Test + @Test public void checkBrokenScripts() throws com.sun.star.uno.Exception, InterruptedException { System.out.println( "testing: broken scripts" ); @@ -221,12 +221,11 @@ public class UndoManager events.replaceByName( "OnViewCreated", scriptDescriptor ); // The below doesn't work: event notification is broken in m96, see http://www.openoffice.org/issues/show_bug.cgi?id=116313 -/* m_callbackCalled = false; + m_callbackCalled = false; m_currentDocument.getCurrentView().dispatch( ".uno:NewWindow" ); assertTrue( "triggering an event did not work as expected - basic script not called", m_callbackCalled ); // same as above: The script didn't close the context, but the OOo framework should have assertEquals( "undo context was not auto-closed as expected", 0, m_undoListener.getCurrentUndoContextDepth() ); - */ // ............................................................................................................. // scenario 4: let the script enter an Undo context, but not close it, as usual. diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index eb6373b5b998..10ccee0cb641 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2195,19 +2195,13 @@ void FileDialogHelper_Impl::loadConfig() { // respect the last "insert as link" state sal_Bool bLink = (sal_Bool) aUserData.GetToken( 0, ' ' ).ToInt32(); - if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ).hasValue() ) - { - aValue <<= bLink; - xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aValue ); - } + aValue <<= bLink; + xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aValue ); // respect the last "show preview" state sal_Bool bShowPreview = (sal_Bool) aUserData.GetToken( 1, ' ' ).ToInt32(); - if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 ).hasValue() ) - { - aValue <<= bShowPreview; - xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, aValue ); - } + aValue <<= bShowPreview; + xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, aValue ); if ( !maPath.getLength() ) displayFolder( getInitPath( aUserData, 2 ) ); diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index fd1327e423ca..c2680d702414 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #endif #include <tools/urlobj.hxx> +#include <tools/diagnose_ex.h> #include <svl/macitem.hxx> #include <sfx2/appuno.hxx> #include <sfx2/objsh.hxx> @@ -842,14 +843,18 @@ void SfxGlobalEvents_Impl::implts_checkAndExecuteEventBindings(const css::docume // <- SAFE css::uno::Any aAny; - if (xEvents.is()) + if ( xEvents.is() && xEvents->hasByName( aEvent.EventName ) ) aAny = xEvents->getByName(aEvent.EventName); Execute(aAny, aEvent, 0); } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} + catch ( css::uno::RuntimeException const & ) + { + throw; + } + catch ( css::uno::Exception const & ) + { + DBG_UNHANDLED_EXCEPTION(); + } } //----------------------------------------------------------------------------- diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk index 7ee473cb116f..064c87844209 100644 --- a/solenv/inc/libs.mk +++ b/solenv/inc/libs.mk @@ -265,15 +265,11 @@ JVMACCESSLIB = -ljvmaccess$(UDK_MAJOR)$(COMID) .ELSE # "$(GUI)$(COM)"=="WNTGCC" JVMACCESSLIB = -ljvmaccess$(COMID) .ENDIF # "$(GUI)$(COM)"=="WNTGCC" -.IF "$(OS)" == "WNT" -CPPUNITLIB = -lcygcppunit-1-12-1 -.ELSE .IF "$(SYSTEM_CPPUNIT)"=="YES" CPPUNITLIB = $(CPPUNIT_LIBS) .ELSE CPPUNITLIB = -lcppunit .ENDIF -.ENDIF .IF "$(SYSTEM_LIBXSLT)"=="YES" XSLTLIB=$(LIBXSLT_LIBS) .ELSE diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 6c29751c1fe5..d1734c0aaad2 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=340 -RSCREVISION=340m0(Build:9583) -BUILD=9583 -LAST_MINOR=m0 +RSCREVISION=340m1(Build:9584) +BUILD=9584 +LAST_MINOR=m1 SOURCEVERSION=OOO340 diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 051ff3e2ae3c..22dd4d749598 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -73,6 +73,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <rtl/ustrbuf.hxx> +#include <rtl/ref.hxx> #include <rtl/strbuf.hxx> #include <hash_map> @@ -87,7 +88,6 @@ using namespace com::sun::star::beans::PropertyConcept; using namespace com::sun::star::beans::MethodConcept; using namespace cppu; using namespace osl; -using namespace rtl; #define IMPLEMENTATION_NAME "com.sun.star.comp.stoc.Introspection" #define SERVICE_NAME "com.sun.star.beans.Introspection" @@ -158,7 +158,7 @@ sal_Bool isDerivedFrom( Reference<XIdlClass> xToTestClass, Reference<XIdlClass> // Hashtable fuer die Suche nach Namen struct hashName_Impl { - size_t operator()(const OUString Str) const + size_t operator()(const ::rtl::OUString Str) const { return (size_t)Str.hashCode(); } @@ -166,7 +166,7 @@ struct hashName_Impl struct eqName_Impl { - sal_Bool operator()(const OUString Str1, const OUString Str2) const + sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const { return ( Str1 == Str2 ); } @@ -174,7 +174,7 @@ struct eqName_Impl typedef std::hash_map < - OUString, + ::rtl::OUString, sal_Int32, hashName_Impl, eqName_Impl @@ -186,8 +186,8 @@ IntrospectionNameMap; // konvertierten Namen, dient zur Unterst�tzung von XExactName typedef std::hash_map < - OUString, - OUString, + ::rtl::OUString, + ::rtl::OUString, hashName_Impl, eqName_Impl > @@ -273,8 +273,8 @@ public: { delete[] mpOrgPropertyHandleArray; } - sal_Int32 getPropertyIndex( const OUString& aPropertyName ) const; - sal_Int32 getMethodIndex( const OUString& aMethodName ) const; + sal_Int32 getPropertyIndex( const ::rtl::OUString& aPropertyName ) const; + sal_Int32 getMethodIndex( const ::rtl::OUString& aMethodName ) const; void acquire() { nRefCount++; } void release() @@ -285,9 +285,9 @@ public: } // Methoden von XIntrospectionAccess (ALT, jetzt nur Impl) - void setPropertyValue(const Any& obj, const OUString& aPropertyName, const Any& aValue) const; -// void setPropertyValue(Any& obj, const OUString& aPropertyName, const Any& aValue) const; - Any getPropertyValue(const Any& obj, const OUString& aPropertyName) const; + void setPropertyValue(const Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue) const; +// void setPropertyValue(Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue) const; + Any getPropertyValue(const Any& obj, const ::rtl::OUString& aPropertyName) const; void setPropertyValueByIndex(const Any& obj, sal_Int32 nIndex, const Any& aValue) const; // void setPropertyValueByIndex(Any& obj, sal_Int32 nIndex, const Any& aValue) const; Any getPropertyValueByIndex(const Any& obj, sal_Int32 nIndex) const; @@ -331,7 +331,7 @@ IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlR // Von Hand refcounten !!! -sal_Int32 IntrospectionAccessStatic_Impl::getPropertyIndex( const OUString& aPropertyName ) const +sal_Int32 IntrospectionAccessStatic_Impl::getPropertyIndex( const ::rtl::OUString& aPropertyName ) const { sal_Int32 iHashResult = -1; IntrospectionAccessStatic_Impl* pThis = (IntrospectionAccessStatic_Impl*)this; @@ -341,7 +341,7 @@ sal_Int32 IntrospectionAccessStatic_Impl::getPropertyIndex( const OUString& aPro return iHashResult; } -sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMethodName ) const +sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const ::rtl::OUString& aMethodName ) const { sal_Int32 iHashResult = -1; IntrospectionAccessStatic_Impl* pThis = (IntrospectionAccessStatic_Impl*)this; @@ -362,15 +362,15 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho if( nFound == -1 ) break; - OUString aPureMethodName = aMethodName.copy( nFound + 1 ); + ::rtl::OUString aPureMethodName = aMethodName.copy( nFound + 1 ); aIt = pThis->maMethodNameMap.find( aPureMethodName ); if( !( aIt == pThis->maMethodNameMap.end() ) ) { // Check if it can be a type? // Problem: Does not work if package names contain _ ?! - OUString aStr = aMethodName.copy( 0, nFound ); - OUString aTypeName = aStr.replace( '_', '.' ); + ::rtl::OUString aStr = aMethodName.copy( 0, nFound ); + ::rtl::OUString aTypeName = aStr.replace( '_', '.' ); Reference< XIdlClass > xClass = mxCoreReflection->forName( aTypeName ); if( xClass.is() ) { @@ -398,8 +398,8 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho { const Reference<XIdlMethod> xMethod2 = pMethods[ i ]; - OUString aTestClassName = xMethod2->getDeclaringClass()->getName(); - OUString aTestMethodName = xMethod2->getName(); + ::rtl::OUString aTestClassName = xMethod2->getDeclaringClass()->getName(); + ::rtl::OUString aTestMethodName = xMethod2->getName(); if( xMethod2->getName() == aPureMethodName ) { @@ -427,8 +427,8 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho return iHashResult; } -void IntrospectionAccessStatic_Impl::setPropertyValue( const Any& obj, const OUString& aPropertyName, const Any& aValue ) const -//void IntrospectionAccessStatic_Impl::setPropertyValue( Any& obj, const OUString& aPropertyName, const Any& aValue ) const +void IntrospectionAccessStatic_Impl::setPropertyValue( const Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue ) const +//void IntrospectionAccessStatic_Impl::setPropertyValue( Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue ) const { sal_Int32 i = getPropertyIndex( aPropertyName ); if( i != -1 ) @@ -476,7 +476,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal if( eValType == TypeClass_INTERFACE ) { Type aPropType = rProp.Type; - OUString aTypeName( aPropType.getTypeName() ); + ::rtl::OUString aTypeName( aPropType.getTypeName() ); Reference< XIdlClass > xPropClass = mxCoreReflection->forName( aTypeName ); //Reference<XIdlClass> xPropClass = rProp.Type; if( xPropClass.is() && xPropClass->getTypeClass() == TypeClass_INTERFACE ) @@ -571,7 +571,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal } } -Any IntrospectionAccessStatic_Impl::getPropertyValue( const Any& obj, const OUString& aPropertyName ) const +Any IntrospectionAccessStatic_Impl::getPropertyValue( const Any& obj, const ::rtl::OUString& aPropertyName ) const { sal_Int32 i = getPropertyIndex( aPropertyName ); if( i != -1 ) @@ -728,6 +728,92 @@ void IntrospectionAccessStatic_Impl::checkInterfaceArraySize( Sequence< Referenc //******************************* +//*** ImplIntrospectionAccess *** +//******************************* + +// Neue Impl-Klasse im Rahmen der Introspection-Umstellung auf Instanz-gebundene +// Introspection mit Property-Zugriff ueber XPropertySet. Die alte Klasse +// ImplIntrospectionAccess lebt als IntrospectionAccessStatic_Impl +class ImplIntrospectionAccess : public IntrospectionAccessHelper +{ + friend class ImplIntrospection; + + // Untersuchtes Objekt + Any maInspectedObject; + + // Als Interface + Reference<XInterface> mxIface; + + // Statische Daten der Introspection + IntrospectionAccessStatic_Impl* mpStaticImpl; + + // Adapter-Implementation + WeakReference< XInterface > maAdapter; + + // Letzte Sequence, die bei getProperties geliefert wurde (Optimierung) + Sequence<Property> maLastPropertySeq; + sal_Int32 mnLastPropertyConcept; + + // Letzte Sequence, die bei getMethods geliefert wurde (Optimierung) + Sequence<Reference<XIdlMethod> > maLastMethodSeq; + sal_Int32 mnLastMethodConcept; + +public: + ImplIntrospectionAccess( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ ); + ~ImplIntrospectionAccess(); + + // Methoden von XIntrospectionAccess + virtual sal_Int32 SAL_CALL getSuppliedMethodConcepts(void) + throw( RuntimeException ); + virtual sal_Int32 SAL_CALL getSuppliedPropertyConcepts(void) + throw( RuntimeException ); + virtual Property SAL_CALL getProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts) + throw( NoSuchElementException, RuntimeException ); + virtual sal_Bool SAL_CALL hasProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts) + throw( RuntimeException ); + virtual Sequence< Property > SAL_CALL getProperties(sal_Int32 PropertyConcepts) + throw( RuntimeException ); + virtual Reference<XIdlMethod> SAL_CALL getMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts) + throw( NoSuchMethodException, RuntimeException ); + virtual sal_Bool SAL_CALL hasMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts) + throw( RuntimeException ); + virtual Sequence< Reference<XIdlMethod> > SAL_CALL getMethods(sal_Int32 MethodConcepts) + throw( RuntimeException ); + virtual Sequence< Type > SAL_CALL getSupportedListeners(void) + throw( RuntimeException ); + using OWeakObject::queryAdapter; + virtual Reference<XInterface> SAL_CALL queryAdapter( const Type& rType ) + throw( IllegalTypeException, RuntimeException ); + + // Methoden von XMaterialHolder + virtual Any SAL_CALL getMaterial(void) throw(RuntimeException); + + // Methoden von XExactName + virtual ::rtl::OUString SAL_CALL getExactName( const ::rtl::OUString& rApproximateName ) throw( RuntimeException ); +}; + +ImplIntrospectionAccess::ImplIntrospectionAccess + ( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ ) + : maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ), maAdapter() +{ + mpStaticImpl->acquire(); + + // Objekt als Interface merken, wenn moeglich + TypeClass eType = maInspectedObject.getValueType().getTypeClass(); + if( eType == TypeClass_INTERFACE ) + mxIface = *(Reference<XInterface>*)maInspectedObject.getValue(); + + mnLastPropertyConcept = -1; + mnLastMethodConcept = -1; +} + +ImplIntrospectionAccess::~ImplIntrospectionAccess() +{ + mpStaticImpl->release(); +} + + +//******************************* //*** ImplIntrospectionAdapter *** //******************************* @@ -741,7 +827,7 @@ class ImplIntrospectionAdapter : public OWeakObject { // Parent-Objekt - ImplIntrospectionAccess* mpAccess; + ::rtl::Reference< ImplIntrospectionAccess > mpAccess; // Untersuchtes Objekt const Any& mrInspectedObject; @@ -773,17 +859,17 @@ public: // Methoden von XPropertySet virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( RuntimeException ); - virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const Any& aValue) + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ); - virtual Any SAL_CALL getPropertyValue(const OUString& aPropertyName) + virtual Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) + virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) + virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addVetoableChangeListener(const OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) + virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removeVetoableChangeListener(const OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) + virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); // Methoden von XFastPropertySet @@ -794,25 +880,25 @@ public: // Methoden von XPropertySetInfo virtual Sequence< Property > SAL_CALL getProperties(void) throw( RuntimeException ); - virtual Property SAL_CALL getPropertyByName(const OUString& Name) throw( RuntimeException ); - virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& Name) throw( RuntimeException ); + virtual Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ); + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ); // Methoden von XElementAccess virtual Type SAL_CALL getElementType(void) throw( RuntimeException ); virtual sal_Bool SAL_CALL hasElements(void) throw( RuntimeException ); // Methoden von XNameAccess - virtual Any SAL_CALL getByName(const OUString& Name) + virtual Any SAL_CALL getByName(const ::rtl::OUString& Name) throw( NoSuchElementException, WrappedTargetException, RuntimeException ); - virtual Sequence<OUString> SAL_CALL getElementNames(void) throw( RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const OUString& Name) throw( RuntimeException ); + virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames(void) throw( RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& Name) throw( RuntimeException ); // Methoden von XNameContainer - virtual void SAL_CALL insertByName(const OUString& Name, const Any& Element) + virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const Any& Element) throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL replaceByName(const OUString& Name, const Any& Element) + virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const Any& Element) throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removeByName(const OUString& Name) + virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw( NoSuchElementException, WrappedTargetException, RuntimeException ); // Methoden von XIndexAccess @@ -899,96 +985,6 @@ Any SAL_CALL ImplIntrospectionAdapter::queryInterface( const Type& rType ) } -//******************************* -//*** ImplIntrospectionAccess *** -//******************************* - -// Neue Impl-Klasse im Rahmen der Introspection-Umstellung auf Instanz-gebundene -// Introspection mit Property-Zugriff ueber XPropertySet. Die alte Klasse -// ImplIntrospectionAccess lebt als IntrospectionAccessStatic_Impl -class ImplIntrospectionAccess : IntrospectionAccessHelper -{ - friend class ImplIntrospection; - - // Untersuchtes Objekt - Any maInspectedObject; - - // Als Interface - Reference<XInterface> mxIface; - - // Statische Daten der Introspection - IntrospectionAccessStatic_Impl* mpStaticImpl; - - // Adapter-Implementation - ImplIntrospectionAdapter* mpAdapter; - - // Letzte Sequence, die bei getProperties geliefert wurde (Optimierung) - Sequence<Property> maLastPropertySeq; - sal_Int32 mnLastPropertyConcept; - - // Letzte Sequence, die bei getMethods geliefert wurde (Optimierung) - Sequence<Reference<XIdlMethod> > maLastMethodSeq; - sal_Int32 mnLastMethodConcept; - -public: - ImplIntrospectionAccess( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ ); - ~ImplIntrospectionAccess(); - - // Methoden von XIntrospectionAccess - virtual sal_Int32 SAL_CALL getSuppliedMethodConcepts(void) - throw( RuntimeException ); - virtual sal_Int32 SAL_CALL getSuppliedPropertyConcepts(void) - throw( RuntimeException ); - virtual Property SAL_CALL getProperty(const OUString& Name, sal_Int32 PropertyConcepts) - throw( NoSuchElementException, RuntimeException ); - virtual sal_Bool SAL_CALL hasProperty(const OUString& Name, sal_Int32 PropertyConcepts) - throw( RuntimeException ); - virtual Sequence< Property > SAL_CALL getProperties(sal_Int32 PropertyConcepts) - throw( RuntimeException ); - virtual Reference<XIdlMethod> SAL_CALL getMethod(const OUString& Name, sal_Int32 MethodConcepts) - throw( NoSuchMethodException, RuntimeException ); - virtual sal_Bool SAL_CALL hasMethod(const OUString& Name, sal_Int32 MethodConcepts) - throw( RuntimeException ); - virtual Sequence< Reference<XIdlMethod> > SAL_CALL getMethods(sal_Int32 MethodConcepts) - throw( RuntimeException ); - virtual Sequence< Type > SAL_CALL getSupportedListeners(void) - throw( RuntimeException ); - using OWeakObject::queryAdapter; - virtual Reference<XInterface> SAL_CALL queryAdapter( const Type& rType ) - throw( IllegalTypeException, RuntimeException ); - - // Methoden von XMaterialHolder - virtual Any SAL_CALL getMaterial(void) throw(RuntimeException); - - // Methoden von XExactName - virtual OUString SAL_CALL getExactName( const OUString& rApproximateName ) throw( RuntimeException ); -}; - -ImplIntrospectionAccess::ImplIntrospectionAccess - ( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ ) - : maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ), mpAdapter( NULL ) -{ - mpStaticImpl->acquire(); - - // Objekt als Interface merken, wenn moeglich - TypeClass eType = maInspectedObject.getValueType().getTypeClass(); - if( eType == TypeClass_INTERFACE ) - mxIface = *(Reference<XInterface>*)maInspectedObject.getValue(); - - mnLastPropertyConcept = -1; - mnLastMethodConcept = -1; -} - -ImplIntrospectionAccess::~ImplIntrospectionAccess() -{ - mpStaticImpl->release(); - - // Eigene Referenz loslassen - if (mpAdapter) - mpAdapter->release(); -} - - //*************************************************** //*** Implementation von ImplIntrospectionAdapter *** //*************************************************** @@ -1000,19 +996,19 @@ Reference<XPropertySetInfo> ImplIntrospectionAdapter::getPropertySetInfo(void) return (XPropertySetInfo *)this; } -void ImplIntrospectionAdapter::setPropertyValue(const OUString& aPropertyName, const Any& aValue) +void ImplIntrospectionAdapter::setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ) { mpStaticImpl->setPropertyValue( mrInspectedObject, aPropertyName, aValue ); } -Any ImplIntrospectionAdapter::getPropertyValue(const OUString& aPropertyName) +Any ImplIntrospectionAdapter::getPropertyValue(const ::rtl::OUString& aPropertyName) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) { return mpStaticImpl->getPropertyValue( mrInspectedObject, aPropertyName ); } -void ImplIntrospectionAdapter::addPropertyChangeListener(const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) +void ImplIntrospectionAdapter::addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) { if( mxIface.is() ) @@ -1025,7 +1021,7 @@ void ImplIntrospectionAdapter::addPropertyChangeListener(const OUString& aProper } } -void ImplIntrospectionAdapter::removePropertyChangeListener(const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) +void ImplIntrospectionAdapter::removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) { if( mxIface.is() ) @@ -1038,7 +1034,7 @@ void ImplIntrospectionAdapter::removePropertyChangeListener(const OUString& aPro } } -void ImplIntrospectionAdapter::addVetoableChangeListener(const OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) +void ImplIntrospectionAdapter::addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) { if( mxIface.is() ) @@ -1051,7 +1047,7 @@ void ImplIntrospectionAdapter::addVetoableChangeListener(const OUString& aProper } } -void ImplIntrospectionAdapter::removeVetoableChangeListener(const OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) +void ImplIntrospectionAdapter::removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) { if( mxIface.is() ) @@ -1082,13 +1078,13 @@ Sequence< Property > ImplIntrospectionAdapter::getProperties(void) throw( Runtim return mpStaticImpl->getProperties(); } -Property ImplIntrospectionAdapter::getPropertyByName(const OUString& Name) +Property ImplIntrospectionAdapter::getPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) { return mpAccess->getProperty( Name, PropertyConcept::ALL ); } -sal_Bool ImplIntrospectionAdapter::hasPropertyByName(const OUString& Name) +sal_Bool ImplIntrospectionAdapter::hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) { return mpAccess->hasProperty( Name, PropertyConcept::ALL ); @@ -1106,38 +1102,38 @@ sal_Bool ImplIntrospectionAdapter::hasElements(void) throw( RuntimeException ) } // Methoden von XNameAccess -Any ImplIntrospectionAdapter::getByName(const OUString& Name) +Any ImplIntrospectionAdapter::getByName(const ::rtl::OUString& Name) throw( NoSuchElementException, WrappedTargetException, RuntimeException ) { return mxObjNameAccess->getByName( Name ); } -Sequence< OUString > ImplIntrospectionAdapter::getElementNames(void) +Sequence< ::rtl::OUString > ImplIntrospectionAdapter::getElementNames(void) throw( RuntimeException ) { return mxObjNameAccess->getElementNames(); } -sal_Bool ImplIntrospectionAdapter::hasByName(const OUString& Name) +sal_Bool ImplIntrospectionAdapter::hasByName(const ::rtl::OUString& Name) throw( RuntimeException ) { return mxObjNameAccess->hasByName( Name ); } // Methoden von XNameContainer -void ImplIntrospectionAdapter::insertByName(const OUString& Name, const Any& Element) +void ImplIntrospectionAdapter::insertByName(const ::rtl::OUString& Name, const Any& Element) throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException ) { mxObjNameContainer->insertByName( Name, Element ); } -void ImplIntrospectionAdapter::replaceByName(const OUString& Name, const Any& Element) +void ImplIntrospectionAdapter::replaceByName(const ::rtl::OUString& Name, const Any& Element) throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException ) { mxObjNameContainer->replaceByName( Name, Element ); } -void ImplIntrospectionAdapter::removeByName(const OUString& Name) +void ImplIntrospectionAdapter::removeByName(const ::rtl::OUString& Name) throw( NoSuchElementException, WrappedTargetException, RuntimeException ) { mxObjNameContainer->removeByName( Name ); @@ -1233,7 +1229,7 @@ sal_Int32 ImplIntrospectionAccess::getSuppliedPropertyConcepts(void) METHODS; } -Property ImplIntrospectionAccess::getProperty(const OUString& Name, sal_Int32 PropertyConcepts) +Property ImplIntrospectionAccess::getProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts) throw( NoSuchElementException, RuntimeException ) { Property aRet; @@ -1254,7 +1250,7 @@ Property ImplIntrospectionAccess::getProperty(const OUString& Name, sal_Int32 Pr return aRet; } -sal_Bool ImplIntrospectionAccess::hasProperty(const OUString& Name, sal_Int32 PropertyConcepts) +sal_Bool ImplIntrospectionAccess::hasProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts) throw( RuntimeException ) { sal_Int32 i = mpStaticImpl->getPropertyIndex( Name ); @@ -1319,7 +1315,7 @@ Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyCo /* // Property mit Concepts ausgeben - OUString aPropName = pSourceProps[ i ].Name; + ::rtl::OUString aPropName = pSourceProps[ i ].Name; String aNameStr = OOUStringToString(aPropName, CHARSET_SYSTEM); String ConceptStr; if( nConcept & PROPERTYSET ) @@ -1339,7 +1335,7 @@ Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyCo return maLastPropertySeq; } -Reference<XIdlMethod> ImplIntrospectionAccess::getMethod(const OUString& Name, sal_Int32 MethodConcepts) +Reference<XIdlMethod> ImplIntrospectionAccess::getMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts) throw( NoSuchMethodException, RuntimeException ) { Reference<XIdlMethod> xRet; @@ -1359,7 +1355,7 @@ Reference<XIdlMethod> ImplIntrospectionAccess::getMethod(const OUString& Name, s return xRet; } -sal_Bool ImplIntrospectionAccess::hasMethod(const OUString& Name, sal_Int32 MethodConcepts) +sal_Bool ImplIntrospectionAccess::hasMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts) throw( RuntimeException ) { sal_Int32 i = mpStaticImpl->getMethodIndex( Name ); @@ -1463,20 +1459,15 @@ Reference<XInterface> SAL_CALL ImplIntrospectionAccess::queryAdapter( const Type throw( IllegalTypeException, RuntimeException ) { // Gibt es schon einen Adapter? - if( !mpAdapter ) + Reference< XInterface > xAdapter( maAdapter ); + if( !xAdapter.is() ) { - ((ImplIntrospectionAccess*)this)->mpAdapter = - new ImplIntrospectionAdapter( this, maInspectedObject, mpStaticImpl ); - - // Selbst eine Referenz halten - mpAdapter->acquire(); + xAdapter = *( new ImplIntrospectionAdapter( this, maInspectedObject, mpStaticImpl ) ); + maAdapter = xAdapter; } Reference<XInterface> xRet; - Any aIfaceAny( mpAdapter->queryInterface( rType ) ); - if( aIfaceAny.hasValue() ) - xRet = *(Reference<XInterface>*)aIfaceAny.getValue(); - + xAdapter->queryInterface( rType ) >>= xRet; return xRet; } @@ -1486,20 +1477,20 @@ Any ImplIntrospectionAccess::getMaterial(void) throw(RuntimeException) return maInspectedObject; } -// Hilfs-Funktion zur LowerCase-Wandlung eines OUString -OUString toLower( OUString aUStr ) +// Hilfs-Funktion zur LowerCase-Wandlung eines ::rtl::OUString +::rtl::OUString toLower( ::rtl::OUString aUStr ) { // Tabelle fuer XExactName pflegen ::rtl::OUString aOWStr( aUStr.getStr() ); ::rtl::OUString aOWLowerStr = aOWStr.toAsciiLowerCase(); - OUString aLowerUStr( aOWLowerStr.getStr() ); + ::rtl::OUString aLowerUStr( aOWLowerStr.getStr() ); return aLowerUStr; } // Methoden von XExactName -OUString ImplIntrospectionAccess::getExactName( const OUString& rApproximateName ) throw( RuntimeException ) +::rtl::OUString ImplIntrospectionAccess::getExactName( const ::rtl::OUString& rApproximateName ) throw( RuntimeException ) { - OUString aRetStr; + ::rtl::OUString aRetStr; LowerToExactNameMap::iterator aIt = mpStaticImpl->maLowerToExactNameMap.find( toLower( rApproximateName ) ); if( !( aIt == mpStaticImpl->maLowerToExactNameMap.end() ) ) @@ -1750,11 +1741,11 @@ public: Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw( RuntimeException ); // XServiceInfo - OUString SAL_CALL getImplementationName() throw(); - sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(); - Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw(); - static OUString SAL_CALL getImplementationName_Static( ); - static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static(void) throw(); + ::rtl::OUString SAL_CALL getImplementationName() throw(); + sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(); + Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(); + static ::rtl::OUString SAL_CALL getImplementationName_Static( ); + static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw(); // Methoden von XIntrospection virtual Reference<XIntrospectionAccess> SAL_CALL inspect(const Any& aToInspectObj) @@ -1787,7 +1778,7 @@ ImplIntrospection::ImplIntrospection( const Reference<XMultiServiceFactory> & rX #endif // Spezielle Klassen holen -// Reference< XInterface > xServiceIface = m_xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ); +// Reference< XInterface > xServiceIface = m_xSMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ); // if( xServiceIface.is() ) // mxCoreReflection = Reference< XIdlReflection >::query( xServiceIface ); Reference< XPropertySet > xProps( rXSMgr, UNO_QUERY ); @@ -1796,30 +1787,30 @@ ImplIntrospection::ImplIntrospection( const Reference<XMultiServiceFactory> & rX { Reference< XComponentContext > xContext; xProps->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; OSL_ASSERT( xContext.is() ); if (xContext.is()) { xContext->getValueByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection") ) ) >>= mxCoreReflection; + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection") ) ) >>= mxCoreReflection; OSL_ENSURE( mxCoreReflection.is(), "### CoreReflection singleton not accessible!?" ); } } if (! mxCoreReflection.is()) { throw DeploymentException( - OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection singleton not accessible") ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection singleton not accessible") ), Reference< XInterface >() ); } - mxElementAccessClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XElementAccess")) ); - mxNameContainerClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameContainer")) ); - mxNameAccessClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameAccess")) ); - mxIndexContainerClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexContainer")) ); - mxIndexAccessClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexAccess")) ); - mxEnumerationAccessClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XEnumerationAccess")) ); - mxInterfaceClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")) ); - mxAggregationClass = mxCoreReflection->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XAggregation")) ); + mxElementAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XElementAccess")) ); + mxNameContainerClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameContainer")) ); + mxNameAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameAccess")) ); + mxIndexContainerClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexContainer")) ); + mxIndexAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexAccess")) ); + mxEnumerationAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XEnumerationAccess")) ); + mxInterfaceClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")) ); + mxAggregationClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XAggregation")) ); mbDisposed = sal_False; } @@ -1900,16 +1891,16 @@ Sequence< sal_Int8 > ImplIntrospection::getImplementationId() // XServiceInfo -OUString ImplIntrospection::getImplementationName() throw() +::rtl::OUString ImplIntrospection::getImplementationName() throw() { return getImplementationName_Static(); } // XServiceInfo -sal_Bool ImplIntrospection::supportsService(const OUString& ServiceName) throw() +sal_Bool ImplIntrospection::supportsService(const ::rtl::OUString& ServiceName) throw() { - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); + Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames(); + const ::rtl::OUString * pArray = aSNL.getConstArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) return sal_True; @@ -1917,23 +1908,23 @@ sal_Bool ImplIntrospection::supportsService(const OUString& ServiceName) throw() } // XServiceInfo -Sequence< OUString > ImplIntrospection::getSupportedServiceNames(void) throw() +Sequence< ::rtl::OUString > ImplIntrospection::getSupportedServiceNames(void) throw() { return getSupportedServiceNames_Static(); } //************************************************************************* // Helper XServiceInfo -OUString ImplIntrospection::getImplementationName_Static( ) +::rtl::OUString ImplIntrospection::getImplementationName_Static( ) { - return OUString::createFromAscii( IMPLEMENTATION_NAME ); + return ::rtl::OUString::createFromAscii( IMPLEMENTATION_NAME ); } // ORegistryServiceManager_Static -Sequence< OUString > ImplIntrospection::getSupportedServiceNames_Static(void) throw() +Sequence< ::rtl::OUString > ImplIntrospection::getSupportedServiceNames_Static(void) throw() { - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString::createFromAscii( SERVICE_NAME ); + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( SERVICE_NAME ); return aSNS; } @@ -2013,10 +2004,10 @@ Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XMultiS rType.getDescription( &pTD ); if( pTD ) { - OUString sOWName( pTD->pTypeName ); + ::rtl::OUString sOWName( pTD->pTypeName ); if( !xRefl.is() ) { - xRefl = Reference< XIdlReflection >( xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ), UNO_QUERY ); + xRefl = Reference< XIdlReflection >( xMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ), UNO_QUERY ); OSL_ENSURE( xRefl.is(), "### no corereflection!" ); } xRetClass = xRefl->forName( sOWName ); @@ -2302,7 +2293,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns pAccess->mnPropertySetPropCount++; // Namen in Hashtable eintragen, wenn nicht schon bekannt - OUString aPropName = rProp.Name; + ::rtl::OUString aPropName = rProp.Name; // Haben wir den Namen schon? IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName ); @@ -2317,9 +2308,9 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns else { OSL_ENSURE( sal_False, - OString( "Introspection: Property \"" ) + - OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ) + - OString( "\" found more than once in PropertySet" ) ); + ::rtl::OString( "Introspection: Property \"" ) + + ::rtl::OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ) + + ::rtl::OString( "\" found more than once in PropertySet" ) ); } // Count pflegen @@ -2404,7 +2395,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns // In eigenes Property-Array eintragen Property& rProp = pAllPropArray[ rPropCount ]; - OUString aFieldName = xField->getName(); + ::rtl::OUString aFieldName = xField->getName(); rProp.Name = aFieldName; rProp.Handle = rPropCount; Type aFieldType( xPropType->getTypeClass(), xPropType->getName() ); @@ -2415,7 +2406,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns ? READONLY : 0; // Namen in Hashtable eintragen - OUString aPropName = rProp.Name; + ::rtl::OUString aPropName = rProp.Name; // Haben wir den Namen schon? IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName ); @@ -2475,9 +2466,9 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns pLocalMethodConcepts[ i ] = 0; } - OUString aMethName; - OUString aPropName; - OUString aStartStr; + ::rtl::OUString aMethName; + ::rtl::OUString aPropName; + ::rtl::OUString aStartStr; for( i = 0 ; i < nSourceMethodCount ; i++ ) { // Methode ansprechen @@ -2502,7 +2493,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns } else { - if( aMethName != OUString( RTL_CONSTASCII_USTRINGPARAM("queryInterface")) ) + if( aMethName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("queryInterface")) ) { rMethodConcept_i |= MethodConcept::DANGEROUS; continue; @@ -2511,7 +2502,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns } else if( rxMethod_i->getDeclaringClass()->equals( mxAggregationClass ) ) { - if( aMethName == OUString( RTL_CONSTASCII_USTRINGPARAM("setDelegator")) ) + if( aMethName == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setDelegator")) ) { rMethodConcept_i |= MethodConcept::DANGEROUS; continue; @@ -2544,7 +2535,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns // Ist es eine get-Methode? aStartStr = aMethName.copy( 0, 3 ); - if( aStartStr == OUString( RTL_CONSTASCII_USTRINGPARAM("get")) ) + if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("get")) ) { // Namen der potentiellen Property aPropName = aMethName.copy( 3 ); @@ -2614,15 +2605,15 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns continue; // Name holen und auswerten - OUString aMethName2 = rxMethod_k->getName(); - OUString aStartStr2 = aMethName2.copy( 0, 3 ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! - if( !( aStartStr2 == OUString( RTL_CONSTASCII_USTRINGPARAM("set")) ) ) + ::rtl::OUString aMethName2 = rxMethod_k->getName(); + ::rtl::OUString aStartStr2 = aMethName2.copy( 0, 3 ); + // ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!! + if( !( aStartStr2 == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("set")) ) ) continue; // Ist es denn der gleiche Name? - OUString aPropName2 = aMethName2.copy( 3 ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! + ::rtl::OUString aPropName2 = aMethName2.copy( 3 ); + // ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!! if( !( aPropName == aPropName2 ) ) continue; @@ -2665,22 +2656,22 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns } // Ist es eine addListener-Methode? - else if( aStartStr == OUString( RTL_CONSTASCII_USTRINGPARAM("add")) ) + else if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("add")) ) { - OUString aListenerStr( RTL_CONSTASCII_USTRINGPARAM("Listener" ) ); + ::rtl::OUString aListenerStr( RTL_CONSTASCII_USTRINGPARAM("Listener" ) ); // Namen der potentiellen Property sal_Int32 nStrLen = aMethName.getLength(); sal_Int32 nCopyLen = nStrLen - aListenerStr.getLength(); - OUString aEndStr = aMethName.copy( nCopyLen > 0 ? nCopyLen : 0 ); + ::rtl::OUString aEndStr = aMethName.copy( nCopyLen > 0 ? nCopyLen : 0 ); // Endet das Teil auf Listener? - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! + // ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!! if( !( aEndStr == aListenerStr ) ) continue; // Welcher Listener? - OUString aListenerName = aMethName.copy( 3, nStrLen - aListenerStr.getLength() - 3 ); + ::rtl::OUString aListenerName = aMethName.copy( 3, nStrLen - aListenerStr.getLength() - 3 ); // TODO: Hier koennten noch genauere Pruefungen vorgenommen werden // - Rueckgabe-Typ @@ -2699,21 +2690,21 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns continue; // Name holen und auswerten - OUString aMethName2 = rxMethod_k->getName(); + ::rtl::OUString aMethName2 = rxMethod_k->getName(); sal_Int32 nNameLen = aMethName2.getLength(); sal_Int32 nCopyLen2 = (nNameLen < 6) ? nNameLen : 6; - OUString aStartStr2 = aMethName2.copy( 0, nCopyLen2 ); - OUString aRemoveStr( RTL_CONSTASCII_USTRINGPARAM("remove" ) ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! + ::rtl::OUString aStartStr2 = aMethName2.copy( 0, nCopyLen2 ); + ::rtl::OUString aRemoveStr( RTL_CONSTASCII_USTRINGPARAM("remove" ) ); + // ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!! if( !( aStartStr2 == aRemoveStr ) ) continue; // Ist es denn der gleiche Listener? if( aMethName2.getLength() - aRemoveStr.getLength() <= aListenerStr.getLength() ) continue; - OUString aListenerName2 = aMethName2.copy + ::rtl::OUString aListenerName2 = aMethName2.copy ( 6, aMethName2.getLength() - aRemoveStr.getLength() - aListenerStr.getLength() ); - // ACHTUNG: Wegen SDL-Bug NICHT != bei OUString verwenden !!! + // ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!! if( !( aListenerName == aListenerName2 ) ) continue; @@ -2754,7 +2745,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns // Ist es eine set-Methode ohne zugehoerige get-Methode? aStartStr = aMethName.copy( 0, 3 ); - if( aStartStr == OUString( RTL_CONSTASCII_USTRINGPARAM("set")) ) + if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("set")) ) { // Namen der potentiellen Property aPropName = aMethName.copy( 3 ); @@ -2862,7 +2853,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns const Reference<XIdlMethod>& rxMethod = pSourceMethods[i]; // Namen in Hashtable eintragen, wenn nicht schon bekannt - OUString aMethName2 = rxMethod->getName(); + ::rtl::OUString aMethName2 = rxMethod->getName(); IntrospectionNameMap::iterator aIt = rMethodNameMap.find( aMethName2 ); if( aIt == rMethodNameMap.end() ) { @@ -2998,7 +2989,7 @@ IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToIns { Reference<XIdlField> xField = pFields[i]; Reference<XIdlClass> xPropType = xField->getType(); - OUString aPropName = xField->getName(); + ::rtl::OUString aPropName = xField->getName(); // Ist die PropertySequence gross genug? pAccess->checkPropertyArraysSize @@ -3073,7 +3064,7 @@ void * SAL_CALL component_getFactory( { Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), + ::rtl::OUString::createFromAscii( pImplName ), stoc_inspect::ImplIntrospection_CreateInstance, stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static() ) ); diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx index 57a26c3109ec..6cebbbb4bbb2 100644 --- a/svl/inc/svl/undo.hxx +++ b/svl/inc/svl/undo.hxx @@ -311,9 +311,14 @@ namespace svl /** clears the redo stack and removes the top undo action */ virtual void RemoveLastUndoAction() = 0; - // enables (true) or disables (false) recording of undo actions - // If undo actions are added while undo is disabled, they are deleted. - // Disabling undo does not clear the current undo buffer! + /** enables (true) or disables (false) recording of undo actions + + If undo actions are added while undo is disabled, they are deleted. + Disabling undo does not clear the current undo buffer! + + Multiple calls to <code>EnableUndo</code> are not cumulative. That is, calling <code>EnableUndo( false )</code> + twice, and then calling <code>EnableUndo( true )</code> means that Undo is enable afterwards. + */ virtual void EnableUndo( bool bEnable ) = 0; // returns true if undo is currently enabled diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index fae0250e9002..5e1e49f397b2 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -186,9 +186,9 @@ struct SVL_DLLPRIVATE SfxUndoManager_Data SfxUndoArray* pActUndoArray; SfxUndoArray* pFatherUndoArray; - sal_Int32 mnLockCount; sal_Int32 mnMarks; sal_Int32 mnEmptyMark; + bool mbUndoEnabled; bool mbDoing; bool mbClearUntilTopLevel; @@ -198,9 +198,9 @@ struct SVL_DLLPRIVATE SfxUndoManager_Data :pUndoArray( new SfxUndoArray( i_nMaxUndoActionCount ) ) ,pActUndoArray( NULL ) ,pFatherUndoArray( NULL ) - ,mnLockCount( 0 ) ,mnMarks( 0 ) ,mnEmptyMark(MARK_INVALID) + ,mbUndoEnabled( true ) ,mbDoing( false ) ,mbClearUntilTopLevel( false ) { @@ -421,14 +421,9 @@ void SfxUndoManager::EnableUndo( bool i_enable ) void SfxUndoManager::ImplEnableUndo_Lock( bool const i_enable ) { - if ( !i_enable ) - ++m_pData->mnLockCount; - else - { - OSL_PRECOND( m_pData->mnLockCount > 0, "SfxUndoManager::ImplEnableUndo_NoNotify: not disabled, so why enabling?" ); - if ( m_pData->mnLockCount > 0 ) - --m_pData->mnLockCount; - } + if ( m_pData->mbUndoEnabled == i_enable ) + return; + m_pData->mbUndoEnabled = i_enable; } //------------------------------------------------------------------------ @@ -443,7 +438,7 @@ bool SfxUndoManager::IsUndoEnabled() const bool SfxUndoManager::ImplIsUndoEnabled_Lock() const { - return m_pData->mnLockCount == 0; + return m_pData->mbUndoEnabled; } //------------------------------------------------------------------------ diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index d7bd98481404..186c83d75be8 100644 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -111,7 +111,9 @@ public: virtual sal_Bool HasRowHeader() const= 0; virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0; virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0; + virtual Rectangle calcHeaderCellRect( sal_Bool _bColHeader, sal_Int32 _nPos ) = 0; virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0; + virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) = 0; virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0; virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0; virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0; @@ -165,6 +167,33 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getTable() = 0; + /** commits the event at all listeners of the cell + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + virtual void commitCellEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue + ) = 0; + /** commits the event at all listeners of the table + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + virtual void commitTableEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue + ) = 0; + ///** Commits an event to all listeners. */ virtual void commitEvent( sal_Int16 nEventId, diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index c472fa408574..d7196419e2e5 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -90,15 +90,15 @@ namespace svt { namespace table virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ); - virtual void PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected, + virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle ); virtual void PaintRowHeader( - bool _bActive, bool _bSelected, + bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ); virtual void PaintCell( ColPos const i_col, - bool _bActive, bool _bSelected, + bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ); virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect); @@ -108,7 +108,12 @@ namespace svt { namespace table ColPos const i_colPos, RowPos const i_rowPos, bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea - ); + ) const; + virtual bool GetFormattedCellString( + ::com::sun::star::uno::Any const & i_cellValue, + ColPos const i_colPos, RowPos const i_rowPos, + ::rtl::OUString & o_cellString + ) const; private: struct CellRenderContext; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 8afc2209227c..6237e4fb9b6a 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -169,9 +169,14 @@ namespace svt { namespace table SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; - virtual void FillAccessibleStateSet( - ::utl::AccessibleStateSetHelper& rStateSet, - AccessibleTableControlObjType eObjType ) const; + SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const; + + // temporary methods + // Those do not really belong into the public API - they're intended for firing A11Y-related events. However, + // firing those events should be an implementation internal to the TableControl resp. TableControl_Impl, + // instead of something triggered externally. + void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const ::com::sun::star::uno::Any& i_newValue, const ::com::sun::star::uno::Any& i_oldValue ); + void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const ::com::sun::star::uno::Any& i_newValue, const ::com::sun::star::uno::Any& i_oldValue ); // ............................................................................................................. // IAccessibleTable @@ -187,7 +192,9 @@ namespace svt { namespace table virtual sal_Bool HasRowHeader() const; virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ); virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ); + virtual Rectangle calcHeaderCellRect( sal_Bool _bIsColumnBar, sal_Int32 nPos); virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ); + virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ); virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const; @@ -208,9 +215,6 @@ namespace svt { namespace table // ............................................................................................................. private: - DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); private: diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 94f03b684e64..9cfc30c1a338 100755..100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -472,6 +472,30 @@ namespace svt { namespace table */ virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0; + /** returns the color to be used for the background of selected cells, when the control has the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const = 0; + + /** returns the color to be used for the background of selected cells, when the control does not have the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const = 0; + + /** returns the color to be used for the text of selected cells, when the control has the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const = 0; + + /** returns the color to be used for the text of selected cells, when the control does not have the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const = 0; + /** returns the color to be used for rendering cell texts. If this value is not set, a default color from the style settings will be used. diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index 3d50c9d70ee7..73d41028bf1f 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -133,9 +133,8 @@ namespace svt { namespace table However, the renderer is also allowed to render any cell-independent content of this row. - @param _bActive - <TRUE/> if and only if the row to be painted contains the - currently active cell. + @param i_hasControlFocus + <TRUE/> if and only if the table control currently has the focus @param _bSelected <TRUE/> if and only if the row to be prepared is selected currently. @@ -147,7 +146,7 @@ namespace svt { namespace table @param _rStyle the style to be used for drawing */ - virtual void PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected, + virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle ) = 0; @@ -156,9 +155,8 @@ namespace svt { namespace table The row to be painted is denoted by the most recent call to ->PrepareRow. - @param _bActive - <TRUE/> if and only if the row to be painted contains the - currently active cell. + @param i_hasControlFocus + <TRUE/> if and only if the table control currently has the focus <br/> Note that this flag is equal to the respective flag in the previous ->PrepareRow call, it's passed here for convinience @@ -177,9 +175,9 @@ namespace svt { namespace table @param _rStyle the style to be used for drawing */ - virtual void PaintRowHeader( bool _bActive, bool _bSelected, - OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle ) = 0; + virtual void PaintRowHeader( bool i_hasControlFocus, bool _bSelected, + OutputDevice& _rDevice, Rectangle const & _rArea, + StyleSettings const & _rStyle ) = 0; /** paints a certain cell @@ -194,8 +192,8 @@ namespace svt { namespace table Note that this flag is equal to the respective flag in the previous ->PrepareRow call, it's passed here for convinience only. - @param _bActive - <TRUE/> if the cell is currently active. + @param i_hasControlFocus + <TRUE/> if and only if the table control currently has the focus <br/> Note that this flag is equal to the respective flag in the previous ->PrepareRow call, it's passed here for convinience @@ -208,7 +206,7 @@ namespace svt { namespace table the style to be used for drawing */ virtual void PaintCell( ColPos const i_col, - bool _bActive, bool _bSelected, + bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) = 0; @@ -259,7 +257,26 @@ namespace svt { namespace table ColPos const i_colPos, RowPos const i_rowPos, bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea - ) = 0; + ) const = 0; + + /** attempts to format the content of the given cell as string + + @param i_cellValue + the value for which an attempt for a string conversion should be made + @param i_colPos + the column position of the cell in question + @param i_rowPos + the row position of the cell in question + @param o_cellString + the cell content, formatted as string + @return + <TRUE/> if and only if the content could be formatted as string + */ + virtual bool GetFormattedCellString( + ::com::sun::star::uno::Any const & i_cellValue, + ColPos const i_colPos, RowPos const i_rowPos, + ::rtl::OUString & o_cellString + ) const = 0; /// deletes the renderer instance virtual ~ITableRenderer() { } diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 286ca505bb30..18e28c2cdc82 100755..100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx @@ -29,8 +29,27 @@ #include "cellvalueconversion.hxx" /** === begin UNO includes === **/ +#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/XNumberFormatTypes.hpp> +#include <com/sun/star/util/NumberFormat.hpp> /** === end UNO includes === **/ +#include <comphelper/componentcontext.hxx> +#include <rtl/math.hxx> +#include <rtl/strbuf.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/diagnose_ex.h> +#include <unotools/syslocale.hxx> + +#include <boost/shared_ptr.hpp> +#include <hash_map> + //...................................................................................................................... namespace svt { @@ -38,36 +57,432 @@ namespace svt /** === begin UNO using === **/ using ::com::sun::star::uno::Any; + using ::com::sun::star::util::XNumberFormatter; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::util::XNumberFormatsSupplier; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::util::DateTime; + using ::com::sun::star::uno::TypeClass; + using ::com::sun::star::util::XNumberFormatTypes; + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::TypeClass_BYTE; + using ::com::sun::star::uno::TypeClass_SHORT; + using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT; + using ::com::sun::star::uno::TypeClass_LONG; + using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG; + using ::com::sun::star::uno::TypeClass_HYPER; /** === end UNO using === **/ + namespace NumberFormat = ::com::sun::star::util::NumberFormat; + + typedef ::com::sun::star::util::Time UnoTime; + typedef ::com::sun::star::util::Date UnoDate; //================================================================================================================== - //= CellValueConversion + //= helper //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString CellValueConversion::convertToString( const Any& i_value ) + namespace { - ::rtl::OUString sConvertString; - if ( !i_value.hasValue() ) - return sConvertString; + //-------------------------------------------------------------------------------------------------------------- + double lcl_convertDateToDays( long const i_day, long const i_month, long const i_year ) + { + long const nNullDateDays = ::Date::DateToDays( 1, 1, 1900 ); + long const nValueDateDays = ::Date::DateToDays( i_day, i_month, i_year ); + + return nValueDateDays - nNullDateDays; + } + + //-------------------------------------------------------------------------------------------------------------- + double lcl_convertTimeToDays( long const i_hours, long const i_minutes, long const i_seconds, long const i_100thSeconds ) + { + return Time( i_hours, i_minutes, i_seconds, i_100thSeconds ).GetTimeInDays(); + } + } + + //================================================================================================================== + //= IValueNormalization + //================================================================================================================== + class SAL_NO_VTABLE IValueNormalization + { + public: + virtual ~IValueNormalization() { } + + /** converts the given <code>Any</code> into a <code>double</code> value to be fed into a number formatter + */ + virtual double convertToDouble( Any const & i_value ) const = 0; + + /** returns the format key to be used for formatting values + */ + virtual ::sal_Int32 getFormatKey() const = 0; + }; + + typedef ::boost::shared_ptr< IValueNormalization > PValueNormalization; + typedef ::std::hash_map< ::rtl::OUString, PValueNormalization, ::rtl::OUStringHash > NormalizerCache; + + //================================================================================================================== + //= CellValueConversion_Data + //================================================================================================================== + struct CellValueConversion_Data + { + ::comphelper::ComponentContext const aContext; + Reference< XNumberFormatter > xNumberFormatter; + bool bAttemptedFormatterCreation; + NormalizerCache aNormalizers; + + CellValueConversion_Data( ::comphelper::ComponentContext const & i_context ) + :aContext( i_context ) + ,xNumberFormatter() + ,bAttemptedFormatterCreation( false ) + ,aNormalizers() + { + } + }; + + //================================================================================================================== + //= StandardFormatNormalizer + //================================================================================================================== + class StandardFormatNormalizer : public IValueNormalization + { + protected: + StandardFormatNormalizer( Reference< XNumberFormatter > const & i_formatter, ::sal_Int32 const i_numberFormatType ) + :m_nFormatKey( 0 ) + { + try + { + ENSURE_OR_THROW( i_formatter.is(), "StandardFormatNormalizer: no formatter!" ); + Reference< XNumberFormatsSupplier > const xSupplier( i_formatter->getNumberFormatsSupplier(), UNO_SET_THROW ); + Reference< XNumberFormatTypes > const xTypes( xSupplier->getNumberFormats(), UNO_QUERY_THROW ); + m_nFormatKey = xTypes->getStandardFormat( i_numberFormatType, SvtSysLocale().GetLocale() ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + virtual ::sal_Int32 getFormatKey() const + { + return m_nFormatKey; + } + + private: + ::sal_Int32 m_nFormatKey; + }; + + //================================================================================================================== + //= DoubleNormalization + //================================================================================================================== + class DoubleNormalization : public StandardFormatNormalizer + { + public: + DoubleNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::NUMBER ) + { + } + + virtual double convertToDouble( Any const & i_value ) const + { + double returnValue(0); + ::rtl::math::setNan( &returnValue ); + OSL_VERIFY( i_value >>= returnValue ); + return returnValue; + } + + virtual ~DoubleNormalization() { } + }; + + //================================================================================================================== + //= IntegerNormalization + //================================================================================================================== + class IntegerNormalization : public StandardFormatNormalizer + { + public: + IntegerNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::NUMBER ) + { + } + + virtual ~IntegerNormalization() {} + + virtual double convertToDouble( Any const & i_value ) const + { + sal_Int64 value( 0 ); + OSL_VERIFY( i_value >>= value ); + return value; + } + }; + + //================================================================================================================== + //= BooleanNormalization + //================================================================================================================== + class BooleanNormalization : public StandardFormatNormalizer + { + public: + BooleanNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::LOGICAL ) + { + } + + virtual ~BooleanNormalization() {} + + virtual double convertToDouble( Any const & i_value ) const + { + bool value( false ); + OSL_VERIFY( i_value >>= value ); + return value ? 1 : 0; + } + }; + + //================================================================================================================== + //= DateTimeNormalization + //================================================================================================================== + class DateTimeNormalization : public StandardFormatNormalizer + { + public: + DateTimeNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::DATETIME ) + { + } + + virtual ~DateTimeNormalization() {} + + virtual double convertToDouble( Any const & i_value ) const + { + double returnValue(0); + ::rtl::math::setNan( &returnValue ); + // extract actual UNO value + DateTime aDateTimeValue; + ENSURE_OR_RETURN( i_value >>= aDateTimeValue, "allowed for DateTime values only", returnValue ); - // TODO: use css.script.XTypeConverter? + // date part + returnValue = lcl_convertDateToDays( aDateTimeValue.Day, aDateTimeValue.Month, aDateTimeValue.Year ); - sal_Int32 nInt = 0; - sal_Bool bBool = false; - double fDouble = 0; + // time part + returnValue += lcl_convertTimeToDays( + aDateTimeValue.Hours, aDateTimeValue.Minutes, aDateTimeValue.Seconds, aDateTimeValue.HundredthSeconds ); + // done + return returnValue; + } + }; + + //================================================================================================================== + //= DateNormalization + //================================================================================================================== + class DateNormalization : public StandardFormatNormalizer + { + public: + DateNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::DATE ) + { + } + + virtual ~DateNormalization() {} + + virtual double convertToDouble( Any const & i_value ) const + { + double returnValue(0); + ::rtl::math::setNan( &returnValue ); + + // extract + UnoDate aDateValue; + ENSURE_OR_RETURN( i_value >>= aDateValue, "allowed for Date values only", returnValue ); + + // convert + returnValue = lcl_convertDateToDays( aDateValue.Day, aDateValue.Month, aDateValue.Year ); + + // done + return returnValue; + } + }; + + //================================================================================================================== + //= TimeNormalization + //================================================================================================================== + class TimeNormalization : public StandardFormatNormalizer + { + public: + TimeNormalization( Reference< XNumberFormatter > const & i_formatter ) + :StandardFormatNormalizer( i_formatter, NumberFormat::TIME ) + { + } + + virtual ~TimeNormalization() {} + + virtual double convertToDouble( Any const & i_value ) const + { + double returnValue(0); + ::rtl::math::setNan( &returnValue ); + + // extract + UnoTime aTimeValue; + ENSURE_OR_RETURN( i_value >>= aTimeValue, "allowed for Time values only", returnValue ); + + // convert + returnValue += lcl_convertTimeToDays( + aTimeValue.Hours, aTimeValue.Minutes, aTimeValue.Seconds, aTimeValue.HundredthSeconds ); + + // done + return returnValue; + } + }; + + //================================================================================================================== + //= operations + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + bool lcl_ensureNumberFormatter( CellValueConversion_Data & io_data ) + { + if ( io_data.bAttemptedFormatterCreation ) + return io_data.xNumberFormatter.is(); + io_data.bAttemptedFormatterCreation = true; + + try + { + // a number formatter + Reference< XNumberFormatter > const xFormatter( + io_data.aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); + + // a supplier of number formats + Sequence< Any > aInitArgs(1); + aInitArgs[0] <<= SvtSysLocale().GetLocale(); + + Reference< XNumberFormatsSupplier > const xSupplier( + io_data.aContext.createComponentWithArguments( "com.sun.star.util.NumberFormatsSupplier", aInitArgs ), + UNO_QUERY_THROW + ); + + // ensure a NullDate we will assume later on + UnoDate const aNullDate( 1, 1, 1900 ); + Reference< XPropertySet > const xFormatSettings( xSupplier->getNumberFormatSettings(), UNO_SET_THROW ); + xFormatSettings->setPropertyValue( ::rtl::OUString::createFromAscii( "NullDate" ), makeAny( aNullDate ) ); + + // knit + xFormatter->attachNumberFormatsSupplier( xSupplier ); + + // done + io_data.xNumberFormatter = xFormatter; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return io_data.xNumberFormatter.is(); + } + + //-------------------------------------------------------------------------------------------------------------- + bool lcl_getValueNormalizer( CellValueConversion_Data & io_data, Type const & i_valueType, + PValueNormalization & o_formatter ) + { + NormalizerCache::const_iterator pos = io_data.aNormalizers.find( i_valueType.getTypeName() ); + if ( pos == io_data.aNormalizers.end() ) + { + // never encountered this type before + o_formatter.reset(); + + ::rtl::OUString const sTypeName( i_valueType.getTypeName() ); + TypeClass const eTypeClass = i_valueType.getTypeClass(); + + if ( sTypeName.equals( ::cppu::UnoType< DateTime >::get().getTypeName() ) ) + { + o_formatter.reset( new DateTimeNormalization( io_data.xNumberFormatter ) ); + } + else if ( sTypeName.equals( ::cppu::UnoType< UnoDate >::get().getTypeName() ) ) + { + o_formatter.reset( new DateNormalization( io_data.xNumberFormatter ) ); + } + else if ( sTypeName.equals( ::cppu::UnoType< UnoTime >::get().getTypeName() ) ) + { + o_formatter.reset( new TimeNormalization( io_data.xNumberFormatter ) ); + } + else if ( sTypeName.equals( ::cppu::UnoType< ::sal_Bool >::get().getTypeName() ) ) + { + o_formatter.reset( new BooleanNormalization( io_data.xNumberFormatter ) ); + } + else if ( sTypeName.equals( ::cppu::UnoType< double >::get().getTypeName() ) + || sTypeName.equals( ::cppu::UnoType< float >::get().getTypeName() ) + ) + { + o_formatter.reset( new DoubleNormalization( io_data.xNumberFormatter ) ); + } + else if ( ( eTypeClass == TypeClass_BYTE ) + || ( eTypeClass == TypeClass_SHORT ) + || ( eTypeClass == TypeClass_UNSIGNED_SHORT ) + || ( eTypeClass == TypeClass_LONG ) + || ( eTypeClass == TypeClass_UNSIGNED_LONG ) + || ( eTypeClass == TypeClass_HYPER ) + ) + { + o_formatter.reset( new IntegerNormalization( io_data.xNumberFormatter ) ); + } + else + { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer message( "lcl_getValueNormalizer: unsupported type '" ); + message.append( ::rtl::OUStringToOString( sTypeName, RTL_TEXTENCODING_ASCII_US ) ); + message.append( "'!" ); + OSL_ENSURE( false, message.makeStringAndClear() ); +#endif + } + io_data.aNormalizers[ sTypeName ] = o_formatter; + } + else + o_formatter = pos->second; + + return !!o_formatter; + } + } + + //================================================================================================================== + //= CellValueConversion + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + CellValueConversion::CellValueConversion( ::comphelper::ComponentContext const & i_context ) + :m_pData( new CellValueConversion_Data( i_context ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + CellValueConversion::~CellValueConversion() + { + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString CellValueConversion::convertToString( const Any& i_value ) + { ::rtl::OUString sStringValue; - if ( i_value >>= sConvertString ) - sStringValue = sConvertString; - else if ( i_value >>= nInt ) - sStringValue = sConvertString.valueOf( nInt ); - else if ( i_value >>= bBool ) - sStringValue = sConvertString.valueOf( bBool ); - else if ( i_value >>= fDouble ) - sStringValue = sConvertString.valueOf( fDouble ); - else - OSL_ENSURE( !i_value.hasValue(), "CellValueConversion::convertToString: cannot handle the given cell content type!" ); + if ( !i_value.hasValue() ) + return sStringValue; + + if ( ! ( i_value >>= sStringValue ) ) + { + if ( lcl_ensureNumberFormatter( *m_pData ) ) + { + PValueNormalization pNormalizer; + if ( lcl_getValueNormalizer( *m_pData, i_value.getValueType(), pNormalizer ) ) + { + try + { + double const formatterCompliantValue = pNormalizer->convertToDouble( i_value ); + sal_Int32 const formatKey = pNormalizer->getFormatKey(); + sStringValue = m_pData->xNumberFormatter->convertNumberToString( + formatKey, formatterCompliantValue ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } return sStringValue; } diff --git a/svtools/source/table/cellvalueconversion.hxx b/svtools/source/table/cellvalueconversion.hxx index 4d6b8c8d6aac..c4d8baa98489 100755..100644 --- a/svtools/source/table/cellvalueconversion.hxx +++ b/svtools/source/table/cellvalueconversion.hxx @@ -31,6 +31,13 @@ #include <com/sun/star/uno/Any.hxx> /** === end UNO includes === **/ +#include <boost/scoped_ptr.hpp> + +namespace comphelper +{ + class ComponentContext; +} + //...................................................................................................................... namespace svt { @@ -39,10 +46,17 @@ namespace svt //================================================================================================================== //= CellValueConversion //================================================================================================================== + struct CellValueConversion_Data; class CellValueConversion { public: - static ::rtl::OUString convertToString( const ::com::sun::star::uno::Any& i_cellValue ); + CellValueConversion( ::comphelper::ComponentContext const & i_context ); + ~CellValueConversion(); + + ::rtl::OUString convertToString( const ::com::sun::star::uno::Any& i_cellValue ); + + private: + ::boost::scoped_ptr< CellValueConversion_Data > m_pData; }; //...................................................................................................................... diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 1e230d372c24..341c398b5bcd 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -35,6 +35,8 @@ #include <com/sun/star/graphic/XGraphic.hpp> /** === end UNO includes === **/ +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <vcl/window.hxx> @@ -123,11 +125,14 @@ namespace svt { namespace table RowPos nCurrentRow; bool bUseGridLines; CachedSortIndicator aSortIndicator; + CellValueConversion aStringConverter; GridTableRenderer_Impl( ITableModel& _rModel ) :rModel( _rModel ) ,nCurrentRow( ROW_INVALID ) ,bUseGridLines( true ) + ,aSortIndicator( ) + ,aStringConverter( ::comphelper::ComponentContext( ::comphelper::getProcessServiceFactory() ) ) { } }; @@ -168,7 +173,9 @@ namespace svt { namespace table } sal_uLong nHorzFlag = TEXT_DRAW_LEFT; - HorizontalAlignment const eHorzAlign = i_impl.rModel.getColumnModel( i_columnPos )->getHorizontalAlign(); + HorizontalAlignment const eHorzAlign = i_impl.rModel.getColumnCount() > 0 + ? i_impl.rModel.getColumnModel( i_columnPos )->getHorizontalAlign() + : HorizontalAlignment_CENTER; switch ( eHorzAlign ) { case HorizontalAlignment_CENTER: nHorzFlag = TEXT_DRAW_CENTER; break; @@ -324,7 +331,7 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ - void GridTableRenderer::PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected, + void GridTableRenderer::PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle ) { // remember the row for subsequent calls to the other ->ITableRenderer methods @@ -334,13 +341,17 @@ namespace svt { namespace table ::Color backgroundColor = _rStyle.GetFieldColor(); - ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() ); + ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() ); ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor; + ::Color const activeSelectionBackColor = + lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor ); if ( _bSelected ) { // selected rows use the background color from the style - backgroundColor = _rStyle.GetHighlightColor(); + backgroundColor = i_hasControlFocus + ? activeSelectionBackColor + : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor ); if ( !aLineColor ) lineColor = backgroundColor; } @@ -357,7 +368,7 @@ namespace svt { namespace table } else { - Color hilightColor = _rStyle.GetHighlightColor(); + Color hilightColor = activeSelectionBackColor; hilightColor.SetRed( 9 * ( fieldColor.GetRed() - hilightColor.GetRed() ) / 10 + hilightColor.GetRed() ); hilightColor.SetGreen( 9 * ( fieldColor.GetGreen() - hilightColor.GetGreen() ) / 10 + hilightColor.GetGreen() ); hilightColor.SetBlue( 9 * ( fieldColor.GetBlue() - hilightColor.GetBlue() ) / 10 + hilightColor.GetBlue() ); @@ -384,13 +395,10 @@ namespace svt { namespace table _rDevice.DrawRect( _rRowArea ); _rDevice.Pop(); - - (void)_bActive; - // row containing the active cell not rendered any special at the moment } //------------------------------------------------------------------------------------------------------------------ - void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, + void GridTableRenderer::PaintRowHeader( bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_TEXTCOLOR ); @@ -401,7 +409,7 @@ namespace svt { namespace table _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); Any const rowHeading( m_pImpl->rModel.getRowHeading( m_pImpl->nCurrentRow ) ); - ::rtl::OUString const rowTitle( CellValueConversion::convertToString( rowHeading ) ); + ::rtl::OUString const rowTitle( m_pImpl->aStringConverter.convertToString( rowHeading ) ); if ( rowTitle.getLength() ) { ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderTextColor(), _rStyle, &StyleSettings::GetFieldTextColor ); @@ -413,8 +421,7 @@ namespace svt { namespace table _rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags ); } - // TODO: active? selected? - (void)_bActive; + (void)i_hasControlFocus; (void)_bSelected; _rDevice.Pop(); } @@ -427,26 +434,28 @@ namespace svt { namespace table StyleSettings const & rStyle; ColPos const nColumn; bool const bSelected; + bool const bHasControlFocus; CellRenderContext( OutputDevice& i_device, Rectangle const & i_contentArea, - StyleSettings const & i_style, ColPos const i_column, bool const i_selected ) + StyleSettings const & i_style, ColPos const i_column, bool const i_selected, bool const i_hasControlFocus ) :rDevice( i_device ) ,aContentArea( i_contentArea ) ,rStyle( i_style ) ,nColumn( i_column ) ,bSelected( i_selected ) + ,bHasControlFocus( i_hasControlFocus ) { } }; //------------------------------------------------------------------------------------------------------------------ - void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool _bActive, + void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool i_hasControlFocus, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); Rectangle const aContentArea( lcl_getContentArea( *m_pImpl, _rArea ) ); - CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected ); + CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected, i_hasControlFocus ); impl_paintCellContent( aRenderContext ); if ( m_pImpl->bUseGridLines ) @@ -457,7 +466,9 @@ namespace svt { namespace table if ( _bSelected && !aLineColor ) { // if no line color is specified by the model, use the usual selection color for lines in selected cells - lineColor = _rStyle.GetHighlightColor(); + lineColor = i_hasControlFocus + ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor ) + : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor ); } _rDevice.SetLineColor( lineColor ); @@ -466,9 +477,6 @@ namespace svt { namespace table } _rDevice.Pop(); - - (void)_bActive; - // no special painting for the active cell at the moment } //------------------------------------------------------------------------------------------------------------------ @@ -537,7 +545,7 @@ namespace svt { namespace table return; } - const ::rtl::OUString sText( CellValueConversion::convertToString( aCellContent ) ); + const ::rtl::OUString sText( m_pImpl->aStringConverter.convertToString( aCellContent ) ); impl_paintCellText( i_context, sText ); } @@ -545,7 +553,12 @@ namespace svt { namespace table void GridTableRenderer::impl_paintCellText( CellRenderContext const & i_context, ::rtl::OUString const & i_text ) { if ( i_context.bSelected ) - i_context.rDevice.SetTextColor( i_context.rStyle.GetHighlightTextColor() ); + { + ::Color const textColor = i_context.bHasControlFocus + ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetHighlightTextColor ) + : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetDeactiveTextColor ); + i_context.rDevice.SetTextColor( textColor ); + } else { ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), i_context.rStyle, &StyleSettings::GetFieldTextColor ); @@ -572,7 +585,7 @@ namespace svt { namespace table //------------------------------------------------------------------------------------------------------------------ bool GridTableRenderer::FitsIntoCell( Any const & i_cellContent, ColPos const i_colPos, RowPos const i_rowPos, - bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea ) + bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea ) const { if ( !i_cellContent.hasValue() ) return true; @@ -592,7 +605,7 @@ namespace svt { namespace table return true; } - ::rtl::OUString const sText( CellValueConversion::convertToString( i_cellContent ) ); + ::rtl::OUString const sText( m_pImpl->aStringConverter.convertToString( i_cellContent ) ); if ( sText.getLength() == 0 ) return true; @@ -613,6 +626,16 @@ namespace svt { namespace table return true; } + //------------------------------------------------------------------------------------------------------------------ + bool GridTableRenderer::GetFormattedCellString( Any const & i_cellValue, ColPos const i_colPos, RowPos const i_rowPos, ::rtl::OUString & o_cellString ) const + { + o_cellString = m_pImpl->aStringConverter.convertToString( i_cellValue ); + + OSL_UNUSED( i_colPos ); + OSL_UNUSED( i_rowPos ); + return true; + } + //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... diff --git a/svtools/source/table/mousefunction.cxx b/svtools/source/table/mousefunction.cxx index 20d505e911e9..162abc7936c8 100755..100644 --- a/svtools/source/table/mousefunction.cxx +++ b/svtools/source/table/mousefunction.cxx @@ -207,27 +207,14 @@ namespace svt { namespace table TableCell const tableCell( i_tableControl.hitTest( i_event.GetPosPixel() ) ); if ( tableCell.nRow >= 0 ) { - bool bSetCursor = false; if ( i_tableControl.getSelEngine()->GetSelectionMode() == NO_SELECTION ) { - bSetCursor = true; + i_tableControl.activateCell( tableCell.nColumn, tableCell.nRow ); + handled = true; } else { - if ( !i_tableControl.isRowSelected( tableCell.nRow ) ) - { - handled = i_tableControl.getSelEngine()->SelMouseButtonDown( i_event ); - } - else - { - bSetCursor = true; - } - } - - if ( bSetCursor ) - { - i_tableControl.activateCell( tableCell.nColumn, tableCell.nRow ); - handled = true; + handled = i_tableControl.getSelEngine()->SelMouseButtonDown( i_event ); } } diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 01a9b667a8f7..d0e726fa5c53 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <tools/diagnose_ex.h> @@ -49,6 +50,8 @@ namespace svt { namespace table { //...................................................................................................................... + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + //================================================================================================================== //= TableControl //================================================================================================================== @@ -58,14 +61,14 @@ namespace svt { namespace table ,m_pImpl( new TableControl_Impl( *this ) ) { TableDataWindow& rDataWindow = m_pImpl->getDataWindow(); - rDataWindow.SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); - rDataWindow.SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); // by default, use the background as determined by the style settings const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); SetBackground( Wallpaper( aWindowColor ) ); SetFillColor( aWindowColor ); + + SetCompoundControl( true ); } // ----------------------------------------------------------------------------------------------------------------- @@ -97,6 +100,27 @@ namespace svt { namespace table { if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) ) Control::KeyInput( rKEvt ); + else + { + if ( m_pImpl->isAccessibleAlive() ) + { + m_pImpl->commitCellEvent( AccessibleEventId::STATE_CHANGED, + makeAny( AccessibleStateType::FOCUSED ), + Any() + ); + // Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every + // (handled) key stroke? + + m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, + Any(), + Any() + ); + // ditto: Why do we notify this unconditionally? We should find the right place to notify the + // ACTIVE_DESCENDANT_CHANGED event. + // Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are + // transient, aren't they? + } + } } @@ -108,6 +132,10 @@ namespace svt { namespace table // forward certain settings to the data window switch ( i_nStateChange ) { + case STATE_CHANGE_CONTROL_FOCUS: + m_pImpl->invalidateSelectedRows(); + break; + case STATE_CHANGE_CONTROLBACKGROUND: if ( IsControlBackground() ) getDataWindow().SetControlBackground( GetControlBackground() ); @@ -209,7 +237,7 @@ namespace svt { namespace table void TableControl::SelectRow( RowPos const i_rowIndex, bool const i_select ) { ENSURE_OR_RETURN_VOID( ( i_rowIndex >= 0 ) && ( i_rowIndex < m_pImpl->getModel()->getRowCount() ), - "TableControl::SelectRow: no control (anymore)!" ); + "TableControl::SelectRow: invalid row index!" ); if ( i_select ) { @@ -291,10 +319,10 @@ namespace svt { namespace table switch( eObjType ) { case TCTYPE_GRIDCONTROL: - aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) ); + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid control" ) ); break; case TCTYPE_TABLE: - aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ); + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid conrol" ) ); break; case TCTYPE_ROWHEADERBAR: aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) ); @@ -303,7 +331,19 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); break; case TCTYPE_TABLECELL: - aRetText = GetAccessibleCellText(_nRow, _nCol); + //the name of the cell constists of column name and row name if defined + //if the name is equal to cell content, it'll be read twice + if(GetModel()->hasColumnHeaders()) + { + aRetText = GetColumnName(_nCol); + aRetText += rtl::OUString::createFromAscii(" , "); + } + if(GetModel()->hasRowHeaders()) + { + aRetText += GetRowName(_nRow); + aRetText += rtl::OUString::createFromAscii(" , "); + } + //aRetText = GetAccessibleCellText(_nRow, _nCol); break; case TCTYPE_ROWHEADERCELL: aRetText = GetRowName(_nRow); @@ -324,7 +364,7 @@ namespace svt { namespace table switch( eObjType ) { case TCTYPE_GRIDCONTROL: - aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) ); + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid control description" ) ); break; case TCTYPE_TABLE: aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) ); @@ -336,7 +376,17 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) ); break; case TCTYPE_TABLECELL: - aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) ); + // the description of the cell consists of column name and row name if defined + // if the name is equal to cell content, it'll be read twice + if ( GetModel()->hasColumnHeaders() ) + { + aRetText = GetColumnName( GetCurrentColumn() ); + aRetText += rtl::OUString::createFromAscii( " , " ); + } + if ( GetModel()->hasRowHeaders() ) + { + aRetText += GetRowName( GetCurrentRow() ); + } break; case TCTYPE_ROWHEADERCELL: aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) ); @@ -401,38 +451,60 @@ namespace svt { namespace table case TCTYPE_TABLE: rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); - if ( HasFocus() ) + + if ( m_pImpl->getSelEngine()->GetSelectionMode() == MULTIPLE_SELECTION ) + rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); + + if ( HasChildPathFocus() ) rStateSet.AddState( AccessibleStateType::FOCUSED ); + if ( IsActive() ) rStateSet.AddState( AccessibleStateType::ACTIVE ); - if ( IsEnabled() ) + + if ( m_pImpl->getDataWindow().IsEnabled() ) + { rStateSet.AddState( AccessibleStateType::ENABLED ); + rStateSet.AddState( AccessibleStateType::SENSITIVE ); + } + if ( IsReallyVisible() ) rStateSet.AddState( AccessibleStateType::VISIBLE ); - rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + if ( eObjType == TCTYPE_TABLE ) + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; + case TCTYPE_ROWHEADERBAR: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; + case TCTYPE_COLUMNHEADERBAR: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; + case TCTYPE_TABLECELL: { + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + if ( HasChildPathFocus() ) + rStateSet.AddState( AccessibleStateType::FOCUSED ); + rStateSet.AddState( AccessibleStateType::ACTIVE ); rStateSet.AddState( AccessibleStateType::TRANSIENT ); rStateSet.AddState( AccessibleStateType::SELECTABLE); - if( GetSelectedRowCount()>0) - rStateSet.AddState( AccessibleStateType::SELECTED); + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::SHOWING ); + if ( IsRowSelected( GetCurrentRow() ) ) + // Hmm? Wouldn't we expect the affected row to be a parameter to this function? + rStateSet.AddState( AccessibleStateType::SELECTED ); } break; + case TCTYPE_ROWHEADERCELL: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::TRANSIENT ); break; + case TCTYPE_COLUMNHEADERCELL: rStateSet.AddState( AccessibleStateType::VISIBLE ); break; @@ -440,6 +512,20 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ + void TableControl::commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue ) + { + if ( m_pImpl->isAccessibleAlive() ) + m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TableControl::commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue ) + { + if ( m_pImpl->isAccessibleAlive() ) + m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue ); + } + + //------------------------------------------------------------------------------------------------------------------ Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const { return Control::GetWindowExtentsRelative( pRelativeWindow ); @@ -484,13 +570,12 @@ namespace svt { namespace table //------------------------------------------------------------------------------------------------------------------ sal_Int32 TableControl::GetAccessibleControlCount() const { - sal_Int32 count = 0; - if(GetRowCount()>0) - count+=1; - if(GetModel()->hasRowHeaders()) - count+=1; - if(GetModel()->hasColumnHeaders()) - count+=1; + // TC_TABLE is always defined, no matter whether empty or not + sal_Int32 count = 1; + if ( GetModel()->hasRowHeaders() ) + ++count; + if ( GetModel()->hasColumnHeaders() ) + ++count; return count; } @@ -532,10 +617,20 @@ namespace svt { namespace table //------------------------------------------------------------------------------------------------------------------ void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const { - if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos ) + if ( IsRowSelected( _nRow ) ) + _rStateSet.AddState( AccessibleStateType::SELECTED ); + if ( HasChildPathFocus() ) _rStateSet.AddState( AccessibleStateType::FOCUSED ); else // only transient when column is not focused _rStateSet.AddState( AccessibleStateType::TRANSIENT ); + + _rStateSet.AddState( AccessibleStateType::VISIBLE ); + _rStateSet.AddState( AccessibleStateType::SHOWING ); + _rStateSet.AddState( AccessibleStateType::ENABLED ); + _rStateSet.AddState( AccessibleStateType::SENSITIVE ); + _rStateSet.AddState( AccessibleStateType::ACTIVE ); + + (void)_nColumnPos; } //------------------------------------------------------------------------------------------------------------------ @@ -562,30 +657,27 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ - Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen) + Rectangle TableControl::calcHeaderCellRect( sal_Bool _bIsColumnBar, sal_Int32 nPos ) { - (void)_bOnScreen; - return m_pImpl->calcTableRect(); + return m_pImpl->calcHeaderCellRect( _bIsColumnBar, nPos ); } //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) + Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen) { - Select(); - return 1; + (void)_bOnScreen; + return m_pImpl->calcTableRect(); } //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData ) + Rectangle TableControl::calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) { - CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData ); - return 1; + return m_pImpl->calcCellRect( _nRowPos, _nColPos ); } - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData ) + IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) { - CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData ); + Select(); return 1; } @@ -593,6 +685,15 @@ namespace svt { namespace table void TableControl::Select() { ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this ); + + if ( m_pImpl->isAccessibleAlive() ) + { + m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + + m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() ); + // TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this, + // actually, when the active descendant, i.e. the current cell, *really* changed? + } } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 8e481d27d993..4ecce7359a15 100755..100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -34,7 +34,6 @@ #include "tabledatawindow.hxx" #include "tablecontrol_impl.hxx" #include "tablegeometry.hxx" -#include "cellvalueconversion.hxx" /** === begin UNO includes === **/ #include <com/sun/star/accessibility/XAccessible.hpp> @@ -51,6 +50,7 @@ #include <tools/diagnose_ex.h> #include <functional> +#include <numeric> #define MIN_COLUMN_WIDTH_PIXEL 4 @@ -186,6 +186,22 @@ namespace svt { namespace table { return ::boost::optional< ::Color >(); } + virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const + { + return ::boost::optional< ::Color >(); + } + virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const + { + return ::boost::optional< ::Color >(); + } + virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const + { + return ::boost::optional< ::Color >(); + } + virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const + { + return ::boost::optional< ::Color >(); + } virtual ::boost::optional< ::Color > getTextColor() const { return ::boost::optional< ::Color >(); @@ -487,7 +503,7 @@ namespace svt { namespace table // recalc some model-dependent cached info impl_ni_updateCachedModelValues(); - impl_ni_updateScrollbars(); + impl_ni_relayout(); // completely invalidate m_rAntiImpl.Invalidate(); @@ -535,8 +551,8 @@ namespace svt { namespace table if ( i_first <= m_nCurRow ) goTo( m_nCurColumn, m_nCurRow + insertedRows ); - // adjust scrollbars - impl_ni_updateScrollbars(); + // relayout, since the scrollbar need might have changed + impl_ni_relayout(); // notify A1YY events if ( impl_isAccessibleAlive() ) @@ -545,20 +561,6 @@ namespace svt { namespace table makeAny( AccessibleTableModelChange( AccessibleTableModelChangeType::INSERT, i_first, i_last, 0, m_pModel->getColumnCount() ) ), Any() ); - impl_commitAccessibleEvent( AccessibleEventId::CHILD, - makeAny( m_pAccessibleTable->getTableHeader( TCTYPE_ROWHEADERBAR ) ), - Any() - ); - -// for ( sal_Int32 i = 0 ; i <= m_pModel->getColumnCount(); ++i ) -// { -// impl_commitAccessibleEvent( -// CHILD, -// makeAny( m_pAccessibleTable->getTable() ), -// Any()); -// } - // Huh? What's that? We're notifying |columnCount| CHILD events here, claiming the *table* itself - // has been inserted. Doesn't make much sense, does it? } // schedule repaint @@ -610,13 +612,13 @@ namespace svt { namespace table m_nCurRow = ROW_INVALID; } - // adjust scrollbars - impl_ni_updateScrollbars(); + // relayout, since the scrollbar need might have changed + impl_ni_relayout(); // notify A11Y events if ( impl_isAccessibleAlive() ) { - impl_commitAccessibleEvent( + commitTableEvent( AccessibleEventId::TABLE_MODEL_CHANGED, makeAny( AccessibleTableModelChange( AccessibleTableModelChangeType::DELETE, @@ -641,8 +643,7 @@ namespace svt { namespace table void TableControl_Impl::columnInserted( ColPos const i_colIndex ) { m_nColumnCount = m_pModel->getColumnCount(); - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + impl_ni_relayout(); m_rAntiImpl.Invalidate(); @@ -653,8 +654,17 @@ namespace svt { namespace table void TableControl_Impl::columnRemoved( ColPos const i_colIndex ) { m_nColumnCount = m_pModel->getColumnCount(); - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + + // adjust the current column, if it is larger than the column count now + if ( m_nCurColumn >= m_nColumnCount ) + { + if ( m_nColumnCount > 0 ) + goTo( m_nCurColumn - 1, m_nCurRow ); + else + m_nCurColumn = COL_INVALID; + } + + impl_ni_relayout(); m_rAntiImpl.Invalidate(); @@ -665,8 +675,7 @@ namespace svt { namespace table void TableControl_Impl::allColumnsRemoved() { m_nColumnCount = m_pModel->getColumnCount(); - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + impl_ni_relayout(); m_rAntiImpl.Invalidate(); } @@ -683,11 +692,8 @@ namespace svt { namespace table //------------------------------------------------------------------------------------------------------------------ void TableControl_Impl::tableMetricsChanged() { - long const oldRowHeaderWidthPixel = m_nRowHeaderWidthPixel; impl_ni_updateCachedTableMetrics(); - if ( oldRowHeaderWidthPixel != m_nRowHeaderWidthPixel ) - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + impl_ni_relayout(); m_rAntiImpl.Invalidate(); } @@ -717,9 +723,8 @@ namespace svt { namespace table { if ( !m_bUpdatingColWidths ) { - impl_ni_updateColumnWidths( i_column ); + impl_ni_relayout( i_column ); invalidate( TableAreaAll ); - impl_ni_updateScrollbars(); } nGroup &= ~COL_ATTRS_WIDTH; @@ -795,67 +800,157 @@ namespace svt { namespace table //------------------------------------------------------------------------------------------------------------------ void TableControl_Impl::impl_ni_updateCachedModelValues() { - m_pInputHandler.reset(); - m_nColumnCount = m_nRowCount = 0; - - impl_ni_updateCachedTableMetrics(); - impl_ni_updateColumnWidths(); - m_pInputHandler = m_pModel->getInputHandler(); if ( !m_pInputHandler ) m_pInputHandler.reset( new DefaultInputHandler ); m_nColumnCount = m_pModel->getColumnCount(); + if ( m_nLeftColumn >= m_nColumnCount ) + m_nLeftColumn = ( m_nColumnCount > 0 ) ? m_nColumnCount - 1 : 0; + m_nRowCount = m_pModel->getRowCount(); + if ( m_nTopRow >= m_nRowCount ) + m_nTopRow = ( m_nRowCount > 0 ) ? m_nRowCount - 1 : 0; + + impl_ni_updateCachedTableMetrics(); } //------------------------------------------------------------------------------------------------------------------ - void TableControl_Impl::impl_ni_updateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding ) + namespace { - ENSURE_OR_RETURN_VOID( !m_bUpdatingColWidths, "TableControl_Impl::impl_ni_updateColumnWidths: recursive call detected!" ); + //.............................................................................................................. + /// determines whether a scrollbar is needed for the given values + bool lcl_determineScrollbarNeed( long const i_position, ScrollbarVisibility const i_visibility, + long const i_availableSpace, long const i_neededSpace ) + { + if ( i_visibility == ScrollbarShowNever ) + return false; + if ( i_visibility == ScrollbarShowAlways ) + return true; + if ( i_position > 0 ) + return true; + if ( i_availableSpace >= i_neededSpace ) + return false; + return true; + } - m_aColumnWidths.resize( 0 ); - if ( !m_pModel ) - return; + //.............................................................................................................. + void lcl_setButtonRepeat( Window& _rWindow, sal_uLong _nDelay ) + { + AllSettings aSettings = _rWindow.GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - const TableSize colCount = m_pModel->getColumnCount(); - if ( colCount == 0 ) - return; + aMouseSettings.SetButtonRepeat( _nDelay ); + aSettings.SetMouseSettings( aMouseSettings ); - m_bUpdatingColWidths = true; - const ::comphelper::FlagGuard aWidthUpdateFlag( m_bUpdatingColWidths ); + _rWindow.SetSettings( aSettings, sal_True ); + } - m_aColumnWidths.reserve( colCount ); + //.............................................................................................................. + bool lcl_updateScrollbar( Window& _rParent, ScrollBar*& _rpBar, + bool const i_needBar, long _nVisibleUnits, + long _nPosition, long _nLineSize, long _nRange, + bool _bHorizontal, const Link& _rScrollHandler ) + { + // do we currently have the scrollbar? + bool bHaveBar = _rpBar != NULL; + + // do we need to correct the scrollbar visibility? + if ( bHaveBar && !i_needBar ) + { + if ( _rpBar->IsTracking() ) + _rpBar->EndTracking(); + DELETEZ( _rpBar ); + } + else if ( !bHaveBar && i_needBar ) + { + _rpBar = new ScrollBar( + &_rParent, + WB_DRAG | ( _bHorizontal ? WB_HSCROLL : WB_VSCROLL ) + ); + _rpBar->SetScrollHdl( _rScrollHandler ); + // get some speed into the scrolling .... + lcl_setButtonRepeat( *_rpBar, 0 ); + } + + if ( _rpBar ) + { + _rpBar->SetRange( Range( 0, _nRange ) ); + _rpBar->SetVisibleSize( _nVisibleUnits ); + _rpBar->SetPageSize( _nVisibleUnits ); + _rpBar->SetLineSize( _nLineSize ); + _rpBar->SetThumbPos( _nPosition ); + _rpBar->Show(); + } + + return ( bHaveBar != i_needBar ); + } + //.............................................................................................................. + /** returns the number of rows fitting into the given range, + for the given row height. Partially fitting rows are counted, too, if the + respective parameter says so. + */ + TableSize lcl_getRowsFittingInto( long _nOverallHeight, long _nRowHeightPixel, bool _bAcceptPartialRow = false ) + { + return _bAcceptPartialRow + ? ( _nOverallHeight + ( _nRowHeightPixel - 1 ) ) / _nRowHeightPixel + : _nOverallHeight / _nRowHeightPixel; + } + + //.............................................................................................................. + /** returns the number of columns fitting into the given area, + with the first visible column as given. Partially fitting columns are counted, too, + if the respective parameter says so. + */ + TableSize lcl_getColumnsVisibleWithin( const Rectangle& _rArea, ColPos _nFirstVisibleColumn, + const TableControl_Impl& _rControl, bool _bAcceptPartialRow ) + { + TableSize visibleColumns = 0; + TableColumnGeometry aColumn( _rControl, _rArea, _nFirstVisibleColumn ); + while ( aColumn.isValid() ) + { + if ( !_bAcceptPartialRow ) + if ( aColumn.getRect().Right() > _rArea.Right() ) + // this column is only partially visible, and this is not allowed + break; + + aColumn.moveRight(); + ++visibleColumns; + } + return visibleColumns; + } + + } + + //------------------------------------------------------------------------------------------------------------------ + long TableControl_Impl::impl_ni_calculateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding, + bool const i_assumeVerticalScrollbar, ::std::vector< long >& o_newColWidthsPixel ) const + { // the available horizontal space long gridWidthPixel = m_rAntiImpl.GetOutputSizePixel().Width(); + ENSURE_OR_RETURN( !!m_pModel, "TableControl_Impl::impl_ni_calculateColumnWidths: not allowed without a model!", gridWidthPixel ); if ( m_pModel->hasRowHeaders() && ( gridWidthPixel != 0 ) ) { gridWidthPixel -= m_nRowHeaderWidthPixel; } - if ( m_pModel->getVerticalScrollbarVisibility() != ScrollbarShowNever ) + + if ( i_assumeVerticalScrollbar && ( m_pModel->getVerticalScrollbarVisibility() != ScrollbarShowNever ) ) { long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); gridWidthPixel -= nScrollbarMetrics; } - // TODO: shouldn't we take the visibility of the vertical scroll bar into account here, too? - long const gridWidthAppFont = m_rAntiImpl.PixelToLogic( Size( gridWidthPixel, 0 ), MAP_APPFONT ).Width(); - - // determine the accumulated current width of all columns - for ( ColPos col = 0; col < colCount; ++col ) - { - const PColumnModel pColumn = m_pModel->getColumnModel( col ); - ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); - - } + // no need to do anything without columns + TableSize const colCount = m_pModel->getColumnCount(); + if ( colCount == 0 ) + return gridWidthPixel; // collect some meta data for our columns: - // - their current (appt-font) metrics + // - their current (pixel) metrics long accumulatedCurrentWidth = 0; ::std::vector< long > currentColWidths; currentColWidths.reserve( colCount ); - // - their effective minimal and maximal width (app-font!) typedef ::std::vector< ::std::pair< long, long > > ColumnLimits; ColumnLimits effectiveColumnLimits; effectiveColumnLimits.reserve( colCount ); @@ -865,13 +960,14 @@ namespace svt { namespace table ::std::vector< ::sal_Int32 > columnFlexibilities; columnFlexibilities.reserve( colCount ); long flexibilityDenominator = 0; + size_t flexibleColumnCount = 0; for ( ColPos col = 0; col < colCount; ++col ) { PColumnModel const pColumn = m_pModel->getColumnModel( col ); ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); // current width - TableMetrics const currentWidth = pColumn->getWidth(); + long const currentWidth = appFontWidthToPixel( pColumn->getWidth() ); currentColWidths.push_back( currentWidth ); // accumulated width @@ -879,7 +975,7 @@ namespace svt { namespace table // flexibility ::sal_Int32 flexibility = pColumn->getFlexibility(); - OSL_ENSURE( flexibility >= 0, "TableControl_Impl::impl_ni_updateColumnWidths: a column's flexibility should be non-negative." ); + OSL_ENSURE( flexibility >= 0, "TableControl_Impl::impl_ni_calculateColumnWidths: a column's flexibility should be non-negative." ); if ( ( flexibility < 0 ) // normalization || ( !pColumn->isResizable() ) // column not resizeable => no auto-resize || ( col <= i_assumeInflexibleColumnsUpToIncluding ) // column shall be treated as inflexible => respec this @@ -891,18 +987,18 @@ namespace svt { namespace table // if the column is not flexible, it will not be asked for min/max, but we assume the current width as limit then if ( flexibility > 0 ) { - long const minWidth = pColumn->getMinWidth(); + long const minWidth = appFontWidthToPixel( pColumn->getMinWidth() ); if ( minWidth > 0 ) effectiveMin = minWidth; else effectiveMin = MIN_COLUMN_WIDTH_PIXEL; - long const maxWidth = pColumn->getMaxWidth(); - OSL_ENSURE( minWidth <= maxWidth, "TableControl_Impl::impl_ni_updateColumnWidths: pretty undecided 'bout its width limits, this column!" ); + long const maxWidth = appFontWidthToPixel( pColumn->getMaxWidth() ); + OSL_ENSURE( minWidth <= maxWidth, "TableControl_Impl::impl_ni_calculateColumnWidths: pretty undecided 'bout its width limits, this column!" ); if ( ( maxWidth > 0 ) && ( maxWidth >= minWidth ) ) effectiveMax = maxWidth; else - effectiveMax = gridWidthAppFont; // TODO: any better guess here? + effectiveMax = gridWidthPixel; // TODO: any better guess here? if ( effectiveMin == effectiveMax ) // if the min and the max are identical, this implies no flexibility at all @@ -911,27 +1007,29 @@ namespace svt { namespace table columnFlexibilities.push_back( flexibility ); flexibilityDenominator += flexibility; + if ( flexibility > 0 ) + ++flexibleColumnCount; effectiveColumnLimits.push_back( ::std::pair< long, long >( effectiveMin, effectiveMax ) ); accumulatedMinWidth += effectiveMin; accumulatedMaxWidth += effectiveMax; } - ::std::vector< long > newWidths( currentColWidths ); + o_newColWidthsPixel = currentColWidths; if ( flexibilityDenominator == 0 ) { // no column is flexible => don't adjust anything } - else if ( gridWidthAppFont > accumulatedCurrentWidth ) + else if ( gridWidthPixel > accumulatedCurrentWidth ) { // we have space to give away ... - long distributeAppFontUnits = gridWidthAppFont - accumulatedCurrentWidth; - if ( gridWidthAppFont > accumulatedMaxWidth ) + long distributePixel = gridWidthPixel - accumulatedCurrentWidth; + if ( gridWidthPixel > accumulatedMaxWidth ) { // ... but the column's maximal widths are still less than we have // => set them all to max for ( size_t i = 0; i < size_t( colCount ); ++i ) { - newWidths[i] = effectiveColumnLimits[i].second; + o_newColWidthsPixel[i] = effectiveColumnLimits[i].second; } } else @@ -941,13 +1039,13 @@ namespace svt { namespace table { startOver = false; // distribute the remaining space amongst all columns with a positive flexibility - for ( size_t i=0; i<newWidths.size() && !startOver; ++i ) + for ( size_t i=0; i<o_newColWidthsPixel.size() && !startOver; ++i ) { long const columnFlexibility = columnFlexibilities[i]; if ( columnFlexibility == 0 ) continue; - long newColWidth = currentColWidths[i] + columnFlexibility * distributeAppFontUnits / flexibilityDenominator; + long newColWidth = currentColWidths[i] + columnFlexibility * distributePixel / flexibilityDenominator; if ( newColWidth > effectiveColumnLimits[i].second ) { // that was too much, we hit the col's maximum @@ -956,9 +1054,10 @@ namespace svt { namespace table // adjust the flexibility denominator ... flexibilityDenominator -= columnFlexibility; columnFlexibilities[i] = 0; + --flexibleColumnCount; // ... and the remaining width ... long const difference = newColWidth - currentColWidths[i]; - distributeAppFontUnits -= difference; + distributePixel -= difference; // ... this way, we ensure that the width not taken up by this column is consumed by the other // flexible ones (if there are some) @@ -967,22 +1066,47 @@ namespace svt { namespace table startOver = true; } - newWidths[i] = newColWidth; + o_newColWidthsPixel[i] = newColWidth; } } while ( startOver ); + + // are there pixels left (might be caused by rounding errors)? + distributePixel = gridWidthPixel - ::std::accumulate( o_newColWidthsPixel.begin(), o_newColWidthsPixel.end(), 0 ); + while ( ( distributePixel > 0 ) && ( flexibleColumnCount > 0 ) ) + { + // yes => ignore relative flexibilities, and subsequently distribute single pixels to all flexible + // columns which did not yet reach their maximum. + for ( size_t i=0; ( i < o_newColWidthsPixel.size() ) && ( distributePixel > 0 ); ++i ) + { + if ( columnFlexibilities[i] == 0 ) + continue; + + OSL_ENSURE( o_newColWidthsPixel[i] <= effectiveColumnLimits[i].second, + "TableControl_Impl::impl_ni_calculateColumnWidths: inconsitency!" ); + if ( o_newColWidthsPixel[i] >= effectiveColumnLimits[i].first ) + { + columnFlexibilities[i] = 0; + --flexibleColumnCount; + continue; + } + + ++o_newColWidthsPixel[i]; + --distributePixel; + } + } } } - else if ( gridWidthAppFont < accumulatedCurrentWidth ) + else if ( gridWidthPixel < accumulatedCurrentWidth ) { // we need to take away some space from the columns which allow it ... - long takeAwayAppFontUnits = accumulatedCurrentWidth - gridWidthAppFont; - if ( gridWidthAppFont < accumulatedMinWidth ) + long takeAwayPixel = accumulatedCurrentWidth - gridWidthPixel; + if ( gridWidthPixel < accumulatedMinWidth ) { // ... but the column's minimal widths are still more than we have // => set them all to min for ( size_t i = 0; i < size_t( colCount ); ++i ) { - newWidths[i] = effectiveColumnLimits[i].first; + o_newColWidthsPixel[i] = effectiveColumnLimits[i].first; } } else @@ -992,13 +1116,13 @@ namespace svt { namespace table { startOver = false; // take away the space we need from the columns with a positive flexibility - for ( size_t i=0; i<newWidths.size() && !startOver; ++i ) + for ( size_t i=0; i<o_newColWidthsPixel.size() && !startOver; ++i ) { long const columnFlexibility = columnFlexibilities[i]; if ( columnFlexibility == 0 ) continue; - long newColWidth = currentColWidths[i] - columnFlexibility * takeAwayAppFontUnits / flexibilityDenominator; + long newColWidth = currentColWidths[i] - columnFlexibility * takeAwayPixel / flexibilityDenominator; if ( newColWidth < effectiveColumnLimits[i].first ) { // that was too much, we hit the col's minimum @@ -1007,172 +1131,79 @@ namespace svt { namespace table // adjust the flexibility denominator ... flexibilityDenominator -= columnFlexibility; columnFlexibilities[i] = 0; + --flexibleColumnCount; // ... and the remaining width ... long const difference = currentColWidths[i] - newColWidth; - takeAwayAppFontUnits -= difference; + takeAwayPixel -= difference; // and start over with the first column, since there might be earlier columns which need // to be recalculated now startOver = true; } - newWidths[i] = newColWidth; + o_newColWidthsPixel[i] = newColWidth; } } while ( startOver ); - } - } - // now that we have calculated the app-font widths, get the actual pixels - long accumulatedWidthPixel = m_nRowHeaderWidthPixel; - for ( ColPos col = 0; col < colCount; ++col ) - { - long const colWidth = m_rAntiImpl.LogicToPixel( Size( newWidths[col], 0 ), MAP_APPFONT ).Width(); - const long columnStart = accumulatedWidthPixel; - const long columnEnd = columnStart + colWidth; - m_aColumnWidths.push_back( MutableColumnMetrics( columnStart, columnEnd ) ); - accumulatedWidthPixel = columnEnd; - - // and don't forget to forward this to the column models - PColumnModel const pColumn = m_pModel->getColumnModel( col ); - ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); - pColumn->setWidth( newWidths[col] ); - } + // are there pixels left (might be caused by rounding errors)? + takeAwayPixel = ::std::accumulate( o_newColWidthsPixel.begin(), o_newColWidthsPixel.end(), 0 ) - gridWidthPixel; + while ( ( takeAwayPixel > 0 ) && ( flexibleColumnCount > 0 ) ) + { + // yes => ignore relative flexibilities, and subsequently take away pixels from all flexible + // columns which did not yet reach their minimum. + for ( size_t i=0; ( i < o_newColWidthsPixel.size() ) && ( takeAwayPixel > 0 ); ++i ) + { + if ( columnFlexibilities[i] == 0 ) + continue; - // if the column resizing happened to leave some space at the right, but there are columns - // scrolled out to the left, scroll them in - while ( ( m_nLeftColumn > 0 ) - && ( accumulatedWidthPixel - m_aColumnWidths[ m_nLeftColumn - 1 ].getStart() <= gridWidthPixel ) - ) - { - --m_nLeftColumn; - } + OSL_ENSURE( o_newColWidthsPixel[i] >= effectiveColumnLimits[i].first, + "TableControl_Impl::impl_ni_calculateColumnWidths: inconsitency!" ); + if ( o_newColWidthsPixel[i] <= effectiveColumnLimits[i].first ) + { + columnFlexibilities[i] = 0; + --flexibleColumnCount; + continue; + } - // now adjust the column metrics, since they currently ignore the horizontal scroll position - if ( m_nLeftColumn > 0 ) - { - const long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); - for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin(); - colPos != m_aColumnWidths.end(); - ++colPos - ) - { - colPos->move( offsetPixel ); + --o_newColWidthsPixel[i]; + --takeAwayPixel; + } + } } } + + return gridWidthPixel; } //------------------------------------------------------------------------------------------------------------------ - namespace + void TableControl_Impl::impl_ni_relayout( ColPos const i_assumeInflexibleColumnsUpToIncluding ) { - //.............................................................................................................. - /// determines whether a scrollbar is needed for the given values - bool lcl_determineScrollbarNeed( long const i_position, ScrollbarVisibility const i_visibility, - long const i_availableSpace, long const i_neededSpace ) - { - if ( i_visibility == ScrollbarShowNever ) - return false; - if ( i_visibility == ScrollbarShowAlways ) - return true; - if ( i_position > 0 ) - return true; - if ( i_availableSpace >= i_neededSpace ) - return false; - return true; - } - - //.............................................................................................................. - void lcl_setButtonRepeat( Window& _rWindow, sal_uLong _nDelay ) - { - AllSettings aSettings = _rWindow.GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - - aMouseSettings.SetButtonRepeat( _nDelay ); - aSettings.SetMouseSettings( aMouseSettings ); - - _rWindow.SetSettings( aSettings, sal_True ); - } - - //.............................................................................................................. - void lcl_updateScrollbar( Window& _rParent, ScrollBar*& _rpBar, - bool const i_needBar, long _nVisibleUnits, - long _nPosition, long _nLineSize, long _nRange, - bool _bHorizontal, const Link& _rScrollHandler ) - { - // do we currently have the scrollbar? - bool bHaveBar = _rpBar != NULL; - - // do we need to correct the scrollbar visibility? - if ( bHaveBar && !i_needBar ) - { - if ( _rpBar->IsTracking() ) - _rpBar->EndTracking(); - DELETEZ( _rpBar ); - } - else if ( !bHaveBar && i_needBar ) - { - _rpBar = new ScrollBar( - &_rParent, - WB_DRAG | ( _bHorizontal ? WB_HSCROLL : WB_VSCROLL ) - ); - _rpBar->SetScrollHdl( _rScrollHandler ); - // get some speed into the scrolling .... - lcl_setButtonRepeat( *_rpBar, 0 ); - } - - if ( _rpBar ) - { - _rpBar->SetRange( Range( 0, _nRange ) ); - _rpBar->SetVisibleSize( _nVisibleUnits ); - _rpBar->SetPageSize( _nVisibleUnits ); - _rpBar->SetLineSize( _nLineSize ); - _rpBar->SetThumbPos( _nPosition ); - _rpBar->Show(); - } - } - - //.............................................................................................................. - /** returns the number of rows fitting into the given range, - for the given row height. Partially fitting rows are counted, too, if the - respective parameter says so. - */ - TableSize lcl_getRowsFittingInto( long _nOverallHeight, long _nRowHeightPixel, bool _bAcceptPartialRow = false ) - { - return _bAcceptPartialRow - ? ( _nOverallHeight + ( _nRowHeightPixel - 1 ) ) / _nRowHeightPixel - : _nOverallHeight / _nRowHeightPixel; - } - - //.............................................................................................................. - /** returns the number of columns fitting into the given area, - with the first visible column as given. Partially fitting columns are counted, too, - if the respective parameter says so. - */ - TableSize lcl_getColumnsVisibleWithin( const Rectangle& _rArea, ColPos _nFirstVisibleColumn, - const TableControl_Impl& _rControl, bool _bAcceptPartialRow ) - { - TableSize visibleColumns = 0; - TableColumnGeometry aColumn( _rControl, _rArea, _nFirstVisibleColumn ); - while ( aColumn.isValid() ) - { - if ( !_bAcceptPartialRow ) - if ( aColumn.getRect().Right() > _rArea.Right() ) - // this column is only partially visible, and this is not allowed - break; + ENSURE_OR_RETURN_VOID( !m_bUpdatingColWidths, "TableControl_Impl::impl_ni_relayout: recursive call detected!" ); - aColumn.moveRight(); - ++visibleColumns; - } - return visibleColumns; - } - - } + m_aColumnWidths.resize( 0 ); + if ( !m_pModel ) + return; - //------------------------------------------------------------------------------------------------------------------ - void TableControl_Impl::impl_ni_updateScrollbars() - { + ::comphelper::FlagRestorationGuard const aWidthUpdateFlag( m_bUpdatingColWidths, true ); SuppressCursor aHideCursor( *this ); + // layouting steps: + // + // 1. adjust column widths, leaving space for a vertical scrollbar + // 2. determine need for a vertical scrollbar + // - V-YES: all fine, result from 1. is still valid + // - V-NO: result from 1. is still under consideration + // + // 3. determine need for a horizontal scrollbar + // - H-NO: all fine, result from 2. is still valid + // - H-YES: reconsider need for a vertical scrollbar, if result of 2. was V-NO + // - V-YES: all fine, result from 1. is still valid + // - V-NO: redistribute the remaining space (if any) amongst all columns which allow it + + ::std::vector< long > newWidthsPixel; + long gridWidthPixel = impl_ni_calculateColumnWidths( i_assumeInflexibleColumnsUpToIncluding, true, newWidthsPixel ); + // the width/height of a scrollbar, needed several times below long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); @@ -1181,18 +1212,13 @@ namespace svt { namespace table Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() ); aDataCellPlayground.Left() = m_nRowHeaderWidthPixel; aDataCellPlayground.Top() = m_nColHeaderHeightPixel; - m_nRowCount = m_pModel->getRowCount(); - m_nColumnCount = m_pModel->getColumnCount(); - if ( m_aColumnWidths.empty() ) - impl_ni_updateColumnWidths(); - OSL_ENSURE( m_aColumnWidths.size() == size_t( m_nColumnCount ), "TableControl_Impl::impl_ni_updateScrollbars: inconsistency!" ); - const long nAllColumnsWidth = m_aColumnWidths.empty() - ? 0 - : m_aColumnWidths[ m_nColumnCount - 1 ].getEnd() - m_aColumnWidths[ 0 ].getStart(); + OSL_ENSURE( ( m_nRowCount == m_pModel->getRowCount() ) && ( m_nColumnCount == m_pModel->getColumnCount() ), + "TableControl_Impl::impl_ni_relayout: how is this expected to work with invalid data?" ); + long const nAllColumnsWidth = ::std::accumulate( newWidthsPixel.begin(), newWidthsPixel.end(), 0 ); - const ScrollbarVisibility eVertScrollbar = m_pModel->getVerticalScrollbarVisibility(); - const ScrollbarVisibility eHorzScrollbar = m_pModel->getHorizontalScrollbarVisibility(); + ScrollbarVisibility const eVertScrollbar = m_pModel->getVerticalScrollbarVisibility(); + ScrollbarVisibility const eHorzScrollbar = m_pModel->getHorizontalScrollbarVisibility(); // do we need a vertical scrollbar? bool bNeedVerticalScrollbar = lcl_determineScrollbarNeed( @@ -1203,8 +1229,10 @@ namespace svt { namespace table aDataCellPlayground.Right() -= nScrollbarMetrics; bFirstRoundVScrollNeed = true; } + // do we need a horizontal scrollbar? - const bool bNeedHorizontalScrollbar = lcl_determineScrollbarNeed( m_nLeftColumn, eHorzScrollbar, aDataCellPlayground.GetWidth(), nAllColumnsWidth ); + bool const bNeedHorizontalScrollbar = lcl_determineScrollbarNeed( + m_nLeftColumn, eHorzScrollbar, aDataCellPlayground.GetWidth(), nAllColumnsWidth ); if ( bNeedHorizontalScrollbar ) { aDataCellPlayground.Bottom() -= nScrollbarMetrics; @@ -1223,12 +1251,77 @@ namespace svt { namespace table } } } + + // the initial call to impl_ni_calculateColumnWidths assumed that we need a vertical scrollbar. If, by now, + // we know that this is not the case, re-calculate the column widths. + if ( !bNeedVerticalScrollbar ) + gridWidthPixel = impl_ni_calculateColumnWidths( i_assumeInflexibleColumnsUpToIncluding, false, newWidthsPixel ); + + // update the column objects with the new widths we finally calculated + TableSize const colCount = m_pModel->getColumnCount(); + m_aColumnWidths.reserve( colCount ); + long accumulatedWidthPixel = m_nRowHeaderWidthPixel; + bool anyColumnWidthChanged = false; + for ( ColPos col = 0; col < colCount; ++col ) + { + const long columnStart = accumulatedWidthPixel; + const long columnEnd = columnStart + newWidthsPixel[col]; + m_aColumnWidths.push_back( MutableColumnMetrics( columnStart, columnEnd ) ); + accumulatedWidthPixel = columnEnd; + + // and don't forget to forward this to the column models + PColumnModel const pColumn = m_pModel->getColumnModel( col ); + ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); + + long const oldColumnWidthAppFont = pColumn->getWidth(); + long const newColumnWidthAppFont = pixelWidthToAppFont( newWidthsPixel[col] ); + pColumn->setWidth( newColumnWidthAppFont ); + + anyColumnWidthChanged |= ( oldColumnWidthAppFont != newColumnWidthAppFont ); + } + + // if the column widths changed, ensure everything is repainted + if ( anyColumnWidthChanged ) + invalidate( TableAreaAll ); + + // if the column resizing happened to leave some space at the right, but there are columns + // scrolled out to the left, scroll them in + while ( ( m_nLeftColumn > 0 ) + && ( accumulatedWidthPixel - m_aColumnWidths[ m_nLeftColumn - 1 ].getStart() <= gridWidthPixel ) + ) + { + --m_nLeftColumn; + } + + // now adjust the column metrics, since they currently ignore the horizontal scroll position + if ( m_nLeftColumn > 0 ) + { + const long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); + for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin(); + colPos != m_aColumnWidths.end(); + ++colPos + ) + { + colPos->move( offsetPixel ); + } + } + + // show or hide the scrollbars as needed, and position the data window + impl_ni_positionChildWindows( aDataCellPlayground, bNeedVerticalScrollbar, bNeedHorizontalScrollbar ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TableControl_Impl::impl_ni_positionChildWindows( Rectangle const & i_dataCellPlayground, + bool const i_verticalScrollbar, bool const i_horizontalScrollbar ) + { + long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + // create or destroy the vertical scrollbar, as needed lcl_updateScrollbar( m_rAntiImpl, m_pVScroll, - bNeedVerticalScrollbar, - lcl_getRowsFittingInto( aDataCellPlayground.GetHeight(), m_nRowHeightPixel ), + i_verticalScrollbar, + lcl_getRowsFittingInto( i_dataCellPlayground.GetHeight(), m_nRowHeightPixel ), // visible units m_nTopRow, // current position 1, // line size @@ -1236,12 +1329,13 @@ namespace svt { namespace table false, // vertical LINK( this, TableControl_Impl, OnScroll ) // scroll handler ); + // position it if ( m_pVScroll ) { Rectangle aScrollbarArea( - Point( aDataCellPlayground.Right() + 1, 0 ), - Size( nScrollbarMetrics, aDataCellPlayground.Bottom() + 1 ) + Point( i_dataCellPlayground.Right() + 1, 0 ), + Size( nScrollbarMetrics, i_dataCellPlayground.Bottom() + 1 ) ); m_pVScroll->SetPosSizePixel( aScrollbarArea.TopLeft(), aScrollbarArea.GetSize() ); @@ -1251,8 +1345,8 @@ namespace svt { namespace table lcl_updateScrollbar( m_rAntiImpl, m_pHScroll, - bNeedHorizontalScrollbar, - lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ), + i_horizontalScrollbar, + lcl_getColumnsVisibleWithin( i_dataCellPlayground, m_nLeftColumn, *this, false ), // visible units m_nLeftColumn, // current position 1, // line size @@ -1260,22 +1354,23 @@ namespace svt { namespace table true, // horizontal LINK( this, TableControl_Impl, OnScroll ) // scroll handler ); + // position it if ( m_pHScroll ) { - TableSize const nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ); + TableSize const nVisibleUnits = lcl_getColumnsVisibleWithin( i_dataCellPlayground, m_nLeftColumn, *this, false ); TableMetrics const nRange = m_nColumnCount; if( m_nLeftColumn + nVisibleUnits == nRange - 1 ) { - if ( m_aColumnWidths[ nRange - 1 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getEnd() + m_aColumnWidths[ nRange-1 ].getWidth() > aDataCellPlayground.GetWidth() ) + if ( m_aColumnWidths[ nRange - 1 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getEnd() + m_aColumnWidths[ nRange-1 ].getWidth() > i_dataCellPlayground.GetWidth() ) { m_pHScroll->SetVisibleSize( nVisibleUnits -1 ); m_pHScroll->SetPageSize( nVisibleUnits - 1 ); } } Rectangle aScrollbarArea( - Point( 0, aDataCellPlayground.Bottom() + 1 ), - Size( aDataCellPlayground.Right() + 1, nScrollbarMetrics ) + Point( 0, i_dataCellPlayground.Bottom() + 1 ), + Size( i_dataCellPlayground.Right() + 1, nScrollbarMetrics ) ); m_pHScroll->SetPosSizePixel( aScrollbarArea.TopLeft(), aScrollbarArea.GetSize() ); @@ -1292,19 +1387,19 @@ namespace svt { namespace table { m_pScrollCorner = new ScrollBarBox( &m_rAntiImpl ); m_pScrollCorner->SetSizePixel( Size( nScrollbarMetrics, nScrollbarMetrics ) ); - m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) ); + m_pScrollCorner->SetPosPixel( Point( i_dataCellPlayground.Right() + 1, i_dataCellPlayground.Bottom() + 1 ) ); m_pScrollCorner->Show(); } else if(bHaveScrollCorner && bNeedScrollCorner) { - m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) ); + m_pScrollCorner->SetPosPixel( Point( i_dataCellPlayground.Right() + 1, i_dataCellPlayground.Bottom() + 1 ) ); m_pScrollCorner->Show(); } // resize the data window m_pDataWindow->SetSizePixel( Size( - aDataCellPlayground.GetWidth() + m_nRowHeaderWidthPixel, - aDataCellPlayground.GetHeight() + m_nColHeaderHeightPixel + i_dataCellPlayground.GetWidth() + m_nRowHeaderWidthPixel, + i_dataCellPlayground.GetHeight() + m_nColHeaderHeightPixel ) ); } @@ -1313,8 +1408,7 @@ namespace svt { namespace table { DBG_CHECK_ME(); - impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + impl_ni_relayout(); checkCursorPosition(); } @@ -1408,14 +1502,14 @@ namespace svt { namespace table if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() ) continue; - bool const isActiveRow = ( aRowIterator.getRow() == getCurrentRow() ); + bool const isControlFocused = m_rAntiImpl.HasControlFocus(); bool const isSelectedRow = isRowSelected( aRowIterator.getRow() ); Rectangle const aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea ); // give the redenderer a chance to prepare the row pRenderer->PrepareRow( - aRowIterator.getRow(), isActiveRow, isSelectedRow, + aRowIterator.getRow(), isControlFocused, isSelectedRow, *m_pDataWindow, aRect, rStyle ); @@ -1423,7 +1517,7 @@ namespace svt { namespace table if ( m_pModel->hasRowHeaders() ) { const Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); - pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, + pRenderer->PaintRowHeader( isControlFocused, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, rStyle ); } @@ -1437,7 +1531,7 @@ namespace svt { namespace table ) { bool isSelectedColumn = false; - pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isControlFocused, *m_pDataWindow, aCell.getRect(), rStyle ); } } @@ -1469,30 +1563,25 @@ namespace svt { namespace table bool bSuccess = false; bool selectionChanged = false; - Rectangle rCells; switch ( _eAction ) { case cursorDown: - if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) + if ( m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION ) { //if other rows already selected, deselect them - if(m_aSelectedRows.size()>0) + if ( m_aSelectedRows.size()>0 ) { - for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin(); - it!=m_aSelectedRows.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } + invalidateSelectedRows(); m_aSelectedRows.clear(); } - if(m_nCurRow < m_nRowCount-1) + if ( m_nCurRow < m_nRowCount-1 ) { ++m_nCurRow; m_aSelectedRows.push_back(m_nCurRow); } else m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); ensureVisible(m_nCurColumn,m_nCurRow,false); selectionChanged = true; bSuccess = true; @@ -1509,23 +1598,19 @@ namespace svt { namespace table { if(m_aSelectedRows.size()>0) { - for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin(); - it!=m_aSelectedRows.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } + invalidateSelectedRows(); m_aSelectedRows.clear(); } if(m_nCurRow>0) { --m_nCurRow; m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } else { m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } ensureVisible(m_nCurColumn,m_nCurRow,false); selectionChanged = true; @@ -1607,7 +1692,7 @@ namespace svt { namespace table //else select the row->put it in the vector else m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); selectionChanged = true; bSuccess = true; } @@ -1630,14 +1715,10 @@ namespace svt { namespace table //and select the current row if(m_nAnchor==-1) { - for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin(); - it!=m_aSelectedRows.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } + invalidateSelectedRows(); m_aSelectedRows.clear(); m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } else { @@ -1655,12 +1736,12 @@ namespace svt { namespace table if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow) { m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells); + invalidateRow( m_nCurRow + 1 ); } else { m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } } else @@ -1670,7 +1751,7 @@ namespace svt { namespace table m_aSelectedRows.push_back(m_nCurRow); m_nCurRow--; m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); + invalidateSelectedRegion( m_nCurRow+1, m_nCurRow ); } } } @@ -1685,12 +1766,12 @@ namespace svt { namespace table m_aSelectedRows.push_back(m_nCurRow); m_nCurRow--; m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); + invalidateSelectedRegion( m_nCurRow+1, m_nCurRow ); } else { m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } } m_pSelEngine->SetAnchor(sal_True); @@ -1717,14 +1798,10 @@ namespace svt { namespace table //and select the current row if(m_nAnchor==-1) { - for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin(); - it!=m_aSelectedRows.end();++it) - { - invalidateSelectedRegion(*it, *it, rCells); - } + invalidateSelectedRows(); m_aSelectedRows.clear(); m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } else { @@ -1742,12 +1819,12 @@ namespace svt { namespace table if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow) { m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells); + invalidateRow( m_nCurRow - 1 ); } else { m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } } else @@ -1757,7 +1834,7 @@ namespace svt { namespace table m_aSelectedRows.push_back(m_nCurRow); m_nCurRow++; m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); + invalidateSelectedRegion( m_nCurRow-1, m_nCurRow ); } } } @@ -1770,12 +1847,12 @@ namespace svt { namespace table m_aSelectedRows.push_back(m_nCurRow); m_nCurRow++; m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells); + invalidateSelectedRegion( m_nCurRow-1, m_nCurRow ); } else { m_aSelectedRows.push_back(m_nCurRow); - invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + invalidateRow( m_nCurRow ); } } m_pSelEngine->SetAnchor(sal_True); @@ -1797,7 +1874,7 @@ namespace svt { namespace table { //select the region between the current and the upper row RowPos iter = m_nCurRow; - invalidateSelectedRegion(m_nCurRow, 0, rCells); + invalidateSelectedRegion( m_nCurRow, 0 ); //put the rows in vector while(iter>=0) { @@ -1823,7 +1900,7 @@ namespace svt { namespace table return bSuccess = false; //select the region between the current and the last row RowPos iter = m_nCurRow; - invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells); + invalidateSelectedRegion( m_nCurRow, m_nRowCount-1 ); //put the rows in the vector while(iter<=m_nRowCount) { @@ -2001,6 +2078,12 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ + long TableControl_Impl::appFontWidthToPixel( long const i_appFontUnits ) const + { + return m_pDataWindow->LogicToPixel( Size( i_appFontUnits, 0 ), MAP_APPFONT ).Width(); + } + + //------------------------------------------------------------------------------------------------------------------ void TableControl_Impl::hideTracking() { m_pDataWindow->HideTracking(); @@ -2020,48 +2103,59 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ - void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect) + void TableControl_Impl::invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow ) { DBG_CHECK_ME(); - //get the visible area of the table control and set the Left and right border of the region to be repainted + // get the visible area of the table control and set the Left and right border of the region to be repainted Rectangle const aAllCells( impl_getAllVisibleCellsArea() ); - _rCellRect.Left() = aAllCells.Left(); - _rCellRect.Right() = aAllCells.Right(); - //if only one row is selected - if(_nPrevRow == _nCurRow) + + Rectangle aInvalidateRect; + aInvalidateRect.Left() = aAllCells.Left(); + aInvalidateRect.Right() = aAllCells.Right(); + // if only one row is selected + if ( _nPrevRow == _nCurRow ) { Rectangle aCellRect; impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect ); - _rCellRect.Top() = aCellRect.Top(); - _rCellRect.Bottom() = aCellRect.Bottom(); + aInvalidateRect.Top() = aCellRect.Top(); + aInvalidateRect.Bottom() = aCellRect.Bottom(); } //if the region is above the current row else if(_nPrevRow < _nCurRow ) { Rectangle aCellRect; impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect ); - _rCellRect.Top() = aCellRect.Top(); + aInvalidateRect.Top() = aCellRect.Top(); impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect ); - _rCellRect.Bottom() = aCellRect.Bottom(); + aInvalidateRect.Bottom() = aCellRect.Bottom(); } //if the region is beneath the current row else { Rectangle aCellRect; impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect ); - _rCellRect.Top() = aCellRect.Top(); + aInvalidateRect.Top() = aCellRect.Top(); impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect ); - _rCellRect.Bottom() = aCellRect.Bottom(); + aInvalidateRect.Bottom() = aCellRect.Bottom(); } - m_pDataWindow->Invalidate(_rCellRect); + m_pDataWindow->Invalidate( aInvalidateRect ); } + //------------------------------------------------------------------------------------------------------------------ - void TableControl_Impl::invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow ) + void TableControl_Impl::invalidateSelectedRows() { - if ( m_nCursorHidden == 2 ) - // WTF? what kind of hack is this? - --m_nCursorHidden; + for ( ::std::vector< RowPos >::iterator selRow = m_aSelectedRows.begin(); + selRow != m_aSelectedRows.end(); + ++selRow + ) + { + invalidateRow( *selRow ); + } + } + //------------------------------------------------------------------------------------------------------------------ + void TableControl_Impl::invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow ) + { RowPos const firstRow = i_firstRow < m_nTopRow ? m_nTopRow : i_firstRow; RowPos const lastVisibleRow = m_nTopRow + impl_getVisibleRows( true ) - 1; RowPos const lastRow = ( ( i_lastRow == ROW_INVALID ) || ( i_lastRow > lastVisibleRow ) ) ? lastVisibleRow : i_lastRow; @@ -2203,9 +2297,13 @@ namespace svt { namespace table //-------------------------------------------------------------------- ::rtl::OUString TableControl_Impl::getCellContentAsString( RowPos const i_row, ColPos const i_col ) { - ::com::sun::star::uno::Any content; - m_pModel->getCellContent( i_col, i_row, content ); - return CellValueConversion::convertToString( content ); + Any aCellValue; + m_pModel->getCellContent( i_col, i_row, aCellValue ); + + ::rtl::OUString sCellStringContent; + m_pModel->getRenderer()->GetFormattedCellString( aCellValue, i_col, i_row, sCellStringContent ); + + return sCellStringContent; } //-------------------------------------------------------------------- @@ -2245,12 +2343,19 @@ namespace svt { namespace table m_pDataWindow->Invalidate( INVALIDATE_UPDATE ); // update the position at the vertical scrollbar - m_pVScroll->SetThumbPos( m_nTopRow ); - } - - // The scroll bar availaility might change when we scrolled. This is because we do not hide - // the scrollbar when it is, in theory, unnecessary, but currently at a position > 0. In this case, it will - // be auto-hidden when it's scrolled back to pos 0. + if ( m_pVScroll != NULL ) + m_pVScroll->SetThumbPos( m_nTopRow ); + } + + // The scroll bar availaility might change when we scrolled. + // For instance, imagine a view with 10 rows, if which 5 fit into the window, numbered 1 to 10. + // Now let + // - the user scroll to row number 6, so the last 5 rows are visible + // - somebody remove the last 4 rows + // - the user scroll to row number 5 being the top row, so the last two rows are visible + // - somebody remove row number 6 + // - the user scroll to row number 1 + // => in this case, the need for the scrollbar vanishes immediately. if ( m_nTopRow == 0 ) m_rAntiImpl.PostUserEvent( LINK( this, TableControl_Impl, OnUpdateScrollbars ) ); @@ -2315,7 +2420,8 @@ namespace svt { namespace table m_pDataWindow->Invalidate( INVALIDATE_UPDATE ); // update the position at the horizontal scrollbar - m_pHScroll->SetThumbPos( m_nLeftColumn ); + if ( m_pHScroll != NULL ) + m_pHScroll->SetThumbPos( m_nLeftColumn ); } // The scroll bar availaility might change when we scrolled. This is because we do not hide @@ -2388,18 +2494,16 @@ namespace svt { namespace table if ( i_ordinate < m_nRowHeaderWidthPixel ) return COL_ROW_HEADERS; - long const ordinate = i_ordinate - m_nRowHeaderWidthPixel; - ColumnPositions::const_iterator lowerBound = ::std::lower_bound( m_aColumnWidths.begin(), m_aColumnWidths.end(), - ordinate + 1, + i_ordinate + 1, ColumnInfoPositionLess() ); if ( lowerBound == m_aColumnWidths.end() ) { // point is *behind* the start of the last column ... - if ( ordinate < m_aColumnWidths.rbegin()->getEnd() ) + if ( i_ordinate < m_aColumnWidths.rbegin()->getEnd() ) // ... but still before its end return m_nColumnCount - 1; return COL_INVALID; @@ -2506,6 +2610,28 @@ namespace svt { namespace table } //-------------------------------------------------------------------- + void TableControl_Impl::commitAccessibleEvent( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue ) + { + impl_commitAccessibleEvent( i_eventID, i_newValue, i_oldValue ); + } + + //-------------------------------------------------------------------- + void TableControl_Impl::commitCellEvent( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue ) + { + DBG_CHECK_ME(); + if ( impl_isAccessibleAlive() ) + m_pAccessibleTable->commitCellEvent( i_eventID, i_newValue, i_oldValue ); + } + + //-------------------------------------------------------------------- + void TableControl_Impl::commitTableEvent( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue ) + { + DBG_CHECK_ME(); + if ( impl_isAccessibleAlive() ) + m_pAccessibleTable->commitTableEvent( i_eventID, i_newValue, i_oldValue ); + } + + //-------------------------------------------------------------------- Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader) { Rectangle const aRectTableWithHeaders( impl_getAllVisibleCellsArea() ); @@ -2517,16 +2643,38 @@ namespace svt { namespace table } //-------------------------------------------------------------------- + Rectangle TableControl_Impl::calcHeaderCellRect( bool bColHeader, sal_Int32 nPos ) + { + Rectangle const aHeaderRect = calcHeaderRect( bColHeader ); + TableCellGeometry const aGeometry( + *this, aHeaderRect, + bColHeader ? nPos : COL_ROW_HEADERS, + bColHeader ? ROW_COL_HEADERS : nPos + ); + return aGeometry.getRect(); + } + + //-------------------------------------------------------------------- Rectangle TableControl_Impl::calcTableRect() { return impl_getAllVisibleDataCellArea(); } //-------------------------------------------------------------------- + Rectangle TableControl_Impl::calcCellRect( sal_Int32 nRow, sal_Int32 nCol ) + { + Rectangle aCellRect; + impl_getCellRect( nRow, nCol, aCellRect ); + return aCellRect; + } + + //-------------------------------------------------------------------- IMPL_LINK( TableControl_Impl, OnUpdateScrollbars, void*, /**/ ) { DBG_CHECK_ME(); - impl_ni_updateScrollbars(); + // TODO: can't we simply use lcl_updateScrollbar here, so the scrollbars ranges are updated, instead of + // doing a complete re-layout? + impl_ni_relayout(); return 1L; } @@ -2666,8 +2814,7 @@ namespace svt { namespace table } m_pTableControl->setAnchor( m_pTableControl->getAnchor() - 1 ); } - Rectangle aCellRect; - m_pTableControl->invalidateSelectedRegion( m_pTableControl->getCurRow(), newRow, aCellRect ); + m_pTableControl->invalidateSelectedRegion( m_pTableControl->getCurRow(), newRow ); bHandled = sal_True; } //no region selected @@ -2690,8 +2837,7 @@ namespace svt { namespace table if ( m_pTableControl->getSelectedRowCount() > 1 && m_pTableControl->getSelEngine()->GetSelectionMode() != SINGLE_SELECTION ) m_pTableControl->getSelEngine()->AddAlways(sal_True); - Rectangle aCellRect; - m_pTableControl->invalidateSelectedRegion( newRow, newRow, aCellRect ); + m_pTableControl->invalidateRow( newRow ); bHandled = sal_True; } m_pTableControl->goTo( newCol, newRow ); @@ -2716,8 +2862,7 @@ namespace svt { namespace table void TableFunctionSet::DeselectAtPoint( const Point& rPoint ) { (void)rPoint; - Rectangle aCellRange; - m_pTableControl->invalidateSelectedRegion( m_nCurrentRow, m_nCurrentRow, aCellRange ); + m_pTableControl->invalidateRow( m_nCurrentRow ); m_pTableControl->markRowAsDeselected( m_nCurrentRow ); } @@ -2726,11 +2871,10 @@ namespace svt { namespace table { if ( m_pTableControl->hasRowSelection() ) { - Rectangle aCellRange; for ( size_t i=0; i<m_pTableControl->getSelectedRowCount(); ++i ) { RowPos const rowIndex = m_pTableControl->getSelectedRowIndex(i); - m_pTableControl->invalidateSelectedRegion( rowIndex, rowIndex, aCellRange ); + m_pTableControl->invalidateRow( rowIndex ); } m_pTableControl->markAllRowsAsDeselected(); diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index bc1ac55fbe51..4f3d18aa84fd 100755..100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -226,10 +226,10 @@ namespace svt { namespace table /** returns the position of the current row in the selection vector */ int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current); - /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ - void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect ); + /** ??? */ + void invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow ); - /** invalidates the part of the data window which is covered by the given row + /** invalidates the part of the data window which is covered by the given rows @param i_firstRow the index of the first row to include in the invalidation @param i_lastRow @@ -238,6 +238,14 @@ namespace svt { namespace table */ void invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow ); + /** invalidates the part of the data window which is covered by the given row + */ + void invalidateRow( RowPos const i_row ) { invalidateRowRange( i_row, i_row ); } + + /** invalidates all selected rows + */ + void invalidateSelectedRows(); + void checkCursorPosition(); bool hasRowSelection() const { return !m_aSelectedRows.empty(); } @@ -272,6 +280,10 @@ namespace svt { namespace table void setSelectHandler( Link const & i_selectHandler ) { m_aSelectHdl = i_selectHandler; } Link const& getSelectHandler() const { return m_aSelectHdl; } + void commitAccessibleEvent( sal_Int16 const i_eventID, const com::sun::star::uno::Any& i_newValue, const com::sun::star::uno::Any& i_oldValue ); + void commitCellEvent( sal_Int16 const i_eventID, const com::sun::star::uno::Any& i_newValue, const com::sun::star::uno::Any& i_oldValue ); + void commitTableEvent( sal_Int16 const i_eventID, const com::sun::star::uno::Any& i_newValue, const com::sun::star::uno::Any& i_oldValue ); + // ITableControl virtual void hideCursor(); virtual void showCursor(); @@ -296,19 +308,25 @@ namespace svt { namespace table virtual bool isRowSelected( RowPos i_row ) const; + long appFontWidthToPixel( long const i_appFontUnits ) const; + TableDataWindow& getDataWindow() { return *m_pDataWindow; } const TableDataWindow& getDataWindow() const { return *m_pDataWindow; } ScrollBar* getHorzScrollbar(); ScrollBar* getVertScrollbar(); - Rectangle calcHeaderRect(bool bColHeader); + Rectangle calcHeaderRect( bool bColHeader ); + Rectangle calcHeaderCellRect( bool bColHeader, sal_Int32 nPos ); Rectangle calcTableRect(); + Rectangle calcCellRect( sal_Int32 nRow, sal_Int32 nCol ); // A11Y ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessible( Window& i_parentWindow ); void disposeAccessible(); + inline bool isAccessibleAlive() const { return impl_isAccessibleAlive(); } + // ITableModelListener virtual void rowsInserted( RowPos first, RowPos last ); virtual void rowsRemoved( RowPos first, RowPos last ); @@ -371,26 +389,45 @@ namespace svt { namespace table */ void impl_ni_updateCachedTableMetrics(); - /** updates ->m_aColumnWidthsPixel with the current pixel widths of all model columns + /** does a relayout of the table control - The method is not bound to the classes public invariants, as it's used in - situations where the they must not necessarily be fullfilled. + Column widths, and consequently the availability of the vertical and horizontal scrollbar, are updated + with a call to this method. @param i_assumeInflexibleColumnsUpToIncluding the index of a column up to which all columns should be considered as inflexible, or <code>COL_INVALID</code>. */ - void impl_ni_updateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding = COL_INVALID ); + void impl_ni_relayout( ColPos const i_assumeInflexibleColumnsUpToIncluding = COL_INVALID ); - /** updates the scrollbars of the control + /** calculates the new width of our columns, taking into account their min and max widths, and their relative + flexibility. - The method is not bound to the classes public invariants, as it's used in - situations where the they must not necessarily be fullfilled. + @param i_assumeInflexibleColumnsUpToIncluding + the index of a column up to which all columns should be considered as inflexible, or + <code>COL_INVALID</code>. + + @param i_assumeVerticalScrollbar + controls whether or not we should assume the presence of a vertical scrollbar. If <true/>, and + if the model has a VerticalScrollbarVisibility != ScrollbarShowNever, the method will leave + space for a vertical scrollbar. + + @return + the overall width of the grid, which is available for columns + */ + long impl_ni_calculateColumnWidths( + ColPos const i_assumeInflexibleColumnsUpToIncluding, + bool const i_assumeVerticalScrollbar, + ::std::vector< long >& o_newColWidthsPixel + ) const; - This includes both the existence of the scrollbars, and their - state. + /** positions all child windows, e.g. the both scrollbars, the corner window, and the data window */ - void impl_ni_updateScrollbars(); + void impl_ni_positionChildWindows( + Rectangle const & i_dataCellPlayground, + bool const i_verticalScrollbar, + bool const i_horizontalScrollbar + ); /** scrolls the view by the given number of rows diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 11605e36c8b2..ccdd826686f6 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -32,7 +32,6 @@ #include "tabledatawindow.hxx" #include "tablecontrol_impl.hxx" #include "tablegeometry.hxx" -#include "cellvalueconversion.hxx" #include <vcl/help.hxx> @@ -140,7 +139,7 @@ namespace svt { namespace table aCellToolTip.clear(); } - sHelpText = CellValueConversion::convertToString( aCellToolTip ); + pTableModel->getRenderer()->GetFormattedCellString( aCellToolTip, hitCol, hitRow, sHelpText ); if ( sHelpText.indexOf( '\n' ) >= 0 ) nHelpStyle = QUICKHELP_TIP_STYLE_BALLOON; @@ -149,18 +148,26 @@ namespace svt { namespace table if ( sHelpText.getLength() ) { + // hide the standard (singleton) help window, so we do not have two help windows open at the same time + Help::HideBalloonAndQuickHelp(); + Rectangle const aControlScreenRect( OutputToScreenPixel( Point( 0, 0 ) ), GetOutputSizePixel() ); if ( m_nTipWindowHandle ) + { Help::UpdateTip( m_nTipWindowHandle, this, aControlScreenRect, sHelpText ); + } else m_nTipWindowHandle = Help::ShowTip( this, aControlScreenRect, sHelpText, nHelpStyle ); } else + { impl_hideTipWindow(); + Window::RequestHelp( rHEvt ); + } } //------------------------------------------------------------------------------------------------------------------ @@ -204,7 +211,6 @@ namespace svt { namespace table { m_aSelectHdl.Call( NULL ); } - m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } //------------------------------------------------------------------------------------------------------------------ @@ -213,7 +219,6 @@ namespace svt { namespace table if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); - m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GrabFocus(); } diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx index 6f78ac49c44d..645c37641870 100644 --- a/svtools/source/table/tabledatawindow.hxx +++ b/svtools/source/table/tabledatawindow.hxx @@ -52,8 +52,6 @@ namespace svt { namespace table friend class TableFunctionSet; private: TableControl_Impl& m_rTableControl; - Link m_aMouseButtonDownHdl; - Link m_aMouseButtonUpHdl; Link m_aSelectHdl; sal_uLong m_nTipWindowHandle; @@ -61,10 +59,6 @@ namespace svt { namespace table TableDataWindow( TableControl_Impl& _rTableControl ); ~TableDataWindow(); - inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; } - inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; } - inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; } - inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; } inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } inline const Link& GetSelectHdl() const { return m_aSelectHdl; } diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index 4de76107fd20..ecb808395c35 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -87,7 +87,7 @@ namespace svt const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; for ( size_t i=0; i<=nUpperBound; ++i ) { - sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); + long const nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); m_aDrawers[i]->SetPosSizePixel( aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); aUpperDrawerPos.Move( 0, nDrawerHeight ); @@ -97,7 +97,7 @@ namespace svt Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) { - sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); + long const nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); m_aDrawers[j]->SetPosSizePixel( Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), Size( nWidth, nDrawerHeight ) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 0e826ef6bff3..64b8f9241ae0 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -43,24 +43,52 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/grid/GridInvalidDataException.hpp> #include <com/sun/star/awt/grid/GridInvalidModelException.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/util/Color.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +/** === begin UNO using === **/ +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::awt::grid::XGridSelectionListener; +using ::com::sun::star::style::VerticalAlignment; +using ::com::sun::star::style::VerticalAlignment_TOP; +using ::com::sun::star::view::SelectionType; +using ::com::sun::star::view::SelectionType_NONE; +using ::com::sun::star::view::SelectionType_RANGE; +using ::com::sun::star::view::SelectionType_SINGLE; +using ::com::sun::star::view::SelectionType_MULTI; +using ::com::sun::star::awt::grid::XGridDataModel; +using ::com::sun::star::awt::grid::GridInvalidDataException; +using ::com::sun::star::lang::EventObject; +using ::com::sun::star::lang::IndexOutOfBoundsException; +using ::com::sun::star::awt::grid::XGridColumnModel; +using ::com::sun::star::awt::grid::GridSelectionEvent; +using ::com::sun::star::awt::grid::XGridColumn; +using ::com::sun::star::container::ContainerEvent; +using ::com::sun::star::awt::grid::GridDataEvent; +using ::com::sun::star::awt::grid::GridInvalidModelException; +using ::com::sun::star::util::VetoException; +/** === end UNO using === **/ + +namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; +namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + using namespace ::svt::table; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt::grid; -using namespace ::com::sun::star::view; -using namespace ::com::sun::star::style; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::accessibility; +typedef ::com::sun::star::util::Color UnoColor; +// --------------------------------------------------------------------------------------------------------------------- SVTXGridControl::SVTXGridControl() :m_pTableModel( new UnoControlTableModel() ) - ,m_bHasColumnHeaders( false ) - ,m_bHasRowHeaders( false ) ,m_bTableModelInitCompleted( false ) - ,m_nSelectedRowCount( 0 ) ,m_aSelectionListeners( *this ) { } @@ -78,7 +106,21 @@ void SVTXGridControl::SetWindow( Window* pWindow ) } // --------------------------------------------------------------------------------------------------------------------- -sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +void SVTXGridControl::impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const +{ + if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= i_table.GetColumnCount() ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SVTXGridControl* >( this ) ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SVTXGridControl::impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const +{ + if ( ( i_rowIndex < 0 ) || ( i_rowIndex >= i_table.GetRowCount() ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SVTXGridControl* >( this ) ); +} + +// --------------------------------------------------------------------------------------------------------------------- +sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -90,7 +132,7 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) } // --------------------------------------------------------------------------------------------------------------------- -sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -125,14 +167,28 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException) return ( nRow >= 0 ) ? nRow : -1; } +//---------------------------------------------------------------------------------------------------------------------- +void SAL_CALL SVTXGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException, VetoException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!" ); + + impl_checkColumnIndex_throw( *pTable, i_columnIndex ); + impl_checkRowIndex_throw( *pTable, i_rowIndex ); + + pTable->GoTo( i_columnIndex, i_rowIndex ); +} + // --------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::addSelectionListener(const Reference< XGridSelectionListener > & listener) throw (RuntimeException) { m_aSelectionListeners.addInterface(listener); } // --------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::removeSelectionListener(const Reference< XGridSelectionListener > & listener) throw (RuntimeException) { m_aSelectionListeners.removeInterface(listener); } @@ -284,6 +340,27 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An pTable->Invalidate(); break; + case BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR: + m_pTableModel->setActiveSelectionBackColor( aValue ); + pTable->Invalidate(); + break; + + case BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR: + m_pTableModel->setInactiveSelectionBackColor( aValue ); + pTable->Invalidate(); + break; + + case BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR: + m_pTableModel->setActiveSelectionTextColor( aValue ); + pTable->Invalidate(); + break; + + case BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR: + m_pTableModel->setInactiveSelectionTextColor( aValue ); + pTable->Invalidate(); + break; + + case BASEPROPERTY_TEXTCOLOR: m_pTableModel->setTextColor( aValue ); pTable->Invalidate(); @@ -455,7 +532,7 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru aPropertyValue.clear(); else { - Sequence< ::com::sun::star::util::Color > aAPIColors( aColors->size() ); + Sequence< UnoColor > aAPIColors( aColors->size() ); for ( size_t i=0; i<aColors->size(); ++i ) { aAPIColors[i] = aColors->at(i).GetColor(); @@ -477,6 +554,22 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru lcl_convertColor( m_pTableModel->getHeaderTextColor(), aPropertyValue ); break; + case BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR: + lcl_convertColor( m_pTableModel->getActiveSelectionBackColor(), aPropertyValue ); + break; + + case BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR: + lcl_convertColor( m_pTableModel->getInactiveSelectionBackColor(), aPropertyValue ); + break; + + case BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR: + lcl_convertColor( m_pTableModel->getActiveSelectionTextColor(), aPropertyValue ); + break; + + case BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR: + lcl_convertColor( m_pTableModel->getInactiveSelectionTextColor(), aPropertyValue ); + break; + case BASEPROPERTY_TEXTCOLOR: lcl_convertColor( m_pTableModel->getTextColor(), aPropertyValue ); break; @@ -505,6 +598,10 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_GRID_HEADER_TEXT_COLOR, BASEPROPERTY_GRID_LINE_COLOR, BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS, + BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR, + BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR, + BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR, + BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR, 0 ); VCLXWindow::ImplGetPropertyIds( rIds, true ); @@ -585,24 +682,26 @@ void SAL_CALL SVTXGridControl::elementReplaced( const ContainerEvent& i_event ) //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::disposing( const EventObject& Source ) throw(RuntimeException) { VCLXWindow::disposing( Source ); } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException ) { ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" ); + impl_checkRowIndex_throw( *pTable, i_rowIndex ); + pTable->SelectRow( i_rowIndex, true ); } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::selectAllRows() throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -613,18 +712,20 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException ) { ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" ); + impl_checkRowIndex_throw( *pTable, i_rowIndex ); + pTable->SelectRow( i_rowIndex, false ); } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::deselectAllRows() throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -635,12 +736,12 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R } //---------------------------------------------------------------------------------------------------------------------- -::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) +Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); - ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", Sequence< sal_Int32 >() ); + ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelectedRows: no control (anymore)!", Sequence< sal_Int32 >() ); sal_Int32 selectionCount = pTable->GetSelectedRowCount(); Sequence< sal_Int32 > selectedRows( selectionCount ); @@ -650,31 +751,31 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R } //---------------------------------------------------------------------------------------------------------------------- -::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL SVTXGridControl::hasSelectedRows() throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); - ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", sal_True ); + ENSURE_OR_RETURN( pTable, "SVTXGridControl::hasSelectedRows: no control (anymore)!", sal_True ); return pTable->GetSelectedRowCount() > 0; } //---------------------------------------------------------------------------------------------------------------------- -::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex( ::sal_Int32 index ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL SVTXGridControl::isRowSelected( ::sal_Int32 index ) throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); - ENSURE_OR_RETURN( pTable, "SVTXGridControl::isSelectedIndex: no control (anymore)!", sal_False ); + ENSURE_OR_RETURN( pTable, "SVTXGridControl::isRowSelected: no control (anymore)!", sal_False ); return pTable->IsRowSelected( index ); } //---------------------------------------------------------------------------------------------------------------------- -void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException) +void SVTXGridControl::dispose() throw(RuntimeException) { - ::com::sun::star::lang::EventObject aObj; + EventObject aObj; aObj.Source = (::cppu::OWeakObject*)this; m_aSelectionListeners.disposeAndClear( aObj ); VCLXWindow::dispose(); @@ -685,22 +786,76 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent { ::vos::OGuard aGuard( GetMutex() ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); + Reference< XWindow > xKeepAlive( this ); + + TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" ); + + bool handled = false; switch ( rVclWindowEvent.GetId() ) { case VCLEVENT_TABLEROW_SELECT: { - TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); - ENSURE_OR_BREAK( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" ); if ( m_aSelectionListeners.getLength() ) ImplCallItemListeners(); + handled = true; } break; - default: - VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); - break; + case VCLEVENT_CONTROL_GETFOCUS: + { + // TODO: this doesn't belong here. It belongs into the TableControl/_Impl, so A11Y also + // works when the control is used outside the UNO context + if ( pTable->GetRowCount()>0 ) + { + pTable->commitCellEventIfAccessibleAlive( + AccessibleEventId::STATE_CHANGED, + makeAny( AccessibleStateType::FOCUSED ), + Any() + ); + pTable->commitTableEventIfAccessibleAlive( + AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, + Any(), + Any() + ); + } + else + { + pTable->commitTableEventIfAccessibleAlive( + AccessibleEventId::STATE_CHANGED, + makeAny( AccessibleStateType::FOCUSED ), + Any() + ); + } + } + break; + + case VCLEVENT_CONTROL_LOSEFOCUS: + { + // TODO: this doesn't belong here. It belongs into the TableControl/_Impl, so A11Y also + // works when the control is used outside the UNO context + if ( pTable->GetRowCount()>0 ) + { + pTable->commitCellEventIfAccessibleAlive( + AccessibleEventId::STATE_CHANGED, + Any(), + makeAny( AccessibleStateType::FOCUSED ) + ); + } + else + { + pTable->commitTableEventIfAccessibleAlive( + AccessibleEventId::STATE_CHANGED, + Any(), + makeAny( AccessibleStateType::FOCUSED ) + ); + } + } + break; } + + if ( !handled ) + VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); } //---------------------------------------------------------------------------------------------------------------------- @@ -711,42 +866,13 @@ void SVTXGridControl::ImplCallItemListeners() if ( m_aSelectionListeners.getLength() ) { - sal_Int32 const actSelRowCount = pTable->GetSelectedRowCount(); - ::com::sun::star::awt::grid::GridSelectionEvent aEvent; + GridSelectionEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.Column = 0; - sal_Int32 diff = actSelRowCount - m_nSelectedRowCount; - //row added to selection - if(diff >= 1) - { - aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0); - aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 ); - aEvent.Range = diff; - } - //selected row changed - else if(diff == 0 && actSelRowCount != 0) - { - aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 ); - aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); - aEvent.Range = 0; - } - else - { - //selection changed: multiple row deselected, only 1 row is selected - if(actSelRowCount == 1) - { - aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 ); - aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); - } - //row is deselected - else - { - aEvent.Row = pTable->GetCurrentRow(); - aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1); - } - aEvent.Range = 0; - } - m_nSelectedRowCount=actSelRowCount; + + sal_Int32 const nSelectedRowCount( pTable->GetSelectedRowCount() ); + aEvent.SelectedRowIndexes.realloc( nSelectedRowCount ); + for ( sal_Int32 i=0; i<nSelectedRowCount; ++i ) + aEvent.SelectedRowIndexes[i] = pTable->GetSelectedRowIndex( i ); m_aSelectionListeners.selectionChanged( aEvent ); } } @@ -777,4 +903,3 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow() DBG_UNHANDLED_EXCEPTION(); } } - diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index 525327b3c760..ebde9b76c078 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -31,6 +31,7 @@ #include <unocontroltablemodel.hxx> #include <svtools/table/tablecontrol.hxx> #include <com/sun/star/awt/grid/XGridControl.hpp> +#include <com/sun/star/awt/grid/XGridRowSelection.hpp> #include <com/sun/star/awt/grid/XGridDataListener.hpp> #include <com/sun/star/awt/grid/GridDataEvent.hpp> #include <com/sun/star/awt/grid/GridColumnEvent.hpp> @@ -45,22 +46,22 @@ #include <toolkit/helper/listenermultiplexer.hxx> -using namespace ::svt::table; +namespace svt { namespace table { + class TableControl; +} } -typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow +typedef ::cppu::ImplInheritanceHelper4 < VCLXWindow , ::com::sun::star::awt::grid::XGridControl + , ::com::sun::star::awt::grid::XGridRowSelection , ::com::sun::star::awt::grid::XGridDataListener , ::com::sun::star::container::XContainerListener > SVTXGridControl_Base; class SVTXGridControl : public SVTXGridControl_Base { private: - ::boost::shared_ptr< UnoControlTableModel > m_pTableModel; - bool m_bHasColumnHeaders; - bool m_bHasRowHeaders; - bool m_bTableModelInitCompleted; - sal_Int32 m_nSelectedRowCount; - SelectionListenerMultiplexer m_aSelectionListeners; + ::boost::shared_ptr< ::svt::table::UnoControlTableModel > m_pTableModel; + bool m_bTableModelInitCompleted; + SelectionListenerMultiplexer m_aSelectionListeners; protected: virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); @@ -84,22 +85,23 @@ public: // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - // XGridSelection - virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - // XGridControl virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException); + + // XGridRowSelection + virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); @@ -115,5 +117,8 @@ protected: private: void impl_updateColumnsFromModel_nothrow(); void impl_checkTableModelInit(); + + void impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const; + void impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const; }; #endif // _SVT_GRIDCONTROL_HXX_ diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 933363115810..b4c1bed746fa 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -98,6 +98,10 @@ namespace svt { namespace table ::boost::optional< ::Color > m_aGridLineColor; ::boost::optional< ::Color > m_aHeaderBackgroundColor; ::boost::optional< ::Color > m_aHeaderTextColor; + ::boost::optional< ::Color > m_aActiveSelectionBackColor; + ::boost::optional< ::Color > m_aInactiveSelectionBackColor; + ::boost::optional< ::Color > m_aActiveSelectionTextColor; + ::boost::optional< ::Color > m_aInactiveSelectionTextColor; ::boost::optional< ::Color > m_aTextColor; ::boost::optional< ::Color > m_aTextLineColor; ::boost::optional< ::std::vector< ::Color > > m_aRowColors; @@ -107,23 +111,27 @@ namespace svt { namespace table WeakReference< XGridColumnModel > m_aColumnModel; UnoControlTableModel_Impl() - :aColumns ( ) - ,bHasColumnHeaders ( true ) - ,bHasRowHeaders ( false ) - ,eVScrollMode ( ScrollbarShowNever ) - ,eHScrollMode ( ScrollbarShowNever ) - ,pRenderer ( ) - ,pInputHandler ( ) - ,nRowHeight ( 10 ) - ,nColumnHeaderHeight ( 10 ) - ,nRowHeaderWidth ( 10 ) - ,m_aGridLineColor ( ) - ,m_aHeaderBackgroundColor ( ) - ,m_aHeaderTextColor ( ) - ,m_aTextColor ( ) - ,m_aTextLineColor ( ) - ,m_aRowColors ( ) - ,m_eVerticalAlign ( VerticalAlignment_TOP ) + :aColumns ( ) + ,bHasColumnHeaders ( true ) + ,bHasRowHeaders ( false ) + ,eVScrollMode ( ScrollbarShowNever ) + ,eHScrollMode ( ScrollbarShowNever ) + ,pRenderer ( ) + ,pInputHandler ( ) + ,nRowHeight ( 10 ) + ,nColumnHeaderHeight ( 10 ) + ,nRowHeaderWidth ( 10 ) + ,m_aGridLineColor ( ) + ,m_aHeaderBackgroundColor ( ) + ,m_aHeaderTextColor ( ) + ,m_aActiveSelectionBackColor ( ) + ,m_aInactiveSelectionBackColor ( ) + ,m_aActiveSelectionTextColor ( ) + ,m_aInactiveSelectionTextColor ( ) + ,m_aTextColor ( ) + ,m_aTextLineColor ( ) + ,m_aRowColors ( ) + ,m_eVerticalAlign ( VerticalAlignment_TOP ) { } }; @@ -654,6 +662,34 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< ::Color > UnoControlTableModel::getActiveSelectionBackColor() const + { + DBG_CHECK_ME(); + return m_pImpl->m_aActiveSelectionBackColor; + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< ::Color > UnoControlTableModel::getInactiveSelectionBackColor() const + { + DBG_CHECK_ME(); + return m_pImpl->m_aInactiveSelectionBackColor; + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< ::Color > UnoControlTableModel::getActiveSelectionTextColor() const + { + DBG_CHECK_ME(); + return m_pImpl->m_aActiveSelectionTextColor; + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< ::Color > UnoControlTableModel::getInactiveSelectionTextColor() const + { + DBG_CHECK_ME(); + return m_pImpl->m_aInactiveSelectionTextColor; + } + + //------------------------------------------------------------------------------------------------------------------ void UnoControlTableModel::setHeaderTextColor( Any const & i_color ) { DBG_CHECK_ME(); @@ -661,6 +697,34 @@ namespace svt { namespace table } //------------------------------------------------------------------------------------------------------------------ + void UnoControlTableModel::setActiveSelectionBackColor( Any const & i_color ) + { + DBG_CHECK_ME(); + lcl_setColor( i_color, m_pImpl->m_aActiveSelectionBackColor ); + } + + //------------------------------------------------------------------------------------------------------------------ + void UnoControlTableModel::setInactiveSelectionBackColor( Any const & i_color ) + { + DBG_CHECK_ME(); + lcl_setColor( i_color, m_pImpl->m_aInactiveSelectionBackColor ); + } + + //------------------------------------------------------------------------------------------------------------------ + void UnoControlTableModel::setActiveSelectionTextColor( Any const & i_color ) + { + DBG_CHECK_ME(); + lcl_setColor( i_color, m_pImpl->m_aActiveSelectionTextColor ); + } + + //------------------------------------------------------------------------------------------------------------------ + void UnoControlTableModel::setInactiveSelectionTextColor( Any const & i_color ) + { + DBG_CHECK_ME(); + lcl_setColor( i_color, m_pImpl->m_aInactiveSelectionTextColor ); + } + + //------------------------------------------------------------------------------------------------------------------ ::boost::optional< ::Color > UnoControlTableModel::getTextColor() const { DBG_CHECK_ME(); diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index 537c3d9a5249..3c5f52748eee 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -89,6 +89,10 @@ namespace svt { namespace table virtual ::boost::optional< ::Color > getLineColor() const; virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const; virtual ::boost::optional< ::Color > getHeaderTextColor() const; + virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const; + virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const; + virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const; + virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const; virtual ::boost::optional< ::Color > getTextColor() const; virtual ::boost::optional< ::Color > getTextLineColor() const; virtual ::boost::optional< ::std::vector< ::Color > > @@ -130,6 +134,10 @@ namespace svt { namespace table void setLineColor( ::com::sun::star::uno::Any const & i_color ); void setHeaderBackgroundColor( ::com::sun::star::uno::Any const & i_color ); void setHeaderTextColor( ::com::sun::star::uno::Any const & i_color ); + void setActiveSelectionBackColor( ::com::sun::star::uno::Any const & i_color ); + void setInactiveSelectionBackColor( ::com::sun::star::uno::Any const & i_color ); + void setActiveSelectionTextColor( ::com::sun::star::uno::Any const & i_color ); + void setInactiveSelectionTextColor( ::com::sun::star::uno::Any const & i_color ); void setTextColor( ::com::sun::star::uno::Any const & i_color ); void setTextLineColor( ::com::sun::star::uno::Any const & i_color ); void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue ); diff --git a/svx/inc/galtheme.hrc b/svx/inc/galtheme.hrc index 483c397983ed..b0d656430864 100644 --- a/svx/inc/galtheme.hrc +++ b/svx/inc/galtheme.hrc @@ -43,7 +43,7 @@ #define RID_GALLERYSTR_THEME_MAPS (RID_GALLERYSTR_THEME_START + 12) #define RID_GALLERYSTR_THEME_PEOPLE (RID_GALLERYSTR_THEME_START + 13) #define RID_GALLERYSTR_THEME_SURFACES (RID_GALLERYSTR_THEME_START + 14) -#define RID_GALLERYSTR_THEME_HTMLBUTTONS (RID_GALLERYSTR_THEME_START + 15) +// free #define RID_GALLERYSTR_THEME_POWERPOINT (RID_GALLERYSTR_THEME_START + 16) #define RID_GALLERYSTR_THEME_RULERS (RID_GALLERYSTR_THEME_START + 17) #define RID_GALLERYSTR_THEME_SOUNDS (RID_GALLERYSTR_THEME_START + 18) diff --git a/svx/inc/svx/gallery.hxx b/svx/inc/svx/gallery.hxx index d87d93f8cc22..7edff48fd401 100644 --- a/svx/inc/svx/gallery.hxx +++ b/svx/inc/svx/gallery.hxx @@ -63,7 +63,7 @@ #define GALLERY_THEME_MAPS 12 #define GALLERY_THEME_PEOPLE 13 #define GALLERY_THEME_SURFACES 14 -#define GALLERY_THEME_HTMLBUTTONS 15 +// free #define GALLERY_THEME_POWERPOINT 16 #define GALLERY_THEME_RULERS 17 #define GALLERY_THEME_SOUNDS 18 diff --git a/svx/inc/svx/msdffdef.hxx b/svx/inc/svx/msdffdef.hxx index 92f00114edf4..d19757b9f8d0 100644 --- a/svx/inc/svx/msdffdef.hxx +++ b/svx/inc/svx/msdffdef.hxx @@ -579,6 +579,10 @@ enum DFF_TextHeader { #define DFF_PBit_Hidden 0x00000002 #define DFF_PBit_Print 0x00000001 +// properties of the second property set +#define DFF_Prop_metroBlob 937 // XML ZipPackage* + + //--------------------------------------------------------------------------- // Dreh- und Angelpunkt: der Shape-Typ //--------------------------------------------------------------------------- diff --git a/svx/inc/svx/sdr/properties/pageproperties.hxx b/svx/inc/svx/sdr/properties/pageproperties.hxx index d85686b3bc5b..9dbbc645d9be 100644 --- a/svx/inc/svx/sdr/properties/pageproperties.hxx +++ b/svx/inc/svx/sdr/properties/pageproperties.hxx @@ -45,6 +45,9 @@ namespace sdr // Do the ItemChange, may do special handling virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0); + // Called after ItemChange() is done for all items. + virtual void PostItemChange(const sal_uInt16 nWhich); + public: // basic constructor PageProperties(SdrObject& rObj); diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx index 311c2ccfd1a5..99ebdfbb1be9 100644 --- a/svx/inc/svx/sdr/properties/properties.hxx +++ b/svx/inc/svx/sdr/properties/properties.hxx @@ -187,6 +187,10 @@ namespace sdr // default implementation returns 0 (zero) virtual sal_uInt32 getVersion() const; }; + + // checks the FillStyle item and removes unneeded Gradient, FillBitmap and Hatch items + void SVX_DLLPUBLIC CleanupFillProperties( SfxItemSet& rItemSet ); + } // end of namespace properties } // end of namespace sdr diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index a32147a3032f..3c112bc57700 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -742,6 +742,7 @@ public: also during the runtime of the Undo() and Redo() methods. */ bool IsUndoEnabled() const; + void SetDrawingLayerPoolDefaults(); }; typedef tools::WeakReference< SdrModel > SdrModelWeakRef; diff --git a/svx/inc/svx/xdef.hxx b/svx/inc/svx/xdef.hxx index dd0fbd802291..9a06439f3738 100644 --- a/svx/inc/svx/xdef.hxx +++ b/svx/inc/svx/xdef.hxx @@ -36,7 +36,7 @@ |* \************************************************************************/ -#define COL_DEFAULT_SHAPE_FILLING RGB_COLORDATA( 0xCF, 0xE7, 0xE5 ) +#define COL_DEFAULT_SHAPE_FILLING RGB_COLORDATA( 0xCF, 0xE7, 0xF5 ) #define COL_DEFAULT_SHAPE_STROKE RGB_COLORDATA( 128, 128, 128 ) #define XATTR_START 1000 diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 6224373f9a15..a0c5f7dbcfb0 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -789,7 +789,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : case mso_sptCurvedLeftArrow : case mso_sptCurvedRightArrow : case mso_sptCurvedUpArrow : - case mso_sptCurvedDownArrow : nColorData = 0x2d000000; break; + case mso_sptCurvedDownArrow : nColorData = 0x20d00000; break; case mso_sptRibbon2 : nColorData = 0x30ee0000; break; case mso_sptRibbon : nColorData = 0x30ee0000; break; @@ -2002,7 +2002,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl SdrObject* pRet = NULL; sal_uInt32 i; - if ( vObjectList.size() ) + if ( !vObjectList.empty() ) { const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet(); Color aFillColor; @@ -2010,7 +2010,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl sal_uInt32 nColorIndex = 0; // #i37011# remove invisible objects - if(vObjectList.size()) + if(!vObjectList.empty()) { std::vector< SdrPathObj* > vTempList; @@ -2092,7 +2092,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl } // #i37011# - if(vObjectList.size()) + if(!vObjectList.empty()) { // copy remaining objects to pRet if(vObjectList.size() > 1L) diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 0af22d94334b..3fee313423b1 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -685,7 +685,7 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW std::vector< double > vDistances; vDistances.reserve( nPointCount ); CalcDistances( rOutlinePoly, vDistances ); - if ( vDistances.size() ) + if ( !vDistances.empty() ) { std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() ); std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() ); @@ -816,7 +816,7 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW SdrObject* CreateSdrObjectFromParagraphOutlines( const FWData& rFWData, const SdrObject* pCustomShape ) { SdrObject* pRet = NULL; - if ( rFWData.vTextAreas.size() ) + if ( !rFWData.vTextAreas.empty() ) { pRet = new SdrObjGroup(); // SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 2bf28c81ca18..e4f5738d531b 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -1186,30 +1186,29 @@ static const mso_CustomShape msoBentUpArrow = (SvxMSDffHandle*)mso_sptBentUpArrowHandle, sizeof( mso_sptBentUpArrowHandle ) / sizeof( SvxMSDffHandle ) }; - -static const SvxMSDffVertPair mso_sptCurvedDownVert[] = +static const SvxMSDffVertPair mso_sptCurvedRightVert[] = { - { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 0, 21600 }, { 4 MSO_I, 0 }, - { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 4 MSO_I, 0 }, { 17 MSO_I, 24 MSO_I }, - { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 15 MSO_I, 21600 }, - { 15 MSO_I, 0 }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 0 }, { 13 MSO_I, 2 MSO_I }, - { 14 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I }, - { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 11 MSO_I, 2 MSO_I }, { 17 MSO_I, 24 MSO_I }, - { 0, 0 }, { 3 MSO_I, 21 MSO_I }, { 17 MSO_I, 24 MSO_I }, { 4 MSO_I, 0 } + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 22 MSO_I, 0 }, { 0, 4 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 0, 7 MSO_I }, { 2 MSO_I, 13 MSO_I }, + { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 22 MSO_I, 15 MSO_I }, + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 22 MSO_I, 0 }, { 0, 4 MSO_I }, + { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 0, 4 MSO_I }, { 26 MSO_I, 17 MSO_I }, + { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 22 MSO_I, 15 MSO_I } }; -static const sal_uInt16 mso_sptCurvedDownSegm[] = +static const sal_uInt16 mso_sptCurvedRightSegm[] = { + 0xa408, + 0x0003, 0xa508, - 0xa304, 0x6000, 0x8000, - 0xa604, - 0x0003, - 0xa308, + 0xa404, + 0xa304, + 0xa504, 0x6000, 0x8000 }; -static const SvxMSDffCalculationData mso_sptCurvedDownCalc[] = +static const SvxMSDffCalculationData mso_sptCurvedRightCalc[] = { { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, @@ -1232,60 +1231,117 @@ static const SvxMSDffCalculationData mso_sptCurvedDownCalc[] = { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, { 0x2001, { 0x412, 1, 2 } }, { 0xa000, { 0x411, 0, 0x413 } }, + { 0x0000, { 21600, 0, 0 } }, + { 0x0000, { 21600, 0, 0 } }, { 0x0001, { 21600, 2, 1 } }, { 0xa000, { 0x411, 0, 0x404 } }, - { 0x600f, { 0x416, 0x404, 21600 } }, - { 0x8000, { 21600, 0, 0x417 } }, + { 0x600f, { 0x418, 0x404, 21600 } }, + { 0x8000, { 21600, 0, 0x419 } }, { 0x2000, { 0x408, 128, 0 } }, { 0x2001, { 0x405, 1, 2 } }, { 0x2000, { 0x405, 0, 128 } }, { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } }, { 0x600f, { 0x414, 0x404, 21600 } }, { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, - { 0x2001, { 0x41e, 1, 2 } }, + { 0x2001, { 0x420, 1, 2 } }, { 0x0001, { 21600, 21600, 1 } }, { 0x6001, { 0x409, 0x409, 1 } }, - { 0xa000, { 0x420, 0, 0x421 } }, - { 0x200d, { 0x422, 0, 0 } }, - { 0x2000, { 0x423, 21600, 0 } }, - { 0x8001, { 21600, 21600, 0x424 } }, - { 0x2000, { 0x425, 64, 0 } }, + { 0xa000, { 0x422, 0, 0x423 } }, + { 0x200d, { 0x424, 0, 0 } }, + { 0x2000, { 0x425, 21600, 0 } }, + { 0x8001, { 21600, 21600, 0x426 } }, + { 0x2000, { 0x427, 64, 0 } }, { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, - { 0x600f, { 0x41f, 0x427, 21600 } }, - { 0x8000, { 21600, 0, 0x428 } }, - { 0x2000, { 0x429, 64, 0 } }, + { 0x600f, { 0x421, 0x429, 21600 } }, + { 0x8000, { 21600, 0, 0x42a } }, + { 0x2000, { 0x42b, 64, 0 } }, { 0x2001, { 0x404, 1, 2 } }, - { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42b } }, + { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42d } }, { 0x0001, { 21600, 2195, 16384 } }, { 0x0001, { 21600, 14189, 16384 } } }; -static const sal_Int32 mso_sptCurvedDownDefault[] = +static const sal_Int32 mso_sptCurvedRightDefault[] = { 3, 12960, 19440, 14400 }; +static const SvxMSDffTextRectangles mso_sptCurvedRightTextRect[] = +{ + { { 47 MSO_I, 45 MSO_I }, { 48 MSO_I, 46 MSO_I } } +}; +static const SvxMSDffVertPair mso_sptCurvedRightGluePoints[] = +{ + { 0, 17 MSO_I }, { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, { 22 MSO_I, 16 MSO_I } +}; +static const SvxMSDffHandle mso_sptCurvedRightHandles[] = +{ + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x100, 10800, 10800, 0, 10800, 3 + 40, 3 + 29 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x101, 10800, 10800, 0, 10800, 3 + 27, 3 + 21 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x102, 21600, 10800, 10800, 3 + 44, 3 + 22, 3375, 21600 } +}; +static const mso_CustomShape msoCurvedRightArrow = +{ + (SvxMSDffVertPair*)mso_sptCurvedRightVert, sizeof( mso_sptCurvedRightVert ) / sizeof( SvxMSDffVertPair ), + (sal_uInt16*)mso_sptCurvedRightSegm, sizeof( mso_sptCurvedRightSegm ) >> 1, + (SvxMSDffCalculationData*)mso_sptCurvedRightCalc, sizeof( mso_sptCurvedRightCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedRightDefault, + (SvxMSDffTextRectangles*)mso_sptCurvedRightTextRect, sizeof( mso_sptCurvedRightTextRect ) / sizeof( SvxMSDffTextRectangles ), + 21600, 21600, + 0x80000000, 0x80000000, + (SvxMSDffVertPair*)mso_sptCurvedRightGluePoints, sizeof( mso_sptCurvedRightGluePoints ) / sizeof( SvxMSDffVertPair ), + (SvxMSDffHandle*)mso_sptCurvedRightHandles, sizeof( mso_sptCurvedRightHandles ) / sizeof( SvxMSDffHandle ) +}; + +static const SvxMSDffVertPair mso_sptCurvedDownVert[] = +{ + { 0, 0 }, { 3 MSO_I, 23 MSO_I }, { 0, 22 MSO_I }, { 4 MSO_I, 0 }, + { 15 MSO_I, 0 }, { 1 MSO_I, 23 MSO_I }, { 7 MSO_I, 0 }, { 13 MSO_I, 2 MSO_I }, + { 14 MSO_I, 2 MSO_I }, { 8 MSO_I, 22 MSO_I }, { 12 MSO_I, 2 MSO_I }, + { 0, 0 }, { 3 MSO_I, 23 MSO_I }, { 11 MSO_I, 2 MSO_I }, { 17 MSO_I, 26 MSO_I }, { 15 MSO_I, 0 }, + { 1 MSO_I, 23 MSO_I }, { 17 MSO_I, 26 MSO_I }, { 15 MSO_I, 22 MSO_I }, + { 0, 0 }, { 3 MSO_I, 23 MSO_I }, { 0, 22 MSO_I }, { 4 MSO_I, 0 }, + { 0, 0 }, { 3 MSO_I, 23 MSO_I }, { 4 MSO_I, 0 }, { 17 MSO_I, 26 MSO_I }, + { 15 MSO_I, 0 }, { 1 MSO_I, 23 MSO_I }, { 17 MSO_I, 26 MSO_I }, { 15 MSO_I, 22 MSO_I } +}; +static const sal_uInt16 mso_sptCurvedDownSegm[] = +{ + 0xa608, + 0x0003, + 0xa308, + 0x6000, + 0x8000, + 0xa604, + 0xa504, + 0xa304, + 0x6000, + 0x8000 +}; static const SvxMSDffTextRectangles mso_sptCurvedDownTextRect[] = { - { { 43 MSO_I, 45 MSO_I }, { 44 MSO_I, 46 MSO_I } } + { { 45 MSO_I, 47 MSO_I }, { 46 MSO_I, 48 MSO_I } } }; static const SvxMSDffVertPair mso_sptCurvedDownGluePoints[] = { - { 17 MSO_I, 0 }, { 16 MSO_I, 21600 }, { 12 MSO_I, 2 MSO_I }, { 8 MSO_I, 21600 }, { 14 MSO_I, 2 MSO_I } + { 17 MSO_I, 0 }, { 16 MSO_I, 22 MSO_I }, { 12 MSO_I, 2 MSO_I }, { 8 MSO_I, 22 MSO_I }, { 14 MSO_I, 2 MSO_I } }; static const SvxMSDffHandle mso_sptCurvedDownHandles[] = { { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, - 0x100, 21600, 10800, 10800, 3 + 0x26, 3 + 0x1b, 0, 10800 }, - { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL, - 0x101, 21600, 10800, 10800, 3 + 0x19, 21600, 0, 10800 }, - { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL, - 21600, 0x102, 10800, 10800, 3375, 21600, 3 + 0x2a, 21600 } + 0x100, 21600, 10800, 10800, 3 + 40, 3 + 29, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, + 0x101, 21600, 10800, 10800, 3 + 27, 3 + 21, 0, 10800 }, + { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, + 21600, 0x102, 10800, 10800, 3375, 21600, 3 + 44, 3 + 22 } }; + static const mso_CustomShape msoCurvedDownArrow = { (SvxMSDffVertPair*)mso_sptCurvedDownVert, sizeof( mso_sptCurvedDownVert ) / sizeof( SvxMSDffVertPair ), (sal_uInt16*)mso_sptCurvedDownSegm, sizeof( mso_sptCurvedDownSegm ) >> 1, - (SvxMSDffCalculationData*)mso_sptCurvedDownCalc, sizeof( mso_sptCurvedDownCalc ) / sizeof( SvxMSDffCalculationData ), - (sal_Int32*)mso_sptCurvedDownDefault, + (SvxMSDffCalculationData*)mso_sptCurvedRightCalc, sizeof( mso_sptCurvedRightCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedRightDefault, (SvxMSDffTextRectangles*)mso_sptCurvedDownTextRect, sizeof( mso_sptCurvedDownTextRect ) / sizeof( SvxMSDffTextRectangles ), 21600, 21600, 0x80000000, 0x80000000, @@ -1296,11 +1352,13 @@ static const mso_CustomShape msoCurvedDownArrow = static const SvxMSDffVertPair mso_sptCurvedUpVert[] = { { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 0, 0 }, { 4 MSO_I, 21 MSO_I }, - { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 12 MSO_I, 2 MSO_I }, - { 13 MSO_I, 2 MSO_I }, { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, + { 12 MSO_I, 2 MSO_I }, { 13 MSO_I, 2 MSO_I }, { 8 MSO_I, 0 }, { 11 MSO_I, 2 MSO_I }, { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 10 MSO_I, 2 MSO_I }, { 16 MSO_I, 24 MSO_I }, { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }, { 14 MSO_I, 0 }, - { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I } + { 0, 22 MSO_I }, { 3 MSO_I, 21 MSO_I }, { 0, 0 }, { 4 MSO_I, 21 MSO_I }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 7 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }, + { 14 MSO_I, 22 MSO_I }, { 1 MSO_I, 21 MSO_I }, { 16 MSO_I, 24 MSO_I }, { 14 MSO_I, 0 } }; static const sal_uInt16 mso_sptCurvedUpSegm[] = { @@ -1309,8 +1367,10 @@ static const sal_uInt16 mso_sptCurvedUpSegm[] = 0xa508, 0x6000, 0x8000, - 0xa604, - 0xaa00, + 0xa404, + 0xa508, + 0xa504, + 0x6000, 0x8000 }; static const SvxMSDffCalculationData mso_sptCurvedUpCalc[] = @@ -1395,116 +1455,16 @@ static const mso_CustomShape msoCurvedUpArrow = (SvxMSDffHandle*)mso_sptCurvedUpHandles, sizeof( mso_sptCurvedUpHandles ) / sizeof( SvxMSDffHandle ) }; -static const SvxMSDffVertPair mso_sptCurvedRightVert[] = -{ - { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 22 MSO_I, 0 }, { 0, 4 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 0, 7 MSO_I }, { 2 MSO_I, 13 MSO_I }, - { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, - { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 2 MSO_I, 11 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 0, 15 MSO_I }, { 23 MSO_I, 1 MSO_I }, { 26 MSO_I, 17 MSO_I }, { 22 MSO_I, 15 MSO_I }, - { 0, 0 }, { 23 MSO_I, 3 MSO_I }, { 0, 4 MSO_I }, { 26 MSO_I, 17 MSO_I } -}; -static const sal_uInt16 mso_sptCurvedRightSegm[] = -{ - 0xa408, - 0x0003, - 0xa508, - 0x6000, - 0x8000, - 0xa404, - 0xaa00, - 0x8000 -}; -static const SvxMSDffCalculationData mso_sptCurvedRightCalc[] = -{ - { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, - { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, - { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, - { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, - { 0x2001, { 0x403, 1, 2 } }, - { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, - { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, - { 0x2001, { 0x406, 1, 2 } }, - { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, - { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } }, - { 0xa00f, { 0x409, 21600, 0x404 } }, - { 0x6000, { 0x404, 0x40a, 0 } }, - { 0x6000, { 0x40b, DFF_Prop_adjust2Value, 21600 } }, - { 0x6000, { 0x407, 0x40a, 0 } }, - { 0xa000, { 0x40c, 21600, DFF_Prop_adjustValue } }, - { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, - { 0x2001, { 0x40f, 1, 2 } }, - { 0x6002, { 0x404, 0x407, 0 } }, - { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, - { 0x2001, { 0x412, 1, 2 } }, - { 0xa000, { 0x411, 0, 0x413 } }, - { 0x0000, { 21600, 0, 0 } }, - { 0x0000, { 21600, 0, 0 } }, - { 0x0001, { 21600, 2, 1 } }, - { 0xa000, { 0x411, 0, 0x404 } }, - { 0x600f, { 0x418, 0x404, 21600 } }, - { 0x8000, { 21600, 0, 0x419 } }, - { 0x2000, { 0x408, 128, 0 } }, - { 0x2001, { 0x405, 1, 2 } }, - { 0x2000, { 0x405, 0, 128 } }, - { 0xe000, { DFF_Prop_adjustValue, 0x411, 0x40c } }, - { 0x600f, { 0x414, 0x404, 21600 } }, - { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, - { 0x2001, { 0x420, 1, 2 } }, - { 0x0001, { 21600, 21600, 1 } }, - { 0x6001, { 0x409, 0x409, 1 } }, - { 0xa000, { 0x422, 0, 0x423 } }, - { 0x200d, { 0x424, 0, 0 } }, - { 0x2000, { 0x425, 21600, 0 } }, - { 0x8001, { 21600, 21600, 0x426 } }, - { 0x2000, { 0x427, 64, 0 } }, - { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, - { 0x600f, { 0x421, 0x429, 21600 } }, - { 0x8000, { 21600, 0, 0x42a } }, - { 0x2000, { 0x42b, 64, 0 } }, - { 0x2001, { 0x404, 1, 2 } }, - { 0xa000, { DFF_Prop_adjust2Value, 0, 0x42d } }, - { 0x0001, { 21600, 2195, 16384 } }, - { 0x0001, { 21600, 14189, 16384 } } -}; -static const sal_Int32 mso_sptCurvedRightDefault[] = -{ - 3, 12960, 19440, 14400 -}; -static const SvxMSDffTextRectangles mso_sptCurvedRightTextRect[] = -{ - { { 47 MSO_I, 45 MSO_I }, { 48 MSO_I, 46 MSO_I } } -}; -static const SvxMSDffVertPair mso_sptCurvedRightGluePoints[] = -{ - { 0, 17 MSO_I }, { 2 MSO_I, 14 MSO_I }, { 22 MSO_I, 8 MSO_I }, { 2 MSO_I, 12 MSO_I }, { 22 MSO_I, 16 MSO_I } -}; -static const SvxMSDffHandle mso_sptCurvedRightHandles[] = -{ - { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, - 21600, 0x100, 10800, 10800, 0, 10800, 3 + 40, 3 + 29 }, - { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL, - 21600, 0x101, 10800, 10800, 0, 10800, 3 + 27, 3 + 21 }, - { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL, - 0x102, 21600, 10800, 10800, 3 + 44, 3 + 22, 3375, 21600 } -}; -static const mso_CustomShape msoCurvedRightArrow = -{ - (SvxMSDffVertPair*)mso_sptCurvedRightVert, sizeof( mso_sptCurvedRightVert ) / sizeof( SvxMSDffVertPair ), - (sal_uInt16*)mso_sptCurvedRightSegm, sizeof( mso_sptCurvedRightSegm ) >> 1, - (SvxMSDffCalculationData*)mso_sptCurvedRightCalc, sizeof( mso_sptCurvedRightCalc ) / sizeof( SvxMSDffCalculationData ), - (sal_Int32*)mso_sptCurvedRightDefault, - (SvxMSDffTextRectangles*)mso_sptCurvedRightTextRect, sizeof( mso_sptCurvedRightTextRect ) / sizeof( SvxMSDffTextRectangles ), - 21600, 21600, - 0x80000000, 0x80000000, - (SvxMSDffVertPair*)mso_sptCurvedRightGluePoints, sizeof( mso_sptCurvedRightGluePoints ) / sizeof( SvxMSDffVertPair ), - (SvxMSDffHandle*)mso_sptCurvedRightHandles, sizeof( mso_sptCurvedRightHandles ) / sizeof( SvxMSDffHandle ) -}; - static const SvxMSDffVertPair mso_sptCurvedLeftVert[] = { - { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 0, 0 }, { 21 MSO_I, 4 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 2 MSO_I, 12 MSO_I }, + { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 0, 0 }, { 21 MSO_I, 4 MSO_I }, + { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 2 MSO_I, 12 MSO_I }, { 2 MSO_I, 13 MSO_I }, { 0, 8 MSO_I }, { 2 MSO_I, 11 MSO_I }, - { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 2 MSO_I, 10 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 0, 14 MSO_I }, - { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 24 MSO_I, 16 MSO_I } + { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 2 MSO_I, 10 MSO_I }, { 24 MSO_I, 16 MSO_I }, + { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 0, 14 MSO_I }, + { 22 MSO_I, 0 }, { 21 MSO_I, 3 MSO_I }, { 0, 0 }, { 21 MSO_I, 4 MSO_I }, + { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 21 MSO_I, 7 MSO_I }, { 24 MSO_I, 16 MSO_I }, + { 22 MSO_I, 14 MSO_I }, { 21 MSO_I, 1 MSO_I }, { 24 MSO_I, 16 MSO_I }, { 0, 14 MSO_I } }; static const sal_uInt16 mso_sptCurvedLeftSegm[] = { @@ -1513,62 +1473,11 @@ static const sal_uInt16 mso_sptCurvedLeftSegm[] = 0xa308, 0x6000, 0x8000, - 0xa404, - 0xaa00, + 0xa604, + 0xa308, + 0x6000, 0x8000 }; -static const SvxMSDffCalculationData mso_sptCurvedLeftCalc[] = -{ - { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, - { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, - { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } }, - { 0xa000, { DFF_Prop_adjustValue, 21600, DFF_Prop_adjust2Value } }, - { 0x2001, { 0x403, 1, 2 } }, - { 0x6000, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 21600 } }, - { 0xe000, { 0x405, DFF_Prop_adjust2Value, DFF_Prop_adjustValue } }, - { 0x2001, { 0x406, 1, 2 } }, - { 0x4002, { 21600, DFF_Prop_adjustValue, 0 } }, - { 0xa00f, { DFF_Prop_adjust3Value, 21600, 0x404 } }, - { 0x6000, { 0x404, 0x409, 0 } }, - { 0x6000, { 0x40a, DFF_Prop_adjust2Value, 21600 } }, - { 0x6000, { 0x407, 0x409, 0 } }, - { 0xa000, { 0x40b, 21600, DFF_Prop_adjustValue } }, - { 0xa000, { 0x405, 0, DFF_Prop_adjustValue } }, - { 0x2001, { 0x40e, 1, 2 } }, - { 0x6002, { 0x404, 0x407, 0 } }, - { 0x6000, { DFF_Prop_adjustValue, DFF_Prop_adjust2Value, 21600 } }, - { 0x2001, { 0x411, 1, 2 } }, - { 0xa000, { 0x410, 0, 0x412 } }, - { 0x0000, { 21600, 0, 0 } }, - { 0x0000, { 21600, 0, 0 } }, - { 0x0000, { 0, 0, 21600 } }, - { 0xa000, { 0x410, 0, 0x404 } }, - { 0x600f, { 0x417, 0x404, 21600 } }, - { 0x2000, { 0x408, 128, 0 } }, - { 0x2001, { 0x405, 1, 2 } }, - { 0x2000, { 0x405, 0, 128 } }, - { 0xe000, { DFF_Prop_adjustValue, 0x410, 0x40b } }, - { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, - { 0x2001, { 0x41d, 1, 2 } }, - { 0x0001, { 21600, 21600, 1 } }, - { 0x6001, { DFF_Prop_adjust3Value, DFF_Prop_adjust3Value, 1 } }, - { 0xa000, { 0x41f, 0, 0x420 } }, - { 0x200d, { 0x421, 0, 0 } }, - { 0x2000, { 0x422, 21600, 0 } }, - { 0x8001, { 21600, 21600, 0x423 } }, - { 0x2000, { 0x424, 64, 0 } }, - { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, - { 0x600f, { 0x41e, 0x426, 21600 } }, - { 0x2000, { 0x427, 0, 64 } }, - { 0x2001, { 0x404, 1, 2 } }, - { 0xa000, { DFF_Prop_adjust2Value, 0, 0x429 } }, - { 0x0001, { 21600, 2195, 16384 } }, - { 0x0001, { 21600, 14189, 16384 } } -}; -static const sal_Int32 mso_sptCurvedLeftDefault[] = -{ - 3, 12960, 19440, 7200 -}; static const SvxMSDffTextRectangles mso_sptCurvedLeftTextRect[] = { { { 43 MSO_I, 41 MSO_I }, { 44 MSO_I, 42 MSO_I } } @@ -1590,8 +1499,8 @@ static const mso_CustomShape msoCurvedLeftArrow = { (SvxMSDffVertPair*)mso_sptCurvedLeftVert, sizeof( mso_sptCurvedLeftVert ) / sizeof( SvxMSDffVertPair ), (sal_uInt16*)mso_sptCurvedLeftSegm, sizeof( mso_sptCurvedLeftSegm ) >> 1, - (SvxMSDffCalculationData*)mso_sptCurvedLeftCalc, sizeof( mso_sptCurvedLeftCalc ) / sizeof( SvxMSDffCalculationData ), - (sal_Int32*)mso_sptCurvedLeftDefault, + (SvxMSDffCalculationData*)mso_sptCurvedUpCalc, sizeof( mso_sptCurvedUpCalc ) / sizeof( SvxMSDffCalculationData ), + (sal_Int32*)mso_sptCurvedUpDefault, (SvxMSDffTextRectangles*)mso_sptCurvedLeftTextRect, sizeof( mso_sptCurvedLeftTextRect ) / sizeof( SvxMSDffTextRectangles ), 21600, 21600, 0x80000000, 0x80000000, @@ -1599,10 +1508,6 @@ static const mso_CustomShape msoCurvedLeftArrow = (SvxMSDffHandle*)mso_sptCurvedLeftHandles, sizeof( mso_sptCurvedLeftHandles ) / sizeof( SvxMSDffHandle ) }; - - - - static const SvxMSDffVertPair mso_sptStripedRightArrowVert[] = // adjustment1 : x 3375 - 21600 { // adjustment2 : y 0 - 10800 { 3375, 0 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 1 MSO_I, 0 }, { 21600, 10800 }, diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index ee59f6ce924d..b0dc050d6017 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -510,7 +510,7 @@ void Svx3DLightControl::TrySelection(Point aPosPixel) std::vector< const E3dCompoundObject* > aResult; getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult); - if(aResult.size()) + if(!aResult.empty()) { // exclude expansion object which will be part of // the hits. It's invisible, but for HitTest, it's included diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 2ff40610fa77..29eac2ab48d1 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1569,7 +1569,7 @@ void FmXFormShell::ExecuteSearch() aContextNames.swap( aValidContexts ); } - if (m_aSearchForms.size() == 0) + if (m_aSearchForms.empty() ) { // es gibt keine Controls, die alle Bedingungen fuer eine Suche erfuellen ErrorBox(NULL, WB_OK, SVX_RESSTR(RID_STR_NODATACONTROLS)).Execute(); return; @@ -2571,7 +2571,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn strFieldList.EraseTrailingChars(';'); sFieldDisplayNames.EraseTrailingChars(';'); - if (!pfmscContextInfo->arrFields.size()) + if (pfmscContextInfo->arrFields.empty()) { pfmscContextInfo->arrFields.clear(); pfmscContextInfo->xCursor = NULL; @@ -3741,7 +3741,7 @@ void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeacti // move all events from our queue to a new one, omit the events for the deactivated // page ::std::queue< FmLoadAction > aNewEvents; - while ( m_aLoadingPages.size() ) + while ( !m_aLoadingPages.empty() ) { FmLoadAction aAction = m_aLoadingPages.front(); m_aLoadingPages.pop(); diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx index 3306e7896c5d..e995e1937d9c 100644 --- a/svx/source/gallery2/codec.cxx +++ b/svx/source/gallery2/codec.cxx @@ -31,20 +31,26 @@ #include <tools/stream.hxx> #include <tools/zcodec.hxx> #include "codec.hxx" +#include <tools/debug.hxx> // ---------------- // - GalleryCodec - // ---------------- +DBG_NAME(GalleryCodec) GalleryCodec::GalleryCodec( SvStream& rIOStm ) : rStm( rIOStm ) { + DBG_CTOR(GalleryCodec,NULL); + } // ----------------------------------------------------------------------------- GalleryCodec::~GalleryCodec() { + + DBG_DTOR(GalleryCodec,NULL); } // ----------------------------------------------------------------------------- diff --git a/svx/source/gallery2/galbrws.cxx b/svx/source/gallery2/galbrws.cxx index 5d4e4297f0a4..5cd82383e9d5 100644 --- a/svx/source/gallery2/galbrws.cxx +++ b/svx/source/gallery2/galbrws.cxx @@ -57,16 +57,21 @@ public: }; // ----------------------------------------------------------------------------- +DBG_NAME(GallerySplitter) GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) : Splitter( pParent, rResId ) { + DBG_CTOR(GallerySplitter,NULL); + } // ----------------------------------------------------------------------------- GallerySplitter::~GallerySplitter() { + + DBG_DTOR(GallerySplitter,NULL); } // ----------------------------------------------------------------------------- @@ -80,10 +85,13 @@ void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) // ------------------------- // - SvxGalleryChildWindow - // ------------------------- +DBG_NAME(GalleryChildWindow) GalleryChildWindow::GalleryChildWindow( Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { + DBG_CTOR(GalleryChildWindow,NULL); + pWindow = new GalleryBrowser( pBindings, this, _pParent, GAL_RESID( RID_SVXDLG_GALLERYBROWSER ) ); eChildAlignment = SFX_ALIGN_TOP; ( (GalleryBrowser*) pWindow )->Initialize( pInfo ); @@ -93,6 +101,8 @@ GalleryChildWindow::GalleryChildWindow( Window* _pParent, sal_uInt16 nId, SfxBin GalleryChildWindow::~GalleryChildWindow() { + + DBG_DTOR(GalleryChildWindow,NULL); } // ----------------------------------------------------------------------------- @@ -102,11 +112,14 @@ SFX_IMPL_DOCKINGWINDOW( GalleryChildWindow, SID_GALLERY ) // ------------------ // - GalleryBrowser - // ------------------ +DBG_NAME(GalleryBrowser) GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW, Window* pParent, const ResId& rResId ) : SfxDockingWindow( _pBindings, pCW, pParent, rResId ) { + DBG_CTOR(GalleryBrowser,NULL); + mpGallery = Gallery::GetGalleryInstance(); mpBrowser1 = new GalleryBrowser1( this, GAL_RESID( GALLERY_BROWSER1 ), mpGallery ); mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ) ); @@ -132,6 +145,8 @@ GalleryBrowser::~GalleryBrowser() delete mpBrowser2; delete mpSplitter; delete mpBrowser1; + + DBG_DTOR(GalleryBrowser,NULL); } // ----------------------------------------------------------------------------- diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 3704262833ed..0836be979866 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -57,16 +57,21 @@ using namespace ::com::sun::star; // ----------------- // - GalleryButton - // ----------------- +DBG_NAME(GalleryButton) GalleryButton::GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits ) : PushButton( pParent, nWinBits ) { + DBG_CTOR(GalleryButton,NULL); + } // ----------------------------------------------------------------------------- GalleryButton::~GalleryButton() { + + DBG_DTOR(GalleryButton,NULL); } // ----------------------------------------------------------------------------- @@ -80,10 +85,13 @@ void GalleryButton::KeyInput( const KeyEvent& rKEvt ) // ----------------------- // - GalleryThemeListBox - // ----------------------- +DBG_NAME(GalleryThemeListBox) GalleryThemeListBox::GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits ) : ListBox( pParent, nWinBits ) { + DBG_CTOR(GalleryThemeListBox,NULL); + InitSettings(); } @@ -91,6 +99,8 @@ GalleryThemeListBox::GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWin GalleryThemeListBox::~GalleryThemeListBox() { + + DBG_DTOR(GalleryThemeListBox,NULL); } // ------------------------------------------------------------------------ @@ -139,6 +149,7 @@ long GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt ) // ------------------- // - GalleryBrowser1 - // ------------------- +DBG_NAME(GalleryBrowser1) GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : Control ( pParent, rResId ), @@ -152,6 +163,8 @@ GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ), aImgImported ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) ) { + DBG_CTOR(GalleryBrowser1,NULL); + StartListening( *mpGallery ); maNewTheme.SetHelpId( HID_GALLERY_NEWTHEME ); @@ -183,6 +196,8 @@ GalleryBrowser1::~GalleryBrowser1() mpThemes = NULL; delete mpExchangeData; mpExchangeData = NULL; + + DBG_DTOR(GalleryBrowser1,NULL); } // ----------------------------------------------------------------------------- @@ -258,9 +273,8 @@ void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeDa // ----------------------------------------------------------------------------- -::std::vector< sal_uInt16 > GalleryBrowser1::ImplGetExecuteVector() +void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec) { - ::std::vector< sal_uInt16 > aExecVector; GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); if( pTheme ) @@ -284,23 +298,21 @@ void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeDa bUpdateAllowed = bRenameAllowed = bRemoveAllowed = sal_True; if( bUpdateAllowed && pTheme->GetObjectCount() ) - aExecVector.push_back( MN_ACTUALIZE ); + o_aExec.push_back( MN_ACTUALIZE ); if( bRenameAllowed ) - aExecVector.push_back( MN_RENAME ); + o_aExec.push_back( MN_RENAME ); if( bRemoveAllowed ) - aExecVector.push_back( MN_DELETE ); + o_aExec.push_back( MN_DELETE ); if( bIdDialog && !pTheme->IsReadOnly() && !pTheme->IsImported() ) - aExecVector.push_back( MN_ASSIGN_ID ); + o_aExec.push_back( MN_ASSIGN_ID ); - aExecVector.push_back( MN_PROPERTIES ); + o_aExec.push_back( MN_PROPERTIES ); mpGallery->ReleaseTheme( pTheme, *this ); } - - return aExecVector; } // ----------------------------------------------------------------------------- @@ -587,7 +599,8 @@ sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) if( !bRet ) { - ::std::vector< sal_uInt16 > aExecVector( ImplGetExecuteVector() ); + ::std::vector< sal_uInt16 > aExecVector; + ImplGetExecuteVector(aExecVector); sal_uInt16 nExecuteId = 0; sal_Bool bMod1 = rKEvt.GetKeyCode().IsMod1(); @@ -651,9 +664,10 @@ sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) IMPL_LINK( GalleryBrowser1, ShowContextMenuHdl, void*, EMPTYARG ) { - ::std::vector< sal_uInt16 > aExecVector( ImplGetExecuteVector() ); + ::std::vector< sal_uInt16 > aExecVector; + ImplGetExecuteVector(aExecVector); - if( aExecVector.size() ) + if( !aExecVector.empty() ) { PopupMenu aMenu( GAL_RESID( RID_SVXMN_GALLERY1 ) ); diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index d05187d4c856..d6078a205042 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -101,7 +101,7 @@ private: void ImplAdjustControls(); sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ); void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ); - ::std::vector< sal_uInt16 > ImplGetExecuteVector(); + void ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec); void ImplExecute( sal_uInt16 nId ); void ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew ); void ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew ); diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 2fff76ba0c76..681ce3335df1 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -92,12 +92,15 @@ public: }; // ------------------------------------------------------------------------ +DBG_NAME(GalleryBackgroundPopup) GalleryBackgroundPopup::GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos ) : SfxControllerItem ( SID_GALLERY_BG_BRUSH, SfxViewFrame::Current()->GetBindings() ), mpTheme ( pTheme ), mnObjectPos ( nObjectPos ) { + DBG_CTOR(GalleryBackgroundPopup,NULL); + SfxViewFrame::Current()->GetBindings().Update( SID_GALLERY_BG_BRUSH ); RemoveDisabledEntries(); } @@ -106,6 +109,8 @@ GalleryBackgroundPopup::GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_ GalleryBackgroundPopup::~GalleryBackgroundPopup() { + + DBG_DTOR(GalleryBackgroundPopup,NULL); } // ------------------------------------------------------------------------ @@ -172,6 +177,7 @@ public: }; // ------------------------------------------------------------------------ +DBG_NAME(GalleryThemePopup) GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos, sal_Bool bPreview ) : PopupMenu ( GAL_RESID( RID_SVXMN_GALLERY2 ) ), @@ -181,6 +187,8 @@ GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nO mnObjectPos ( nObjectPos ), mbPreview ( bPreview ) { + DBG_CTOR(GalleryThemePopup,NULL); + const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos ); PopupMenu* pAddMenu = GetPopupMenu( MN_ADDMENU ); SfxBindings& rBindings = SfxViewFrame::Current()->GetBindings(); @@ -259,6 +267,8 @@ GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nO GalleryThemePopup::~GalleryThemePopup() { + + DBG_DTOR(GalleryThemePopup,NULL); } // ------------------------------------------------------------------------ @@ -279,16 +289,21 @@ void GalleryThemePopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, cons // ------------------ // - GalleryToolBox - // ------------------ +DBG_NAME(GalleryToolBox) GalleryToolBox::GalleryToolBox( GalleryBrowser2* pParent ) : ToolBox( pParent, WB_TABSTOP ) { + DBG_CTOR(GalleryToolBox,NULL); + } // ------------------------------------------------------------------------ GalleryToolBox::~GalleryToolBox() { + + DBG_DTOR(GalleryToolBox,NULL); } // ------------------------------------------------------------------------ @@ -302,6 +317,7 @@ void GalleryToolBox::KeyInput( const KeyEvent& rKEvt ) // ------------------- // - GalleryBrowser2 - // ------------------- +DBG_NAME(GalleryBrowser2) GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : Control ( pParent, rResId ), @@ -318,6 +334,8 @@ GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, meLastMode ( GALLERYBROWSERMODE_NONE ), mbCurActionIsLinkage( sal_False ) { + DBG_CTOR(GalleryBrowser2,NULL); + Image aDummyImage; const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) ); Font aInfoFont( maInfoBar.GetControlFont() ); @@ -371,6 +389,8 @@ GalleryBrowser2::~GalleryBrowser2() if( mpCurTheme ) mpGallery->ReleaseTheme( mpCurTheme, *this ); + + DBG_DTOR(GalleryBrowser2,NULL); } // ----------------------------------------------------------------------------- diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index 6dca7b050e01..9e2ea4abaf92 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -54,6 +54,7 @@ // ------------------ // - GalleryPreview - // ------------------ +DBG_NAME(GalleryPreview) GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : Window( pParent, WB_TABSTOP | WB_BORDER ), @@ -61,6 +62,8 @@ GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ) DragSourceHelper( this ), mpTheme( pTheme ) { + DBG_CTOR(GalleryPreview,NULL); + SetHelpId( HID_GALLERY_WINDOW ); InitSettings(); } @@ -73,6 +76,8 @@ GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) : DragSourceHelper( this ), mpTheme( NULL ) { + DBG_CTOR(GalleryPreview,NULL); + SetHelpId( HID_GALLERY_PREVIEW ); InitSettings(); } @@ -81,6 +86,8 @@ GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) : GalleryPreview::~GalleryPreview() { + + DBG_DTOR(GalleryPreview,NULL); } @@ -300,6 +307,7 @@ void GalleryPreview::PreviewMedia( const INetURLObject& rURL ) // ------------------- // - GalleryIconView - // ------------------- +DBG_NAME(GalleryIconView) GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : ValueSet( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_VSCROLL | WB_FLATVALUESET ), @@ -307,6 +315,7 @@ GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme DragSourceHelper( this ), mpTheme ( pTheme ) { + DBG_CTOR(GalleryIconView,NULL); EnableFullItemMode( sal_False ); SetHelpId( HID_GALLERY_WINDOW ); @@ -320,6 +329,8 @@ GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme GalleryIconView::~GalleryIconView() { + + DBG_DTOR(GalleryIconView,NULL); } // ------------------------------------------------------------------------ @@ -402,7 +413,7 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt ) aGraphic.Draw( pDev, aPos, aSize ); } - SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_THEMENAME | GALLERY_ITEM_TITLE | GALLERY_ITEM_PATH ) ); + SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE) ); mpTheme->ReleaseObject( pObj ); } } @@ -468,6 +479,7 @@ void GalleryIconView::StartDrag( sal_Int8, const Point& ) // ------------------- // - GalleryListView - // ------------------- +DBG_NAME(GalleryListView) GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : BrowseBox( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER ), @@ -475,6 +487,8 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme mnCurRow( 0 ), mbInit( sal_False ) { + DBG_CTOR(GalleryListView,NULL); + SetHelpId( HID_GALLERY_WINDOW ); InitSettings(); @@ -489,6 +503,8 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme GalleryListView::~GalleryListView() { + + DBG_DTOR(GalleryListView,NULL); } // ------------------------------------------------------------------------ diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index eee9f46953c4..f8e5dd5f24fa 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -175,6 +175,8 @@ SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry ) // - GalleryThemeCacheEntry - // -------------------------- +class GalleryThemeCacheEntry; +DBG_NAME(GalleryThemeCacheEntry) class GalleryThemeCacheEntry { private: @@ -185,8 +187,8 @@ private: public: GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, GalleryTheme* pTheme ) : - mpThemeEntry( pThemeEntry ), mpTheme( pTheme ) {} - ~GalleryThemeCacheEntry() { delete mpTheme; } + mpThemeEntry( pThemeEntry ), mpTheme( pTheme ) {DBG_CTOR(GalleryThemeCacheEntry,NULL);} + ~GalleryThemeCacheEntry() { delete mpTheme;DBG_DTOR(GalleryThemeCacheEntry,NULL); } const GalleryThemeEntry* GetThemeEntry() const { return mpThemeEntry; } GalleryTheme* GetTheme() const { return mpTheme; } @@ -195,7 +197,6 @@ public: // ----------- // - Gallery - // ----------- - Gallery::Gallery( const String& rMultiPath ) : nReadTextEncoding ( gsl_getSystemTextEncoding() ) , nLastFileNumber ( 0 ) @@ -327,16 +328,20 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR if( xContentAccess.is() ) { + static const ::rtl::OUString s_sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")); + static const ::rtl::OUString s_sIsReadOnly(RTL_CONSTASCII_USTRINGPARAM("IsReadOnly")); + static const ::rtl::OUString s_sSDG_EXT(RTL_CONSTASCII_USTRINGPARAM("sdg")); + static const ::rtl::OUString s_sSDV_EXT(RTL_CONSTASCII_USTRINGPARAM("sdv")); + while( xResultSet->next() ) { INetURLObject aThmURL( xContentAccess->queryContentIdentifierString() ); if(aThmURL.GetExtension().equalsIgnoreAsciiCaseAscii("thm")) { - INetURLObject aSdgURL( aThmURL); aSdgURL.SetExtension( OUString::createFromAscii( "sdg" ) ); - INetURLObject aSdvURL( aThmURL ); aSdvURL.SetExtension( OUString::createFromAscii( "sdv" ) ); - const OUString aTitleProp( OUString::createFromAscii( "Title" ) ); - const OUString aReadOnlyProp( OUString::createFromAscii( "IsReadOnly" ) ); + INetURLObject aSdgURL( aThmURL); aSdgURL.SetExtension( s_sSDG_EXT ); + INetURLObject aSdvURL( aThmURL ); aSdvURL.SetExtension( s_sSDV_EXT ); + OUString aTitle; sal_Bool bReadOnly = sal_False; @@ -348,7 +353,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR try { - aThmCnt.getPropertyValue( aTitleProp ) >>= aTitle; + aThmCnt.getPropertyValue( s_sTitle ) >>= aTitle; } catch( const uno::RuntimeException& ) { @@ -361,7 +366,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR { try { - aThmCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly; + aThmCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly; } catch( const uno::RuntimeException& ) { @@ -374,7 +379,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR { try { - aSdgCnt.getPropertyValue( aTitleProp ) >>= aTitle; + aSdgCnt.getPropertyValue( s_sTitle ) >>= aTitle; } catch( const ::com::sun::star::uno::RuntimeException& ) { @@ -387,7 +392,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR { try { - aSdgCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly; + aSdgCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly; } catch( const uno::RuntimeException& ) { @@ -402,7 +407,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR { try { - aSdvCnt.getPropertyValue( aTitleProp ) >>= aTitle; + aSdvCnt.getPropertyValue( s_sTitle ) >>= aTitle; } catch( const ::com::sun::star::uno::RuntimeException& ) { @@ -415,7 +420,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR { try { - aSdvCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly; + aSdvCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly; } catch( const uno::RuntimeException& ) { @@ -594,7 +599,6 @@ String Gallery::GetThemeName( sal_uIntPtr nThemeId ) const case( GALLERY_THEME_3D ): aFallback = "3D"; break; case( GALLERY_THEME_BULLETS ): aFallback = "Bullets"; break; case( GALLERY_THEME_HOMEPAGE ): aFallback = "Homepage"; break; - case( GALLERY_THEME_HTMLBUTTONS ): aFallback = "private://gallery/hidden/HtmlExportButtons"; break; case( GALLERY_THEME_POWERPOINT ): aFallback = "private://gallery/hidden/imgppt"; break; case( GALLERY_THEME_FONTWORK ): aFallback = "private://gallery/hidden/fontwork"; break; case( GALLERY_THEME_FONTWORK_VERTICAL ): aFallback = "private://gallery/hidden/fontworkvertical"; break; diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index da5375423b56..e9cad0b9e561 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -399,10 +399,13 @@ sal_Bool KillFile( const INetURLObject& rURL ) // ------------------- // - GalleryProgress - // ------------------- +DBG_NAME(GalleryProgress) GalleryProgress::GalleryProgress( GraphicFilter* pFilter ) : mpFilter( pFilter ) { + DBG_CTOR(GalleryProgress,NULL); + uno::Reference< lang::XMultiServiceFactory > xMgr( ::utl::getProcessServiceFactory() ); if( xMgr.is() ) @@ -442,6 +445,8 @@ GalleryProgress::~GalleryProgress() { // if( mpFilter ) // mpFilter->SetUpdatePercentHdl( Link() ); + + DBG_DTOR(GalleryProgress,NULL); } // ------------------------------------------------------------------------ @@ -455,6 +460,7 @@ void GalleryProgress::Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal ) // ----------------------- // - GalleryTransferable - // ----------------------- +DBG_NAME(GalleryTransferable) GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObjectPos, bool bLazy ) : mpTheme( pTheme ), @@ -464,6 +470,8 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObj mpImageMap( NULL ), mpURL( NULL ) { + DBG_CTOR(GalleryTransferable,NULL); + InitData( bLazy ); } @@ -471,6 +479,8 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObj GalleryTransferable::~GalleryTransferable() { + + DBG_DTOR(GalleryTransferable,NULL); } // ------------------------------------------------------------------------ diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 9ba9cff068a3..ff870974d776 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -320,10 +320,13 @@ void SgaObjectBmp::ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) // ------------------ // - SgaObjectSound - // ------------------ +DBG_NAME(SgaObjectSound) SgaObjectSound::SgaObjectSound() : eSoundType( SOUND_STANDARD ) { + DBG_CTOR(SgaObjectSound,NULL); + } // ------------------------------------------------------------------------ @@ -331,6 +334,8 @@ SgaObjectSound::SgaObjectSound() : SgaObjectSound::SgaObjectSound( const INetURLObject& rURL ) : eSoundType( SOUND_STANDARD ) { + DBG_CTOR(SgaObjectSound,NULL); + if( FileExists( rURL ) ) { aURL = rURL; @@ -345,6 +350,8 @@ SgaObjectSound::SgaObjectSound( const INetURLObject& rURL ) : SgaObjectSound::~SgaObjectSound() { + + DBG_DTOR(SgaObjectSound,NULL); } // ------------------------------------------------------------------------ @@ -453,10 +460,13 @@ SgaObjectSvDraw::SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject } // ------------------------------------------------------------------------ +DBG_NAME(SvxGalleryDrawModel) SvxGalleryDrawModel::SvxGalleryDrawModel() : mpFormModel( 0 ) { + DBG_CTOR(SvxGalleryDrawModel,NULL); + const String sFactoryURL(RTL_CONSTASCII_USTRINGPARAM("sdraw")); mxDoc = SfxObjectShell::CreateObjectByFactoryName( sFactoryURL ); @@ -484,6 +494,8 @@ SvxGalleryDrawModel::~SvxGalleryDrawModel() { if( mxDoc.Is() ) mxDoc->DoClose(); + + DBG_DTOR(SvxGalleryDrawModel,NULL); } // ------------------------------------------------------------------------ diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 71f2252fc731..196b35189c03 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -72,6 +72,7 @@ using namespace ::com::sun::star; // ------------ // - SgaTheme - // ------------ +DBG_NAME(GalleryTheme) GalleryTheme::GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry ) : pParent ( pGallery ), @@ -81,6 +82,8 @@ GalleryTheme::GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry ) nDragPos ( 0 ), bDragging ( sal_False ) { + DBG_CTOR(GalleryTheme,NULL); + ImplCreateSvDrawStorage(); if( pThm->IsImported() ) @@ -99,6 +102,8 @@ GalleryTheme::~GalleryTheme() delete pEntry; Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) ); } + + DBG_DTOR(GalleryTheme,NULL); } // ------------------------------------------------------------------------ @@ -1188,18 +1193,13 @@ sal_Bool GalleryTheme::InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, s uno::Sequence< OUString > aProps( 1 ); aProps.getArray()[ 0 ] = OUString::createFromAscii( "Url" ); uno::Reference< sdbc::XResultSet > xResultSet( aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) ); - - if( xResultSet.is() ) + uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); + if( xContentAccess.is() ) { - uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); - - if( xContentAccess.is() ) + while( xResultSet->next() ) { - while( xResultSet->next() ) - { - aURL.SetSmartURL( xContentAccess->queryContentIdentifierString() ); - aURLVector.push_back( aURL ); - } + aURL.SetSmartURL( xContentAccess->queryContentIdentifierString() ); + aURLVector.push_back( aURL ); } } } diff --git a/svx/source/gallery2/galtheme.src b/svx/source/gallery2/galtheme.src index bfb1f65d0340..0c1771cac440 100644 --- a/svx/source/gallery2/galtheme.src +++ b/svx/source/gallery2/galtheme.src @@ -127,14 +127,6 @@ String RID_GALLERYSTR_THEME_SURFACES // ----------------------------------------------------------------------------- -String RID_GALLERYSTR_THEME_HTMLBUTTONS -{ - // !!! Don't translate, please !!! - Text = "private://gallery/hidden/HtmlExportButtons"; -}; - -// ----------------------------------------------------------------------------- - String RID_GALLERYSTR_THEME_POWERPOINT { // !!! Don't translate, please !!! diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx index bda2e1529988..c0ba5cec6bb8 100644 --- a/svx/source/sdr/contact/objectcontact.cxx +++ b/svx/source/sdr/contact/objectcontact.cxx @@ -66,7 +66,7 @@ namespace sdr std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector); maViewObjectContactVector.clear(); - while(aLocalVOCList.size()) + while(!aLocalVOCList.empty()) { ViewObjectContact* pCandidate = aLocalVOCList.back(); aLocalVOCList.pop_back(); diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index 3057acf55df1..3d6bd2d79a5a 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -82,7 +82,7 @@ namespace sdr std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector); maViewObjectContactVector.clear(); - while(aLocalVOCList.size()) + while(!aLocalVOCList.empty()) { ViewObjectContact* pCandidate = aLocalVOCList.back(); aLocalVOCList.pop_back(); @@ -147,7 +147,7 @@ namespace sdr { maViewObjectContactVector.erase(aFindResult); - if(0 == maViewObjectContactVector.size()) + if(maViewObjectContactVector.empty()) { // This may need to get asynchron later since it eventually triggers // deletes of OCs where the VOC is still added. diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 3b002e406be1..c06bb7f25b0e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -173,7 +173,7 @@ namespace sdr aGluepointVector.push_back(basegfx::B2DPoint(aPosition.X(), aPosition.Y())); } - if(aGluepointVector.size()) + if(!aGluepointVector.empty()) { const basegfx::BColor aBackPen(1.0, 1.0, 1.0); const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx index 967b6fefe949..e65dfe927fda 100644 --- a/svx/source/sdr/event/eventhandler.cxx +++ b/svx/source/sdr/event/eventhandler.cxx @@ -83,7 +83,7 @@ namespace sdr BaseEvent* EventHandler::GetEvent() { - if(maVector.size()) + if(!maVector.empty()) { // get the last event, that one is fastest to be removed return maVector.back(); @@ -100,7 +100,7 @@ namespace sdr EventHandler::~EventHandler() { - while(maVector.size()) + while(!maVector.empty()) { delete GetEvent(); } diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index e9464bdee09b..0e9f61d9b03a 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -83,7 +83,7 @@ namespace sdr bool OverlayObjectList::isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance) const { - if(maVector.size()) + if(!maVector.empty()) { OverlayObjectVector::const_iterator aStart(maVector.begin()); sdr::overlay::OverlayObject* pFirst = *aStart; @@ -134,7 +134,7 @@ namespace sdr bool OverlayObjectList::isHitPixel(const Point& rDiscretePosition, sal_uInt32 nDiscreteTolerance) const { - if(maVector.size()) + if(!maVector.empty()) { OverlayObjectVector::const_iterator aStart(maVector.begin()); sdr::overlay::OverlayObject* pCandidate = *aStart; @@ -164,7 +164,7 @@ namespace sdr { basegfx::B2DRange aRetval; - if(maVector.size()) + if(!maVector.empty()) { OverlayObjectVector::const_iterator aStart(maVector.begin()); diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 7d51b26a0051..41149a965248 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -204,8 +204,10 @@ namespace sdr { } - void DefaultProperties::PostItemChange(const sal_uInt16 /*nWhich*/) + void DefaultProperties::PostItemChange(const sal_uInt16 nWhich ) { + if( (nWhich == XATTR_FILLSTYLE) && (mpItemSet != NULL) ) + CleanupFillProperties(*mpItemSet); } void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/) diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx index 2fc92633b953..c1d0467b740e 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -89,6 +89,12 @@ namespace sdr return 0L; } + void PageProperties::PostItemChange(const sal_uInt16 nWhich ) + { + if( (nWhich == XATTR_FILLSTYLE) && (mpEmptyItemSet != NULL) ) + CleanupFillProperties(*mpEmptyItemSet); + } + void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/) { // simply ignore item clearing on page objects diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index f8c307f26309..0439fd6baf4c 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -32,6 +32,7 @@ #include <svl/itemset.hxx> #include <svx/svdogrp.hxx> #include <svx/svditer.hxx> +#include <svx/xfillit0.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -182,6 +183,35 @@ namespace sdr { return 0; } + + void CleanupFillProperties( SfxItemSet& rItemSet ) + { + const bool bFillBitmap = rItemSet.GetItemState(XATTR_FILLBITMAP, sal_False) == SFX_ITEM_SET; + const bool bFillGradient = rItemSet.GetItemState(XATTR_FILLGRADIENT, sal_False) == SFX_ITEM_SET; + const bool bFillHatch = rItemSet.GetItemState(XATTR_FILLHATCH, sal_False) == SFX_ITEM_SET; + if( bFillBitmap || bFillGradient || bFillHatch ) + { + const XFillStyleItem* pFillStyleItem = dynamic_cast< const XFillStyleItem* >( rItemSet.GetItem(XATTR_FILLSTYLE) ); + if( pFillStyleItem ) + { + if( bFillBitmap && (pFillStyleItem->GetValue() != XFILL_BITMAP) ) + { + rItemSet.ClearItem( XATTR_FILLBITMAP ); + } + + if( bFillGradient && (pFillStyleItem->GetValue() != XFILL_GRADIENT) ) + { + rItemSet.ClearItem( XATTR_FILLGRADIENT ); + } + + if( bFillHatch && (pFillStyleItem->GetValue() != XFILL_HATCH) ) + { + rItemSet.ClearItem( XATTR_FILLHATCH ); + } + } + } + } + } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index afbb6d0b4066..7590b7d14ae8 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -247,7 +247,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPointGlueDrag::create { drawinglayer::primitive2d::Primitive2DSequence aRetval; - if(maPositions.size()) + if(!maPositions.empty()) { basegfx::B2DPolygon aPolygon; sal_uInt32 a(0); @@ -499,7 +499,7 @@ void SdrDragMethod::createSdrDragEntries_PointDrag() } } - if(aPositions.size()) + if(!aPositions.empty()) { addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true)); } @@ -543,7 +543,7 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag() } } - if(aPositions.size()) + if(!aPositions.empty()) { addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false)); } @@ -670,14 +670,14 @@ void SdrDragMethod::CancelSdrDrag() void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager) { // create SdrDragEntries on demand - if(!maSdrDragEntries.size()) + if(maSdrDragEntries.empty()) { createSdrDragEntries(); } // if there are entries, derive OverlayObjects from the entries, including // modification from current interactive state - if(maSdrDragEntries.size()) + if(!maSdrDragEntries.empty()) { drawinglayer::primitive2d::Primitive2DSequence aResult; drawinglayer::primitive2d::Primitive2DSequence aResultTransparent; diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index d8b31a9a0ccb..784866869d61 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -785,7 +785,7 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) } // fire scene updaters - while(aUpdaters.size()) + while(!aUpdaters.empty()) { delete aUpdaters.back(); aUpdaters.pop_back(); @@ -794,7 +794,7 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) if( !bUndo ) { // now delete removed scene objects - while(aRemoved3DObjects.size()) + while(!aRemoved3DObjects.empty()) { SdrObject::Free( aRemoved3DObjects.back() ); aRemoved3DObjects.pop_back(); @@ -840,7 +840,7 @@ void SdrEditView::DeleteMarkedObj() if(pParent) { - if(aParents.size()) + if(!aParents.empty()) { std::vector< SdrObject* >::iterator aFindResult = std::find(aParents.begin(), aParents.end(), pParent); @@ -857,7 +857,7 @@ void SdrEditView::DeleteMarkedObj() } } - if(aParents.size()) + if(!aParents.empty()) { // in a 2nd run, remove all objects which may already be scheduled for // removal. I am not sure if this can happen, but theoretically diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 3502db48e4e9..ee95d8486e60 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -318,7 +318,7 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy) } // fire scene updaters - while(aUpdaters.size()) + while(!aUpdaters.empty()) { delete aUpdaters.back(); aUpdaters.pop_back(); @@ -378,7 +378,7 @@ void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool b } // fire scene updaters - while(aUpdaters.size()) + while(!aUpdaters.empty()) { delete aUpdaters.back(); aUpdaters.pop_back(); @@ -1051,7 +1051,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll) { SdrTextObj* pTextObj = ((SdrTextObj*)pObj); - if(0 != aCharWhichIds.size()) + if(!aCharWhichIds.empty()) { Rectangle aOldBoundRect = pTextObj->GetLastBoundRect(); @@ -1079,7 +1079,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll) } // fire scene updaters - while(aUpdaters.size()) + while(!aUpdaters.empty()) { delete aUpdaters.back(); aUpdaters.pop_back(); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 30628a10df86..f012cac1757c 100755 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -69,6 +69,9 @@ #include "svx/svdstr.hrc" // Objektname #include "svdoutlinercache.hxx" +#include "svx/xflclit.hxx" +#include "svx/xflhtit.hxx" +#include "svx/xlnclit.hxx" #include <svl/asiancfg.hxx> #include "editeng/fontitem.hxx" @@ -210,6 +213,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) ); SetTextDefaults(); + pLayerAdmin=new SdrLayerAdmin; pLayerAdmin->SetModel(this); ImpSetUIUnit(); @@ -2167,6 +2171,18 @@ const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImpleme return *pSeq; } +void SdrModel::SetDrawingLayerPoolDefaults() +{ + const String aNullStr; + const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); + const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); + const XHatch aNullHatch(aNullLineCol); + + pItemPool->SetPoolDefaultItem( XFillColorItem(aNullStr,aNullFillCol) ); + pItemPool->SetPoolDefaultItem( XFillHatchItem(pItemPool,aNullHatch) ); + pItemPool->SetPoolDefaultItem( XLineColorItem(aNullStr,aNullLineCol) ); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrHint,SfxHint); diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 30791ce216d4..f595909e654f 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2438,7 +2438,7 @@ void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat ) aRect1 = Rectangle( rStat.GetNow(), Size( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ) ); // subtracting the horizontal difference of the latest handle from shape position - if ( aInteractionHandles.size() ) + if ( !aInteractionHandles.empty() ) { sal_Int32 nHandlePos = aInteractionHandles[ aInteractionHandles.size() - 1 ].xInteraction->getPosition().X; aRect1.Move( aRect.Left() - nHandlePos, 0 ); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 81ff5005d0f6..cc2ece168ec7 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -929,7 +929,7 @@ const Rectangle& SdrObject::GetLastBoundRect() const void SdrObject::RecalcBoundRect() { // #i101680# suppress BoundRect calculations on import(s) - if(pModel && pModel->isLocked() ) + if(pModel && pModel->isLocked()) return; // central new method which will calculate the BoundRect using primitive geometry @@ -2440,7 +2440,7 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLin // #i102241# check for line results const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines(); - if(rHairlineVector.size()) + if(!rHairlineVector.empty()) { // for SdrObject creation, just copy all to a single Hairline-PolyPolygon for(sal_uInt32 a(0); a < rHairlineVector.size(); a++) @@ -2452,7 +2452,7 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLin // #i102241# check for fill rsults const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills()); - if(rLineFillVector.size()) + if(!rLineFillVector.empty()) { // merge to a single PolyPolygon (OR) aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector); diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index ede6b35178f9..152ab501f8e6 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -282,7 +282,6 @@ const Rectangle& SdrObjGroup::GetCurrentBoundRect() const // <-- } - const Rectangle& SdrObjGroup::GetSnapRect() const { // --> OD 2007-02-01 #144962# diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 9bc3bbb4958c..0ef0732ac80d 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -491,7 +491,7 @@ namespace { // only create a line primitive when we had content; there is no need for // empty line primitives (contrary to paragraphs, see below). - if(maTextPortionPrimitives.size()) + if(!maTextPortionPrimitives.empty()) { drawinglayer::primitive2d::Primitive2DSequence aLineSequence(impConvertVectorToPrimitive2DSequence(maTextPortionPrimitives)); maTextPortionPrimitives.clear(); @@ -658,13 +658,13 @@ namespace drawinglayer::primitive2d::Primitive2DSequence impTextBreakupHandler::getPrimitive2DSequence() { - if(maTextPortionPrimitives.size()) + if(!maTextPortionPrimitives.empty()) { // collect non-closed lines impFlushTextPortionPrimitivesToLinePrimitives(); } - if(maLinePrimitives.size()) + if(!maLinePrimitives.empty()) { // collect non-closed paragraphs impFlushLinePrimitivesToParagraphPrimitives(); diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 72de016703bd..7b6f71eed59c 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -200,7 +200,7 @@ namespace mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decompositionPathTextPrimitive)); mrOutliner.StripPortions(); - if(maPathTextPortions.size()) + if(!maPathTextPortions.empty()) { // sort portions by paragraph, x and y ::std::sort(maPathTextPortions.begin(), maPathTextPortions.end()); @@ -627,7 +627,7 @@ namespace // get text outlines and their object transformation pTextCandidate->getTextOutlinesAndTransformation(aB2DPolyPolyVector, aPolygonTransform); - if(aB2DPolyPolyVector.size()) + if(!aB2DPolyPolyVector.empty()) { // create stroke primitives std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aStrokePrimitives; @@ -712,7 +712,7 @@ void SdrTextObj::impDecomposePathTextPrimitive( impTextBreakupHandler aConverter(rOutliner); const ::std::vector< impPathTextPortion > rPathTextPortions = aConverter.decompositionPathTextPrimitive(); - if(rPathTextPortions.size()) + if(!rPathTextPortions.empty()) { // get FormText and polygon values const drawinglayer::attribute::SdrFormTextAttribute& rFormTextAttribute = rSdrPathTextPrimitive.getSdrFormTextAttribute(); @@ -753,7 +753,7 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // handle data pair polygon/ParagraphTextPortions - if(aParagraphTextPortions.size()) + if(!aParagraphTextPortions.empty()) { aPolygonParagraphHandler.HandlePair(rPathPolyPolygon.getB2DPolygon(a), aParagraphTextPortions); } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index aaa83ed5f1fe..fd2327dd8139 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -308,7 +308,7 @@ SdrPaintView::~SdrPaintView() #endif // delete existing SdrPaintWindows - while(maPaintWindows.size()) + while(!maPaintWindows.empty()) { delete maPaintWindows.back(); maPaintWindows.pop_back(); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 9ac652f5e025..5618a2880e31 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -330,6 +330,7 @@ void SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource ) void SdrTableObjImpl::SetModel(SdrModel* /*pOldModel*/, SdrModel* pNewModel) { // try to find new table style + disconnectTableStyle(); Reference< XIndexAccess > xNewTableStyle; if( mxTableStyle.is() ) try @@ -360,6 +361,7 @@ void SdrTableObjImpl::SetModel(SdrModel* /*pOldModel*/, SdrModel* pNewModel) mxTableStyle = xNewTableStyle; + connectTableStyle(); update(); } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index ad97a61900fa..91548f37a05a 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2247,7 +2247,7 @@ Window* SvxStyleToolBoxControl::CreateItemWindow( Window *pParent ) pImpl->aClearForm, pImpl->aMore, pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); - if( pImpl->aDefaultStyles.size()) + if( !pImpl->aDefaultStyles.empty()) pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] ); // Set visibility listener to bind/unbind controller pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification )); diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index eb9a7cb8128f..b8a344ce4609 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -819,11 +819,11 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aShapes.push_back( pObj ); } - if( 0 == aShapes.size() ) + if( aShapes.empty() ) bRet = false; } - if( bRet && aShapes.size() ) + if( bRet && !aShapes.empty() ) { // special treatment for only one SdrGrafObj that has text sal_Bool bSingleGraphic = sal_False; @@ -949,7 +949,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } - if(aShapes.size()) + if(!aShapes.empty()) { // more effective way to paint a vector of SdrObjects. Hand over the processed page // to have it in the diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 305b181a65a2..a86baef14810 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -52,8 +52,8 @@ XOutdevItemPool::XOutdevItemPool( const XubString aNullStr; const Bitmap aNullBmp; const basegfx::B2DPolyPolygon aNullPol; - const Color aNullLineCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE)); - const Color aNullFillCol(RGB_Color(COL_DEFAULT_SHAPE_FILLING)); + const Color aNullLineCol(RGB_Color(COL_BLACK)); + const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 )); const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY)); const XDash aNullDash; const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE)); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a72f4f46ec32..0d612ab70a33 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -600,6 +600,8 @@ private: sal_Bool mbStartIdleTimer ; // idle timer mode start/stop + bool mbSetDrawDefaults ; // set draw pool defaults for freshly created documents + static SwAutoCompleteWord *pACmpltWords; // Liste aller Worte fuers AutoComplete //---------------- private Methoden ------------------------------ @@ -2095,6 +2097,13 @@ public: ::sw::UndoManager & GetUndoManager(); ::sw::UndoManager const& GetUndoManager() const; SfxObjectShell* CreateCopy(bool bCallInitNew) const; + + /// must be called only in SwDocShell::InitNew, causes UpdateDrawDefaults to be called when drawing layer is created + void SetDrawDefaults(); + +private: + /// method to set new graphics pool defaults, must only be called by SetDrawDefaults! + void UpdateDrawDefaults(); }; diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index b18ccb6af8c4..4cc0caf01772 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -709,6 +709,8 @@ void SwDoc::InitDrawModel() pViewSh = (ViewShell*)pViewSh->GetNext(); }while( pViewSh != pCurrentView ); } + + UpdateDrawDefaults(); } /** method to notify drawing page view about the invisible layers @@ -1101,3 +1103,16 @@ namespace docfunc } // <-- +void SwDoc::SetDrawDefaults() +{ + mbSetDrawDefaults = true; + UpdateDrawDefaults(); +} + +void SwDoc::UpdateDrawDefaults() +{ + // drawing layer defaults that are set for new documents (if InitNew was called) + if ( pDrawModel && mbSetDrawDefaults ) + pDrawModel->SetDrawingLayerPoolDefaults(); +} + diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 98ad5724f10d..3872e24b456f 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -301,7 +301,8 @@ SwDoc::SwDoc() mbLastBrowseMode( false ), n32DummyCompatabilityOptions1(0), n32DummyCompatabilityOptions2(0), - mbStartIdleTimer(sal_False) + mbStartIdleTimer(sal_False), + mbSetDrawDefaults(false) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" ); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 79eb610a84e6..a2b92c738c30 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -407,12 +407,9 @@ SwUndo * UndoManager::RemoveLastUndo() void UndoManager::EnableUndo(bool bEnable) { - // UGLY: SfxUndoManager has a counter to match enable/disable calls - // but the writer code expects that a single call switches - while (IsUndoEnabled() != bEnable) - { - SfxUndoManager::EnableUndo(bEnable); - } + // SfxUndoManager does not have a counter anymore, but reverted to the old behavior of + // having a simple boolean flag for locking. So, simply forward. + SfxUndoManager::EnableUndo(bEnable); } void UndoManager::AddUndoAction(SfxUndoAction *pAction, sal_Bool bTryMerge) diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 6c8e73931105..17eead88c233 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -351,6 +351,8 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) //#i16874# AutoKerning as default for new documents pDoc->SetDefault( SvxAutoKernItem( sal_True, RES_CHRATR_AUTOKERN ) ); + pDoc->SetDrawDefaults(); + // --> OD 2005-02-10 #i42080# - Due to the several calls of method <SetDefault(..)> // at the document instance, the document is modified. Thus, reset this // status here. Note: In method <SubInitNew()> this is also done. diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index 25b09c895687..f8fbfdde04ca 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -782,6 +782,12 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c aOpt.setBrowseMode( bVal ); pView->GetWrtShell().ApplyViewOptions( aOpt ); pView->RecheckBrowseMode(); + + // must be set in mpViewOption as this will overwrite settings in _post! + mpViewOption->setBrowseMode( bVal ); + + // disable multiple layout + pView->GetDocShell()->ToggleBrowserMode(bVal, pView ); } } break; diff --git a/testautomation/chart2/optional/ch2_data_series.bas b/testautomation/chart2/optional/ch2_data_series.bas new file mode 100644 index 000000000000..6677c8a8c886 --- /dev/null +++ b/testautomation/chart2/optional/ch2_data_series.bas @@ -0,0 +1,60 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' 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. +'* +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Function test for Data Series functions in chart +'* +'\************************************************************************************************ + +sub main + use "chart2\tools\ch_tools_common.inc" + use "chart2\tools\ch_tools_chart_type.inc" + use "chart2\tools\ch_tools_select.inc" + use "chart2\optional\includes\ch2_lvl1_data_series1.inc" + + Call hStatusIn("Chart2", "ch2_data_series.bas") + + printlog "----------------------------------------" + printlog " C h a r t 2 D a t a S e r i e s " + printlog "----------------------------------------" + printLog Chr(13) + "----------- Options ------------" + Call tPlotMissingValuesBar + Call tPlotMissingValuesLine + Call hStatusOut +end sub +' +'------------------------------------------------------------------------------- +' +sub LoadIncludeFiles + use "global\tools\includes\optional\t_set_standard_controls.inc" + use "global\system\includes\master.inc" + use "global\system\includes\gvariabl.inc" + Call GetUseFiles + gApplication = "CALC" +end sub + diff --git a/testautomation/chart2/optional/includes/ch2_lvl1_data_series1.inc b/testautomation/chart2/optional/includes/ch2_lvl1_data_series1.inc new file mode 100644 index 000000000000..b13bf14eb6d2 --- /dev/null +++ b/testautomation/chart2/optional/includes/ch2_lvl1_data_series1.inc @@ -0,0 +1,214 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' 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. +'* +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Data Series dialog test cases +'* +'************************************************************************ +'* +' #1 tPlotMissingValuesBar +' #1 tPlotMissingValuesLine +'* +'\************************************************************************ + +testcase tPlotMissingValuesBar + Dim iCountTabPg as integer + iCountTabPg = 0 + Dim iTestRadio as integer + iTestRadio = 99 + printlog "Load simple chart document" + + if fLoadVerySimpleChartAndSaveLocal() > 0 then + warnlog "Loading test document seems to have failed -> Check this out!" + goto endsub + endif + printlog "Go one row down" + Kontext "DocumentCalc" + DocumentCalc.TypeKeys "<DOWN>" + printlog "Insert / Rows to insert one empty row in the data series" + InsertRowsCalc + printlog "Select chart using navigator" + if fSelectFirstOLE = 0 then + printlog "Edit / Object / Edit" + EditObjectEdit + printlog "Select DataSeries A by toolbar selectorbox" + call fChartSelectElement (8) + printlog "Open the properties dialog by using the FormatSelection button in the toolbar" + FormatSelection.Click + printlog "Select tab page Options" + Kontext + iCountTabPg = Active.GetPageCount + if iCountTabPg <> 4 then + warnlog "Edit / Properties on a data series should have 4 tab pages but has " & iCountTabPg & "." + endif + Active.SetPage TabDataSeriesOptions + Kontext "TabDataSeriesOptions" + call DialogTest ( TabDataSeriesOptions ) + printlog "Verify that 'Leave gap' is checked (default)" + if NOT LeaveGap.IsChecked then + warnlog "'Leave gap' should be the default setting in bar charts!" + endif + printlog "Check that 'ContinueLine' is disabled" + if ContinueLine.IsEnabled then + warnlog "Continue Line radio button is enabled but should not in bar charts!" + endif + printlog "Select 'AssumeZero' and close the dialog with OK" + iTestRadio = fSetRadioButton(AssumeZero) + if iTestRadio = 2 then + warnlog "Assume Zero radio button was not checked." + elseif iTestRadio = 11 then + warnlog "Assume Zero radio button is not visible." + elseif iTestRadio = 12 then + warnlog "Assume Zero radio button is not enabled." + endif + Kontext + printlog "Clicking OK" + TabDataSeriesOptions.OK + printlog "Invoke Format / Object Properties" + FormatSelection + Kontext + Active.SetPage TabDataSeriesOptions + Kontext "TabDataSeriesOptions" + printlog "Check if 'AssumeZero' is selected" + if NOT AssumeZero.IsChecked then + warnlog "'AssumeZero' should be selected." + endif + TabDataSeriesOptions.Cancel + else + warnlog "It was not possible to select the chart object!" + endif + printlog "Close document" + Call hCloseDocument +endcase +' +'------------------------------------------------------------------------- +' +testcase tPlotMissingValuesLine + Dim iCountTabPg as integer + iCountTabPg = 0 + Dim iTestRadio as integer + iTestRadio = 99 + + printlog "Load simple chart document" + + if fLoadVerySimpleChartAndSaveLocal() > 0 then + warnlog "Loading test document seems to have failed -> Check this out!" + goto endsub + endif + printlog "Go one row down" + Kontext "DocumentCalc" + DocumentCalc.TypeKeys "<DOWN>" + printlog "Insert / Rows to insert one empty row in the data series" + InsertRowsCalc + printlog "Select chart using navigator" + if fSelectFirstOLE = 0 then + printlog "Edit / Object / Edit" + EditObjectEdit + if fInvokeChartTypeDialog <> 0 then + warnlog "Impossible to invike the chart type dialog!" + goto endsub + endif + if fSetChartType("line") <> 0 then + warnlog "Selecting chart type 'line' failed!" + goto endsub + end if + if fSetChartTypeVariant(2) <> 0 then + warnlog "Selecting chart type 'line' variant 2 failed!" + goto endsub + end if + if fCloseChartTypeDialogOK <> 0 then + warnlog "Closing Chart Type dialog with OK failed!" + goto endsub + end if + printlog "Select DataSeries A by toolbar selectorbox" + call fChartSelectElement (8) + printlog "Invoke Format / Object Properties" + FormatSelection.Click + printlog "Select tab page Options" + Kontext + iCountTabPg = Active.GetPageCount + if iCountTabPg <> 2 then + warnlog "Edit / Properties on a data series of a line chart should have 2 tab pages but has " & iCountTabPg & "." + endif + Active.SetPage TabDataSeriesOptions + Kontext "TabDataSeriesOptions" + call DialogTest ( TabDataSeriesOptions ) + printlog "Verify that 'Leave gap' is checked (default)" + if NOT LeaveGap.IsChecked then + warnlog "'Leave gap' should be the default setting in line charts!" + endif + printlog "Select 'AssumeZero' and close the dialog with OK" + iTestRadio = fSetRadioButton(AssumeZero) + if iTestRadio = 2 then + warnlog "Assume Zero radio button was not checked." + elseif iTestRadio = 11 then + warnlog "Assume Zero radio button is not visible." + elseif iTestRadio = 12 then + warnlog "Assume Zero radio button is not enabled." + endif + Kontext + printlog "Clicking OK" + TabDataSeriesOptions.OK + printlog "Invoke Format / Object Properties" + FormatSelection + Kontext + Active.SetPage TabDataSeriesOptions + Kontext "TabDataSeriesOptions" + printlog "Check if 'AssumeZero' is selected" + if NOT AssumeZero.IsChecked then + warnlog "'AssumeZero' should be selected." + endif + printlog "Select 'ContinueLine' and close the dialog with OK" + iTestRadio = 99 + iTestRadio = fSetRadioButton(ContinueLine) + if iTestRadio = 2 then + warnlog "Continue Line radio button was not checked." + elseif iTestRadio = 11 then + warnlog "Continue Line radio button is not visible." + elseif iTestRadio = 12 then + warnlog "Continue Line radio button is not enabled." + endif + Kontext + TabDataSeriesOptions.OK + printlog "Invoke Format / Object Properties" + FormatSelection + Kontext + Active.SetPage TabDataSeriesOptions + Kontext "TabDataSeriesOptions" + printlog "Check if 'ContinueLine' is selected" + if NOT ContinueLine.IsChecked then + warnlog "'ContinueLine' should be selected." + endif + printlog "Close dialog with Cancel-button" + TabDataSeriesOptions.Cancel + else + warnlog "It was not possible to select the chart object!" + endif + printlog "Close document" + Call hCloseDocument +endcase diff --git a/testautomation/chart2/optional/includes/ch2_lvl1a.inc b/testautomation/chart2/optional/includes/ch2_lvl1a.inc index e012dd0253c8..e7154d3820cf 100755 --- a/testautomation/chart2/optional/includes/ch2_lvl1a.inc +++ b/testautomation/chart2/optional/includes/ch2_lvl1a.inc @@ -174,10 +174,15 @@ testcase tChartShapes printlog " Verify that the drawbar is visible" Kontext "DrawBar" - qaerrorlog "#i107003# disabled because of bug in toolbars" - ' if Not DrawBar.Exists then - ' Call hToolbarSelect("Drawing", true) - ' endif + if Not DrawBar.Exists then + warnlog "Drawbar is not enabled" + Kontext "DocumentCalc" + DocumentCalc.TypeKeys "<Escape>" + printlog " Close document" + Call hCloseDocument + goto endsub +' Call hToolbarSelect("Drawing", true) + endif printlog " Insert a shape to the chart by <STRG-RETURN>" Kontext "DocumentChart" diff --git a/testautomation/chart2/optional/includes/wizard/ch2_lvl1_wizard.inc b/testautomation/chart2/optional/includes/wizard/ch2_lvl1_wizard.inc index 357fa89c4393..2cc8a47568be 100644 --- a/testautomation/chart2/optional/includes/wizard/ch2_lvl1_wizard.inc +++ b/testautomation/chart2/optional/includes/wizard/ch2_lvl1_wizard.inc @@ -199,7 +199,7 @@ testcase tCreateNew3DChart endif printlog "Check that 3D look is 'simple' (=default)" if Scheme3D.GetSelIndex <> 1 then - warnlog "#i112522# - Default 3D Look ('simple') has not been preserved after save and reload." + warnlog "Default 3D Look ('simple') has not been preserved after save and reload." endif printlog "Check that 3D shape 'cone' is selected" if BarColumnShape.GetSelIndex <> 3 Then @@ -222,7 +222,7 @@ testcase tCreateNew3DChart warnlog "Data range wasn't correctly preserved after save and reload and does not caontain $A$2:$E$13." endif if instr ( sControlString , "$A$17:$E$17" ) = 0 Then - warnlog "#i72241# - Data range wasn't correctly preserved after save and reload and does not contain $A$17:$E$17." + warnlog "Data range wasn't correctly preserved after save and reload and does not contain $A$17:$E$17." endif printlog "Check that radio button 'rows' is checked" if NOT Rows.IsChecked then @@ -238,7 +238,7 @@ testcase tCreateNew3DChart endif printlog "Check that 'First column as label' checkbox is checked." if NOT FirstColumnAsLabel.IsChecked then - warnlog "#i72241# - Check box 'First column as label' (enabled) wasn't preserved after save and reload." + warnlog "Check box 'First column as label' (enabled) wasn't preserved after save and reload." endif else warnlog "Tab page 'Data Range' not visible!" @@ -260,7 +260,7 @@ testcase tCreateNew3DChart sControlString = RangeFor.GetText printlog "'Range for name' is: " & sControlString if instr ( sControlString , "$A$17" ) = 0 Then - warnlog "#i72241# - 'Range for name' wasn't correctly preserved after save and reload." + warnlog "'Range for name' wasn't correctly preserved after save and reload." else printlog "Select 'Y-Values' in Data Ranges list on the right." if fSetListBoxByItem ( DataRanges , 2 ) > 0 then @@ -594,7 +594,7 @@ testcase tCreateNewLineChart if instr ( sControlString , "$A$19" ) = 0 Then warnlog "'Categories' wasn't correctly preserved after save and reload." endif - printlog "Leave tab page data series with CANCEL" + printlog "Leave tab page data series with CANCEL" TabChartTypeDataSeries.Cancel else warnlog "Tab page Data Series was not up!" @@ -867,7 +867,7 @@ testcase tCreateNewBubbleChart warnlog "Data range wasn't correctly preserved after save and reload: $A$19" endif if instr ( sControlString , "$B$13:$C$16" ) = 0 Then - QAErrorlog "#i100780#Data range wasn't correctly preserved after save and reload: $B$13:$C$16" + QAErrorlog "Data range wasn't correctly preserved after save and reload: $B$13:$C$16" endif if instr ( sControlString , "$C$12" ) = 0 Then warnlog "Data range wasn't correctly preserved after save and reload: $E$1:$F$13" diff --git a/testautomation/chart2/required/includes/ch2_toolbars.inc b/testautomation/chart2/required/includes/ch2_toolbars.inc index 32eed54ee370..2ad6f3db7e46 100644 --- a/testautomation/chart2/required/includes/ch2_toolbars.inc +++ b/testautomation/chart2/required/includes/ch2_toolbars.inc @@ -48,11 +48,16 @@ testcase tDrawBar EditObjectEdit printlog " Verify that the drawbar is visible" Kontext "DrawBar" - - qaerrorlog "#i107003# disabled because of bug in toolbars" -' if Not DrawBar.Exists then + + if Not DrawBar.Exists then + warnlog "Drawbar is not enabled" + Kontext "DocumentCalc" + DocumentCalc.TypeKeys "<Escape>" + printlog " Close document" + Call hCloseDocument + goto endsub ' Call hToolbarSelect("Drawing", true) -' endif + endif printlog " Check if all items on drawbar are available" if DrawBar.GetItemCount <> 16 then diff --git a/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc b/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc index 8743feae997b..4620d90150d4 100644 --- a/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc +++ b/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc @@ -86,8 +86,7 @@ testcase tNewReport sleep(10) Kontext "DocumentWriter" - DocumentWriter.TypeKeys "<MOD1 SHIFT I>" , true ' EDIT / SELECT TEXT - DocumentWriter.TypeKeys "<DOWN>" , true + DocumentWriter.TypeKeys "<MOD1 SHIFT I>" , true ' EDIT / SELECT TEXT DocumentWriter.TypeKeys "<SHIFT END>" , true DocumentWriter.TypeKeys "<MOD1 C>" , true @@ -102,7 +101,7 @@ testcase tNewReport ' select next line and check content Kontext "DocumentWriter" - DocumentWriter.TypeKeys "<DOWN>" , true + DocumentWriter.TypeKeys "<DOWN>", 2, true DocumentWriter.TypeKeys "<SHIFT HOME>" , true DocumentWriter.TypeKeys "<MOD1 C>" , true diff --git a/testautomation/dbaccess/optional/includes/xf_Submission.inc b/testautomation/dbaccess/optional/includes/xf_Submission.inc index 05f0da768cdf..a928d660b093 100644 --- a/testautomation/dbaccess/optional/includes/xf_Submission.inc +++ b/testautomation/dbaccess/optional/includes/xf_Submission.inc @@ -172,8 +172,8 @@ testcase tDataNavigatorSubmission dim sLine as String Line Input #1, sLine - if sLine <> "<?xml version=""1.0""?>" then - warnlog "the first line in the xml document should <?xml version=""1.0""?> but it is " + sLine + if sLine <> "<?xml version=""1.0"" encoding=""UTF-8""?>" then + warnlog "the first line in the xml document should <?xml version=""1.0"" encoding=""UTF-8""?> but it is " + sLine endif Line Input #1, sLine if sLine <> "<instanceData><element1/></instanceData>" then diff --git a/testautomation/dbaccess/required/includes/ReportBuilder01.inc b/testautomation/dbaccess/required/includes/ReportBuilder01.inc index d1cce59d4d3f..91faba007d11 100644 --- a/testautomation/dbaccess/required/includes/ReportBuilder01.inc +++ b/testautomation/dbaccess/required/includes/ReportBuilder01.inc @@ -116,13 +116,13 @@ testcase tMainMenuBar 'edit menu - '/// check if there are 11 items in the edit menu. - printlog "check if there are 11 items in the edit menu." + '/// check if there are 14 items in the edit menu. + printlog "check if there are 14 items in the edit menu." ReportDesign.UseMenu hMenuSelectNr(2) iCount = hMenuItemGetCount() - if (iCount <> 11) then - warnlog "There should 11 items in the edit menu but there are " + iCount + " items." + if (iCount <> 14) then + warnlog "There should 14 items in the edit menu but there are " + iCount + " items." end if call hMenuClose() @@ -140,13 +140,13 @@ testcase tMainMenuBar 'insert menu - '/// check if there are 3 items in the insert menu. - printlog "check if there are 3 items in the insert menu." + '/// check if there are 5 items in the insert menu. + printlog "check if there are 5 items in the insert menu." ReportDesign.UseMenu hMenuSelectNr(4) iCount = hMenuItemGetCount() - if (iCount <> 3) then - warnlog "There should 3 items in the insert menu but there are " + iCount + " items." + if (iCount <> 5) then + warnlog "There should 5 items in the insert menu but there are " + iCount + " items." end if call hMenuClose() @@ -336,7 +336,7 @@ testcase tExecuteReport Kontext "ReportDesign" ReportDesign.UseMenu hMenuSelectNr(2) - hMenuSelectNr(11) + hMenuSelectNr(14) sleep(10) diff --git a/testautomation/framework/optional/includes/basic_gridcontrol.inc b/testautomation/framework/optional/includes/basic_gridcontrol.inc index 95bad4d09463..68a2416bddee 100644 --- a/testautomation/framework/optional/includes/basic_gridcontrol.inc +++ b/testautomation/framework/optional/includes/basic_gridcontrol.inc @@ -32,7 +32,6 @@ '\****************************************************************************** testcase tGridcontrolLoad - const MACRO_NAME = "Show" const FILE_NAME = "framework/optional/input/gridcontrol.odt" dim i as integer @@ -42,8 +41,10 @@ testcase tGridcontrolLoad call hFileOpenLocally( gTestToolPath & FILE_NAME ) printlog "Start the macro, that performs the test" - hExecMacro( MACRO_NAME ) + Kontext "ShowGridcontrol" + ' FAILS IF DOCUMENT IS READONLY.... + ShowGridcontrol.typeKeys "<space>" Kontext "GridControlDialog" if GridControlDialog.exists(5) then for i=1 to gridcontrolcontrol.getcolumncount diff --git a/testautomation/framework/optional/includes/basic_macros.inc b/testautomation/framework/optional/includes/basic_macros.inc index cc8ff04fb408..e649200a585f 100644 --- a/testautomation/framework/optional/includes/basic_macros.inc +++ b/testautomation/framework/optional/includes/basic_macros.inc @@ -351,7 +351,7 @@ testcase tMakro_Dialog printlog( "Select the last item in the treelist" ) kontext "Makro" hSelectTheLastNode( MakroAus ) - + WaitSlot(2000) printlog( "Delete the new module" ) Loeschen.Click() diff --git a/testautomation/framework/optional/input/gridcontrol.odt b/testautomation/framework/optional/input/gridcontrol.odt Binary files differindex d1d52c32245f..9d175f3c73eb 100755 --- a/testautomation/framework/optional/input/gridcontrol.odt +++ b/testautomation/framework/optional/input/gridcontrol.odt diff --git a/testautomation/global/sid/e_all.sid b/testautomation/global/sid/e_all.sid index 4770eab50f1b..a09d700c6f6c 100755 --- a/testautomation/global/sid/e_all.sid +++ b/testautomation/global/sid/e_all.sid @@ -204,6 +204,7 @@ ViewToolbarsInsertFormula .uno:InsertFormula ViewToolbarsCustomize .uno:ConfigureDialog ViewToolbarsPreviewbar .uno:AvailableToolbars?Toolbar:string=previewbar ViewToolbarsDrawObjectbar .uno:AvailableToolbars?Toolbar:string=drawobjectbar +ViewToolbarsReset SYM:.cmd:RestoreVisibility ' **** Writer ViewRuler .uno:Ruler diff --git a/testautomation/global/system/includes/gvariabl.inc b/testautomation/global/system/includes/gvariabl.inc index d9290ebb2c3c..20a05b164aaa 100644 --- a/testautomation/global/system/includes/gvariabl.inc +++ b/testautomation/global/system/includes/gvariabl.inc @@ -146,6 +146,7 @@ Global gTestAppArea as String '///+ gTestAppArea : name of the testarea (e Global gErrorSum as Integer '///+ gErrorSum : last value of errors in a test Global gWarningSum as Integer '///+ gWarningSum : last value of warnings in a test Global gQaErrorSum as Integer '///+ gQaErrorSum : last value of qaErrors in a test +Global gAssertionSum as Integer '///+ gAssertionSum : last value of Assertions in a test Global gStatusDuration '///+ gStatusDuration : starting time to get at the end the duration of a test Global gTestcaseStart as Date '///+ gTestCaseDuration : starting time of the testcase Global glsStatusPage (32000) as String '///+ glsStatusPage () : list for the output in the status-page diff --git a/testautomation/global/system/includes/iniinfo.inc b/testautomation/global/system/includes/iniinfo.inc index 3423584253fd..e187f77e4a57 100644 --- a/testautomation/global/system/includes/iniinfo.inc +++ b/testautomation/global/system/includes/iniinfo.inc @@ -122,27 +122,38 @@ sub GetIniInformation call sCheckValgrindStatus() ' set a global path for custom scripts outside of current environment gPrivateEnvironmentLocation = getIniValue(gTesttoolIni, "PrivateEnvironment", "Current") - if (gPrivateEnvironmentLocation <> "" AND gPrivateEnvironmentLocation <> ".") then + if (gPrivateEnvironmentLocation <> "" AND gPrivateEnvironmentLocation <> ".") then ' check if the gPrivateEnvironmentLocation path exists if fileExists(gPrivateEnvironmentLocation) then - ' check if the path ends with a path sign and add the path sign if not - if (Right(gPrivateEnvironmentLocation,1) <> gPathSigne) then - gPrivateEnvironmentLocation = gPrivateEnvironmentLocation & gPathSigne - endif + if getAttr(gPrivateEnvironmentLocation) = 16 then + ' check if the path ends with a path sign and add the path sign if not + if (Right(gPrivateEnvironmentLocation,1) <> gPathSigne) then + gPrivateEnvironmentLocation = gPrivateEnvironmentLocation & gPathSigne + endif + else + qaErrorLog "[PrivateEnvironment] you need to specify a path" + gPrivateEnvironmentLocation = "" + endif else ' check if the gTesttoolPath plus the gPrivateEnvironmentLocation path exists ' f.e. this is for a relative path if fileExists(gTesttoolPath & gPrivateEnvironmentLocation) then + ' check if the gPrivateEnvironmentLocation is a path gPrivateEnvironmentLocation = gTesttoolPath & gPrivateEnvironmentLocation - ' check if the path ends with a path sign and add the path sign if not - if (Right(gPrivateEnvironmentLocation,1) <> gPathSigne) then - gPrivateEnvironmentLocation = gPrivateEnvironmentLocation & gPathSigne - endif + if getAttr(gPrivateEnvironmentLocation) = 16 then + ' check if the path ends with a path sign and add the path sign if not + if (Right(gPrivateEnvironmentLocation,1) <> gPathSigne) then + gPrivateEnvironmentLocation = gPrivateEnvironmentLocation & gPathSigne + endif + else + qaErrorLog "[PrivateEnvironment] you need to specify a path" + gPrivateEnvironmentLocation = "" + endif else qaErrorLog "[PrivateEnvironment] defined in: '" & gTesttoolIni & "', but the path '" & gPrivateEnvironmentLocation & "'does not exist!" gPrivateEnvironmentLocation = "" endif - end if + end if else gPrivateEnvironmentLocation = "" end if diff --git a/testautomation/global/system/includes/status.inc b/testautomation/global/system/includes/status.inc index 83430bfaa332..da3e52e3992b 100644 --- a/testautomation/global/system/includes/status.inc +++ b/testautomation/global/system/includes/status.inc @@ -66,6 +66,7 @@ sub hStatusIn ( sTestAppArea as String, sTestname as String, optional sName as S gErrorSum = getErrorCount() ' not 0! if you run 2-times status in/out in one bas-file! gWarningSum = getWarningCount() gQaErrorSum = getQaErrorCount() + gAssertionSum = 0 ' make sure we have everything to update the status-Database. gDatabasePath = getDatabasePath(privateDatabasePath) @@ -109,6 +110,60 @@ sub hStatusOut ( optional NoKill as Boolean ) PrintLog Chr(13) + "* - End of the test - *" Printlog "Date : " + Date() + " Time: " + Time() Printlog "Duration : " + sLocalTestDuration + ' Output assertion count message only in nonpro version + if (NOT isProduct) then + if (gAssertionSum > 0) then + warnlog " ** " + gAssertionSum + " Assertions" + else + printlog " ** " + gAssertionSum + " Assertions" + endif + endif +end sub + +sub hGetNonproAssertions(sName as string, sDuration as string) + Dim sResultFilePath as string + dim fList(15000) as string + dim i, a as integer + dim aCount as integer + dim x + dim soutput as string + dim xlist(15000) as string + + if (bDebugVersion = true) then + 'Get the path to the RESULT directory and put resultfile into array + sResultFilePath = GetIniValue (gTesttoolIni, gTTProfileName , "LogBaseDir") + gPathSigne + Left(gTestname, Len(gTestname)-4) + ".res" + listRead(fList, sResultFilePath, "UTF8") + for i=1 to listcount(fList(0)) + 'Go through whole file, but only last testrun counts + if (left(fList(i),1,1) = "0") then + 'Line starting with 0 indicates start of new testrun: reset counters + aCount=0 + listalldelete(xlist()) + endif + if (left(fList(i),1,1) = "6") then + 'Assertion found like: + '5;~global\system\includes\master.inc;533;12;65535;"Dial + '0 1: file 2:Line 5:Text + x = split(fList(i), ";") + aCount=aCount+1 + sOutput = sName _ + + Chr(9) + sDuration _ + + Chr(9) + "4" _ + + Chr(9) + mid(fRemoveLineBreaks(x(5)),2, len(fRemoveLineBreaks(x(5)))-2) _ + + Chr(9) + x(2) _ + + Chr(9) + "No Revision found" _ + + Chr(9) + fgetFileName(x(1)) _ + + Chr(9) + ListAppend (xlist(), sOutput) + endif + next i + 'Update global message list + for i = gAssertionSum +1 to listcount(xlist) + ListAppend (glsStatusPage(), xlist(i)) + next i + 'Update global assertion counter + gAssertionSum = aCount + endif end sub sub hStatusAddTestcase() @@ -139,7 +194,7 @@ sub hStatusAddTestcase() '///+ duration => the duration of the testcase sTestcaseDuration = wielange(gTestcaseStart, 1) '(2) - sTestcaseStart = convertDateToDatabase(gTestcaseStart) + " " + convertTimeToDatabase(gTestcaseStart) ' TODO: ask HDE/TBO + sTestcaseStart = convertDateToDatabase(gTestcaseStart) + " " + convertTimeToDatabase(gTestcaseStart) sTCname = GetTestcaseName ' testtool basic command iCut = Instr ( sTCname, "(" ) @@ -177,7 +232,7 @@ sub hStatusAddTestcase() endif ' generate status line for testcase and append to global array - '/// iErrorLevel: 0: no faults; 1: Warning; 2: Error; 3: qaError ///' + '/// iErrorLevel: 0: no faults; 1: Warning; 2: Error; 3: qaError; 4: Assertion ///' iErrorLevel = -1 'D printlog "Iall: " + iAllErrorCount + " W:" + iWarningCount + " E: " + iErrorCount for i = 0 to iAllErrorCount @@ -215,6 +270,7 @@ sub hStatusAddTestcase() gErrorSum = getErrorCount() gQaErrorSum = getQaErrorCount() gWarningSum = getWarningCount() + hGetNonproAssertions(sTCname, sTestcaseDuration) ' workaround to get assertions count end sub sub hStatusWriteOutputFirstFile () @@ -234,6 +290,7 @@ sub hStatusWriteOutputFirstFile () dim sTemp as string dim sFileName as string dim slVersion() as string + dim iDebug as integer dim ilVersion as integer dim sVersionCWS as string dim iPosA as integer @@ -261,7 +318,7 @@ sub hStatusWriteOutputFirstFile () '///+ 13 cws name => if it is the master: 'Master' else the name of the childworkspace '///+ 14 source tree => '///+ 15 product => - '///+ 16 builder => + '///+ 16 debug => '///+ 17 checksum => '///+ data => @@ -307,6 +364,12 @@ sub hStatusWriteOutputFirstFile () sUsername = gReturnAddress endif + if (isProduct()) then + iDebug = 0 + else + iDebug = 1 + endif + ListAppend ( lTestrun(), "fileformat=0.2" ) ListAppend ( lTestrun(), "product=" + sProduct ) ListAppend ( lTestrun(), "sourcetree=" + sSource ) @@ -323,6 +386,7 @@ sub hStatusWriteOutputFirstFile () ListAppend ( lTestrun(), "testname=" + gTestName ) '(10) ' generated in hStatusIn ListAppend ( lTestrun(), "cws=" + sVersionCWS ) ListAppend ( lTestrun(), "ooolanguage=" + iSprache ) '(9) + ListAppend ( lTestrun(), "debug=" + iDebug ) ListAppend ( lTestrun(), "checksum=" + "") ' ListAppend ( lTestrun(), "data=" + ) diff --git a/testautomation/global/win/dial_d_h.win b/testautomation/global/win/dial_d_h.win index 6af13cd00f6c..75ab744dce79 100755 --- a/testautomation/global/win/dial_d_h.win +++ b/testautomation/global/win/dial_d_h.win @@ -443,8 +443,7 @@ Aktualisieren sym:SFX2_HID_TEMPLDLG_UPDATEBYEXAMPLE Vorlagenliste sym:SFX2_HID_TEMPLATE_FMT Gruppenliste sym:SFX2_HID_TEMPLATE_FILTER -*GridControlDialogStarter ACTIVE -ShowGridcontrol sym:showGridcontrol +*ShowGridcontrol sym:showgridcontrol *GridControlDialog sym:gridcontroldialog gridcontrolcontrol sym:gridcontrolself diff --git a/testautomation/global/win/etab_a_d.win b/testautomation/global/win/etab_a_d.win index e8fb0ac7b870..1267cdae88ca 100755 --- a/testautomation/global/win/etab_a_d.win +++ b/testautomation/global/win/etab_a_d.win @@ -364,6 +364,10 @@ SaveIn sym:CUI_HID_SVX_SAVE_IN ToolbarContents sym:CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS ResetBtn sym:SFX2_HID_TABDLG_RESET_BTN +*TabCustomProperties sym:SFX2_HID_TP_CUSTOMPROPERTIES +Properties sym:SFX2_HID_CTRL_CUSTOMPROPERTIES +Add sym:sfx2:PushButton:TP_CUSTOMPROPERTIES:BTN_ADD + *TabDatabaseField sym:extensions:TabPage:RID_PAGE_OPTION_DBFIELD YesSaveIt sym:extensions:RadioButton:RID_PAGE_OPTION_DBFIELD:RB_STOREINFIELD_YES NoValueForm sym:extensions:RadioButton:RID_PAGE_OPTION_DBFIELD:RB_STOREINFIELD_NO diff --git a/testautomation/graphics/optional/includes/global/g_clipboard.inc b/testautomation/graphics/optional/includes/global/g_clipboard.inc index 8da14643d748..2be5461617bd 100644 --- a/testautomation/graphics/optional/includes/global/g_clipboard.inc +++ b/testautomation/graphics/optional/includes/global/g_clipboard.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'************************************************************************************** +'\************************************************************************************** testcase tiEditUndo diff --git a/testautomation/graphics/optional/includes/global/g_convertto.inc b/testautomation/graphics/optional/includes/global/g_convertto.inc index 3a829b1ef275..69719accd4e8 100644 --- a/testautomation/graphics/optional/includes/global/g_convertto.inc +++ b/testautomation/graphics/optional/includes/global/g_convertto.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'************************************************************************************** +'\************************************************************************************** ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\columbia.dxf") ' Call hGrafikEinfuegen ConvertPath ( gTesttoolPath + "global\input\graf_inp\enter.bmp" ) diff --git a/testautomation/graphics/optional/includes/global/g_demoguide.inc b/testautomation/graphics/optional/includes/global/g_demoguide.inc index 0860e8cb942a..9e1a4ffbf497 100644 --- a/testautomation/graphics/optional/includes/global/g_demoguide.inc +++ b/testautomation/graphics/optional/includes/global/g_demoguide.inc @@ -263,16 +263,15 @@ testcase t_Interoperability Kontext "DocumentImpress" Kontext "Slides" Kontext "SlidesControl" - SlidesControl.OpenContextMenu sleep 1 - hMenuSelectNr (8) + SlidesControl.TypeKeys "<MOD1 X>" + Kontext "DocumentImpress" DocumentImpress.TypeKeys "<HOME>", true Kontext "Slides" Kontext "SlidesControl" - SlidesControl.OpenContextMenu sleep 1 - hMenuSelectNr (10) + SlidesControl.TypeKeys "<MOD1 V>" Printlog " Verify that the slide was moved correctly" Kontext "Slides" diff --git a/testautomation/graphics/optional/includes/global/g_insert.inc b/testautomation/graphics/optional/includes/global/g_insert.inc index 44d9030413ea..67196c3145d6 100644 --- a/testautomation/graphics/optional/includes/global/g_insert.inc +++ b/testautomation/graphics/optional/includes/global/g_insert.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'************************************************************************************** +'\************************************************************************************** testcase tdInsertObjectOleObjects diff --git a/testautomation/graphics/optional/includes/global/g_line.inc b/testautomation/graphics/optional/includes/global/g_line.inc index eb672b3b9716..758f537c5630 100644 --- a/testautomation/graphics/optional/includes/global/g_line.inc +++ b/testautomation/graphics/optional/includes/global/g_line.inc @@ -363,6 +363,7 @@ testcase tLineConnect Dim i as integer Dim cname as string Dim cfirst as integer + Dim CornerStyles as integer if bAsianLan then QaErrorLog "tLineConnect ends because Asian languages are not fully supported." @@ -517,10 +518,11 @@ testcase tLineConnect else sleep 1 endif + + For i = 1 to CornerStyles + Kontext "TabLinie" + if (i > 1) AND (cname <> CornerStyle.GetSelText) then - For i = 1 to CornerStyle.GetItemCount - Kontext "TabLinie" - if (i > 1) AND (cname <> CornerStyle.GetSelText) then warnlog "Cornerstylename wasnt saved. Should have been: " + cname + ". But was: " + CornerStyle.GetSelText endif CornerStyle.Select i diff --git a/testautomation/graphics/optional/includes/global/g_tools.inc b/testautomation/graphics/optional/includes/global/g_tools.inc index e8e918b95cbb..10d2c6bbe93a 100644 --- a/testautomation/graphics/optional/includes/global/g_tools.inc +++ b/testautomation/graphics/optional/includes/global/g_tools.inc @@ -275,8 +275,16 @@ testcase tiToolsThesaurusContextMenu end select PrintLog "Thesaurus with 1 word: " + sWord - Call hNewDocument + + printlog "Setting doc language to english" + ToolsOptions + Kontext "ExtrasOptionenDlg" + hToolsOptions("LANGUAGESETTINGS","Languages") + Westlich.Select 34 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + Call hTextrahmenErstellen (sWord,20,20,50,30) sleep 1 diff --git a/testautomation/graphics/optional/includes/impress/i_headerfooter.inc b/testautomation/graphics/optional/includes/impress/i_headerfooter.inc index d69a6762f886..390654350e29 100644 --- a/testautomation/graphics/optional/includes/impress/i_headerfooter.inc +++ b/testautomation/graphics/optional/includes/impress/i_headerfooter.inc @@ -29,7 +29,7 @@ '* '* short description : Tests the header-footer-function in Impress '* -'******************************************************************* +'\******************************************************************* testcase tiHeaderFooterSlide diff --git a/testautomation/graphics/optional/includes/impress/i_pengine1.inc b/testautomation/graphics/optional/includes/impress/i_pengine1.inc index ff4d2a035ef0..eeb6293ddb0d 100644 --- a/testautomation/graphics/optional/includes/impress/i_pengine1.inc +++ b/testautomation/graphics/optional/includes/impress/i_pengine1.inc @@ -29,7 +29,7 @@ '* '* short description : Tests the Engine for Presentation '* -'******************************************************************* +'\******************************************************************* testcase tiPengineTabEntrance diff --git a/testautomation/graphics/optional/includes/impress/i_pengine2.inc b/testautomation/graphics/optional/includes/impress/i_pengine2.inc index 56d15f6eee37..5f89299c066d 100644 --- a/testautomation/graphics/optional/includes/impress/i_pengine2.inc +++ b/testautomation/graphics/optional/includes/impress/i_pengine2.inc @@ -29,7 +29,7 @@ '* '* short description : Tests the Presentation-Engines effects '* -'******************************************************************* +'\******************************************************************* testcase tiPengineAnimationEffectsPreview dim bError as boolean diff --git a/testautomation/graphics/optional/includes/impress/i_saveloadlayout.inc b/testautomation/graphics/optional/includes/impress/i_saveloadlayout.inc index 06a7ac89cf9d..87f72b3e6673 100644 --- a/testautomation/graphics/optional/includes/impress/i_saveloadlayout.inc +++ b/testautomation/graphics/optional/includes/impress/i_saveloadlayout.inc @@ -29,7 +29,7 @@ '* '* short description: Save & Load testing of Layout -templates. '* -'************************************************************************************** +'\************************************************************************************** testcase tSaveLoadLayoutEmpty Dim NewFileDir as String diff --git a/testautomation/graphics/optional/includes/impress/i_slidelayer.inc b/testautomation/graphics/optional/includes/impress/i_slidelayer.inc index 508394144663..8b9504e7a5be 100644 --- a/testautomation/graphics/optional/includes/impress/i_slidelayer.inc +++ b/testautomation/graphics/optional/includes/impress/i_slidelayer.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'********************************************************************* +'\********************************************************************* ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") ' Inhalt.SetText ConvertPath (gTesttoolPath + "graphics\required\input\leer.sxd") diff --git a/testautomation/graphics/optional/includes/impress/i_slideshow2.inc b/testautomation/graphics/optional/includes/impress/i_slideshow2.inc index 2df33261c6f2..f409aeb2e9f6 100644 --- a/testautomation/graphics/optional/includes/impress/i_slideshow2.inc +++ b/testautomation/graphics/optional/includes/impress/i_slideshow2.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'******************************************************************* +'\******************************************************************* testcase tPraesentationAnimation diff --git a/testautomation/graphics/optional/includes/impress/i_slideshow3.inc b/testautomation/graphics/optional/includes/impress/i_slideshow3.inc index 52858e22e7cf..eee2416a1723 100644 --- a/testautomation/graphics/optional/includes/impress/i_slideshow3.inc +++ b/testautomation/graphics/optional/includes/impress/i_slideshow3.inc @@ -29,7 +29,7 @@ '* '* short description : '* -'******************************************************************* +'\******************************************************************* testcase tExtrasInteraktion diff --git a/testautomation/graphics/required/includes/global/id_001.inc b/testautomation/graphics/required/includes/global/id_001.inc index b878278961b1..509e35a52185 100644 --- a/testautomation/graphics/required/includes/global/id_001.inc +++ b/testautomation/graphics/required/includes/global/id_001.inc @@ -779,15 +779,17 @@ testcase tmFileProperties Kontext "TabDokumentInfo" Call DialogTest ( TabDokumentInfo ) - qaerrorlog "#i95523#" - 'Kontext - 'active.SetPage TabBenutzer - 'Kontext "TabBenutzer" - 'Call DialogTest ( TabBenutzer ) - 'Infofelder.Click - ' Kontext "InfonamenBearbeiten" - ' Call DialogTest (InfonamenBearbeiten) - 'InfonamenBearbeiten.Cancel + Kontext + '/// select tabpage 'Security' ///' + active.SetPage TabSecurityProperties + Kontext "TabSecurityProperties" + Call DialogTest ( TabSecurityProperties) + + Kontext + '/// select tabpage 'User defined' ///' + active.SetPage TabCustomProperties + Kontext "TabCustomProperties" + Call DialogTest ( TabCustomProperties ) Kontext active.SetPage TabInternet diff --git a/testautomation/math/required/includes/m_001_.inc b/testautomation/math/required/includes/m_001_.inc index 85546a0e222a..af5123591e62 100755 --- a/testautomation/math/required/includes/m_001_.inc +++ b/testautomation/math/required/includes/m_001_.inc @@ -636,28 +636,27 @@ testcase tmFileProperties Call DialogTest ( TabDokumentInfo ) Kontext + '/// select tabpage 'Security' ///' + active.SetPage TabSecurityProperties + Kontext "TabSecurityProperties" + Call DialogTest ( TabSecurityProperties) + + Kontext + '/// select tabpage 'User defined' ///' + active.SetPage TabCustomProperties + Kontext "TabCustomProperties" + Call DialogTest ( TabCustomProperties ) + + Kontext '/// select tabpage 'Internet' ///' active.SetPage TabInternet Kontext "TabInternet" Call DialogTest (TabInternet) + hCloseDialog( TabInternet, "cancel" ) '/// close application ///' Call hCloseDocument - qaerrorlog "#i95523# Custom Properties is not controlable by VCL TestTool Application" - goto endsub - - Kontext - '/// select tabpage 'User defined' ///' - active.SetPage TabBenutzer - Kontext "TabBenutzer" - Call DialogTest ( TabBenutzer ) - '/// click button 'info fields' ///' - Infofelder.Click - Kontext "InfonamenBearbeiten" - Call DialogTest (InfonamenBearbeiten) - '/// close dialog 'edit field names' ///' - hCloseDialog( InfoNamenBearbeiten, "cancel" ) endcase testcase tmFilePrinterSetting diff --git a/testautomation/spreadsheet/optional/includes/so7pp1/c_so7_pp1_iz.inc b/testautomation/spreadsheet/optional/includes/so7pp1/c_so7_pp1_iz.inc index 873ca1bddabc..4777fc60917f 100644 --- a/testautomation/spreadsheet/optional/includes/so7pp1/c_so7_pp1_iz.inc +++ b/testautomation/spreadsheet/optional/includes/so7pp1/c_so7_pp1_iz.inc @@ -104,11 +104,7 @@ testcase tIZ19381 sleep(2) Kontext if Active.exists(2) then - if gPlatGroup = "w95" then - warnlog "REGRESSION! #i41751# - Saving after Cut&Paste of OLE fails on windows!" - else - warnlog "OOPS, found unexpected MsgBox -> Check this out!" - end if + warnlog "OOPS, found unexpected MsgBox -> Check this out!" Active.OK call hCloseDocument goto endsub @@ -202,7 +198,7 @@ testcase tIZ21036 try printlog "OK, there are still " & GetDocumentCount & " documents open" catch - warnlog "Probably the office did crash -> #I21036#" + warnlog "Probably the office did crash" goto endsub endcatch diff --git a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc index 33c52111c384..cf52ad4c7647 100644 --- a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc @@ -658,7 +658,7 @@ testcase tFileSaveAsDBF Kontext if Active.exists(2) then printlog " " - warnlog "#i87325# - Unexpected messagebox" + warnlog "Unexpected messagebox" Printlog Active.GetText Printlog " " Active.OK diff --git a/testautomation/spreadsheet/required/includes/c_upd_insertmenu.inc b/testautomation/spreadsheet/required/includes/c_upd_insertmenu.inc index b8c749c27cd9..b9c4b7d3b2ca 100644 --- a/testautomation/spreadsheet/required/includes/c_upd_insertmenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_insertmenu.inc @@ -1204,7 +1204,7 @@ testcase tInsertObjectFormular Kontext "SelectionMath" call DialogTest (SelectionMath) catch - qaerrorlog "#i93427# Math Selection Dialog is not available" + warnlog "Math Selection Dialog is not available" endcatch end if '/// Close Formular with 'Esc' diff --git a/testautomation/spreadsheet/required/includes/c_upd_viewmenu.inc b/testautomation/spreadsheet/required/includes/c_upd_viewmenu.inc index e7568390c38a..99d8c9823776 100644 --- a/testautomation/spreadsheet/required/includes/c_upd_viewmenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_viewmenu.inc @@ -173,8 +173,12 @@ testcase tViewToolbars TabCustomizeMenu.Cancel '/// Reset toolbars by 'View - Toolbars - Reset' printlog " Reset toolbars by 'View - Toolbars - Reset'" + Kontext "DocumentCalc" + DocumentCalc.UseMenu 'Selecting Menubar + hMenuSelectNr(3) 'Using third entry on Menubar (VIEW) + hMenuSelectNr(3) 'Using third entry on menu (TOOLBARS) + hMenuFindSelect(22, true, 22) 'Using last entry on menu (RESET) ' ViewToolbarsReset - qaerrorlog "Reset not possible because of #i84544" '/// Close document printlog " Close starting document" call hCloseDocument diff --git a/testautomation/writer/required/includes/w_001a_.inc b/testautomation/writer/required/includes/w_001a_.inc index cb9739cd00dd..d41a89fc7d61 100644 --- a/testautomation/writer/required/includes/w_001a_.inc +++ b/testautomation/writer/required/includes/w_001a_.inc @@ -88,22 +88,23 @@ testcase tFileProperties Kontext "TabDokumentinfo" Call DialogTest (TabDokumentinfo) + Kontext + printlog " Switch to Tabpage 'Security'" + active.SetPage TabSecurityProperties + Kontext "TabSecurityProperties" + Call DialogTest ( TabSecurityProperties) + printlog " Click button 'Protect...'" + Protect.click + kontext "PasswordDLG" + Call DialogTest (PasswordDLG) + printlog " Cancel dialog 'Password'" + PasswordDLG.cancel - Warnlog "#i95523# - FileProperties - Tabpage 'User Defined' has changed. - Adaption of testcases needed." - ' printlog " Switch to Tabpage 'User defined'" - ' Kontext - ' active.SetPage TabBenutzer - ' Kontext "TabBenutzer" - ' Call DialogTest ( TabBenutzer ) - - ' Wait 500 - - ' Infofelder.Click - ' printlog " Click 'Infofields'" - ' Kontext "InfonamenBearbeiten" - ' printlog " Close upcoming dialog with 'Cancel'" - ' Call DialogTest (InfonamenBearbeiten) - ' InfonamenBearbeiten.Cancel + Kontext + printlog " Switch to Tabpage 'User defined'" + active.SetPage TabCustomProperties + Kontext "TabCustomProperties" + Call DialogTest ( TabCustomProperties ) printlog " Switch to Tabpage 'Internet'" Kontext diff --git a/testautomation/writer/required/includes/w_002_.inc b/testautomation/writer/required/includes/w_002_.inc index e19b37514c99..0acd4d4a587c 100644 --- a/testautomation/writer/required/includes/w_002_.inc +++ b/testautomation/writer/required/includes/w_002_.inc @@ -1300,7 +1300,7 @@ testcase tEditImageMap printlog( "Check for <Imagemap changed> messagebox (should not appear)" ) kontext "Active" if ( Active.exists( 1 ) ) then - Warnlog( "<imagemap changed> message displayed." ) + Warnlog( "#i117432#<imagemap changed> message displayed." ) printlog( Active.getText ) Active.no() else diff --git a/testautomation/writer/required/w_updt.bas b/testautomation/writer/required/w_updt_1.bas index b8779647281b..c6f633ec7375 100755..100644 --- a/testautomation/writer/required/w_updt.bas +++ b/testautomation/writer/required/w_updt_1.bas @@ -27,7 +27,7 @@ '* '* owner : helge.delfs@oracle.com '* -'* short description : Ressource-Test Writer Document +'* short description : Ressource-Test Writer Document Part 1 / 2 '* '\****************************************************************** @@ -45,20 +45,12 @@ sub main use "writer\required\includes\w_004b_.inc" use "writer\required\includes\w_005_.inc" use "writer\required\includes\w_005b_.inc" - use "writer\required\includes\w_006_.inc" - use "writer\required\includes\w_007_.inc" - use "writer\required\includes\w_008_.inc" - use "writer\required\includes\w_009_.inc" - use "writer\required\includes\w_010_.inc" - use "writer\required\includes\w_010_1.inc" - use "writer\required\includes\w_011_.inc" - use "writer\required\includes\w_020_.inc" - Printlog "******* Ressource-Test Writer Document *******" + Printlog "******* Ressource-Test Writer Document Part 1 / 2 *******" Call wChangeDefaultView() - Call hStatusIn ( "writer", "w_updt.bas" ) + Call hStatusIn ( "writer", "w_updt_1.bas" ) Call w_001_ ' Menu File Call w_001a_ ' Menu File Call w_001b_ ' Menu File @@ -68,14 +60,6 @@ sub main Call w_004b_ ' Menu Insert Call w_005_ ' Menu Format Call w_005b_ ' Menu Format (2) - Call w_006_ ' Menu Table - Call w_007_ ' Menu Tools - Call w_008_ ' Menu Window - Call w_009_ ' Menu Help - Call w_010_ ' Objectbar - Call w_010_1 ' Objectbar. Part 2 - Call w_011_ ' Rest of Objectbar - Call w_020_ ' Toolbar Call hStatusOut end sub @@ -84,9 +68,7 @@ sub LoadIncludeFiles use "global\system\includes\master.inc" use "global\system\includes\gvariabl.inc" use "global\required\includes\g_001.inc" - use "global\required\includes\g_option.inc" ' global subroutines for Tools / Options use "global\required\includes\g_printing.inc" - use "global\required\includes\g_findbar.inc" use "global\tools\includes\optional\t_xml_filter1.inc" ' global routines for XML-functionality use "global\tools\includes\optional\t_docfuncs.inc" use "global\tools\includes\optional\t_control_objects.inc" diff --git a/testautomation/writer/required/w_updt_2.bas b/testautomation/writer/required/w_updt_2.bas new file mode 100644 index 000000000000..6bbf7bb6a771 --- /dev/null +++ b/testautomation/writer/required/w_updt_2.bas @@ -0,0 +1,75 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' 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. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Ressource-Test Writer Document Part 2 / 2 +'* +'\****************************************************************** + +sub main + use "writer\tools\includes\w_tools.inc" ' global subroutines for Writer-application + use "writer\tools\includes\w_tool1.inc" ' global subroutines for Writer-application + use "writer\tools\includes\w_tool2.inc" ' global subroutines for Writer-application + + use "writer\required\includes\w_006_.inc" + use "writer\required\includes\w_007_.inc" + use "writer\required\includes\w_008_.inc" + use "writer\required\includes\w_009_.inc" + use "writer\required\includes\w_010_.inc" + use "writer\required\includes\w_010_1.inc" + use "writer\required\includes\w_011_.inc" + use "writer\required\includes\w_020_.inc" + + Printlog "******* Ressource-Test Writer Document Part 2 / 2 *******" + + Call wChangeDefaultView() + + Call hStatusIn ( "writer", "w_updt_2.bas" ) + Call w_006_ ' Menu Table + Call w_007_ ' Menu Tools + Call w_008_ ' Menu Window + Call w_009_ ' Menu Help + Call w_010_ ' Objectbar + Call w_010_1 ' Objectbar. Part 2 + Call w_011_ ' Rest of Objectbar + Call w_020_ ' Toolbar + Call hStatusOut + +end sub + +sub LoadIncludeFiles + use "global\system\includes\master.inc" + use "global\system\includes\gvariabl.inc" + use "global\required\includes\g_option.inc" ' global subroutines for Tools / Options + use "global\required\includes\g_findbar.inc" + use "global\tools\includes\optional\t_docfuncs.inc" + use "global\tools\includes\optional\t_control_objects.inc" + + gApplication = "WRITER" + GetUseFiles () +end sub diff --git a/toolkit/JunitTest_toolkit_complex.mk b/toolkit/JunitTest_toolkit_complex.mk new file mode 100755 index 000000000000..77bf7544afc1 --- /dev/null +++ b/toolkit/JunitTest_toolkit_complex.mk @@ -0,0 +1,56 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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. +# +#************************************************************************* + +$(eval $(call gb_JunitTest_JunitTest,toolkit_complex)) + +$(eval $(call gb_JunitTest_add_jars,toolkit_complex,\ + $(OUTDIR)/bin/OOoRunner.jar \ + $(OUTDIR)/bin/ridl.jar \ + $(OUTDIR)/bin/test.jar \ + $(OUTDIR)/bin/unoil.jar \ +)) + +$(eval $(call gb_JunitTest_add_sourcefiles,toolkit_complex,\ + toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent \ + toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext \ + toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster \ + toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent \ + toolkit/qa/complex/toolkit/accessibility/_XAccessibleText \ + toolkit/qa/complex/toolkit/Assert \ + toolkit/qa/complex/toolkit/awtgrid/GridDataListener \ + toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel \ + toolkit/qa/complex/toolkit/awtgrid/DummyColumn \ + toolkit/qa/complex/toolkit/GridControl \ + toolkit/qa/complex/toolkit/UnitConversion \ +)) + +$(eval $(call gb_JunitTest_add_classes,toolkit_complex,\ + complex.toolkit.GridControl \ + complex.toolkit.UnitConversion \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/toolkit/Module_toolkit.mk b/toolkit/Module_toolkit.mk index 858aecd1c13d..beb7dbc4971f 100644 --- a/toolkit/Module_toolkit.mk +++ b/toolkit/Module_toolkit.mk @@ -36,6 +36,7 @@ $(eval $(call gb_Module_add_targets,toolkit,\ )) $(eval $(call gb_Module_add_subsequentcheck_targets,toolkit,\ + JunitTest_toolkit_complex \ JunitTest_toolkit_unoapi \ )) diff --git a/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx index d4fe2a727b43..f9c7b01da551 100644 --- a/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx +++ b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx @@ -63,12 +63,12 @@ public: // ::com::sun::star::awt::grid::XTabPageContainer virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } diff --git a/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx index 670ed25c0f2d..5d8237f2cacc 100644 --- a/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx +++ b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx @@ -74,8 +74,8 @@ public: virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTip() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException); protected: ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); }; diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx index 3090eba68749..c607a48f66cd 100644 --- a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx +++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx @@ -173,8 +173,8 @@ public: virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTip() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException); protected: void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); diff --git a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx index c7a2e3b8ef90..c660edf2e3e9 100644 --- a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx +++ b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx @@ -76,28 +76,29 @@ public: // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, szServiceName_UnoControlTabPageContainerModel ) + + // XTabPageContainerModel + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > SAL_CALL createTabPage( ::sal_Int16 TabPageID ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > SAL_CALL loadTabPage( ::sal_Int16 TabPageID, const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + // XIndexContainer virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - // XIndexReplace + // XIndexReplace virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - // XIndexAccess + // XIndexAccess virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - // XElementAccess + // XElementAccess virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException); - //{ - //return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); - //} - virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::container::XContainer @@ -125,12 +126,12 @@ public: // ::com::sun::star::awt::tab::XTabPageContainer virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTabPageContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo diff --git a/toolkit/inc/toolkit/controls/tabpagemodel.hxx b/toolkit/inc/toolkit/controls/tabpagemodel.hxx index 08938669fa58..68924b831af4 100644 --- a/toolkit/inc/toolkit/controls/tabpagemodel.hxx +++ b/toolkit/inc/toolkit/controls/tabpagemodel.hxx @@ -33,7 +33,6 @@ #include <com/sun/star/awt/tab/XTabPage.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> #include "toolkit/helper/servicenames.hxx" #include "toolkit/helper/macros.hxx" #include <toolkit/controls/unocontrolcontainer.hxx> @@ -41,55 +40,6 @@ #include <list> #include <cppuhelper/implbase2.hxx> -// ---------------------------------------------------- -// class TabPageModel -// ---------------------------------------------------- -//typedef ::cppu::ImplHelper2< ::com::sun::star::awt::tab::XTabPageModel, -// ::com::sun::star::lang::XInitialization -// > TabPageAccess_BASE; -// -//class TabPageModel : public TabPageAccess_BASE -//{ -// -//private: -// bool m_bEnabled; -// ::rtl::OUString m_sTitle; -// ::rtl::OUString m_sImageURL; -// ::rtl::OUString m_sTooltip; -// sal_Int16 m_nTabPageId; -// -//public: -// TabPageModel(); -// explicit TabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCompContext); -// ~TabPageModel(); -// -// // XInitialization -// virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments) -// throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); -// -// ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); -// void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } -// void SAL_CALL release() throw() { OWeakAggObject::release(); } -// -// // ::com::sun::star::lang::XTypeProvider -// //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); -// //::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); -// -// // ::com::sun::star::awt::tab::XTabPageModel -// virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException); -// virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException); -// virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException); -// virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); -// virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException); -// virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException); -// virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException); -// virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException); -// virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException); -//}; -// ---------------------------------------------------- -// class UnoControlTabPageModel -// ---------------------------------------------------- - class UnoControlTabPageModel : public ControlModelContainerBase //public TabPageModel { diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index c2d6380dcb65..03cd972940a7 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -206,6 +206,10 @@ namespace rtl { #define BASEPROPERTY_ROW_HEADER_WIDTH 155 #define BASEPROPERTY_COLUMN_HEADER_HEIGHT 156 #define BASEPROPERTY_USE_GRID_LINES 157 +#define BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR 158 +#define BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR 159 +#define BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR 160 +#define BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR 161 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst index e11d32c435bf..a0ddbffd8718 100644 --- a/toolkit/prj/build.lst +++ b/toolkit/prj/build.lst @@ -1,3 +1,2 @@ ti toolkit : LIBXSLT:libxslt vcl qadevOOo test NULL ti toolkit\prj nmake - all ti_prj NULL -ti toolkit\qa\complex\toolkit nmake - all ti_complex_toolkit NULL diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java index a06a52342417..22d6e10c7b60 100755..100644 --- a/toolkit/qa/complex/toolkit/GridControl.java +++ b/toolkit/qa/complex/toolkit/GridControl.java @@ -33,6 +33,7 @@ import com.sun.star.awt.XToolkit; import com.sun.star.awt.grid.DefaultGridDataModel; import com.sun.star.awt.grid.XGridColumn; import com.sun.star.awt.grid.XGridColumnModel; +import com.sun.star.awt.grid.XGridControl; import com.sun.star.awt.grid.XGridDataModel; import com.sun.star.awt.grid.XMutableGridDataModel; import com.sun.star.awt.grid.XSortableMutableGridDataModel; @@ -59,6 +60,8 @@ import java.util.List; import java.util.Random; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import org.openoffice.test.OfficeConnection; @@ -205,6 +208,8 @@ public class GridControl TMutableGridDataModel test = new TMutableGridDataModel( m_dataModel ); test.testAddRow(); test.testAddRows(); + test.testInsertRow(); + test.testInsertRows(); test.testRemoveRow(); test.testRemoveAllRows(); test.testUpdateCellData(); @@ -326,6 +331,33 @@ public class GridControl // ----------------------------------------------------------------------------------------------------------------- @Test + public void testDataModel() throws Exception + { + impl_recreateGridModel(); + + // ensure that getCellData and getRowData have the same opinion on the data they deliver + final Object[][] data = new Object[][] { + new Object[] { 15, 17, 0 }, + new Object[] { 9, 8, 14 }, + new Object[] { 17, 2, 16 }, + new Object[] { 0, 7, 14 }, + new Object[] { 10, 16, 16 }, + }; + m_dataModel.addRows( new Object[ data.length ], data ); + + for ( int row = 0; row < data.length; ++row ) + { + assertArrayEquals( "getRowData delivers wrong data in row " + row, data[row], m_dataModel.getRowData( row ) ); + for ( int col = 0; col < data[row].length; ++col ) + { + assertEquals( "getCellData delivers wrong data at position (" + col + ", " + row + ")", + data[row][col], m_dataModel.getCellData( col, row ) ); + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test public void testSortableDataModel() throws Exception { impl_recreateGridModel(); @@ -403,63 +435,88 @@ public class GridControl // ----------------------------------------------------------------------------------------------------------------- @Test - public void testModelViewInteraction() throws Exception + public void testView() throws Exception { - final List< Object > disposables = new ArrayList< Object >(); - try - { - // create a siple dialog model/control/peer trinity - final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" ); - disposables.add( dialogModel ); - final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel ); - dialogProps.setPropertyValue( "Width", 200 ); - dialogProps.setPropertyValue( "Height", 100 ); - dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" ); - final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" ); - disposables.add( dialogControl ); - dialogControl.setModel( dialogModel ); - dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null ); - - // insert a grid control model - final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, - dialogModel ); - XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class, - controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) ); - disposables.add( gridModelProps ); - gridModelProps.setPropertyValue( "PositionX", 6 ); - gridModelProps.setPropertyValue( "PositionY", 6 ); - gridModelProps.setPropertyValue( "Width", 188 ); - gridModelProps.setPropertyValue( "Height", 88 ); - final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel ); - modelContainer.insertByName( "grid", gridModelProps ); - - // check the respective control has been created - final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl ); - final XControl gridControl = controlContainer.getControl( "grid" ); - assertNotNull( "no grid control created in the dialog", gridControl ); - - // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer) - // ensures that if there are no columns in the column model, but in the data model, then the column model - // will implicitly have the needed columns added. - // To ensure that clients which rely on this do not break in the future, check this here. - final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class, - gridModelProps.getPropertyValue( "GridDataModel" ) ); - assertNotNull( dataModel ); - assertEquals( 0, dataModel.getColumnCount() ); - - final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, - gridModelProps.getPropertyValue( "ColumnModel" ) ); - assertNotNull( columnModel ); - assertEquals( 0, columnModel.getColumnCount() ); - - dataModel.addRow( null, new Object[] { 1, 2, 3 } ); - assertEquals( 3, dataModel.getColumnCount() ); - assertEquals( 3, columnModel.getColumnCount() ); - } - finally - { - impl_dispose( disposables.toArray()); - } + final XControl control = impl_createDialogWithGridControl(); + final XPropertySet gridModelProps = + UnoRuntime.queryInterface( XPropertySet.class, control.getModel() ); + + // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer) + // ensures that if there are no columns in the column model, but in the data model, then the column model + // will implicitly have the needed columns added. + // To ensure that clients which rely on this do not break in the future, check this here. + final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class, + gridModelProps.getPropertyValue( "GridDataModel" ) ); + assertNotNull( dataModel ); + assertEquals( 0, dataModel.getColumnCount() ); + + final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, + gridModelProps.getPropertyValue( "ColumnModel" ) ); + assertNotNull( columnModel ); + assertEquals( 0, columnModel.getColumnCount() ); + + final int columnCount = 3; + final int rowCount = 2; + dataModel.addRow( null, new Object[] { 1, 2, 3 } ); + dataModel.addRow( null, new Object[] { 6, 5, 4 } ); + + assertEquals( columnCount, dataModel.getColumnCount() ); + assertEquals( columnCount, columnModel.getColumnCount() ); + + // some cursor traveling + final XGridControl gridControl = UnoRuntime.queryInterface( XGridControl.class, control ); + gridControl.goToCell( 0, 0 ); + assertEquals( "wrong 'current column' (1)", 0, gridControl.getCurrentColumn() ); + assertEquals( "wrong 'current row' (1)", 0, gridControl.getCurrentRow() ); + gridControl.goToCell( columnCount - 1, rowCount - 1 ); + assertEquals( "wrong 'current column' (2)", dataModel.getColumnCount() - 1, gridControl.getCurrentColumn() ); + assertEquals( "wrong 'current row' (2)", dataModel.getRowCount() - 1, gridControl.getCurrentRow() ); + + // removing the last column, while the active cell is in this very last column, is expected to adjust + // the active cell + columnModel.removeColumn( columnCount - 1 ); + assertEquals( "removed the last and active column, active column was not adjusted!", + columnCount - 2, gridControl.getCurrentColumn() ); + // same holds for rows + dataModel.removeRow( rowCount - 1 ); + assertEquals( "removed the last and active row, active row was not adjusted!", + rowCount - 2, gridControl.getCurrentRow() ); + } + + // ----------------------------------------------------------------------------------------------------------------- + private XControl impl_createDialogWithGridControl() throws Exception + { + // create a simple dialog model/control/peer trinity + final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" ); + m_disposables.add( dialogModel ); + final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel ); + dialogProps.setPropertyValue( "Width", 200 ); + dialogProps.setPropertyValue( "Height", 100 ); + dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" ); + final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" ); + m_disposables.add( dialogControl ); + dialogControl.setModel( dialogModel ); + dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null ); + + // insert a grid control model + final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, + dialogModel ); + final XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class, + controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) ); + m_disposables.add( gridModelProps ); + gridModelProps.setPropertyValue( "PositionX", 6 ); + gridModelProps.setPropertyValue( "PositionY", 6 ); + gridModelProps.setPropertyValue( "Width", 188 ); + gridModelProps.setPropertyValue( "Height", 88 ); + final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel ); + modelContainer.insertByName( "grid", gridModelProps ); + + // check the respective control has been created + final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl ); + final XControl gridControl = controlContainer.getControl( "grid" ); + assertNotNull( "no grid control created in the dialog", gridControl ); + + return gridControl; } // ----------------------------------------------------------------------------------------------------------------- @@ -554,6 +611,20 @@ public class GridControl } // ----------------------------------------------------------------------------------------------------------------- + @Before + public void initTestCase() + { + m_disposables.clear(); + } + + // ----------------------------------------------------------------------------------------------------------------- + @After + public void cleanupTestCase() + { + impl_dispose( m_disposables.toArray() ); + } + + // ----------------------------------------------------------------------------------------------------------------- @BeforeClass public static void setUpConnection() throws java.lang.Exception { @@ -684,4 +755,5 @@ public class GridControl private XPropertySet m_gridControlModel; private XGridColumnModel m_columnModel; private XSortableMutableGridDataModel m_dataModel; + private final List< Object > m_disposables = new ArrayList< Object >(); } diff --git a/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java index c550dd9a047d..7f3c8fb55541 100755..100644 --- a/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java +++ b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java @@ -53,14 +53,14 @@ public class TMutableGridDataModel */ public void testAddRow() throws IndexOutOfBoundsException { - m_dataModel.addRow( 1, m_rowValues[0] ); + m_dataModel.addRow( m_rowHeadings[0], m_rowValues[0] ); GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); m_listener.reset(); assertEquals( "row insertion: wrong FirstRow (1)", 0, event.FirstRow ); assertEquals( "row insertion: wrong LastRow (1)", 0, event.LastRow ); impl_assertRowData( 0 ); - m_dataModel.addRow( 2, m_rowValues[1] ); + m_dataModel.addRow( m_rowHeadings[1], m_rowValues[1] ); event = m_listener.assertSingleRowInsertionEvent(); m_listener.reset(); assertEquals( "row insertion: wrong FirstRow (2)", 1, event.FirstRow ); @@ -75,7 +75,9 @@ public class TMutableGridDataModel { assertEquals( "precondition not met: call this directly after testAddRow, please!", 2, m_dataModel.getRowCount() ); - m_dataModel.addRows( new Object[] { "3", 4.0, "5" }, new Object[][] { m_rowValues[2], m_rowValues[3], m_rowValues[4] } ); + m_dataModel.addRows( + new Object[] { m_rowHeadings[2], m_rowHeadings[3], m_rowHeadings[4] }, + new Object[][] { m_rowValues[2], m_rowValues[3], m_rowValues[4] } ); GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); assertEquals( "row insertion: wrong FirstRow (1)", 2, event.FirstRow ); assertEquals( "row insertion: wrong LastRow (1)", 4, event.LastRow ); @@ -97,6 +99,145 @@ public class TMutableGridDataModel } /** + * tests the XMutableGridDataModel.insertRow method + */ + public void testInsertRow() throws IndexOutOfBoundsException + { + int expectedRowCount = m_rowValues.length; + assertEquals( "precondition not met: call this directly after testAddRows, please!", expectedRowCount, m_dataModel.getRowCount() ); + + // inserting some row somewhere between the other rows + final Object heading = "inbetweenRow"; + final Object[] inbetweenRow = new Object[] { "foo", "bar", 3, 4, 5 }; + final int insertionPos = 2; + m_dataModel.insertRow( insertionPos, heading, inbetweenRow ); + ++expectedRowCount; + assertEquals( "inserting a row is expected to increment the row count", + expectedRowCount, m_dataModel.getRowCount() ); + + final GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); + assertEquals( "inserting a row results in wrong FirstRow being notified", insertionPos, event.FirstRow ); + assertEquals( "inserting a row results in wrong LastRow being notified", insertionPos, event.LastRow ); + m_listener.reset(); + + for ( int row=0; row<expectedRowCount; ++row ) + { + final Object[] actualRowData = m_dataModel.getRowData( row ); + final Object[] expectedRowData = + ( row < insertionPos ) + ? m_rowValues[ row ] + : ( row == insertionPos ) + ? inbetweenRow + : m_rowValues[ row - 1 ]; + assertArrayEquals( "row number " + row + " has wrong content content after inserting a row", + expectedRowData, actualRowData ); + + final Object actualHeading = m_dataModel.getRowHeading(row); + final Object expectedHeading = + ( row < insertionPos ) + ? m_rowHeadings[ row ] + : ( row == insertionPos ) + ? heading + : m_rowHeadings[ row - 1 ]; + assertEquals( "row " + row + " has a wrong heading after invoking insertRow", + expectedHeading, actualHeading ); + } + + // exceptions + assertException( "inserting a row at a position > rowCount is expected to throw", + m_dataModel, "insertRow", + new Class[] { Integer.class, Object.class, Object[].class }, + new Object[] { expectedRowCount + 1, "", new Object[] { "1", 2, 3 } }, + IndexOutOfBoundsException.class ); + assertException( "inserting a row at a position < 0 is expected to throw", + m_dataModel, "insertRow", + new Class[] { Integer.class, Object.class, Object[].class }, + new Object[] { -1, "", new Object[] { "1", 2, 3 } }, + IndexOutOfBoundsException.class ); + + // remove the row, to create the situation expected by the next test + m_dataModel.removeRow( insertionPos ); + m_listener.reset(); + } + + /** + * tests the XMutableGridDataModel.insertRows method + */ + public void testInsertRows() throws IndexOutOfBoundsException, IllegalArgumentException + { + int expectedRowCount = m_rowValues.length; + assertEquals( "precondition not met: call this directly after testInsertRow, please!", expectedRowCount, m_dataModel.getRowCount() ); + + // inserting some rows somewhere between the other rows + final int insertionPos = 3; + final Object[] rowHeadings = new Object[] { "A", "B", "C" }; + final Object[][] rowData = new Object[][] { + new Object[] { "A", "B", "C", "D", "E" }, + new Object[] { "J", "I", "H", "G", "F" }, + new Object[] { "K", "L", "M", "N", "O" } + }; + final int insertedRowCount = rowData.length; + assertEquals( "invalid test data", rowHeadings.length, insertedRowCount ); + + m_dataModel.insertRows( insertionPos, rowHeadings, rowData ); + expectedRowCount += insertedRowCount; + + final GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); + assertEquals( "inserting multiple rows results in wrong FirstRow being notified", + insertionPos, event.FirstRow ); + assertEquals( "inserting multiple rows results in wrong LastRow being notified", + insertionPos + insertedRowCount - 1, event.LastRow ); + m_listener.reset(); + + for ( int row=0; row<expectedRowCount; ++row ) + { + final Object[] actualRowData = m_dataModel.getRowData( row ); + final Object[] expectedRowData = + ( row < insertionPos ) + ? m_rowValues[ row ] + : ( row >= insertionPos ) && ( row < insertionPos + insertedRowCount ) + ? rowData[ row - insertionPos ] + : m_rowValues[ row - insertedRowCount ]; + assertArrayEquals( "row number " + row + " has wrong content content after inserting multiple rows", + expectedRowData, actualRowData ); + + final Object actualHeading = m_dataModel.getRowHeading(row); + final Object expectedHeading = + ( row < insertionPos ) + ? m_rowHeadings[ row ] + : ( row >= insertionPos ) && ( row < insertionPos + insertedRowCount ) + ? rowHeadings[ row - insertionPos ] + : m_rowHeadings[ row - insertedRowCount ]; + assertEquals( "row " + row + " has a wrong heading after invoking insertRows", + expectedHeading, actualHeading ); + } + + // exceptions + assertException( "inserting multiple rows at a position > rowCount is expected to throw an IndexOutOfBoundsException", + m_dataModel, "insertRows", + new Class[] { Integer.class, Object[].class, Object[][].class }, + new Object[] { expectedRowCount + 1, new Object[0], new Object[][] { } }, + IndexOutOfBoundsException.class ); + assertException( "inserting multiple rows at a position < 0 is expected to throw an IndexOutOfBoundsException", + m_dataModel, "insertRows", + new Class[] { Integer.class, Object[].class, Object[][].class }, + new Object[] { -1, new Object[0], new Object[][] { } }, + IndexOutOfBoundsException.class ); + assertException( "inserting multiple rows with inconsistent array lengths is expected to throw an IllegalArgumentException", + m_dataModel, "insertRows", + new Class[] { Integer.class, Object[].class, Object[][].class }, + new Object[] { 0, new Object[0], new Object[][] { new Object[0] } }, + IllegalArgumentException.class ); + + // remove the row, to create the situation expected by the next test + for ( int i=0; i<insertedRowCount; ++i ) + { + m_dataModel.removeRow( insertionPos ); + m_listener.reset(); + } + } + + /** * tests the XMutableGridDataModel.removeRow method */ public void testRemoveRow() throws IndexOutOfBoundsException @@ -150,7 +291,7 @@ public class TMutableGridDataModel { assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", 0, m_dataModel.getRowCount() ); - m_dataModel.addRows( new Object[] { 1, 2, 3, 4, 5 }, m_rowValues ); + m_dataModel.addRows( m_rowHeadings, m_rowValues ); m_listener.assertSingleRowInsertionEvent(); m_listener.reset(); @@ -311,4 +452,8 @@ public class TMutableGridDataModel new Object[] { 4, 5, 6, 7, "8" }, new Object[] { 5, "6", 7, 8, 9 }, }; + + private final static Object[] m_rowHeadings = new Object[] { + "1", 2, 3.0, "4", (float)5.0 + }; } diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk deleted file mode 100755 index ecb173f9bdac..000000000000 --- a/toolkit/qa/complex/toolkit/makefile.mk +++ /dev/null @@ -1,97 +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. -# -#************************************************************************* - -.IF "$(OOO_JUNIT_JAR)" == "" -nothing .PHONY: - @echo ----------------------------------------------------- - @echo - JUnit not available, not building anything - @echo ----------------------------------------------------- -.ELSE # IF "$(OOO_JUNIT_JAR)" != "" - -PRJ = ../../.. -PRJNAME = toolkit -TARGET = qa_complex_toolkit -PACKAGE = complex/toolkit - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - -#----- compile .java files ----------------------------------------- - -JARFILES = OOoRunnerLight.jar ridl.jar test.jar unoil.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - -JAVAFILES = \ - $(JAVATESTFILES) \ - accessibility/_XAccessibleComponent.java \ - accessibility/_XAccessibleContext.java \ - accessibility/_XAccessibleEventBroadcaster.java \ - accessibility/_XAccessibleExtendedComponent.java \ - accessibility/_XAccessibleText.java \ - Assert.java \ - awtgrid/GridDataListener.java \ - awtgrid/TMutableGridDataModel.java \ - awtgrid/DummyColumn.java \ - -#----- create a jar from compiled files ---------------------------- - -JARTARGET = $(TARGET).jar - -#----- JUnit tests class ------------------------------------------- - -JAVATESTFILES = \ - GridControl.java \ - UnitConversion.java \ - - -# disabled for now - the tests fail on at least one platform -# no issue, yet (not sure this is worth it. Don't know who to give the issue to, and don't know whether the test really makes sense) -DISABLED_JAVA_TEST_FILES=\ - AccessibleStatusBar.java\ - AccessibleStatusBarItem.java - - -# --- Targets ------------------------------------------------------ - -.INCLUDE: target.mk - -ALL : ALLTAR - -# --- subsequent tests --------------------------------------------- - -.IF "$(OOO_SUBSEQUENT_TESTS)" != "" - -.INCLUDE: installationtest.mk - -ALLTAR : javatest - - # Sample how to debug - # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y - -.END # "$(OOO_SUBSEQUENT_TESTS)" == "" - -.END # ELSE "$(OOO_JUNIT_JAR)" != "" diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk deleted file mode 100644 index 9517601c3917..000000000000 --- a/toolkit/qa/unoapi/makefile.mk +++ /dev/null @@ -1,48 +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. -#***********************************************************************/ - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../.. -PRJNAME = toolkit -TARGET = qa_unoapi - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = org/openoffice/toolkit/qa/unoapi -JAVATESTFILES = Test.java -JAVAFILES = $(JAVATESTFILES) -JARFILES = OOoRunner.jar ridl.jar test.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx index d4f7a5048701..64337153dac1 100644 --- a/toolkit/source/awt/vclxtabpagecontainer.cxx +++ b/toolkit/source/awt/vclxtabpagecontainer.cxx @@ -126,7 +126,7 @@ void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpa if ( pTabCtrl ) pTabCtrl->SelectTabPage(_activetabpageid); } -::sal_Int32 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException) +::sal_Int16 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException) { TabControl* pTabCtrl = (TabControl*)GetWindow(); return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0; @@ -157,11 +157,11 @@ Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer: } return xTabPage; } -void SAL_CALL VCLXTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) +void SAL_CALL VCLXTabPageContainer::addTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) { m_aTabPageListeners.addInterface( listener ); } -void SAL_CALL VCLXTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) +void SAL_CALL VCLXTabPageContainer::removeTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) { m_aTabPageListeners.removeInterface( listener ); } @@ -209,7 +209,7 @@ void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::con pPage->Hide(); pTabCtrl->SetTabPage(nPageID,pPage); - pTabCtrl->SetHelpText(nPageID,xP->getTooltip()); + pTabCtrl->SetHelpText(nPageID,xP->getToolTip()); pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL())); pTabCtrl->SelectTabPage(nPageID); m_aTabPages.push_back(xTabPage); diff --git a/toolkit/source/awt/vclxtabpagemodel.cxx b/toolkit/source/awt/vclxtabpagemodel.cxx index c7145992bd7f..936a2301dcb4 100644 --- a/toolkit/source/awt/vclxtabpagemodel.cxx +++ b/toolkit/source/awt/vclxtabpagemodel.cxx @@ -124,12 +124,12 @@ void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl* { //m_sImageURL = _imageurl; } -::rtl::OUString SAL_CALL VCLXTabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException) +::rtl::OUString SAL_CALL VCLXTabPageModel::getToolTip() throw (::com::sun::star::uno::RuntimeException) { //return m_sTooltip; return ::rtl::OUString::createFromAscii(""); } -void SAL_CALL VCLXTabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXTabPageModel::setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) { (void)_tooltip; } diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 25f30cb88d34..aa7452113652 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -39,14 +39,14 @@ #include <toolkit/controls/unocontrols.hxx> #include "toolkit/controls/formattedcontrol.hxx" #include "toolkit/controls/roadmapcontrol.hxx" -#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX #include "toolkit/controls/tkscrollbar.hxx" -#endif +#include "toolkit/controls/tabpagemodel.hxx" #include <toolkit/controls/stdtabcontroller.hxx> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <tools/list.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> @@ -389,6 +389,8 @@ Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl:: pNewModel = new OGeometryControlModel< UnoGridModel >( xFactory ); else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 ) pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >( xFactory ); + else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageModel ) == 0 ) + pNewModel = new OGeometryControlModel< UnoControlTabPageModel >( xFactory ); if ( !pNewModel ) { @@ -417,9 +419,13 @@ Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl:: return xNewModel; } -Reference< XInterface > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException) +Reference< XInterface > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& i_arguments ) throw(Exception, RuntimeException) { - return createInstance( ServiceSpecifier ); + const Reference< XInterface > xInstance( createInstance( ServiceSpecifier ) ); + const Reference< XInitialization > xInstanceInit( xInstance, UNO_QUERY ); + ENSURE_OR_RETURN( xInstanceInit.is(), "ControlModelContainerBase::createInstanceWithArguments: can't pass the arguments!", xInstance ); + xInstanceInit->initialize( i_arguments ); + return xInstance; } Sequence< ::rtl::OUString > ControlModelContainerBase::getAvailableServiceNames() throw(RuntimeException) @@ -779,11 +785,11 @@ void SAL_CALL ControlModelContainerBase::setImageURL( const ::rtl::OUString& _im { m_sImageURL = _imageurl; } -::rtl::OUString SAL_CALL ControlModelContainerBase::getTooltip() throw (::com::sun::star::uno::RuntimeException) +::rtl::OUString SAL_CALL ControlModelContainerBase::getToolTip() throw (::com::sun::star::uno::RuntimeException) { return m_sTooltip; } -void SAL_CALL ControlModelContainerBase::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL ControlModelContainerBase::setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) { m_sTooltip = _tooltip; } @@ -1344,7 +1350,7 @@ void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxMode Reference < XControl > xCtrl; maContext.createComponent( aDefCtrl, xCtrl ); - DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" ); + DBG_ASSERT( xCtrl.is(), "ControlContainerBase::ImplInsertControl: could not create the control!" ); if ( xCtrl.is() ) { xCtrl->setModel( rxModel ); @@ -1562,7 +1568,7 @@ void ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw( Event.Accessor >>= aName; Event.Element >>= xModel; - ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementInserted: illegal element!" ); + ENSURE_OR_RETURN_VOID( xModel.is(), "ControlContainerBase::elementInserted: illegal element!" ); try { ImplInsertControl( xModel, aName ); @@ -1580,7 +1586,7 @@ void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(R Reference< XControlModel > xModel; Event.Element >>= xModel; - ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementRemoved: illegal element!" ); + ENSURE_OR_RETURN_VOID( xModel.is(), "ControlContainerBase::elementRemoved: illegal element!" ); try { ImplRemoveControl( xModel ); @@ -1600,7 +1606,7 @@ void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw( Event.ReplacedElement >>= xModel; try { - OSL_ENSURE( xModel.is(), "UnoDialogControl::elementReplaced: invalid ReplacedElement!" ); + OSL_ENSURE( xModel.is(), "ControlContainerBase::elementReplaced: invalid ReplacedElement!" ); if ( xModel.is() ) ImplRemoveControl( xModel ); } @@ -1613,7 +1619,7 @@ void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw( ::rtl::OUString aName; Event.Accessor >>= aName; Event.Element >>= xModel; - ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementReplaced: invalid new element!" ); + ENSURE_OR_RETURN_VOID( xModel.is(), "ControlContainerBase::elementReplaced: invalid new element!" ); try { ImplInsertControl( xModel, aName ); diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 4ef99d749ba1..acb71a33be4c 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -37,6 +37,7 @@ #include <rtl/ref.hxx> #include <algorithm> +#include <functional> //...................................................................................................................... namespace toolkit @@ -100,7 +101,7 @@ namespace toolkit ::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException) { ::comphelper::ComponentGuard aGuard( *this, rBHelper ); - return m_aData.size(); + return impl_getRowCount_nolck(); } //------------------------------------------------------------------------------------------------------------------ @@ -175,52 +176,82 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException) + Sequence< Any > SAL_CALL DefaultGridDataModel::getRowData( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException) { ::comphelper::ComponentGuard aGuard( *this, rBHelper ); - sal_Int32 const columnCount = i_data.getLength(); - - // store header name - m_aRowHeaders.push_back( i_heading ); - - // store row m_aData - impl_addRow( i_data ); - - // update column count - if ( columnCount > m_nColumnCount ) - m_nColumnCount = columnCount; + Sequence< Any > resultData( m_nColumnCount ); + RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount ); - sal_Int32 const rowIndex = sal_Int32( m_aData.size() - 1 ); - broadcast( - GridDataEvent( *this, -1, -1, rowIndex, rowIndex ), - &XGridDataListener::rowsInserted, - aGuard - ); + ::std::transform( rRowData.begin(), rRowData.end(), resultData.getArray(), ::std::select1st< CellData >() ); + return resultData; } //------------------------------------------------------------------------------------------------------------------ - void DefaultGridDataModel::impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount ) + void DefaultGridDataModel::impl_insertRow( sal_Int32 const i_position, Any const & i_heading, Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount ) { OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ), - "DefaultGridDataModel::impl_addRow: invalid column count!" ); + "DefaultGridDataModel::impl_insertRow: invalid column count!" ); + + // insert heading + m_aRowHeaders.insert( m_aRowHeaders.begin() + i_position, i_heading ); + // create new data row RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() ); RowData::iterator cellData = newRow.begin(); for ( const Any* pData = stl_begin( i_rowData ); pData != stl_end( i_rowData ); ++pData, ++cellData ) cellData->first = *pData; - m_aData.push_back( newRow ); + // insert data row + m_aData.insert( m_aData.begin() + i_position, newRow ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException) + { + insertRow( getRowCount(), i_heading, i_data ); } //------------------------------------------------------------------------------------------------------------------ void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException) { + insertRows( getRowCount(), i_headings, i_data ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DefaultGridDataModel::insertRow( ::sal_Int32 i_index, const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException, IndexOutOfBoundsException) + { + ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + + if ( ( i_index < 0 ) || ( i_index > impl_getRowCount_nolck() ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + + // actually insert the row + impl_insertRow( i_index, i_heading, i_data ); + + // update column count + sal_Int32 const columnCount = i_data.getLength(); + if ( columnCount > m_nColumnCount ) + m_nColumnCount = columnCount; + + broadcast( + GridDataEvent( *this, -1, -1, i_index, i_index ), + &XGridDataListener::rowsInserted, + aGuard + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL DefaultGridDataModel::insertRows( ::sal_Int32 i_index, const Sequence< Any>& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException) + { if ( i_headings.getLength() != i_data.getLength() ) throw IllegalArgumentException( ::rtl::OUString(), *this, -1 ); ::comphelper::ComponentGuard aGuard( *this, rBHelper ); + if ( ( i_index < 0 ) || ( i_index > impl_getRowCount_nolck() ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + sal_Int32 const rowCount = i_headings.getLength(); if ( rowCount == 0 ) return; @@ -236,17 +267,14 @@ namespace toolkit for ( sal_Int32 row=0; row<rowCount; ++row ) { - m_aRowHeaders.push_back( i_headings[row] ); - impl_addRow( i_data[row], maxColCount ); + impl_insertRow( i_index + row, i_headings[row], i_data[row], maxColCount ); } if ( maxColCount > m_nColumnCount ) m_nColumnCount = maxColCount; - sal_Int32 const firstRow = sal_Int32( m_aData.size() - rowCount ); - sal_Int32 const lastRow = sal_Int32( m_aData.size() - 1 ); broadcast( - GridDataEvent( *this, -1, -1, firstRow, lastRow ), + GridDataEvent( *this, -1, -1, i_index, i_index + rowCount - 1 ), &XGridDataListener::rowsInserted, aGuard ); diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx index bf4b6cc3355e..e679160dc9db 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx @@ -65,6 +65,8 @@ public: // XMutableGridDataModel virtual void SAL_CALL addRow( const Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertRow( ::sal_Int32 i_index, const ::com::sun::star::uno::Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); + virtual void SAL_CALL insertRows( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); @@ -81,6 +83,7 @@ public: virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getRowData( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); // OComponentHelper virtual void SAL_CALL disposing(); @@ -104,7 +107,9 @@ private: ::comphelper::ComponentGuard & i_instanceLock ); - void impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 ); + void impl_insertRow( sal_Int32 const i_position, Any const & i_heading, Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 ); + + ::sal_Int32 impl_getRowCount_nolck() const { return sal_Int32( m_aData.size() ); } CellData const & impl_getCellData_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ) const; CellData& impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ); diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx index acda52753a60..82619d01c7f5 100644 --- a/toolkit/source/controls/grid/gridcontrol.cxx +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -54,6 +54,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::view; +using namespace ::com::sun::star::util; namespace toolkit { @@ -111,6 +112,10 @@ UnoGridModel::UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun:: ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND ); ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_TEXT_COLOR ); ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS ); + ImplRegisterProperty( BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR ); + ImplRegisterProperty( BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR ); + ImplRegisterProperty( BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR ); + ImplRegisterProperty( BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR ); ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); } @@ -240,6 +245,10 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const case BASEPROPERTY_GRID_HEADER_TEXT_COLOR: case BASEPROPERTY_GRID_LINE_COLOR: case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS: + case BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR: + case BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR: + case BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR: + case BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR: return Any(); default: return UnoControlModel::ImplGetDefaultValue( nPropId ); @@ -304,8 +313,8 @@ void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > { UnoControlBase::createPeer( rxToolkit, rParentPeer ); - const Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW ); - xGrid->addSelectionListener(&m_aSelectionListeners); + const Reference< XGridRowSelection > xGrid( getPeer(), UNO_QUERY_THROW ); + xGrid->addSelectionListener( &m_aSelectionListeners ); } //---------------------------------------------------------------------------------------------------------------------- @@ -387,45 +396,52 @@ sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_ } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException, VetoException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex ); + Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW ); + xGrid->goToCell( i_columnIndex, i_rowIndex ); +} + +//---------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException ) +{ + Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex ); } //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows(); + Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->selectAllRows(); } //---------------------------------------------------------------------------------------------------------------------- -void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException ) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex ); + Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex ); } //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows(); + Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->deselectAllRows(); } //---------------------------------------------------------------------------------------------------------------------- -::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) +::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelectedRows() throw (::com::sun::star::uno::RuntimeException) { - return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection(); + return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->getSelectedRows(); } //---------------------------------------------------------------------------------------------------------------------- -::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL UnoGridControl::hasSelectedRows() throw (::com::sun::star::uno::RuntimeException) { - return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty(); + return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->hasSelectedRows(); } //---------------------------------------------------------------------------------------------------------------------- -::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL UnoGridControl::isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) { - return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ); + return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->isRowSelected( index ); } //---------------------------------------------------------------------------------------------------------------------- diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index 61d9f8fc0232..de1ac8d657c3 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -29,12 +29,13 @@ #define TOOLKIT_GRID_CONTROL_HXX #include <com/sun/star/awt/grid/XGridControl.hpp> +#include <com/sun/star/awt/grid/XGridRowSelection.hpp> #include <com/sun/star/view/SelectionType.hpp> #include <toolkit/controls/unocontrolbase.hxx> #include <toolkit/controls/unocontrolmodel.hxx> #include <toolkit/helper/servicenames.hxx> -#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <comphelper/sequence.hxx> #include <toolkit/helper/listenermultiplexer.hxx> @@ -80,8 +81,9 @@ public: // =================================================================== // = UnoGridControl // =================================================================== -typedef ::cppu::ImplInheritanceHelper1 < UnoControlBase +typedef ::cppu::ImplInheritanceHelper2 < UnoControlBase , ::com::sun::star::awt::grid::XGridControl + , ::com::sun::star::awt::grid::XGridRowSelection > UnoGridControl_Base; class UnoGridControl : public UnoGridControl_Base { @@ -101,15 +103,16 @@ public: virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException); - // ::com::sun::star::awt::grid::XGridSelection - virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::grid::XGridRowSelection + virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index 77a2ffa1637b..abfa123df0de 100755..100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -295,45 +295,15 @@ namespace toolkit MethodGuard aGuard( *this, rBHelper ); DBG_CHECK_ME(); - // if the data is not sorted, broadcast the event unchanged - if ( !impl_isSorted_nothrow() ) - { - GridDataEvent const aEvent( impl_createPublicEvent( i_event ) ); - impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard ); - return; - } - - bool needReIndex = false; - if ( i_event.FirstRow > i_event.LastRow ) - { - OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - invalid row indexes!" ); - needReIndex = true; - } - else if ( size_t( i_event.FirstRow ) > m_privateToPublicRowIndex.size() ) - { - OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - too large row index!" ); - needReIndex = true; - } - - if ( needReIndex ) - { - impl_rebuildIndexesAndNotify( aGuard ); - return; - } - - // we do not insert the new rows into the sort order - if somebody adds rows while we're sorted, s/he has - // to resort. Instead, we simply append the rows, no matter where they were inserted in the delegator data - // model. - sal_Int32 const nPublicFirstRow = sal_Int32( m_privateToPublicRowIndex.size() ); - sal_Int32 nPublicLastRow = nPublicFirstRow; - for ( sal_Int32 newRow = i_event.FirstRow; newRow <= i_event.LastRow; ++newRow, ++nPublicLastRow ) + if ( impl_isSorted_nothrow() ) { - m_privateToPublicRowIndex.push_back( nPublicLastRow ); - m_publicToPrivateRowIndex.push_back( nPublicLastRow ); + // no infrastructure is in place currently to sort the new row to its proper location, + // so we remove the sorting here. + impl_removeColumnSort( aGuard ); + aGuard.reset(); } - // broadcast the event - GridDataEvent const aEvent( *this, -1, -1, nPublicFirstRow, nPublicLastRow ); + GridDataEvent const aEvent( impl_createPublicEvent( i_event ) ); impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard ); } @@ -362,14 +332,18 @@ namespace toolkit lcl_clear( m_publicToPrivateRowIndex ); lcl_clear( m_privateToPublicRowIndex ); + // rebuild the index + if ( !impl_reIndex_nothrow( m_currentSortColumn, m_sortAscending ) ) + { + impl_removeColumnSort( i_instanceLock ); + return; + } + // broadcast an artificial event, saying that all rows have been removed GridDataEvent const aRemovalEvent( *this, -1, -1, -1, -1 ); impl_broadcast( &XGridDataListener::rowsRemoved, aRemovalEvent, i_instanceLock ); i_instanceLock.reset(); - // rebuild the index - impl_reIndex_nothrow( m_currentSortColumn, m_sortAscending ); - // broadcast an artificial event, saying that n rows have been added GridDataEvent const aAdditionEvent( *this, -1, -1, 0, m_delegator->getRowCount() - 1 ); impl_broadcast( &XGridDataListener::rowsInserted, aAdditionEvent, i_instanceLock ); @@ -505,7 +479,7 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ - void SortableGridDataModel::impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending ) + bool SortableGridDataModel::impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending ) { ::sal_Int32 const rowCount( getRowCount() ); ::std::vector< ::sal_Int32 > aPublicToPrivate( rowCount ); @@ -527,7 +501,7 @@ namespace toolkit // get predicate object ::std::auto_ptr< ::comphelper::IKeyPredicateLess > const pPredicate( ::comphelper::getStandardLessPredicate( dataType, m_collator ) ); - ENSURE_OR_RETURN_VOID( pPredicate.get(), "SortableGridDataModel::impl_reIndex_nothrow: no sortable data found!" ); + ENSURE_OR_RETURN_FALSE( pPredicate.get(), "SortableGridDataModel::impl_reIndex_nothrow: no sortable data found!" ); // then sort CellDataLessComparison const aComparator( aColumnData, *pPredicate, i_sortAscending ); @@ -536,7 +510,7 @@ namespace toolkit catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); - return; + return false; } // also build the "private to public" mapping @@ -546,6 +520,8 @@ namespace toolkit m_publicToPrivateRowIndex.swap( aPublicToPrivate ); m_privateToPublicRowIndex.swap( aPrivateToPublic ); + + return true; } //------------------------------------------------------------------------------------------------------------------ @@ -557,7 +533,8 @@ namespace toolkit if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= getColumnCount() ) ) throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); - impl_reIndex_nothrow( i_columnIndex, i_sortAscending ); + if ( !impl_reIndex_nothrow( i_columnIndex, i_sortAscending ) ) + return; m_currentSortColumn = i_columnIndex; m_sortAscending = i_sortAscending; @@ -570,25 +547,35 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL SortableGridDataModel::removeColumnSort( ) throw (RuntimeException) + void SortableGridDataModel::impl_removeColumnSort_noBroadcast() { - MethodGuard aGuard( *this, rBHelper ); - DBG_CHECK_ME(); - lcl_clear( m_publicToPrivateRowIndex ); lcl_clear( m_privateToPublicRowIndex ); m_currentSortColumn = -1; m_sortAscending = sal_True; + } + //------------------------------------------------------------------------------------------------------------------ + void SortableGridDataModel::impl_removeColumnSort( MethodGuard& i_instanceLock ) + { + impl_removeColumnSort_noBroadcast(); impl_broadcast( &XGridDataListener::dataChanged, GridDataEvent( *this, -1, -1, -1, -1 ), - aGuard + i_instanceLock ); } //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SortableGridDataModel::removeColumnSort( ) throw (RuntimeException) + { + MethodGuard aGuard( *this, rBHelper ); + DBG_CHECK_ME(); + impl_removeColumnSort( aGuard ); + } + + //------------------------------------------------------------------------------------------------------------------ Pair< ::sal_Int32, ::sal_Bool > SAL_CALL SortableGridDataModel::getCurrentSortOrder( ) throw (RuntimeException) { MethodGuard aGuard( *this, rBHelper ); @@ -620,6 +607,34 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SortableGridDataModel::insertRow( ::sal_Int32 i_index, const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException, IndexOutOfBoundsException) + { + MethodGuard aGuard( *this, rBHelper ); + DBG_CHECK_ME(); + + ::sal_Int32 const rowIndex = i_index == getRowCount() ? i_index : impl_getPrivateRowIndex_throw( i_index ); + // note that |RowCount| is a valid index in this method, but not for impl_getPrivateRowIndex_throw + + Reference< XMutableGridDataModel > const delegator( m_delegator ); + aGuard.clear(); + delegator->insertRow( rowIndex, i_heading, i_data ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SortableGridDataModel::insertRows( ::sal_Int32 i_index, const Sequence< Any>& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *this, rBHelper ); + DBG_CHECK_ME(); + + ::sal_Int32 const rowIndex = i_index == getRowCount() ? i_index : impl_getPrivateRowIndex_throw( i_index ); + // note that |RowCount| is a valid index in this method, but not for impl_getPrivateRowIndex_throw + + Reference< XMutableGridDataModel > const delegator( m_delegator ); + aGuard.clear(); + delegator->insertRows( rowIndex, i_headings, i_data ); + } + + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SortableGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException) { MethodGuard aGuard( *this, rBHelper ); @@ -782,6 +797,19 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ + Sequence< Any > SAL_CALL SortableGridDataModel::getRowData( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *this, rBHelper ); + DBG_CHECK_ME(); + + ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex ); + + Reference< XMutableGridDataModel > const delegator( m_delegator ); + aGuard.clear(); + return delegator->getRowData( rowIndex ); + } + + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SortableGridDataModel::disposing() { m_currentSortColumn = -1; diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.hxx b/toolkit/source/controls/grid/sortablegriddatamodel.hxx index 50f08d3a7113..8f90801ee50c 100755..100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.hxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.hxx @@ -85,6 +85,8 @@ namespace toolkit // XMutableGridDataModel virtual void SAL_CALL addRow( const ::com::sun::star::uno::Any& Heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertRow( ::sal_Int32 i_index, const ::com::sun::star::uno::Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); + virtual void SAL_CALL insertRows( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); @@ -98,9 +100,10 @@ namespace toolkit // XGridDataModel virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getRowData( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); // OComponentHelper virtual void SAL_CALL disposing(); @@ -155,7 +158,7 @@ namespace toolkit Neither <member>m_currentSortColumn</member> nor <member>m_sortAscending</member> are touched by this method. Also, the given column index is not checked, this is the responsibility of the caller. */ - void impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending ); + bool impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending ); /** translates the given event, obtained from our delegator, to a version which can be broadcasted to our own clients. @@ -180,6 +183,14 @@ namespace toolkit */ void impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock ); + /** removes the current sorting, and notifies a change of all data + */ + void impl_removeColumnSort( MethodGuard& i_instanceLock ); + + /** removes the current sorting, without any broadcast + */ + void impl_removeColumnSort_noBroadcast(); + private: ::comphelper::ComponentContext m_context; bool m_isInitialized; diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx index 808feca02e8a..84ecef367e56 100644 --- a/toolkit/source/controls/tabpagecontainer.cxx +++ b/toolkit/source/controls/tabpagecontainer.cxx @@ -28,19 +28,21 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" +#include <toolkit/controls/geometrycontrolmodel.hxx> #include <toolkit/controls/tabpagecontainer.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <toolkit/helper/unopropertyarrayhelper.hxx> +#include <toolkit/controls/tabpagemodel.hxx> #include <toolkit/helper/property.hxx> -#include <toolkit/controls/geometrycontrolmodel.hxx> +#include <toolkit/helper/unopropertyarrayhelper.hxx> + +#include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + #include <comphelper/processfactory.hxx> #include <osl/diagnose.h> +#include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> -#include <com/sun/star/awt/XControlModel.hpp> -#include <tools/diagnose_ex.h> using ::rtl::OUString; using namespace ::com::sun::star; @@ -49,6 +51,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::view; +using ::com::sun::star::awt::tab::XTabPageModel; #define WRONG_TYPE_EXCEPTION "Type must be ::com::sun::star::awt::tab::XTabPageModel!" // ---------------------------------------------------- @@ -89,13 +92,13 @@ uno::Any UnoControlTabPageContainerModel::ImplGetDefaultValue( sal_uInt16 nPropI ::cppu::IPropertyArrayHelper& UnoControlTabPageContainerModel::getInfoHelper() { - static UnoPropertyArrayHelper* pHelper = NULL; - if ( !pHelper ) - { + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); - pHelper = new UnoPropertyArrayHelper( aIDs ); + pHelper = new UnoPropertyArrayHelper( aIDs ); } - return *pHelper; + return *pHelper; } Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContainerModel::getPropertySetInfo( ) throw(RuntimeException) { @@ -103,17 +106,67 @@ Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContaine return xInfo; } +namespace +{ + Reference< XTabPageModel > lcl_createTabPageModel( ::comphelper::ComponentContext const & i_context, + Sequence< Any > const & i_initArguments, Reference< XPropertySet > const & i_parentModel ) + { + try + { + Reference< XPropertySet > const xParentDelegator( i_parentModel, UNO_QUERY_THROW ); + Reference< XPropertySetInfo > const xPSI( xParentDelegator->getPropertySetInfo() ); + bool const isGeometryControlModel = xPSI.is() && xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ); + + Reference< XInterface > xInstance; + if ( isGeometryControlModel ) + xInstance = *( new OGeometryControlModel< UnoControlTabPageModel >( i_context.getLegacyServiceFactory() ) ); + else + xInstance = *( new UnoControlTabPageModel( i_context.getLegacyServiceFactory() ) ); + + Reference< XTabPageModel > const xTabPageModel( xInstance, UNO_QUERY_THROW ); + Reference< XInitialization > const xInit( xTabPageModel, UNO_QUERY_THROW ); + xInit->initialize( i_initArguments ); + + return xTabPageModel; + } + catch( const RuntimeException& ) + { + throw; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } +} + +Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::createTabPage( ::sal_Int16 i_tabPageID ) throw (RuntimeException) +{ + Sequence< Any > aInitArgs(1); + aInitArgs[0] <<= i_tabPageID; + return lcl_createTabPageModel( maContext, aInitArgs, this ); +} + +Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::loadTabPage( ::sal_Int16 i_tabPageID, const ::rtl::OUString& i_resourceURL ) throw (RuntimeException) +{ + Sequence< Any > aInitArgs(2); + aInitArgs[0] <<= i_tabPageID; + aInitArgs[1] <<= i_resourceURL; + return lcl_createTabPageModel( maContext, aInitArgs, this ); +} + void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - uno::Reference < ::awt::tab::XTabPageModel > xTabPageModel; + uno::Reference < XTabPageModel > xTabPageModel; if(aElement >>= xTabPageModel) { if ( sal_Int32( m_aTabPageVector.size()) ==nIndex ) m_aTabPageVector.push_back( xTabPageModel ); else if ( sal_Int32( m_aTabPageVector.size()) > nIndex ) { - std::vector< uno::Reference< ::awt::tab::XTabPageModel > >::iterator aIter = m_aTabPageVector.begin(); + std::vector< uno::Reference< XTabPageModel > >::iterator aIter = m_aTabPageVector.begin(); aIter += nIndex; m_aTabPageVector.insert( aIter, xTabPageModel ); } @@ -167,12 +220,12 @@ uno::Type SAL_CALL UnoControlTabPageContainerModel::getElementType( ) throw (un // XContainer void UnoControlTabPageContainerModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException) { - maContainerListeners.addInterface( l ); + maContainerListeners.addInterface( l ); } void UnoControlTabPageContainerModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException) { - maContainerListeners.removeInterface( l ); + maContainerListeners.removeInterface( l ); } // ---------------------------------------------------- @@ -203,7 +256,7 @@ void UnoControlTabPageContainer::createPeer( const uno::Reference< awt::XToolkit Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW ); if ( m_aTabPageListeners.getLength() ) - xTPContainer->addTabPageListener(&m_aTabPageListeners); + xTPContainer->addTabPageContainerListener(&m_aTabPageListeners); } // ------------------------------------------------------------------- @@ -221,7 +274,7 @@ void SAL_CALL UnoControlTabPageContainer::setActiveTabPageID( ::sal_Int16 _activ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW ); xTPContainer->setActiveTabPageID(_activetabpageid); } -::sal_Int32 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException) +::sal_Int16 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW ); @@ -245,21 +298,21 @@ Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageCont Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW ); return xTPContainer->getTabPageByID(tabPageID); } -void SAL_CALL UnoControlTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) +void SAL_CALL UnoControlTabPageContainer::addTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) { m_aTabPageListeners.addInterface( listener ); if( getPeer().is() && m_aTabPageListeners.getLength() == 1 ) { uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY ); - xTabPageContainer->addTabPageListener( &m_aTabPageListeners ); + xTabPageContainer->addTabPageContainerListener( &m_aTabPageListeners ); } } -void SAL_CALL UnoControlTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) +void SAL_CALL UnoControlTabPageContainer::removeTabPageContainerListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException) { if( getPeer().is() && m_aTabPageListeners.getLength() == 1 ) { uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY ); - xTabPageContainer->addTabPageListener( &m_aTabPageListeners ); + xTabPageContainer->addTabPageContainerListener( &m_aTabPageListeners ); } m_aTabPageListeners.removeInterface( listener ); } diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index f498fefd761b..834b7f92e013 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -75,72 +75,6 @@ using namespace ::com::sun::star::util; ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl ); // ---------------------------------------------------- -// class TabPageModel -// ---------------------------------------------------- - -//TabPageModel::TabPageModel() -//{ -//} -//TabPageModel::TabPageModel( uno::Reference< uno::XComponentContext > const & xCompContext) -//{ -// (void) xCompContext; -//} -// -//TabPageModel::~TabPageModel() -//{ -//} -// -//////----- XInitialization ------------------------------------------------------------------- -//void SAL_CALL TabPageModel::initialize (const Sequence<Any>& rArguments) -//{ -// sal_Int16 nPageId; -// if ( rArguments.getLength() == 1 ) -// { -// if ( !( rArguments[ 0 ] >>= nPageId )) -// throw lang::IllegalArgumentException(); -// m_nTabPageId = nPageId; -// } -// else -// m_nTabPageId = -1; -//} -//::sal_Int16 SAL_CALL TabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException) -//{ -// return m_nTabPageId; -//} -//::sal_Bool SAL_CALL TabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException) -//{ -// return m_bEnabled; -//} -//void SAL_CALL TabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException) -//{ -// m_bEnabled = _enabled; -//} -//::rtl::OUString SAL_CALL TabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException) -//{ -// return m_sTitle; -//} -//void SAL_CALL TabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException) -//{ -// m_sTitle = _title; -//} -//::rtl::OUString SAL_CALL TabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException) -//{ -// return m_sImageURL; -//} -//void SAL_CALL TabPageModel::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException) -//{ -// m_sImageURL = _imageurl; -//} -//::rtl::OUString SAL_CALL TabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException) -//{ -// return m_sTooltip; -//} -//void SAL_CALL TabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) -//{ -// m_sTooltip = _tooltip; -//} - -// ---------------------------------------------------- // class UnoControlTabPageModel // ---------------------------------------------------- UnoControlTabPageModel::UnoControlTabPageModel( Reference< XMultiServiceFactory > const & i_factory ) diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index a418b4a00b7b..80ddf6d04fce 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -292,6 +292,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "RowBackgroundColors", GRID_ROW_BACKGROUND_COLORS, Sequence< sal_Int32 >, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "UseGridLines", USE_GRID_LINES, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ActiveSelectionBackgroundColor", ACTIVE_SEL_BACKGROUND_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "InactiveSelectionBackgroundColor", INACTIVE_SEL_BACKGROUND_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "ActiveSelectionTextColor", ACTIVE_SEL_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "InactiveSelectionTextColor", INACTIVE_SEL_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index 8a6b1d8de4b9..fa3afbe87af8 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -128,9 +128,10 @@ namespace toolkit ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) \ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( i_factory ) ); } -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) -{ - return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel>( i_factory ) ); +#define IMPL_CREATE_INSTANCE_WITH_GEOMETRY( ImplName ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) \ +{ \ + return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel< ImplName >( i_factory ) ); \ } #define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \ @@ -212,6 +213,8 @@ IMPL_CREATEINSTANCE2( AnimatedImagesControl ) IMPL_CREATEINSTANCE2( AnimatedImagesControlModel ) IMPL_CREATEINSTANCE2( SpinningProgressControlModel ) +IMPL_CREATE_INSTANCE_WITH_GEOMETRY( UnoControlDialogModel ) + extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); @@ -234,6 +237,7 @@ TOOLKIT_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sa *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } + TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) { void* pRet = NULL; @@ -313,13 +317,13 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL ); GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL ); GET_FACTORY_WITH_IMPL_PREFIX( SortableGridDataModel, "org.openoffice.comp.toolkit", szServiceName_SortableGridDataModel, NULL ); - GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL ) - GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL ) - GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL ) GET_FACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL ) GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL ) GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL ) GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL ) + GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL ) + GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL ) + GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL ) if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 ) return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey ); diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx index 88f0e62024a9..22750165c446 100644 --- a/vcl/inc/unx/wmadaptor.hxx +++ b/vcl/inc/unx/wmadaptor.hxx @@ -70,6 +70,7 @@ public: NET_WM_STATE_STAYS_ON_TOP, NET_WM_STATE_STICKY, NET_WM_STATE_FULLSCREEN, + NET_WM_FULLSCREEN_MONITORS, NET_WM_STRUT, NET_WM_STRUT_PARTIAL, NET_WM_USER_TIME, @@ -347,6 +348,10 @@ public: * if reference frame is NULL the root window is used instead */ void changeReferenceFrame( X11SalFrame* pFrame, X11SalFrame* pReferenceFrame ) const; + + /* set fullscreen monitor range; takes X11 window as input since it is also used by gtk plugin + */ + virtual void setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ); }; } // namespace diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 3bf529ada48b..88a4e1f08362 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -47,7 +47,7 @@ protected: ::vcl::ImplControlData* mpControlData; private: - sal_Bool mbHasFocus; + bool mbHasControlFocus; Link maGetFocusHdl; Link maLoseFocusHdl; @@ -179,6 +179,10 @@ public: void SetLoseFocusHdl( const Link& rLink ) { maLoseFocusHdl = rLink; } const Link& GetLoseFocusHdl() const { return maLoseFocusHdl; } + /** determines whether the control currently has the focus + */ + bool HasControlFocus() const { return mbHasControlFocus; } + void SetLayoutDataParent( const Control* pParent ) const; virtual Size GetOptimalSize(WindowSizeType eType) const; diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index b80b9a86627a..b1e7f05d53a1 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -77,30 +77,30 @@ public: void SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; } const String& GetHelpFile() const { return maHelpFile; } - virtual sal_Bool Start( const XubString& rHelpId, const Window* pWindow ); - virtual sal_Bool SearchKeyword( const XubString& rKeyWord ); + virtual sal_Bool Start( const XubString& rHelpId, const Window* pWindow ); + virtual sal_Bool SearchKeyword( const XubString& rKeyWord ); virtual void OpenHelpAgent( const rtl::OString& rHelpId ); virtual XubString GetHelpText( const String& aHelpURL, const Window* pWindow ); static void EnableContextHelp(); static void DisableContextHelp(); - static sal_Bool IsContextHelpEnabled(); - static sal_Bool StartContextHelp(); + static sal_Bool IsContextHelpEnabled(); + static sal_Bool StartContextHelp(); static void EnableExtHelp(); static void DisableExtHelp(); - static sal_Bool IsExtHelpEnabled(); - static sal_Bool StartExtHelp(); - static sal_Bool EndExtHelp(); - static sal_Bool IsExtHelpActive(); + static sal_Bool IsExtHelpEnabled(); + static sal_Bool StartExtHelp(); + static sal_Bool EndExtHelp(); + static sal_Bool IsExtHelpActive(); static void EnableBalloonHelp(); static void DisableBalloonHelp(); - static sal_Bool IsBalloonHelpEnabled(); - static sal_Bool ShowBalloon( Window* pParent, + static sal_Bool IsBalloonHelpEnabled(); + static sal_Bool ShowBalloon( Window* pParent, const Point& rScreenPos, const XubString& rHelpText ); - static sal_Bool ShowBalloon( Window* pParent, + static sal_Bool ShowBalloon( Window* pParent, const Point& rScreenPos, const Rectangle&, const XubString& rHelpText ); @@ -119,6 +119,8 @@ public: sal_uInt16 nStyle = 0 ) { return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); } + static void HideBalloonAndQuickHelp(); + static sal_uLong ShowTip( Window* pParent, const Rectangle& rScreenRect, const XubString& rText, sal_uInt16 nStyle = 0 ); diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index f367be85051d..219bd4328b1b 100755..100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -270,6 +270,7 @@ typedef sal_uInt16 StateChangedType; #define STATE_CHANGE_FORMAT ((StateChangedType)17) #define STATE_CHANGE_EXTENDEDSTYLE ((StateChangedType)18) #define STATE_CHANGE_MIRRORING ((StateChangedType)19) +#define STATE_CHANGE_CONTROL_FOCUS ((StateChangedType)20) #define STATE_CHANGE_USER ((StateChangedType)10000) // GetFocusFlags diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index ce582916ea62..231b1df8e36c 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -277,6 +277,15 @@ sal_Bool Help::ShowQuickHelp( Window* pParent, // ----------------------------------------------------------------------- +void Help::HideBalloonAndQuickHelp() +{ + HelpTextWindow const * pHelpWin = ImplGetSVData()->maHelpData.mpHelpWin; + bool const bIsVisible = ( pHelpWin != NULL ) && pHelpWin->IsVisible(); + ImplDestroyHelpWindow( bIsVisible ); +} + +// ----------------------------------------------------------------------- + sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect, const XubString& rText, sal_uInt16 nStyle ) { @@ -303,6 +312,7 @@ void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreen pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect ); pHelpWin->SetHelpText( rText ); + pHelpWin->Invalidate(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 26ef9b076d8c..dd887276ca5b 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -50,7 +50,7 @@ using namespace vcl; void Control::ImplInitControlData() { - mbHasFocus = sal_False; + mbHasControlFocus = sal_False; mpControlData = new ImplControlData; } @@ -304,9 +304,10 @@ long Control::Notify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == EVENT_GETFOCUS ) { - if ( !mbHasFocus ) + if ( !mbHasControlFocus ) { - mbHasFocus = sal_True; + mbHasControlFocus = sal_True; + StateChanged( STATE_CHANGE_CONTROL_FOCUS ); if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) ) // been destroyed within the handler return sal_True; @@ -319,7 +320,8 @@ long Control::Notify( NotifyEvent& rNEvt ) Window* pFocusWin = Application::GetFocusWindow(); if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) { - mbHasFocus = sal_False; + mbHasControlFocus = sal_False; + StateChanged( STATE_CHANGE_CONTROL_FOCUS ); if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) ) // been destroyed within the handler return sal_True; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ac7101f079c0..f22b97e8426a 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9784,7 +9784,7 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.rendering.SpriteCanvas.MultiScreen" )) : OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.rendering.Canvas" )), + "com.sun.star.rendering.Canvas.MultiScreen" )), aArg ), UNO_QUERY ); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0e667de73067..5c50652afbe5 100755 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -181,7 +181,7 @@ void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDispla if ( !mbFullScreenMode == !bFullScreenMode ) return; - if( (nDisplay < 0) + if( (nDisplay < -1) || (nDisplay >= static_cast<sal_Int32>(Application::GetScreenCount()) ) ) { nDisplay = GetScreenNumber(); diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index ec8db9509bf6..8230fda8f09d 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -672,6 +672,8 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if (p_prioritize_timer != NULL) CheckTimeout(); + const int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; + // first, check for already queued events. for ( int nFD = 0; nFD < nFDs_; nFD++ ) { @@ -679,20 +681,11 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if ( pEntry->fd ) { DBG_ASSERT( nFD == pEntry->fd, "wrong fd in Yield()" ); - if ( pEntry->HasPendingEvent() ) + for( int i = 0; i < nMaxEvents && pEntry->HasPendingEvent(); i++ ) { pEntry->HandleNextEvent(); - // #63862# da jetzt alle user-events ueber die interne - // queue kommen, wird die Kontrolle analog zum select - // gesteuerten Zweig einmal bei bWait abgegeben - - /* #i9277# do not reschedule since performance gets down the - the drain under heavy load - YieldMutexReleaser aReleaser; - if ( bWait ) osl_yieldThread(); - */ - - return; + if( ! bHandleAllCurrentEvents ) + return; } } } @@ -779,7 +772,6 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) } if ( FD_ISSET( nFD, &ReadFDS ) ) { - int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; for( int i = 0; pEntry->IsEventQueued() && i < nMaxEvents; i++ ) { pEntry->HandleNextEvent(); diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 90b2e5426bdf..1d89ed264dcc 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -84,6 +84,7 @@ public: int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x ) const; virtual void setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const; + virtual void setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ); }; class GnomeWMAdaptor : public WMAdaptor @@ -124,6 +125,7 @@ static const WMAdaptorProtocol aProtocolTab[] = { "_NET_CURRENT_DESKTOP", WMAdaptor::NET_CURRENT_DESKTOP }, { "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS }, { "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP }, + { "_NET_WM_FULLSCREEN_MONITORS", WMAdaptor::NET_WM_FULLSCREEN_MONITORS }, { "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME }, { "_NET_WM_PING", WMAdaptor::NET_WM_PING }, { "_NET_WM_STATE", WMAdaptor::NET_WM_STATE }, @@ -2546,3 +2548,67 @@ void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent XFlush( m_pDisplay ); } } + +/* +* WMAdaptor::setFullScreenMonitors +*/ +void WMAdaptor::setFullScreenMonitors( XLIB_Window, sal_Int32 ) +{ +} + +/* +* NetWMAdaptor::setFullScreenMonitors +*/ +void NetWMAdaptor::setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ) +{ + if( m_aWMAtoms[ NET_WM_FULLSCREEN_MONITORS ] ) + { + const std::vector< Rectangle >& rScreens( m_pSalDisplay->GetXineramaScreens() ); + if( m_pSalDisplay->IsXinerama() && rScreens.size() > 1 ) + { + long nSpannedMonitors[4] = {0,0,0,0}; + if( i_nScreen == -1 ) // all screens + { + long nLeft = rScreens.front().Left(); + long nRight = rScreens.front().Right(); + long nTop = rScreens.front().Top(); + long nBottom = rScreens.front().Bottom(); + for( long i = 1; i < long(rScreens.size()); ++ i ) + { + if( rScreens[i].Left() < nLeft ) + { + nLeft = rScreens[i].Left(); + nSpannedMonitors[2] = i; + } + if( rScreens[i].Top() < nTop ) + { + nTop = rScreens[i].Top(); + nSpannedMonitors[0] = i; + } + if( rScreens[i].Bottom() > nBottom ) + { + nBottom = rScreens[i].Bottom(); + nSpannedMonitors[1] = i; + } + if( rScreens[i].Right() > nRight ) + { + nRight = rScreens[i].Right(); + nSpannedMonitors[3] = i; + } + } + } + else + { + if( i_nScreen < 0 || i_nScreen >= sal_Int32(rScreens.size()) ) + i_nScreen = 0; + nSpannedMonitors[0] = nSpannedMonitors[1] = nSpannedMonitors[2] = nSpannedMonitors[3] = i_nScreen; + } + XChangeProperty( m_pDisplay, i_aWindow, + m_aWMAtoms[ NET_WM_FULLSCREEN_MONITORS ], + XA_CARDINAL, 32, + PropModeReplace, (unsigned char*)nSpannedMonitors, 4 ); + + } + } +} + diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index c0348beb6a34..940ab0ea5f56 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2223,7 +2223,10 @@ void X11SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); else + { + GetDisplay()->getWMAdaptor()->setFullScreenMonitors( GetShellWindow(), nScreen ); GetDisplay()->getWMAdaptor()->showFullScreen( this, true ); + } if( bVisible ) Show(sal_True); diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index ffa61bc52c10..d468eef57d2a 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -208,6 +208,25 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen ) void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { + /* Caution: since we support the _NET_WM_FULLSCREEN_MONITORS property now and + the EWMH spec says, the index used for that needs to be that of the + Xinerama extension, we need to ensure that the order of m_aXineramaScreens is actually intact. + + gdk_screen_get_monitor_geometry however has a different sort order that has a default monitor number + Xinerama returns the default monitor as 0. + That means if we fill in the multiple montors vector from gdk, we'll get the wrong order unless + the default monitor is incidentally the same (number 0). + + Given that XRandR (which is what gdk_screen_get_monitor_geometry is based on) is + supposed to replace Xinerama, this is bound to get a problem at some time again, + unfortunately there does not currently seem to be a way to map the returns of xinerama to + that of randr. Currently getting Xinerama values again works with updated values, given + a new enough Xserver. + */ + InitXinerama(); + (void)pScreen; + + #if 0 if( pScreen ) { if( gdk_display_get_n_screens(m_pGdkDisplay) == 1 ) @@ -234,6 +253,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } } + #endif } extern "C" @@ -244,6 +264,9 @@ extern "C" int GtkSalDisplay::GetDefaultMonitorNumber() const { int n = 0; + + // currently disabled, see remarks in monitorsChanged +#if 0 GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); #if GTK_CHECK_VERSION(2,20,0) n = gdk_screen_get_primary_monitor(pScreen); @@ -255,6 +278,7 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const #endif if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) n = m_aXineramaScreenIndexMap[n]; +#endif return n; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 5f4a2bda25f8..d9bca2d2e9ea 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1814,6 +1814,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) aNewPosSize = Rectangle( Point( 0, 0 ), pDisp->GetScreenSize(m_nScreen) ); else aNewPosSize = pDisp->GetXineramaScreens()[ nScreen ]; + gtk_window_resize( GTK_WINDOW(m_pWindow), maGeometry.nWidth = aNewPosSize.GetWidth(), maGeometry.nHeight = aNewPosSize.GetHeight() ); @@ -1828,6 +1829,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { + pDisp->getWMAdaptor()->setFullScreenMonitors( GDK_WINDOW_XWINDOW( GTK_WIDGET(m_pWindow)->window ), nScreen ); if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) gtk_window_set_resizable( GTK_WINDOW(m_pWindow), sal_True ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index bcbaee6d8b6c..a82e6a152efc 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -875,7 +875,8 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, { uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); - if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) ) + sal_Int32 nMonitors = xMultiMon->getCount(); + if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) ) { uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); com::sun::star::awt::Rectangle aRect; @@ -889,10 +890,28 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, } else { - nScreenX = GetSystemMetrics( SM_XVIRTUALSCREEN ); - nScreenY = GetSystemMetrics( SM_YVIRTUALSCREEN ); - nScreenDX = GetSystemMetrics( SM_CXVIRTUALSCREEN ); - nScreenDY = GetSystemMetrics( SM_CYVIRTUALSCREEN ); + Rectangle aCombined; + uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( 0 ), UNO_QUERY_THROW ); + com::sun::star::awt::Rectangle aRect; + if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) + { + aCombined.Left() = aRect.X; + aCombined.Top() = aRect.Y; + aCombined.Right() = aRect.X + aRect.Width; + aCombined.Bottom() = aRect.Y + aRect.Height; + for( sal_Int32 i = 1 ; i < nMonitors ; i++ ) + { + xMonitor = uno::Reference< XPropertySet >( xMultiMon->getByIndex(i), UNO_QUERY_THROW ); + if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) + { + aCombined.Union( Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) ); + } + } + } + nScreenX = aCombined.Left(); + nScreenY = aCombined.Top(); + nScreenDX = aCombined.GetWidth(); + nScreenDY = aCombined.GetHeight(); } } catch( Exception& ) @@ -1001,6 +1020,8 @@ WinSalFrame::WinSalFrame() // ----------------------------------------------------------------------- void WinSalFrame::updateScreenNumber() { + if( mnDisplay == -1 ) // spans all monitors + return; WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); if( pSys ) { diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java index e03323c6ebbc..cd9b0771fc4e 100644 --- a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java +++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java @@ -16,7 +16,10 @@ import com.sun.star.sdbc.SQLException; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.NamedValueCollection; +import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.ui.WizardDialog; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; @@ -73,4 +76,84 @@ public abstract class DatabaseObjectWizard extends WizardDialog Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex ); } } + + protected static void executeWizardFromCommandLine( final String i_args[], final String i_className ) + { + final String settings[] = new String[] { null, null, null }; + final int IDX_PIPE_NAME = 0; + final int IDX_LOCATION = 1; + final int IDX_DSN = 2; + + // some simple parsing + boolean failure = false; + int settingsIndex = -1; + for ( int i=0; i<i_args.length; ++i ) + { + if ( settingsIndex >= 0 ) + { + settings[ settingsIndex ] = i_args[i]; + settingsIndex = -1; + continue; + } + + if ( i_args[i].equals( "--pipe-name" ) ) + { + settingsIndex = IDX_PIPE_NAME; + continue; + } + + if ( i_args[i].equals( "--database-location" ) ) + { + settingsIndex = IDX_LOCATION; + continue; + } + + if ( i_args[i].equals( "--data-source-name" ) ) + { + settingsIndex = IDX_DSN; + continue; + } + + failure = true; + } + + if ( settings[ IDX_PIPE_NAME ] == null ) + failure = true; + + if ( ( settings[ IDX_DSN ] == null ) && ( settings[ IDX_LOCATION ] == null ) ) + failure = true; + + if ( failure ) + { + System.err.println( "supported arguments: " ); + System.err.println( " --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance" ); + System.err.println( " --database-location <url> : specifies the URL of the database document to work with" ); + System.err.println( " --data-source-name <name> : specifies the name of the data source to work with" ); + return; + } + + final String ConnectStr = "uno:pipe,name=" + settings[IDX_PIPE_NAME] + ";urp;StarOffice.ServiceManager"; + try + { + final XMultiServiceFactory serviceFactory = Desktop.connect(ConnectStr); + if (serviceFactory != null) + { + PropertyValue[] curproperties = new PropertyValue[1]; + if ( settings[ IDX_LOCATION ] != null ) + curproperties[0] = Properties.createProperty( "DatabaseLocation", settings[ IDX_LOCATION ] ); + else + curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] ); + + final Class wizardClass = Class.forName( i_className ); + final Constructor ctor = wizardClass.getConstructor( XMultiServiceFactory.class, PropertyValue[].class ); + final Method invokeMethod = wizardClass.getMethod( "start", new Class[0] ); + final Object wizardInstance = ctor.newInstance( serviceFactory, curproperties ); + invokeMethod.invoke( wizardInstance ); + } + } + catch (java.lang.Exception jexception) + { + jexception.printStackTrace(System.out); + } + } } diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 828ae4fc67f0..8ca665273d74 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -219,23 +219,21 @@ public class FormHandler return xFormsSupplier.getForms(); } - public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException + public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName) { + String value = ""; try { if (xNamedForm.hasByName(ControlName)) { - return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue")); - } - else - { - throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg); + value = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue")); } } - catch (Exception exception) + catch (Exception ex) { - throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg); + Logger.getLogger( FormHandler.class.getName() ).log( Level.SEVERE, null, ex ); } + return value; } public void insertHiddenControl(XNameAccess xNameAccess, XNameContainer xNamedForm, String ControlName, String ControlValue) @@ -260,19 +258,6 @@ public class FormHandler } } - public class UnknownHiddenControlException extends java.lang.Throwable - { - - public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing) - { - XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm); - String FormName = xNamed.getName(); - sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>"); - sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>"); - SystemDialog.showMessageBox(xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgHiddenControlisMissing); - } - } - public boolean hasFormByName(String _FormName) { xNamedFormContainer = getDocumentForms(); diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java index 543a521c6ce7..59b51e63bca7 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -85,7 +85,7 @@ public class CallFormWizard if (sEvent.compareTo(PropertyNames.START) == 0) { FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext ); - CurFormWizard.startFormWizard(); + CurFormWizard.start(); } } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index f12455c264d5..2f331f40bcfd 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -389,7 +389,7 @@ public class FormDocument extends TextDocument public void initialize(int _curArrangement, Short _NBorderType) { - boolean badaptControlStyles = false; + boolean adaptControlStyles = false; xTextDocument.lockControllers(); curArrangement = _curArrangement; if (oGridControl != null) @@ -413,14 +413,14 @@ public class FormDocument extends TextDocument if (curArrangement == FormWizard.AS_GRID) { insertGridControl(_NBorderType); - badaptControlStyles = true; + adaptControlStyles = true; } else { - badaptControlStyles = !oFormController.areControlsexisting(); + adaptControlStyles = !oFormController.areControlsexisting(); oFormController.positionControls(_curArrangement, aStartPoint, getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType); } - if (badaptControlStyles) + if (adaptControlStyles) { curStyleApplier.applyStyle(false, true); } diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index cff52f46229b..2d4b33b0992c 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -29,7 +29,6 @@ package com.sun.star.wizards.form; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; import com.sun.star.sdb.application.DatabaseObject; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.PropertyNames; @@ -95,6 +94,11 @@ public class FormWizard extends DatabaseObjectWizard } } + public static void main(String i_args[]) + { + executeWizardFromCommandLine( i_args, FormWizard.class.getName() ); + } + // @Override protected void enterStep(int nOldStep, int nNewStep) { @@ -334,7 +338,7 @@ public class FormWizard extends DatabaseObjectWizard setCurrentRoadmapItemID((short) 1); } - public void startFormWizard() + public void start() { try { @@ -459,14 +463,14 @@ public class FormWizard extends DatabaseObjectWizard private void toggleMainFormSteps() { curDBCommandFieldSelection.setModified(true); - boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0; - enablefromStep(SOSUBFORM_PAGE, benable); - setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); - if (benable) + boolean enabled = curDBCommandFieldSelection.getSelectedFieldNames().length > 0; + enablefromStep(SOSUBFORM_PAGE, enabled); + setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled); + if (enabled) { if (curFormConfiguration.hasSubForm()) { - benable = toggleSubFormSteps(); + enabled = toggleSubFormSteps(); } else { @@ -474,7 +478,7 @@ public class FormWizard extends DatabaseObjectWizard setStepEnabled(SOFIELDLINKER_PAGE, false); } } - setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); + setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled); } } } diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 9f6f6d6160dd..bf1b165250c4 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -343,7 +343,7 @@ public class StyleApplier String[] sPropList = JavaTools.ArrayoutofString(scurline, ":"); String sPropValue = sPropList[1]; sPropValue = sPropValue.trim(); - if (sPropValue.indexOf("#") > 0) + if (sPropValue.indexOf("#") > -1) { sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SEMI_COLON); sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SPACE); diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index 84870f99646e..41ec462f46b4 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -93,7 +93,7 @@ public class CallQueryWizard if (sEvent.compareTo(PropertyNames.START) == 0) { QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext ); - Command = CurQueryWizard.startQueryWizard(); + Command = CurQueryWizard.start(); } } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index f4dd3296dbce..fb1fa8f6a0b8 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -36,10 +36,8 @@ import com.sun.star.sdbc.SQLException; import com.sun.star.uno.AnyConverter; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.DatabaseObjectWizard; @@ -90,90 +88,7 @@ public class QueryWizard extends DatabaseObjectWizard public static void main(String i_args[]) { - final String settings[] = new String[] - { - null, null, null - }; - final int IDX_PIPE_NAME = 0; - final int IDX_LOCATION = 1; - final int IDX_DSN = 2; - - // some simple parsing - boolean failure = false; - int settingsIndex = -1; - for (int i = 0; i < i_args.length; ++i) - { - if (settingsIndex >= 0) - { - settings[ settingsIndex] = i_args[i]; - settingsIndex = -1; - continue; - } - - if (i_args[i].equals("--pipe-name")) - { - settingsIndex = IDX_PIPE_NAME; - continue; - } - - if (i_args[i].equals("--database-location")) - { - settingsIndex = IDX_LOCATION; - continue; - } - - if (i_args[i].equals("--data-source-name")) - { - settingsIndex = IDX_DSN; - continue; - } - - failure = true; - } - - if (settings[ IDX_PIPE_NAME] == null) - { - failure = true; - } - - if ((settings[ IDX_DSN] == null) && (settings[ IDX_LOCATION] == null)) - { - failure = true; - } - - if (failure) - { - System.err.println("supported arguments: "); - System.err.println(" --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance"); - System.err.println(" --database-location <url> : specifies the URL of the database document to work with"); - System.err.println(" --data-source-name <name> : specifies the name of the data source to work with"); - return; - } - - final String ConnectStr = "uno:pipe,name=" + settings[IDX_PIPE_NAME] + ";urp;StarOffice.ServiceManager"; - try - { - final XMultiServiceFactory serviceFactory = Desktop.connect(ConnectStr); - if (serviceFactory != null) - { - PropertyValue[] curproperties = new PropertyValue[1]; - if (settings[ IDX_LOCATION] != null) - { - curproperties[0] = Properties.createProperty("DatabaseLocation", settings[ IDX_LOCATION]); - } - else - { - curproperties[0] = Properties.createProperty("DataSourceName", settings[ IDX_DSN]); - } - - QueryWizard CurQueryWizard = new QueryWizard(serviceFactory, curproperties); - CurQueryWizard.startQueryWizard(); - } - } - catch (java.lang.Exception jexception) - { - jexception.printStackTrace(System.out); - } + executeWizardFromCommandLine( i_args, QueryWizard.class.getName() ); } public final XFrame getFrame() @@ -181,7 +96,7 @@ public class QueryWizard extends DatabaseObjectWizard return m_frame; } - public String startQueryWizard() + public String start() { try { @@ -463,7 +378,7 @@ public class QueryWizard extends DatabaseObjectWizard } catch (SQLException e) { - e.printStackTrace(); + e.printStackTrace( System.err ); } } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 6a79d0f37d84..28379de73909 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -224,24 +224,27 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms(); Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME); boolean bgetConnection; - String sQueryName = PropertyNames.EMPTY_STRING; if (oDBForm != null) { String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot; XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm ); - getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg); - String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg); - String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg); - String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg); - final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", sMsg); - String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg); - if (xNamedForm.hasByName("QueryName")) - { - sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg); - } + getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND); + String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE); + String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames"); + String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames"); + String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames"); + + String sorting = PropertyNames.EMPTY_STRING; + if ( xNamedForm.hasByName( "Sorting" ) ) + sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting"); + + String sQueryName = PropertyNames.EMPTY_STRING; + if ( xNamedForm.hasByName( "QueryName" ) ) + sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName"); + String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON); String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON); - if ( !PropertyNames.EMPTY_STRING.equals(sorting)) + if ( sorting.length() > 0) { String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON); ArrayList<String[]> aSortFields = new ArrayList<String[]>(); @@ -308,11 +311,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); return false; } - catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex) - { - Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); - return false; - } } private boolean m_bStopProcess; diff --git a/xmloff/source/transform/ActionMapTypesOOo.hxx b/xmloff/source/transform/ActionMapTypesOOo.hxx index ff8081b025cf..a9ed15ecb74a 100644 --- a/xmloff/source/transform/ActionMapTypesOOo.hxx +++ b/xmloff/source/transform/ActionMapTypesOOo.hxx @@ -86,6 +86,7 @@ enum ActionMapTypesOOo OOO_SOURCE_SERVICE_ACTIONS, OOO_DRAW_AREA_POLYGON_ACTIONS, OOO_SCRIPT_ACTIONS, + OOO_ANIMATION_ACTIONS, MAX_OOO_ACTIONS }; diff --git a/xmloff/source/transform/AttrTransformerAction.hxx b/xmloff/source/transform/AttrTransformerAction.hxx index ffcd8b43ada0..0cfb6a116c2c 100644 --- a/xmloff/source/transform/AttrTransformerAction.hxx +++ b/xmloff/source/transform/AttrTransformerAction.hxx @@ -135,6 +135,7 @@ enum XMLAttrTransformerAction XML_ATACTION_GAMMA_OOO, // converts double value to percentage XML_ATACTION_DECODE_ID, // converts strings with non numeric characters to only numeric character ids XML_ATACTION_OPACITY_FIX, // converts transparency to opacity and back + XML_ATACTION_SHAPEID, // convert shape id XML_ATACTION_USER_DEFINED=0x40000000,// user defined actions start here XML_ATACTION_END=XML_TACTION_END }; diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 103202c48866..b678da6b2304 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -573,6 +573,14 @@ static XMLTransformerActionInit aActionTable[] = ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS, OOO_SOURCE_SERVICE_ACTIONS ), + // fix id strings in old animation elements + ENTRY1( PRESENTATION, DIM, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, PLAY, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) }; @@ -755,6 +763,9 @@ static XMLTransformerActionInit aShapeActionTable[] = ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE, RENAME_ENTRY( XML_LEFT, XML_START ), RENAME_ENTRY( XML_RIGHT, XML_END )), + ENTRY0( DRAW, ID, XML_ATACTION_SHAPEID ), + ENTRY0( DRAW, START_SHAPE, XML_ATACTION_SHAPEID ), + ENTRY0( DRAW, END_SHAPE, XML_ATACTION_SHAPEID ), ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) }; @@ -778,6 +789,7 @@ static XMLTransformerActionInit aConnectorActionTable[] = ENTRY1Q( FORM, ID, XML_ATACTION_RENAME, XML_NAMESPACE_DRAW, XML_CONTROL ), ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + ENTRY0( DRAW, ID, XML_ATACTION_SHAPEID ), ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) }; @@ -1036,6 +1048,14 @@ static XMLTransformerActionInit aSourceServiceActionTable[] = ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) }; +// OOO_ANIMATION_ACTIONS +static XMLTransformerActionInit aAnimationsActionTable[] = +{ + ENTRY0( DRAW, SHAPE_ID, XML_ATACTION_SHAPEID ), + ENTRY0( PRESENTATION, PATH_ID, XML_ATACTION_SHAPEID ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + // OOO_DRAW_AREA_POLYGON_ACTIONS (to be added to OOO_SHAPE_ACTIONS) static XMLTransformerActionInit aDrawAreaPolygonActionTable[] = { @@ -1777,6 +1797,10 @@ XMLTransformerActions *OOo2OasisTransformer::GetUserDefinedActions( m_aActions[OOO_SCRIPT_ACTIONS] = new XMLTransformerActions( aScriptActionTable ); break; + case OOO_ANIMATION_ACTIONS: + m_aActions[OOO_ANIMATION_ACTIONS] = + new XMLTransformerActions( aAnimationsActionTable ); + break; } } pActions = m_aActions[n]; diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 61bb73120da6..f2d7af5585c0 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -248,6 +248,9 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, { SvXMLNamespaceMap *pRewindMap = 0; + bool bRect = rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "presentation:show-shape" ) ); + (void)bRect; + // Process namespace attributes. This must happen before creating the // context, because namespace decaration apply to the element name itself. XMLMutableAttributeList *pMutableAttrList = 0; @@ -888,6 +891,14 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( } break; // <-- + case XML_ATACTION_SHAPEID: + { + OUString sNewValue( RTL_CONSTASCII_USTRINGPARAM( "shape" ) ); + sNewValue += rAttrValue; + pMutableAttrList->SetValueByIndex( i, sNewValue ); + break; + } + default: OSL_ENSURE( !this, "unknown action" ); break; |