Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #ifdef SD_DLLIMPLEMENTATION
31 : : #undef SD_DLLIMPLEMENTATION
32 : : #endif
33 : :
34 : : #include "morphdlg.hxx"
35 : :
36 : : #include "strings.hrc"
37 : : #include "sdresid.hxx"
38 : : #include "sdmod.hxx"
39 : : #include "sdiocmpt.hxx"
40 : : #include "morphdlg.hrc"
41 : : #include <svx/xfillit0.hxx>
42 : : #include <svx/xlineit0.hxx>
43 : : #include <svx/xenum.hxx>
44 : : #include <svx/svdobj.hxx>
45 : : #include <svl/itemset.hxx>
46 : : #include <svl/itempool.hxx>
47 : :
48 : : namespace sd {
49 : :
50 : 0 : MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 ) :
51 : : ModalDialog ( pParent, SdResId( DLG_MORPH ) ),
52 : : aGrpPreset ( this, SdResId( GRP_PRESET ) ),
53 : : aFtSteps ( this, SdResId( FT_STEPS ) ),
54 : : aMtfSteps ( this, SdResId( MTF_STEPS ) ),
55 : : aCbxAttributes ( this, SdResId( CBX_ATTRIBUTES ) ),
56 : : aCbxOrientation ( this, SdResId( CBX_ORIENTATION ) ),
57 : : aBtnOK ( this, SdResId( BTN_OK ) ),
58 : : aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
59 : 0 : aBtnHelp ( this, SdResId( BTN_HELP ) )
60 : : {
61 : 0 : FreeResource();
62 : 0 : LoadSettings();
63 : :
64 : 0 : SfxItemPool* pPool = (SfxItemPool*) pObj1->GetObjectItemPool();
65 : 0 : SfxItemSet aSet1( *pPool );
66 : 0 : SfxItemSet aSet2( *pPool );
67 : :
68 : 0 : aSet1.Put(pObj1->GetMergedItemSet());
69 : 0 : aSet2.Put(pObj2->GetMergedItemSet());
70 : :
71 : 0 : const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
72 : 0 : const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
73 : 0 : const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
74 : 0 : const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
75 : :
76 : 0 : if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) &&
77 : : ( ( eFillStyle1 != XFILL_SOLID ) || ( eFillStyle2 != XFILL_SOLID ) ) )
78 : : {
79 : 0 : aCbxAttributes.Disable();
80 : 0 : }
81 : 0 : }
82 : :
83 : 0 : MorphDlg::~MorphDlg()
84 : : {
85 : 0 : }
86 : :
87 : 0 : void MorphDlg::LoadSettings()
88 : : {
89 : 0 : SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( rtl::OUString(SD_OPTION_MORPHING) ,
90 : 0 : SD_OPTION_LOAD ) );
91 : : sal_uInt16 nSteps;
92 : : sal_Bool bOrient, bAttrib;
93 : :
94 : 0 : if( xIStm.Is() )
95 : : {
96 : 0 : SdIOCompat aCompat( *xIStm, STREAM_READ );
97 : :
98 : 0 : *xIStm >> nSteps >> bOrient >> bAttrib;
99 : : }
100 : : else
101 : : {
102 : 0 : nSteps = 16;
103 : 0 : bOrient = bAttrib = sal_True;
104 : : }
105 : :
106 : 0 : aMtfSteps.SetValue( nSteps );
107 : 0 : aCbxOrientation.Check( bOrient );
108 : 0 : aCbxAttributes.Check( bAttrib );
109 : 0 : }
110 : :
111 : : // -----------------------------------------------------------------------------
112 : :
113 : 0 : void MorphDlg::SaveSettings() const
114 : : {
115 : 0 : SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( rtl::OUString(SD_OPTION_MORPHING) ,
116 : 0 : SD_OPTION_STORE ) );
117 : :
118 : 0 : if( xOStm.Is() )
119 : : {
120 : 0 : SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
121 : :
122 : 0 : *xOStm << (sal_uInt16) aMtfSteps.GetValue()
123 : 0 : << aCbxOrientation.IsChecked()
124 : 0 : << aCbxAttributes.IsChecked();
125 : 0 : }
126 : 0 : }
127 : :
128 : : } // end of namespace sd
129 : :
130 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|