LibreOffice Module sw (master)  1
viewcoll.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <cmdid.h>
21 #include <uiitems.hxx>
22 #include <sfx2/bindings.hxx>
23 #include <sfx2/request.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <svl/stritem.hxx>
26 #include <svl/style.hxx>
27 
28 #include <view.hxx>
29 #include <wrtsh.hxx>
30 #include <basesh.hxx>
31 
32 void SwView::ExecColl(SfxRequest const &rReq)
33 {
34  const SfxItemSet* pArgs = rReq.GetArgs();
35  const SfxPoolItem* pItem = nullptr;
36  sal_uInt16 nWhich = rReq.GetSlot();
37  switch( nWhich )
38  {
39  case FN_SET_PAGE:
40  {
41  OSL_ENSURE(false, "Not implemented");
42  }
43  break;
44  case FN_SET_PAGE_STYLE:
45  {
46  if( pArgs )
47  {
48  if (SfxItemState::SET == pArgs->GetItemState( nWhich , true, &pItem ))
49  {
50  if( static_cast<const SfxStringItem*>(pItem)->GetValue() !=
52  {
53  SfxStringItem aName(SID_STYLE_APPLY,
54  static_cast<const SfxStringItem*>(pItem)->GetValue());
55  SfxUInt16Item aFamItem( SID_STYLE_FAMILY,
56  sal_uInt16(SfxStyleFamily::Page));
58  SfxRequest aReq(SID_STYLE_APPLY, SfxCallMode::SLOT, GetPool());
59  aReq.AppendItem(aName);
60  aReq.AppendItem(aFamItem);
61  aReq.AppendItem(aShell);
62  GetCurShell()->ExecuteSlot(aReq);
63  }
64  }
65  }
66  else
67  {
68  SfxRequest aReq(FN_FORMAT_PAGE_DLG, SfxCallMode::SLOT, GetPool());
69  GetCurShell()->ExecuteSlot(aReq);
70  }
71  }
72  break;
73  default:
74  OSL_FAIL("wrong CommandProcessor for Dispatch");
75  return;
76  }
77 }
78 
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1545
#define FN_SET_PAGE_STYLE
Definition: cmdid.h:322
std::string GetValue
const SfxItemSet * GetArgs() const
#define FN_SET_PAGE
Definition: cmdid.h:163
SfxShell * GetCurShell()
Definition: view.hxx:562
SwWrtShell & GetWrtShell() const
Definition: view.hxx:400
SfxItemPool & GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define FN_PARAM_WRTSHELL
Definition: cmdid.h:769
sal_uInt16 GetSlot() const
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:401
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:298
OString const aName
void AppendItem(const SfxPoolItem &)
void ExecColl(SfxRequest const &)
Definition: viewcoll.cxx:32