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
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef LAYOUT_CORE_PROPLIST_HXX
33 #define LAYOUT_CORE_PROPLIST_HXX
35 #include <com/sun/star/beans/XPropertySetInfo.hpp>
36 #include <com/sun/star/xml/input/XAttributes.hpp>
38 #include <rtl/ustring.hxx>
39 #include <toolkit/dllapi.h>
44 namespace css
= ::com::sun::star
;
46 typedef std::list
< std::pair
< rtl::OUString
, rtl::OUString
> > PropList
;
48 void propsFromAttributes( const css::uno::Reference
<css::xml::input::XAttributes
> & xAttributes
,
49 PropList
&rProps
, sal_Int32 nNamespace
);
51 void setProperties( css::uno::Reference
< css::uno::XInterface
> const& xPeer
,
52 PropList
const& rProps
);
54 void setProperty( css::uno::Reference
< css::uno::XInterface
> const& xPeer
,
55 rtl::OUString
const& attr
, rtl::OUString
const& value
);
57 long getAttributeProps( PropList
&rProps
);
58 bool findAndRemove( const char *pAttr
, PropList
&rProps
, rtl::OUString
&rValue
);
60 // Helpers - unfortunately VCLXWindows don't implement XPropertySet
61 // but containers do - these helpers help us to hide this
65 // can we set properties on this handle ?
66 bool TOOLKIT_DLLPUBLIC
canHandleProps( const css::uno::Reference
< css::uno::XInterface
> &xRef
);
67 // if so which properties ?
68 css::uno::Reference
< css::beans::XPropertySetInfo
> TOOLKIT_DLLPUBLIC
queryPropertyInfo(
69 const css::uno::Reference
< css::uno::XInterface
> &xRef
);
71 void TOOLKIT_DLLPUBLIC
setProperty( const css::uno::Reference
< css::uno::XInterface
> &xRef
,
72 const rtl::OUString
&rName
,
73 css::uno::Any aValue
);
74 css::uno::Any TOOLKIT_DLLPUBLIC
getProperty( const css::uno::Reference
< css::uno::XInterface
> &xRef
,
75 const rtl::OUString
&rName
);
76 } // namespace prophlp
78 } // namespace layoutimpl
81 #if !OUSTRING_CSTR_PARANOIA
82 #define OUSTRING_CSTR( str ) \
83 rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
86 inline char const* OUSTRING_CSTR( rtl::OUString
const& str
)
89 = new rtl::OString (rtl::OUStringToOString (str
, RTL_TEXTENCODING_ASCII_US
));
90 return leak
->getStr();
95 #endif /* LAYOUT_CORE_PROPLIST_HXX */