1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoredlines.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <vos/mutex.hxx>
36 #include <vcl/svapp.hxx>
37 #include <unoredlines.hxx>
38 #include <unoredline.hxx>
39 #include <tools/debug.hxx>
40 #include <pagedesc.hxx>
41 #include "poolfmt.hxx"
44 #include <redline.hxx>
45 #include <com/sun/star/beans/XPropertySet.hpp>
47 using namespace ::com::sun::star
;
48 using ::rtl::OUString
;
50 /*-- 11.01.01 15:28:54---------------------------------------------------
52 -----------------------------------------------------------------------*/
53 SwXRedlines::SwXRedlines(SwDoc
* _pDoc
) :
54 SwUnoCollection(_pDoc
)
57 /*-- 11.01.01 15:28:55---------------------------------------------------
59 -----------------------------------------------------------------------*/
60 SwXRedlines::~SwXRedlines()
63 /*-- 11.01.01 15:28:55---------------------------------------------------
65 -----------------------------------------------------------------------*/
66 sal_Int32
SwXRedlines::getCount( ) throw(uno::RuntimeException
)
68 vos::OGuard
aGuard(Application::GetSolarMutex());
70 throw uno::RuntimeException();
71 const SwRedlineTbl
& rRedTbl
= GetDoc()->GetRedlineTbl();
72 return rRedTbl
.Count();
74 /*-- 11.01.01 15:28:55---------------------------------------------------
76 -----------------------------------------------------------------------*/
77 uno::Any
SwXRedlines::getByIndex(sal_Int32 nIndex
)
78 throw( lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
80 vos::OGuard
aGuard(Application::GetSolarMutex());
82 throw uno::RuntimeException();
83 const SwRedlineTbl
& rRedTbl
= GetDoc()->GetRedlineTbl();
85 if(rRedTbl
.Count() > nIndex
&& nIndex
>= 0)
87 uno::Reference
<beans::XPropertySet
> xRet
= SwXRedlines::GetObject( *rRedTbl
.GetObject((USHORT
)nIndex
), *GetDoc() );
91 throw lang::IndexOutOfBoundsException();
94 /*-- 11.01.01 15:28:55---------------------------------------------------
96 -----------------------------------------------------------------------*/
97 uno::Reference
< container::XEnumeration
> SwXRedlines::createEnumeration(void)
98 throw( uno::RuntimeException
)
100 vos::OGuard
aGuard(Application::GetSolarMutex());
102 throw uno::RuntimeException();
103 return uno::Reference
< container::XEnumeration
>(new SwXRedlineEnumeration(*GetDoc()));
105 /*-- 11.01.01 15:28:55---------------------------------------------------
107 -----------------------------------------------------------------------*/
108 uno::Type
SwXRedlines::getElementType( ) throw(uno::RuntimeException
)
110 return ::getCppuType((uno::Reference
<beans::XPropertySet
>*)0);
112 /*-- 11.01.01 15:28:56---------------------------------------------------
114 -----------------------------------------------------------------------*/
115 sal_Bool
SwXRedlines::hasElements( ) throw(uno::RuntimeException
)
117 vos::OGuard
aGuard(Application::GetSolarMutex());
119 throw uno::RuntimeException();
120 const SwRedlineTbl
& rRedTbl
= GetDoc()->GetRedlineTbl();
121 return rRedTbl
.Count() > 0;
123 /*-- 11.01.01 15:28:56---------------------------------------------------
125 -----------------------------------------------------------------------*/
126 OUString
SwXRedlines::getImplementationName(void) throw( uno::RuntimeException
)
128 return C2U("SwXRedlines");
130 /*-- 11.01.01 15:28:56---------------------------------------------------
132 -----------------------------------------------------------------------*/
133 BOOL
SwXRedlines::supportsService(const rtl::OUString
& /*ServiceName*/)
134 throw( uno::RuntimeException
)
136 DBG_ERROR("not implemented");
139 /*-- 11.01.01 15:28:57---------------------------------------------------
141 -----------------------------------------------------------------------*/
142 uno::Sequence
< OUString
> SwXRedlines::getSupportedServiceNames(void)
143 throw( uno::RuntimeException
)
145 DBG_ERROR("not implemented");
146 return uno::Sequence
< OUString
>();
148 /*-- 11.01.01 15:28:57---------------------------------------------------
150 -----------------------------------------------------------------------*/
151 beans::XPropertySet
* SwXRedlines::GetObject( SwRedline
& rRedline
, SwDoc
& rDoc
)
153 SwPageDesc
* pStdDesc
= rDoc
.GetPageDescFromPool(RES_POOLPAGE_STANDARD
);
154 SwClientIter
aIter(*pStdDesc
);
155 SwXRedline
* pxRedline
= (SwXRedline
*)aIter
.First( TYPE( SwXRedline
));
158 if(pxRedline
->GetRedline() == &rRedline
)
160 pxRedline
= (SwXRedline
*)aIter
.Next();
163 pxRedline
= new SwXRedline(rRedline
, rDoc
);
166 /*-- 12.01.01 15:06:10---------------------------------------------------
168 -----------------------------------------------------------------------*/
169 SwXRedlineEnumeration::SwXRedlineEnumeration(SwDoc
& rDoc
) :
173 pDoc
->GetPageDescFromPool(RES_POOLPAGE_STANDARD
)->Add(this);
175 /*-- 12.01.01 15:06:10---------------------------------------------------
177 -----------------------------------------------------------------------*/
178 SwXRedlineEnumeration::~SwXRedlineEnumeration()
181 /*-- 12.01.01 15:06:10---------------------------------------------------
183 -----------------------------------------------------------------------*/
184 BOOL
SwXRedlineEnumeration::hasMoreElements(void) throw( uno::RuntimeException
)
187 throw uno::RuntimeException();
188 return pDoc
->GetRedlineTbl().Count() > nCurrentIndex
;
190 /*-- 12.01.01 15:06:10---------------------------------------------------
192 -----------------------------------------------------------------------*/
193 uno::Any
SwXRedlineEnumeration::nextElement(void)
194 throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
197 throw uno::RuntimeException();
198 const SwRedlineTbl
& rRedTbl
= pDoc
->GetRedlineTbl();
199 if(!(rRedTbl
.Count() > nCurrentIndex
))
200 throw container::NoSuchElementException();
201 uno::Reference
<beans::XPropertySet
> xRet
= SwXRedlines::GetObject( *rRedTbl
.GetObject(nCurrentIndex
++), *pDoc
);
206 /*-- 12.01.01 15:06:10---------------------------------------------------
208 -----------------------------------------------------------------------*/
209 rtl::OUString
SwXRedlineEnumeration::getImplementationName(void) throw( uno::RuntimeException
)
211 return C2U("SwXRedlineEnumeration");
213 /*-- 12.01.01 15:06:10---------------------------------------------------
215 -----------------------------------------------------------------------*/
216 BOOL
SwXRedlineEnumeration::supportsService(const rtl::OUString
& /*ServiceName*/) throw( uno::RuntimeException
)
220 /*-- 12.01.01 15:06:11---------------------------------------------------
222 -----------------------------------------------------------------------*/
223 uno::Sequence
< OUString
> SwXRedlineEnumeration::getSupportedServiceNames(void) throw( uno::RuntimeException
)
225 return uno::Sequence
< OUString
>();
227 /*-- 12.01.01 15:06:11---------------------------------------------------
229 -----------------------------------------------------------------------*/
230 void SwXRedlineEnumeration::Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
)
232 ClientModify(this, pOld
, pNew
);
233 if(!GetRegisteredIn())