20#include <com/sun/star/embed/Aspects.hpp>
21#include <com/sun/star/embed/EmbedStates.hpp>
22#include <com/sun/star/embed/WrongStateException.hpp>
23#include <com/sun/star/datatransfer/XTransferable.hpp>
24#include <com/sun/star/uno/Sequence.hxx>
25#include <com/sun/star/lang/DisposedException.hpp>
36 ::osl::MutexGuard aGuard(
m_aMutex );
38 throw lang::DisposedException();
40 SAL_WARN_IF( nAspect == embed::Aspects::MSOLE_ICON,
"embeddedobj.common",
"For iconified objects no graphical replacement is required!" );
41 if ( nAspect == embed::Aspects::MSOLE_ICON )
43 throw embed::WrongStateException(
"Illegal call!",
47 throw embed::WrongStateException(
"The own object has no persistence!",
52 bool bBackToLoaded =
false;
61 bool bSuccess =
m_xDocHolder->SetExtent( nAspect, aSize );
67 throw uno::Exception(
"SetExtent failed",
nullptr);
72 ::osl::MutexGuard aGuard(
m_aMutex );
74 throw lang::DisposedException();
77 throw embed::WrongStateException(
"The own object has no persistence!",
80 SAL_WARN_IF( nAspect == embed::Aspects::MSOLE_ICON,
"embeddedobj.common",
"For iconified objects no graphical replacement is required!" );
85 bool bBackToLoaded =
false;
95 bool bSuccess =
m_xDocHolder->GetExtent( nAspect, &aResult );
101 throw uno::Exception(
"GetExtent failed",
nullptr);
108 ::osl::MutexGuard aGuard(
m_aMutex );
110 throw lang::DisposedException();
112 SAL_WARN_IF( nAspect == embed::Aspects::MSOLE_ICON,
"embeddedobj.common",
"For iconified objects no graphical replacement is required!" );
113 if ( nAspect == embed::Aspects::MSOLE_ICON )
115 throw embed::WrongStateException(
"Illegal call!",
119 throw embed::WrongStateException(
"The own object has no persistence!",
125 bool bBackToLoaded =
false;
134 sal_Int32 nResult =
m_xDocHolder->GetMapUnit( nAspect );
140 throw uno::Exception(
"result " + OUString::number(nResult),
nullptr);
147 ::osl::MutexGuard aGuard(
m_aMutex );
149 throw lang::DisposedException();
152 throw embed::WrongStateException(
"The own object has no persistence!",
156 SAL_WARN_IF( nAspect == embed::Aspects::MSOLE_ICON,
"embeddedobj.common",
"For iconified objects no graphical replacement is required!" );
157 if ( nAspect == embed::Aspects::MSOLE_ICON )
159 throw embed::WrongStateException(
"Illegal call!",
162 bool bBackToLoaded =
false;
178 SAL_WARN_IF( !
m_xDocHolder->GetComponent().is(),
"embeddedobj.common",
"Running or Active object has no component!" );
181 embed::VisualRepresentation aVisualRepresentation;
183 uno::Reference< embed::XVisualObject > xVisualObject(
m_xDocHolder->GetComponent(), uno::UNO_QUERY );
184 if( xVisualObject.is())
186 aVisualRepresentation = xVisualObject->getPreferredVisualRepresentation( nAspect );
190 uno::Reference< datatransfer::XTransferable > xTransferable(
m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
192 datatransfer::DataFlavor aDataFlavor(
193 "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"",
197 if( !xTransferable->isDataFlavorSupported( aDataFlavor ))
198 throw uno::RuntimeException();
199 aVisualRepresentation.Data = xTransferable->getTransferData( aDataFlavor );
200 aVisualRepresentation.Flavor = aDataFlavor;
206 return aVisualRepresentation;
const OUString & GetDocumentServiceName() const
virtual void SAL_CALL changeState(sal_Int32 nNewState) override
virtual css::awt::Size SAL_CALL getVisualAreaSize(sal_Int64 nAspect) override
virtual void SAL_CALL setVisualAreaSize(sal_Int64 nAspect, const css::awt::Size &aSize) override
virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation(::sal_Int64 nAspect) override
sal_Int32 m_nClonedMapUnit
css::awt::Size m_aClonedSize
rtl::Reference< DocumentHolder > m_xDocHolder
virtual sal_Int32 SAL_CALL getMapUnit(sal_Int64 nAspect) override
#define SAL_WARN_IF(condition, area, stream)