[storage] Allow to hook loading in 'load query'
[abstract.git] / view / aaPageView.cpp
blobdb01c3f4754dd7fd73ea725604a2bd5aae5bfb0b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
3 /*
4 * Copyright (C) 2007 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include <abstract/aacore.h>
24 #include "nsCOMPtr.h"
25 #include "nsComponentManagerUtils.h"
27 /* Unfrozen API */
28 #include "unstable/nsISHEntry.h"
29 #include "unstable/nsISHContainer.h"
31 /* Project includes */
32 #include <abstract/base/aaIDataNode.h>
33 #include <abstract/view/aaIPageView.h>
34 #include "aaPageView.h"
36 aaPageView::aaPageView(nsISupports *aOuter)
37 :mIndex(-1), mChoosingSet(PR_FALSE), mChoosing(PR_FALSE)
39 mSHE = do_QueryInterface(aOuter);
40 mSHC = do_QueryInterface(aOuter);
43 aaPageView::~aaPageView()
47 NS_IMPL_ISUPPORTS4(aaPageView,
48 nsIHistoryEntry,
49 nsISHEntry,
50 aaIPageView,
51 nsISHContainer)
52 /* aaIPageView */
53 NS_IMETHODIMP
54 aaPageView::GetBuffer(aaIDataNode * *aBuffer)
56 NS_ENSURE_ARG_POINTER(aBuffer);
57 NS_IF_ADDREF(*aBuffer = mBuffer);
58 return NS_OK;
60 NS_IMETHODIMP
61 aaPageView::SetBuffer(aaIDataNode *aBuffer)
63 mBuffer = aBuffer;
64 return NS_OK;
67 NS_IMETHODIMP
68 aaPageView::GetIndex(PRInt32 *aIndex)
70 NS_ENSURE_ARG_POINTER( aIndex );
71 *aIndex = mIndex;
72 return NS_OK;
74 NS_IMETHODIMP
75 aaPageView::SetIndex(PRInt32 aIndex)
77 mIndex = aIndex;
78 return NS_OK;
81 NS_IMETHODIMP
82 aaPageView::GetQueryChoice(nsISupports * *aQueryChoice)
84 NS_ENSURE_ARG_POINTER(aQueryChoice);
85 NS_IF_ADDREF(*aQueryChoice = mQueryChoice);
86 return NS_OK;
88 NS_IMETHODIMP
89 aaPageView::SetQueryChoice(nsISupports *aQueryChoice)
91 mQueryChoice = aQueryChoice;
92 return NS_OK;
95 NS_IMETHODIMP
96 aaPageView::GetChoosing(PRBool *aChoosing)
98 NS_ENSURE_ARG_POINTER( aChoosing );
99 *aChoosing = mChoosing;
100 return NS_OK;
102 NS_IMETHODIMP
103 aaPageView::SetChoosing(PRBool aChoosing)
105 if (mChoosingSet)
106 return NS_ERROR_ALREADY_INITIALIZED;
107 mChoosingSet = PR_TRUE;
108 mChoosing = aChoosing;
109 return NS_OK;