summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-12 12:44:26 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-12 12:44:26 +0000
commit98bd0fd01cc03b171d83f41664b0633547004405 (patch)
treeb6e02a19fe6abf3a868c7fc9498eaae5a4f73199
parentCWS-TOOLING: integrate CWS mav44 (diff)
downloadcore-98bd0fd01cc03b171d83f41664b0633547004405.tar.gz
core-98bd0fd01cc03b171d83f41664b0633547004405.zip
CWS-TOOLING: integrate CWS impress166
2009-01-27 11:42:29 +0100 af r266972 : #i98508# Handle non DrawViewShell view shells correctly. 2009-01-21 10:41:32 +0100 af r266635 : #i98069# Do not call PreModelChange() for every ModelLock. 2009-01-20 15:25:41 +0100 af r266588 : #i98069# Added friend declaration that became necessary on Solaris after recent changes. 2009-01-19 13:48:47 +0100 af r266493 : #i97478# Prevent SID_PARASPACE_(DE|IN)CREASE from crashing when style sheet is missing. 2009-01-16 11:52:37 +0100 af r266411 : #i97338# Check the dispatcher before using it to show a context menu. 2009-01-15 14:33:55 +0100 sj r266373 : #153716# taking care of font-independent line spacing (editmode and hittest) 2009-01-15 14:29:46 +0100 sj r266372 : #153716# taking care of font-independent line spacing also in presentation styles 2009-01-14 14:04:16 +0100 af r266301 : #i97634# Do view change synchronously. Use shared pointers for view shells. 2009-01-14 14:01:27 +0100 af r266300 : #i97634# Added non-API methods that update the configuration synchronously. 2009-01-14 13:34:40 +0100 af r266295 : #i98069# Be more carefull with handling model updates to avoid assertion regarding number of selected pages. 2009-01-14 11:34:57 +0100 cl r266270 : #i97261# force outliner para oibject after text edit 2009-01-14 10:49:08 +0100 cl r266269 : #i97413# dispose cell undo action if shape dies 2009-01-13 18:50:05 +0100 cl r266247 : #i97347# fixed cell undo crash 2009-01-12 14:16:56 +0100 af r266156 : #i97296# Using is() method to check WeakReference for validity. 2009-01-12 13:52:00 +0100 af r266155 : #i97190# Turned static_cast to dynamic_cast in CreateChildList. 2009-01-12 13:06:57 +0100 af r266153 : #i97552# Catching Exceptions caught while accessing OLE-Object that is to be inserted. 2009-01-12 13:06:37 +0100 cl r266152 : #i96164# applied patch to fix ambiguous operation
-rw-r--r--sd/inc/Outliner.hxx5
-rw-r--r--sd/inc/OutlinerIterator.hxx14
-rw-r--r--sd/source/core/stlpool.cxx2
-rw-r--r--sd/source/ui/app/sdmod1.cxx5
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationController.cxx12
-rw-r--r--sd/source/ui/framework/configuration/ConfigurationUpdater.hxx2
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx31
-rw-r--r--sd/source/ui/func/fuinsert.cxx252
-rw-r--r--sd/source/ui/inc/OutlinerIteratorImpl.hxx21
-rw-r--r--sd/source/ui/inc/framework/ConfigurationController.hxx10
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx17
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx47
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx13
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.hxx7
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx59
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx2
-rw-r--r--sd/source/ui/unoidl/DrawController.cxx2
-rw-r--r--sd/source/ui/view/Outliner.cxx95
-rw-r--r--sd/source/ui/view/OutlinerIterator.cxx213
-rw-r--r--sd/source/ui/view/drtxtob1.cxx60
20 files changed, 507 insertions, 362 deletions
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
index 61ca41a59b8c..e7e9c9dc70f9 100644
--- a/sd/inc/Outliner.hxx
+++ b/sd/inc/Outliner.hxx
@@ -37,6 +37,7 @@
#include "OutlinerIterator.hxx"
#include <svx/SpellPortions.hxx>
#include <memory>
+#include <boost/shared_ptr.hpp>
class Dialog;
class SdPage;
@@ -203,7 +204,7 @@ private:
/// The view which displays the searched objects.
::sd::View* mpView;
/// The view shell containing the view.
- ViewShell* mpViewShell;
+ ::boost::shared_ptr<ViewShell> mpViewShell;
/// This window contains the view.
::sd::Window* mpWindow;
/// The document on whose objects and pages this class operates.
@@ -543,7 +544,7 @@ private:
It handles i.e. registering at the associated view as selection
change listener.
*/
- void SetViewShell (ViewShell* pViewShell);
+ void SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell);
/** Activate or deactivate the search in the current selection. Call
this method whenever the selection has changed. This method creates
diff --git a/sd/inc/OutlinerIterator.hxx b/sd/inc/OutlinerIterator.hxx
index 36e1b6269615..62646f66fe3d 100644
--- a/sd/inc/OutlinerIterator.hxx
+++ b/sd/inc/OutlinerIterator.hxx
@@ -36,12 +36,13 @@
#include "pres.hxx"
#include "sal/types.h"
#include <vector>
+#include <boost/shared_ptr.hpp>
class SdDrawDocument;
namespace sd {
-class DrawViewShell;
+class ViewShell;
class Outliner;
class View;
@@ -267,7 +268,7 @@ private:
Iterator CreateSelectionIterator (
const ::std::vector<SdrObjectWeakRef>& rObjectList,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward=true,
IteratorLocation aLocation=BEGIN);
@@ -285,7 +286,7 @@ private:
*/
Iterator CreateViewIterator (
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward=true,
IteratorLocation aLocation=BEGIN);
@@ -302,7 +303,7 @@ private:
*/
Iterator CreateDocumentIterator (
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward=true,
IteratorLocation aLocation=BEGIN);
@@ -323,8 +324,9 @@ private:
@param aLocation
This specifies at which object the iterator points initially.
*/
- sal_Int32 GetPageIndex (SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ sal_Int32 GetPageIndex (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
PageKind ePageKind,
EditMode eEditMode,
bool bDirectionIsForward,
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index b4af640a2cc5..708ed0b3c8b0 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1466,7 +1466,7 @@ SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
{
for (USHORT n = 0; n < nListenerCount; n++)
{
- SdStyleSheet* pChild = static_cast< SdStyleSheet* >( pSheet->GetListener(n) );
+ SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
if(pChild && pChild->GetParent() == pSheet->GetName())
{
aResult.push_back( SdStyleSheetRef( pChild ) );
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 8cdef6f922a3..44fd6337ca09 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -188,9 +188,12 @@ void SdModule::Execute(SfxRequest& rReq)
{
const SfxPoolItem* pItem;
if( pSet &&
+ (
SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, FALSE, &pItem ) ||
SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, FALSE, &pItem ) ||
- SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pItem ) )
+ SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pItem )
+ )
+ )
{
// am Dokument sichern:
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx
index 5e21e672d3bc..731b9d6963c0 100644
--- a/sd/source/ui/framework/configuration/ConfigurationController.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx
@@ -237,6 +237,18 @@ void ConfigurationController::ProcessEvent (void)
+void ConfigurationController::RequestSynchronousUpdate (void)
+{
+ if (mpImplementation.get() == NULL)
+ return;
+ if (mpImplementation->mpQueueProcessor.get() == 0)
+ return;
+ mpImplementation->mpQueueProcessor->ProcessUntilEmpty();
+}
+
+
+
+
//----- XConfigurationControllerBroadcaster -----------------------------------
void SAL_CALL ConfigurationController::addConfigurationChangeListener (
diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx
index 929fb9e016d2..e924f57eca8c 100644
--- a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx
+++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx
@@ -76,7 +76,7 @@ public:
css::drawing::framework::XControllerManager>& rxControllerManager);
/** Request an update of the current configuration so that it looks like
- the given requested configuration. It check whether an update of
+ the given requested configuration. It checks whether an update of
the current configuration can be done. Calls UpdateConfiguration()
if that is the case. Otherwise it schedules a later call to
UpdateConfiguration().
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 4dedb617ea89..d0d6938a2b21 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -34,8 +34,9 @@
#include "framework/FrameworkHelper.hxx"
-#include "framework/ViewShellWrapper.hxx"
+#include "framework/ConfigurationController.hxx"
#include "framework/ResourceId.hxx"
+#include "framework/ViewShellWrapper.hxx"
#include "ViewShellBase.hxx"
#include "FrameView.hxx"
#include "DrawViewShell.hxx"
@@ -511,10 +512,12 @@ Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneO
-void FrameworkHelper::RequestView (
+Reference<XResourceId> FrameworkHelper::RequestView (
const OUString& rsResourceURL,
const OUString& rsAnchorURL)
{
+ Reference<XResourceId> xViewId;
+
try
{
if (mxConfigurationController.is())
@@ -522,17 +525,23 @@ void FrameworkHelper::RequestView (
mxConfigurationController->requestResourceActivation(
CreateResourceId(rsAnchorURL),
ResourceActivationMode_ADD);
+ xViewId = CreateResourceId(rsResourceURL, rsAnchorURL);
mxConfigurationController->requestResourceActivation(
- CreateResourceId(rsResourceURL, rsAnchorURL),
+ xViewId,
ResourceActivationMode_REPLACE);
}
}
catch (lang::DisposedException&)
{
Dispose();
+ xViewId = NULL;
}
catch (RuntimeException&)
- {}
+ {
+ xViewId = NULL;
+ }
+
+ return xViewId;
}
@@ -764,6 +773,20 @@ private:
bool& mrFlag;
};
+
+
+
+void FrameworkHelper::RequestSynchronousUpdate (void)
+{
+ rtl::Reference<ConfigurationController> pCC (
+ dynamic_cast<ConfigurationController*>(mxConfigurationController.get()));
+ if (pCC.is())
+ pCC->RequestSynchronousUpdate();
+}
+
+
+
+
void FrameworkHelper::WaitForEvent (const OUString& rsEventType) const
{
bool bConfigurationUpdateSeen (false);
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 7bce1526993b..12c94fbf9f8f 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -503,163 +503,171 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
}
}
- if (xObj.is())
+ try
{
- //TODO/LATER: needs status for RESIZEONPRINTERCHANGE
- //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->getStatus( nAspect ) )
- // aIPObj->OnDocumentPrinterChanged( mpDocSh->GetPrinter(FALSE) );
+ if (xObj.is())
+ {
+ //TODO/LATER: needs status for RESIZEONPRINTERCHANGE
+ //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->getStatus( nAspect ) )
+ // aIPObj->OnDocumentPrinterChanged( mpDocSh->GetPrinter(FALSE) );
- BOOL bInsertNewObject = TRUE;
+ BOOL bInsertNewObject = TRUE;
- Size aSize;
- MapUnit aMapUnit = MAP_100TH_MM;
- if ( nAspect != embed::Aspects::MSOLE_ICON )
- {
- awt::Size aSz;
- try
+ Size aSize;
+ MapUnit aMapUnit = MAP_100TH_MM;
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
{
- aSz = xObj->getVisualAreaSize( nAspect );
- }
- catch( embed::NoVisualAreaSizeException& )
- {
- // the default size will be set later
- }
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
- aSize =Size( aSz.Width, aSz.Height );
+ aSize =Size( aSz.Width, aSz.Height );
- aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
- if (aSize.Height() == 0 || aSize.Width() == 0)
- {
- // Rechteck mit ausgewogenem Kantenverhaeltnis
- aSize.Width() = 14100;
- aSize.Height() = 10000;
- Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aMapUnit );
- aSz.Width = aTmp.Width();
- aSz.Height = aTmp.Height();
- xObj->setVisualAreaSize( nAspect, aSz );
- }
- else
- {
- aSize = OutputDevice::LogicToLogic(aSize, aMapUnit, MAP_100TH_MM);
+ aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ if (aSize.Height() == 0 || aSize.Width() == 0)
+ {
+ // Rechteck mit ausgewogenem Kantenverhaeltnis
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aMapUnit );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, aMapUnit, MAP_100TH_MM);
+ }
}
- }
-
- if ( mpView->AreObjectsMarked() )
- {
- /**********************************************************
- * Ist ein leeres OLE-Objekt vorhanden?
- **********************************************************/
- const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
- if (rMarkList.GetMarkCount() == 1)
+ if ( mpView->AreObjectsMarked() )
{
- SdrMark* pMark = rMarkList.GetMark(0);
- SdrObject* pObj = pMark->GetMarkedSdrObj();
+ /**********************************************************
+ * Ist ein leeres OLE-Objekt vorhanden?
+ **********************************************************/
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
- if (pObj->GetObjInventor() == SdrInventor &&
- pObj->GetObjIdentifier() == OBJ_OLE2)
+ if (rMarkList.GetMarkCount() == 1)
{
- if ( !( (SdrOle2Obj*) pObj)->GetObjRef().is() )
- {
- /**************************************************
- * Das leere OLE-Objekt bekommt ein neues IPObj
- **************************************************/
- bInsertNewObject = FALSE;
- pObj->SetEmptyPresObj(FALSE);
- ( (SdrOle2Obj*) pObj)->SetOutlinerParaObject(NULL);
- ( (SdrOle2Obj*) pObj)->SetObjRef(xObj);
- ( (SdrOle2Obj*) pObj)->SetPersistName(aName);
- ( (SdrOle2Obj*) pObj)->SetName(aName);
- ( (SdrOle2Obj*) pObj)->SetAspect(nAspect);
- Rectangle aRect = ( (SdrOle2Obj*) pObj)->GetLogicRect();
-
- //HMHmpView->HideMarkHdl();
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- {
- if( xIconMetaFile.is() )
- ( (SdrOle2Obj*) pObj)->SetGraphicToObj( xIconMetaFile, aIconMediaType );
- }
- else
+ if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OLE2)
+ {
+ if ( !( (SdrOle2Obj*) pObj)->GetObjRef().is() )
{
- Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
- awt::Size aSz( aTmp.Width(), aTmp.Height() );
- xObj->setVisualAreaSize( nAspect, aSz );
+ /**************************************************
+ * Das leere OLE-Objekt bekommt ein neues IPObj
+ **************************************************/
+ bInsertNewObject = FALSE;
+ pObj->SetEmptyPresObj(FALSE);
+ ( (SdrOle2Obj*) pObj)->SetOutlinerParaObject(NULL);
+ ( (SdrOle2Obj*) pObj)->SetObjRef(xObj);
+ ( (SdrOle2Obj*) pObj)->SetPersistName(aName);
+ ( (SdrOle2Obj*) pObj)->SetName(aName);
+ ( (SdrOle2Obj*) pObj)->SetAspect(nAspect);
+ Rectangle aRect = ( (SdrOle2Obj*) pObj)->GetLogicRect();
+
+ //HMHmpView->HideMarkHdl();
+
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( xIconMetaFile.is() )
+ ( (SdrOle2Obj*) pObj)->SetGraphicToObj( xIconMetaFile, aIconMediaType );
+ }
+ else
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
}
}
}
}
- }
- if (bInsertNewObject)
- {
- /**************************************************************
- * Ein neues OLE-Objekt wird erzeugt
- **************************************************************/
- SdrPageView* pPV = mpView->GetSdrPageView();
- Size aPageSize = pPV->GetPage()->GetSize();
-
- // get the size from the iconified object
- ::svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
+ if (bInsertNewObject)
{
- aObjRef.SetGraphicStream( xIconMetaFile, aIconMediaType );
- MapMode aMapMode( MAP_100TH_MM );
- aSize = aObjRef.GetSize( &aMapMode );
- }
-
- Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
- (aPageSize.Height() - aSize.Height()) / 2);
- Rectangle aRect (aPnt, aSize);
+ /**************************************************************
+ * Ein neues OLE-Objekt wird erzeugt
+ **************************************************************/
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ Size aPageSize = pPV->GetPage()->GetSize();
+
+ // get the size from the iconified object
+ ::svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ aObjRef.SetGraphicStream( xIconMetaFile, aIconMediaType );
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = aObjRef.GetSize( &aMapMode );
+ }
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
+ Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
+ (aPageSize.Height() - aSize.Height()) / 2);
+ Rectangle aRect (aPnt, aSize);
- if( mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER) )
- {
- // #73279# Math objects change their object size during InsertObject.
- // New size must be set in SdrObject, or a wrong scale will be set at
- // ActivateObject.
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
- if ( nAspect != embed::Aspects::MSOLE_ICON )
+ if( mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER) )
{
- try
- {
- awt::Size aSz = xObj->getVisualAreaSize( nAspect );
+ // #73279# Math objects change their object size during InsertObject.
+ // New size must be set in SdrObject, or a wrong scale will be set at
+ // ActivateObject.
- Size aNewSize = Window::LogicToLogic( Size( aSz.Width, aSz.Height ),
- MapMode( aMapUnit ), MapMode( MAP_100TH_MM ) );
- if ( aNewSize != aSize )
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ try
{
- aRect.SetSize( aNewSize );
- pObj->SetLogicRect( aRect );
+ awt::Size aSz = xObj->getVisualAreaSize( nAspect );
+
+ Size aNewSize = Window::LogicToLogic( Size( aSz.Width, aSz.Height ),
+ MapMode( aMapUnit ), MapMode( MAP_100TH_MM ) );
+ if ( aNewSize != aSize )
+ {
+ aRect.SetSize( aNewSize );
+ pObj->SetLogicRect( aRect );
+ }
}
+ catch( embed::NoVisualAreaSizeException& )
+ {}
}
- catch( embed::NoVisualAreaSizeException& )
- {}
- }
-
- if (bCreateNew)
- {
- //HMHmpView->HideMarkHdl();
- pObj->SetLogicRect(aRect);
- if ( nAspect != embed::Aspects::MSOLE_ICON )
+ if (bCreateNew)
{
- Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
- awt::Size aSz( aTmp.Width(), aTmp.Height() );
- xObj->setVisualAreaSize( nAspect, aSz );
+ //HMHmpView->HideMarkHdl();
+ pObj->SetLogicRect(aRect);
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+
+ mpViewShell->ActivateObject(pObj, SVVERB_SHOW);
}
- mpViewShell->ActivateObject(pObj, SVVERB_SHOW);
+ Size aVisSizePixel = mpWindow->GetOutputSizePixel();
+ Rectangle aVisAreaWin = mpWindow->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ mpViewShell->VisAreaChanged(aVisAreaWin);
+ mpDocSh->SetVisArea(aVisAreaWin);
}
-
- Size aVisSizePixel = mpWindow->GetOutputSizePixel();
- Rectangle aVisAreaWin = mpWindow->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
- mpViewShell->VisAreaChanged(aVisAreaWin);
- mpDocSh->SetVisArea(aVisAreaWin);
}
}
}
+ catch (uno::Exception&)
+ {
+ // For some reason the object can not be inserted. For example
+ // because it is password protected and is not properly unlocked.
+ }
}
}
diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
index 2f929e2fccb7..f489fffd9ed3 100644
--- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx
+++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx
@@ -33,6 +33,7 @@
#include <svx/svdobj.hxx>
#include "OutlinerIterator.hxx"
+#include <boost/weak_ptr.hpp>
class SdDrawDocument;
class SdPage;
@@ -40,7 +41,7 @@ class SdrObjListIter;
namespace sd {
-class DrawViewShell;
+class ViewShell;
namespace outliner {
@@ -58,15 +59,17 @@ public:
classes.
@param pDocument
The document provides the information to be iterated on.
- @param pViewShell
+ @param pViewShellWeak
Some information has to be taken from the view shell.
@param bDirectionIsForward
This flag defines the iteration direction. When <TRUE/> then
the direction is forwards otherwise it is backwards.
*/
- IteratorImplBase (SdDrawDocument* pDocument, DrawViewShell* pViewShell,
+ IteratorImplBase (SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
- IteratorImplBase (SdDrawDocument* pDocument, DrawViewShell* pViewShell,
+ IteratorImplBase (SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode);
virtual ~IteratorImplBase (void);
@@ -123,7 +126,7 @@ protected:
/// The document on whose data the iterator operates.
SdDrawDocument* mpDocument;
/// Necessary secondary source of information.
- DrawViewShell* mpViewShell;
+ ::boost::weak_ptr<ViewShell> mpViewShellWeak;
/// Specifies the search direction.
bool mbDirectionIsForward;
};
@@ -148,7 +151,7 @@ public:
const ::std::vector< SdrObjectWeakRef >& rObjectList,
sal_Int32 nObjectIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
SelectionIteratorImpl (const SelectionIteratorImpl& rObject);
virtual ~SelectionIteratorImpl (void);
@@ -191,12 +194,12 @@ public:
ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward,
PageKind ePageKind,
EditMode eEditMode);
@@ -252,7 +255,7 @@ public:
PageKind ePageKind,
EditMode eEditMode,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
virtual ~DocumentIteratorImpl (void);
diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx
index 8741909acdeb..12a19d9d40be 100644
--- a/sd/source/ui/inc/framework/ConfigurationController.hxx
+++ b/sd/source/ui/inc/framework/ConfigurationController.hxx
@@ -92,6 +92,16 @@ public:
void ProcessEvent (void);
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate (void);
// XConfigurationController
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index 74804f2a0870..27ed5f6f8bef 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -215,8 +215,12 @@ public:
The resource URL of the view to show.
@param rsAnchorURL
The URL of the pane in which to show the view.
+ @return
+ The resource id of the requested view is returned. With that
+ the caller can, for example, call RunOnResourceActivation() to
+ do some initialization after the requested view becomes active.
*/
- void RequestView (
+ css::uno::Reference<css::drawing::framework::XResourceId> RequestView (
const ::rtl::OUString& rsResourceURL,
const ::rtl::OUString& rsAnchorURL);
@@ -257,6 +261,17 @@ public:
const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
const Callback& rCallback);
+ /** Normally the requested changes of the configuration are executed
+ asynchronously. However, there is at least one situation (searching
+ with the Outliner) where the surrounding code does not cope with
+ this. So, instead of calling Reschedule until the global event loop
+ executes the configuration update, this method does (almost) the
+ same without the reschedules.
+
+ Do not use this method until there is absolutely no other way.
+ */
+ void RequestSynchronousUpdate (void);
+
/** Block until the specified event is notified by the configuration
controller. When the configuration controller is not processing any
requests the method returns immediately.
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 8ebc2725a19f..43c568b375d4 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -118,8 +118,9 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
mpSelectionManager(),
mpAnimator(new Animator(rSlideSorter)),
mpListener(),
- mnModelChangeLockCount (0),
- mbPostModelChangePending (false),
+ mnModelChangeLockCount(0),
+ mbPreModelChangeDone(false),
+ mbPostModelChangePending(false),
maSelectionBeforeSwitch(),
mnCurrentPageBeforeSwitch(0),
mpEditModeChangeMasterPage(NULL),
@@ -439,7 +440,11 @@ bool SlideSorterController::Command (
{
mbIsContextMenuOpen = true;
if (pViewShell != NULL)
- pViewShell->GetDispatcher()->ExecutePopup(SdResId(nPopupId));
+ {
+ SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
+ if (pDispatcher != NULL)
+ pDispatcher->ExecutePopup(SdResId(nPopupId));
+ }
}
else
{
@@ -515,6 +520,11 @@ void SlideSorterController::UnlockModelChange (void)
void SlideSorterController::PreModelChange (void)
{
+ // Prevent PreModelChange to execute more than once per model lock.
+ if (mbPostModelChangePending)
+ return;
+ mbPreModelChangeDone = true;
+
if (mrSlideSorter.GetViewShell() != NULL)
mrSlideSorter.GetViewShell()->Broadcast(
ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
@@ -532,10 +542,10 @@ void SlideSorterController::PreModelChange (void)
-void SlideSorterController::PostModelChange (const bool bSkipModelResync)
+void SlideSorterController::PostModelChange (void)
{
- if ( ! bSkipModelResync)
- mrModel.Resync();
+ mbPostModelChangePending = false;
+ mrModel.Resync();
::sd::Window* pWindow = mrSlideSorter.GetActiveWindow();
if (pWindow != NULL)
@@ -555,7 +565,6 @@ void SlideSorterController::PostModelChange (const bool bSkipModelResync)
mpPageSelector->HandleModelChange ();
- mbPostModelChangePending = false;
if (mrSlideSorter.GetViewShell() != NULL)
mrSlideSorter.GetViewShell()->Broadcast(
ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
@@ -570,22 +579,10 @@ void SlideSorterController::HandleModelChange (void)
// not the same number of regular and notes pages.
bool bIsDocumentValid = (mrModel.GetDocument()->GetPageCount() % 2 == 1);
-
if (bIsDocumentValid)
{
- if (mnModelChangeLockCount == 0)
- {
- PreModelChange();
- PostModelChange();
- }
- else
- // Call PreModelChange when not already done.
- if ( ! mbPostModelChangePending)
- {
- PreModelChange();
- // The PostModelChange() call will be made when the model change
- // is unlocked again.
- }
+ ModelChangeLock aLock (*this);
+ PreModelChange();
}
}
@@ -902,13 +899,12 @@ void SlideSorterController::PrepareEditModeChange (void)
bool SlideSorterController::ChangeEditMode (EditMode eEditMode)
{
- ModelChangeLock aLock (*this);
-
bool bResult (false);
if (mrModel.GetEditMode() != eEditMode)
{
- // Do the actual edit mode switching.
+ ModelChangeLock aLock (*this);
PreModelChange();
+ // Do the actual edit mode switching.
bResult = mrModel.SetEditMode(eEditMode);
if (bResult)
HandleModelChange();
@@ -1030,10 +1026,11 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex
{
if (mrModel.GetDocumentSlides() != rxSlides)
{
+ ModelChangeLock aLock (*this);
PreModelChange();
+
mrModel.SetDocumentSlides(rxSlides);
mrView.Layout();
- PostModelChange(false);
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index fc4f14039538..9c51643b2b49 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -72,7 +72,10 @@ Listener::Listener (
mbListeningToUNODocument (false),
mbListeningToController (false),
mbListeningToFrame (false),
- mbIsMainViewChangePending(false)
+ mbIsMainViewChangePending(false),
+ mxControllerWeak(),
+ mxFrameWeak(),
+ mpModelChangeLock()
{
StartListening (*mrSlideSorter.GetModel().GetDocument());
mbListeningToDocument = true;
@@ -328,13 +331,13 @@ void Listener::Notify (
case ViewShellHint::HINT_PAGE_RESIZE_START:
// Initiate a model change but do nothing (well, not much)
// until we are told that all slides have been resized.
- mrController.LockModelChange();
+ mpModelChangeLock.reset(new SlideSorterController::ModelChangeLock(mrController));
mrController.HandleModelChange();
break;
case ViewShellHint::HINT_PAGE_RESIZE_END:
// All slides have been resized. The model has to be updated.
- mrController.UnlockModelChange();
+ mpModelChangeLock.reset();
break;
case ViewShellHint::HINT_CHANGE_EDIT_MODE_START:
@@ -346,11 +349,11 @@ void Listener::Notify (
break;
case ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
- mrController.LockModelChange();
+ mpModelChangeLock.reset(new SlideSorterController::ModelChangeLock(mrController));
break;
case ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
- mrController.UnlockModelChange();
+ mpModelChangeLock.reset();
break;
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.hxx b/sd/source/ui/slidesorter/controller/SlsListener.hxx
index 401e71013b6a..f91c7337713a 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.hxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.hxx
@@ -32,6 +32,7 @@
#define SD_SLIDESORTER_SLIDE_SORTER_LISTENER_HXX
#include "MutexOwner.hxx"
+#include "controller/SlideSorterController.hxx"
#include <com/sun/star/document/XEventListener.hpp>
#ifndef _COM_SUN_STAR_DOCUMENT_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
@@ -44,6 +45,7 @@
#include <svtools/lstner.hxx>
#include <tools/link.hxx>
+#include <boost/shared_ptr.hpp>
namespace sd {
class ViewShellBase;
@@ -160,6 +162,11 @@ private:
::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XController> mxControllerWeak;
::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame> mxFrameWeak;
+ /** This object is used to lock the model between some
+ events. It is refernce counted in order to cope with events that
+ are expected but never sent.
+ */
+ ::boost::shared_ptr<SlideSorterController::ModelChangeLock> mpModelChangeLock;
void ReleaseListeners (void);
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 4f72e5d12457..06dc252f7b96 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -161,20 +161,6 @@ public:
void GetAttrState (SfxItemSet& rSet);
void ExecStatusBar (SfxRequest& rRequest);
- /** Prepare for several model changes, i.e. prevent time-consuming and
- non-critical operations like repaints until UnlockModelChange() is
- called. Ciritcal operations like releasing references to pages that
- do not exist anymore are executed.
- */
- void LockModelChange (void);
-
- /** Further calls to HandleModelChange() will result in a full featured
- update of model, view, and controller. When HandleModelChange() has
- been called since the last LockModelChange() then this is done right
- away to bring the view up-to-date.
- */
- void UnlockModelChange (void);
-
bool IsLocked (void) const;
/** Create an object of this inner class to prevent updates due to model
@@ -188,21 +174,8 @@ public:
private:
SlideSorterController* mpController;
};
+ friend class ModelChangeLock;
- /** Prepare for a model change. This method does all the things that
- need to be done _before_ the model changes, e.g. because they need
- access to the model data before the change.
- */
- void PreModelChange (void);
-
- /** Complete a model change. This includes the recreation of data
- structures that depend on the model and the request for a repaint to
- show the changes.
- @param bSkipModelResync
- When the SlideSorterModel::Resync() call is not necessary,
- because already made, then pass <TRUE/> here.
- */
- void PostModelChange (const bool bSkipModelResync = false);
/** Handle a change of the model, that is, handle the removal and
insertion of whole pages or a change of the edit mode.
@@ -301,9 +274,7 @@ private:
int mnModelChangeLockCount;
- /** In this flag we remember whether a call to PreModelChange() has been
- made and one to PostModelChange() is pending.
- */
+ bool mbPreModelChangeDone;
bool mbPostModelChangePending;
::std::vector<Link> maSelectionChangeListeners;
@@ -354,6 +325,32 @@ private:
A list of master pages. Supplying normal pages is an error.
*/
void DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedMasterPages);
+
+ /** Prepare for several model changes, i.e. prevent time-consuming and
+ non-critical operations like repaints until UnlockModelChange() is
+ called. Ciritcal operations like releasing references to pages that
+ do not exist anymore are executed.
+ */
+ void LockModelChange (void);
+
+ /** Further calls to HandleModelChange() will result in a full featured
+ update of model, view, and controller. When HandleModelChange() has
+ been called since the last LockModelChange() then this is done right
+ away to bring the view up-to-date.
+ */
+ void UnlockModelChange (void);
+
+ /** Prepare for a model change. This method does all the things that
+ need to be done _before_ the model changes, e.g. because they need
+ access to the model data before the change.
+ */
+ void PreModelChange (void);
+
+ /** Complete a model change. This includes the recreation of data
+ structures that depend on the model and the request for a repaint to
+ show the changes.
+ */
+ void PostModelChange (void);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index cce263a19cca..4f21e48cce93 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -112,8 +112,8 @@ bool SlideSorterModel::SetEditMode (EditMode eEditMode)
if (meEditMode != eEditMode)
{
meEditMode = eEditMode;
- ClearDescriptorList();
UpdatePageList();
+ ClearDescriptorList();
bEditModeChanged = true;
}
return bEditModeChanged;
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
index 7a4af551f6d1..77dbc1fa4b22 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -411,7 +411,7 @@ Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage (void)
// When there is not yet a sub controller (during initialization) then fall back
// to the current page in mpCurrentPage.
- if ( ! xPage.is() && mpCurrentPage != NULL)
+ if ( ! xPage.is() && mpCurrentPage.is())
xPage = Reference<drawing::XDrawPage>(mpCurrentPage->getUnoPage(), UNO_QUERY);
return xPage;
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index b044d1552e9f..3f295e10b529 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -114,7 +114,7 @@ public:
*/
void ProvideOutlinerView (
Outliner& rOutliner,
- ViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
::Window* pWindow);
/** This method is called when the OutlinerView is no longer used.
@@ -150,7 +150,7 @@ Outliner::Outliner( SdDrawDocument* pDoc, USHORT nMode )
mpImpl(new Implementation()),
meMode(SEARCH),
mpView(NULL),
- mpViewShell(NULL),
+ mpViewShell(),
mpWindow(NULL),
mpDrawDocument(pDoc),
mnConversionLanguage(LANGUAGE_NONE),
@@ -285,10 +285,10 @@ void Outliner::PrepareSpelling (void)
ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current());
if (pBase != NULL)
- SetViewShell (pBase->GetMainViewShell().get());
+ SetViewShell (pBase->GetMainViewShell());
SetRefDevice( SD_MOD()->GetRefDevice( *mpDrawDocument->GetDocSh() ) );
- if (mpViewShell != NULL)
+ if (mpViewShell.get() != NULL)
{
mbStringFound = FALSE;
@@ -336,13 +336,13 @@ void Outliner::EndSpelling (void)
{
ViewShellBase* pBase = PTR_CAST(ViewShellBase,SfxViewShell::Current());
if (pBase != NULL)
- mpViewShell = pBase->GetMainViewShell().get();
+ mpViewShell = pBase->GetMainViewShell();
else
- mpViewShell = NULL;
+ mpViewShell.reset();
// When in <member>PrepareSpelling()</member> a new outline view has
// been created then delete it here.
- sal_Bool bViewIsDrawViewShell(mpViewShell!=NULL
+ sal_Bool bViewIsDrawViewShell(mpViewShell.get()!=NULL
&& mpViewShell->ISA(DrawViewShell));
if (bViewIsDrawViewShell)
{
@@ -386,12 +386,14 @@ void Outliner::EndSpelling (void)
RestoreStartPosition ();
}
- mpViewShell = NULL;
+ mpViewShell.reset();
mpView = NULL;
mpWindow = NULL;
}
+
+
BOOL Outliner::SpellNextDocument (void)
{
if (mpViewShell->ISA(OutlineViewShell))
@@ -509,9 +511,9 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
bool bAbort = false;
if (pBase != NULL)
{
- ViewShell* pShell = pBase->GetMainViewShell().get();
- SetViewShell (pShell);
- if (pShell == NULL)
+ ::boost::shared_ptr<ViewShell> pShell (pBase->GetMainViewShell());
+ SetViewShell(pShell);
+ if (pShell.get() == NULL)
bAbort = true;
else
switch (pShell->GetShellType())
@@ -758,12 +760,11 @@ void Outliner::DetectChange (void)
{
::sd::outliner::IteratorPosition aPosition (maCurrentPosition);
- DrawViewShell* pDrawViewShell = NULL;
- if (mpViewShell->ISA(DrawViewShell))
- pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
// Detect whether the view has been switched from the outside.
- if (pDrawViewShell != NULL
+ if (pDrawViewShell.get() != NULL
&& (aPosition.meEditMode != pDrawViewShell->GetEditMode()
|| aPosition.mePageKind != pDrawViewShell->GetPageKind()))
{
@@ -858,9 +859,9 @@ void Outliner::RememberStartPosition (void)
{
if (mpViewShell->ISA(DrawViewShell))
{
- DrawViewShell* pDrawViewShell =
- static_cast<DrawViewShell*>(mpViewShell);
- if (pDrawViewShell != NULL)
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ if (pDrawViewShell.get() != NULL)
{
meStartViewMode = pDrawViewShell->GetPageKind();
meStartEditMode = pDrawViewShell->GetEditMode();
@@ -917,10 +918,10 @@ void Outliner::RestoreStartPosition (void)
{
if (mpViewShell->ISA(DrawViewShell))
{
- DrawViewShell* pDrawViewShell =
- static_cast<DrawViewShell*>(mpViewShell);
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
SetViewMode (meStartViewMode);
- if (pDrawViewShell != NULL)
+ if (pDrawViewShell.get() != NULL)
SetPage (meStartEditMode, mnStartPageIndex);
@@ -1263,10 +1264,11 @@ void Outliner::PrepareSearchAndReplace (void)
void Outliner::SetViewMode (PageKind ePageKind)
{
- if (ePageKind != static_cast<DrawViewShell*>(mpViewShell)->GetPageKind())
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ if (pDrawViewShell.get()!=NULL && ePageKind != pDrawViewShell->GetPageKind())
{
// Restore old edit mode.
- DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, FALSE);
SetStatusEventHdl(Link());
@@ -1290,13 +1292,17 @@ void Outliner::SetViewMode (PageKind ePageKind)
bool bMatchMayExist = mbMatchMayExist;
ViewShellBase& rBase = mpViewShell->GetViewShellBase();
- SetViewShell (NULL);
+ SetViewShell(::boost::shared_ptr<ViewShell>());
framework::FrameworkHelper::Instance(rBase)->RequestView(
sViewURL,
framework::FrameworkHelper::msCenterPaneURL);
- framework::FrameworkHelper::Instance(rBase)->WaitForEvent(
- framework::FrameworkHelper::msConfigurationUpdateEndEvent);
+ // Force (well, request) a synchronous update of the configuration.
+ // In a better world we would handle the asynchronous view update
+ // instead. But that would involve major restucturing of the
+ // Outliner code.
+ framework::FrameworkHelper::Instance(rBase)->RequestSynchronousUpdate();
+ SetViewShell(rBase.GetMainViewShell());
// Switching to another view shell has intermediatly called
// EndSpelling(). A PrepareSpelling() is pending, so call that now.
@@ -1312,8 +1318,10 @@ void Outliner::SetViewMode (PageKind ePageKind)
// Save edit mode so that it can be restored when switching the view
// shell again.
- pDrawViewShell = static_cast<DrawViewShell*>(mpViewShell);
- mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode();
+ pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell);
+ OSL_ASSERT(pDrawViewShell.get()!=NULL);
+ if (pDrawViewShell.get() != NULL)
+ mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode();
}
}
@@ -1324,9 +1332,14 @@ void Outliner::SetPage (EditMode eEditMode, USHORT nPageIndex)
{
if ( ! mbRestrictSearchToSelection)
{
- static_cast<DrawViewShell*>(mpViewShell)->ChangeEditMode(
- eEditMode, FALSE);
- static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nPageIndex);
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mpViewShell));
+ OSL_ASSERT(pDrawViewShell.get()!=NULL);
+ if (pDrawViewShell.get() != NULL)
+ {
+ pDrawViewShell->ChangeEditMode(eEditMode, FALSE);
+ pDrawViewShell->SwitchPage(nPageIndex);
+ }
}
}
@@ -1500,20 +1513,18 @@ SdrObject* Outliner::SetObject (
-void Outliner::SetViewShell (ViewShell* pViewShell)
+void Outliner::SetViewShell (const ::boost::shared_ptr<ViewShell>& rpViewShell)
{
- OSL_TRACE("Outliner %p: SetViewShell to %p with outline view at %p",
- this, pViewShell, mpImpl->GetOutlinerView());
- if (mpViewShell != pViewShell)
+ if (mpViewShell != rpViewShell)
{
// Set the new view shell.
- mpViewShell = pViewShell;
+ mpViewShell = rpViewShell;
// When the outline view is not owned by us then we have to clear
// that pointer so that the current one for the new view shell will
// be used (in ProvideOutlinerView).
// if ( ! mbOwnOutlineView)
// mpOutlineView = NULL;
- if (mpViewShell != NULL)
+ if (mpViewShell.get() != NULL)
{
mpView = mpViewShell->GetView();
@@ -1625,7 +1636,7 @@ void Outliner::BeginConversion (void)
ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
if (pBase != NULL)
- SetViewShell (pBase->GetMainViewShell().get());
+ SetViewShell (pBase->GetMainViewShell());
if (mpViewShell != NULL)
{
@@ -1781,12 +1792,12 @@ OutlinerView* Outliner::Implementation::GetOutlinerView ()
*/
void Outliner::Implementation::ProvideOutlinerView (
Outliner& rOutliner,
- ViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
::Window* pWindow)
{
- if (pViewShell != NULL)
+ if (rpViewShell.get() != NULL)
{
- switch (pViewShell->GetShellType())
+ switch (rpViewShell->GetShellType())
{
case ViewShell::ST_DRAW:
case ViewShell::ST_IMPRESS:
@@ -1816,7 +1827,7 @@ void Outliner::Implementation::ProvideOutlinerView (
rOutliner.SetText( String(), rOutliner.GetParagraph( 0 ) );
meOriginalEditMode =
- static_cast<DrawViewShell*>(pViewShell)->GetEditMode();
+ ::boost::static_pointer_cast<DrawViewShell>(rpViewShell)->GetEditMode();
}
break;
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx
index b8b718f58a86..084d7735e99c 100644
--- a/sd/source/ui/view/OutlinerIterator.cxx
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -217,14 +217,14 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
return CreateSelectionIterator (
mpOutliner->maMarkListCopy,
mpOutliner->mpDrawDocument,
- static_cast<DrawViewShell*>(mpOutliner->mpViewShell),
+ mpOutliner->mpViewShell,
mpOutliner->mbDirectionIsForward,
aLocation);
else
// Search in the whole document.
return CreateDocumentIterator (
mpOutliner->mpDrawDocument,
- static_cast<DrawViewShell*>(mpOutliner->mpViewShell),
+ mpOutliner->mpViewShell,
mpOutliner->mbDirectionIsForward,
aLocation);
}
@@ -232,10 +232,12 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation)
Iterator OutlinerContainer::CreateSelectionIterator (
const ::std::vector<SdrObjectWeakRef>& rObjectList,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward,
IteratorLocation aLocation)
{
+ OSL_ASSERT(rpViewShell.get());
+
sal_Int32 nObjectIndex;
if (bDirectionIsForward)
@@ -264,86 +266,111 @@ Iterator OutlinerContainer::CreateSelectionIterator (
}
return Iterator (new SelectionIteratorImpl (
- rObjectList, nObjectIndex, pDocument, pViewShell, bDirectionIsForward));
+ rObjectList, nObjectIndex, pDocument, rpViewShell, bDirectionIsForward));
}
Iterator OutlinerContainer::CreateViewIterator (
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward,
IteratorLocation aLocation)
{
- sal_Int32 nPageIndex = GetPageIndex (pDocument, pViewShell,
- pViewShell->GetPageKind(), pViewShell->GetEditMode(),
- bDirectionIsForward, aLocation);
+ OSL_ASSERT(rpViewShell.get());
+
+ const ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
+ sal_Int32 nPageIndex = GetPageIndex (
+ pDocument,
+ rpViewShell,
+ pDrawViewShell.get() ? pDrawViewShell->GetPageKind() : PK_STANDARD,
+ pDrawViewShell.get() ? pDrawViewShell->GetEditMode() : EM_PAGE,
+ bDirectionIsForward,
+ aLocation);
return Iterator (new ViewIteratorImpl (
- nPageIndex, pDocument, pViewShell, bDirectionIsForward));
+ nPageIndex, pDocument, rpViewShell, bDirectionIsForward));
}
Iterator OutlinerContainer::CreateDocumentIterator (
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
bool bDirectionIsForward,
IteratorLocation aLocation)
{
+ OSL_ASSERT(rpViewShell.get());
+
PageKind ePageKind;
EditMode eEditMode;
- if (bDirectionIsForward)
- switch (aLocation)
- {
- case BEGIN:
- default:
+ switch (aLocation)
+ {
+ case BEGIN:
+ default:
+ if (bDirectionIsForward)
+ {
ePageKind = PK_STANDARD;
eEditMode = EM_PAGE;
- break;
- case END:
+ }
+ else
+ {
ePageKind = PK_HANDOUT;
eEditMode = EM_MASTERPAGE;
- break;
- case CURRENT:
- ePageKind = pViewShell->GetPageKind();
- eEditMode = pViewShell->GetEditMode();
- break;
- }
- else
- switch (aLocation)
- {
- case BEGIN:
- default:
+ }
+ break;
+
+ case END:
+ if (bDirectionIsForward)
+ {
ePageKind = PK_HANDOUT;
eEditMode = EM_MASTERPAGE;
- break;
- case END:
+ }
+ else
+ {
ePageKind = PK_STANDARD;
eEditMode = EM_PAGE;
- break;
- case CURRENT:
- ePageKind = pViewShell->GetPageKind();
- eEditMode = pViewShell->GetEditMode();
- break;
- }
+ }
+ break;
+
+ case CURRENT:
+ const ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
+ if (pDrawViewShell.get())
+ {
+ ePageKind = pDrawViewShell->GetPageKind();
+ eEditMode = pDrawViewShell->GetEditMode();
+ }
+ else
+ {
+ ePageKind = PK_STANDARD;
+ eEditMode = EM_PAGE;
+ }
+ break;
+ }
- sal_Int32 nPageIndex = GetPageIndex (pDocument, pViewShell,
+ sal_Int32 nPageIndex = GetPageIndex (pDocument, rpViewShell,
ePageKind, eEditMode, bDirectionIsForward, aLocation);
return Iterator (
new DocumentIteratorImpl (nPageIndex, ePageKind, eEditMode,
- pDocument, pViewShell, bDirectionIsForward));
+ pDocument, rpViewShell, bDirectionIsForward));
}
sal_Int32 OutlinerContainer::GetPageIndex (
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::shared_ptr<ViewShell>& rpViewShell,
PageKind ePageKind,
EditMode eEditMode,
bool bDirectionIsForward,
IteratorLocation aLocation)
{
+ OSL_ASSERT(rpViewShell);
+
sal_Int32 nPageIndex;
sal_Int32 nPageCount;
+ const ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
+
switch (eEditMode)
{
case EM_PAGE:
@@ -356,34 +383,36 @@ sal_Int32 OutlinerContainer::GetPageIndex (
nPageCount = 0;
}
- if (bDirectionIsForward)
- switch (aLocation)
- {
- case CURRENT:
- nPageIndex = pViewShell->GetCurPageId() - 1;
- break;
- case BEGIN:
- default:
+ switch (aLocation)
+ {
+ case CURRENT:
+ if (pDrawViewShell.get())
+ nPageIndex = pDrawViewShell->GetCurPageId() - 1;
+ else
+ {
+ const SdPage* pPage = rpViewShell->GetActualPage();
+ if (pPage != NULL)
+ nPageIndex = (pPage->GetPageNum()-1)/2;
+ else
+ nPageIndex = 0;
+ }
+ break;
+
+ case BEGIN:
+ default:
+ if (bDirectionIsForward)
nPageIndex = 0;
- break;
- case END:
- nPageIndex = nPageCount;
- break;
- }
- else
- switch (aLocation)
- {
- case CURRENT:
- nPageIndex = pViewShell->GetCurPageId() - 1;
- break;
- case BEGIN:
- default:
+ else
nPageIndex = nPageCount-1;
- break;
- case END:
+ break;
+
+ case END:
+ if (bDirectionIsForward)
+ nPageIndex = nPageCount;
+ else
nPageIndex = -1;
- break;
- }
+ break;
+ }
return nPageIndex;
}
@@ -393,20 +422,36 @@ sal_Int32 OutlinerContainer::GetPageIndex (
//===== IteratorImplBase ====================================================
-IteratorImplBase::IteratorImplBase(SdDrawDocument* pDocument, DrawViewShell* pViewShell, bool bDirectionIsForward)
+IteratorImplBase::IteratorImplBase(SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward)
: maPosition()
, mpDocument (pDocument)
-, mpViewShell (pViewShell)
+, mpViewShellWeak (rpViewShellWeak)
, mbDirectionIsForward (bDirectionIsForward)
{
- maPosition.mePageKind = pViewShell->GetPageKind();
- maPosition.meEditMode = pViewShell->GetEditMode();
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell;
+ if ( ! mpViewShellWeak.expired())
+ pDrawViewShell = ::boost::dynamic_pointer_cast<DrawViewShell>(rpViewShellWeak.lock());
+
+ if (pDrawViewShell.get())
+ {
+ maPosition.mePageKind = pDrawViewShell->GetPageKind();
+ maPosition.meEditMode = pDrawViewShell->GetEditMode();
+ }
+ else
+ {
+ maPosition.mePageKind = PK_STANDARD;
+ maPosition.meEditMode = EM_PAGE;
+ }
}
-IteratorImplBase::IteratorImplBase( SdDrawDocument* pDocument, DrawViewShell* pViewShell,bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode)
+IteratorImplBase::IteratorImplBase( SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
+ bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode)
: maPosition()
, mpDocument (pDocument)
-, mpViewShell (pViewShell)
+, mpViewShellWeak (rpViewShellWeak)
, mbDirectionIsForward (bDirectionIsForward)
{
maPosition.mePageKind = ePageKind;
@@ -443,7 +488,7 @@ IteratorImplBase* IteratorImplBase::Clone (IteratorImplBase* pObject) const
{
pObject->maPosition = maPosition;
pObject->mpDocument = mpDocument;
- pObject->mpViewShell = mpViewShell;
+ pObject->mpViewShellWeak = mpViewShellWeak;
pObject->mbDirectionIsForward = mbDirectionIsForward;
}
return pObject;
@@ -464,12 +509,13 @@ SelectionIteratorImpl::SelectionIteratorImpl (
const ::std::vector<SdrObjectWeakRef>& rObjectList,
sal_Int32 nObjectIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward)
- : IteratorImplBase (pDocument, pViewShell, bDirectionIsForward),
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
mrObjectList(rObjectList),
mnObjectIndex(nObjectIndex)
-{}
+{
+}
SelectionIteratorImpl::~SelectionIteratorImpl (void)
{}
@@ -479,7 +525,7 @@ IteratorImplBase* SelectionIteratorImpl::Clone (IteratorImplBase* pObject) const
SelectionIteratorImpl* pIterator = static_cast<SelectionIteratorImpl*>(pObject);
if (pIterator == NULL)
pIterator = new SelectionIteratorImpl (
- mrObjectList, mnObjectIndex, mpDocument, mpViewShell, mbDirectionIsForward);
+ mrObjectList, mnObjectIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward);
return pIterator;
}
@@ -570,9 +616,9 @@ bool SelectionIteratorImpl::IsEqual (
ViewIteratorImpl::ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward)
- : IteratorImplBase (pDocument, pViewShell, bDirectionIsForward),
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward),
mbPageChangeOccured(false),
mpPage(NULL),
mpObjectIterator(NULL)
@@ -586,11 +632,11 @@ ViewIteratorImpl::ViewIteratorImpl (
ViewIteratorImpl::ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
- DrawViewShell* pViewShell,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward,
PageKind ePageKind,
EditMode eEditMode)
- : IteratorImplBase (pDocument, pViewShell, bDirectionIsForward, ePageKind, eEditMode),
+ : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode),
mbPageChangeOccured(false),
mpPage(NULL),
mpObjectIterator(NULL)
@@ -614,7 +660,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const
ViewIteratorImpl* pIterator = static_cast<ViewIteratorImpl*>(pObject);
if (pIterator == NULL)
pIterator = new ViewIteratorImpl (
- maPosition.mnPageIndex, mpDocument, mpViewShell, mbDirectionIsForward);
+ maPosition.mnPageIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward);
IteratorImplBase::Clone (pObject);
@@ -772,9 +818,10 @@ void ViewIteratorImpl::Reverse (void)
DocumentIteratorImpl::DocumentIteratorImpl (
sal_Int32 nPageIndex,
PageKind ePageKind, EditMode eEditMode,
- SdDrawDocument* pDocument, DrawViewShell* pViewShell,
+ SdDrawDocument* pDocument,
+ const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward)
- : ViewIteratorImpl (nPageIndex, pDocument, pViewShell, bDirectionIsForward,
+ : ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, bDirectionIsForward,
ePageKind, eEditMode)
{
if (eEditMode == EM_PAGE)
@@ -798,7 +845,7 @@ IteratorImplBase* DocumentIteratorImpl::Clone (IteratorImplBase* pObject) const
if (pIterator == NULL)
pIterator = new DocumentIteratorImpl (
maPosition.mnPageIndex, maPosition.mePageKind, maPosition.meEditMode,
- mpDocument, mpViewShell, mbDirectionIsForward);
+ mpDocument, mpViewShellWeak, mbDirectionIsForward);
// Finish the cloning.
return ViewIteratorImpl::Clone (pIterator);
}
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index bde39e18189d..8c14b57fe286 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -163,36 +163,42 @@ void TextObjectBar::Execute( SfxRequest &rReq )
}
for( ULONG nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
- SfxItemSet aAttr( pOLV->GetOutliner()->GetStyleSheet( nPara )->GetItemSet() );
- SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (USHORT) nPara ) );
- aAttr.Put( aTmpSet, FALSE ); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
- const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
- SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
-
- long nUpper = pNewItem->GetUpper();
- if( nSlot == SID_PARASPACE_INCREASE )
- nUpper += 100;
- else
+ SfxStyleSheet* pStyleSheet = NULL;
+ if (pOLV->GetOutliner() != NULL)
+ pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
+ if (pStyleSheet != NULL)
{
- nUpper -= 100;
- nUpper = Max( (long) nUpper, 0L );
- }
- pNewItem->SetUpper( (USHORT) nUpper );
+ SfxItemSet aAttr( pStyleSheet->GetItemSet() );
+ SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (USHORT) nPara ) );
+ aAttr.Put( aTmpSet, FALSE ); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+ const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
+ SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
+
+ long nUpper = pNewItem->GetUpper();
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nUpper += 100;
+ else
+ {
+ nUpper -= 100;
+ nUpper = Max( (long) nUpper, 0L );
+ }
+ pNewItem->SetUpper( (USHORT) nUpper );
- long nLower = pNewItem->GetLower();
- if( nSlot == SID_PARASPACE_INCREASE )
- nLower += 100;
- else
- {
- nLower -= 100;
- nLower = Max( (long) nLower, 0L );
- }
- pNewItem->SetLower( (USHORT) nLower );
+ long nLower = pNewItem->GetLower();
+ if( nSlot == SID_PARASPACE_INCREASE )
+ nLower += 100;
+ else
+ {
+ nLower -= 100;
+ nLower = Max( (long) nLower, 0L );
+ }
+ pNewItem->SetLower( (USHORT) nLower );
- SfxItemSet aNewAttrs( aAttr );
- aNewAttrs.Put( *pNewItem );
- delete pNewItem;
- pOLV->GetOutliner()->SetParaAttribs( (USHORT)nPara, aNewAttrs );
+ SfxItemSet aNewAttrs( aAttr );
+ aNewAttrs.Put( *pNewItem );
+ delete pNewItem;
+ pOLV->GetOutliner()->SetParaAttribs( (USHORT)nPara, aNewAttrs );
+ }
}
}
else