summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-03-25 16:31:29 -0430
committerCaolán McNamara <caolanm@redhat.com>2012-04-11 16:47:07 +0100
commit5b47338f50395e9697c14af1d98ac9081e611e16 (patch)
treee084576e2a1334f417d9ca927e8c6a9f53afdc86
parent656f560585e96b697ce6955cff30b1064a79c2c4 (diff)
Overload View::GetExchangeList to use vector instead of List.
-rw-r--r--sd/source/ui/inc/View.hxx15
-rw-r--r--sd/source/ui/view/sdview2.cxx63
2 files changed, 78 insertions, 0 deletions
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 3e712523a161..99901a5f01e3 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -168,6 +168,21 @@ public:
sal_Bool GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_uInt16 nType );
+ /*************************************************************************
+ |*
+ |* Rueckgabeparameter:
+ |* pExchangeList == NULL -> Namen sind alle eindeutig
+ |* bNameOK == sal_False -> Benutzer hat abgebrochen
+ |* nType == 0 -> Seiten
+ |* nType == 1 -> Objekte
+ |* nType == 2 -> Seiten + Objekte
+ |*
+ \************************************************************************/
+
+ bool GetExchangeList( std::vector<rtl::OUString> &rExchangeList,
+ std::vector<rtl::OUString> &rBookmarkList,
+ const sal_uInt16 nType );
+
virtual void onAccessibilityOptionsChanged();
virtual SdrModel* GetMarkedObjModel() const;
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 2a62767e2bde..9ed7b3da9486 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -1001,6 +1001,69 @@ sal_Bool View::GetExchangeList( List*& rpExchangeList, List* pBookmarkList, sal_
return( bNameOK );
}
+bool View::GetExchangeList (std::vector<rtl::OUString> &rExchangeList,
+ std::vector<rtl::OUString> &rBookmarkList,
+ const sal_uInt16 nType)
+{
+ assert(rExchangeList.empty());
+
+ bool bListIdentical = true; // BookmarkList und ExchangeList sind gleich
+ bool bNameOK = true; // Name ist eindeutig
+
+ std::vector<rtl::OUString>::const_iterator pIter;
+ for ( pIter = rBookmarkList.begin(); bNameOK && pIter != rBookmarkList.end(); ++pIter )
+ {
+ String tmp = *pIter; ///TODO: remove when CreateSvxNameDialog uses OUString!!
+ rtl::OUString aNewName = *pIter;
+
+ if( nType == 0 || nType == 2 )
+ bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), tmp);
+
+ if( bNameOK && ( nType == 1 || nType == 2 ) )
+ {
+ if( mrDoc.GetObj( aNewName ) )
+ {
+ rtl::OUString aTitle( ResId::toString(SdResId( STR_TITLE_NAMEGROUP ) ) ) ;
+ rtl::OUString aDesc( ResId::toString(SdResId( STR_DESC_NAMEGROUP ) ) );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* pDlg = 0;
+
+ if (pFact)
+ pDlg = pFact->CreateSvxNameDialog( mpViewSh->GetActiveWindow(), tmp, aDesc );
+
+ if( pDlg )
+ {
+ pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT );
+
+ bNameOK = false;
+ pDlg->SetText( aTitle );
+
+ while( !bNameOK && pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( tmp );
+
+ if( !mrDoc.GetObj( tmp ) )
+ bNameOK = true;
+ }
+
+ delete pDlg;
+ }
+ }
+ }
+
+ bListIdentical = (*pIter == aNewName);
+
+ rExchangeList.push_back(aNewName);
+ }
+
+ // ExchangeList ist mit BookmarkList identisch
+ if( !rExchangeList.empty() && bListIdentical )
+ rExchangeList.clear();
+
+ return bNameOK;
+}
+
typedef std::vector< std::pair< sal_uInt32, sal_uInt32 > > PathSurrogateVector;
typedef std::vector< SdrObject* > SdrObjectVector;