From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- svx/source/sidebar/area/AreaPropertyPanel.cxx | 158 ++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 svx/source/sidebar/area/AreaPropertyPanel.cxx (limited to 'svx/source/sidebar/area/AreaPropertyPanel.cxx') diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx new file mode 100644 index 000000000..fa634ee44 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "AreaPropertyPanel.hxx" +#include +#include +#include +#include +#include + + +using namespace css; +using namespace css::uno; + +namespace svx::sidebar { + +AreaPropertyPanel::AreaPropertyPanel( + weld::Widget* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings) + : AreaPropertyPanelBase(pParent, rxFrame), + maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this), + maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this), + maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this), + maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this), + maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this), + maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), + maHatchListControl(SID_HATCH_LIST, *pBindings, *this), + maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), + maPatternListControl(SID_PATTERN_LIST, *pBindings, *this), + maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), + maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), + maFillUseSlideBackgroundController(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, *pBindings, *this), + mpBindings(pBindings) +{ +} + +AreaPropertyPanel::~AreaPropertyPanel() +{ + maStyleControl.dispose(); + maColorControl.dispose(); + maGradientControl.dispose(); + maHatchControl.dispose(); + maBitmapControl.dispose(); + maGradientListControl.dispose(); + maHatchListControl.dispose(); + maBitmapListControl.dispose(); + maPatternListControl.dispose(); + maFillTransparenceController.dispose(); + maFillFloatTransparenceController.dispose(); +} + +std::unique_ptr AreaPropertyPanel::Create ( + weld::Widget* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == nullptr) + throw lang::IllegalArgumentException("no parent Window given to AreaPropertyPanel::Create", nullptr, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException("no XFrame given to AreaPropertyPanel::Create", nullptr, 1); + if (pBindings == nullptr) + throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", nullptr, 2); + + return std::make_unique(pParent, rxFrame, pBindings); +} + +void AreaPropertyPanel::setFillTransparence(const XFillTransparenceItem& rItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_TRANSPARENCE, + SfxCallMode::RECORD, { &rItem }); +} + +void AreaPropertyPanel::setFillUseBackground(const XFillStyleItem* pStyleItem, + const XFillUseSlideBackgroundItem& rItem) +{ + const SfxPoolItem* pItem = nullptr; + auto pDispatcher = GetBindings()->GetDispatcher(); + auto state = pDispatcher->QueryState(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, pItem); + // FillUseSlideBackground is only available in Impress + if (state == SfxItemState::DISABLED) + { + setFillStyle(*pStyleItem); + } + else + { + pDispatcher->ExecuteList(SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SfxCallMode::RECORD, + std::initializer_list{ &rItem, pStyleItem }); + } +} + +void AreaPropertyPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_FLOATTRANSPARENCE, + SfxCallMode::RECORD, { &rItem }); +} + +void AreaPropertyPanel::setFillStyle(const XFillStyleItem& rItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_STYLE, + SfxCallMode::RECORD, { &rItem }); +} + +void AreaPropertyPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem, + const XFillColorItem& rColorItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_COLOR, + SfxCallMode::RECORD, pStyleItem + ? std::initializer_list{ &rColorItem, pStyleItem } + : std::initializer_list{ &rColorItem }); +} + +void AreaPropertyPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem, + const XFillGradientItem& rGradientItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_GRADIENT, + SfxCallMode::RECORD, pStyleItem + ? std::initializer_list{ &rGradientItem, pStyleItem } + : std::initializer_list{ &rGradientItem }); +} + +void AreaPropertyPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem, + const XFillHatchItem& rHatchItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_HATCH, + SfxCallMode::RECORD, pStyleItem + ? std::initializer_list{ &rHatchItem, pStyleItem } + : std::initializer_list{ &rHatchItem }); +} + +void AreaPropertyPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, + const XFillBitmapItem& rBitmapItem) +{ + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_FILL_BITMAP, + SfxCallMode::RECORD, pStyleItem + ? std::initializer_list{ &rBitmapItem, pStyleItem } + : std::initializer_list{ &rBitmapItem }); +} + +} // end of namespace svx::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3