1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*40df464eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*40df464eSAndrew Rist * distributed with this work for additional information
6*40df464eSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*40df464eSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*40df464eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*40df464eSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist * software distributed under the License is distributed on an
15*40df464eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist * KIND, either express or implied. See the License for the
17*40df464eSAndrew Rist * specific language governing permissions and limitations
18*40df464eSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*40df464eSAndrew Rist *************************************************************/
21*40df464eSAndrew Rist
22*40df464eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include "HistoryOptTest.hxx"
25cdf0e10cSrcweir #include <unotools/historyoptions_const.hxx>
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
30cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx>
34cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx>
35cdf0e10cSrcweir #include <unotools/processfactory.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir namespace css = ::com::sun::star;
38cdf0e10cSrcweir
39cdf0e10cSrcweir //=============================================================================
40cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed.");
41cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed.");
42cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config.");
43cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config.");
44cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config.");
45cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item.");
46cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item.");
47cdf0e10cSrcweir static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list.");
48cdf0e10cSrcweir
49cdf0e10cSrcweir //=============================================================================
HistoryOptTest()50cdf0e10cSrcweir HistoryOptTest::HistoryOptTest()
51cdf0e10cSrcweir : m_aConfigItem ( )
52cdf0e10cSrcweir , m_eList (ePICKLIST)
53cdf0e10cSrcweir , m_xHistoriesXCU( )
54cdf0e10cSrcweir , m_xCommonXCU ( )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
58cdf0e10cSrcweir //=============================================================================
~HistoryOptTest()59cdf0e10cSrcweir HistoryOptTest::~HistoryOptTest()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir m_xHistoriesXCU.clear();
62cdf0e10cSrcweir m_xCommonXCU.clear();
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
65cdf0e10cSrcweir //=============================================================================
checkPicklist()66cdf0e10cSrcweir void HistoryOptTest::checkPicklist()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir impl_testHistory(ePICKLIST, 4);
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir //=============================================================================
checkURLHistory()72cdf0e10cSrcweir void HistoryOptTest::checkURLHistory()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir impl_testHistory(eHISTORY, 10);
75cdf0e10cSrcweir }
76cdf0e10cSrcweir
77cdf0e10cSrcweir //=============================================================================
checkHelpBookmarks()78cdf0e10cSrcweir void HistoryOptTest::checkHelpBookmarks()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir impl_testHistory(eHELPBOOKMARKS, 100);
81cdf0e10cSrcweir }
82cdf0e10cSrcweir
83cdf0e10cSrcweir //=============================================================================
impl_testHistory(EHistoryType eHistory,::sal_Int32 nMaxItems)84cdf0e10cSrcweir void HistoryOptTest::impl_testHistory(EHistoryType eHistory ,
85cdf0e10cSrcweir ::sal_Int32 nMaxItems)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir try
88cdf0e10cSrcweir {
89cdf0e10cSrcweir m_eList = eHistory;
90cdf0e10cSrcweir ::sal_Int32 c = nMaxItems;
91cdf0e10cSrcweir ::sal_Int32 i = 0;
92cdf0e10cSrcweir
93cdf0e10cSrcweir impl_clearList( );
94cdf0e10cSrcweir impl_setSize (c);
95cdf0e10cSrcweir
96cdf0e10cSrcweir // a) fill list completely and check if all items could be realy created.
97cdf0e10cSrcweir // But dont check its order here! Because every new item will change that order.
98cdf0e10cSrcweir for (i=0; i<c; ++i)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir impl_appendItem(i);
101cdf0e10cSrcweir if ( ! impl_existsItem(i))
102cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_MISS_ITEM, 0);
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir // b) Check order of all items in list now.
106cdf0e10cSrcweir // It must be reverse to the item number ...
107cdf0e10cSrcweir // item max = index 0
108cdf0e10cSrcweir // item max-1 = index 1
109cdf0e10cSrcweir // ...
110cdf0e10cSrcweir for (i=0; i<c; ++i)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir ::sal_Int32 nExpectedIndex = (c-1)-i;
113cdf0e10cSrcweir if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
114cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
115cdf0e10cSrcweir }
116cdf0e10cSrcweir
117cdf0e10cSrcweir // c) increase prio of "first" item so it will switch
118cdf0e10cSrcweir // to "second" and "second" will switch to "first" :-)
119cdf0e10cSrcweir // Check also if all other items was not touched.
120cdf0e10cSrcweir ::sal_Int32 nFirstItem = (c-1);
121cdf0e10cSrcweir ::sal_Int32 nSecondItem = (c-2);
122cdf0e10cSrcweir impl_appendItem(nSecondItem);
123cdf0e10cSrcweir
124cdf0e10cSrcweir if (
125cdf0e10cSrcweir ( ! impl_existsItemAtIndex(nSecondItem, 0)) ||
126cdf0e10cSrcweir ( ! impl_existsItemAtIndex(nFirstItem , 1))
127cdf0e10cSrcweir )
128cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
129cdf0e10cSrcweir
130cdf0e10cSrcweir for (i=0; i<nSecondItem; ++i)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir ::sal_Int32 nExpectedIndex = (c-1)-i;
133cdf0e10cSrcweir if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
134cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir // d) Check if appending new items will destroy the oldest one.
138cdf0e10cSrcweir ::sal_Int32 nNewestItem = c;
139cdf0e10cSrcweir ::sal_Int32 nOldestItem = 0;
140cdf0e10cSrcweir
141cdf0e10cSrcweir impl_appendItem(nNewestItem);
142cdf0e10cSrcweir
143cdf0e10cSrcweir if ( ! impl_existsItemAtIndex(nNewestItem, 0))
144cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
145cdf0e10cSrcweir
146cdf0e10cSrcweir if (impl_existsItem(nOldestItem))
147cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_UNEXPECTED_ITEM, 0);
148cdf0e10cSrcweir
149cdf0e10cSrcweir // e) Check if decreasing list size will remove oldest items.
150cdf0e10cSrcweir // Note: impl_setSize() will make sure that 3 items exists only.
151cdf0e10cSrcweir // Otherwhise it throws an exception. If we further check
152cdf0e10cSrcweir // positions of three items no further items must be checked.
153cdf0e10cSrcweir // They cant exists :-)
154cdf0e10cSrcweir ::sal_Int32 nNewSize = 3;
155cdf0e10cSrcweir impl_setSize(nNewSize);
156cdf0e10cSrcweir if (
157cdf0e10cSrcweir ( ! impl_existsItemAtIndex(nNewestItem, 0)) ||
158cdf0e10cSrcweir ( ! impl_existsItemAtIndex(nSecondItem, 1)) ||
159cdf0e10cSrcweir ( ! impl_existsItemAtIndex(nFirstItem , 2))
160cdf0e10cSrcweir )
161cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
162cdf0e10cSrcweir
163cdf0e10cSrcweir // finaly we should try to clean up all used structures so the same office can be used
164cdf0e10cSrcweir // without problems :-)
165cdf0e10cSrcweir impl_clearList();
166cdf0e10cSrcweir }
167cdf0e10cSrcweir catch (const css::uno::Exception& ex)
168cdf0e10cSrcweir {
169cdf0e10cSrcweir impl_clearList();
170cdf0e10cSrcweir throw ex;
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir //=============================================================================
impl_clearList()176cdf0e10cSrcweir void HistoryOptTest::impl_clearList()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir m_aConfigItem.Clear(m_eList);
179cdf0e10cSrcweir ::sal_Int32 nCount = m_aConfigItem.GetList(m_eList).getLength();
180cdf0e10cSrcweir
181cdf0e10cSrcweir if (nCount != 0)
182cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
183cdf0e10cSrcweir
184cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xList;
185cdf0e10cSrcweir xList = impl_getItemList();
186cdf0e10cSrcweir nCount = xList->getElementNames().getLength();
187cdf0e10cSrcweir
188cdf0e10cSrcweir if (nCount != 0)
189cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
190cdf0e10cSrcweir
191cdf0e10cSrcweir xList = impl_getOrderList();
192cdf0e10cSrcweir nCount = xList->getElementNames().getLength();
193cdf0e10cSrcweir
194cdf0e10cSrcweir if (nCount != 0)
195cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
198cdf0e10cSrcweir //=============================================================================
impl_setSize(::sal_Int32 nSize)199cdf0e10cSrcweir void HistoryOptTest::impl_setSize(::sal_Int32 nSize)
200cdf0e10cSrcweir {
201cdf0e10cSrcweir m_aConfigItem.SetSize (m_eList, nSize);
202cdf0e10cSrcweir
203cdf0e10cSrcweir // a) size info returned by GetSize() means "MaxSize"
204cdf0e10cSrcweir // so it must match exactly !
205cdf0e10cSrcweir ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList);
206cdf0e10cSrcweir if (nCheck != nSize)
207cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
208cdf0e10cSrcweir
209cdf0e10cSrcweir // b) current size of used XCU lists reflects the current state of
210cdf0e10cSrcweir // history list and not max size. So it can be less then size !
211cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xList;
212cdf0e10cSrcweir xList = impl_getItemList();
213cdf0e10cSrcweir nCheck = xList->getElementNames().getLength();
214cdf0e10cSrcweir if (nCheck > nSize)
215cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
216cdf0e10cSrcweir
217cdf0e10cSrcweir xList = impl_getOrderList();
218cdf0e10cSrcweir nCheck = xList->getElementNames().getLength();
219cdf0e10cSrcweir if (nCheck > nSize)
220cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
223cdf0e10cSrcweir //=============================================================================
impl_appendItem(::sal_Int32 nItem)224cdf0e10cSrcweir void HistoryOptTest::impl_appendItem(::sal_Int32 nItem)
225cdf0e10cSrcweir {
226cdf0e10cSrcweir const ::rtl::OUString sURL = impl_createItemURL (nItem);
227cdf0e10cSrcweir const ::rtl::OUString sTitle = impl_createItemTitle (nItem);
228cdf0e10cSrcweir const ::rtl::OUString sPassword = impl_createItemPassword(nItem);
229cdf0e10cSrcweir
230cdf0e10cSrcweir m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword);
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
233cdf0e10cSrcweir //=============================================================================
impl_createItemURL(::sal_Int32 nItem)234cdf0e10cSrcweir ::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem)
235cdf0e10cSrcweir {
236cdf0e10cSrcweir ::rtl::OUStringBuffer sURL(256);
237cdf0e10cSrcweir sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_");
238cdf0e10cSrcweir sURL.append ((::sal_Int32)nItem );
239cdf0e10cSrcweir sURL.appendAscii(".odt" );
240cdf0e10cSrcweir
241cdf0e10cSrcweir return sURL.makeStringAndClear();
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir //=============================================================================
impl_createItemTitle(::sal_Int32 nItem)245cdf0e10cSrcweir ::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir ::rtl::OUStringBuffer sTitle(256);
248cdf0e10cSrcweir sTitle.appendAscii("Non Existing Test Item Nr ");
249cdf0e10cSrcweir sTitle.append ((::sal_Int32)nItem );
250cdf0e10cSrcweir
251cdf0e10cSrcweir return sTitle.makeStringAndClear();
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir //=============================================================================
impl_createItemPassword(::sal_Int32 nItem)255cdf0e10cSrcweir ::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem)
256cdf0e10cSrcweir {
257cdf0e10cSrcweir ::rtl::OUStringBuffer sPassword(256);
258cdf0e10cSrcweir sPassword.appendAscii("Password_" );
259cdf0e10cSrcweir sPassword.append ((::sal_Int32)nItem);
260cdf0e10cSrcweir
261cdf0e10cSrcweir return sPassword.makeStringAndClear();
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir //=============================================================================
impl_existsItem(::sal_Int32 nItem)265cdf0e10cSrcweir ::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem)
266cdf0e10cSrcweir {
267cdf0e10cSrcweir const ::rtl::OUString sURL = impl_createItemURL(nItem);
268cdf0e10cSrcweir const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
269cdf0e10cSrcweir const ::sal_Int32 c = lItems.getLength ();
270cdf0e10cSrcweir ::sal_Int32 i = 0;
271cdf0e10cSrcweir ::sal_Bool bFound = sal_False;
272cdf0e10cSrcweir
273cdf0e10cSrcweir for (i=0; i<c; ++i)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir const ::comphelper::SequenceAsHashMap aItem(lItems[i]);
276cdf0e10cSrcweir const ::rtl::OUString& sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
277cdf0e10cSrcweir
278cdf0e10cSrcweir bFound = sCheck.equals(sURL);
279cdf0e10cSrcweir if (bFound)
280cdf0e10cSrcweir break;
281cdf0e10cSrcweir }
282cdf0e10cSrcweir
283cdf0e10cSrcweir if ( ! bFound)
284cdf0e10cSrcweir return sal_False;
285cdf0e10cSrcweir bFound = sal_False;
286cdf0e10cSrcweir
287cdf0e10cSrcweir try
288cdf0e10cSrcweir {
289cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
290cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xItem ;
291cdf0e10cSrcweir xItemList->getByName(sURL) >>= xItem;
292cdf0e10cSrcweir
293cdf0e10cSrcweir bFound = xItem.is();
294cdf0e10cSrcweir }
295cdf0e10cSrcweir catch(const css::container::NoSuchElementException&)
296cdf0e10cSrcweir {}
297cdf0e10cSrcweir
298cdf0e10cSrcweir return bFound;
299cdf0e10cSrcweir }
300cdf0e10cSrcweir
301cdf0e10cSrcweir //=============================================================================
impl_existsItemAtIndex(::sal_Int32 nItem,::sal_Int32 nIndex)302cdf0e10cSrcweir ::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem ,
303cdf0e10cSrcweir ::sal_Int32 nIndex)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir const ::rtl::OUString sURL = impl_createItemURL(nItem);
306cdf0e10cSrcweir const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
307cdf0e10cSrcweir const ::sal_Int32 c = lItems.getLength ();
308cdf0e10cSrcweir ::sal_Bool bFound = sal_False;
309cdf0e10cSrcweir
310cdf0e10cSrcweir if (nIndex >= c)
311cdf0e10cSrcweir return sal_False;
312cdf0e10cSrcweir
313cdf0e10cSrcweir const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]);
314cdf0e10cSrcweir ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
315cdf0e10cSrcweir
316cdf0e10cSrcweir bFound = sCheck.equals(sURL);
317cdf0e10cSrcweir if ( ! bFound)
318cdf0e10cSrcweir return sal_False;
319cdf0e10cSrcweir bFound = sal_False;
320cdf0e10cSrcweir
321cdf0e10cSrcweir try
322cdf0e10cSrcweir {
323cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
324cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xItem ;
325cdf0e10cSrcweir xItemList->getByName(sURL) >>= xItem;
326cdf0e10cSrcweir
327cdf0e10cSrcweir bFound = xItem.is();
328cdf0e10cSrcweir }
329cdf0e10cSrcweir catch(const css::container::NoSuchElementException&)
330cdf0e10cSrcweir {}
331cdf0e10cSrcweir
332cdf0e10cSrcweir if ( ! bFound)
333cdf0e10cSrcweir return sal_False;
334cdf0e10cSrcweir bFound = sal_False;
335cdf0e10cSrcweir
336cdf0e10cSrcweir try
337cdf0e10cSrcweir {
338cdf0e10cSrcweir const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex);
339cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList();
340cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xOrder ;
341cdf0e10cSrcweir xOrderList->getByName(sOrder) >>= xOrder;
342cdf0e10cSrcweir
343cdf0e10cSrcweir if (xOrder.is())
344cdf0e10cSrcweir {
345cdf0e10cSrcweir xOrder->getByName(s_sHistoryItemRef) >>= sCheck;
346cdf0e10cSrcweir bFound = sCheck.equals(sURL);
347cdf0e10cSrcweir }
348cdf0e10cSrcweir }
349cdf0e10cSrcweir catch(const css::container::NoSuchElementException&)
350cdf0e10cSrcweir {}
351cdf0e10cSrcweir
352cdf0e10cSrcweir return bFound;
353cdf0e10cSrcweir }
354cdf0e10cSrcweir
355cdf0e10cSrcweir //=============================================================================
impl_getItemList()356cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
359cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xList ;
360cdf0e10cSrcweir xHistory->getByName (s_sItemList) >>= xList;
361cdf0e10cSrcweir
362cdf0e10cSrcweir if ( ! xList.is())
363cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0);
364cdf0e10cSrcweir
365cdf0e10cSrcweir return xList;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
368cdf0e10cSrcweir //=============================================================================
impl_getOrderList()369cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList()
370cdf0e10cSrcweir {
371cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
372cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xList ;
373cdf0e10cSrcweir xHistory->getByName (s_sOrderList) >>= xList;
374cdf0e10cSrcweir
375cdf0e10cSrcweir if ( ! xList.is())
376cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0);
377cdf0e10cSrcweir
378cdf0e10cSrcweir return xList;
379cdf0e10cSrcweir }
380cdf0e10cSrcweir
381cdf0e10cSrcweir //=============================================================================
impl_getNewHistory()382cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory()
383cdf0e10cSrcweir {
384cdf0e10cSrcweir if ( ! m_xHistoriesXCU.is())
385cdf0e10cSrcweir {
386cdf0e10cSrcweir m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >(
387cdf0e10cSrcweir ::comphelper::ConfigurationHelper::openConfig(
388cdf0e10cSrcweir ::utl::getProcessServiceFactory(),
389cdf0e10cSrcweir s_sHistories,
390cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_STANDARD),
391cdf0e10cSrcweir css::uno::UNO_QUERY_THROW);
392cdf0e10cSrcweir }
393cdf0e10cSrcweir
394cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xHistory;
395cdf0e10cSrcweir
396cdf0e10cSrcweir switch (m_eList)
397cdf0e10cSrcweir {
398cdf0e10cSrcweir case ePICKLIST :
399cdf0e10cSrcweir m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory;
400cdf0e10cSrcweir break;
401cdf0e10cSrcweir
402cdf0e10cSrcweir case eHISTORY :
403cdf0e10cSrcweir m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory;
404cdf0e10cSrcweir break;
405cdf0e10cSrcweir
406cdf0e10cSrcweir case eHELPBOOKMARKS :
407cdf0e10cSrcweir m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory;
408cdf0e10cSrcweir break;
409cdf0e10cSrcweir }
410cdf0e10cSrcweir
411cdf0e10cSrcweir if ( ! xHistory.is())
412cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
413cdf0e10cSrcweir
414cdf0e10cSrcweir return xHistory;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
417cdf0e10cSrcweir //=============================================================================
impl_getOldHistory()418cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory()
419cdf0e10cSrcweir {
420cdf0e10cSrcweir if ( ! m_xCommonXCU.is())
421cdf0e10cSrcweir {
422cdf0e10cSrcweir m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >(
423cdf0e10cSrcweir ::comphelper::ConfigurationHelper::openConfig(
424cdf0e10cSrcweir ::utl::getProcessServiceFactory(),
425cdf0e10cSrcweir s_sCommonHistory,
426cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_STANDARD),
427cdf0e10cSrcweir css::uno::UNO_QUERY_THROW);
428cdf0e10cSrcweir }
429cdf0e10cSrcweir
430cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xHistory;
431cdf0e10cSrcweir
432cdf0e10cSrcweir switch (m_eList)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir case ePICKLIST :
435cdf0e10cSrcweir m_xCommonXCU->getByName(s_sPickList) >>= xHistory;
436cdf0e10cSrcweir break;
437cdf0e10cSrcweir
438cdf0e10cSrcweir case eHISTORY :
439cdf0e10cSrcweir m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory;
440cdf0e10cSrcweir break;
441cdf0e10cSrcweir
442cdf0e10cSrcweir case eHELPBOOKMARKS :
443cdf0e10cSrcweir m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory;
444cdf0e10cSrcweir break;
445cdf0e10cSrcweir }
446cdf0e10cSrcweir
447cdf0e10cSrcweir if ( ! xHistory.is())
448cdf0e10cSrcweir throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
449cdf0e10cSrcweir
450cdf0e10cSrcweir return xHistory;
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
453cdf0e10cSrcweir /*
454cdf0e10cSrcweir //=============================================================================
455cdf0e10cSrcweir // clear the list in XML directly when using the new Histories.xcs
456cdf0e10cSrcweir void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xListAccess;
459cdf0e10cSrcweir css::uno::Reference< css::container::XNameContainer > xItemOrder;
460cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xFirstItem;
461cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > sFileList;
462cdf0e10cSrcweir
463cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
464cdf0e10cSrcweir m_xCfg->getByName(s_sPickList) >>= xListAccess;
465cdf0e10cSrcweir
466cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
467cdf0e10cSrcweir m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
468cdf0e10cSrcweir
469cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
470cdf0e10cSrcweir m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
471cdf0e10cSrcweir
472cdf0e10cSrcweir if (xListAccess.is())
473cdf0e10cSrcweir {
474cdf0e10cSrcweir xListAccess->getByName(s_sItemList) >>= xItemOrder ;
475cdf0e10cSrcweir sFileList = xItemOrder->getElementNames();
476cdf0e10cSrcweir for(sal_Int32 i=0; i<sFileList.getLength(); ++i)
477cdf0e10cSrcweir xItemOrder->removeByName(sFileList[i]);
478cdf0e10cSrcweir
479cdf0e10cSrcweir xListAccess->getByName(s_sOrderList) >>= xItemOrder ;
480cdf0e10cSrcweir sFileList = xItemOrder->getElementNames();
481cdf0e10cSrcweir for(sal_Int32 j=0; j<sFileList.getLength(); ++j)
482cdf0e10cSrcweir xItemOrder->removeByName(sFileList[j]);
483cdf0e10cSrcweir
484cdf0e10cSrcweir xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY);
485cdf0e10cSrcweir xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) );
486cdf0e10cSrcweir
487cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg);
488cdf0e10cSrcweir }
489cdf0e10cSrcweir }
490cdf0e10cSrcweir
491cdf0e10cSrcweir //=============================================================================
492cdf0e10cSrcweir // use configuration API (not ConfigItem!) to verify the results within XML !
493cdf0e10cSrcweir sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList)
494cdf0e10cSrcweir {
495cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xListAccess;
496cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xItemList;
497cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > xOrderList;
498cdf0e10cSrcweir sal_Bool bRet = sal_True;
499cdf0e10cSrcweir
500cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
501cdf0e10cSrcweir m_xCfg->getByName(s_sPickList) >>= xListAccess;
502cdf0e10cSrcweir
503cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
504cdf0e10cSrcweir m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
505cdf0e10cSrcweir
506cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
507cdf0e10cSrcweir m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
508cdf0e10cSrcweir
509cdf0e10cSrcweir if (xListAccess.is())
510cdf0e10cSrcweir {
511cdf0e10cSrcweir xListAccess->getByName(s_sItemList) >>= xItemList;
512cdf0e10cSrcweir xListAccess->getByName(s_sOrderList) >>= xOrderList;
513cdf0e10cSrcweir
514cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames();
515cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames();
516cdf0e10cSrcweir if (sItemList.getLength()!=0 || sOrderList.getLength()!=0)
517cdf0e10cSrcweir bRet = sal_False;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
520cdf0e10cSrcweir return bRet;
521cdf0e10cSrcweir }
522cdf0e10cSrcweir
523cdf0e10cSrcweir //=============================================================================
524cdf0e10cSrcweir // append a item: use configuration API (not ConfigItem!) to verify the results within XML !
525cdf0e10cSrcweir void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList)
526cdf0e10cSrcweir {//to do...
527cdf0e10cSrcweir }
528cdf0e10cSrcweir
529cdf0e10cSrcweir //=============================================================================
530cdf0e10cSrcweir // test SvtHistoryOptions::GetSize()
531cdf0e10cSrcweir void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList)
532cdf0e10cSrcweir {
533cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
534cdf0e10cSrcweir
535cdf0e10cSrcweir sal_uInt32 nSize = 0;
536cdf0e10cSrcweir sal_uInt32 nSize_ = 0;
537cdf0e10cSrcweir
538cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
539cdf0e10cSrcweir {
540cdf0e10cSrcweir nSize = aHistoryOpt.GetSize(ePICKLIST);
541cdf0e10cSrcweir
542cdf0e10cSrcweir xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1));
543cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
544cdf0e10cSrcweir
545cdf0e10cSrcweir nSize_ = aHistoryOpt.GetSize(ePICKLIST);
546cdf0e10cSrcweir if (nSize_ == nSize)
547cdf0e10cSrcweir throw css::uno::RuntimeException(
548cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0);
549cdf0e10cSrcweir }
550cdf0e10cSrcweir
551cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
552cdf0e10cSrcweir {
553cdf0e10cSrcweir nSize = aHistoryOpt.GetSize(eHISTORY);
554cdf0e10cSrcweir
555cdf0e10cSrcweir xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1));
556cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
557cdf0e10cSrcweir
558cdf0e10cSrcweir nSize_ = aHistoryOpt.GetSize(eHISTORY);
559cdf0e10cSrcweir
560cdf0e10cSrcweir if (nSize_ == nSize)
561cdf0e10cSrcweir throw css::uno::RuntimeException(
562cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0);
563cdf0e10cSrcweir }
564cdf0e10cSrcweir
565cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
566cdf0e10cSrcweir {
567cdf0e10cSrcweir nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
568cdf0e10cSrcweir
569cdf0e10cSrcweir xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1));
570cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
571cdf0e10cSrcweir
572cdf0e10cSrcweir nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS);
573cdf0e10cSrcweir
574cdf0e10cSrcweir if (nSize_ == nSize)
575cdf0e10cSrcweir throw css::uno::RuntimeException(
576cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0);
577cdf0e10cSrcweir }
578cdf0e10cSrcweir }
579cdf0e10cSrcweir
580cdf0e10cSrcweir //=============================================================================
581cdf0e10cSrcweir // test SvtHistoryOptions::SetSize()
582cdf0e10cSrcweir void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList)
583cdf0e10cSrcweir {
584cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
585cdf0e10cSrcweir
586cdf0e10cSrcweir sal_uInt32 nSize = 0;
587cdf0e10cSrcweir sal_uInt32 nSize_ = 0;
588cdf0e10cSrcweir
589cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
590cdf0e10cSrcweir {
591cdf0e10cSrcweir xSet->getPropertyValue(s_sPickListSize) >>= nSize;
592cdf0e10cSrcweir aHistoryOpt.SetSize(ePICKLIST, (nSize+1));
593cdf0e10cSrcweir xSet->getPropertyValue(s_sPickListSize) >>= nSize_;
594cdf0e10cSrcweir
595cdf0e10cSrcweir if (nSize_ == nSize) //old config item will throw error
596cdf0e10cSrcweir throw css::uno::RuntimeException(
597cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0);
598cdf0e10cSrcweir }
599cdf0e10cSrcweir
600cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
601cdf0e10cSrcweir {
602cdf0e10cSrcweir xSet->getPropertyValue(s_sURLHistorySize) >>= nSize;
603cdf0e10cSrcweir aHistoryOpt.SetSize(eHISTORY, (nSize+1));
604cdf0e10cSrcweir xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_;
605cdf0e10cSrcweir
606cdf0e10cSrcweir if (nSize_ == nSize) //old config item will throw error
607cdf0e10cSrcweir throw css::uno::RuntimeException(
608cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0);
609cdf0e10cSrcweir }
610cdf0e10cSrcweir
611cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
612cdf0e10cSrcweir {
613cdf0e10cSrcweir xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
614cdf0e10cSrcweir aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1));
615cdf0e10cSrcweir xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_;
616cdf0e10cSrcweir
617cdf0e10cSrcweir if (nSize_ == nSize) //old config item will throw error
618cdf0e10cSrcweir throw css::uno::RuntimeException(
619cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0);
620cdf0e10cSrcweir }
621cdf0e10cSrcweir }
622cdf0e10cSrcweir
623cdf0e10cSrcweir //=============================================================================
624cdf0e10cSrcweir // test SvtHistoryOptions::Clear()
625cdf0e10cSrcweir void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList)
626cdf0e10cSrcweir {
627cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
628cdf0e10cSrcweir {
629cdf0e10cSrcweir aHistoryOpt.Clear(ePICKLIST);
630cdf0e10cSrcweir if ( !impl_isListEmpty(s_sPickList) )
631cdf0e10cSrcweir throw css::uno::RuntimeException(
632cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0);
633cdf0e10cSrcweir }
634cdf0e10cSrcweir
635cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
636cdf0e10cSrcweir {
637cdf0e10cSrcweir aHistoryOpt.Clear(eHISTORY);
638cdf0e10cSrcweir if ( !impl_isListEmpty(s_sURLHistory) )
639cdf0e10cSrcweir throw css::uno::RuntimeException(
640cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0);
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
643cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
644cdf0e10cSrcweir {
645cdf0e10cSrcweir aHistoryOpt.Clear(eHELPBOOKMARKS);
646cdf0e10cSrcweir if ( !impl_isListEmpty(s_sHelpBookmarks) )
647cdf0e10cSrcweir throw css::uno::RuntimeException(
648cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0);
649cdf0e10cSrcweir }
650cdf0e10cSrcweir }
651cdf0e10cSrcweir
652cdf0e10cSrcweir //=============================================================================
653cdf0e10cSrcweir // test SvtHistoryOptions::GetList()
654cdf0e10cSrcweir void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList)
655cdf0e10cSrcweir {
656cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
657cdf0e10cSrcweir {
658cdf0e10cSrcweir impl_clearList(s_sPickList);
659cdf0e10cSrcweir aHistoryOpt.AppendItem( ePICKLIST ,
660cdf0e10cSrcweir ::rtl::OUString::createFromAscii("file:///c/test1"),
661cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
662cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
663cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
664cdf0e10cSrcweir css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST );
665cdf0e10cSrcweir
666cdf0e10cSrcweir if ( aHistoryList.getLength()==0 )
667cdf0e10cSrcweir throw css::uno::RuntimeException(
668cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0);
669cdf0e10cSrcweir }
670cdf0e10cSrcweir
671cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
672cdf0e10cSrcweir {
673cdf0e10cSrcweir impl_clearList(s_sURLHistory);
674cdf0e10cSrcweir aHistoryOpt.AppendItem( eHISTORY ,
675cdf0e10cSrcweir ::rtl::OUString::createFromAscii("file:///c/test1"),
676cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
677cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
678cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
679cdf0e10cSrcweir css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY );
680cdf0e10cSrcweir
681cdf0e10cSrcweir if ( aHistoryList.getLength()==0 )
682cdf0e10cSrcweir throw css::uno::RuntimeException(
683cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0);
684cdf0e10cSrcweir }
685cdf0e10cSrcweir
686cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
687cdf0e10cSrcweir {
688cdf0e10cSrcweir impl_clearList(s_sHelpBookmarks);
689cdf0e10cSrcweir aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
690cdf0e10cSrcweir ::rtl::OUString::createFromAscii("file:///c/test1"),
691cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
692cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
693cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
694cdf0e10cSrcweir css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS );
695cdf0e10cSrcweir
696cdf0e10cSrcweir if ( aHistoryList.getLength()==0 )
697cdf0e10cSrcweir throw css::uno::RuntimeException(
698cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0);
699cdf0e10cSrcweir }
700cdf0e10cSrcweir }
701cdf0e10cSrcweir
702cdf0e10cSrcweir void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList)
703cdf0e10cSrcweir {
704cdf0e10cSrcweir if (sList.equalsAscii("PickList"))
705cdf0e10cSrcweir {
706cdf0e10cSrcweir impl_clearList(s_sPickList);
707cdf0e10cSrcweir sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST);
708cdf0e10cSrcweir
709cdf0e10cSrcweir for (sal_Int32 i=0; i<nListSize; ++i)
710cdf0e10cSrcweir aHistoryOpt.AppendItem( ePICKLIST ,
711cdf0e10cSrcweir ::rtl::OUString::valueOf(i),
712cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
713cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
714cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
715cdf0e10cSrcweir
716cdf0e10cSrcweir aHistoryOpt.AppendItem( ePICKLIST ,
717cdf0e10cSrcweir ::rtl::OUString::valueOf(nListSize),
718cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
719cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
720cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
721cdf0e10cSrcweir }
722cdf0e10cSrcweir
723cdf0e10cSrcweir else if (sList.equalsAscii("URLHistory"))
724cdf0e10cSrcweir {
725cdf0e10cSrcweir impl_clearList(s_sURLHistory);
726cdf0e10cSrcweir sal_Int32 nListSize = aHistoryOpt.GetSize(eHISTORY);
727cdf0e10cSrcweir
728cdf0e10cSrcweir for (sal_Int32 i=0; i<nListSize; ++i)
729cdf0e10cSrcweir aHistoryOpt.AppendItem( eHISTORY ,
730cdf0e10cSrcweir ::rtl::OUString::valueOf(i),
731cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
732cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
733cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
734cdf0e10cSrcweir
735cdf0e10cSrcweir aHistoryOpt.AppendItem( eHISTORY ,
736cdf0e10cSrcweir ::rtl::OUString::valueOf(nListSize),
737cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
738cdf0e10cSrcweir ::rtl::OUString::createFromAscii(""),
739cdf0e10cSrcweir ::rtl::OUString::createFromAscii("") );
740cdf0e10cSrcweir }
741cdf0e10cSrcweir
742cdf0e10cSrcweir else if (sList.equalsAscii("HelpBookmarks"))
743cdf0e10cSrcweir {
744cdf0e10cSrcweir //impl_clearList(s_sHelpBookmarks);
745cdf0e10cSrcweir //sal_Int32 nListSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
746cdf0e10cSrcweir
747cdf0e10cSrcweir //for (sal_Int32 i=0; i<nListSize; ++i)
748cdf0e10cSrcweir // aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
749cdf0e10cSrcweir // ::rtl::OUString::valueOf(i),
750cdf0e10cSrcweir // ::rtl::OUString::createFromAscii(""),
751cdf0e10cSrcweir // ::rtl::OUString::createFromAscii(""),
752cdf0e10cSrcweir // ::rtl::OUString::createFromAscii("") );
753cdf0e10cSrcweir
754cdf0e10cSrcweir //aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
755cdf0e10cSrcweir // ::rtl::OUString::valueOf(nListSize),
756cdf0e10cSrcweir // ::rtl::OUString::createFromAscii(""),
757cdf0e10cSrcweir // ::rtl::OUString::createFromAscii(""),
758cdf0e10cSrcweir // ::rtl::OUString::createFromAscii("") );
759cdf0e10cSrcweir }
760cdf0e10cSrcweir }
761cdf0e10cSrcweir
762cdf0e10cSrcweir //=============================================================================
763cdf0e10cSrcweir void HistoryOptTest::impl_checkPicklist()
764cdf0e10cSrcweir {
765cdf0e10cSrcweir impl_checkGetSize(s_sPickList);
766cdf0e10cSrcweir impl_checkSetSize(s_sPickList);
767cdf0e10cSrcweir
768cdf0e10cSrcweir impl_checkClear(s_sPickList);
769cdf0e10cSrcweir impl_checkGetList(s_sPickList);
770cdf0e10cSrcweir impl_checkAppendItem(s_sPickList);
771cdf0e10cSrcweir }
772cdf0e10cSrcweir
773cdf0e10cSrcweir //=============================================================================
774cdf0e10cSrcweir void HistoryOptTest::impl_checkURLHistory()
775cdf0e10cSrcweir {
776cdf0e10cSrcweir impl_checkGetSize(s_sURLHistory);
777cdf0e10cSrcweir impl_checkSetSize(s_sURLHistory);
778cdf0e10cSrcweir
779cdf0e10cSrcweir impl_checkClear(s_sURLHistory);
780cdf0e10cSrcweir impl_checkGetList(s_sURLHistory);
781cdf0e10cSrcweir impl_checkAppendItem(s_sURLHistory);
782cdf0e10cSrcweir }
783cdf0e10cSrcweir
784cdf0e10cSrcweir //=============================================================================
785cdf0e10cSrcweir void HistoryOptTest::impl_checkHelpBookmarks()
786cdf0e10cSrcweir {
787cdf0e10cSrcweir impl_checkGetSize(s_sHelpBookmarks);
788cdf0e10cSrcweir impl_checkSetSize(s_sHelpBookmarks);
789cdf0e10cSrcweir
790cdf0e10cSrcweir impl_checkClear(s_sHelpBookmarks);
791cdf0e10cSrcweir impl_checkGetList(s_sHelpBookmarks);
792cdf0e10cSrcweir impl_checkAppendItem(s_sHelpBookmarks);
793cdf0e10cSrcweir }
794cdf0e10cSrcweir */
795