bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / sidebar / area / AreaPropertyPanel.cxx
blobb4d22f6823ab0a8633dc7d3189236cb3badf7cba
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 using namespace css;
29 using namespace css::uno;
31 namespace svx::sidebar {
33 AreaPropertyPanel::AreaPropertyPanel(
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 mpBindings(pBindings)
53 AreaPropertyPanel::~AreaPropertyPanel()
55 maStyleControl.dispose();
56 maColorControl.dispose();
57 maGradientControl.dispose();
58 maHatchControl.dispose();
59 maBitmapControl.dispose();
60 maGradientListControl.dispose();
61 maHatchListControl.dispose();
62 maBitmapListControl.dispose();
63 maPatternListControl.dispose();
64 maFillTransparenceController.dispose();
65 maFillFloatTransparenceController.dispose();
68 std::unique_ptr<PanelLayout> AreaPropertyPanel::Create (
69 weld::Widget* pParent,
70 const css::uno::Reference<css::frame::XFrame>& rxFrame,
71 SfxBindings* pBindings)
73 if (pParent == nullptr)
74 throw lang::IllegalArgumentException("no parent Window given to AreaPropertyPanel::Create", nullptr, 0);
75 if ( ! rxFrame.is())
76 throw lang::IllegalArgumentException("no XFrame given to AreaPropertyPanel::Create", nullptr, 1);
77 if (pBindings == nullptr)
78 throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", nullptr, 2);
80 return std::make_unique<AreaPropertyPanel>(pParent, rxFrame, pBindings);
83 void AreaPropertyPanel::setFillTransparence(const XFillTransparenceItem& rItem)
85 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_TRANSPARENCE,
86 SfxCallMode::RECORD, { &rItem });
89 void AreaPropertyPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& rItem)
91 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE,
92 SfxCallMode::RECORD, { &rItem });
95 void AreaPropertyPanel::setFillStyle(const XFillStyleItem& rItem)
97 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_STYLE,
98 SfxCallMode::RECORD, { &rItem });
101 void AreaPropertyPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
102 const XFillColorItem& rColorItem)
104 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_COLOR,
105 SfxCallMode::RECORD, pStyleItem
106 ? std::initializer_list<SfxPoolItem const*>{ &rColorItem, pStyleItem }
107 : std::initializer_list<SfxPoolItem const*>{ &rColorItem });
110 void AreaPropertyPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
111 const XFillGradientItem& rGradientItem)
113 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_GRADIENT,
114 SfxCallMode::RECORD, pStyleItem
115 ? std::initializer_list<SfxPoolItem const*>{ &rGradientItem, pStyleItem }
116 : std::initializer_list<SfxPoolItem const*>{ &rGradientItem });
119 void AreaPropertyPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
120 const XFillHatchItem& rHatchItem)
122 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_HATCH,
123 SfxCallMode::RECORD, pStyleItem
124 ? std::initializer_list<SfxPoolItem const*>{ &rHatchItem, pStyleItem }
125 : std::initializer_list<SfxPoolItem const*>{ &rHatchItem });
128 void AreaPropertyPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
129 const XFillBitmapItem& rBitmapItem)
131 GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_BITMAP,
132 SfxCallMode::RECORD, pStyleItem
133 ? std::initializer_list<SfxPoolItem const*>{ &rBitmapItem, pStyleItem }
134 : std::initializer_list<SfxPoolItem const*>{ &rBitmapItem });
137 } // end of namespace svx::sidebar
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */