summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rwxr-xr-x[-rw-r--r--]sd/inc/FactoryIds.hxx3
-rwxr-xr-xsd/source/core/sdpage.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/filter/ppt/propread.cxx128
-rwxr-xr-x[-rw-r--r--]sd/source/ui/animations/CustomAnimationList.hxx1
-rwxr-xr-xsd/source/ui/app/strings.src4
-rwxr-xr-xsd/source/ui/dlg/PaneChildWindows.cxx26
-rwxr-xr-xsd/source/ui/inc/strings.hrc1
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx8
-rwxr-xr-xsd/source/ui/toolpanel/ToolPanelViewShell.cxx17
-rwxr-xr-xsd/source/ui/toolpanel/controls/DocumentHelper.cxx93
-rwxr-xr-xsd/source/ui/view/GraphicViewShellBase.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/view/ImpressViewShellBase.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/view/OutlineViewShellBase.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/view/PresentationViewShellBase.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/view/SlideSorterViewShellBase.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx2
-rwxr-xr-xsd/source/ui/view/sdwindow.cxx4
20 files changed, 212 insertions, 95 deletions
diff --git a/sd/inc/FactoryIds.hxx b/sd/inc/FactoryIds.hxx
index 66477a1faf67..4f2346942fc9 100644..100755
--- a/sd/inc/FactoryIds.hxx
+++ b/sd/inc/FactoryIds.hxx
@@ -42,8 +42,7 @@ enum ViewShellFactoryIds
DRAW_FACTORY_ID = 1,
SLIDE_SORTER_FACTORY_ID = 2,
OUTLINE_FACTORY_ID = 3,
- PRESENTATION_FACTORY_ID = 4,
- PREVIEW_FACTORY_ID = 5
+ PRESENTATION_FACTORY_ID = 4
};
} // end of namespace sd
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 82a841a199c8..971bb2340069 100755
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2355,7 +2355,7 @@ SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind,
}
}
- if ( pObj && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
+ if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
pObj->AdjustToMaxRect( aRect );
return pObj;
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 54acab192cb5..ff1250bdf090 100644..100755
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -29,6 +29,7 @@
#include "precompiled_sd.hxx"
#include <propread.hxx>
#include <tools/bigint.hxx>
+#include "tools/debug.hxx"
#include "rtl/tencinfo.h"
#include "rtl/textenc.h"
@@ -90,6 +91,17 @@ void PropItem::Clear()
// -----------------------------------------------------------------------
+static xub_StrLen lcl_getMaxSafeStrLen(sal_uInt32 nSize)
+{
+ nSize -= 1; //Drop NULL terminator
+
+ //If it won't fit in a string, clip it to the max size that does
+ if (nSize > STRING_MAXLEN)
+ nSize = STRING_MAXLEN;
+
+ return nSize;
+}
+
BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
{
sal_uInt32 i, nItemSize, nType, nItemPos;
@@ -108,36 +120,43 @@ BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
{
case VT_LPSTR :
{
- if ( (sal_uInt16)nItemSize )
+ if ( nItemSize )
{
- sal_Char* pString = new sal_Char[ (sal_uInt16)nItemSize ];
- if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+ try
{
- nItemSize >>= 1;
- if ( (sal_uInt16)nItemSize > 1 )
+ sal_Char* pString = new sal_Char[ nItemSize ];
+ if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
{
- sal_Unicode* pWString = (sal_Unicode*)pString;
- for ( i = 0; i < (sal_uInt16)nItemSize; i++ )
- *this >> pWString[ i ];
- rString = String( pWString, (sal_uInt16)nItemSize - 1 );
- }
- else
- rString = String();
- bRetValue = sal_True;
- }
- else
- {
- SvMemoryStream::Read( pString, (sal_uInt16)nItemSize );
- if ( pString[ (sal_uInt16)nItemSize - 1 ] == 0 )
- {
- if ( (sal_uInt16)nItemSize > 1 )
- rString = String( ByteString( pString ), mnTextEnc );
+ nItemSize >>= 1;
+ if ( nItemSize > 1 )
+ {
+ sal_Unicode* pWString = (sal_Unicode*)pString;
+ for ( i = 0; i < nItemSize; i++ )
+ *this >> pWString[ i ];
+ rString = String( pWString, lcl_getMaxSafeStrLen(nItemSize) );
+ }
else
rString = String();
bRetValue = sal_True;
}
+ else
+ {
+ SvMemoryStream::Read( pString, nItemSize );
+ if ( pString[ nItemSize - 1 ] == 0 )
+ {
+ if ( nItemSize > 1 )
+ rString = String( ByteString( pString ), mnTextEnc );
+ else
+ rString = String();
+ bRetValue = sal_True;
+ }
+ }
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ DBG_ERROR( "sd PropItem::Read bad alloc" );
}
- delete[] pString;
}
if ( bAlign )
SeekRel( ( 4 - ( nItemSize & 3 ) ) & 3 ); // dword align
@@ -148,18 +167,25 @@ BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
{
if ( nItemSize )
{
- sal_Unicode* pString = new sal_Unicode[ (sal_uInt16)nItemSize ];
- for ( i = 0; i < (sal_uInt16)nItemSize; i++ )
- *this >> pString[ i ];
- if ( pString[ i - 1 ] == 0 )
+ try
{
- if ( (sal_uInt16)nItemSize > 1 )
- rString = String( pString, (sal_uInt16)nItemSize - 1 );
- else
- rString = String();
- bRetValue = sal_True;
+ sal_Unicode* pString = new sal_Unicode[ nItemSize ];
+ for ( i = 0; i < nItemSize; i++ )
+ *this >> pString[ i ];
+ if ( pString[ i - 1 ] == 0 )
+ {
+ if ( (sal_uInt16)nItemSize > 1 )
+ rString = String( pString, lcl_getMaxSafeStrLen(nItemSize) );
+ else
+ rString = String();
+ bRetValue = sal_True;
+ }
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ DBG_ERROR( "sd PropItem::Read bad alloc" );
}
- delete[] pString;
}
if ( bAlign && ( nItemSize & 1 ) )
SeekRel( 2 ); // dword align
@@ -349,24 +375,31 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
for ( sal_uInt32 i = 0; i < nDictCount; i++ )
{
aStream >> nId >> nSize;
- if ( (sal_uInt16)nSize )
+ if ( nSize )
{
String aString;
nPos = aStream.Tell();
- sal_Char* pString = new sal_Char[ (sal_uInt16)nSize ];
- aStream.Read( pString, (sal_uInt16)nSize );
- if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+ try
{
- nSize >>= 1;
- aStream.Seek( nPos );
- sal_Unicode* pWString = (sal_Unicode*)pString;
- for ( i = 0; i < (sal_uInt16)nSize; i++ )
- aStream >> pWString[ i ];
- aString = String( pWString, (sal_uInt16)nSize - 1 );
+ sal_Char* pString = new sal_Char[ nSize ];
+ aStream.Read( pString, nSize );
+ if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+ {
+ nSize >>= 1;
+ aStream.Seek( nPos );
+ sal_Unicode* pWString = (sal_Unicode*)pString;
+ for ( i = 0; i < nSize; i++ )
+ aStream >> pWString[ i ];
+ aString = String( pWString, lcl_getMaxSafeStrLen(nSize) );
+ }
+ else
+ aString = String( ByteString( pString, lcl_getMaxSafeStrLen(nSize) ), mnTextEnc );
+ delete[] pString;
+ }
+ catch( const std::bad_alloc& )
+ {
+ DBG_ERROR( "sd Section::GetDictionary bad alloc" );
}
- else
- aString = String( ByteString( pString, (sal_uInt16)nSize - 1 ), mnTextEnc );
- delete[] pString;
if ( !aString.Len() )
break;
aDict.AddProperty( nId, aString );
@@ -500,6 +533,11 @@ void Section::Read( SvStorageStream *pStrm )
}
if ( nPropSize )
{
+ if ( nPropSize > nStrmSize )
+ {
+ nPropCount = 0;
+ break;
+ }
pStrm->Seek( nPropOfs + nSecOfs );
sal_uInt8* pBuf = new sal_uInt8[ nPropSize ];
pStrm->Read( pBuf, nPropSize );
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index 2fe96440030e..66b1e2c6a436 100644..100755
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -47,6 +47,7 @@ public:
virtual void onSelect() = 0;
virtual void onDoubleClick() = 0;
virtual void onContextMenu( USHORT nSelectedPopupEntry ) = 0;
+ virtual ~ICustomAnimationListController() {}
};
class CustomAnimationList : public SvTreeListBox, public ISequenceListener
diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index e992e7016f04..bb1199fdd352 100755
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -86,10 +86,6 @@ String RID_APPTITLE
{
Text = "StarImpress 4.0" ;
};
-String STR_DEFAULTVIEW
-{
- Text [ en-US ] = "Default" ;
-};
String STR_NULL
{
Text [ en-US ] = "None" ;
diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx
index 181fc8433c22..f9f181b0e44d 100755
--- a/sd/source/ui/dlg/PaneChildWindows.cxx
+++ b/sd/source/ui/dlg/PaneChildWindows.cxx
@@ -37,6 +37,9 @@
#include "strings.hrc"
#include "sdresid.hxx"
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
+
#include <sfx2/app.hxx>
#include <sfx2/dockwin.hxx>
#include <sfx2/bindings.hxx>
@@ -47,6 +50,9 @@ namespace sd {
using ::com::sun::star::uno::Reference;
using ::com::sun::star::drawing::framework::XResourceId;
+using ::com::sun::star::drawing::framework::XConfigurationController;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_ADD;
+using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS)
SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW)
@@ -151,6 +157,26 @@ ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, USHORT i_
:PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo,
FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT )
{
+ // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework
+ // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the
+ // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell
+ // which has this responsibility. And this view shell is created implicitly via the resource framework.)
+ // #i113788# / 2010-09-03 / frank.schoenheit@oracle.com
+ SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
+ ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
+ ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" );
+
+ const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
+ ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" );
+ Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() );
+ ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" );
+ xConfigController->requestResourceActivation(
+ framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ),
+ ResourceActivationMode_ADD );
+ xConfigController->requestResourceActivation(
+ framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ),
+ ResourceActivationMode_REPLACE
+ );
}
//----------------------------------------------------------------------------------------------------------------------
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
index d9dc93a1ef20..7f5086057e5c 100755
--- a/sd/source/ui/inc/strings.hrc
+++ b/sd/source/ui/inc/strings.hrc
@@ -28,7 +28,6 @@
#ifndef _SD_CFGID_HXX
#include "cfgids.hxx"
#endif
-#define STR_DEFAULTVIEW (RID_APP_START)
#define STR_NULL (RID_APP_START+3)
#define STR_INSERTPAGE (RID_APP_START+35)
#define STR_INSERTLAYER (RID_APP_START+37)
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index 6a85192f8418..76e9e411e81e 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -273,15 +273,19 @@ VisibleAreaScroller::VisibleAreaScroller (
// jump to within this distance of the final value and start the
// animation from there.
if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance)
+ {
if (aStart.X() < aEnd.X())
maStart.X() = aEnd.X()-gnMaxScrollDistance;
else
maStart.X() = aEnd.X()+gnMaxScrollDistance;
+ }
if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance)
+ {
if (aStart.Y() < aEnd.Y())
maStart.Y() = aEnd.Y()-gnMaxScrollDistance;
else
maStart.Y() = aEnd.Y()+gnMaxScrollDistance;
+ }
}
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index 5eaf64db7bf8..be964715f1a6 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -700,6 +700,7 @@ void SlideSorterModel::UpdateIndices (const sal_Int32 nFirstIndex)
{
SharedPageDescriptor& rpDescriptor (maPageDescriptors[nDescriptorIndex]);
if (rpDescriptor)
+ {
if (nDescriptorIndex < nFirstIndex)
{
if (rpDescriptor->GetPageIndex()!=nDescriptorIndex)
@@ -711,6 +712,7 @@ void SlideSorterModel::UpdateIndices (const sal_Int32 nFirstIndex)
{
rpDescriptor->SetPageIndex(nDescriptorIndex);
}
+ }
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index 1d98a217ff90..5f322e65141d 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -450,6 +450,7 @@ void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMod
{
model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
if (pDescriptor)
+ {
if (eMode == controller::Animator::AM_Animated)
maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
else
@@ -459,6 +460,7 @@ void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMod
rView.RequestRepaint(aOldBoundingBox);
rView.RequestRepaint(pDescriptor);
}
+ }
maEndOffset[nIndex] = Point(0,0);
}
if (eMode == controller::Animator::AM_Animated)
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 8d5b1cfbcdc8..a0bc19edb470 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -234,10 +234,12 @@ void PageObjectPainter::PaintPreview (
const Bitmap aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
if ( ! aPreview.IsEmpty())
+ {
if (aPreview.GetSizePixel() != aBox.GetSize())
rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
else
rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
+ }
}
}
@@ -342,10 +344,12 @@ void PageObjectPainter::PaintPageNumber (
// (preferred) or brighter font color.
const sal_Int32 nFontLuminance (aPageNumberColor.GetLuminance());
if (abs(nBackgroundLuminance - nFontLuminance) < 60)
+ {
if (nBackgroundLuminance > nFontLuminance-30)
aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberBrightBackground));
else
aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberDarkBackground));
+ }
}
}
@@ -387,10 +391,10 @@ Bitmap& PageObjectPainter::GetBackgroundForState (
const OutputDevice& rReferenceDevice)
{
enum State { None = 0x00, Selected = 0x01, MouseOver = 0x02, Focused = 0x04 };
- const State eState (State(
+ const int eState =
(rpDescriptor->HasState(model::PageDescriptor::ST_Selected) ? Selected : None)
| (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ? MouseOver : None)
- | (rpDescriptor->HasState(model::PageDescriptor::ST_Focused) ? Focused : None)));
+ | (rpDescriptor->HasState(model::PageDescriptor::ST_Focused) ? Focused : None);
switch (eState)
{
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index c62faf29ca50..f193b2ece851 100755
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -512,12 +512,20 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi
SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) );
+ // Some recent changes to the toolpanel make it necessary to create the
+ // accessibility object now. Creating it on demand would lead to a
+ // pointer cycle in the tree of accessibility objects and would lead
+ // e.g. the accerciser AT tool into an infinite loop.
+ // It would be nice to get rid of this workaround in the future.
+ if (mpContentWindow.get())
+ mpContentWindow->SetAccessible(mpImpl->CreateAccessible(*mpContentWindow));
+
// For accessibility we have to shortly hide the content window. This
// triggers the construction of a new accessibility object for the new
// view shell. (One is created earlier while the construtor of the base
// class is executed. At that time the correct accessibility object can
// not be constructed.)
- if ( mpContentWindow.get() )
+ if (mpContentWindow.get())
{
mpContentWindow->Hide();
mpContentWindow->Show();
@@ -633,7 +641,12 @@ DockingWindow* ToolPanelViewShell::GetDockingWindow()
Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
{
ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
- return mpImpl->CreateAccessible( *i_pWindow );
+ // As said above, we have to create the accessibility object
+ // (unconditionally) in the constructor, not here on demand, or
+ // otherwise we would create a cycle in the tree of accessible objects
+ // which could lead to infinite loops in AT tools.
+ // return mpImpl->CreateAccessible( *i_pWindow );
+ return Reference<XAccessible>();
}
// ---------------------------------------------------------------------------------------------------------------------
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
index b9040e72283f..c5919b7aa7ee 100755
--- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
+++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
@@ -503,45 +503,78 @@ SdPage* DocumentHelper::ProvideMasterPage (
SdPage* pMasterPage,
const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
{
- SdPage* pMasterPageInDocument = NULL;
-
- // Get notes master page.
+ // Make sure that both the master page and its notes master exist
+ // in the source document. If one is missing then return without
+ // making any changes.
+ if (pMasterPage == NULL)
+ {
+ // The caller should make sure that the master page is valid.
+ OSL_ASSERT(pMasterPage != NULL);
+ return NULL;
+ }
SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ if (pSourceDocument == NULL)
+ return NULL;
SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage (pMasterPage->GetPageNum()+1));
- if (pNotesMasterPage != NULL)
+ pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
+ if (pNotesMasterPage == NULL)
{
- // When the given master page or its associated notes master page do
- // not already belong to the document we have to create copies of
- // them and insert them into the document.
-
- // Determine the position where the new master pages are inserted.
- // By default they are inserted at the end. When we assign to a
- // master page then insert after the last of the (selected) pages.
- USHORT nInsertionIndex = rTargetDocument.GetMasterPageCount();
- if (rpPageList->front()->IsMasterPage())
+ // The model is not in a valid state. Maybe a new master page
+ // is being (not finished yet) created? Return without making
+ // any changes.
+ return NULL;
+ }
+
+ SdPage* pMasterPageInDocument = NULL;
+ // Search for a master page with the same name as the given one in
+ // the target document.
+ const XubString sMasterPageLayoutName (pMasterPage->GetLayoutName());
+ for (USHORT nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex));
+ if (pCandidate!=NULL
+ && sMasterPageLayoutName==pCandidate->GetLayoutName())
{
- nInsertionIndex = rpPageList->back()->GetPageNum();
+ // The requested master page does already exist in the
+ // target document, return it.
+ return pCandidate;
}
+ }
- if (pMasterPage->GetModel() != &rTargetDocument)
- {
- pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
- if( rTargetDocument.IsUndoEnabled() )
+ // The given master page does not already belong to the target
+ // document so we have to create copies and insert them into the
+ // targer document.
+
+ // Determine the position where the new master pages are inserted.
+ // By default they are inserted at the end. When we assign to a
+ // master page then insert after the last of the (selected) pages.
+ USHORT nInsertionIndex = rTargetDocument.GetMasterPageCount();
+ if (rpPageList->front()->IsMasterPage())
+ {
+ nInsertionIndex = rpPageList->back()->GetPageNum();
+ }
+
+ // Clone the master page.
+ if (pMasterPage->GetModel() != &rTargetDocument)
+ {
+ pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
+ if( rTargetDocument.IsUndoEnabled() )
rTargetDocument.AddUndo(
rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument));
- }
- else
- pMasterPageInDocument = pMasterPage;
- if (pNotesMasterPage->GetModel() != &rTargetDocument)
- {
- SdPage* pClonedNotesMasterPage
- = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
- if( rTargetDocument.IsUndoEnabled() )
- rTargetDocument.AddUndo(
- rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
- }
}
+ else
+ pMasterPageInDocument = pMasterPage;
+
+ // Clone the notes master.
+ if (pNotesMasterPage->GetModel() != &rTargetDocument)
+ {
+ SdPage* pClonedNotesMasterPage
+ = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
+ if( rTargetDocument.IsUndoEnabled() )
+ rTargetDocument.AddUndo(
+ rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
+ }
+
return pMasterPageInDocument;
}
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
index 759103760bfe..99e45a0d05d6 100755
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -62,7 +62,7 @@ SfxViewShell* __EXPORT GraphicViewShellBase::CreateInstance (
void GraphicViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"Default");
InitFactory();
}
void GraphicViewShellBase::InitFactory()
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx b/sd/source/ui/view/ImpressViewShellBase.cxx
index 0cd5971eb51e..69906fbfd5d8 100644..100755
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -62,7 +62,7 @@ SfxViewShell* __EXPORT ImpressViewShellBase::CreateInstance (
void ImpressViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"Default");
InitFactory();
}
void ImpressViewShellBase::InitFactory()
diff --git a/sd/source/ui/view/OutlineViewShellBase.cxx b/sd/source/ui/view/OutlineViewShellBase.cxx
index 762219c88016..3c31155a9fb5 100644..100755
--- a/sd/source/ui/view/OutlineViewShellBase.cxx
+++ b/sd/source/ui/view/OutlineViewShellBase.cxx
@@ -60,7 +60,7 @@ SfxViewShell* __EXPORT OutlineViewShellBase::CreateInstance (
void OutlineViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"Outline");
InitFactory();
}
void OutlineViewShellBase::InitFactory()
diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx b/sd/source/ui/view/PresentationViewShellBase.cxx
index a16b12d3cb63..0fcb421a9888 100644..100755
--- a/sd/source/ui/view/PresentationViewShellBase.cxx
+++ b/sd/source/ui/view/PresentationViewShellBase.cxx
@@ -70,7 +70,7 @@ SfxViewShell* __EXPORT PresentationViewShellBase::CreateInstance (
void PresentationViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"FullScreenPresentation");
InitFactory();
}
void PresentationViewShellBase::InitFactory()
diff --git a/sd/source/ui/view/SlideSorterViewShellBase.cxx b/sd/source/ui/view/SlideSorterViewShellBase.cxx
index 466f699b1bb0..7944d2cf4b2e 100644..100755
--- a/sd/source/ui/view/SlideSorterViewShellBase.cxx
+++ b/sd/source/ui/view/SlideSorterViewShellBase.cxx
@@ -64,7 +64,7 @@ SfxViewShell* __EXPORT SlideSorterViewShellBase::CreateInstance (
void SlideSorterViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"SlideSorter");
InitFactory();
}
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 1e18ad5c5ee9..c748ffbc05e0 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -258,7 +258,7 @@ SfxViewShell* __EXPORT ViewShellBase::CreateInstance (
void ViewShellBase::RegisterFactory( USHORT nPrio )
{
pFactory = new SfxViewFactory(
- &CreateInstance,&InitFactory,nPrio,SdResId(STR_DEFAULTVIEW));
+ &CreateInstance,&InitFactory,nPrio,"Default");
InitFactory();
}
void ViewShellBase::InitFactory()
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 28873b3946a3..ed5dda39037c 100755
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -1165,11 +1165,11 @@ void Window::DropScroll(const Point& rMousePos)
Window::CreateAccessible (void)
{
if (mpViewShell != NULL)
- return mpViewShell->CreateAccessibleDocumentView (this);
+ return mpViewShell->CreateAccessibleDocumentView (this);
else
{
OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
- return ::Window::CreateAccessible ();
+ return ::Window::CreateAccessible ();
}
}