xref: /aoo41x/main/sc/source/ui/view/prevwsh.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 // INCLUDE ---------------------------------------------------------------
30 
31 #include "scitems.hxx"
32 #include <editeng/eeitem.hxx>
33 
34 #include <sfx2/app.hxx>
35 #include <editeng/sizeitem.hxx>
36 #include <svl/srchitem.hxx>
37 #include <svx/zoomslideritem.hxx>
38 #include <svx/svdview.hxx>
39 //CHINA001 #include <svx/zoom.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <sfx2/objface.hxx>
42 #include <sfx2/request.hxx>
43 #include <svl/stritem.hxx>
44 #include <svl/whiter.hxx>
45 #include <vcl/msgbox.hxx>
46 #include <vcl/help.hxx>
47 #include <tools/urlobj.hxx>
48 #include <sfx2/docfile.hxx>
49 #include <sfx2/printer.hxx>
50 
51 #ifndef _SVX_ZOOMSLIDERITEM_HXX
52 #include <svx/zoomslideritem.hxx>
53 #endif
54 #include "prevwsh.hxx"
55 #include "preview.hxx"
56 #include "printfun.hxx"
57 #include "attrib.hxx"
58 #include "scmod.hxx"
59 #include "inputhdl.hxx"
60 #include "docsh.hxx"
61 #include "tabvwsh.hxx"
62 #include "stlpool.hxx"
63 #include "editutil.hxx"
64 #include "scresid.hxx"
65 #include "globstr.hrc"
66 #include "sc.hrc"
67 #include "ViewSettingsSequenceDefines.hxx"
68 #include "tpprint.hxx"
69 #include "printopt.hxx"
70 #include <xmloff/xmluconv.hxx>
71 #include <rtl/ustrbuf.hxx>
72 
73 #include <svx/svxdlg.hxx> //CHINA001
74 #include <svx/dialogs.hrc> //CHINA001
75 
76 #ifndef _SVX_ZOOM_HXX
77 #include <svx/zoom_def.hxx>
78 #endif
79 
80 #include "sc.hrc" //CHINA001
81 #include "scabstdlg.hxx" //CHINA001
82 //	fuer Rad-Maus
83 #define SC_DELTA_ZOOM	10
84 #define MINZOOM_SLIDER 10
85 #define MAXZOOM_SLIDER 400
86 
87 #define SC_USERDATA_SEP	';'
88 
89 using namespace com::sun::star;
90 
91 // -----------------------------------------------------------------------
92 
93 #define ScPreviewShell
94 #include "scslots.hxx"
95 
96 TYPEINIT1( ScPreviewShell, SfxViewShell );
97 
SFX_IMPL_INTERFACE(ScPreviewShell,SfxViewShell,ScResId (SCSTR_PREVIEWSHELL))98 SFX_IMPL_INTERFACE( ScPreviewShell, SfxViewShell, ScResId(SCSTR_PREVIEWSHELL) )
99 {
100 	SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|
101 								SFX_VISIBILITY_SERVER|SFX_VISIBILITY_READONLYDOC,
102 								ScResId(RID_OBJECTBAR_PREVIEW));
103 	SFX_POPUPMENU_REGISTRATION(ScResId(RID_POPUP_PREVIEW));
104 }
105 
106 SFX_IMPL_NAMED_VIEWFACTORY( ScPreviewShell, "PrintPreview" )
107 {
108 	SFX_VIEW_REGISTRATION(ScDocShell);
109 }
110 
111 //------------------------------------------------------------------
112 
Construct(Window * pParent)113 void ScPreviewShell::Construct( Window* pParent )
114 {
115 	eZoom = SVX_ZOOM_WHOLEPAGE;
116 
117 	pCorner = new ScrollBarBox( pParent, WB_SIZEABLE );
118 
119 	pHorScroll = new ScrollBar(pParent, WB_HSCROLL );
120 	pVerScroll = new ScrollBar(pParent, WB_VSCROLL);
121 
122     // SSA: --- RTL --- no mirroring for horizontal scrollbars
123     pHorScroll->EnableRTL( sal_False );
124 
125 	pHorScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) );
126 	pVerScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) );
127 
128 	pPreview = new ScPreview( pParent, pDocShell, this );
129 
130 	SetPool( &SC_MOD()->GetPool() );
131 	SetWindow( pPreview );
132     StartListening(*pDocShell,sal_True);
133     StartListening(*SFX_APP(),sal_True);        // #i62045# #i62046# application is needed for Calc's own hints
134 	SfxBroadcaster* pDrawBC = pDocShell->GetDocument()->GetDrawBroadcaster();
135 	if (pDrawBC)
136 		StartListening(*pDrawBC);
137 
138 	pHorScroll->Show();
139 	pVerScroll->Show();
140 	pCorner->Show();
141 	SetHelpId( HID_SCSHELL_PREVWSH );
142 	SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Preview")));
143 }
144 
ScPreviewShell(SfxViewFrame * pViewFrame,SfxViewShell * pOldSh)145 ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
146 								SfxViewShell* pOldSh ) :
147 	SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ),
148 	pDocShell( (ScDocShell*)pViewFrame->GetObjectShell() ),
149 	nSourceDesignMode( SC_FORCEMODE_NONE ),
150 	pAccessibilityBroadcaster( NULL )
151 {
152 	Construct( &pViewFrame->GetWindow() );
153 
154 	if ( pOldSh && pOldSh->ISA( ScTabViewShell ) )
155 	{
156 		//	store view settings, show table from TabView
157 		//!	store live ScViewData instead, and update on ScTablesHint?
158 		//!	or completely forget aSourceData on ScTablesHint?
159 
160 		ScTabViewShell* pTabViewShell = ((ScTabViewShell*)pOldSh);
161 		ScViewData* pData = pTabViewShell->GetViewData();
162 		pData->WriteUserDataSequence( aSourceData );
163 		InitStartTable( pData->GetTabNo() );
164 
165 		//	#106334# also have to store the TabView's DesignMode state
166 		//	(only if draw view exists)
167 		SdrView* pDrawView = pTabViewShell->GetSdrView();
168 		if ( pDrawView )
169 			nSourceDesignMode = pDrawView->IsDesignMode();
170 	}
171 }
172 
~ScPreviewShell()173 __EXPORT ScPreviewShell::~ScPreviewShell()
174 {
175     // #108333#; notify Accessibility that Shell is dying and before destroy all
176     BroadcastAccessibility( SfxSimpleHint( SFX_HINT_DYING ) );
177     DELETEZ(pAccessibilityBroadcaster);
178 
179     SfxBroadcaster* pDrawBC = pDocShell->GetDocument()->GetDrawBroadcaster();
180 	if (pDrawBC)
181 		EndListening(*pDrawBC);
182 	EndListening(*SFX_APP());
183 	EndListening(*pDocShell);
184 
185 	SetWindow(0);
186 	delete pPreview;
187 	delete pHorScroll;
188 	delete pVerScroll;
189 	delete pCorner;
190 
191 	//	#97612# normal mode of operation is switching back to default view in the same frame,
192 	//	so there's no need to activate any other window here anymore
193 }
194 
InitStartTable(SCTAB nTab)195 void ScPreviewShell::InitStartTable(SCTAB nTab)
196 {
197 	pPreview->SetPageNo( pPreview->GetFirstPage(nTab) );
198 }
199 
200 //------------------------------------------------------------------
201 
GetDescription() const202 String __EXPORT ScPreviewShell::GetDescription() const
203 {
204 	return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(" ** Test ** "));
205 }
206 
GetOptimalSizePixel() const207 Size __EXPORT ScPreviewShell::GetOptimalSizePixel() const
208 {
209 	Size aOptSize(100,100);
210 
211 	ScTabViewShell*     pViewSh = pDocShell->GetBestViewShell();
212 
213 	if ( pViewSh )
214 	{
215 		ScViewData*			pViewData	= pViewSh->GetViewData();
216 		SCTAB				nCurTab		= pViewData->GetTabNo();
217 		ScDocument*			pDoc		= pDocShell->GetDocument();
218 		ScStyleSheetPool*	pStylePool  = pDoc->GetStyleSheetPool();
219 		SfxStyleSheetBase*	pStyleSheet = pStylePool->Find(
220 											pDoc->GetPageStyle( nCurTab ),
221 											SFX_STYLE_FAMILY_PAGE );
222 
223 		DBG_ASSERT( pStyleSheet, "PageStyle not found :-/" );
224 
225 		if ( pStyleSheet )
226 		{
227 			const SfxItemSet&  rSet 	 = pStyleSheet->GetItemSet();
228 			const SvxSizeItem& rItem	 = (const SvxSizeItem&)rSet.Get( ATTR_PAGE_SIZE );
229 			const Size&		   rPageSize = rItem.GetSize();
230 
231 			aOptSize.Width()  = (long) (rPageSize.Width()  * pViewData->GetPPTX());
232 			aOptSize.Height() = (long) (rPageSize.Height() * pViewData->GetPPTY());
233 		}
234 	}
235 	else
236 	{
237 		DBG_ERROR( "TabViewShell not found :-/" );
238 	}
239 
240 	return aOptSize;
241 }
242 
AdjustPosSizePixel(const Point & rPos,const Size & rSize)243 void __EXPORT ScPreviewShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
244 {
245 	long nBarW = GetViewFrame()->GetWindow().GetSettings().GetStyleSettings().GetScrollBarSize();
246 	long nBarH = nBarW;
247 //	long nBarW = pVerScroll->GetSizePixel().Width();
248 //	long nBarH = pHorScroll->GetSizePixel().Height();
249 
250 	Size aOutSize( rSize.Width()-nBarW, rSize.Height()-nBarH );
251 	pPreview->SetPosSizePixel( rPos, aOutSize );
252 	pHorScroll->SetPosSizePixel( Point( rPos.X(), rPos.Y() + aOutSize.Height() ),
253 								 Size( aOutSize.Width(), nBarH ) );
254 	pVerScroll->SetPosSizePixel( Point( rPos.X() + aOutSize.Width(), rPos.Y() ),
255 								 Size( nBarW, aOutSize.Height() ) );
256 	pCorner->SetPosSizePixel( Point( rPos.X() + aOutSize.Width(), rPos.Y() + aOutSize.Height() ),
257 							  Size( nBarW, nBarH ) );
258 
259 	if ( SVX_ZOOM_WHOLEPAGE == eZoom )
260 		pPreview->SetZoom( pPreview->GetOptimalZoom(sal_False) );
261 	else if ( SVX_ZOOM_PAGEWIDTH == eZoom )
262 		pPreview->SetZoom( pPreview->GetOptimalZoom(sal_True) );
263 
264 	UpdateScrollBars();
265 }
266 
InnerResizePixel(const Point & rOfs,const Size & rSize)267 void __EXPORT ScPreviewShell::InnerResizePixel( const Point &rOfs, const Size &rSize )
268 {
269 	AdjustPosSizePixel( rOfs,rSize );
270 }
271 
OuterResizePixel(const Point & rOfs,const Size & rSize)272 void __EXPORT ScPreviewShell::OuterResizePixel( const Point &rOfs, const Size &rSize )
273 {
274 	AdjustPosSizePixel( rOfs,rSize );
275 }
276 
UpdateScrollBars()277 void ScPreviewShell::UpdateScrollBars()
278 {
279 	ScDocument* pDoc = pDocShell->GetDocument();
280 	SCTAB nTab = pPreview->GetTab();
281 
282 	ScStyleSheetPool*	pStylePool	= pDoc->GetStyleSheetPool();
283 	SfxStyleSheetBase*	pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ),
284 														SFX_STYLE_FAMILY_PAGE );
285 	DBG_ASSERT(pStyleSheet,"StyleSheet nicht gefunden");
286 	if (!pStyleSheet) return;
287 	const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet();
288 
289 	Size aPageSize = ((const SvxSizeItem&) pParamSet->Get(ATTR_PAGE_SIZE)).GetSize();
290 	aPageSize.Width()  = (long) (aPageSize.Width()  * HMM_PER_TWIPS );
291 	aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS );
292 
293 	//	for centering, page size without the shadow is used
294 
295 	Size aWindowSize = pPreview->GetOutputSize();
296 
297 	Point aOfs = pPreview->GetOffset();
298 	long nMaxPos;
299 
300     if( pHorScroll )
301     {
302         pHorScroll->SetRange( Range( 0, aPageSize.Width() ) );
303         pHorScroll->SetLineSize( aWindowSize.Width() / 16 );
304         pHorScroll->SetPageSize( aWindowSize.Width() );
305         pHorScroll->SetVisibleSize( aWindowSize.Width() );
306         nMaxPos = aPageSize.Width() - aWindowSize.Width();
307         if ( nMaxPos<0 )
308         {
309             //	page smaller than window -> center (but put scrollbar to 0)
310             aOfs.X() = 0;
311             pPreview->SetXOffset( nMaxPos / 2 );
312         }
313         else if (aOfs.X() < 0)
314         {
315             //	page larger than window -> never use negative offset
316             aOfs.X() = 0;
317             pPreview->SetXOffset( 0 );
318         }
319         else if (aOfs.X() > nMaxPos)
320         {
321             //	limit offset to align with right edge of window
322             aOfs.X() = nMaxPos;
323             pPreview->SetXOffset(nMaxPos);
324         }
325         pHorScroll->SetThumbPos( aOfs.X() );
326     }
327 
328     if( pVerScroll )
329     {
330         long nPageNo     = pPreview->GetPageNo();
331         long nTotalPages = pPreview->GetTotalPages();
332 
333         nMaxVertPos = aPageSize.Height() - aWindowSize.Height();
334         pVerScroll->SetLineSize( aWindowSize.Height() / 16  );
335         pVerScroll->SetPageSize( aWindowSize.Height() );
336         pVerScroll->SetVisibleSize( aWindowSize.Height() );
337         if ( nMaxVertPos < 0 )
338         {
339             //	page smaller than window -> center (but put scrollbar to 0)
340             aOfs.Y() = 0;
341             pPreview->SetYOffset( nMaxVertPos / 2 );
342             pVerScroll->SetThumbPos( nPageNo * aWindowSize.Height() );
343             pVerScroll->SetRange( Range( 0, aWindowSize.Height() * nTotalPages ));
344         }
345         else if (aOfs.Y() < 0)
346         {
347             //	page larger than window -> never use negative offset
348             pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
349             aOfs.Y() = 0;
350             pPreview->SetYOffset( 0 );
351             pVerScroll->SetThumbPos( aOfs.Y() );
352         }
353         else if (aOfs.Y() > nMaxVertPos )
354         {
355             //	limit offset to align with window bottom
356             pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
357             aOfs.Y() = nMaxVertPos;
358             pPreview->SetYOffset( nMaxVertPos );
359             pVerScroll->SetThumbPos( aOfs.Y() );
360         }
361     }
362 }
363 
IMPL_LINK(ScPreviewShell,ScrollHandler,ScrollBar *,pScroll)364 IMPL_LINK (ScPreviewShell,ScrollHandler, ScrollBar* ,pScroll )
365 {
366     long nPos           = pScroll->GetThumbPos();
367     long nDelta         = pScroll->GetDelta();
368     long nMaxRange      = pScroll->GetRangeMax();
369     long nTotalPages    = pPreview->GetTotalPages();
370     long nPageNo        = 0;
371     long nPerPageLength = 0;
372     sal_Bool bIsDivide      = sal_True;
373 
374     if( nTotalPages )
375         nPerPageLength = nMaxRange / nTotalPages;
376 
377     if( nPerPageLength )
378     {
379         nPageNo = nPos / nPerPageLength;
380         if( nPos % nPerPageLength )
381         {
382             bIsDivide = sal_False;
383             nPageNo ++;
384         }
385     }
386 
387     sal_Bool bHoriz = ( pScroll == pHorScroll );
388 
389     if( bHoriz )
390         pPreview->SetXOffset( nPos );
391     else
392     {
393         if( nMaxVertPos > 0 )
394             pPreview->SetYOffset( nPos );
395         else
396         {
397             Point  aMousePos = pScroll->OutputToNormalizedScreenPixel( pScroll->GetPointerPosPixel() );
398             Point  aPos      = pScroll->GetParent()->OutputToNormalizedScreenPixel( pScroll->GetPosPixel() );
399             String aHelpStr;
400             Rectangle aRect;
401             sal_uInt16   nAlign;
402 
403             if( nDelta < 0 )
404             {
405                 if ( nTotalPages && nPageNo > 0 && !bIsDivide )
406                     pPreview->SetPageNo( nPageNo-1 );
407                 if( bIsDivide )
408                     pPreview->SetPageNo( nPageNo );
409 
410                 aHelpStr = ScGlobal::GetRscString( STR_PAGE );
411                 aHelpStr += ' ';
412                 aHelpStr += String::CreateFromInt32( nPageNo );
413 
414                 aHelpStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " / " ));
415                 aHelpStr += String::CreateFromInt32( nTotalPages );
416             }
417             else if( nDelta > 0 )
418             {
419                 sal_Bool bAllTested	= pPreview->AllTested();
420                 if ( nTotalPages && ( nPageNo < nTotalPages || !bAllTested ) )
421                     pPreview->SetPageNo( nPageNo );
422 
423                 aHelpStr = ScGlobal::GetRscString( STR_PAGE );
424                 aHelpStr += ' ';
425                 aHelpStr += String::CreateFromInt32( nPageNo+1 );
426 
427                 aHelpStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " / " ));
428                 aHelpStr += String::CreateFromInt32( nTotalPages );
429             }
430 
431             aRect.Left()    = aPos.X() - 8;
432             aRect.Top()	    = aMousePos.Y();
433             aRect.Right() 	= aRect.Left();
434             aRect.Top()		= aRect.Top();
435             nAlign		    = QUICKHELP_BOTTOM|QUICKHELP_CENTER;
436             Help::ShowQuickHelp( pScroll->GetParent(), aRect, aHelpStr, nAlign );
437         }
438     }
439 
440 	return 0;
441 }
442 
ScrollCommand(const CommandEvent & rCEvt)443 sal_Bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt )
444 {
445 	sal_Bool bDone = sal_False;
446 	const CommandWheelData* pData = rCEvt.GetWheelData();
447 	if ( pData && pData->GetMode() == COMMAND_WHEEL_ZOOM )
448 	{
449 		long nOld = pPreview->GetZoom();
450 		long nNew = nOld;
451 		if ( pData->GetDelta() < 0 )
452 			nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
453 		else
454 			nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
455 
456 		if ( nNew != nOld )
457 		{
458 			eZoom = SVX_ZOOM_PERCENT;
459 			pPreview->SetZoom( (sal_uInt16)nNew );
460 		}
461 
462 		bDone = sal_True;
463 	}
464 	else
465 	{
466 		bDone = pPreview->HandleScrollCommand( rCEvt, pHorScroll, pVerScroll );
467 	}
468 
469 	return bDone;
470 }
471 
GetPrinter(sal_Bool bCreate)472 SfxPrinter* __EXPORT ScPreviewShell::GetPrinter( sal_Bool bCreate )
473 {
474 	return pDocShell->GetPrinter(bCreate);
475 }
476 
SetPrinter(SfxPrinter * pNewPrinter,sal_uInt16 nDiffFlags,bool)477 sal_uInt16 __EXPORT ScPreviewShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool )
478 {
479 	return pDocShell->SetPrinter( pNewPrinter, nDiffFlags );
480 }
481 
CreatePrintOptionsPage(Window * pParent,const SfxItemSet & rOptions)482 SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions )
483 {
484 	ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
485 	DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
486 	//CHINA001 return ScTpPrintOptions::Create( pParent, rOptions );
487 	::CreateTabPage ScTpPrintOptionsCreate = 	pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
488 	if ( ScTpPrintOptionsCreate )
489 		return  (*ScTpPrintOptionsCreate)( pParent, rOptions);
490 	return 0;
491 }
492 
493 //------------------------------------------------------------------------
494 
Activate(sal_Bool bMDI)495 void __EXPORT ScPreviewShell::Activate(sal_Bool bMDI)
496 {
497 	SfxViewShell::Activate(bMDI);
498 
499 	//!	Basic etc. -> auslagern in eigene Datei (s. tabvwsh4)
500 
501 	if (bMDI)
502 	{
503 		// InputHdl ist jetzt meistens Null, keine Assertion mehr!
504 		ScInputHandler*	pInputHdl = SC_MOD()->GetInputHdl();
505 		if ( pInputHdl )
506 			pInputHdl->NotifyChange( NULL );
507 	}
508 }
509 
Deactivate(sal_Bool bMDI)510 void __EXPORT ScPreviewShell::Deactivate(sal_Bool bMDI)
511 {
512 	SfxViewShell::Deactivate(bMDI);
513 
514 	if (bMDI)
515 	{
516 	}
517 }
518 
519 //------------------------------------------------------------------------
520 
Execute(SfxRequest & rReq)521 void __EXPORT ScPreviewShell::Execute( SfxRequest& rReq )
522 {
523 	sal_uInt16 nSlot = rReq.GetSlot();
524 	const SfxItemSet* pReqArgs = rReq.GetArgs();
525 
526 	switch ( nSlot )
527 	{
528 		case SID_FORMATPAGE:
529 		case SID_STATUS_PAGESTYLE:
530 		case SID_HFEDIT:
531 			pDocShell->ExecutePageStyle( *this, rReq, pPreview->GetTab() );
532 			break;
533 		case SID_REPAINT:
534 			pPreview->Invalidate();
535 			rReq.Done();
536 			break;
537 		case SID_PREV_TABLE: // Accelerator
538 		case SID_PREVIEW_PREVIOUS:
539 			{
540 				long nPage = pPreview->GetPageNo();
541 				long nTotal = pPreview->GetTotalPages();
542 				if (nTotal && nPage > 0)
543 					pPreview->SetPageNo( nPage-1 );
544 			}
545 			break;
546 		case SID_NEXT_TABLE: // Accelerator
547 		case SID_PREVIEW_NEXT:
548 			{
549 				sal_Bool bAllTested	= pPreview->AllTested();
550 				long nPage = pPreview->GetPageNo();
551 				long nTotal = pPreview->GetTotalPages();
552 				if (nTotal && (nPage+1 < nTotal || !bAllTested))
553 					pPreview->SetPageNo( nPage+1 );
554 			}
555 			break;
556 		case SID_CURSORTOPOFFILE: // Accelerator
557 		case SID_PREVIEW_FIRST:
558 			{
559 				long nPage = pPreview->GetPageNo();
560 				long nTotal = pPreview->GetTotalPages();
561 				if (nTotal && nPage != 0)
562 					pPreview->SetPageNo( 0 );
563 			}
564 			break;
565 		case SID_CURSORENDOFFILE: // Accelerator
566 		case SID_PREVIEW_LAST:
567 			{
568 				if (!pPreview->AllTested())
569 					pPreview->CalcAll();
570 
571 				long nPage = pPreview->GetPageNo();
572 				long nTotal = pPreview->GetTotalPages();
573 				if (nTotal && nPage+1 != nTotal)
574 					pPreview->SetPageNo( nTotal-1 );
575 			}
576 			break;
577 		case SID_ATTR_ZOOM:
578 		case FID_SCALE:
579 			{
580 				sal_uInt16		nZoom		= 100;
581 				sal_Bool		bCancel		= sal_False;
582 
583 				eZoom = SVX_ZOOM_PERCENT;
584 
585 				if ( pReqArgs )
586 				{
587 
588 					const SvxZoomItem& rZoomItem = (const SvxZoomItem&)
589 												   pReqArgs->Get(SID_ATTR_ZOOM);
590 
591 					eZoom = rZoomItem.GetType();
592 					nZoom = rZoomItem.GetValue();
593 				}
594 				else
595 				{
596 					SfxItemSet		aSet	 ( GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
597 					SvxZoomItem		aZoomItem( SVX_ZOOM_PERCENT, pPreview->GetZoom(), SID_ATTR_ZOOM );
598 
599 					aSet.Put( aZoomItem );
600 					//CHINA001 SvxZoomDialog* pDlg = pDlg = new SvxZoomDialog( NULL, aSet );
601 					SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
602 					if(pFact)
603 					{
604 						AbstractSvxZoomDialog* pDlg = pFact->CreateSvxZoomDialog(NULL, aSet);
605 						DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
606 						pDlg->SetLimits( 20, 400 );
607 						pDlg->HideButton( ZOOMBTN_OPTIMAL );
608 						bCancel = ( RET_CANCEL == pDlg->Execute() );
609 
610 						if ( !bCancel )
611 						{
612 							const SvxZoomItem&	rZoomItem = (const SvxZoomItem&)
613 													pDlg->GetOutputItemSet()->
614 														Get( SID_ATTR_ZOOM );
615 
616 							eZoom = rZoomItem.GetType();
617 							nZoom = rZoomItem.GetValue();
618 						}
619 
620 						delete pDlg;
621 					}
622 				}
623 
624 				if ( !bCancel )
625 				{
626 					switch ( eZoom )
627 					{
628 						case SVX_ZOOM_OPTIMAL:
629 						case SVX_ZOOM_WHOLEPAGE:
630 							nZoom = pPreview->GetOptimalZoom(sal_False);
631 							break;
632 						case SVX_ZOOM_PAGEWIDTH:
633 							nZoom = pPreview->GetOptimalZoom(sal_True);
634 							break;
635                         default:
636                         {
637                             // added to avoid warnings
638                         }
639 					}
640 
641 					pPreview->SetZoom( nZoom );
642 					rReq.Done();
643 				}
644 			}
645 			break;
646 		case SID_PREVIEW_ZOOMIN:
647 			{
648 				sal_uInt16 nNew = pPreview->GetZoom() + 20 ;
649 				nNew -= nNew % 20;
650 				pPreview->SetZoom( nNew );
651 				eZoom = SVX_ZOOM_PERCENT;
652 				rReq.Done();
653 			}
654 			break;
655 		case SID_PREVIEW_ZOOMOUT:
656 			{
657 				sal_uInt16 nNew = pPreview->GetZoom() - 1;
658 				nNew -= nNew % 20;
659 				pPreview->SetZoom( nNew );
660 				eZoom = SVX_ZOOM_PERCENT;
661 				rReq.Done();
662 			}
663 			break;
664         case SID_PREVIEW_MARGIN:
665             {
666                 sal_Bool bMargin = pPreview->GetPageMargins();
667                 pPreview->SetPageMargins( !bMargin );
668                 pPreview->Invalidate();
669                 rReq.Done();
670             }
671             break;
672         case SID_ATTR_ZOOMSLIDER:
673             {
674                 const SfxPoolItem* pItem;
675                 eZoom = SVX_ZOOM_PERCENT;
676                 if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_ZOOMSLIDER, sal_True, &pItem ) )
677                 {
678                     const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem*)pItem)->GetValue();
679                     if( nCurrentZoom )
680                     {
681                         pPreview->SetZoom( nCurrentZoom );
682                         rReq.Done();
683                     }
684                 }
685             }
686             break;
687         case SID_PREVIEW_SCALINGFACTOR:
688             {
689                 const SfxPoolItem* pItem;
690                 SCTAB nTab                      = pPreview->GetTab();
691                 String aOldName                 = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() );
692                 ScStyleSheetPool* pStylePool    = pDocShell->GetDocument()->GetStyleSheetPool();
693                 SfxStyleSheetBase* pStyleSheet  = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE );
694                 DBG_ASSERT( pStyleSheet, "PageStyle not found! :-/" );
695 
696                 if ( pReqArgs && pStyleSheet && SFX_ITEM_SET == pReqArgs->GetItemState( SID_PREVIEW_SCALINGFACTOR, sal_True, &pItem ) )
697                 {
698                     const sal_uInt16 nCurrentZoom   = ((const SvxZoomSliderItem *)pItem)->GetValue();
699                     SfxItemSet& rSet            = pStyleSheet->GetItemSet();
700                     rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nCurrentZoom ) );
701                     ScPrintFunc aPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab );
702                     aPrintFunc.UpdatePages();
703                     rReq.Done();
704                 }
705                 GetViewFrame()->GetBindings().Invalidate( nSlot );
706             }
707             break;
708 		case SID_PRINTPREVIEW:
709 		case SID_PREVIEW_CLOSE:
710 			//	print preview is now always in the same frame as the tab view
711 			//	-> always switch this frame back to normal view
712 			//	(ScTabViewShell ctor reads stored view data)
713 
714             GetViewFrame()->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_ASYNCHRON );
715 			break;
716 		case SID_CURSORPAGEUP:
717 		case SID_CURSORPAGEDOWN:
718 		case SID_CURSORHOME:
719 		case SID_CURSOREND:
720 		case SID_CURSORUP:
721 		case SID_CURSORDOWN:
722 		case SID_CURSORLEFT:
723 		case SID_CURSORRIGHT:
724 			DoScroll( nSlot );
725 			break;
726         case SID_CANCEL:
727             if( ScViewUtil::IsFullScreen( *this ) )
728                 ScViewUtil::SetFullScreen( *this, false );
729             break;
730 
731 		default:
732 			break;
733 	}
734 }
735 
GetState(SfxItemSet & rSet)736 void __EXPORT ScPreviewShell::GetState( SfxItemSet& rSet )
737 {
738 	pPreview->SetInGetState(sal_True);
739 
740 	SCTAB nTab		= pPreview->GetTab();
741 	long nPage		= pPreview->GetPageNo();
742 	long nTotal		= pPreview->GetTotalPages();
743 	sal_uInt16 nZoom	= pPreview->GetZoom();
744 	sal_Bool bAllTested	= pPreview->AllTested();
745 
746 	SfxWhichIter aIter(rSet);
747 	sal_uInt16 nWhich = aIter.FirstWhich();
748 	while ( nWhich )
749 	{
750 		switch (nWhich)
751 		{
752 			case SID_STATUS_PAGESTYLE:
753 			case SID_HFEDIT:
754 				pDocShell->GetStatePageStyle( *this, rSet, nTab );
755 				break;
756 			case SID_UNDO:
757 			case SID_REDO:
758 			case SID_REPEAT:
759 				rSet.DisableItem(nWhich);
760 				break;
761 			case SID_PREVIEW_PREVIOUS:
762 			case SID_PREVIEW_FIRST:
763 				if (!nTotal || nPage==0)
764 					rSet.DisableItem(nWhich);
765 				break;
766 			case SID_PREVIEW_NEXT:
767 			case SID_PREVIEW_LAST:
768 				if (bAllTested)
769 					if (!nTotal || nPage==nTotal-1)
770 						rSet.DisableItem(nWhich);
771 				break;
772 			case SID_PREVIEW_ZOOMIN:
773 				if (nZoom >= 400)
774 					rSet.DisableItem(nWhich);
775 				break;
776 			case SID_PREVIEW_ZOOMOUT:
777 				if (nZoom <= 20)
778 					rSet.DisableItem(nWhich);
779 				break;
780 			case SID_ATTR_ZOOM:
781 				{
782 					SvxZoomItem aZoom( eZoom, nZoom, nWhich );
783 					aZoom.SetValueSet( SVX_ZOOM_ENABLE_ALL & ~SVX_ZOOM_ENABLE_OPTIMAL );
784 					rSet.Put( aZoom );
785 				}
786 				break;
787             case SID_ATTR_ZOOMSLIDER:
788                 {
789                     SvxZoomSliderItem aZoomSliderItem( nZoom, MINZOOM, MAXZOOM, SID_ATTR_ZOOMSLIDER );
790                     aZoomSliderItem.AddSnappingPoint( 100 );
791                     rSet.Put( aZoomSliderItem );
792                 }
793                 break;
794             case SID_PREVIEW_SCALINGFACTOR:
795                 {
796                     if( pDocShell->IsReadOnly() )
797                         rSet.DisableItem( nWhich );
798                     else
799                     {
800                         String aOldName                 = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() );
801                         ScStyleSheetPool* pStylePool    = pDocShell->GetDocument()->GetStyleSheetPool();
802                         SfxStyleSheetBase* pStyleSheet  = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE );
803                         DBG_ASSERT( pStyleSheet, "PageStyle not found! :-/" );
804 
805                         if ( pStyleSheet )
806                         {
807                             SfxItemSet& rStyleSet   = pStyleSheet->GetItemSet();
808                             sal_uInt16 nCurrentZoom     = ((const SfxUInt16Item&)rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue();
809                             if( nCurrentZoom )
810                             {
811                                 SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_SCALINGFACTOR );
812                                 aZoomSliderItem.AddSnappingPoint( 100 );
813                                 rSet.Put( aZoomSliderItem );
814                             }
815                             else
816                                 rSet.DisableItem( nWhich );
817                         }
818                     }
819                 }
820                 break;
821 			case SID_STATUS_DOCPOS:
822 				rSet.Put( SfxStringItem( nWhich, pPreview->GetPosString() ) );
823 				break;
824 			case SID_PRINTPREVIEW:
825 				rSet.Put( SfxBoolItem( nWhich, sal_True ) );
826 				break;
827 			case SID_FORMATPAGE:
828             case SID_PREVIEW_MARGIN:
829                 if( pDocShell->IsReadOnly() )
830 					rSet.DisableItem( nWhich );
831 				break;
832 		}
833 
834 		nWhich = aIter.NextWhich();
835 	}
836 
837 	pPreview->SetInGetState(sal_False);
838 }
839 
FillFieldData(ScHeaderFieldData & rData)840 void ScPreviewShell::FillFieldData( ScHeaderFieldData& rData )
841 {
842 	ScDocument* pDoc = pDocShell->GetDocument();
843 	SCTAB nTab = pPreview->GetTab();
844 	pDoc->GetName( nTab, rData.aTabName );
845 
846 	rData.aTitle		= pDocShell->GetTitle();
847 	const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
848 	rData.aLongDocName	= rURLObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
849 	if ( rData.aLongDocName.Len() )
850 		rData.aShortDocName = rURLObj.GetName( INetURLObject::DECODE_UNAMBIGUOUS );
851 	else
852 		rData.aShortDocName = rData.aLongDocName = rData.aTitle;
853 	rData.nPageNo		= pPreview->GetPageNo() + 1;
854 
855 	sal_Bool bAllTested	= pPreview->AllTested();
856 	if (bAllTested)
857 		rData.nTotalPages = pPreview->GetTotalPages();
858 	else
859 		rData.nTotalPages = 99;
860 
861 	//	eNumType kennt der Dialog selber
862 }
863 
WriteUserData(String & rData,sal_Bool)864 void __EXPORT ScPreviewShell::WriteUserData(String& rData, sal_Bool /* bBrowse */)
865 {
866 	//	nZoom
867 	//	nPageNo
868 
869 	rData =  String::CreateFromInt32(pPreview->GetZoom());
870 	rData += (sal_Unicode) SC_USERDATA_SEP;
871 	rData += String::CreateFromInt32(pPreview->GetPageNo());
872 }
873 
ReadUserData(const String & rData,sal_Bool)874 void __EXPORT ScPreviewShell::ReadUserData(const String& rData, sal_Bool /* bBrowse */)
875 {
876 	xub_StrLen nCount = rData.GetTokenCount();
877 	if (nCount)
878 	{
879 		xub_StrLen nIndex = 0;
880 		pPreview->SetZoom((sal_uInt16)rData.GetToken( 0, SC_USERDATA_SEP, nIndex ).ToInt32());
881 		pPreview->SetPageNo(rData.GetToken( 0, SC_USERDATA_SEP, nIndex ).ToInt32());
882 		eZoom = SVX_ZOOM_PERCENT;
883 	}
884 }
885 
WriteUserDataSequence(uno::Sequence<beans::PropertyValue> & rSeq,sal_Bool)886 void __EXPORT ScPreviewShell::WriteUserDataSequence(uno::Sequence < beans::PropertyValue >& rSeq, sal_Bool /* bBrowse */)
887 {
888 	rSeq.realloc(3);
889 	beans::PropertyValue* pSeq = rSeq.getArray();
890 	if(pSeq)
891 	{
892 		sal_uInt16 nViewID(GetViewFrame()->GetCurViewId());
893 		pSeq[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VIEWID));
894 		rtl::OUStringBuffer sBuffer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_VIEW)));
895 		SvXMLUnitConverter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID));
896 		pSeq[0].Value <<= sBuffer.makeStringAndClear();
897 		pSeq[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ZOOMVALUE));
898 		pSeq[1].Value <<= sal_Int32 (pPreview->GetZoom());
899 		pSeq[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
900 		pSeq[2].Value <<= pPreview->GetPageNo();
901 	}
902 }
903 
ReadUserDataSequence(const uno::Sequence<beans::PropertyValue> & rSeq,sal_Bool)904 void __EXPORT ScPreviewShell::ReadUserDataSequence(const uno::Sequence < beans::PropertyValue >& rSeq, sal_Bool /* bBrowse */)
905 {
906 	sal_Int32 nCount(rSeq.getLength());
907 	if (nCount)
908 	{
909 		sal_Int32 nTemp = 0;
910 		const beans::PropertyValue* pSeq = rSeq.getConstArray();
911 		if(pSeq)
912 		{
913 			for(sal_Int32 i = 0; i < nCount; i++, pSeq++)
914 			{
915 				rtl::OUString sName(pSeq->Name);
916 				if(sName.compareToAscii(SC_ZOOMVALUE) == 0)
917 				{
918 					if (pSeq->Value >>= nTemp)
919 						pPreview->SetZoom(sal_uInt16(nTemp));
920 				}
921 				else if (sName.compareToAscii("PageNumber") == 0)
922 				{
923 					if (pSeq->Value >>= nTemp)
924 						pPreview->SetPageNo(nTemp);
925 				}
926 			}
927 		}
928 	}
929 }
930 
DoScroll(sal_uInt16 nMode)931 void ScPreviewShell::DoScroll( sal_uInt16 nMode )
932 {
933 	Point	aCurPos, aPrevPos;
934 
935 	long nHRange	= pHorScroll->GetRange().Max();
936 	long nHLine		= pHorScroll->GetLineSize();
937 	long nHPage		= pHorScroll->GetPageSize();
938 	long nVRange	= pVerScroll->GetRange().Max();
939 	long nVLine		= pVerScroll->GetLineSize();
940 	long nVPage		= pVerScroll->GetPageSize();
941 
942 	aCurPos.X() = pHorScroll->GetThumbPos();
943 	aCurPos.Y() = pVerScroll->GetThumbPos();
944 	aPrevPos = aCurPos;
945 
946 	long nThumbPos	= pVerScroll->GetThumbPos();
947 	long nRangeMax	= pVerScroll->GetRangeMax();
948 
949 	switch( nMode )
950 	{
951         case SID_CURSORUP:
952             if( nMaxVertPos<0 )
953             {
954                 long nPage = pPreview->GetPageNo();
955 
956                 if( nPage>0 )
957                 {
958                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
959                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_PREVIOUS );
960                     Execute( aSfxRequest );
961                 }
962             }
963             else
964                 aCurPos.Y() -= nVLine;
965             break;
966         case SID_CURSORDOWN:
967             if( nMaxVertPos<0 )
968             {
969                 long nPage = pPreview->GetPageNo();
970                 long nTotal = pPreview->GetTotalPages();
971 
972                 // before testing for last page, make sure all page counts are calculated
973                 if ( nPage+1 == nTotal && !pPreview->AllTested() )
974                 {
975                     pPreview->CalcAll();
976                     nTotal = pPreview->GetTotalPages();
977                 }
978 
979                 if( nPage<nTotal-1 )
980                 {
981                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
982                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_NEXT );
983                     Execute( aSfxRequest );
984                 }
985             }
986             else
987                 aCurPos.Y() += nVLine;
988             break;
989         case SID_CURSORLEFT:
990             aCurPos.X() -= nHLine;
991             break;
992         case SID_CURSORRIGHT:
993             aCurPos.X() += nHLine;
994             break;
995         case SID_CURSORPAGEUP:
996             if( nThumbPos==0 || nMaxVertPos<0 )
997             {
998                 long nPage = pPreview->GetPageNo();
999 
1000                 if( nPage>0 )
1001                 {
1002                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
1003                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_PREVIOUS );
1004                     Execute( aSfxRequest );
1005                     aCurPos.Y() = nVRange;
1006                 }
1007             }
1008             else
1009                 aCurPos.Y() -= nVPage;
1010             break;
1011         case SID_CURSORPAGEDOWN:
1012             if( (abs(nVPage+nThumbPos-nRangeMax)<10) || nMaxVertPos<0 )
1013             {
1014                 long nPage = pPreview->GetPageNo();
1015                 long nTotal = pPreview->GetTotalPages();
1016 
1017                 // before testing for last page, make sure all page counts are calculated
1018                 if ( nPage+1 == nTotal && !pPreview->AllTested() )
1019                 {
1020                     pPreview->CalcAll();
1021                     nTotal = pPreview->GetTotalPages();
1022                 }
1023                 if( nPage<nTotal-1 )
1024                 {
1025                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
1026                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_NEXT );
1027                     Execute( aSfxRequest );
1028                     aCurPos.Y() = 0;
1029                 }
1030             }
1031             else
1032                 aCurPos.Y() += nVPage;
1033             break;
1034         case SID_CURSORHOME:
1035             if( nMaxVertPos<0 )
1036             {
1037                 long nPage  = pPreview->GetPageNo();
1038                 long nTotal = pPreview->GetTotalPages();
1039                 if( nTotal && nPage != 0 )
1040                 {
1041                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
1042                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_FIRST );
1043                     Execute( aSfxRequest );
1044                 }
1045             }
1046             else
1047             {
1048                 aCurPos.Y() = 0;
1049                 aCurPos.X() = 0;
1050             }
1051             break;
1052         case SID_CURSOREND:
1053             if( nMaxVertPos<0 )
1054             {
1055                 if( !pPreview->AllTested() )
1056                     pPreview->CalcAll();
1057                 long nPage  = pPreview->GetPageNo();
1058                 long nTotal = pPreview->GetTotalPages();
1059                 if( nTotal && nPage+1 != nTotal )
1060                 {
1061                     SfxViewFrame* pSfxViewFrame = GetViewFrame();
1062                     SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_LAST );
1063                     Execute( aSfxRequest );
1064                 }
1065             }
1066             else
1067             {
1068                 aCurPos.Y() = nVRange;
1069                 aCurPos.X() = nHRange;
1070             }
1071             break;
1072 	}
1073 
1074 		// nHRange-nHPage kann negativ sein, deshalb Abfrage auf < 0 hinterher
1075 
1076     if( aCurPos.Y() > (nVRange-nVPage) )
1077         aCurPos.Y() = (nVRange-nVPage);
1078     if( aCurPos.Y() < 0 )
1079         aCurPos.Y() = 0;
1080     if( aCurPos.X() > (nHRange-nHPage) )
1081         aCurPos.X() = (nHRange-nHPage);
1082     if( aCurPos.X() < 0 )
1083         aCurPos.X() = 0;
1084 
1085     if( nMaxVertPos>=0 )
1086     {
1087 	    if( aCurPos.Y() != aPrevPos.Y() )
1088 	    {
1089 	    	pVerScroll->SetThumbPos( aCurPos.Y() );
1090 	        pPreview->SetYOffset( aCurPos.Y() );
1091 	    }
1092     }
1093 
1094 	if( aCurPos.X() != aPrevPos.X() )
1095 	{
1096 		pHorScroll->SetThumbPos( aCurPos.X() );
1097 		pPreview->SetXOffset( aCurPos.X() );
1098 	}
1099 
1100 }
1101 
AddAccessibilityObject(SfxListener & rObject)1102 void ScPreviewShell::AddAccessibilityObject( SfxListener& rObject )
1103 {
1104 	if (!pAccessibilityBroadcaster)
1105 		pAccessibilityBroadcaster = new SfxBroadcaster;
1106 
1107 	rObject.StartListening( *pAccessibilityBroadcaster );
1108 }
1109 
RemoveAccessibilityObject(SfxListener & rObject)1110 void ScPreviewShell::RemoveAccessibilityObject( SfxListener& rObject )
1111 {
1112 	if (pAccessibilityBroadcaster)
1113 		rObject.EndListening( *pAccessibilityBroadcaster );
1114 	else
1115 	{
1116 		DBG_ERROR("kein Accessibility-Broadcaster?");
1117 	}
1118 }
1119 
BroadcastAccessibility(const SfxHint & rHint)1120 void ScPreviewShell::BroadcastAccessibility( const SfxHint &rHint )
1121 {
1122 	if (pAccessibilityBroadcaster)
1123 		pAccessibilityBroadcaster->Broadcast( rHint );
1124 }
1125 
HasAccessibilityObjects()1126 sal_Bool ScPreviewShell::HasAccessibilityObjects()
1127 {
1128 	return pAccessibilityBroadcaster && pAccessibilityBroadcaster->HasListeners();
1129 }
1130 
GetLocationData()1131 const ScPreviewLocationData& ScPreviewShell::GetLocationData()
1132 {
1133 	return pPreview->GetLocationData();
1134 }
1135 
GetDocument()1136 ScDocument* ScPreviewShell::GetDocument()
1137 {
1138 	return pDocShell->GetDocument();
1139 }
1140 
1141 
1142