summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/fmcomp/gridctrl.cxx12
-rw-r--r--svx/source/form/fmobj.cxx4
-rw-r--r--svx/source/form/fmpage.cxx5
-rw-r--r--svx/source/form/fmpgeimp.cxx76
-rw-r--r--svx/source/form/fmshell.cxx6
-rw-r--r--svx/source/inc/fmpgeimp.hxx4
-rwxr-xr-xsvx/source/sdr/contact/viewobjectcontactofunocontrol.cxx3
-rw-r--r--svx/source/svdraw/svdouno.cxx71
8 files changed, 84 insertions, 97 deletions
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 38342bf355ea..26f36802a8f9 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2001,6 +2001,18 @@ void DbGridControl::AdjustRows()
RowRemoved(GetRowCount() - nDelta, nDelta, sal_False);
// es sind Zeilen weggefallen, dann ab der aktuellen Position neu zeichen
Invalidate();
+
+ sal_Int32 nNewPos = AlignSeekCursor();
+ if (m_bSynchDisplay)
+ DbGridControl_Base::GoToRow(nNewPos);
+
+ SetCurrent(nNewPos);
+ // there are rows so go to the selected current column
+ if (nRecordCount)
+ GoToRowColumnId(nNewPos, GetColumnId(GetCurColumnId()));
+ if (!IsResizing() && GetRowCount())
+ RecalcRows(GetTopRow(), GetVisibleRows(), sal_True);
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
}
else // zuwenig
RowInserted(GetRowCount(), -nDelta, sal_True);
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 2b7ad83f7f5f..a3a4038e4ab8 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -650,7 +650,9 @@ void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XContr
{
SdrUnoObj::SetUnoControlModel( _rxModel );
- // TODO: call something like formObjectInserted at the form page, to tell it the new model
+ FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetPage() );
+ if ( pFormPage )
+ pFormPage->GetImpl().formModelAssigned( *this );
impl_checkRefDevice_nothrow( true );
}
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 480bc5678eaf..bf86964d76de 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -105,12 +105,15 @@ FmFormPage::FmFormPage(FmFormModel& rModel, StarBASIC* _pBasic, FASTBOOL bMaster
FmFormPage::FmFormPage(const FmFormPage& rPage)
:SdrPage(rPage)
#ifndef SVX_LIGHT
- ,m_pImpl(new FmFormPageImpl( *this, rPage.GetImpl() ) )
+ ,m_pImpl(new FmFormPageImpl( *this ) )
#else
,m_pImpl(NULL)
#endif
,m_pBasic(0)
{
+#ifndef SVX_LIGHT
+ m_pImpl->initFrom( rPage.GetImpl() );
+#endif
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::FmFormPage" );
m_sPageName = rPage.m_sPageName;
}
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index e239e982dd66..a0d2f5a3c47a 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -167,21 +167,18 @@ namespace
}
//------------------------------------------------------------------------------
-FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl )
- :m_rPage( _rPage )
- ,m_bFirstActivation( sal_True )
- ,m_bAttemptedFormCreation( false )
+void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
{
- DBG_CTOR(FmFormPageImpl,NULL);
-
// clone the Forms collection
- Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( rImpl ).getForms( false ), UNO_QUERY );
+ const Reference< XNameContainer > xForeignForms( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ) );
+ const Reference< XCloneable > xCloneable( xForeignForms, UNO_QUERY );
if ( !xCloneable.is() )
{
// great, nothing to do
- OSL_ENSURE( !const_cast< FmFormPageImpl& >( rImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
+ OSL_ENSURE( !xForeignForms.is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
return;
}
+
try
{
m_xForms.set( xCloneable->createClone(), UNO_QUERY_THROW );
@@ -196,7 +193,7 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl
aVisitor.process( FormComponentPair( xCloneable, m_xForms ), aAssignmentProcessor );
// assign the cloned models to their SdrObjects
- SdrObjListIter aForeignIter( rImpl.m_rPage );
+ SdrObjListIter aForeignIter( i_foreignImpl.m_rPage );
SdrObjListIter aOwnIter( m_rPage );
OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
@@ -208,31 +205,23 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl
bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == FmFormInventor );
bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == FmFormInventor );
- if ( bForeignIsForm != bOwnIsForm )
- {
- OSL_ENSURE( false, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
- // don't attempt to do further assignments, something's completely messed up
- break;
- }
+ ENSURE_OR_BREAK( bForeignIsForm == bOwnIsForm, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
+ // if this fires, don't attempt to do further assignments, something's completely messed up
+
if ( !bForeignIsForm )
// no form control -> next round
continue;
Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() );
- OSL_ENSURE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
- if ( !xForeignModel.is() )
- // the SdrObject does not have a UNO Control Model. This is pathological, but well ... So the cloned
- // SdrObject will also not have a UNO Control Model.
- continue;
-
- OSL_ENSURE( !pOwnObj->GetUnoControlModel().is(), "FmFormPageImpl::FmFormPageImpl: there already is a control model for the target object!" );
+ ENSURE_OR_CONTINUE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
+ // if this fires, the SdrObject does not have a UNO Control Model. This is pathological, but well ...
+ // So the cloned SdrObject will also not have a UNO Control Model.
MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel );
- OSL_ENSURE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
- if ( assignment == aModelAssignment.end() )
- // the source SdrObject has a model, but it is not part of the model hierarchy in rImpl.getForms().
+ ENSURE_OR_CONTINUE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
+ // if this fires, the source SdrObject has a model, but it is not part of the model hierarchy in
+ // i_foreignImpl.getForms().
// Pathological, too ...
- continue;
pOwnObj->SetUnoControlModel( assignment->second );
}
@@ -275,7 +264,7 @@ namespace
_map->put( makeAny( xControlModel ), makeAny( xControlShape ) );
}
- static void lcl_removeFormObject( const FmFormObj& _object, const Reference< XMap >& _map )
+ static void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map, bool i_ignoreNonExistence = false )
{
// the control model
Reference< XControlModel > xControlModel( _object.GetUnoControlModel(), UNO_QUERY );
@@ -287,8 +276,13 @@ namespace
Any aOldAssignment =
#endif
_map->remove( makeAny( xControlModel ) );
- OSL_ENSURE( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ),
- "lcl_removeFormObject: map was inconsistent!" );
+ #if OSL_DEBUG_LEVEL > 0
+ (void)aOldAssignment;
+ #endif
+ OSL_ENSURE( !i_ignoreNonExistence ||
+ ( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ) ),
+ "lcl_removeFormObject: map was inconsistent!" );
+ (void)i_ignoreNonExistence;
}
}
@@ -703,7 +697,26 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource(
return sName;
}
-//------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+void FmFormPageImpl::formModelAssigned( const FmFormObj& _object )
+{
+ Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
+ if ( !xControlShapeMap.is() )
+ // our map does not exist -> not interested in this event
+ return;
+
+ try
+ {
+ lcl_removeFormObject_throw( _object, xControlShapeMap, false );
+ lcl_insertFormObject_throw( _object, xControlShapeMap );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
{
Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
@@ -721,6 +734,7 @@ void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
}
}
+//----------------------------------------------------------------------------------------------------------------------
void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
{
Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
@@ -730,7 +744,7 @@ void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
try
{
- lcl_removeFormObject( _object, xControlShapeMap );
+ lcl_removeFormObject_throw( _object, xControlShapeMap );
}
catch( const Exception& )
{
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 112b47b1107e..4dec747ca431 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -901,19 +901,19 @@ void FmFormShell::GetState(SfxItemSet &rSet)
case SID_FM_USE_WIZARDS:
if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
- else if (!m_bDesignMode || !GetFormModel())
+ else if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) );
break;
case SID_FM_AUTOCONTROLFOCUS:
- if (!m_bDesignMode || !GetFormModel())
+ if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) );
break;
case SID_FM_OPEN_READONLY:
- if (!m_bDesignMode || !GetFormModel())
+ if (!GetFormModel())
rSet.DisableItem( nWhich );
else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) );
diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx
index 755c754853dc..9eb91c809d66 100644
--- a/svx/source/inc/fmpgeimp.hxx
+++ b/svx/source/inc/fmpgeimp.hxx
@@ -81,9 +81,10 @@ protected:
public:
FmFormPageImpl( FmFormPage& _rPage );
- FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl );
~FmFormPageImpl();
+ void initFrom( FmFormPageImpl& i_foreignImpl );
+
// nur wichtig fuer den DesignMode
void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm);
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm();
@@ -135,6 +136,7 @@ public:
void formObjectInserted( const FmFormObj& _object );
void formObjectRemoved( const FmFormObj& _object );
+ void formModelAssigned( const FmFormObj& _object );
/** returns an object mapping from control models to drawing shapes.
*/
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 5e225e626175..56f9a7bdaaf0 100755
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -57,8 +57,6 @@
#include <com/sun/star/container/XContainer.hpp>
/** === end UNO includes === **/
-#include <toolkit/helper/formpdfexport.hxx>
-#include <vcl/pdfextoutdevdata.hxx>
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
#include <comphelper/processfactory.hxx>
@@ -69,7 +67,6 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
-#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
/*
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index ed6c2170a5f2..cd32145c191d 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -318,68 +318,25 @@ void SdrUnoObj::operator = (const SdrObject& rObj)
SdrRectObj::operator = (rObj);
// release the reference to the current control model
- SetUnoControlModel(uno::Reference< awt::XControlModel >());
+ SetUnoControlModel( NULL );
- aUnoControlModelTypeName = ((SdrUnoObj&) rObj).aUnoControlModelTypeName;
- aUnoControlTypeName = ((SdrUnoObj&) rObj).aUnoControlTypeName;
+ const SdrUnoObj& rUnoObj = dynamic_cast< const SdrUnoObj& >( rObj );
- // copy the uno control model
- uno::Reference< awt::XControlModel > xCtrl( ((SdrUnoObj&) rObj).GetUnoControlModel(), uno::UNO_QUERY );
- uno::Reference< util::XCloneable > xClone( xCtrl, uno::UNO_QUERY );
+ aUnoControlModelTypeName = rUnoObj.aUnoControlModelTypeName;
+ aUnoControlTypeName = rUnoObj.aUnoControlTypeName;
- if ( xClone.is() )
- {
- // copy the model by cloning
- uno::Reference< awt::XControlModel > xNewModel( xClone->createClone(), uno::UNO_QUERY );
- DBG_ASSERT( xNewModel.is(), "SdrUnoObj::operator =, no control model!");
- xUnoControlModel = xNewModel;
- }
- else
+ // copy the uno control model
+ const uno::Reference< awt::XControlModel > xSourceControlModel( rUnoObj.GetUnoControlModel(), uno::UNO_QUERY );
+ if ( xSourceControlModel.is() )
{
- // copy the model by streaming
- uno::Reference< io::XPersistObject > xObj( xCtrl, uno::UNO_QUERY );
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
-
- if ( xObj.is() && xFactory.is() )
+ try
{
- // creating a pipe
- uno::Reference< io::XOutputStream > xOutPipe(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), uno::UNO_QUERY);
- uno::Reference< io::XInputStream > xInPipe(xOutPipe, uno::UNO_QUERY);
-
- // creating the mark streams
- uno::Reference< io::XInputStream > xMarkIn(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), uno::UNO_QUERY);
- uno::Reference< io::XActiveDataSink > xMarkSink(xMarkIn, uno::UNO_QUERY);
-
- uno::Reference< io::XOutputStream > xMarkOut(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), uno::UNO_QUERY);
- uno::Reference< io::XActiveDataSource > xMarkSource(xMarkOut, uno::UNO_QUERY);
-
- // connect mark and sink
- uno::Reference< io::XActiveDataSink > xSink(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), uno::UNO_QUERY);
-
- // connect mark and source
- uno::Reference< io::XActiveDataSource > xSource(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), uno::UNO_QUERY);
-
- uno::Reference< io::XObjectOutputStream > xOutStrm(xSource, uno::UNO_QUERY);
- uno::Reference< io::XObjectInputStream > xInStrm(xSink, uno::UNO_QUERY);
-
- if (xMarkSink.is() && xMarkSource.is() && xSink.is() && xSource.is())
- {
- xMarkSink->setInputStream(xInPipe);
- xMarkSource->setOutputStream(xOutPipe);
- xSink->setInputStream(xMarkIn);
- xSource->setOutputStream(xMarkOut);
-
- // write the object to source
- xOutStrm->writeObject(xObj);
- xOutStrm->closeOutput();
- // read the object
- uno::Reference< awt::XControlModel > xModel(xInStrm->readObject(), uno::UNO_QUERY);
- xInStrm->closeInput();
-
- DBG_ASSERT(xModel.is(), "SdrUnoObj::operator =, keine Model erzeugt");
-
- xUnoControlModel = xModel;
- }
+ uno::Reference< util::XCloneable > xClone( xSourceControlModel, uno::UNO_QUERY_THROW );
+ xUnoControlModel.set( xClone->createClone(), uno::UNO_QUERY_THROW );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}