LibreOffice Module sd (master) 1
morphdlg.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 <morphdlg.hxx>
21
22#include <sdmod.hxx>
23#include <sdiocmpt.hxx>
24#include <svx/xdef.hxx>
25#include <svx/xfillit0.hxx>
26#include <svx/xlineit0.hxx>
27#include <svx/svdobj.hxx>
28#include <svl/itemset.hxx>
29#include <com/sun/star/drawing/LineStyle.hpp>
30
31using namespace com::sun::star;
32
33namespace sd {
34
35MorphDlg::MorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
36 : GenericDialogController(pParent, "modules/sdraw/ui/crossfadedialog.ui", "CrossFadeDialog")
37 , m_xMtfSteps(m_xBuilder->weld_spin_button("increments"))
38 , m_xCbxAttributes(m_xBuilder->weld_check_button("attributes"))
39 , m_xCbxOrientation(m_xBuilder->weld_check_button("orientation"))
40{
42
43 SfxItemPool & rPool = pObj1->GetObjectItemPool();
44 SfxItemSet aSet1( rPool );
45 SfxItemSet aSet2( rPool );
46
47 aSet1.Put(pObj1->GetMergedItemSet());
48 aSet2.Put(pObj2->GetMergedItemSet());
49
50 const drawing::LineStyle eLineStyle1 = aSet1.Get( XATTR_LINESTYLE ).GetValue();
51 const drawing::LineStyle eLineStyle2 = aSet2.Get( XATTR_LINESTYLE ).GetValue();
52 const drawing::FillStyle eFillStyle1 = aSet1.Get( XATTR_FILLSTYLE ).GetValue();
53 const drawing::FillStyle eFillStyle2 = aSet2.Get( XATTR_FILLSTYLE ).GetValue();
54
55 if ( ( ( eLineStyle1 == drawing::LineStyle_NONE ) || ( eLineStyle2 == drawing::LineStyle_NONE ) ) &&
56 ( ( eFillStyle1 != drawing::FillStyle_SOLID ) || ( eFillStyle2 != drawing::FillStyle_SOLID ) ) )
57 {
58 m_xCbxAttributes->set_sensitive(false);
59 }
60}
61
63{
64}
65
67{
70 sal_uInt16 nSteps;
71 bool bOrient, bAttrib;
72
73 if( xIStm.is() )
74 {
75 SdIOCompat aCompat( *xIStm, StreamMode::READ );
76
77 xIStm->ReadUInt16( nSteps ).ReadCharAsBool( bOrient ).ReadCharAsBool( bAttrib );
78 }
79 else
80 {
81 nSteps = 16;
82 bOrient = bAttrib = true;
83 }
84
85 m_xMtfSteps->set_value(nSteps);
86 m_xCbxOrientation->set_active(bOrient);
87 m_xCbxAttributes->set_active(bAttrib);
88}
89
91{
94
95 if( xOStm.is() )
96 {
97 SdIOCompat aCompat( *xOStm, StreamMode::WRITE, 1 );
98
99 xOStm->WriteUInt16( m_xMtfSteps->get_value() )
100 .WriteBool( m_xCbxOrientation->get_active() )
101 .WriteBool( m_xCbxAttributes->get_active() );
102 }
103}
104
105} // end of namespace sd
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxItemPool & GetObjectItemPool() const
const SfxItemSet & GetMergedItemSet() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void LoadSettings()
Definition: morphdlg.cxx:66
void SaveSettings() const
Definition: morphdlg.cxx:90
MorphDlg(weld::Window *pParent, const SdrObject *pObj1, const SdrObject *pObj2)
Definition: morphdlg.cxx:35
virtual ~MorphDlg() override
Definition: morphdlg.cxx:62
std::unique_ptr< weld::CheckButton > m_xCbxAttributes
Definition: morphdlg.hxx:41
std::unique_ptr< weld::CheckButton > m_xCbxOrientation
Definition: morphdlg.hxx:42
std::unique_ptr< weld::SpinButton > m_xMtfSteps
Definition: morphdlg.hxx:40
bool is() const
#define SD_OPTION_MORPHING
Definition: glob.hxx:52
#define SD_MOD()
Definition: sdmod.hxx:184
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)