1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <morphdlg.hxx>
22 #include <svx/xdef.hxx>
23 #include <svx/xfillit0.hxx>
24 #include <svx/xlineit0.hxx>
25 #include <svx/svdobj.hxx>
26 #include <svl/itemset.hxx>
27 #include <com/sun/star/drawing/LineStyle.hpp>
28 #include <officecfg/Office/Draw.hxx>
30 using namespace com::sun::star
;
34 MorphDlg::MorphDlg(weld::Window
* pParent
, const SdrObject
* pObj1
, const SdrObject
* pObj2
)
35 : GenericDialogController(pParent
, u
"modules/sdraw/ui/crossfadedialog.ui"_ustr
, u
"CrossFadeDialog"_ustr
)
36 , m_xMtfSteps(m_xBuilder
->weld_spin_button(u
"increments"_ustr
))
37 , m_xCbxAttributes(m_xBuilder
->weld_check_button(u
"attributes"_ustr
))
38 , m_xCbxOrientation(m_xBuilder
->weld_check_button(u
"orientation"_ustr
))
42 SfxItemPool
& rPool
= pObj1
->GetObjectItemPool();
43 SfxItemSet
aSet1( rPool
);
44 SfxItemSet
aSet2( rPool
);
46 aSet1
.Put(pObj1
->GetMergedItemSet());
47 aSet2
.Put(pObj2
->GetMergedItemSet());
49 const drawing::LineStyle eLineStyle1
= aSet1
.Get( XATTR_LINESTYLE
).GetValue();
50 const drawing::LineStyle eLineStyle2
= aSet2
.Get( XATTR_LINESTYLE
).GetValue();
51 const drawing::FillStyle eFillStyle1
= aSet1
.Get( XATTR_FILLSTYLE
).GetValue();
52 const drawing::FillStyle eFillStyle2
= aSet2
.Get( XATTR_FILLSTYLE
).GetValue();
54 if ( ( ( eLineStyle1
== drawing::LineStyle_NONE
) || ( eLineStyle2
== drawing::LineStyle_NONE
) ) &&
55 ( ( eFillStyle1
!= drawing::FillStyle_SOLID
) || ( eFillStyle2
!= drawing::FillStyle_SOLID
) ) )
57 m_xCbxAttributes
->set_sensitive(false);
66 void MorphDlg::LoadSettings()
68 m_xMtfSteps
->set_value(officecfg::Office::Draw::Misc::CrossFading::Steps::get());
69 m_xCbxOrientation
->set_active(officecfg::Office::Draw::Misc::CrossFading::Orientation::get());
70 m_xCbxAttributes
->set_active(officecfg::Office::Draw::Misc::CrossFading::Attributes::get());
73 void MorphDlg::SaveSettings() const
75 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(
76 comphelper::ConfigurationChanges::create());
77 officecfg::Office::Draw::Misc::CrossFading::Steps::set(m_xMtfSteps
->get_value(),batch
);
78 officecfg::Office::Draw::Misc::CrossFading::Orientation::set(m_xCbxOrientation
->get_active(),batch
);
79 officecfg::Office::Draw::Misc::CrossFading::Attributes::set(m_xCbxAttributes
->get_active(),batch
);
83 } // end of namespace sd
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */