1 /* AbiWord
2  * Copyright (C) 2001 Tomas Frydrych
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA.
18  */
19 
20 #include "xap_Dialog_Id.h"
21 #include "xap_DialogFactory.h"
22 #include "ap_Dialog_InsertBookmark.h"
23 
AP_Dialog_InsertBookmark(XAP_DialogFactory * pDlgFactory,XAP_Dialog_Id id)24 AP_Dialog_InsertBookmark::AP_Dialog_InsertBookmark( XAP_DialogFactory * pDlgFactory,
25                                                     XAP_Dialog_Id id )
26     : AP_Dialog_Modal(pDlgFactory,id, "interface/dialogbookmark")
27     , m_answer(a_CANCEL)
28 {
29 	m_pBookmark[0] = 0;
30 }
31 
~AP_Dialog_InsertBookmark(void)32 AP_Dialog_InsertBookmark::~AP_Dialog_InsertBookmark(void)
33 {
34 }
35 
setAnswer(AP_Dialog_InsertBookmark::tAnswer a)36 void AP_Dialog_InsertBookmark::setAnswer(AP_Dialog_InsertBookmark::tAnswer a)
37 {
38   m_answer = a;
39 }
40 
getAnswer(void) const41 AP_Dialog_InsertBookmark::tAnswer AP_Dialog_InsertBookmark::getAnswer(void) const
42 {
43   return m_answer;
44 }
45 
getExistingBookmarksCount() const46 UT_sint32 AP_Dialog_InsertBookmark::getExistingBookmarksCount() const
47 {
48 	UT_return_val_if_fail (m_pDoc, 0);
49 	return m_pDoc->getBookmarkCount();
50 }
51 
getNthExistingBookmark(UT_uint32 n) const52 const std::string & AP_Dialog_InsertBookmark::getNthExistingBookmark(UT_uint32 n) const
53 {
54 	UT_ASSERT(m_pDoc);
55 	return m_pDoc->getNthBookmark(n);
56 }
57 
getBookmark() const58 const gchar * AP_Dialog_InsertBookmark::getBookmark() const
59 {
60   return m_pBookmark;
61 }
62 
setBookmark(const gchar * mark)63 void AP_Dialog_InsertBookmark::setBookmark(const gchar * mark)
64 {
65 	strncpy(m_pBookmark, mark, BOOKMARK_SIZE_LIMIT);
66 }
67 
setDoc(FV_View * pView)68 void AP_Dialog_InsertBookmark::setDoc(FV_View * pView)
69 {
70 	m_pDoc = pView->getDocument();
71 }
72