27#include <com/sun/star/ucb/ContentCreationException.hpp>
40#include <svx/strings.hrc>
43#include <osl/diagnose.h>
44#include <com/sun/star/awt/XProgressMonitor.hpp>
45#include <com/sun/star/ucb/TransferInfo.hpp>
46#include <com/sun/star/ucb/NameClash.hpp>
52 OUString& rFilterName )
86 aCodec.
Read( aMemStm );
91 OSL_FAIL(
"staroffice binary file formats are no longer supported inside the gallery!" );
106 uno::Reference< lang::XComponent > xComponent;
108 bRet =
SvxDrawingLayerImport( &rModel, xInputStream, xComponent,
"com.sun.star.comp.Draw.XMLOasisImporter" );
112 bRet =
SvxDrawingLayerImport( &rModel, xInputStream, xComponent,
"com.sun.star.comp.Draw.XMLImporter" );
130 auto pGrafObj =
dynamic_cast<const SdrGrafObj*
>( pObj);
138 for ( sal_uInt16
i = 0;
i <
nCount;
i++ )
144 rGraphic = pGrafObj->GetGraphic();
145 rImageMap =
static_cast<const SgaIMapInfo*
>( pUserData )->GetImageMap();
158 aReduced = aReduced.copy(aReduced.lastIndexOf(
'/')+1);
160 if( INetProtocol::PrivSoffice != rURL.
GetProtocol() )
163 const OUString aPath( rURL.
getFSysPath( FSysStyle::Detect, &aDelimiter ) );
164 const OUString
aName( aReduced );
166 if( aPath.getLength() > nMaxLen )
168 sal_Int32 nPathPrefixLen = nMaxLen -
aName.getLength() - 4;
170 if (nPathPrefixLen >= 0)
172 aReduced = OUString::Concat(aPath.subView(0, nPathPrefixLen)) +
"..."
173 + OUStringChar(aDelimiter) +
aName;
177 aReduced +=
"..." + OUStringChar(aDelimiter) +
"..."
178 +
aName.subView(
aName.getLength() - (nMaxLen - 7) );
192 if( rSvDrawObjURL.
GetProtocol() == INetProtocol::PrivSoffice &&
213 bRet = ( !aTitle.isEmpty() );
215 catch(
const ucb::ContentCreationException& )
218 catch(
const uno::RuntimeException& )
221 catch(
const uno::Exception& )
237 uno::Reference< ucb::XCommandEnvironment > aCmdEnv;
241 uno::Sequence< OUString > aProps{
"Title" };
245 bRet = aParent.
insertNewContent(
"application/vnd.sun.staroffice.fsys-folder", aProps, aValues, aContent );
247 catch(
const ucb::ContentCreationException& )
250 catch(
const uno::RuntimeException& )
253 catch(
const uno::Exception& )
271 rDstURL.
GetLastName(), ucb::NameClash::OVERWRITE ) ) );
274 catch(
const ucb::ContentCreationException& )
277 catch(
const uno::RuntimeException& )
280 catch(
const uno::Exception& )
298 catch(
const ucb::ContentCreationException& )
302 catch(
const uno::RuntimeException& )
306 catch(
const uno::Exception& )
319 uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
321 uno::Reference< awt::XProgressMonitor > xMonitor( xMgr->createInstance(
"com.sun.star.awt.XProgressMonitor" ),
324 if ( !xMonitor.is() )
329 OUString aProgressText;
333 aProgressText =
SvxResId(RID_SVXSTR_GALLERY_FILTER);
339 aProgressText =
"Gallery";
341 xMonitor->addText(
"Gallery", aProgressText,
false ) ;
359 meObjectKind( pTheme ? mpTheme->GetObjectKind(nObjectPos) :
SgaObjKind::
NONE),
360 mnObjectPos( nObjectPos )
437 OSL_FAIL(
"GalleryTransferable::GalleryTransferable: invalid object type" );
446 AddFormat( SotClipboardFormatId::DRAWING );
448 AddFormat( SotClipboardFormatId::GDIMETAFILE );
449 AddFormat( SotClipboardFormatId::BITMAP );
454 AddFormat( SotClipboardFormatId::SIMPLE_FILE );
462 AddFormat( SotClipboardFormatId::GDIMETAFILE );
463 AddFormat( SotClipboardFormatId::BITMAP );
467 AddFormat( SotClipboardFormatId::BITMAP );
468 AddFormat( SotClipboardFormatId::GDIMETAFILE );
485 else if( ( SotClipboardFormatId::SIMPLE_FILE == nFormat ) &&
mpURL )
489 else if( ( SotClipboardFormatId::SVXB == nFormat ) &&
mpGraphicObject )
493 else if( ( SotClipboardFormatId::GDIMETAFILE == nFormat ) &&
mpGraphicObject )
497 else if( ( SotClipboardFormatId::BITMAP == nFormat ) &&
mpGraphicObject )
506 sal_uInt32,
const datatransfer::DataFlavor& )
static vcl::Window * GetFocusWindow()
void Read(SvStream &rStmToRead)
static bool IsCoded(SvStream &rStm, sal_uInt32 &rVersion)
css::uno::Reference< css::awt::XProgressBar > mxProgressBar
GalleryProgress(const GraphicFilter *pFilter=nullptr)
void Update(sal_Int32 nVal, sal_Int32 nMaxVal)
bool GetGraphic(sal_uInt32 nPos, Graphic &rGraphic)
SAL_DLLPRIVATE void SetDragging(bool bSet)
SAL_DLLPRIVATE bool GetModelStream(sal_uInt32 nPos, tools::SvRef< SotTempStream > const &rModelStreamRef)
SAL_DLLPRIVATE void SetDragPos(sal_uInt32 nPos)
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject &rURL)
virtual void ObjectReleased() override
tools::SvRef< SotTempStream > mxModelStream
std::unique_ptr< GraphicObject > mpGraphicObject
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
void InitData(bool bLazy)
virtual void AddSupportedFormats() override
std::unique_ptr< INetURLObject > mpURL
virtual void DragFinished(sal_Int8 nDropAction) override
GalleryTransferable(GalleryTheme *pTheme, sal_uInt32 nObjectPos, bool bLazy)
void SelectObject(sal_uInt32 nObjectPos)
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
virtual ~GalleryTransferable() override
static GraphicFilter & GetGraphicFilter()
OUString GetImportFormatName(sal_uInt16 nFormat)
ErrCode ImportGraphic(Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
This class represents an embedded or linked bitmap graphic object.
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
User data of a drawing object, e.g.
SdrInventor GetInventor() const
sal_uInt16 GetUserDataCount() const
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
void SetDefaultMetric(MapUnit eNewMetric)
void Download(const Link< void *, void > &aLink=Link< void *, void >())
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
sal_uInt64 Seek(sal_uInt64 nPos)
bool SetGraphic(const Graphic &rGraphic)
bool SetObject(void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
bool SetString(const OUString &rString)
bool SetBitmapEx(const BitmapEx &rBitmap, const css::datatransfer::DataFlavor &rFlavor)
void AddFormat(SotClipboardFormatId nFormat)
bool SetGDIMetaFile(const GDIMetaFile &rMtf)
css::uno::Any getPropertyValue(const OUString &rPropertyName)
css::uno::Any executeCommand(const OUString &rCommandName, const css::uno::Any &rCommandArgument)
bool insertNewContent(const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, Content &rNewContent)
void GrabFocusToDocument()
OUString SvxResId(TranslateId aId)
EmbeddedObjectRef * pObject
bool CreateIMapGraphic(const FmFormModel &rModel, Graphic &rGraphic, ImageMap &rImageMap)
bool GallerySvDrawImport(SvStream &rIStm, SdrModel &rModel)
bool CreateDir(const INetURLObject &rURL)
INetURLObject ImplGetURL(const GalleryObject *pObject)
OUString GetSvDrawStreamNameFromURL(const INetURLObject &rSvDrawObjURL)
bool KillFile(const INetURLObject &rURL)
bool CopyFile(const INetURLObject &rSrcURL, const INetURLObject &rDstURL)
OUString GetReducedString(const INetURLObject &rURL, sal_Int32 nMaxLen)
bool FileExists(const INetURLObject &rURL)
GalleryGraphicImportRet GalleryGraphicImport(const INetURLObject &rURL, Graphic &rGraphic, OUString &rFilterName)
#define GALLERY_PROGRESS_RANGE
#define GRFILTER_FORMAT_DONTKNOW
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
Reference< XComponentContext > getProcessComponentContext()
bool SvxDrawingLayerImport(SdrModel *pModel, const uno::Reference< io::XInputStream > &xInputStream, const Reference< lang::XComponent > &xComponent)