Files
libreoffice/svx/source/table/tablemodel.cxx

1185 lines
39 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
/*
* This file is part of the LibreOffice project.
*
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
* This file incorporates work covered by the following license notice:
*
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <com/sun/star/table/XMergeableCell.hpp>
#include <algorithm>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include "cell.hxx"
#include "cellcursor.hxx"
#include "tablemodel.hxx"
#include "tablerow.hxx"
#include "tablerows.hxx"
#include "tablecolumn.hxx"
#include "tablecolumns.hxx"
#include "tableundo.hxx"
#include "svx/svdotable.hxx"
#include "svx/svdmodel.hxx"
#include "svx/svdstr.hrc"
#include "svx/svdglob.hxx"
using ::rtl::OUString;
using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::table;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
// -----------------------------------------------------------------------------
namespace sdr { namespace table {
// -----------------------------------------------------------------------------
// removes the given range from a vector
template< class Vec, class Iter > void remove_range( Vec& rVector, sal_Int32 nIndex, sal_Int32 nCount )
{
const sal_Int32 nSize = static_cast<sal_Int32>(rVector.size());
if( nCount && (nIndex >= 0) && (nIndex < nSize) )
{
if( (nIndex + nCount) >= nSize )
{
// remove at end
rVector.resize( nIndex );
}
else
{
Iter aBegin( rVector.begin() );
while( nIndex-- )
aBegin++;
if( nCount == 1 )
{
rVector.erase( aBegin );
}
else
{
Iter aEnd( aBegin );
while( nCount-- )
aEnd++;
rVector.erase( aBegin, aEnd );
}
}
}
}
// -----------------------------------------------------------------------------
/** inserts a range into a vector */
template< class Vec, class Iter, class Entry > sal_Int32 insert_range( Vec& rVector, sal_Int32 nIndex, sal_Int32 nCount )
{
if( nCount )
{
if( nIndex >= static_cast< sal_Int32 >( rVector.size() ) )
{
// append at end
nIndex = static_cast< sal_Int32 >( rVector.size() ); // cap to end
rVector.resize( nIndex + nCount );
}
else
{
// insert
sal_Int32 nFind = nIndex;
Iter aIter( rVector.begin() );
while( nFind-- )
++aIter;
Entry aEmpty;
rVector.insert( aIter, nCount, aEmpty );
}
}
return nIndex;
}
// -----------------------------------------------------------------------------
TableModel::TableModel( SdrTableObj* pTableObj )
: TableModelBase( m_aMutex )
, mpTableObj( pTableObj )
, mbModified( sal_False )
, mbNotifyPending( false )
, mnNotifyLock( 0 )
{
}
TableModel::TableModel( SdrTableObj* pTableObj, const TableModelRef& xSourceTable )
: TableModelBase( m_aMutex )
, mpTableObj( pTableObj )
, mbModified( sal_False )
, mbNotifyPending( false )
, mnNotifyLock( 0 )
{
if( xSourceTable.is() )
{
const sal_Int32 nColCount = xSourceTable->getColumnCountImpl();
const sal_Int32 nRowCount = xSourceTable->getRowCountImpl();
init( nColCount, nRowCount );
sal_Int32 nRows = nRowCount;
while( nRows-- )
(*maRows[nRows]) = (*xSourceTable->maRows[nRows]);
sal_Int32 nColumns = nColCount;
while( nColumns-- )
(*maColumns[nColumns]) = (*xSourceTable->maColumns[nColumns]);
// copy cells
for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
{
for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
{
CellRef xTargetCell( getCell( nCol, nRow ) );
if( xTargetCell.is() )
xTargetCell->cloneFrom( xSourceTable->getCell( nCol, nRow ) );
}
}
}
}
// -----------------------------------------------------------------------------
TableModel::~TableModel()
{
}
// -----------------------------------------------------------------------------
void TableModel::init( sal_Int32 nColumns, sal_Int32 nRows )
{
if( nRows < 20 )
maRows.reserve( 20 );
if( nColumns < 20 )
maColumns.reserve( 20 );
if( nRows && nColumns )
{
maColumns.resize( nColumns );
maRows.resize( nRows );
while( nRows-- )
maRows[nRows].set( new TableRow( this, nRows, nColumns ) );
while( nColumns-- )
maColumns[nColumns].set( new TableColumn( this, nColumns ) );
}
}
// -----------------------------------------------------------------------------
// ICellRange
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getLeft()
{
return 0;
}
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getTop()
{
return 0;
}
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getRight()
{
return getColumnCount();
}
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getBottom()
{
return getRowCount();
}
// -----------------------------------------------------------------------------
Reference< XTable > TableModel::getTable()
{
return this;
}
// -----------------------------------------------------------------------------
void TableModel::UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount )
{
TableModelNotifyGuard aGuard( this );
// remove the rows
remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount );
updateRows();
setModified(sal_True);
}
// -----------------------------------------------------------------------------
void TableModel::UndoRemoveRows( sal_Int32 nIndex, RowVector& aRows )
{
TableModelNotifyGuard aGuard( this );
const sal_Int32 nCount = sal::static_int_cast< sal_Int32 >( aRows.size() );
nIndex = insert_range<RowVector,RowVector::iterator,TableRowRef>( maRows, nIndex, nCount );
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
maRows[nIndex+nOffset] = aRows[nOffset];
updateRows();
setModified(sal_True);
}
// -----------------------------------------------------------------------------
void TableModel::UndoInsertColumns( sal_Int32 nIndex, sal_Int32 nCount )
{
TableModelNotifyGuard aGuard( this );
// now remove the columns
remove_range<ColumnVector,ColumnVector::iterator>( maColumns, nIndex, nCount );
sal_Int32 nRows = getRowCountImpl();
while( nRows-- )
maRows[nRows]->removeColumns( nIndex, nCount );
updateColumns();
setModified(sal_True);
}
// -----------------------------------------------------------------------------
void TableModel::UndoRemoveColumns( sal_Int32 nIndex, ColumnVector& aCols, CellVector& aCells )
{
TableModelNotifyGuard aGuard( this );
const sal_Int32 nCount = sal::static_int_cast< sal_Int32 >( aCols.size() );
// assert if there are not enough cells saved
DBG_ASSERT( (aCols.size() * maRows.size()) == aCells.size(), "sdr::table::TableModel::UndoRemoveColumns(), invalid undo data!" );
nIndex = insert_range<ColumnVector,ColumnVector::iterator,TableColumnRef>( maColumns, nIndex, nCount );
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
maColumns[nIndex+nOffset] = aCols[nOffset];
CellVector::iterator aIter( aCells.begin() );
sal_Int32 nRows = getRowCountImpl();
for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
{
CellVector::iterator aIter2 = aIter + nRow * nCount;
OSL_ENSURE(aIter2 < aCells.end(), "invalid iterator!");
maRows[nRow]->insertColumns( nIndex, nCount, &aIter2 );
}
updateColumns();
setModified(sal_True);
}
// -----------------------------------------------------------------------------
// XTable
// -----------------------------------------------------------------------------
Reference< XCellCursor > SAL_CALL TableModel::createCursor() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
return createCursorByRange( Reference< XCellRange >( this ) );
}
// -----------------------------------------------------------------------------
Reference< XCellCursor > SAL_CALL TableModel::createCursorByRange( const Reference< XCellRange >& rRange ) throw (IllegalArgumentException, RuntimeException)
{
::SolarMutexGuard aGuard;
ICellRange* pRange = dynamic_cast< ICellRange* >( rRange.get() );
if( (pRange == 0) || (pRange->getTable().get() != this) )
throw IllegalArgumentException();
TableModelRef xModel( this );
return new CellCursor( xModel, pRange->getLeft(), pRange->getTop(), pRange->getRight(), pRange->getBottom() );
}
// -----------------------------------------------------------------------------
sal_Int32 SAL_CALL TableModel::getRowCount() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
return getRowCountImpl();
}
// -----------------------------------------------------------------------------
sal_Int32 SAL_CALL TableModel::getColumnCount() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
return getColumnCountImpl();
}
// -----------------------------------------------------------------------------
// XComponent
// -----------------------------------------------------------------------------
void TableModel::dispose() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
TableModelBase::dispose();
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
TableModelBase::addEventListener( xListener );
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
TableModelBase::removeEventListener( xListener );
}
// -----------------------------------------------------------------------------
// XModifiable
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL TableModel::isModified( ) throw (RuntimeException)
{
::SolarMutexGuard aGuard;
return mbModified;
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::setModified( sal_Bool bModified ) throw (PropertyVetoException, RuntimeException)
{
{
::SolarMutexGuard aGuard;
mbModified = bModified;
}
if( bModified )
notifyModification();
}
// -----------------------------------------------------------------------------
// XModifyBroadcaster
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
{
rBHelper.addListener( XModifyListener::static_type() , xListener );
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
{
rBHelper.removeListener( XModifyListener::static_type() , xListener );
}
// -----------------------------------------------------------------------------
// XColumnRowRange
// -----------------------------------------------------------------------------
Reference< XTableColumns > SAL_CALL TableModel::getColumns() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
if( !mxTableColumns.is() )
mxTableColumns.set( new TableColumns( this ) );
return mxTableColumns.get();
}
// -----------------------------------------------------------------------------
Reference< XTableRows > SAL_CALL TableModel::getRows() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
if( !mxTableRows.is() )
mxTableRows.set( new TableRows( this ) );
return mxTableRows.get();
}
// -----------------------------------------------------------------------------
// XCellRange
// -----------------------------------------------------------------------------
Reference< XCell > SAL_CALL TableModel::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw ( IndexOutOfBoundsException, RuntimeException)
{
::SolarMutexGuard aGuard;
CellRef xCell( getCell( nColumn, nRow ) );
if( xCell.is() )
return xCell.get();
throw IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
Reference< XCellRange > SAL_CALL TableModel::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
{
::SolarMutexGuard aGuard;
if( (nLeft >= 0) && (nTop >= 0) && (nRight >= nLeft) && (nBottom >= nTop) && (nRight < getColumnCountImpl()) && (nBottom < getRowCountImpl() ) )
{
TableModelRef xModel( this );
return new CellRange( xModel, nLeft, nTop, nRight, nBottom );
}
throw IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
Reference< XCellRange > SAL_CALL TableModel::getCellRangeByName( const OUString& /*aRange*/ ) throw (RuntimeException)
{
return Reference< XCellRange >();
}
// -----------------------------------------------------------------------------
// XPropertySet
// -----------------------------------------------------------------------------
Reference< XPropertySetInfo > SAL_CALL TableModel::getPropertySetInfo( ) throw (RuntimeException)
{
Reference< XPropertySetInfo > xInfo;
return xInfo;
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::setPropertyValue( const ::rtl::OUString& /*aPropertyName*/, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
Any SAL_CALL TableModel::getPropertyValue( const OUString& /*PropertyName*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
return Any();
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::addVetoableChangeListener( const OUString& /*aPropertyName*/, const Reference< XVetoableChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::removeVetoableChangeListener( const OUString& /*aPropertyName*/, const Reference< XVetoableChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
// XFastPropertySet
// -----------------------------------------------------------------------------
void SAL_CALL TableModel::setFastPropertyValue( ::sal_Int32 /*nHandle*/, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
{
}
// -----------------------------------------------------------------------------
Any SAL_CALL TableModel::getFastPropertyValue( ::sal_Int32 /*nHandle*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
Any aAny;
return aAny;
}
// -----------------------------------------------------------------------------
// internals
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getRowCountImpl() const
{
return static_cast< sal_Int32 >( maRows.size() );
}
// -----------------------------------------------------------------------------
sal_Int32 TableModel::getColumnCountImpl() const
{
return static_cast< sal_Int32 >( maColumns.size() );
}
// -----------------------------------------------------------------------------
void TableModel::disposing()
{
if( !maRows.empty() )
{
RowVector::iterator aIter( maRows.begin() );
while( aIter != maRows.end() )
(*aIter++)->dispose();
RowVector().swap(maRows);
}
if( !maColumns.empty() )
{
ColumnVector::iterator aIter( maColumns.begin() );
while( aIter != maColumns.end() )
(*aIter++)->dispose();
ColumnVector().swap(maColumns);
}
if( mxTableColumns.is() )
{
mxTableColumns->dispose();
mxTableColumns.clear();
}
if( mxTableRows.is() )
{
mxTableRows->dispose();
mxTableRows.clear();
}
mpTableObj = 0;
}
// -----------------------------------------------------------------------------
// XBroadcaster
// -----------------------------------------------------------------------------
void TableModel::lockBroadcasts() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
++mnNotifyLock;
}
// -----------------------------------------------------------------------------
void TableModel::unlockBroadcasts() throw (RuntimeException)
{
::SolarMutexGuard aGuard;
--mnNotifyLock;
if( mnNotifyLock <= 0 )
{
mnNotifyLock = 0;
if( mbNotifyPending )
notifyModification();
}
}
// -----------------------------------------------------------------------------
void TableModel::notifyModification()
{
::osl::MutexGuard guard( m_aMutex );
if( (mnNotifyLock == 0) && mpTableObj && mpTableObj->GetModel() )
{
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
mbNotifyPending = false;
::cppu::OInterfaceContainerHelper * pModifyListeners = rBHelper.getContainer( XModifyListener::static_type() );
if( pModifyListeners )
{
EventObject aSource;
aSource.Source = static_cast< ::cppu::OWeakObject* >(this);
pModifyListeners->notifyEach( &XModifyListener::modified, aSource);
}
}
else
{
mbNotifyPending = true;
}
}
// -----------------------------------------------------------------------------
CellRef TableModel::getCell( sal_Int32 nCol, sal_Int32 nRow ) const
{
if( ((nRow >= 0) && (nRow < getRowCountImpl())) && (nCol >= 0) && (nCol < getColumnCountImpl()) )
{
return maRows[nRow]->maCells[nCol];
}
else
{
CellRef xRet;
return xRet;
}
}
// -----------------------------------------------------------------------------
CellRef TableModel::createCell()
{
CellRef xCell;
if( mpTableObj )
mpTableObj->createCell( xCell );
return xCell;
}
// -----------------------------------------------------------------------------
void TableModel::insertColumns( sal_Int32 nIndex, sal_Int32 nCount )
{
if( nCount && mpTableObj )
{
try
{
SdrModel* pModel = mpTableObj->GetModel();
TableModelNotifyGuard aGuard( this );
nIndex = insert_range<ColumnVector,ColumnVector::iterator,TableColumnRef>( maColumns, nIndex, nCount );
sal_Int32 nRows = getRowCountImpl();
while( nRows-- )
maRows[nRows]->insertColumns( nIndex, nCount );
ColumnVector aNewColumns(nCount);
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
{
TableColumnRef xNewCol( new TableColumn( this, nIndex+nOffset ) );
maColumns[nIndex+nOffset] = xNewCol;
aNewColumns[nOffset] = xNewCol;
}
const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
if( bUndo )
{
pModel->BegUndo( ImpGetResStr(STR_TABLE_INSCOL) );
pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
TableModelRef xThis( this );
nRows = getRowCountImpl();
CellVector aNewCells( nCount * nRows );
CellVector::iterator aCellIter( aNewCells.begin() );
nRows = getRowCountImpl();
for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
{
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
(*aCellIter++) = getCell( nIndex + nOffset, nRow );
}
pModel->AddUndo( new InsertColUndo( xThis, nIndex, aNewColumns, aNewCells ) );
}
const sal_Int32 nRowCount = getRowCountImpl();
// check if cells merge over new columns
for( sal_Int32 nCol = 0; nCol < nIndex; ++nCol )
{
for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
{
CellRef xCell( getCell( nCol, nRow ) );
sal_Int32 nColSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getColumnSpan() : 1;
if( (nColSpan != 1) && ((nColSpan + nCol ) > nIndex) )
{
// cell merges over newly created columns, so add the new columns to the merged cell
const sal_Int32 nRowSpan = xCell->getRowSpan();
nColSpan += nCount;
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
merge( nCol, nRow, nColSpan, nRowSpan );
}
}
}
if( bUndo )
pModel->EndUndo();
CWS-TOOLING: integrate CWS impress174 2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled. 2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element 2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason 2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error 2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word 2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation 2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork) 2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics 2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines 2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes 2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode) 2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied 2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled 2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies 2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service 2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page 2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning 2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines 2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified 2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog 2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
2009-09-09 09:19:53 +00:00
if( pModel )
pModel->SetChanged();
}
catch( Exception& )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL("sdr::table::TableModel::insertColumns(), exception caught!");
}
updateColumns();
setModified(sal_True);
}
}
// -----------------------------------------------------------------------------
void TableModel::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
{
sal_Int32 nColCount = getColumnCountImpl();
if( mpTableObj && nCount && (nIndex >= 0) && (nIndex < nColCount) )
{
try
{
TableModelNotifyGuard aGuard( this );
// clip removed columns to columns actually avalaible
if( (nIndex + nCount) > nColCount )
nCount = nColCount - nIndex;
sal_Int32 nRows = getRowCountImpl();
SdrModel* pModel = mpTableObj->GetModel();
const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
if( bUndo )
{
pModel->BegUndo( ImpGetResStr(STR_UNDO_COL_DELETE) );
pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
TableModelRef xThis( this );
ColumnVector aRemovedCols( nCount );
sal_Int32 nOffset;
for( nOffset = 0; nOffset < nCount; ++nOffset )
{
aRemovedCols[nOffset] = maColumns[nIndex+nOffset];
}
CellVector aRemovedCells( nCount * nRows );
CellVector::iterator aCellIter( aRemovedCells.begin() );
for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
{
for( nOffset = 0; nOffset < nCount; ++nOffset )
(*aCellIter++) = getCell( nIndex + nOffset, nRow );
}
pModel->AddUndo( new RemoveColUndo( xThis, nIndex, aRemovedCols, aRemovedCells ) );
}
// only rows before and inside the removed rows are considered
nColCount = nIndex + nCount + 1;
const sal_Int32 nRowCount = getRowCountImpl();
// first check merged cells before and inside the removed rows
for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
{
for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
{
CellRef xCell( getCell( nCol, nRow ) );
sal_Int32 nColSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getColumnSpan() : 1;
if( nColSpan <= 1 )
continue;
if( nCol >= nIndex )
{
// current cell is inside the removed columns
if( (nCol + nColSpan) > ( nIndex + nCount ) )
{
// current cells merges with columns after the removed columns
const sal_Int32 nRemove = nCount - nCol + nIndex;
CellRef xTargetCell( getCell( nIndex + nCount, nRow ) );
if( xTargetCell.is() )
{
if( bUndo )
xTargetCell->AddUndo();
xTargetCell->merge( nColSpan - nRemove, xCell->getRowSpan() );
xTargetCell->replaceContentAndFormating( xCell );
}
}
}
else if( nColSpan > (nIndex - nCol) )
{
// current cells spans inside the removed columns, so adjust
const sal_Int32 nRemove = ::std::min( nCount, nCol + nColSpan - nIndex );
if( bUndo )
xCell->AddUndo();
xCell->merge( nColSpan - nRemove, xCell->getRowSpan() );
}
}
}
// now remove the columns
remove_range<ColumnVector,ColumnVector::iterator>( maColumns, nIndex, nCount );
while( nRows-- )
maRows[nRows]->removeColumns( nIndex, nCount );
if( bUndo )
pModel->EndUndo();
CWS-TOOLING: integrate CWS impress174 2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled. 2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element 2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason 2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error 2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word 2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation 2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork) 2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics 2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines 2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes 2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode) 2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied 2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled 2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies 2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service 2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page 2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning 2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines 2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified 2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog 2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
2009-09-09 09:19:53 +00:00
if( pModel )
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
pModel->SetChanged();
}
catch( Exception& )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL("sdr::table::TableModel::removeColumns(), exception caught!");
}
updateColumns();
setModified(sal_True);
}
}
// -----------------------------------------------------------------------------
void TableModel::insertRows( sal_Int32 nIndex, sal_Int32 nCount )
{
if( nCount && mpTableObj )
{
SdrModel* pModel = mpTableObj->GetModel();
const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
try
{
TableModelNotifyGuard aGuard( this );
nIndex = insert_range<RowVector,RowVector::iterator,TableRowRef>( maRows, nIndex, nCount );
RowVector aNewRows(nCount);
const sal_Int32 nColCount = getColumnCountImpl();
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
{
TableRowRef xNewRow( new TableRow( this, nIndex+nOffset, nColCount ) );
maRows[nIndex+nOffset] = xNewRow;
aNewRows[nOffset] = xNewRow;
}
if( bUndo )
{
pModel->BegUndo( ImpGetResStr(STR_TABLE_INSROW) );
pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
TableModelRef xThis( this );
pModel->AddUndo( new InsertRowUndo( xThis, nIndex, aNewRows ) );
}
// check if cells merge over new columns
for( sal_Int32 nRow = 0; nRow < nIndex; ++nRow )
{
for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
{
CellRef xCell( getCell( nCol, nRow ) );
sal_Int32 nRowSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getRowSpan() : 1;
if( (nRowSpan > 1) && ((nRowSpan + nRow) > nIndex) )
{
// cell merges over newly created columns, so add the new columns to the merged cell
const sal_Int32 nColSpan = xCell->getColumnSpan();
nRowSpan += nCount;
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
merge( nCol, nRow, nColSpan, nRowSpan );
}
}
}
}
catch( Exception& )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL("sdr::table::TableModel::insertRows(), exception caught!");
}
if( bUndo )
pModel->EndUndo();
CWS-TOOLING: integrate CWS impress174 2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled. 2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element 2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason 2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error 2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word 2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation 2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork) 2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics 2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines 2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes 2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode) 2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied 2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled 2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies 2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service 2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page 2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning 2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines 2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified 2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog 2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
2009-09-09 09:19:53 +00:00
if( pModel )
pModel->SetChanged();
updateRows();
setModified(sal_True);
}
}
// -----------------------------------------------------------------------------
void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount )
{
sal_Int32 nRowCount = getRowCountImpl();
if( mpTableObj && nCount && (nIndex >= 0) && (nIndex < nRowCount) )
{
SdrModel* pModel = mpTableObj->GetModel();
const bool bUndo = pModel && mpTableObj->IsInserted()&& pModel->IsUndoEnabled();
try
{
TableModelNotifyGuard aGuard( this );
// clip removed rows to rows actually avalaible
if( (nIndex + nCount) > nRowCount )
nCount = nRowCount - nIndex;
if( bUndo )
{
pModel->BegUndo( ImpGetResStr(STR_UNDO_ROW_DELETE) );
pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
TableModelRef xThis( this );
RowVector aRemovedRows( nCount );
for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
aRemovedRows[nOffset] = maRows[nIndex+nOffset];
pModel->AddUndo( new RemoveRowUndo( xThis, nIndex, aRemovedRows ) );
}
// only rows before and inside the removed rows are considered
nRowCount = nIndex + nCount + 1;
const sal_Int32 nColCount = getColumnCountImpl();
// first check merged cells before and inside the removed rows
for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
{
for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
{
CellRef xCell( getCell( nCol, nRow ) );
sal_Int32 nRowSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getRowSpan() : 1;
if( nRowSpan <= 1 )
continue;
if( nRow >= nIndex )
{
// current cell is inside the removed rows
if( (nRow + nRowSpan) > (nIndex + nCount) )
{
// current cells merges with rows after the removed rows
const sal_Int32 nRemove = nCount - nRow + nIndex;
CellRef xTargetCell( getCell( nCol, nIndex + nCount ) );
if( xTargetCell.is() )
{
if( bUndo )
xTargetCell->AddUndo();
xTargetCell->merge( xCell->getColumnSpan(), nRowSpan - nRemove );
xTargetCell->replaceContentAndFormating( xCell );
}
}
}
else if( nRowSpan > (nIndex - nRow) )
{
// current cells spans inside the removed rows, so adjust
const sal_Int32 nRemove = ::std::min( nCount, nRow + nRowSpan - nIndex );
if( bUndo )
xCell->AddUndo();
xCell->merge( xCell->getColumnSpan(), nRowSpan - nRemove );
}
}
}
// now remove the rows
remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount );
if( bUndo )
pModel->EndUndo();
CWS-TOOLING: integrate CWS impress174 2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled. 2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element 2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason 2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error 2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word 2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation 2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork) 2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics 2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines 2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes 2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode) 2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied 2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled 2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies 2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service 2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page 2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning 2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring) 2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines 2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified 2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog 2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap 2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
2009-09-09 09:19:53 +00:00
if( pModel )
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
pModel->SetChanged();
}
catch( Exception& )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL("sdr::table::TableModel::removeRows(), exception caught!");
}
updateRows();
setModified(sal_True);
}
}
// -----------------------------------------------------------------------------
TableRowRef TableModel::getRow( sal_Int32 nRow ) const throw (IndexOutOfBoundsException)
{
if( (nRow >= 0) && (nRow < getRowCountImpl()) )
return maRows[nRow];
throw IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
TableColumnRef TableModel::getColumn( sal_Int32 nColumn ) const throw (IndexOutOfBoundsException)
{
if( (nColumn >= 0) && (nColumn < getColumnCountImpl()) )
return maColumns[nColumn];
throw IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
/** deletes rows and columns that are completely merged. Must be called between BegUndo/EndUndo! */
void TableModel::optimize()
{
TableModelNotifyGuard aGuard( this );
bool bWasModified = false;
if( !maRows.empty() && !maColumns.empty() )
{
sal_Int32 nCol = getColumnCountImpl() - 1;
sal_Int32 nRows = getRowCountImpl();
while( nCol > 0 )
{
bool bEmpty = true;
for( sal_Int32 nRow = 0; (nRow < nRows) && bEmpty; nRow++ )
{
Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
if( xCell.is() && !xCell->isMerged() )
bEmpty = false;
}
if( bEmpty )
{
if( nCol > 0 ) try
{
const OUString sWidth("Width");
sal_Int32 nWidth1 = 0, nWidth2 = 0;
Reference< XPropertySet > xSet1( static_cast< XCellRange* >( maColumns[nCol].get() ), UNO_QUERY_THROW );
Reference< XPropertySet > xSet2( static_cast< XCellRange* >( maColumns[nCol-1].get() ), UNO_QUERY_THROW );
xSet1->getPropertyValue( sWidth ) >>= nWidth1;
xSet2->getPropertyValue( sWidth ) >>= nWidth2;
nWidth1 += nWidth2;
xSet2->setPropertyValue( sWidth, Any( nWidth1 ) );
}
catch( Exception& e )
{
(void)e;
2011-03-01 19:07:44 +01:00
OSL_FAIL("svx::TableModel::optimize(), exception caught!");
}
removeColumns( nCol, 1 );
bWasModified = true;
}
nCol--;
}
sal_Int32 nRow = getRowCountImpl() - 1;
sal_Int32 nCols = getColumnCountImpl();
while( nRow > 0 )
{
bool bEmpty = true;
for( nCol = 0; (nCol < nCols) && bEmpty; nCol++ )
{
Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
if( xCell.is() && !xCell->isMerged() )
bEmpty = false;
}
if( bEmpty )
{
if( nRow > 0 ) try
{
const OUString sHeight("Height");
sal_Int32 nHeight1 = 0, nHeight2 = 0;
Reference< XPropertySet > xSet1( static_cast< XCellRange* >( maRows[nRow].get() ), UNO_QUERY_THROW );
Reference< XPropertySet > xSet2( static_cast< XCellRange* >( maRows[nRow-1].get() ), UNO_QUERY_THROW );
xSet1->getPropertyValue( sHeight ) >>= nHeight1;
xSet2->getPropertyValue( sHeight ) >>= nHeight2;
nHeight1 += nHeight2;
xSet2->setPropertyValue( sHeight, Any( nHeight1 ) );
}
catch( Exception& e )
{
(void)e;
2011-03-01 19:07:44 +01:00
OSL_FAIL("svx::TableModel::optimize(), exception caught!");
}
removeRows( nRow, 1 );
bWasModified = true;
}
nRow--;
}
}
if( bWasModified )
setModified(sal_True);
}
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
// -----------------------------------------------------------------------------
void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan )
{
2009-06-22 10:18:07 +00:00
SdrModel* pModel = mpTableObj->GetModel();
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
const sal_Int32 nLastRow = nRow + nRowSpan;
const sal_Int32 nLastCol = nCol + nColSpan;
if( (nLastRow > getRowCount()) || (nLastCol > getColumnCount() ) )
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
{
2011-03-01 19:07:44 +01:00
OSL_FAIL("TableModel::merge(), merge beyound the table!");
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
}
// merge first cell
CellRef xOriginCell( dynamic_cast< Cell* >( getCellByPosition( nCol, nRow ).get() ) );
if( xOriginCell.is() )
{
if( bUndo )
xOriginCell->AddUndo();
xOriginCell->merge( nColSpan, nRowSpan );
}
sal_Int32 nTempCol = nCol + 1;
// merge remaining cells
for( ; nRow < nLastRow; nRow++ )
{
for( ; nTempCol < nLastCol; nTempCol++ )
{
CellRef xCell( dynamic_cast< Cell* >( getCellByPosition( nTempCol, nRow ).get() ) );
if( xCell.is() && !xCell->isMerged() )
{
if( bUndo )
xCell->AddUndo();
xCell->setMerged();
xOriginCell->mergeContent( xCell );
}
}
nTempCol = nCol;
}
}
// -----------------------------------------------------------------------------
void TableModel::updateRows()
{
sal_Int32 nRow = 0;
RowVector::iterator iter = maRows.begin();
while( iter != maRows.end() )
{
(*iter++)->mnRow = nRow++;
}
}
// -----------------------------------------------------------------------------
void TableModel::updateColumns()
{
sal_Int32 nColumn = 0;
ColumnVector::iterator iter = maColumns.begin();
while( iter != maColumns.end() )
{
(*iter++)->mnColumn = nColumn++;
}
}
// -----------------------------------------------------------------------------
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */