1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
31 #ifndef _EXTENSIONS_PROPCTRLR_FONTITEMIDS_HXX_
32 #include "controlfontdialog.hxx"
34 #include <cppuhelper/typeprovider.hxx>
35 #include "fontdialog.hxx"
36 #include "formstrings.hxx"
37 #include "pcrcommon.hxx"
39 extern "C" void SAL_CALL
createRegistryInfo_OControlFontDialog()
41 ::pcr::OAutoRegistration
< ::pcr::OControlFontDialog
> aAutoRegistration
;
44 //........................................................................
47 //........................................................................
49 using namespace ::com::sun::star::uno
;
50 using namespace ::com::sun::star::lang
;
51 using namespace ::com::sun::star::beans
;
53 //====================================================================
54 //= OControlFontDialog
55 //====================================================================
56 //---------------------------------------------------------------------
57 OControlFontDialog::OControlFontDialog(const Reference
< XComponentContext
>& _rxContext
)
58 :OGenericUnoDialog( _rxContext
)
61 ,m_pItemPoolDefaults(NULL
)
63 registerProperty(PROPERTY_INTROSPECTEDOBJECT
, OWN_PROPERTY_ID_INTROSPECTEDOBJECT
,
64 PropertyAttribute::BOUND
| PropertyAttribute::TRANSIENT
,
65 &m_xControlModel
, ::getCppuType(&m_xControlModel
));
68 //---------------------------------------------------------------------
69 OControlFontDialog::~OControlFontDialog()
73 ::osl::MutexGuard
aGuard(m_aMutex
);
79 //---------------------------------------------------------------------
80 Sequence
<sal_Int8
> SAL_CALL
OControlFontDialog::getImplementationId( ) throw(RuntimeException
)
82 static ::cppu::OImplementationId aId
;
83 return aId
.getImplementationId();
86 //---------------------------------------------------------------------
87 Reference
< XInterface
> SAL_CALL
OControlFontDialog::Create( const Reference
< XComponentContext
>& _rxContext
)
89 return *( new OControlFontDialog( _rxContext
) );
92 //---------------------------------------------------------------------
93 ::rtl::OUString SAL_CALL
OControlFontDialog::getImplementationName() throw(RuntimeException
)
95 return getImplementationName_static();
98 //---------------------------------------------------------------------
99 ::rtl::OUString
OControlFontDialog::getImplementationName_static() throw(RuntimeException
)
101 return ::rtl::OUString::createFromAscii("org.openoffice.comp.form.ui.OControlFontDialog");
104 //---------------------------------------------------------------------
105 ::comphelper::StringSequence SAL_CALL
OControlFontDialog::getSupportedServiceNames() throw(RuntimeException
)
107 return getSupportedServiceNames_static();
110 //---------------------------------------------------------------------
111 ::comphelper::StringSequence
OControlFontDialog::getSupportedServiceNames_static() throw(RuntimeException
)
113 ::comphelper::StringSequence
aSupported(1);
114 aSupported
.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.form.ControlFontDialog");
118 //---------------------------------------------------------------------
119 Reference
<XPropertySetInfo
> SAL_CALL
OControlFontDialog::getPropertySetInfo() throw(RuntimeException
)
121 Reference
<XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
125 //---------------------------------------------------------------------
126 ::cppu::IPropertyArrayHelper
& OControlFontDialog::getInfoHelper()
128 return *const_cast<OControlFontDialog
*>(this)->getArrayHelper();
131 //--------------------------------------------------------------------------
132 ::cppu::IPropertyArrayHelper
* OControlFontDialog::createArrayHelper( ) const
134 Sequence
< Property
> aProps
;
135 describeProperties(aProps
);
136 return new ::cppu::OPropertyArrayHelper(aProps
);
139 //--------------------------------------------------------------------------
140 Dialog
* OControlFontDialog::createDialog(Window
* _pParent
)
142 ControlCharacterDialog::createItemSet(m_pFontItems
, m_pItemPool
, m_pItemPoolDefaults
);
144 OSL_ENSURE(m_xControlModel
.is(), "OControlFontDialog::createDialog: no introspectee set!");
145 if (m_xControlModel
.is())
146 ControlCharacterDialog::translatePropertiesToItems(m_xControlModel
, m_pFontItems
);
147 // TODO: we need a mechanism to prevent that somebody creates us, sets an introspectee, executes us,
148 // sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first
149 // execute) will be re-used upon the second execute, and thus it won't be initialized correctly.
151 ControlCharacterDialog
* pDialog
= new ControlCharacterDialog(_pParent
, *m_pFontItems
);
155 //-------------------------------------------------------------------------
156 void OControlFontDialog::destroyDialog()
158 OGenericUnoDialog::destroyDialog();
159 ControlCharacterDialog::destroyItemSet(m_pFontItems
, m_pItemPool
, m_pItemPoolDefaults
);
162 //-------------------------------------------------------------------------
163 void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult
)
165 OSL_ENSURE(m_pDialog
, "OControlFontDialog::executedDialog: no dialog anymore?!!");
166 if (m_pDialog
&& (sal_True
== _nExecutionResult
) && m_xControlModel
.is())
168 const SfxItemSet
* pOutput
= static_cast<ControlCharacterDialog
*>(m_pDialog
)->GetOutputItemSet();
170 ControlCharacterDialog::translateItemsToProperties( *pOutput
, m_xControlModel
);
174 //........................................................................
176 //........................................................................