Line data Source code
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 "strings.hrc"
23 : #include "sdresid.hxx"
24 : #include "sdmod.hxx"
25 : #include "sdiocmpt.hxx"
26 : #include <svx/xfillit0.hxx>
27 : #include <svx/xlineit0.hxx>
28 : #include <svx/xenum.hxx>
29 : #include <svx/svdobj.hxx>
30 : #include <svl/itemset.hxx>
31 : #include <svl/itempool.hxx>
32 :
33 : using namespace com::sun::star;
34 :
35 : namespace sd {
36 :
37 0 : MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
38 : : ModalDialog(pParent, "CrossFadeDialog",
39 0 : "modules/sdraw/ui/crossfadedialog.ui")
40 : {
41 0 : get(m_pMtfSteps, "increments");
42 0 : get(m_pCbxAttributes, "attributes");
43 0 : get(m_pCbxOrientation, "orientation");
44 :
45 0 : LoadSettings();
46 :
47 0 : SfxItemPool & pPool = pObj1->GetObjectItemPool();
48 0 : SfxItemSet aSet1( pPool );
49 0 : SfxItemSet aSet2( pPool );
50 :
51 0 : aSet1.Put(pObj1->GetMergedItemSet());
52 0 : aSet2.Put(pObj2->GetMergedItemSet());
53 :
54 0 : const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
55 0 : const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
56 0 : const drawing::FillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
57 0 : const drawing::FillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
58 :
59 0 : if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) &&
60 0 : ( ( eFillStyle1 != drawing::FillStyle_SOLID ) || ( eFillStyle2 != drawing::FillStyle_SOLID ) ) )
61 : {
62 0 : m_pCbxAttributes->Disable();
63 0 : }
64 0 : }
65 :
66 0 : MorphDlg::~MorphDlg()
67 : {
68 0 : }
69 :
70 0 : void MorphDlg::LoadSettings()
71 : {
72 0 : SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
73 0 : SD_OPTION_LOAD ) );
74 : sal_uInt16 nSteps;
75 : bool bOrient, bAttrib;
76 :
77 0 : if( xIStm.Is() )
78 : {
79 0 : SdIOCompat aCompat( *xIStm, STREAM_READ );
80 :
81 0 : xIStm->ReadUInt16( nSteps ).ReadCharAsBool( bOrient ).ReadCharAsBool( bAttrib );
82 : }
83 : else
84 : {
85 0 : nSteps = 16;
86 0 : bOrient = bAttrib = true;
87 : }
88 :
89 0 : m_pMtfSteps->SetValue( nSteps );
90 0 : m_pCbxOrientation->Check( bOrient );
91 0 : m_pCbxAttributes->Check( bAttrib );
92 0 : }
93 :
94 0 : void MorphDlg::SaveSettings() const
95 : {
96 0 : SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
97 0 : SD_OPTION_STORE ) );
98 :
99 0 : if( xOStm.Is() )
100 : {
101 0 : SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
102 :
103 0 : xOStm->WriteUInt16( m_pMtfSteps->GetValue() )
104 0 : .WriteUChar( m_pCbxOrientation->IsChecked() )
105 0 : .WriteUChar( m_pCbxAttributes->IsChecked() );
106 0 : }
107 0 : }
108 :
109 0 : } // end of namespace sd
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|