xref: /trunk/main/sw/source/ui/uiview/viewcoll.cxx (revision 78190a370f7d7129fed9a7e70ca122eaae71ce1d)
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 "cmdid.h"
26 #include "uiitems.hxx"
27 #include <tools/list.hxx>
28 #include <vcl/window.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <svl/stritem.hxx>
32 #include <rsc/rscsfx.hxx>
33 
34 #include "errhdl.hxx"
35 #include "view.hxx"
36 #include "wrtsh.hxx"
37 #include "basesh.hxx"
38 
39 void SwView::ExecColl(SfxRequest &rReq)
40 {
41     const SfxItemSet* pArgs = rReq.GetArgs();
42     const SfxPoolItem* pItem = 0;
43     sal_uInt16 nWhich = rReq.GetSlot();
44     switch( nWhich )
45     {
46         case FN_SET_PAGE:
47         {
48             DBG_ASSERT(sal_False, "Not implemented");
49         }
50         break;
51         case FN_SET_PAGE_STYLE:
52         {
53             if( pArgs )
54             {
55                 if (pArgs &&
56                     SFX_ITEM_SET == pArgs->GetItemState( nWhich , sal_True, &pItem ))
57                 {
58                     if( ((SfxStringItem*)pItem)->GetValue() !=
59                                             GetWrtShell().GetCurPageStyle(sal_False) )
60                     {
61                         SfxStringItem aName(SID_STYLE_APPLY,
62                                     ((SfxStringItem*)pItem)->GetValue());
63                         SfxUInt16Item aFamItem( SID_STYLE_FAMILY,
64                                             SFX_STYLE_FAMILY_PAGE);
65                         SwPtrItem aShell(FN_PARAM_WRTSHELL, GetWrtShellPtr());
66                         SfxRequest aReq(SID_STYLE_APPLY, 0, GetPool());
67                         aReq.AppendItem(aName);
68                         aReq.AppendItem(aFamItem);
69                         aReq.AppendItem(aShell);
70                         GetCurShell()->ExecuteSlot(aReq);
71                     }
72                 }
73             }
74             else
75             {
76                 SfxRequest aReq(FN_FORMAT_PAGE_DLG, 0, GetPool());
77                 GetCurShell()->ExecuteSlot(aReq);
78             }
79         }
80         break;
81         default:
82             ASSERT(sal_False, falscher CommandProcessor fuer Dispatch);
83             return;
84     }
85 }
86 
87 /* vim: set noet sw=4 ts=4: */
88