LibreOffice Module svx (master)  1
AreaPropertyPanel.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 "AreaPropertyPanel.hxx"
21 #include <svx/svxids.hrc>
22 #include <svx/xfltrit.hxx>
23 #include <svx/xflftrit.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/bindings.hxx>
26 
27 
28 using namespace css;
29 using namespace css::uno;
30 
31 namespace svx::sidebar {
32 
33 AreaPropertyPanel::AreaPropertyPanel(
34  vcl::Window* pParent,
35  const css::uno::Reference<css::frame::XFrame>& rxFrame,
36  SfxBindings* pBindings)
37  : AreaPropertyPanelBase(pParent, rxFrame),
38  maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this),
39  maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this),
40  maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this),
41  maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this),
42  maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this),
43  maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this),
44  maHatchListControl(SID_HATCH_LIST, *pBindings, *this),
45  maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this),
46  maPatternListControl(SID_PATTERN_LIST, *pBindings, *this),
47  maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this),
48  maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this),
49  mpBindings(pBindings)
50 {
51 }
52 
54 {
55  disposeOnce();
56 }
57 
59 {
71 
73 }
74 
76  vcl::Window* pParent,
77  const css::uno::Reference<css::frame::XFrame>& rxFrame,
78  SfxBindings* pBindings)
79 {
80  if (pParent == nullptr)
81  throw lang::IllegalArgumentException("no parent Window given to AreaPropertyPanel::Create", nullptr, 0);
82  if ( ! rxFrame.is())
83  throw lang::IllegalArgumentException("no XFrame given to AreaPropertyPanel::Create", nullptr, 1);
84  if (pBindings == nullptr)
85  throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", nullptr, 2);
86 
88  pParent,
89  rxFrame,
90  pBindings);
91 }
92 
94 {
95  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_TRANSPARENCE,
96  SfxCallMode::RECORD, { &rItem });
97 }
98 
100 {
101  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE,
102  SfxCallMode::RECORD, { &rItem });
103 }
104 
106 {
107  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_STYLE,
108  SfxCallMode::RECORD, { &rItem });
109 }
110 
112  const XFillColorItem& rColorItem)
113 {
114  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_COLOR,
115  SfxCallMode::RECORD, pStyleItem
116  ? std::initializer_list<SfxPoolItem const*>{ &rColorItem, pStyleItem }
117  : std::initializer_list<SfxPoolItem const*>{ &rColorItem });
118 }
119 
121  const XFillGradientItem& rGradientItem)
122 {
123  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_GRADIENT,
124  SfxCallMode::RECORD, pStyleItem
125  ? std::initializer_list<SfxPoolItem const*>{ &rGradientItem, pStyleItem }
126  : std::initializer_list<SfxPoolItem const*>{ &rGradientItem });
127 }
128 
130  const XFillHatchItem& rHatchItem)
131 {
132  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_HATCH,
133  SfxCallMode::RECORD, pStyleItem
134  ? std::initializer_list<SfxPoolItem const*>{ &rHatchItem, pStyleItem }
135  : std::initializer_list<SfxPoolItem const*>{ &rHatchItem });
136 }
137 
139  const XFillBitmapItem& rBitmapItem)
140 {
141  GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_BITMAP,
142  SfxCallMode::RECORD, pStyleItem
143  ? std::initializer_list<SfxPoolItem const*>{ &rBitmapItem, pStyleItem }
144  : std::initializer_list<SfxPoolItem const*>{ &rBitmapItem });
145 }
146 
147 } // end of namespace svx::sidebar
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void setFillStyleAndBitmap(const XFillStyleItem *pStyleItem, const XFillBitmapItem &aHatchItem) override
::sfx2::sidebar::ControllerItem maBitmapListControl
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
virtual void setFillStyleAndHatch(const XFillStyleItem *pStyleItem, const XFillHatchItem &aHatchItem) override
::sfx2::sidebar::ControllerItem maFillTransparenceController
::sfx2::sidebar::ControllerItem maPatternListControl
virtual void dispose() override
::sfx2::sidebar::ControllerItem maGradientListControl
virtual void setFillStyleAndColor(const XFillStyleItem *pStyleItem, const XFillColorItem &aColorItem) override
::sfx2::sidebar::ControllerItem maHatchListControl
virtual void setFillStyleAndGradient(const XFillStyleItem *pStyleItem, const XFillGradientItem &aGradientItem) override
virtual void setFillFloatTransparence(const XFillFloatTransparenceItem &rItem) override
virtual void dispose()
static VclPtr< vcl::Window > Create(vcl::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame, SfxBindings *pBindings)
::sfx2::sidebar::ControllerItem maFillFloatTransparenceController
::sfx2::sidebar::ControllerItem maHatchControl
::sfx2::sidebar::ControllerItem maGradientControl
::sfx2::sidebar::ControllerItem maBitmapControl
virtual void setFillTransparence(const XFillTransparenceItem &rItem) override
::sfx2::sidebar::ControllerItem maColorControl
static VclPtr< reference_type > Create(Arg &&...arg)
::sfx2::sidebar::ControllerItem maStyleControl
SfxDispatcher * GetDispatcher() const
virtual void setFillStyle(const XFillStyleItem &rItem) override