xref: /trunk/main/sw/source/ui/uiview/viewdlg.cxx (revision 870262e3)
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_sw.hxx"
26 
27 
28 
29 #include "hintids.hxx"
30 #include <sfx2/viewfrm.hxx>
31 #include <editeng/tstpitem.hxx>
32 #include <svl/stritem.hxx>
33 #include <sfx2/request.hxx>
34 
35 
36 #include "view.hxx"
37 #include "wrtsh.hxx"
38 #include "basesh.hxx"
39 #include "viewopt.hxx"
40 #include "uitool.hxx"
41 #include "cmdid.h"
42 #include <sfx2/tabdlg.hxx>
43 
44 #include "pagedesc.hxx"
45 
46 
ExecDlg(SfxRequest & rReq)47 void SwView::ExecDlg(SfxRequest &rReq)
48 {
49 	ModalDialog *pDialog = 0;
50 	//Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
51 	const SfxPoolItem* pItem = 0;
52 	const SfxItemSet* pArgs = rReq.GetArgs();
53 
54 	sal_uInt16 nSlot = rReq.GetSlot();
55 	if(pArgs)
56 		pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem );
57 
58 	switch ( nSlot )
59 	{
60 		case FN_CHANGE_PAGENUM:
61 		{
62 			if ( pItem )
63 			{
64 				sal_uInt16 nValue = ((SfxUInt16Item *)pItem)->GetValue();
65 				sal_uInt16 nOldValue = pWrtShell->GetPageOffset();
66 				sal_uInt16 nPage, nLogPage;
67 				pWrtShell->GetPageNum( nPage, nLogPage,
68 				   pWrtShell->IsCrsrVisible(), sal_False);
69 
70 				if(nValue != nOldValue || nValue != nLogPage)
71 				{
72 					if(!nOldValue)
73 						pWrtShell->SetNewPageOffset( nValue );
74 					else
75 						pWrtShell->SetPageOffset( nValue );
76 				}
77 			}
78 		}
79 		break;
80 
81 		default:
82 			ASSERT(sal_False, "wrong dispatcher");
83 			return;
84 	}
85 
86 	if( pDialog )
87 	{
88 		pDialog->Execute();
89 		delete pDialog;
90 	}
91 }
92 
93 
94 
95