fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / dlg / morphdlg.cxx
blob2b682bddb8d7cedfc5d8e242d4ba434f9919b06c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "morphdlg.hxx"
22 #include "strings.hrc"
23 #include "sdresid.hxx"
24 #include "sdmod.hxx"
25 #include "sdiocmpt.hxx"
26 #include "morphdlg.hrc"
27 #include <svx/xfillit0.hxx>
28 #include <svx/xlineit0.hxx>
29 #include <svx/xenum.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svl/itemset.hxx>
32 #include <svl/itempool.hxx>
34 namespace sd {
36 MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 ) :
37 ModalDialog ( pParent, SdResId( DLG_MORPH ) ),
38 aGrpPreset ( this, SdResId( GRP_PRESET ) ),
39 aFtSteps ( this, SdResId( FT_STEPS ) ),
40 aMtfSteps ( this, SdResId( MTF_STEPS ) ),
41 aCbxAttributes ( this, SdResId( CBX_ATTRIBUTES ) ),
42 aCbxOrientation ( this, SdResId( CBX_ORIENTATION ) ),
43 aBtnOK ( this, SdResId( BTN_OK ) ),
44 aBtnCancel ( this, SdResId( BTN_CANCEL ) ),
45 aBtnHelp ( this, SdResId( BTN_HELP ) )
47 FreeResource();
48 LoadSettings();
50 SfxItemPool* pPool = (SfxItemPool*) pObj1->GetObjectItemPool();
51 SfxItemSet aSet1( *pPool );
52 SfxItemSet aSet2( *pPool );
54 aSet1.Put(pObj1->GetMergedItemSet());
55 aSet2.Put(pObj2->GetMergedItemSet());
57 const XLineStyle eLineStyle1 = ( (const XLineStyleItem&) aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
58 const XLineStyle eLineStyle2 = ( (const XLineStyleItem&) aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
59 const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
60 const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
62 if ( ( ( eLineStyle1 == XLINE_NONE ) || ( eLineStyle2 == XLINE_NONE ) ) &&
63 ( ( eFillStyle1 != XFILL_SOLID ) || ( eFillStyle2 != XFILL_SOLID ) ) )
65 aCbxAttributes.Disable();
69 MorphDlg::~MorphDlg()
73 void MorphDlg::LoadSettings()
75 SvStorageStreamRef xIStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
76 SD_OPTION_LOAD ) );
77 sal_uInt16 nSteps;
78 sal_Bool bOrient, bAttrib;
80 if( xIStm.Is() )
82 SdIOCompat aCompat( *xIStm, STREAM_READ );
84 *xIStm >> nSteps >> bOrient >> bAttrib;
86 else
88 nSteps = 16;
89 bOrient = bAttrib = sal_True;
92 aMtfSteps.SetValue( nSteps );
93 aCbxOrientation.Check( bOrient );
94 aCbxAttributes.Check( bAttrib );
97 // -----------------------------------------------------------------------------
99 void MorphDlg::SaveSettings() const
101 SvStorageStreamRef xOStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
102 SD_OPTION_STORE ) );
104 if( xOStm.Is() )
106 SdIOCompat aCompat( *xOStm, STREAM_WRITE, 1 );
108 *xOStm << (sal_uInt16) aMtfSteps.GetValue()
109 << aCbxOrientation.IsChecked()
110 << aCbxAttributes.IsChecked();
114 } // end of namespace sd
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */