[Libreoffice-commits] .: 3 commits - comphelper/inc comphelper/source sd/source svx/inc svx/source xmloff/inc xmloff/source
Michael Meeks
michael at kemper.freedesktop.org
Fri Aug 26 09:20:53 PDT 2011
comphelper/inc/comphelper/storagehelper.hxx | 20 ++++++++++
comphelper/source/misc/storagehelper.cxx | 53 ++++++++++++++++++++++++++++
sd/source/filter/xml/sdxmlwrp.cxx | 7 +++
svx/inc/svx/XPropertyTable.hxx | 14 ++++---
svx/inc/svx/svdmodel.hxx | 5 +-
svx/inc/svx/xtable.hxx | 2 -
svx/source/xml/xmlxtexp.cxx | 2 -
xmloff/inc/xmloff/xmlimp.hxx | 5 ++
xmloff/source/core/xmlimp.cxx | 11 +++++
9 files changed, 107 insertions(+), 12 deletions(-)
New commits:
commit 74881f6a87c260fa32bd3ba5489c6ce6f5b9caf0
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Aug 26 17:20:39 2011 +0100
export the source storage to import filter, to mirror TargetStorage for export
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 0810204..eb53143 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -490,7 +490,7 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
// -------------------------------------
- /** property map for export info set */
+ /** property map for import info set */
PropertyMapEntry aImportInfoMap[] =
{
// necessary properties for XML progress bar at load time
@@ -517,6 +517,8 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
{ MAP_LEN( "OrganizerMode" ), 0,
&::getBooleanCppuType(),
::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "SourceStorage" ), 0, &embed::XStorage::static_type(),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ NULL, 0, 0, NULL, 0, 0 }
};
@@ -594,6 +596,9 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError )
Reference<io::XInputStream> xInputStream;
uno::Reference < embed::XStorage > xStorage = mrMedium.GetStorage();
+ OUString sSourceStorage( RTL_CONSTASCII_USTRINGPARAM("SourceStorage") );
+ xInfoSet->setPropertyValue( sSourceStorage, Any( xStorage ) );
+
if( !xStorage.is() )
nRet = SD_XML_READERROR;
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
index 69cbe1f..498aed4 100644
--- a/xmloff/inc/xmloff/xmlimp.hxx
+++ b/xmloff/inc/xmloff/xmlimp.hxx
@@ -32,6 +32,7 @@
#include "sal/config.h"
#include "xmloff/dllapi.h"
#include "sal/types.h"
+#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
@@ -326,6 +327,10 @@ public:
GetStreamForEmbeddedObjectURLFromBase64();
::rtl::OUString ResolveEmbeddedObjectURLFromBase64();
+ // get source storage we're importing from (if available)
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetSourceStorage();
+
void AddStyleDisplayName( sal_uInt16 nFamily,
const ::rtl::OUString& rName,
const ::rtl::OUString& rDisplayName );
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a70a43f..803290a 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -193,6 +193,8 @@ public:
const uno::Reference< uno::XComponentContext > mxComponentContext;
+ uno::Reference< embed::XStorage > mxSourceStorage;
+
std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
SvXMLImport_Impl() :
@@ -995,6 +997,10 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
aAny >>= (mpImpl->mbTextDocInOOoFileFormat);
}
+
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("SourceStorage" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ mxImportInfo->getPropertyValue(sPropName) >>= mpImpl->mxSourceStorage;
}
}
}
@@ -1317,6 +1323,11 @@ Reference< XOutputStream > SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
return sRet;
}
+Reference< embed::XStorage > SvXMLImport::GetSourceStorage()
+{
+ return mpImpl->mxSourceStorage;
+}
+
Reference < XOutputStream >
SvXMLImport::GetStreamForEmbeddedObjectURLFromBase64()
{
commit eb9531f9c01b5e3a823103c41bbb34905847b0bf
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Aug 26 17:15:19 2011 +0100
misc. comment cleanup, and non-exporting of symbols not used externally
diff --git a/svx/inc/svx/XPropertyTable.hxx b/svx/inc/svx/XPropertyTable.hxx
index 691784a..d348f89 100644
--- a/svx/inc/svx/XPropertyTable.hxx
+++ b/svx/inc/svx/XPropertyTable.hxx
@@ -33,12 +33,14 @@
#include "svx/svxdllapi.h"
#include <svx/xtable.hxx>
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw();
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw();
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw();
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw();
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pList ) throw();
-SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pList ) throw();
+// FIXME: should have a single factory method with an enumeration here [!]
+
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pList ) throw();
#endif
diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
index 01e2bd8..e512e45 100644
--- a/svx/inc/svx/svdmodel.hxx
+++ b/svx/inc/svx/svdmodel.hxx
@@ -645,7 +645,8 @@ public:
void SetIOProgressHdl(const Link& rLink) { aIOProgressLink=rLink; }
const Link& GetIOProgressHdl() const { return aIOProgressLink; }
- // Zugriffsmethoden fuer Paletten, Listen und Tabellen
+ // Accessor methods for Palettes, Lists and Tabeles
+ // FIXME: this badly needs re-factoring ...
void SetColorTable(XColorTable* pTable) { pColorTable=pTable; }
XColorTable* GetColorTable() const { return pColorTable; }
void SetDashList(XDashList* pList) { pDashList=pList; }
@@ -755,7 +756,7 @@ typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
+---+---+ +---+---+ +----+----+ +----+----+ +-----+------+ +------+-----+
|SdrObj | |SdrObj | |SdrLayer | |SdrLayer | |SdrLayerSet | |SdrLayerSet |
+-------+ +-------+ +---------+ +---------+ +------------+ +------------+
-Die Klasse SdrModel ist der Kopf des Datenmodells der StarView Drawing-Engine.
+This class: SdrModel is the head of the data modells for the StarView Drawing Engine.
///////////////////////////////////////////////////////////////////////////////////////////////// */
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index d465dee..1b7f493 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -249,7 +249,7 @@ typedef ::std::vector< Bitmap* > BitmapList_impl;
class SVX_DLLPUBLIC XPropertyList
{
protected:
- String aName; // nicht persistent !
+ String aName; // not persistent
String aPath;
XOutdevItemPool* pXPool;
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index bc5d444..c170484 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -250,8 +250,6 @@ sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Ref
const OUString aName;
- // #110680#
- // SvxXMLXTableExportComponent aExporter( aName, xHandler, xTable, xGrfResolver );
SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver );
bRet = aExporter.exportTable();
commit d7e0e737c103ebc145cdf4c6afc182dafe0fcd47
Author: Michael Meeks <michael.meeks at novell.com>
Date: Fri Aug 26 16:58:07 2011 +0100
add a helper class to do path resolution
includes horrible lifecycle stack workaround for free.
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index 078bfb8..f4f0f81 100644
--- a/comphelper/inc/comphelper/storagehelper.hxx
+++ b/comphelper/inc/comphelper/storagehelper.hxx
@@ -167,6 +167,26 @@ public:
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
static sal_Bool PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment );
+
+ // Methods to allow easy use of hierachical names inside storages
+
+ // Unfortunately - the impl.s of XStorage like to invalidate all
+ // their sub streams and storages when you release references, so
+ // it is necessary to keep references to all storages down the
+ // path - this is 'beautiful' (TM). So we need this ugly hack:
+ class LifecycleProxyImpl;
+ class LifecycleProxy {
+ public:
+ LifecycleProxyImpl *pBadness;
+ LifecycleProxy();
+ ~LifecycleProxy();
+ };
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
};
}
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 70b7852..52b8e67 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <vector>
#include <rtl/digest.h>
#include <ucbhelper/content.hxx>
@@ -536,6 +537,58 @@ sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::r
return bResult;
}
+class OStorageHelper::LifecycleProxyImpl : public std::vector< uno::Reference< embed::XStorage > > {};
+OStorageHelper::LifecycleProxy::LifecycleProxy() :
+ pBadness( new OStorageHelper::LifecycleProxyImpl() ) { }
+OStorageHelper::LifecycleProxy::~LifecycleProxy() { delete pBadness; }
+
+static void splitPath( std::vector<rtl::OUString> &rElems,
+ const ::rtl::OUString& rPath )
+{
+ for (sal_Int32 i = 0; i >= 0;)
+ rElems.push_back( rPath.getToken( 0, '/', i ) );
+}
+
+static uno::Reference< embed::XStorage > LookupStorageAtPath(
+ const uno::Reference< embed::XStorage > &xParentStorage,
+ std::vector<rtl::OUString> &rElems, sal_uInt32 nOpenMode,
+ OStorageHelper::LifecycleProxy &rNastiness )
+{
+ uno::Reference< embed::XStorage > xStorage( xParentStorage );
+ rNastiness.pBadness->push_back( xStorage );
+ for( size_t i = 0; i < rElems.size() && xStorage.is(); i++ )
+ {
+ xStorage = xStorage->openStorageElement( rElems[i], nOpenMode );
+ rNastiness.pBadness->push_back( xStorage );
+ }
+ return xStorage;
+}
+
+uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath(
+ const uno::Reference< embed::XStorage > &xStorage,
+ const ::rtl::OUString& rPath, sal_uInt32 nOpenMode,
+ OStorageHelper::LifecycleProxy &rNastiness )
+{
+ std::vector<rtl::OUString> aElems;
+ splitPath( aElems, rPath );
+ return LookupStorageAtPath( xStorage, aElems, nOpenMode, rNastiness );
+}
+
+uno::Reference< io::XStream > OStorageHelper::GetStreamAtPath(
+ const uno::Reference< embed::XStorage > &xParentStorage,
+ const ::rtl::OUString& rPath, sal_uInt32 nOpenMode,
+ OStorageHelper::LifecycleProxy &rNastiness )
+{
+ std::vector<rtl::OUString> aElems;
+ splitPath( aElems, rPath );
+ rtl::OUString aName( aElems.back() );
+ aElems.pop_back();
+ uno::Reference< embed::XStorage > xStorage(
+ LookupStorageAtPath( xParentStorage, aElems, nOpenMode, rNastiness ),
+ uno::UNO_QUERY_THROW );
+ return xStorage->openStreamElement( aName, nOpenMode );
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list