1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: morphdlg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #ifdef SD_DLLIMPLEMENTATION
35 #undef SD_DLLIMPLEMENTATION
38 #include "morphdlg.hxx"
40 #include "strings.hrc"
41 #include "sdresid.hxx"
43 #include "sdiocmpt.hxx"
44 #include "morphdlg.hrc"
45 #include <tools/config.hxx>
46 #include <svx/xfillit0.hxx>
47 #include <svx/xlineit0.hxx>
48 #include <svx/xenum.hxx>
49 #include <svx/svdobj.hxx>
50 #include <svtools/itemset.hxx>
51 #include <svtools/itempool.hxx>
56 /******************************************************************************/
59 #define FADE_STEP "FadeSteps"
60 #define FADE_ATTRIB "FadeAttributes"
61 #define FADE_ORIENT "FadeOrientation"
62 #define FADE_TRUE "true"
63 #define FADE_FALSE "false"
66 /******************************************************************************/
69 /******************************************************************************
73 \******************************************************************************/
75 MorphDlg::MorphDlg( ::Window
* pParent
, const SdrObject
* pObj1
, const SdrObject
* pObj2
) :
76 ModalDialog ( pParent
, SdResId( DLG_MORPH
) ),
77 aGrpPreset ( this, SdResId( GRP_PRESET
) ),
78 aFtSteps ( this, SdResId( FT_STEPS
) ),
79 aMtfSteps ( this, SdResId( MTF_STEPS
) ),
80 aCbxAttributes ( this, SdResId( CBX_ATTRIBUTES
) ),
81 aCbxOrientation ( this, SdResId( CBX_ORIENTATION
) ),
82 aBtnOK ( this, SdResId( BTN_OK
) ),
83 aBtnCancel ( this, SdResId( BTN_CANCEL
) ),
84 aBtnHelp ( this, SdResId( BTN_HELP
) )
89 SfxItemPool
* pPool
= (SfxItemPool
*) pObj1
->GetObjectItemPool();
90 SfxItemSet
aSet1( *pPool
);
91 SfxItemSet
aSet2( *pPool
);
93 aSet1
.Put(pObj1
->GetMergedItemSet());
94 aSet2
.Put(pObj2
->GetMergedItemSet());
96 const XLineStyle eLineStyle1
= ( (const XLineStyleItem
&) aSet1
.Get( XATTR_LINESTYLE
) ).GetValue();
97 const XLineStyle eLineStyle2
= ( (const XLineStyleItem
&) aSet2
.Get( XATTR_LINESTYLE
) ).GetValue();
98 const XFillStyle eFillStyle1
= ( (const XFillStyleItem
&) aSet1
.Get( XATTR_FILLSTYLE
) ).GetValue();
99 const XFillStyle eFillStyle2
= ( (const XFillStyleItem
&) aSet2
.Get( XATTR_FILLSTYLE
) ).GetValue();
101 if ( ( ( eLineStyle1
== XLINE_NONE
) || ( eLineStyle2
== XLINE_NONE
) ) &&
102 ( ( eFillStyle1
!= XFILL_SOLID
) || ( eFillStyle2
!= XFILL_SOLID
) ) )
104 aCbxAttributes
.Disable();
109 /******************************************************************************
113 \******************************************************************************/
115 MorphDlg::~MorphDlg()
120 /******************************************************************************
124 \******************************************************************************/
126 void MorphDlg::LoadSettings()
128 SvStorageStreamRef
xIStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii(
129 RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING
) ),
132 BOOL bOrient
, bAttrib
;
136 SdIOCompat
aCompat( *xIStm
, STREAM_READ
);
138 *xIStm
>> nSteps
>> bOrient
>> bAttrib
;
143 bOrient
= bAttrib
= TRUE
;
146 aMtfSteps
.SetValue( nSteps
);
147 aCbxOrientation
.Check( bOrient
);
148 aCbxAttributes
.Check( bAttrib
);
151 // -----------------------------------------------------------------------------
153 void MorphDlg::SaveSettings() const
155 SvStorageStreamRef
xOStm( SD_MOD()->GetOptionStream( UniString::CreateFromAscii(
156 RTL_CONSTASCII_STRINGPARAM( SD_OPTION_MORPHING
) ),
161 SdIOCompat
aCompat( *xOStm
, STREAM_WRITE
, 1 );
163 *xOStm
<< (UINT16
) aMtfSteps
.GetValue()
164 << aCbxOrientation
.IsChecked()
165 << aCbxAttributes
.IsChecked();
169 } // end of namespace sd