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
28using namespace css;
29using namespace css::uno;
30
31namespace svx::sidebar {
32
34 weld::Widget* 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 maFillUseSlideBackgroundController(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, *pBindings, *this),
50 mpBindings(pBindings)
51{
52}
53
55{
67}
68
69std::unique_ptr<PanelLayout> AreaPropertyPanel::Create (
70 weld::Widget* pParent,
71 const css::uno::Reference<css::frame::XFrame>& rxFrame,
72 SfxBindings* pBindings)
73{
74 if (pParent == nullptr)
75 throw lang::IllegalArgumentException("no parent Window given to AreaPropertyPanel::Create", nullptr, 0);
76 if ( ! rxFrame.is())
77 throw lang::IllegalArgumentException("no XFrame given to AreaPropertyPanel::Create", nullptr, 1);
78 if (pBindings == nullptr)
79 throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", nullptr, 2);
80
81 return std::make_unique<AreaPropertyPanel>(pParent, rxFrame, pBindings);
82}
83
85{
86 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_TRANSPARENCE,
87 SfxCallMode::RECORD, { &rItem });
88}
89
91 const XFillUseSlideBackgroundItem& rItem)
92{
93 const SfxPoolItem* pItem = nullptr;
94 auto pDispatcher = GetBindings()->GetDispatcher();
95 auto state = pDispatcher->QueryState(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, pItem);
96 // FillUseSlideBackground is only available in Impress
97 if (state == SfxItemState::DISABLED)
98 {
99 setFillStyle(*pStyleItem);
100 }
101 else
102 {
103 pDispatcher->ExecuteList(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SfxCallMode::RECORD,
104 std::initializer_list<SfxPoolItem const*>{ &rItem, pStyleItem });
105 }
106}
107
109{
110 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE,
111 SfxCallMode::RECORD, { &rItem });
112}
113
115{
116 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_STYLE,
117 SfxCallMode::RECORD, { &rItem });
118}
119
121 const XFillColorItem& rColorItem)
122{
123 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_COLOR,
124 SfxCallMode::RECORD, pStyleItem
125 ? std::initializer_list<SfxPoolItem const*>{ &rColorItem, pStyleItem }
126 : std::initializer_list<SfxPoolItem const*>{ &rColorItem });
127}
128
130 const XFillGradientItem& rGradientItem)
131{
132 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_GRADIENT,
133 SfxCallMode::RECORD, pStyleItem
134 ? std::initializer_list<SfxPoolItem const*>{ &rGradientItem, pStyleItem }
135 : std::initializer_list<SfxPoolItem const*>{ &rGradientItem });
136}
137
139 const XFillHatchItem& rHatchItem)
140{
141 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_HATCH,
142 SfxCallMode::RECORD, pStyleItem
143 ? std::initializer_list<SfxPoolItem const*>{ &rHatchItem, pStyleItem }
144 : std::initializer_list<SfxPoolItem const*>{ &rHatchItem });
145}
146
148 const XFillBitmapItem& rBitmapItem)
149{
150 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_BITMAP,
151 SfxCallMode::RECORD, pStyleItem
152 ? std::initializer_list<SfxPoolItem const*>{ &rBitmapItem, pStyleItem }
153 : std::initializer_list<SfxPoolItem const*>{ &rBitmapItem });
154}
155
156} // end of namespace svx::sidebar
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxDispatcher * GetDispatcher() const
virtual void dispose()
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 * >())
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
Item to enable slide background for filled objects.
::sfx2::sidebar::ControllerItem maFillFloatTransparenceController
::sfx2::sidebar::ControllerItem maBitmapControl
virtual void setFillTransparence(const XFillTransparenceItem &rItem) override
virtual void setFillStyleAndBitmap(const XFillStyleItem *pStyleItem, const XFillBitmapItem &aHatchItem) override
::sfx2::sidebar::ControllerItem maFillTransparenceController
::sfx2::sidebar::ControllerItem maGradientListControl
::sfx2::sidebar::ControllerItem maStyleControl
virtual void setFillStyle(const XFillStyleItem &rItem) override
static std::unique_ptr< PanelLayout > Create(weld::Widget *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame, SfxBindings *pBindings)
virtual void setFillStyleAndHatch(const XFillStyleItem *pStyleItem, const XFillHatchItem &aHatchItem) override
virtual void setFillFloatTransparence(const XFillFloatTransparenceItem &rItem) override
::sfx2::sidebar::ControllerItem maBitmapListControl
::sfx2::sidebar::ControllerItem maGradientControl
::sfx2::sidebar::ControllerItem maHatchControl
AreaPropertyPanel(weld::Widget *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame, SfxBindings *pBindings)
virtual void setFillUseBackground(const XFillStyleItem *pStyleItem, const XFillUseSlideBackgroundItem &rItem) override
virtual void setFillStyleAndColor(const XFillStyleItem *pStyleItem, const XFillColorItem &aColorItem) override
virtual void setFillStyleAndGradient(const XFillStyleItem *pStyleItem, const XFillGradientItem &aGradientItem) override
::sfx2::sidebar::ControllerItem maColorControl
::sfx2::sidebar::ControllerItem maPatternListControl
::sfx2::sidebar::ControllerItem maHatchListControl