On Mon, 13 Jun 2011 10:17:07 +0200, Thorsten Behrens
<thb@documentfoundation.org> wrote:
Marco wrote:
What I get is an XView object that does not support any service.
I look into the implementation code for SlideSorter and I found
out that this object, which I get, is indeed a fake XView:
its real type is a ViewShellWrapper from which we can get
a SlideSorterViewShell that owns a method to provide a
XDrawSubController interface for the view.
Hi Marco,
wow, nice detective work - and you're almost there:
Thanks! :)
Now as I said my problem is that to utilize these classes I have
to include the headers under "sd/source/ui/inc/" but they are not
delivered to "solver/340/unxlngx6.pro/inc".
So what should I do ?
Well, this is purposefully not accessible from the outside - what
you want to do, is to make that XDrawSubController available via
API. A very cheap cop-out would be to add something like
com::sun::star::beans::XMaterialHolder to the ViewShellWrapper
interfaces (add it to ViewShellWrapperInterfaceBase, and use
WeakComponentImplHelper5 instead of WeakComponentImplHelper4) - and
have the implementation hand out the result of calling
mpViewShell->CreateSubController() for that new interface.
There are surely cleaner ways to do that, API-wise, e.g. by
implementing an XPropertySet, and/or the DrawingDocumentDrawView
service - maybe Christian has suggestions on how to best evolve
that.
Well, the XMaterialHolder solution is more simple but really dirty:
it is a one shot method, imo. Once you have used it get something
you can't use it for anyrhing else.
The DrawingDocumentDrawView looks a too big service.
So the best compromise looks the XPropertySet interface.
A minimal implementation could be enough.
What do you think of the following one :
//-----XPropertySet --------------------------------------------------
virtual uno::Any SAL_CALL ViewShellWrapper::getPropertyValue( const
::rtl::OUString& PropertyName )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
uno::Any aResult;
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
{
Reference< drawing::XDrawSubController > xSubController;
if( GetViewShell() )
{
xSubController = this->GetViewShell()->CreateSubController();
}
aResult <<= xSubController;
}
else
{
throw beans::UnknownPropertyException();
}
return aResult;
}
// the left methods are only fake implementations
virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL
ViewShellWrapper::getPropertySetInfo( )
throw (uno::RuntimeException)
{
return NULL;
}
virtual void SAL_CALL ViewShellWrapper::setPropertyValue( const
::rtl::OUString& aPropertyName, const uno::Any& aValue )
throw (beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException)
{
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
throw beans::PropertyVetoException();
else
throw beans::UnknownPropertyException();
}
virtual void SAL_CALL ViewShellWrapper::addPropertyChangeListener
( const ::rtl::OUString& aPropertyName, const uno::Reference<
beans::XPropertyChangeListener >& xListener )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
return;
else
throw beans::UnknownPropertyException();
}
virtual void SAL_CALL ViewShellWrapper::removePropertyChangeListener
( const ::rtl::OUString& aPropertyName, const uno::Reference<
beans::XPropertyChangeListener >& aListener )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
return;
else
throw beans::UnknownPropertyException();
}
virtual void SAL_CALL ViewShellWrapper::addVetoableChangeListener
( const ::rtl::OUString& PropertyName, const uno::Reference<
beans::XVetoableChangeListener >& aListener )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
return;
else
throw beans::UnknownPropertyException();
}
virtual void SAL_CALL ViewShellWrapper::removeVetoableChangeListener
( const ::rtl::OUString& PropertyName, const uno::Reference<
beans::XVetoableChangeListener >& aListener )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"SubController" ) ) )
return;
else
throw beans::UnknownPropertyException();
}
//---------------------------------------------------------------------------------------
It is not elegant, but it provides what I need and in the future
if someone needs other properties he will be able to extend it.
That said, I'd put lower priority on this for the moment, and
instead get back to the java script and master page parts.
I would like to implemement some code to handle variable text
fields like page numbers and dates, but there is two issue:
1) text is exported by tspan svg tags where it is set up
the position of each character;
2) it looks that only used character glyphs are available,
so I could have the glyph for "1" but not the glyph for "2"
or I could have all glyphs for write "June 15, 2011" but not
for "July 7, 2011" and so on.
Cheers,
Marco
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Context
Re: [Libreoffice] [GSoC 2011][svgexport] I need some help on exporting "all selected slides" task · Ariel Constenla-Haile
Re: [Libreoffice] [GSoC 2011][svgexport] I need some help on exporting "all selected slides" task · Marco
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.