diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-03-27 21:35:48 -0430 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-04-13 18:42:08 +0200 |
commit | 77f8397f989785d2623cfffc63a584bd3af894d6 (patch) | |
tree | 8e339ab2b32d85bcaa1310a5e0cd1d4d4e28527f /sd | |
parent | 6a0ca287e99a4f7262294c57b9bea0c5968edb41 (diff) |
Overload SdDrawDocument::InsertBookmark to use vector instead of List.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/drawdoc.hxx | 6 | ||||
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 75 |
2 files changed, 81 insertions, 0 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index b1a3e6ab752a..fb6af150db44 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -273,6 +273,12 @@ public: ::sd::DrawDocShell* pBookmarkDocSh, sal_Bool bCopy, Point* pObjPos); + sal_Bool InsertBookmark(const std::vector<rtl::OUString> &rBookmarkList, + std::vector<rtl::OUString> &rExchangeList, sal_Bool bLink, + sal_Bool bReplace, sal_uInt16 nPgPos, sal_Bool bNoDialogs, + ::sd::DrawDocShell* pBookmarkDocSh, sal_Bool bCopy, + Point* pObjPos); + bool IsStartWithPresentation() const; void SetStartWithPresentation( bool bStartWithPresentation ); diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 9db7af094b4a..d75ef2075b4d 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -437,6 +437,81 @@ sal_Bool SdDrawDocument::InsertBookmark( return bOK; } +sal_Bool SdDrawDocument::InsertBookmark( + const std::vector<rtl::OUString> &rBookmarkList, // Liste der Namen der einzufuegenden Bookmarks + std::vector<rtl::OUString> &rExchangeList, // Liste der zu verwendenen Namen + sal_Bool bLink, // Bookmarks sollen als Verknuepfung eingefuegt werden + sal_Bool bReplace, // Aktuellen Seiten (Standard&Notiz) werden ersetzt + sal_uInt16 nInsertPos, // Einfuegeposition fuer Seiten + sal_Bool bNoDialogs, // Keine Dialoge anzeigen + ::sd::DrawDocShell* pBookmarkDocSh, // Wenn gesetzt, so ist dieses das Source-Dokument + sal_Bool bCopy, // Seiten werden kopiert + Point* pObjPos) // Einfuegeposition fuer Objekte +{ + sal_Bool bOK = sal_True; + sal_Bool bInsertPages = sal_False; + + if (rBookmarkList.empty()) + { + /********************************************************************** + * Alle Seiten werden eingefuegt + **********************************************************************/ + bInsertPages = sal_True; + } + else + { + SdDrawDocument* pBookmarkDoc = NULL; + String aBookmarkName; + + if (pBookmarkDocSh) + { + pBookmarkDoc = pBookmarkDocSh->GetDoc(); + aBookmarkName = pBookmarkDocSh->GetMedium()->GetName(); + } + else if ( mxBookmarkDocShRef.Is() ) + { + pBookmarkDoc = mxBookmarkDocShRef->GetDoc(); + aBookmarkName = maBookmarkFile; + } + else + bOK = sal_False; + + std::vector<rtl::OUString>::const_iterator pIter; + for ( pIter = rBookmarkList.begin(); bOK && pIter != rBookmarkList.end() && !bInsertPages; ++pIter ) + { + /****************************************************************** + * Gibt es in der Bookmark-Liste einen Seitennamen? + ******************************************************************/ + String aBMPgName(*pIter); + sal_Bool bIsMasterPage; + + if( pBookmarkDoc->GetPageByName( aBMPgName, bIsMasterPage ) != SDRPAGE_NOTFOUND ) + { + // Seite gefunden + bInsertPages = sal_True; + } + } + } + + sal_Bool bCalcObjCount = !rExchangeList.empty(); + + if ( bOK && bInsertPages ) + { + // Zuerst werden alle Seiten-Bookmarks eingefuegt + bOK = InsertBookmarkAsPage(rBookmarkList, rExchangeList, bLink, bReplace, + nInsertPos, bNoDialogs, pBookmarkDocSh, bCopy, sal_True, sal_False); + } + + if ( bOK && !rBookmarkList.empty() ) + { + // Es werden alle Objekt-Bookmarks eingefuegt + bOK = InsertBookmarkAsObject(rBookmarkList, rExchangeList, bLink, + pBookmarkDocSh, pObjPos, bCalcObjCount); + } + + return bOK; +} + sal_Bool SdDrawDocument::InsertBookmarkAsPage( List* pBookmarkList, List* pExchangeList, // Liste der zu verwendenen Namen |