Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / dlg / morphdlg.cxx
blob434a57d7f03450483ffb12cfc47c1ded56fa3a91
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 <morphdlg.hxx>
22 #include <sdmod.hxx>
23 #include <sdiocmpt.hxx>
24 #include <svx/xfillit0.hxx>
25 #include <svx/xlineit0.hxx>
26 #include <svx/xenum.hxx>
27 #include <svx/svdobj.hxx>
28 #include <svl/itemset.hxx>
29 #include <svl/itempool.hxx>
30 #include <com/sun/star/drawing/LineStyle.hpp>
32 using namespace com::sun::star;
34 namespace sd {
36 MorphDlg::MorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
37 : GenericDialogController(pParent, "modules/sdraw/ui/crossfadedialog.ui", "CrossFadeDialog")
38 , m_xMtfSteps(m_xBuilder->weld_spin_button("increments"))
39 , m_xCbxAttributes(m_xBuilder->weld_check_button("attributes"))
40 , m_xCbxOrientation(m_xBuilder->weld_check_button("orientation"))
42 LoadSettings();
44 SfxItemPool & rPool = pObj1->GetObjectItemPool();
45 SfxItemSet aSet1( rPool );
46 SfxItemSet aSet2( rPool );
48 aSet1.Put(pObj1->GetMergedItemSet());
49 aSet2.Put(pObj2->GetMergedItemSet());
51 const drawing::LineStyle eLineStyle1 = aSet1.Get( XATTR_LINESTYLE ).GetValue();
52 const drawing::LineStyle eLineStyle2 = aSet2.Get( XATTR_LINESTYLE ).GetValue();
53 const drawing::FillStyle eFillStyle1 = aSet1.Get( XATTR_FILLSTYLE ).GetValue();
54 const drawing::FillStyle eFillStyle2 = aSet2.Get( XATTR_FILLSTYLE ).GetValue();
56 if ( ( ( eLineStyle1 == drawing::LineStyle_NONE ) || ( eLineStyle2 == drawing::LineStyle_NONE ) ) &&
57 ( ( eFillStyle1 != drawing::FillStyle_SOLID ) || ( eFillStyle2 != drawing::FillStyle_SOLID ) ) )
59 m_xCbxAttributes->set_sensitive(false);
63 MorphDlg::~MorphDlg()
67 void MorphDlg::LoadSettings()
69 tools::SvRef<SotStorageStream> xIStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING ,
70 SD_OPTION_LOAD ) );
71 sal_uInt16 nSteps;
72 bool bOrient, bAttrib;
74 if( xIStm.is() )
76 SdIOCompat aCompat( *xIStm, StreamMode::READ );
78 xIStm->ReadUInt16( nSteps ).ReadCharAsBool( bOrient ).ReadCharAsBool( bAttrib );
80 else
82 nSteps = 16;
83 bOrient = bAttrib = true;
86 m_xMtfSteps->set_value(nSteps);
87 m_xCbxOrientation->set_active(bOrient);
88 m_xCbxAttributes->set_active(bAttrib);
91 void MorphDlg::SaveSettings() const
93 tools::SvRef<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING ,
94 SD_OPTION_STORE ) );
96 if( xOStm.is() )
98 SdIOCompat aCompat( *xOStm, StreamMode::WRITE, 1 );
100 xOStm->WriteUInt16( m_xMtfSteps->get_value() )
101 .WriteBool( m_xCbxOrientation->get_active() )
102 .WriteBool( m_xCbxAttributes->get_active() );
106 } // end of namespace sd
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */