summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2012-02-01 18:01:17 +0530
committerMuthu Subramanian <sumuthu@suse.com>2012-02-01 18:02:28 +0530
commitfd33c0b1cf23020b27db25895eeb380653d734b6 (patch)
treeaba5ec3fd849695dcd48d203ecb179af717ef60b /sd
parentab8f1757cedf0029bf3bec40cfe48069a33151be (diff)
n#735533: Donot set duplicate master slide names.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/unopage.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 48673388dee1..a13a4faea0fa 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -3015,7 +3015,7 @@ void SdMasterPage::getBackground( Any& rValue ) throw()
}
// XNamed
-void SAL_CALL SdMasterPage::setName( const OUString& aName )
+void SAL_CALL SdMasterPage::setName( const OUString& rName )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
@@ -3024,11 +3024,18 @@ void SAL_CALL SdMasterPage::setName( const OUString& aName )
if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
{
- String aNewName( aName );
+ SdDrawDocument* pDoc = GetModel()->GetDoc();
+ sal_Bool bOutDummy;
+ String aNewName( rName );
+
+ // Slide Name has to be unique
+ if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND )
+ return; // throw Exception ?
+
GetPage()->SetName( aNewName );
- if(GetModel()->GetDoc())
- GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName);
+ if( pDoc )
+ pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName );
// fake a mode change to repaint the page tab bar
::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();