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