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