1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SDTHELPER_HXX
11 #define INCLUDED_SDTHELPER_HXX
13 #include <boost/optional.hpp>
15 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
16 #include <rtl/ustrbuf.hxx>
18 #include <WriterFilterDllApi.hxx>
20 namespace com
{ namespace sun
{ namespace star
{
27 namespace writerfilter
{
31 * Helper to create form controls from w:sdt tokens.
33 * w:sdt tokens can't be imported as form fields, as w:sdt supports
34 * e.g. date picking as well.
38 DomainMapper_Impl
& m_rDM_Impl
;
40 /// Items of the drop-down control.
41 std::vector
<OUString
> m_aDropDownItems
;
42 /// Pieces of the default text -- currently used only by the dropdown control.
43 OUStringBuffer m_aSdtTexts
;
44 /// Date format, see com/sun/star/awt/UnoControlDateFieldModel.idl
45 boost::optional
<sal_Int16
> m_oDateFormat
;
49 /// Create and append the drawing::XControlShape, containing the various models.
50 void createControlShape(com::sun::star::awt::Size aSize
, com::sun::star::uno::Reference
<com::sun::star::awt::XControlModel
>);
52 SdtHelper(DomainMapper_Impl
& rDM_Impl
);
55 std::vector
<OUString
>& getDropDownItems();
56 OUStringBuffer
& getSdtTexts();
57 boost::optional
<sal_Int16
>& getDateFormat();
58 /// If createControlShape() was ever called.
61 /// Create drop-down control from w:sdt's w:dropDownList.
62 void createDropDownControl();
63 /// Create date control from w:sdt's w:date.
64 void createDateControl(OUString
& rDefaultText
);
67 } // namespace dmapper
68 } // namespace writerfilter
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */