xref: /AOO41X/main/sw/source/ui/uno/unotxvw.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "viscrs.hxx"
28cdf0e10cSrcweir #include <sfx2/frame.hxx>
29cdf0e10cSrcweir #include <sfx2/printer.hxx>
30cdf0e10cSrcweir #include <cmdid.h>
31cdf0e10cSrcweir #include <hintids.hxx>
32cdf0e10cSrcweir #include <docsh.hxx>
33cdf0e10cSrcweir #include <rubylist.hxx>
34cdf0e10cSrcweir #include <doc.hxx>
35cdf0e10cSrcweir #include <unotxvw.hxx>
36cdf0e10cSrcweir #include <unodispatch.hxx>
37cdf0e10cSrcweir #include <unomap.hxx>
38cdf0e10cSrcweir #include <unostyle.hxx>
39cdf0e10cSrcweir #include <unoprnms.hxx>
40cdf0e10cSrcweir #include <view.hxx>
41cdf0e10cSrcweir #include <viewopt.hxx>
42cdf0e10cSrcweir #include <unomod.hxx>
43cdf0e10cSrcweir #include <unoframe.hxx>
44cdf0e10cSrcweir #include <unocrsr.hxx>
45cdf0e10cSrcweir #include <wrtsh.hxx>
46cdf0e10cSrcweir #include <unotbl.hxx>
47cdf0e10cSrcweir #include <svx/fmshell.hxx>
48cdf0e10cSrcweir #include <svx/svdview.hxx>
49cdf0e10cSrcweir #include <svx/svdpage.hxx>
50cdf0e10cSrcweir #include <svx/svdouno.hxx>
51cdf0e10cSrcweir #include <svx/svdogrp.hxx>
52cdf0e10cSrcweir #include <editeng/pbinitem.hxx>
53cdf0e10cSrcweir #include <pagedesc.hxx>
54cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
55cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
56cdf0e10cSrcweir #include <sfx2/bindings.hxx>
57cdf0e10cSrcweir #include <sfx2/request.hxx>
58cdf0e10cSrcweir #include <frmatr.hxx>
59cdf0e10cSrcweir #include <vos/mutex.hxx>
60cdf0e10cSrcweir #include <IMark.hxx>
61cdf0e10cSrcweir #include <unotxdoc.hxx>
62cdf0e10cSrcweir #include <unodraw.hxx>
63cdf0e10cSrcweir #include <svx/unoshcol.hxx>
64cdf0e10cSrcweir #include <svx/unoshape.hxx>
65cdf0e10cSrcweir #include <svx/svdpagv.hxx>
66cdf0e10cSrcweir #include <swerror.h>
67cdf0e10cSrcweir #include <tools/cachestr.hxx>
68cdf0e10cSrcweir #include <shellio.hxx>
69cdf0e10cSrcweir #include <ndtxt.hxx>
70cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
71cdf0e10cSrcweir #include <crsskip.hxx>
72cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
73cdf0e10cSrcweir #include <editeng/outliner.hxx>
74cdf0e10cSrcweir #include <editeng/editview.hxx>
75cdf0e10cSrcweir #include <unobookmark.hxx>
76cdf0e10cSrcweir #include <unoparagraph.hxx>
77cdf0e10cSrcweir #include <unocrsrhelper.hxx>
78cdf0e10cSrcweir #include <unotextrange.hxx>
79cdf0e10cSrcweir #include <sfx2/docfile.hxx>
80cdf0e10cSrcweir #include <switerator.hxx>
81cdf0e10cSrcweir #include "swdtflvr.hxx"
82cdf0e10cSrcweir #include <vcl/svapp.hxx>
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85cdf0e10cSrcweir using namespace ::com::sun::star;
86cdf0e10cSrcweir using namespace ::com::sun::star::uno;
87cdf0e10cSrcweir using namespace ::com::sun::star::lang;
88cdf0e10cSrcweir using namespace ::com::sun::star::beans;
89cdf0e10cSrcweir using namespace ::com::sun::star::text;
90cdf0e10cSrcweir using namespace ::com::sun::star::view;
91cdf0e10cSrcweir using namespace ::com::sun::star::frame;
92cdf0e10cSrcweir using namespace rtl;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir using ::com::sun::star::util::URL;
95cdf0e10cSrcweir using comphelper::HelperBaseNoState;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir SV_IMPL_PTRARR( SelectionChangeListenerArr, XSelectionChangeListenerPtr );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir /* -----------------22.05.98 12:20-------------------
100cdf0e10cSrcweir  *
101cdf0e10cSrcweir  * --------------------------------------------------*/
102cdf0e10cSrcweir SwPaM* lcl_createPamCopy(const SwPaM& rPam)
103cdf0e10cSrcweir {
104cdf0e10cSrcweir     SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
105cdf0e10cSrcweir     ::sw::DeepCopyPaM(rPam, *pRet);
106cdf0e10cSrcweir 	return pRet;
107cdf0e10cSrcweir }
108cdf0e10cSrcweir /******************************************************************
109cdf0e10cSrcweir  * SwXTextView
110cdf0e10cSrcweir  ******************************************************************/
111cdf0e10cSrcweir /*-- 17.12.98 09:34:25---------------------------------------------------
112cdf0e10cSrcweir 
113cdf0e10cSrcweir   -----------------------------------------------------------------------*/
114cdf0e10cSrcweir SwXTextView::SwXTextView(SwView* pSwView) :
115cdf0e10cSrcweir 	SfxBaseController(pSwView),
116cdf0e10cSrcweir     m_pView(pSwView),
117cdf0e10cSrcweir     m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) ),
118cdf0e10cSrcweir 	pxViewSettings(0),
119cdf0e10cSrcweir     pxTextViewCursor(0)
120cdf0e10cSrcweir {
121cdf0e10cSrcweir 
122cdf0e10cSrcweir }
123cdf0e10cSrcweir /*-- 17.12.98 09:34:25---------------------------------------------------
124cdf0e10cSrcweir 
125cdf0e10cSrcweir   -----------------------------------------------------------------------*/
126cdf0e10cSrcweir SwXTextView::~SwXTextView()
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     Invalidate();
129cdf0e10cSrcweir }
130cdf0e10cSrcweir /* -----------------------------09.03.01 15:47--------------------------------
131cdf0e10cSrcweir 
132cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
133cdf0e10cSrcweir void SwXTextView::Invalidate()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir     if(pxViewSettings)
136cdf0e10cSrcweir 	{
137cdf0e10cSrcweir 	 	HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( pxViewSettings->get() );
138cdf0e10cSrcweir 		static_cast < SwXViewSettings* > ( pSettings )->Invalidate();
139cdf0e10cSrcweir         DELETEZ(pxViewSettings);
140cdf0e10cSrcweir 	}
141cdf0e10cSrcweir 	if(pxTextViewCursor)
142cdf0e10cSrcweir 	{
143cdf0e10cSrcweir         text::XTextViewCursor* pCrsr = pxTextViewCursor->get();
144cdf0e10cSrcweir 		((SwXTextViewCursor*)pCrsr)->Invalidate();
145cdf0e10cSrcweir         DELETEZ(pxTextViewCursor);
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	m_refCount++; //prevent second d'tor call
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	sal_uInt16 nCount = aSelChangedListeners.Count();
151cdf0e10cSrcweir     if(nCount)
152cdf0e10cSrcweir     {
153cdf0e10cSrcweir         uno::Reference< uno::XInterface >  xInt = (cppu::OWeakObject*)(SfxBaseController*)this;
154cdf0e10cSrcweir         lang::EventObject aEvent(xInt);
155cdf0e10cSrcweir         for ( sal_uInt16 i = nCount; i--; )
156cdf0e10cSrcweir         {
157cdf0e10cSrcweir             uno::Reference< view::XSelectionChangeListener >  *pObj = aSelChangedListeners[i];
158cdf0e10cSrcweir             (*pObj)->disposing(aEvent);
159cdf0e10cSrcweir         }
160cdf0e10cSrcweir     }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	// #i85580: now clean up any possibly remaining entries in the array...
163cdf0e10cSrcweir 	// (i.e. listeners that did not call removeSelectionChangeListener in their disposing.)
164cdf0e10cSrcweir 	while ((nCount = aSelChangedListeners.Count()) != 0)
165cdf0e10cSrcweir 	{
166cdf0e10cSrcweir 		removeSelectionChangeListener( *aSelChangedListeners[0] );
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	m_refCount--;
170cdf0e10cSrcweir     m_pView = 0;
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir /* -----------------------------18.05.00 10:18--------------------------------
174cdf0e10cSrcweir 
175cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
176cdf0e10cSrcweir Sequence< uno::Type > SAL_CALL SwXTextView::getTypes(  ) throw(uno::RuntimeException)
177cdf0e10cSrcweir {
178cdf0e10cSrcweir //	uno::Sequence< uno::Type > aViewTypes = SwXTextViewBaseClass::getTypes();
179cdf0e10cSrcweir 	uno::Sequence< uno::Type > aBaseTypes = SfxBaseController::getTypes();
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	long nIndex = aBaseTypes.getLength();
182cdf0e10cSrcweir 	aBaseTypes.realloc(
183cdf0e10cSrcweir         aBaseTypes.getLength() + 8 );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	uno::Type* pBaseTypes = aBaseTypes.getArray();
186cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XSelectionSupplier	>*)0);
187cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XServiceInfo			>*)0);
188cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XFormLayerAccess   >*)0);
189cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XTextViewCursorSupplier>*)0);
190cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XViewSettingsSupplier	>*)0);
191cdf0e10cSrcweir 	pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XRubySelection	>*)0);
192cdf0e10cSrcweir     pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XPropertySet  >*)0);
193cdf0e10cSrcweir     pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0);
194cdf0e10cSrcweir 	return aBaseTypes;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir /* -----------------------------18.05.00 10:18--------------------------------
197cdf0e10cSrcweir 
198cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
199cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId(  ) throw(uno::RuntimeException)
200cdf0e10cSrcweir {
201cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
202cdf0e10cSrcweir     static Sequence< sal_Int8 > aId( 16 );
203cdf0e10cSrcweir     static sal_Bool bInit = sal_False;
204cdf0e10cSrcweir     if(!bInit)
205cdf0e10cSrcweir     {
206cdf0e10cSrcweir         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
207cdf0e10cSrcweir         bInit = sal_True;
208cdf0e10cSrcweir     }
209cdf0e10cSrcweir     return aId;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir /* -----------------------------18.05.00 10:18--------------------------------
212cdf0e10cSrcweir 
213cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
214cdf0e10cSrcweir void SAL_CALL SwXTextView::acquire(  )throw()
215cdf0e10cSrcweir {
216cdf0e10cSrcweir 	SfxBaseController::acquire();
217cdf0e10cSrcweir }
218cdf0e10cSrcweir /* -----------------------------18.05.00 10:18--------------------------------
219cdf0e10cSrcweir 
220cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
221cdf0e10cSrcweir void SAL_CALL SwXTextView::release(  )throw()
222cdf0e10cSrcweir {
223cdf0e10cSrcweir 	SfxBaseController::release();
224cdf0e10cSrcweir }
225cdf0e10cSrcweir /* -----------------------------18.05.00 10:23--------------------------------
226cdf0e10cSrcweir 
227cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
228cdf0e10cSrcweir uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType )
229cdf0e10cSrcweir 	throw (RuntimeException)
230cdf0e10cSrcweir {
231cdf0e10cSrcweir 	uno::Any aRet;
232cdf0e10cSrcweir 	if(aType == ::getCppuType((uno::Reference<view::XSelectionSupplier	>*)0))
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir 		uno::Reference<view::XSelectionSupplier> xRet = this;
235cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
236cdf0e10cSrcweir 	}
237cdf0e10cSrcweir 	else if(aType == ::getCppuType((uno::Reference<lang::XServiceInfo			>*)0))
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		uno::Reference<lang::XServiceInfo> xRet = this;
240cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
241cdf0e10cSrcweir 	}
242cdf0e10cSrcweir 	else if(aType == ::getCppuType((uno::Reference<view::XControlAccess		>*)0))
243cdf0e10cSrcweir 	{
244cdf0e10cSrcweir 		uno::Reference<view::XControlAccess> xRet = this;
245cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
246cdf0e10cSrcweir 	}
247cdf0e10cSrcweir     else if(aType == ::getCppuType((uno::Reference<view::XFormLayerAccess   >*)0))
248cdf0e10cSrcweir 	{
249cdf0e10cSrcweir 		uno::Reference<view::XFormLayerAccess> xRet = this;
250cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
251cdf0e10cSrcweir 	}
252cdf0e10cSrcweir 	else if(aType == ::getCppuType((uno::Reference<text::XTextViewCursorSupplier>*)0))
253cdf0e10cSrcweir 	{
254cdf0e10cSrcweir 		uno::Reference<text::XTextViewCursorSupplier> xRet = this;
255cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
256cdf0e10cSrcweir 	}
257cdf0e10cSrcweir 	else if(aType == ::getCppuType((uno::Reference<view::XViewSettingsSupplier	>*)0))
258cdf0e10cSrcweir 	{
259cdf0e10cSrcweir 		uno::Reference<view::XViewSettingsSupplier> xRet = this;
260cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
261cdf0e10cSrcweir 	}
262cdf0e10cSrcweir 	else if(aType == ::getCppuType((uno::Reference<XRubySelection>*)0))
263cdf0e10cSrcweir 	{
264cdf0e10cSrcweir 		uno::Reference<XRubySelection> xRet = this;
265cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
266cdf0e10cSrcweir 	}
267cdf0e10cSrcweir     else if(aType == ::getCppuType((uno::Reference<XPropertySet>*)0))
268cdf0e10cSrcweir     {
269cdf0e10cSrcweir         uno::Reference<XPropertySet> xRet = this;
270cdf0e10cSrcweir         aRet.setValue(&xRet, aType);
271cdf0e10cSrcweir     }
272cdf0e10cSrcweir     else if(aType == ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier   >*)0))
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir         uno::Reference<datatransfer::XTransferableSupplier> xRet = this;
275cdf0e10cSrcweir 		aRet.setValue(&xRet, aType);
276cdf0e10cSrcweir 	}
277cdf0e10cSrcweir 	else
278cdf0e10cSrcweir 		aRet = SfxBaseController::queryInterface(aType);
279cdf0e10cSrcweir 	return aRet;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir /*-- 17.12.98 09:34:26---------------------------------------------------
282cdf0e10cSrcweir 
283cdf0e10cSrcweir   -----------------------------------------------------------------------*/
284cdf0e10cSrcweir sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArgumentException, uno::RuntimeException )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
287cdf0e10cSrcweir     uno::Reference< uno::XInterface >  xInterface;
288cdf0e10cSrcweir     if(GetView() && (aInterface >>= xInterface))
289cdf0e10cSrcweir 	{
290cdf0e10cSrcweir 		SwWrtShell& rSh = GetView()->GetWrtShell();
291cdf0e10cSrcweir 		SwDoc* pDoc = GetView()->GetDocShell()->GetDoc();
292cdf0e10cSrcweir 		uno::Reference< lang::XUnoTunnel >  xIfcTunnel(xInterface, uno::UNO_QUERY);
293cdf0e10cSrcweir 		uno::Reference< text::XTextCursor >  xCrsr(xInterface, uno::UNO_QUERY);
294cdf0e10cSrcweir 		uno::Reference< container::XIndexAccess > 	xPosN(xInterface, uno::UNO_QUERY);
295cdf0e10cSrcweir 		uno::Reference< text::XTextRange > 	xPos(xInterface, uno::UNO_QUERY);
296cdf0e10cSrcweir         SwXFrame* pFrame = xIfcTunnel.is() ? reinterpret_cast<SwXFrame*>(
297cdf0e10cSrcweir             xIfcTunnel->getSomething(SwXFrame::getUnoTunnelId())) : 0;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         SwXCell* pCell = xIfcTunnel.is() ? reinterpret_cast<SwXCell*>(
300cdf0e10cSrcweir             xIfcTunnel->getSomething(SwXCell::getUnoTunnelId())) : 0;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 		SwPaM * pPam = 0;
303cdf0e10cSrcweir 		SwXTextRanges* pPosN = 0;
304cdf0e10cSrcweir 		if(xCrsr.is())
305cdf0e10cSrcweir 		{
306cdf0e10cSrcweir 			//
307cdf0e10cSrcweir 			OTextCursorHelper* pCursor =
308cdf0e10cSrcweir 				xIfcTunnel.is() ?
309cdf0e10cSrcweir                     reinterpret_cast<OTextCursorHelper*>(xIfcTunnel->getSomething(OTextCursorHelper::getUnoTunnelId()))
310cdf0e10cSrcweir 					: 0;
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 			if(pCursor && pCursor->GetDoc() == GetView()->GetDocShell()->GetDoc())
313cdf0e10cSrcweir             {
314cdf0e10cSrcweir                 pPam = lcl_createPamCopy(*pCursor->GetPaM());
315cdf0e10cSrcweir             }
316cdf0e10cSrcweir 		}
317cdf0e10cSrcweir 		else if(xPosN.is() &&
318cdf0e10cSrcweir 			xIfcTunnel.is() &&
319cdf0e10cSrcweir                 0 != (pPosN = reinterpret_cast<SwXTextRanges*>(xIfcTunnel->getSomething(SwXTextRanges::getUnoTunnelId()))))
320cdf0e10cSrcweir 		{
321cdf0e10cSrcweir 			const SwUnoCrsr* pUnoCrsr = pPosN->GetCursor();
322cdf0e10cSrcweir 			if(pUnoCrsr)
323cdf0e10cSrcweir 			{
324cdf0e10cSrcweir 				pPam = lcl_createPamCopy(*pUnoCrsr);
325cdf0e10cSrcweir 			}
326cdf0e10cSrcweir 		}
327cdf0e10cSrcweir 		// prevent misinterpretation of text frames that provide a XTextRange interface, too
328cdf0e10cSrcweir 		else if(!pFrame && !pCell && xPos.is())
329cdf0e10cSrcweir 		{
330cdf0e10cSrcweir 			SwUnoInternalPaM aPam(*pDoc);
331cdf0e10cSrcweir             if (::sw::XTextRangeToSwPaM(aPam, xPos))
332cdf0e10cSrcweir 			{
333cdf0e10cSrcweir 				pPam = lcl_createPamCopy(aPam);
334cdf0e10cSrcweir 			}
335cdf0e10cSrcweir 		}
336cdf0e10cSrcweir 		if(pPam)
337cdf0e10cSrcweir 		{
338cdf0e10cSrcweir 			rSh.EnterStdMode();
339cdf0e10cSrcweir 			rSh.SetSelection(*pPam);
340cdf0e10cSrcweir             while( pPam->GetNext() != pPam )
341cdf0e10cSrcweir                 delete pPam->GetNext();
342cdf0e10cSrcweir             delete pPam;
343cdf0e10cSrcweir 			return sal_True;
344cdf0e10cSrcweir 		}
345cdf0e10cSrcweir 		if(pFrame)
346cdf0e10cSrcweir 		{
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 			SwFrmFmt* pFrmFmt = pFrame->GetFrmFmt();
349cdf0e10cSrcweir 			if(pFrmFmt && pFrmFmt->GetDoc() == pDoc)
350cdf0e10cSrcweir 			{
351cdf0e10cSrcweir 				sal_Bool bSuccess = rSh.GotoFly( pFrmFmt->GetName(), pFrame->GetFlyCntType());
352cdf0e10cSrcweir 				if (bSuccess)
353cdf0e10cSrcweir 				{
354cdf0e10cSrcweir 					rSh.HideCrsr();
355cdf0e10cSrcweir 					rSh.EnterSelFrmMode();
356cdf0e10cSrcweir 				}
357cdf0e10cSrcweir 				return sal_True;
358cdf0e10cSrcweir 			}
359cdf0e10cSrcweir 		}
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 		uno::Reference< text::XTextTable >  xTbl(xInterface, uno::UNO_QUERY);;
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 		if(xTbl.is() && xIfcTunnel.is())
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir             SwXTextTable* pTable = reinterpret_cast<SwXTextTable*>(
366cdf0e10cSrcweir                 xIfcTunnel->getSomething(SwXTextTable::getUnoTunnelId()));
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 			SwFrmFmt* pTblFrmFmt = pTable ? ((SwXTextTable*)pTable)->GetFrmFmt() : 0;
369cdf0e10cSrcweir 			if(pTblFrmFmt &&pTblFrmFmt->GetDoc() == pDoc)
370cdf0e10cSrcweir 			{
371cdf0e10cSrcweir 				rSh.EnterStdMode();
372cdf0e10cSrcweir 				rSh.GotoTable(pTblFrmFmt->GetName());
373cdf0e10cSrcweir 			}
374cdf0e10cSrcweir 			return sal_True;
375cdf0e10cSrcweir 		}
376cdf0e10cSrcweir 
377cdf0e10cSrcweir         if(pCell)
378cdf0e10cSrcweir         {
379cdf0e10cSrcweir             SwFrmFmt* pTblFrmFmt = pCell->GetFrmFmt();
380cdf0e10cSrcweir             if(pTblFrmFmt && pTblFrmFmt->GetDoc() == pDoc)
381cdf0e10cSrcweir             {
382cdf0e10cSrcweir                 SwTableBox* pBox = pCell->GetTblBox();
383cdf0e10cSrcweir                 SwTable* pTable = SwTable::FindTable( pTblFrmFmt );
384cdf0e10cSrcweir                 pBox = pCell->FindBox(pTable, pBox);
385cdf0e10cSrcweir                 if(pBox)
386cdf0e10cSrcweir                 {
387cdf0e10cSrcweir                     const SwStartNode* pSttNd = pBox->GetSttNd();
388cdf0e10cSrcweir                     SwPosition aPos(*pSttNd);
389cdf0e10cSrcweir                     SwPaM aPam(aPos);
390cdf0e10cSrcweir                     aPam.Move(fnMoveForward, fnGoNode);
391cdf0e10cSrcweir                     rSh.EnterStdMode();
392cdf0e10cSrcweir                     rSh.SetSelection(aPam);
393cdf0e10cSrcweir                     return sal_True;
394cdf0e10cSrcweir                 }
395cdf0e10cSrcweir             }
396cdf0e10cSrcweir         }
397cdf0e10cSrcweir         SwXCellRange* pRange = xIfcTunnel.is() ? reinterpret_cast<SwXCellRange*>(
398cdf0e10cSrcweir             xIfcTunnel->getSomething(SwXCellRange::getUnoTunnelId())) : 0;
399cdf0e10cSrcweir         if(pRange)
400cdf0e10cSrcweir         {
401cdf0e10cSrcweir            const SwUnoCrsr* pUnoCrsr = pRange->GetTblCrsr();
402cdf0e10cSrcweir            if(pUnoCrsr)
403cdf0e10cSrcweir            {
404cdf0e10cSrcweir                 UnoActionRemoveContext aContext(pDoc);
405cdf0e10cSrcweir                 rSh.EnterStdMode();
406cdf0e10cSrcweir                 rSh.SetSelection(*pUnoCrsr);
407cdf0e10cSrcweir 				return sal_True;
408cdf0e10cSrcweir            }
409cdf0e10cSrcweir         }
410cdf0e10cSrcweir 		uno::Reference< text::XTextContent >  xBkm(xInterface, uno::UNO_QUERY);;
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 		if(xBkm.is() && xIfcTunnel.is())
413cdf0e10cSrcweir         {
414cdf0e10cSrcweir             ::sw::mark::IMark const*const pMark(
415cdf0e10cSrcweir                     SwXBookmark::GetBookmarkInDoc(pDoc, xIfcTunnel) );
416cdf0e10cSrcweir             if (pMark)
417cdf0e10cSrcweir             {
418cdf0e10cSrcweir                 rSh.EnterStdMode();
419cdf0e10cSrcweir                 rSh.GotoMark(pMark);
420cdf0e10cSrcweir                 return sal_True;
421cdf0e10cSrcweir             }
422cdf0e10cSrcweir         }
423cdf0e10cSrcweir         // IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
424cdf0e10cSrcweir 		//
425cdf0e10cSrcweir 
426cdf0e10cSrcweir         // detect controls
427cdf0e10cSrcweir 
428cdf0e10cSrcweir         uno::Reference< awt::XControlModel > xCtrlModel(xInterface, UNO_QUERY);
429cdf0e10cSrcweir         if(xCtrlModel.is())
430cdf0e10cSrcweir         {
431cdf0e10cSrcweir             uno::Reference<awt::XControl> XControl;
432cdf0e10cSrcweir             SdrObject* pObj = GetControl(xCtrlModel, XControl);
433cdf0e10cSrcweir             if(pObj)
434cdf0e10cSrcweir             {
435cdf0e10cSrcweir                 SdrView* pDrawView = rSh.GetDrawView();
436cdf0e10cSrcweir                 SdrPageView* pPV = pDrawView->GetSdrPageView();
437cdf0e10cSrcweir                 if ( pPV && pObj->GetPage() == pPV->GetPage() )
438cdf0e10cSrcweir 				{
439cdf0e10cSrcweir 					pDrawView->SdrEndTextEdit();
440cdf0e10cSrcweir 					pDrawView->UnmarkAll();
441cdf0e10cSrcweir                     pDrawView->MarkObj( pObj, pPV );
442cdf0e10cSrcweir 				}
443cdf0e10cSrcweir                 return sal_True;
444cdf0e10cSrcweir             }
445cdf0e10cSrcweir         }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 		uno::Reference< drawing::XShapes >  xShapeColl( xInterface, uno::UNO_QUERY );
448cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet >  xTmpProp(xInterface, uno::UNO_QUERY);
449cdf0e10cSrcweir 		SwXShape* pSwXShape = 0;
450cdf0e10cSrcweir 		if(xIfcTunnel.is())
451cdf0e10cSrcweir             pSwXShape = reinterpret_cast<SwXShape*>(xIfcTunnel->getSomething(SwXShape::getUnoTunnelId()));
452cdf0e10cSrcweir 		SvxShape* pSvxShape = 0;
453cdf0e10cSrcweir 		if(pSwXShape)
454cdf0e10cSrcweir 		{
455cdf0e10cSrcweir 			uno::Reference< uno::XAggregation > 	xAgg = pSwXShape->GetAggregationInterface();
456cdf0e10cSrcweir 			if(xAgg.is())
457cdf0e10cSrcweir 			{
458cdf0e10cSrcweir                 pSvxShape = reinterpret_cast<SvxShape*>(xIfcTunnel->getSomething(SvxShape::getUnoTunnelId()));
459cdf0e10cSrcweir 			}
460cdf0e10cSrcweir 		}
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 		if ( pSvxShape || xShapeColl.is() )			// Drawing drawing::Layer
463cdf0e10cSrcweir 		{
464cdf0e10cSrcweir 			SdrView* pDrawView = rSh.GetDrawView();
465cdf0e10cSrcweir 			if (pDrawView)
466cdf0e10cSrcweir 			{
467cdf0e10cSrcweir 				pDrawView->SdrEndTextEdit();
468cdf0e10cSrcweir 				pDrawView->UnmarkAll();
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 				if (pSvxShape)		// einzelnes Shape
471cdf0e10cSrcweir 				{
472cdf0e10cSrcweir 					SdrObject *pObj = pSvxShape->GetSdrObject();
473cdf0e10cSrcweir 					if (pObj)
474cdf0e10cSrcweir 					{
475cdf0e10cSrcweir //                      lcl_ShowObject( *m_pViewSh, *pDrawView, pObj );
476cdf0e10cSrcweir 						SdrPageView* pPV = pDrawView->GetSdrPageView();
477cdf0e10cSrcweir 						if ( pPV && pObj->GetPage() == pPV->GetPage() )
478cdf0e10cSrcweir 						{
479cdf0e10cSrcweir 							pDrawView->MarkObj( pObj, pPV );
480cdf0e10cSrcweir                             return sal_True;
481cdf0e10cSrcweir 						}
482cdf0e10cSrcweir 					}
483cdf0e10cSrcweir 				}
484cdf0e10cSrcweir 				else	// Shape Collection
485cdf0e10cSrcweir 				{
486cdf0e10cSrcweir                     sal_Bool bSelected = sal_False;
487cdf0e10cSrcweir 					SdrPageView* pPV = NULL;
488cdf0e10cSrcweir 					long nCount = xShapeColl->getCount();
489cdf0e10cSrcweir 					for ( long i = 0; i < nCount; i++ )
490cdf0e10cSrcweir 					{
491cdf0e10cSrcweir 						uno::Reference< drawing::XShape >  xShapeInt;
492cdf0e10cSrcweir 						uno::Any aAny = xShapeColl->getByIndex(i);
493cdf0e10cSrcweir                         aAny >>= xShapeInt;
494cdf0e10cSrcweir 						if (xShapeInt.is())
495cdf0e10cSrcweir 						{
496cdf0e10cSrcweir 							uno::Reference< lang::XUnoTunnel> xShapeTunnel(xShapeInt, uno::UNO_QUERY);
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 							SvxShape* pShape = xShapeTunnel.is() ?
499cdf0e10cSrcweir                                 reinterpret_cast<SvxShape*>(xShapeTunnel->getSomething(SvxShape::getUnoTunnelId())) : 0;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 							if (pShape)
502cdf0e10cSrcweir 							{
503cdf0e10cSrcweir 								SdrObject *pObj = pShape->GetSdrObject();
504cdf0e10cSrcweir 								if (pObj)
505cdf0e10cSrcweir 								{
506cdf0e10cSrcweir 									if (!pPV)				// erstes Objekt
507cdf0e10cSrcweir 									{
508cdf0e10cSrcweir //                                      lcl_ShowObject( *m_pViewSh, *pDrawView, pObj );
509cdf0e10cSrcweir 										pPV = pDrawView->GetSdrPageView();
510cdf0e10cSrcweir 									}
511cdf0e10cSrcweir 									if ( pPV && pObj->GetPage() == pPV->GetPage() )
512cdf0e10cSrcweir 									{
513cdf0e10cSrcweir 										pDrawView->MarkObj( pObj, pPV );
514cdf0e10cSrcweir                                         bSelected = sal_True;
515cdf0e10cSrcweir 									}
516cdf0e10cSrcweir 								}
517cdf0e10cSrcweir 							}
518cdf0e10cSrcweir 						}
519cdf0e10cSrcweir 					}
520cdf0e10cSrcweir                     return bSelected;
521cdf0e10cSrcweir 				}
522cdf0e10cSrcweir 			}
523cdf0e10cSrcweir 		}
524cdf0e10cSrcweir 	}
525cdf0e10cSrcweir 	return sal_False;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir }
528cdf0e10cSrcweir /*-- 17.12.98 09:34:26---------------------------------------------------
529cdf0e10cSrcweir 
530cdf0e10cSrcweir   -----------------------------------------------------------------------*/
531cdf0e10cSrcweir uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException )
532cdf0e10cSrcweir {
533cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
534cdf0e10cSrcweir 	uno::Reference< uno::XInterface >  aRef;
535cdf0e10cSrcweir     if(GetView())
536cdf0e10cSrcweir 	{
537cdf0e10cSrcweir 		//force immediat shell update
538cdf0e10cSrcweir         m_pView->StopShellTimer();
539cdf0e10cSrcweir 		// ein interface aus der aktuellen Selektion erzeugen
540cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
541cdf0e10cSrcweir         ShellModes  eSelMode = m_pView->GetShellMode();
542cdf0e10cSrcweir 		switch(eSelMode)
543cdf0e10cSrcweir 		{
544cdf0e10cSrcweir 			case SHELL_MODE_TABLE_TEXT      :
545cdf0e10cSrcweir 			{
546cdf0e10cSrcweir 				if(rSh.GetTableCrsr())
547cdf0e10cSrcweir 				{
548cdf0e10cSrcweir 					DBG_ASSERT(rSh.GetTableFmt(), "kein Tabellenformat?");
549cdf0e10cSrcweir 					uno::Reference< text::XTextTableCursor >  xCrsr = new SwXTextTableCursor(*rSh.GetTableFmt(),
550cdf0e10cSrcweir 													rSh.GetTableCrsr());
551cdf0e10cSrcweir 					aRef = uno::Reference< uno::XInterface >  (xCrsr, uno::UNO_QUERY);;
552cdf0e10cSrcweir 					break;
553cdf0e10cSrcweir 				}
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 			}
556cdf0e10cSrcweir 			// ohne Tabellenselektion wird der Text geliefert
557cdf0e10cSrcweir 			//break;
558cdf0e10cSrcweir 			case SHELL_MODE_LIST_TEXT       :
559cdf0e10cSrcweir 			case SHELL_MODE_TABLE_LIST_TEXT:
560cdf0e10cSrcweir 			case SHELL_MODE_TEXT            :
561cdf0e10cSrcweir 			{
562cdf0e10cSrcweir 				uno::Reference< container::XIndexAccess >  xPos = new SwXTextRanges(rSh.GetCrsr());
563cdf0e10cSrcweir 				aRef = uno::Reference< uno::XInterface >(xPos, uno::UNO_QUERY);
564cdf0e10cSrcweir 			}
565cdf0e10cSrcweir 			break;
566cdf0e10cSrcweir 			case SHELL_MODE_FRAME           :
567cdf0e10cSrcweir 			case SHELL_MODE_GRAPHIC         :
568cdf0e10cSrcweir 			case SHELL_MODE_OBJECT          :
569cdf0e10cSrcweir 			{
570cdf0e10cSrcweir 				//Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
571cdf0e10cSrcweir 				const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
572cdf0e10cSrcweir 				if (pFmt)
573cdf0e10cSrcweir 				{
574cdf0e10cSrcweir 					SwXFrame* pxFrame = SwIterator<SwXFrame,SwFmt>::FirstElement(*pFmt);
575cdf0e10cSrcweir 					if(pxFrame)				   //das einzige gemeinsame interface fuer alle Frames
576cdf0e10cSrcweir 					{
577cdf0e10cSrcweir 						aRef = uno::Reference< uno::XInterface >((cppu::OWeakObject*)pxFrame, uno::UNO_QUERY);
578cdf0e10cSrcweir 					}
579cdf0e10cSrcweir 					else
580cdf0e10cSrcweir 					{
581cdf0e10cSrcweir 						if(SHELL_MODE_FRAME == eSelMode)
582cdf0e10cSrcweir 						{
583cdf0e10cSrcweir 							uno::Reference< text::XTextFrame >  xFrm =  new SwXTextFrame((SwFrmFmt&)*pFmt);
584cdf0e10cSrcweir 							aRef = uno::Reference< uno::XInterface >(xFrm, uno::UNO_QUERY);
585cdf0e10cSrcweir 						}
586cdf0e10cSrcweir 						else if(SHELL_MODE_GRAPHIC == eSelMode)
587cdf0e10cSrcweir 						{
588cdf0e10cSrcweir 							uno::Reference< text::XTextContent >  xFrm = new SwXTextGraphicObject((SwFrmFmt&)*pFmt);
589cdf0e10cSrcweir 							aRef = xFrm;
590cdf0e10cSrcweir 						}
591cdf0e10cSrcweir 						else
592cdf0e10cSrcweir 						{
593cdf0e10cSrcweir 							uno::Reference< text::XTextContent >  xFrm =  new SwXTextEmbeddedObject((SwFrmFmt&)*pFmt);
594cdf0e10cSrcweir 							aRef = xFrm;
595cdf0e10cSrcweir 						}
596cdf0e10cSrcweir 					}
597cdf0e10cSrcweir 				}
598cdf0e10cSrcweir 			}
599cdf0e10cSrcweir 			break;
600cdf0e10cSrcweir 			case SHELL_MODE_DRAW            :
601cdf0e10cSrcweir 			case SHELL_MODE_DRAW_CTRL       :
602cdf0e10cSrcweir 			case SHELL_MODE_DRAW_FORM       :
603cdf0e10cSrcweir 			case SHELL_MODE_DRAWTEXT        :
604cdf0e10cSrcweir 			case SHELL_MODE_BEZIER          :
605cdf0e10cSrcweir 			{
606cdf0e10cSrcweir 				uno::Reference< drawing::XDrawPageSupplier >  xPageSupp;
607cdf0e10cSrcweir                 uno::Reference< frame::XModel > xModel = m_pView->GetDocShell()->GetBaseModel();
608cdf0e10cSrcweir 				uno::Reference< lang::XUnoTunnel > xModelTunnel(xModel, uno::UNO_QUERY);
609cdf0e10cSrcweir                 SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument*>(xModelTunnel->
610cdf0e10cSrcweir                                 getSomething(SwXTextDocument::getUnoTunnelId()));
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 				SwFmDrawPage* pSvxDrawPage = 	pTextDoc->GetDrawPage()->GetSvxPage();
613cdf0e10cSrcweir 				uno::Reference< drawing::XShapes >  xShCol = new SvxShapeCollection();
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 				const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList();
616cdf0e10cSrcweir 				for(sal_uInt16 i = 0; i < rMarkList.GetMarkCount(); i++)
617cdf0e10cSrcweir 				{
618cdf0e10cSrcweir 					SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
619cdf0e10cSrcweir 					uno::Reference< uno::XInterface >  xInt = pSvxDrawPage->GetInterface( pObj );
620cdf0e10cSrcweir 					uno::Reference< drawing::XShape >  xShape(xInt, uno::UNO_QUERY);;
621cdf0e10cSrcweir 					xShCol->add(xShape);
622cdf0e10cSrcweir 				}
623cdf0e10cSrcweir 				aRef = uno::Reference< uno::XInterface >(xShCol, uno::UNO_QUERY);
624cdf0e10cSrcweir 			}
625cdf0e10cSrcweir 			break;
626cdf0e10cSrcweir             default:;//prevent warning
627cdf0e10cSrcweir 		}
628cdf0e10cSrcweir 	}
629cdf0e10cSrcweir 	uno::Any aRet(&aRef, ::getCppuType((uno::Reference<uno::XInterface>*)0));
630cdf0e10cSrcweir 	return aRet;
631cdf0e10cSrcweir }
632cdf0e10cSrcweir /*-- 17.12.98 09:34:27---------------------------------------------------
633cdf0e10cSrcweir 
634cdf0e10cSrcweir   -----------------------------------------------------------------------*/
635cdf0e10cSrcweir void SwXTextView::addSelectionChangeListener(
636cdf0e10cSrcweir 									const uno::Reference< view::XSelectionChangeListener > & rxListener)
637cdf0e10cSrcweir 									throw( uno::RuntimeException )
638cdf0e10cSrcweir {
639cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
640cdf0e10cSrcweir 	uno::Reference< view::XSelectionChangeListener > * pInsert = new uno::Reference< view::XSelectionChangeListener > ;
641cdf0e10cSrcweir 	*pInsert = rxListener;
642cdf0e10cSrcweir 	aSelChangedListeners.Insert(pInsert, aSelChangedListeners.Count());
643cdf0e10cSrcweir }
644cdf0e10cSrcweir /*-- 17.12.98 09:34:27---------------------------------------------------
645cdf0e10cSrcweir 
646cdf0e10cSrcweir   -----------------------------------------------------------------------*/
647cdf0e10cSrcweir void SwXTextView::removeSelectionChangeListener(
648cdf0e10cSrcweir 										const uno::Reference< view::XSelectionChangeListener > & rxListener)
649cdf0e10cSrcweir 										throw( uno::RuntimeException )
650cdf0e10cSrcweir {
651cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
652cdf0e10cSrcweir 	view::XSelectionChangeListener* pLeft = rxListener.get();
653cdf0e10cSrcweir 	for(sal_uInt16 i = 0; i < aSelChangedListeners.Count(); i++)
654cdf0e10cSrcweir 	{
655cdf0e10cSrcweir 		uno::Reference< view::XSelectionChangeListener > * pElem = aSelChangedListeners.GetObject(i);
656cdf0e10cSrcweir 	 	view::XSelectionChangeListener* pRight = pElem->get();
657cdf0e10cSrcweir 		if(pLeft == pRight)
658cdf0e10cSrcweir 		{
659cdf0e10cSrcweir 			aSelChangedListeners.Remove(i);
660cdf0e10cSrcweir 			delete pElem;
661cdf0e10cSrcweir             break;
662cdf0e10cSrcweir 		}
663cdf0e10cSrcweir 	}
664cdf0e10cSrcweir }
665cdf0e10cSrcweir /* -----------------------------01.06.01 14:41--------------------------------
666cdf0e10cSrcweir 
667cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
668cdf0e10cSrcweir SdrObject* SwXTextView::GetControl(
669cdf0e10cSrcweir         const uno::Reference< awt::XControlModel > & xModel,
670cdf0e10cSrcweir         uno::Reference< awt::XControl >& xToFill  )
671cdf0e10cSrcweir {
672cdf0e10cSrcweir     SwView* pView2 = GetView();
673cdf0e10cSrcweir     FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
674cdf0e10cSrcweir     SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL;
675cdf0e10cSrcweir     Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
676cdf0e10cSrcweir 
677cdf0e10cSrcweir     DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
678cdf0e10cSrcweir 
679cdf0e10cSrcweir     SdrObject* pControl = NULL;
680cdf0e10cSrcweir     if ( pFormShell && pDrawView && pWindow )
681cdf0e10cSrcweir         pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow, xToFill );
682cdf0e10cSrcweir     return pControl;
683cdf0e10cSrcweir }
684cdf0e10cSrcweir /*-- 17.12.98 09:34:27---------------------------------------------------
685cdf0e10cSrcweir 
686cdf0e10cSrcweir   -----------------------------------------------------------------------*/
687cdf0e10cSrcweir uno::Reference< awt::XControl >  SwXTextView::getControl(const uno::Reference< awt::XControlModel > & xModel)
688cdf0e10cSrcweir 		throw( container::NoSuchElementException, uno::RuntimeException )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
691cdf0e10cSrcweir     uno::Reference< awt::XControl >  xRet;
692cdf0e10cSrcweir     GetControl(xModel, xRet);
693cdf0e10cSrcweir     return xRet;
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------
697cdf0e10cSrcweir 
698cdf0e10cSrcweir   -----------------------------------------------------------------------*/
699cdf0e10cSrcweir uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException)
700cdf0e10cSrcweir {
701cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
702cdf0e10cSrcweir 
703cdf0e10cSrcweir     SwView* pView2 = GetView();
704cdf0e10cSrcweir     FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
705cdf0e10cSrcweir     SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL;
706cdf0e10cSrcweir     Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
707cdf0e10cSrcweir     DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" );
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     uno::Reference< form::runtime::XFormController > xController;
710cdf0e10cSrcweir     if ( pFormShell && pDrawView && pWindow )
711cdf0e10cSrcweir         xController = pFormShell->GetFormController( _Form, *pDrawView, *pWindow );
712cdf0e10cSrcweir     return xController;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------
716cdf0e10cSrcweir 
717cdf0e10cSrcweir   -----------------------------------------------------------------------*/
718cdf0e10cSrcweir ::sal_Bool SAL_CALL SwXTextView::isFormDesignMode(  ) throw (uno::RuntimeException)
719cdf0e10cSrcweir {
720cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
721cdf0e10cSrcweir     SwView* pView2 = GetView();
722cdf0e10cSrcweir     FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
723cdf0e10cSrcweir     return pFormShell ? pFormShell->IsDesignMode() : sal_True;
724cdf0e10cSrcweir }
725cdf0e10cSrcweir 
726cdf0e10cSrcweir /*-- 08.03.07 13:55------------------------------------------------------
727cdf0e10cSrcweir 
728cdf0e10cSrcweir   -----------------------------------------------------------------------*/
729cdf0e10cSrcweir void SAL_CALL SwXTextView::setFormDesignMode( ::sal_Bool _DesignMode ) throw (RuntimeException)
730cdf0e10cSrcweir {
731cdf0e10cSrcweir 	::vos::OGuard aGuard( Application::GetSolarMutex() );
732cdf0e10cSrcweir     SwView* pView2 = GetView();
733cdf0e10cSrcweir     FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
734cdf0e10cSrcweir     if ( pFormShell )
735cdf0e10cSrcweir         pFormShell->SetDesignMode( _DesignMode );
736cdf0e10cSrcweir }
737cdf0e10cSrcweir 
738cdf0e10cSrcweir /*-- 17.12.98 09:34:28---------------------------------------------------
739cdf0e10cSrcweir 
740cdf0e10cSrcweir   -----------------------------------------------------------------------*/
741cdf0e10cSrcweir uno::Reference< text::XTextViewCursor >  SwXTextView::getViewCursor(void) throw( uno::RuntimeException )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
744cdf0e10cSrcweir     if(GetView())
745cdf0e10cSrcweir 	{
746cdf0e10cSrcweir 		if(!pxTextViewCursor)
747cdf0e10cSrcweir 		{
748cdf0e10cSrcweir 			((SwXTextView*)this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ;
749cdf0e10cSrcweir             *pxTextViewCursor = new  SwXTextViewCursor(GetView());
750cdf0e10cSrcweir 		}
751cdf0e10cSrcweir 		return *pxTextViewCursor;
752cdf0e10cSrcweir 	}
753cdf0e10cSrcweir 	else
754cdf0e10cSrcweir 		throw uno::RuntimeException();
755cdf0e10cSrcweir }
756cdf0e10cSrcweir /*-- 17.12.98 09:34:28---------------------------------------------------
757cdf0e10cSrcweir 
758cdf0e10cSrcweir   -----------------------------------------------------------------------*/
759cdf0e10cSrcweir uno::Reference< beans::XPropertySet >  SwXTextView::getViewSettings(void) throw( uno::RuntimeException )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
762cdf0e10cSrcweir     if(m_pView)
763cdf0e10cSrcweir 	{
764cdf0e10cSrcweir 		if(!pxViewSettings)
765cdf0e10cSrcweir 		{
766cdf0e10cSrcweir 			((SwXTextView*)this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ;
767cdf0e10cSrcweir             *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, m_pView ) );
768cdf0e10cSrcweir 		}
769cdf0e10cSrcweir 	}
770cdf0e10cSrcweir 	else
771cdf0e10cSrcweir 		throw uno::RuntimeException();
772cdf0e10cSrcweir 	return *pxViewSettings;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir /* -----------------------------30.01.01 15:01--------------------------------
775cdf0e10cSrcweir 
776cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
777cdf0e10cSrcweir Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ ) throw(RuntimeException)
778cdf0e10cSrcweir {
779cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
780cdf0e10cSrcweir 
781cdf0e10cSrcweir     if(!GetView())
782cdf0e10cSrcweir 		throw RuntimeException();
783cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
784cdf0e10cSrcweir     ShellModes  eSelMode = m_pView->GetShellMode();
785cdf0e10cSrcweir 	if (eSelMode != SHELL_MODE_LIST_TEXT      &&
786cdf0e10cSrcweir 		eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
787cdf0e10cSrcweir         eSelMode != SHELL_MODE_TABLE_TEXT      &&
788cdf0e10cSrcweir         eSelMode != SHELL_MODE_TEXT           )
789cdf0e10cSrcweir 		return Sequence< Sequence< PropertyValue > > ();
790cdf0e10cSrcweir 
791cdf0e10cSrcweir     SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
792cdf0e10cSrcweir 	SwRubyList aList;
793cdf0e10cSrcweir 
794cdf0e10cSrcweir 	sal_uInt16 nCount = pDoc->FillRubyList( *rSh.GetCrsr(), aList, 0 );
795cdf0e10cSrcweir 	Sequence< Sequence< PropertyValue > > aRet(nCount);
796cdf0e10cSrcweir 	Sequence< PropertyValue >* pRet = aRet.getArray();
797cdf0e10cSrcweir 	String aString;
798cdf0e10cSrcweir 	for(sal_uInt16 n = 0; n < nCount; n++)
799cdf0e10cSrcweir 	{
800cdf0e10cSrcweir 		const SwRubyListEntryPtr pEntry = aList[n];
801cdf0e10cSrcweir 
802cdf0e10cSrcweir 		const String& rEntryText = pEntry->GetText();
803cdf0e10cSrcweir 		const SwFmtRuby& rAttr = pEntry->GetRubyAttr();
804cdf0e10cSrcweir 
805cdf0e10cSrcweir         pRet[n].realloc(5);
806cdf0e10cSrcweir 		PropertyValue* pValues = pRet[n].getArray();
807cdf0e10cSrcweir 		pValues[0].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_BASE_TEXT));
808cdf0e10cSrcweir 		pValues[0].Value <<= OUString(rEntryText);
809cdf0e10cSrcweir 		pValues[1].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_TEXT));
810cdf0e10cSrcweir 		pValues[1].Value <<= OUString(rAttr.GetText());
811cdf0e10cSrcweir 		pValues[2].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_CHAR_STYLE_NAME));
812cdf0e10cSrcweir 		SwStyleNameMapper::FillProgName(rAttr.GetCharFmtName(), aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
813cdf0e10cSrcweir 		pValues[2].Value <<= OUString( aString );
814cdf0e10cSrcweir 		pValues[3].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_ADJUST));
815cdf0e10cSrcweir 		pValues[3].Value <<= (sal_Int16)rAttr.GetAdjustment();
816cdf0e10cSrcweir         pValues[4].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_IS_ABOVE));
817cdf0e10cSrcweir         sal_Bool bVal = !rAttr.GetPosition();
818cdf0e10cSrcweir         pValues[4].Value.setValue(&bVal, ::getBooleanCppuType());
819cdf0e10cSrcweir     }
820cdf0e10cSrcweir 	return aRet;
821cdf0e10cSrcweir }
822cdf0e10cSrcweir /* -----------------------------30.01.01 15:02--------------------------------
823cdf0e10cSrcweir 
824cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
825cdf0e10cSrcweir void SAL_CALL SwXTextView::setRubyList(
826cdf0e10cSrcweir     const Sequence< Sequence< PropertyValue > >& rRubyList, sal_Bool /*bAutomatic*/ )
827cdf0e10cSrcweir 		throw(RuntimeException)
828cdf0e10cSrcweir {
829cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
830cdf0e10cSrcweir 
831cdf0e10cSrcweir     if(!GetView() || !rRubyList.getLength())
832cdf0e10cSrcweir 		throw RuntimeException();
833cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
834cdf0e10cSrcweir     ShellModes  eSelMode = m_pView->GetShellMode();
835cdf0e10cSrcweir 	if (eSelMode != SHELL_MODE_LIST_TEXT      &&
836cdf0e10cSrcweir 		eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
837cdf0e10cSrcweir         eSelMode != SHELL_MODE_TABLE_TEXT      &&
838cdf0e10cSrcweir         eSelMode != SHELL_MODE_TEXT           )
839cdf0e10cSrcweir 		throw RuntimeException();
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 	SwRubyList aList;
842cdf0e10cSrcweir 
843cdf0e10cSrcweir 	const Sequence<PropertyValue>* pRubyList = rRubyList.getConstArray();
844cdf0e10cSrcweir 	for(sal_Int32 nPos = 0; nPos < rRubyList.getLength(); nPos++)
845cdf0e10cSrcweir 	{
846cdf0e10cSrcweir 		SwRubyListEntryPtr pEntry = new SwRubyListEntry;
847cdf0e10cSrcweir 		const PropertyValue* pProperties = pRubyList[nPos].getConstArray();
848cdf0e10cSrcweir 		OUString sTmp;
849cdf0e10cSrcweir 		for(sal_Int32 nProp = 0; nProp < pRubyList[nPos].getLength(); nProp++)
850cdf0e10cSrcweir 		{
851cdf0e10cSrcweir 			if(pProperties[nProp].Name.equalsAsciiL(
852cdf0e10cSrcweir 									SW_PROP_NAME(UNO_NAME_RUBY_BASE_TEXT)))
853cdf0e10cSrcweir 			{
854cdf0e10cSrcweir 				pProperties[nProp].Value >>= sTmp;
855cdf0e10cSrcweir 				pEntry->SetText(sTmp);
856cdf0e10cSrcweir 			}
857cdf0e10cSrcweir 			else if(pProperties[nProp].Name.equalsAsciiL(
858cdf0e10cSrcweir 									SW_PROP_NAME(UNO_NAME_RUBY_TEXT)))
859cdf0e10cSrcweir 			{
860cdf0e10cSrcweir 				pProperties[nProp].Value >>= sTmp;
861cdf0e10cSrcweir 				pEntry->GetRubyAttr().SetText(sTmp);
862cdf0e10cSrcweir 			}
863cdf0e10cSrcweir 			else if(pProperties[nProp].Name.equalsAsciiL(
864cdf0e10cSrcweir 									SW_PROP_NAME(UNO_NAME_RUBY_CHAR_STYLE_NAME)))
865cdf0e10cSrcweir 			{
866cdf0e10cSrcweir 				if((pProperties[nProp].Value >>= sTmp))
867cdf0e10cSrcweir                 {
868cdf0e10cSrcweir 				    String sName;
869cdf0e10cSrcweir 					SwStyleNameMapper::FillUIName(sTmp, sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
870cdf0e10cSrcweir 				    sal_uInt16 nPoolId = sName.Len() ?
871cdf0e10cSrcweir                         SwStyleNameMapper::GetPoolIdFromUIName( sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) : 0;
872cdf0e10cSrcweir 
873cdf0e10cSrcweir 				    pEntry->GetRubyAttr().SetCharFmtName( sName );
874cdf0e10cSrcweir 				    pEntry->GetRubyAttr().SetCharFmtId( nPoolId );
875cdf0e10cSrcweir                 }
876cdf0e10cSrcweir 			}
877cdf0e10cSrcweir 			else if(pProperties[nProp].Name.equalsAsciiL(
878cdf0e10cSrcweir 									SW_PROP_NAME(UNO_NAME_RUBY_ADJUST)))
879cdf0e10cSrcweir 			{
880cdf0e10cSrcweir 				sal_Int16 nTmp = 0;
881cdf0e10cSrcweir 				if((pProperties[nProp].Value >>= nTmp))
882cdf0e10cSrcweir 				    pEntry->GetRubyAttr().SetAdjustment(nTmp);
883cdf0e10cSrcweir 			}
884cdf0e10cSrcweir 			else if(pProperties[nProp].Name.equalsAsciiL(
885cdf0e10cSrcweir 									SW_PROP_NAME(UNO_NAME_RUBY_IS_ABOVE)))
886cdf0e10cSrcweir 			{
887cdf0e10cSrcweir 				sal_Bool bValue = pProperties[nProp].Value.hasValue() ?
888cdf0e10cSrcweir                     *(sal_Bool*)pProperties[nProp].Value.getValue() : sal_True;
889cdf0e10cSrcweir 				pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
890cdf0e10cSrcweir 			}
891cdf0e10cSrcweir 		}
892cdf0e10cSrcweir 		aList.Insert(pEntry, (sal_uInt16)nPos);
893cdf0e10cSrcweir 	}
894cdf0e10cSrcweir     SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
895cdf0e10cSrcweir 	pDoc->SetRubyList( *rSh.GetCrsr(), aList, 0 );
896cdf0e10cSrcweir }
897cdf0e10cSrcweir /*-- 29.12.02 15:45:29---------------------------------------------------
898cdf0e10cSrcweir 
899cdf0e10cSrcweir   -----------------------------------------------------------------------*/
900cdf0e10cSrcweir SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
901cdf0e10cSrcweir {
902cdf0e10cSrcweir     SwWrtShell& rOldSh = m_pView->GetWrtShell();
903cdf0e10cSrcweir     SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false );
904cdf0e10cSrcweir     SwDocShell* pDocSh;
905cdf0e10cSrcweir     SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
906cdf0e10cSrcweir     xDocSh->DoInitNew( 0 );
907cdf0e10cSrcweir     SwDoc *const pTempDoc( pDocSh->GetDoc() );
908cdf0e10cSrcweir     // #i103634#, #i112425#: do not expand numbering and fields on PDF export
909cdf0e10cSrcweir     pTempDoc->SetClipBoard(true);
910cdf0e10cSrcweir     rOldSh.FillPrtDoc(pTempDoc,  pPrt);
911cdf0e10cSrcweir     SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
912cdf0e10cSrcweir     SwView* pDocView = (SwView*) pDocFrame->GetViewShell();
913cdf0e10cSrcweir     pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird.
914cdf0e10cSrcweir     SwWrtShell* pSh = pDocView->GetWrtShellPtr();
915cdf0e10cSrcweir 
916cdf0e10cSrcweir     IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
917cdf0e10cSrcweir     SfxPrinter* pTempPrinter = pIDDA->getPrinter( true );
918cdf0e10cSrcweir 
919cdf0e10cSrcweir     const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
920cdf0e10cSrcweir 
921cdf0e10cSrcweir     IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess();
922cdf0e10cSrcweir 
923cdf0e10cSrcweir     if( pIDDA_old->getPrinter( false ) )
924cdf0e10cSrcweir     {
925cdf0e10cSrcweir         pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
926cdf0e10cSrcweir         //#69563# if it isn't the same printer then the pointer has been invalidated!
927cdf0e10cSrcweir         pTempPrinter = pIDDA->getPrinter( true );
928cdf0e10cSrcweir     }
929cdf0e10cSrcweir 
930cdf0e10cSrcweir     pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
931cdf0e10cSrcweir 
932cdf0e10cSrcweir     return xDocSh;
933cdf0e10cSrcweir }
934cdf0e10cSrcweir 
935cdf0e10cSrcweir /*-- 17.12.98 09:34:29---------------------------------------------------
936cdf0e10cSrcweir 
937cdf0e10cSrcweir   -----------------------------------------------------------------------*/
938cdf0e10cSrcweir void SwXTextView::NotifySelChanged()
939cdf0e10cSrcweir {
940cdf0e10cSrcweir     DBG_ASSERT( m_pView, "view is missing" );
941cdf0e10cSrcweir 
942cdf0e10cSrcweir     // destroy temporary document with selected text that is used
943cdf0e10cSrcweir     // in PDF export of (multi-)selections.
944cdf0e10cSrcweir     if (m_pView && m_pView->GetTmpSelectionDoc().Is())
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir         m_pView->GetTmpSelectionDoc()->DoClose();
947cdf0e10cSrcweir         m_pView->GetTmpSelectionDoc() = 0;
948cdf0e10cSrcweir     }
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 	uno::Reference< uno::XInterface >  xInt = (cppu::OWeakObject*)(SfxBaseController*)this;
951cdf0e10cSrcweir 
952cdf0e10cSrcweir  	lang::EventObject aEvent(xInt);
953cdf0e10cSrcweir 
954cdf0e10cSrcweir 	sal_uInt16 nCount = aSelChangedListeners.Count();
955cdf0e10cSrcweir 	for ( sal_uInt16 i = nCount; i--; )
956cdf0e10cSrcweir 	{
957cdf0e10cSrcweir 		uno::Reference< view::XSelectionChangeListener >  *pObj = aSelChangedListeners[i];
958cdf0e10cSrcweir 		(*pObj)->selectionChanged(aEvent);
959cdf0e10cSrcweir 	}
960cdf0e10cSrcweir }
961cdf0e10cSrcweir /* -----------------------------12.07.01 13:26--------------------------------
962cdf0e10cSrcweir 
963cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
964cdf0e10cSrcweir void SwXTextView::NotifyDBChanged()
965cdf0e10cSrcweir {
966cdf0e10cSrcweir     URL aURL;
967cdf0e10cSrcweir     aURL.Complete = C2U(SwXDispatch::GetDBChangeURL());
968cdf0e10cSrcweir 
969cdf0e10cSrcweir     sal_uInt16 nCount = aSelChangedListeners.Count();
970cdf0e10cSrcweir 	for ( sal_uInt16 i = nCount; i--; )
971cdf0e10cSrcweir 	{
972cdf0e10cSrcweir 		uno::Reference< view::XSelectionChangeListener >  *pObj = aSelChangedListeners[i];
973cdf0e10cSrcweir         uno::Reference<XDispatch> xDispatch((*pObj), UNO_QUERY);
974cdf0e10cSrcweir         if(xDispatch.is())
975cdf0e10cSrcweir             xDispatch->dispatch(aURL, Sequence<PropertyValue>(0));
976cdf0e10cSrcweir     }
977cdf0e10cSrcweir }
978cdf0e10cSrcweir 
979cdf0e10cSrcweir /* -----------------------------10.12.04 11:07--------------------------------
980cdf0e10cSrcweir 
981cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
982cdf0e10cSrcweir 
983cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo(  )
984cdf0e10cSrcweir     throw (uno::RuntimeException)
985cdf0e10cSrcweir {
986cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
987cdf0e10cSrcweir     static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
988cdf0e10cSrcweir     return aRef;
989cdf0e10cSrcweir }
990cdf0e10cSrcweir 
991cdf0e10cSrcweir 
992cdf0e10cSrcweir void SAL_CALL SwXTextView::setPropertyValue(
993cdf0e10cSrcweir         const OUString& rPropertyName, const uno::Any& rValue )
994cdf0e10cSrcweir     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
995cdf0e10cSrcweir {
996cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
997cdf0e10cSrcweir     const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
998cdf0e10cSrcweir     if (!pEntry)
999cdf0e10cSrcweir         throw UnknownPropertyException();
1000cdf0e10cSrcweir     else if (pEntry->nFlags & PropertyAttribute::READONLY)
1001cdf0e10cSrcweir         throw PropertyVetoException();
1002cdf0e10cSrcweir     else
1003cdf0e10cSrcweir     {
1004cdf0e10cSrcweir         switch (pEntry->nWID)
1005cdf0e10cSrcweir         {
1006cdf0e10cSrcweir             case WID_IS_HIDE_SPELL_MARKS :
1007cdf0e10cSrcweir                 // deprecated #i91949
1008cdf0e10cSrcweir             break;
1009cdf0e10cSrcweir             case WID_IS_CONSTANT_SPELLCHECK :
1010cdf0e10cSrcweir             {
1011cdf0e10cSrcweir                 sal_Bool bVal = sal_False;
1012cdf0e10cSrcweir                 const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
1013cdf0e10cSrcweir                 if (!pOpt || !(rValue >>= bVal))
1014cdf0e10cSrcweir                     throw RuntimeException();
1015cdf0e10cSrcweir                 SwViewOption aNewOpt( *pOpt );
1016cdf0e10cSrcweir                 if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK)
1017cdf0e10cSrcweir                     aNewOpt.SetOnlineSpell(bVal);
1018cdf0e10cSrcweir                 m_pView->GetWrtShell().ApplyViewOptions( aNewOpt );
1019cdf0e10cSrcweir             }
1020cdf0e10cSrcweir             break;
1021cdf0e10cSrcweir             default :
1022cdf0e10cSrcweir                 DBG_ERROR("unknown WID");
1023cdf0e10cSrcweir         }
1024cdf0e10cSrcweir     }
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir uno::Any SAL_CALL SwXTextView::getPropertyValue(
1029cdf0e10cSrcweir         const OUString& rPropertyName )
1030cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     Any aRet;
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir     const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
1037cdf0e10cSrcweir     if (!pEntry)
1038cdf0e10cSrcweir         throw UnknownPropertyException();
1039cdf0e10cSrcweir     else
1040cdf0e10cSrcweir     {
1041cdf0e10cSrcweir         sal_Int16 nWID = pEntry->nWID;
1042cdf0e10cSrcweir         switch (nWID)
1043cdf0e10cSrcweir         {
1044cdf0e10cSrcweir             case WID_PAGE_COUNT :
1045cdf0e10cSrcweir             case WID_LINE_COUNT :
1046cdf0e10cSrcweir             {
1047cdf0e10cSrcweir                 // format document completely in order to get meaningful
1048cdf0e10cSrcweir                 // values for page count and line count
1049cdf0e10cSrcweir                 m_pView->GetWrtShell().CalcLayout();
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir                 sal_Int32 nCount = -1;
1052cdf0e10cSrcweir                 if (nWID == WID_PAGE_COUNT)
1053cdf0e10cSrcweir                     nCount = m_pView->GetWrtShell().GetPageCount();
1054cdf0e10cSrcweir                 else // WID_LINE_COUNT
1055cdf0e10cSrcweir                     nCount = m_pView->GetWrtShell().GetLineCount( sal_False /*of whole document*/ );
1056cdf0e10cSrcweir                 aRet <<= nCount;
1057cdf0e10cSrcweir             }
1058cdf0e10cSrcweir             break;
1059cdf0e10cSrcweir             case WID_IS_HIDE_SPELL_MARKS :
1060cdf0e10cSrcweir                 // deprecated #i91949
1061cdf0e10cSrcweir             break;
1062cdf0e10cSrcweir             case WID_IS_CONSTANT_SPELLCHECK :
1063cdf0e10cSrcweir             {
1064cdf0e10cSrcweir                 const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
1065cdf0e10cSrcweir                 if (!pOpt)
1066cdf0e10cSrcweir                     throw RuntimeException();
1067cdf0e10cSrcweir                 sal_uInt32 nFlag = VIEWOPT_1_ONLINESPELL;
1068cdf0e10cSrcweir                 sal_Bool bVal = 0 != (pOpt->GetCoreOptions() & nFlag);
1069cdf0e10cSrcweir                 aRet <<= bVal;
1070cdf0e10cSrcweir             }
1071cdf0e10cSrcweir             break;
1072cdf0e10cSrcweir             default :
1073cdf0e10cSrcweir                 DBG_ERROR("unknown WID");
1074cdf0e10cSrcweir         }
1075cdf0e10cSrcweir     }
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir     return aRet;
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir void SAL_CALL SwXTextView::addPropertyChangeListener(
1082cdf0e10cSrcweir         const OUString& /*rPropertyName*/,
1083cdf0e10cSrcweir         const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
1084cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir     DBG_WARNING("not implemented");
1087cdf0e10cSrcweir }
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir void SAL_CALL SwXTextView::removePropertyChangeListener(
1091cdf0e10cSrcweir         const OUString& /*rPropertyName*/,
1092cdf0e10cSrcweir         const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
1093cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1094cdf0e10cSrcweir {
1095cdf0e10cSrcweir     DBG_WARNING("not implemented");
1096cdf0e10cSrcweir }
1097cdf0e10cSrcweir 
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir void SAL_CALL SwXTextView::addVetoableChangeListener(
1100cdf0e10cSrcweir         const OUString& /*rPropertyName*/,
1101cdf0e10cSrcweir         const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
1102cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir     DBG_WARNING("not implemented");
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir void SAL_CALL SwXTextView::removeVetoableChangeListener(
1109cdf0e10cSrcweir         const OUString& /*rPropertyName*/,
1110cdf0e10cSrcweir         const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
1111cdf0e10cSrcweir     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir     DBG_WARNING("not implemented");
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1119cdf0e10cSrcweir OUString SwXTextView::getImplementationName(void) throw( RuntimeException )
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir 	return C2U("SwXTextView");
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1126cdf0e10cSrcweir sal_Bool SwXTextView::supportsService(const OUString& rServiceName) throw( RuntimeException )
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir     return rServiceName.equalsAscii("com.sun.star.text.TextDocumentView") ||
1129cdf0e10cSrcweir             rServiceName.equalsAscii("com.sun.star.view.OfficeDocumentView");
1130cdf0e10cSrcweir }
1131cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1134cdf0e10cSrcweir Sequence< OUString > SwXTextView::getSupportedServiceNames(void) throw( RuntimeException )
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir     Sequence< OUString > aRet(2);
1137cdf0e10cSrcweir 	OUString* pArray = aRet.getArray();
1138cdf0e10cSrcweir     pArray[0] = C2U("com.sun.star.text.TextDocumentView");
1139cdf0e10cSrcweir     pArray[1] = C2U("com.sun.star.view.OfficeDocumentView");
1140cdf0e10cSrcweir 	return aRet;
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir 
1143cdf0e10cSrcweir /******************************************************************
1144cdf0e10cSrcweir  * SwXTextViewCursor
1145cdf0e10cSrcweir  ******************************************************************/
1146cdf0e10cSrcweir /*-- 17.12.98 09:36:23---------------------------------------------------
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1149cdf0e10cSrcweir SwXTextViewCursor::SwXTextViewCursor(SwView* pVw) :
1150cdf0e10cSrcweir     m_pView(pVw),
1151cdf0e10cSrcweir     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir /*-- 17.12.98 09:36:24---------------------------------------------------
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1157cdf0e10cSrcweir SwXTextViewCursor::~SwXTextViewCursor()
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir /*-- 06.10.04 09:36:25---------------------------------------------------
1161cdf0e10cSrcweir 
1162cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir // used to determine if there is a text selction or not.
1165cdf0e10cSrcweir // If there is no text selection the functions that need a working
1166cdf0e10cSrcweir // cursor will be disabled (throw RuntimeException). This will be the case
1167cdf0e10cSrcweir // for the following interfaces:
1168cdf0e10cSrcweir // - XViewCursor
1169cdf0e10cSrcweir // - XTextCursor
1170cdf0e10cSrcweir // - XTextRange
1171cdf0e10cSrcweir // - XLineCursor
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir sal_Bool SwXTextViewCursor::IsTextSelection( sal_Bool bAllowTables ) const
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir 
1176cdf0e10cSrcweir     sal_Bool bRes = sal_False;
1177cdf0e10cSrcweir     DBG_ASSERT(m_pView, "m_pView is NULL ???");
1178cdf0e10cSrcweir     if(m_pView)
1179cdf0e10cSrcweir 	{
1180cdf0e10cSrcweir         //! m_pView->GetShellMode() will only work after the shell
1181cdf0e10cSrcweir 		//! has already changed and thus can not be used here!
1182cdf0e10cSrcweir         SelectionType eSelType = m_pView->GetWrtShell().GetSelectionType();
1183cdf0e10cSrcweir 		bRes =  ( (nsSelectionType::SEL_TXT & eSelType) ||
1184cdf0e10cSrcweir                   (nsSelectionType::SEL_NUM & eSelType) )  &&
1185cdf0e10cSrcweir 				(!(nsSelectionType::SEL_TBL_CELLS & eSelType) || bAllowTables);
1186cdf0e10cSrcweir     }
1187cdf0e10cSrcweir     return bRes;
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir /*-- 17.12.98 09:36:25---------------------------------------------------
1191cdf0e10cSrcweir 
1192cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1193cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isVisible(void) throw( uno::RuntimeException )
1194cdf0e10cSrcweir {
1195cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1196cdf0e10cSrcweir 	DBG_WARNING("not implemented");
1197cdf0e10cSrcweir 	return sal_True;
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir /*-- 17.12.98 09:36:25---------------------------------------------------
1200cdf0e10cSrcweir 
1201cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1202cdf0e10cSrcweir void SwXTextViewCursor::setVisible(sal_Bool /*bVisible*/) throw( uno::RuntimeException )
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1205cdf0e10cSrcweir 	DBG_WARNING("not implemented");
1206cdf0e10cSrcweir }
1207cdf0e10cSrcweir /*-- 17.12.98 09:36:26---------------------------------------------------
1208cdf0e10cSrcweir 
1209cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1210cdf0e10cSrcweir awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException )
1211cdf0e10cSrcweir {
1212cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1213cdf0e10cSrcweir 	awt::Point aRet;
1214cdf0e10cSrcweir     if(m_pView)
1215cdf0e10cSrcweir 	{
1216cdf0e10cSrcweir         const SwWrtShell& rSh = m_pView->GetWrtShell();
1217cdf0e10cSrcweir 		const SwRect aCharRect(rSh.GetCharRect());
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir         const SwFrmFmt& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster();
1220cdf0e10cSrcweir 
1221cdf0e10cSrcweir         const SvxULSpaceItem& rUL = rMaster.GetULSpace();
1222cdf0e10cSrcweir 		const long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER);
1223cdf0e10cSrcweir 		aRet.Y = TWIP_TO_MM100(nY);
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir         const SvxLRSpaceItem& rLR = rMaster.GetLRSpace();
1226cdf0e10cSrcweir 		const long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER);
1227cdf0e10cSrcweir 		aRet.X = TWIP_TO_MM100(nX);
1228cdf0e10cSrcweir 	}
1229cdf0e10cSrcweir 	else
1230cdf0e10cSrcweir 		throw uno::RuntimeException();
1231cdf0e10cSrcweir 	return aRet;
1232cdf0e10cSrcweir }
1233cdf0e10cSrcweir /*-- 17.12.98 09:36:26---------------------------------------------------
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1236cdf0e10cSrcweir void SwXTextViewCursor::collapseToStart(void) throw( uno::RuntimeException )
1237cdf0e10cSrcweir {
1238cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1239cdf0e10cSrcweir     if(m_pView)
1240cdf0e10cSrcweir 	{
1241cdf0e10cSrcweir         if (!IsTextSelection())
1242cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1245cdf0e10cSrcweir 		if(rSh.HasSelection())
1246cdf0e10cSrcweir 		{
1247cdf0e10cSrcweir 			SwPaM* pShellCrsr = rSh.GetCrsr();
1248cdf0e10cSrcweir 			if(*pShellCrsr->GetPoint() > *pShellCrsr->GetMark())
1249cdf0e10cSrcweir 				pShellCrsr->Exchange();
1250cdf0e10cSrcweir 			pShellCrsr->DeleteMark();
1251cdf0e10cSrcweir 			rSh.EnterStdMode();
1252cdf0e10cSrcweir 			rSh.SetSelection(*pShellCrsr);
1253cdf0e10cSrcweir 		}
1254cdf0e10cSrcweir 	}
1255cdf0e10cSrcweir 	else
1256cdf0e10cSrcweir 		throw uno::RuntimeException();
1257cdf0e10cSrcweir }
1258cdf0e10cSrcweir /*-- 17.12.98 09:36:26---------------------------------------------------
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1261cdf0e10cSrcweir void SwXTextViewCursor::collapseToEnd(void) throw( uno::RuntimeException )
1262cdf0e10cSrcweir {
1263cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1264cdf0e10cSrcweir     if(m_pView)
1265cdf0e10cSrcweir 	{
1266cdf0e10cSrcweir         if (!IsTextSelection())
1267cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1270cdf0e10cSrcweir 		if(rSh.HasSelection())
1271cdf0e10cSrcweir 		{
1272cdf0e10cSrcweir 			SwPaM* pShellCrsr = rSh.GetCrsr();
1273cdf0e10cSrcweir 			if(*pShellCrsr->GetPoint() < *pShellCrsr->GetMark())
1274cdf0e10cSrcweir 				pShellCrsr->Exchange();
1275cdf0e10cSrcweir 			pShellCrsr->DeleteMark();
1276cdf0e10cSrcweir 			rSh.EnterStdMode();
1277cdf0e10cSrcweir 			rSh.SetSelection(*pShellCrsr);
1278cdf0e10cSrcweir 		}
1279cdf0e10cSrcweir 	}
1280cdf0e10cSrcweir 	else
1281cdf0e10cSrcweir 		throw uno::RuntimeException();
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir /*-- 17.12.98 09:36:27---------------------------------------------------
1284cdf0e10cSrcweir 
1285cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1286cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isCollapsed(void) throw( uno::RuntimeException )
1287cdf0e10cSrcweir {
1288cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1289cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1290cdf0e10cSrcweir     if(m_pView)
1291cdf0e10cSrcweir 	{
1292cdf0e10cSrcweir         if (!IsTextSelection())
1293cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1294cdf0e10cSrcweir 
1295cdf0e10cSrcweir         const SwWrtShell& rSh = m_pView->GetWrtShell();
1296cdf0e10cSrcweir         bRet = !rSh.HasSelection();
1297cdf0e10cSrcweir 	}
1298cdf0e10cSrcweir 	else
1299cdf0e10cSrcweir 		throw uno::RuntimeException();
1300cdf0e10cSrcweir 	return bRet;
1301cdf0e10cSrcweir 
1302cdf0e10cSrcweir }
1303cdf0e10cSrcweir /*-- 17.12.98 09:36:27---------------------------------------------------
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1306cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
1307cdf0e10cSrcweir {
1308cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1309cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1310cdf0e10cSrcweir     if(m_pView)
1311cdf0e10cSrcweir 	{
1312cdf0e10cSrcweir         if (!IsTextSelection())
1313cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nCount; i++ )
1316cdf0e10cSrcweir             bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, sal_True );
1317cdf0e10cSrcweir 	}
1318cdf0e10cSrcweir 	else
1319cdf0e10cSrcweir 		throw uno::RuntimeException();
1320cdf0e10cSrcweir 	return bRet;
1321cdf0e10cSrcweir }
1322cdf0e10cSrcweir /*-- 17.12.98 09:36:27---------------------------------------------------
1323cdf0e10cSrcweir 
1324cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1325cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
1326cdf0e10cSrcweir {
1327cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1328cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1329cdf0e10cSrcweir     if(m_pView)
1330cdf0e10cSrcweir 	{
1331cdf0e10cSrcweir         if (!IsTextSelection())
1332cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nCount; i++ )
1335cdf0e10cSrcweir             bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, sal_True );
1336cdf0e10cSrcweir 	}
1337cdf0e10cSrcweir 	else
1338cdf0e10cSrcweir 		throw uno::RuntimeException();
1339cdf0e10cSrcweir 	return bRet;
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir /* -----------------08.03.99 11:18-------------------
1343cdf0e10cSrcweir  *
1344cdf0e10cSrcweir  * --------------------------------------------------*/
1345cdf0e10cSrcweir void SwXTextViewCursor::gotoRange(
1346cdf0e10cSrcweir 	const uno::Reference< text::XTextRange > & xRange,
1347cdf0e10cSrcweir 	sal_Bool bExpand)
1348cdf0e10cSrcweir 		throw(RuntimeException)
1349cdf0e10cSrcweir {
1350cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1351cdf0e10cSrcweir     if(m_pView && xRange.is())
1352cdf0e10cSrcweir 	{
1353cdf0e10cSrcweir         if (!IsTextSelection())
1354cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir         SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
1357cdf0e10cSrcweir         if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
1358cdf0e10cSrcweir         {
1359cdf0e10cSrcweir             throw uno::RuntimeException();
1360cdf0e10cSrcweir         }
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir         ShellModes  eSelMode = m_pView->GetShellMode();
1363cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1364cdf0e10cSrcweir 		// call EnterStdMode in non-text selections only
1365cdf0e10cSrcweir 		if(!bExpand ||
1366cdf0e10cSrcweir 		   (eSelMode != SHELL_MODE_TABLE_TEXT &&
1367cdf0e10cSrcweir 			eSelMode != SHELL_MODE_LIST_TEXT &&
1368cdf0e10cSrcweir 			eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
1369cdf0e10cSrcweir 			eSelMode != SHELL_MODE_TEXT ))
1370cdf0e10cSrcweir 				rSh.EnterStdMode();
1371cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1372cdf0e10cSrcweir 		SwPaM aOwnPaM(*pShellCrsr->GetPoint());
1373cdf0e10cSrcweir 		if(pShellCrsr->HasMark())
1374cdf0e10cSrcweir 		{
1375cdf0e10cSrcweir 			aOwnPaM.SetMark();
1376cdf0e10cSrcweir 			*aOwnPaM.GetMark() = *pShellCrsr->GetMark();
1377cdf0e10cSrcweir 		}
1378cdf0e10cSrcweir 
1379cdf0e10cSrcweir 		uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
1380cdf0e10cSrcweir 		SwXTextRange* pRange = 0;
1381cdf0e10cSrcweir         SwXParagraph* pPara = 0;
1382cdf0e10cSrcweir         OTextCursorHelper* pCursor = 0;
1383cdf0e10cSrcweir 		if(xRangeTunnel.is())
1384cdf0e10cSrcweir 		{
1385cdf0e10cSrcweir             pRange = reinterpret_cast<SwXTextRange*>(xRangeTunnel->getSomething(
1386cdf0e10cSrcweir                                     SwXTextRange::getUnoTunnelId()));
1387cdf0e10cSrcweir             pCursor = reinterpret_cast<OTextCursorHelper*>(xRangeTunnel->getSomething(
1388cdf0e10cSrcweir                                     OTextCursorHelper::getUnoTunnelId()));
1389cdf0e10cSrcweir             pPara = reinterpret_cast<SwXParagraph*>(xRangeTunnel->getSomething(
1390cdf0e10cSrcweir                                     SwXParagraph::getUnoTunnelId()));
1391cdf0e10cSrcweir 		}
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir         const sal_uInt16 nFrmType = rSh.GetFrmType(0,sal_True);
1394cdf0e10cSrcweir 
1395cdf0e10cSrcweir 		SwStartNodeType eSearchNodeType = SwNormalStartNode;
1396cdf0e10cSrcweir 		if(nFrmType & FRMTYPE_FLY_ANY)
1397cdf0e10cSrcweir 			eSearchNodeType = SwFlyStartNode;
1398cdf0e10cSrcweir 		else if(nFrmType &FRMTYPE_HEADER)
1399cdf0e10cSrcweir 			eSearchNodeType = SwHeaderStartNode;
1400cdf0e10cSrcweir 		else if(nFrmType & FRMTYPE_FOOTER)
1401cdf0e10cSrcweir 			eSearchNodeType = SwFooterStartNode;
1402cdf0e10cSrcweir 		else if(nFrmType & FRMTYPE_TABLE)
1403cdf0e10cSrcweir 			eSearchNodeType = SwTableBoxStartNode;
1404cdf0e10cSrcweir 		else if(nFrmType & FRMTYPE_FOOTNOTE)
1405cdf0e10cSrcweir 			eSearchNodeType = SwFootnoteStartNode;
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir 		const SwStartNode* pOwnStartNode = aOwnPaM.GetNode()->
1408cdf0e10cSrcweir 												FindSttNodeByType(eSearchNodeType);
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir 		const SwNode* pSrcNode = 0;
1411cdf0e10cSrcweir         if(pCursor && pCursor->GetPaM())
1412cdf0e10cSrcweir         {
1413cdf0e10cSrcweir             pSrcNode = pCursor->GetPaM()->GetNode();
1414cdf0e10cSrcweir         }
1415cdf0e10cSrcweir         else if (pRange)
1416cdf0e10cSrcweir         {
1417cdf0e10cSrcweir             SwPaM aPam(pRange->GetDoc()->GetNodes());
1418cdf0e10cSrcweir             if (pRange->GetPositions(aPam))
1419cdf0e10cSrcweir             {
1420cdf0e10cSrcweir                 pSrcNode = aPam.GetNode();
1421cdf0e10cSrcweir             }
1422cdf0e10cSrcweir         }
1423cdf0e10cSrcweir         else if (pPara && pPara->GetTxtNode())
1424cdf0e10cSrcweir         {
1425cdf0e10cSrcweir             pSrcNode = pPara->GetTxtNode();
1426cdf0e10cSrcweir         }
1427cdf0e10cSrcweir         const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0;
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir         //SectionNodes ueberspringen
1430cdf0e10cSrcweir 		while(pTmp && pTmp->IsSectionNode())
1431cdf0e10cSrcweir 		{
1432cdf0e10cSrcweir             pTmp = pTmp->StartOfSectionNode();
1433cdf0e10cSrcweir 		}
1434cdf0e10cSrcweir         while(pOwnStartNode && pOwnStartNode->IsSectionNode())
1435cdf0e10cSrcweir         {
1436cdf0e10cSrcweir             pOwnStartNode = pOwnStartNode->StartOfSectionNode();
1437cdf0e10cSrcweir         }
1438cdf0e10cSrcweir 		//ohne Expand darf mit dem ViewCursor ueberall hingesprungen werden
1439cdf0e10cSrcweir 		//mit Expand nur in der gleichen Umgebung
1440cdf0e10cSrcweir 		if(bExpand &&
1441cdf0e10cSrcweir 			(pOwnStartNode != pTmp ||
1442cdf0e10cSrcweir 			(eSelMode != SHELL_MODE_TABLE_TEXT &&
1443cdf0e10cSrcweir 				eSelMode != SHELL_MODE_LIST_TEXT &&
1444cdf0e10cSrcweir 				eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
1445cdf0e10cSrcweir 				eSelMode != SHELL_MODE_TEXT)))
1446cdf0e10cSrcweir 			throw uno::RuntimeException();
1447cdf0e10cSrcweir 
1448cdf0e10cSrcweir 		//jetzt muss die Selektion erweitert werden
1449cdf0e10cSrcweir 		if(bExpand)
1450cdf0e10cSrcweir 		{
1451cdf0e10cSrcweir 			// der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen
1452cdf0e10cSrcweir 			// Range eingeschlossen wurde
1453cdf0e10cSrcweir             SwPosition aOwnLeft(*aOwnPaM.Start());
1454cdf0e10cSrcweir             SwPosition aOwnRight(*aOwnPaM.End());
1455cdf0e10cSrcweir             SwPosition* pParamLeft = rDestPam.Start();
1456cdf0e10cSrcweir             SwPosition* pParamRight = rDestPam.End();
1457cdf0e10cSrcweir             // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche?
1458cdf0e10cSrcweir 			if(aOwnRight > *pParamRight)
1459cdf0e10cSrcweir 				*aOwnPaM.GetPoint() = aOwnRight;
1460cdf0e10cSrcweir 			else
1461cdf0e10cSrcweir 				*aOwnPaM.GetPoint() = *pParamRight;
1462cdf0e10cSrcweir 			aOwnPaM.SetMark();
1463cdf0e10cSrcweir 			if(aOwnLeft < *pParamLeft)
1464cdf0e10cSrcweir 				*aOwnPaM.GetMark() = aOwnLeft;
1465cdf0e10cSrcweir 			else
1466cdf0e10cSrcweir 				*aOwnPaM.GetMark() = *pParamLeft;
1467cdf0e10cSrcweir 		}
1468cdf0e10cSrcweir 		else
1469cdf0e10cSrcweir 		{
1470cdf0e10cSrcweir 			//der Cursor soll dem uebergebenen Range entsprechen
1471cdf0e10cSrcweir             *aOwnPaM.GetPoint() = *rDestPam.GetPoint();
1472cdf0e10cSrcweir             if(rDestPam.HasMark())
1473cdf0e10cSrcweir             {
1474cdf0e10cSrcweir                 aOwnPaM.SetMark();
1475cdf0e10cSrcweir                 *aOwnPaM.GetMark() = *rDestPam.GetMark();
1476cdf0e10cSrcweir             }
1477cdf0e10cSrcweir             else
1478cdf0e10cSrcweir                 aOwnPaM.DeleteMark();
1479cdf0e10cSrcweir         }
1480cdf0e10cSrcweir 		rSh.SetSelection(aOwnPaM);
1481cdf0e10cSrcweir 	}
1482cdf0e10cSrcweir 	else
1483cdf0e10cSrcweir 		throw uno::RuntimeException();
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir /*-- 17.12.98 09:36:28---------------------------------------------------
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1489cdf0e10cSrcweir void SwXTextViewCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException )
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1492cdf0e10cSrcweir     if(m_pView)
1493cdf0e10cSrcweir     {
1494cdf0e10cSrcweir         if (!IsTextSelection())
1495cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir         m_pView->GetWrtShell().SttDoc( bExpand );
1498cdf0e10cSrcweir     }
1499cdf0e10cSrcweir 	else
1500cdf0e10cSrcweir 		throw uno::RuntimeException();
1501cdf0e10cSrcweir }
1502cdf0e10cSrcweir /*-- 17.12.98 09:36:28---------------------------------------------------
1503cdf0e10cSrcweir 
1504cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1505cdf0e10cSrcweir void SwXTextViewCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException )
1506cdf0e10cSrcweir {
1507cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1508cdf0e10cSrcweir     if(m_pView)
1509cdf0e10cSrcweir     {
1510cdf0e10cSrcweir         if (!IsTextSelection())
1511cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir         m_pView->GetWrtShell().EndDoc( bExpand );
1514cdf0e10cSrcweir     }
1515cdf0e10cSrcweir 	else
1516cdf0e10cSrcweir 		throw uno::RuntimeException();
1517cdf0e10cSrcweir }
1518cdf0e10cSrcweir /*-- 17.12.98 09:36:28---------------------------------------------------
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1521cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToFirstPage(void) throw( uno::RuntimeException )
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1524cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1525cdf0e10cSrcweir     if(m_pView)
1526cdf0e10cSrcweir     {
1527cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1528cdf0e10cSrcweir         if (rSh.IsSelFrmMode())
1529cdf0e10cSrcweir         {
1530cdf0e10cSrcweir             rSh.UnSelectFrm();
1531cdf0e10cSrcweir             rSh.LeaveSelFrmMode();
1532cdf0e10cSrcweir         }
1533cdf0e10cSrcweir         rSh.EnterStdMode();
1534cdf0e10cSrcweir         bRet = rSh.SttEndDoc(sal_True);
1535cdf0e10cSrcweir     }
1536cdf0e10cSrcweir 	else
1537cdf0e10cSrcweir 		throw uno::RuntimeException();
1538cdf0e10cSrcweir 	return bRet;
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir /*-- 17.12.98 09:36:29---------------------------------------------------
1541cdf0e10cSrcweir 
1542cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1543cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToLastPage(void) throw( uno::RuntimeException )
1544cdf0e10cSrcweir {
1545cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1546cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1547cdf0e10cSrcweir     if(m_pView)
1548cdf0e10cSrcweir 	{
1549cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1550cdf0e10cSrcweir         if (rSh.IsSelFrmMode())
1551cdf0e10cSrcweir         {
1552cdf0e10cSrcweir             rSh.UnSelectFrm();
1553cdf0e10cSrcweir             rSh.LeaveSelFrmMode();
1554cdf0e10cSrcweir         }
1555cdf0e10cSrcweir         rSh.EnterStdMode();
1556cdf0e10cSrcweir         bRet = rSh.SttEndDoc(sal_False);
1557cdf0e10cSrcweir 		rSh.SttPg();
1558cdf0e10cSrcweir 	}
1559cdf0e10cSrcweir 	else
1560cdf0e10cSrcweir 		throw uno::RuntimeException();
1561cdf0e10cSrcweir 	return bRet;
1562cdf0e10cSrcweir }
1563cdf0e10cSrcweir /*-- 17.12.98 09:36:30---------------------------------------------------
1564cdf0e10cSrcweir 
1565cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1566cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToPage(sal_Int16 nPage) throw( uno::RuntimeException )
1567cdf0e10cSrcweir {
1568cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1569cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1570cdf0e10cSrcweir     if(m_pView)
1571cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().GotoPage(nPage, sal_True);
1572cdf0e10cSrcweir 	else
1573cdf0e10cSrcweir 		throw uno::RuntimeException();
1574cdf0e10cSrcweir 	return bRet;
1575cdf0e10cSrcweir }
1576cdf0e10cSrcweir /*-- 17.12.98 09:36:30---------------------------------------------------
1577cdf0e10cSrcweir 
1578cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1579cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToNextPage(void) throw( uno::RuntimeException )
1580cdf0e10cSrcweir {
1581cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1582cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1583cdf0e10cSrcweir     if(m_pView)
1584cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().SttNxtPg();
1585cdf0e10cSrcweir 	else
1586cdf0e10cSrcweir 		throw uno::RuntimeException();
1587cdf0e10cSrcweir 	return bRet;
1588cdf0e10cSrcweir }
1589cdf0e10cSrcweir /*-- 17.12.98 09:36:31---------------------------------------------------
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1592cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToPreviousPage(void) throw( uno::RuntimeException )
1593cdf0e10cSrcweir {
1594cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1595cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1596cdf0e10cSrcweir     if(m_pView)
1597cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().EndPrvPg();
1598cdf0e10cSrcweir 	else
1599cdf0e10cSrcweir 		throw uno::RuntimeException();
1600cdf0e10cSrcweir 	return bRet;
1601cdf0e10cSrcweir }
1602cdf0e10cSrcweir /*-- 17.12.98 09:36:32---------------------------------------------------
1603cdf0e10cSrcweir 
1604cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1605cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToEndOfPage(void) throw( uno::RuntimeException )
1606cdf0e10cSrcweir {
1607cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1608cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1609cdf0e10cSrcweir     if(m_pView)
1610cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().EndPg();
1611cdf0e10cSrcweir 	else
1612cdf0e10cSrcweir 		throw uno::RuntimeException();
1613cdf0e10cSrcweir 	return bRet;
1614cdf0e10cSrcweir }
1615cdf0e10cSrcweir /*-- 17.12.98 09:36:32---------------------------------------------------
1616cdf0e10cSrcweir 
1617cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1618cdf0e10cSrcweir sal_Bool SwXTextViewCursor::jumpToStartOfPage(void) throw( uno::RuntimeException )
1619cdf0e10cSrcweir {
1620cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1621cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1622cdf0e10cSrcweir     if(m_pView)
1623cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().SttPg();
1624cdf0e10cSrcweir 	else
1625cdf0e10cSrcweir 		throw uno::RuntimeException();
1626cdf0e10cSrcweir 	return bRet;
1627cdf0e10cSrcweir }
1628cdf0e10cSrcweir /* -----------------04.10.99 14:21-------------------
1629cdf0e10cSrcweir 
1630cdf0e10cSrcweir  --------------------------------------------------*/
1631cdf0e10cSrcweir sal_Int16 SwXTextViewCursor::getPage(void) throw( uno::RuntimeException )
1632cdf0e10cSrcweir {
1633cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1634cdf0e10cSrcweir 	short nRet = 0;
1635cdf0e10cSrcweir     if(m_pView)
1636cdf0e10cSrcweir 	{
1637cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1638cdf0e10cSrcweir         SwPaM* pShellCrsr = rSh.GetCrsr();
1639cdf0e10cSrcweir         nRet = (short)pShellCrsr->GetPageNum( sal_True, 0 );
1640cdf0e10cSrcweir     }
1641cdf0e10cSrcweir 	else
1642cdf0e10cSrcweir 		throw uno::RuntimeException();
1643cdf0e10cSrcweir 	return nRet;
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir /*-- 17.12.98 09:36:33---------------------------------------------------
1646cdf0e10cSrcweir 
1647cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1648cdf0e10cSrcweir sal_Bool SwXTextViewCursor::screenDown(void) throw( uno::RuntimeException )
1649cdf0e10cSrcweir {
1650cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1651cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1652cdf0e10cSrcweir     if(m_pView)
1653cdf0e10cSrcweir 	{
1654cdf0e10cSrcweir         SfxRequest aReq(FN_PAGEDOWN, SFX_CALLMODE_SLOT, m_pView->GetPool());
1655cdf0e10cSrcweir         m_pView->Execute(aReq);
1656cdf0e10cSrcweir 		const SfxPoolItem* pRet = aReq.GetReturnValue();
1657cdf0e10cSrcweir 		bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue();
1658cdf0e10cSrcweir 	}
1659cdf0e10cSrcweir 	else
1660cdf0e10cSrcweir 		throw uno::RuntimeException();
1661cdf0e10cSrcweir 	return bRet;
1662cdf0e10cSrcweir }
1663cdf0e10cSrcweir /*-- 17.12.98 09:36:33---------------------------------------------------
1664cdf0e10cSrcweir 
1665cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1666cdf0e10cSrcweir sal_Bool SwXTextViewCursor::screenUp(void) throw( uno::RuntimeException )
1667cdf0e10cSrcweir {
1668cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1669cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1670cdf0e10cSrcweir     if(m_pView)
1671cdf0e10cSrcweir 	{
1672cdf0e10cSrcweir         SfxRequest aReq(FN_PAGEUP, SFX_CALLMODE_SLOT, m_pView->GetPool());
1673cdf0e10cSrcweir         m_pView->Execute(aReq);
1674cdf0e10cSrcweir 		const SfxPoolItem* pRet = aReq.GetReturnValue();
1675cdf0e10cSrcweir 		bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue();
1676cdf0e10cSrcweir 	}
1677cdf0e10cSrcweir 	else
1678cdf0e10cSrcweir 		throw uno::RuntimeException();
1679cdf0e10cSrcweir 	return bRet;
1680cdf0e10cSrcweir }
1681cdf0e10cSrcweir /*-- 17.12.98 11:59:05---------------------------------------------------
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1684cdf0e10cSrcweir uno::Reference< text::XText >  SwXTextViewCursor::getText(void) throw( uno::RuntimeException )
1685cdf0e10cSrcweir {
1686cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1687cdf0e10cSrcweir 	uno::Reference< text::XText >  xRet;
1688cdf0e10cSrcweir     if(m_pView)
1689cdf0e10cSrcweir 	{
1690cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
1691cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1692cdf0e10cSrcweir 
1693cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1694cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1695cdf0e10cSrcweir         SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1696cdf0e10cSrcweir         xRet = ::sw::CreateParentXText(*pDoc, *pShellCrsr->Start());
1697cdf0e10cSrcweir 	}
1698cdf0e10cSrcweir 	else
1699cdf0e10cSrcweir 		throw uno::RuntimeException();
1700cdf0e10cSrcweir 	return xRet;
1701cdf0e10cSrcweir }
1702cdf0e10cSrcweir /*-- 17.12.98 11:59:05---------------------------------------------------
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1705cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXTextViewCursor::getStart(void) throw( uno::RuntimeException )
1706cdf0e10cSrcweir {
1707cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1708cdf0e10cSrcweir 	uno::Reference< text::XTextRange >  xRet;
1709cdf0e10cSrcweir     if(m_pView)
1710cdf0e10cSrcweir 	{
1711cdf0e10cSrcweir         if (!IsTextSelection())
1712cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1713cdf0e10cSrcweir 
1714cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1715cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1716cdf0e10cSrcweir         SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1717cdf0e10cSrcweir         xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->Start(), 0);
1718cdf0e10cSrcweir 	}
1719cdf0e10cSrcweir 	else
1720cdf0e10cSrcweir 		throw uno::RuntimeException();
1721cdf0e10cSrcweir 	return xRet;
1722cdf0e10cSrcweir }
1723cdf0e10cSrcweir /*-- 17.12.98 11:59:06---------------------------------------------------
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1726cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXTextViewCursor::getEnd(void) throw( uno::RuntimeException )
1727cdf0e10cSrcweir {
1728cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1729cdf0e10cSrcweir 	uno::Reference< text::XTextRange >  xRet;
1730cdf0e10cSrcweir     if(m_pView)
1731cdf0e10cSrcweir 	{
1732cdf0e10cSrcweir         if (!IsTextSelection())
1733cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1734cdf0e10cSrcweir 
1735cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1736cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1737cdf0e10cSrcweir         SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
1738cdf0e10cSrcweir         xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->End(), 0);
1739cdf0e10cSrcweir 	}
1740cdf0e10cSrcweir 	else
1741cdf0e10cSrcweir 		throw uno::RuntimeException();
1742cdf0e10cSrcweir 	return xRet;
1743cdf0e10cSrcweir }
1744cdf0e10cSrcweir /* -----------------12.10.99 09:03-------------------
1745cdf0e10cSrcweir 
1746cdf0e10cSrcweir  --------------------------------------------------*/
1747cdf0e10cSrcweir OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException )
1748cdf0e10cSrcweir {
1749cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1750cdf0e10cSrcweir 	OUString uRet;
1751cdf0e10cSrcweir     if(m_pView)
1752cdf0e10cSrcweir 	{
1753cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
1754cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir         ShellModes  eSelMode = m_pView->GetShellMode();
1757cdf0e10cSrcweir 		switch(eSelMode)
1758cdf0e10cSrcweir         {
1759cdf0e10cSrcweir             //! since setString for SEL_TABLE_TEXT (with possible
1760cdf0e10cSrcweir             //! multi selection of cells) would not work properly we
1761cdf0e10cSrcweir             //! will ignore this case for both
1762cdf0e10cSrcweir             //! functions (setString AND getString) because of symmetrie.
1763cdf0e10cSrcweir 
1764cdf0e10cSrcweir 			case SHELL_MODE_LIST_TEXT       :
1765cdf0e10cSrcweir 			case SHELL_MODE_TABLE_LIST_TEXT:
1766cdf0e10cSrcweir 			case SHELL_MODE_TEXT            :
1767cdf0e10cSrcweir 			{
1768cdf0e10cSrcweir                 SwWrtShell& rSh = m_pView->GetWrtShell();
1769cdf0e10cSrcweir 				SwPaM* pShellCrsr = rSh.GetCrsr();
1770cdf0e10cSrcweir                 SwUnoCursorHelper::GetTextFromPam(*pShellCrsr, uRet);
1771cdf0e10cSrcweir 			}
1772cdf0e10cSrcweir             default:;//prevent warning
1773cdf0e10cSrcweir         }
1774cdf0e10cSrcweir 	}
1775cdf0e10cSrcweir 	return uRet;
1776cdf0e10cSrcweir }
1777cdf0e10cSrcweir /*-- 17.12.98 11:59:06---------------------------------------------------
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1780cdf0e10cSrcweir void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeException )
1781cdf0e10cSrcweir {
1782cdf0e10cSrcweir     ::vos::OGuard aGuard(Application::GetSolarMutex());
1783cdf0e10cSrcweir     if(m_pView)
1784cdf0e10cSrcweir     {
1785cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
1786cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir         ShellModes  eSelMode = m_pView->GetShellMode();
1789cdf0e10cSrcweir         switch(eSelMode)
1790cdf0e10cSrcweir         {
1791cdf0e10cSrcweir             //! since setString for SEL_TABLE_TEXT (with possible
1792cdf0e10cSrcweir             //! multi selection of cells) would not work properly we
1793cdf0e10cSrcweir             //! will ignore this case for both
1794cdf0e10cSrcweir             //! functions (setString AND getString) because of symmetrie.
1795cdf0e10cSrcweir 
1796cdf0e10cSrcweir             case SHELL_MODE_LIST_TEXT       :
1797cdf0e10cSrcweir             case SHELL_MODE_TABLE_LIST_TEXT :
1798cdf0e10cSrcweir             case SHELL_MODE_TEXT            :
1799cdf0e10cSrcweir             {
1800cdf0e10cSrcweir                 SwWrtShell& rSh = m_pView->GetWrtShell();
1801cdf0e10cSrcweir                 SwCursor* pShellCrsr = rSh.GetSwCrsr();
1802cdf0e10cSrcweir                 SwUnoCursorHelper::SetString(*pShellCrsr, aString);
1803cdf0e10cSrcweir             }
1804cdf0e10cSrcweir             default:;//prevent warning
1805cdf0e10cSrcweir         }
1806cdf0e10cSrcweir     }
1807cdf0e10cSrcweir }
1808cdf0e10cSrcweir 
1809cdf0e10cSrcweir /*-- 29.06.00 17:33:38---------------------------------------------------
1810cdf0e10cSrcweir 
1811cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1812cdf0e10cSrcweir uno::Reference< XPropertySetInfo >  SwXTextViewCursor::getPropertySetInfo(  ) throw(RuntimeException)
1813cdf0e10cSrcweir {
1814cdf0e10cSrcweir     static uno::Reference< XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
1815cdf0e10cSrcweir 	return xRef;
1816cdf0e10cSrcweir }
1817cdf0e10cSrcweir /*-- 29.06.00 17:33:39---------------------------------------------------
1818cdf0e10cSrcweir 
1819cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1820cdf0e10cSrcweir void  SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
1821cdf0e10cSrcweir 							throw(UnknownPropertyException, PropertyVetoException,
1822cdf0e10cSrcweir 								IllegalArgumentException, WrappedTargetException, RuntimeException)
1823cdf0e10cSrcweir {
1824cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1825cdf0e10cSrcweir     if(m_pView)
1826cdf0e10cSrcweir 	{
1827cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1828cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1829cdf0e10cSrcweir 		SwNode *pNode = pShellCrsr->GetNode();
1830cdf0e10cSrcweir 		if (pNode && pNode->IsTxtNode())
1831cdf0e10cSrcweir         {
1832cdf0e10cSrcweir             SwUnoCursorHelper::SetPropertyValue(
1833cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet, rPropertyName, aValue );
1834cdf0e10cSrcweir         }
1835cdf0e10cSrcweir 		else
1836cdf0e10cSrcweir 			throw RuntimeException();
1837cdf0e10cSrcweir 	}
1838cdf0e10cSrcweir 	else
1839cdf0e10cSrcweir 		throw RuntimeException();
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir /*-- 29.06.00 17:33:39---------------------------------------------------
1842cdf0e10cSrcweir 
1843cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1844cdf0e10cSrcweir Any  SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
1845cdf0e10cSrcweir 				throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1846cdf0e10cSrcweir {
1847cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1848cdf0e10cSrcweir 	Any aRet;
1849cdf0e10cSrcweir     if(m_pView)
1850cdf0e10cSrcweir 	{
1851cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1852cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1853cdf0e10cSrcweir         aRet = SwUnoCursorHelper::GetPropertyValue(
1854cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet, rPropertyName);
1855cdf0e10cSrcweir 	}
1856cdf0e10cSrcweir 	else
1857cdf0e10cSrcweir 		throw RuntimeException();
1858cdf0e10cSrcweir 	return aRet;
1859cdf0e10cSrcweir }
1860cdf0e10cSrcweir /*-- 29.06.00 17:33:40---------------------------------------------------
1861cdf0e10cSrcweir 
1862cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1863cdf0e10cSrcweir void  SwXTextViewCursor::addPropertyChangeListener(
1864cdf0e10cSrcweir     const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
1865cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir }
1868cdf0e10cSrcweir /*-- 29.06.00 17:33:40---------------------------------------------------
1869cdf0e10cSrcweir 
1870cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1871cdf0e10cSrcweir void  SwXTextViewCursor::removePropertyChangeListener(
1872cdf0e10cSrcweir     const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
1873cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1874cdf0e10cSrcweir {
1875cdf0e10cSrcweir }
1876cdf0e10cSrcweir /*-- 29.06.00 17:33:41---------------------------------------------------
1877cdf0e10cSrcweir 
1878cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1879cdf0e10cSrcweir void  SwXTextViewCursor::addVetoableChangeListener(
1880cdf0e10cSrcweir     const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
1881cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1882cdf0e10cSrcweir {
1883cdf0e10cSrcweir }
1884cdf0e10cSrcweir /*-- 29.06.00 17:33:41---------------------------------------------------
1885cdf0e10cSrcweir 
1886cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1887cdf0e10cSrcweir void  SwXTextViewCursor::removeVetoableChangeListener(
1888cdf0e10cSrcweir     const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir }
1891cdf0e10cSrcweir /*-- 29.06.00 17:33:41---------------------------------------------------
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1894cdf0e10cSrcweir PropertyState  SwXTextViewCursor::getPropertyState( const OUString& rPropertyName )
1895cdf0e10cSrcweir     throw(UnknownPropertyException, RuntimeException)
1896cdf0e10cSrcweir {
1897cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1898cdf0e10cSrcweir 	PropertyState eState;
1899cdf0e10cSrcweir     if(m_pView)
1900cdf0e10cSrcweir 	{
1901cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1902cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1903cdf0e10cSrcweir         eState = SwUnoCursorHelper::GetPropertyState(
1904cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet, rPropertyName);
1905cdf0e10cSrcweir 	}
1906cdf0e10cSrcweir 	else
1907cdf0e10cSrcweir 		throw RuntimeException();
1908cdf0e10cSrcweir 	return eState;
1909cdf0e10cSrcweir }
1910cdf0e10cSrcweir /*-- 29.06.00 17:33:42---------------------------------------------------
1911cdf0e10cSrcweir 
1912cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1913cdf0e10cSrcweir Sequence< PropertyState >  SwXTextViewCursor::getPropertyStates(
1914cdf0e10cSrcweir 	const Sequence< OUString >& rPropertyNames ) throw(UnknownPropertyException, RuntimeException)
1915cdf0e10cSrcweir {
1916cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1917cdf0e10cSrcweir 	Sequence< PropertyState >  aRet;
1918cdf0e10cSrcweir     if(m_pView)
1919cdf0e10cSrcweir 	{
1920cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1921cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1922cdf0e10cSrcweir         aRet = SwUnoCursorHelper::GetPropertyStates(
1923cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet,  rPropertyNames);
1924cdf0e10cSrcweir 	}
1925cdf0e10cSrcweir 	return aRet;
1926cdf0e10cSrcweir }
1927cdf0e10cSrcweir /*-- 29.06.00 17:33:42---------------------------------------------------
1928cdf0e10cSrcweir 
1929cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1930cdf0e10cSrcweir void  SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
1931cdf0e10cSrcweir 										throw(UnknownPropertyException, RuntimeException)
1932cdf0e10cSrcweir {
1933cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1934cdf0e10cSrcweir     if(m_pView)
1935cdf0e10cSrcweir 	{
1936cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1937cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1938cdf0e10cSrcweir         SwUnoCursorHelper::SetPropertyToDefault(
1939cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet, rPropertyName);
1940cdf0e10cSrcweir 	}
1941cdf0e10cSrcweir }
1942cdf0e10cSrcweir /*-- 29.06.00 17:33:43---------------------------------------------------
1943cdf0e10cSrcweir 
1944cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1945cdf0e10cSrcweir Any  SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
1946cdf0e10cSrcweir 						throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1947cdf0e10cSrcweir {
1948cdf0e10cSrcweir 	Any aRet;
1949cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1950cdf0e10cSrcweir     if(m_pView)
1951cdf0e10cSrcweir 	{
1952cdf0e10cSrcweir         SwWrtShell& rSh = m_pView->GetWrtShell();
1953cdf0e10cSrcweir 		SwPaM* pShellCrsr = rSh.GetCrsr();
1954cdf0e10cSrcweir         aRet = SwUnoCursorHelper::GetPropertyDefault(
1955cdf0e10cSrcweir                 *pShellCrsr, *m_pPropSet, rPropertyName);
1956cdf0e10cSrcweir 	}
1957cdf0e10cSrcweir 	return aRet;
1958cdf0e10cSrcweir }
1959cdf0e10cSrcweir /*-- 28.09.99 08:31:19---------------------------------------------------
1960cdf0e10cSrcweir 
1961cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1962cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
1963cdf0e10cSrcweir {
1964cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1965cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1966cdf0e10cSrcweir     if(m_pView)
1967cdf0e10cSrcweir 	{
1968cdf0e10cSrcweir         if (!IsTextSelection())
1969cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1970cdf0e10cSrcweir 
1971cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nCount; i++ )
1972cdf0e10cSrcweir             bRet = m_pView->GetWrtShell().Down( bExpand, 1, sal_True );
1973cdf0e10cSrcweir 	}
1974cdf0e10cSrcweir 	else
1975cdf0e10cSrcweir 		throw uno::RuntimeException();
1976cdf0e10cSrcweir 	return bRet;
1977cdf0e10cSrcweir }
1978cdf0e10cSrcweir /*-- 28.09.99 08:31:20---------------------------------------------------
1979cdf0e10cSrcweir 
1980cdf0e10cSrcweir   -----------------------------------------------------------------------*/
1981cdf0e10cSrcweir sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
1984cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1985cdf0e10cSrcweir     if(m_pView)
1986cdf0e10cSrcweir 	{
1987cdf0e10cSrcweir         if (!IsTextSelection())
1988cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
1989cdf0e10cSrcweir 
1990cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nCount; i++ )
1991cdf0e10cSrcweir             bRet = m_pView->GetWrtShell().Up( bExpand, 1, sal_True );
1992cdf0e10cSrcweir 	}
1993cdf0e10cSrcweir 	else
1994cdf0e10cSrcweir 		throw uno::RuntimeException();
1995cdf0e10cSrcweir 	return bRet;
1996cdf0e10cSrcweir }
1997cdf0e10cSrcweir /*-- 28.09.99 08:31:20---------------------------------------------------
1998cdf0e10cSrcweir 
1999cdf0e10cSrcweir   -----------------------------------------------------------------------*/
2000cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isAtStartOfLine(void) throw( uno::RuntimeException )
2001cdf0e10cSrcweir {
2002cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
2003cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
2004cdf0e10cSrcweir     if(m_pView)
2005cdf0e10cSrcweir 	{
2006cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
2007cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
2008cdf0e10cSrcweir 
2009cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().IsAtLeftMargin();
2010cdf0e10cSrcweir 	}
2011cdf0e10cSrcweir 	else
2012cdf0e10cSrcweir 		throw uno::RuntimeException();
2013cdf0e10cSrcweir 	return bRet;
2014cdf0e10cSrcweir }
2015cdf0e10cSrcweir /*-- 28.09.99 08:31:21---------------------------------------------------
2016cdf0e10cSrcweir 
2017cdf0e10cSrcweir   -----------------------------------------------------------------------*/
2018cdf0e10cSrcweir sal_Bool SwXTextViewCursor::isAtEndOfLine(void) throw( uno::RuntimeException )
2019cdf0e10cSrcweir {
2020cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
2021cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
2022cdf0e10cSrcweir     if(m_pView)
2023cdf0e10cSrcweir 	{
2024cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
2025cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
2026cdf0e10cSrcweir 
2027cdf0e10cSrcweir         bRet = m_pView->GetWrtShell().IsAtRightMargin(sal_True);
2028cdf0e10cSrcweir 	}
2029cdf0e10cSrcweir 	else
2030cdf0e10cSrcweir 		throw uno::RuntimeException();
2031cdf0e10cSrcweir 	return bRet;
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir /*-- 28.09.99 08:31:21---------------------------------------------------
2034cdf0e10cSrcweir 
2035cdf0e10cSrcweir   -----------------------------------------------------------------------*/
2036cdf0e10cSrcweir void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand) throw( uno::RuntimeException )
2037cdf0e10cSrcweir {
2038cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
2039cdf0e10cSrcweir     if(m_pView)
2040cdf0e10cSrcweir     {
2041cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
2042cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
2043cdf0e10cSrcweir 
2044cdf0e10cSrcweir         m_pView->GetWrtShell().RightMargin(bExpand, sal_True);
2045cdf0e10cSrcweir     }
2046cdf0e10cSrcweir 	else
2047cdf0e10cSrcweir 		throw uno::RuntimeException();
2048cdf0e10cSrcweir }
2049cdf0e10cSrcweir /*-- 28.09.99 08:31:22---------------------------------------------------
2050cdf0e10cSrcweir 
2051cdf0e10cSrcweir   -----------------------------------------------------------------------*/
2052cdf0e10cSrcweir void SwXTextViewCursor::gotoStartOfLine(sal_Bool bExpand) throw( uno::RuntimeException )
2053cdf0e10cSrcweir {
2054cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
2055cdf0e10cSrcweir     if(m_pView)
2056cdf0e10cSrcweir     {
2057cdf0e10cSrcweir         if (!IsTextSelection( sal_False ))
2058cdf0e10cSrcweir             throw  uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
2059cdf0e10cSrcweir 
2060cdf0e10cSrcweir         m_pView->GetWrtShell().LeftMargin(bExpand, sal_True);
2061cdf0e10cSrcweir     }
2062cdf0e10cSrcweir 	else
2063cdf0e10cSrcweir 		throw uno::RuntimeException();
2064cdf0e10cSrcweir }
2065cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
2066cdf0e10cSrcweir 
2067cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2068cdf0e10cSrcweir OUString SwXTextViewCursor::getImplementationName(void) throw( RuntimeException )
2069cdf0e10cSrcweir {
2070cdf0e10cSrcweir 	return C2U("SwXTextViewCursor");
2071cdf0e10cSrcweir }
2072cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
2073cdf0e10cSrcweir 
2074cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2075cdf0e10cSrcweir sal_Bool SwXTextViewCursor::supportsService(const OUString& rServiceName) throw( RuntimeException )
2076cdf0e10cSrcweir {
2077cdf0e10cSrcweir     return !rServiceName.compareToAscii("com.sun.star.text.TextViewCursor") ||
2078cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
2079cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
2080cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
2081cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
2082cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
2083cdf0e10cSrcweir             !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex");
2084cdf0e10cSrcweir }
2085cdf0e10cSrcweir /* -----------------------------06.04.00 11:07--------------------------------
2086cdf0e10cSrcweir 
2087cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2088cdf0e10cSrcweir Sequence< OUString > SwXTextViewCursor::getSupportedServiceNames(void) throw( RuntimeException )
2089cdf0e10cSrcweir {
2090cdf0e10cSrcweir     Sequence< OUString > aRet(7);
2091cdf0e10cSrcweir 	OUString* pArray = aRet.getArray();
2092cdf0e10cSrcweir 	pArray[0] = C2U("com.sun.star.text.TextViewCursor");
2093cdf0e10cSrcweir     pArray[1] = C2U("com.sun.star.style.CharacterProperties");
2094cdf0e10cSrcweir     pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
2095cdf0e10cSrcweir     pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
2096cdf0e10cSrcweir     pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
2097cdf0e10cSrcweir     pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
2098cdf0e10cSrcweir     pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
2099cdf0e10cSrcweir     return aRet;
2100cdf0e10cSrcweir }
2101cdf0e10cSrcweir /* -----------------------------03.03.03 11:07--------------------------------
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2104cdf0e10cSrcweir const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId()
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
2107cdf0e10cSrcweir 	return aSeq;
2108cdf0e10cSrcweir }
2109cdf0e10cSrcweir /* -----------------------------03.03.03 11:07--------------------------------
2110cdf0e10cSrcweir 
2111cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
2112cdf0e10cSrcweir //XUnoTunnel
2113cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextViewCursor::getSomething(
2114cdf0e10cSrcweir 	const uno::Sequence< sal_Int8 >& rId )
2115cdf0e10cSrcweir 		throw(uno::RuntimeException)
2116cdf0e10cSrcweir {
2117cdf0e10cSrcweir     if( rId.getLength() == 16
2118cdf0e10cSrcweir         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
2119cdf0e10cSrcweir 										rId.getConstArray(), 16 ) )
2120cdf0e10cSrcweir         {
2121cdf0e10cSrcweir                 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
2122cdf0e10cSrcweir         }
2123cdf0e10cSrcweir 	return OTextCursorHelper::getSomething(rId);;
2124cdf0e10cSrcweir }
2125cdf0e10cSrcweir // -----------------------------------------------------------------------------
2126cdf0e10cSrcweir 
2127cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCursorHelper)
2128cdf0e10cSrcweir const SwDoc* 		SwXTextViewCursor::GetDoc() const
2129cdf0e10cSrcweir {
2130cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
2131cdf0e10cSrcweir 	return	 rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0;
2132cdf0e10cSrcweir }
2133cdf0e10cSrcweir // -----------------------------------------------------------------------------
2134cdf0e10cSrcweir SwDoc* 	SwXTextViewCursor::GetDoc()
2135cdf0e10cSrcweir {
2136cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
2137cdf0e10cSrcweir 	return	 rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0;
2138cdf0e10cSrcweir }
2139cdf0e10cSrcweir // -----------------------------------------------------------------------------
2140cdf0e10cSrcweir const SwPaM* 	SwXTextViewCursor::GetPaM() const
2141cdf0e10cSrcweir {
2142cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
2143cdf0e10cSrcweir 	return rSh.GetCrsr();
2144cdf0e10cSrcweir }
2145cdf0e10cSrcweir // -----------------------------------------------------------------------------
2146cdf0e10cSrcweir SwPaM* 	SwXTextViewCursor::GetPaM()
2147cdf0e10cSrcweir {
2148cdf0e10cSrcweir     SwWrtShell& rSh = m_pView->GetWrtShell();
2149cdf0e10cSrcweir 	return rSh.GetCrsr();
2150cdf0e10cSrcweir }
2151cdf0e10cSrcweir 
2152cdf0e10cSrcweir uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable(  ) throw (uno::RuntimeException)
2153cdf0e10cSrcweir {
2154cdf0e10cSrcweir 	::vos::OGuard aGuard(Application::GetSolarMutex());
2155cdf0e10cSrcweir 
2156cdf0e10cSrcweir     //force immediat shell update
2157cdf0e10cSrcweir     GetView()->StopShellTimer();
2158cdf0e10cSrcweir     SwWrtShell& rSh = GetView()->GetWrtShell();
2159cdf0e10cSrcweir     if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT )
2160cdf0e10cSrcweir     {
2161cdf0e10cSrcweir         SdrView *pSdrView = rSh.GetDrawView();
2162cdf0e10cSrcweir         OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
2163cdf0e10cSrcweir         return pOLV->GetEditView().GetTransferable();
2164cdf0e10cSrcweir     }
2165cdf0e10cSrcweir     else
2166cdf0e10cSrcweir     {
2167cdf0e10cSrcweir         SwTransferable* pTransfer = new SwTransferable( rSh );
2168cdf0e10cSrcweir         const sal_Bool bLockedView = rSh.IsViewLocked();
2169cdf0e10cSrcweir         rSh.LockView( sal_True );    //lock visible section
2170cdf0e10cSrcweir         pTransfer->PrepareForCopy();
2171cdf0e10cSrcweir         rSh.LockView( bLockedView );
2172cdf0e10cSrcweir         return uno::Reference< datatransfer::XTransferable >( pTransfer );
2173cdf0e10cSrcweir     }
2174cdf0e10cSrcweir }
2175cdf0e10cSrcweir 
2176cdf0e10cSrcweir void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans ) throw (datatransfer::UnsupportedFlavorException, uno::RuntimeException)
2177cdf0e10cSrcweir {
2178cdf0e10cSrcweir     ::vos::OGuard aGuard(Application::GetSolarMutex());
2179cdf0e10cSrcweir 
2180cdf0e10cSrcweir     //force immediat shell update
2181cdf0e10cSrcweir     GetView()->StopShellTimer();
2182cdf0e10cSrcweir     SwWrtShell& rSh = GetView()->GetWrtShell();
2183cdf0e10cSrcweir     if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT )
2184cdf0e10cSrcweir     {
2185cdf0e10cSrcweir         SdrView *pSdrView = rSh.GetDrawView();
2186cdf0e10cSrcweir         OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
2187cdf0e10cSrcweir         pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), sal_False );
2188cdf0e10cSrcweir     }
2189cdf0e10cSrcweir     else
2190cdf0e10cSrcweir     {
2191cdf0e10cSrcweir         TransferableDataHelper aDataHelper( xTrans );
2192cdf0e10cSrcweir         if ( SwTransferable::IsPaste( rSh, aDataHelper ) )
2193cdf0e10cSrcweir         {
2194cdf0e10cSrcweir             SwTransferable::Paste( rSh, aDataHelper );
2195cdf0e10cSrcweir             if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
2196cdf0e10cSrcweir                 rSh.EnterSelFrmMode();
2197cdf0e10cSrcweir             GetView()->AttrChangedNotify( &rSh );
2198cdf0e10cSrcweir         }
2199cdf0e10cSrcweir     }
2200cdf0e10cSrcweir }
2201cdf0e10cSrcweir 
2202cdf0e10cSrcweir // -----------------------------------------------------------------------------
2203cdf0e10cSrcweir 
2204