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 : namespace sd {
34 :
35 0 : MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
36 : : ModalDialog(pParent, "CrossFadeDialog",
37 0 : "modules/sdraw/ui/crossfadedialog.ui")
38 : {
39 0 : get(m_pMtfSteps, "increments");
40 0 : get(m_pCbxAttributes, "attributes");
41 0 : get(m_pCbxOrientation, "orientation");
42 :
43 0 : LoadSettings();
44 :
45 0 : SfxItemPool* pPool = (SfxItemPool*) pObj1->GetObjectItemPool();
46 0 : SfxItemSet aSet1( *pPool );
47 0 : SfxItemSet aSet2( *pPool );
48 :
49 0 : aSet1.Put(pObj1->GetMergedItemSet());
50 0 : aSet2.Put(pObj2->GetMergedItemSet());
51 :
52 0 : const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
53 0 : const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
54 0 : const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
55 0 : const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
56 :
57 0 : if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) &&
58 0 : ( ( eFillStyle1 != XFILL_SOLID ) || ( eFillStyle2 != XFILL_SOLID ) ) )
59 : {
60 0 : m_pCbxAttributes->Disable();
61 0 : }
62 0 : }
63 :
64 0 : MorphDlg::~MorphDlg()
65 : {
66 0 : }
67 :
68 0 : void MorphDlg::LoadSettings()
69 : {
70 0 : SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
71 0 : SD_OPTION_LOAD ) );
72 : sal_uInt16 nSteps;
73 : sal_Bool bOrient, bAttrib;
74 :
75 0 : if( xIStm.Is() )
76 : {
77 0 : SdIOCompat aCompat( *xIStm, STREAM_READ );
78 :
79 0 : xIStm->ReadUInt16( nSteps ).ReadUChar( bOrient ).ReadUChar( bAttrib );
80 : }
81 : else
82 : {
83 0 : nSteps = 16;
84 0 : bOrient = bAttrib = sal_True;
85 : }
86 :
87 0 : m_pMtfSteps->SetValue( nSteps );
88 0 : m_pCbxOrientation->Check( bOrient );
89 0 : m_pCbxAttributes->Check( bAttrib );
90 0 : }
91 :
92 :
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( (sal_uInt16) m_pMtfSteps->GetValue() )
104 0 : .WriteUChar( m_pCbxOrientation->IsChecked() )
105 0 : .WriteUChar( m_pCbxAttributes->IsChecked() );
106 0 : }
107 0 : }
108 :
109 : } // end of namespace sd
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|