summaryrefslogtreecommitdiff
path: root/sd/source/ui/unoidl
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/unoidl')
-rwxr-xr-xsd/source/ui/unoidl/DrawController.cxx936
-rwxr-xr-xsd/source/ui/unoidl/SdUnoDrawView.cxx644
-rwxr-xr-xsd/source/ui/unoidl/SdUnoOutlineView.cxx271
-rwxr-xr-xsd/source/ui/unoidl/SdUnoSlideView.cxx274
-rwxr-xr-xsd/source/ui/unoidl/UnoDocumentSettings.cxx1248
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.hxx40
-rw-r--r--sd/source/ui/unoidl/detreg.cxx113
-rwxr-xr-xsd/source/ui/unoidl/facreg.cxx623
-rwxr-xr-xsd/source/ui/unoidl/makefile.mk90
-rw-r--r--sd/source/ui/unoidl/randomnode.cxx703
-rwxr-xr-xsd/source/ui/unoidl/sddetect.cxx546
-rw-r--r--sd/source/ui/unoidl/sddetect.hxx95
-rwxr-xr-xsd/source/ui/unoidl/unocpres.cxx495
-rwxr-xr-xsd/source/ui/unoidl/unocpres.hxx169
-rw-r--r--sd/source/ui/unoidl/unodoc.cxx104
-rw-r--r--sd/source/ui/unoidl/unohelp.hxx59
-rw-r--r--sd/source/ui/unoidl/unokywds.cxx37
-rw-r--r--sd/source/ui/unoidl/unolayer.cxx832
-rw-r--r--sd/source/ui/unoidl/unolayer.hxx189
-rwxr-xr-xsd/source/ui/unoidl/unomodel.cxx3069
-rw-r--r--sd/source/ui/unoidl/unomodule.cxx163
-rw-r--r--sd/source/ui/unoidl/unomodule.hxx98
-rwxr-xr-xsd/source/ui/unoidl/unoobj.cxx1763
-rwxr-xr-xsd/source/ui/unoidl/unoobj.hxx138
-rwxr-xr-xsd/source/ui/unoidl/unopage.cxx3181
-rwxr-xr-xsd/source/ui/unoidl/unopage.hxx319
-rw-r--r--sd/source/ui/unoidl/unopback.cxx463
-rw-r--r--sd/source/ui/unoidl/unopback.hxx92
-rw-r--r--sd/source/ui/unoidl/unopool.cxx99
-rwxr-xr-xsd/source/ui/unoidl/unosrch.cxx879
-rwxr-xr-xsd/source/ui/unoidl/unowcntr.cxx125
-rwxr-xr-xsd/source/ui/unoidl/unowcntr.hxx58
32 files changed, 17915 insertions, 0 deletions
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
new file mode 100755
index 000000000000..2bc98cd66de3
--- /dev/null
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -0,0 +1,936 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+
+#include "DrawSubController.hxx"
+#include "sdpage.hxx"
+#include "ViewShellBase.hxx"
+#include "ViewShellManager.hxx"
+#include "FormShellManager.hxx"
+#include "Window.hxx"
+
+#include <comphelper/anytostring.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/framework/ConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/ModuleController.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include "slideshow.hxx"
+
+#include <svx/fmshell.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <boost/shared_ptr.hpp>
+
+using namespace ::std;
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::vos;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing::framework;
+
+namespace {
+static const ::com::sun::star::uno::Type saComponentTypeIdentifier (
+ ::getCppuType( (Reference<lang::XEventListener > *)0 ));
+static const ::com::sun::star::uno::Type saSelectionTypeIdentifier (
+ ::getCppuType( (Reference<view::XSelectionChangeListener > *)0 ));
+
+} // end of anonymous namespace
+
+namespace sd {
+
+DrawController::DrawController (ViewShellBase& rBase) throw()
+ : DrawControllerInterfaceBase(&rBase),
+ BroadcastHelperOwner(SfxBaseController::m_aMutex),
+ OPropertySetHelper( static_cast<OBroadcastHelperVar<
+ OMultiTypeInterfaceContainerHelper,
+ OMultiTypeInterfaceContainerHelper::keyType>& >(
+ BroadcastHelperOwner::maBroadcastHelper)),
+ mpBase(&rBase),
+ maLastVisArea(),
+ mpCurrentPage(NULL),
+ mbMasterPageMode(false),
+ mbLayerMode(false),
+ mbDisposing(false),
+ mpPropertyArrayHelper(NULL),
+ mxSubController(),
+ mxConfigurationController(),
+ mxModuleController()
+{
+ ProvideFrameworkControllers();
+}
+
+
+
+
+DrawController::~DrawController (void) throw()
+{
+}
+
+
+
+
+void DrawController::SetSubController (
+ const Reference<drawing::XDrawSubController>& rxSubController)
+{
+ // Update the internal state.
+ mxSubController = rxSubController;
+ mpPropertyArrayHelper.reset();
+ maLastVisArea = Rectangle();
+
+ // Inform listeners about the changed state.
+ FireSelectionChangeListener();
+}
+
+
+
+
+// XInterface
+
+IMPLEMENT_FORWARD_XINTERFACE2(
+ DrawController,
+ DrawControllerInterfaceBase,
+ OPropertySetHelper);
+
+
+// XTypeProvider
+
+Sequence<Type> SAL_CALL DrawController::getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // OPropertySetHelper does not provide getTypes, so we have to
+ // implement this method manually and list its three interfaces.
+ OTypeCollection aTypeCollection (
+ ::getCppuType (( const Reference<beans::XMultiPropertySet>*)NULL),
+ ::getCppuType (( const Reference<beans::XFastPropertySet>*)NULL),
+ ::getCppuType (( const Reference<beans::XPropertySet>*)NULL));
+
+ return ::comphelper::concatSequences(
+ SfxBaseController::getTypes(),
+ aTypeCollection.getTypes(),
+ DrawControllerInterfaceBase::getTypes());
+}
+
+IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController);
+
+
+
+// XComponent
+
+
+void SAL_CALL DrawController::dispose (void)
+ throw( RuntimeException )
+{
+ if( !mbDisposing )
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mbDisposing )
+ {
+ mbDisposing = true;
+
+ boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell();
+ if ( pViewShell )
+ {
+ pViewShell->DeactivateCurrentFunction();
+ DrawDocShell* pDocShell = pViewShell->GetDocSh();
+ if ( pDocShell != NULL )
+ pDocShell->SetDocShellFunction(0);
+ }
+ pViewShell.reset();
+
+ // When the controller has not been detached from its view
+ // shell, i.e. mpViewShell is not NULL, then tell PaneManager
+ // and ViewShellManager to clear the shell stack.
+ if (mxSubController.is() && mpBase!=NULL)
+ {
+ mpBase->DisconnectAllClients();
+ mpBase->GetViewShellManager()->Shutdown();
+ }
+
+ OPropertySetHelper::disposing();
+
+ DisposeFrameworkControllers();
+
+ SfxBaseController::dispose();
+ }
+ }
+}
+
+
+
+
+void SAL_CALL DrawController::addEventListener(
+ const Reference<lang::XEventListener >& xListener)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+ SfxBaseController::addEventListener( xListener );
+}
+
+
+
+
+void SAL_CALL DrawController::removeEventListener (
+ const Reference<lang::XEventListener >& aListener)
+ throw (RuntimeException)
+{
+ if(!rBHelper.bDisposed && !rBHelper.bInDispose && !mbDisposing)
+ SfxBaseController::removeEventListener( aListener );
+}
+
+// XController
+::sal_Bool SAL_CALL DrawController::suspend( ::sal_Bool Suspend ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( Suspend )
+ {
+ ViewShellBase* pViewShellBase = GetViewShellBase();
+ if( pViewShellBase )
+ {
+ // do not allow suspend if a slideshow needs this controller!
+ rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( *pViewShellBase ) );
+ if( xSlideShow.is() && xSlideShow->dependsOn(pViewShellBase) )
+ return sal_False;
+ }
+ }
+
+ return SfxBaseController::suspend( Suspend );
+}
+
+
+// XServiceInfo
+
+OUString SAL_CALL DrawController::getImplementationName( ) throw(RuntimeException)
+{
+ // Do not throw an excepetion at the moment. This leads to a crash
+ // under Solaris on relead. See issue i70929 for details.
+ // ThrowIfDisposed();
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawController" ) );
+}
+
+
+
+static OUString ssServiceName (OUString::createFromAscii(
+ "com.sun.star.drawing.DrawingDocumentDrawView"));
+
+sal_Bool SAL_CALL DrawController::supportsService (
+ const OUString& rsServiceName)
+ throw(RuntimeException)
+{
+ // Do not throw an excepetion at the moment. This leads to a crash
+ // under Solaris on relead. See issue i70929 for details.
+ // ThrowIfDisposed();
+ return rsServiceName.equals(ssServiceName);
+}
+
+
+
+
+Sequence<OUString> SAL_CALL DrawController::getSupportedServiceNames (void)
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ Sequence<OUString> aSupportedServices (1);
+ OUString* pServices = aSupportedServices.getArray();
+ pServices[0] = ssServiceName;
+ return aSupportedServices;
+}
+
+
+
+
+//------ XSelectionSupplier --------------------------------------------
+
+sal_Bool SAL_CALL DrawController::select (const Any& aSelection)
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ ThrowIfDisposed();
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+ if (mxSubController.is())
+ return mxSubController->select(aSelection);
+ else
+ return false;
+}
+
+
+
+
+Any SAL_CALL DrawController::getSelection()
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+ if (mxSubController.is())
+ return mxSubController->getSelection();
+ else
+ return Any();
+}
+
+
+
+
+void SAL_CALL DrawController::addSelectionChangeListener(
+ const Reference< view::XSelectionChangeListener >& xListener)
+ throw(RuntimeException)
+{
+ if( mbDisposing )
+ throw lang::DisposedException();
+
+ BroadcastHelperOwner::maBroadcastHelper.addListener (saSelectionTypeIdentifier, xListener);
+}
+
+
+
+
+void SAL_CALL DrawController::removeSelectionChangeListener(
+ const Reference< view::XSelectionChangeListener >& xListener )
+ throw(RuntimeException)
+{
+ if (rBHelper.bDisposed)
+ throw lang::DisposedException();
+
+ BroadcastHelperOwner::maBroadcastHelper.removeListener (saSelectionTypeIdentifier, xListener);
+}
+
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL
+ DrawController::disposing (const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+}
+
+
+
+
+//===== view::XSelectionChangeListener ======================================
+
+void SAL_CALL
+ DrawController::selectionChanged (const lang::EventObject& rEvent)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // Have to forward the event to our selection change listeners.
+ OInterfaceContainerHelper* pListeners = BroadcastHelperOwner::maBroadcastHelper.getContainer(
+ ::getCppuType((Reference<view::XSelectionChangeListener>*)0));
+ if (pListeners)
+ {
+ // Re-send the event to all of our listeners.
+ OInterfaceIteratorHelper aIterator (*pListeners);
+ while (aIterator.hasMoreElements())
+ {
+ try
+ {
+ view::XSelectionChangeListener* pListener =
+ static_cast<view::XSelectionChangeListener*>(
+ aIterator.next());
+ if (pListener != NULL)
+ pListener->selectionChanged (rEvent);
+ }
+ catch (RuntimeException aException)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+// XDrawView
+
+void SAL_CALL DrawController::setCurrentPage( const Reference< drawing::XDrawPage >& xPage )
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+ if (mxSubController.is())
+ mxSubController->setCurrentPage(xPage);
+}
+
+
+
+
+Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage (void)
+ throw(RuntimeException)
+{
+ ThrowIfDisposed();
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Reference<drawing::XDrawPage> xPage;
+
+ // Get current page from sub controller.
+ if (mxSubController.is())
+ xPage = mxSubController->getCurrentPage();
+
+ // When there is not yet a sub controller (during initialization) then fall back
+ // to the current page in mpCurrentPage.
+ if ( ! xPage.is() && mpCurrentPage.is())
+ xPage = Reference<drawing::XDrawPage>(mpCurrentPage->getUnoPage(), UNO_QUERY);
+
+ return xPage;
+}
+
+
+
+
+void DrawController::FireVisAreaChanged (const Rectangle& rVisArea) throw()
+{
+ if( maLastVisArea != rVisArea )
+ {
+ Any aNewValue;
+ aNewValue <<= awt::Rectangle(
+ rVisArea.Left(),
+ rVisArea.Top(),
+ rVisArea.GetWidth(),
+ rVisArea.GetHeight() );
+
+ Any aOldValue;
+ aOldValue <<= awt::Rectangle(
+ maLastVisArea.Left(),
+ maLastVisArea.Top(),
+ maLastVisArea.GetWidth(),
+ maLastVisArea.GetHeight() );
+
+ FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue);
+
+ maLastVisArea = rVisArea;
+ }
+}
+
+
+
+
+void DrawController::FireSelectionChangeListener() throw()
+{
+ OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer(
+ saSelectionTypeIdentifier);
+ if( pLC )
+ {
+ Reference< XInterface > xSource( (XWeak*)this );
+ const lang::EventObject aEvent( xSource );
+
+ // Ueber alle Listener iterieren und Events senden
+ OInterfaceIteratorHelper aIt( *pLC);
+ while( aIt.hasMoreElements() )
+ {
+ try
+ {
+ view::XSelectionChangeListener * pL =
+ static_cast<view::XSelectionChangeListener*>(aIt.next());
+ if (pL != NULL)
+ pL->selectionChanged( aEvent );
+ }
+ catch (RuntimeException aException)
+ {
+ }
+ }
+ }
+}
+
+
+
+
+void DrawController::FireChangeEditMode (bool bMasterPageMode) throw()
+{
+ if (bMasterPageMode != mbMasterPageMode )
+ {
+ FirePropertyChange(
+ PROPERTY_MASTERPAGEMODE,
+ makeAny(bMasterPageMode),
+ makeAny(mbMasterPageMode));
+
+ mbMasterPageMode = bMasterPageMode;
+ }
+}
+
+
+
+
+void DrawController::FireChangeLayerMode (bool bLayerMode) throw()
+{
+ if (bLayerMode != mbLayerMode)
+ {
+ FirePropertyChange(
+ PROPERTY_LAYERMODE,
+ makeAny(bLayerMode),
+ makeAny(mbLayerMode));
+
+ mbLayerMode = bLayerMode;
+ }
+}
+
+
+
+
+void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw()
+{
+ SdrPage* pCurrentPage = mpCurrentPage.get();
+ if (pNewCurrentPage != pCurrentPage)
+ {
+ try
+ {
+ Any aNewValue (
+ makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY)));
+
+ Any aOldValue;
+ if (pCurrentPage != NULL)
+ {
+ Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY);
+ aOldValue <<= xOldPage;
+ }
+
+ FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue);
+
+ mpCurrentPage.reset(pNewCurrentPage);
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (::rtl::OString("sd::SdUnoDrawView::FireSwitchCurrentPage(), "
+ "exception caught: ") +
+ ::rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+}
+
+
+
+
+void DrawController::FirePropertyChange (
+ sal_Int32 nHandle,
+ const Any& rNewValue,
+ const Any& rOldValue)
+{
+ try
+ {
+ fire (&nHandle, &rNewValue, &rOldValue, 1, sal_False);
+ }
+ catch (RuntimeException aException)
+ {
+ // Ignore this exception. Exceptions should be handled in the
+ // fire() function so that all listeners are called. This is
+ // not the case at the moment, so we simply ignore the
+ // exception.
+ }
+
+}
+
+
+
+
+ViewShellBase* DrawController::GetViewShellBase (void)
+{
+ return mpBase;
+}
+
+
+
+
+void DrawController::ReleaseViewShellBase (void)
+{
+ DisposeFrameworkControllers();
+ mpBase = NULL;
+}
+
+
+
+
+//===== XControllerManager ==============================================================
+
+Reference<XConfigurationController> SAL_CALL
+ DrawController::getConfigurationController (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxConfigurationController;
+}
+
+
+
+
+Reference<XModuleController> SAL_CALL
+ DrawController::getModuleController (void)
+ throw (RuntimeException)
+{
+ ThrowIfDisposed();
+
+ return mxModuleController;
+}
+
+
+
+
+//===== XUnoTunnel ============================================================
+
+const Sequence<sal_Int8>& DrawController::getUnoTunnelId (void)
+{
+ static ::com::sun::star::uno::Sequence<sal_Int8>* pSequence = NULL;
+ if (pSequence == NULL)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard (::osl::Mutex::getGlobalMutex());
+ if (pSequence == NULL)
+ {
+ static ::com::sun::star::uno::Sequence<sal_Int8> aSequence (16);
+ rtl_createUuid((sal_uInt8*)aSequence.getArray(), 0, sal_True);
+ pSequence = &aSequence;
+ }
+ }
+ return *pSequence;
+}
+
+
+
+
+sal_Int64 SAL_CALL DrawController::getSomething (const Sequence<sal_Int8>& rId)
+ throw (RuntimeException)
+{
+ sal_Int64 nResult = 0;
+
+ if (rId.getLength() == 16
+ && rtl_compareMemory(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0)
+ {
+ nResult = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+
+ return nResult;
+}
+
+
+
+
+//===== Properties ============================================================
+
+void DrawController::FillPropertyTable (
+ ::std::vector<beans::Property>& rProperties)
+{
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleArea") ),
+ PROPERTY_WORKAREA,
+ ::getCppuType((const ::com::sun::star::awt::Rectangle*)0),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY));
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("SubController") ),
+ PROPERTY_SUB_CONTROLLER,
+ ::getCppuType((const Reference<drawing::XDrawSubController>*)0),
+ beans::PropertyAttribute::BOUND));
+ rProperties.push_back(
+ beans::Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CurrentPage") ),
+ PROPERTY_CURRENTPAGE,
+ ::getCppuType((const Reference< drawing::XDrawPage > *)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsLayerMode") ),
+ PROPERTY_LAYERMODE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode") ),
+ PROPERTY_MASTERPAGEMODE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ActiveLayer") ),
+ PROPERTY_ACTIVE_LAYER,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomValue") ),
+ PROPERTY_ZOOMVALUE,
+ ::getCppuType((const sal_Int16*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomType") ),
+ PROPERTY_ZOOMTYPE,
+ ::getCppuType((const sal_Int16*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOffset") ),
+ PROPERTY_VIEWOFFSET,
+ ::getCppuType((const ::com::sun::star::awt::Point*)0),
+ beans::PropertyAttribute::BOUND ));
+ rProperties.push_back(
+ beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("DrawViewMode") ),
+ PROPERTY_DRAWVIEWMODE,
+ ::getCppuType((const ::com::sun::star::awt::Point*)0),
+ beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID ));
+}
+
+
+
+
+IPropertyArrayHelper & DrawController::getInfoHelper()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if (mpPropertyArrayHelper.get() == NULL)
+ {
+ ::std::vector<beans::Property> aProperties;
+ FillPropertyTable (aProperties);
+ Sequence<beans::Property> aPropertySequence (aProperties.size());
+ for (unsigned int i=0; i<aProperties.size(); i++)
+ aPropertySequence[i] = aProperties[i];
+ mpPropertyArrayHelper.reset(new OPropertyArrayHelper(aPropertySequence, sal_False));
+ }
+
+ return *mpPropertyArrayHelper.get();
+}
+
+
+
+
+Reference < beans::XPropertySetInfo > DrawController::getPropertySetInfo()
+ throw ( ::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ static Reference < beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+uno::Reference< form::runtime::XFormController > SAL_CALL DrawController::getFormController( const uno::Reference< form::XForm >& Form ) throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ SdrView* pSdrView = mpBase->GetDrawView();
+ ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell();
+ ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL;
+
+ uno::Reference< form::runtime::XFormController > xController( NULL );
+ if ( pFormShell && pSdrView && pWindow )
+ xController = pFormShell->GetFormController( Form, *pSdrView, *pWindow );
+ return xController;
+}
+
+::sal_Bool SAL_CALL DrawController::isFormDesignMode( ) throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Bool bIsDesignMode = sal_True;
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ if ( pFormShell )
+ bIsDesignMode = pFormShell->IsDesignMode();
+
+ return bIsDesignMode;
+}
+
+void SAL_CALL DrawController::setFormDesignMode( ::sal_Bool _DesignMode ) throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ if ( pFormShell )
+ pFormShell->SetDesignMode( _DesignMode );
+}
+
+uno::Reference< awt::XControl > SAL_CALL DrawController::getControl( const uno::Reference< awt::XControlModel >& xModel ) throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ FmFormShell* pFormShell = mpBase->GetFormShellManager()->GetFormShell();
+ SdrView* pSdrView = mpBase->GetDrawView();
+ ::boost::shared_ptr<ViewShell> pViewShell = mpBase->GetMainViewShell();
+ ::sd::Window* pWindow = pViewShell ? pViewShell->GetActiveWindow() : NULL;
+
+ uno::Reference< awt::XControl > xControl( NULL );
+ if ( pFormShell && pSdrView && pWindow )
+ pFormShell->GetFormControl( xModel, *pSdrView, *pWindow, xControl );
+ return xControl;
+}
+
+
+
+
+sal_Bool DrawController::convertFastPropertyValue (
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Bool bResult = sal_False;
+
+ if (nHandle == PROPERTY_SUB_CONTROLLER)
+ {
+ rOldValue <<= mxSubController;
+ rConvertedValue <<= Reference<drawing::XDrawSubController>(rValue, UNO_QUERY);
+ bResult = (rOldValue != rConvertedValue);
+ }
+ else if (mxSubController.is())
+ {
+ rConvertedValue = rValue;
+ rOldValue = mxSubController->getFastPropertyValue(nHandle);
+ bResult = (rOldValue != rConvertedValue);
+ /* bResult = mpSubController->convertFastPropertyValue(
+ rConvertedValue,
+ rOldValue,
+ nHandle,
+ rValue);
+ */
+ }
+
+ return bResult;
+}
+
+
+
+
+void DrawController::setFastPropertyValue_NoBroadcast (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::uno::Exception)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if (nHandle == PROPERTY_SUB_CONTROLLER)
+ SetSubController(Reference<drawing::XDrawSubController>(rValue, UNO_QUERY));
+ else if (mxSubController.is())
+ mxSubController->setFastPropertyValue(nHandle, rValue);
+}
+
+
+
+
+void DrawController::getFastPropertyValue (
+ Any & rRet,
+ sal_Int32 nHandle ) const
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ switch( nHandle )
+ {
+ case PROPERTY_WORKAREA:
+ rRet <<= awt::Rectangle(
+ maLastVisArea.Left(),
+ maLastVisArea.Top(),
+ maLastVisArea.GetWidth(),
+ maLastVisArea.GetHeight());
+ break;
+
+ case PROPERTY_SUB_CONTROLLER:
+ rRet <<= mxSubController;
+ break;
+
+ default:
+ if (mxSubController.is())
+ rRet = mxSubController->getFastPropertyValue(nHandle);
+ break;
+ }
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+void DrawController::ProvideFrameworkControllers (void)
+{
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+ try
+ {
+ Reference<XController> xController (this);
+ const Reference<XComponentContext> xContext (
+ ::comphelper::getProcessComponentContext() );
+ mxConfigurationController = ConfigurationController::create(
+ xContext,
+ xController);
+ mxModuleController = ModuleController::create(
+ xContext,
+ xController);
+ }
+ catch (RuntimeException&)
+ {
+ mxConfigurationController = NULL;
+ mxModuleController = NULL;
+ }
+}
+
+
+
+
+void DrawController::DisposeFrameworkControllers (void)
+{
+ Reference<XComponent> xComponent (mxModuleController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ xComponent = Reference<XComponent>(mxConfigurationController, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+void DrawController::ThrowIfDisposed (void) const
+ throw (::com::sun::star::lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose || mbDisposing)
+ {
+ OSL_TRACE ("Calling disposed DrawController object. Throwing exception:");
+ throw lang::DisposedException (
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DrawController object has already been disposed")),
+ const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+ }
+}
+
+
+
+
+
+} // end of namespace sd
+
+
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
new file mode 100755
index 000000000000..8594d4e0ebf9
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -0,0 +1,644 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "SdUnoDrawView.hxx"
+
+#include "DrawController.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "drawdoc.hxx"
+#include "unolayer.hxx"
+#include "unomodel.hxx"
+#include "unopage.hxx"
+#include "Window.hxx"
+#include "pres.hxx"
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoshcol.hxx>
+#include <svx/zoomitem.hxx>
+#include <com/sun/star/drawing/DrawViewMode.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+
+#include <vector>
+
+using rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+
+
+namespace sd {
+
+SdUnoDrawView::SdUnoDrawView(
+ DrawController& rController,
+ DrawViewShell& rViewShell,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrDrawViewShell(rViewShell),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoDrawView::~SdUnoDrawView() throw()
+{
+}
+
+
+
+
+sal_Bool SdUnoDrawView::getMasterPageMode(void) const throw()
+{
+ return (mrDrawViewShell.GetEditMode() == EM_MASTERPAGE);
+}
+
+
+
+
+void SdUnoDrawView::setMasterPageMode (sal_Bool bMasterPageMode) throw()
+{
+ if ((mrDrawViewShell.GetEditMode() == EM_MASTERPAGE) != bMasterPageMode)
+ {
+ mrDrawViewShell.ChangeEditMode (
+ bMasterPageMode ? EM_MASTERPAGE : EM_PAGE,
+ mrDrawViewShell.IsLayerModeActive());
+ }
+}
+
+
+
+
+sal_Bool SdUnoDrawView::getLayerMode(void) const throw()
+{
+ return mrDrawViewShell.IsLayerModeActive();
+}
+
+
+
+
+void SdUnoDrawView::setLayerMode (sal_Bool bLayerMode) throw()
+{
+ if (mrDrawViewShell.IsLayerModeActive() != (bLayerMode==sal_True))
+ {
+ mrDrawViewShell.ChangeEditMode (
+ mrDrawViewShell.GetEditMode(),
+ bLayerMode);
+ }
+}
+
+
+
+
+Reference<drawing::XLayer> SdUnoDrawView::getActiveLayer (void) throw ()
+{
+ Reference<drawing::XLayer> xCurrentLayer;
+
+ do
+ {
+ // Retrieve the layer manager from the model.
+ SdXImpressDocument* pModel = GetModel();
+ if (pModel == NULL)
+ break;
+
+ SdDrawDocument* pSdModel = pModel->GetDoc();
+ if (pSdModel == NULL)
+ break;
+
+ // From the model get the current SdrLayer object via the layer admin.
+ SdrLayerAdmin& rLayerAdmin = pSdModel->GetLayerAdmin ();
+ SdrLayer* pLayer = rLayerAdmin.GetLayer (mrView.GetActiveLayer(), TRUE);
+ if (pLayer == NULL)
+ break;
+
+ // Get the corresponding XLayer object from the implementation
+ // object of the layer manager.
+ Reference<drawing::XLayerManager> xManager (pModel->getLayerManager(), uno::UNO_QUERY);
+ SdLayerManager* pManager = SdLayerManager::getImplementation (xManager);
+ if (pManager != NULL)
+ xCurrentLayer = pManager->GetLayer (pLayer);
+ }
+ while (false);
+
+ return xCurrentLayer;
+}
+
+
+
+
+void SdUnoDrawView::setActiveLayer (const Reference<drawing::XLayer>& rxLayer) throw ()
+{
+ do
+ {
+ // Get the SdrLayer object corresponding to the given reference.
+ if ( ! rxLayer.is())
+ break;
+
+ SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
+ if (pLayer == NULL)
+ break;
+
+ SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
+ if (pSdrLayer == NULL)
+ break;
+
+ // Set the new active layer and make the change visible.
+ mrView.SetActiveLayer (pSdrLayer->GetName());
+ mrDrawViewShell.ResetActualLayer ();
+ }
+ while (false);
+}
+
+
+
+
+// XSelectionSupplier
+
+
+sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ bool bOk = true;
+
+ ::std::vector<SdrObject*> aObjects;
+
+ SdrPage* pSdrPage = NULL;
+
+ Reference< drawing::XShape > xShape;
+ aSelection >>= xShape;
+
+ if(xShape.is())
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape && (pShape->GetSdrObject() != NULL) )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ pSdrPage = pObj->GetPage();
+ aObjects.push_back( pObj );
+ }
+ else
+ {
+ bOk = false;
+ }
+ }
+ else
+ {
+ Reference< drawing::XShapes > xShapes;
+ aSelection >>= xShapes;
+ if( xShapes.is() )
+ {
+ const sal_uInt32 nCount = xShapes->getCount();
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ xShapes->getByIndex(i) >>= xShape;
+ if( xShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation(xShape);
+ if( (pShape == NULL) || (pShape->GetSdrObject() == NULL) )
+ {
+ bOk = false;
+ break;
+ }
+
+ SdrObject* pObj = pShape->GetSdrObject();
+
+ if( pSdrPage == NULL )
+ {
+ pSdrPage = pObj->GetPage();
+ }
+ else if( pSdrPage != pObj->GetPage() )
+ {
+ bOk = false;
+ break;
+ }
+
+ aObjects.push_back( pObj );
+ }
+ }
+ }
+ }
+
+ if( bOk )
+ {
+ if( pSdrPage )
+ {
+ setMasterPageMode( pSdrPage->IsMasterPage() );
+ mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
+ mrDrawViewShell.WriteFrameViewData();
+ }
+
+ SdrPageView *pPV = mrView.GetSdrPageView();
+
+ if(pPV)
+ {
+ // first deselect all
+ mrView.UnmarkAllObj( pPV );
+
+ ::std::vector<SdrObject*>::iterator aIter( aObjects.begin() );
+ const ::std::vector<SdrObject*>::iterator aEnd( aObjects.end() );
+ while( aIter != aEnd )
+ {
+ SdrObject* pObj = (*aIter++);
+ mrView.MarkObj( pObj, pPV );
+ }
+ }
+ else
+ {
+ bOk = false;
+ }
+ }
+
+ return bOk;
+}
+
+//----------------------------------------------------------------------
+
+Any SAL_CALL SdUnoDrawView::getSelection()
+ throw(RuntimeException)
+{
+ Any aAny;
+
+ if( mrView.IsTextEdit() )
+ mrView.getTextSelection( aAny );
+
+
+ if( !aAny.hasValue() )
+ {
+ const SdrMarkList& rMarkList = mrView.GetMarkedObjectList();
+ sal_uInt32 nCount = rMarkList.GetMarkCount();
+ if( nCount )
+ {
+ Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
+ for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
+ {
+ SdrMark *pMark = rMarkList.GetMark(nNum);
+ if(pMark==NULL)
+ continue;
+
+ SdrObject *pObj = pMark->GetMarkedSdrObj();
+ if(pObj==NULL || pObj->GetPage() == NULL)
+ continue;
+
+ Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
+
+ if(!xPage.is())
+ continue;
+
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+
+ if(pDrawPage==NULL)
+ continue;
+
+ Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
+
+ if(xShape.is())
+ xShapes->add(xShape);
+ }
+ aAny <<= xShapes;
+ }
+ }
+
+ return aAny;
+}
+
+
+
+
+void SAL_CALL SdUnoDrawView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoDrawView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SdUnoDrawView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xPage;
+ rValue >>= xPage;
+ setCurrentPage( xPage );
+ }
+ break;
+
+ case DrawController::PROPERTY_MASTERPAGEMODE:
+ {
+ sal_Bool bValue = sal_False;
+ rValue >>= bValue;
+ setMasterPageMode( bValue );
+ }
+ break;
+
+ case DrawController::PROPERTY_LAYERMODE:
+ {
+ sal_Bool bValue = sal_False;
+ rValue >>= bValue;
+ setLayerMode( bValue );
+ }
+
+ case DrawController::PROPERTY_ACTIVE_LAYER:
+ {
+ Reference<drawing::XLayer> xLayer;
+ rValue >>= xLayer;
+ setActiveLayer (xLayer);
+ }
+ break;
+ case DrawController::PROPERTY_ZOOMVALUE:
+ {
+ sal_Int16 nZoom = 0;
+ rValue >>= nZoom;
+ SetZoom( nZoom );
+ }
+ break;
+ case DrawController::PROPERTY_ZOOMTYPE:
+ {
+ sal_Int16 nType = 0;
+ rValue >>= nType;
+ SetZoomType( nType );
+ }
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ {
+ awt::Point aOffset;
+ rValue >>= aOffset;
+ SetViewOffset( aOffset );
+ }
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+}
+
+
+
+
+Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ Any aValue;
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ aValue <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
+ break;
+
+ case DrawController::PROPERTY_MASTERPAGEMODE:
+ aValue <<= getMasterPageMode();
+ break;
+
+ case DrawController::PROPERTY_LAYERMODE:
+ aValue <<= getLayerMode();
+ break;
+
+ case DrawController::PROPERTY_ACTIVE_LAYER:
+ aValue <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
+ break;
+
+ case DrawController::PROPERTY_ZOOMVALUE:
+ aValue <<= GetZoom();
+ break;
+ case DrawController::PROPERTY_ZOOMTYPE:
+ aValue <<= (sal_Int16)com::sun::star::view::DocumentZoomType::BY_VALUE;
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ aValue <<= GetViewOffset();
+ break;
+
+ case DrawController::PROPERTY_DRAWVIEWMODE:
+ aValue = getDrawViewMode();
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+
+
+
+// XDrawView
+
+
+void SAL_CALL SdUnoDrawView::setCurrentPage (
+ const Reference< drawing::XDrawPage >& xPage )
+ throw(RuntimeException)
+{
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+ SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
+
+ if(pSdrPage)
+ {
+ // End editing of text. Otherwise the edited text object would
+ // still be visible on the new page.
+ mrDrawViewShell.GetView()->SdrEndTextEdit();
+
+ setMasterPageMode( pSdrPage->IsMasterPage() );
+ mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
+ mrDrawViewShell.WriteFrameViewData();
+ }
+}
+
+//----------------------------------------------------------------------
+
+Reference< drawing::XDrawPage > SAL_CALL SdUnoDrawView::getCurrentPage()
+ throw(RuntimeException)
+{
+ Reference< drawing::XDrawPage > xPage;
+
+ SdrPageView *pPV = mrView.GetSdrPageView();
+ SdrPage* pPage = pPV ? pPV->GetPage() : NULL;
+
+ if(pPage)
+ xPage = Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
+
+ return xPage;
+}
+
+
+sal_Int16 SdUnoDrawView::GetZoom(void) const
+{
+ if (mrDrawViewShell.GetActiveWindow() )
+ {
+ return (sal_Int16)mrDrawViewShell.GetActiveWindow()->GetZoom();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void SdUnoDrawView::SetZoom( sal_Int16 nZoom )
+{
+ SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, nZoom );
+
+ SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
+ if( pViewFrame )
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if( pDispatcher )
+ {
+ pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
+ }
+ }
+}
+
+
+void SdUnoDrawView::SetViewOffset(const awt::Point& rWinPos )
+{
+ Point aWinPos( rWinPos.X, rWinPos.Y );
+ aWinPos += mrDrawViewShell.GetViewOrigin();
+ mrDrawViewShell.SetWinViewPos( aWinPos, true );
+}
+
+awt::Point SdUnoDrawView::GetViewOffset() const
+{
+ Point aRet;
+
+ aRet = mrDrawViewShell.GetWinViewPos();
+ aRet -= mrDrawViewShell.GetViewOrigin();
+
+ return awt::Point( aRet.X(), aRet.Y() );
+}
+
+void SdUnoDrawView::SetZoomType ( sal_Int16 nType )
+{
+ SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
+ if( pViewFrame )
+ {
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if( pDispatcher )
+ {
+ SvxZoomType eZoomType;
+ switch( nType )
+ {
+ case com::sun::star::view::DocumentZoomType::OPTIMAL:
+ eZoomType = SVX_ZOOM_OPTIMAL;
+ break;
+
+ case com::sun::star::view::DocumentZoomType::PAGE_WIDTH:
+ case com::sun::star::view::DocumentZoomType::PAGE_WIDTH_EXACT:
+ eZoomType = SVX_ZOOM_PAGEWIDTH;
+ break;
+
+ case com::sun::star::view::DocumentZoomType::ENTIRE_PAGE:
+ eZoomType = SVX_ZOOM_WHOLEPAGE;
+ break;
+
+ default:
+ return;
+ }
+ SvxZoomItem aZoomItem( eZoomType );
+ pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
+ }
+ }
+}
+
+
+
+
+SdXImpressDocument* SdUnoDrawView::GetModel (void) const throw()
+{
+ if (mrView.GetDocSh()!=NULL)
+ {
+ Reference<frame::XModel> xModel (mrView.GetDocSh()->GetModel());
+ return SdXImpressDocument::getImplementation(xModel);
+ }
+ else
+ return NULL;
+}
+
+Any SdUnoDrawView::getDrawViewMode() const
+{
+ Any aRet;
+ switch( mrDrawViewShell.GetPageKind() )
+ {
+ case PK_NOTES: aRet <<= DrawViewMode_NOTES; break;
+ case PK_HANDOUT: aRet <<= DrawViewMode_HANDOUT; break;
+ case PK_STANDARD: aRet <<= DrawViewMode_DRAW; break;
+ }
+ return aRet;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoDrawView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoDrawView") );
+}
+
+sal_Bool SAL_CALL SdUnoDrawView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoDrawView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+} // end of namespace sd
+
diff --git a/sd/source/ui/unoidl/SdUnoOutlineView.cxx b/sd/source/ui/unoidl/SdUnoOutlineView.cxx
new file mode 100755
index 000000000000..ff3e5dd501fb
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoOutlineView.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "SdUnoOutlineView.hxx"
+
+#include "DrawController.hxx"
+#include "OutlineViewShell.hxx"
+#include "sdpage.hxx"
+#include "unopage.hxx"
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <svx/unopage.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using ::rtl::OUString;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+
+namespace sd {
+
+SdUnoOutlineView::SdUnoOutlineView(
+ DrawController& rController,
+ OutlineViewShell& rViewShell,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrOutlineViewShell(rViewShell),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoOutlineView::~SdUnoOutlineView (void) throw()
+{
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::disposing (void)
+{
+}
+
+
+
+
+//----- XSelectionSupplier ----------------------------------------------------
+
+sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& )
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ // todo: add selections for text ranges
+ return sal_False;
+}
+
+
+
+Any SAL_CALL SdUnoOutlineView::getSelection()
+ throw(RuntimeException)
+{
+ Any aAny;
+ return aAny;
+}
+
+
+
+void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+//----- XDrawView -------------------------------------------------------------
+
+
+void SAL_CALL SdUnoOutlineView::setCurrentPage (
+ const Reference< drawing::XDrawPage >& xPage)
+ throw(RuntimeException)
+{
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
+ SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
+
+ if (pSdrPage != NULL)
+ mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage));
+}
+
+
+
+
+Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void)
+ throw(RuntimeException)
+{
+ Reference<drawing::XDrawPage> xPage;
+
+ SdPage* pPage = mrOutlineViewShell.getCurrentPage();
+ if (pPage != NULL)
+ xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage());
+
+ return xPage;
+}
+
+
+
+/*
+// Return sal_True, value change
+sal_Bool SdUnoOutlineView::convertFastPropertyValue (
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw ( com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Bool bResult = sal_False;
+
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xOldPage( getCurrentPage() );
+ Reference< drawing::XDrawPage > xNewPage;
+ ::cppu::convertPropertyValue( xNewPage, rValue );
+ if( xOldPage != xNewPage )
+ {
+ rConvertedValue <<= xNewPage;
+ rOldValue <<= xOldPage;
+ bResult = sal_True;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return bResult;
+}
+*/
+
+
+void SdUnoOutlineView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ Reference< drawing::XDrawPage > xPage;
+ rValue >>= xPage;
+ setCurrentPage( xPage );
+ }
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+}
+
+
+
+
+void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+
+
+
+Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ Any aValue;
+
+ switch( nHandle )
+ {
+ case DrawController::PROPERTY_CURRENTPAGE:
+ {
+ SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage();
+ if (pPage != NULL)
+ aValue <<= pPage->getUnoPage();
+ }
+ break;
+ case DrawController::PROPERTY_VIEWOFFSET:
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdUnoOutlineView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoOutlineView") );
+}
+
+sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlineView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx
new file mode 100755
index 000000000000..a6502711ee72
--- /dev/null
+++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "DrawController.hxx"
+#include "SdUnoSlideView.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "model/SlsPageEnumerationProvider.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include "sdpage.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+
+SdUnoSlideView::SdUnoSlideView (
+ DrawController& rController,
+ slidesorter::SlideSorter& rSlideSorter,
+ View& rView) throw()
+ : DrawSubControllerInterfaceBase(m_aMutex),
+ mrController(rController),
+ mrSlideSorter(rSlideSorter),
+ mrView(rView)
+{
+}
+
+
+
+
+SdUnoSlideView::~SdUnoSlideView (void) throw()
+{
+}
+
+
+
+
+//----- XSelectionSupplier ----------------------------------------------------
+
+sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
+ throw(lang::IllegalArgumentException, RuntimeException)
+{
+ bool bOk = true;
+
+ slidesorter::controller::SlideSorterController& rSlideSorterController
+ = mrSlideSorter.GetController();
+ slidesorter::controller::PageSelector& rSelector (rSlideSorterController.GetPageSelector());
+ rSelector.DeselectAllPages();
+ Sequence<Reference<drawing::XDrawPage> > xPages;
+ aSelection >>= xPages;
+ const sal_uInt32 nCount = xPages.getLength();
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ Any aNumber = xSet->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Number")));
+ sal_Int32 nPageNumber = 0;
+ aNumber >>= nPageNumber;
+ nPageNumber -=1; // Transform 1-based page numbers to 0-based ones.
+ rSelector.SelectPage(nPageNumber);
+ }
+ catch(RuntimeException e)
+ {
+ }
+ }
+ }
+ rSlideSorterController.GetSelectionManager()->MakeSelectionVisible();
+
+ return bOk;
+}
+
+
+
+
+Any SAL_CALL SdUnoSlideView::getSelection (void)
+ throw(RuntimeException)
+{
+ Any aResult;
+
+ slidesorter::model::PageEnumeration aSelectedPages (
+ slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ int nSelectedPageCount (
+ mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
+
+ Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
+ int nIndex = 0;
+ while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
+ {
+ slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
+ }
+ aResult <<= aPages;
+
+ return aResult;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::addSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::removeSelectionChangeListener (
+ const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
+ throw(css::uno::RuntimeException)
+{
+ (void)rxListener;
+}
+
+
+
+
+//----- XDrawView -------------------------------------------------------------
+
+void SAL_CALL SdUnoSlideView::setCurrentPage (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+}
+
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL
+ SdUnoSlideView::getCurrentPage (void)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return Reference<drawing::XDrawPage>();
+}
+
+
+
+
+//----- XFastPropertySet ------------------------------------------------------
+
+void SdUnoSlideView::setFastPropertyValue (
+ sal_Int32 nHandle,
+ const Any& rValue)
+ throw(css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ (void)nHandle;
+ (void)rValue;
+
+ throw beans::UnknownPropertyException();
+}
+
+
+
+
+Any SAL_CALL SdUnoSlideView::getFastPropertyValue (
+ sal_Int32 nHandle)
+ throw(css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ (void)nHandle;
+
+ if( nHandle != DrawController::PROPERTY_VIEWOFFSET )
+ throw beans::UnknownPropertyException();
+
+ return Any();
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SdUnoSlideView::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoSlideView") );
+}
+
+sal_Bool SAL_CALL SdUnoSlideView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdUnoSlideView::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlidesView") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+
+/*
+void SdUnoSlideView::FillPropertyTable (
+ ::std::vector< ::com::sun::star::beans::Property>& )
+{
+}
+
+
+
+
+sal_Bool SAL_CALL SdUnoSlideView::convertFastPropertyValue(
+ ::com::sun::star::uno::Any & ,
+ ::com::sun::star::uno::Any & ,
+ sal_Int32 ,
+ const ::com::sun::star::uno::Any& )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ return sal_False;
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::setFastPropertyValue_NoBroadcast(
+ sal_Int32 ,
+ const ::com::sun::star::uno::Any& )
+ throw (::com::sun::star::uno::Exception)
+{
+}
+
+
+
+
+void SAL_CALL SdUnoSlideView::getFastPropertyValue( ::com::sun::star::uno::Any&, sal_Int32 ) const
+{
+}
+
+*/
+
+} // end of namespace sd
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
new file mode 100755
index 000000000000..ed47e57b2130
--- /dev/null
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -0,0 +1,1248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <vector>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/propertysethelper.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/xtable.hxx>
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include "drawdoc.hxx"
+#ifndef SVX_LIGHT
+#ifndef SD_DRAW_DOC_SHELL_HXX
+#include "DrawDocShell.hxx"
+#endif
+#endif
+#include "unomodel.hxx"
+
+#ifndef SVX_LIGHT
+#ifndef _SD_OPTSITEM_HXX
+#include "optsitem.hxx"
+#endif
+#include <sfx2/printer.hxx>
+#include "sdattr.hxx"
+#endif
+#include "../inc/ViewShell.hxx"
+#include "../inc/FrameView.hxx"
+#ifndef SVX_LIGHT
+#ifndef SD_OUTLINER_HXX
+#include "Outliner.hxx"
+#endif
+#else
+#include <svx/svdoutl.hxx>
+#endif
+#include <editeng/editstat.hxx>
+#include <svx/unoapi.hxx>
+
+#define MAP_LEN(x) x, sizeof(x)-1
+
+using namespace ::comphelper;
+using namespace ::osl;
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::vos;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::i18n;
+
+namespace sd
+{
+ class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
+ public comphelper::PropertySetHelper
+ {
+ public:
+ DocumentSettings( SdXImpressDocument* pModel );
+ virtual ~DocumentSettings() throw();
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+
+ protected:
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ private:
+ Reference< XModel > mxModel;
+ SdXImpressDocument* mpModel;
+ };
+
+ Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel )
+ throw( Exception )
+ {
+ DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" );
+ return (XWeak*)new DocumentSettings( pModel );
+ }
+
+enum SdDocumentSettingsPropertyHandles
+{
+ HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
+ HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME,
+ HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
+ HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
+ HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
+ HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
+ HANDLE_PRINTER_INDEPENDENT_LAYOUT
+ // --> PB 2004-08-23 #i33095#
+ ,HANDLE_LOAD_READONLY, HANDLE_SAVE_VERSION
+ // <--
+ ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL
+};
+
+#define MID_PRINTER 1
+
+ PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw )
+ {
+ static PropertyMapEntry aImpressSettingsInfoMap[] =
+ {
+ { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT, &::getCppuType((const sal_Int16*)0), 0, MID_PRINTER },
+ { MAP_LEN("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ static PropertyMapEntry aDrawSettingsInfoMap[] =
+ {
+ { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_LEN("ScaleNumerator"), HANDLE_SCALE_NUM, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("ScaleDenominator"), HANDLE_SCALE_DOM, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ static PropertyMapEntry aCommonSettingsInfoMap[] =
+ {
+ { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("PrinterName"), HANDLE_PRINTERNAME, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("PrinterSetup"), HANDLE_PRINTERJOB, &::getCppuType((const uno::Sequence < sal_Int8 > *)0), 0, MID_PRINTER },
+#ifndef SVX_LIGHT
+
+ { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, MID_PRINTER },
+ { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, MID_PRINTER },
+#endif
+ { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
+
+ { MAP_LEN("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS, &::getCppuType((const Reference< XForbiddenCharacters >*)0), 0, 0 },
+ { MAP_LEN("ApplyUserData"), HANDLE_APPLYUSERDATA, &::getBooleanCppuType(), 0, 0 },
+
+ { MAP_LEN("PageNumberFormat"), HANDLE_PAGENUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_LEN("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS, &::getCppuType((sal_Int16*)0), 0, 0 },
+ { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0, 0 },
+ // --> PB 2004-08-23 #i33095#
+ { MAP_LEN("LoadReadonly"), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), 0, 0 },
+ { MAP_LEN("SaveVersionOnClose"), HANDLE_SAVE_VERSION, &::getBooleanCppuType(), 0, 0 },
+ // <--
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap );
+ pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap );
+
+ return pInfo;
+ }
+}
+
+using namespace ::sd;
+
+DocumentSettings::DocumentSettings( SdXImpressDocument* pModel )
+: PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ),
+ mxModel( pModel ),
+ mpModel( pModel )
+{
+}
+
+DocumentSettings::~DocumentSettings() throw()
+{
+}
+
+void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdDrawDocument* pDoc = mpModel->GetDoc();
+ ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
+ if( NULL == pDoc || NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ sal_Bool bOk, bChanged = sal_False, bValue = sal_False, bOptionsChanged = false;
+
+ SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
+
+ SfxPrinter* pPrinter = pDocSh->GetPrinter( FALSE );
+ if( pPrinter )
+ {
+ SdOptionsPrintItem* pPrinterOptions = NULL;
+ if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
+ aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
+ }
+ else
+ {
+ aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
+ }
+ SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
+
+ for( ; *ppEntries; ppEntries++, pValues++ )
+ {
+ bOk = sal_False;
+
+ switch( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_COLORTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pColTab->SetName( aURL.getName() );
+ if( pColTab->Load() )
+ {
+ pDoc->SetColorTable( pColTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_DASHTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XDashList* pDashTab = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pDashTab->SetName( aURL.getName() );
+ if( pDashTab->Load() )
+ {
+ pDoc->SetDashList( pDashTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_LINEENDTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XLineEndList* pTab = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetLineEndList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_HATCHTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XHatchList* pTab = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetHatchList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_GRADIENTTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XGradientList* pTab = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetGradientList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_BITMAPTABLEURL:
+ {
+ OUString aURLString;
+ if( *pValues >>= aURLString )
+ {
+ INetURLObject aURL( aURLString );
+ INetURLObject aPathURL( aURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ XBitmapList* pTab = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
+ pTab->SetName( aURL.getName() );
+ if( pTab->Load() )
+ {
+ pDoc->SetBitmapList( pTab );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_FORBIDDENCHARS:
+ {
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_APPLYUSERDATA:
+ {
+ sal_Bool bApplyUserData = sal_False;
+ if( *pValues >>= bApplyUserData )
+ {
+ bChanged = ( bApplyUserData != pDocSh->IsUseUserData() );
+ pDocSh->SetUseUserData( bApplyUserData );
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PRINTDRAWING:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDraw() != bValue )
+ {
+ aPrintOpts.SetDraw( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTNOTES:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsNotes() != bValue )
+ {
+ aPrintOpts.SetNotes( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTHANDOUT:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHandout() != bValue)
+ {
+ aPrintOpts.SetHandout( bValue );
+ bOptionsChanged = true;
+ }
+
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTOUTLINE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsOutline() != bValue)
+ {
+ aPrintOpts.SetOutline( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_SLIDESPERHANDOUT:
+ {
+ sal_Int16 nValue = 0;
+ if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) )
+ {
+ if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue )
+ {
+ aPrintOpts.SetHandoutPages( static_cast< UINT16 >( nValue ) );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_HANDOUTHORIZONTAL:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHandoutHorizontal() != bValue )
+ {
+ aPrintOpts.SetHandoutHorizontal( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+
+ case HANDLE_PRINTPAGENAME:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagename() != bValue)
+ {
+ aPrintOpts.SetPagename( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTDATE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDate() != bValue)
+ {
+ aPrintOpts.SetDate( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTTIME:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsDate() != bValue)
+ {
+ aPrintOpts.SetTime( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTHIDENPAGES:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsHiddenPages() != bValue)
+ {
+ aPrintOpts.SetHiddenPages( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTFITPAGE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagesize() != bValue)
+ {
+ aPrintOpts.SetPagesize( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTTILEPAGE:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsPagetile() != bValue)
+ {
+ aPrintOpts.SetPagetile( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLET:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsBooklet() != bValue)
+ {
+ aPrintOpts.SetBooklet( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLETFRONT:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsFrontPage() != bValue)
+ {
+ aPrintOpts.SetFrontPage( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTBOOKLETBACK:
+ if( *pValues >>= bValue )
+ {
+ if( aPrintOpts.IsBackPage() != bValue)
+ {
+ aPrintOpts.SetBackPage( bValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ break;
+ case HANDLE_PRINTQUALITY:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ if( aPrintOpts.GetOutputQuality() != nValue)
+ {
+ aPrintOpts.SetOutputQuality( (sal_uInt16)nValue );
+ bOptionsChanged = true;
+ }
+ bOk = sal_True;
+ }
+ }
+ break;
+ case HANDLE_MEASUREUNIT:
+ {
+ sal_Int16 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ short nFieldUnit;
+ if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
+ {
+ pDoc->SetUIUnit((FieldUnit)nFieldUnit );
+ bOk = sal_True;
+ }
+ }
+ }
+ break;
+ case HANDLE_SCALE_NUM:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
+ pDoc->SetUIScale( aFract );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_SCALE_DOM:
+ {
+ sal_Int32 nValue = 0;
+ if( *pValues >>= nValue )
+ {
+ Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
+ pDoc->SetUIScale( aFract );
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+
+ case HANDLE_TABSTOP:
+ {
+ sal_Int32 nValue = 0;
+ if( (*pValues >>= nValue) && (nValue >= 0) )
+ {
+ pDoc->SetDefaultTabulator((sal_uInt16)nValue);
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PAGENUMFMT:
+ {
+ sal_Int32 nValue = 0;
+ if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) )
+ {
+ pDoc->SetPageNumType((SvxNumType)nValue);
+ bOk = sal_True;
+ bChanged = sal_True;
+ }
+ }
+ break;
+ case HANDLE_PRINTERNAME:
+ {
+ OUString aPrinterName;
+ if( *pValues >>= aPrinterName )
+ {
+ bOk = sal_True;
+ if( aPrinterName.getLength() && pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_True );
+ if (pTempPrinter)
+ {
+ SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
+ pDocSh->SetPrinter( pNewPrinter );
+ }
+ }
+ }
+ }
+ break;
+ case HANDLE_PRINTERJOB:
+ {
+ Sequence < sal_Int8 > aSequence;
+ if ( *pValues >>= aSequence )
+ {
+ bOk = sal_True;
+ sal_uInt32 nSize = aSequence.getLength();
+ if( nSize )
+ {
+ SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ SfxItemSet* pItemSet;
+
+ if( pPrinter )
+ {
+ pItemSet = pPrinter->GetOptions().Clone();
+ }
+ else
+ {
+ pItemSet = new SfxItemSet(pDoc->GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
+ 0 );
+ }
+
+ pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+
+ MapMode aMM (pPrinter->GetMapMode());
+ aMM.SetMapUnit(MAP_100TH_MM);
+ pPrinter->SetMapMode(aMM);
+
+ pDocSh->SetPrinter( pPrinter );
+
+ pPrinter = NULL;
+ }
+ }
+ }
+ break;
+
+ case HANDLE_PARAGRAPHSUMMATION :
+ {
+ sal_Bool bIsSummationOfParagraphs = sal_False;
+ if ( *pValues >>= bIsSummationOfParagraphs )
+ {
+ bOk = sal_True;
+ bChanged = sal_True;
+ if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0;
+ sal_uInt32 nCntrl;
+
+ pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
+ nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ rOutl.SetControlWord( nCntrl | nSum );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+ pOutl = pDocument->GetInternalOutliner( FALSE );
+ if( pOutl )
+ {
+ nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
+ pOutl->SetControlWord( nCntrl | nSum );
+ }
+ }
+ }
+ }
+ break;
+
+ case HANDLE_CHARCOMPRESS:
+ {
+ sal_Int16 nCharCompressType = 0;
+ if( *pValues >>= nCharCompressType )
+ {
+ bOk = sal_True;
+
+ pDoc->SetCharCompressType( (UINT16)nCharCompressType );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
+ rOutl.SetAsianCompressionMode( (UINT16)nCharCompressType );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
+ if( pOutl )
+ {
+ pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType );
+ }
+ pOutl = pDocument->GetInternalOutliner( FALSE );
+ if( pOutl )
+ {
+ pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType );
+ }
+ }
+ break;
+
+ }
+ case HANDLE_ASIANPUNCT:
+ {
+ sal_Bool bAsianPunct = sal_False;
+ if( *pValues >>= bAsianPunct )
+ {
+ bOk = sal_True;
+
+ pDoc->SetKernAsianPunctuation( bAsianPunct );
+ SdDrawDocument* pDocument = pDocSh->GetDoc();
+ SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
+ rOutl.SetKernAsianPunctuation( bAsianPunct );
+ ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
+ if( pOutl )
+ {
+ pOutl->SetKernAsianPunctuation( bAsianPunct );
+ }
+ pOutl = pDocument->GetInternalOutliner( FALSE );
+ if( pOutl )
+ {
+ pOutl->SetKernAsianPunctuation( bAsianPunct );
+ }
+ }
+ break;
+
+ }
+ case HANDLE_UPDATEFROMTEMPLATE:
+ {
+ sal_Bool value = sal_False;
+ if( *pValues >>= value )
+ {
+ bChanged = ( value != pDocSh->IsQueryLoadTemplate() );
+ pDocSh->SetQueryLoadTemplate( value );
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ // Just propagate the new printer independent layout mode to
+ // the document and determine it really differs from the old
+ // one.
+ sal_Int16 nOldValue =
+ (sal_Int16)pDoc->GetPrinterIndependentLayout ();
+ sal_Int16 nValue = 0;
+ if (*pValues >>= nValue)
+ {
+ pDoc->SetPrinterIndependentLayout (nValue);
+ bChanged = (nValue != nOldValue);
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ // --> PB 2004-08-23 #i33095#
+ case HANDLE_LOAD_READONLY:
+ {
+ sal_Bool bNewValue = sal_False;
+ if ( *pValues >>= bNewValue )
+ {
+ bChanged = ( pDocSh->IsLoadReadonly() != bNewValue );
+ pDocSh->SetLoadReadonly( bNewValue );
+ bOk = sal_True;
+ }
+ }
+ break;
+ // <--
+
+ case HANDLE_SAVE_VERSION:
+ {
+ sal_Bool bNewValue = sal_False;
+ if ( *pValues >>= bNewValue )
+ {
+ bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue );
+ pDocSh->SetSaveVersionOnClose( bNewValue );
+ bOk = sal_True;
+ }
+ }
+ break;
+
+ default:
+ throw UnknownPropertyException();
+ }
+
+ if( !bOk )
+ throw IllegalArgumentException();
+ }
+
+ if( bOptionsChanged )
+ {
+ if( !pPrinter )
+ pPrinter = pDocSh->GetPrinter( TRUE );
+ SfxItemSet aNewOptions( pPrinter->GetOptions() );
+ aNewOptions.Put( aOptionsPrintItem );
+ pPrinter->SetOptions( aNewOptions );
+ }
+
+ if( bChanged || bOptionsChanged )
+ mpModel->SetModified( sal_True );
+}
+
+void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdDrawDocument* pDoc = mpModel->GetDoc();
+ ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
+ if( NULL == pDoc || NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
+
+ SfxPrinter* pPrinter = pDocSh->GetPrinter( FALSE );
+ if( pPrinter )
+ {
+ SdOptionsPrintItem* pPrinterOptions = NULL;
+ if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
+ aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
+ }
+ else
+ {
+ aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
+ }
+ SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
+
+ for( ; *ppEntries; ppEntries++, pValue++ )
+ {
+ switch( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_COLORTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetColorTable()->GetPath() );
+ aPathURL.insertName( pDoc->GetColorTable()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_DASHTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetDashList()->GetPath() );
+ aPathURL.insertName( pDoc->GetDashList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_LINEENDTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetLineEndList()->GetPath() );
+ aPathURL.insertName( pDoc->GetLineEndList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_HATCHTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetHatchList()->GetPath() );
+ aPathURL.insertName( pDoc->GetHatchList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_GRADIENTTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetGradientList()->GetPath() );
+ aPathURL.insertName( pDoc->GetGradientList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_BITMAPTABLEURL:
+ {
+ INetURLObject aPathURL( pDoc->GetBitmapList()->GetPath() );
+ aPathURL.insertName( pDoc->GetBitmapList()->GetName() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") );
+ aPathURL.setExtension( aExt );
+ OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ *pValue <<= aPath;
+ }
+ break;
+ case HANDLE_FORBIDDENCHARS:
+ *pValue <<= mpModel->getForbiddenCharsTable();
+ break;
+
+ case HANDLE_APPLYUSERDATA:
+ *pValue <<= pDocSh->IsUseUserData();
+ break;
+
+ case HANDLE_PRINTDRAWING:
+ *pValue <<= (sal_Bool)aPrintOpts.IsDraw();
+ break;
+ case HANDLE_PRINTNOTES:
+ *pValue <<= (sal_Bool)aPrintOpts.IsNotes();
+ break;
+ case HANDLE_PRINTHANDOUT:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHandout();
+ break;
+ case HANDLE_PRINTOUTLINE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsOutline();
+ break;
+ case HANDLE_SLIDESPERHANDOUT:
+ *pValue <<= (sal_Int16)aPrintOpts.GetHandoutPages();
+ break;
+ case HANDLE_HANDOUTHORIZONTAL:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHandoutHorizontal();
+ break;
+ case HANDLE_PRINTPAGENAME:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagename();
+ break;
+ case HANDLE_PRINTDATE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsDate();
+ break;
+ case HANDLE_PRINTTIME:
+ *pValue <<= (sal_Bool)aPrintOpts.IsTime();
+ break;
+ case HANDLE_PRINTHIDENPAGES:
+ *pValue <<= (sal_Bool)aPrintOpts.IsHiddenPages();
+ break;
+ case HANDLE_PRINTFITPAGE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagesize();
+ break;
+ case HANDLE_PRINTTILEPAGE:
+ *pValue <<= (sal_Bool)aPrintOpts.IsPagetile();
+ break;
+ case HANDLE_PRINTBOOKLET:
+ *pValue <<= (sal_Bool)aPrintOpts.IsBooklet();
+ break;
+ case HANDLE_PRINTBOOKLETFRONT:
+ *pValue <<= (sal_Bool)aPrintOpts.IsFrontPage();
+ break;
+ case HANDLE_PRINTBOOKLETBACK:
+ *pValue <<= (sal_Bool)aPrintOpts.IsBackPage();
+ break;
+ case HANDLE_PRINTQUALITY:
+ *pValue <<= (sal_Int32)aPrintOpts.GetOutputQuality();
+ break;
+ case HANDLE_MEASUREUNIT:
+ {
+ short nMeasure;
+ SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
+ *pValue <<= (sal_Int16)nMeasure;
+ }
+ break;
+ case HANDLE_SCALE_NUM:
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
+ break;
+ case HANDLE_SCALE_DOM:
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
+ break;
+ case HANDLE_TABSTOP:
+ *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
+ break;
+ case HANDLE_PAGENUMFMT:
+ *pValue <<= (sal_Int32)pDoc->GetPageNumType();
+ break;
+ case HANDLE_PRINTERNAME:
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
+ *pValue <<= pTempPrinter ? OUString ( pTempPrinter->GetName()) : OUString();
+ }
+ break;
+ case HANDLE_PRINTERJOB:
+ {
+ SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
+ if (pTempPrinter)
+ {
+ SvMemoryStream aStream;
+ pTempPrinter->Store( aStream );
+ aStream.Seek ( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = aStream.Tell();
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ Sequence < sal_Int8 > aSequence ( nSize );
+ memcpy ( aSequence.getArray(), aStream.GetData(), nSize );
+ *pValue <<= aSequence;
+ }
+ else
+ {
+ Sequence < sal_Int8 > aSequence;
+ *pValue <<= aSequence;
+ }
+ }
+ break;
+
+ case HANDLE_PARAGRAPHSUMMATION :
+ {
+ sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
+ *pValue <<= bIsSummationOfParagraphs;
+ }
+ break;
+
+ case HANDLE_CHARCOMPRESS:
+ {
+ *pValue <<= (sal_Int16)pDoc->GetCharCompressType();
+ break;
+ }
+
+ case HANDLE_ASIANPUNCT:
+ {
+ *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation();
+ break;
+ }
+
+ case HANDLE_UPDATEFROMTEMPLATE:
+ {
+ *pValue <<= pDocSh->IsQueryLoadTemplate();
+ }
+ break;
+
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ sal_Int16 nPrinterIndependentLayout =
+ (sal_Int16)pDoc->GetPrinterIndependentLayout();
+ *pValue <<= nPrinterIndependentLayout;
+ }
+ break;
+
+ // --> PB 2004-08-23 #i33095#
+ case HANDLE_LOAD_READONLY:
+ {
+ *pValue <<= pDocSh->IsLoadReadonly();
+ }
+ break;
+ // <--
+
+ case HANDLE_SAVE_VERSION:
+ {
+ *pValue <<= pDocSh->IsSaveVersionOnClose();
+ }
+ break;
+
+ default:
+ throw UnknownPropertyException();
+ }
+ }
+}
+
+// XInterface
+Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
+}
+
+void SAL_CALL DocumentSettings::acquire( ) throw ()
+{
+ WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
+}
+
+void SAL_CALL DocumentSettings::release( ) throw ()
+{
+ WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
+}
+
+
+// XPropertySet
+Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return PropertySetHelper::getPropertySetInfo();
+}
+
+void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::setPropertyValue( aPropertyName, aValue );
+}
+
+Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ return PropertySetHelper::getPropertyValue( PropertyName );
+}
+
+void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XMultiPropertySet
+void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ PropertySetHelper::setPropertyValues( aPropertyNames, aValues );
+}
+
+Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException)
+{
+ return PropertySetHelper::getPropertyValues( aPropertyNames );
+}
+
+void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener );
+}
+
+void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::removePropertiesChangeListener( xListener );
+}
+
+void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener );
+}
+
+// XServiceInfo
+OUString SAL_CALL DocumentSettings::getImplementationName( )
+ throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings"));
+}
+
+sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ const Sequence< OUString > aSeq( getSupportedServiceNames() );
+ sal_Int32 nCount = aSeq.getLength();
+ const OUString* pServices = aSeq.getConstArray();
+ while( nCount-- )
+ {
+ if( *pServices++ == ServiceName )
+ return sal_True;
+ }
+
+ return sal_True;
+}
+
+Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq( 2 );
+ aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
+ if( mpModel->IsImpressDocument() )
+ {
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings") );
+ }
+ else
+ {
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings") );
+ }
+
+ return aSeq;
+}
+
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.hxx b/sd/source/ui/unoidl/UnoDocumentSettings.hxx
new file mode 100644
index 000000000000..432b02174e73
--- /dev/null
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNODOCUMENTSETTINGS_HXX_
+#define _SD_UNODOCUMENTSETTINGS_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+
+class SdXImpressDocument;
+
+namespace sd
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pDoc ) throw();
+}
+
+#endif
diff --git a/sd/source/ui/unoidl/detreg.cxx b/sd/source/ui/unoidl/detreg.cxx
new file mode 100644
index 000000000000..a45496d5d5a4
--- /dev/null
+++ b/sd/source/ui/unoidl/detreg.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddetect.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include "sal/types.h"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+extern "C" {
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvironmentTypeName,
+ uno_Environment** )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void* ,
+ void* pRegistryKey )
+{
+ Reference< ::registry::XRegistryKey >
+ xKey( reinterpret_cast< ::registry::XRegistryKey* >( pRegistryKey ) ) ;
+
+ ::rtl::OUString aDelimiter( RTL_CONSTASCII_USTRINGPARAM("/") );
+ ::rtl::OUString aUnoServices( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") );
+
+ // Eigentliche Implementierung und ihre Services registrieren
+ sal_Int32 i;
+ Reference< ::registry::XRegistryKey > xNewKey;
+
+ xNewKey = xKey->createKey( aDelimiter + SdFilterDetect::impl_getStaticImplementationName() +
+ aUnoServices );
+
+ Sequence< ::rtl::OUString > aServices = SdFilterDetect::impl_getStaticSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ return sal_True;
+}
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* )
+{
+ // Set default return value for this operation - if it failed.
+ void* pReturn = NULL ;
+
+ if (
+ ( pImplementationName != NULL ) &&
+ ( pServiceManager != NULL )
+ )
+ {
+ // Define variables which are used in following macros.
+ Reference< XSingleServiceFactory > xFactory ;
+ Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+
+ if( SdFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SdFilterDetect::impl_getStaticImplementationName(),
+ SdFilterDetect::impl_createInstance,
+ SdFilterDetect::impl_getStaticSupportedServiceNames() );
+ }
+
+ // Factory is valid - service was found.
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ // Return with result of this operation.
+ return pReturn ;
+}
+} // extern "C"
+
+
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
new file mode 100755
index 000000000000..1ac245ad00d4
--- /dev/null
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+#include "sddll.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <uno/lbnames.h>
+#include <sfx2/sfxmodelfactory.hxx>
+#include "osl/diagnose.h"
+#include "sal/types.h"
+
+#ifndef INCLUDED_STRING_H
+#include <string.h>
+#define INCLUDED_STRING_H
+#endif
+#include <comphelper/stl_types.hxx>
+#include <hash_map>
+#include <boost/shared_ptr.hpp>
+
+using namespace rtl;
+using namespace com::sun::star;
+
+
+// Forward declarations of the factories.
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
+extern OUString SdDrawingDocument_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
+extern OUString SdPresentationDocument_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdHtmlOptionsDialog_CreateInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SdHtmlOptionsDialog_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SdUnoModule_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException );
+
+namespace sd
+{
+extern uno::Reference< uno::XInterface > SAL_CALL RandomNode_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString RandomNode__getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL SlideLayoutController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString SlideLayoutController_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SlideLayoutController_getSupportedServiceNames() throw( uno::RuntimeException );
+
+extern uno::Reference< uno::XInterface > SAL_CALL InsertSlideController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
+extern OUString InsertSlideController_getImplementationName() throw( uno::RuntimeException );
+extern uno::Sequence< OUString > InsertSlideController_getSupportedServiceNames() throw( uno::RuntimeException );
+}
+
+namespace sd { namespace framework {
+
+extern uno::Reference<uno::XInterface> SAL_CALL Configuration_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString Configuration_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL Configuration_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ConfigurationController_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ConfigurationController_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ConfigurationController_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ModuleController_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ModuleController_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ModuleController_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicPaneFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicPaneFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicPaneFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicToolBarFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicToolBarFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicToolBarFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL BasicViewFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString BasicViewFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ResourceId_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ResourceId_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresentationFactoryProvider_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresentationFactoryProvider_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+
+namespace sd { namespace toolpanel {
+
+extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+} }
+
+namespace sd { namespace presenter {
+extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString SlideRenderer_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL SlideRenderer_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterCanvas_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterCanvas_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterTextViewService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterTextViewService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterHelperService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterHelperService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+
+extern uno::Reference<uno::XInterface> SAL_CALL PresenterPreviewCache_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString PresenterPreviewCache_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL PresenterPreviewCache_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+
+namespace sd { namespace slidesorter {
+extern uno::Reference<uno::XInterface> SAL_CALL SlideSorterService_createInstance(
+ const uno::Reference<uno::XComponentContext>& rxContext)
+ throw(uno::Exception);
+extern OUString SlideSorterService_getImplementationName(void)
+ throw (uno::RuntimeException);
+extern uno::Sequence<OUString> SAL_CALL SlideSorterService_getSupportedServiceNames (void)
+ throw (uno::RuntimeException);
+} }
+
+using namespace ::sd;
+using namespace ::sd::framework;
+using namespace ::sd::presenter;
+using namespace ::sd::slidesorter;
+using namespace ::sd::toolpanel;
+
+
+
+
+// ----------------------------------------------------------------------------
+// Declaration and initialization of a map from service names to locally
+// unique factory identifiers.
+
+enum FactoryId
+{
+ SdDrawingDocumentFactoryId,
+ SdPresentationDocumentFactoryId,
+ SdHtmlOptionsDialogFactoryId,
+ SdUnoModuleFactoryId,
+ RandomNodeFactoryId,
+
+ ConfigurationFactoryId,
+ ConfigurationControllerFactoryId,
+ ModuleControllerFactoryId,
+ BasicPaneFactoryFactoryId,
+ BasicToolBarFactoryFactoryId,
+ BasicViewFactoryFactoryId,
+ TaskPanelFactoryFactoryId,
+ ToolPanelFactoryFactoryId,
+ ResourceIdFactoryId,
+ PresentationFactoryProviderFactoryId,
+ SlideRendererFactoryId,
+ PresenterCanvasFactoryId,
+ PresenterTextViewServiceFactoryId,
+ PresenterHelperServiceFactoryId,
+ PresenterPreviewCacheFactoryId,
+ SlideSorterServiceFactoryId,
+ SlideLayoutControllerFactoryId,
+ InsertSlideControllerFactoryId,
+};
+typedef ::std::hash_map<OUString, FactoryId, comphelper::UStringHash, comphelper::UStringEqual> FactoryMap;
+
+
+namespace {
+static ::boost::shared_ptr<FactoryMap> spFactoryMap;
+::boost::shared_ptr<FactoryMap> GetFactoryMap (void)
+{
+ if (spFactoryMap.get() == NULL)
+ {
+ spFactoryMap.reset(new FactoryMap);
+ (*spFactoryMap)[SdDrawingDocument_getImplementationName()] = SdDrawingDocumentFactoryId;
+ (*spFactoryMap)[SdPresentationDocument_getImplementationName()] = SdPresentationDocumentFactoryId;
+ (*spFactoryMap)[SdHtmlOptionsDialog_getImplementationName()] = SdHtmlOptionsDialogFactoryId;
+ (*spFactoryMap)[SdUnoModule_getImplementationName()] = SdUnoModuleFactoryId;
+ (*spFactoryMap)[RandomNode__getImplementationName()] = RandomNodeFactoryId;
+ (*spFactoryMap)[Configuration_getImplementationName()] = ConfigurationFactoryId;
+ (*spFactoryMap)[ConfigurationController_getImplementationName()] = ConfigurationControllerFactoryId;
+ (*spFactoryMap)[ModuleController_getImplementationName()] = ModuleControllerFactoryId;
+ (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
+ (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
+ (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
+ (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
+ (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
+ (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
+ (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
+ (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
+ (*spFactoryMap)[PresenterCanvas_getImplementationName()] = PresenterCanvasFactoryId;
+ (*spFactoryMap)[PresenterTextViewService_getImplementationName()] = PresenterTextViewServiceFactoryId;
+ (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId;
+ (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId;
+ (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId;
+ (*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId;
+ (*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId;
+ }
+ return spFactoryMap;
+};
+} // end of anonymous namespace
+
+
+extern "C"
+{
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName,
+ uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+static void SAL_CALL writeInfo(
+ registry::XRegistryKey * pRegistryKey,
+ const OUString & rImplementationName,
+ const uno::Sequence< OUString > & rServices )
+{
+ uno::Reference< registry::XRegistryKey > xNewKey(
+ pRegistryKey->createKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) );
+
+ for( sal_Int32 i = 0; i < rServices.getLength(); i++ )
+ xNewKey->createKey( rServices.getConstArray()[i]);
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * ,
+ void * pRegistryKey )
+{
+ if( pRegistryKey )
+ {
+ try
+ {
+ registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey );
+
+ writeInfo( pKey, SdHtmlOptionsDialog_getImplementationName(), SdHtmlOptionsDialog_getSupportedServiceNames() );
+ writeInfo( pKey, SdDrawingDocument_getImplementationName(), SdDrawingDocument_getSupportedServiceNames() );
+ writeInfo( pKey, SdPresentationDocument_getImplementationName(), SdPresentationDocument_getSupportedServiceNames() );
+ writeInfo( pKey, SdUnoModule_getImplementationName(), SdUnoModule_getSupportedServiceNames() );
+ writeInfo( pKey, sd::RandomNode__getImplementationName(), sd::RandomNode_getSupportedServiceNames() );
+ writeInfo(
+ pKey,
+ sd::framework::Configuration_getImplementationName(),
+ sd::framework::Configuration_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::ConfigurationController_getImplementationName(),
+ sd::framework::ConfigurationController_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::ModuleController_getImplementationName(),
+ sd::framework::ModuleController_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::BasicPaneFactory_getImplementationName(),
+ sd::framework::BasicPaneFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::BasicToolBarFactory_getImplementationName(),
+ sd::framework::BasicToolBarFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::BasicViewFactory_getImplementationName(),
+ sd::framework::BasicViewFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::TaskPanelFactory_getImplementationName(),
+ sd::framework::TaskPanelFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::toolpanel::ToolPanelFactory_getImplementationName(),
+ sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::ResourceId_getImplementationName(),
+ sd::framework::ResourceId_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::framework::PresentationFactoryProvider_getImplementationName(),
+ sd::framework::PresentationFactoryProvider_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::presenter::SlideRenderer_getImplementationName(),
+ sd::presenter::SlideRenderer_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::presenter::PresenterCanvas_getImplementationName(),
+ sd::presenter::PresenterCanvas_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::presenter::PresenterTextViewService_getImplementationName(),
+ sd::presenter::PresenterTextViewService_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::presenter::PresenterHelperService_getImplementationName(),
+ sd::presenter::PresenterHelperService_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::presenter::PresenterPreviewCache_getImplementationName(),
+ sd::presenter::PresenterPreviewCache_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::slidesorter::SlideSorterService_getImplementationName(),
+ sd::slidesorter::SlideSorterService_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::SlideLayoutController_getImplementationName(),
+ sd::SlideLayoutController_getSupportedServiceNames());
+ writeInfo(
+ pKey,
+ sd::InsertSlideController_getImplementationName(),
+ sd::InsertSlideController_getSupportedServiceNames());
+ }
+ catch (registry::InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_True;
+}
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName,
+ void * pServiceManager,
+ void * )
+{
+ void * pRet = 0;
+
+ if( pServiceManager )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+
+ uno::Reference<lang::XSingleServiceFactory> xFactory;
+ uno::Reference<lang::XSingleComponentFactory> xComponentFactory;
+
+ ::boost::shared_ptr<FactoryMap> pFactoryMap (GetFactoryMap());
+ OUString sImplementationName (OUString::createFromAscii(pImplName));
+ FactoryMap::const_iterator iFactory (pFactoryMap->find(sImplementationName));
+ if (iFactory != pFactoryMap->end())
+ {
+ switch (iFactory->second)
+ {
+ case SdHtmlOptionsDialogFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ SdHtmlOptionsDialog_getImplementationName(),
+ SdHtmlOptionsDialog_CreateInstance,
+ SdHtmlOptionsDialog_getSupportedServiceNames());
+ break;
+
+ case SdDrawingDocumentFactoryId:
+ xFactory = ::sfx2::createSfxModelFactory(
+ xMSF,
+ SdDrawingDocument_getImplementationName(),
+ SdDrawingDocument_createInstance,
+ SdDrawingDocument_getSupportedServiceNames());
+ break;
+
+ case SdPresentationDocumentFactoryId:
+ xFactory = ::sfx2::createSfxModelFactory(
+ xMSF,
+ SdPresentationDocument_getImplementationName(),
+ SdPresentationDocument_createInstance,
+ SdPresentationDocument_getSupportedServiceNames());
+ break;
+
+ case SdUnoModuleFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ SdUnoModule_getImplementationName(),
+ SdUnoModule_createInstance,
+ SdUnoModule_getSupportedServiceNames());
+ break;
+
+ case RandomNodeFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::RandomNode__getImplementationName(),
+ sd::RandomNode_createInstance,
+ sd::RandomNode_getSupportedServiceNames());
+ break;
+
+ case ConfigurationFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::Configuration_createInstance,
+ sd::framework::Configuration_getImplementationName(),
+ sd::framework::Configuration_getSupportedServiceNames());
+ break;
+
+ case ConfigurationControllerFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ConfigurationController_createInstance,
+ sd::framework::ConfigurationController_getImplementationName(),
+ sd::framework::ConfigurationController_getSupportedServiceNames());
+ break;
+
+ case ModuleControllerFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ModuleController_createInstance,
+ sd::framework::ModuleController_getImplementationName(),
+ sd::framework::ModuleController_getSupportedServiceNames());
+ break;
+
+ case BasicPaneFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicPaneFactory_createInstance,
+ sd::framework::BasicPaneFactory_getImplementationName(),
+ sd::framework::BasicPaneFactory_getSupportedServiceNames());
+ break;
+
+ case BasicToolBarFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicToolBarFactory_createInstance,
+ sd::framework::BasicToolBarFactory_getImplementationName(),
+ sd::framework::BasicToolBarFactory_getSupportedServiceNames());
+ break;
+
+ case BasicViewFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::BasicViewFactory_createInstance,
+ sd::framework::BasicViewFactory_getImplementationName(),
+ sd::framework::BasicViewFactory_getSupportedServiceNames());
+ break;
+
+ case TaskPanelFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::TaskPanelFactory_createInstance,
+ sd::framework::TaskPanelFactory_getImplementationName(),
+ sd::framework::TaskPanelFactory_getSupportedServiceNames());
+ break;
+
+ case ToolPanelFactoryFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::toolpanel::ToolPanelFactory_createInstance,
+ sd::toolpanel::ToolPanelFactory_getImplementationName(),
+ sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
+ break;
+
+ case ResourceIdFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::ResourceId_createInstance,
+ sd::framework::ResourceId_getImplementationName(),
+ sd::framework::ResourceId_getSupportedServiceNames());
+ break;
+
+ case PresentationFactoryProviderFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::framework::PresentationFactoryProvider_createInstance,
+ sd::framework::PresentationFactoryProvider_getImplementationName(),
+ sd::framework::PresentationFactoryProvider_getSupportedServiceNames());
+ break;
+
+ case SlideRendererFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::SlideRenderer_createInstance,
+ sd::presenter::SlideRenderer_getImplementationName(),
+ sd::presenter::SlideRenderer_getSupportedServiceNames());
+ break;
+
+ case PresenterCanvasFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterCanvas_createInstance,
+ sd::presenter::PresenterCanvas_getImplementationName(),
+ sd::presenter::PresenterCanvas_getSupportedServiceNames());
+ break;
+
+ case PresenterTextViewServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterTextViewService_createInstance,
+ sd::presenter::PresenterTextViewService_getImplementationName(),
+ sd::presenter::PresenterTextViewService_getSupportedServiceNames());
+ break;
+
+ case PresenterHelperServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterHelperService_createInstance,
+ sd::presenter::PresenterHelperService_getImplementationName(),
+ sd::presenter::PresenterHelperService_getSupportedServiceNames());
+ break;
+
+ case PresenterPreviewCacheFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::presenter::PresenterPreviewCache_createInstance,
+ sd::presenter::PresenterPreviewCache_getImplementationName(),
+ sd::presenter::PresenterPreviewCache_getSupportedServiceNames());
+ break;
+
+ case SlideSorterServiceFactoryId:
+ xComponentFactory = ::cppu::createSingleComponentFactory(
+ sd::slidesorter::SlideSorterService_createInstance,
+ sd::slidesorter::SlideSorterService_getImplementationName(),
+ sd::slidesorter::SlideSorterService_getSupportedServiceNames());
+ break;
+
+ case SlideLayoutControllerFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::SlideLayoutController_getImplementationName(),
+ sd::SlideLayoutController_createInstance,
+ sd::SlideLayoutController_getSupportedServiceNames());
+ break;
+
+ case InsertSlideControllerFactoryId:
+ xFactory = ::cppu::createSingleFactory(
+ xMSF,
+ sd::InsertSlideController_getImplementationName(),
+ sd::InsertSlideController_createInstance,
+ sd::InsertSlideController_getSupportedServiceNames());
+ default:
+ break;
+ }
+ if (xComponentFactory.is())
+ {
+ xComponentFactory->acquire();
+ pRet = xComponentFactory.get();
+ }
+ else if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ }
+
+ if (pRet != NULL)
+ SdDLL::Init();
+ return pRet;
+}
+
+} // end of extern "C"
diff --git a/sd/source/ui/unoidl/makefile.mk b/sd/source/ui/unoidl/makefile.mk
new file mode 100755
index 000000000000..cf4910b29186
--- /dev/null
+++ b/sd/source/ui/unoidl/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util$/sd
+PRJNAME=sd
+TARGET=unoidl
+ENABLE_EXCEPTIONS=TRUE
+AUTOSEG=true
+LIBTARGET = NO
+PRJINC=..$/slidesorter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(COM)"=="GCC"
+NOOPTFILES= $(SLO)$/unowcntr.obj
+.ENDIF
+
+SLO1FILES = \
+ $(SLO)$/DrawController.obj \
+ $(SLO)$/SdUnoSlideView.obj\
+ $(SLO)$/SdUnoOutlineView.obj\
+ $(SLO)$/SdUnoDrawView.obj \
+ $(SLO)$/unopool.obj \
+ $(SLO)$/UnoDocumentSettings.obj \
+ $(SLO)$/facreg.obj \
+ $(SLO)$/unomodel.obj \
+ $(SLO)$/unopage.obj \
+ $(SLO)$/unolayer.obj \
+ $(SLO)$/unocpres.obj \
+ $(SLO)$/unoobj.obj \
+ $(SLO)$/unosrch.obj \
+ $(SLO)$/unowcntr.obj \
+ $(SLO)$/unokywds.obj \
+ $(SLO)$/unopback.obj \
+ $(SLO)$/unodoc.obj \
+ $(SLO)$/unomodule.obj \
+ $(SLO)$/randomnode.obj
+
+SLO2FILES = \
+ $(SLO)$/sddetect.obj \
+ $(SLO)$/detreg.obj
+
+SLOFILES = \
+ $(SLO1FILES) \
+ $(SLO2FILES)
+
+LIB1TARGET = \
+ $(SLB)$/$(TARGET).lib
+
+LIB1OBJFILES = \
+ $(SLO1FILES)
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx
new file mode 100644
index 000000000000..9a57fd090c7a
--- /dev/null
+++ b/sd/source/ui/unoidl/randomnode.cxx
@@ -0,0 +1,703 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <cppuhelper/implbase5.hxx>
+#include <osl/mutex.hxx>
+#include "CustomAnimationPreset.hxx"
+
+using ::osl::Mutex;
+using ::osl::Guard;
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::NoSupportException;
+using ::com::sun::star::beans::NamedValue;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::ElementExistException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::container::XEnumerationAccess;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::lang::XInitialization;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::XWeak;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::presentation::ParagraphTarget;
+using ::com::sun::star::drawing::XShape;
+
+using namespace ::com::sun::star::animations;
+namespace sd
+{
+
+typedef ::cppu::WeakImplHelper5< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase;
+class RandomAnimationNode : public RandomAnimationNodeBase
+{
+public:
+ RandomAnimationNode( const RandomAnimationNode& rNode );
+ RandomAnimationNode( sal_Int16 nPresetClass );
+ RandomAnimationNode();
+
+ void init( sal_Int16 nPresetClass );
+
+ // XInitialization
+ void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ // XChild
+ Reference< XInterface > SAL_CALL getParent( ) throw (RuntimeException);
+ void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException);
+
+ // XCloneable
+ virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw();
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
+
+ // XAnimationNode
+ ::sal_Int16 SAL_CALL getType() throw (RuntimeException);
+ Any SAL_CALL getBegin() throw (RuntimeException);
+ void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException);
+ Any SAL_CALL getDuration() throw (RuntimeException);
+ void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException);
+ Any SAL_CALL getEnd() throw (RuntimeException);
+ void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException);
+ Any SAL_CALL getEndSync() throw (RuntimeException);
+ void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException);
+ Any SAL_CALL getRepeatCount() throw (RuntimeException);
+ void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException);
+ Any SAL_CALL getRepeatDuration() throw (RuntimeException);
+ void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getFill() throw (RuntimeException);
+ void SAL_CALL setFill( ::sal_Int16 _fill ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException);
+ void SAL_CALL setFillDefault( ::sal_Int16 _filldefault ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getRestart() throw (RuntimeException);
+ void SAL_CALL setRestart( ::sal_Int16 _restart ) throw (RuntimeException);
+ ::sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException);
+ void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault ) throw (RuntimeException);
+ double SAL_CALL getAcceleration() throw (RuntimeException);
+ void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException);
+ double SAL_CALL getDecelerate() throw (RuntimeException);
+ void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException);
+ ::sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException);
+ void SAL_CALL setAutoReverse( ::sal_Bool _autoreverse ) throw (RuntimeException);
+ Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException);
+ void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
+
+ // XEnumerationAccess
+ virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException);
+
+ // XTimeContainer
+ Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
+ Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
+
+private:
+ // our first, last and only protection from mutli-threads!
+ Mutex maMutex;
+
+ sal_Int16 mnPresetClass;
+ Reference< XInterface > mxParent;
+
+ Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
+ sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
+ double mfAcceleration, mfDecelerate;
+ sal_Bool mbAutoReverse;
+ Sequence< NamedValue > maUserData;
+
+ Reference< XAnimate > mxFirstNode;
+};
+
+// --------------------------------------------------------------------
+
+static const sal_Char* pSN1 = "com.sun.star.animations.ParallelTimeContainer";
+static const sal_Char* pSN2 = "com.sun.star.comp.sd.RandomAnimationNode";
+
+// --------------------------------------------------------------------
+
+SD_DLLPUBLIC Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass )
+{
+ Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) );
+ return xInt;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL RandomNode_createInstance( const Reference< XMultiServiceFactory > & )
+{
+ Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode() ) );
+ return xInt;
+}
+
+// --------------------------------------------------------------------
+
+OUString RandomNode__getImplementationName() throw( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "sd::RandomAnimationNode" ) );
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException )
+{
+// static const OUString aSN1( OUString::createFromAscii( pSN1 ) );
+ static const OUString aSN2( OUString::createFromAscii( pSN2 ) );
+ Sequence< OUString > aSeq( &aSN2, 1 );
+// aSeq[0] = aSN1;
+/// aSeq[1] = aSN2;
+ return aSeq;
+}
+
+// --------------------------------------------------------------------
+
+RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode )
+: RandomAnimationNodeBase(),
+ mnPresetClass( rNode.mnPresetClass ),
+ maBegin( rNode.maBegin ),
+ maDuration( rNode.maDuration ),
+ maEnd( rNode.maEnd ),
+ maEndSync( rNode.maEndSync ),
+ maRepeatCount( rNode.maRepeatCount ),
+ maRepeatDuration( rNode.maRepeatDuration ),
+ maTarget( rNode.maTarget ),
+ mnFill( rNode.mnFill ),
+ mnFillDefault( rNode.mnFillDefault ),
+ mnRestart( rNode.mnRestart ),
+ mnRestartDefault( rNode.mnRestartDefault ),
+ mfAcceleration( rNode.mfAcceleration ),
+ mfDecelerate( rNode.mfDecelerate ),
+ mbAutoReverse( rNode.mbAutoReverse ),
+ maUserData( rNode.maUserData )
+{
+}
+
+// --------------------------------------------------------------------
+
+RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
+{
+ init( nPresetClass );
+}
+
+RandomAnimationNode::RandomAnimationNode()
+{
+ init( 1 );
+}
+
+void RandomAnimationNode::init( sal_Int16 nPresetClass )
+{
+ mnPresetClass = nPresetClass;
+ mnFill = AnimationFill::DEFAULT;
+ mnFillDefault = AnimationFill::INHERIT;
+ mnRestart = AnimationRestart::DEFAULT;
+ mnRestartDefault = AnimationRestart::INHERIT;
+ mfAcceleration = 0.0;
+ mfDecelerate = 0.0;
+ mbAutoReverse = sal_False;
+}
+
+// --------------------------------------------------------------------
+
+// XInitialization
+void SAL_CALL RandomAnimationNode::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
+{
+ if( aArguments.getLength() != 1 )
+ throw IllegalArgumentException();
+
+ if( aArguments[0].getValueType() == ::getCppuType((const sal_Int16*)0) )
+ {
+ aArguments[0] >>= mnPresetClass;
+ }
+ else if( aArguments[0].getValueType() != ::getCppuType((const ParagraphTarget*)0) )
+ {
+ Reference< XShape > xShape;
+ aArguments[0] >>= xShape;
+ if( !xShape.is() )
+ throw IllegalArgumentException();
+ }
+ maTarget = aArguments[0];
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getType() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return ::com::sun::star::animations::AnimationNodeType::PAR;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getBegin() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maBegin;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setBegin( const Any& _begin ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maBegin = _begin;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getDuration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maDuration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setDuration( const Any& _duration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maDuration = _duration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getEnd() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maEnd;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setEnd( const Any& _end ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maEnd = _end;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getEndSync() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maEndSync;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maEndSync = _endsync;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getRepeatCount() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maRepeatCount;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maRepeatCount = _repeatcount;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+Any SAL_CALL RandomAnimationNode::getRepeatDuration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maRepeatDuration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maRepeatDuration = _repeatduration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getFill() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnFill;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnFill = _fill;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnFillDefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnFillDefault = _filldefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getRestart() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnRestart;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnRestart = _restart;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mnRestartDefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mnRestartDefault = _restartdefault;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+double SAL_CALL RandomAnimationNode::getAcceleration() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mfAcceleration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mfAcceleration = _acceleration;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+double SAL_CALL RandomAnimationNode::getDecelerate() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mfDecelerate;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mfDecelerate = _decelerate;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mbAutoReverse;
+}
+
+// --------------------------------------------------------------------
+
+// XAnimationNode
+void SAL_CALL RandomAnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mbAutoReverse = _autoreverse;
+}
+
+// --------------------------------------------------------------------
+
+Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maUserData;
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ maUserData = _userdata;
+}
+
+// --------------------------------------------------------------------
+
+// XChild
+Reference< XInterface > SAL_CALL RandomAnimationNode::getParent() throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ return mxParent;
+}
+
+// --------------------------------------------------------------------
+
+// XChild
+void SAL_CALL RandomAnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+ mxParent = Parent;
+}
+
+// --------------------------------------------------------------------
+
+// XCloneable
+Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone() throw (RuntimeException)
+{
+ Reference< XCloneable > xNewNode( new RandomAnimationNode( *this ) );
+ return xNewNode;
+}
+
+// --------------------------------------------------------------------
+
+// XElementAccess
+Type SAL_CALL RandomAnimationNode::getElementType() throw (RuntimeException)
+{
+ return ::getCppuType((const Reference< XAnimationNode >*)0);
+}
+
+// --------------------------------------------------------------------
+
+// XElementAccess
+sal_Bool SAL_CALL RandomAnimationNode::hasElements() throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+// XEnumerationAccess
+Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
+ throw (RuntimeException)
+{
+ Guard< Mutex > aGuard( maMutex );
+
+ if( !maTarget.hasValue() && mxFirstNode.is() )
+ {
+ Any aTarget( mxFirstNode->getTarget() );
+ if( aTarget.hasValue() )
+ {
+ maTarget = aTarget;
+ mxFirstNode.clear();
+ }
+ }
+
+ Reference< XEnumeration > xEnum;
+
+ Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
+
+ if( aEnumAccess.is() )
+ {
+ Reference< XEnumeration > xEnumeration( aEnumAccess->createEnumeration(), UNO_QUERY );
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
+ if( xAnimate.is() )
+ xAnimate->setTarget( maTarget );
+ }
+ }
+ xEnum = aEnumAccess->createEnumeration();
+ }
+ else
+ {
+ // no presets? give empty node!
+ Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ Reference< XEnumerationAccess > aEmptyEnumAccess(
+ xServiceFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.animations.ParallelTimeContainer" ))),
+ UNO_QUERY );
+
+ if( aEmptyEnumAccess.is() )
+ xEnum = aEmptyEnumAccess->createEnumeration();
+ }
+
+ return xEnum;
+}
+
+// --------------------------------------------------------------------
+
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
+ throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ return appendChild( newChild );
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ return oldChild;
+}
+
+// --------------------------------------------------------------------
+
+// XTimeContainer
+Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
+ if( xAnimate.is() )
+ {
+ Any aTarget( xAnimate->getTarget() );
+ if( aTarget.hasValue() )
+ maTarget = aTarget;
+ }
+
+ if( !maTarget.hasValue() && !mxFirstNode.is() )
+ mxFirstNode = xAnimate;
+
+ return newChild;
+}
+
+// XServiceInfo
+OUString RandomAnimationNode::getImplementationName() throw()
+{
+ return RandomNode__getImplementationName();
+}
+
+// XServiceInfo
+sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw()
+{
+ return ServiceName.equalsAscii( pSN1 ) || ServiceName.equalsAscii( pSN2 );
+}
+
+// XServiceInfo
+Sequence< OUString > RandomAnimationNode::getSupportedServiceNames(void) throw()
+{
+ return RandomNode_getSupportedServiceNames();
+}
+
+}
+
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
new file mode 100755
index 000000000000..9f268dec0cfa
--- /dev/null
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "sddetect.hxx"
+
+#include <framework/interaction.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/InteractiveAppException.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <framework/interaction.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <ucbhelper/simpleinteractionrequest.hxx>
+#include <svtools/filter.hxx>
+#include <rtl/ustring.h>
+#include <rtl/logfile.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/window.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <tools/urlobj.hxx>
+#include <vos/mutex.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/ehdl.hxx>
+#include <sot/storinfo.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/brokenpackageint.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <sot/storage.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <com/sun/star/util/XArchiver.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "strmname.h"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::rtl;
+
+SdFilterDetect::SdFilterDetect( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& )
+{
+}
+
+SdFilterDetect::~SdFilterDetect()
+{
+}
+
+::rtl::OUString SAL_CALL SdFilterDetect::detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ REFERENCE< XInputStream > xStream;
+ REFERENCE< XContent > xContent;
+ REFERENCE< XInteractionHandler > xInteraction;
+ String aURL;
+ ::rtl::OUString sTemp;
+ String aTypeName; // a name describing the type (from MediaDescriptor, usually from flat detection)
+ String aPreselectedFilterName; // a name describing the filter to use (from MediaDescriptor, usually from UI action)
+
+ ::rtl::OUString aDocumentTitle; // interesting only if set in this method
+
+ // opening as template is done when a parameter tells to do so and a template filter can be detected
+ // (otherwise no valid filter would be found) or if the detected filter is a template filter and
+ // there is no parameter that forbids to open as template
+ sal_Bool bOpenAsTemplate = sal_False;
+ sal_Bool bWasReadOnly = sal_False, bReadOnly = sal_False;
+
+ sal_Bool bRepairPackage = sal_False;
+ sal_Bool bRepairAllowed = sal_False;
+
+ // now some parameters that can already be in the array, but may be overwritten or new inserted here
+ // remember their indices in the case new values must be added to the array
+ sal_Int32 nPropertyCount = lDescriptor.getLength();
+ sal_Int32 nIndexOfFilterName = -1;
+ sal_Int32 nIndexOfInputStream = -1;
+ sal_Int32 nIndexOfContent = -1;
+ sal_Int32 nIndexOfReadOnlyFlag = -1;
+ sal_Int32 nIndexOfTemplateFlag = -1;
+ sal_Int32 nIndexOfDocumentTitle = -1;
+
+ for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
+ {
+ // extract properties
+ if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( !aURL.Len() && lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FileName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aTypeName = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aPreselectedFilterName = sTemp;
+
+ // if the preselected filter name is not correct, it must be erased after detection
+ // remember index of property to get access to it later
+ nIndexOfFilterName = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) )
+ nIndexOfInputStream = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")) )
+ nIndexOfReadOnlyFlag = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("UCBContent")) )
+ nIndexOfContent = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")) )
+ {
+ lDescriptor[nProperty].Value >>= bOpenAsTemplate;
+ nIndexOfTemplateFlag = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) )
+ lDescriptor[nProperty].Value >>= xInteraction;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")) )
+ lDescriptor[nProperty].Value >>= bRepairPackage;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")) )
+ nIndexOfDocumentTitle = nProperty;
+ }
+
+ // can't check the type for external filters, so set the "dont" flag accordingly
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ //SfxFilterFlags nMust = SFX_FILTER_IMPORT, nDont = SFX_FILTER_NOTINSTALLED;
+
+ SfxApplication* pApp = SFX_APP();
+ SfxAllItemSet *pSet = new SfxAllItemSet( pApp->GetPool() );
+ TransformParameters( SID_OPENDOC, lDescriptor, *pSet );
+ SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, FALSE );
+
+ bWasReadOnly = pItem && pItem->GetValue();
+
+ const SfxFilter* pFilter = 0;
+ String aFilterName;
+ String aPrefix = String::CreateFromAscii( "private:factory/" );
+ if( aURL.Match( aPrefix ) == aPrefix.Len() )
+ {
+ if( SvtModuleOptions().IsImpress() )
+ {
+ String aPattern( aPrefix );
+ aPattern += String::CreateFromAscii("simpress");
+ if ( aURL.Match( aPattern ) >= aPattern.Len() )
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aURL );
+ }
+
+ if( !pFilter && SvtModuleOptions().IsDraw() )
+ {
+ String aPattern( aPrefix );
+ aPattern += String::CreateFromAscii("sdraw");
+ if ( aURL.Match( aPattern ) >= aPattern.Len() )
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aURL );
+ }
+ }
+ else
+ {
+ // ctor of SfxMedium uses owner transition of ItemSet
+ SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, FALSE, NULL, pSet );
+ aMedium.UseInteractionHandler( TRUE );
+ if ( aPreselectedFilterName.Len() )
+ pFilter = SfxFilter::GetFilterByName( aPreselectedFilterName );
+ else if( aTypeName.Len() )
+ {
+ SfxFilterMatcher aMatch;
+ pFilter = aMatch.GetFilter4EA( aTypeName );
+ }
+
+ if ( aMedium.GetErrorCode() == ERRCODE_NONE )
+ {
+ // remember input stream and content and put them into the descriptor later
+ // should be done here since later the medium can switch to a version
+ xStream = aMedium.GetInputStream();
+ xContent = aMedium.GetContent();
+ bReadOnly = aMedium.IsReadOnly();
+ BOOL bIsStorage = aMedium.IsStorage();
+
+ if (aMedium.GetError() == SVSTREAM_OK)
+ {
+ if ( bIsStorage )
+ {
+ // PowerPoint needs to be detected via StreamName, all other storage based formats are our own and can
+ // be detected by the ClipboardId, so except for the PPT filter all filters must have a ClipboardId set
+ uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage( sal_False );
+
+ //TODO/LATER: move error handling to central place! (maybe even complete own filters)
+ if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
+ {
+ // error during storage creation means _here_ that the medium
+ // is broken, but we can not handle it in medium since unpossibility
+ // to create a storage does not _always_ means that the medium is broken
+ aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ if ( xInteraction.is() )
+ {
+ OUString empty;
+ try
+ {
+ InteractiveAppException xException( empty,
+ REFERENCE< XInterface >(),
+ InteractionClassification_ERROR,
+ aMedium.GetError() );
+
+ REFERENCE< XInteractionRequest > xRequest(
+ new ucbhelper::SimpleInteractionRequest( makeAny( xException ),
+ ucbhelper::CONTINUATION_APPROVE ) );
+ xInteraction->handle( xRequest );
+ }
+ catch ( Exception & ) {};
+ }
+ }
+ else
+ {
+ if ( pFilter && !pFilter->GetFormat() )
+ // preselected Filter has no ClipboardId -> doesn't match (see comment above)
+ pFilter = 0;
+
+ // the storage must be checked even if filter is already found, since it is deep type detection
+ // the storage can be corrupted and it will be detected here
+ try
+ {
+ String sFilterName;
+ if ( pFilter )
+ sFilterName = pFilter->GetName();
+ aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : FALSE, &sFilterName );
+ }
+ catch( lang::WrappedTargetException& aWrap )
+ {
+ packages::zip::ZipIOException aZipException;
+ if ( ( aWrap.TargetException >>= aZipException ) && aTypeName.Len() )
+ {
+ if ( xInteraction.is() )
+ {
+ // the package is broken one
+ aDocumentTitle = aMedium.GetURLObject().getName(
+ INetURLObject::LAST_SEGMENT,
+ true,
+ INetURLObject::DECODE_WITH_CHARSET );
+
+ if ( !bRepairPackage )
+ {
+ // ask the user whether he wants to try to repair
+ RequestPackageReparation* pRequest = new RequestPackageReparation( aDocumentTitle );
+ uno::Reference< task::XInteractionRequest > xRequest ( pRequest );
+
+ xInteraction->handle( xRequest );
+
+ bRepairAllowed = pRequest->isApproved();
+ }
+
+ if ( !bRepairAllowed )
+ {
+ // repair either not allowed or not successful
+ NotifyBrokenPackage* pNotifyRequest = new NotifyBrokenPackage( aDocumentTitle );
+ uno::Reference< task::XInteractionRequest > xRequest ( pNotifyRequest );
+ xInteraction->handle( xRequest );
+ }
+ }
+
+ if ( !bRepairAllowed )
+ {
+ aTypeName.Erase();
+ pFilter = 0;
+ }
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ aTypeName.Erase();
+ pFilter = 0;
+ }
+
+ if ( !pFilter && aTypeName.Len() )
+ {
+ //TODO/LATER: using this method impress is always preferred if no flat detecion has been made
+ // this should been discussed!
+ if ( SvtModuleOptions().IsImpress() )
+ pFilter = SfxFilterMatcher( String::CreateFromAscii("simpress") ).GetFilter4EA( aTypeName );
+ else if ( SvtModuleOptions().IsDraw() )
+ pFilter = SfxFilterMatcher( String::CreateFromAscii("sdraw") ).GetFilter4EA( aTypeName );
+ }
+ }
+ }
+ else
+ {
+ SvStream* pStm = aMedium.GetInStream();
+ if ( !pStm )
+ {
+ pFilter = 0;
+ }
+ else
+ {
+ SotStorageRef aStorage = new SotStorage ( pStm, FALSE );
+ if ( !aStorage->GetError() )
+ {
+ String aStreamName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "PowerPoint Document" ) );
+ if ( aStorage->IsStream( aStreamName ) && SvtModuleOptions().IsImpress() )
+ {
+ String aFileName(aMedium.GetName());
+ aFileName.ToUpperAscii();
+
+ if( aFileName.SearchAscii( ".POT" ) == STRING_NOTFOUND )
+ pFilter = SfxFilter::GetFilterByName( pFilterPowerPoint97);
+ else
+ pFilter = SfxFilter::GetFilterByName( pFilterPowerPoint97Template );
+ }
+ }
+ else
+ {
+ // Vektorgraphik?
+ pStm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ const String aFileName( aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
+ GraphicDescriptor aDesc( *pStm, &aFileName );
+ GraphicFilter* pGrfFilter = GraphicFilter::GetGraphicFilter();
+ if( !aDesc.Detect( FALSE ) )
+ {
+ pFilter = 0;
+ if( SvtModuleOptions().IsImpress() )
+ {
+ INetURLObject aCheckURL( aFileName );
+ if( aCheckURL.getExtension().equalsIgnoreAsciiCaseAscii( "cgm" ) )
+ {
+ sal_uInt8 n8;
+ pStm->Seek( STREAM_SEEK_TO_BEGIN );
+ *pStm >> n8;
+ if ( ( n8 & 0xf0 ) == 0 ) // we are supporting binary cgm format only, so
+ { // this is a small test to exclude cgm text
+ const String aName = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "CGM - Computer Graphics Metafile" ) );
+ SfxFilterMatcher aMatch( String::CreateFromAscii("simpress") );
+ pFilter = aMatch.GetFilter4FilterName( aName );
+ }
+ }
+ }
+ }
+ else
+ {
+ String aShortName( aDesc.GetImportFormatShortName( aDesc.GetFileFormat() ) );
+ const String aName( pGrfFilter->GetImportFormatTypeName( pGrfFilter->GetImportFormatNumberForShortName( aShortName ) ) );
+
+ if ( pFilter && aShortName.EqualsIgnoreCaseAscii( "PCD" ) ) // there is a multiple pcd selection possible
+ {
+ sal_Int32 nBase = 2; // default Base0
+ String aFilterTypeName( pFilter->GetRealTypeName() );
+ if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base4" ) == COMPARE_EQUAL )
+ nBase = 1;
+ else if ( aFilterTypeName.CompareToAscii( "pcd_Photo_CD_Base16" ) == COMPARE_EQUAL )
+ nBase = 0;
+ String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Import/PCD" ) );
+ FilterConfigItem aFilterConfigItem( aFilterConfigPath );
+ aFilterConfigItem.WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), nBase );
+ }
+
+ SfxFilterMatcher aMatch( String::CreateFromAscii("sdraw") );
+ pFilter = aMatch.GetFilter4FilterName( aName );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ( nIndexOfInputStream == -1 && xStream.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("InputStream");
+ lDescriptor[nPropertyCount].Value <<= xStream;
+ nPropertyCount++;
+ }
+
+ if ( nIndexOfContent == -1 && xContent.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("UCBContent");
+ lDescriptor[nPropertyCount].Value <<= xContent;
+ nPropertyCount++;
+ }
+
+ if ( bReadOnly != bWasReadOnly )
+ {
+ if ( nIndexOfReadOnlyFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("ReadOnly");
+ lDescriptor[nPropertyCount].Value <<= bReadOnly;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfReadOnlyFlag].Value <<= bReadOnly;
+ }
+
+ if ( !bRepairPackage && bRepairAllowed )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("RepairPackage");
+ lDescriptor[nPropertyCount].Value <<= bRepairAllowed;
+ nPropertyCount++;
+
+ bOpenAsTemplate = sal_True;
+
+ // TODO/LATER: set progress bar that should be used
+ }
+
+ if ( bOpenAsTemplate )
+ {
+ if ( nIndexOfTemplateFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("AsTemplate");
+ lDescriptor[nPropertyCount].Value <<= bOpenAsTemplate;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfTemplateFlag].Value <<= bOpenAsTemplate;
+ }
+
+ if ( aDocumentTitle.getLength() )
+ {
+ // the title was set here
+ if ( nIndexOfDocumentTitle == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("DocumentTitle");
+ lDescriptor[nPropertyCount].Value <<= aDocumentTitle;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
+ }
+
+ if ( pFilter )
+ aTypeName = pFilter->GetTypeName();
+ else
+ aTypeName.Erase();
+
+ return aTypeName;
+}
+
+SFX_IMPL_SINGLEFACTORY( SdFilterDetect )
+
+/* XServiceInfo */
+UNOOUSTRING SAL_CALL SdFilterDetect::getImplementationName() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticImplementationName();
+}
+ \
+/* XServiceInfo */
+sal_Bool SAL_CALL SdFilterDetect::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION )
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+/* XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SAL_CALL SdFilterDetect::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+/* Helper for XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SdFilterDetect::impl_getStaticSupportedServiceNames()
+{
+ UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 1 );
+ seqServiceNames.getArray() [0] = UNOOUSTRING::createFromAscii( "com.sun.star.frame.ExtendedTypeDetection" );
+ return seqServiceNames ;
+}
+
+/* Helper for XServiceInfo */
+UNOOUSTRING SdFilterDetect::impl_getStaticImplementationName()
+{
+ return UNOOUSTRING::createFromAscii( "com.sun.star.comp.draw.FormatDetector" );
+}
+
+/* Helper for registry */
+UNOREFERENCE< UNOXINTERFACE > SAL_CALL SdFilterDetect::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION )
+{
+ return UNOREFERENCE< UNOXINTERFACE >( *new SdFilterDetect( xServiceManager ) );
+}
+
diff --git a/sd/source/ui/unoidl/sddetect.hxx b/sd/source/ui/unoidl/sddetect.hxx
new file mode 100644
index 000000000000..5daa3d0fe23e
--- /dev/null
+++ b/sd/source/ui/unoidl/sddetect.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_TYPEDETECT_HXX
+#define _SD_TYPEDETECT_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/factory.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+
+class SfxObjectFactory;
+class SfxFilterMatcher;
+class LoadEnvironment_Impl;
+class SfxMedium;
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace uno
+ {
+ class Any;
+ }
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace frame
+ {
+ class XFrame;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#include <sfx2/sfxuno.hxx>
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIME_EXCEPTION ::com::sun::star::uno::RuntimeException
+
+class SdFilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ SdFilterDetect( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ virtual ~SdFilterDetect();
+
+ SFX_DECL_XSERVICEINFO
+
+ //----------------------------------------------------------------------------------
+ // XExtendedFilterDetect
+ //----------------------------------------------------------------------------------
+ virtual ::rtl::OUString SAL_CALL detect( SEQUENCE< ::com::sun::star::beans::PropertyValue >& lDescriptor ) throw( RUNTIME_EXCEPTION );
+};
+
+#endif
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
new file mode 100755
index 000000000000..1935c424ec03
--- /dev/null
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -0,0 +1,495 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svdpage.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "unohelp.hxx"
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+#include "unocpres.hxx"
+#include "cusshow.hxx"
+#include "unopage.hxx"
+
+using namespace ::rtl;
+using namespace ::vos;
+using namespace ::com::sun::star;
+
+
+uno::Reference< uno::XInterface > createUnoCustomShow( SdCustomShow* pShow )
+{
+ return (cppu::OWeakObject*)new SdXCustomPresentation( pShow, NULL );
+}
+
+SdXCustomPresentation::SdXCustomPresentation() throw()
+: mpSdCustomShow(NULL), mpModel(NULL),
+ aDisposeListeners( aDisposeContainerMutex ),
+ bDisposing( sal_False )
+{
+}
+
+SdXCustomPresentation::SdXCustomPresentation( SdCustomShow* pShow, SdXImpressDocument* pMyModel) throw()
+: mpSdCustomShow(pShow), mpModel(pMyModel),
+ aDisposeListeners( aDisposeContainerMutex ),
+ bDisposing( sal_False )
+{
+}
+
+SdXCustomPresentation::~SdXCustomPresentation() throw()
+{
+}
+
+UNO3_GETIMPLEMENTATION_IMPL( SdXCustomPresentation );
+
+// XServiceInfo
+OUString SAL_CALL SdXCustomPresentation::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentation") );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentation::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentation::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentation") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+// XIndexContainer
+void SAL_CALL SdXCustomPresentation::insertByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if( Index < 0 || Index > (sal_Int32)( mpSdCustomShow ? mpSdCustomShow->Count() : 0 ) )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference< drawing::XDrawPage > xPage;
+ Element >>= xPage;
+
+ if(!xPage.is())
+ throw lang::IllegalArgumentException();
+
+ SdDrawPage* pPage = SdDrawPage::getImplementation( xPage );
+
+ if(pPage)
+ {
+ if( NULL == mpModel )
+ mpModel = pPage->GetModel();
+
+ if( NULL != mpModel && NULL == mpSdCustomShow && mpModel->GetDoc() )
+ mpSdCustomShow = new SdCustomShow( mpModel->GetDoc() );
+
+ mpSdCustomShow->Insert(pPage->GetSdrPage(), Index);
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+void SAL_CALL SdXCustomPresentation::removeByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ {
+ uno::Reference< drawing::XDrawPage > xPage;
+ getByIndex( Index ) >>= xPage;
+
+ if( xPage.is() )
+ {
+ SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage );
+ if(pPage)
+ mpSdCustomShow->Remove(pPage->GetSdrPage());
+ }
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+// XIndexReplace
+void SAL_CALL SdXCustomPresentation::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ removeByIndex( Index );
+ insertByIndex( Index, Element );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdXCustomPresentation::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XDrawPage );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentation::hasElements()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ return getCount() > 0;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdXCustomPresentation::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ return mpSdCustomShow?mpSdCustomShow->Count():0;
+}
+
+uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if( Index < 0 || Index >= (sal_Int32)mpSdCustomShow->Count() )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Any aAny;
+ if(mpSdCustomShow )
+ {
+ SdrPage* pPage = (SdrPage*)mpSdCustomShow->GetObject(Index);
+
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xRef( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xRef;
+ }
+ }
+
+ return aAny;
+}
+
+// XNamed
+OUString SAL_CALL SdXCustomPresentation::getName()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ return mpSdCustomShow->GetName();
+
+ return OUString();
+}
+
+void SAL_CALL SdXCustomPresentation::setName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ if(mpSdCustomShow)
+ mpSdCustomShow->SetName( aName );
+}
+
+// XComponent
+void SAL_CALL SdXCustomPresentation::dispose() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( bDisposing )
+ return; // catched a recursion
+
+ bDisposing = sal_True;
+
+ uno::Reference< uno::XInterface > xSource( (cppu::OWeakObject*)this );
+
+ lang::EventObject aEvt;
+ aEvt.Source = xSource;
+ aDisposeListeners.disposeAndClear(aEvt);
+
+ mpSdCustomShow = NULL;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdXCustomPresentation::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
+{
+ if( bDisposing )
+ throw lang::DisposedException();
+
+ aDisposeListeners.addInterface(xListener);
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdXCustomPresentation::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException)
+{
+ if( !bDisposing )
+ aDisposeListeners.removeInterface(aListener);
+}
+
+/*===========================================================================*
+ * class SdXCustomPresentationAccess : public XCustomPresentationAccess, *
+ * public UsrObject *
+ *===========================================================================*/
+
+SdXCustomPresentationAccess::SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw()
+: mrModel(rMyModel)
+{
+}
+
+SdXCustomPresentationAccess::~SdXCustomPresentationAccess() throw()
+{
+}
+
+// XServiceInfo
+OUString SAL_CALL SdXCustomPresentationAccess::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXCustomPresentationAccess") );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aNS( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CustomPresentationAccess") );
+ uno::Sequence< OUString > aSeq( &aNS, 1 );
+ return aSeq;
+}
+
+// XSingleServiceFactory
+uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstance()
+ throw(uno::Exception, uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xRef( (::cppu::OWeakObject*)new SdXCustomPresentation() );
+ return xRef;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdXCustomPresentationAccess::createInstanceWithArguments( const uno::Sequence< uno::Any >& )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ return createInstance();
+}
+
+// XNameContainer
+void SAL_CALL SdXCustomPresentationAccess::insertByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ // get the documents custom show list
+ List* pList = 0;
+ if(mrModel.GetDoc())
+ pList = mrModel.GetDoc()->GetCustomShowList(sal_True);
+
+ // no list, no cookies
+ if( NULL == pList)
+ throw uno::RuntimeException();
+
+ // do we have an container::XIndexContainer?
+ SdXCustomPresentation* pXShow = NULL;
+
+ uno::Reference< container::XIndexContainer > xContainer;
+ if( (aElement >>= xContainer) && xContainer.is() )
+ pXShow = SdXCustomPresentation::getImplementation(xContainer);
+
+ if( NULL == pXShow )
+ throw lang::IllegalArgumentException();
+
+ // get the internal custom show from the api wrapper
+ SdCustomShow* pShow = pXShow->GetSdCustomShow();
+ if( NULL == pShow )
+ {
+ pShow = new SdCustomShow( mrModel.GetDoc(), xContainer );
+ pXShow->SetSdCustomShow( pShow );
+ }
+ else
+ {
+ if( NULL == pXShow->GetModel() || *pXShow->GetModel() != mrModel )
+ throw lang::IllegalArgumentException();
+ }
+
+ // give it a name
+ pShow->SetName( aName);
+
+ // check if this or another customshow with the same name already exists
+ for( SdCustomShow* pCompare = (SdCustomShow*)pList->First();
+ pCompare;
+ pCompare = (SdCustomShow*)pList->Next() )
+ {
+ if( pCompare == pShow || pCompare->GetName() == pShow->GetName() )
+ throw container::ElementExistException();
+ }
+
+ pList->Insert(pShow);
+
+ mrModel.SetModified();
+}
+
+void SAL_CALL SdXCustomPresentationAccess::removeByName( const OUString& Name )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdCustomShow* pShow = getSdCustomShow(Name);
+
+ List* pList = GetCustomShowList();
+ if(pList && pShow)
+ delete (SdCustomShow*)pList->Remove( pShow );
+ else
+ throw container::NoSuchElementException();
+
+ mrModel.SetModified();
+}
+
+// XNameReplace
+void SAL_CALL SdXCustomPresentationAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ removeByName( aName );
+ insertByName( aName, aElement );
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdXCustomPresentationAccess::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aAny;
+
+ SdCustomShow* pShow = getSdCustomShow(aName);
+ if(pShow)
+ {
+ uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
+ aAny <<= xRef;
+ }
+ else
+ {
+ throw container::NoSuchElementException();
+ }
+
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getElementNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ List* pList = GetCustomShowList();
+ const sal_uInt32 nCount = pList?pList->Count():0;
+
+ uno::Sequence< OUString > aSequence( nCount );
+ OUString* pStringList = aSequence.getArray();
+
+ sal_uInt32 nIdx = 0;
+ while( nIdx < nCount )
+ {
+ const SdCustomShow* pShow = (const SdCustomShow*)pList->GetObject(nIdx);
+ pStringList[nIdx] = pShow->GetName();
+ nIdx++;
+ }
+
+ return aSequence;
+}
+
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return getSdCustomShow(aName) != NULL;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdXCustomPresentationAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( container::XIndexContainer );
+}
+
+sal_Bool SAL_CALL SdXCustomPresentationAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ List* pList = GetCustomShowList();
+ return pList && pList->Count() > 0;
+}
+
+SdCustomShow * SdXCustomPresentationAccess::getSdCustomShow( const OUString& Name ) const throw()
+{
+ sal_uInt32 nIdx = 0;
+
+ List* pList = GetCustomShowList();
+ const sal_uInt32 nCount = pList?pList->Count():0;
+
+ const String aName( Name );
+
+ while( nIdx < nCount )
+ {
+ SdCustomShow* pShow = (SdCustomShow*)pList->GetObject(nIdx);
+ if( pShow->GetName() == aName )
+ return pShow;
+ nIdx++;
+ }
+ return NULL;
+}
diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx
new file mode 100755
index 000000000000..615d5ba7007c
--- /dev/null
+++ b/sd/source/ui/unoidl/unocpres.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOCPRES_HXX
+#define _SD_UNOCPRES_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <osl/mutex.hxx>
+
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/servicehelper.hxx>
+
+///////////////////////////////////////////////////////////////////////////////
+
+class SdXImpressDocument;
+class SdView;
+class SdDrawViewShell;
+class SdCustomShow;
+
+class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ SdCustomShow* mpSdCustomShow;
+ SdXImpressDocument* mpModel;
+
+ // for xComponent
+ ::osl::Mutex aDisposeContainerMutex;
+ ::cppu::OInterfaceContainerHelper aDisposeListeners;
+ BOOL bDisposing;
+
+public:
+ SdXCustomPresentation() throw();
+ SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
+ virtual ~SdXCustomPresentation() throw();
+
+ // internal
+ void Invalidate() { mpSdCustomShow = NULL; }
+ SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
+ void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
+ SdXImpressDocument* GetModel() const throw() { return mpModel; }
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexContainer
+ virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// --------------------------------------------------------------------------
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+
+class List;
+
+class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::lang::XSingleServiceFactory,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ SdXImpressDocument& mrModel;
+
+ // intern
+ inline List* GetCustomShowList() const throw();
+ SdCustomShow * getSdCustomShow( const ::rtl::OUString& Name ) const throw();
+
+public:
+ SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
+ ~SdXCustomPresentationAccess() throw();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XSingleServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+};
+
+inline List * SdXCustomPresentationAccess::GetCustomShowList() const throw()
+{
+ if(mrModel.GetDoc())
+ return mrModel.GetDoc()->GetCustomShowList(sal_False);
+ else
+ return NULL;
+};
+
+#endif
+
+
diff --git a/sd/source/ui/unoidl/unodoc.cxx b/sd/source/ui/unoidl/unodoc.cxx
new file mode 100644
index 000000000000..a423692caa4f
--- /dev/null
+++ b/sd/source/ui/unoidl/unodoc.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// System - Includes -----------------------------------------------------
+
+#include <tools/string.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include "sdmod.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+// com.sun.star.comp.Draw.DrawingDocument
+
+::rtl::OUString SAL_CALL SdDrawingDocument_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingDocument" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 2 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
+ aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SdDLL::Init();
+
+ SfxObjectShell* pShell =
+ new ::sd::GraphicDocShell(
+ _nCreationFlags, FALSE, DOCUMENT_TYPE_DRAW );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+// com.sun.star.comp.Draw.PresentationDocument
+
+::rtl::OUString SAL_CALL SdPresentationDocument_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.PresentationDocument" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 2 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+ aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SdDLL::Init();
+
+ SfxObjectShell* pShell =
+ new ::sd::DrawDocShell(
+ _nCreationFlags, FALSE, DOCUMENT_TYPE_IMPRESS );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+
diff --git a/sd/source/ui/unoidl/unohelp.hxx b/sd/source/ui/unoidl/unohelp.hxx
new file mode 100644
index 000000000000..9f25da2c6089
--- /dev/null
+++ b/sd/source/ui/unoidl/unohelp.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+namespace sd
+{
+inline sal_Bool any2bool( const ::com::sun::star::uno::Any& rAny, sal_Bool& rBool )
+{
+ if( rAny.getValueType() == ::getCppuBooleanType() )
+ {
+ rBool = *(sal_Bool*)rAny.getValue();
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if(!(rAny >>= nValue))
+ return sal_False;
+ rBool = nValue != 0;
+ }
+
+ return sal_True;
+}
+
+inline void bool2any( sal_Bool bBool, ::com::sun::star::uno::Any& rAny )
+{
+ rAny.setValue( &bBool, ::getCppuBooleanType() );
+}
+
+}
+
+#define ITYPE( xint ) \
+ ::getCppuType((const uno::Reference< xint >*)0)
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
+ aAny <<= uno::Reference< xint >(this)
diff --git a/sd/source/ui/unoidl/unokywds.cxx b/sd/source/ui/unoidl/unokywds.cxx
new file mode 100644
index 000000000000..2f417a5f4709
--- /dev/null
+++ b/sd/source/ui/unoidl/unokywds.cxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifndef _SD_UNOKYWDS_HXX_
+#define SD_DEFINE_KEYWORDS
+#include <unokywds.hxx>
+#undef SD_DEFINE_KEYWORDS
+#endif
+
+
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx
new file mode 100644
index 000000000000..5ad9fe3fd555
--- /dev/null
+++ b/sd/source/ui/unoidl/unolayer.cxx
@@ -0,0 +1,832 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "unolayer.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+
+#include <svx/svdpagv.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svdobj.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+// folgende fuer InsertSdPage()
+#include <svx/svdlayer.hxx>
+
+#ifndef SVX_LIGHT
+#ifndef SD_DRAW_DOC_SHELL_HXX
+#include "DrawDocShell.hxx"
+#endif
+#endif
+#include <drawdoc.hxx>
+#include <unomodel.hxx>
+#include "unoprnms.hxx"
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <svx/svdpool.hxx>
+#include "unohelp.hxx"
+#include "FrameView.hxx"
+#include "DrawViewShell.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "glob.hrc"
+
+#include "unokywds.hxx"
+#include "unowcntr.hxx"
+#include <vcl/svapp.hxx>
+
+using namespace ::rtl;
+using namespace ::vos;
+using namespace ::com::sun::star;
+
+//=============================================================================
+// class SdLayer
+//=============================================================================
+
+#define WID_LAYER_LOCKED 1
+#define WID_LAYER_PRINTABLE 2
+#define WID_LAYER_VISIBLE 3
+#define WID_LAYER_NAME 4
+#define WID_LAYER_TITLE 5
+#define WID_LAYER_DESC 6
+
+const SvxItemPropertySet* ImplGetSdLayerPropertySet()
+{
+ static const SfxItemPropertyMapEntry aSdLayerPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_LOCKED), WID_LAYER_LOCKED, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_PRINTABLE), WID_LAYER_PRINTABLE,&::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_VISIBLE), WID_LAYER_VISIBLE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_LAYER_NAME), WID_LAYER_NAME, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Title"), WID_LAYER_TITLE, &::getCppuType((const OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Description"), WID_LAYER_DESC, &::getCppuType((const OUString*)0), 0, 0 },
+ { 0,0,0,0,0,0}
+ };
+ static SvxItemPropertySet aSDLayerPropertySet_Impl( aSdLayerPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aSDLayerPropertySet_Impl;
+}
+
+String SdLayer::convertToInternalName( const OUString& rName )
+{
+ if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background) ) )
+ {
+ return String( SdResId( STR_LAYER_BCKGRND ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_background_objects) ) )
+ {
+ return String( SdResId( STR_LAYER_BCKGRNDOBJ ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_layout) ) )
+ {
+ return String( SdResId( STR_LAYER_LAYOUT ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_controls) ) )
+ {
+ return String( SdResId( STR_LAYER_CONTROLS ) );
+ }
+ else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_LayerName_measurelines) ) )
+ {
+ return String( SdResId( STR_LAYER_MEASURELINES ) );
+ }
+ else
+ {
+ return String( rName );
+ }
+}
+
+OUString SdLayer::convertToExternalName( const String& rName )
+{
+ const String aCompare( rName );
+ if( rName == String( SdResId( STR_LAYER_BCKGRND ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_BCKGRNDOBJ ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_background_objects) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_LAYOUT ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_layout) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_CONTROLS ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_controls) );
+ }
+ else if( rName == String( SdResId( STR_LAYER_MEASURELINES ) ) )
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_LayerName_measurelines) );
+ }
+ else
+ {
+ return OUString( rName );
+ }
+}
+
+/** */
+SdLayer::SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw()
+: pLayerManager(pLayerManager_)
+, mxLayerManager(pLayerManager_)
+, pLayer(pSdrLayer_)
+, pPropSet(ImplGetSdLayerPropertySet())
+{
+}
+
+/** */
+SdLayer::~SdLayer() throw()
+{
+}
+
+// uno helper
+UNO3_GETIMPLEMENTATION_IMPL( SdLayer );
+
+// XServiceInfo
+OUString SAL_CALL SdLayer::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( OUString::createFromAscii(sUNO_SdLayer) );
+}
+
+sal_Bool SAL_CALL SdLayer::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayer::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayer) );
+ uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// beans::XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdLayer::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return pPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(pLayer == NULL || pLayerManager == NULL)
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_LAYER_LOCKED:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( LOCKED, bValue );
+ break;
+ }
+ case WID_LAYER_PRINTABLE:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( PRINTABLE, bValue );
+ break;
+ }
+ case WID_LAYER_VISIBLE:
+ {
+ sal_Bool bValue = sal_False;
+ if(!sd::any2bool( aValue, bValue ))
+ throw lang::IllegalArgumentException();
+ set( VISIBLE, bValue );
+ break;
+ }
+ case WID_LAYER_NAME:
+ {
+ OUString aName;
+ if(!(aValue >>= aName))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetName(SdLayer::convertToInternalName( aName ) );
+ pLayerManager->UpdateLayerView();
+ break;
+ }
+
+ case WID_LAYER_TITLE:
+ {
+ OUString sTitle;
+ if(!(aValue >>= sTitle))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetTitle(sTitle);
+ break;
+ }
+
+ case WID_LAYER_DESC:
+ {
+ OUString sDescription;
+ if(!(aValue >>= sDescription))
+ throw lang::IllegalArgumentException();
+
+ pLayer->SetDescription(sDescription);
+ break;
+ }
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+#ifndef SVX_LIGHT
+ if( pLayerManager->GetDocShell() )
+ pLayerManager->GetDocShell()->SetModified();
+#endif
+}
+
+uno::Any SAL_CALL SdLayer::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(pLayer == NULL || pLayerManager == NULL)
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(PropertyName);
+
+ uno::Any aValue;
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_LAYER_LOCKED:
+ sd::bool2any( get( LOCKED ), aValue );
+ break;
+ case WID_LAYER_PRINTABLE:
+ sd::bool2any( get( PRINTABLE ), aValue );
+ break;
+ case WID_LAYER_VISIBLE:
+ sd::bool2any( get( VISIBLE ), aValue );
+ break;
+ case WID_LAYER_NAME:
+ {
+ OUString aRet( SdLayer::convertToExternalName( pLayer->GetName() ) );
+ aValue <<= aRet;
+ break;
+ }
+ case WID_LAYER_TITLE:
+ aValue <<= OUString( pLayer->GetTitle() );
+ break;
+ case WID_LAYER_DESC:
+ aValue <<= OUString( pLayer->GetDescription() );
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+void SAL_CALL SdLayer::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdLayer::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+/** */
+sal_Bool SdLayer::get( LayerAttribute what ) throw()
+{
+ if(pLayer&&pLayerManager)
+ {
+ // Versuch 1. ist eine beliebige Seite geoeffnet?
+ ::sd::View *pView = pLayerManager->GetView();
+ SdrPageView* pSdrPageView = NULL;
+ if(pView)
+ pSdrPageView = pView->GetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ String aLayerName = pLayer->GetName();
+ switch(what)
+ {
+ case VISIBLE: return pSdrPageView->IsLayerVisible(aLayerName);
+ case PRINTABLE: return pSdrPageView->IsLayerPrintable(aLayerName);
+ case LOCKED: return pSdrPageView->IsLayerLocked(aLayerName);
+ }
+ }
+
+#ifndef SVX_LIGHT
+ // Versuch 2. Info von der FrameView besorgen
+ if(pLayerManager->GetDocShell())
+ {
+ ::sd::FrameView *pFrameView = pLayerManager->GetDocShell()->GetFrameView();
+ if(pFrameView)
+ switch(what)
+ {
+ case VISIBLE: return pFrameView->GetVisibleLayers().IsSet(pLayer->GetID());
+ case PRINTABLE: return pFrameView->GetPrintableLayers().IsSet(pLayer->GetID());
+ case LOCKED: return pFrameView->GetLockedLayers().IsSet(pLayer->GetID());
+ }
+ }
+#endif
+ }
+ return sal_False; //TODO: uno::Exception?
+}
+
+void SdLayer::set( LayerAttribute what, sal_Bool flag ) throw()
+{
+ if(pLayer&&pLayerManager)
+ {
+ // Versuch 1. ist eine beliebige Seite geoeffnet?
+ ::sd::View *pView = pLayerManager->GetView();
+ SdrPageView* pSdrPageView = NULL;
+ if(pView)
+ pSdrPageView = pView->GetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ String aLayerName(pLayer->GetName());
+ switch(what)
+ {
+ case VISIBLE: pSdrPageView->SetLayerVisible(aLayerName,flag);
+ break;
+ case PRINTABLE: pSdrPageView->SetLayerPrintable(aLayerName,flag);
+ break;
+ case LOCKED: pSdrPageView->SetLayerLocked(aLayerName,flag);
+ break;
+ }
+ }
+
+#ifndef SVX_LIGHT
+ // Versuch 2. Info von der FrameView besorgen
+ if(pLayerManager->GetDocShell())
+ {
+ ::sd::FrameView *pFrameView = pLayerManager->GetDocShell()->GetFrameView();
+
+ if(pFrameView)
+ {
+ SetOfByte aNewLayers;
+ switch(what)
+ {
+ case VISIBLE: aNewLayers = pFrameView->GetVisibleLayers();
+ break;
+ case PRINTABLE: aNewLayers = pFrameView->GetPrintableLayers();
+ break;
+ case LOCKED: aNewLayers = pFrameView->GetLockedLayers();
+ break;
+ }
+
+ aNewLayers.Set(pLayer->GetID(),flag);
+
+ switch(what)
+ {
+ case VISIBLE: pFrameView->SetVisibleLayers(aNewLayers);
+ break;
+ case PRINTABLE: pFrameView->SetPrintableLayers(aNewLayers);
+ break;
+ case LOCKED: pFrameView->SetLockedLayers(aNewLayers);
+ break;
+ }
+ return;
+ }
+ }
+#endif
+ }
+ //TODO: uno::Exception?
+}
+
+
+
+
+//===== ::com::sun::star::container::XChild =================================
+
+uno::Reference<uno::XInterface> SAL_CALL SdLayer::getParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( pLayerManager == NULL )
+ throw lang::DisposedException();
+
+ return uno::Reference<uno::XInterface> (mxLayerManager, uno::UNO_QUERY);
+}
+
+
+void SAL_CALL SdLayer::setParent (const uno::Reference<uno::XInterface >& )
+ throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ throw lang::NoSupportException ();
+}
+
+// XComponent
+void SAL_CALL SdLayer::dispose( ) throw (uno::RuntimeException)
+{
+ pLayerManager = 0;
+ mxLayerManager = 0;
+ pLayer = 0;
+}
+
+void SAL_CALL SdLayer::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR("not implemented!");
+}
+
+void SAL_CALL SdLayer::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR("not implemented!");
+}
+
+
+//=============================================================================
+// class SdLayerManager
+//=============================================================================
+
+/** */
+SdLayerManager::SdLayerManager( SdXImpressDocument& rMyModel ) throw()
+:mpModel( &rMyModel)
+{
+ mpLayers = new SvUnoWeakContainer;
+}
+
+/** */
+SdLayerManager::~SdLayerManager() throw()
+{
+ dispose();
+}
+
+// uno helper
+UNO3_GETIMPLEMENTATION_IMPL( SdLayerManager );
+
+// XComponent
+void SAL_CALL SdLayerManager::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = 0;
+ if( mpLayers )
+ {
+ mpLayers->dispose();
+
+ delete mpLayers;
+ mpLayers = 0;
+ }
+}
+
+void SAL_CALL SdLayerManager::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR("not implemented!");
+}
+
+void SAL_CALL SdLayerManager::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR("not implemented!");
+}
+
+// XServiceInfo
+OUString SAL_CALL SdLayerManager::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( OUString::createFromAscii(sUNO_SdLayerManager) );
+}
+
+sal_Bool SAL_CALL SdLayerManager::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayerManager::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OUString aServiceName( OUString::createFromAscii(sUNO_Service_DrawingLayerManager) );
+ uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// XLayerManager
+uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::insertNewByIndex( sal_Int32 nIndex )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XLayer > xLayer;
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
+ sal_uInt16 nLayer = nLayerCnt - 2 + 1;
+ String aLayerName;
+
+ // Ueberpruefung auf schon vorhandene Namen
+ while( aLayerName.Len()==0 || rLayerAdmin.GetLayer( aLayerName, sal_False) )
+ {
+ aLayerName = String(SdResId(STR_LAYER));
+ aLayerName += String::CreateFromInt32( (sal_Int32)nLayer );
+ nLayer++;
+ }
+
+ SdrLayerAdmin& rLA=mpModel->mpDoc->GetLayerAdmin();
+ const sal_Int32 nMax=rLA.GetLayerCount();
+ if (nIndex>nMax) nIndex=nMax;
+ xLayer = GetLayer (rLA.NewLayer(aLayerName,(USHORT)nIndex));
+ mpModel->SetModified();
+ }
+ return xLayer;
+}
+
+void SAL_CALL SdLayerManager::remove( const uno::Reference< drawing::XLayer >& xLayer )
+ throw(container::NoSuchElementException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdLayer* pSdLayer = SdLayer::getImplementation(xLayer);
+
+ if(pSdLayer && GetView())
+ {
+ const SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer();
+ GetView()->DeleteLayer( pSdrLayer->GetName() );
+
+ UpdateLayerView();
+ }
+
+ mpModel->SetModified();
+}
+
+void SAL_CALL SdLayerManager::attachShapeToLayer( const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XLayer >& xLayer )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdLayer* pSdLayer = SdLayer::getImplementation(xLayer);
+ SdrLayer* pSdrLayer = pSdLayer?pSdLayer->GetSdrLayer():NULL;
+ if(pSdrLayer==NULL)
+ return;
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SdrObject* pSdrObject = pShape?pShape->GetSdrObject():NULL;
+
+ if(pSdrObject && pSdrLayer )
+ pSdrObject->SetLayer(pSdrLayer->GetID());
+
+ mpModel->SetModified();
+}
+
+uno::Reference< drawing::XLayer > SAL_CALL SdLayerManager::getLayerForShape( const uno::Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XLayer > xLayer;
+
+ if(mpModel->mpDoc)
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ SdrObject* pObj = pShape?pShape->GetSdrObject():NULL;
+ if(pObj)
+ {
+ SdrLayerID aId = pObj->GetLayer();
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ xLayer = GetLayer (rLayerAdmin.GetLayerPerID(aId));
+ }
+ }
+ return xLayer;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdLayerManager::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ return rLayerAdmin.GetLayerCount();
+ }
+
+ return 0;
+}
+
+uno::Any SAL_CALL SdLayerManager::getByIndex( sal_Int32 nLayer )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ if( nLayer >= getCount() || nLayer < 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Any aAny;
+
+ if( mpModel->mpDoc )
+ {
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ uno::Reference<drawing::XLayer> xLayer (GetLayer (rLayerAdmin.GetLayer((sal_uInt16)nLayer)));
+ aAny <<= xLayer;
+ }
+ return aAny;
+}
+
+
+// XNameAccess
+uno::Any SAL_CALL SdLayerManager::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpModel->mpDoc == 0 ) )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ SdrLayer* pLayer = rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), FALSE );
+ if( pLayer == NULL )
+ throw container::NoSuchElementException();
+
+ return uno::Any( GetLayer (pLayer) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdLayerManager::getElementNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+ const sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
+
+ uno::Sequence< OUString > aSeq( nLayerCount );
+
+ OUString* pStrings = aSeq.getArray();
+ SdrLayer* pLayer;
+
+ for( sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++ )
+ {
+ pLayer = rLayerAdmin.GetLayer( nLayer );
+ if( pLayer )
+ *pStrings++ = SdLayer::convertToExternalName( pLayer->GetName() );
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdLayerManager::hasByName( const OUString& aName ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
+
+ return NULL != rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ), FALSE );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdLayerManager::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XLayer );
+}
+
+sal_Bool SAL_CALL SdLayerManager::hasElements() throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+/** Falls an den Layern was geaendert wurde sorgt diese Methode dafuer, das
+ die Aenderungen auch in der sdbcx::View sichtbar gemacht werden */
+void SdLayerManager::UpdateLayerView( sal_Bool modify ) const throw()
+{
+ if(mpModel->mpDocShell)
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpModel->mpDocShell->GetViewShell());
+
+ if(pDrViewSh)
+ {
+ sal_Bool bLayerMode = pDrViewSh->IsLayerModeActive();
+ pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), !bLayerMode);
+ pDrViewSh->ChangeEditMode(pDrViewSh->GetEditMode(), bLayerMode);
+ }
+
+ if(modify)
+ mpModel->mpDoc->SetChanged(sal_True);
+ }
+}
+
+/** */
+::sd::View* SdLayerManager::GetView() const throw()
+{
+ if( mpModel->mpDocShell )
+ {
+ ::sd::ViewShell* pViewSh = mpModel->mpDocShell->GetViewShell();
+ if(pViewSh)
+ return pViewSh->GetView();
+ }
+ return NULL;
+}
+
+
+
+namespace
+{
+/** Compare two pointers to <type>SdrLayer</type> objects.
+ @param xRef
+ The implementing SdLayer class provides the first pointer by the
+ <member>SdLayer::GetSdrLayer</member> method.
+ @param pSearchData
+ This void pointer is the second pointer to an <type>SdrLayer</type>
+ object.
+ @return
+ Return </True> if both pointers point to the same object.
+*/
+sal_Bool compare_layers (uno::WeakReference<uno::XInterface> xRef, void* pSearchData)
+{
+ uno::Reference<uno::XInterface> xLayer (xRef);
+ if (xLayer.is())
+ {
+ SdLayer* pSdLayer = SdLayer::getImplementation (xRef);
+ if (pSdLayer != NULL)
+ {
+ SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer ();
+ if (pSdrLayer == static_cast<SdrLayer*>(pSearchData))
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+}
+
+/** Use the <member>mpLayers</member> container of weak references to either
+ retrieve and return a previously created <type>XLayer</type> object for
+ the given <type>SdrLayer</type> object or create and remember a new one.
+*/
+uno::Reference<drawing::XLayer> SdLayerManager::GetLayer (SdrLayer* pLayer)
+{
+ uno::WeakReference<uno::XInterface> xRef;
+ uno::Reference<drawing::XLayer> xLayer;
+
+ // Search existing xLayer for the given pLayer.
+ if (mpLayers->findRef (xRef, (void*)pLayer, compare_layers))
+ xLayer = uno::Reference<drawing::XLayer> (xRef, uno::UNO_QUERY);
+
+ // Create the xLayer if necessary.
+ if ( ! xLayer.is())
+ {
+ xLayer = new SdLayer (this, pLayer);
+
+ // Remember the new xLayer for future calls.
+ uno::WeakReference<uno::XInterface> wRef(xLayer);
+ mpLayers->insert(wRef);
+ }
+
+ return xLayer;
+}
diff --git a/sd/source/ui/unoidl/unolayer.hxx b/sd/source/ui/unoidl/unolayer.hxx
new file mode 100644
index 000000000000..76ccc6e22ab1
--- /dev/null
+++ b/sd/source/ui/unoidl/unolayer.hxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SD_UNOLAYER_HXX
+#define SD_UNOLAYER_HXX
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XLayer.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/servicehelper.hxx>
+
+#include <unomodel.hxx>
+
+class SdrLayer;
+class SdLayerManager;
+class SdXImpressDocument;
+class SvUnoWeakContainer;
+
+namespace sd {
+class View;
+}
+enum LayerAttribute { VISIBLE, PRINTABLE, LOCKED };
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SdLayer : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayer,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XChild,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent >
+{
+public:
+ SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw();
+ virtual ~SdLayer() throw();
+
+ // intern
+ SdrLayer* GetSdrLayer() const throw() { return pLayer; }
+
+ static String convertToInternalName( const ::rtl::OUString& rName );
+ static ::rtl::OUString convertToExternalName( const String& rName );
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdLayer )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XChild
+
+ /** Returns the layer manager that manages this layer.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Not implemented. Allways throws an exception.
+ @raises NoSupportException.
+ */
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ SdLayerManager* pLayerManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayerManager > mxLayerManager;
+
+ SdrLayer* pLayer;
+ const SvxItemPropertySet* pPropSet;
+
+ sal_Bool get( LayerAttribute what ) throw();
+ void set( LayerAttribute what, sal_Bool flag ) throw();
+
+};
+
+
+
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//#include <cppuhelper/implbase4.hxx>
+
+class SdLayerManager : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayerManager,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent >
+{
+ friend class SdLayer;
+
+public:
+ SdLayerManager( SdXImpressDocument& rMyModel ) throw();
+ virtual ~SdLayerManager() throw();
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdLayerManager )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XLayerManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL attachShapeToLayer( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL getLayerForShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ /** Return the <type>XLayer</type> object that is associated with the
+ given <type>SdrLayer</type> object. If the requested object does
+ not yet exist it is created. All calls with the same argument
+ return the same object.
+ @param pLayer
+ The <type>SdrLayer</type> object for which to return the
+ associated <type>XLayer</type> object.
+ @return
+ The returned value is the unique <type>XLayer</type> object
+ associated with the specified argument. If no layer can be
+ created for the argument than an empty reference is returned.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> GetLayer (SdrLayer* pLayer);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ SdXImpressDocument* mpModel;
+ SvUnoWeakContainer* mpLayers;
+
+ ::sd::View* GetView() const throw();
+ ::sd::DrawDocShell* GetDocShell() const throw() { return mpModel->mpDocShell; }
+ void UpdateLayerView( sal_Bool modify = sal_True ) const throw();
+};
+
+#endif
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
new file mode 100755
index 000000000000..e11f76a64baa
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -0,0 +1,3069 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/presentation/XPresentation2.hpp>
+
+#include <osl/mutex.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <comphelper/sequence.hxx>
+
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <editeng/unofield.hxx>
+#include <unomodel.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/UnoForbiddenCharsTable.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svx/UnoNamespaceMap.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/unofill.hxx>
+#include <svx/unopool.hxx>
+#include <svx/svdorect.hxx>
+#include <editeng/flditem.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/svdpagv.hxx>
+#include <svtools/unoimap.hxx>
+#include <svx/unoshape.hxx>
+#include <editeng/unonrule.hxx>
+#include <editeng/eeitem.hxx>
+
+// #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+#include <svx/xmleohlp.hxx>
+#include <svx/xmlgrhlp.hxx>
+#include "DrawDocShell.hxx"
+#include "ViewShellBase.hxx"
+#include <UnoDocumentSettings.hxx>
+
+#include <drawdoc.hxx>
+#include <glob.hrc>
+#include <sdresid.hxx>
+#include <sdpage.hxx>
+
+#include <strings.hrc>
+#include "unohelp.hxx"
+#include <unolayer.hxx>
+#include <unoprnms.hxx>
+#include <unopage.hxx>
+#include <unocpres.hxx>
+#include <unoobj.hxx>
+#include <stlpool.hxx>
+#include <unopback.hxx>
+#include <unokywds.hxx>
+#include "FrameView.hxx"
+#include "ClientView.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+#include <vcl/pdfextoutdevdata.hxx>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <tools/urlobj.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#include <com/sun/star/office/XAnnotation.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+#include <com/sun/star/office/XAnnotationEnumeration.hpp>
+#include <com/sun/star/geometry/RealPoint2D.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+using ::rtl::OUString;
+
+#include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
+
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+
+extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel );
+
+class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
+ public SfxListener
+{
+public:
+ SdUnoForbiddenCharsTable( SdrModel* pModel );
+ ~SdUnoForbiddenCharsTable();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
+protected:
+ virtual void onChange();
+
+private:
+ SdrModel* mpModel;
+};
+
+SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel )
+: SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel )
+{
+ StartListening( *pModel );
+}
+
+void SdUnoForbiddenCharsTable::onChange()
+{
+ if( mpModel )
+ {
+ mpModel->ReformatAllTextObjects();
+ }
+}
+
+SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
+{
+ if( mpModel )
+ EndListening( *mpModel );
+}
+
+void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ if( HINT_MODELCLEARED == pSdrHint->GetKind() )
+ {
+ mpModel = NULL;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+const sal_Int32 WID_MODEL_LANGUAGE = 1;
+const sal_Int32 WID_MODEL_TABSTOP = 2;
+const sal_Int32 WID_MODEL_VISAREA = 3;
+const sal_Int32 WID_MODEL_MAPUNIT = 4;
+const sal_Int32 WID_MODEL_FORBCHARS= 5;
+const sal_Int32 WID_MODEL_CONTFOCUS = 6;
+const sal_Int32 WID_MODEL_DSGNMODE = 7;
+const sal_Int32 WID_MODEL_BASICLIBS = 8;
+const sal_Int32 WID_MODEL_RUNTIMEUID = 9;
+const sal_Int32 WID_MODEL_BUILDID = 10;
+const sal_Int32 WID_MODEL_HASVALIDSIGNATURES = 11;
+const sal_Int32 WID_MODEL_DIALOGLIBS = 12;
+
+const SvxItemPropertySet* ImplGetDrawModelPropertySet()
+{
+ // Achtung: Der erste Parameter MUSS sortiert vorliegen !!!
+ const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("BuildId"), WID_MODEL_BUILDID, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_CharLocale), WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_TabStop), WID_MODEL_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_VisibleArea), WID_MODEL_VISAREA, &::getCppuType((const awt::Rectangle*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_MapUnit), WID_MODEL_MAPUNIT, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters), WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ), WID_MODEL_CONTFOCUS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("BasicLibraries"), WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN("DialogLibraries"), WID_MODEL_DIALOGLIBS, &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_RuntimeUID), WID_MODEL_RUNTIMEUID, &::getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0 },
+ { MAP_CHAR_LEN(sUNO_Prop_HasValidSignatures), WID_MODEL_HASVALIDSIGNATURES, &::getCppuType(static_cast< const sal_Bool * >(0)), beans::PropertyAttribute::READONLY, 0 },
+ { 0,0,0,0,0,0 }
+ };
+ static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aDrawModelPropertySet_Impl;
+}
+
+// this ctor is used from the DocShell
+SdXImpressDocument::SdXImpressDocument (::sd::DrawDocShell* pShell, bool bClipBoard ) throw()
+: SfxBaseModel( pShell ),
+ mpDocShell( pShell ),
+ mpDoc( pShell ? pShell->GetDoc() : NULL ),
+ mbDisposed(false),
+ mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
+ mbClipBoard( bClipBoard ),
+ mpPropSet( ImplGetDrawModelPropertySet() )
+{
+ if( mpDoc )
+ {
+ StartListening( *mpDoc );
+ }
+ else
+ {
+ DBG_ERROR("DocShell is invalid");
+ }
+}
+
+SdXImpressDocument::SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard ) throw()
+: SfxBaseModel( NULL ),
+ mpDocShell( NULL ),
+ mpDoc( pDoc ),
+ mbDisposed(false),
+ mbImpressDoc( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
+ mbClipBoard( bClipBoard ),
+ mpPropSet( ImplGetDrawModelPropertySet() )
+{
+ if( mpDoc )
+ {
+ StartListening( *mpDoc );
+ }
+ else
+ {
+ DBG_ERROR("SdDrawDocument is invalid");
+ }
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+SdXImpressDocument::~SdXImpressDocument() throw()
+{
+}
+
+// uno helper
+
+
+/******************************************************************************
+* Erzeugt anhand der uebergebennen SdPage eine SdDrawPage. Wurde fuer diese *
+* SdPage bereits eine SdDrawPage erzeugt, wird keine neue SdDrawPage erzeug. *
+******************************************************************************/
+/*
+uno::Reference< drawing::XDrawPage > SdXImpressDocument::CreateXDrawPage( SdPage* pPage ) throw()
+{
+ DBG_ASSERT(pPage,"SdXImpressDocument::CreateXDrawPage( NULL? )");
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+
+ if(pPage)
+ {
+ xDrawPage = SvxDrawPage::GetPageForSdrPage(pPage);
+
+ if(!xDrawPage.is())
+ {
+ if(pPage->IsMasterPage())
+ {
+ xDrawPage = (presentation::XPresentationPage*)new SdMasterPage( this, pPage );
+ }
+ else
+ {
+ xDrawPage = (SvxDrawPage*)new SdDrawPage( this, pPage );
+ }
+ }
+ }
+
+ return xDrawPage;
+}
+*/
+
+// XInterface
+uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT(lang::XServiceInfo);
+ else QUERYINT(beans::XPropertySet);
+ else QUERYINT(lang::XMultiServiceFactory);
+ else QUERYINT(drawing::XDrawPageDuplicator);
+ else QUERYINT(drawing::XLayerSupplier);
+ else QUERYINT(drawing::XMasterPagesSupplier);
+ else QUERYINT(drawing::XDrawPagesSupplier);
+ else QUERYINT(presentation::XHandoutMasterSupplier);
+ else QUERYINT(document::XLinkTargetSupplier);
+ else QUERYINT(style::XStyleFamiliesSupplier);
+ else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
+ else QUERYINT(view::XRenderable);
+ else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) )
+ aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
+ else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) )
+ aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
+ else
+ return SfxBaseModel::queryInterface( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SdXImpressDocument::acquire() throw ( )
+{
+ SfxBaseModel::acquire();
+}
+
+void SAL_CALL SdXImpressDocument::release() throw ( )
+{
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if(!mbDisposed)
+ {
+ try
+ {
+ dispose();
+ }
+ catch (uno::RuntimeException const& exc)
+ { // don't break throw ()
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ }
+ SfxBaseModel::release();
+ }
+}
+
+// XUnoTunnel
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() throw()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SdXImpressDocument* SdXImpressDocument::getImplementation( const uno::Reference< uno::XInterface >& xInt )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ return reinterpret_cast<SdXImpressDocument*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( SdXImpressDocument::getUnoTunnelId() )));
+ else
+ return NULL;
+}
+
+sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rIdentifier.getLength() == 16 )
+ {
+ if( (0 == rtl_compareMemory( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+
+ if( (0 == rtl_compareMemory( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc));
+ }
+
+ return SfxBaseModel::getSomething( rIdentifier );
+}
+
+// XTypeProvider
+uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ const sal_Int32 nOwnTypes = mbImpressDoc ? 14 : 11; // !DANGER! Keep this updated!
+
+ maTypeSequence.realloc( nBaseTypes + nOwnTypes );
+ uno::Type* pTypes = maTypeSequence.getArray();
+
+ *pTypes++ = ITYPE(beans::XPropertySet);
+ *pTypes++ = ITYPE(lang::XServiceInfo);
+ *pTypes++ = ITYPE(lang::XMultiServiceFactory);
+ *pTypes++ = ITYPE(drawing::XDrawPageDuplicator);
+ *pTypes++ = ITYPE(drawing::XLayerSupplier);
+ *pTypes++ = ITYPE(drawing::XMasterPagesSupplier);
+ *pTypes++ = ITYPE(drawing::XDrawPagesSupplier);
+ *pTypes++ = ITYPE(document::XLinkTargetSupplier);
+ *pTypes++ = ITYPE(style::XStyleFamiliesSupplier);
+ *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory);
+ *pTypes++ = ITYPE(view::XRenderable);
+ if( mbImpressDoc )
+ {
+ *pTypes++ = ITYPE(presentation::XPresentationSupplier);
+ *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier);
+ *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier);
+ }
+
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if( mpDoc )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ if( hasEventListeners() )
+ {
+ document::EventObject aEvent;
+ if( SvxUnoDrawMSFactory::createEvent( mpDoc, pSdrHint, aEvent ) )
+ notifyEvent( aEvent );
+ }
+
+ if( pSdrHint->GetKind() == HINT_MODELCLEARED )
+ {
+ if( mpDoc )
+ EndListening( *mpDoc );
+ mpDoc = NULL;
+ mpDocShell = NULL;
+ }
+ }
+ else
+ {
+ const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
+
+ // ist unser SdDrawDocument gerade gestorben?
+ if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
+ {
+ // yup, also schnell ein neues erfragen
+ if( mpDocShell )
+ {
+ SdDrawDocument *pNewDoc = mpDocShell->GetDoc();
+
+ // ist ueberhaupt ein neues da?
+ if( pNewDoc != mpDoc )
+ {
+ mpDoc = pNewDoc;
+ if(mpDoc)
+ StartListening( *mpDoc );
+ }
+ }
+ }
+ }
+ }
+ SfxBaseModel::Notify( rBC, rHint );
+}
+
+/******************************************************************************
+* *
+******************************************************************************/
+SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw()
+{
+ sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
+ SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+ BYTE aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ BYTE aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+
+ SdPage* pStandardPage = NULL;
+
+ if( 0 == nPageCount )
+ {
+ // this is only used for clipboard where we only have one page
+ pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ Size aDefSize(21000, 29700); // A4-Hochformat
+ pStandardPage->SetSize( aDefSize );
+ mpDoc->InsertPage(pStandardPage, 0);
+ }
+ else
+ {
+ // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll
+ SdPage* pPreviousStandardPage = mpDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD );
+ SetOfByte aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers();
+ sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd );
+ sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj );
+
+ // AutoLayouts muessen fertig sein
+ mpDoc->StopWorkStartupDelay();
+
+ /**************************************************************
+ * Es wird stets zuerst eine Standardseite und dann eine
+ * Notizseite erzeugt. Es ist sichergestellt, dass auf eine
+ * Standardseite stets die zugehoerige Notizseite folgt.
+ **************************************************************/
+
+ sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
+ SdPage* pPreviousNotesPage = (SdPage*) mpDoc->GetPage( nStandardPageNum - 1 );
+ sal_uInt16 nNotesPageNum = nStandardPageNum + 1;
+ String aStandardPageName;
+ String aNotesPageName;
+
+ /**************************************************************
+ * Standardseite
+ **************************************************************/
+ if( bDuplicate )
+ pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
+ else
+ pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
+ pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
+ pPreviousStandardPage->GetUppBorder(),
+ pPreviousStandardPage->GetRgtBorder(),
+ pPreviousStandardPage->GetLwrBorder() );
+ pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() );
+ pStandardPage->SetName(aStandardPageName);
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pStandardPage, nStandardPageNum);
+
+ if( !bDuplicate )
+ {
+ // MasterPage der aktuellen Seite verwenden
+ pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
+ pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
+ pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True );
+ }
+
+ aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
+ aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
+ aVisibleLayers.Set(aBckgrnd, bIsPageBack);
+ aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
+ pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ /**************************************************************
+ * Notizseite
+ **************************************************************/
+ SdPage* pNotesPage = NULL;
+
+ if( bDuplicate )
+ pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
+ else
+ pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
+
+ pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
+ pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(),
+ pPreviousNotesPage->GetUppBorder(),
+ pPreviousNotesPage->GetRgtBorder(),
+ pPreviousNotesPage->GetLwrBorder() );
+ pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
+ pNotesPage->SetName(aNotesPageName);
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pNotesPage, nNotesPageNum);
+
+ if( !bDuplicate )
+ {
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
+ pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True );
+ }
+ }
+
+ SetModified();
+
+ return( pStandardPage );
+}
+
+void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw()
+{
+ if( mpDoc )
+ mpDoc->SetChanged( bModified );
+}
+
+// XModel
+void SAL_CALL SdXImpressDocument ::lockControllers( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ mpDoc->setLock( sal_True );
+}
+
+void SAL_CALL SdXImpressDocument::unlockControllers( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ if( mpDoc->isLocked() )
+ {
+ mpDoc->setLock( sal_False );
+ }
+}
+
+sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ return mpDoc && mpDoc->isLocked();
+}
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
+
+ if( !xRet.is() )
+ {
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ if( pFrameViewList && pFrameViewList->Count() )
+ {
+ xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"))));
+
+
+ uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY );
+ DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
+ if( xCont.is() )
+ {
+ sal_uInt32 i;
+ for( i = 0; i < pFrameViewList->Count(); i++ )
+ {
+ ::sd::FrameView* pFrameView =
+ static_cast< ::sd::FrameView*>(
+ pFrameViewList->GetObject(i));
+
+ if(pFrameView)
+ {
+ uno::Sequence< beans::PropertyValue > aSeq;
+ pFrameView->WriteUserDataSequence( aSeq );
+ xCont->insertByIndex( i, uno::makeAny( aSeq ) );
+ }
+ }
+ }
+ }
+ }
+
+ return xRet;
+}
+
+void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ SfxBaseModel::setViewData( xData );
+ if( mpDocShell && (mpDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() )
+ {
+ const sal_Int32 nCount = xData->getCount();
+
+ List* pFrameViewList = mpDoc->GetFrameViewList();
+
+ DBG_ASSERT( pFrameViewList, "No FrameViewList?" );
+ if( pFrameViewList )
+ {
+ ::sd::FrameView* pFrameView;
+
+ sal_uInt32 i;
+ for ( i = 0; i < pFrameViewList->Count(); i++)
+ {
+ // Ggf. FrameViews loeschen
+ pFrameView = static_cast< ::sd::FrameView*>(
+ pFrameViewList->GetObject(i));
+
+ if (pFrameView)
+ delete pFrameView;
+ }
+
+ pFrameViewList->Clear();
+
+ uno::Sequence< beans::PropertyValue > aSeq;
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ if( xData->getByIndex( nIndex ) >>= aSeq )
+ {
+ pFrameView = new ::sd::FrameView( mpDoc );
+ pFrameView->ReadUserDataSequence( aSeq );
+ pFrameViewList->Insert( pFrameView );
+ }
+ }
+ }
+ }
+}
+
+// XDrawPageDuplicator
+uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ // pPage von xPage besorgen und dann die Id (nPos )ermitteln
+ SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
+ if( pSvxPage )
+ {
+ SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
+ sal_uInt16 nPos = pPage->GetPageNum();
+ nPos = ( nPos - 1 ) / 2;
+ pPage = InsertSdPage( nPos, sal_True );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ return xDrawPage;
+ }
+ }
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+ return xDrawPage;
+}
+
+
+// XDrawPagesSupplier
+uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess );
+
+ if( !xDrawPages.is() )
+ {
+ initializeDocument();
+ mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this);
+ }
+
+ return xDrawPages;
+}
+
+// XMasterPagesSupplier
+uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess );
+
+ if( !xMasterPages.is() )
+ {
+ initializeDocument();
+ mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
+ }
+
+ return xMasterPages;
+}
+
+// XLayerManagerSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
+
+ if( !xLayerManager.is() )
+ mxLayerManager = xLayerManager = new SdLayerManager(*this);
+
+ return xLayerManager;
+}
+
+// XCustomPresentationSupplier
+uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess );
+
+ if( !xCustomPres.is() )
+ mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this);
+
+ return xCustomPres;
+}
+
+extern uno::Reference< presentation::XPresentation > createPresentation( SdXImpressDocument& rModel );
+
+// XPresentationSupplier
+uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() );
+}
+
+// XHandoutMasterSupplier
+uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage()
+ throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPage > xPage;
+
+ if( mpDoc )
+ {
+ initializeDocument();
+ SdPage* pPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
+ if( pPage )
+ xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
+ }
+ return xPage;
+}
+
+// XMultiServiceFactory ( SvxFmMSFactory )
+uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
+ {
+ if( !mxDashTable.is() )
+ mxDashTable = SvxUnoDashTable_createInstance( mpDoc );
+
+ return mxDashTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
+ {
+ if( !mxGradientTable.is() )
+ mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc );
+
+ return mxGradientTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
+ {
+ if( !mxHatchTable.is() )
+ mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc );
+
+ return mxHatchTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
+ {
+ if( !mxBitmapTable.is() )
+ mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc );
+
+ return mxBitmapTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
+ {
+ if( !mxTransGradientTable.is() )
+ mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc );
+
+ return mxTransGradientTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
+ {
+ if( !mxMarkerTable.is() )
+ mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc );
+
+ return mxMarkerTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
+ {
+ return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY );
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) )
+ {
+ return uno::Reference< uno::XInterface >(
+ static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc )));
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) )
+ {
+ if( !mxDrawingPool.is() )
+ mxDrawingPool = SdUnoCreatePool( mpDoc );
+
+ return mxDrawingPool;
+
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapRectangleObject) ) )
+ {
+ return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapCircleObject) ) )
+ {
+ return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapPolygonObject) ) )
+ {
+ return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) ||
+ ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) ||
+ ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) )
+ {
+ return sd::DocumentSettings_createInstance( this );
+ }
+
+ if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) ||
+ ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_HEADERFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_FOOTERFIELD );
+ }
+
+ if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
+ (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_DATETIMEFIELD );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
+ {
+ static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
+
+ return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() );
+ }
+
+ // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) )
+ {
+ return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) )
+ {
+ return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
+ if( NULL == pPersist )
+ throw lang::DisposedException();
+
+ return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
+ if( NULL == pPersist )
+ throw lang::DisposedException();
+
+ return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ );
+ }
+
+ uno::Reference< uno::XInterface > xRet;
+
+ const String aType( aServiceSpecifier );
+ if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
+ {
+ SvxShape* pShape = NULL;
+
+ sal_uInt16 nType = OBJ_TEXT;
+ // create a shape wrapper
+ if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
+ {
+ nType = OBJ_GRAF;
+ }
+ else if( aType.EqualsAscii( "PageShape", 26, 9 ) )
+ {
+ nType = OBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "ChartShape", 26, 10 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "CalcShape", 26, 9 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
+ {
+ nType = OBJ_TABLE;
+ }
+ else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "NotesShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) )
+ {
+ nType = OBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "FooterShape", 26, 12 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "MediaShape", 26, 10 ) )
+ {
+ nType = OBJ_MEDIA;
+ }
+ else
+ {
+ throw lang::ServiceNotRegisteredException();
+ }
+
+ // create the API wrapper
+ pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
+
+ // set shape type
+ if( pShape && !mbClipBoard )
+ pShape->SetShapeType(aServiceSpecifier);
+
+ xRet = (uno::XWeak*)pShape;
+ }
+ else if( aServiceSpecifier.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) )
+ {
+ SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor );
+ if( pShape && !mbClipBoard )
+ pShape->SetShapeType(aServiceSpecifier);
+
+ xRet = (uno::XWeak*)pShape;
+ }
+ else
+ {
+ xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
+ }
+
+ uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY );
+ if( xShape.is() )
+ {
+ xRet.clear();
+ new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this );
+ xRet = xShape;
+ xShape.clear();
+ }
+
+ return xRet;
+}
+
+uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
+
+ uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) );
+
+ sal_uInt16 i(0);
+
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Background"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapRectangleObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapCircleObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapPolygonObject));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap"));
+
+ // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TableShape"));
+
+ if(mbImpressDoc)
+ {
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.FooterShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HeaderShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlideNumberShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DateTimeShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CalcShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.MediaShape"));
+ }
+ else
+ {
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings"));
+ }
+
+ DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
+
+ return comphelper::concatSequences( aSNS_ORG, aSNS );
+}
+
+// lang::XServiceInfo
+OUString SAL_CALL SdXImpressDocument::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXImpressDocument"));
+}
+
+sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if (
+ (ServiceName.equalsAscii("com.sun.star.document.OfficeDocument" )) ||
+ (ServiceName.equalsAscii("com.sun.star.drawing.GenericDrawingDocument")) ||
+ (ServiceName.equalsAscii("com.sun.star.drawing.DrawingDocumentFactory"))
+ )
+ {
+ return sal_True;
+ }
+
+ return (
+ ( mbImpressDoc && ServiceName.equalsAscii("com.sun.star.presentation.PresentationDocument")) ||
+ (!mbImpressDoc && ServiceName.equalsAscii("com.sun.star.drawing.DrawingDocument" ))
+ );
+}
+
+uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Sequence< OUString > aSeq( 4 );
+ OUString* pServices = aSeq.getArray();
+
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OfficeDocument"));
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GenericDrawingDocument"));
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
+
+ if( mbImpressDoc )
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
+ else
+ *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
+
+ return aSeq;
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_MODEL_LANGUAGE:
+ {
+ lang::Locale aLocale;
+ if(!(aValue >>= aLocale))
+ throw lang::IllegalArgumentException();
+
+ mpDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE );
+ break;
+ }
+ case WID_MODEL_TABSTOP:
+ {
+ sal_Int32 nValue = 0;
+ if(!(aValue >>= nValue) || nValue < 0 )
+ throw lang::IllegalArgumentException();
+
+ mpDoc->SetDefaultTabulator((sal_uInt16)nValue);
+ break;
+ }
+ case WID_MODEL_VISAREA:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ awt::Rectangle aVisArea;
+ if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
+ throw lang::IllegalArgumentException();
+
+ pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) );
+ }
+ break;
+ case WID_MODEL_CONTFOCUS:
+ {
+ sal_Bool bFocus = sal_False;
+ if( !(aValue >>= bFocus ) )
+ throw lang::IllegalArgumentException();
+ mpDoc->SetAutoControlFocus( bFocus );
+ }
+ break;
+ case WID_MODEL_DSGNMODE:
+ {
+ sal_Bool bMode = sal_False;
+ if( !(aValue >>= bMode ) )
+ throw lang::IllegalArgumentException();
+ mpDoc->SetOpenInDesignMode( bMode );
+ }
+ break;
+ case WID_MODEL_BUILDID:
+ aValue >>= maBuildId;
+ return;
+ case WID_MODEL_MAPUNIT:
+ case WID_MODEL_BASICLIBS:
+ case WID_MODEL_RUNTIMEUID: // is read-only
+ case WID_MODEL_DIALOGLIBS:
+ throw beans::PropertyVetoException();
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ SetModified();
+}
+
+uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aAny;
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_MODEL_LANGUAGE:
+ {
+ LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE );
+ lang::Locale aLocale;
+ SvxLanguageToLocale( aLocale, eLang );
+ aAny <<= aLocale;
+ break;
+ }
+ case WID_MODEL_TABSTOP:
+ aAny <<= (sal_Int32)mpDoc->GetDefaultTabulator();
+ break;
+ case WID_MODEL_VISAREA:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ const Rectangle& aRect = pEmbeddedObj->GetVisArea();
+ awt::Rectangle aVisArea( aRect.nLeft, aRect.nTop, aRect.getWidth(), aRect.getHeight() );
+ aAny <<= aVisArea;
+ }
+ break;
+ case WID_MODEL_MAPUNIT:
+ {
+ SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
+ if( !pEmbeddedObj )
+ break;
+
+ sal_Int16 nMeasureUnit = 0;
+ SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit );
+ aAny <<= (sal_Int16)nMeasureUnit;
+ }
+ break;
+ case WID_MODEL_FORBCHARS:
+ {
+ aAny <<= getForbiddenCharsTable();
+ }
+ break;
+ case WID_MODEL_CONTFOCUS:
+ aAny <<= (sal_Bool)mpDoc->GetAutoControlFocus();
+ break;
+ case WID_MODEL_DSGNMODE:
+ aAny <<= mpDoc->GetOpenInDesignMode();
+ break;
+ case WID_MODEL_BASICLIBS:
+ aAny <<= mpDocShell->GetBasicContainer();
+ break;
+ case WID_MODEL_DIALOGLIBS:
+ aAny <<= mpDocShell->GetDialogContainer();
+ break;
+ case WID_MODEL_RUNTIMEUID:
+ aAny <<= getRuntimeUID();
+ break;
+ case WID_MODEL_BUILDID:
+ return uno::Any( maBuildId );
+ case WID_MODEL_HASVALIDSIGNATURES:
+ aAny <<= hasValidSignatures();
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aAny;
+}
+
+void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XLinkTargetSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xLinks( mxLinks );
+ if( !xLinks.is() )
+ mxLinks = xLinks = new SdDocLinkTargets( *this );
+ return xLinks;
+}
+
+// XStyleFamiliesSupplier
+uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Reference< container::XNameAccess > xStyles( dynamic_cast< container::XNameAccess* >( mpDoc->GetStyleSheetPool()) );
+ return xStyles;
+}
+
+// XAnyCompareFactory
+uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& )
+ throw (uno::RuntimeException)
+{
+ return SvxCreateNumRuleCompare();
+}
+
+// XRenderable
+sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ sal_Int32 nRet = 0;
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ uno::Sequence< beans::PropertyValue > aRenderer;
+
+ if( mpDocShell && mpDoc )
+ {
+ uno::Reference< frame::XModel > xModel;
+
+ rSelection >>= xModel;
+
+ if( xModel == mpDocShell->GetModel() )
+ nRet = mpDoc->GetSdPageCount( PK_STANDARD );
+ else
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+
+ rSelection >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() )
+ nRet = 1;
+ }
+ }
+ return nRet;
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& ,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ sal_Bool bExportNotesPages = sal_False;
+ for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( rxOptions[ nProperty ].Name.equalsAscii( "ExportNotesPages" ) )
+ rxOptions[ nProperty].Value >>= bExportNotesPages;
+ }
+ uno::Sequence< beans::PropertyValue > aRenderer;
+ if( mpDocShell && mpDoc )
+ {
+ awt::Size aPageSize;
+ if ( bExportNotesPages )
+ {
+ Size aNotesPageSize = mpDoc->GetSdPage( 0, PK_NOTES )->GetSize();
+ aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() );
+ }
+ else
+ {
+ const Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
+ aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
+ }
+ aRenderer.realloc( 1 );
+
+ aRenderer[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
+ aRenderer[ 0 ].Value <<= aPageSize;
+ }
+ return aRenderer;
+}
+
+class ImplRenderPaintProc : public ::sdr::contact::ViewObjectContactRedirector
+{
+ const SdrLayerAdmin& rLayerAdmin;
+ SdrPageView* pSdrPageView;
+ vcl::PDFExtOutDevData* pPDFExtOutDevData;
+
+ vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject );
+
+public:
+ sal_Bool IsVisible ( const SdrObject* pObj ) const;
+ sal_Bool IsPrintable( const SdrObject* pObj ) const;
+
+ ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData );
+ virtual ~ImplRenderPaintProc();
+
+ // all default implementations just call the same methods at the original. To do something
+ // different, overload the method and at least do what the method does.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
+};
+
+ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData )
+: ViewObjectContactRedirector(),
+ rLayerAdmin ( rLA ),
+ pSdrPageView ( pView ),
+ pPDFExtOutDevData ( pData )
+{
+}
+
+ImplRenderPaintProc::~ImplRenderPaintProc()
+{
+}
+
+sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc )
+{
+ sal_Int32 nPage = -1;
+
+ OSL_TRACE("GotoBookmark %s",
+ ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
+
+ String aBookmark( rBookmark );
+
+ if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
+ aBookmark = rBookmark.Copy( 1 );
+
+ // is the bookmark a page ?
+ BOOL bIsMasterPage;
+ USHORT nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
+ SdrObject* pObj = NULL;
+
+ if ( nPgNum == SDRPAGE_NOTFOUND )
+ {
+ // is the bookmark a object ?
+ pObj = rDoc.GetObj( aBookmark );
+ if (pObj)
+ nPgNum = pObj->GetPage()->GetPageNum();
+ }
+ if ( nPgNum != SDRPAGE_NOTFOUND )
+ nPage = ( nPgNum - 1 ) / 2;
+ return nPage;
+}
+
+void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData )
+{
+ try
+ {
+ uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
+ uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
+
+ LanguageType eLanguage = Application::GetSettings().GetLanguage();
+ while( xAnnotationEnumeration->hasMoreElements() )
+ {
+ uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
+
+ geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
+ uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
+// rtl::OUString sInitials( getInitials( sAuthor ) );
+ util::DateTime aDateTime( xAnnotation->getDateTime() );
+
+ Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
+ Time aTime;
+ String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) );
+
+ vcl::PDFNote aNote;
+ String sTitle( xAnnotation->getAuthor() );
+ sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+ sTitle += aStr;
+ aNote.Title = sTitle;
+ aNote.Contents = xText->getString();
+ rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ),
+ static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData )
+{
+ const rtl::OUString sGroup ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) );
+ const rtl::OUString sOnClick ( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+ const rtl::OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
+
+ if ( xShape->getShapeType().equals( sGroup ) )
+ {
+ uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY );
+ if ( xIndexAccess.is() )
+ {
+ sal_Int32 i, nCount = xIndexAccess->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
+ if ( xSubShape.is() )
+ ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData );
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY );
+ if( xShapePropSet.is() )
+ {
+ Size aPageSize( rDoc.GetSdPage( 0, PK_STANDARD )->GetSize() );
+ Point aPoint( 0, 0 );
+ Rectangle aPageRect( aPoint, aPageSize );
+
+ awt::Point aShapePos( xShape->getPosition() );
+ awt::Size aShapeSize( xShape->getSize() );
+ Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) );
+
+ presentation::ClickAction eCa;
+ uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) );
+ if ( aAny >>= eCa )
+ {
+ switch ( eCa )
+ {
+ case presentation::ClickAction_LASTPAGE :
+ {
+ sal_Int32 nCount = rDoc.GetSdPageCount( PK_STANDARD );
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_FIRSTPAGE :
+ {
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_PREVPAGE :
+ {
+ sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
+ if ( nDestPage )
+ nDestPage--;
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+ case presentation::ClickAction_NEXTPAGE :
+ {
+ sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1;
+ sal_Int32 nLastPage = rDoc.GetSdPageCount( PK_STANDARD ) - 1;
+ if ( nDestPage > nLastPage )
+ nDestPage = nLastPage;
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM :
+ case presentation::ClickAction_BOOKMARK :
+ case presentation::ClickAction_DOCUMENT :
+ {
+ rtl::OUString aBookmark;
+ xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark;
+ if( aBookmark.getLength() )
+ {
+ switch( eCa )
+ {
+ case presentation::ClickAction_DOCUMENT :
+ case presentation::ClickAction_PROGRAM :
+ {
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark );
+ }
+ break;
+ case presentation::ClickAction_BOOKMARK :
+ {
+ sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
+ if ( nPage != -1 )
+ {
+ sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle );
+ sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
+ rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ break;
+
+ case presentation::ClickAction_STOPPRESENTATION :
+ case presentation::ClickAction_SOUND :
+ case presentation::ClickAction_INVISIBLE :
+ case presentation::ClickAction_VERB :
+ case presentation::ClickAction_VANISH :
+ case presentation::ClickAction_MACRO :
+ default :
+ break;
+ }
+ }
+ }
+ }
+}
+
+vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject )
+{
+ vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
+
+ if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() )
+ {
+ sal_uInt32 nInventor = rObject.GetObjInventor();
+ sal_uInt16 nIdentifier = rObject.GetObjIdentifier();
+ sal_Bool bIsTextObj = rObject.ISA( SdrTextObj );
+
+ if ( nInventor == SdrInventor )
+ {
+ if ( nIdentifier == OBJ_GRUP )
+ eElement = vcl::PDFWriter::Section;
+ else if ( nIdentifier == OBJ_TITLETEXT )
+ eElement = vcl::PDFWriter::Heading;
+ else if ( nIdentifier == OBJ_OUTLINETEXT )
+ eElement = vcl::PDFWriter::Division;
+ else if ( !bIsTextObj || !((SdrTextObj&)rObject).HasText() )
+ eElement = vcl::PDFWriter::Figure;
+ }
+ }
+
+ return eElement;
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+
+ if(pObject)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pObject->GetPage())
+ {
+ if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
+ {
+ if(IsVisible(pObject) && IsPrintable(pObject))
+ {
+ const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject ));
+ const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement);
+
+ xRetval = ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+
+ if(xRetval.hasElements() && bTagUsed)
+ {
+ // embed Primitive2DSequence in a structure tag element for
+ // exactly this purpose (StructureTagPrimitive2D)
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::StructureTagPrimitive2D(eElement, xRetval));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ else
+ {
+ // not an object, maybe a page
+ return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+}
+
+sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
+{
+ sal_Bool bVisible = sal_True;
+ SdrLayerID nLayerId = pObj->GetLayer();
+ if( pSdrPageView )
+ {
+ const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
+ if ( pSdrLayer )
+ {
+ String aLayerName = pSdrLayer->GetName();
+ bVisible = pSdrPageView->IsLayerVisible( aLayerName );
+ }
+ }
+ return bVisible;
+}
+sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
+{
+ sal_Bool bPrintable = sal_True;
+ SdrLayerID nLayerId = pObj->GetLayer();
+ if( pSdrPageView )
+ {
+ const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
+ if ( pSdrLayer )
+ {
+ String aLayerName = pSdrLayer->GetName();
+ bPrintable = pSdrPageView->IsLayerPrintable( aLayerName );
+ }
+ }
+ return bPrintable;
+
+}
+void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpDoc )
+ throw lang::DisposedException();
+
+ if( mpDocShell && mpDoc )
+ {
+ uno::Reference< awt::XDevice > xRenderDevice;
+ const sal_Int32 nPageNumber = nRenderer + 1;
+ PageKind ePageKind = PK_STANDARD;
+ sal_Bool bExportNotesPages = sal_False;
+
+ for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) )
+ rxOptions[ nProperty ].Value >>= xRenderDevice;
+ else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) )
+ {
+ rxOptions[ nProperty].Value >>= bExportNotesPages;
+ if ( bExportNotesPages )
+ ePageKind = PK_NOTES;
+ }
+ }
+
+ if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+
+ if( pOut )
+ {
+ vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() );
+
+ ::sd::ClientView* pView = new ::sd::ClientView( mpDocShell, pOut, NULL );
+ Rectangle aVisArea = Rectangle( Point(), mpDoc->GetSdPage( (USHORT)nPageNumber - 1, ePageKind )->GetSize() );
+ Region aRegion( aVisArea );
+ Point aOrigin;
+
+ ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
+ ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : NULL;
+
+ if ( pOldSdView )
+ pOldSdView->SdrEndTextEdit();
+
+ pView->SetHlplVisible( sal_False );
+ pView->SetGridVisible( sal_False );
+ pView->SetBordVisible( sal_False );
+ pView->SetPageVisible( sal_False );
+ pView->SetGlueVisible( sal_False );
+
+ pOut->SetMapMode( MAP_100TH_MM );
+ pOut->IntersectClipRegion( aVisArea );
+
+
+
+ uno::Reference< frame::XModel > xModel;
+ rSelection >>= xModel;
+
+ if( xModel == mpDocShell->GetModel() )
+ {
+ pView->ShowSdrPage( mpDoc->GetSdPage( (USHORT)nPageNumber - 1, ePageKind ));
+ SdrPageView* pPV = pView->GetSdrPageView();
+
+ if( pOldSdView )
+ {
+ SdrPageView* pOldPV = pOldSdView->GetSdrPageView();
+ if( pPV && pOldPV )
+ {
+ pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() );
+ pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() );
+ }
+ }
+
+ ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
+ pPV, pPDFExtOutDevData );
+
+ // background color for outliner :o
+ SdPage* pPage = (SdPage*)pPV->GetPage();
+ if( pPage )
+ {
+ SdrOutliner& rOutl = mpDoc->GetDrawOutliner( NULL );
+ bool bScreenDisplay(true);
+
+ if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType())
+ {
+ // #i75566# printing; suppress AutoColor BackgroundColor generation
+ // for visibility reasons by giving GetPageBackgroundColor()
+ // the needed hint
+ bScreenDisplay = false;
+ }
+
+ if(bScreenDisplay && pOut && pOut->GetPDFWriter())
+ {
+ // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
+ bScreenDisplay = false;
+ }
+
+ // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
+ // hint value if screen display. Only then the AutoColor mechanisms shall be applied
+ rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
+ }
+ pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
+
+ if ( pPDFExtOutDevData )
+ {
+ try
+ {
+ uno::Any aAny;
+ uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) );
+ if ( xPage.is() )
+ {
+ if ( pPDFExtOutDevData->GetIsExportNotes() )
+ ImplPDFExportComments( xPage, *pPDFExtOutDevData );
+ uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY );
+ if( xPagePropSet.is() )
+ {
+ // exporting object interactions to pdf
+
+ // if necessary, the master page interactions will be exported first
+ sal_Bool bIsBackgroundObjectsVisible = sal_False; // SJ: #i39428# IsBackgroundObjectsVisible not available for Draw
+ const rtl::OUString sIsBackgroundObjectsVisible( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) );
+ if ( mbImpressDoc && ( xPagePropSet->getPropertyValue( sIsBackgroundObjectsVisible ) >>= bIsBackgroundObjectsVisible ) && bIsBackgroundObjectsVisible )
+ {
+ uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY );
+ if ( xMasterPageTarget.is() )
+ {
+ uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
+ if ( xMasterPage.is() )
+ {
+ uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY );
+ sal_Int32 i, nCount = xShapes->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ aAny = xShapes->getByIndex( i );
+ uno::Reference< drawing::XShape > xShape;
+ if ( aAny >>= xShape )
+ ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
+ }
+ }
+ }
+ }
+
+ // exporting slide page object interactions
+ uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY );
+ sal_Int32 i, nCount = xShapes->getCount();
+ for ( i = 0; i < nCount; i++ )
+ {
+ aAny = xShapes->getByIndex( i );
+ uno::Reference< drawing::XShape > xShape;
+ if ( aAny >>= xShape )
+ ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
+ }
+
+ // exporting transition effects to pdf
+ if ( mbImpressDoc && pPDFExtOutDevData->GetIsExportTransitionEffects() ) // SJ: #i39428# TransitionEffects not available for Draw
+ {
+ const rtl::OUString sEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) );
+ const rtl::OUString sSpeed ( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) );
+ sal_Int32 nTime = 800;
+ presentation::AnimationSpeed aAs;
+ aAny = xPagePropSet->getPropertyValue( sSpeed );
+ if ( aAny >>= aAs )
+ {
+ switch( aAs )
+ {
+ case presentation::AnimationSpeed_SLOW : nTime = 1500; break;
+ case presentation::AnimationSpeed_FAST : nTime = 300; break;
+ default:
+ case presentation::AnimationSpeed_MEDIUM : nTime = 800;
+ }
+ }
+ presentation::FadeEffect eFe;
+ aAny = xPagePropSet->getPropertyValue( sEffect );
+ vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular;
+ if ( aAny >>= eFe )
+ {
+ switch( eFe )
+ {
+ case presentation::FadeEffect_HORIZONTAL_LINES :
+ case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
+ case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break;
+
+ case presentation::FadeEffect_VERTICAL_LINES :
+ case presentation::FadeEffect_VERTICAL_CHECKERBOARD :
+ case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_RIGHT :
+ case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
+ case presentation::FadeEffect_ROLL_FROM_LEFT :
+ case presentation::FadeEffect_FADE_FROM_UPPERLEFT :
+ case presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
+ case presentation::FadeEffect_FADE_FROM_LEFT :
+ case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_BOTTOM :
+ case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
+ case presentation::FadeEffect_ROLL_FROM_TOP :
+ case presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
+ case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
+ case presentation::FadeEffect_FADE_FROM_TOP :
+ case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::WipeTopToBottom; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_LEFT :
+ case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
+ case presentation::FadeEffect_ROLL_FROM_RIGHT :
+
+ case presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
+ case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
+ case presentation::FadeEffect_FADE_FROM_RIGHT :
+ case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::WipeRightToLeft; break;
+
+ case presentation::FadeEffect_UNCOVER_TO_TOP :
+ case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
+ case presentation::FadeEffect_ROLL_FROM_BOTTOM :
+ case presentation::FadeEffect_FADE_FROM_LOWERLEFT :
+ case presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
+ case presentation::FadeEffect_FADE_FROM_BOTTOM :
+ case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::WipeBottomToTop; break;
+
+ case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::SplitHorizontalInward; break;
+ case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::SplitHorizontalOutward; break;
+
+ case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::SplitVerticalInward; break;
+ case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::SplitVerticalOutward; break;
+
+ case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::BoxInward; break;
+ case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::BoxOutward; break;
+
+ case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::Regular; break;
+
+ case presentation::FadeEffect_RANDOM :
+ case presentation::FadeEffect_DISSOLVE :
+ default: eType = vcl::PDFWriter::Dissolve; break;
+ }
+ }
+ pPDFExtOutDevData->SetPageTransition( eType, nTime, -1 );
+ }
+ }
+ }
+
+ Size aPageSize( mpDoc->GetSdPage( 0, PK_STANDARD )->GetSize() );
+ Point aPoint( 0, 0 );
+ Rectangle aPageRect( aPoint, aPageSize );
+
+ // resolving links found in this page by the method ImpEditEngine::Paint
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
+ std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
+ while ( aIBeg != aIEnd )
+ {
+ sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc );
+ if ( nPage != -1 )
+ pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) );
+ else
+ pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark );
+ aIBeg++;
+ }
+ rBookmarks.clear();
+ //---> i56629, i40318
+ //get the page name, will be used as outline element in PDF bookmark pane
+ String aPageName = mpDoc->GetSdPage( (USHORT)nPageNumber - 1 , PK_STANDARD )->GetName();
+ if( aPageName.Len() > 0 )
+ {
+ // insert the bookmark to this page into the NamedDestinations
+ if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
+ pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 );
+ //
+ // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
+ // issue i40318.
+ //
+ if( pPDFExtOutDevData->GetIsExportBookmarks() )
+ {
+ // Destination Export
+ const sal_Int32 nDestId =
+ pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
+
+ // Create a new outline item:
+ pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
+ }
+ }
+ //<--- i56629, i40318
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ }
+ }
+ else
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+ rSelection >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() )
+ {
+ SdrPageView* pPV = NULL;
+
+ ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
+ pOldSdView ? pOldSdView->GetSdrPageView() : NULL, pPDFExtOutDevData );
+
+ for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xShape;
+ xShapes->getByIndex( i ) >>= xShape;
+
+ if( xShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj && pObj->GetPage()
+ && aImplRenderPaintProc.IsVisible( pObj )
+ && aImplRenderPaintProc.IsPrintable( pObj ) )
+ {
+ if( !pPV )
+ pPV = pView->ShowSdrPage( pObj->GetPage() );
+
+ if( pPV )
+ pView->MarkObj( pObj, pPV );
+ }
+ }
+ }
+ }
+ pView->DrawMarkedObj(*pOut);
+ }
+ }
+
+ delete pView;
+ }
+ }
+ }
+}
+
+uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
+{
+ uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
+
+ if( !xForb.is() )
+ mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
+
+ return xForb;
+}
+
+void SdXImpressDocument::initializeDocument()
+{
+ if( !mbClipBoard )
+ {
+ switch( mpDoc->GetPageCount() )
+ {
+ case 1:
+ {
+ // nasty hack to detect clipboard document
+ mbClipBoard = true;
+ break;
+ }
+ case 0:
+ {
+ mpDoc->CreateFirstPages();
+ mpDoc->StopWorkStartupDelay();
+ break;
+ }
+ }
+ }
+}
+
+void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mbDisposed )
+ {
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpDoc )
+ {
+ EndListening( *mpDoc );
+ mpDoc = NULL;
+ }
+
+ // Call the base class dispose() before setting the mbDisposed flag
+ // to true. The reason for this is that if close() has not yet been
+ // called this is done in SfxBaseModel::dispose(). At the end of
+ // that dispose() is called again. It is important to forward this
+ // second dispose() to the base class, too.
+ // As a consequence the following code has to be able to be run twice.
+ SfxBaseModel::dispose();
+ mbDisposed = true;
+
+ uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies);
+ if( xStyles.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xStyles, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xStyles = 0;
+ }
+
+ uno::Reference< presentation::XPresentation > xPresentation( mxPresentation );
+ if( xPresentation.is() )
+ {
+ uno::Reference< ::com::sun::star::presentation::XPresentation2 > xPres( mpDoc->getPresentation().get() );
+ uno::Reference< lang::XComponent > xPresComp( xPres, uno::UNO_QUERY );
+ if( xPresComp.is() )
+ xPresComp->dispose();
+ }
+
+ uno::Reference< container::XNameAccess > xLinks( mxLinks );
+ if( xLinks.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xLinks = 0;
+ }
+
+ uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess );
+ if( xDrawPagesAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xDrawPagesAccess = 0;
+ }
+
+ uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess );
+ if( xDrawPagesAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xDrawPagesAccess = 0;
+ }
+
+ uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
+ if( xLayerManager.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xLayerManager = 0;
+ }
+
+ uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess );
+ if( xCustomPresentationAccess.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ xCustomPresentationAccess = 0;
+ }
+
+ mxDashTable = 0;
+ mxGradientTable = 0;
+ mxHatchTable = 0;
+ mxBitmapTable = 0;
+ mxTransGradientTable = 0;
+ mxMarkerTable = 0;
+ mxDrawingPool = 0;
+ }
+ }
+}
+
+//=============================================================================
+// class SdDrawPagesAccess
+//=============================================================================
+
+SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw()
+: mpModel( &rMyModel)
+{
+}
+
+SdDrawPagesAccess::~SdDrawPagesAccess() throw()
+{
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdDrawPagesAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+}
+
+uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Any aAny;
+
+ if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PK_STANDARD ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ }
+
+ return aAny;
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ if( aName.getLength() != 0 )
+ {
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ if(NULL == pPage)
+ continue;
+
+ if( aName == SdDrawPage::getPageApiName( pPage ) )
+ {
+ uno::Any aAny;
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ return aAny;
+ }
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ uno::Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ *pNames++ = SdDrawPage::getPageApiName( pPage );
+ }
+
+ return aNames;
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPage;
+ for( nPage = 0; nPage < nCount; nPage++ )
+ {
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
+ if(NULL == pPage)
+ continue;
+
+ if( aName == SdDrawPage::getPageApiName( pPage ) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdDrawPagesAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XDrawPage );
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+// XDrawPages
+
+/******************************************************************************
+* Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die *
+* dazugehoerige SdDrawPage zurueck. *
+******************************************************************************/
+uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ if( mpModel->mpDoc )
+ {
+ SdPage* pPage = mpModel->InsertSdPage( (sal_uInt16)nIndex );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ return xDrawPage;
+ }
+ }
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+ return xDrawPage;
+}
+
+/******************************************************************************
+* Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen *
+* Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model *
+* nach dem entfernen dieser Seite vorhanden ist. *
+******************************************************************************/
+void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel || mpModel->mpDoc == NULL )
+ throw lang::DisposedException();
+
+ SdDrawDocument& rDoc = *mpModel->mpDoc;
+
+ sal_uInt16 nPageCount = rDoc.GetSdPageCount( PK_STANDARD );
+ if( nPageCount > 1 )
+ {
+ // pPage von xPage besorgen und dann die Id (nPos )ermitteln
+ SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage );
+ if( pSvxPage )
+ {
+ SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
+ if(pPage && ( pPage->GetPageKind() == PK_STANDARD ) )
+ {
+ sal_uInt16 nPage = pPage->GetPageNum();
+
+ SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) );
+
+ bool bUndo = rDoc.IsUndoEnabled();
+ if( bUndo )
+ {
+ // Add undo actions and delete the pages. The order of adding
+ // the undo actions is important.
+ rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ }
+
+ rDoc.RemovePage( nPage ); // the page
+ rDoc.RemovePage( nPage ); // the notes page
+
+ if( bUndo )
+ {
+ rDoc.EndUndo();
+ }
+ else
+ {
+ delete pNotesPage;
+ delete pPage;
+ }
+ }
+ }
+ }
+
+ mpModel->SetModified();
+}
+
+// XServiceInfo
+sal_Char pSdDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages";
+
+OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdDrawPagesAccess" ) );
+}
+
+sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdDrawPagesAccessService ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdDrawPagesAccessService ) );
+ uno::Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+
+// XComponent
+void SAL_CALL SdDrawPagesAccess::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+//=============================================================================
+// class SdMasterPagesAccess
+//=============================================================================
+
+SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw()
+: mpModel(&rMyModel)
+{
+}
+
+SdMasterPagesAccess::~SdMasterPagesAccess() throw()
+{
+}
+
+// XComponent
+void SAL_CALL SdMasterPagesAccess::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdMasterPagesAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel->mpDoc )
+ throw lang::DisposedException();
+
+ return mpModel->mpDoc->GetMasterSdPageCount(PK_STANDARD);
+}
+
+/******************************************************************************
+* Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der *
+* angegebennen Position im Model. *
+******************************************************************************/
+uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Any aAny;
+
+ if( (Index < 0) || (Index >= mpModel->mpDoc->GetMasterSdPageCount( PK_STANDARD ) ) )
+ throw lang::IndexOutOfBoundsException();
+
+ SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD );
+ if( pPage )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+ aAny <<= xDrawPage;
+ }
+
+ return aAny;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdMasterPagesAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(drawing::XDrawPage);
+}
+
+sal_Bool SAL_CALL SdMasterPagesAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+// XDrawPages
+uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+
+ SdDrawDocument* mpDoc = mpModel->mpDoc;
+ if( mpDoc )
+ {
+ // calculate internal index and check for range errors
+ const sal_Int32 nMPageCount = mpDoc->GetMasterPageCount();
+ nInsertPos = nInsertPos * 2 + 1;
+ if( nInsertPos < 0 || nInsertPos > nMPageCount )
+ nInsertPos = nMPageCount;
+
+ // now generate a unique name for the new masterpage
+ const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) );
+ String aPrefix( aStdPrefix );
+
+ sal_Bool bUnique = sal_True;
+ sal_Int32 i = 0;
+ do
+ {
+ bUnique = sal_True;
+ for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ )
+ {
+ SdPage* pPage = (SdPage*)mpDoc->GetMasterPage((USHORT)nMaster);
+ if( pPage && pPage->GetName() == aPrefix )
+ {
+ bUnique = sal_False;
+ break;
+ }
+ }
+
+ if( !bUnique )
+ {
+ i++;
+ aPrefix = aStdPrefix;
+ aPrefix += sal_Unicode( ' ' );
+ aPrefix += String::CreateFromInt32( i );
+ }
+
+ } while( !bUnique );
+
+ String aLayoutName( aPrefix );
+ aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
+ aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
+
+ // create styles
+ ((SdStyleSheetPool*)mpDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix );
+
+ // get the first page for initial size and border settings
+ SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD );
+ SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES);
+
+ // create and instert new draw masterpage
+ SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
+ pMPage->SetSize( pPage->GetSize() );
+ pMPage->SetBorder( pPage->GetLftBorder(),
+ pPage->GetUppBorder(),
+ pPage->GetRgtBorder(),
+ pPage->GetLwrBorder() );
+ pMPage->SetLayoutName( aLayoutName );
+ mpDoc->InsertMasterPage(pMPage, (USHORT)nInsertPos);
+
+ {
+ // ensure default MasterPage fill
+ pMPage->EnsureMasterPageDefaultBackground();
+ }
+
+ xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() );
+
+ // create and instert new notes masterpage
+ SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
+ pMNotesPage->SetSize( pRefNotesPage->GetSize() );
+ pMNotesPage->SetPageKind(PK_NOTES);
+ pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
+ pRefNotesPage->GetUppBorder(),
+ pRefNotesPage->GetRgtBorder(),
+ pRefNotesPage->GetLwrBorder() );
+ pMNotesPage->SetLayoutName( aLayoutName );
+ mpDoc->InsertMasterPage(pMNotesPage, (USHORT)nInsertPos + 1);
+// pMNotesPage->InsertMasterPage( pMPage->GetPageNum() );
+ pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True);
+ mpModel->SetModified();
+ }
+
+ return( xDrawPage );
+}
+
+/******************************************************************************
+* Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen *
+* Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese *
+* Seite als Masterpage benutzt. *
+******************************************************************************/
+void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel || mpModel->mpDoc == NULL )
+ throw lang::DisposedException();
+
+ SdDrawDocument& rDoc = *mpModel->mpDoc;
+
+ SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage );
+ if(pSdPage == NULL)
+ return;
+
+ SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage());
+
+ DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?");
+
+ if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0))
+ return; //Todo: this should be excepted
+
+ // only standard pages can be removed directly
+ if( pPage->GetPageKind() == PK_STANDARD )
+ {
+ sal_uInt16 nPage = pPage->GetPageNum();
+
+ SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) );
+
+ bool bUndo = rDoc.IsUndoEnabled();
+ if( bUndo )
+ {
+ // Add undo actions and delete the pages. The order of adding
+ // the undo actions is important.
+ rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
+ rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
+ }
+
+ rDoc.RemoveMasterPage( nPage );
+ rDoc.RemoveMasterPage( nPage );
+
+ if( bUndo )
+ {
+ rDoc.EndUndo();
+ }
+ else
+ {
+ delete pNotesPage;
+ delete pPage;
+ }
+ }
+}
+
+// XServiceInfo
+sal_Char pSdMasterPagesAccessService[sizeof("com.sun.star.drawing.MasterPages")] = "com.sun.star.drawing.MasterPages";
+
+OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdMasterPagesAccess" ) );
+}
+
+sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdMasterPagesAccessService ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdMasterPagesAccessService ) );
+ uno::Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+
+//=============================================================================
+// class SdDocLinkTargets
+//=============================================================================
+
+SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw()
+: mpModel( &rMyModel )
+{
+}
+
+SdDocLinkTargets::~SdDocLinkTargets() throw()
+{
+}
+
+// XComponent
+void SAL_CALL SdDocLinkTargets::dispose( ) throw (uno::RuntimeException)
+{
+ mpModel = NULL;
+}
+
+void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
+{
+ DBG_ERROR( "not implemented!" );
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ SdPage* pPage = FindPage( aName );
+
+ if( pPage == NULL )
+ throw container::NoSuchElementException();
+
+ uno::Any aAny;
+
+ uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY );
+ if( xProps.is() )
+ aAny <<= xProps;
+
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ SdDrawDocument* mpDoc = mpModel->GetDoc();
+ if( mpDoc == NULL )
+ {
+ uno::Sequence< OUString > aSeq;
+ return aSeq;
+ }
+
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW )
+ {
+ const sal_uInt16 nMaxPages = mpDoc->GetSdPageCount( PK_STANDARD );
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterSdPageCount( PK_STANDARD );
+
+ uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
+ OUString* pStr = aSeq.getArray();
+
+ sal_uInt16 nPage;
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ *pStr++ = mpDoc->GetSdPage( nPage, PK_STANDARD )->GetName();
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ *pStr++ = mpDoc->GetMasterSdPage( nPage, PK_STANDARD )->GetName();
+ return aSeq;
+ }
+ else
+ {
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
+
+ uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
+ OUString* pStr = aSeq.getArray();
+
+ sal_uInt16 nPage;
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ *pStr++ = ((SdPage*)mpDoc->GetPage( nPage ))->GetName();
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ *pStr++ = ((SdPage*)mpDoc->GetMasterPage( nPage ))->GetName();
+ return aSeq;
+ }
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return FindPage( aName ) != NULL;
+}
+
+// container::XElementAccess
+uno::Type SAL_CALL SdDocLinkTargets::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(beans::XPropertySet);
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::hasElements()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpModel )
+ throw lang::DisposedException();
+
+ return mpModel->GetDoc() != NULL;
+}
+
+SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw()
+{
+ SdDrawDocument* mpDoc = mpModel->GetDoc();
+ if( mpDoc == NULL )
+ return NULL;
+
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+ const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
+
+ sal_uInt16 nPage;
+ SdPage* pPage;
+
+ const String aName( rName );
+
+ const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW;
+
+ // standard pages
+ for( nPage = 0; nPage < nMaxPages; nPage++ )
+ {
+ pPage = (SdPage*)mpDoc->GetPage( nPage );
+ if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
+ return pPage;
+ }
+
+ // master pages
+ for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
+ {
+ pPage = (SdPage*)mpDoc->GetMasterPage( nPage );
+ if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
+ return pPage;
+ }
+
+ return NULL;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdDocLinkTargets::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDocLinkTargets") );
+}
+
+sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument* pDocument )
+{
+ rtl::Reference< SdXImpressDocument > xRet;
+ if( pDocument )
+ {
+ ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh();
+ if( pDocShell )
+ {
+ uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
+
+ xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
+ }
+ }
+
+ return xRet;
+}
+
+void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName )
+{
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+
+ if( xModel.is() )
+ {
+ uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) );
+ ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
+ xModel->notifyEvent(aEvent );
+ }
+}
+
+void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
+{
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+
+ if( xModel.is() )
+ {
+ ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
+ xModel->notifyEvent(aEvent );
+ }
+}
diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx
new file mode 100644
index 000000000000..7769f7e14dba
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodule.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+// System - Includes -----------------------------------------------------
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+
+#include "sdmod.hxx"
+#include "unomodule.hxx"
+#include <sfx2/objface.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+::rtl::OUString SAL_CALL SdUnoModule_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingModule" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 1 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ModuleDispatcher"));
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ return uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( new SdUnoModule( rSMgr ) ) );
+}
+
+ // XNotifyingDispatch
+void SAL_CALL SdUnoModule::dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // there is no guarantee, that we are holded alive during this method!
+ // May the outside dispatch container will be updated by a CONTEXT_CHANGED
+ // asynchronous ...
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis(static_cast< ::com::sun::star::frame::XNotifyingDispatch* >(this));
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SdDLL::Init();
+ const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
+
+ sal_Int16 aState = ::com::sun::star::frame::DispatchResultState::DONTKNOW;
+ if ( !pSlot )
+ aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
+ else
+ {
+ SfxRequest aReq( pSlot, aArgs, SFX_CALLMODE_SYNCHRON, SD_MOD()->GetPool() );
+ const SfxPoolItem* pResult = SD_MOD()->ExecuteSlot( aReq );
+ if ( pResult )
+ aState = ::com::sun::star::frame::DispatchResultState::SUCCESS;
+ else
+ aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
+ }
+
+ if ( xListener.is() )
+ {
+ xListener->dispatchFinished(
+ ::com::sun::star::frame::DispatchResultEvent(
+ xThis, aState, ::com::sun::star::uno::Any()));
+ }
+}
+ // XDispatch
+void SAL_CALL SdUnoModule::dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ dispatchWithNotification(aURL, aArgs, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >());
+}
+
+void SAL_CALL SdUnoModule::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+void SAL_CALL SdUnoModule::removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
+{
+}
+
+SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SdUnoModule::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ sal_Int32 nCount = seqDescripts.getLength();
+ SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount );
+
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL ,
+ seqDescripts[i].FrameName ,
+ seqDescripts[i].SearchFlags );
+ }
+
+ return lDispatcher;
+}
+
+// XDispatchProvider
+REFERENCE< XDISPATCH > SAL_CALL SdUnoModule::queryDispatch( const UNOURL& aURL, const OUSTRING&, sal_Int32 ) throw( RUNTIMEEXCEPTION )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SdDLL::Init();
+ const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
+
+ REFERENCE< XDISPATCH > xSlot;
+ if ( pSlot )
+ xSlot = this;
+
+ return xSlot;
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL SdUnoModule::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return SdUnoModule_getImplementationName();
+}
+
+sal_Bool SAL_CALL SdUnoModule::supportsService( const ::rtl::OUString& sServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SdUnoModule::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return SdUnoModule_getSupportedServiceNames();
+}
+
diff --git a/sd/source/ui/unoidl/unomodule.hxx b/sd/source/ui/unoidl/unomodule.hxx
new file mode 100644
index 000000000000..bce015702ddd
--- /dev/null
+++ b/sd/source/ui/unoidl/unomodule.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SD_UNOMODULE_HXX
+#define _SD_UNOMODULE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase3.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define XDISPATCH ::com::sun::star::frame::XDispatch
+#define XNOTIFYINGDISPATCH ::com::sun::star::frame::XNotifyingDispatch
+#define OUSTRING ::rtl::OUString
+#define UNOURL ::com::sun::star::util::URL
+#define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor
+
+class SdUnoModule : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::lang::XServiceInfo >
+{
+ REFERENCE < ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+public:
+ SdUnoModule( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ : m_xFactory( xFactory )
+ {}
+
+ // XnotifyingDispatch
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& URL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatchProvider
+ virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ) ;
+ virtual REFERENCE< XDISPATCH > SAL_CALL queryDispatch( const UNOURL & aURL ,
+ const OUSTRING & sTargetFrameName,
+ sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION ) ;
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
new file mode 100755
index 000000000000..f31c960d432d
--- /dev/null
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -0,0 +1,1763 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/stl_types.hxx>
+#include <vos/mutex.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/style.hxx>
+#include <svx/svdpool.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/unoimap.hxx>
+#include <svtools/unoevent.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <comphelper/extract.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <editeng/outlobj.hxx>
+#include "CustomAnimationPreset.hxx"
+#include "Outliner.hxx"
+#include "sdresid.hxx"
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "anminfo.hxx"
+#include "unohelp.hxx"
+#include "unoobj.hxx"
+#include "unoprnms.hxx"
+#include "unomodel.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "ViewShell.hxx"
+#include "unokywds.hxx"
+#include "unopage.hxx"
+#ifndef SVX_LIGHT
+#ifndef SD_DRAW_DOC_SHELL_HXX
+#include "DrawDocShell.hxx"
+#endif
+#endif
+#include "helpids.h"
+#include "glob.hxx"
+#include "glob.hrc"
+#include "unolayer.hxx"
+#include "imapinfo.hxx"
+#include "EffectMigration.hxx"
+
+#ifndef SEQTYPE
+ #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
+ #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
+ #else
+ #define SEQTYPE(x) &(x)
+ #endif
+#endif
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::vos;
+using namespace ::sd;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::animations;
+
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::drawing::XShape;
+
+extern OUString getPageApiNameFromUiName( const String& rUIName );
+extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
+
+///////////////////////////////////////////////////////////////////////
+
+DECLARE_STL_STDKEY_MAP(sal_uIntPtr, SfxExtItemPropertySetInfo*, SdExtPropertySetInfoCache);
+static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
+static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
+
+DECLARE_STL_STDKEY_MAP(sal_uInt32, uno::Sequence< uno::Type >*, SdTypesCache);
+static SdTypesCache gImplTypesCache;
+
+///////////////////////////////////////////////////////////////////////
+
+
+#define WID_EFFECT 1
+#define WID_SPEED 2
+#define WID_TEXTEFFECT 3
+#define WID_BOOKMARK 4
+#define WID_CLICKACTION 5
+#define WID_PLAYFULL 6
+#define WID_SOUNDFILE 7
+#define WID_SOUNDON 8
+#define WID_BLUESCREEN 9
+#define WID_VERB 10
+#define WID_DIMCOLOR 11
+#define WID_DIMHIDE 12
+#define WID_DIMPREV 13
+#define WID_PRESORDER 14
+#define WID_STYLE 15
+#define WID_ANIMPATH 16
+#define WID_IMAGEMAP 17
+#define WID_ISANIMATION 18
+
+#define WID_ISEMPTYPRESOBJ 20
+#define WID_ISPRESOBJ 21
+#define WID_MASTERDEPEND 22
+
+#define WID_NAVORDER 23
+
+#define WID_THAT_NEED_ANIMINFO 19
+
+
+
+ #define IMPRESS_MAP_ENTRIES \
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH), WID_ANIMPATH, &ITYPE(drawing::XShape), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR), WID_DIMCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMHIDE), WID_DIMHIDE, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMPREV), WID_DIMPREV, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_EFFECT), WID_EFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ISEMPTYPRESOBJ),WID_ISEMPTYPRESOBJ, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_ISPRESOBJ), WID_ISPRESOBJ, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_MASTERDEPENDENT),WID_MASTERDEPEND, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_PLAYFULL), WID_PLAYFULL, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_PRESORDER), WID_PRESORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE( style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_SOUNDFILE, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDON), WID_SOUNDON, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SPEED), WID_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_TEXTEFFECT), WID_TEXTEFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BLUESCREEN), WID_BLUESCREEN, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_VERB), WID_VERB, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN("IsAnimation"), WID_ISANIMATION, &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { 0,0,0,0,0,0}
+
+
+ const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()
+ {
+
+ static const SfxItemPropertyMapEntry aImpress_SdXShapePropertyGraphicMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
+ IMPRESS_MAP_ENTRIES
+ };
+ return aImpress_SdXShapePropertyGraphicMap_Impl;
+ }
+
+ const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertySimpleMap_Impl()
+ {
+
+ static const SfxItemPropertyMapEntry aImpress_SdXShapePropertySimpleMap_Impl[] =
+ {
+ IMPRESS_MAP_ENTRIES
+ };
+ return aImpress_SdXShapePropertySimpleMap_Impl;
+ }
+
+ #define DRAW_MAP_ENTRIES\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0),0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE(style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { 0,0,0,0,0,0}
+
+ const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertySimpleMap_Impl()
+ {
+ static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyMap_Impl[] =
+ {
+ DRAW_MAP_ENTRIES
+ };
+ return aDraw_SdXShapePropertyMap_Impl;
+ }
+ const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()
+ {
+ static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyGraphicMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
+ DRAW_MAP_ENTRIES
+ };
+ return aDraw_SdXShapePropertyGraphicMap_Impl;
+ }
+ const SfxItemPropertyMapEntry* lcl_ImplGetShapePropertyMap( sal_Bool bImpress, sal_Bool bGraphicObj )
+ {
+ const SfxItemPropertyMapEntry* pRet = 0;
+ if( bImpress )
+ {
+ if( bGraphicObj )
+ pRet = lcl_GetImpress_SdXShapePropertyGraphicMap_Impl();
+ else
+ pRet = lcl_GetImpress_SdXShapePropertySimpleMap_Impl();
+ }
+ else
+ {
+ if( bGraphicObj )
+ pRet = lcl_GetDraw_SdXShapePropertyGraphicMap_Impl();
+ else
+ pRet = lcl_GetDraw_SdXShapePropertySimpleMap_Impl();
+ }
+ return pRet;
+
+ }
+ const SvxItemPropertySet* lcl_ImplGetShapePropertySet( sal_Bool bImpress, sal_Bool bGraphicObj )
+ {
+ const SvxItemPropertySet* pRet = 0;
+ if( bImpress )
+ {
+ if( bGraphicObj )
+ {
+ static SvxItemPropertySet aImpress_SdXShapePropertyGraphicSet_Impl( lcl_GetImpress_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aImpress_SdXShapePropertyGraphicSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aImpress_SdXShapePropertySet_Impl(lcl_GetImpress_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aImpress_SdXShapePropertySet_Impl;
+ }
+ }
+ else
+ {
+ if( bGraphicObj )
+ {
+ static SvxItemPropertySet aDraw_SdXShapePropertyGraphicSet_Impl(lcl_GetDraw_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aDraw_SdXShapePropertyGraphicSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aDraw_SdXShapePropertySet_Impl( lcl_GetDraw_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
+ pRet = &aDraw_SdXShapePropertySet_Impl;
+ }
+ }
+ return pRet;
+ }
+ const SfxItemPropertyMapEntry* lcl_GetEmpty_SdXShapePropertyMap_Impl()
+ {
+ static SfxItemPropertyMapEntry aEmpty_SdXShapePropertyMap_Impl[] =
+ {
+ { 0,0,0,0,0,0}
+ };
+ return aEmpty_SdXShapePropertyMap_Impl;
+ }
+
+ static const SvxItemPropertySet* lcl_GetEmpty_SdXShapePropertySet_Impl()
+ {
+ static SvxItemPropertySet aEmptyPropSet( lcl_GetEmpty_SdXShapePropertyMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aEmptyPropSet;
+ }
+const SvEventDescription* ImplGetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+ };
+
+ return aMacroDescriptionsImpl;
+}
+
+/*************************************************************************
+|*
+|* Vergleichsfkt. fuer QSort
+|*
+\************************************************************************/
+struct SortStruct
+{
+ SdrObject* pObj;
+ sal_uInt32 nOrder;
+};
+
+typedef SortStruct SORT;
+typedef SORT* PSORT;
+
+extern "C" int __LOADONCALLAPI SortFunc( const void* p1, const void* p2 );
+
+SdXShape::SdXShape( SvxShape* pShape, SdXImpressDocument* pModel) throw()
+: mpShape( pShape ),
+ mpPropSet( pModel?
+ lcl_ImplGetShapePropertySet(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
+ : lcl_GetEmpty_SdXShapePropertySet_Impl() ),
+ mpMap( pModel?
+ lcl_ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
+ : lcl_GetEmpty_SdXShapePropertyMap_Impl() ),
+ mpModel(pModel),
+ mpImplementationId( NULL )
+
+{
+
+ pShape->setMaster( this );
+}
+
+SdXShape::~SdXShape() throw()
+{
+}
+
+void SdXShape::dispose()
+{
+ mpShape->setMaster( NULL );
+ delete this;
+}
+
+// XInterface
+uno::Any SAL_CALL SdXShape::queryAggregation( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return mpShape->queryAggregation( rType );
+}
+
+uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return mpShape->queryInterface( rType );
+}
+
+void SAL_CALL SdXShape::acquire() throw()
+{
+ mpShape->acquire();
+}
+
+void SAL_CALL SdXShape::release() throw()
+{
+ mpShape->release();
+}
+
+sal_Bool SdXShape::queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny )
+{
+ if( mpModel && mpModel ->IsImpressDocument() )
+ {
+ if( rType == ::getCppuType(( const uno::Reference< document::XEventsSupplier >*)0) )
+ {
+ aAny <<= uno::Reference< document::XEventsSupplier >(this);
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
+ throw (uno::RuntimeException)
+{
+ if( mpModel && !mpModel->IsImpressDocument() )
+ {
+ return mpShape->_getTypes();
+ }
+ else
+ {
+ const sal_uInt32 nObjId = mpShape->getShapeKind();
+ uno::Sequence< uno::Type >* pTypes;
+ SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
+ if( aIter == gImplTypesCache.end() )
+ {
+ pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
+ sal_uInt32 nCount = pTypes->getLength();
+ pTypes->realloc( nCount+1 );
+ (*pTypes)[nCount] = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+
+ gImplTypesCache[ nObjId ] = pTypes;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pTypes = (*aIter).second;
+ }
+ return *pTypes;
+ }
+}
+
+// XPropertyState
+beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpPropSet->getPropertyMapEntry(PropertyName) )
+ {
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return mpShape->_getPropertyState( PropertyName );
+ }
+}
+
+void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpPropSet->getPropertyMapEntry(PropertyName) )
+ {
+ return;
+ }
+ else
+ {
+ mpShape->_setPropertyToDefault(PropertyName);
+ }
+}
+
+uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpPropSet->getPropertyMapEntry(aPropertyName) )
+ {
+ return getPropertyValue( aPropertyName );
+ }
+ else
+ {
+ uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
+
+ if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aRet >>= aName )
+ {
+ aName = SdLayer::convertToExternalName( aName );
+ aRet <<= aName;
+ }
+ }
+ return aRet;
+ }
+}
+
+//XPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_uIntPtr nObjId = (sal_uIntPtr)mpShape->getPropertyMapEntries();
+ SfxExtItemPropertySetInfo* pInfo = NULL;
+
+ SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
+ &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
+
+ SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
+ if( aIter == pCache->end() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
+ pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
+ pInfo->acquire();
+
+ (*pCache)[ nObjId ] = pInfo;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pInfo = (*aIter).second;
+ }
+
+ uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
+ return pInfo;
+}
+
+void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ if( pEntry )
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj )
+ {
+ SdAnimationInfo* pInfo = GetAnimationInfo((pEntry->nWID <= WID_THAT_NEED_ANIMINFO)?sal_True:sal_False);
+
+ switch(pEntry->nWID)
+ {
+ case WID_NAVORDER:
+ {
+ sal_Int32 nNavOrder = 0;
+ if(!(aValue >>= nNavOrder))
+ throw lang::IllegalArgumentException();
+
+ SdrObjList* pObjList = pObj->GetObjList();
+ if( pObjList )
+ pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) );
+ break;
+ }
+
+ case WID_EFFECT:
+ {
+ AnimationEffect eEffect;
+ if(!(aValue >>= eEffect))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetAnimationEffect( mpShape, eEffect );
+ break;
+ }
+ case WID_TEXTEFFECT:
+ {
+ AnimationEffect eEffect;
+ if(!(aValue >>= eEffect))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetTextAnimationEffect( mpShape, eEffect );
+ break;
+ }
+ case WID_SPEED:
+ {
+ AnimationSpeed eSpeed;
+ if(!(aValue>>=eSpeed))
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
+ break;
+ }
+/* TODO?? case WID_ISANIMATION:
+ {
+
+ sal_Bool bIsAnimation;
+ if(!(aValue >>= bIsAnimation))
+ throw lang::IllegalArgumentException();
+
+ pInfo->mbIsMovie = bIsAnimation;
+ break;
+ }
+*/
+ case WID_BOOKMARK:
+ {
+ OUString aString;
+ if(!(aValue >>= aString))
+ throw lang::IllegalArgumentException();
+
+ pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) );
+ break;
+ }
+ case WID_CLICKACTION:
+ ::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue);
+ break;
+
+/* todo?
+ case WID_PLAYFULL:
+ pInfo->mbPlayFull = ::cppu::any2bool(aValue);
+ break;
+*/
+ case WID_SOUNDFILE:
+ {
+ OUString aString;
+ if(!(aValue >>= aString))
+ throw lang::IllegalArgumentException();
+ pInfo->maSoundFile = aString;
+ EffectMigration::UpdateSoundEffect( mpShape, pInfo );
+ break;
+ }
+
+ case WID_SOUNDON:
+ {
+ if( !(aValue >>= pInfo->mbSoundOn) )
+ throw lang::IllegalArgumentException();
+ EffectMigration::UpdateSoundEffect( mpShape, pInfo );
+ break;
+ }
+/*
+ case WID_BLUESCREEN:
+ {
+ sal_Int32 nColor;
+ if(!(aValue >>= nColor))
+ throw lang::IllegalArgumentException();
+
+ pInfo->maBlueScreen.SetColor( nColor );
+ break;
+ }
+*/
+ case WID_VERB:
+ {
+ sal_Int32 nVerb = 0;
+ if(!(aValue >>= nVerb))
+ throw lang::IllegalArgumentException();
+
+ pInfo->mnVerb = (USHORT)nVerb;
+ break;
+ }
+ case WID_DIMCOLOR:
+ {
+ sal_Int32 nColor = 0;
+
+ if( !(aValue >>= nColor) )
+ throw lang::IllegalArgumentException();
+
+ EffectMigration::SetDimColor( mpShape, nColor );
+ break;
+ }
+ case WID_DIMHIDE:
+ {
+ sal_Bool bDimHide = sal_False;
+ if( !(aValue >>= bDimHide) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetDimHide( mpShape, bDimHide );
+ break;
+ }
+ case WID_DIMPREV:
+ {
+ sal_Bool bDimPrevious = sal_False;
+ if( !(aValue >>= bDimPrevious) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetDimPrevious( mpShape, bDimPrevious );
+ break;
+ }
+ case WID_PRESORDER:
+ {
+ sal_Int32 nNewPos = 0;
+ if( !(aValue >>= nNewPos) )
+ lang::IllegalArgumentException();
+
+ EffectMigration::SetPresentationOrder( mpShape, nNewPos );
+ break;
+ }
+ case WID_STYLE:
+ SetStyleSheet( aValue );
+ break;
+ case WID_ISEMPTYPRESOBJ:
+ SetEmptyPresObj( ::cppu::any2bool(aValue) );
+ break;
+ case WID_MASTERDEPEND:
+ SetMasterDepend( ::cppu::any2bool(aValue) );
+ break;
+/* todo
+ case WID_ANIMPATH:
+ {
+ uno::Reference< drawing::XShape > xShape;
+ aValue >>= xShape;
+
+ SdrObject* pObj = NULL;
+ if(xShape.is())
+ pObj = GetSdrObjectFromXShape( xShape );
+
+ if( pObj == NULL || !pObj->ISA( SdrPathObj ) )
+ throw lang::IllegalArgumentException();
+
+ pInfo->mpPathObj = (SdrPathObj*)pObj;
+
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+ pInfo = pDoc->GetAnimationInfo(pObj);
+ if( pInfo == NULL )
+ {
+ pInfo = new SdAnimationInfo(pDoc);
+ pObj->InsertUserData( pInfo );
+ }
+ pInfo->mbInvisibleInPresentation = sal_True;
+ }
+
+ break;
+ }
+*/
+ case WID_IMAGEMAP:
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+ ImageMap aImageMap;
+ uno::Reference< uno::XInterface > xImageMap;
+ aValue >>= xImageMap;
+
+ if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) )
+ throw lang::IllegalArgumentException();
+
+ SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(pObj);
+ if( pIMapInfo )
+ {
+ // replace existing image map
+ pIMapInfo->SetImageMap( aImageMap );
+ }
+ else
+ {
+ // insert new user data with image map
+ pObj->InsertUserData(new SdIMapInfo(aImageMap) );
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ uno::Any aAny( aValue );
+
+ if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aAny >>= aName )
+ {
+ aName = SdLayer::convertToInternalName( aName );
+ aAny <<= aName;
+ }
+ }
+
+ mpShape->_setPropertyValue(aPropertyName, aAny);
+ }
+
+ if( mpModel )
+ mpModel->SetModified();
+}
+
+::com::sun::star::uno::Any SAL_CALL SdXShape::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aRet;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ if( pEntry && mpShape->GetSdrObject() )
+ {
+ SdAnimationInfo* pInfo = GetAnimationInfo(sal_False);
+
+ switch(pEntry->nWID)
+ {
+ case WID_NAVORDER:
+ {
+ const sal_uInt32 nNavOrder = mpShape->GetSdrObject()->GetNavigationPosition();
+ aRet <<= nNavOrder == SAL_MAX_UINT32 ? static_cast<sal_Int32>(-1) : static_cast< sal_Int32 >(nNavOrder);
+ }
+ break;
+ case WID_EFFECT:
+ aRet <<= EffectMigration::GetAnimationEffect( mpShape );
+ break;
+ case WID_TEXTEFFECT:
+ aRet <<= EffectMigration::GetTextAnimationEffect( mpShape );
+ break;
+ case WID_ISPRESOBJ:
+ aRet <<= (sal_Bool)IsPresObj();
+ break;
+ case WID_ISEMPTYPRESOBJ:
+ aRet <<= (sal_Bool)IsEmptyPresObj();
+ break;
+ case WID_MASTERDEPEND:
+ aRet <<= (sal_Bool)IsMasterDepend();
+ break;
+ case WID_SPEED:
+ aRet <<= EffectMigration::GetAnimationSpeed( mpShape );
+ break;
+ case WID_ISANIMATION:
+ aRet <<= (sal_Bool)( pInfo && pInfo->mbIsMovie);
+ break;
+ case WID_BOOKMARK:
+ {
+ OUString aString;
+ if( pInfo )
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ // is the bookmark a page?
+ BOOL bIsMasterPage;
+ if(pDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ) != SDRPAGE_NOTFOUND)
+ {
+ aString = SdDrawPage::getPageApiNameFromUiName( pInfo->GetBookmark() );
+ }
+ else
+ {
+ aString = pInfo->GetBookmark() ;
+ sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aString.copy( 0, nPos+1 ) );
+ OUString aName( aString.copy( nPos+1 ) );
+ if(pDoc->GetPageByName( aName, bIsMasterPage ) != SDRPAGE_NOTFOUND)
+ {
+ aURL += SdDrawPage::getPageApiNameFromUiName( aName );
+ aString = aURL;
+ }
+ }
+ }
+ }
+
+ aRet <<= aString;
+ break;
+ }
+ case WID_CLICKACTION:
+ aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
+ break;
+ case WID_PLAYFULL:
+ aRet <<= (sal_Bool)( pInfo && pInfo->mbPlayFull );
+ break;
+ case WID_SOUNDFILE:
+ aRet <<= EffectMigration::GetSoundFile( mpShape );
+ break;
+ case WID_SOUNDON:
+ aRet <<= EffectMigration::GetSoundOn( mpShape );
+ break;
+ case WID_BLUESCREEN:
+ aRet <<= (sal_Int32)( pInfo?pInfo->maBlueScreen.GetColor():0x00ffffff );
+ break;
+ case WID_VERB:
+ aRet <<= (sal_Int32)( pInfo?pInfo->mnVerb:0 );
+ break;
+ case WID_DIMCOLOR:
+ aRet <<= EffectMigration::GetDimColor( mpShape );
+ break;
+ case WID_DIMHIDE:
+ aRet <<= EffectMigration::GetDimHide( mpShape );
+ break;
+ case WID_DIMPREV:
+ aRet <<= EffectMigration::GetDimPrevious( mpShape );
+ break;
+ case WID_PRESORDER:
+ aRet <<= EffectMigration::GetPresentationOrder( mpShape );
+ break;
+ case WID_STYLE:
+ aRet = GetStyleSheet();
+ break;
+ case WID_ANIMPATH:
+ if( pInfo && pInfo->mpPathObj )
+ aRet <<= pInfo->mpPathObj->getUnoShape();
+ break;
+ case WID_IMAGEMAP:
+ {
+ uno::Reference< uno::XInterface > xImageMap;
+
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ if( pDoc )
+ {
+
+ SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(mpShape->GetSdrObject());
+ if( pIMapInfo )
+ {
+ const ImageMap& rIMap = pIMapInfo->GetImageMap();
+ xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() );
+ }
+ else
+ {
+ xImageMap = SvUnoImageMap_createInstance(ImplGetSupportedMacroItems() );
+ }
+ }
+
+ aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
+ break;
+ }
+ }
+ }
+ else
+ {
+ aRet = mpShape->_getPropertyValue(PropertyName);
+
+ if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
+ {
+ OUString aName;
+ if( aRet >>= aName )
+ {
+ aName = SdLayer::convertToExternalName( aName );
+ aRet <<= aName;
+ }
+ }
+ }
+
+ return aRet;
+}
+
+/** */
+SdAnimationInfo* SdXShape::GetAnimationInfo( sal_Bool bCreate ) const throw()
+{
+ SdAnimationInfo* pInfo = NULL;
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj)
+ pInfo = SdDrawDocument::GetShapeUserData(*pObj, bCreate ? true : false);
+
+ return pInfo;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SdXShape::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() );
+
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.presentation.Shape",
+ "com.sun.star.document.LinkTarget" );
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj && pObj->GetObjInventor() == SdrInventor )
+ {
+ sal_uInt32 nInventor = pObj->GetObjIdentifier();
+ switch( nInventor )
+ {
+ case OBJ_TITLETEXT:
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.TitleTextShape" );
+ break;
+ case OBJ_OUTLINETEXT:
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.OutlinerShape" );
+ break;
+ }
+ }
+ return aSeq;
+}
+
+/** checks if this is a presentation object
+ */
+sal_Bool SdXShape::IsPresObj() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if(pObj)
+ {
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ if(pPage)
+ return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE;
+ }
+ return sal_False;
+}
+
+/** checks if this presentation object is empty
+ */
+sal_Bool SdXShape::IsEmptyPresObj() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( (pObj != NULL) && pObj->IsEmptyPresObj() )
+ {
+ // check if the object is in edit, than its temporarely not empty
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if( pTextObj == 0 )
+ return sal_True;
+
+ OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
+ if( pParaObj )
+ {
+ delete pParaObj;
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+/** sets/reset the empty status of a presentation object
+*/
+void SdXShape::SetEmptyPresObj( sal_Bool bEmpty ) throw()
+{
+ // only possible if this actually *is* a presentation object
+ if( !IsPresObj() )
+ return;
+
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ return;
+
+ if( pObj->IsEmptyPresObj() != bEmpty )
+ {
+ if(!bEmpty)
+ {
+ OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
+ const sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
+
+ // really delete SdrOutlinerObj at pObj
+ pObj->NbcSetOutlinerParaObject(0L);
+ if( bVertical && PTR_CAST( SdrTextObj, pObj ) )
+ ((SdrTextObj*)pObj)->SetVerticalWriting( sal_True );
+
+ SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj );
+ if( pGraphicObj )
+ {
+ Graphic aEmpty;
+ pGraphicObj->SetGraphic(aEmpty);
+ }
+ else
+ {
+ SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj );
+ if( pOleObj )
+ {
+ pOleObj->SetGraphic( NULL );
+ }
+ }
+ }
+ else
+ {
+ // now set an empty OutlinerParaObject at pObj without
+ // any content but with the style of the old OutlinerParaObjects
+ // first paragraph
+ do
+ {
+ SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
+ DBG_ASSERT( pDoc, "no document?" );
+ if( pDoc == NULL)
+ break;
+
+ ::sd::Outliner* pOutliner = pDoc->GetInternalOutliner();
+ DBG_ASSERT( pOutliner, "no outliner?" );
+ if( pOutliner == NULL )
+ break;
+
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ DBG_ASSERT( pPage, "no page?" );
+ if( pPage == NULL )
+ break;
+
+ OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
+ pOutliner->SetText( *pOutlinerParaObject );
+ const sal_Bool bVertical = pOutliner->IsVertical();
+
+ pOutliner->Clear();
+ pOutliner->SetVertical( bVertical );
+ pOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)pDoc->GetStyleSheetPool() );
+ pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) );
+ pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) );
+ pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() );
+ pOutliner->Clear();
+ }
+ while(0);
+ }
+
+ pObj->SetEmptyPresObj(bEmpty);
+ }
+}
+
+sal_Bool SdXShape::IsMasterDepend() const throw()
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ return pObj && pObj->GetUserCall() != NULL;
+}
+
+void SdXShape::SetMasterDepend( sal_Bool bDepend ) throw()
+{
+ if( IsMasterDepend() != bDepend )
+ {
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj )
+ {
+ if( bDepend )
+ {
+ SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
+ pObj->SetUserCall( pPage );
+ }
+ else
+ {
+ pObj->SetUserCall( NULL );
+ }
+ }
+ }
+}
+
+void SdXShape::SetStyleSheet( const uno::Any& rAny ) throw( lang::IllegalArgumentException )
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ throw beans::UnknownPropertyException();
+
+ uno::Reference< style::XStyle > xStyle( rAny, uno::UNO_QUERY );
+ SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
+
+ const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet();
+ if( pOldStyleSheet != pStyleSheet )
+ {
+ if( pStyleSheet == 0 || (pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_MASTERPAGE) )
+ throw lang::IllegalArgumentException();
+
+ pObj->SetStyleSheet( pStyleSheet, sal_False );
+
+ SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : NULL;
+ if( pDoc )
+ {
+ ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+
+ if( pViewSh )
+ pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+}
+
+uno::Any SdXShape::GetStyleSheet() const throw( beans::UnknownPropertyException )
+{
+ SdrObject* pObj = mpShape->GetSdrObject();
+ if( pObj == NULL )
+ throw beans::UnknownPropertyException();
+
+ SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet();
+ // it is possible for shapes inside a draw to have a presentation style
+ // but we don't want this for the api
+ if( (pStyleSheet == NULL) || ((pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS) && !mpModel->IsImpressDocument()) )
+ return Any();
+
+ return Any( uno::Reference< style::XStyle >( dynamic_cast< SfxUnoStyleSheet* >( pStyleSheet ) ) );
+}
+
+class SdUnoEventsAccess : public cppu::WeakImplHelper2< com::sun::star::container::XNameReplace, com::sun::star::lang::XServiceInfo >
+{
+private:
+ const OUString maStrOnClick;
+ const OUString maStrServiceName;
+ const OUString maStrEventType;
+ const OUString maStrPresentation;
+ const OUString maStrLibrary;
+ const OUString maStrMacroName;
+ const OUString maStrClickAction;
+ const OUString maStrBookmark;
+ const OUString maStrEffect;
+ const OUString maStrPlayFull;
+ const OUString maStrVerb;
+ const OUString maStrSoundURL;
+ const OUString maStrSpeed;
+ const OUString maStrStarBasic;
+ const OUString maStrScript;
+
+ SdXShape* mpShape;
+ uno::Reference< document::XEventsSupplier > mxShape;
+
+public:
+ SdUnoEventsAccess( SdXShape* pShape ) throw();
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// XEventsSupplier
+uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return new SdUnoEventsAccess( this );
+}
+
+SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
+: maStrOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
+ maStrServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.documents.Events") ),
+ maStrEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
+ maStrPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
+ maStrLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
+ maStrMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
+ maStrClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
+ maStrBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
+ maStrEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
+ maStrPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
+ maStrVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
+ maStrSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
+ maStrSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
+ maStrStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ),
+ maStrScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
+ mpShape( pShape ), mxShape( pShape )
+{
+}
+
+#define FOUND_CLICKACTION 0x0001
+#define FOUND_BOOKMARK 0x0002
+#define FOUND_EFFECT 0x0004
+#define FOUND_PLAYFULL 0x0008
+#define FOUND_VERB 0x0010
+#define FOUND_SOUNDURL 0x0020
+#define FOUND_SPEED 0x0040
+#define FOUND_EVENTTYPE 0x0080
+#define FOUND_MACRO 0x0100
+#define FOUND_LIBRARY 0x0200
+
+static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
+{
+ const String aEmpty;
+ pInfo->SetBookmark( aEmpty );
+ pInfo->mbSecondSoundOn = sal_False;
+ pInfo->mbSecondPlayFull = sal_False;
+ pInfo->meClickAction = presentation::ClickAction_NONE;
+ pInfo->meSecondEffect = presentation::AnimationEffect_NONE;
+ pInfo->meSecondSpeed = presentation::AnimationSpeed_MEDIUM;
+ pInfo->mnVerb = 0;
+}
+
+// XNameReplace
+void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpShape == NULL || aName != maStrOnClick )
+ throw container::NoSuchElementException();
+
+ uno::Sequence< beans::PropertyValue > aProperties;
+ if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
+ throw lang::IllegalArgumentException();
+
+ sal_Int32 nFound = 0;
+ const beans::PropertyValue* pProperties = aProperties.getConstArray();
+
+ OUString aStrEventType;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
+ OUString aStrSoundURL;
+ sal_Bool bPlayFull = sal_False;
+ sal_Int32 nVerb = 0;
+ OUString aStrMacro;
+ OUString aStrLibrary;
+ OUString aStrBookmark;
+
+ const sal_Int32 nCount = aProperties.getLength();
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
+ {
+ if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType )
+ {
+ if( pProperties->Value >>= aStrEventType )
+ {
+ nFound |= FOUND_EVENTTYPE;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction )
+ {
+ if( pProperties->Value >>= eClickAction )
+ {
+ nFound |= FOUND_CLICKACTION;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
+ {
+ if( pProperties->Value >>= aStrMacro )
+ {
+ nFound |= FOUND_MACRO;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary )
+ {
+ if( pProperties->Value >>= aStrLibrary )
+ {
+ nFound |= FOUND_LIBRARY;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect )
+ {
+ if( pProperties->Value >>= eEffect )
+ {
+ nFound |= FOUND_EFFECT;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark )
+ {
+ if( pProperties->Value >>= aStrBookmark )
+ {
+ nFound |= FOUND_BOOKMARK;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed )
+ {
+ if( pProperties->Value >>= eSpeed )
+ {
+ nFound |= FOUND_SPEED;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL )
+ {
+ if( pProperties->Value >>= aStrSoundURL )
+ {
+ nFound |= FOUND_SOUNDURL;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull )
+ {
+ if( pProperties->Value >>= bPlayFull )
+ {
+ nFound |= FOUND_PLAYFULL;
+ continue;
+ }
+ }
+ else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb )
+ {
+ if( pProperties->Value >>= nVerb )
+ {
+ nFound |= FOUND_VERB;
+ continue;
+ }
+ }
+
+ throw lang::IllegalArgumentException();
+ }
+
+ sal_Bool bOk = sal_False;
+ do
+ {
+ if( ( nFound & FOUND_EVENTTYPE ) == 0 )
+ break;
+
+ if( aStrEventType == maStrPresentation )
+ {
+ if( ( nFound & FOUND_CLICKACTION ) == 0 )
+ break;
+
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
+ if( presentation::ClickAction_NONE == eClickAction && NULL == pInfo )
+ {
+ bOk = sal_True;
+ break;
+ }
+
+ if( NULL == pInfo )
+ pInfo = mpShape->GetAnimationInfo( sal_True );
+
+ DBG_ASSERT( pInfo, "shape animation info could not be created!" );
+ if( NULL == pInfo )
+ break;
+
+ clearEventsInAnimationInfo( pInfo );
+ pInfo->meClickAction = eClickAction;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ {
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_BOOKMARK:
+ case presentation::ClickAction_DOCUMENT:
+ if( nFound & FOUND_BOOKMARK )
+ {
+ if( eClickAction == presentation::ClickAction_BOOKMARK )
+ {
+ aStrBookmark = getUiNameFromPageApiNameImpl( aStrBookmark );
+ }
+ else if( eClickAction == presentation::ClickAction_DOCUMENT )
+ {
+ sal_Int32 nPos = aStrBookmark.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aStrBookmark.copy( 0, nPos+1 ) );
+ aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
+ aStrBookmark = aURL;
+ }
+ }
+
+ pInfo->SetBookmark( aStrBookmark );
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ if( nFound & FOUND_MACRO )
+ {
+ pInfo->SetBookmark( aStrMacro );
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ if( nFound & FOUND_VERB )
+ {
+ pInfo->mnVerb = (USHORT)nVerb;
+ bOk = sal_True;
+ }
+ break;
+
+ case presentation::ClickAction_VANISH:
+ if( ( nFound & FOUND_EFFECT ) == 0 )
+ break;
+
+ pInfo->meSecondEffect = eEffect;
+ pInfo->meSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM;
+
+ bOk = sal_True;
+
+ // NOTE: No break here!!!
+
+ case presentation::ClickAction_SOUND:
+ if( nFound & FOUND_SOUNDURL )
+ {
+ pInfo->SetBookmark( aStrSoundURL );
+ if( eClickAction != presentation::ClickAction_SOUND )
+ pInfo->mbSecondSoundOn = aStrSoundURL.getLength() != 0;
+ pInfo->mbSecondPlayFull = nFound & FOUND_PLAYFULL ? bPlayFull : sal_False;
+
+ bOk = sal_True;
+ }
+ break;
+ case presentation::ClickAction_MAKE_FIXED_SIZE:
+ break;
+ }
+ }
+ else
+ {
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_True );
+
+ DBG_ASSERT( pInfo, "shape animation info could not be created!" );
+ if( NULL == pInfo )
+ break;
+
+ clearEventsInAnimationInfo( pInfo );
+ pInfo->meClickAction = presentation::ClickAction_MACRO;
+
+ if ( SfxApplication::IsXScriptURL( aStrMacro ) )
+ {
+ pInfo->SetBookmark( aStrMacro );
+ }
+ else
+ {
+ String aMacro = aStrMacro;
+
+ String aLibName = aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
+ String aMacroName = aMacro.GetToken(2, sal_Unicode('.'));
+
+ OUStringBuffer sBuffer;
+ sBuffer.append( aMacroName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aModulName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aLibName );
+ sBuffer.append( sal_Unicode('.') );
+
+ if( aStrLibrary.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ) )
+ {
+ sBuffer.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
+ }
+ else
+ {
+ sBuffer.append( aStrLibrary );
+ }
+
+ pInfo->SetBookmark( sBuffer.makeStringAndClear() );
+ }
+ bOk = sal_True;
+ }
+ }
+ while(0);
+
+ if( !bOk )
+ throw lang::IllegalArgumentException();
+}
+
+// XNameAccess
+uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpShape == NULL || aName != maStrOnClick )
+ throw container::NoSuchElementException();
+
+ SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
+
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ if( pInfo )
+ eClickAction = pInfo->meClickAction;
+
+ sal_Int32 nPropertyCount = 2;
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ break;
+ case presentation::ClickAction_PROGRAM:
+ case presentation::ClickAction_VERB:
+ case presentation::ClickAction_BOOKMARK:
+ case presentation::ClickAction_DOCUMENT:
+ case presentation::ClickAction_MACRO:
+ if ( !SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ nPropertyCount += 1;
+ break;
+
+ case presentation::ClickAction_SOUND:
+ nPropertyCount += 2;
+ break;
+
+ case presentation::ClickAction_VANISH:
+ nPropertyCount += 4;
+ break;
+ default:
+ break;
+ }
+
+ uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
+ beans::PropertyValue* pProperties = aProperties.getArray();
+
+ uno::Any aAny;
+
+ if( eClickAction == presentation::ClickAction_MACRO )
+ {
+ if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ {
+ // Scripting Framework URL
+ aAny <<= maStrScript;;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= OUString( pInfo->GetBookmark() );
+ pProperties->Name = maStrScript;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+ }
+ else
+ {
+ // Old Basic macro URL
+ aAny <<= maStrStarBasic;;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ String aMacro = pInfo->GetBookmark();
+
+ // aMacro has got following format:
+ // "Macroname.Modulname.Libname.Documentname" or
+ // "Macroname.Modulname.Libname.Applicationsname"
+ String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
+ String aLibName = aMacro.GetToken(2, sal_Unicode('.'));
+ String aDocName = aMacro.GetToken(3, sal_Unicode('.'));
+
+ OUStringBuffer sBuffer;
+ sBuffer.append( aLibName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aModulName );
+ sBuffer.append( sal_Unicode('.') );
+ sBuffer.append( aMacroName );
+
+ aAny <<= OUString( sBuffer.makeStringAndClear() );
+ pProperties->Name = maStrMacroName;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) );
+ pProperties->Name = maStrLibrary;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ aAny <<= maStrPresentation;
+ pProperties->Name = maStrEventType;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= eClickAction;
+ pProperties->Name = maStrClickAction;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ switch( eClickAction )
+ {
+ case presentation::ClickAction_NONE:
+ case presentation::ClickAction_PREVPAGE:
+ case presentation::ClickAction_NEXTPAGE:
+ case presentation::ClickAction_FIRSTPAGE:
+ case presentation::ClickAction_LASTPAGE:
+ case presentation::ClickAction_INVISIBLE:
+ case presentation::ClickAction_STOPPRESENTATION:
+ break;
+ case presentation::ClickAction_BOOKMARK:
+ {
+ const OUString aStrBookmark( getPageApiNameFromUiName( pInfo->GetBookmark()) );
+ pProperties->Name = maStrBookmark;
+ pProperties->Handle = -1;
+ pProperties->Value <<= aStrBookmark;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ case presentation::ClickAction_PROGRAM:
+ {
+ OUString aString( pInfo->GetBookmark());
+ sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
+ if( nPos >= 0 )
+ {
+ OUString aURL( aString.copy( 0, nPos+1 ) );
+ aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) );
+ aString = aURL;
+ }
+ pProperties->Name = maStrBookmark;
+ pProperties->Handle = -1;
+ pProperties->Value <<= aString;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_VANISH:
+ aAny <<= pInfo->meSecondEffect;
+ pProperties->Name = maStrEffect;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ aAny <<= pInfo->meSecondSpeed;
+ pProperties->Name = maStrSpeed;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ // NOTE: no break here!!!
+
+ case presentation::ClickAction_SOUND:
+ if( eClickAction == presentation::ClickAction_SOUND || pInfo->mbSecondSoundOn )
+ {
+ aAny <<= OUString( pInfo->GetBookmark());
+ pProperties->Name = maStrSoundURL;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ pProperties++;
+
+ pProperties->Name = maStrPlayFull;
+ pProperties->Handle = -1;
+ pProperties->Value = ::cppu::bool2any(pInfo->mbSecondPlayFull);
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ aAny <<= (sal_Int32)pInfo->mnVerb;
+ pProperties->Name = maStrVerb;
+ pProperties->Handle = -1;
+ pProperties->Value = aAny;
+ pProperties->State = beans::PropertyState_DIRECT_VALUE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ aAny <<= aProperties;
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aStr( &maStrOnClick, 1 );
+ return aStr;
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ return aName == maStrOnClick;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdUnoEventsAccess::getElementType( )
+ throw(uno::RuntimeException)
+{
+ return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::hasElements( ) throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoEventsAccess::getImplementationName( )
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdUnoEventsAccess" ) );
+}
+
+sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return ServiceName == maStrServiceName;
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aStr( &maStrServiceName, 1 );
+ return aStr;
+}
+
+void SdXShape::modelChanged( SdrModel* pNewModel )
+{
+ if( pNewModel )
+ {
+ uno::Reference< uno::XInterface > xModel( pNewModel->getUnoModel() );
+ mpModel = SdXImpressDocument::getImplementation( xModel );
+ }
+ else
+ {
+ mpModel = 0;
+ }
+}
+
+void SdXShape::pageChanged( SdrPage* )
+{
+}
+
+void SdXShape::objectChanged( SdrObject* )
+{
+}
+
diff --git a/sd/source/ui/unoidl/unoobj.hxx b/sd/source/ui/unoidl/unoobj.hxx
new file mode 100755
index 000000000000..0e472f41ff16
--- /dev/null
+++ b/sd/source/ui/unoidl/unoobj.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOOBJ_HXX
+#define _UNOOBJ_HXX
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <svx/svdpool.hxx>
+#include <svx/unomaster.hxx>
+
+#include <editeng/unoipset.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+
+class SdrObject;
+class SdXImpressDocument;
+class SdAnimationInfo;
+
+class SdXShape : public SvxShapeMaster,
+ public ::com::sun::star::document::XEventsSupplier
+{
+ friend class SdUnoEventsAccess;
+
+private:
+ SvxShape* mpShape;
+ const SvxItemPropertySet* mpPropSet;
+ const SfxItemPropertyMapEntry* mpMap;
+ SdXImpressDocument* mpModel;
+
+ void SetStyleSheet( const ::com::sun::star::uno::Any& rAny ) throw( ::com::sun::star::lang::IllegalArgumentException );
+ ::com::sun::star::uno::Any GetStyleSheet() const throw( ::com::sun::star::beans::UnknownPropertyException );
+
+ // Intern
+ SdAnimationInfo* GetAnimationInfo( sal_Bool bCreate = sal_False ) const throw();
+ sal_Bool IsPresObj() const throw();
+ void SetPresObj( sal_Bool bPresObj ) throw();
+
+ sal_Bool IsEmptyPresObj() const throw();
+ void SetEmptyPresObj( sal_Bool bEmpty ) throw();
+
+ sal_Bool IsMasterDepend() const throw();
+ void SetMasterDepend( sal_Bool bDepend ) throw();
+
+ SdrObject* GetSdrObject() const throw();
+
+ com::sun::star::uno::Sequence< sal_Int8 >* mpImplementationId;
+
+public:
+ SdXShape(SvxShape* pShape, SdXImpressDocument* pModel) throw();
+ virtual ~SdXShape() throw();
+
+ virtual sal_Bool queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny );
+ virtual void dispose();
+ virtual void modelChanged( SdrModel* pNewModel );
+ virtual void pageChanged( SdrPage* pNewPage );
+ virtual void objectChanged( SdrObject* pNewObj );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ void setOldEffect( const com::sun::star::uno::Any& aValue );
+ void setOldTextEffect( const com::sun::star::uno::Any& aValue );
+ void setOldSpeed( const com::sun::star::uno::Any& aValue );
+ void setOldDimColor( const com::sun::star::uno::Any& aValue );
+ void setOldDimHide( const com::sun::star::uno::Any& aValue );
+ void setOldDimPrevious( const com::sun::star::uno::Any& aValue );
+ void setOldPresOrder( const com::sun::star::uno::Any& aValue );
+ void updateOldSoundEffect( SdAnimationInfo* pInfo );
+
+ void getOldEffect( com::sun::star::uno::Any& rValue ) const;
+ void getOldTextEffect( com::sun::star::uno::Any& rValue ) const;
+ void getOldSpeed( com::sun::star::uno::Any& rValue ) const;
+ void getOldSoundFile( com::sun::star::uno::Any& rValue ) const;
+ void getOldSoundOn( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimColor( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimHide( com::sun::star::uno::Any& rValue ) const;
+ void getOldDimPrev( com::sun::star::uno::Any& rValue ) const;
+ void getOldPresOrder( com::sun::star::uno::Any& rValue ) const;
+};
+
+struct SvEventDescription;
+const SvEventDescription* ImplGetSupportedMacroItems();
+
+#endif
+
+
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
new file mode 100755
index 000000000000..fb356087245a
--- /dev/null
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -0,0 +1,3181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
+#include <com/sun/star/presentation/FadeEffect.hpp>
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#include <com/sun/star/presentation/PresentationRange.hpp>
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#include <com/sun/star/view/PaperOrientation.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/metaact.hxx>
+#include <toolkit/unohlp.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+#include <unomodel.hxx>
+#include <unopage.hxx>
+#include <svx/svxids.hrc>
+#include <svl/itemset.hxx>
+#include <svx/svdmodel.hxx>
+#include <sdresid.hxx>
+#include <glob.hrc>
+#include <sdpage.hxx>
+#include <unoprnms.hxx>
+#include <sdattr.hxx>
+#include <drawdoc.hxx>
+#include <svx/unoshape.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <svx/svdorect.hxx>
+#include <vos/mutex.hxx>
+#include <svl/style.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <comphelper/extract.hxx>
+#include <list>
+#include <svx/svditer.hxx>
+#include <svtools/wmf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdview.hxx>
+#include "misc.hxx"
+#include "View.hxx"
+#ifndef SVX_LIGHT
+#ifndef SD_DRAW_DOC_SHELL_HXX
+#include "DrawDocShell.hxx"
+#endif
+#endif
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "unoobj.hxx"
+#include "res_bmp.hrc"
+#include "unokywds.hxx"
+#include "unopback.hxx"
+#include "unohelp.hxx"
+
+using ::com::sun::star::animations::XAnimationNode;
+using ::com::sun::star::animations::XAnimationNodeSupplier;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::vos;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::office;
+
+namespace sd {
+extern Reference< XAnnotation > createAnnotation( const Reference< XComponentContext >& xContext, SdPage* );
+extern Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& );
+}
+
+/* this are the ids for page properties */
+enum WID_PAGE
+{
+ WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
+ WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
+ WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
+ WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
+ WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
+ WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
+ WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
+ WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
+ WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
+ WID_NAVORDER
+};
+
+#ifndef SEQTYPE
+ #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
+ #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
+ #else
+ #define SEQTYPE(x) &(x)
+ #endif
+#endif
+
+static sal_Char __FAR_DATA sEmptyPageName[sizeof("page")] = "page";
+
+/** this function stores the property maps for draw pages in impress and draw */
+const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKind ePageKind )
+{
+ static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, &::getCppuType((const presentation::FadeEffect*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, &::getCppuType((const Any*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionType"), WID_TRANSITION_TYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionSubtype"), WID_TRANSITION_SUBTYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionDirection"), WID_TRANSITION_DIRECTION, &::getCppuType((const sal_Bool*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("TransitionDuration"), WID_TRANSITION_DURATION, &::getCppuType((const double*)0), 0, 0},
+ { MAP_CHAR_LEN("LoopSound"), WID_LOOP_SOUND, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0},
+ {0,0,0,0,0,0}
+ };
+
+#define DRAW_PAGE_NOTES_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},\
+ { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
+ {0,0,0,0,0,0}
+
+ static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
+ {
+ // this must be the first two entries so they can be excluded for PK_STANDARD
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
+ DRAW_PAGE_NOTES_PROPERTIES
+ };
+ static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
+ {
+ DRAW_PAGE_NOTES_PROPERTIES
+ };
+
+#define GRAPHIC_PAGE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
+ {0,0,0,0,0,0}
+
+ static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet), beans::PropertyAttribute::MAYBEVOID,0},
+ GRAPHIC_PAGE_PROPERTIES
+ };
+ static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
+ {
+ GRAPHIC_PAGE_PROPERTIES
+ };
+
+ //
+ bool bWithoutBackground = ePageKind != PK_STANDARD && ePageKind != PK_HANDOUT;
+ const SvxItemPropertySet* pRet = 0;
+ if( bImpress )
+ {
+ if( ePageKind == PK_STANDARD )
+ {
+ //PK_STANDARD always has a background property
+ static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPagePropertySet_Impl;
+ }
+ else
+ {
+ if(bWithoutBackground)
+ {
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aDrawPageNotesHandoutPropertySet_Impl;
+ }
+ }
+ }
+ else
+ {
+ if(bWithoutBackground)
+ {
+ static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aGraphicPagePropertyNoBackSet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aGraphicPagePropertySet_Impl;
+ }
+ }
+ return pRet;
+}
+
+/** this function stores the property map for master pages in impress and draw */
+const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
+{
+ static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE(beans::XPropertySet), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+ };
+
+ static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ {0,0,0,0,0,0}
+ };
+
+ const SvxItemPropertySet* pRet = 0;
+ if( ePageKind == PK_HANDOUT )
+ {
+ static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aHandoutMasterPagePropertySet_Impl;
+ }
+ else
+ {
+ static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ pRet = &aMasterPagePropertySet_Impl;
+ }
+ return pRet;
+}
+
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+ else
+ {
+ return SvxFmDrawPage::getSomething( rId );
+ }
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet ) throw()
+: SvxFmDrawPage( (SdrPage*) pInPage ),
+ SdUnoSearchReplaceShape(this),
+ mpModel ( _pModel ),
+ mpSdrModel(0),
+ mnTempPageNumber(0),
+ mpPropSet ( _pSet ),
+ mbIsImpressDocument(false)
+{
+ mpSdrModel = SvxFmDrawPage::mpModel;
+ if( mpModel )
+ mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
+
+}
+
+SdGenericDrawPage::~SdGenericDrawPage() throw()
+{
+}
+
+void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException )
+{
+ if( (SvxFmDrawPage::mpModel == 0) || (mpModel == 0) || (SvxFmDrawPage::mpPage == 0) )
+ throw lang::DisposedException();
+}
+
+SdXImpressDocument* SdGenericDrawPage::GetModel() const
+{
+ if( mpSdrModel != SvxFmDrawPage::mpModel )
+ {
+ const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
+ if( mpSdrModel )
+ {
+ uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
+ const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
+ if( mpModel )
+ const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
+ }
+ else
+ {
+ const_cast< SdGenericDrawPage* >(this)->mpModel = 0;
+ }
+ }
+
+ return mpModel;
+}
+
+// this is called whenever a SdrObject must be created for a empty api shape wrapper
+SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShape >& xShape ) throw()
+{
+ if( NULL == SvxFmDrawPage::mpPage || !xShape.is() )
+ return NULL;
+
+ String aType( xShape->getShapeType() );
+ const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
+ if( aType.CompareTo( aPrefix, aPrefix.Len() ) != 0 )
+ {
+ SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape );
+ if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if( pDoc )
+ pObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
+ }
+ return pObj;
+ }
+
+ aType = aType.Copy( aPrefix.Len() );
+
+ PresObjKind eObjKind = PRESOBJ_NONE;
+
+ if( aType.EqualsAscii( "TitleTextShape" ) )
+ {
+ eObjKind = PRESOBJ_TITLE;
+ }
+ else if( aType.EqualsAscii( "OutlinerShape" ) )
+ {
+ eObjKind = PRESOBJ_OUTLINE;
+ }
+ else if( aType.EqualsAscii( "SubtitleShape" ) )
+ {
+ eObjKind = PRESOBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "OLE2Shape" ) )
+ {
+ eObjKind = PRESOBJ_OBJECT;
+ }
+ else if( aType.EqualsAscii( "ChartShape" ) )
+ {
+ eObjKind = PRESOBJ_CHART;
+ }
+ else if( aType.EqualsAscii( "CalcShape" ) )
+ {
+ eObjKind = PRESOBJ_CALC;
+ }
+ else if( aType.EqualsAscii( "TableShape" ) )
+ {
+ eObjKind = PRESOBJ_TABLE;
+ }
+ else if( aType.EqualsAscii( "GraphicObjectShape" ) )
+ {
+#ifdef STARIMAGE_AVAILABLE
+ eObjKind = PRESOBJ_IMAGE;
+#else
+ eObjKind = PRESOBJ_GRAPHIC;
+#endif
+ }
+ else if( aType.EqualsAscii( "OrgChartShape" ) )
+ {
+ eObjKind = PRESOBJ_ORGCHART;
+ }
+ else if( aType.EqualsAscii( "PageShape" ) )
+ {
+ if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
+ eObjKind = PRESOBJ_TITLE;
+ else
+ eObjKind = PRESOBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "NotesShape" ) )
+ {
+ eObjKind = PRESOBJ_NOTES;
+ }
+ else if( aType.EqualsAscii( "HandoutShape" ) )
+ {
+ eObjKind = PRESOBJ_HANDOUT;
+ }
+ else if( aType.EqualsAscii( "FooterShape" ) )
+ {
+ eObjKind = PRESOBJ_FOOTER;
+ }
+ else if( aType.EqualsAscii( "HeaderShape" ) )
+ {
+ eObjKind = PRESOBJ_HEADER;
+ }
+ else if( aType.EqualsAscii( "SlideNumberShape" ) )
+ {
+ eObjKind = PRESOBJ_SLIDENUMBER;
+ }
+ else if( aType.EqualsAscii( "DateTimeShape" ) )
+ {
+ eObjKind = PRESOBJ_DATETIME;
+ }
+ else if( aType.EqualsAscii( "MediaShape" ) )
+ {
+ eObjKind = PRESOBJ_MEDIA;
+ }
+
+ Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
+
+ const awt::Point aPos( aRect.Left(), aRect.Top() );
+ xShape->setPosition( aPos );
+
+ const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
+ xShape->setSize( aSize );
+
+ SdrObject *pPresObj = 0;
+ if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
+ {
+ pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape );
+ if( pPresObj )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if( pDoc )
+ pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
+ GetPage()->InsertPresObj( pPresObj, eObjKind );
+ }
+ }
+ else
+ {
+ pPresObj = GetPage()->CreatePresObj( eObjKind, FALSE, aRect, sal_True );
+ }
+
+ if( pPresObj )
+ pPresObj->SetUserCall( GetPage() );
+
+ return pPresObj;
+}
+
+// XInterface
+Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ Any aAny;
+
+ QUERYINT( beans::XPropertySet );
+ else QUERYINT( container::XNamed );
+ else QUERYINT( util::XReplaceable );
+ else QUERYINT( util::XSearchable );
+ else QUERYINT( document::XLinkTargetSupplier );
+ else QUERYINT( drawing::XShapeCombiner );
+ else QUERYINT( drawing::XShapeBinder );
+ else QUERYINT( beans::XMultiPropertySet );
+ else if( rType == ITYPE( office::XAnnotationAccess ) )
+ {
+ return Any( Reference< office::XAnnotationAccess >( this ) );
+ }
+ else if( rType == ITYPE( XAnimationNodeSupplier ) )
+ {
+ if( mbIsImpressDocument )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+
+ if( ePageKind == PK_STANDARD )
+ return makeAny( Reference< XAnimationNodeSupplier >( this ) );
+ }
+ }
+ else
+ return SvxDrawPage::queryInterface( rType );
+
+ return aAny;
+}
+
+// XPropertySet
+Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ throwIfDisposed();
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_NAVORDER:
+ setNavigationOrder( aValue );
+ break;
+ case WID_PAGE_LEFT:
+ case WID_PAGE_RIGHT:
+ case WID_PAGE_TOP:
+ case WID_PAGE_BOTTOM:
+ case WID_PAGE_LAYOUT:
+ case WID_PAGE_DURATION:
+ case WID_PAGE_CHANGE:
+ {
+ sal_Int32 nValue = 0;
+ if(!(aValue >>= nValue))
+ throw lang::IllegalArgumentException();
+
+ switch( pEntry->nWID )
+ {
+ case WID_PAGE_LEFT:
+ SetLftBorder(nValue);
+ break;
+ case WID_PAGE_RIGHT:
+ SetRgtBorder( nValue );
+ break;
+ case WID_PAGE_TOP:
+ SetUppBorder( nValue );
+ break;
+ case WID_PAGE_BOTTOM:
+ SetLwrBorder( nValue );
+ break;
+ case WID_PAGE_CHANGE:
+ GetPage()->SetPresChange( (PresChange)nValue );
+ break;
+ case WID_PAGE_LAYOUT:
+ GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
+ break;
+ case WID_PAGE_DURATION:
+ GetPage()->SetTime((sal_uInt32)nValue);
+ break;
+ }
+ break;
+ }
+ case WID_PAGE_WIDTH:
+ {
+ sal_Int32 nWidth = 0;
+ if(!(aValue >>= nWidth))
+ throw lang::IllegalArgumentException();
+
+ SetWidth( nWidth );
+ break;
+ }
+ case WID_PAGE_HEIGHT:
+ {
+ sal_Int32 nHeight = 0;
+ if(!(aValue >>= nHeight))
+ throw lang::IllegalArgumentException();
+
+ SetHeight( nHeight );
+ break;
+ }
+ case WID_PAGE_ORIENT:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE;
+
+ if( eOri != GetPage()->GetOrientation() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetOrientation( eOri );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetOrientation( eOri );
+ }
+ }
+ break;
+ }
+ case WID_PAGE_EFFECT:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum );
+ break;
+ }
+ case WID_PAGE_BACK:
+ setBackground( aValue );
+ break;
+ case WID_PAGE_SPEED:
+ {
+ sal_Int32 nEnum = 0;
+ if(!::cppu::enum2int( nEnum, aValue ))
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 ) );
+ break;
+ }
+ case WID_PAGE_VISIBLE :
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+ GetPage()->SetExcluded( bVisible == FALSE );
+ break;
+ }
+ case WID_PAGE_SOUNDFILE :
+ {
+ OUString aURL;
+ if( aValue >>= aURL )
+ {
+ GetPage()->SetSoundFile( aURL );
+ GetPage()->SetSound( aURL.getLength() != 0 ? sal_True : sal_False );
+ break;
+ }
+ else
+ {
+ sal_Bool bStopSound = sal_False;
+ if( aValue >>= bStopSound )
+ {
+ GetPage()->SetStopSound( bStopSound ? true : false );
+ break;
+ }
+ }
+
+
+ throw lang::IllegalArgumentException();
+ }
+ case WID_LOOP_SOUND:
+ {
+ sal_Bool bLoop = sal_False;
+ if( ! (aValue >>= bLoop) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->SetLoopSound( bLoop ? true : false );
+ break;
+ }
+ case WID_PAGE_BACKFULL:
+ {
+ sal_Bool bFullSize = sal_False;
+ if( ! ( aValue >>= bFullSize ) )
+ throw lang::IllegalArgumentException();
+ GetPage()->SetBackgroundFullSize( bFullSize );
+ break;
+ }
+ case WID_PAGE_BACKVIS:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), FALSE), bVisible);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ }
+ break;
+ }
+ case WID_PAGE_BACKOBJVIS:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), FALSE), bVisible);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ }
+ }
+
+ break;
+ }
+ case WID_PAGE_USERATTRIBS:
+ {
+ if( !GetPage()->setAlienAttributes( aValue ) )
+ throw lang::IllegalArgumentException();
+ break;
+ }
+ case WID_PAGE_BOOKMARK:
+ {
+ OUString aBookmarkURL;
+ if( ! ( aValue >>= aBookmarkURL ) )
+ throw lang::IllegalArgumentException();
+
+ setBookmarkURL( aBookmarkURL );
+ break;
+ }
+
+ case WID_PAGE_HEADERVISIBLE:
+ case WID_PAGE_HEADERTEXT:
+ case WID_PAGE_FOOTERVISIBLE:
+ case WID_PAGE_FOOTERTEXT:
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ case WID_PAGE_DATETIMEVISIBLE:
+ case WID_PAGE_DATETIMEFIXED:
+ case WID_PAGE_DATETIMETEXT:
+ case WID_PAGE_DATETIMEFORMAT:
+ {
+ sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
+
+ switch( pEntry->nWID )
+ {
+ case WID_PAGE_HEADERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbHeaderVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_HEADERTEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maHeaderText = aText;
+ break;
+ }
+ case WID_PAGE_FOOTERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbFooterVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_FOOTERTEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maFooterText = aText;
+ break;
+ }
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMEVISIBLE:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbDateTimeVisible = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMEFIXED:
+ {
+ sal_Bool bVisible = sal_False;
+ if( ! ( aValue >>= bVisible ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
+ break;
+ }
+ case WID_PAGE_DATETIMETEXT:
+ {
+ OUString aText;
+ if( ! ( aValue >>= aText ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.maDateTimeText = aText;
+ break;
+ }
+ case WID_PAGE_DATETIMEFORMAT:
+ {
+ sal_Int32 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ aHeaderFooterSettings.meDateTimeFormat = nValue;
+ break;
+ }
+ }
+
+ if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
+ GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
+
+ break;
+ }
+
+ case WID_PAGE_NUMBER:
+ if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
+ {
+ if( !(aValue >>= mnTempPageNumber) )
+ throw lang::IllegalArgumentException();
+
+ break;
+ }
+ throw beans::PropertyVetoException();
+
+ case WID_PAGE_LDBITMAP:
+ case WID_PAGE_LDNAME:
+ case WID_PAGE_ISDARK:
+ throw beans::PropertyVetoException();
+
+ case WID_TRANSITION_TYPE:
+ {
+ sal_Int16 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionType( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_SUBTYPE:
+ {
+ sal_Int16 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionSubtype( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_DIRECTION:
+ {
+ sal_Bool bValue = sal_False;
+ if( ! ( aValue >>= bValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDirection( bValue );
+ break;
+ }
+
+ case WID_TRANSITION_FADE_COLOR:
+ {
+ sal_Int32 nValue = 0;
+ if( ! ( aValue >>= nValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionFadeColor( nValue );
+ break;
+ }
+
+ case WID_TRANSITION_DURATION:
+ {
+ double fValue = 0.0;
+ if( ! ( aValue >>= fValue ) )
+ throw lang::IllegalArgumentException();
+
+ GetPage()->setTransitionDuration( fValue );
+ break;
+ }
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ GetModel()->SetModified();
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ uno::Any aAny;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_NAVORDER:
+ aAny = getNavigationOrder();
+ break;
+ case WID_PAGE_LEFT:
+ aAny <<= (sal_Int32)( GetPage()->GetLftBorder() );
+ break;
+ case WID_PAGE_RIGHT:
+ aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() );
+ break;
+ case WID_PAGE_TOP:
+ aAny <<= (sal_Int32)( GetPage()->GetUppBorder() );
+ break;
+ case WID_PAGE_BOTTOM:
+ aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() );
+ break;
+ case WID_PAGE_WIDTH:
+ aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() );
+ break;
+ case WID_PAGE_HEIGHT:
+ aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() );
+ break;
+ case WID_PAGE_ORIENT:
+ aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::getCppuType((const view::PaperOrientation*)0) );
+ break;
+ case WID_PAGE_EFFECT:
+ aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect*)0) );
+ break;
+ case WID_PAGE_CHANGE:
+ aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
+ break;
+ case WID_PAGE_SPEED:
+ {
+ const double fDuration = GetPage()->getTransitionDuration();
+ aAny = ::cppu::int2enum( fDuration < 2.0 ? 2 : (fDuration > 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed*)0) );
+ }
+ break;
+ case WID_PAGE_LAYOUT:
+ aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
+ break;
+ case WID_PAGE_NUMBER:
+ {
+ const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
+
+ if(nPageNumber > 0)
+ {
+ // for all other pages calculate the number
+ aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
+ }
+ else
+ {
+ aAny <<= mnTempPageNumber;
+ }
+ }
+ break;
+ case WID_PAGE_DURATION:
+ aAny <<= (sal_Int32)(GetPage()->GetTime());
+ break;
+ case WID_PAGE_LDNAME:
+ {
+ const OUString aName( GetPage()->GetName() );
+ aAny <<= aName;
+ break;
+ }
+ case WID_PAGE_LDBITMAP:
+ {
+ BOOL bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ Reference< awt::XBitmap > xBitmap(
+ VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( bHC ? BMP_PAGE_H : BMP_PAGE ) ) ) );
+ aAny <<= xBitmap;
+ }
+ break;
+ case WID_PAGE_BACK:
+ getBackground( aAny );
+ break;
+ case WID_PAGE_PREVIEW :
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if ( pDoc )
+ {
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
+ {
+ pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ ::boost::shared_ptr<GDIMetaFile> pMetaFile =
+ pDocShell->GetPreviewMetaFile();
+ if ( pMetaFile )
+ {
+ Point aPoint;
+ Size aSize( GetPage()->GetSize() );
+ pMetaFile->AddAction( (MetaAction*) new MetaFillColorAction( COL_WHITE, TRUE ), 0 );
+ pMetaFile->AddAction( (MetaAction*) new MetaRectAction( Rectangle( aPoint, aSize ) ), 1 );
+ pMetaFile->SetPrefMapMode( MAP_100TH_MM );
+ pMetaFile->SetPrefSize( aSize );
+
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ ConvertGDIMetaFileToWMF( *pMetaFile, aDestStrm, NULL, sal_False );
+ Sequence<sal_Int8> aSeq( (sal_Int8*)aDestStrm.GetData(), aDestStrm.Tell() );
+ aAny <<= aSeq;
+ }
+ }
+ }
+ }
+ break;
+
+ case WID_PAGE_PREVIEWBITMAP :
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ if ( pDoc )
+ {
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
+ sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
+ {
+ pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ ::boost::shared_ptr<GDIMetaFile> pMetaFile =
+ pDocShell->GetPreviewMetaFile();
+ BitmapEx aBitmap;
+ if ( pMetaFile && pMetaFile->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
+ aBitmap ) )
+ {
+ SvMemoryStream aMemStream;
+ aBitmap.GetBitmap().Write( aMemStream, FALSE, FALSE );
+ uno::Sequence<sal_Int8> aSeq( (sal_Int8*)aMemStream.GetData(), aMemStream.Tell() );
+ aAny <<= aSeq;
+ }
+ }
+ }
+ }
+ break;
+
+ case WID_PAGE_VISIBLE :
+ {
+ sal_Bool bVisible = GetPage()->IsExcluded() == FALSE;
+ aAny <<= Any( &bVisible, ::getBooleanCppuType() );
+ break;
+ }
+
+ case WID_PAGE_SOUNDFILE :
+ {
+ if( GetPage()->IsStopSound() )
+ {
+ aAny <<= sal_True;
+ }
+ else
+ {
+ OUString aURL;
+ if( GetPage()->IsSoundOn() )
+ aURL = GetPage()->GetSoundFile();
+ aAny <<= aURL;
+ }
+ break;
+ }
+ case WID_LOOP_SOUND:
+ {
+ aAny <<= (sal_Bool)GetPage()->IsLoopSound();
+ break;
+ }
+ case WID_PAGE_BACKFULL:
+ {
+ sal_Bool bFullSize = GetPage()->IsBackgroundFullSize();
+ aAny = Any( &bFullSize, ::getBooleanCppuType() );
+ break;
+ }
+ case WID_PAGE_BACKVIS:
+ {
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), FALSE));
+ }
+ else
+ {
+ aAny <<= (sal_Bool)sal_False;
+ }
+ }
+ break;
+ }
+ case WID_PAGE_BACKOBJVIS:
+ {
+ SdrPage* pPage = GetPage();
+ if( pPage )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
+ if( pDoc->GetMasterPageCount() )
+ {
+ SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
+ aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), FALSE));
+ }
+ else
+ {
+ aAny <<= (sal_Bool)sal_False;
+ }
+ }
+ break;
+ }
+ case WID_PAGE_USERATTRIBS:
+ {
+ GetPage()->getAlienAttributes( aAny );
+ break;
+ }
+ case WID_PAGE_BOOKMARK:
+ {
+ aAny <<= getBookmarkURL();
+ break;
+ }
+ case WID_PAGE_ISDARK:
+ {
+ aAny <<= (sal_Bool)GetPage()->GetPageBackgroundColor().IsDark();
+ break;
+ }
+ case WID_PAGE_HEADERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbHeaderVisible;
+ break;
+ case WID_PAGE_HEADERTEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_FOOTERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbFooterVisible;
+ break;
+ case WID_PAGE_FOOTERTEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_PAGENUMBERVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
+ break;
+ case WID_PAGE_DATETIMEVISIBLE:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
+ break;
+ case WID_PAGE_DATETIMEFIXED:
+ aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
+ break;
+ case WID_PAGE_DATETIMETEXT:
+ {
+ const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
+ aAny <<= aText;
+ }
+ break;
+ case WID_PAGE_DATETIMEFORMAT:
+ aAny <<= (sal_Int32)GetPage()->getHeaderFooterSettings().meDateTimeFormat;
+ break;
+
+ case WID_TRANSITION_TYPE:
+ aAny <<= GetPage()->getTransitionType();
+ break;
+
+ case WID_TRANSITION_SUBTYPE:
+ aAny <<= GetPage()->getTransitionSubtype();
+ break;
+
+ case WID_TRANSITION_DIRECTION:
+ aAny <<= GetPage()->getTransitionDirection();
+ break;
+
+ case WID_TRANSITION_FADE_COLOR:
+ aAny <<= GetPage()->getTransitionFadeColor();
+ break;
+
+ case WID_TRANSITION_DURATION:
+ aAny <<= GetPage()->getTransitionDuration();
+ break;
+
+ default:
+ throw beans::UnknownPropertyException();
+ }
+ return aAny;
+}
+
+void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XMultiPropertySet
+void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
+{
+ if( aPropertyNames.getLength() != aValues.getLength() )
+ throw lang::IllegalArgumentException();
+
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+ sal_uInt32 nCount = aValues.getLength();
+ while( nCount-- )
+ {
+ try
+ {
+ setPropertyValue( *pNames++, *pValues++ );
+ }
+ catch( beans::UnknownPropertyException& )
+ {
+ // ignore for multi property set
+ // todo: optimize this!
+ }
+ }
+}
+
+Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
+{
+ const OUString* pNames = aPropertyNames.getConstArray();
+ sal_uInt32 nCount = aPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+ while( nCount-- )
+ {
+ Any aValue;
+ try
+ {
+ aValue = getPropertyValue( *pNames++ );
+ }
+ catch( beans::UnknownPropertyException& )
+ {
+ // ignore for multi property set
+ // todo: optimize this!
+ }
+ *pValues++ = aValue;
+ }
+ return aValues;
+}
+
+void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj ) const throw()
+{
+ DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
+ DBG_ASSERT( pObj, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
+
+ if( GetPage() && pObj )
+ {
+ PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
+
+ SvxShape* pShape = NULL;
+
+ if(pObj->GetObjInventor() == SdrInventor)
+ {
+ sal_uInt32 nInventor = pObj->GetObjIdentifier();
+ switch( nInventor )
+ {
+ case OBJ_TITLETEXT:
+ pShape = new SvxShapeText( pObj );
+ if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
+ {
+ // fake a empty PageShape if its a title shape on the master page
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")));
+ }
+ else
+ {
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")));
+ }
+ eKind = PRESOBJ_NONE;
+ break;
+ case OBJ_OUTLINETEXT:
+ pShape = new SvxShapeText( pObj );
+ pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")));
+ eKind = PRESOBJ_NONE;
+ break;
+ }
+ }
+
+ Reference< drawing::XShape > xShape( pShape );
+
+ if(!xShape.is())
+ xShape = SvxFmDrawPage::_CreateShape( pObj );
+
+
+ if( eKind != PRESOBJ_NONE )
+ {
+ String aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation."));
+
+ switch( eKind )
+ {
+ case PRESOBJ_TITLE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") );
+ break;
+ case PRESOBJ_OUTLINE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") );
+ break;
+ case PRESOBJ_TEXT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") );
+ break;
+ case PRESOBJ_GRAPHIC:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") );
+ break;
+ case PRESOBJ_OBJECT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") );
+ break;
+ case PRESOBJ_CHART:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") );
+ break;
+ case PRESOBJ_ORGCHART:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") );
+ break;
+ case PRESOBJ_CALC:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("CalcShape") );
+ break;
+ case PRESOBJ_TABLE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
+ break;
+ case PRESOBJ_MEDIA:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("MediaShape") );
+ break;
+ case PRESOBJ_PAGE:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
+ break;
+ case PRESOBJ_HANDOUT:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") );
+ break;
+ case PRESOBJ_NOTES:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") );
+ break;
+ case PRESOBJ_FOOTER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("FooterShape") );
+ break;
+ case PRESOBJ_HEADER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HeaderShape") );
+ break;
+ case PRESOBJ_SLIDENUMBER:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SlideNumberShape") );
+ break;
+ case PRESOBJ_DATETIME:
+ aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("DateTimeShape") );
+ break;
+ case PRESOBJ_NONE:
+ case PRESOBJ_IMAGE:
+ case PRESOBJ_MAX:
+ break;
+ }
+
+ if( !pShape )
+ pShape = SvxShape::getImplementation( xShape );
+
+ if( pShape )
+ pShape->SetShapeType( aShapeType );
+ }
+
+ // SdXShape aggregiert SvxShape
+ new SdXShape( SvxShape::getImplementation( xShape ), GetModel() );
+ return xShape;
+ }
+ else
+ {
+ return SvxFmDrawPage::_CreateShape( pObj );
+ }
+
+}
+
+//----------------------------------------------------------------------
+
+// XServiceInfo
+Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
+ "com.sun.star.document.LinkTarget",
+ "com.sun.star.document.LinkTargetSupplier");
+ return aSeq;
+}
+
+//----------------------------------------------------------------------
+
+// XLinkTargetSupplier
+Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( )
+ throw(uno::RuntimeException)
+{
+ return new SdPageLinkTargets( (SdGenericDrawPage*)this );
+}
+
+//----------------------------------------------------------------------
+
+void SdGenericDrawPage::setBackground( const Any& ) throw(lang::IllegalArgumentException)
+{
+ DBG_ERROR( "Don't call me, I'm useless!" );
+}
+
+//----------------------------------------------------------------------
+
+void SdGenericDrawPage::getBackground( Any& ) throw()
+{
+ DBG_ERROR( "Don't call me, I'm useless!" );
+}
+
+//----------------------------------------------------------------------
+
+OUString SdGenericDrawPage::getBookmarkURL() const
+{
+ OUStringBuffer aRet;
+ if( SvxFmDrawPage::mpPage )
+ {
+ OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
+ if( aFileName.getLength() )
+ {
+ const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
+ aRet.append( aFileName );
+ aRet.append( (sal_Unicode)'#' );
+ aRet.append( aBookmarkName );
+ }
+ }
+
+ return aRet.makeStringAndClear();
+}
+
+//----------------------------------------------------------------------
+void SdGenericDrawPage::setBookmarkURL( rtl::OUString& rURL )
+{
+ if( SvxFmDrawPage::mpPage )
+ {
+ sal_Int32 nIndex = rURL.indexOf( (sal_Unicode)'#' );
+ if( nIndex != -1 )
+ {
+ const String aFileName( rURL.copy( 0, nIndex ) );
+ const String aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) );
+
+ if( aFileName.Len() && aBookmarkName.Len() )
+ {
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
+ static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ Reference< drawing::XShape > xShape;
+ if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
+ return xShape;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+
+ _SelectObjectsInView( xShapes, pPageView );
+
+ mpView->CombineMarkedObjects( sal_False );
+
+ mpView->AdjustMarkHdl();
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj )
+ xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
+ }
+
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+
+ return xShape;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(mpView==NULL||!xGroup.is()||GetPage()==NULL)
+ return;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+ _SelectObjectInView( xGroup, pPageView );
+ mpView->DismantleMarkedObjects( sal_False );
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ uno::Reference< drawing::XShape > xShape;
+ if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
+ return xShape;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+
+ _SelectObjectsInView( xShapes, pPageView );
+
+ mpView->CombineMarkedObjects( sal_True );
+
+ mpView->AdjustMarkHdl();
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj )
+ xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
+ }
+
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+
+ return xShape;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(mpView==NULL||!xShape.is()||GetPage()==NULL)
+ return;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
+ _SelectObjectInView( xShape, pPageView );
+ mpView->DismantleMarkedObjects( sal_True );
+ mpView->HideSdrPage();
+
+ GetModel()->SetModified();
+}
+
+void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetLftBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetLftBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetLftBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetRgtBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetRgtBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetRgtBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetUppBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetUppBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetUppBorder( nValue );
+ }
+ }
+}
+
+void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue )
+{
+ if( nValue != GetPage()->GetLwrBorder() )
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetLwrBorder( nValue );
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetLwrBorder( nValue );
+ }
+ }
+}
+
+static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
+{
+ ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+ if ( pDocShell )
+ {
+ ::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
+
+ if( pViewSh )
+ {
+ if( pViewSh->ISA(::sd::DrawViewShell ) )
+ static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
+
+ Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
+ const long nWidth = aPageSize.Width();
+ const long nHeight = aPageSize.Height();
+
+ Point aPageOrg = Point(nWidth, nHeight / 2);
+ Size aViewSize = Size(nWidth * 3, nHeight * 2);
+
+ pDoc->SetMaxObjSize(aViewSize);
+
+ pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), TRUE);
+
+ pViewSh->UpdateScrollBars();
+ }
+ }
+}
+
+void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
+{
+ Size aSize( GetPage()->GetSize() );
+ if( aSize.getWidth() != nWidth )
+ {
+ aSize.setWidth( nWidth );
+
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ refreshpage( pDoc, ePageKind );
+ }
+}
+
+void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
+{
+ Size aSize( GetPage()->GetSize() );
+ if( aSize.getHeight() != nHeight )
+ {
+ aSize.setHeight( nHeight );
+
+ SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
+ const PageKind ePageKind = GetPage()->GetPageKind();
+
+ USHORT i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ nPageCnt = pDoc->GetSdPageCount(ePageKind);
+
+ for (i = 0; i < nPageCnt; i++)
+ {
+ SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ pPage->SetSize(aSize);
+ }
+
+ refreshpage( pDoc, ePageKind );
+ }
+}
+
+// XInterface
+void SdGenericDrawPage::release() throw()
+{
+
+ OWeakAggObject::release();
+}
+
+// XComponent
+void SdGenericDrawPage::disposing() throw()
+{
+ mpModel = 0;
+ SvxFmDrawPage::disposing();
+}
+
+// XAnimationNodeSupplier
+Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
+
+
+ return pSdPage->getAnimationNode();
+}
+
+//========================================================================
+// SdPageLinkTargets
+//========================================================================
+
+SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
+{
+ mxPage = pUnoPage;
+ mpUnoPage = pUnoPage;
+}
+
+SdPageLinkTargets::~SdPageLinkTargets() throw()
+{
+}
+
+ // XElementAccess
+uno::Type SAL_CALL SdPageLinkTargets::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE(beans::XPropertySet);
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+// container::XNameAccess
+
+// XNameAccess
+Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObject* pObj = FindObject( aName );
+ if( pObj )
+ {
+ Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
+ return makeAny( aRef );
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_uInt32 nObjCount = 0;
+
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage != NULL )
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ nObjCount++;
+ }
+ }
+
+ Sequence< OUString > aSeq( nObjCount );
+ if( nObjCount > 0 )
+ {
+ OUString* pStr = aSeq.getArray();
+
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() )
+ *pStr++ = aStr;
+ }
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return FindObject( aName ) != NULL;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+SdrObject* SdPageLinkTargets::FindObject( const String& rName ) const throw()
+{
+ SdPage* pPage = mpUnoPage->GetPage();
+ if( pPage == NULL )
+ return NULL;
+
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ String aStr( pObj->GetName() );
+ if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
+ aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
+ if( aStr.Len() && (aStr == rName) )
+ return pObj;
+ }
+
+ return NULL;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdPageLinkTargets::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") );
+}
+
+sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
+ Sequence< OUString > aSeq( &aSN, 1);
+ return aSeq;
+}
+
+//========================================================================
+// SdDrawPage
+//========================================================================
+
+SdDrawPage::SdDrawPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
+: SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
+{
+}
+
+SdDrawPage::~SdDrawPage() throw()
+{
+}
+
+// XInterface
+Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ if( rType == ITYPE( drawing::XMasterPageTarget ) )
+ {
+ return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
+ }
+ else
+ {
+ if( mbIsImpressDocument )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+
+ if( ePageKind != PK_HANDOUT && rType == ITYPE( presentation::XPresentationPage ) )
+ {
+ return makeAny( Reference< presentation::XPresentationPage >( this ) );
+ }
+ }
+ }
+
+ return SdGenericDrawPage::queryInterface( rType );
+}
+
+void SAL_CALL SdDrawPage::acquire() throw()
+{
+ SvxDrawPage::acquire();
+}
+
+void SAL_CALL SdDrawPage::release() throw()
+{
+ SvxDrawPage::release();
+}
+
+UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
+
+// XTypeProvider
+Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+ sal_Bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
+
+ // Collect the types of this class.
+ ::std::vector<uno::Type> aTypes;
+ aTypes.reserve(13);
+ aTypes.push_back(ITYPE(drawing::XDrawPage));
+ aTypes.push_back(ITYPE(beans::XPropertySet));
+ aTypes.push_back(ITYPE(container::XNamed));
+ aTypes.push_back(ITYPE(drawing::XMasterPageTarget));
+ aTypes.push_back(ITYPE(lang::XServiceInfo));
+ aTypes.push_back(ITYPE(util::XReplaceable));
+ aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
+ aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
+ aTypes.push_back(ITYPE( drawing::XShapeBinder ));
+ aTypes.push_back(ITYPE( office::XAnnotationAccess ));
+ aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
+ if( bPresPage )
+ aTypes.push_back(ITYPE(presentation::XPresentationPage));
+ if( bPresPage && ePageKind == PK_STANDARD )
+ aTypes.push_back(ITYPE(XAnimationNodeSupplier));
+
+ // Get types of base class.
+ const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ // Join those types in a sequence.
+ maTypeSequence.realloc(aTypes.size() + nBaseTypes);
+ uno::Type* pTypes = maTypeSequence.getArray();
+ ::std::vector<uno::Type>::const_iterator iType;
+ for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
+ *pTypes++ = *iType;
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ static Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+OUString SdDrawPage::getPageApiName( SdPage* pPage )
+{
+ return ::getPageApiName( pPage );
+}
+
+OUString getPageApiName( SdPage* pPage )
+{
+ OUString aPageName;
+
+ if(pPage)
+ {
+ aPageName = pPage->GetRealName();
+
+ if( aPageName.getLength() == 0 )
+ {
+ OUStringBuffer sBuffer;
+ sBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName ) );
+ const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
+ sBuffer.append( nPageNum );
+ aPageName = sBuffer.makeStringAndClear();
+ }
+ }
+
+ return aPageName;
+}
+
+
+OUString getPageApiNameFromUiName( const String& rUIName )
+{
+ OUString aApiName;
+
+ String aDefPageName(SdResId(STR_PAGE));
+ aDefPageName += sal_Unicode( ' ' );
+
+ if( rUIName.Equals( aDefPageName, 0, aDefPageName.Len() ) )
+ {
+ aApiName = OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ) );
+ aApiName += rUIName.Copy( aDefPageName.Len() );
+ }
+ else
+ {
+ aApiName = rUIName;
+ }
+
+ return aApiName;
+}
+
+OUString SdDrawPage::getPageApiNameFromUiName( const String& rUIName )
+{
+ return ::getPageApiNameFromUiName( rUIName );
+}
+
+String getUiNameFromPageApiNameImpl( const OUString& rApiName )
+{
+ const String aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ));
+ if( rApiName.compareTo( aDefPageName, aDefPageName.Len() ) == 0 )
+ {
+ OUString aNumber( rApiName.copy( sizeof( sEmptyPageName ) - 1 ) );
+
+ // create the page number
+ sal_Int32 nPageNumber = aNumber.toInt32();
+
+ // check if there are non number characters in the number part
+ const sal_Int32 nChars = aNumber.getLength();
+ const sal_Unicode* pString = aNumber.getStr();
+ sal_Int32 nChar;
+ for( nChar = 0; nChar < nChars; nChar++, pString++ )
+ {
+ if((*pString < sal_Unicode('0')) || (*pString > sal_Unicode('9')))
+ {
+ // found a non number character, so this is not the default
+ // name for this page
+ nPageNumber = -1;
+ break;
+ }
+ }
+
+ if( nPageNumber != -1)
+ {
+ OUStringBuffer sBuffer;
+ sBuffer.append( String(SdResId(STR_PAGE)) );
+ sBuffer.append( sal_Unicode( ' ' ) );
+ sBuffer.append( aNumber );
+ return sBuffer.makeStringAndClear();
+ }
+ }
+
+ return rApiName;
+}
+
+String SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
+{
+ return getUiNameFromPageApiNameImpl( rApiName );
+}
+
+// XServiceInfo
+OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") );
+}
+
+Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
+
+ if( mbIsImpressDocument )
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::supportsService( ServiceName );
+}
+
+// XNamed
+void SAL_CALL SdDrawPage::setName( const OUString& rName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
+
+ OUString aName( rName );
+
+ if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
+ {
+ // check if this is the default 'page1234' name
+ if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0)
+ {
+ // ok, it maybe is, first get the number part after 'page'
+ OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
+
+ // create the page number
+ sal_Int32 nPageNumber = aNumber.toInt32();
+
+ // check if there are non number characters in the number part
+ const sal_Int32 nChars = aNumber.getLength();
+ const sal_Unicode* pString = aNumber.getStr();
+ sal_Int32 nChar;
+ for( nChar = 0; nChar < nChars; nChar++, pString++ )
+ {
+ if((*pString < '0') || (*pString > '9'))
+ {
+ // found a non number character, so this is not the default
+ // name for this page
+ nPageNumber = -1;
+ break;
+ }
+ }
+
+ if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
+ aName = OUString();
+ }
+ else
+ {
+ String aDefaultPageName( SdResId(STR_PAGE) );
+ aDefaultPageName += sal_Unicode( ' ' );
+ if( aName.compareTo( aDefaultPageName, aDefaultPageName.Len() ) == 0 )
+ aName = OUString();
+ }
+
+ GetPage()->SetName( aName );
+
+ USHORT nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
+ if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES ) > nNotesPageNum )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PK_NOTES );
+ if( pNotesPage )
+ pNotesPage->SetName(aName);
+ }
+
+ // fake a mode change to repaint the page tab bar
+ ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+ if( pViewSh && pViewSh->ISA(::sd::DrawViewShell))
+ {
+ ::sd::DrawViewShell* pDrawViewSh = static_cast<
+ ::sd::DrawViewShell*>(pViewSh);
+
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ if( eMode == EM_PAGE )
+ {
+ BOOL bLayer = pDrawViewSh->IsLayerModeActive();
+
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+ }
+
+ GetModel()->SetModified();
+ }
+}
+
+OUString SAL_CALL SdDrawPage::getName()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ return getPageApiName( GetPage() );
+}
+
+// XMasterPageTarget
+Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(GetPage())
+ {
+ Reference< drawing::XDrawPages > xPages( GetModel()->getMasterPages() );
+ Reference< drawing::XDrawPage > xPage;
+
+ if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
+ xPage = uno::Reference< drawing::XDrawPage >( rMasterPage.getUnoPage(), uno::UNO_QUERY );
+ }
+
+ return xPage;
+ }
+ return NULL;
+}
+
+void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage)
+ {
+ SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
+ if( pMasterPage && pMasterPage->isValid() )
+ {
+ SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
+
+ SdPage* pSdPage = (SdPage*) pMasterPage->GetSdrPage();
+ SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
+
+ SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(),
+ pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() );
+
+ SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
+ SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
+ ((SdPage*)SvxFmDrawPage::mpPage)->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
+
+ // set notes master also
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+
+ pNotesPage->TRG_ClearMasterPage();
+ sal_uInt16 nNum = (SvxFmDrawPage::mpPage->TRG_GetMasterPage()).GetPageNum() + 1;
+ pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
+ pNotesPage->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
+
+ GetModel()->SetModified();
+ }
+
+ }
+}
+
+// XPresentationPage
+Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+ if( pNotesPage )
+ {
+ Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
+ return xPage;
+ }
+ }
+ return NULL;
+}
+
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdDrawPage::getCount()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getCount();
+}
+
+Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return SdGenericDrawPage::getByIndex( Index );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdDrawPage::getElementType()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getElementType();
+}
+
+sal_Bool SAL_CALL SdDrawPage::hasElements()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::hasElements();
+}
+
+// XShapes
+void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ SdGenericDrawPage::add( xShape );
+}
+
+void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj )
+ {
+ GetPage()->RemovePresObj(pObj);
+ pObj->SetUserCall(NULL);
+ }
+ }
+
+ SdGenericDrawPage::remove( xShape );
+}
+
+void SdDrawPage::setBackground( const Any& rValue )
+ throw( lang::IllegalArgumentException )
+{
+ Reference< beans::XPropertySet > xSet;
+
+ if( !(rValue >>= xSet) && !rValue.hasValue() )
+ throw lang::IllegalArgumentException();
+
+ if( !xSet.is() )
+ {
+ // the easy case, no background set. Set XFILL_NONE to represent this
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ return;
+ }
+
+ // is it our own implementation?
+ SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
+
+ SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pBack )
+ {
+ pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+ else
+ {
+ SdUnoPageBackground* pBackground = new SdUnoPageBackground();
+
+ Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
+ Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
+ Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() );
+
+ Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
+ sal_Int32 nCount = aProperties.getLength();
+ beans::Property* pProp = aProperties.getArray();
+
+ while( nCount-- )
+ {
+ const OUString aPropName( pProp->Name );
+ if( xSetInfo->hasPropertyByName( aPropName ) )
+ xDestSet->setPropertyValue( aPropName,
+ xSet->getPropertyValue( aPropName ) );
+
+ pProp++;
+ }
+
+ pBackground->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+
+//-/ pObj->NbcSetAttributes( aSet, sal_False );
+ if( aSet.Count() == 0 )
+ {
+ // no background fill, represent by setting XFILL_NONE
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ // background fill, set at page (not sure if ClearItem is needed)
+ GetPage()->getSdrPageProperties().ClearItem();
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
+ }
+
+ // repaint only
+ SvxFmDrawPage::mpPage->ActionChanged();
+ // pPage->SendRepaintBroadcast();
+}
+
+// XAnnotationAccess:
+Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException)
+{
+ if( !GetPage() )
+ throw DisposedException();
+
+ Reference< XAnnotation > xRet;
+ GetPage()->createAnnotation(xRet);
+ return xRet;
+}
+
+void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException)
+{
+ GetPage()->removeAnnotation(annotation);
+}
+
+Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException)
+{
+ return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
+}
+
+void SdDrawPage::getBackground( Any& rValue ) throw()
+{
+ const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // no fill set (switched off by XFILL_NONE), clear rValue to represent this
+ rValue.clear();
+ }
+ else
+ {
+ // there is a fill set, export to rValue
+ Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
+ GetModel()->GetDoc(),
+ &GetPage()->getSdrPageProperties().GetItemSet()));
+ rValue <<= xSet;
+ }
+}
+
+void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
+{
+ Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
+ if( xIA.is() )
+ {
+ if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
+ {
+ if( GetPage()->HasObjectNavigationOrder() )
+ GetPage()->ClearObjectNavigationOrder();
+
+ return;
+ }
+ else if( xIA->getCount() == static_cast< sal_Int32 >( GetPage()->GetObjCount() ) )
+ {
+ GetPage()->SetNavigationOrder(xIA);
+ return;
+ }
+ }
+ throw IllegalArgumentException();
+}
+
+class NavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
+{
+public:
+ NavigationOrderAccess( SdrPage* pPage );
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
+
+private:
+ std::vector< Reference< XShape > > maShapes;
+};
+
+NavigationOrderAccess::NavigationOrderAccess( SdrPage* pPage )
+: maShapes( static_cast< sal_uInt32 >( pPage ? pPage->GetObjCount() : 0 ) )
+{
+ if( pPage )
+ {
+ sal_uInt32 nIndex;
+ const sal_uInt32 nCount = static_cast< sal_uInt32 >( pPage->GetObjCount() );
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ SdrObject* pObj = pPage->GetObj( nIndex );
+ sal_uInt32 nNavPos = pObj->GetNavigationPosition();
+ DBG_ASSERT( !maShapes[nNavPos].is(), "sd::NavigationOrderAccess::NavigationOrderAccess(), duplicate navigation positions from core!" );
+ maShapes[nNavPos] = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
+ }
+ }
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL NavigationOrderAccess::getCount( ) throw (RuntimeException)
+{
+ return static_cast< sal_Int32 >( maShapes.size() );
+}
+
+Any SAL_CALL NavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ if( (Index < 0) || (Index > getCount()) )
+ throw IndexOutOfBoundsException();
+
+ return Any( maShapes[Index] );
+}
+
+// XElementAccess
+Type SAL_CALL NavigationOrderAccess::getElementType( ) throw (RuntimeException)
+{
+ return XShape::static_type();
+}
+
+sal_Bool SAL_CALL NavigationOrderAccess::hasElements( ) throw (RuntimeException)
+{
+ return maShapes.empty() ? sal_False : sal_True;
+}
+
+Any SdGenericDrawPage::getNavigationOrder()
+{
+ if( GetPage()->HasObjectNavigationOrder() )
+ {
+ return Any( Reference< XIndexAccess >( new NavigationOrderAccess( GetPage() ) ) );
+ }
+ else
+ {
+ return Any( Reference< XIndexAccess >( this ) );
+ }
+}
+
+//========================================================================
+// class SdMasterPage
+//========================================================================
+
+SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
+: SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
+{
+}
+
+SdMasterPage::~SdMasterPage() throw()
+{
+}
+
+// XInterface
+Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ uno::Any aAny;
+
+ if( rType == ITYPE( container::XIndexAccess ) )
+ aAny <<= Reference< container::XIndexAccess >((presentation::XPresentationPage*)(this));
+ else if( rType == ITYPE( container::XElementAccess ) )
+ aAny <<= Reference< container::XElementAccess >((presentation::XPresentationPage*)(this));
+ else if( rType == ITYPE( container::XNamed ) )
+ aAny <<= Reference< container::XNamed >(this);
+ else if( rType == ITYPE( presentation::XPresentationPage ) &&
+ ( mbIsImpressDocument &&
+ GetPage() && GetPage()->GetPageKind() != PK_HANDOUT) )
+ aAny <<= Reference< presentation::XPresentationPage >( this );
+ else
+ return SdGenericDrawPage::queryInterface( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SdMasterPage::acquire() throw()
+{
+ SvxDrawPage::acquire();
+}
+
+void SAL_CALL SdMasterPage::release() throw()
+{
+ SvxDrawPage::release();
+}
+
+UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
+
+// XTypeProvider
+Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
+ sal_Bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
+
+ // Collect the types of this class.
+ ::std::vector<uno::Type> aTypes;
+ aTypes.reserve(12);
+ aTypes.push_back(ITYPE(drawing::XDrawPage));
+ aTypes.push_back(ITYPE(beans::XPropertySet));
+ aTypes.push_back(ITYPE(container::XNamed));
+ aTypes.push_back(ITYPE(lang::XServiceInfo));
+ aTypes.push_back(ITYPE(util::XReplaceable));
+ aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
+ aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
+ aTypes.push_back(ITYPE( drawing::XShapeBinder ));
+ aTypes.push_back(ITYPE( office::XAnnotationAccess ));
+ aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
+ if( bPresPage )
+ aTypes.push_back(ITYPE(presentation::XPresentationPage));
+ if( bPresPage && ePageKind == PK_STANDARD )
+ aTypes.push_back(ITYPE(XAnimationNodeSupplier));
+
+ // Get types of base class.
+ const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ // Join those types in a sequence.
+ maTypeSequence.realloc(aTypes.size() + nBaseTypes);
+ uno::Type* pTypes = maTypeSequence.getArray();
+ ::std::vector<uno::Type>::const_iterator iType;
+ for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
+ *pTypes++ = *iType;
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ static Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// XServiceInfo
+OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") );
+}
+
+Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
+
+ if( SvxFmDrawPage::mpPage && ((SdPage*)SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::supportsService( ServiceName );
+}
+
+// XElementAccess
+sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if( SvxFmDrawPage::mpPage == NULL )
+ return sal_False;
+
+ return SvxFmDrawPage::mpPage->GetObjCount() > 0;
+}
+
+uno::Type SAL_CALL SdMasterPage::getElementType()
+ throw(uno::RuntimeException)
+{
+ return SdGenericDrawPage::getElementType();
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdMasterPage::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ return SdGenericDrawPage::getCount();
+}
+
+Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ return SdGenericDrawPage::getByIndex(Index);
+}
+
+// intern
+void SdMasterPage::setBackground( const Any& rValue )
+ throw( lang::IllegalArgumentException )
+{
+ // we need at least an beans::XPropertySet
+ Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
+ if( !xInputSet.is() )
+ throw lang::IllegalArgumentException();
+
+ try
+ {
+ if( GetModel() && mbIsImpressDocument )
+ {
+ Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
+ Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
+ if( xFamily.is() )
+ {
+ OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
+
+ Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
+
+ Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
+ Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
+
+ PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin();
+ while( aIt != aBackgroundProperties.end() )
+ {
+ if( xSetInfo->hasPropertyByName( aIt->sName ) )
+ {
+ if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE )
+ xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) );
+ else
+ xSetStates->setPropertyToDefault( aIt->sName );
+ }
+
+ ++aIt;
+ }
+ }
+ }
+ else
+ {
+ // first fill an item set
+ // is it our own implementation?
+ SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
+
+ SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pBack )
+ {
+ pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
+ }
+ else
+ {
+ SdUnoPageBackground* pBackground = new SdUnoPageBackground();
+
+ Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
+ Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_QUERY_THROW );
+
+ uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
+ sal_Int32 nCount = aProperties.getLength();
+ beans::Property* pProp = aProperties.getArray();
+
+ while( nCount-- )
+ {
+ const OUString aPropName( pProp->Name );
+ if( xInputSetInfo->hasPropertyByName( aPropName ) )
+ xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
+
+ pProp++;
+ }
+
+ pBackground->fillItemSet( (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel(), aSet );
+ }
+
+ // if we find the background style, copy the set to the background
+ SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
+ SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
+ if(pSSPool)
+ {
+ String aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
+ aLayoutName.Erase(aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
+ aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
+ SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
+
+ if( pStyleSheet )
+ {
+ pStyleSheet->GetItemSet().Put( aSet );
+
+ // repaint only
+ SvxFmDrawPage::mpPage->ActionChanged();
+ return;
+ }
+ }
+
+ // if no background style is available, set at page directly. This
+ // is an error and should NOT happen (and will be asserted from the SdrPage)
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sd::SdMasterPage::setBackground(), exception caught!");
+ }
+}
+
+void SdMasterPage::getBackground( Any& rValue ) throw()
+{
+ if( GetModel() ) try
+ {
+ if( mbIsImpressDocument )
+ {
+ Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
+ Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
+
+ const OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
+ rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
+ }
+ else
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
+ SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
+ if(pSSPool)
+ {
+ String aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
+ aLayoutName.Erase( aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
+ aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
+ SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
+
+ if( pStyleSheet )
+ {
+ SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
+ if( aStyleSet.Count() )
+ {
+ rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
+ return;
+ }
+ }
+ }
+
+ // No style found, use fill attributes from page background. This
+ // should NOT happen and is an error
+ const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ rValue <<= Reference< beans::XPropertySet >(
+ new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
+ }
+ else
+ {
+ rValue.clear();
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ rValue.clear();
+ DBG_ERROR("sd::SdMasterPage::getBackground(), exception caught!");
+ }
+}
+
+// XNamed
+void SAL_CALL SdMasterPage::setName( const OUString& aName )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
+ {
+ String aNewName( aName );
+ GetPage()->SetName( aNewName );
+
+ if(GetModel()->GetDoc())
+ GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName);
+
+ // fake a mode change to repaint the page tab bar
+ ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
+ ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
+ if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) )
+ {
+ ::sd::DrawViewShell* pDrawViewSh =
+ static_cast< ::sd::DrawViewShell*>(pViewSh);
+
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ if( eMode == EM_MASTERPAGE )
+ {
+ BOOL bLayer = pDrawViewSh->IsLayerModeActive();
+
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+ }
+
+ GetModel()->SetModified();
+ }
+}
+
+OUString SAL_CALL SdMasterPage::getName( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage)
+ {
+ String aLayoutName( GetPage()->GetLayoutName() );
+ aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR)))));
+
+ return aLayoutName;
+ }
+
+ return OUString();
+}
+
+// XPresentationPage
+Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
+ {
+ SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
+ if( pNotesPage )
+ {
+ Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
+ return xPage;
+ }
+ }
+ return NULL;
+}
+
+// XShapes
+void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ SdGenericDrawPage::add( xShape );
+}
+
+void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ throwIfDisposed();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape )
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if( pObj )
+ {
+ if( GetPage()->IsPresObj( pObj ) )
+ GetPage()->RemovePresObj(pObj);
+ }
+ }
+
+ SdGenericDrawPage::remove( xShape );
+}
+
+
+Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
+{
+ Reference< uno::XInterface > xPage;
+
+ if( pPage && pPage->GetModel() )
+ {
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
+ if( pModel )
+ {
+ if( pPage->IsMasterPage() )
+ {
+ xPage = (::cppu::OWeakObject*)new SdMasterPage( pModel, pPage );
+ }
+ else
+ {
+ xPage = (::cppu::OWeakObject*)new SdDrawPage( pModel, pPage );
+ }
+ }
+ }
+
+ return xPage;
+}
diff --git a/sd/source/ui/unoidl/unopage.hxx b/sd/source/ui/unoidl/unopage.hxx
new file mode 100755
index 000000000000..e3fda70c0f11
--- /dev/null
+++ b/sd/source/ui/unoidl/unopage.hxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOPAGE_HXX
+#define _SD_UNOPAGE_HXX
+
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/office/XAnnotationAccess.hpp>
+
+#include <svl/itemprop.hxx>
+
+#ifndef _SVX_UNOPAGE_HXX
+#include <svx/unopage.hxx>
+#endif
+#include <svx/fmdpage.hxx>
+#include <svx/svdpool.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include "unosrch.hxx"
+
+class SdPage;
+class SvxShape;
+class SdrObject;
+struct SfxItemPropertySimpleEntry;
+
+#ifdef SVX_LIGHT
+#define SvxFmDrawPage SvxDrawPage
+#endif
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SdGenericDrawPage : public SvxFmDrawPage,
+ public SdUnoSearchReplaceShape,
+ public ::com::sun::star::drawing::XShapeCombiner,
+ public ::com::sun::star::drawing::XShapeBinder,
+ public ::com::sun::star::container::XNamed,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XMultiPropertySet,
+ public ::com::sun::star::animations::XAnimationNodeSupplier,
+ public ::com::sun::star::office::XAnnotationAccess,
+ public ::com::sun::star::document::XLinkTargetSupplier
+{
+private:
+ SdXImpressDocument* mpModel;
+ SdrModel* mpSdrModel;
+ sal_Int16 mnTempPageNumber; // for printing handouts
+
+protected:
+ friend class SdXImpressDocument;
+
+ const SvxItemPropertySet* mpPropSet;
+
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+
+ rtl::OUString getBookmarkURL() const;
+ void setBookmarkURL( rtl::OUString& rURL );
+
+ void SetLftBorder( sal_Int32 nValue );
+ void SetRgtBorder( sal_Int32 nValue );
+ void SetUppBorder( sal_Int32 nValue );
+ void SetLwrBorder( sal_Int32 nValue );
+
+ void SetWidth( sal_Int32 nWidth );
+ void SetHeight( sal_Int32 nHeight );
+
+ bool mbIsImpressDocument;
+
+ virtual void disposing() throw();
+
+ ::com::sun::star::uno::Any getNavigationOrder();
+ void setNavigationOrder( const ::com::sun::star::uno::Any& rValue );
+
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException );
+
+public:
+ SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet ) throw();
+ virtual ~SdGenericDrawPage() throw();
+
+ // intern
+ sal_Bool isValid() { return (SvxDrawPage::mpPage != NULL) && (mpModel != NULL); }
+
+ SdPage* GetPage() const { return (SdPage*)SvxDrawPage::mpPage; }
+ SdXImpressDocument* GetModel() const;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // this is called whenever a SdrObject must be created for a empty api shape wrapper
+ virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+
+ // SvxFmDrawPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL release() throw();
+
+ // XShapeCombiner
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL combine( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL split( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xGroup ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapeBinder
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL bind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unbind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XLinkTargetSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XAnimationNodeSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAnnotationAccess:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAnnotation(const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > & annotation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget,
+ public ::com::sun::star::presentation::XPresentationPage,
+ public SdGenericDrawPage
+{
+private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+protected:
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+public:
+ SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
+ virtual ~SdDrawPage() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SdDrawPage )
+
+ static ::rtl::OUString getPageApiName( SdPage* pPage );
+ static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName );
+ static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XMasterPageTarget
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPresentationPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage,
+ public SdGenericDrawPage
+{
+private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+protected:
+ virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw();
+
+public:
+ SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw();
+ virtual ~SdMasterPage() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL(SdMasterPage)
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XPresentationPage
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+/***********************************************************************
+* *
+***********************************************************************/
+#include <cppuhelper/implbase2.hxx>
+
+class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage;
+ SdGenericDrawPage* mpUnoPage;
+
+public:
+ SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw();
+ virtual ~SdPageLinkTargets() throw();
+
+ // intern
+ SdrObject* FindObject( const String& rName ) const throw();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _SD_UNOPAGE_HXX
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
new file mode 100644
index 000000000000..1ac62fb1363f
--- /dev/null
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -0,0 +1,463 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdpool.hxx>
+#include <comphelper/extract.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <svx/xflbstit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/unoshape.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include "unopback.hxx"
+#include "unohelp.hxx"
+#include "drawdoc.hxx"
+#include "unokywds.hxx"
+
+using namespace ::rtl;
+using namespace ::vos;
+using namespace ::com::sun::star;
+
+const SvxItemPropertySet* ImplGetPageBackgroundPropertySet()
+{
+ static const SfxItemPropertyMapEntry aPageBackgroundPropertyMap_Impl[] =
+ {
+ FILL_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+
+ static SvxItemPropertySet aPageBackgroundPropertySet_Impl( aPageBackgroundPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aPageBackgroundPropertySet_Impl;
+}
+
+UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground );
+
+SdUnoPageBackground::SdUnoPageBackground(
+ SdDrawDocument* pDoc /* = NULL */,
+ const SfxItemSet* pSet /* = NULL */) throw()
+: mpPropSet(ImplGetPageBackgroundPropertySet()),
+ mpSet(NULL),
+ mpDoc(pDoc)
+{
+ if( pDoc )
+ {
+ StartListening( *pDoc );
+ mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( pSet )
+ mpSet->Put(*pSet);
+ }
+}
+
+SdUnoPageBackground::~SdUnoPageBackground() throw()
+{
+ if( mpDoc )
+ EndListening( *mpDoc );
+
+ if( mpSet )
+ delete mpSet;
+}
+
+void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ // delete item set if document is dying because then the pool
+ // will also die
+ if( pSdrHint->GetKind() == HINT_MODELCLEARED )
+ {
+ delete mpSet;
+ mpSet = NULL;
+ mpDoc = NULL;
+ }
+ }
+
+}
+
+void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw()
+{
+ rSet.ClearItem();
+
+ if( mpSet == NULL )
+ {
+ StartListening( *pDoc );
+ mpDoc = pDoc;
+
+ mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
+
+ if( mpPropSet->AreThereOwnUsrAnys() )
+ {
+ uno::Any* pAny;
+ PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap()->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aIt = aProperties.begin();
+
+ while( aIt != aProperties.end() )
+ {
+ pAny = mpPropSet->GetUsrAnyForID( aIt->nWID );
+ if( pAny )
+ {
+ OUString aPropertyName( aIt->sName );
+ switch( aIt->nWID )
+ {
+ case XATTR_FILLFLOATTRANSPARENCE :
+ case XATTR_FILLGRADIENT :
+ {
+ if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::awt::Gradient*)0) )
+ && ( aIt->nMemberId == MID_FILLGRADIENT ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( aIt->nMemberId == MID_NAME ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+ case XATTR_FILLHATCH :
+ {
+ if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::drawing::Hatch*)0) )
+ && ( aIt->nMemberId == MID_FILLHATCH ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( aIt->nMemberId == MID_NAME ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+ case XATTR_FILLBITMAP :
+ {
+ if ( ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0) ) ||
+ ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >*)0) ) ) &&
+ ( aIt->nMemberId == MID_BITMAP ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
+ ( ( aIt->nMemberId == MID_NAME ) || ( aIt->nMemberId == MID_GRAFURL ) ) )
+ {
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ break;
+
+ default:
+ setPropertyValue( aPropertyName, *pAny );
+ }
+ }
+ ++aIt;
+ }
+ }
+ }
+
+ rSet.Put( *mpSet );
+}
+
+// XServiceInfo
+OUString SAL_CALL SdUnoPageBackground::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString::createFromAscii( sUNO_SdUnoPageBackground );
+}
+
+sal_Bool SAL_CALL SdUnoPageBackground::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SdUnoPageBackground::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aNameSequence( 2 );
+ OUString* pStrings = aNameSequence.getArray();
+
+ *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_PageBackground ) );
+ *pStrings = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_FillProperties ) );
+
+ return aNameSequence;
+}
+
+// XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPageBackground::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
+
+ if( pEntry == NULL )
+ {
+ throw beans::UnknownPropertyException();
+ }
+ else
+ {
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ drawing::BitmapMode eMode;
+ if( aValue >>= eMode )
+ {
+ mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
+ mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
+ return;
+ }
+ throw lang::IllegalArgumentException();
+ }
+
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( *mpSet );
+
+ if( !aSet.Count() )
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
+ {
+ OUString aName;
+ if(!(aValue >>= aName ))
+ throw lang::IllegalArgumentException();
+
+ SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
+ }
+ else
+ {
+ SvxItemPropertySet_setPropertyValue( *mpPropSet, pEntry, aValue, aSet );
+ }
+
+ mpSet->Put( aSet );
+ }
+ else
+ {
+ if(pEntry && pEntry->nWID)
+ mpPropSet->setPropertyValue( pEntry, aValue );
+ }
+ }
+}
+
+uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aAny;
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ {
+ throw beans::UnknownPropertyException();
+ }
+ else
+ {
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)mpSet->GetItem(XATTR_FILLBMP_STRETCH);
+ XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)mpSet->GetItem(XATTR_FILLBMP_TILE);
+
+ if( pStretchItem && pTileItem )
+ {
+ if( pTileItem->GetValue() )
+ aAny <<= drawing::BitmapMode_REPEAT;
+ else if( pStretchItem->GetValue() )
+ aAny <<= drawing::BitmapMode_STRETCH;
+ else
+ aAny <<= drawing::BitmapMode_NO_REPEAT;
+ }
+ }
+ else
+ {
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( *mpSet );
+
+ if( !aSet.Count() )
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ // Hole Wert aus ItemSet
+ aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
+ }
+ }
+ else
+ {
+ if(pEntry && pEntry->nWID)
+ aAny = mpPropSet->getPropertyValue( pEntry );
+ }
+ }
+ return aAny;
+}
+
+void SAL_CALL SdUnoPageBackground::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+void SAL_CALL SdUnoPageBackground::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
+
+// XPropertyState
+beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ if( mpSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
+ mpSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
+ {
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ return beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+
+ switch( mpSet->GetItemState( pEntry->nWID, sal_False ) )
+ {
+ case SFX_ITEM_READONLY:
+ case SFX_ITEM_SET:
+ return beans::PropertyState_DIRECT_VALUE;
+ case SFX_ITEM_DEFAULT:
+ return beans::PropertyState_DEFAULT_VALUE;
+ default:
+// case SFX_ITEM_DONTCARE:
+// case SFX_ITEM_DISABLED:
+ return beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+ else
+ {
+ if( NULL == mpPropSet->GetUsrAnyForID(pEntry->nWID) )
+ return beans::PropertyState_DEFAULT_VALUE;
+ else
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+}
+
+uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Int32 nCount = aPropertyName.getLength();
+ const OUString* pNames = aPropertyName.getConstArray();
+
+ uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount );
+ beans::PropertyState* pState = aPropertyStateSequence.getArray();
+
+ while( nCount-- )
+ *pState++ = getPropertyState( *pNames++ );
+
+ return aPropertyStateSequence;
+}
+
+void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
+
+ if( pEntry == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ mpSet->ClearItem( XATTR_FILLBMP_STRETCH );
+ mpSet->ClearItem( XATTR_FILLBMP_TILE );
+ }
+ else
+ {
+ mpSet->ClearItem( pEntry->nWID );
+ }
+ }
+}
+
+uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(aPropertyName);
+ if( pEntry == NULL || mpSet == NULL )
+ throw beans::UnknownPropertyException();
+
+ uno::Any aAny;
+ if( mpSet )
+ {
+ if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ aAny <<= drawing::BitmapMode_REPEAT;
+ }
+ else
+ {
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
+ aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+ aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
+ }
+ }
+ return aAny;
+}
+
+/** this is used because our property map is not sorted yet */
+const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
+{
+ return mpPropSet->getPropertyMap()->getByName(rPropertyName);
+}
+
diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx
new file mode 100644
index 000000000000..530a75856662
--- /dev/null
+++ b/sd/source/ui/unoidl/unopback.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SD_UNOPBACK_HXX
+#define _SD_UNOPBACK_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <svx/unoshprp.hxx>
+#include <editeng/unoipset.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include <cppuhelper/implbase4.hxx>
+
+const SvxItemPropertySet* ImplGetPageBackgroundPropertySet();
+class SdDrawDocument;
+class SfxItemSet;
+
+class SdUnoPageBackground : public ::cppu::WeakImplHelper4<
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::lang::XUnoTunnel>,
+ public SfxListener
+{
+protected:
+ const SvxItemPropertySet* mpPropSet;
+ SfxItemSet* mpSet;
+ SdrModel* mpDoc;
+
+ const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw();
+public:
+ SdUnoPageBackground( SdDrawDocument* pDoc = NULL, const SfxItemSet* pSet = NULL) throw();
+ ~SdUnoPageBackground() throw();
+
+ // internal
+ void fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw();
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // uno helper
+ UNO3_GETIMPLEMENTATION_DECL( SdUnoPageBackground )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/sd/source/ui/unoidl/unopool.cxx b/sd/source/ui/unoidl/unopool.cxx
new file mode 100644
index 000000000000..21ac567edc70
--- /dev/null
+++ b/sd/source/ui/unoidl/unopool.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <i18npool/mslangid.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/unopool.hxx>
+
+#include "drawdoc.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::comphelper;
+
+LanguageType SdUnoGetLanguage( const lang::Locale& rLocale )
+{
+ // empty language -> LANGUAGE_SYSTEM
+ if ( rLocale.Language.getLength() == 0 )
+ return LANGUAGE_SYSTEM;
+
+ LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale );
+ if ( eRet == LANGUAGE_NONE )
+ eRet = LANGUAGE_SYSTEM; //! or throw an exception?
+
+ return eRet;
+}
+
+class SdUnoDrawPool : public SvxUnoDrawPool
+{
+public:
+ SdUnoDrawPool( SdDrawDocument* pModel ) throw();
+ virtual ~SdUnoDrawPool() throw();
+
+protected:
+ virtual void putAny( SfxItemPool* pPool, const PropertyMapEntry* pEntry, const uno::Any& rValue ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException);
+
+private:
+ SdDrawDocument* mpDrawModel;
+};
+
+SdUnoDrawPool::SdUnoDrawPool( SdDrawDocument* pModel ) throw()
+: SvxUnoDrawPool( pModel ), mpDrawModel( pModel )
+{
+}
+
+SdUnoDrawPool::~SdUnoDrawPool() throw()
+{
+}
+
+void SdUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const uno::Any& rValue )
+ throw(beans::UnknownPropertyException, lang::IllegalArgumentException)
+{
+ switch( pEntry->mnHandle )
+ {
+ case EE_CHAR_LANGUAGE:
+ case EE_CHAR_LANGUAGE_CJK:
+ case EE_CHAR_LANGUAGE_CTL:
+ {
+ lang::Locale aLocale;
+ if( rValue >>= aLocale )
+ mpDrawModel->SetLanguage(
+ SdUnoGetLanguage( aLocale ),
+ (const USHORT)pEntry->mnHandle );
+ }
+ }
+ SvxUnoDrawPool::putAny( pPool, pEntry, rValue );
+}
+
+uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel )
+{
+ return (uno::XAggregation*)new SdUnoDrawPool( pDrawModel );
+}
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
new file mode 100755
index 000000000000..56133e03a375
--- /dev/null
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -0,0 +1,879 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <svx/unoshape.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/unoprov.hxx>
+#include <editeng/unotext.hxx>
+
+#include <comphelper/extract.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include "unohelp.hxx"
+#include "unoprnms.hxx"
+#include "unosrch.hxx"
+
+using namespace ::vos;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+#define WID_SEARCH_BACKWARDS 0
+#define WID_SEARCH_CASE 1
+#define WID_SEARCH_WORDS 2
+
+const SfxItemPropertyMapEntry* ImplGetSearchPropertyMap()
+{
+ static const SfxItemPropertyMapEntry aSearchPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_BACKWARDS), WID_SEARCH_BACKWARDS, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_CASE), WID_SEARCH_CASE, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_SEARCH_WORDS), WID_SEARCH_WORDS, &::getBooleanCppuType(), 0, 0 },
+ { 0,0,0,0,0,0}
+ };
+
+ return aSearchPropertyMap_Impl;
+}
+
+class SearchContext_impl
+{
+ uno::Reference< drawing::XShapes > mxShapes;
+ sal_Int32 mnIndex;
+ SearchContext_impl* mpParent;
+
+public:
+ SearchContext_impl( uno::Reference< drawing::XShapes > xShapes, SearchContext_impl* pParent = NULL )
+ : mxShapes( xShapes ), mnIndex( -1 ), mpParent( pParent ) {}
+
+
+ uno::Reference< drawing::XShape > firstShape()
+ {
+ mnIndex = -1;
+ return nextShape();
+ }
+
+ uno::Reference< drawing::XShape > nextShape()
+ {
+ uno::Reference< drawing::XShape > xShape;
+ mnIndex++;
+ if( mxShapes.is() && mxShapes->getCount() > mnIndex )
+ {
+ mxShapes->getByIndex( mnIndex ) >>= xShape;
+ }
+ return xShape;
+ }
+
+ SearchContext_impl* getParent() const { return mpParent; }
+};
+
+/* ================================================================= */
+/** this class implements a search or replace operation on a given
+ page or a given sdrobj
+ */
+
+SdUnoSearchReplaceShape::SdUnoSearchReplaceShape( drawing::XDrawPage* pPage ) throw()
+{
+ mpPage = pPage;
+}
+
+SdUnoSearchReplaceShape::~SdUnoSearchReplaceShape() throw()
+{
+}
+
+// util::XReplaceable
+uno::Reference< util::XReplaceDescriptor > SAL_CALL SdUnoSearchReplaceShape::createReplaceDescriptor()
+ throw( uno::RuntimeException )
+{
+ return new SdUnoSearchReplaceDescriptor(sal_True);
+}
+
+sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( const uno::Reference< util::XSearchDescriptor >& xDesc )
+ throw( uno::RuntimeException )
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+ if( pDescr == NULL )
+ return 0;
+
+ sal_Int32 nFound = 0;
+
+ uno::Reference< drawing::XShapes > xShapes;
+ uno::Reference< drawing::XShape > xShape;
+
+ SearchContext_impl* pContext = NULL;
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+
+ xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+
+ if( xShapes.is() && (xShapes->getCount() > 0) )
+ {
+ pContext = new SearchContext_impl( xShapes );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ xShapes = NULL;
+ }
+ }
+ else
+ {
+ xShape = mpShape;
+ }
+
+ while( xShape.is() )
+ {
+ // replace in xShape
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRange(xText, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xFound;
+
+ while( xRange.is() )
+ {
+ xFound = Search( xRange, pDescr );
+ if( !xFound.is() )
+ break;
+
+ xFound->setString( pDescr->getReplaceString() );
+ xRange = xFound->getEnd();
+ nFound++;
+ }
+ // done with xShape -> get next shape
+
+ // test if its a group
+ uno::Reference< drawing::XShapes > xGroupShape( xShape, uno::UNO_QUERY );
+ if( xGroupShape.is() && ( xGroupShape->getCount() > 0 ) )
+ {
+ pContext = new SearchContext_impl( xGroupShape, pContext );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ if( pContext )
+ xShape = pContext->nextShape();
+ else
+ xShape = NULL;
+ }
+
+ // test parent contexts for next shape if none
+ // is found in the current context
+ while( pContext && !xShape.is() )
+ {
+ if( pContext->getParent() )
+ {
+ SearchContext_impl* pOldContext = pContext;
+ pContext = pContext->getParent();
+ delete pOldContext;
+ xShape = pContext->nextShape();
+ }
+ else
+ {
+ delete pContext;
+ pContext = NULL;
+ xShape = NULL;
+ }
+ }
+ }
+
+ return nFound;
+}
+
+// XSearchable
+uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL SdUnoSearchReplaceShape::createSearchDescriptor( )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return new SdUnoSearchReplaceDescriptor(sal_False);
+}
+
+uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL SdUnoSearchReplaceShape::findAll( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+ if( pDescr == NULL )
+ return uno::Reference< container::XIndexAccess > ();
+
+
+ sal_Int32 nSequence = 32;
+ sal_Int32 nFound = 0;
+
+ uno::Sequence < uno::Reference< uno::XInterface > > aSeq( nSequence );
+
+ uno::Reference< uno::XInterface > * pArray = aSeq.getArray();
+
+ uno::Reference< drawing::XShapes > xShapes;
+ uno::Reference< drawing::XShape > xShape;
+
+ SearchContext_impl* pContext = NULL;
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+ xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+
+ if( xShapes.is() && xShapes->getCount() > 0 )
+ {
+ pContext = new SearchContext_impl( xShapes );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ xShapes = NULL;
+ }
+ }
+ else
+ {
+ xShape = mpShape;
+ }
+ while( xShape.is() )
+ {
+ // find in xShape
+ uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRange(xText, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xFound;
+
+ while( xRange.is() )
+ {
+ xFound = Search( xRange, pDescr );
+ if( !xFound.is() )
+ break;
+
+ if( nFound >= nSequence )
+ {
+ nSequence += 32;
+ aSeq.realloc( nSequence );
+ pArray = aSeq.getArray();
+ }
+
+ pArray[nFound++] = xFound;
+
+ xRange = xFound->getEnd();
+ }
+ // done with shape -> get next shape
+
+ // test if its a group
+ uno::Reference< drawing::XShapes > xGroupShape;
+ uno::Any aAny( xShape->queryInterface( ITYPE( drawing::XShapes )));
+
+ if( (aAny >>= xGroupShape ) && xGroupShape->getCount() > 0 )
+ {
+ pContext = new SearchContext_impl( xGroupShape, pContext );
+ xShape = pContext->firstShape();
+ }
+ else
+ {
+ if( pContext )
+ xShape = pContext->nextShape();
+ else
+ xShape = NULL;
+ }
+
+ // test parent contexts for next shape if none
+ // is found in the current context
+ while( pContext && !xShape.is() )
+ {
+ if( pContext->getParent() )
+ {
+ SearchContext_impl* pOldContext = pContext;
+ pContext = pContext->getParent();
+ delete pOldContext;
+ xShape = pContext->nextShape();
+ }
+ else
+ {
+ delete pContext;
+ pContext = NULL;
+ xShape = NULL;
+ }
+ }
+ }
+
+ if( nFound != nSequence )
+ aSeq.realloc( nFound );
+
+ return (container::XIndexAccess*)new SdUnoFindAllAccess( aSeq );
+}
+
+uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findFirst( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference< text::XTextRange > xRange( GetCurrentShape(), uno::UNO_QUERY );
+ if( xRange.is() )
+ return findNext( xRange, xDesc );
+
+ return uno::Reference< uno::XInterface > ();
+}
+
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetCurrentShape() const throw()
+{
+ uno::Reference< drawing::XShape > xShape;
+
+ if( mpPage )
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+ uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ if(xShapes->getCount() > 0)
+ {
+ xShapes->getByIndex(0) >>= xShape;
+ }
+ }
+ }
+ else if( mpShape )
+ {
+ xShape = mpShape;
+ }
+
+ return xShape;
+
+}
+
+uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findNext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xStartAt, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& xDesc )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ SdUnoSearchReplaceDescriptor* pDescr = SdUnoSearchReplaceDescriptor::getImplementation( xDesc );
+
+ uno::Reference< uno::XInterface > xFound;
+
+ uno::Reference< text::XTextRange > xRange( xStartAt, uno::UNO_QUERY );
+ if(pDescr && xRange.is() )
+ {
+
+ uno::Reference< text::XTextRange > xCurrentRange( xStartAt, uno::UNO_QUERY );
+
+ uno::Reference< drawing::XShape > xCurrentShape( GetShape( xCurrentRange ) );
+
+ while(!xFound.is() && xRange.is())
+ {
+ xFound = Search( xRange, pDescr );
+ if(!xFound.is())
+ {
+ // we need a new starting range now
+ xRange = NULL;
+
+ if(mpPage)
+ {
+ uno::Reference< drawing::XDrawPage > xPage( mpPage );
+
+ // we do a page wide search, so skip to the next shape here
+ uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY );
+
+ // get next shape on our page
+ if( xShapes.is() )
+ {
+ uno::Reference< drawing::XShape > xFound2( GetNextShape( xShapes, xCurrentShape ) );
+ if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) )
+ xCurrentShape = xFound2;
+ else
+ xCurrentShape = NULL;
+
+ xCurrentShape->queryInterface( ITYPE( text::XTextRange ) ) >>= xRange;
+ if(!(xCurrentShape.is() && (xRange.is())))
+ xRange = NULL;
+ }
+ }
+ else
+ {
+ // we search only in this shape, so end search if we have
+ // not found anything
+ }
+ }
+ }
+ }
+ return xFound;
+}
+
+/** this method returns the shape that follows xCurrentShape in the shape collection xShapes.
+ It steps recursive into groupshapes and returns the xCurrentShape if it is the last
+ shape in this collection */
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetNextShape( uno::Reference< container::XIndexAccess > xShapes, uno::Reference< drawing::XShape > xCurrentShape ) throw()
+{
+ uno::Reference< drawing::XShape > xFound;
+ uno::Any aAny;
+
+ if(xShapes.is() && xCurrentShape.is())
+ {
+ const sal_Int32 nCount = xShapes->getCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xSearchShape;
+ xShapes->getByIndex(i) >>= xSearchShape;
+
+ if( xSearchShape.is() )
+ {
+ uno::Reference< container::XIndexAccess > xGroup( xSearchShape, uno::UNO_QUERY );
+
+ if( xCurrentShape.get() == xSearchShape.get() )
+ {
+ if( xGroup.is() && xGroup->getCount() > 0 )
+ {
+ xGroup->getByIndex( 0 ) >>= xFound;
+ }
+ else
+ {
+ i++;
+ if( i < nCount )
+ xShapes->getByIndex( i ) >>= xFound;
+ else
+ xFound = xCurrentShape;
+ }
+
+ break;
+ }
+ else if( xGroup.is() )
+ {
+ xFound = GetNextShape( xGroup, xCurrentShape );
+ if( xFound.is() )
+ {
+ if( xFound.get() == xCurrentShape.get() )
+ {
+ // the current shape was found at the end of the group
+ i++;
+ if( i < nCount )
+ {
+ xShapes->getByIndex(i) >>= xFound;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return xFound;
+}
+
+uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Reference< text::XTextRange > xText, SdUnoSearchReplaceDescriptor* pDescr ) throw()
+{
+ if(!xText.is())
+ return uno::Reference< text::XTextRange > ();
+
+ uno::Reference< text::XText > xParent( xText->getText() );
+
+ if( !xParent.is() )
+ {
+ uno::Any aAny( xText->queryInterface( ITYPE( text::XText )) );
+ aAny >>= xParent;
+ }
+
+ const OUString aText( xParent->getString() );
+
+ const sal_Int32 nTextLen = aText.getLength();
+
+ sal_Int32* pConvertPos = new sal_Int32[nTextLen+2];
+ sal_Int32* pConvertPara = new sal_Int32[nTextLen+2];
+
+ int ndbg = 0;
+ const sal_Unicode* pText = aText;
+
+ sal_Int32* pPos = pConvertPos;
+ sal_Int32* pPara = pConvertPara;
+
+ sal_Int32 nLastPos = 0, nLastPara = 0;
+
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( xParent, uno::UNO_QUERY );
+
+ // first we fill the arrys with the position and paragraph for every character
+ // inside the text
+ if( xEnumAccess.is() )
+ {
+ uno::Reference< container::XEnumeration > xParaEnum( xEnumAccess->createEnumeration() );
+
+ while(xParaEnum->hasMoreElements())
+ {
+ uno::Reference< text::XTextContent > xParagraph( xParaEnum->nextElement(), uno::UNO_QUERY );
+ if( xParagraph.is() )
+ xEnumAccess.query( xParagraph );
+ else
+ xEnumAccess.clear();
+
+ if( xEnumAccess.is() )
+ {
+ uno::Reference< container::XEnumeration > xPortionEnum( xEnumAccess->createEnumeration() );
+ if( xPortionEnum.is() )
+ {
+ while(xPortionEnum->hasMoreElements())
+ {
+ uno::Reference< text::XTextRange > xPortion( xPortionEnum->nextElement(), uno::UNO_QUERY );
+ if( xPortion.is() )
+ {
+ const OUString aPortion( xPortion->getString() );
+ const sal_Int32 nLen = aPortion.getLength();
+
+ ESelection aStartSel( GetSelection( xPortion->getStart() ) );
+ ESelection aEndSel( GetSelection( xPortion->getEnd() ) );
+
+ // special case for empty portions with content or length one portions with content (fields)
+ if( (aStartSel.nStartPos == aEndSel.nStartPos) || ( (aStartSel.nStartPos == (aEndSel.nStartPos - 1)) && (nLen > 1) ) )
+ {
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = aStartSel.nStartPos;
+ *pPara++ = aStartSel.nStartPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ DBG_ERROR( "array overflow while searching" );
+ }
+ }
+
+ nLastPos = aStartSel.nStartPos;
+ }
+ // normal case
+ else
+ {
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = aStartSel.nStartPos++;
+ *pPara++ = aStartSel.nStartPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ DBG_ERROR( "array overflow while searching" );
+ }
+ }
+
+ nLastPos = aStartSel.nStartPos - 1;
+ DBG_ASSERT( aEndSel.nStartPos == aStartSel.nStartPos, "Search is not working" );
+ }
+ nLastPara = aStartSel.nStartPara;
+ }
+ }
+ }
+ }
+
+ if( ndbg < (nTextLen+2) )
+ {
+ *pPos++ = nLastPos + 1;
+ *pPara++ = nLastPara;
+
+ ndbg += 1;
+ pText++;
+ }
+ else
+ {
+ DBG_ERROR( "array overflow while searching" );
+ }
+ }
+ }
+
+ uno::Reference< text::XText > xFound;
+ ESelection aSel;
+
+ uno::Reference< text::XTextRange > xRangeRef( xText, uno::UNO_QUERY );
+ if( xRangeRef.is() )
+ aSel = GetSelection( xRangeRef );
+
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPos = 0;
+ for( nStartPos = 0; nStartPos < nTextLen; nStartPos++ )
+ {
+ if( pConvertPara[nStartPos] == aSel.nStartPara && pConvertPos[nStartPos] == aSel.nStartPos )
+ break;
+ }
+
+ if( Search( aText, nStartPos, nEndPos, pDescr ) )
+ {
+ if( nStartPos <= nTextLen && nEndPos <= nTextLen )
+ {
+ ESelection aSelection( (USHORT)pConvertPara[nStartPos], (USHORT)pConvertPos[nStartPos],
+ (USHORT)pConvertPara[nEndPos], (USHORT)pConvertPos[nEndPos] );
+ SvxUnoTextRange *pRange;
+
+ SvxUnoTextBase* pParent = SvxUnoTextBase::getImplementation( xParent );
+
+ if(pParent)
+ {
+ pRange = new SvxUnoTextRange( *pParent );
+ xFound = (text::XText*)pRange;
+ pRange->SetSelection(aSelection);
+
+// pDescr->SetStartPos( nEndPos );
+ }
+ }
+ else
+ {
+ DBG_ERROR("Array overflow while searching!");
+ }
+ }
+
+ delete[] pConvertPos;
+ delete[] pConvertPara;
+
+ return uno::Reference< text::XTextRange > ( xFound, uno::UNO_QUERY );
+}
+
+sal_Bool SdUnoSearchReplaceShape::Search( const OUString& rText, sal_Int32& nStartPos, sal_Int32& nEndPos, SdUnoSearchReplaceDescriptor* pDescr ) throw()
+{
+ OUString aSearchStr( pDescr->getSearchString() );
+ OUString aText( rText );
+
+ if( !pDescr->IsCaseSensitive() )
+ {
+ aText.toAsciiLowerCase();
+ aSearchStr.toAsciiLowerCase();
+ }
+
+ sal_Int32 nFound = aText.indexOf( aSearchStr, nStartPos );
+ if( nFound != -1 )
+ {
+ nStartPos = nFound;
+ nEndPos = nFound + aSearchStr.getLength();
+
+ if(pDescr->IsWords())
+ {
+ if( (nStartPos > 0 && aText.getStr()[nStartPos-1] > ' ') ||
+ (nEndPos < aText.getLength() && aText.getStr()[nEndPos] > ' ') )
+ {
+ nStartPos++;
+ return Search( aText, nStartPos, nEndPos, pDescr );
+ }
+ }
+
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+ESelection SdUnoSearchReplaceShape::GetSelection( uno::Reference< text::XTextRange > xTextRange ) throw()
+{
+ ESelection aSel;
+ SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xTextRange );
+
+ if(pRange)
+ aSel = pRange->GetSelection();
+
+ return aSel;
+}
+
+uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetShape( uno::Reference< text::XTextRange > xTextRange ) throw()
+{
+ uno::Reference< drawing::XShape > xShape;
+
+ if(xTextRange.is())
+ {
+ uno::Reference< text::XText > xText( xTextRange->getText() );
+
+ if(xText.is())
+ {
+ do
+ {
+ xText->queryInterface( ITYPE( drawing::XShape )) >>= xShape;
+ if(!xShape.is())
+ {
+ uno::Reference< text::XText > xParent( xText->getText() );
+ if(!xParent.is() || xText.get() == xParent.get())
+ return xShape;
+
+ xText = xParent;
+ }
+ } while( !xShape.is() );
+ }
+ }
+
+ return xShape;
+}
+
+/* ================================================================= */
+/** this class holds the parameters and status of a search or replace
+ operation performed by class SdUnoSearchReplaceShape
+ */
+
+UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor );
+
+SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( sal_Bool bReplace ) throw()
+{
+ mpPropSet = new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool());
+
+ mbBackwards = sal_False;
+ mbCaseSensitive = sal_False;
+ mbWords = sal_False;
+
+ mbReplace = bReplace;
+}
+
+SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
+{
+ delete mpPropSet;
+}
+
+// XSearchDescriptor
+OUString SAL_CALL SdUnoSearchReplaceDescriptor::getSearchString()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSearchStr;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::setSearchString( const OUString& aString )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ maSearchStr = aString;
+}
+
+// XReplaceDescriptor
+OUString SAL_CALL SdUnoSearchReplaceDescriptor::getReplaceString()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maReplaceStr;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::setReplaceString( const ::rtl::OUString& aReplaceString )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ maReplaceStr = aReplaceString;
+}
+
+// XPropertySet
+uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdUnoSearchReplaceDescriptor::getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return mpPropSet->getPropertySetInfo();
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ sal_Bool bOk = sal_False;
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_SEARCH_BACKWARDS:
+ bOk = (aValue >>= mbBackwards);
+ break;
+ case WID_SEARCH_CASE:
+ bOk = (aValue >>= mbCaseSensitive);
+ break;
+ case WID_SEARCH_WORDS:
+ bOk = (aValue >>= mbWords);
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ if( !bOk )
+ throw lang::IllegalArgumentException();
+}
+
+uno::Any SAL_CALL SdUnoSearchReplaceDescriptor::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aAny;
+
+ const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ switch( pEntry ? pEntry->nWID : -1 )
+ {
+ case WID_SEARCH_BACKWARDS:
+ aAny <<= (sal_Bool)mbBackwards;
+ break;
+ case WID_SEARCH_CASE:
+ aAny <<= (sal_Bool)mbCaseSensitive;
+ break;
+ case WID_SEARCH_WORDS:
+ aAny <<= (sal_Bool)mbWords;
+ break;
+ default:
+ throw beans::UnknownPropertyException();
+ }
+
+ return aAny;
+}
+
+void SAL_CALL SdUnoSearchReplaceDescriptor::addPropertyChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::removePropertyChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::addVetoableChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+void SAL_CALL SdUnoSearchReplaceDescriptor::removeVetoableChangeListener( const ::rtl::OUString& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) {}
+
+
+/* ================================================================= */
+
+SdUnoFindAllAccess::SdUnoFindAllAccess( uno::Sequence< uno::Reference< uno::XInterface > >& rSequence ) throw()
+:maSequence( rSequence )
+{
+}
+
+SdUnoFindAllAccess::~SdUnoFindAllAccess() throw()
+{
+}
+
+// XElementAccess
+uno::Type SAL_CALL SdUnoFindAllAccess::getElementType()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return ITYPE( text::XTextRange );
+}
+
+sal_Bool SAL_CALL SdUnoFindAllAccess::hasElements()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSequence.getLength() > 0;
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SdUnoFindAllAccess::getCount()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return maSequence.getLength();
+}
+
+uno::Any SAL_CALL SdUnoFindAllAccess::getByIndex( sal_Int32 Index )
+ throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ if( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ const uno::Reference< uno::XInterface > *pRefs = maSequence.getConstArray();
+ if(pRefs)
+ aAny <<= pRefs[ Index ];
+ return aAny;
+}
+
diff --git a/sd/source/ui/unoidl/unowcntr.cxx b/sd/source/ui/unoidl/unowcntr.cxx
new file mode 100755
index 000000000000..e29ee1e1516e
--- /dev/null
+++ b/sd/source/ui/unoidl/unowcntr.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+#include <tools/list.hxx>
+
+#include <unowcntr.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+DECLARE_LIST( WeakRefList, uno::WeakReference< uno::XInterface >* )
+
+SvUnoWeakContainer::SvUnoWeakContainer() throw()
+{
+ mpList = new WeakRefList;
+}
+
+SvUnoWeakContainer::~SvUnoWeakContainer() throw()
+{
+ uno::WeakReference< uno::XInterface >* pRef = mpList->First();
+ while( pRef )
+ {
+ delete mpList->Remove();
+ pRef = mpList->GetCurObject();
+ }
+ delete mpList;
+}
+
+/** inserts the given ref into this container */
+void SvUnoWeakContainer::insert( uno::WeakReference< uno::XInterface > xRef ) throw()
+{
+ uno::WeakReference< uno::XInterface >* pRef = mpList->First();
+ while( pRef )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef );
+ if(! xTestRef.is() )
+ {
+ delete mpList->Remove();
+ pRef = mpList->GetCurObject();
+ }
+ else
+ {
+ if( *pRef == xRef )
+ return;
+
+ pRef = mpList->Next();
+ }
+ }
+
+ mpList->Insert( new uno::WeakReference< uno::XInterface >( xRef ) );
+}
+
+/** searches the container for a ref that returns true on the given
+ search function
+*/
+sal_Bool SvUnoWeakContainer::findRef( uno::WeakReference< uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc )
+{
+ uno::WeakReference< uno::XInterface >* pRef = mpList->First();
+ while( pRef )
+ {
+ uno::Reference< ::com::sun::star::uno::XInterface > xTestRef( *pRef );
+ if(!xTestRef.is())
+ {
+ delete mpList->Remove();
+ pRef = mpList->GetCurObject();
+ }
+ else
+ {
+ if( (*pSearchFunc)( *pRef, pSearchData ) )
+ {
+ rRef = *pRef;
+ return sal_True;
+ }
+
+ pRef = mpList->Next();
+ }
+ }
+
+ return sal_False;
+}
+
+void SvUnoWeakContainer::dispose()
+{
+ uno::WeakReference< uno::XInterface >* pRef = mpList->First();
+ while( pRef )
+ {
+ uno::Reference< uno::XInterface > xTestRef( *pRef );
+ if(xTestRef.is())
+ {
+ uno::Reference< lang::XComponent > xComp( xTestRef, uno::UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+ }
+
+ pRef = mpList->Next();
+ }
+}
+
diff --git a/sd/source/ui/unoidl/unowcntr.hxx b/sd/source/ui/unoidl/unowcntr.hxx
new file mode 100755
index 000000000000..a35c27cfd583
--- /dev/null
+++ b/sd/source/ui/unoidl/unowcntr.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SV_UNOWCNTR_HXX_
+#define _SV_UNOWCNTR_HXX_
+
+#include <cppuhelper/weakref.hxx>
+
+typedef sal_Bool (*weakref_searchfunc)( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef, void* pSearchData );
+
+class WeakRefList;
+
+class SvUnoWeakContainer
+{
+private:
+ WeakRefList* mpList;
+
+public:
+ SvUnoWeakContainer() throw();
+ ~SvUnoWeakContainer() throw();
+
+ /** inserts the given ref into this container */
+ void insert( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > xRef ) throw();
+
+ /** searches the container for a ref that returns true on the given
+ search function
+ */
+ sal_Bool findRef( ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >& rRef, void* pSearchData, weakref_searchfunc pSearchFunc );
+
+ void dispose();
+};
+
+#endif // _SV_UNOWCNTR_HXX_
+