xref: /trunk/main/sw/source/ui/uiview/viewdlg.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 
33 #include "hintids.hxx"
34 #include <sfx2/viewfrm.hxx>
35 #include <editeng/tstpitem.hxx>
36 #include <svl/stritem.hxx>
37 #include <sfx2/request.hxx>
38 
39 
40 #include "view.hxx"
41 #include "wrtsh.hxx"
42 #include "basesh.hxx"
43 #include "viewopt.hxx"
44 #include "uitool.hxx"
45 #include "cmdid.h"
46 #include <sfx2/tabdlg.hxx>
47 
48 #include "pagedesc.hxx"
49 
50 
51 void SwView::ExecDlg(SfxRequest &rReq)
52 {
53     ModalDialog *pDialog = 0;
54     //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
55     const SfxPoolItem* pItem = 0;
56     const SfxItemSet* pArgs = rReq.GetArgs();
57 
58     sal_uInt16 nSlot = rReq.GetSlot();
59     if(pArgs)
60         pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem );
61 
62     switch ( nSlot )
63     {
64         case FN_CHANGE_PAGENUM:
65         {
66             if ( pItem )
67             {
68                 sal_uInt16 nValue = ((SfxUInt16Item *)pItem)->GetValue();
69                 sal_uInt16 nOldValue = pWrtShell->GetPageOffset();
70                 sal_uInt16 nPage, nLogPage;
71                 pWrtShell->GetPageNum( nPage, nLogPage,
72                    pWrtShell->IsCrsrVisible(), sal_False);
73 
74                 if(nValue != nOldValue || nValue != nLogPage)
75                 {
76                     if(!nOldValue)
77                         pWrtShell->SetNewPageOffset( nValue );
78                     else
79                         pWrtShell->SetPageOffset( nValue );
80                 }
81             }
82         }
83         break;
84 
85         default:
86             ASSERT(!this, falscher Dispatcher);
87             return;
88     }
89 
90     if( pDialog )
91     {
92         pDialog->Execute();
93         delete pDialog;
94     }
95 }
96 
97 
98 
99