summaryrefslogtreecommitdiff
path: root/svx/source/table
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/table')
-rw-r--r--svx/source/table/cell.cxx58
-rw-r--r--svx/source/table/cell.hxx11
-rw-r--r--svx/source/table/svdotable.cxx2
-rw-r--r--svx/source/table/tablecontroller.cxx2
4 files changed, 68 insertions, 5 deletions
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 7f2f2d35f1..dbfaa845dc 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -142,6 +142,8 @@ namespace sdr
void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
+ void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
sdr::table::CellRef mxCell;
};
@@ -271,7 +273,24 @@ namespace sdr
// call parent
AttributeProperties::ItemChange( nWhich, pNewItem );
}
+
+ void CellProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+
+ if( bDontRemoveHardAttr && pNewStyleSheet )
+ {
+ GetObjectItemSet();
+ const SfxItemSet& rStyleAttribs = pNewStyleSheet->GetItemSet();
+
+ for ( USHORT nWhich = SDRATTR_START; nWhich <= SDRATTR_TABLE_LAST; nWhich++ )
+ {
+ if ( rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON )
+ mpItemSet->ClearItem( nWhich );
+ }
+ }
+ }
} // end of namespace properties
} // end of namespace sdr
@@ -281,6 +300,19 @@ namespace sdr { namespace table {
// Cell
// -----------------------------------------------------------------------------
+rtl::Reference< Cell > Cell::create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject )
+{
+ rtl::Reference< Cell > xCell( new Cell( rTableObj, pOutlinerParaObject ) );
+ if( xCell->mxTable.is() )
+ {
+ Reference< XEventListener > xListener( xCell.get() );
+ xCell->mxTable->addEventListener( xListener );
+ }
+ return xCell;
+}
+
+// -----------------------------------------------------------------------------
+
Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw()
: SdrText( rTableObj, pOutlinerParaObject )
, SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorPropertyMap() )
@@ -309,7 +341,19 @@ Cell::~Cell() throw()
void Cell::dispose()
{
- mxTable.clear();
+ if( mxTable.is() )
+ {
+ try
+ {
+ Reference< XEventListener > xThis( this );
+ mxTable->removeEventListener( xThis );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("Cell::dispose(), exception caught!");
+ }
+ mxTable.clear();
+ }
if( mpProperties )
{
@@ -621,7 +665,7 @@ sal_Int32 Cell::getMinimumHeight()
pEditOutliner->SetMaxAutoPaperSize(aSize);
nMinimumHeight = pEditOutliner->GetTextHeight()+1;
}
- else
+ else /*if ( hasText() )*/
{
Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
rOutliner.SetPaperSize(aSize);
@@ -737,6 +781,9 @@ Any SAL_CALL Cell::queryInterface( const Type & rType ) throw(RuntimeException)
if( rType == XLayoutConstrains::static_type() )
return Any( Reference< XLayoutConstrains >( this ) );
+ if( rType == XEventListener::static_type() )
+ return Any( Reference< XEventListener >( this ) );
+
Any aRet( SvxUnoTextBase::queryAggregation( rType ) );
if( aRet.hasValue() )
return aRet;
@@ -1697,5 +1744,12 @@ void SAL_CALL Cell::setString( const OUString& aString ) throw (RuntimeException
notifyModified();
}
+// XEventListener
+void SAL_CALL Cell::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+{
+ mxTable.clear();
+ dispose();
+}
+
} }
diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx
index 3500230dfa..dc3b2ad300 100644
--- a/svx/source/table/cell.hxx
+++ b/svx/source/table/cell.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/table/XMergeableCell.hpp>
#include <com/sun/star/awt/XLayoutConstrains.hpp>
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
#include <rtl/ref.hxx>
@@ -61,13 +62,13 @@ class Cell : public SdrText,
public SvxUnoTextBase,
public ::com::sun::star::table::XMergeableCell,
public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::lang::XEventListener,
public ::cppu::OWeakObject
{
friend class CellUndo;
public:
- Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw();
- virtual ~Cell() throw();
+ static rtl::Reference< Cell > create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject );
// private
void dispose();
@@ -192,6 +193,9 @@ public:
virtual ::rtl::OUString SAL_CALL getString( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw (::com::sun::star::uno::RuntimeException);
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject );
void AddUndo();
@@ -212,6 +216,9 @@ protected:
::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertyMap* pMap );
private:
+ Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw();
+ virtual ~Cell() throw();
+
SvxItemPropertySet maPropSet;
sdr::properties::TextProperties* mpProperties;
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index deceaddf26..211afa5ff4 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2676,7 +2676,7 @@ Pointer SdrTableObj::GetCreatePointer() const
void SdrTableObj::createCell( CellRef& xNewCell )
{
- xNewCell.set( new Cell( *this, 0 ) );
+ xNewCell = Cell::create( *this, 0 );
}
// --------------------------------------------------------------------
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index a43796d705..ab5d250ada 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -847,6 +847,7 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
pModel->AddUndo( new TableStyleUndo( *pTableObj ) );
+/*
const sal_Int32 nRowCount = mxTable->getRowCount();
const sal_Int32 nColCount = mxTable->getColumnCount();
for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
@@ -866,6 +867,7 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
DBG_ERROR( "svx::SvxTableController::SetTableStyle(), exception caught!" );
}
}
+*/
pTableObj->setTableStyle( xNewTableStyle );
pModel->EndUndo();