diff options
Diffstat (limited to 'filter/source')
98 files changed, 2612 insertions, 3729 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 29cc0cc5d321..e4b55af57132 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -54,9 +54,8 @@ namespace filter{ ::salhelper::SingletonRef< FilterCache >* BaseContainer::m_pPerformanceOptimizer = 0; -/*----------------------------------------------- - 03.03.2004 11:37 ------------------------------------------------*/ + + BaseContainer::BaseContainer() : BaseLock ( ) , m_rCache ( ) @@ -74,16 +73,14 @@ BaseContainer::BaseContainer() // <- GLOBAL SAFE (!) ----------------------- } -/*----------------------------------------------- - 02.07.2003 10:16 ------------------------------------------------*/ + + BaseContainer::~BaseContainer() { } -/*----------------------------------------------- - 03.07.2003 11:16 ------------------------------------------------*/ + + void BaseContainer::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , const ::rtl::OUString& sImplementationName, const css::uno::Sequence< ::rtl::OUString >& lServiceNames , @@ -102,9 +99,8 @@ void BaseContainer::init(const css::uno::Reference< css::lang::XMultiServiceFact // <- SAFE } -/*----------------------------------------------- - 28.10.2003 09:04 ------------------------------------------------*/ + + void BaseContainer::impl_loadOnDemand() { #ifdef LOAD_IMPLICIT @@ -144,9 +140,8 @@ void BaseContainer::impl_loadOnDemand() #endif } -/*----------------------------------------------- - 03.03.2004 12:18 ------------------------------------------------*/ + + void BaseContainer::impl_initFlushMode() throw (css::uno::RuntimeException) { @@ -161,9 +156,8 @@ void BaseContainer::impl_initFlushMode() // <- SAFE } -/*----------------------------------------------- - 03.03.2004 12:11 ------------------------------------------------*/ + + FilterCache* BaseContainer::impl_getWorkingCache() const { // SAFE -> @@ -175,9 +169,8 @@ FilterCache* BaseContainer::impl_getWorkingCache() const // <- SAFE } -/*----------------------------------------------- - 03.07.2003 11:12 ------------------------------------------------*/ + + ::rtl::OUString SAL_CALL BaseContainer::getImplementationName() throw (css::uno::RuntimeException) { @@ -187,9 +180,8 @@ FilterCache* BaseContainer::impl_getWorkingCache() const // <- SAFE } -/*----------------------------------------------- - 03.07.2003 11:14 ------------------------------------------------*/ + + sal_Bool SAL_CALL BaseContainer::supportsService(const ::rtl::OUString& sServiceName) throw (css::uno::RuntimeException) { @@ -207,9 +199,8 @@ sal_Bool SAL_CALL BaseContainer::supportsService(const ::rtl::OUString& sService // <- SAFE } -/*----------------------------------------------- - 03.07.2003 11:12 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getSupportedServiceNames() throw (css::uno::RuntimeException) { @@ -219,9 +210,8 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getSupportedServic // <- SAFE } -/*----------------------------------------------- - 20.10.2003 11:39 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::insertByName(const ::rtl::OUString& sItem , const css::uno::Any& aValue) throw (css::lang::IllegalArgumentException , @@ -262,9 +252,8 @@ void SAL_CALL BaseContainer::insertByName(const ::rtl::OUString& sItem , // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.03.2004 11:40 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::removeByName(const ::rtl::OUString& sItem) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException , @@ -285,9 +274,8 @@ void SAL_CALL BaseContainer::removeByName(const ::rtl::OUString& sItem) // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.03.2004 11:41 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::replaceByName(const ::rtl::OUString& sItem , const css::uno::Any& aValue) throw (css::lang::IllegalArgumentException , @@ -328,9 +316,8 @@ void SAL_CALL BaseContainer::replaceByName(const ::rtl::OUString& sItem , // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.03.2004 11:44 ------------------------------------------------*/ + + css::uno::Any SAL_CALL BaseContainer::getByName(const ::rtl::OUString& sItem) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException , @@ -371,9 +358,8 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const ::rtl::OUString& sItem) return aValue; } -/*----------------------------------------------- - 03.03.2004 11:46 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getElementNames() throw (css::uno::RuntimeException) { @@ -401,9 +387,8 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL BaseContainer::getElementNames() return lNames; } -/*----------------------------------------------- - 03.03.2004 11:47 ------------------------------------------------*/ + + sal_Bool SAL_CALL BaseContainer::hasByName(const ::rtl::OUString& sItem) throw (css::uno::RuntimeException) { @@ -430,9 +415,8 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const ::rtl::OUString& sItem) return bHasOne; } -/*----------------------------------------------- - 02.07.2003 10:18 ------------------------------------------------*/ + + css::uno::Type SAL_CALL BaseContainer::getElementType() throw (css::uno::RuntimeException) { @@ -441,9 +425,8 @@ css::uno::Type SAL_CALL BaseContainer::getElementType() return ::getCppuType(static_cast< css::uno::Sequence< css::beans::PropertyValue >* >(NULL)); } -/*----------------------------------------------- - 03.03.2004 11:48 ------------------------------------------------*/ + + sal_Bool SAL_CALL BaseContainer::hasElements() throw (css::uno::RuntimeException) { @@ -470,9 +453,8 @@ sal_Bool SAL_CALL BaseContainer::hasElements() return bHasSome; } -/*----------------------------------------------- - 15.07.2003 09:21 ------------------------------------------------*/ + + css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::createSubSetEnumerationByQuery(const ::rtl::OUString& /* sQuery */ ) throw (css::uno::RuntimeException) { @@ -482,9 +464,8 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY); } -/*----------------------------------------------- - 15.07.2003 10:15 ------------------------------------------------*/ + + css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties) throw (css::uno::RuntimeException) { @@ -532,9 +513,8 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY); } -/*----------------------------------------------- - 07.03.2004 10:48 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::flush() throw (css::uno::RuntimeException) { @@ -611,9 +591,8 @@ void SAL_CALL BaseContainer::flush() } } -/*----------------------------------------------- - 02.07.2003 12:16 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::addFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener) throw (css::uno::RuntimeException) { @@ -623,9 +602,8 @@ void SAL_CALL BaseContainer::addFlushListener(const css::uno::Reference< css::ut xListener ); } -/*----------------------------------------------- - 02.07.2003 12:18 ------------------------------------------------*/ + + void SAL_CALL BaseContainer::removeFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener) throw (css::uno::RuntimeException) { diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index 694aef24ec58..d4524f80e984 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -50,17 +50,15 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 04.11.2003 09:27 ------------------------------------------------*/ + + CacheItem::CacheItem() : SequenceAsHashMap() { } -/*----------------------------------------------- - 26.06.2003 11:37 ------------------------------------------------*/ + + void CacheItem::update(const CacheItem& rUpdateItem) { for(const_iterator pItUpdate = rUpdateItem.begin(); @@ -75,9 +73,8 @@ void CacheItem::update(const CacheItem& rUpdateItem) } } -/*----------------------------------------------- - 26.11.2003 13:27 ------------------------------------------------*/ + + void CacheItem::validateUINames(const ::rtl::OUString& sActLocale) { if (!sActLocale.getLength()) @@ -110,9 +107,8 @@ void CacheItem::validateUINames(const ::rtl::OUString& sActLocale) (*this)[PROPNAME_UINAME ] <<= sUIName; } -/*----------------------------------------------- - 12.01.2004 13:32 ------------------------------------------------*/ + + css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList() { sal_Int32 c = (sal_Int32)size(); @@ -140,9 +136,8 @@ css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyVa return lList; } -/*----------------------------------------------- - 17.07.2003 08:27 ------------------------------------------------*/ + + sal_Bool isSubSet(const css::uno::Any& aSubSet, const css::uno::Any& aSet ) { @@ -369,9 +364,8 @@ sal_Bool isSubSet(const css::uno::Any& aSubSet, return sal_False; } -/*----------------------------------------------- - 14.07.2003 10:24 ------------------------------------------------*/ + + sal_Bool CacheItem::haveProps(const CacheItem& lProps) const { for (const_iterator pIt = lProps.begin(); @@ -401,9 +395,8 @@ sal_Bool CacheItem::haveProps(const CacheItem& lProps) const return sal_True; } -/*----------------------------------------------- - 14.07.2003 10:43 ------------------------------------------------*/ + + sal_Bool CacheItem::dontHaveProps(const CacheItem& lProps) const { for (const_iterator pIt = lProps.begin(); diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index 8ef1ac47b6a8..4080e43f7bd4 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -32,7 +32,7 @@ //_______________________________________________ // includes -#include <hash_map> +#include <boost/unordered_map.hpp> #include <deque> #include <list> #include <com/sun/star/uno/Any.h> @@ -190,7 +190,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap /** @short represent an item list of a FilterCache instance. */ -typedef ::std::hash_map< ::rtl::OUString , +typedef ::boost::unordered_map< ::rtl::OUString , CacheItem , ::rtl::OUStringHash , ::std::equal_to< ::rtl::OUString > > CacheItemList; @@ -209,7 +209,7 @@ typedef ::std::hash_map< ::rtl::OUString , there we need key-value pairs too, which cant be provided by a pur vector! */ -typedef ::std::hash_map< ::rtl::OUString , +typedef ::boost::unordered_map< ::rtl::OUString , OUStringList , ::rtl::OUStringHash , ::std::equal_to< ::rtl::OUString > > CacheItemRegistration; diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 7fa8896925e6..68aaadbf6172 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -51,9 +51,8 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 05.03.2004 08:36 ------------------------------------------------*/ + + CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , const css::uno::Reference< css::uno::XInterface >& xConfigAccess, FilterCache::EItemType eConfigType ) @@ -65,16 +64,14 @@ CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::X { } -/*----------------------------------------------- - 05.03.2004 08:37 ------------------------------------------------*/ + + CacheUpdateListener::~CacheUpdateListener() { } -/*----------------------------------------------- - 07.03.2004 07:59 ------------------------------------------------*/ + + void CacheUpdateListener::startListening() { // SAFE -> @@ -99,9 +96,8 @@ void CacheUpdateListener::startListening() */ } -/*----------------------------------------------- - 07.03.2004 07:59 ------------------------------------------------*/ + + void CacheUpdateListener::stopListening() { // SAFE -> @@ -126,9 +122,8 @@ void CacheUpdateListener::stopListening() */ } -/*----------------------------------------------- - 07.03.2004 08:17 ------------------------------------------------*/ + + void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent) throw(css::uno::RuntimeException) { @@ -229,9 +224,8 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven } } -/*----------------------------------------------- - 05.03.2004 08:44 ------------------------------------------------*/ + + void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException) { diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index c842df864f7a..e0378fb86466 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -51,9 +51,8 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { BaseContainer::init(xSMGR , @@ -62,16 +61,14 @@ ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::lan FilterCache::E_CONTENTHANDLER ); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + ContentHandlerFactory::~ContentHandlerFactory() { } -/*----------------------------------------------- - 16.07.2003 13:38 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::createInstance(const ::rtl::OUString& sHandler) throw(css::uno::Exception , css::uno::RuntimeException) @@ -79,9 +76,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea return createInstanceWithArguments(sHandler, css::uno::Sequence< css::uno::Any >()); } -/*----------------------------------------------- - 16.07.2003 13:40 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::createInstanceWithArguments(const ::rtl::OUString& sHandler , const css::uno::Sequence< css::uno::Any >& lArguments) throw(css::uno::Exception , @@ -161,9 +157,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea // <- SAFE } -/*----------------------------------------------- - 09.07.2003 07:46 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > SAL_CALL ContentHandlerFactory::getAvailableServiceNames() throw(css::uno::RuntimeException) { @@ -171,17 +166,15 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL ContentHandlerFactory::getAvailab return getElementNames(); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + ::rtl::OUString ContentHandlerFactory::impl_getImplementationName() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filter.config.ContentHandlerFactory" )); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > ContentHandlerFactory::impl_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lServiceNames(1); @@ -189,9 +182,8 @@ css::uno::Sequence< ::rtl::OUString > ContentHandlerFactory::impl_getSupportedSe return lServiceNames; } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { ContentHandlerFactory* pNew = new ContentHandlerFactory(xSMGR); diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 76437181108b..c439482379f4 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -79,9 +79,8 @@ namespace css = ::com::sun::star; // Its no longer supported by using native installers ... static ::rtl::OUString MESSAGE_CORRUPTED_FILTERCONFIG( RTL_CONSTASCII_USTRINGPARAM( "The filter configuration appears to be defective. Please install the office suite again." )); -/*----------------------------------------------- - 15.03.2004 08:59 ------------------------------------------------*/ + + FilterCache::FilterCache() : BaseLock ( ) , m_xSMGR (::comphelper::getProcessServiceFactory()) @@ -90,17 +89,15 @@ FilterCache::FilterCache() RTL_LOGFILE_TRACE("{ (as96863) FilterCache lifetime"); } -/*----------------------------------------------- - 15.03.2004 08:59 ------------------------------------------------*/ + + FilterCache::~FilterCache() { RTL_LOGFILE_TRACE("} (as96863) FilterCache lifetime"); } -/*----------------------------------------------- - 03.03.2004 11:27 ------------------------------------------------*/ + + FilterCache* FilterCache::clone() const { // SAFE -> ---------------------------------- @@ -138,9 +135,8 @@ FilterCache* FilterCache::clone() const // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.03.2004 14:39 ------------------------------------------------*/ + + void FilterCache::takeOver(const FilterCache& rClone) { // SAFE -> ---------------------------------- @@ -194,9 +190,8 @@ void FilterCache::takeOver(const FilterCache& rClone) // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 28.10.2003 09:01 ------------------------------------------------*/ + + void FilterCache::load(EFillState eRequired, #if OSL_DEBUG_LEVEL > 1 sal_Bool bByThread @@ -281,9 +276,8 @@ void FilterCache::load(EFillState eRequired, // <- SAFE } -/*----------------------------------------------- - 28.10.2003 09:50 ------------------------------------------------*/ + + sal_Bool FilterCache::isFillState(FilterCache::EFillState eState) const throw(css::uno::Exception) { @@ -293,9 +287,8 @@ sal_Bool FilterCache::isFillState(FilterCache::EFillState eState) const // <- SAFE } -/*----------------------------------------------- - 14.07.2003 10:45 ------------------------------------------------*/ + + OUStringList FilterCache::getMatchingItemsByProps( EItemType eType , const CacheItem& lIProps, const CacheItem& lEProps) const @@ -332,9 +325,8 @@ OUStringList FilterCache::getMatchingItemsByProps( EItemType eType , // <- SAFE } -/*----------------------------------------------- - 02.07.2003 09:32 ------------------------------------------------*/ + + sal_Bool FilterCache::hasItems(EItemType eType) const throw(css::uno::Exception) { @@ -350,9 +342,8 @@ sal_Bool FilterCache::hasItems(EItemType eType) const // <- SAFE } -/*----------------------------------------------- - 02.07.2003 11:48 ------------------------------------------------*/ + + OUStringList FilterCache::getItemNames(EItemType eType) const throw(css::uno::Exception) { @@ -375,9 +366,8 @@ OUStringList FilterCache::getItemNames(EItemType eType) const // <- SAFE } -/*----------------------------------------------- - 27.10.2003 08:37 ------------------------------------------------*/ + + sal_Bool FilterCache::hasItem( EItemType eType, const ::rtl::OUString& sItem) throw(css::uno::Exception) @@ -410,9 +400,8 @@ sal_Bool FilterCache::hasItem( EItemType eType, // <- SAFE } -/*----------------------------------------------- - 17.07.2006 09:15 ------------------------------------------------*/ + + CacheItem FilterCache::getItem( EItemType eType, const ::rtl::OUString& sItem) throw(css::uno::Exception) @@ -447,13 +436,11 @@ CacheItem FilterCache::getItem( EItemType eType, ::rtl::OUString sDocService; rFilter[PROPNAME_DOCUMENTSERVICE] >>= sDocService; - // --> PB 2006-10-18 #142498# // In Standalone-Impress the module WriterWeb is not installed // but it is there to load help pages bool bIsHelpFilter = sItem.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("writer_web_HTML_help")); if ( !bIsHelpFilter && !impl_isModuleInstalled(sDocService) ) - // <-- { ::rtl::OUStringBuffer sMsg(256); sMsg.appendAscii("The requested filter '" ); @@ -467,9 +454,8 @@ CacheItem FilterCache::getItem( EItemType eType, // <- SAFE } -/*----------------------------------------------- - 03.03.2004 11:28 ------------------------------------------------*/ + + void FilterCache::removeItem( EItemType eType, const ::rtl::OUString& sItem) throw(css::uno::Exception) @@ -490,9 +476,8 @@ void FilterCache::removeItem( EItemType eType, impl_addItem2FlushList(eType, sItem); } -/*----------------------------------------------- - 26.11.2003 13:28 ------------------------------------------------*/ + + void FilterCache::setItem( EItemType eType , const ::rtl::OUString& sItem , const CacheItem& aValue) @@ -531,9 +516,8 @@ void FilterCache::refreshItem( EItemType eType, impl_loadItemOnDemand(eType, sItem); } -/*----------------------------------------------- - 27.10.2003 08:14 ------------------------------------------------*/ + + void FilterCache::addStatePropsToItem( EItemType eType, const ::rtl::OUString& sItem, CacheItem& rItem) @@ -629,9 +613,8 @@ void FilterCache::addStatePropsToItem( EItemType eType, // <- SAFE } -/*----------------------------------------------- - 05.03.2004 10:36 ------------------------------------------------*/ + + void FilterCache::removeStatePropsFromItem(CacheItem& rItem) throw(css::uno::Exception) { @@ -644,9 +627,8 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem) rItem.erase(pIt); } -/*----------------------------------------------- - 02.07.2003 09:17 ------------------------------------------------*/ + + void FilterCache::flush() throw(css::uno::Exception) { @@ -683,9 +665,8 @@ void FilterCache::flush() /*TODO FrameLoader/ContentHandler must be flushed here too ... */ } -/*----------------------------------------------- - 20.10.2003 09:22 ------------------------------------------------*/ + + void FilterCache::impl_flushByList(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType , const CacheItemList& rCache, @@ -746,9 +727,8 @@ void FilterCache::impl_flushByList(const css::uno::Reference< css::container::XN } } -/*----------------------------------------------- - 03.11.2003 08:38 ------------------------------------------------*/ + + void FilterCache::detectFlatForURL(const css::util::URL& aURL , FlatDetection& rFlatTypes) const throw(css::uno::Exception) @@ -814,9 +794,8 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.11.2003 08:38 ------------------------------------------------*/ + + CacheItemList& FilterCache::impl_getItemList(EItemType eType) const throw(css::uno::Exception) { @@ -838,9 +817,8 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType) const // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 21.10.2003 13:20 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) throw(css::uno::Exception) { @@ -924,9 +902,8 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig // <- SAFE } -/*----------------------------------------------- - 17.07.2003 10:10 ------------------------------------------------*/ + + css::uno::Any FilterCache::impl_getDirectCFGValue(const ::rtl::OUString& sDirectKey) { ::rtl::OUString sRoot; @@ -956,7 +933,7 @@ css::uno::Any FilterCache::impl_getDirectCFGValue(const ::rtl::OUString& sDirect } catch(const css::uno::RuntimeException& exRun) { throw exRun; } - #if OSL_DEBUG_LEVEL>0 + #if OSL_DEBUG_LEVEL > 0 catch(const css::uno::Exception& ex) #else catch(const css::uno::Exception&) @@ -971,9 +948,8 @@ css::uno::Any FilterCache::impl_getDirectCFGValue(const ::rtl::OUString& sDirect return aValue; } -/*----------------------------------------------- - 17.07.2003 09:49 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess(const ::rtl::OUString& sRoot , sal_Bool bReadOnly , sal_Bool bLocalesMode) @@ -1033,9 +1009,8 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess // <- SAFE } -/*----------------------------------------------- - 24.10.2003 10:03 ------------------------------------------------*/ + + void FilterCache::impl_validateAndOptimize() throw(css::uno::Exception) { @@ -1342,9 +1317,8 @@ void FilterCache::impl_validateAndOptimize() // <- SAFE } -/*----------------------------------------------- - 20.10.2003 08:15 ------------------------------------------------*/ + + void FilterCache::impl_addItem2FlushList( EItemType eType, const ::rtl::OUString& sItem) throw(css::uno::Exception) @@ -1380,9 +1354,8 @@ void FilterCache::impl_addItem2FlushList( EItemType eType, pList->push_back(sItem); } -/*----------------------------------------------- - 20.10.2003 08:49 ------------------------------------------------*/ + + FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css::uno::Reference< css::container::XNameAccess >& xSet , const CacheItemList& rList, const ::rtl::OUString& sItem) @@ -1409,16 +1382,15 @@ FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css:: return eState; } -/*----------------------------------------------- - 14.10.2003 09:26 ------------------------------------------------*/ + + void FilterCache::impl_resolveItem4TypeRegistration( CacheItemList* pList, const ::rtl::OUString& sItem, const ::rtl::OUString& sType) throw(css::uno::Exception) { CacheItem& rItem = (*pList)[sItem]; - // In case its a new created entry (automaticly done by the hash_map index operator!) + // In case its a new created entry (automaticly done by the boost::unordered_map index operator!) // we must be shure, that this entry has its own name as property available. // Its needed later at our container interface! rItem[PROPNAME_NAME] <<= sItem; @@ -1431,9 +1403,8 @@ void FilterCache::impl_resolveItem4TypeRegistration( CacheItemList* pList } } -/*----------------------------------------------- - 28.10.2003 09:18 ------------------------------------------------*/ + + void FilterCache::impl_load(EFillState eRequiredState) throw(css::uno::Exception) { @@ -1538,9 +1509,8 @@ void FilterCache::impl_load(EFillState eRequiredState) // <- SAFE } -/*----------------------------------------------- - 22.09.2003 14:27 ------------------------------------------------*/ + + void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig, EItemType eType , EReadOption eOption, @@ -1659,9 +1629,8 @@ void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameA } } -/*----------------------------------------------- - 26.11.2003 12:49 ------------------------------------------------*/ + + void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode, CacheItem& rItem) throw(css::uno::Exception) @@ -1743,9 +1712,8 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe rItem[PROPNAME_UINAME] = pUIName->second; } -/*----------------------------------------------- - 26.11.2003 12:56 ------------------------------------------------*/ + + void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::container::XNameReplace >& xNode, const CacheItem& rItem) throw(css::uno::Exception) @@ -1897,9 +1865,8 @@ CacheItem FilterCache::impl_loadItem(const css::uno::Reference< css::container:: return aItem; } -/*----------------------------------------------- - 27.10.2003 08:47 ------------------------------------------------*/ + + CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType eType, const ::rtl::OUString& sItem) throw(css::uno::Exception) @@ -1958,10 +1925,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType if (bItemInConfig) { - CacheItem aItem; - CacheItem::iterator pDbgTest = aItem.find(PROPNAME_NAME); - aItem = impl_loadItem(xSet, eType, sItem, E_READ_ALL); - (*pList)[sItem] = aItem; + (*pList)[sItem] = impl_loadItem(xSet, eType, sItem, E_READ_ALL); _FILTER_CONFIG_LOG_2_("impl_loadItemOnDemand(%d, \"%s\") ... OK", (int)eType, _FILTER_CONFIG_TO_ASCII_(sItem).getStr()) } else @@ -1979,9 +1943,8 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType return pList->find(sItem); } -/*----------------------------------------------- - 20.10.2003 09:38 ------------------------------------------------*/ + + void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xItem, EItemType eType, const CacheItem& aItem) @@ -2262,9 +2225,8 @@ sal_Int32 FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequence< return nField; } -/*----------------------------------------------- - 12.02.2004 08:40 ------------------------------------------------*/ + + void FilterCache::impl_interpretDataVal4Type(const ::rtl::OUString& sValue, sal_Int32 nProp , CacheItem& rItem ) @@ -2294,9 +2256,8 @@ void FilterCache::impl_interpretDataVal4Type(const ::rtl::OUString& sValue, } } -/*----------------------------------------------- - 12.02.2004 08:50 ------------------------------------------------*/ + + void FilterCache::impl_interpretDataVal4Filter(const ::rtl::OUString& sValue, sal_Int32 nProp , CacheItem& rItem ) @@ -2391,9 +2352,8 @@ void FilterCache::impl_readOldFormat() } } -/*----------------------------------------------- - 12.02.2004 08:30 ------------------------------------------------*/ + + CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType, const ::rtl::OUString& sItem) @@ -2453,9 +2413,8 @@ CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::containe return aItem; } -/*----------------------------------------------- - 12.02.2004 08:15 ------------------------------------------------*/ + + OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , sal_Unicode cSeperator) { @@ -2471,7 +2430,8 @@ OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , } #if OSL_DEBUG_LEVEL > 0 -/*-----------------------------------------------*/ + + ::rtl::OUString FilterCache::impl_searchFrameLoaderForType(const ::rtl::OUString& sType) const { CacheItemList::const_iterator pIt; @@ -2490,7 +2450,8 @@ OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , return ::rtl::OUString(); } -/*-----------------------------------------------*/ + + ::rtl::OUString FilterCache::impl_searchContentHandlerForType(const ::rtl::OUString& sType) const { CacheItemList::const_iterator pIt; @@ -2510,7 +2471,8 @@ OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , } #endif -/*-----------------------------------------------*/ + + sal_Bool FilterCache::impl_isModuleInstalled(const ::rtl::OUString& sModule) { css::uno::Reference< css::container::XNameAccess > xCfg; diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index e88c0c296d0b..06689db3bdf5 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -96,9 +96,8 @@ namespace css = ::com::sun::star; #define QUERYPARAMVALUE_SORT_PROP_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "name" )) #define QUERYPARAMVALUE_SORT_PROP_UINAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "uiname" )) -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + FilterFactory::FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { BaseContainer::init(xSMGR , @@ -107,16 +106,14 @@ FilterFactory::FilterFactory(const css::uno::Reference< css::lang::XMultiService FilterCache::E_FILTER ); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + FilterFactory::~FilterFactory() { } -/*----------------------------------------------- - 16.07.2003 13:43 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstance(const ::rtl::OUString& sFilter) throw(css::uno::Exception , css::uno::RuntimeException) @@ -124,9 +121,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan return createInstanceWithArguments(sFilter, css::uno::Sequence< css::uno::Any >()); } -/*----------------------------------------------- - 17.07.2003 08:56 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstanceWithArguments(const ::rtl::OUString& sFilter , const css::uno::Sequence< css::uno::Any >& lArguments) throw(css::uno::Exception , @@ -206,9 +202,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan // <- SAFE } -/*----------------------------------------------- - 18.02.2004 14:21 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > SAL_CALL FilterFactory::getAvailableServiceNames() throw(css::uno::RuntimeException) { @@ -235,9 +230,8 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL FilterFactory::getAvailableServic return lUNOFilters.getAsConstList(); } -/*----------------------------------------------- - 11.03.2004 08:37 ------------------------------------------------*/ + + css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery) throw (css::uno::RuntimeException) { @@ -278,7 +272,6 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea if (lTokens.find(QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE) != lTokens.end()) OSL_ENSURE(sal_False, "DEPRECATED!\nPlease use prop search at the TypeDetection container!"); -// lEnumSet = impl_queryGetPreferredFilterForType(lTokens); else if (lTokens.find(QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE) != lTokens.end()) lEnumSet = impl_queryMatchByDocumentService(lTokens); @@ -290,52 +283,13 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea // pack list of item names as an enum list // Attention: Do not return empty reference for empty list! // The outside check "hasMoreElements()" should be enough, to detect this state :-) -// size_t c = lEnumSet.size(); css::uno::Sequence< ::rtl::OUString > lSet = lEnumSet.getAsConstList(); ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSet); return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY); } -/* - if (lEnumSet.empty()) - { - //------------------------------------------- - // 1) getDefaultFilterForType=<internal_typename> - pIt = lTokens.find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getDefaultFilterForType"))); - if (pIt != lTokens.end()) - { - // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); - - // might not all types was loaded till now! - impl_loadOnDemand(); - - ::rtl::OUString sType = pIt->second; - FilterCache* pCache = impl_getWorkingCache(); - if (pCache->hasItem(FilterCache::E_TYPE, sType)) - { - CacheItem aType = pCache->getItem(FilterCache::E_TYPE, sType); - ::rtl::OUString sPreferredFilter; - aType[PROPNAME_PREFERREDFILTER] >>= sPreferredFilter; - - if ( - (sPreferredFilter.getLength() ) && - (pCache->hasItem(FilterCache::E_FILTER, sPreferredFilter)) - ) - { - lEnumSet.push_back(sPreferredFilter); - } - } - - aLock.clear(); - // <- SAFE - } - } -*/ -/*----------------------------------------------- - 11.03.2004 08:33 ------------------------------------------------*/ + OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenizer& lTokens) const { // analyze query @@ -474,9 +428,8 @@ OUStringList FilterFactory::impl_queryMatchByDocumentService(const QueryTokenize return lResult; } -/*----------------------------------------------- - 21.01.2005 13:39 ------------------------------------------------*/ + + class stlcomp_removeIfMatchFlags { private: @@ -517,9 +470,8 @@ class stlcomp_removeIfMatchFlags } }; -/*----------------------------------------------- - 21.01.2005 13:39 ------------------------------------------------*/ + + OUStringList FilterFactory::impl_getSortedFilterList(const QueryTokenizer& lTokens) const { // analyze the given query parameter @@ -569,9 +521,8 @@ OUStringList FilterFactory::impl_getSortedFilterList(const QueryTokenizer& lToke return lFilterList; } -/*----------------------------------------------- - 21.01.2005 10:19 ------------------------------------------------*/ + + OUStringList FilterFactory::impl_getListOfInstalledModules() const { // SAFE -> ---------------------- @@ -598,9 +549,8 @@ OUStringList FilterFactory::impl_getListOfInstalledModules() const return OUStringList(); } -/*----------------------------------------------- - 21.01.2005 10:19 ------------------------------------------------*/ + + OUStringList FilterFactory::impl_getSortedFilterListForModule(const ::rtl::OUString& sModule, sal_Int32 nIFlags, sal_Int32 nEFlags) const @@ -654,9 +604,8 @@ OUStringList FilterFactory::impl_getSortedFilterListForModule(const ::rtl::OUStr return lMergedFilters; } -/*----------------------------------------------- - 21.01.2005 10:19 ------------------------------------------------*/ + + OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const ::rtl::OUString& sModule) const { // SAFE -> ---------------------- @@ -694,17 +643,15 @@ OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const ::rtl::OUS return OUStringList(); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + ::rtl::OUString FilterFactory::impl_getImplementationName() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filter.config.FilterFactory" )); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > FilterFactory::impl_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lServiceNames(1); @@ -712,9 +659,8 @@ css::uno::Sequence< ::rtl::OUString > FilterFactory::impl_getSupportedServiceNam return lServiceNames; } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { FilterFactory* pNew = new FilterFactory(xSMGR); diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index 822d826d52bf..9f14010f931d 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -50,9 +50,8 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { BaseContainer::init(xSMGR , @@ -61,16 +60,14 @@ FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::lang::XMu FilterCache::E_FRAMELOADER ); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + FrameLoaderFactory::~FrameLoaderFactory() { } -/*----------------------------------------------- - 16.07.2003 13:37 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createInstance(const ::rtl::OUString& sLoader) throw(css::uno::Exception , css::uno::RuntimeException) @@ -78,9 +75,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI return createInstanceWithArguments(sLoader, css::uno::Sequence< css::uno::Any >()); } -/*----------------------------------------------- - 17.07.2003 09:00 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createInstanceWithArguments(const ::rtl::OUString& sLoader , const css::uno::Sequence< css::uno::Any >& lArguments) throw(css::uno::Exception , @@ -158,9 +154,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI // <- SAFE } -/*----------------------------------------------- - 09.07.2003 07:46 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > SAL_CALL FrameLoaderFactory::getAvailableServiceNames() throw(css::uno::RuntimeException) { @@ -168,17 +163,15 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL FrameLoaderFactory::getAvailableS return getElementNames(); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + ::rtl::OUString FrameLoaderFactory::impl_getImplementationName() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filter.config.FrameLoaderFactory" )); } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > FrameLoaderFactory::impl_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lServiceNames(1); @@ -186,9 +179,8 @@ css::uno::Sequence< ::rtl::OUString > FrameLoaderFactory::impl_getSupportedServi return lServiceNames; } -/*----------------------------------------------- - 09.07.2003 07:43 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { FrameLoaderFactory* pNew = new FrameLoaderFactory(xSMGR); diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx index 4f4e3ae513b1..2b8c84b8b903 100644 --- a/filter/source/config/cache/lateinitlistener.cxx +++ b/filter/source/config/cache/lateinitlistener.cxx @@ -47,9 +47,8 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 14.08.2003 07:35 ------------------------------------------------*/ + + LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) : BaseLock( ) , m_xSMGR (xSMGR) @@ -68,16 +67,14 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiS osl_decrementInterlockedCount( &m_refCount ); } -/*----------------------------------------------- - 14.08.2003 07:25 ------------------------------------------------*/ + + LateInitListener::~LateInitListener() { } -/*----------------------------------------------- - 14.08.2003 08:45 ------------------------------------------------*/ + + void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aEvent) throw(css::uno::RuntimeException) { @@ -114,9 +111,8 @@ void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aE } } -/*----------------------------------------------- - 14.08.2003 07:48 ------------------------------------------------*/ + + void SAL_CALL LateInitListener::disposing(const css::lang::EventObject& /* aEvent */ ) throw(css::uno::RuntimeException) { diff --git a/filter/source/config/cache/lateinitthread.cxx b/filter/source/config/cache/lateinitthread.cxx index 0812e3f280b3..e18df2aa317d 100644 --- a/filter/source/config/cache/lateinitthread.cxx +++ b/filter/source/config/cache/lateinitthread.cxx @@ -45,23 +45,20 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 14.08.2003 09:31 ------------------------------------------------*/ + + LateInitThread::LateInitThread() { } -/*----------------------------------------------- - 14.08.2003 08:42 ------------------------------------------------*/ + + LateInitThread::~LateInitThread() { } -/*----------------------------------------------- - 28.10.2003 09:30 ------------------------------------------------*/ + + void SAL_CALL LateInitThread::run() { // sal_True => It indicates using of this method by this thread diff --git a/filter/source/config/cache/macros.hxx b/filter/source/config/cache/macros.hxx index 19a4496ec13d..9a5c07792d6b 100644 --- a/filter/source/config/cache/macros.hxx +++ b/filter/source/config/cache/macros.hxx @@ -41,11 +41,6 @@ #error "who already defined such macro :-(" #endif -/* -//#define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \ -// ::rtl::OUString::createFromAscii(ASCII_STRING) -*/ - #define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ASCII_STRING)) @@ -57,79 +52,6 @@ #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2) #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3) -/* -#include <rtl/ustrbuf.hxx> - -#include <stdio.h> - -//_______________________________________________ - - #ifdef _FILTER_CONFIG_LOG_ - #error "who already defined such macro :-(" - #endif - - #ifdef _FILTER_CONFIG_LOG_1_ - #error "who already defined such macro :-(" - #endif - - #ifdef _FILTER_CONFIG_LOG_2_ - #error "who already defined such macro :-(" - #endif - - #ifdef _FILTER_CONFIG_LOG_3_ - #error "who already defined such macro :-(" - #endif - - //------------------------------------------- - // @short append given text to the log file - // - // @param TEXT [const char*] - // contains the text, which should be logged - // - #define _FILTER_CONFIG_LOG_(TEXT) \ - { \ - FILE* pFile = fopen("filtercache.log", "a");\ - fprintf(pFile, "%s", TEXT); \ - fclose(pFile); \ - } - - //------------------------------------------- - // @short append given text to the log file - // and supports using one optional argument. - // - // @descr The syntax of FORMAT and ARG1 follows the - // mechanism of e.g. sprintf(); - // - // @param FORMAT [const char*] - // specify the format of the log message - // - // @param ARGn - // points to any argument(s), which will be used - // inside the FORMAT string to replace place holder(s). - // - #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1) \ - { \ - FILE* pFile = fopen("filtercache.log", "a");\ - fprintf(pFile, FORMAT, ARG1); \ - fclose(pFile); \ - } - - #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2) \ - { \ - FILE* pFile = fopen("filtercache.log", "a");\ - fprintf(pFile, FORMAT, ARG1, ARG2); \ - fclose(pFile); \ - } - - #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3) \ - { \ - FILE* pFile = fopen("filtercache.log", "a");\ - fprintf(pFile, FORMAT, ARG1, ARG2, ARG3); \ - fclose(pFile); \ - } - -#endif // OSL_DEBUG_LEVEL < 2 -*/ #endif // _FILTER_CONFIG_MACROS_HXX_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx index b3c082801a69..c508f01baf9e 100644 --- a/filter/source/config/cache/querytokenizer.cxx +++ b/filter/source/config/cache/querytokenizer.cxx @@ -43,9 +43,8 @@ namespace filter{ //_______________________________________________ // definitions -/*----------------------------------------------- - 01.08.2003 10:42 ------------------------------------------------*/ + + QueryTokenizer::QueryTokenizer(const ::rtl::OUString& sQuery) : m_bValid(sal_True) { @@ -80,17 +79,15 @@ QueryTokenizer::QueryTokenizer(const ::rtl::OUString& sQuery) } } -/*----------------------------------------------- - 01.08.2003 10:28 ------------------------------------------------*/ + + QueryTokenizer::~QueryTokenizer() { /*TODO*/ } -/*----------------------------------------------- - 01.08.2003 10:53 ------------------------------------------------*/ + + sal_Bool QueryTokenizer::valid() const { return m_bValid; diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx index c7c5caa747ee..c3cbbdb58b05 100644 --- a/filter/source/config/cache/querytokenizer.hxx +++ b/filter/source/config/cache/querytokenizer.hxx @@ -32,7 +32,7 @@ //_______________________________________________ // includes -#include <hash_map> +#include <boost/unordered_map.hpp> #include <rtl/ustring.hxx> //_______________________________________________ @@ -61,7 +61,7 @@ namespace filter{ @attention This class is not threadsafe implemented. Because its not neccessary. But you have to make shure, that ist not used as such :-) */ -class QueryTokenizer : public ::std::hash_map< ::rtl::OUString , +class QueryTokenizer : public ::boost::unordered_map< ::rtl::OUString , ::rtl::OUString , ::rtl::OUStringHash , ::std::equal_to< ::rtl::OUString > > diff --git a/filter/source/config/cache/registration.hxx b/filter/source/config/cache/registration.hxx deleted file mode 100644 index 2c1ff3f79c0c..000000000000 --- a/filter/source/config/cache/registration.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 __COMPHELPER_REGISTRATION_HXX_ -#define __COMPHELPER_REGISTRATION_HXX_ - -//_______________________________________________ -// includes - -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/registry/InvalidRegistryException.hpp> -#include <rtl/ustrbuf.hxx> -#include <cppuhelper/factory.hxx> - -//_______________________________________________ -// namespace - -namespace comphelper{ - -//_______________________________________________ -// declaration - -//_______________________________________________ - -/** TODO doc - */ -#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT \ - extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvironmentTypeName, \ - uno_Environment** /* ppEnvironment */ ) \ - { \ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ - } - -//_______________________________________________ - -/** @short creates a new key inside component registry. - - @descr using: a) _COMPHELPER_COMPONENTINFO( MyClass, - MyClass::st_getImplName(), - MyClass::st_getServNames()) - - b) _COMPHELPER_COMPONENTINFO( MyClass, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "css.MyClass" )), - lServiceNames) - - @param CLASS - must be the class name of the implementation - of an uno service, which should be registered here. - - @param IMPLEMENTATIONNAME - can be an uno implementation name from type [::rtl::OUString] - directly or any possible method call, which returns such - name. - - @param SERVICENAME - a list of supported uno service names from type - [css::uno::Sequence< ::rtl::OUString >] - or any possible method call, which returns such - list. - */ -#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES) \ - /*define new scope to prevent multiple using of the same variables ... */ \ - { \ - /* build new key name */ \ - ::rtl::OUStringBuffer sKeyBuf(256); \ - sKeyBuf.appendAscii("/" ); \ - sKeyBuf.append (IMPLEMENTATIONNAME); \ - sKeyBuf.appendAscii("/UNO/SERVICES" ); \ - ::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \ - \ - /* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \ - css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \ - if (!xKey.is()) \ - throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \ - \ - /* dont optimize it! it must work for simple types and function calls! */ \ - const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \ - const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \ - sal_Int32 nCount = lServiceNames.getLength(); \ - \ - for (sal_Int32 i=0; i<nCount; ++i) \ - xKey->createKey(pServiceNames[i]); \ - } - -//_______________________________________________ - -/** @short implments extern C function component_writeInfo - - @descr using: _COMPHELPER_COMPONENT_WRITEINFO - ( - _COMPHELPER_COMPONENTINFO(...) - .. - _COMPHELPER_COMPONENTINFO(...) - ) - - @param INFOLIST - list of macros of type COMPONENTINFO without(!) any - seperator signs between two elements. - */ -#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST) \ - extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, \ - void* pRegistryKey ) \ - { \ - if (!pServiceManager || !pRegistryKey) \ - return sal_False; \ - \ - css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \ - \ - /*if one of following registration will fail ... an exception is thrown! */ \ - try \ - { \ - /* This parameter will expand to: */ \ - /* _COMPHELPER_COMPONENTINFO(1) */ \ - /* ... */ \ - /* _COMPHELPER_COMPONENTINFO(n) */ \ - INFOLIST \ - } \ - catch(const css::registry::InvalidRegistryException&) \ - { \ - return sal_False; \ - } \ - return sal_True; \ - } - -//_______________________________________________ - -/** TODO doc - */ -#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \ - if (IMPLEMENTATIONNAME == sImplName) \ - xFactory = ::cppu::createSingleFactory(xSMGR , \ - IMPLEMENTATIONNAME, \ - FACTORYMETHOD , \ - SERVICENAMES ); - -//_______________________________________________ - -/** TODO doc - */ -#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \ - if (IMPLEMENTATIONNAME == sImplName) \ - xFactory = ::cppu::createOneInstanceFactory(xSMGR , \ - IMPLEMENTATIONNAME, \ - FACTORYMETHOD , \ - SERVICENAMES ); - -//_______________________________________________ - -/** TODO doc - */ -#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST) \ - extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, \ - void* pServiceManager , \ - void* /* pRegistryKey */ ) \ - { \ - if ( \ - (!pImplementationName) || \ - (!pServiceManager ) \ - ) \ - return NULL; \ - \ - STATIC_INIT \ - \ - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager); \ - css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; \ - rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplementationName); \ - \ - /* This parameter will expand to: */ \ - /* _COMPHELPER_xxxFACTORY(1) */ \ - /* else */ \ - /* ... */ \ - /* else */ \ - /* _COMPHELPER_xxxFACTORY(n) */ \ - FACTORYLIST \ - \ - /* And if one of these checks was successfully => xFactory was set! */ \ - if (xFactory.is()) \ - { \ - xFactory->acquire(); \ - return xFactory.get(); \ - } \ - \ - return NULL; \ - } - -} // namespace comphelper - -#endif // #ifndef __COMPHELPER_REGISTRATION_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index a766e343a4f8..a98a5c0610d3 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -62,9 +62,8 @@ namespace css = ::com::sun::star; // enable/disable special handling for CSV/TXT problem #define WORKAROUND_CSV_TXT_BUG_i60158 -/*----------------------------------------------- - 03.07.2003 11:25 ------------------------------------------------*/ + + TypeDetection::TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { BaseContainer::init(xSMGR , @@ -73,16 +72,14 @@ TypeDetection::TypeDetection(const css::uno::Reference< css::lang::XMultiService FilterCache::E_TYPE ); } -/*----------------------------------------------- - 03.07.2003 10:36 ------------------------------------------------*/ + + TypeDetection::~TypeDetection() { } -/*----------------------------------------------- - 03.11.2003 08:43 ------------------------------------------------*/ + + ::rtl::OUString SAL_CALL TypeDetection::queryTypeByURL(const ::rtl::OUString& sURL) throw (css::uno::RuntimeException) { @@ -122,9 +119,8 @@ TypeDetection::~TypeDetection() // <- SAFE } -/*----------------------------------------------- - 31.10.2003 09:36 ------------------------------------------------*/ + + ::rtl::OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::beans::PropertyValue >& lDescriptor, sal_Bool bAllowDeep ) throw (css::uno::RuntimeException) @@ -225,9 +221,8 @@ TypeDetection::~TypeDetection() return sType; } -/*----------------------------------------------- - 03.07.2003 10:36 ------------------------------------------------*/ + + void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescriptor& rDescriptor, ::rtl::OUString& sType ) { @@ -261,7 +256,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip if ( (sDocumentService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sheet.SpreadsheetDocument"))) && ( - (sRealType.equalsAscii("writer_Text" )) || + (sRealType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("writer_Text"))) || (sRealType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("writer_Text_encoded"))) ) ) @@ -271,7 +266,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip else if ( (sDocumentService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument"))) && - (sRealType.equalsAscii("calc_Text_txt_csv_StarCalc" )) + (sRealType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("calc_Text_txt_csv_StarCalc"))) ) { sRealType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "writer_Text" )); @@ -411,9 +406,8 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(::comphelper::MediaDescrip {} } -/*----------------------------------------------- - 14.11.2003 12:06 ------------------------------------------------*/ + + sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreSelType, const css::util::URL& aParsedURL , FlatDetection& rFlatTypes ) @@ -509,19 +503,6 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS } } } - - /* - Comment ... why the following line of code should be comened out .-) - - This type does not seem to fit the requirements - But its an existing and well known type. - At least - [because may be the extension was missing :-( ] - we should try to detect this type deep ... - So we accept it here :-) - - if (!bBreakDetection) - sType = ::rtl::OUString(); - */ } // if its a valid type - set it on all return values! @@ -545,9 +526,8 @@ sal_Bool TypeDetection::impl_getPreselectionForType(const ::rtl::OUString& sPreS return sal_False; } -/*----------------------------------------------- - 14.11.2003 12:09 ------------------------------------------------*/ + + sal_Bool TypeDetection::impl_getPreselectionForFilter(const ::rtl::OUString& sPreSelFilter, const css::util::URL& aParsedURL , FlatDetection& rFlatTypes ) @@ -605,9 +585,8 @@ sal_Bool TypeDetection::impl_getPreselectionForFilter(const ::rtl::OUString& sPr return sal_False; } -/*----------------------------------------------- - 14.11.2003 12:11 ------------------------------------------------*/ + + sal_Bool TypeDetection::impl_getPreselectionForDocumentService(const ::rtl::OUString& sPreSelDocumentService, const css::util::URL& aParsedURL , FlatDetection& rFlatTypes ) @@ -683,9 +662,8 @@ sal_Bool TypeDetection::impl_getPreselectionForDocumentService(const ::rtl::OUSt return sal_True; } -/*----------------------------------------------- - 14.11.2003 12:21 ------------------------------------------------*/ + + void TypeDetection::impl_getPreselection(const css::util::URL& aParsedURL , ::comphelper::MediaDescriptor& rDescriptor, FlatDetection& rFlatTypes ) @@ -722,9 +700,8 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes); } -/*----------------------------------------------- - 03.11.2003 09:17 ------------------------------------------------*/ + + ::rtl::OUString TypeDetection::impl_detectTypeFlatAndDeep( ::comphelper::MediaDescriptor& rDescriptor , const FlatDetection& lFlatTypes , sal_Bool bAllowDeep , @@ -827,9 +804,8 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP // <- SAFE ---------------------------------- } -/*----------------------------------------------- - 03.11.2003 09:19 ------------------------------------------------*/ + + ::rtl::OUString TypeDetection::impl_detectTypeDeepOnly( ::comphelper::MediaDescriptor& rDescriptor , const OUStringList& lOutsideUsedDetectors) { @@ -957,9 +933,8 @@ void TypeDetection::impl_getPreselection(const css::util::URL& aP return ::rtl::OUString(); } -/*----------------------------------------------- - 07.03.2005 11:13 ------------------------------------------------*/ + + void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescriptor) { // try to seek to 0 ... @@ -981,9 +956,8 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript } } -/*----------------------------------------------- - 30.10.2003 15:12 ------------------------------------------------*/ + + ::rtl::OUString TypeDetection::impl_askDetectService(const ::rtl::OUString& sDetectService, ::comphelper::MediaDescriptor& rDescriptor ) { @@ -1069,9 +1043,8 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript return ::rtl::OUString(); } -/*----------------------------------------------- - 17.12.2004 13:47 ------------------------------------------------*/ + + ::rtl::OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor) { // SAFE -> @@ -1138,9 +1111,8 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript return ::rtl::OUString(); } -/*----------------------------------------------- - 10.03.2004 10:30 ------------------------------------------------*/ + + void TypeDetection::impl_openStream(::comphelper::MediaDescriptor& rDescriptor) throw (css::uno::Exception) { @@ -1168,9 +1140,8 @@ void TypeDetection::impl_openStream(::comphelper::MediaDescriptor& rDescriptor) } } -/*----------------------------------------------- - 04.07.2003 13:47 ------------------------------------------------*/ + + void TypeDetection::impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescriptor& rDescriptor) { ::comphelper::MediaDescriptor::iterator pItType = rDescriptor.find(::comphelper::MediaDescriptor::PROP_TYPENAME() ); @@ -1181,9 +1152,8 @@ void TypeDetection::impl_removeTypeFilterFromDescriptor(::comphelper::MediaDescr rDescriptor.erase(pItFilter); } -/*----------------------------------------------- - 14.10.2003 11:15 ------------------------------------------------*/ + + sal_Bool TypeDetection::impl_validateAndSetTypeOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor, const ::rtl::OUString& sType ) { @@ -1202,9 +1172,8 @@ sal_Bool TypeDetection::impl_validateAndSetTypeOnDescriptor( ::comphelper:: return sal_False; } -/*----------------------------------------------- - 04.07.2003 14:01 ------------------------------------------------*/ + + sal_Bool TypeDetection::impl_validateAndSetFilterOnDescriptor( ::comphelper::MediaDescriptor& rDescriptor, const ::rtl::OUString& sFilter ) { @@ -1233,17 +1202,15 @@ sal_Bool TypeDetection::impl_validateAndSetFilterOnDescriptor( ::comphelper return sal_False; } -/*----------------------------------------------- - 03.07.2003 10:36 ------------------------------------------------*/ + + ::rtl::OUString TypeDetection::impl_getImplementationName() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.filter.config.TypeDetection" )); } -/*----------------------------------------------- - 03.07.2003 11:27 ------------------------------------------------*/ + + css::uno::Sequence< ::rtl::OUString > TypeDetection::impl_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lServiceNames(1); @@ -1251,9 +1218,8 @@ css::uno::Sequence< ::rtl::OUString > TypeDetection::impl_getSupportedServiceNam return lServiceNames; } -/*----------------------------------------------- - 09.07.2003 08:02 ------------------------------------------------*/ + + css::uno::Reference< css::uno::XInterface > SAL_CALL TypeDetection::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { TypeDetection* pNew = new TypeDetection(xSMGR); diff --git a/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu b/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu index d0d2b13e5584..a0bb672092f4 100644 --- a/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu +++ b/filter/source/config/fragments/filters/MS_Excel_2003_XML.xcu @@ -2,7 +2,7 @@ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,../share/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl,../share/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,com.sun.star.comp.JAXTHelper,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,../share/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl,../share/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl</value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>calc_MS_Excel_2003_XML</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu index c953598dd67d..4568910dfdd2 100644 --- a/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu +++ b/filter/source/config/fragments/filters/MS_Word_2003_XML.xcu @@ -2,7 +2,7 @@ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,../share/xslt/import/wordml/wordml2ooo.xsl,../share/xslt/export/wordml/ooo2wordml.xsl</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,com.sun.star.comp.JAXTHelper,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,../share/xslt/import/wordml/wordml2ooo.xsl,../share/xslt/export/wordml/ooo2wordml.xsl</value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>writer_MS_Word_2003_XML</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/ODG_FlatXML.xcu b/filter/source/config/fragments/filters/ODG_FlatXML.xcu index f528248aadb2..0e386addbca6 100644 --- a/filter/source/config/fragments/filters/ODG_FlatXML.xcu +++ b/filter/source/config/fragments/filters/ODG_FlatXML.xcu @@ -3,7 +3,7 @@ <prop oor:name="Type"><value>draw_ODG_FlatXML</value></prop> <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> <prop oor:name="UIComponent"/> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> <prop oor:name="TemplateName"/> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/filters/ODP_FlatXML.xcu b/filter/source/config/fragments/filters/ODP_FlatXML.xcu index 8f15d7c5991f..121cb2d3ffd7 100644 --- a/filter/source/config/fragments/filters/ODP_FlatXML.xcu +++ b/filter/source/config/fragments/filters/ODP_FlatXML.xcu @@ -3,7 +3,7 @@ <prop oor:name="Type"><value>impress_ODP_FlatXML</value></prop> <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> <prop oor:name="UIComponent"/> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> <prop oor:name="TemplateName"/> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/filters/ODS_FlatXML.xcu b/filter/source/config/fragments/filters/ODS_FlatXML.xcu index df8e8566fb6e..7ae34aa22818 100644 --- a/filter/source/config/fragments/filters/ODS_FlatXML.xcu +++ b/filter/source/config/fragments/filters/ODS_FlatXML.xcu @@ -3,7 +3,7 @@ <prop oor:name="Type"><value>calc_ODS_FlatXML</value></prop> <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop> <prop oor:name="UIComponent"/> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> <prop oor:name="TemplateName"/> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/filters/ODT_FlatXML.xcu b/filter/source/config/fragments/filters/ODT_FlatXML.xcu index cf764ecc5935..e08d39d3fc39 100644 --- a/filter/source/config/fragments/filters/ODT_FlatXML.xcu +++ b/filter/source/config/fragments/filters/ODT_FlatXML.xcu @@ -3,7 +3,7 @@ <prop oor:name="Type"><value>writer_ODT_FlatXML</value></prop> <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop> <prop oor:name="UIComponent"/> - <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop> + <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop> <prop oor:name="TemplateName"/> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/makefile.mk b/filter/source/config/fragments/makefile.mk index c97818bfdb97..2acc8fcc0690 100644 --- a/filter/source/config/fragments/makefile.mk +++ b/filter/source/config/fragments/makefile.mk @@ -184,7 +184,7 @@ $(ALL_FLAGS) : $(INCLUDE_FRAGMENTS) .IF "$(SYSTEM_PYTHON)" == "YES" MERGE:=$(PYTHON) ../tools/merge/pyAltFCFGMerge .ELSE -MERGE:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/python ../tools/merge/pyAltFCFGMerge +MERGE:=$(AUGMENT_LIBRARY_PATH) PYTHONPATH=$(SOLARLIBDIR)/python $(SOLARBINDIR)/python ../tools/merge/pyAltFCFGMerge .ENDIF .ELSE MERGE := $(JAVAI) $(JAVAIFLAGS) -jar $(SOLARBINDIR)$/FCFGMerge.jar diff --git a/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu index ab9e409959a2..7216db8a6480 100644 --- a/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu +++ b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlsx xlsm</value></prop> - <prop oor:name="MediaType"/> + <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>Calc MS Excel 2007 XML</value></prop> <prop oor:name="UIName"><value xml:lang="x-default">Microsoft Excel 2007 XML</value></prop> diff --git a/filter/source/config/fragments/types/calc_OOXML.xcu b/filter/source/config/fragments/types/calc_OOXML.xcu index 40fd3eea1d6c..016d322f0313 100644 --- a/filter/source/config/fragments/types/calc_OOXML.xcu +++ b/filter/source/config/fragments/types/calc_OOXML.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlsx xlsm</value></prop> - <prop oor:name="MediaType"/> + <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>Calc Office Open XML</value></prop> <prop oor:name="UIName"><value xml:lang="x-default">Office Open XML Spreadsheet</value></prop> diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge index a44a4bb81d29..0d7666aed912 100755 --- a/filter/source/config/tools/merge/pyAltFCFGMerge +++ b/filter/source/config/tools/merge/pyAltFCFGMerge @@ -51,7 +51,7 @@ Copyright (C) 2002,2004 - Ollie Rutherfurd <oliver@rutherfurd.net> Based on: - http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html + http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html Missing: @@ -89,190 +89,190 @@ __all__ = ['Properties'] def dec2hex(n): - h = hex(n)[2:].upper() - return '\\u' + '0' * (4 - len(h)) + h + h = hex(n)[2:].upper() + return '\\u' + '0' * (4 - len(h)) + h def escapestr(s): - buff = [] - # QUESTION: escape leading or trailing spaces? - for c in s: - if c == '\\': - buff.append('\\\\') - elif c == '\t': - buff.append('\\t') - elif c == '\n': - buff.append('\\n') - elif c == '\r': - buff.append('\\r') - elif c == ' ': - buff.append('\\ ') - elif c == "'": - buff.append("\\'") - elif c == '"': - buff.append('\\"') - elif c == '#': - buff.append('\\#') - elif c == '!': - buff.append('\\!') - elif c == '=': - buff.append('\\=') - elif 32 <= ord(c) <= 126: - buff.append(c) - else: - buff.append(dec2hex(c)) - - return ''.join(buff) + buff = [] + # QUESTION: escape leading or trailing spaces? + for c in s: + if c == '\\': + buff.append('\\\\') + elif c == '\t': + buff.append('\\t') + elif c == '\n': + buff.append('\\n') + elif c == '\r': + buff.append('\\r') + elif c == ' ': + buff.append('\\ ') + elif c == "'": + buff.append("\\'") + elif c == '"': + buff.append('\\"') + elif c == '#': + buff.append('\\#') + elif c == '!': + buff.append('\\!') + elif c == '=': + buff.append('\\=') + elif 32 <= ord(c) <= 126: + buff.append(c) + else: + buff.append(dec2hex(c)) + + return ''.join(buff) # TODO: add support for \uXXXX? def unescapestr(line): - buff = [] - escape = 0 - for i in range(len(line)): - c = line[i] - if c == '\\': - if escape: - escape = 0 - buff.append('\\') - continue - else: - # this is to deal with '\' - # acting as a line continuation - # character - if i == len(line) - 1: - buff.append('\\') - break - else: - escape = 1 - continue - elif c == 'n': - if escape: - escape = 0 - buff.append('\n') - continue - elif c == 'r': - if escape: - escape = 0 - buff.append('\r') - continue - elif c == 't': - if escape: - escape = 0 - buff.append('\t') - continue - - buff.append(c) - - # make sure escape doesn't stay one - # all expected escape sequences either break - # or continue, so this should be safe - if escape: - escape = 0 - - return ''.join(buff) + buff = [] + escape = 0 + for i in range(len(line)): + c = line[i] + if c == '\\': + if escape: + escape = 0 + buff.append('\\') + continue + else: + # this is to deal with '\' + # acting as a line continuation + # character + if i == len(line) - 1: + buff.append('\\') + break + else: + escape = 1 + continue + elif c == 'n': + if escape: + escape = 0 + buff.append('\n') + continue + elif c == 'r': + if escape: + escape = 0 + buff.append('\r') + continue + elif c == 't': + if escape: + escape = 0 + buff.append('\t') + continue + + buff.append(c) + + # make sure escape doesn't stay one + # all expected escape sequences either break + # or continue, so this should be safe + if escape: + escape = 0 + + return ''.join(buff) class Properties(dict): - def __init__(self, defaults={}): - dict.__init__(self) - for n,v in defaults.items(): - self[n] = v - - def __getittem__(self,key): - try: - return dict.__getittem__(self,key) - except KeyError: - return None - - def read(self,filename): - """ - Reads properties from a file (java Property class - reads from an input stream -- see load()). - """ - f = None - try: - f = open(filename) - self.load(f) - finally: - if f: - f.close() - - def load(self, buff): - """ - Reads properties from a stream (StringIO, file, etc...) - """ - props = readprops(buff) - for n,v in props.iteritems(): - self[n] = v + def __init__(self, defaults={}): + dict.__init__(self) + for n,v in defaults.items(): + self[n] = v + + def __getittem__(self,key): + try: + return dict.__getittem__(self,key) + except KeyError: + return None + + def read(self,filename): + """ + Reads properties from a file (java Property class + reads from an input stream -- see load()). + """ + f = None + try: + f = open(filename) + self.load(f) + finally: + if f: + f.close() + + def load(self, buff): + """ + Reads properties from a stream (StringIO, file, etc...) + """ + props = readprops(buff) + for n,v in props.iteritems(): + self[n] = v def readprops(buff): - name,value = None,'' - props = {} - continued = 0 - - while 1: - line = buff.readline() - if not line: - break - line = line.strip() - - # empty line - if not line: - continue - - # comment - if line[0] in ('#','!'): - continue - - # find name - i,escaped = 0,0 - while i < len(line): - c = line[i] - - if c == '\\': - if escaped: - escaped = 0 - else: - escaped = 1 - i += 1 - continue - - elif c in (' ', '\t', ':', '=') and not escaped: - name = unescapestr(line[:i]) - break - - # make sure escaped doesn't stay on - if escaped: - escaped = 0 - - i += 1 - - # no dlimiter was found, name is entire line, there is no value - if name == None: - name = unescapestr(line.lstrip()) - - # skip delimiter - while line[i:i+1] in ('\t', ' ', ':', '='): - i += 1 - - value = unescapestr(line[i:].strip()) - while value[-1:] == '\\': - value = value[:-1] # remove \ - line = buff.readline() - if not line: - break - value += unescapestr(line.strip()) - - #print 'value:',value ## - props[name] = value - - return props + name,value = None,'' + props = {} + continued = 0 + + while 1: + line = buff.readline() + if not line: + break + line = line.strip() + + # empty line + if not line: + continue + + # comment + if line[0] in ('#','!'): + continue + + # find name + i,escaped = 0,0 + while i < len(line): + c = line[i] + + if c == '\\': + if escaped: + escaped = 0 + else: + escaped = 1 + i += 1 + continue + + elif c in (' ', '\t', ':', '=') and not escaped: + name = unescapestr(line[:i]) + break + + # make sure escaped doesn't stay on + if escaped: + escaped = 0 + + i += 1 + + # no dlimiter was found, name is entire line, there is no value + if name == None: + name = unescapestr(line.lstrip()) + + # skip delimiter + while line[i:i+1] in ('\t', ' ', ':', '='): + i += 1 + + value = unescapestr(line[i:].strip()) + while value[-1:] == '\\': + value = value[:-1] # remove \ + line = buff.readline() + if not line: + break + value += unescapestr(line.strip()) + + #print 'value:',value ## + props[name] = value + + return props #---end java.util.Properties copy---# # Its a simple command line tool, which can merge different XML fragments @@ -341,7 +341,7 @@ def StringTokenizer(mstring, separators, isSepIncluded=0): # @author Andreas Schluens class ConfigHelper: def __init__(self, sPropFile, lCommandLineArgs): - self.m_bEmpty = 1 + self.m_bEmpty = 1 # first load prop file, so its values can be overwritten # by command line args later # Do it only, if a valid file name was given. @@ -399,7 +399,7 @@ class ConfigHelper: def getValueWithDefault(self, sProp, default): if not self.props.has_key(sProp): - return default; + return default; return self.props[sProp]; def getStringList(self, sProp, sDelimiter, bTrim, bDecode): @@ -543,7 +543,7 @@ class Merger: sBuffer = sBuffer + generateFooter() # Attention! - # If the package seem to be empty, it make no sense to generate a + # If the package seem to be empty, it make no sense to generate a # corresponding xml file. We should suppress writing of this file on # disk completly ... if nItemCount < 1: diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index 66e652347402..86ed934acf3f 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -32,10 +32,11 @@ #include "impswfdialog.hxx" #include "impswfdialog.hrc" -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::beans; +using ::rtl::OUString; + // ---------------- // - ImpPDFDialog - // ---------------- diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx index 01794b102e0f..8e9f10905780 100644 --- a/filter/source/flash/swffilter.cxx +++ b/filter/source/flash/swffilter.cxx @@ -333,6 +333,9 @@ sal_Bool FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue err = osl_writeFile(xBackgroundConfig, "slides=", strlen("slides="), &bytesWritten); } + // TODO: check for errors + (void) err; + FlashExporter aFlashExporter( mxMSF, findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75), findPropertyValue<sal_Bool>(aFilterData, "ExportOLEAsJPEG", false)); diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 07382d9aa6dd..980146cf6594 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -515,7 +515,6 @@ sal_Bool Writer::streamSound( const char * filename ) if (ret_code < 0) throw 0; - int lame_frame_size = lame_get_framesize(m_lame_flags); int samples_per_frame = 22050 / 12; // AS: (samples/sec) / (frames/sec) = samples/frame int mp3buffer_size = static_cast<int>(samples_per_frame*1.25 + 7200 + 7200); @@ -583,7 +582,7 @@ sal_Bool Writer::streamSound( const char * filename ) SvMemoryStream strm(mp3buffer, ret + ret2, STREAM_READWRITE); - mpTag->addUI16(samples_to_write); //lame_frame_size); + mpTag->addUI16(samples_to_write); mpTag->addUI16(0); mpTag->addStream(strm); diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index 7acf4b88ce9f..41f8f8f663a9 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -197,9 +197,7 @@ public: void write( SvStream& out ); void addUI32( sal_uInt32 nValue ); - //unused as of yet void addI32( sal_Int32 nValue ); void addUI16( sal_uInt16 nValue ); - //unused as of yet void addI16( sal_Int16 nValue ); void addUI8( sal_uInt8 nValue ); void addBits( BitStream& rIn ); diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 5e68fc04fb4b..692f7049a681 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -612,22 +612,6 @@ void Writer::Impl_writeText( const Point& rPos, const String& rText, const sal_I // write text element -/* test code to create a bound rect, not realy working for rotated text - Size aTextSize( map( Size( mpVDev->GetTextWidth( rText ), mpVDev->GetTextHeight() ) ) ); - Point aMetricPoint( map( Point( aMetric.GetLeading(), aMetric.GetAscent() ) ) ); - - Point aTmpPoint( map( Point( - aMetric.GetLeading(), - aMetric.GetAscent() ) ) ); ; - Rectangle aTmpRectangle(aTmpPoint, aTextSize ); - Polygon aPoly( aTmpRectangle ); - - aPoly.Rotate( aTmpPoint, (USHORT) nOrientation ); - - Rectangle aTextBoundRect( aPoly.GetBoundRect() ); - - aPoly.Move( aPt.X(), aPt.Y() - map( Size( 0, aMetric.GetDescent() ) ).Height() ); - -*/ - #if 0 // makes the calculated bound rect visible for debuging { Polygon aTmpPoly( aPoly ); @@ -899,15 +883,6 @@ sal_uInt16 Writer::defineBitmap( const BitmapEx &bmpSource, sal_Int32 nJPEGQuali aFilterData[0].Value <<= nJPEGQualityLevel; } -#if 0 - // Debug code to see what we export to swf - { - SvFileStream aDstStm( String( RTL_CONSTASCII_USTRINGPARAM("e:\\test.jpg") ), STREAM_READ | STREAM_WRITE | STREAM_TRUNC ); - aFilter.ExportGraphic( aGraphic, String(), aDstStm, - aFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( JPG_SHORTNAME ) ) ), &aFilterData ); - } -#endif - if( aFilter.ExportGraphic( aGraphic, String(), aDstStm, aFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( JPG_SHORTNAME ) ) ), &aFilterData ) == ERRCODE_NONE ) { @@ -1069,7 +1044,7 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal #ifdef DBG_UTIL if (0xFF != *pJpgSearch) { - DBG_ERROR( "Expected JPEG marker." ); ((void)0); + OSL_FAIL( "Expected JPEG marker." ); ((void)0); } #endif @@ -1139,7 +1114,7 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal break; default: - DBG_ERROR( "JPEG marker I didn't handle!" ); + OSL_FAIL( "JPEG marker I didn't handle!" ); } } @@ -1329,12 +1304,10 @@ bool Writer::Impl_writeFilling( SvtGraphicFill& rFilling ) aMatrix.set(2, 2, 1.0); // scale bitmap - Rectangle originalPixelRect = Rectangle(Point(), aGraphic.GetBitmapEx().GetSizePixel()); - double XScale = (double)aNewRect.GetWidth()/aOldRect.GetWidth(); double YScale = (double)aNewRect.GetHeight()/aOldRect.GetHeight(); - aMatrix.scale( XScale, YScale ); + aMatrix.scale( XScale, YScale ); FillStyle aFillStyle( nBitmapId, !rFilling.IsTiling(), aMatrix ); @@ -1887,20 +1860,11 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) case( META_MOVECLIPREGION_ACTION ): { ( (MetaAction*) pAction )->Execute( mpVDev ); -// mbClipAttrChanged = sal_True; } break; case( META_MAPMODE_ACTION ): { -// const MetaMapModeAction *pA = (const MetaMapModeAction*) pAction; -// MapMode mm = pA->GetMapMode(); -// MapUnit mu = mm.GetMapUnit(); -// -// Point pt = mm.GetOrigin(); -// Fraction fx = mm.GetScaleX(); -// Fraction fy = mm.GetScaleY(); - bMap++; } case( META_REFPOINT_ACTION ): @@ -1931,7 +1895,6 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) break; default: - //DBG_ERROR( "FlashActionWriter::ImplWriteActions: unsupported MetaAction #" ); break; } } diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx index a3b9dcfd3dea..ee5d9c664615 100644 --- a/filter/source/graphicfilter/eos2met/eos2met.cxx +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -1965,7 +1965,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_TEXTRECT_ACTION: { -// DBG_ERROR( "Unsupported MET-Action: META_TEXTRECT_ACTION!" ); +// OSL_FAIL( "Unsupported MET-Action: META_TEXTRECT_ACTION!" ); } break; @@ -2050,21 +2050,12 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) break; case META_MASK_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_MASK_ACTION!" ); - } break; case META_MASKSCALE_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALE_ACTION!" ); - } break; case META_MASKSCALEPART_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALEPART_ACTION!" ); - } break; case META_GRADIENT_ACTION: @@ -2092,15 +2083,9 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) break; case META_WALLPAPER_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_WALLPAPER_ACTION!" ); - } break; case META_CLIPREGION_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_CLIPREGION_ACTION!" ); - } break; case META_ISECTRECTCLIPREGION_ACTION: @@ -2111,15 +2096,9 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) break; case META_ISECTREGIONCLIPREGION_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_ISECTREGIONCLIPREGION_ACTION!" ); - } break; case META_MOVECLIPREGION_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_MOVECLIPREGION_ACTION!" ); - } break; case META_LINECOLOR_ACTION: @@ -2163,9 +2142,6 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) break; case META_TEXTALIGN_ACTION: - { -// DBG_ERROR( "Unsupported MET-Action: META_TEXTALIGN_ACTION!" ); - } break; case META_MAPMODE_ACTION: diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx index db4b2d1502ab..14340d3fa34a 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -1630,7 +1630,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_CHORD_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_CHORD_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_CHORD_ACTION!" ); } break; @@ -1805,7 +1805,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_TEXTRECT_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_TEXTRECT_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_TEXTRECT_ACTION!" ); } break; @@ -1884,7 +1884,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_MASKSCALE_ACTION: case META_MASKSCALEPART_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_MASK..._ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_MASK..._ACTION!" ); } break; @@ -1914,13 +1914,13 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_WALLPAPER_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_WALLPAPER_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_WALLPAPER_ACTION!" ); } break; case META_CLIPREGION_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_CLIPREGION_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_CLIPREGION_ACTION!" ); } break; @@ -1933,13 +1933,13 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_ISECTREGIONCLIPREGION_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_ISECTREGIONCLIPREGION_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_ISECTREGIONCLIPREGION_ACTION!" ); } break; case META_MOVECLIPREGION_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_MOVECLIPREGION_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_MOVECLIPREGION_ACTION!" ); } break; @@ -1985,7 +1985,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) case META_TEXTALIGN_ACTION: { -// DBG_ERROR( "Unsupported PICT-Action: META_TEXTALIGN_ACTION!" ); +// OSL_FAIL( "Unsupported PICT-Action: META_TEXTALIGN_ACTION!" ); } break; diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 458195b0cd8d..628c3f1177f5 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -44,6 +44,7 @@ #include <vcl/msgbox.hxx> #include <vcl/cvtgrf.hxx> #include <vcl/gradient.hxx> +#include <unotools/configmgr.hxx> #include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> @@ -54,6 +55,8 @@ #include <math.h> +using namespace ::com::sun::star::uno; + #define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox // in the first 4096 bytes @@ -368,10 +371,21 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter ChrSet* pCS; StackMember* pGS; - if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) + if (rGraphic.GetType() == GRAPHIC_GDIMETAFILE) pMTF = &rGraphic.GetGDIMetaFile(); - else + else if (rGraphic.GetGDIMetaFile().GetActionCount()) pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() ); + else + { + Bitmap aBmp( rGraphic.GetBitmap() ); + pAMTF = new GDIMetaFile(); + VirtualDevice aTmpVDev; + pAMTF->Record( &aTmpVDev ); + aTmpVDev.DrawBitmap( Point(), aBmp ); + pAMTF->Stop(); + pAMTF->SetPrefSize( aBmp.GetSizePixel() ); + pMTF = pAMTF; + } aVDev.SetMapMode( pMTF->GetPrefMapMode() ); nBoundingX1 = nBoundingY1 = 0; nBoundingX2 = pMTF->GetPrefSize().Width(); @@ -459,7 +473,18 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview ) ImplWriteLong( aSizePoint.Width() ); ImplWriteLong( aSizePoint.Height() ,PS_RET ); ImplWriteLine( "%%Pages: 0" ); - ImplWriteLine( "%%Creator: Sun Microsystems, Inc." ); + ::rtl::OUStringBuffer aCreator; + aCreator.appendAscii( RTL_CONSTASCII_STRINGPARAM( "%%Creator: " ) ); + ::utl::ConfigManager& rMgr = ::utl::ConfigManager::GetConfigManager(); + Any aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); + ::rtl::OUString sProductName; + aProductName >>= sProductName; + aCreator.append( sProductName ); + aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); + aProductName >>= sProductName; + aCreator.appendAscii( RTL_CONSTASCII_STRINGPARAM( " " ) ); + aCreator.append( sProductName ); + ImplWriteLine( ::rtl::OUStringToOString( aCreator.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr() ); ImplWriteLine( "%%Title: none" ); ImplWriteLine( "%%CreationDate: none" ); @@ -762,7 +787,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) case META_TEXTRECT_ACTION: { - DBG_ERROR( "Unsupported action: TextRect...Action!" ); + OSL_FAIL( "Unsupported action: TextRect...Action!" ); } break; @@ -867,7 +892,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) case META_MASKSCALE_ACTION: case META_MASKSCALEPART_ACTION: { - DBG_ERROR( "Unsupported action: MetaMask...Action!" ); + OSL_FAIL( "Unsupported action: MetaMask...Action!" ); } break; diff --git a/filter/source/graphicfilter/eps/makefile.mk b/filter/source/graphicfilter/eps/makefile.mk index 34c87f146604..0124a1efa662 100644 --- a/filter/source/graphicfilter/eps/makefile.mk +++ b/filter/source/graphicfilter/eps/makefile.mk @@ -31,8 +31,6 @@ PRJNAME=filter TARGET=eps DEPTARGET=veps -#GEN_HID=TRUE - # --- Settings ----------------------------------------------------------- .INCLUDE : settings.mk @@ -60,7 +58,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= eps$(DLLPOSTFIX) SHL1IMPLIB= eps -SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(UNOTOOLSLIB) SHL1LIBS= $(SLB)$/eps.lib diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx index ce0d5f191238..f6ecc3c39a73 100644 --- a/filter/source/graphicfilter/icgm/actimpr.cxx +++ b/filter/source/graphicfilter/icgm/actimpr.cxx @@ -58,9 +58,6 @@ using namespace ::com::sun::star; // --------------------------------------------------------------- -// --------------------------------------------------------------- -// --------------------------------------------------------------- -// --------------------------------------------------------------- CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XModel > & rModel ) : CGMOutAct ( rCGM ), @@ -210,7 +207,6 @@ void CGMImpressOutAct::ImplSetFillBundle() sal_uInt32 nFillColor; FillInteriorStyle eFillStyle; - long nPatternIndex; sal_uInt32 nHatchIndex; if ( mpCGM->pElement->eEdgeVisibility == EV_ON ) @@ -243,10 +239,6 @@ void CGMImpressOutAct::ImplSetFillBundle() nHatchIndex = (sal_uInt32)mpCGM->pElement->pFillBundle->nFillHatchIndex; else nHatchIndex = (sal_uInt32)mpCGM->pElement->aFillBundle.nFillHatchIndex; - if ( mpCGM->pElement->nAspectSourceFlags & ASF_PATTERNINDEX ) - nPatternIndex = mpCGM->pElement->pFillBundle->nFillPatternIndex; - else - nPatternIndex = mpCGM->pElement->aFillBundle.nFillPatternIndex; aAny <<= (sal_Int32)nFillColor; maXPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" )), aAny ); @@ -328,15 +320,6 @@ void CGMImpressOutAct::ImplSetFillBundle() case ET_DOTDOTSPACE : case ET_LONGDASH : case ET_DASHDASHDOT : -// { -// eLS = LineStyle_DASH; -// aAny.setValue( &eLS, ::getCppuType((const drawing::LineStyle*)0) ); -// maXPropSet->setPropertyValue( L"LineStyle", aAny ); -// drawing::LineDash aLineDash( DashStyle_RECTRELATIVE, 1, 160, 1, 160, 190 ); -// aAny.setValue( &aLineDash, ::getCppuType((const drawing::LineDash*)0) ); -// maXPropSet->setPropertyValue( L"DashStyle", aAny ); -// } -// break; default: // case ET_SOLID : { eLS = drawing::LineStyle_SOLID; @@ -384,28 +367,13 @@ void CGMImpressOutAct::ImplSetFillBundle() void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XPropertySet > & rProperty ) { uno::Any aAny; - TextPrecision eTextPrecision; sal_uInt32 nTextFontIndex; sal_uInt32 nTextColor; - double fCharacterExpansion; - double fCharacterSpacing; if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX ) nTextFontIndex = mpCGM->pElement->pTextBundle->nTextFontIndex; else nTextFontIndex = mpCGM->pElement->aTextBundle.nTextFontIndex; - if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTPRECISION ) - eTextPrecision = mpCGM->pElement->pTextBundle->eTextPrecision; - else - eTextPrecision = mpCGM->pElement->aTextBundle.eTextPrecision; - if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION ) - fCharacterExpansion = mpCGM->pElement->pTextBundle->nCharacterExpansion; - else - fCharacterExpansion = mpCGM->pElement->aTextBundle.nCharacterExpansion; - if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTERSPACING ) - fCharacterSpacing = mpCGM->pElement->pTextBundle->nCharacterSpacing; - else - fCharacterSpacing = mpCGM->pElement->aTextBundle.nCharacterSpacing; if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR ) nTextColor = mpCGM->pElement->pTextBundle->GetColor(); else @@ -483,8 +451,6 @@ void CGMImpressOutAct::EndGroup() if( aAny >>= aXShapeGrouper ) { uno::Reference< drawing::XShapes > aXShapes; -// if ( maXServiceManagerSC->createInstance( L"stardiv.one.drawing.ShapeCollection" )->queryInterface( ::getCppuType((const Reference< drawing::XShapes >*)0), aXShapes ) ) - uno::Reference< drawing::XShape > aXShapeCollection( maXServiceManagerSC->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ShapeCollection" )) ), uno::UNO_QUERY ); if ( aXShapeCollection.is() ) { @@ -1010,120 +976,7 @@ void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFla // nCount != 0 -> Append Text sal_uInt32 CGMImpressOutAct::DrawText( TextEntry* /*pTextEntry*/, NodeFrameSet& /*rNodeFrameSet*/, sal_uInt32 /*nObjCount*/ ) { - return 0; - -/* - uno::Reference< drawing::XShape > aShape; - - if ( nObjCount ) - { - aShape = (drawing::XShape*) maXShapes->getElementByIndex( nObjCount - 1 )->queryInterface( ::getCppuType((const Reference< drawing::XShape >*)0) ); - } - else - { - aShape = maXShapes->insertShape( maXShapeFactory->createShape( L"ShapeText", rNodeFrameSet.nSize ), rNodeFrameSet.nTopLeft ); - } - if ( aShape.is() ) - { - uno::Reference< text::XText > xText = (text::XText*)aShape->queryInterface( ::getCppuType((const Reference< text::XText >*)0) ); - if ( xText.is() ) - { - uno::Reference< text::XTextCursor > aXTextCursor = (text::XTextCursor*)xText->createTextCursor()->queryInterface( ::getCppuType((const Reference< text::XTextCursor >*)0) ); - if ( aXTextCursor.is() ) - { - uno::Any aAny; - sal_uInt32 nTextOfs = 0; - TextAttribute* pTAttr = pTextEntry->pAttribute; - do - { - if ( pTAttr->nTextAttribSize > 0.3 ) // is text readable - { - aXTextCursor->gotoEnd( sal_False ); - char nPushedChar = pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ]; - pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = 0; - UString aStr( StringToOUString( pTextEntry->pText + nTextOfs, CHARSET_SYSTEM ) ); - - uno::Reference< text::XText > aCursorText = (text::XText*)aXTextCursor->queryInterface( ::getCppuType((const Reference< text::XText >*)0) ); - if ( aCursorText.is() ) - { - uno::Reference< beans::XPropertySet > aPropSet = (beans::XPropertySet*)aCursorText->queryInterface( ::getCppuType((const Reference< beans::XPropertySet >*)0) ); - if ( aPropSet.is() ) - { - if ( pTextEntry->nRowOrLineNum ) - { - uno::Reference< XControlCharacterInsertable > aCRef = (XControlCharacterInsertable*)aXTextCursor->queryInterface( ::getCppuType((const Reference< XControlCharacterInsertable >*)0) ); - if ( aCRef.is() ) - { - aCRef->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK ); - } - } - aCursorText->setText( aStr ); - aXTextCursor->gotoEnd( sal_True ); - double nSize = mpCGM->mnOutdx; - if ( mpCGM->mnOutdx < mpCGM->mnOutdy ) - nSize = mpCGM->mnOutdy; - nSize = ( nSize * (double)pTAttr->nTextAttribSize * (double)1.5 ) / 100; - - aAny <<= (sal_Int32)( (sal_Int32)nSize ); - aPropSet->setPropertyValue( L"CharHeight", aAny ); - - sal_uInt32 nTextColor = pTAttr->nTextColorIndex; - if ( nTextColor == 0xff ) - { - nTextColor = ( pTAttr->nTextColorBlue << 16 ) + ( pTAttr->nTextColorGreen << 8 ) + pTAttr->nTextColorRed; - } - else - { - nTextColor = mpCGM->pElement->aColorTable[ nTextColor ]; - } - - sal_uInt32 nFontType = 0; - - if ( pTAttr->nTextFontType == 0xff ) - { - FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( pTAttr->nTextFontFamily ); - if ( pFontEntry ) - { - nFontType = pFontEntry->nFontType; - if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR ) - nTextColor = mpCGM->pElement->pTextBundle->GetColor(); - else - nTextColor = mpCGM->pElement->aTextBundle.GetColor(); - } - FontItalic eFontItalic = ITALIC_NONE; - if ( nFontType & 1 ) - eFontItalic = ITALIC_NORMAL; - aAny.setValue( &eFontItalic, ::getCppuType((const FontItalic*)0) ); - aPropSet->setPropertyValue( L"CharPosture", aAny ); - } - aAny <<= (sal_Int32)( (sal_Int32)nTextColor ); - aPropSet->setPropertyValue( L"CharColor", aAny ); - - awt::FontWeight eFontWeight = WEIGHT_NORMAL; - if ( nFontType & 2 ) - eFontWeight = WEIGHT_BOLD; - aAny.setValue( &eFontWeight, ::getCppuType((const awt::FontWeight*)0) ); - aPropSet->setPropertyValue( L"CharWeight", aAny ); - - if ( pTAttr->nTextAttribBits & 0x4000 ) - { - awt::FontUnderline eUnderline = UNDERLINE_SINGLE; - aAny.setValue( &eUnderline, ::getCppuType((const awt::FontUnderline*)0) ); - aPropSet->setPropertyValue( L"CharUnderline", aAny ); - } - } - } - pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = nPushedChar; - } - nTextOfs += pTAttr->nTextAttribCount; - } - while ( ( ( pTAttr = pTAttr->pNextAttribute ) != NULL ) ); - } - } - } - return ( nObjCount ) ? nObjCount : maXShapes->getCount(); -*/ } // --------------------------------------------------------------- diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx index 3431734a4573..15a8157e6e74 100644 --- a/filter/source/graphicfilter/icgm/bundles.cxx +++ b/filter/source/graphicfilter/icgm/bundles.cxx @@ -33,7 +33,6 @@ #include <vcl/salbtype.hxx> #include <tools/stream.hxx> -#include <tools/list.hxx> Bundle& Bundle::operator=( Bundle& rSource ) { diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index 11fd45cb5a39..b001e10375bd 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -49,7 +49,6 @@ // --------------------------------------------------------------- -class List; class Bundle; class Graphic; class SvStream; diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx index ed9793ffcd27..0ed8efbd4474 100644 --- a/filter/source/graphicfilter/icgm/class1.cxx +++ b/filter/source/graphicfilter/icgm/class1.cxx @@ -181,7 +181,7 @@ void CGM::ImplDoClass1() { memcpy( pBuf, mpSource, mnElementSize ); maDefRepList.Insert( pBuf, LIST_APPEND ); - maDefRepSizeList.Insert( (void*)mnElementSize, LIST_APPEND ); + maDefRepSizeList.Insert( (void*)(sal_uIntPtr)mnElementSize, LIST_APPEND ); } } mnParaSize = mnElementSize; diff --git a/filter/source/graphicfilter/icgm/main.hxx b/filter/source/graphicfilter/icgm/main.hxx index 7dd5cb18ba52..4b0bf2329b9a 100644 --- a/filter/source/graphicfilter/icgm/main.hxx +++ b/filter/source/graphicfilter/icgm/main.hxx @@ -54,7 +54,6 @@ #include <vcl/salbtype.hxx> #include <tools/stream.hxx> -#include <tools/list.hxx> #include "bundles.hxx" #include "bitmap.hxx" #include "elements.hxx" diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 0a8d7a3abbe4..1c09f0018118 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -226,13 +226,10 @@ void PCXReader::ImplReadHeader() void PCXReader::ImplReadBody() { BYTE *pPlane[ 4 ], * pDest, * pSource1, * pSource2, * pSource3, *pSource4; - ULONG i, nx, ny, np, nCount, nUsedLineSize, nLineSize, nPercent; + ULONG i, nx, ny, np, nCount, nPercent; ULONG nLastPercent = 0; BYTE nDat = 0, nCol = 0; - nUsedLineSize = (ULONG)( ( ( nWidth * (ULONG)nDestBitsPerPixel ) + 7 ) >> 3 ); - nLineSize = ( nUsedLineSize + 3 ) & 0xfffc; - for( np = 0; np < nPlanes; np++ ) pPlane[ np ] = new BYTE[ nBytesPerPlaneLin ]; diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 3d39ab7f3498..f7cd1b1e3734 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -339,6 +339,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -361,6 +364,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -388,6 +394,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -408,6 +417,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -441,6 +453,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -458,6 +473,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -484,6 +502,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -501,6 +522,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -529,6 +553,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } @@ -549,6 +576,9 @@ BOOL TGAReader::ImplReadBody() nXCount = 0; nY += nYAdd; nYCount++; + + if( nYCount >= mpFileHeader->nImageHeight ) + return false; // invalid picture } } } diff --git a/filter/source/msfilter/countryid.cxx b/filter/source/msfilter/countryid.cxx index 35fba0f64009..80ae81899e01 100644 --- a/filter/source/msfilter/countryid.cxx +++ b/filter/source/msfilter/countryid.cxx @@ -261,8 +261,6 @@ static const CountryEntry pTable[] = const CountryEntry * const pEnd = pTable + SAL_N_ELEMENTS( pTable ); -// ---------------------------------------------------------------------------- - /** Predicate comparing a country ID with the member of a CountryEntry. */ struct CountryEntryPred_Country { @@ -275,8 +273,6 @@ struct CountryEntryPred_Country { return rCmp.meCountry == meCountry; } }; -// ---------------------------------------------------------------------------- - /** Predicate comparing a language type with the member of a CountryEntry. Compares by primary language only, if the passed CountryEntry allows it @@ -299,8 +295,6 @@ inline bool CountryEntryPred_Language::operator()( const CountryEntry& rCmp ) co ((meLanguage & 0x03FF) == (rCmp.meLanguage & 0x03FF)); } -// ---------------------------------------------------------------------------- - } // namespace // Country ID <-> Language type conversion ==================================== @@ -336,10 +330,6 @@ LanguageType ConvertCountryToLanguage( CountryId eCountry ) return (pEntry != pEnd) ? pEntry->meLanguage : LANGUAGE_DONTKNOW; } -// ============================================================================ - } // namespace svx -// ============================================================================ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 062c5e52e606..b99a682539aa 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -99,8 +99,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -// --------------------------------------------------------------------------------------------- - EscherExContainer::EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance ) : rStrm ( rSt ) { @@ -137,8 +135,6 @@ EscherExAtom::~EscherExAtom() } } -// --------------------------------------------------------------------------------------------- - EscherExClientRecord_Base::~EscherExClientRecord_Base() { } @@ -147,8 +143,6 @@ EscherExClientAnchor_Base::~EscherExClientAnchor_Base() { } -// --------------------------------------------------------------------------------------------- - void EscherPropertyContainer::ImplInit() { nSortCount = 0; @@ -578,29 +572,6 @@ void EscherPropertyContainer::CreateTextProperties( if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) ) ) ) aAny >>= nBottom; -/* - if ( rObj.ImplGetPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextWritingMode")) ) ) - { - ::com::sun::star::text::WritingMode eMode; - rObj.GetUsrAny() >>= eMode; - switch (eMode) - { - case ::com::sun::star::text::WritingMode_TB_RL: - //Well if it so happens that we are fliped 180 we can use - //this instead. - if (rObj.GetAngle() == 18000) - eFlow = ESCHER_txflBtoT; - else - eFlow = ESCHER_txflTtoBA; - break; - case ::com::sun::star::text::WritingMode_RL_TB: - eDir = ESCHER_txdirRTL; - break; - } - } -*/ - ESCHER_AnchorText eAnchor = ESCHER_AnchorTop; ESCHER_WrapMode eWrapMode = ESCHER_WrapSquare; sal_uInt32 nTextAttr = 0x40004; // rotate text with shape @@ -1879,29 +1850,6 @@ sal_Bool EscherPropertyContainer::CreateConnectorProperties( aAny >>= aShapeA; if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeEndConnection ) ) aAny >>= aShapeB; -/* - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine1Delta" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine2Delta" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeLine3Delta" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode1HorzDist" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode1VertDist" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode2HorzDist" ) ) ) ) - { - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "EdgeNode2VertDist" ) ) ) ) - { - } -*/ rSolverContainer.AddConnector( rXShape, aStartPoint, aShapeA, aEndPoint, aShapeB ); switch ( eCt ) { @@ -1986,8 +1934,6 @@ sal_Bool EscherPropertyContainer::CreateShadowProperties( return bHasShadow; } -// --------------------------------------------------------------------------------------------- - sal_Int32 GetValueForEnhancedCustomShapeParameter( const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, const std::vector< sal_Int32 >& rEquationOrder ) { sal_Int32 nValue = 0; @@ -2013,14 +1959,6 @@ sal_Int32 GetValueForEnhancedCustomShapeParameter( const com::sun::star::drawing } break; -/* not sure if it is allowed to set following values -(but they are not yet used) - case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT : - case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM : - case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT : - case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP : - case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT : -*/ } return nValue; } @@ -2156,7 +2094,6 @@ sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShap && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_SEGMENTS ) && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_STRETCHX ) && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_STRETCHY ) -// && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_HANDLES ) && pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_TEXTFRAMES ) ) bIsDefaultObject = sal_True; } @@ -3117,7 +3054,6 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT const rtl::OUString sMirroredY ( RTL_CONSTASCII_USTRINGPARAM( "MirroredY" ) ); const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) ); const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) ); - // const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) ); const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) ); const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) ); const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) ); @@ -3173,20 +3109,6 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT nFlags |= 8; } } - /* seems not to be used. - else if ( rPropVal.Name.equals( sMap ) ) - { - com::sun::star::drawing::EnhancedCustomShapeParameterPair aMap; - if ( rPropVal.Value >>= aMap ) - { - if ( GetValueForEnhancedCustomShapeHandleParameter( nXMap, aMap.First ) ) - nFlags |= 0x800; - if ( GetValueForEnhancedCustomShapeHandleParameter( nYMap, aMap.Second ) ) - nFlags |= 0x1000; - nFlags |= 0x10; - } - } - */ else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) ) { nYRangeMin = (sal_Int32)0xff4c0000; // the range of angles seems to be a not @@ -3304,8 +3226,6 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT } } -// --------------------------------------------------------------------------------------------- - MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, rtl::OUString& rShapeType ) { MSO_SPT eShapeType = mso_sptNil; @@ -3357,22 +3277,16 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi return GetCustomShapeType( rXShape, nMirrorFlags, aShapeType ); } -// --------------------------------------------------------------------------------------------- - EscherPersistTable::EscherPersistTable() { } -// --------------------------------------------------------------------------------------------- - EscherPersistTable::~EscherPersistTable() { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) delete (EscherPersistEntry*)pPtr; } -// --------------------------------------------------------------------------------------------- - BOOL EscherPersistTable::PtIsID( UINT32 nID ) { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) @@ -3383,30 +3297,23 @@ BOOL EscherPersistTable::PtIsID( UINT32 nID ) return FALSE; } -// --------------------------------------------------------------------------------------------- - void EscherPersistTable::PtInsert( UINT32 nID, UINT32 nOfs ) { maPersistTable.Insert( new EscherPersistEntry( nID, nOfs ) ); } -// --------------------------------------------------------------------------------------------- - UINT32 EscherPersistTable::PtDelete( UINT32 nID ) { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) { if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) { -// UINT32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset; delete (EscherPersistEntry*) maPersistTable.Remove(); } } return 0; } -// --------------------------------------------------------------------------------------------- - UINT32 EscherPersistTable::PtGetOffsetByID( UINT32 nID ) { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) @@ -3417,8 +3324,6 @@ UINT32 EscherPersistTable::PtGetOffsetByID( UINT32 nID ) return 0; }; -// --------------------------------------------------------------------------------------------- - UINT32 EscherPersistTable::PtReplace( UINT32 nID, UINT32 nOfs ) { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) @@ -3433,8 +3338,6 @@ UINT32 EscherPersistTable::PtReplace( UINT32 nID, UINT32 nOfs ) return 0; } -// --------------------------------------------------------------------------------------------- - UINT32 EscherPersistTable::PtReplaceOrInsert( UINT32 nID, UINT32 nOfs ) { for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) @@ -3488,8 +3391,6 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue( return bRetValue; } -// --------------------------------------------------------------------------------------------- - ::com::sun::star::beans::PropertyState EscherPropertyValueHelper::GetPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const String& rPropertyName ) @@ -3504,15 +3405,10 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue( } catch( ::com::sun::star::uno::Exception& ) { - //... } return eRetValue; } -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- - EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject& rObject, const ByteString& rId, const GraphicAttr* pGraphicAttr ) : mnPictureOffset ( nPictureOffset ), @@ -3581,8 +3477,6 @@ EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject } }; -// --------------------------------------------------------------------------------------------- - void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize ) { sal_uInt32 nPictureOffset = ( bWritePictureOffset ) ? mnPictureOffset : 0; @@ -3609,14 +3503,10 @@ void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffse << (sal_uInt32)0; } -// --------------------------------------------------------------------------------------------- - EscherBlibEntry::~EscherBlibEntry() { }; -// --------------------------------------------------------------------------------------------- - BOOL EscherBlibEntry::operator==( const EscherBlibEntry& rEscherBlibEntry ) const { for ( int i = 0; i < 3; i++ ) @@ -3627,10 +3517,6 @@ BOOL EscherBlibEntry::operator==( const EscherBlibEntry& rEscherBlibEntry ) cons return TRUE; } -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- - EscherGraphicProvider::EscherGraphicProvider( sal_uInt32 nFlags ) : mnFlags ( nFlags ), mpBlibEntrys ( NULL ), @@ -3836,7 +3722,6 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteSt { sal_uInt32 nErrCode; if ( !aGraphic.IsAnimated() ) -// !EMF nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG : CVT_WMF ); nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG : CVT_EMF ); else { // to store a animation, a gif has to be included into the msOG chunk of a png #I5583# @@ -3865,7 +3750,6 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteSt } if ( nErrCode == ERRCODE_NONE ) { -// !EMF p_EscherBlibEntry->meBlibType = ( eGraphicType == GRAPHIC_BITMAP ) ? PNG : WMF; p_EscherBlibEntry->meBlibType = ( eGraphicType == GRAPHIC_BITMAP ) ? PNG : EMF; aStream.Seek( STREAM_SEEK_TO_END ); p_EscherBlibEntry->mnSize = aStream.Tell(); @@ -3982,10 +3866,6 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const ByteSt return nBlibId; } -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- - struct EscherConnectorRule { sal_uInt32 nRuleId; @@ -4342,8 +4222,6 @@ void EscherSolverContainer::WriteSolver( SvStream& rStrm ) } } -// --------------------------------------------------------------------------------------------- - EscherExGlobal::EscherExGlobal( sal_uInt32 nGraphicProvFlags ) : EscherGraphicProvider( nGraphicProvFlags ), mpPicStrm( 0 ), @@ -4372,6 +4250,10 @@ sal_uInt32 EscherExGlobal::GenerateDrawingId() sal_uInt32 EscherExGlobal::GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr ) { // drawing identifier is one-based + // make sure the drawing is valid (bnc#656503) + if ( nDrawingId == 0 ) + return 0; + // create index from the identifier size_t nDrawingIdx = nDrawingId - 1; OSL_ENSURE( nDrawingIdx < maDrawingInfos.size(), "EscherExGlobal::GenerateShapeId - invalid drawing ID" ); if( nDrawingIdx >= maDrawingInfos.size() ) @@ -4464,14 +4346,12 @@ SvStream* EscherExGlobal::ImplQueryPictureStream() return 0; } -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- -// --------------------------------------------------------------------------------------------- - EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ) : mxGlobal ( rxGlobal ), mpOutStrm ( &rOutStrm ), + mnCurrentDg ( 0 ), + mnGroupLevel ( 0 ), mnHellLayerId ( USHRT_MAX ), @@ -4486,8 +4366,6 @@ EscherEx::~EscherEx() { } -// --------------------------------------------------------------------------------------------- - void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ ) { if ( mxGlobal->HasDggContainer() ) @@ -4523,8 +4401,6 @@ void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ ) } } -// --------------------------------------------------------------------------------------------- - void EscherEx::InsertAtCurrentPos( UINT32 nBytes, bool bExpandEndOfAtom ) { UINT32 nSize, nType, nSource, nBufSize, nToCopy, nCurPos = mpOutStrm->Tell(); @@ -4584,8 +4460,6 @@ void EscherEx::InsertAtCurrentPos( UINT32 nBytes, bool bExpandEndOfAtom ) mpOutStrm->Seek( nCurPos ); } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::SeekBehindRecHeader( UINT16 nRecType ) { UINT32 nOldPos, nStreamEnd, nType, nSize; @@ -4605,8 +4479,6 @@ BOOL EscherEx::SeekBehindRecHeader( UINT16 nRecType ) return FALSE; } -// --------------------------------------------------------------------------------------------- - void EscherEx::InsertPersistOffset( UINT32 nKey, UINT32 nOffset ) { PtInsert( ESCHER_Persist_PrivateEntry | nKey, nOffset ); @@ -4622,8 +4494,6 @@ UINT32 EscherEx::GetPersistOffset( UINT32 nKey ) return PtGetOffsetByID( ESCHER_Persist_PrivateEntry | nKey ); } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::DoSeek( UINT32 nKey ) { UINT32 nPos = PtGetOffsetByID( nKey ); @@ -4638,15 +4508,11 @@ BOOL EscherEx::DoSeek( UINT32 nKey ) return TRUE; } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::SeekToPersistOffset( UINT32 nKey ) { return DoSeek( ESCHER_Persist_PrivateEntry | nKey ); } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::InsertAtPersistOffset( UINT32 nKey, UINT32 nValue ) { UINT32 nOldPos = mpOutStrm->Tell(); @@ -4659,8 +4525,6 @@ BOOL EscherEx::InsertAtPersistOffset( UINT32 nKey, UINT32 nValue ) return bRetValue; } -// --------------------------------------------------------------------------------------------- - void EscherEx::OpenContainer( UINT16 nEscherContainer, int nRecInstance ) { *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | 0xf ) << nEscherContainer << (UINT32)0; @@ -4717,8 +4581,6 @@ void EscherEx::OpenContainer( UINT16 nEscherContainer, int nRecInstance ) } } -// --------------------------------------------------------------------------------------------- - void EscherEx::CloseContainer() { sal_uInt32 nSize, nPos = mpOutStrm->Tell(); @@ -4757,16 +4619,12 @@ void EscherEx::CloseContainer() mpOutStrm->Seek( nPos ); } -// --------------------------------------------------------------------------------------------- - void EscherEx::BeginAtom() { mnCountOfs = mpOutStrm->Tell(); *mpOutStrm << (UINT32)0 << (UINT32)0; // record header wird spaeter geschrieben } -// --------------------------------------------------------------------------------------------- - void EscherEx::EndAtom( UINT16 nRecType, int nRecVersion, int nRecInstance ) { UINT32 nOldPos = mpOutStrm->Tell(); @@ -4776,15 +4634,11 @@ void EscherEx::EndAtom( UINT16 nRecType, int nRecVersion, int nRecInstance ) mpOutStrm->Seek( nOldPos ); } -// --------------------------------------------------------------------------------------------- - void EscherEx::AddAtom( UINT32 nAtomSize, UINT16 nRecType, int nRecVersion, int nRecInstance ) { *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | ( nRecVersion & 0xf ) ) << nRecType << nAtomSize; } -// --------------------------------------------------------------------------------------------- - void EscherEx::AddChildAnchor( const Rectangle& rRect ) { AddAtom( 16, ESCHER_ChildAnchor ); @@ -4794,8 +4648,6 @@ void EscherEx::AddChildAnchor( const Rectangle& rRect ) << (sal_Int32)rRect.Bottom(); } -// --------------------------------------------------------------------------------------------- - void EscherEx::AddClientAnchor( const Rectangle& rRect ) { AddAtom( 8, ESCHER_ClientAnchor ); @@ -4805,15 +4657,11 @@ void EscherEx::AddClientAnchor( const Rectangle& rRect ) << (sal_Int16)( rRect.GetHeight() + rRect.Top() ); } -// --------------------------------------------------------------------------------------------- - EscherExHostAppData* EscherEx::EnterAdditionalTextGroup() { return NULL; } -// --------------------------------------------------------------------------------------------- - UINT32 EscherEx::EnterGroup( const String& rShapeName, const Rectangle* pBoundRect ) { Rectangle aRect; @@ -4867,8 +4715,6 @@ UINT32 EscherEx::EnterGroup( const Rectangle* pBoundRect ) return EnterGroup( String::EmptyString(), pBoundRect ); } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::SetGroupSnapRect( UINT32 nGroupLevel, const Rectangle& rRect ) { BOOL bRetValue = FALSE; @@ -4887,8 +4733,6 @@ BOOL EscherEx::SetGroupSnapRect( UINT32 nGroupLevel, const Rectangle& rRect ) return bRetValue; } -// --------------------------------------------------------------------------------------------- - BOOL EscherEx::SetGroupLogicRect( UINT32 nGroupLevel, const Rectangle& rRect ) { BOOL bRetValue = FALSE; @@ -4904,8 +4748,6 @@ BOOL EscherEx::SetGroupLogicRect( UINT32 nGroupLevel, const Rectangle& rRect ) return bRetValue; } -// --------------------------------------------------------------------------------------------- - void EscherEx::LeaveGroup() { --mnGroupLevel; @@ -4914,8 +4756,6 @@ void EscherEx::LeaveGroup() CloseContainer(); } -// --------------------------------------------------------------------------------------------- - void EscherEx::AddShape( UINT32 nShpInstance, UINT32 nFlags, UINT32 nShapeID ) { AddAtom( 8, ESCHER_Sp, 2, nShpInstance ); @@ -4931,15 +4771,11 @@ void EscherEx::AddShape( UINT32 nShpInstance, UINT32 nFlags, UINT32 nShapeID ) *mpOutStrm << nShapeID << nFlags; } -// --------------------------------------------------------------------------------------------- - void EscherEx::Commit( EscherPropertyContainer& rProps, const Rectangle& ) { rProps.Commit( GetStream() ); } -// --------------------------------------------------------------------------------------------- - UINT32 EscherEx::GetColor( const UINT32 nSOColor, BOOL bSwap ) { if ( bSwap ) @@ -4953,8 +4789,6 @@ UINT32 EscherEx::GetColor( const UINT32 nSOColor, BOOL bSwap ) return nSOColor & 0xffffff; } -// --------------------------------------------------------------------------------------------- - UINT32 EscherEx::GetColor( const Color& rSOColor, BOOL bSwap ) { UINT32 nColor = ( rSOColor.GetRed() << 16 ); @@ -4967,6 +4801,4 @@ UINT32 EscherEx::GetColor( const Color& rSOColor, BOOL bSwap ) return nColor; } -// --------------------------------------------------------------------------------------------- - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 4e4167e2d0c6..b77da0bb504e 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -68,15 +68,12 @@ using namespace ::com::sun::star::style; #define EES_MAP_FRACTION 1440 // 1440 dpi -// =================================================================== - ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx ) : mpEscherEx ( &rEx ), maMapModeSrc ( MAP_100TH_MM ), // PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi maMapModeDest( MAP_INCH, Point(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) ), -// mXStatusIndicator ( rXStatInd ), mpPicStrm ( NULL ), mpHostAppData ( NULL ), mnPagesWritten ( 0 ), @@ -88,16 +85,11 @@ ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx ) } -// ------------------------------------------------------------------- - Point ImplEESdrWriter::ImplMapPoint( const Point& rPoint ) { return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest ); } - -// ------------------------------------------------------------------- - Size ImplEESdrWriter::ImplMapSize( const Size& rSize ) { Size aRetSize( OutputDevice::LogicToLogic( rSize, maMapModeSrc, maMapModeDest ) ); @@ -109,8 +101,6 @@ Size ImplEESdrWriter::ImplMapSize( const Size& rSize ) return aRetSize; } -// ------------------------------------------------------------------- - void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt ) { INT32 nAngle = rObj.GetAngle(); @@ -222,14 +212,6 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, ::cppu::any2bool( rObj.GetUsrAny() ) ) || rObj.GetType().EqualsAscii( "drawing.Measure" ) || rObj.GetType().EqualsAscii( "drawing.Caption" ) ) { -/* - if( rObj.ImplGetPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BoundRect")) ) ) - { - ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)rObj.GetUsrAny().getValue() ); - rObj.SetRect( ImplMapPoint( Point( aRect.X, aRect.Y ) ), - ImplMapSize( Size( aRect.Width, aRect.Height ) ) ); - } -*/ rObj.SetType( String( RTL_CONSTASCII_STRINGPARAM( "drawing.dontknow" ), RTL_TEXTENCODING_MS_1252 )); @@ -446,86 +428,6 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, } else if ( rObj.GetType().EqualsAscii( "drawing.Measure" )) { -/* - if ( ImplGetPropertyValue( L"MeasureKind" ) ) - { - mpEscherEx->EnterGroup( &maRect ); - mpEscherEx->OpenContainer( ESCHER_SpContainer ); - ImplWriteAny( ANY_FLAGS_LINE, FALSE ); - UINT32 nFlags = 0xa00; // Flags: Connector | HasSpt - if ( maRect.Top() > maRect.Bottom() ) - nFlags |= 0x80; // Flags: VertMirror - if ( maRect.Left() > maRect.Right() ) - nFlags |= 0x40; // Flags: HorzMirror - - ADD_SHAPE( ESCHER_ShpInst_Line, nFlags ); - aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex ); - aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False ); - mpEscherEx->EndCount( ESCHER_OPT, 3 ); - maRect.Justify(); - mpEscherEx->AddClientAnchor( maRect ); - mpEscherEx->CloseContainer(); // ESCHER_SpContainer - - if ( ImplGetPropertyValue( L"MeasureTextHorizontalPosition" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextVerticalPosition" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureLineDistance" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureHelpLineOverhang" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureHelpLineDistance" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureHelpLine1Length" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureHelpLine2Length" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureBelowReferenceEdge" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextRotate90" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextUpsideDown" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureOverhang" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureUnit" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureScale" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureShowUnit" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureFormatString" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextAutoAngle" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextAutoAngleView" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextIsFixedAngle" ) ) - { - } - if ( ImplGetPropertyValue( L"MeasureTextFixedAngle" ) ) - { - } - mpEscherEx->LeaveGroup(); - } -*/ break; } else if ( rObj.GetType().EqualsAscii( "drawing.Line" )) @@ -693,7 +595,6 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 ); aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 ); aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash,0x00080008 ); -// aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured,0x00020000 ); aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080000 ); } aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 ); @@ -871,8 +772,6 @@ void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj, } -// ------------------------------------------------------------------- - UINT32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShape >& rShape, const Rectangle* pBoundRect ) { @@ -883,8 +782,6 @@ UINT32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShape >& } -// ------------------------------------------------------------------- - BOOL ImplEESdrWriter::ImplInitPageValues() { mnIndices = 0; @@ -895,9 +792,6 @@ BOOL ImplEESdrWriter::ImplInitPageValues() return TRUE; } - -// ------------------------------------------------------------------- - void ImplEESdrWriter::ImplWritePage( EscherSolverContainer& rSolverContainer, ImplEESdrPageType ePageType, BOOL /* bBackGround */ ) @@ -928,8 +822,6 @@ void ImplEESdrWriter::ImplWritePage( mnPagesWritten++; } -// =================================================================== - ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx ) : ImplEESdrWriter( rEx ), @@ -939,8 +831,6 @@ ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx ) } -// ------------------------------------------------------------------- - ImplEscherExSdr::~ImplEscherExSdr() { DBG_ASSERT( !mpSolverContainer, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" ); @@ -948,8 +838,6 @@ ImplEscherExSdr::~ImplEscherExSdr() } -// ------------------------------------------------------------------- - bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage ) { do @@ -961,8 +849,6 @@ bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage ) ImplFlushSolverContainer(); mpSdrPage = NULL; - // why not declare a const parameter if the object will not be modified? -// mXDrawPage = pSvxDrawPage = new SvxDrawPage( (SdrPage*) &rPage ); mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( (SdrPage*) &rPage ); mXShapes = Reference< XShapes >::query( mXDrawPage ); if ( !mXShapes.is() ) @@ -982,8 +868,6 @@ bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage ) return false; } -// ------------------------------------------------------------------- - bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes ) { // eventually write SolverContainer of current page, deletes the Solver @@ -1003,8 +887,6 @@ bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes ) return true; } -// ------------------------------------------------------------------- - void ImplEscherExSdr::ImplExitPage() { // close all groups before the solver container is written @@ -1016,8 +898,6 @@ void ImplEscherExSdr::ImplExitPage() } -// ------------------------------------------------------------------- - void ImplEscherExSdr::ImplFlushSolverContainer() { if ( mpSolverContainer ) @@ -1029,8 +909,6 @@ void ImplEscherExSdr::ImplFlushSolverContainer() } -// ------------------------------------------------------------------- - void ImplEscherExSdr::ImplWriteCurrentPage() { DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" ); @@ -1039,8 +917,6 @@ void ImplEscherExSdr::ImplWriteCurrentPage() } -// ------------------------------------------------------------------- - UINT32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj ) { DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" ); @@ -1048,24 +924,18 @@ UINT32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj ) } -// =================================================================== - void EscherEx::AddSdrPage( const SdrPage& rPage ) { if ( mpImplEscherExSdr->ImplInitPage( rPage ) ) mpImplEscherExSdr->ImplWriteCurrentPage(); } -// ------------------------------------------------------------------- - void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes ) { if ( mpImplEscherExSdr->ImplInitUnoShapes( rxShapes ) ) mpImplEscherExSdr->ImplWriteCurrentPage(); } -// ------------------------------------------------------------------- - UINT32 EscherEx::AddSdrObject( const SdrObject& rObj ) { ImplEESdrObject aObj( *mpImplEscherExSdr, rObj ); @@ -1075,48 +945,36 @@ UINT32 EscherEx::AddSdrObject( const SdrObject& rObj ) } -// ------------------------------------------------------------------- - void EscherEx::EndSdrObjectPage() { mpImplEscherExSdr->ImplExitPage(); } -// ------------------------------------------------------------------- - EscherExHostAppData* EscherEx::StartShape( const Reference< XShape >& /* rShape */, const Rectangle* /*pChildAnchor*/ ) { return NULL; } -// ------------------------------------------------------------------- - void EscherEx::EndShape( UINT16 /* nShapeType */, UINT32 /* nShapeID */ ) { } -// ------------------------------------------------------------------- - UINT32 EscherEx::QueryTextID( const Reference< XShape >&, UINT32 ) { return 0; } -// ------------------------------------------------------------------- // add an dummy rectangle shape into the escher stream UINT32 EscherEx::AddDummyShape() { OpenContainer( ESCHER_SpContainer ); UINT32 nShapeID = GenerateShapeId(); AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nShapeID ); -//?? aSolverContainer.AddShape( mXShape, nShapeID ); CloseContainer(); return nShapeID; } -// ------------------------------------------------------------------- - // static const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape ) { @@ -1132,8 +990,6 @@ const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape ) } -// ------------------------------------------------------------------- - ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr& rEx, const SdrObject& rObj ) : mnShapeId( 0 ), @@ -1199,7 +1055,6 @@ void ImplEESdrObject::Init( ImplEESdrWriter& rEx ) } } -//BOOL ImplEESdrObject::ImplGetPropertyValue( const OUString& rString ) BOOL ImplEESdrObject::ImplGetPropertyValue( const sal_Unicode* rString ) { BOOL bRetValue = FALSE; diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx index 12a90771da1a..c7612b1b2aa3 100644 --- a/filter/source/msfilter/eschesdo.hxx +++ b/filter/source/msfilter/eschesdo.hxx @@ -62,9 +62,12 @@ public: ~ImplEESdrObject(); BOOL ImplGetPropertyValue( const sal_Unicode* pString ); + BOOL ImplGetPropertyValue( const rtl::OUString& rString ) { return ImplGetPropertyValue(rString.getStr()); } INT32 ImplGetInt32PropertyValue( const sal_Unicode* pStr, UINT32 nDef = 0 ) { return ImplGetPropertyValue( pStr ) ? *(INT32*)mAny.getValue() : nDef; } + INT32 ImplGetInt32PropertyValue( const rtl::OUString& rStr, UINT32 nDef = 0 ) + { return ImplGetInt32PropertyValue(rStr.getStr(), nDef); } const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& GetShapeRef() const { return mXShape; } const ::com::sun::star::uno::Any& GetUsrAny() const { return mAny; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 0a8b3d85e63f..51eda7ceb6c0 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -307,7 +307,7 @@ void Impl_OlePres::Write( SvStream & rStm ) } else { - DBG_ERROR( "unknown format" ); + OSL_FAIL( "unknown format" ); } ULONG nEndPos = rStm.Tell(); rStm.Seek( nPos ); @@ -744,8 +744,6 @@ void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const } } } -// if ( pDefaultPropSet ) -// Merge( *( pDefaultPropSet ) ); ( (DffPropertyReader*) this )->mnFix16Angle = Fix16ToAngle( GetPropertyValue( DFF_Prop_Rotation, 0 ) ); @@ -1605,9 +1603,6 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetHeight() / 2540.0 ) * 90.0 ) ); if ( aBitmapSizePixel.Width() && aBitmapSizePixel.Height() && ( aBitmapSizePixel.Width() <= 1024 ) && ( aBitmapSizePixel.Height() <= 1024 ) ) { -// std::vector< QuantErr > aQuantErrCurrScan( aBitmapSizePixel.Width() + 1 ); -// std::vector< QuantErr > aQuantErrNextScan( aBitmapSizePixel.Width() + 1 ); - double fFocusX = rManager.GetPropertyValue( DFF_Prop_fillToRight, 0 ) / 65536.0; double fFocusY = rManager.GetPropertyValue( DFF_Prop_fillToBottom, 0 ) / 65536.0; @@ -1697,28 +1692,6 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream sal_Int16 nRed = static_cast< sal_Int16 >( fRed + 0.5 ); sal_Int16 nGreen = static_cast< sal_Int16 >( fGreen + 0.5 ); sal_Int16 nBlue = static_cast< sal_Int16 >( fBlue + 0.5 ); -/* - double fErr = fRed - nRed; - aQuantErrCurrScan[ nX + 1 ].fRed += 7.0 * fErr / 16.0; - if ( nX ) - aQuantErrNextScan[ nX - 1 ].fRed += 3.0 * fErr / 16.0; - aQuantErrNextScan[ nX ].fRed += 5.0 * fErr / 16.0; - aQuantErrNextScan[ nX + 1 ].fRed += 1.0 * fErr / 16.0; - - fErr = fGreen - nGreen; - aQuantErrCurrScan[ nX + 1 ].fGreen += 7.0 * fErr / 16.0; - if ( nX ) - aQuantErrNextScan[ nX - 1 ].fGreen += 3.0 * fErr / 16.0; - aQuantErrNextScan[ nX ].fGreen += 5.0 * fErr / 16.0; - aQuantErrNextScan[ nX + 1 ].fGreen += 1.0 * fErr / 16.0; - - fErr = fBlue - nBlue; - aQuantErrCurrScan[ nX + 1 ].fBlue += 7.0 * fErr / 16.0; - if ( nX ) - aQuantErrNextScan[ nX - 1 ].fBlue += 3.0 * fErr / 16.0; - aQuantErrNextScan[ nX ].fBlue += 5.0 * fErr / 16.0; - aQuantErrNextScan[ nX + 1 ].fBlue += 1.0 * fErr / 16.0; -*/ if ( nRed < 0 ) nRed = 0; if ( nRed > 255 ) @@ -1734,15 +1707,6 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream pAcc->SetPixel( nY, nX, BitmapColor( static_cast< sal_Int8 >( nRed ), static_cast< sal_Int8 >( nGreen ), static_cast< sal_Int8 >( nBlue ) ) ); } -/* - aQuantErrCurrScan.swap( aQuantErrNextScan ); - std::vector< QuantErr >::iterator aIter( aQuantErrNextScan.begin() ); - while( aIter != aQuantErrNextScan.end() ) - { - *aIter = QuantErr(); - aIter++; - } -*/ } aBitmap.ReleaseAccess( pAcc ); @@ -1969,7 +1933,6 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const { -// sal_uInt32 nTextFlags = aTextObj.GetTextFlags(); sal_Bool bVerticalText = sal_False; sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ) / 360; // 0.25 cm (emu) sal_Int32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 25 * 3600 ) / 360; // 0.25 cm (emu) @@ -2098,9 +2061,6 @@ void DffPropertyReader::ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const rSet.Put( SdrTextWordWrapItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_True : sal_False ) ); rSet.Put( SdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0 ) ); - -// rSet.Put( SdrTextAutoGrowWidthItem( (MSO_WrapMode)GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) != mso_wrapNone ? sal_False : sal_True ) ); -// rSet.Put( SdrTextAutoGrowHeightItem( ( GetPropertyValue( DFF_Prop_FitTextToShape ) & 2 ) != 0 ) ); } void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const @@ -2130,30 +2090,6 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aProp.Value <<= EnhancedCustomShapeTypeNames::Get( rObjData.eShapeType ); aPropVec.push_back( aProp ); -/* - ///////////////// - // "MirroredX" // - ///////////////// - if ( nShapeFlags & SP_FFLIPH ) - { - const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) ); - sal_Bool bMirroredX = sal_True; - aProp.Name = sMirroredX; - aProp.Value <<= bMirroredX; - aPropVec.push_back( aProp ); - } - ///////////////// - // "MirroredY" // - ///////////////// - if ( nShapeFlags & SP_FFLIPV ) - { - const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) ); - sal_Bool bMirroredY = sal_True; - aProp.Name = sMirroredY; - aProp.Value <<= bMirroredY; - aPropVec.push_back( aProp ); - } -*/ /////////////// // "ViewBox" // /////////////// @@ -2179,7 +2115,6 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt { sal_Int32 nTextRotateAngle = 0; MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF ); -/* sal_Int32 nFontDirection = GetPropertyValue( DFF_Prop_cdirFont, mso_cdir0 ); */ if ( eTextFlow == mso_txflBtoT ) // Bottom to Top non-@, unten -> oben nTextRotateAngle += 90; @@ -2331,47 +2266,12 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt aExtrusionPropVec.push_back( aProp ); } -/* LockRotationCenter, OrientationAngle and Orientation needs to be converted to use the properties AngleX, AngleY and RotationAngle instead. - // "LockRotationCenter" - const rtl::OUString sExtrusionLockRotationCenter( RTL_CONSTASCII_USTRINGPARAM ( "LockRotationCenter" ) ); - sal_Bool bExtrusionLockRotationCenter = ( GetPropertyValue( DFF_Prop_fc3DFillHarsh ) & 16 ) != 0; - aProp.Name = sExtrusionLockRotationCenter; - aProp.Value <<= bExtrusionLockRotationCenter; - aExtrusionPropVec.push_back( aProp ); - - // "Orientation" - if ( IsProperty( DFF_Prop_c3DRotationAxisX ) || IsProperty( DFF_Prop_c3DRotationAxisY ) || IsProperty( DFF_Prop_c3DRotationAxisZ ) ) - { - double fRotX = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisX, 100 )); - double fRotY = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisY, 0 )); - double fRotZ = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAxisZ, 0 )); - ::com::sun::star::drawing::Direction3D aExtrusionDirection( fRotX, fRotY, fRotZ ); - const rtl::OUString sExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM ( "Orientation" ) ); - aProp.Name = sExtrusionDirection; - aProp.Value <<= aExtrusionDirection; - aExtrusionPropVec.push_back( aProp ); - } - // "OrientationAngle" in Grad - if ( IsProperty( DFF_Prop_c3DRotationAngle ) ) - { - const rtl::OUString sExtrusionOrientationAngle( RTL_CONSTASCII_USTRINGPARAM ( "OrientationAngle" ) ); - double fOrientationAngle = (double)((sal_Int32)GetPropertyValue( DFF_Prop_c3DRotationAngle )) / 65536.0; - aProp.Name = sExtrusionOrientationAngle; - aProp.Value <<= fOrientationAngle; - aExtrusionPropVec.push_back( aProp ); - } -*/ - // "Metal" const rtl::OUString sExtrusionMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) ); sal_Bool bExtrusionMetal = ( GetPropertyValue( DFF_Prop_fc3DLightFace ) & 4 ) != 0; aProp.Name = sExtrusionMetal; aProp.Value <<= bExtrusionMetal; aExtrusionPropVec.push_back( aProp ); -// if ( IsProperty( DFF_Prop_c3DExtrudePlane ) ) -// { -// UPS -// } // "ShadeMode" if ( IsProperty( DFF_Prop_c3DRenderMode ) ) { @@ -3171,8 +3071,6 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const { -// MapUnit eMap( rManager.GetModel()->GetScaleUnit() ); - sal_Bool bHasShadow = sal_False; for ( void* pDummy = ((DffPropertyReader*)this)->First(); pDummy; pDummy = ((DffPropertyReader*)this)->Next() ) @@ -3195,8 +3093,6 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const rSet.Put( SvxUnderlineItem( nContent ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) ); if ( nContent & 0x40 ) rSet.Put(SvxShadowedItem( nContent != 0, EE_CHAR_SHADOW ) ); -// if ( nContent & 0x02 ) -// rSet.Put( SvxCaseMapItem( nContent ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) ); if ( nContent & 0x01 ) rSet.Put( SvxCrossedOutItem( nContent ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) ); } @@ -3285,7 +3181,6 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const case mso_fillShadeScale : case mso_fillShadeTitle : break; - // case mso_fillBackground : default: nFillFlags &=~0x10; // no fillstyle used break; @@ -3812,7 +3707,6 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); -// UINT16 nParameter = (BYTE)( nColorCode >> 16); // SJ: nice compiler optimization bug on windows, though downcasting UINT16 nParameter = sal_uInt16(( nColorCode >> 16 ) & 0x00ff); // the HiByte of nParameter is not zero, an exclusive AND is helping :o UINT16 nFunctionBits = (UINT16)( ( nColorCode & 0x00000f00 ) >> 8 ); UINT16 nAdditionalFlags = (UINT16)( ( nColorCode & 0x0000f000) >> 8 ); @@ -4104,11 +3998,8 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const ULONG nRecEnd=aTextHd.GetRecEndFilePos(); DffRecordHeader aHd; String aText; -// UINT32 nInvent=pText->GetObjInventor(); -// UINT16 nIdent=pText->GetObjIdentifier(); SdrOutliner& rOutliner=pText->ImpGetDrawOutliner(); -// sal_Int16 nMinDepth = rOutliner.GetMinDepth(); USHORT nOutlMode = rOutliner.GetMode(); { // Wohl 'nen kleiner Bug der EditEngine, das die @@ -4130,7 +4021,6 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const } rOutliner.Init( OUTLINERMODE_TEXTOBJECT ); -// ULONG nFilePosMerker=rSt.Tell(); //////////////////////////////////// // TextString und MetaChars lesen // //////////////////////////////////// @@ -4797,7 +4687,6 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r aRecHd2.SeekToEndOfRecord( rSt ); } - // pRet->NbcSetSnapRect( aGroupBound ); if ( nGroupRotateAngle ) { double a = nGroupRotateAngle * nPi180; @@ -4970,8 +4859,6 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ApplyAttributes( rSt, aSet, aObjData ); -// the com.sun.star.drawing.EnhancedCustomShapeEngine is default, so we do not need to set a hard attribute -// aSet.Put( SdrCustomShapeEngineItem( String::CreateFromAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) ) ); pRet = new SdrObjCustomShape(); pRet->SetModel( pSdrModel ); @@ -5116,7 +5003,6 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength(); XPolygon aXP( (sal_uInt16)nNumElemVert ); -// const EnhancedCustomShapeParameterPair* pTmp = seqCoordinates.getArray(); for ( nPtNum = 0; nPtNum < nNumElemVert; nPtNum++ ) { Point aP; @@ -5857,13 +5743,6 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, bTHASet = TRUE; } break; - /* - case mso_anchorTopBaseline: - case mso_anchorBottomBaseline: - case mso_anchorTopCenteredBaseline: - case mso_anchorBottomCenteredBaseline: - break; - */ default : break; } // Einsetzen @@ -6119,16 +5998,6 @@ void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const // Hilfs Deklarationen //--------------------------------------------------------------------------- -/*struct SvxMSDffBLIPInfo -> in's Header-File -{ - USHORT nBLIPType; // Art des BLIP: z.B. 6 fuer PNG - ULONG nFilePos; // Offset des BLIP im Daten-Stream - ULONG nBLIPSize; // Anzahl Bytes, die der BLIP im Stream einnimmt - SvxMSDffBLIPInfo(USHORT nBType, ULONG nFPos, ULONG nBSize): - nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){} -}; -*/ - SV_IMPL_PTRARR( SvxMSDffBLIPInfos, SvxMSDffBLIPInfo_Ptr ); SV_IMPL_PTRARR( SvxMSDffShapeOrders, SvxMSDffShapeOrder_Ptr ); @@ -6644,7 +6513,6 @@ BOOL SvxMSDffManager::GetShapeContainerData( SvStream& rSt, // wir wissen noch nicht, ob es eine TextBox ist MSO_SPT eShapeType = mso_sptNil; -// BOOL bIsTextBox = FALSE; // Shape analysieren // @@ -6669,9 +6537,7 @@ BOOL SvxMSDffManager::GetShapeContainerData( SvStream& rSt, USHORT nPropId; sal_uInt32 nPropVal; nLenShapePropTbl = nLength; -// UINT32 nPropCount = nInst; long nStartShapePropTbl = rSt.Tell(); -// UINT32 nComplexDataFilePos = nStartShapePropTbl + (nPropCount * 6); do { rSt >> nPropId @@ -7003,7 +6869,6 @@ BOOL SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, Rect pGrStream = pOut; } -//#define DBG_EXTRACTGRAPHICS #ifdef DBG_EXTRACTGRAPHICS static sal_Int32 nCount; diff --git a/filter/source/msfilter/msfiltertracer.cxx b/filter/source/msfilter/msfiltertracer.cxx index 46a91d45701a..08d9b6b3c2cd 100644 --- a/filter/source/msfilter/msfiltertracer.cxx +++ b/filter/source/msfilter/msfiltertracer.cxx @@ -44,10 +44,6 @@ #include <unotools/ucbstreamhelper.hxx> -// -------------- -// - Namespaces - -// -------------- - using namespace ::com::sun::star; MSFilterTracer::MSFilterTracer( const ::rtl::OUString& rConfigPath, uno::Sequence< beans::PropertyValue >* pConfigData ) : diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx index b4732b7bf4e0..9b4b3acbec98 100644 --- a/filter/source/msfilter/msocximex.cxx +++ b/filter/source/msfilter/msocximex.cxx @@ -440,7 +440,7 @@ bool readOCXNAME( OUString& sCName, SvStorageStream* pStream ) } -/* #110435# (DR, 2003-11-12) ** Import of Unicode strings in form controls ** +/* ** Import of Unicode strings in form controls ** Strings may be stored either as compressed or uncompressed Unicode character array. There are no encoded byte strings anywhere. @@ -1171,7 +1171,7 @@ class ContainerRecReader } else { - DBG_ERROR("Terminating import, unexpected error"); + OSL_FAIL("Terminating import, unexpected error"); return false; } } @@ -3855,7 +3855,7 @@ void OCX_MultiPage::ProcessControl(OCX_Control* pControl, SvStorageStream* /* pS else { OSL_TRACE("!!!! Unsupported Control 0x%x ", rec.nTypeIdent); - DBG_ERROR("MultiPage error expected Page control"); + OSL_FAIL("MultiPage error expected Page control"); } } @@ -3912,7 +3912,7 @@ sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference< // need to sort the controls according to the order of the ids for ( sal_Int32 index = 1 ; ( sCaptions.size() == idToPage.size() ) && itCtrlId != itCtrlId_end; ++itCtrlId, ++itCaption, ++index ) { - std::hash_map< sal_Int32, OCX_Page* >::iterator it = idToPage.find( *itCtrlId ); + boost::unordered_map< sal_Int32, OCX_Page* >::iterator it = idToPage.find( *itCtrlId ); if ( it != idToPage.end() ) { it->second->msTitle = *itCaption; @@ -4872,7 +4872,7 @@ void OCX_FontData::Import(uno::Reference< beans::XPropertySet > &rPropSet) rPropSet->setPropertyValue( WW8_ASCII2STR("FontStrikeout"), aTmp); } - // 2004-09-17: very strange way of storing font sizes... + // very strange way of storing font sizes... // 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135 // 8pt->165, 9pt->180, 10pt->195, 11pt->225, ... aTmp <<= sal_Int16( (nFontSize <= 30) ? 1 : ((nFontSize + 10) / 20) ); @@ -4918,7 +4918,7 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, if (nFontHeight) { nFlags |= 0x04; - // 2004-09-17: very strange way of storing font sizes: + // very strange way of storing font sizes: // 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135 // 8pt->165, 9pt->180, 10pt->195, 11pt->225, ... nFontSize = (nFontHeight == 1) ? 30 : (static_cast<sal_uInt32>((nFontHeight*4+1)/3)*15); @@ -6181,7 +6181,7 @@ bool OCX_ParentControl::createFromContainerRecord( const ContainerRecord& record break; default: OSL_TRACE( "**** Unknown control 0x%x", record.nTypeIdent ); - DBG_ERROR( "Unknown control"); + OSL_FAIL( "Unknown control"); return false; } pControl->sName = record.cName; diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx index abb5d680cc57..b0ec82904cb3 100644 --- a/filter/source/msfilter/msoleexp.cxx +++ b/filter/source/msfilter/msoleexp.cxx @@ -233,7 +233,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvSto catch( uno::Exception& ) { // TODO/LATER: Error handling - DBG_ERROR( "The object could not be exported!" ); + OSL_FAIL( "The object could not be exported!" ); } } else if( aOwnGlobalName != SvGlobalName() ) @@ -279,12 +279,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvSto aSize.Height = 5000; } - //Rectangle aVisArea = xSfxIPObj->GetVisArea( ASPECT_CONTENT ); sal_Int32 pRect[4]; - //pRect[0] = aVisArea.Left(); - //pRect[1] = aVisArea.Right(); - //pRect[2] = aVisArea.Top(); - //pRect[3] = aVisArea.Bottom(); pRect[0] = 0; pRect[1] = aSize.Width; pRect[2] = 0; @@ -328,14 +323,14 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvSto catch( uno::Exception& ) { // TODO/LATER: Error handling - DBG_ERROR( "The object could not be exported!" ); + OSL_FAIL( "The object could not be exported!" ); } } } } else { - DBG_ERROR("Own binary format inside own container document!"); + OSL_FAIL("Own binary format inside own container document!"); } } else diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index 2e11fbdd1423..28b094e103a5 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -1,4 +1,33 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Noel Power <noel.power@novell.com> + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Noel Power <noel.power@novell.com> + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ #include <filter/msfilter/mstoolbar.hxx> #include <rtl/ustrbuf.hxx> #include <stdarg.h> diff --git a/filter/source/msfilter/msvbasic.cxx b/filter/source/msfilter/msvbasic.cxx index ce937dd61dab..c51edf7981a7 100644 --- a/filter/source/msfilter/msvbasic.cxx +++ b/filter/source/msfilter/msvbasic.cxx @@ -1291,7 +1291,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel ) } else if ( key == sDocument ) { - /* #i37965# DR 2004-12-03: add "Document", used i.e. + /* #i37965# add "Document", used i.e. in Excel for macros attached to sheet or document. */ // value is of form <name>/&H<identifier>, strip the identifier diff --git a/filter/source/msfilter/msvbasic.hxx b/filter/source/msfilter/msvbasic.hxx index 6529349162f2..1e5349684776 100644 --- a/filter/source/msfilter/msvbasic.hxx +++ b/filter/source/msfilter/msvbasic.hxx @@ -57,12 +57,11 @@ using namespace ::com::sun::star::script::ModuleType; DECLARE_DYNARRAY(StringArray,String *) -// #117718# define internal types to distinguish between +// define internal types to distinguish between // module types, form, class & normal -// #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet +// #i37965# add "Document", used in Excel for macros attached to sheet -// #117718# define map to hold types of module -// +// define map to hold types of module typedef sal_Int32 ModType; typedef ::std::map< UniString, ModType > ModuleTypeHash; diff --git a/filter/source/msfilter/powerpoint/pptimporter.cxx b/filter/source/msfilter/powerpoint/pptimporter.cxx index 05f09eeefcd9..44e0f369fd60 100644 --- a/filter/source/msfilter/powerpoint/pptimporter.cxx +++ b/filter/source/msfilter/powerpoint/pptimporter.cxx @@ -38,10 +38,6 @@ #include <uno/mapping.hxx> -// ----------------- -// - PptImporter - -// ----------------- - NMSP_RTL::OUString PptImporter_getImplementationName() throw( NMSP_UNO::RuntimeException ) { @@ -64,8 +60,6 @@ SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter_getSupportedServiceNames() } #undef SERVICE_NAME -// ----------------------------------------------------------------------------- - PptImporter::PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) : xFact( rxMgr ) { @@ -80,21 +74,15 @@ PptImporter::PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) } } -// ----------------------------------------------------------------------------- - PptImporter::~PptImporter() { } -// ----------------------------------------------------------------------------- - void SAL_CALL PptImporter::acquire() throw() { OWeakObject::acquire(); } -// ----------------------------------------------------------------------------- - void SAL_CALL PptImporter::release() throw() { OWeakObject::release(); @@ -116,15 +104,11 @@ sal_Bool SAL_CALL PptImporter::filter( const SEQ( NMSP_BEANS::PropertyValue )& a xDataSource->setOutputStream( xOutStream ); aFilter.filter( aDescriptor, REF( NMSP_SAX::XDocumentHandler )( xWriter, NMSP_UNO::UNO_QUERY ) ); -// REF( NMSP_BEANS::XPropertySet ) xPropSet( xServiceFactory->createInstance( B2UCONST( "com.sun.star.beans.PropertySet" ) ) ); -// Any aAny; -// aAny <<= (sal_Bool)sal_True; -// xPropSet->setPropertyValue( B2UCONST( "UsePrettyPrinting" ), aAny ); - #endif return aFilter.filter( aDescriptor, xHdl ); } + void SAL_CALL PptImporter::cancel() throw ( NMSP_UNO::RuntimeException ) { @@ -150,11 +134,13 @@ NMSP_RTL::OUString SAL_CALL PptImporter::getImplementationName() { return PptImporter_getImplementationName(); } + sal_Bool SAL_CALL PptImporter::supportsService( const NMSP_RTL::OUString& rServiceName ) throw( NMSP_UNO::RuntimeException ) { return PptImporter_supportsService( rServiceName ); } + SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter::getSupportedServiceNames() throw ( NMSP_UNO::RuntimeException ) { diff --git a/filter/source/msfilter/powerpoint/pptimporteruno.cxx b/filter/source/msfilter/powerpoint/pptimporteruno.cxx index e91761d1f145..feeef52173d6 100644 --- a/filter/source/msfilter/powerpoint/pptimporteruno.cxx +++ b/filter/source/msfilter/powerpoint/pptimporteruno.cxx @@ -34,28 +34,16 @@ #include <cppuhelper/factory.hxx> #include <uno/mapping.hxx> -// ------------------- -// - factory methods - -// ------------------- - static REF( NMSP_UNO::XInterface ) SAL_CALL create_PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact ) { return REF( NMSP_UNO::XInterface )( *new PptImporter( rxFact ) ); } -// ------------------------------------------ -// - component_getImplementationEnvironment - -// ------------------------------------------ - extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) { sal_Bool bRet = sal_False; @@ -83,10 +71,6 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, v return bRet; } -// ------------------------ -// - component_getFactory - -// ------------------------ - extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) { REF( NMSP_LANG::XSingleServiceFactory ) xFactory; diff --git a/filter/source/msfilter/powerpoint/ppttoxml.cxx b/filter/source/msfilter/powerpoint/ppttoxml.cxx index e4597055d430..d07e08c466d8 100644 --- a/filter/source/msfilter/powerpoint/ppttoxml.cxx +++ b/filter/source/msfilter/powerpoint/ppttoxml.cxx @@ -52,14 +52,6 @@ sal_Bool PptToXml::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor, NMSP_RTL::OUString strTemp; aDescriptor[ i ].Value >>= strTemp; -/* we will open the document by url, so the stream is not needed - if( aDescriptor[i].Name == B2UCONST( "InputStream" ) ) - { - REF( NMSP_IO::XInputStream ) rInputStream; - aDescriptor[ i].Value >>= rInputStream; - } - else -*/ if ( aDescriptor[ i ].Name == B2UCONST( "URL" ) ) { NMSP_RTL::OUString sURL; @@ -73,7 +65,6 @@ sal_Bool PptToXml::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor, xDocStream->SetVersion( xStg->GetVersion() ); xDocStream->SetKey( xStg->GetKey() ); -// xHdl->unknown( PPT_DTD_STRING ); xHdl->startDocument(); diff --git a/filter/source/msfilter/powerpoint/ppttoxml.hxx b/filter/source/msfilter/powerpoint/ppttoxml.hxx index 91be43246a74..b3218589955f 100644 --- a/filter/source/msfilter/powerpoint/ppttoxml.hxx +++ b/filter/source/msfilter/powerpoint/ppttoxml.hxx @@ -31,10 +31,6 @@ #include "pptcom.hxx" -// ------------ -// - PptToXml - -// ------------ - class PptToXml { REF( NMSP_SAX::XDocumentHandler ) xHdl; diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 850877e254c4..344caa55bee5 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -70,15 +70,6 @@ #include <editeng/unoprnms.hxx> #include <editeng/editids.hrc> -#if defined(JOEENV) && defined(JOEDEBUG) -#include "impinccv.h" // etwas Testkram -#endif - -#if defined(DBG_EXTRACTOLEOBJECTS) || defined(DBG_EXTRACTFONTMETRICS) -#include <tools/urlobj.hxx> -#include <unotools/localfilehelper.hxx> -#endif - #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() #include <editeng/adjitem.hxx> #include <editeng/escpitem.hxx> @@ -1027,7 +1018,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi } break; case TSS_TYPE_BODY : - // case TSS_TYPE_SUBTITLE : case TSS_TYPE_HALFBODY : case TSS_TYPE_QUARTERBODY : nDestinationInstance = TSS_TYPE_BODY; @@ -1182,23 +1172,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi sal_Int32 nAngle = ( rObjData.nSpFlags & SP_FFLIPV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way nAngle += nTextRotationAngle; - if ( pTObj->ISA( SdrObjCustomShape ) ) - { -/* - if ( nTextRotationAngle ) - { - double fTextRotateAngle = (double)nTextRotationAngle / 100.0; - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pTObj)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) ); - PropertyValue aPropValue; - aPropValue.Name = sTextRotateAngle; - aPropValue.Value <<= fTextRotateAngle; - aGeometryItem.SetPropertyValue( aPropValue ); - ((SdrObjCustomShape*)pTObj)->SetMergedItem( aGeometryItem ); - } -*/ - } - else + if ( !pTObj->ISA( SdrObjCustomShape ) ) { if ( rObjData.nSpFlags & SP_FFLIPV ) { @@ -1319,8 +1293,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi return pRet; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - void SdrEscherImport::CheckWingdings() const { OutputDevice* pDev = (OutputDevice*)Application::GetDefaultDevice(); @@ -1342,10 +1314,6 @@ void SdrEscherImport::CheckTimesNewRoman() const ((SdrEscherImport*)this)->bTimesNewRomanChecked = TRUE; } -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const String& rBaseURL ) : SdrEscherImport ( rParam, rBaseURL ), bOk ( rStCtrl.GetErrorCode() == SVSTREAM_OK ), @@ -1442,7 +1410,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S if ( pPersistPtr[ nOfs ] > nStreamLen ) { bOk = FALSE; - DBG_ERROR("SdrPowerPointImport::Ctor(): Ungueltiger Eintrag im Persist-Directory!"); + OSL_FAIL("SdrPowerPointImport::Ctor(): Ungueltiger Eintrag im Persist-Directory!"); } } nAnz--; @@ -1450,7 +1418,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S } if ( bOk && nAnz > 0 ) { - DBG_ERROR("SdrPowerPointImport::Ctor(): Nicht alle Persist-Directory Entraege gelesen!"); + OSL_FAIL("SdrPowerPointImport::Ctor(): Nicht alle Persist-Directory Entraege gelesen!"); bOk = FALSE; } } @@ -1472,7 +1440,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S nDocStreamPos = aUserEditAtom.nDocumentRef; if ( nDocStreamPos > nPersistPtrAnz ) { - DBG_ERROR("SdrPowerPointImport::Ctor(): aUserEditAtom.nDocumentRef ungueltig!"); + OSL_FAIL("SdrPowerPointImport::Ctor(): aUserEditAtom.nDocumentRef ungueltig!"); bOk = FALSE; } } @@ -1481,7 +1449,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S nDocStreamPos = pPersistPtr[ nDocStreamPos ]; if ( nDocStreamPos >= nStreamLen ) { - DBG_ERROR("SdrPowerPointImport::Ctor(): nDocStreamPos >= nStreamLen!"); + OSL_FAIL("SdrPowerPointImport::Ctor(): nDocStreamPos >= nStreamLen!"); bOk = FALSE; } } @@ -1531,7 +1499,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S { if (!(rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT )) { - DBG_ERROR( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" ); + OSL_FAIL( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" ); } } #endif @@ -1661,12 +1629,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S rStCtrl >> pE2->aColorScheme; else { - DBG_ERROR( "SdrPowerPointImport::Ctor(): could not get SlideColorScheme! (SJ)" ); + OSL_FAIL( "SdrPowerPointImport::Ctor(): could not get SlideColorScheme! (SJ)" ); } } else { - DBG_ERROR("SdrPowerPointImport::Ctor(): Persist-Eintrag fehlerhaft! (SJ)"); + OSL_FAIL("SdrPowerPointImport::Ctor(): Persist-Eintrag fehlerhaft! (SJ)"); } } } @@ -1741,7 +1709,6 @@ sal_Bool PPTConvertOCXControls::InsertControl( if ( xShape.is() ) { xShape->setSize(rSize); -// GetShapes()->add( xShape ); // Das Control-Model am Control-Shape setzen ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape > xControlShape( xShape, ::com::sun::star::uno::UNO_QUERY ); @@ -2073,8 +2040,6 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt if ( i && bCopied ) { SvxImportMSVBasic aMSVBas( *pShell, *xDest, TRUE, FALSE ); - //int nSuccess = aMSVBas.Import( String( RTL_CONSTASCII_USTRINGPARAM( "MACROS" ) ), - // String( RTL_CONSTASCII_USTRINGPARAM( "VBA" ) ), TRUE, FALSE ); uno::Reference < embed::XStorage > xDoc( pShell->GetStorage() ); if ( xDoc.is() ) @@ -2205,63 +2170,6 @@ sal_Bool SdrPowerPointImport::ReadFontCollection() if ( mbTracing && !pFont->bAvailable ) mpTracer->Trace( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sd1000" )), pFont->aName ); -#ifdef DBG_EXTRACTFONTMETRICS - - SvxFont aTmpFont( aFont ); - - if ( !pVDev ) - pVDev = new VirtualDevice; - aTmpFont.SetPhysFont( pVDev ); - FontMetric aMetric( pVDev->GetFontMetric() ); - sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent(); - - String aFileURLStr; - if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aFileURLStr ) ) - { - INetURLObject aURL( aFileURLStr ); - aURL.SetName( String( RTL_CONSTASCII_STRINGPARAM( "dbgfontmetrics.txt" ) ) ); - - SvStream* pDbgOut = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ); - if( pDbgOut ) - { - pDbgOut->Seek( STREAM_SEEK_TO_END ); - - Printer* pPrinter = NULL; - if ( pSdrModel->GetRefDevice() && pSdrModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER ) - pPrinter = (Printer*)pSdrModel->GetRefDevice(); - if ( pPrinter ) - { - Font aOldFont( pPrinter->GetFont() ); - aFont.SetKerning( TRUE ); - pPrinter->SetFont( aFont ); - aMetric = pPrinter->GetFontMetric(); - pPrinter->SetFont( aOldFont ); - } - - if ( ( pPrinter == NULL ) || ( aMetric.GetIntLeading() == 0 ) ) - { - VirtualDevice aVirDev( 1 ); - aVirDev.SetFont( aFont ); - aMetric = aVirDev.GetFontMetric(); - } - ByteString aFontName( aFont.GetName(), RTL_TEXTENCODING_UTF8 ); - ByteString aHeight( ByteString::CreateFromInt32( aMetric.GetLineHeight() ) ); - ByteString aAscent( ByteString::CreateFromInt32( aMetric.GetAscent() ) ); - ByteString aDescent( ByteString::CreateFromInt32( aMetric.GetDescent() ) ); - ByteString aLeading( ByteString::CreateFromInt32( aMetric.GetIntLeading() ) ); - ByteString aPhysHeight( ByteString::CreateFromInt32( nTxtHeight ) ); - - *pDbgOut << (sal_uInt8)0xa - << "FontName : " << aFontName.GetBuffer() << (sal_uInt8)0xa - << " Height: " << aHeight.GetBuffer() << (sal_uInt8)0xa - << " Ascent: " << aAscent.GetBuffer() << (sal_uInt8)0xa - << " Descent:" << aDescent.GetBuffer() << (sal_uInt8)0xa - << " Leading:" << aLeading.GetBuffer() << (sal_uInt8)0xa - << "PhysHeight :" << aPhysHeight.GetBuffer()<< (sal_uInt8)0xa; - } - delete pDbgOut; - } -#endif // following block is necessary, because our old PowerPoint export did not set the // correct charset if ( pFont->aName.EqualsIgnoreCaseAscii( "Wingdings" ) || @@ -2451,7 +2359,6 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* if ( !aSelection.nStartPos ) // in PPT empty paragraphs never gets a bullet { aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, FALSE ) ); -// rOutliner.SetDepth( rOutliner.GetParagraph( nParaIndex ), -1 ); } aSelection.nStartPos = 0; rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection ); @@ -2741,9 +2648,6 @@ BOOL SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, UINT32 case TSS_TYPE_BODY : nShapePos = pPersist->pPresentationObjects[ TSS_TYPE_BODY ]; break; -// case TSS_TYPE_NOTES : -// case TSS_TYPE_UNUSED : -// case TSS_TYPE_TEXT_IN_SHAPE : } if ( nShapePos ) { @@ -2770,25 +2674,6 @@ SdrPage* SdrPowerPointImport::MakeBlancPage( sal_Bool bMaster ) const SdrPage* pRet = pSdrModel->AllocPage( bMaster ); pRet->SetSize( GetPageSize() ); -/* - SJ (21.08.00) : since bug #77576# i decided not to set a border size. - - Size aPageSize( aDocAtom.GetSlidesPageSize() ); // PageSize in 576DPI-Units - long nHMarg = aPageSize.Width() - aDocAtom.aSlidesPageSize.Width(); - long nVMarg = aPageSize.Height() - aDocAtom.aSlidesPageSize.Height(); - if ( nHMarg > 0 ) - { - Scale( nHMarg ); - pRet->SetLftBorder( nHMarg / 2 ); - pRet->SetRgtBorder( nHMarg - nHMarg / 2 ); - } - if ( nVMarg > 0 ) - { - Scale( nVMarg ); - pRet->SetUppBorder( nVMarg / 2 ); - pRet->SetLwrBorder( nVMarg - nVMarg / 2 ); - } -*/ return pRet; } @@ -2863,7 +2748,6 @@ void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage, // be sure not to import masterpages with this method -// be sure not to import masterpages with this method void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* pMasterPersist ) { UINT32 nMerk = rStCtrl.Tell(); @@ -3201,8 +3085,6 @@ SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage return pRet; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - HeaderFooterEntry::HeaderFooterEntry( const PptSlidePersistEntry* pMPE ) : pMasterPersist ( pMPE ), nAtom ( 0 ) @@ -3295,77 +3177,6 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderF } } -//static sal_Unicode PPTExportMapper( sal_Unicode nUni, BOOL& bNeedsStarBats ) -//{ -// bNeedsStarBats = FALSE; -// -// sal_Unicode cLo, cReplace; -// cLo = cReplace = 0; -// switch ( nUni ) -// { -// case 132 : cLo = 175; break; -// case 147 : cLo = 174; break; -// // Currency -// case 0x00A2: cReplace = 224; break; -// case 0x00A4: cReplace = 225; break; -// case 0x00A5: cReplace = 226; break; -// case 0x20A1: cReplace = 228; break; -// case 0x20A2: cReplace = 229; break; -// case 0x20A3: cReplace = 230; break; -// case 0x20A4: cReplace = 231; break; -// case 0x20A7: cReplace = 227; break; -// case 0x20A8: cReplace = 234; break; -// case 0x20A9: cReplace = 232; break; -// case 0x20AB: cReplace = 233; break; -// case 0x20AC: cReplace = 128; break; -// // Punctuation and other -// case 0x201A: cReplace = 130; break; // SINGLE LOW-9 QUOTATION MARK -// case 0x0192: cReplace = 131; break; // LATIN SMALL LETTER F WITH HOOK -// case 0x201E: // DOUBLE LOW-9 QUOTATION MARK -// case 0x301F: // LOW DOUBLE PRIME QUOTATION MARK -// cReplace = 132; break; -// case 0x2026: cReplace = 133; break; // HORIZONTAL ELLIPSES -// case 0x2020: cReplace = 134; break; // DAGGER -// case 0x2021: cReplace = 135; break; // DOUBLE DAGGER -// case 0x02C6: cReplace = 136; break; // MODIFIER LETTER CIRCUMFLEX ACCENT -// case 0x2030: cReplace = 137; break; // PER MILLE SIGN -// case 0x0160: cReplace = 138; break; // LATIN CAPITAL LETTER S WITH CARON -// case 0x2039: cReplace = 139; break; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK -// case 0x0152: cReplace = 140; break; // LATIN CAPITAL LIGATURE OE -// case 0x017D: cReplace = 142; break; // LATIN CAPITAL LETTER Z WITH CARON -// case 0x2018: // LEFT SINGLE QUOTATION MARK -// case 0x02BB: // MODIFIER LETTER TURNED COMMA -// cReplace = 145; break; -// case 0x2019: // RIGHT SINGLE QUOTATION MARK -// case 0x02BC: // MODIFIER LETTER APOSTROPHE -// cReplace = 146; break; -// case 0x201C: // LEFT DOUBLE QUOTATION MARK -// case 0x301D: // REVERSED DOUBLE PRIME QUOTATION MARK -// cReplace = 147; break; -// case 0x201D: // RIGHT DOUBLE QUOTATION MARK -// case 0x301E: // REVERSED DOUBLE PRIME QUOTATION MARK -// cReplace = 148; break; -// case 0x2022: cReplace = 149; break; // BULLET -// case 0x2013: cReplace = 150; break; // EN DASH -// case 0x2014: cReplace = 151; break; // EM DASH -// case 0x02DC: cReplace = 152; break; // SMALL TILDE -// case 0x2122: cReplace = 153; break; // TRADE MARK SIGN -// case 0x0161: cReplace = 154; break; // LATIN SMALL LETTER S WITH CARON -// case 0x203A: cReplace = 155; break; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -// case 0x0153: cReplace = 156; break; // LATIN SMALL LIGATURE OE -// case 0x017E: cReplace = 158; break; // LATIN SMALL LETTER Z WITH CARON -// case 0x0178: cReplace = 159; break; // LATIN CAPITAL LETTER Y WITH DIAERESIS -// case 0x00B6: cReplace = 222; break; // PILCROW SIGN / PARAGRAPH SIGN -// } -// if ( cReplace ) -// { -// bNeedsStarBats = TRUE; -// return cReplace; -// } -// else -// return cLo; -//} - // no longer needed sal_Unicode SdrPowerPointImport::PPTSubstitute( UINT16 /*nFont*/, sal_Unicode /*nChar*/, UINT32& /*nMappedFontId*/, Font& /*rFont*/, char /*nDefault*/) const @@ -3373,8 +3184,6 @@ sal_Unicode SdrPowerPointImport::PPTSubstitute( UINT16 /*nFont*/, sal_Unicode /* return 0; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTBuGraEntry::PPTBuGraEntry( Graphic& rGraphic, UINT32 nInst ) : nInstance ( nInst ), aBuGra ( rGraphic ) {} @@ -3491,11 +3300,11 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const aBuGraList.Insert( pBuGra, (UINT32)n ); } #ifdef DBG_UTIL - else DBG_ERROR( "PPTExParaProv::PPTExParaProv - bullet graphic is not valid (SJ)" ); + else OSL_FAIL( "PPTExParaProv::PPTExParaProv - bullet graphic is not valid (SJ)" ); #endif } #ifdef DBG_UTIL - else DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" ); + else OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" ); #endif aBuGraAtomHd.SeekToEndOfRecord( rSt ); } @@ -3509,7 +3318,7 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const break; #ifdef DBG_UTIL default : - DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom reading ppt2000 num rules (SJ)" ); + OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom reading ppt2000 num rules (SJ)" ); case PPT_PST_MasterText : // first seen in: ms-tt02.ppt case PPT_PST_SrKinsoku : case PPT_PST_NewlyAddedAtom4016 : @@ -3551,20 +3360,20 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const } #ifdef DBG_UTIL if ( rSt.Tell() != aHd.GetRecEndFilePos() ) - DBG_ERROR( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" ); + OSL_FAIL( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" ); #endif } #ifdef DBG_UTIL - else DBG_ERROR( "PPTExParaProv::PPTExParaProv - depth is greater than 5 (SJ)" ); + else OSL_FAIL( "PPTExParaProv::PPTExParaProv - depth is greater than 5 (SJ)" ); #endif } #ifdef DBG_UTIL - else DBG_ERROR( "PPTExParaProv::PPTExParaProv - instance out of range (SJ)" ); + else OSL_FAIL( "PPTExParaProv::PPTExParaProv - instance out of range (SJ)" ); #endif } break; default : - DBG_ERROR( "PPTExParaProv::PPTExParaProv - unknown atom, assuming PPT_PST_ExtendedParagraphMasterAtom (SJ)" ); + OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom, assuming PPT_PST_ExtendedParagraphMasterAtom (SJ)" ); case PPT_PST_NewlyAddedAtomByXP11008 : case PPT_PST_NewlyAddedAtomByXP11010 : case PPT_PST_NewlyAddedAtomByXP12010 : @@ -3586,8 +3395,6 @@ PPTExtParaProv::~PPTExtParaProv() delete (PPTBuGraEntry*)pPtr; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTNumberFormatCreator::PPTNumberFormatCreator( PPTExtParaProv* pParaProv ) : pExtParaProv ( pParaProv ) { @@ -3918,8 +3725,6 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport& rManager, rNumberFormat.SetFirstLineOffset( -nFirstLineOffset ); } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTCharSheet::PPTCharSheet( UINT32 nInstance ) { UINT32 nColor = PPT_COLSCHEME_TEXT_UND_ZEILEN; @@ -4004,7 +3809,7 @@ void PPTCharSheet::Read( SvStream& rIn, sal_Bool /*bMasterStyle*/, sal_uInt32 nL { if ( nCMask & 1 ) { - DBG_ERROR( "PPTCharSheet::Read - unknown attribute, send me this document (SJ)" ); + OSL_FAIL( "PPTCharSheet::Read - unknown attribute, send me this document (SJ)" ); rIn >> nVal16; } nCMask >>= 1; @@ -4035,12 +3840,6 @@ PPTParaSheet::PPTParaSheet( UINT32 nInstance ) case TSS_TYPE_NOTES : nUpperDist = 0x1e; break; -/* - default : - case TSS_TYPE_UNUSED : - case TSS_TYPE_TEXT_IN_SHAPE : - break; -*/ } for ( UINT32 i = 0; i < 5; i++ ) { @@ -4186,7 +3985,7 @@ void PPTParaSheet::Read( SdrPowerPointImport& #ifdef DBG_UTIL if (!(rManager.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT)) { - DBG_ERROR( "PPTParaSheet::Read - unknown attribute, send me this document (SJ)" ); + OSL_FAIL( "PPTParaSheet::Read - unknown attribute, send me this document (SJ)" ); } #endif rIn >> nVal16; @@ -4329,7 +4128,7 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd rIn >> nLevelAnz; if ( nLevelAnz > 5 ) { - DBG_ERROR( "PPTStyleSheet::Ppt-TextStylesheet hat mehr als 5 Ebenen! (SJ)" ); + OSL_FAIL( "PPTStyleSheet::Ppt-TextStylesheet hat mehr als 5 Ebenen! (SJ)" ); nLevelAnz = 5; } sal_uInt16 nLev = 0; @@ -4526,8 +4325,6 @@ PPTStyleSheet::~PPTStyleSheet() } } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTParaPropSet::PPTParaPropSet() : pParaSet( new ImplPPTParaPropSet ) { @@ -4654,8 +4451,6 @@ void PPTCharPropSet::SetColor( sal_uInt32 nColor ) pCharSet->mnAttrSet |= 1 << PPT_CharAttr_FontColor; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTRuler::PPTRuler() : nRefCount ( 1 ), nFlags ( 0 ), @@ -4774,8 +4569,6 @@ PPTTextRulerInterpreter::~PPTTextRulerInterpreter() delete mpImplRuler; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTTextCharacterStyleAtomInterpreter::PPTTextCharacterStyleAtomInterpreter() : nFlags1 ( 0 ), nFlags2 ( 0 ), @@ -4801,7 +4594,6 @@ PPTTextCharacterStyleAtomInterpreter::~PPTTextCharacterStyleAtomInterpreter() { } -//////////////////////////////////////////////////////////////////////////////////////////////////// PPTTextParagraphStyleAtomInterpreter::PPTTextParagraphStyleAtomInterpreter() : bValid ( sal_False ), bForbiddenRules ( sal_False ), @@ -4878,8 +4670,6 @@ PPTTextParagraphStyleAtomInterpreter::~PPTTextParagraphStyleAtomInterpreter() } -//////////////////////////////////////////////////////////////////////////////////////////////////// - PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) : nCharIdx ( _nCharIdx ), nDontKnow ( 1 ) @@ -4964,8 +4754,6 @@ PPTTextSpecInfoAtomInterpreter::~PPTTextSpecInfoAtomInterpreter() delete (PPTTextSpecInfo*)pPtr; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - void StyleTextProp9::Read( SvStream& rIn ) { rIn >> mnExtParagraphMask; @@ -5113,7 +4901,7 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& // it should be a const reference PPTParaPropSet aTmpPPTParaPropSet; aParaPropSet = aTmpPPTParaPropSet; - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); + OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); } PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet ); pPara->mnOriginalTextPos = nCharAnzRead; @@ -5160,7 +4948,7 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar if ( nCharsToRead < -1 ) { bTextPropAtom = sal_False; - DBG_ERROR( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" ); + OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the character attributes" ); } } ImplPPTCharPropSet& aSet = *aCharPropSet.pCharSet; @@ -5454,8 +5242,6 @@ PPTStyleTextPropReader::~PPTStyleTextPropReader() delete (PPTCharPropSet*)pTmp; } -//////////////////////////////////////////////////////////////////////////////////////////////////// - struct FieldEntry { UINT32 nFieldType; @@ -5559,7 +5345,7 @@ BOOL PPTPortionObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestinat nRetValue = pCharSet->mnEscapement; break; default : - DBG_ERROR( "SJ:PPTPortionObj::GetAttrib ( hard attribute does not exist )" ); + OSL_FAIL( "SJ:PPTPortionObj::GetAttrib ( hard attribute does not exist )" ); } } else @@ -5625,7 +5411,7 @@ BOOL PPTPortionObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestinat } break; default : - DBG_ERROR( "SJ:PPTPortionObj::GetAttrib ( attribute does not exist )" ); + OSL_FAIL( "SJ:PPTPortionObj::GetAttrib ( attribute does not exist )" ); } } return (BOOL)bIsHardAttribute; @@ -5808,7 +5594,6 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, U } } break; -// case mso_fillPicture : default: break; } rSet.Put( SvxColorItem( aDefColor, EE_CHAR_COLOR ) ); @@ -5859,8 +5644,6 @@ SvxFieldItem* PPTPortionObj::GetTextField() return NULL; } -// ----------------------------------------------------------------------- - PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, UINT32 nInstance, UINT16 nDepth ) : PPTNumberFormatCreator ( NULL ), mrStyleSheet ( rStyleSheet ), @@ -5907,7 +5690,7 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPT } else { - DBG_ERROR( "SJ:PPTParagraphObj::It seems that there are missing some textportions" ); + OSL_FAIL( "SJ:PPTParagraphObj::It seems that there are missing some textportions" ); mpPortionList[ i ] = NULL; } pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next(); @@ -5958,7 +5741,7 @@ BOOL PPTParagraphObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestin if ( nAttr > 21 ) { - DBG_ERROR( "SJ:PPTParagraphObj::GetAttrib - attribute does not exist" ); + OSL_FAIL( "SJ:PPTParagraphObj::GetAttrib - attribute does not exist" ); return FALSE; } @@ -6047,7 +5830,7 @@ BOOL PPTParagraphObj::GetAttrib( UINT32 nAttr, UINT32& nRetValue, UINT32 nDestin case PPT_ParaAttr_BuHardFont : case PPT_ParaAttr_BuHardColor : case PPT_ParaAttr_BuHardHeight : - DBG_ERROR( "SJ:PPTParagraphObj::GetAttrib - this attribute does not make sense" ); + OSL_FAIL( "SJ:PPTParagraphObj::GetAttrib - this attribute does not make sense" ); break; case PPT_ParaAttr_BulletChar : { @@ -6507,8 +6290,6 @@ void PPTFieldEntry::SetDateTime( UINT32 nVal ) } } -// ----------------------------------------------------------------------- - PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport, PptSlidePersistEntry& rPersistEntry, DffObjData* pObjData ) : mpImplTextObj ( new ImplPPTTextObj( rPersistEntry ) ) { @@ -6540,9 +6321,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport if ( pObjData->nSpFlags & SP_FHAVEMASTER ) mpImplTextObj->mnShapeMaster = rSdrPowerPointImport.GetPropertyValue( DFF_Prop_hspMaster, 0 ); } - //////////////// - // ClientData // - //////////////// + // ClientData if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) ) { UINT32 nOldPos = rIn.Tell(); @@ -6561,9 +6340,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } } - /////////////////// - // ClientTextBox // - /////////////////// + // ClientTextBox if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientTextbox, SEEK_FROM_CURRENT_AND_RESTART ) ) { DffRecordHeader aClientTextBoxHd( *rSdrPowerPointImport.maShapeRecords.Current() ); @@ -6571,12 +6348,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport // case of -1 -> ther is no atom of this kind // else -> this is the fileofs where we can get it - ////////////////////////////////////// - // checkout if this is a referenced // - // textobj, if so the we will patch // - // the ClientTextBoxHd for a // - // equivalent one // - ////////////////////////////////////// + // checkout if this is a referenced + // textobj, if so the we will patch + // the ClientTextBoxHd for a + // equivalent one DffRecordHeader aTextHd; if ( rSdrPowerPointImport.SeekToRec( rIn, PPT_PST_OutlineTextRefAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) ) { @@ -6775,15 +6550,13 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport { if (!(rSdrPowerPointImport.rImportParam.nImportFlags & PPT_IMPORTFLAGS_NO_TEXT_ASSERT)) { - DBG_ERROR( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" ); + OSL_FAIL( "SdrTextSpecInfoAtomInterpreter::Ctor(): parsing error, this document needs to be analysed (SJ)" ); } } #endif } - // // now will search for possible textextensions such as date/time fields // or ParaTabStops and append them on this textobj - // rIn.Seek( nFilePos ); List* pFieldList = NULL; while ( rIn.Tell() < aClientTextBoxHd.GetRecEndFilePos() ) @@ -7743,7 +7516,4 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab return pRet; } - -//////////////////////////////////////////////////////////////////////////////////////////////////// - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx index 7aabccd91dcd..f4bf514e3ca4 100644 --- a/filter/source/msfilter/svxmsbas.cxx +++ b/filter/source/msfilter/svxmsbas.cxx @@ -116,7 +116,7 @@ int SvxImportMSVBasic::Import( const String& rStorageName, bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode ) { - BOOL bRet = FALSE; + bool bRet = false; // #FIXME VBA_Impl ( or some other new class ) should handle both userforms // and code VBA_Impl aVBA( *xRoot, TRUE ); @@ -379,9 +379,9 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, const std::vector< Stri catch( Exception& ) { } } } - typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash, + typedef boost::unordered_map< rtl::OUString, uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameModuleDataHash; - typedef std::hash_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash, + typedef boost::unordered_map< rtl::OUString, script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameModuleInfoHash; NameModuleDataHash moduleData; @@ -391,7 +391,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, const std::vector< Stri { StringArray aDecompressed = aVBA.Decompress(i); #if 0 -/* DR 2005-08-11 #124850# Do not filter special characters from module name. +/* Do not filter special characters from module name. Just put the original module name and let the Basic interpreter deal with it. Needed for roundtrip... */ diff --git a/filter/source/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx index 0e58f4114300..6a341979688d 100644 --- a/filter/source/msfilter/viscache.hxx +++ b/filter/source/msfilter/viscache.hxx @@ -30,12 +30,6 @@ #include <vcl/gdimtf.hxx> #include <vcl/bitmap.hxx> -/************************************************************************ -|* Impl_CacheElement -|* Impl_Cache -|* -|* Beschreibung -*************************************************************************/ class Impl_OlePres { ULONG nFormat; diff --git a/filter/source/odfflatxml/FlatXml.cxx b/filter/source/odfflatxml/FlatXml.cxx deleted file mode 100644 index 6bf7c608a440..000000000000 --- a/filter/source/odfflatxml/FlatXml.cxx +++ /dev/null @@ -1,365 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * The Contents of this file are made available subject to the terms of - * the BSD license. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Sun Microsystems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *************************************************************************/ - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/implbase.hxx> - -#include <com/sun/star/lang/XComponent.hpp> - -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Type.hxx> - -#include <com/sun/star/beans/PropertyValue.hpp> - -#include <com/sun/star/xml/sax/XParser.hpp> -#include <com/sun/star/xml/sax/InputSource.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#include <com/sun/star/xml/sax/SAXException.hpp> -#include <com/sun/star/xml/XImportFilter.hpp> -#include <com/sun/star/xml/XExportFilter.hpp> - -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XSeekable.hpp> - -#include "FlatXml.hxx" - -using namespace ::rtl; -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::xml; -using namespace ::com::sun::star::xml::sax; - -namespace XFlatXml -{ - - sal_Bool - XFlatXml::importer(const Sequence<PropertyValue>& aSourceData, - const Reference<XDocumentHandler>& xHandler, const Sequence< - OUString>& /* msUserData */) throw (RuntimeException) - { - // get information from media descriptor - // the imput stream that represents the imported file - // is most important here since we need to supply it to - // the sax parser that drives the supplied document handler - sal_Int32 nLength = aSourceData.getLength(); - OUString aName, aFileName, aURL; - Reference<XInputStream> xInputStream; - for (sal_Int32 i = 0; i < nLength; i++) - { - aName = aSourceData[i].Name; - if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InputStream"))) - aSourceData[i].Value >>= xInputStream; - else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName"))) - aSourceData[i].Value >>= aFileName; - else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL"))) - aSourceData[i].Value >>= aURL; - } - - // we need an input stream - OSL_ASSERT(xInputStream.is()); - if (!xInputStream.is()) - return sal_False; - - // rewind seekable stream - Reference<XSeekable> xSeek(xInputStream, UNO_QUERY); - if (xSeek.is()) - xSeek->seek(0); - - // create SAX parser that will read the document file - // and provide events to xHandler passed to this call - Reference<XParser> - xSaxParser( - m_rServiceFactory->createInstance( - OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))), - UNO_QUERY); - OSL_ASSERT(xSaxParser.is()); - if (!xSaxParser.is()) - return sal_False; - - // let the parser try to send the sax event to the document handler - try - { - InputSource aInput; - aInput.sSystemId = aURL; - aInput.sPublicId = aURL; - aInput.aInputStream = xInputStream; - xSaxParser->setDocumentHandler(xHandler); - xSaxParser->parseStream(aInput); - } - catch (Exception &exc) - { - // something went wrong - OString msg = OUStringToOString(exc.Message, - RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(0, msg); - return sal_False; - } - - // done - return sal_True; - } - - sal_Bool - XFlatXml::exporter(const Sequence<PropertyValue>& aSourceData, - const Sequence<OUString>& /*msUserData*/) throw (RuntimeException) - { - - // read source data - // we are especialy interested in the output stream - // since that is where our xml-writer will push the data - // from it's data-source interface - OUString aName, sURL; - Reference<XOutputStream> rOutputStream; - sal_Int32 nLength = aSourceData.getLength(); - for (sal_Int32 i = 0; i < nLength; i++) - { - aName = aSourceData[i].Name; - if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OutputStream"))) - aSourceData[i].Value >>= rOutputStream; - else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL"))) - aSourceData[i].Value >>= sURL; - } - - if (!m_rDocumentHandler.is()) - { - // get the document writer - m_rDocumentHandler - = Reference<XExtendedDocumentHandler> ( - m_rServiceFactory->createInstance( - OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))), - UNO_QUERY); - OSL_ASSERT(m_rDocumentHandler.is()); - if (!m_rDocumentHandler.is()) - return sal_False; - } - // get data source interface ... - Reference<XActiveDataSource> rDataSource(m_rDocumentHandler, UNO_QUERY); - OSL_ASSERT(rDataSource.is()); - if (!rDataSource.is()) - return sal_False; - OSL_ASSERT(rOutputStream.is()); - if (!rOutputStream.is()) - return sal_False; - // ... and set output stream - rDataSource->setOutputStream(rOutputStream); - - return sal_True; - } - - // for the DocumentHandler implementation, we just proxy the the - // events to the XML writer that we created upon the output stream - // that was provided by the XMLFilterAdapter - void - XFlatXml::startDocument() throw (SAXException, RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->startDocument(); - } - - void - XFlatXml::endDocument() throw (SAXException, RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endDocument(); - } - - void - XFlatXml::startElement(const OUString& str, - const Reference<XAttributeList>& attriblist) throw (SAXException, - RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->startElement(str, attriblist); - } - - void - XFlatXml::endElement(const OUString& str) throw (SAXException, - RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endElement(str); - } - - void - XFlatXml::characters(const OUString& str) throw (SAXException, - RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->characters(str); - } - - void - XFlatXml::ignorableWhitespace(const OUString& str) throw (SAXException, - RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - if (!m_bPrettyPrint) - return; - m_rDocumentHandler->ignorableWhitespace(str); - } - - void - XFlatXml::processingInstruction(const OUString& str, const OUString& str2) - throw (SAXException, RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->processingInstruction(str, str2); - } - - void - XFlatXml::setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException, RuntimeException) - { - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->setDocumentLocator(doclocator); - } - - // -------------------------------------- - // Component management - // -------------------------------------- - Reference<XInterface> SAL_CALL - CreateInstance(const Reference<XMultiServiceFactory> &r) - { - return Reference<XInterface> ((OWeakObject *) new XFlatXml(r)); - } - - Sequence<OUString> - getSupportedServiceNames() - { - static Sequence<OUString> *pNames = 0; - if (!pNames) - { - MutexGuard guard(Mutex::getGlobalMutex()); - if (!pNames) - { - static Sequence<OUString> seqNames(2); - seqNames.getArray()[0] = OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.document.ImportFilter")); - seqNames.getArray()[1] = OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.document.ExportFilter")); - pNames = &seqNames; - } - } - return *pNames; - } - -} - -using namespace XFlatXml; -#define IMPLEMENTATION_NAME "com.sun.star.comp.filter.FlatXmlCpp" - -extern "C" -{ - void SAL_CALL - component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, - uno_Environment ** /* ppEnv */) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - sal_Bool SAL_CALL - component_writeInfo(void * /* pServiceManager */, void * pRegistryKey) - { - if (pRegistryKey) - { - try - { - Reference<XRegistryKey> - xNewKey( - reinterpret_cast<XRegistryKey *> (pRegistryKey)->createKey( - OUString( - RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" )))); - - const Sequence<OUString> & rSNL = - getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for (sal_Int32 nPos = rSNL.getLength(); nPos--;) - xNewKey->createKey(pArray[nPos]); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; - } - - void * - SAL_CALL component_getFactory(const sal_Char * pImplName, - void * pServiceManager, void * /* pRegistryKey */) - { - void * pRet = 0; - - if (pServiceManager && rtl_str_compare(pImplName, IMPLEMENTATION_NAME) - == 0) - { - Reference<XSingleServiceFactory> - xFactory( - createSingleFactory( - reinterpret_cast<XMultiServiceFactory *> (pServiceManager), - OUString::createFromAscii(pImplName), - CreateInstance, - getSupportedServiceNames())); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - return pRet; - } - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/odfflatxml/FlatXml.hxx b/filter/source/odfflatxml/FlatXml.hxx deleted file mode 100644 index 8b72f1e1bba4..000000000000 --- a/filter/source/odfflatxml/FlatXml.hxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * The Contents of this file are made available subject to the terms of - * the BSD license. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Sun Microsystems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *************************************************************************/ -#ifndef __XFLATXML_HXX__ -#define __XFLATXML_HXX__ - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/implbase.hxx> - -#include <com/sun/star/lang/XComponent.hpp> - -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Type.hxx> - -#include <com/sun/star/beans/PropertyValue.hpp> - -#include <com/sun/star/xml/sax/XParser.hpp> -#include <com/sun/star/xml/sax/InputSource.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#include <com/sun/star/xml/sax/SAXException.hpp> -#include <com/sun/star/xml/XImportFilter.hpp> -#include <com/sun/star/xml/XExportFilter.hpp> - -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XSeekable.hpp> - -using namespace ::rtl; -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::xml; -using namespace ::com::sun::star::xml::sax; - -namespace XFlatXml -{ - - /* - * XFlatXml export and imports ODF flat XML documents by plumbing a pass-through - * filter implementation to XmlFilterAdaptor. - * - * XXX: Currently, this code adds nothing to the flat XML filter implementation - * provided with the ODK. - */ - class XFlatXml : public WeakImplHelper3<XImportFilter, XExportFilter, - XDocumentHandler> - { - private: - // the UNO ServiceFactory - Reference<XMultiServiceFactory> m_rServiceFactory; - - // DocumentHandler interface of the css::xml::sax::Writer service - Reference<XExtendedDocumentHandler> m_rDocumentHandler; - - // controls pretty-printing - sal_Bool m_bPrettyPrint; - - public: - - // ctor... - XFlatXml(const Reference<XMultiServiceFactory> &r) : - m_rServiceFactory(r), m_bPrettyPrint(sal_True) - { - } - - // XImportFilter - virtual sal_Bool SAL_CALL - importer(const Sequence<PropertyValue>& aSourceData, const Reference< - XDocumentHandler>& xHandler, - const Sequence<OUString>& msUserData) throw (RuntimeException); - - // XExportFilter - virtual sal_Bool SAL_CALL - exporter(const Sequence<PropertyValue>& aSourceData, const Sequence< - OUString>& msUserData) throw (RuntimeException); - - // XDocumentHandler - virtual void SAL_CALL - startDocument() throw (SAXException, RuntimeException); - virtual void SAL_CALL - endDocument() throw (SAXException, RuntimeException); - virtual void SAL_CALL - startElement(const OUString& str, - const Reference<XAttributeList>& attriblist) - throw (SAXException, RuntimeException); - virtual void SAL_CALL - endElement(const OUString& str) throw (SAXException, RuntimeException); - virtual void SAL_CALL - characters(const OUString& str) throw (SAXException, RuntimeException); - virtual void SAL_CALL - ignorableWhitespace(const OUString& str) throw (SAXException, - RuntimeException); - virtual void SAL_CALL - processingInstruction(const OUString& str, const OUString& str2) - throw (com::sun::star::xml::sax::SAXException, - RuntimeException); - virtual void SAL_CALL - setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException, RuntimeException); - }; -} -#endif // __XFLATXML_HXX__ -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx new file mode 100644 index 000000000000..b072e2ef91b4 --- /dev/null +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -0,0 +1,258 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Peter Jentsch <pjotr@guineapics.de> + * + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase.hxx> + +#include <sax/tools/documenthandleradapter.hxx> + +#include <com/sun/star/lang/XComponent.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Type.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <com/sun/star/xml/XImportFilter.hpp> +#include <com/sun/star/xml/XExportFilter.hpp> +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/xml/sax/InputSource.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> + +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XSeekable.hpp> + +#include <registration.hxx> + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::osl; +using namespace ::sax; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::xml; +using namespace ::com::sun::star::xml::sax; + +namespace filter { + namespace odfflatxml { + /* + * OdfFlatXml export and imports ODF flat XML documents by plugging a pass-through + * filter implementation into XmlFilterAdaptor. + */ + class OdfFlatXml : public WeakImplHelper3<XImportFilter, + XExportFilter, DocumentHandlerAdapter> + { + private: + Reference< XMultiServiceFactory > m_rServiceFactory; + + public: + + OdfFlatXml(const Reference<XMultiServiceFactory> &r) : + m_rServiceFactory(r) + { + } + + // XImportFilter + virtual sal_Bool SAL_CALL + importer(const Sequence< PropertyValue >& sourceData, + const Reference< XDocumentHandler >& docHandler, + const Sequence< OUString >& userData) + throw (IllegalArgumentException, RuntimeException); + + // XExportFilter + virtual sal_Bool SAL_CALL + exporter( + const Sequence< PropertyValue >& sourceData, + const Sequence< OUString >& userData) + throw (IllegalArgumentException, + RuntimeException); + + // UNO component helper methods + + static OUString impl_getImplementationName(); + + static Sequence< OUString > impl_getSupportedServiceNames(); + + static Reference< XInterface > impl_createInstance(const Reference< XMultiServiceFactory >& fact); + }; + } +} + +using namespace ::filter::odfflatxml; + +sal_Bool +OdfFlatXml::importer( + const Sequence< PropertyValue >& sourceData, + const Reference< XDocumentHandler >& docHandler, + const Sequence< OUString >& /* userData */) + throw (IllegalArgumentException, RuntimeException) +{ + // Read InputStream to read from and an URL used for the system id + // of the InputSource we create from the given sourceData sequence + Reference<XInputStream> inputStream; + OUString paramName; + OUString url; + + sal_Int32 paramCount = sourceData.getLength(); + for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++) + { + paramName = sourceData[paramIdx].Name; + if (paramName.equalsAscii("InputStream")) + sourceData[paramIdx].Value >>= inputStream; + else if (paramName.equalsAscii("URL")) + sourceData[paramIdx].Value >>= url; + } + + OSL_ASSERT(inputStream.is()); + if (!inputStream.is()) + return sal_False; + + OUString SAX_PARSER_SERVICE( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")); + Reference<XParser> saxParser(m_rServiceFactory->createInstance( + SAX_PARSER_SERVICE), UNO_QUERY); + + OSL_ASSERT(saxParser.is()); + if (!saxParser.is()) + return sal_False; + + InputSource inputSource; + inputSource.sSystemId = url; + inputSource.sPublicId = url; + inputSource.aInputStream = inputStream; + saxParser->setDocumentHandler(docHandler); + try + { + saxParser->parseStream(inputSource); + } + catch (Exception &exc) + { + OString msg = OUStringToOString(exc.Message, + RTL_TEXTENCODING_ASCII_US); + OSL_ENSURE(0, msg); + return sal_False; + } + return sal_True; +} + +sal_Bool +OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData, + const Sequence< OUString >& /*msUserData*/) + throw (IllegalArgumentException, RuntimeException) +{ + OUString paramName; + OUString targetURL; + Reference<XOutputStream> outputStream; + + // Read output stream and target URL from the parameters given in sourceData. + sal_Int32 paramCount = sourceData.getLength(); + for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++) + { + paramName = sourceData[paramIdx].Name; + if (paramName.equalsAscii("OutputStream")) + sourceData[paramIdx].Value >>= outputStream; + else if (paramName.equalsAscii("URL")) + sourceData[paramIdx].Value >>= targetURL; + } + + if (!getDelegate().is()) + { + OUString SAX_WRITER_SERVICE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")); + Reference< XDocumentHandler > saxWriter(m_rServiceFactory->createInstance(SAX_WRITER_SERVICE), + UNO_QUERY); + setDelegate(saxWriter); + if (!getDelegate().is()) + return sal_False; + } + // get data source interface ... + Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY); + OSL_ASSERT(dataSource.is()); + if (!dataSource.is()) + return sal_False; + OSL_ASSERT(outputStream.is()); + if (!outputStream.is()) + return sal_False; + dataSource->setOutputStream(outputStream); + + return sal_True; +} + + +OUString OdfFlatXml::impl_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.filter.OdfFlatXml")); +} + +Sequence< OUString > OdfFlatXml::impl_getSupportedServiceNames() +{ + Sequence< OUString > lServiceNames(2); + lServiceNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ImportFilter" )); + lServiceNames[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" )); + return lServiceNames; +} + +Reference< XInterface > SAL_CALL OdfFlatXml::impl_createInstance(const Reference< XMultiServiceFactory >& fact) +{ + return Reference<XInterface> ((OWeakObject *) new OdfFlatXml(fact)); + +} + +_COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT + +// extern "C" component_writeInfo() + +_COMPHELPER_COMPONENT_WRITEINFO +( + _COMPHELPER_COMPONENTINFO( OdfFlatXml, + OdfFlatXml::impl_getImplementationName(), + OdfFlatXml::impl_getSupportedServiceNames()) +) +// extern "C" component_getFactory() +_COMPHELPER_COMPONENT_GETFACTORY +( + {}, + _COMPHELPER_ONEINSTANCEFACTORY( OdfFlatXml::impl_getImplementationName(), + OdfFlatXml::impl_getSupportedServiceNames(), + OdfFlatXml::impl_createInstance) + +) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/odfflatxml/makefile.mk b/filter/source/odfflatxml/makefile.mk index ee5678933e8b..aaffb3539a2c 100644 --- a/filter/source/odfflatxml/makefile.mk +++ b/filter/source/odfflatxml/makefile.mk @@ -34,7 +34,7 @@ LIBTARGET=NO .INCLUDE: settings.mk -SLOFILES=$(SLO)$/FlatXml.obj +SLOFILES=$(SLO)$/OdfFlatXml.obj LIBNAME=odfflatxml SHL1TARGETDEPN=makefile.mk SHL1OBJS=$(SLOFILES) diff --git a/filter/source/odfflatxml/odfflatxmlexport.xsl b/filter/source/odfflatxml/odfflatxmlexport.xsl deleted file mode 100644 index 2c1ea97eea33..000000000000 --- a/filter/source/odfflatxml/odfflatxmlexport.xsl +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version='1.0' encoding="UTF-8"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"> - <xsl:output method="xml" encoding="UTF-8" indent="yes"/> - - <xsl:template match="@*|node()"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> - - <xsl:template match="@office:mimetype[string(.)='application/vnd.oasis.opendocument.drawing']"> - <xsl:attribute name="office:mimetype">application/vnd.oasis.opendocument.graphics</xsl:attribute> - </xsl:template> - - <xsl:include href="split-long-lines.xsl"/> -</xsl:stylesheet> diff --git a/filter/source/odfflatxml/odfflatxmlimport.xsl b/filter/source/odfflatxml/odfflatxmlimport.xsl deleted file mode 100644 index 802ff535d891..000000000000 --- a/filter/source/odfflatxml/odfflatxmlimport.xsl +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version='1.0' encoding="UTF-8"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output method="xml" encoding="UTF-8" indent="yes"/> - - <xsl:template match="@*|node()"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> -</xsl:stylesheet> diff --git a/filter/source/odfflatxml/split-long-lines.xsl b/filter/source/odfflatxml/split-long-lines.xsl deleted file mode 100644 index 0e9d310a5ac5..000000000000 --- a/filter/source/odfflatxml/split-long-lines.xsl +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Version: MPL 1.1 / GPLv3+ / LGPLv3+ - -The contents of this file are subject to the Mozilla Public License Version -1.1 (the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -for the specific language governing rights and limitations under the -License. - -The Initial Developer of the Original Code is - Gioele Barabucci <gioele@svario.it> -Portions created by the Initial Developer are Copyright (C) 2010 the -Initial Developer. All Rights Reserved. - -Contributor(s): Gioele Barabucci <gioele@svario.it> - -Alternatively, the contents of this file may be used under the terms of -either the GNU General Public License Version 3 or later (the "GPLv3+"), or -the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -instead of those above. ---> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" - version="1.0"> - <xsl:param name="num-max-spaces">5</xsl:param> - <xsl:param name="sep"><xsl:text xml:space="preserve"> </xsl:text></xsl:param> - <xsl:param name="newline"><xsl:text xml:space="preserve"> </xsl:text></xsl:param> - - <xsl:template match="text:p/text()"> - <xsl:call-template name="split-current-text-node"/> - </xsl:template> - - <xsl:template match="text:p/text:span/text()"> - <xsl:call-template name="split-current-text-node"/> - </xsl:template> - - <xsl:template name="split-current-text-node"> - <xsl:call-template name="split-text"> - <xsl:with-param name="num-prec-spaces">0</xsl:with-param> - <xsl:with-param name="text" select="."/> - </xsl:call-template> - </xsl:template> - - <xsl:template name="split-text"> - <xsl:param name="num-prec-spaces"/> - <xsl:param name="text"/> - - <xsl:variable name="contains-space" select="contains($text, $sep)"/> - <xsl:variable name="text-before"> - <xsl:choose> - <xsl:when test="$contains-space"><xsl:value-of select="substring-before($text, $sep)"/></xsl:when> - <xsl:when test="$text = $sep"><xsl:value-of select="$text"/></xsl:when> - <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:variable name="text-after"> - <xsl:choose> - <xsl:when test="$contains-space"><xsl:value-of select="substring-after($text, $sep)"/></xsl:when> - <xsl:otherwise></xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:variable name="finished" select="string-length($text-after) = 0"/> - <xsl:variable name="is-empty" select="string-length($text-before) = 0"/> - - <xsl:value-of select="$text-before"/> - - <xsl:choose> - <xsl:when test="$num-prec-spaces = $num-max-spaces"> - <xsl:value-of select="$newline"/> - <xsl:call-template name="split-text"> - <xsl:with-param name="text" select="$text-after"/> - <xsl:with-param name="num-prec-spaces">0</xsl:with-param> - </xsl:call-template> - </xsl:when> - - <xsl:otherwise> - <xsl:if test="$contains-space"> - <xsl:value-of select="$sep"/> - </xsl:if> - - <xsl:if test="not($finished)"> - <xsl:variable name="incr" select="number(not($is-empty))"/> - - <xsl:call-template name="split-text"> - <xsl:with-param name="text" select="$text-after"/> - <xsl:with-param name="num-prec-spaces" select="$num-prec-spaces + $incr"/> - </xsl:call-template> - </xsl:if> - </xsl:otherwise> - </xsl:choose> - </xsl:template> -</xsl:stylesheet> diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 494e3c1c3235..f8c0dbc20739 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -204,13 +204,12 @@ sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com: aMtf.SetPrefMapMode( aMapMode ); aMtf.Record( pOut ); - // --> FME 2004-10-08 #i35176# + // #i35176# // IsLastPage property. const sal_Int32 nCurrentRenderer = nSel - 1; nSel = aMultiSelection.NextSelected(); if ( pLastPage && sal_Int32(SFX_ENDOFSELECTION) == nSel ) *pLastPage <<= sal_True; - // <-- rRenderable->render( nCurrentRenderer, rSelection, rRenderOptions ); @@ -789,7 +788,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution ); pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest ); - Sequence< PropertyValue > aRenderOptions( 5 ); + Sequence< PropertyValue > aRenderOptions( 6 ); aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ); aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice ); aRenderOptions[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ); @@ -801,12 +800,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aRenderOptions[ 3 ].Value <<= sal_False; aRenderOptions[ 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ); aRenderOptions[ 4 ].Value <<= mbSkipEmptyPages; - #if 0 - // #i113919# writer has to begun "PageRange" for itself changing its renderer count - // we should unify this behavior but not for OOo 3.3 aRenderOptions[ 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ); aRenderOptions[ 5 ].Value <<= aPageRange; - #endif if( aPageRange.getLength() || !aSelection.hasValue() ) { @@ -1432,88 +1427,6 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF else if ( fTransparency == 1.0 ) bSkipSequence = sal_True; } -/* #i81548# removing optimization for fill textures, because most of the texture settings are not - exported properly. In OpenOffice 3.1 the drawing layer will support graphic primitives, then it - will not be a problem to optimize the filltexture export. But for wysiwyg is more important than - filesize. - else if( aFill.getFillType() == SvtGraphicFill::fillTexture && aFill.isTiling() ) - { - sal_Int32 nPattern = mnCachePatternId; - Graphic aPatternGraphic; - aFill.getGraphic( aPatternGraphic ); - bool bUseCache = false; - SvtGraphicFill::Transform aPatTransform; - aFill.getTransform( aPatTransform ); - - if( mnCachePatternId >= 0 ) - { - SvtGraphicFill::Transform aCacheTransform; - maCacheFill.getTransform( aCacheTransform ); - if( aCacheTransform.matrix[0] == aPatTransform.matrix[0] && - aCacheTransform.matrix[1] == aPatTransform.matrix[1] && - aCacheTransform.matrix[2] == aPatTransform.matrix[2] && - aCacheTransform.matrix[3] == aPatTransform.matrix[3] && - aCacheTransform.matrix[4] == aPatTransform.matrix[4] && - aCacheTransform.matrix[5] == aPatTransform.matrix[5] - ) - { - Graphic aCacheGraphic; - maCacheFill.getGraphic( aCacheGraphic ); - if( aCacheGraphic == aPatternGraphic ) - bUseCache = true; - } - } - - if( ! bUseCache ) - { - - // paint graphic to metafile - GDIMetaFile aPattern; - rDummyVDev.SetConnectMetaFile( &aPattern ); - rDummyVDev.Push(); - rDummyVDev.SetMapMode( aPatternGraphic.GetPrefMapMode() ); - - aPatternGraphic.Draw( &rDummyVDev, Point( 0, 0 ) ); - rDummyVDev.Pop(); - rDummyVDev.SetConnectMetaFile( NULL ); - aPattern.WindStart(); - - MapMode aPatternMapMode( aPatternGraphic.GetPrefMapMode() ); - // prepare pattern from metafile - Size aPrefSize( aPatternGraphic.GetPrefSize() ); - // FIXME: this magic -1 shouldn't be necessary - aPrefSize.Width() -= 1; - aPrefSize.Height() -= 1; - aPrefSize = rWriter.GetReferenceDevice()-> - LogicToLogic( aPrefSize, - &aPatternMapMode, - &rWriter.GetReferenceDevice()->GetMapMode() ); - // build bounding rectangle of pattern - Rectangle aBound( Point( 0, 0 ), aPrefSize ); - rWriter.BeginPattern( aBound ); - rWriter.Push(); - rDummyVDev.Push(); - rWriter.SetMapMode( aPatternMapMode ); - rDummyVDev.SetMapMode( aPatternMapMode ); - ImplWriteActions( rWriter, NULL, aPattern, rDummyVDev ); - rDummyVDev.Pop(); - rWriter.Pop(); - - nPattern = rWriter.EndPattern( aPatTransform ); - - // try some caching and reuse pattern - mnCachePatternId = nPattern; - maCacheFill = aFill; - } - - // draw polypolygon with pattern fill - PolyPolygon aPath; - aFill.getPath( aPath ); - rWriter.DrawPolyPolygon( aPath, nPattern, aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ); - - bSkipSequence = sal_True; - } -*/ } if ( bSkipSequence ) { @@ -1603,7 +1516,7 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF case( META_MASKSCALE_ACTION ): case( META_MASKSCALEPART_ACTION ): { - DBG_ERROR( "MetaMask...Action not supported yet" ); + OSL_FAIL( "MetaMask...Action not supported yet" ); } break; @@ -1824,7 +1737,7 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF if( !bAssertionFired ) { bAssertionFired = true; - DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); + OSL_FAIL( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); } break; } diff --git a/filter/source/placeware/Base64Codec.cxx b/filter/source/placeware/Base64Codec.cxx index 4fef9df67517..435b36cb9b7b 100644 --- a/filter/source/placeware/Base64Codec.cxx +++ b/filter/source/placeware/Base64Codec.cxx @@ -31,10 +31,10 @@ #include "Base64Codec.hxx" #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> -using namespace rtl; using namespace osl; using namespace com::sun::star; - +using ::rtl::OUString; +using ::rtl::OUStringBuffer; const sal_Char aBase64EncodeTable[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', diff --git a/filter/source/placeware/tempfile.cxx b/filter/source/placeware/tempfile.cxx index 6c85817d1da1..f7abd18eebc0 100644 --- a/filter/source/placeware/tempfile.cxx +++ b/filter/source/placeware/tempfile.cxx @@ -131,8 +131,7 @@ oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir ) #include "tempfile.hxx" -using namespace rtl; - +using ::rtl::OUString; TempFile::TempFile( const OUString& rTempFileURL ) :osl::File( rTempFileURL ), maURL( rTempFileURL ) { diff --git a/filter/source/placeware/zip.cxx b/filter/source/placeware/zip.cxx index ca9863e0d61f..8a852c6fc16f 100644 --- a/filter/source/placeware/zip.cxx +++ b/filter/source/placeware/zip.cxx @@ -38,8 +38,7 @@ #include "zip.hxx" #include "zipfile.hxx" -using namespace rtl; - +using ::rtl::OString; /** this struct describes one entry in a zip file */ struct ZipEntry { diff --git a/filter/source/svg/gfxtypes.hxx b/filter/source/svg/gfxtypes.hxx index 8cad13556cdf..24c4cbd1e203 100644 --- a/filter/source/svg/gfxtypes.hxx +++ b/filter/source/svg/gfxtypes.hxx @@ -31,8 +31,8 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dlinegeometry.hxx> -#include <hash_set> -#include <hash_map> +#include <boost/unordered_set.hpp> +#include <boost/unordered_map.hpp> #include <rtl/ustring.hxx> namespace svgi @@ -174,7 +174,7 @@ struct State maViewport(), maViewBox(), maFontFamily(), // app-default - mnFontSize(12.0), + mnFontSize(0), maFontStyle(RTL_CONSTASCII_USTRINGPARAM("normal")), maFontVariant(RTL_CONSTASCII_USTRINGPARAM("normal")), mnFontWeight(400.0), @@ -275,6 +275,7 @@ inline bool operator==(const State& rLHS, const State& rRHS ) rLHS.mbVisibility==rRHS.mbVisibility && rLHS.meFillType==rRHS.meFillType && rLHS.mnFillOpacity==rRHS.mnFillOpacity && + rLHS.mnOpacity==rRHS.mnOpacity && rLHS.meStrokeType==rRHS.meStrokeType && rLHS.mnStrokeOpacity==rRHS.mnStrokeOpacity && rLHS.meViewportFillType==rRHS.meViewportFillType && @@ -319,6 +320,7 @@ struct StateHash ^ size_t(rState.mbVisibility) ^ size_t(rState.meFillType) ^ size_t(rState.mnFillOpacity) + ^ size_t(rState.mnOpacity) ^ size_t(rState.meStrokeType) ^ size_t(rState.mnStrokeOpacity) ^ size_t(rState.meViewportFillType) @@ -348,8 +350,8 @@ struct StateHash } }; -typedef std::hash_set<State, StateHash> StatePool; -typedef std::hash_map<sal_Int32, State> StateMap; +typedef boost::unordered_set<State, StateHash> StatePool; +typedef boost::unordered_map<sal_Int32, State> StateMap; } // namespace svgi diff --git a/filter/source/svg/parserfragments.cxx b/filter/source/svg/parserfragments.cxx index c515e856cd23..95811d4755b6 100644 --- a/filter/source/svg/parserfragments.cxx +++ b/filter/source/svg/parserfragments.cxx @@ -560,9 +560,9 @@ bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri, const bool bRes = parse(sPaintUri, // Begin grammar ( - str_p("url(#") >> + str_p("url(") >> !( str_p("'") | str_p("\"") ) >> ("#") >> (+alnum_p)[assign_a(o_rPaintUri)] >> - str_p(")") >> + !( str_p("'") | str_p("\"") ) >> str_p(")") >> *( str_p("none")[assign_a(io_rColor.second,false)] | str_p("currentColor")[assign_a(io_rColor.second,true)] | ColorGrammar(io_rColor.first) diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 89770828cd1e..3661315d097e 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -221,7 +221,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) catch( ... ) { delete mpSVGDoc, mpSVGDoc = NULL; - DBG_ERROR( "Exception caught" ); + OSL_FAIL( "Exception caught" ); } if( mpSdrModel ) @@ -510,26 +510,25 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages, mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", implGetValidIDFromInterface( xShapes ) ); { - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE ); - const Point aNullPt; - { Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); if( xExtDocHandler.is() ) { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE ); - OUString aDesc; + OUString aDesc; if( bMaster ) - aDesc = B2UCONST( "Master slide" ); + aDesc = B2UCONST( "Master_Slide" ); else aDesc = B2UCONST( "Slide" ); - xExtDocHandler->unknown( aDesc ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aDesc ); } } + SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE ); + const Point aNullPt; + if( bMaster ) { const GDIMetaFile& rMtf = (*mpObjects)[ xDrawPage ].GetRepresentation(); @@ -639,15 +638,9 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) if( xShapes.is() ) { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Group" ) ); SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE ); - { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE ); - Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); - - xExtDocHandler->unknown( B2UCONST( "Group" ) ); - } - bRet = implExportShapes( xShapes ); } } @@ -663,13 +656,25 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) const Size aSize( aBoundRect.Width, aBoundRect.Height ); { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) ); SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", TRUE, TRUE ); + Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); + + OUString aTitle; + xShapePropSet->getPropertyValue( B2UCONST( "Title" ) ) >>= aTitle; + if( aTitle.getLength() ) { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE ); - Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); + SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "title", TRUE, TRUE ); + xExtDocHandler->characters( aTitle ); + } - xExtDocHandler->unknown( implGetDescriptionFromShape( rxShape ) ); + OUString aDescription; + xShapePropSet->getPropertyValue( B2UCONST( "Description" ) ) >>= aDescription; + if( aDescription.getLength() ) + { + SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", TRUE, TRUE ); + xExtDocHandler->characters( aDescription ); } if( rMtf.GetActionCount() ) @@ -868,7 +873,7 @@ sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage // ----------------------------------------------------------------------------- -OUString SVGFilter::implGetDescriptionFromShape( const Reference< XShape >& rxShape ) +OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape ) { OUString aRet; const OUString aShapeType( rxShape->getShapeType() ); @@ -886,7 +891,7 @@ OUString SVGFilter::implGetDescriptionFromShape( const Reference< XShape >& rxSh else if( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 ) aRet = B2UCONST( "Date/Time" ); else if( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) - aRet = B2UCONST( "Slide Number" ); + aRet = B2UCONST( "Slide_Number" ); else aRet = B2UCONST( "Drawing" ); diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index d1025baea0bf..25efa6cd0ba7 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -56,7 +56,7 @@ #include <com/sun/star/java/XJavaThreadRegister_11.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <osl/diagnose.h> #include <rtl/process.h> #include <tools/debug.hxx> @@ -175,7 +175,7 @@ class SVGFilter : public cppu::WeakImplHelper4 < XFilter, XExporter, XExtendedFilterDetection > { - typedef ::std::hash_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap; + typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap; private: @@ -222,7 +222,7 @@ private: sal_Bool implCreateObjectsFromShape( const Reference< XShape >& rxShape ); sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage ); - ::rtl::OUString implGetDescriptionFromShape( const Reference< XShape >& rxShape ); + ::rtl::OUString implGetClassFromShape( const Reference< XShape >& rxShape ); ::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf ); DECL_LINK( CalcFieldHdl, EditFieldInfo* ); diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx index 12c1733d1119..45a27e7aeaec 100644 --- a/filter/source/svg/svgfontexport.hxx +++ b/filter/source/svg/svgfontexport.hxx @@ -39,7 +39,7 @@ class SVGFontExport { - typedef ::std::hash_map< ::rtl::OUString, ::std::set< sal_Unicode >, ::comphelper::UStringHash > GlyphMap; + typedef ::boost::unordered_map< ::rtl::OUString, ::std::set< sal_Unicode >, ::comphelper::UStringHash > GlyphMap; typedef ::std::vector< ObjectRepresentation > ObjectVector; private: diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index 4f2b9eb141c7..0357462d9016 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -64,7 +64,7 @@ #include <tools/zcodec.hxx> #include <boost/bind.hpp> -#include <hash_set> +#include <boost/unordered_set.hpp> #include <map> #include <string.h> @@ -147,6 +147,7 @@ struct AnnotatingVisitor StateMap& rStateMap, const State& rInitialState, const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler) : + mbSeenText(false), mnCurrStateId(0), maCurrState(), maParentStates(), @@ -266,6 +267,13 @@ struct AnnotatingVisitor maCurrState.maTransform.identity(); maCurrState.maViewBox.reset(); + // set default font size here to ensure writing styles for text + if( !mbSeenText && XML_TEXT == nTagId ) + { + maCurrState.mnFontSize = 12.0; + mbSeenText = true; + } + // scan for style info const sal_Int32 nNumAttrs( xAttributes->getLength() ); rtl::OUString sAttributeValue; @@ -410,13 +418,13 @@ struct AnnotatingVisitor const sal_uInt8 nGreen( toByteColor(rColor.g) ); const sal_uInt8 nBlue ( toByteColor(rColor.b) ); aBuf.append( sal_Unicode('#') ); - if( nRed < 10 ) + if( nRed < 0x10 ) aBuf.append( sal_Unicode('0') ); aBuf.append( sal_Int32(nRed), 16 ); - if( nGreen < 10 ) + if( nGreen < 0x10 ) aBuf.append( sal_Unicode('0') ); aBuf.append( sal_Int32(nGreen), 16 ); - if( nBlue < 10 ) + if( nBlue < 0x10 ) aBuf.append( sal_Unicode('0') ); aBuf.append( sal_Int32(nBlue), 16 ); @@ -873,7 +881,7 @@ struct AnnotatingVisitor { // TODO(F1): preserveAspectRatio parseViewBox( - aValueUtf8, + aValueUtf8.getStr(), maCurrState.maViewBox); break; } @@ -990,6 +998,14 @@ struct AnnotatingVisitor rParent.maStrokeGradient ); break; } + case XML_COLOR: + { + if( aValueUtf8 == "inherit" ) + maCurrState.maCurrentColor = maParentStates.back().maCurrentColor; + else + parseColor(aValueUtf8.getStr(), maCurrState.maCurrentColor); + break; + } case XML_TRANSFORM: { basegfx::B2DHomMatrix aTransform; @@ -1019,7 +1035,7 @@ struct AnnotatingVisitor if( maGradientVector.empty() || maGradientVector.back().maStops.empty() ) break; - parseColor( aValueUtf8, + parseColor( aValueUtf8.getStr(), maGradientStopVector[ maGradientVector.back().maStops.back()].maStopColor ); break; @@ -1027,7 +1043,7 @@ struct AnnotatingVisitor if( maGradientVector.empty() || maGradientVector.back().maStops.empty() ) break; - parseOpacity( aValueUtf8, + parseOpacity( aValueUtf8.getStr(), maGradientStopVector[ maGradientVector.back().maStops.back()].maStopColor ); break; @@ -1153,6 +1169,7 @@ struct AnnotatingVisitor } } + bool mbSeenText; sal_Int32 mnCurrStateId; State maCurrState; std::vector<State> maParentStates; @@ -1458,7 +1475,7 @@ struct ShapeWritingVisitor // collect text from all TEXT_NODE children into sText rtl::OUStringBuffer sText; visitChildren(boost::bind( - (rtl::OUStringBuffer& (rtl::OUStringBuffer::*)(const sal_Unicode* str))&rtl::OUStringBuffer::append, + (rtl::OUStringBuffer& (rtl::OUStringBuffer::*)(const rtl::OUString& str))&rtl::OUStringBuffer::append, boost::ref(sText), boost::bind(&xml::dom::XNode::getNodeValue, _1)), @@ -2368,7 +2385,7 @@ struct ShapeRenderingVisitor // collect text from all TEXT_NODE children into sText rtl::OUStringBuffer sText; visitChildren(boost::bind( - (rtl::OUStringBuffer& (rtl::OUStringBuffer::*)(const sal_Unicode* str))&rtl::OUStringBuffer::append, + (rtl::OUStringBuffer& (rtl::OUStringBuffer::*)(const rtl::OUString& str))&rtl::OUStringBuffer::append, boost::ref(sText), boost::bind(&xml::dom::XNode::getNodeValue, _1)), diff --git a/filter/source/svg/svgscript.hxx b/filter/source/svg/svgscript.hxx index 88d0517ce626..2019994dced0 100644 --- a/filter/source/svg/svgscript.hxx +++ b/filter/source/svg/svgscript.hxx @@ -119,94 +119,4 @@ static const char aSVGScript2[] = init();\n\ ]]>"; -/* -<![CDATA[ - var nCurSlide = 0; - var nSlides = 0; - var aSlides = new Object(); - var aMasters = new Object(); - var aMasterVisibilities; - - function onClick( aEvt ) - { - var nOffset = 0; - - if( aEvt.getButton() == 0 ) - nOffset = 1; - else if( aEvt.getButton() == 2 ) - nOffset = -1; - - if( 0 != nOffset ) - switchSlide( aEvt, nOffset ); - } - - function onKeyPress( aEvt ) - { - var nCode = String.fromCharCode( aEvt.getCharCode() ); - var nOffset = 0; - - if( ( ' ' == nCode ) || - ( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && - ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_DOWN() || - aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_RIGHT() ) ) ) - { - nOffset = 1; - } - else if( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && - ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_UP() || - aEvt.getKeyCode() == aEvt.DOM_VK_LEFT() ) ) - { - nOffset = -1 - } - - if( 0 != nOffset ) - switchSlide( aEvt, nOffset ); - } - - function switchSlide( aEvt, nOffset ) - { - var nNextSlide = nCurSlide + nOffset; - - if( nNextSlide < 0 && nSlides > 0 ) - nNextSlide = nSlides - 1; - else if( nNextSlide >= nSlides ) - nNextSlide = 0; - - aSlides[ nCurSlide ].setAttributeNS( null, "visibility", "hidden" ); - aSlides[ nNextSlide ].setAttributeNS( null, "visibility", "visible" ); - - var aCurMaster = aMasters[ nCurSlide ]; - var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ]; - - var aNextMaster = aMasters[ nNextSlide ]; - var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ]; - - if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) ) - { - if( aCurMaster != aNextMaster ) - aCurMaster.setAttributeNS( null, "visibility", "hidden" ); - - aNextMaster.setAttributeNS( null, "visibility", aNextMasterVisibility ); - } - - nCurSlide = nNextSlide; - } - - function init() - { - nSlides = document.getElementById( "meta_slides" ).getAttributeNS( null, "numberOfSlides" ); - - for( i = 0; i < nSlides; i++ ) - { - var aSlide = document.getElementById( "meta_slide" + i ); - - aSlides[ i ] = document.getElementById( aSlide.getAttributeNS( null, "slide" ) ); - aMasters[ i ] = document.getElementById( aSlide.getAttributeNS( null, "master" ) ); - aMasterVisibilities[ i ] = aSlide.getAttributeNS( null, "master-visibility" ); - } - } - - init(); -]]*/ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index d81a2aae5367..c14a0f5773a8 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -39,6 +39,10 @@ static const char aXMLElemG[] = "g"; static const char aXMLElemDefs[] = "defs"; static const char aXMLElemClipPath[] = "clipPath"; +static const char aXMLElemMask[] = "mask"; +static const char aXMLElemPattern[] = "pattern"; +static const char aXMLElemLinearGradient[] = "linearGradient"; +static const char aXMLElemStop[] = "stop"; static const char aXMLElemLine[] = "line"; static const char aXMLElemRect[] = "rect"; static const char aXMLElemEllipse[] = "ellipse"; @@ -66,21 +70,11 @@ static const char aXMLAttrRY[] = "ry"; static const char aXMLAttrWidth[] = "width"; static const char aXMLAttrHeight[] = "height"; static const char aXMLAttrPoints[] = "points"; +static const char aXMLAttrPatternUnits[] = "patternUnits"; +static const char aXMLAttrGradientUnits[] = "gradientUnits"; +static const char aXMLAttrOffset[] = "offset"; static const char aXMLAttrXLinkHRef[] = "xlink:href"; -static const sal_Unicode pBase64[] = -{ - //0 1 2 3 4 5 6 7 - 'A','B','C','D','E','F','G','H', // 0 - 'I','J','K','L','M','N','O','P', // 1 - 'Q','R','S','T','U','V','W','X', // 2 - 'Y','Z','a','b','c','d','e','f', // 3 - 'g','h','i','j','k','l','m','n', // 4 - 'o','p','q','r','s','t','u','v', // 5 - 'w','x','y','z','0','1','2','3', // 6 - '4','5','6','7','8','9','+','/' // 7 -}; - // -------------- // - FastString - // -------------- @@ -98,64 +92,6 @@ FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) : // ----------------------------------------------------------------------------- -FastString::FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ) : - mnBufInc( 2048 ), - mnPartPos( 0 ) -{ - DBG_ASSERT( pBufferForBase64Encoding && nBufLen, "invalid arguments" ); - - const sal_uInt32 nQuadCount = nBufLen / 3; - const sal_uInt32 nRest = nBufLen % 3; - - if( nQuadCount || nRest ) - { - mnBufLen = mnCurLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 ); - mpBuffer = new sal_Unicode[ mnBufLen * sizeof( sal_Unicode ) ]; - - sal_Char* pTmpSrc = pBufferForBase64Encoding; - sal_Unicode* pTmpDst = mpBuffer; - - for( sal_uInt32 i = 0; i < nQuadCount; i++ ) - { - const sal_Int32 nA = *pTmpSrc++; - const sal_Int32 nB = *pTmpSrc++; - const sal_Int32 nC = *pTmpSrc++; - - *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ]; - *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ]; - *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ]; - *pTmpDst++ = pBase64[ nC & 0x3f ]; - } - - if( 1 == nRest ) - { - const sal_Int32 nA = *pTmpSrc; - - *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ]; - *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ]; - *pTmpDst++ = '='; - *pTmpDst = '='; - } - else if( 2 == nRest ) - { - const sal_Int32 nA = *pTmpSrc++; - const sal_Int32 nB = *pTmpSrc; - - *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ]; - *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ]; - *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ]; - *pTmpDst = '='; - } - } - else - { - mpBuffer = new sal_Unicode[ ( mnBufLen = 1 ) * sizeof( sal_Unicode ) ]; - mnCurLen = 0; - } -} - -// ----------------------------------------------------------------------------- - FastString::~FastString() { delete[] mpBuffer; @@ -198,39 +134,6 @@ const NMSP_RTL::OUString& FastString::GetString() const return maString; } -// ----------------------------------------------------------------------------- - -sal_Bool FastString::GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString ) -{ - const sal_uInt32 nLength = Min( mnCurLen, nPartLen ); - - mnPartPos = 0; - - if( nLength ) - { - rPartString = NMSP_RTL::OUString( mpBuffer, nLength ); - mnPartPos = nLength; - } - - return( rPartString.getLength() > 0 ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool FastString::GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString ) -{ - if( mnPartPos < mnCurLen ) - { - const sal_uInt32 nLength = Min( mnCurLen - mnPartPos, nPartLen ); - rPartString = NMSP_RTL::OUString( mpBuffer + mnPartPos, nLength ); - mnPartPos += nLength; - } - else - rPartString = NMSP_RTL::OUString(); - - return( rPartString.getLength() > 0 ); -} - // ---------------------- // - SVGAttributeWriter - // ---------------------- @@ -329,6 +232,21 @@ NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont ) // ----------------------------------------------------------------------------- +NMSP_RTL::OUString SVGAttributeWriter::GetColorStyle( const Color& rColor ) +{ + FastString aStyle; + aStyle += B2UCONST( "rgb(" ); + aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetRed() ); + aStyle += B2UCONST( "," ); + aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetGreen() ); + aStyle += B2UCONST( "," ); + aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rColor.GetBlue() ); + aStyle += B2UCONST( ")" ); + return aStyle.GetString(); +} + +// ----------------------------------------------------------------------------- + NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo ) { FastString aStyle; @@ -341,13 +259,7 @@ NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, c else { // line color value in rgb - aStyle += B2UCONST( "rgb(" ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetRed() ); - aStyle += B2UCONST( "," ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetGreen() ); - aStyle += B2UCONST( "," ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetBlue() ); - aStyle += B2UCONST( ")" ); + aStyle += GetColorStyle( rLineColor ); // line color opacity in percent if neccessary if( rLineColor.GetTransparency() ) @@ -429,13 +341,7 @@ NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, c else { // fill color value in rgb - aStyle += B2UCONST( "rgb(" ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetRed() ); - aStyle += B2UCONST( "," ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetGreen() ); - aStyle += B2UCONST( "," ); - aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetBlue() ); - aStyle += B2UCONST( ")" ); + aStyle += GetColorStyle( rFillColor ); // fill color opacity in percent if neccessary if( rFillColor.GetTransparency() ) @@ -483,7 +389,10 @@ SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, SVGFontExport& rFontExpo mrFontExport( rFontExport ), mpContext( NULL ), mbClipAttrChanged( sal_False ), - mnCurClipId( 1 ) + mnCurClipId( 1 ), + mnCurPatternId( 1 ), + mnCurGradientId( 1 ), + mnCurMaskId( 1 ) { mpVDev = new VirtualDevice; mpVDev->EnableOutput( sal_False ); @@ -653,7 +562,7 @@ void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const if( pLineColor ) { // !!! mrExport.AddAttribute( XML_NAMESPACE_NONE, ... ) - DBG_ERROR( "SVGActionWriter::ImplWriteLine: Line color not implemented" ); + OSL_FAIL( "SVGActionWriter::ImplWriteLine: Line color not implemented" ); } { @@ -763,44 +672,307 @@ void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bo // ----------------------------------------------------------------------------- +void SVGActionWriter::ImplWritePattern( const PolyPolygon& rPolyPoly, + const Hatch* pHatch, + const Gradient* pGradient, + const NMSP_RTL::OUString* pStyle, + sal_uInt32 nWriteFlags ) +{ + if( rPolyPoly.Count() ) + { + SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); + + FastString aPatternId; + aPatternId += B2UCONST( "pattern" ); + aPatternId += GetValueString( ImplGetNextPatternId() ); + + { + SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, TRUE, TRUE ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aPatternId.GetString() ); + + Rectangle aRect( ImplMap( rPolyPoly.GetBoundRect() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight() ) ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPatternUnits, NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse") ) ); + + { + SvXMLElementExport aElemPattern( mrExport, XML_NAMESPACE_NONE, aXMLElemPattern, TRUE, TRUE ); + + // The origin of a pattern is positioned at (aRect.Left(), aRect.Top()). + // So we need to adjust the pattern coordinate. + FastString aTransform; + aTransform += B2UCONST( "translate" ); + aTransform += B2UCONST( "(" ); + aTransform += GetValueString( -aRect.Left() ); + aTransform += B2UCONST( "," ); + aTransform += GetValueString( -aRect.Top() ); + aTransform += B2UCONST( ")" ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform.GetString() ); + + { + SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); + + GDIMetaFile aTmpMtf; + if( pHatch ) + mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf ); + else if ( pGradient ) + mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), *pGradient, aTmpMtf ); + ImplWriteActions( aTmpMtf, pStyle, nWriteFlags ); + } + } + } + + FastString aPatternStyle; + aPatternStyle += B2UCONST( "fill:url(#" ); + aPatternStyle += aPatternId.GetString(); + aPatternStyle += B2UCONST( ")" ); + + { + ImplWritePolyPolygon( rPolyPoly, sal_False, &aPatternStyle.GetString() ); + } + } +} + +// ----------------------------------------------------------------------------- + void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const NMSP_RTL::OUString* pStyle, sal_uInt32 nWriteFlags ) { + if ( rGradient.GetStyle() == GRADIENT_LINEAR || + rGradient.GetStyle() == GRADIENT_AXIAL ) + { + ImplWriteGradientLinear( rPolyPoly, rGradient ); + } + else + { + ImplWritePattern( rPolyPoly, NULL, &rGradient, pStyle, nWriteFlags ); + } +} + +void SVGActionWriter::ImplWriteGradientLinear( const PolyPolygon& rPolyPoly, + const Gradient& rGradient ) +{ if( rPolyPoly.Count() ) { - SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); - FastString aClipId; - FastString aClipStyle; + SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); - aClipId += B2UCONST( "clip" ); - aClipId += NMSP_RTL::OUString::valueOf( ImplGetNextClipId() ); + FastString aGradientId; + aGradientId += B2UCONST( "gradient" ); + aGradientId += GetValueString( ImplGetNextGradientId() ); { SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, TRUE, TRUE ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aClipId.GetString() ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aGradientId.GetString() ); + { + Rectangle aTmpRect; + Point aTmpCenter; + rGradient.GetBoundRect( rPolyPoly.GetBoundRect(), aTmpRect, aTmpCenter ); + const Rectangle aRect( ImplMap( aTmpRect) ); + const Point aCenter( ImplMap( aTmpCenter) ); + const sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + + Polygon aPoly( 2 ); + // Setting x value of a gradient vector to rotation center to + // place a gradient vector in a target polygon. + // This would help editing it in SVG editors like inkscape. + aPoly[ 0 ].X() = aPoly[ 1 ].X() = aCenter.X(); + aPoly[ 0 ].Y() = aRect.Top(); + aPoly[ 1 ].Y() = aRect.Bottom(); + aPoly.Rotate( aCenter, nAngle ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPoly[ 0 ].X() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPoly[ 0 ].Y() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPoly[ 1 ].X() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPoly[ 1 ].Y() ) ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, + NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM( "userSpaceOnUse" ) ) ); + } { - SvXMLElementExport aElemClipPath( mrExport, XML_NAMESPACE_NONE, aXMLElemClipPath, TRUE, TRUE ); - ImplWritePolyPolygon( rPolyPoly, sal_False ); + SvXMLElementExport aElemLinearGradient( mrExport, XML_NAMESPACE_NONE, aXMLElemLinearGradient, TRUE, TRUE ); + + const Color aStartColor = ImplGetColorWithIntensity( rGradient.GetStartColor(), rGradient.GetStartIntensity() ); + const Color aEndColor = ImplGetColorWithIntensity( rGradient.GetEndColor(), rGradient.GetEndIntensity() ); + double fBorderOffset = rGradient.GetBorder() / 100.0; + const sal_uInt16 nSteps = rGradient.GetSteps(); + if( rGradient.GetStyle() == GRADIENT_LINEAR ) + { + // Emulate non-smooth gradient + if( 0 < nSteps && nSteps < 100 ) + { + double fOffsetStep = ( 1.0 - fBorderOffset ) / (double)nSteps; + for( sal_uInt16 i = 0; i < nSteps; i++ ) { + Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps ); + ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep ); + aColor = ImplGetGradientColor( aStartColor, aEndColor, ( i + 1 ) / (double) nSteps ); + ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep ); + } + } + else + { + ImplWriteGradientStop( aStartColor, fBorderOffset ); + ImplWriteGradientStop( aEndColor, 1.0 ); + } + } + else + { + fBorderOffset /= 2; + // Emulate non-smooth gradient + if( 0 < nSteps && nSteps < 100 ) + { + double fOffsetStep = ( 0.5 - fBorderOffset ) / (double)nSteps; + // Upper half + for( sal_uInt16 i = 0; i < nSteps; i++ ) + { + Color aColor = ImplGetGradientColor( aEndColor, aStartColor, i / (double) nSteps ); + ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep ); + aColor = ImplGetGradientColor( aEndColor, aStartColor, (i + 1 ) / (double) nSteps ); + ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep ); + } + // Lower half + for( sal_uInt16 i = 0; i < nSteps; i++ ) + { + Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / (double) nSteps ); + ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep ); + aColor = ImplGetGradientColor( aStartColor, aEndColor, (i + 1 ) / (double) nSteps ); + ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep ); + } + } + else + { + ImplWriteGradientStop( aEndColor, fBorderOffset ); + ImplWriteGradientStop( aStartColor, 0.5 ); + ImplWriteGradientStop( aEndColor, 1.0 - fBorderOffset ); + } + } } } - // create new context with clippath set - aClipStyle += B2UCONST( "clip-path:URL(#" ); - aClipStyle += aClipId.GetString(); - aClipStyle += B2UCONST( ")" ); + FastString aGradientStyle; + aGradientStyle += B2UCONST( "fill:" ); + aGradientStyle += B2UCONST( "url(#" ); + aGradientStyle += aGradientId.GetString(); + aGradientStyle += B2UCONST( ")" ); + + { + ImplWritePolyPolygon( rPolyPoly, sal_False, &aGradientStyle.GetString() ); + } + } +} + +void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset ) +{ + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, NMSP_RTL::OUString::valueOf( fOffset ) ); + + FastString aStyle; + aStyle += B2UCONST( "stop-color:" ); + aStyle += mpContext->GetColorStyle ( rColor ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() ); + { + SvXMLElementExport aElemStartStop( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, TRUE, TRUE ); + } +} + +Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor, + sal_uInt16 nIntensity ) +{ + sal_uInt8 nNewRed = (sal_uInt8)( (long)rColor.GetRed() * nIntensity / 100L ); + sal_uInt8 nNewGreen = (sal_uInt8)( (long)rColor.GetGreen() * nIntensity / 100L ); + sal_uInt8 nNewBlue = (sal_uInt8)( (long)rColor.GetBlue() * nIntensity / 100L ); + return Color( nNewRed, nNewGreen, nNewBlue); +} + +Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor, + const Color& rEndColor, + double fOffset ) +{ + long nRedStep = rEndColor.GetRed() - rStartColor.GetRed(); + long nNewRed = rStartColor.GetRed() + (long)( nRedStep * fOffset ); + nNewRed = ( nNewRed < 0 ) ? 0 : ( nNewRed > 0xFF) ? 0xFF : nNewRed; + + long nGreenStep = rEndColor.GetGreen() - rStartColor.GetGreen(); + long nNewGreen = rStartColor.GetGreen() + (long)( nGreenStep * fOffset ); + nNewGreen = ( nNewGreen < 0 ) ? 0 : ( nNewGreen > 0xFF) ? 0xFF : nNewGreen; + + long nBlueStep = rEndColor.GetBlue() - rStartColor.GetBlue(); + long nNewBlue = rStartColor.GetBlue() + (long)( nBlueStep * fOffset ); + nNewBlue = ( nNewBlue < 0 ) ? 0 : ( nNewBlue > 0xFF) ? 0xFF : nNewBlue; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aClipStyle.GetString() ); + return Color( (sal_uInt8)nNewRed, (sal_uInt8)nNewGreen, (sal_uInt8)nNewBlue ); +} + +// ----------------------------------------------------------------------------- + +void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf, + const Point& rDestPt, + const Size& rDestSize, + const Gradient& rGradient, + const NMSP_RTL::OUString* pStyle, + sal_uInt32 nWriteFlags ) +{ + Point aSrcPt( rMtf.GetPrefMapMode().GetOrigin() ); + const Size aSrcSize( rMtf.GetPrefSize() ); + const double fScaleX = aSrcSize.Width() ? (double) rDestSize.Width() / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? (double) rDestSize.Height() / aSrcSize.Height() : 1.0; + long nMoveX, nMoveY; + + if( fScaleX != 1.0 || fScaleY != 1.0 ) + { + rMtf.Scale( fScaleX, fScaleY ); + aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY ); + } + + nMoveX = rDestPt.X() - aSrcPt.X(), nMoveY = rDestPt.Y() - aSrcPt.Y(); + + if( nMoveX || nMoveY ) + rMtf.Move( nMoveX, nMoveY ); + + FastString aMaskId; + aMaskId += B2UCONST( "mask" ); + aMaskId += GetValueString( ImplGetNextMaskId() ); + + { + SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, TRUE, TRUE ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aMaskId.GetString() ); { - GDIMetaFile aTmpMtf; - SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); + SvXMLElementExport aElemMask( mrExport, XML_NAMESPACE_NONE, aXMLElemMask, TRUE, TRUE ); - mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); - ImplWriteActions( aTmpMtf, pStyle, nWriteFlags ); + const PolyPolygon aPolyPolygon( PolyPolygon( Rectangle( rDestPt, rDestSize ) ) ); + Gradient aGradient( rGradient ); + + // swap gradient stops to adopt SVG mask + Color aTmpColor( aGradient.GetStartColor() ); + sal_uInt16 nTmpIntensity( aGradient.GetStartIntensity() ); + aGradient.SetStartColor( aGradient.GetEndColor() ); + aGradient.SetStartIntensity( aGradient.GetEndIntensity() ) ; + aGradient.SetEndColor( aTmpColor ); + aGradient.SetEndIntensity( nTmpIntensity ); + + ImplWriteGradientEx( aPolyPolygon, aGradient, pStyle, nWriteFlags ); } } + + FastString aMaskStyle; + aMaskStyle += B2UCONST( "mask:url(#" ); + aMaskStyle += aMaskId.GetString(); + aMaskStyle += B2UCONST( ")" ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aMaskStyle.GetString() ); + + { + SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE ); + + mpVDev->Push(); + ImplWriteActions( rMtf, pStyle, nWriteFlags ); + mpVDev->Pop(); + } } // ----------------------------------------------------------------------------- @@ -1106,59 +1278,21 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx, if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE ) { - const Point aPt( ImplMap( rPt ) ); - const Size aSz( ImplMap( rSz ) ); - FastString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell() ); - REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY ); + const Point aPt( ImplMap( rPt ) ); + const Size aSz( ImplMap( rSz ) ); + Sequence< sal_Int8 > aSeq( (sal_Int8*) aOStm.GetData(), aOStm.Tell() ); + NMSP_RTL::OUStringBuffer aBuffer; + aBuffer.appendAscii( "data:image/png;base64," ); + SvXMLUnitConverter::encodeBase64( aBuffer, aSeq ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aSz.Width() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aSz.Height() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, aBuffer.makeStringAndClear() ); - if( xExtDocHandler.is() ) { - static const sal_uInt32 nPartLen = 64; - const NMSP_RTL::OUString aSpace( ' ' ); - const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) ); - NMSP_RTL::OUString aString; - NMSP_RTL::OUString aImageString; - - aString = aLineFeed; - aString += B2UCONST( "<" ); - aString += NMSP_RTL::OUString::createFromAscii( aXMLElemImage ); - aString += aSpace; - - aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrX ); - aString += B2UCONST( "=\"" ); - aString += GetValueString( aPt.X() ); - aString += B2UCONST( "\" " ); - - aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrY ); - aString += B2UCONST( "=\"" ); - aString += GetValueString( aPt.Y() ); - aString += B2UCONST( "\" " ); - - aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrWidth ); - aString += B2UCONST( "=\"" ); - aString += GetValueString( aSz.Width() ); - aString += B2UCONST( "\" " ); - - aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrHeight ); - aString += B2UCONST( "=\"" ); - aString += GetValueString( aSz.Height() ); - aString += B2UCONST( "\" " ); - - aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrXLinkHRef ); - aString += B2UCONST( "=\"data:image/png;base64," ); - - if( aImageData.GetFirstPartString( nPartLen, aImageString ) ) - { - xExtDocHandler->unknown( aString += aImageString ); - - while( aImageData.GetNextPartString( nPartLen, aImageString ) ) - { - xExtDocHandler->unknown( aLineFeed ); - xExtDocHandler->unknown( aImageString ); - } - } - - xExtDocHandler->unknown( B2UCONST( "\"/>" ) ); + SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemImage, TRUE, TRUE ); } } } @@ -1409,10 +1543,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, if( nWriteFlags & SVGWRITER_WRITE_FILL ) { const MetaHatchAction* pA = (const MetaHatchAction*) pAction; - GDIMetaFile aTmpMtf; - - mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); - ImplWriteActions( aTmpMtf, pStyle, nWriteFlags ); + ImplWritePattern( pA->GetPolyPolygon(), &pA->GetHatch(), NULL, pStyle, nWriteFlags ); } } break; @@ -1446,28 +1577,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction; GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() ); - Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() ); - const Size aSrcSize( aTmpMtf.GetPrefSize() ); - const Point aDestPt( pA->GetPoint() ); - const Size aDestSize( pA->GetSize() ); - const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0; - const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0; - long nMoveX, nMoveY; - - if( fScaleX != 1.0 || fScaleY != 1.0 ) - { - aTmpMtf.Scale( fScaleX, fScaleY ); - aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY ); - } - - nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y(); - - if( nMoveX || nMoveY ) - aTmpMtf.Move( nMoveX, nMoveY ); - - mpVDev->Push(); - ImplWriteActions( aTmpMtf, pStyle, nWriteFlags ); - mpVDev->Pop(); + ImplWriteMask( aTmpMtf, pA->GetPoint(), pA->GetSize(), + pA->GetGradient(), pStyle, nWriteFlags ); } } break; @@ -1708,7 +1819,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, break; default: - DBG_ERROR( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" ); + OSL_FAIL( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" ); break; } } diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index 04d2dfb352e2..d6ce2b223e5e 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -44,6 +44,7 @@ #include <vcl/cvtgrf.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/nmspmap.hxx> +#include <xmloff/xmluconv.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/RuntimeException.hpp> @@ -102,14 +103,11 @@ private: public: FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 ); - FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ); ~FastString(); FastString& operator+=( const ::rtl::OUString& rStr ); const ::rtl::OUString& GetString() const; - sal_Bool GetFirstPartString( const sal_uInt32 nPartLen, ::rtl::OUString& rPartString ); - sal_Bool GetNextPartString( const sal_uInt32 nPartLen, ::rtl::OUString& rPartString ); sal_uInt32 GetLength() const { return mnCurLen; } void Clear() { mnCurLen = 0, maString = ::rtl::OUString(); } @@ -142,6 +140,7 @@ public: virtual ~SVGAttributeWriter(); ::rtl::OUString GetFontStyle( const Font& rFont ); + ::rtl::OUString GetColorStyle( const Color& rColor ); ::rtl::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor, const LineInfo* pLineInfo ); void SetFontAttr( const Font& rFont ); @@ -165,6 +164,9 @@ private: SVGAttributeWriter* mpContext; sal_Bool mbClipAttrChanged; sal_Int32 mnCurClipId; + sal_Int32 mnCurPatternId; + sal_Int32 mnCurGradientId; + sal_Int32 mnCurMaskId; Stack maContextStack; VirtualDevice* mpVDev; MapMode maTargetMapMode; @@ -185,7 +187,13 @@ private: void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const ::rtl::OUString* pStyle = NULL ); void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const ::rtl::OUString* pStyle = NULL ); void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const ::rtl::OUString* pStyle = NULL ); + void ImplWritePattern( const PolyPolygon& rPolyPoly, const Hatch* pHatch, const Gradient* pGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags ); void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags ); + void ImplWriteGradientLinear( const PolyPolygon& rPolyPoly, const Gradient& rGradient ); + void ImplWriteGradientStop( const Color& rColor, double fOffset ); + Color ImplGetColorWithIntensity( const Color& rColor, USHORT nIntensity ); + Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset ); + void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags ); void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const ::rtl::OUString* pStyle = NULL ); void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const ::rtl::OUString* pStyle, Color aTextColor ); void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const ::rtl::OUString* pStyle = NULL ); @@ -195,6 +203,9 @@ private: void ImplWriteActions( const GDIMetaFile& rMtf, const ::rtl::OUString* pStyle, sal_uInt32 nWriteFlags ); sal_Int32 ImplGetNextClipId() { return mnCurClipId++; } + sal_Int32 ImplGetNextPatternId() { return mnCurPatternId++; } + sal_Int32 ImplGetNextGradientId() { return mnCurGradientId++; } + sal_Int32 ImplGetNextMaskId() { return mnCurMaskId++; } public: diff --git a/filter/source/svg/test/parsertest.cxx b/filter/source/svg/test/parsertest.cxx index 89728fec673f..07845ba63941 100644 --- a/filter/source/svg/test/parsertest.cxx +++ b/filter/source/svg/test/parsertest.cxx @@ -27,7 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_filter.hxx" -#include <cppunit/simpleheader.hxx> +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> #include "../gfxtypes.hxx" #include "../parserfragments.hxx" @@ -215,8 +217,4 @@ public: CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestParser, "test svg parser fragments"); -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/t602/makefile.mk b/filter/source/t602/makefile.mk index c65de1bc9b7c..f5ee62405f7e 100644 --- a/filter/source/t602/makefile.mk +++ b/filter/source/t602/makefile.mk @@ -48,7 +48,6 @@ SHL1OBJS=$(SLOFILES) SHL1TARGET=$(LIBNAME)$(DLLPOSTFIX) SHL1IMPLIB=i$(LIBNAME) SHL1VERSIONMAP=$(SOLARENV)/src/component.map -#SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) SHL1STDLIBS= \ diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index cf13627d3463..be367005d217 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -61,7 +61,6 @@ #include <comphelper/genericpropertyset.hxx> #include <comphelper/propertysetinfo.hxx> -using namespace rtl; using namespace comphelper; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -75,6 +74,8 @@ using namespace com::sun::star::xml::sax; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::task; +using ::rtl::OUString; + #define MAP_LEN(x) x, sizeof(x) - 1 Reference< com::sun::star::frame::XModel > xModel; @@ -151,7 +152,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star //******************** //Template Loading if Required //******************** - if (!msTemplateName.equalsAscii("")){ + if (msTemplateName.getLength()){ Reference< XStyleFamiliesSupplier > xstylefamiliessupplier(mxDoc, UNO_QUERY); Reference< XNameAccess >xName; diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx index 5fa92e9b0a7b..ddf8926567e0 100644 --- a/filter/source/xmlfilterdetect/filterdetect.cxx +++ b/filter/source/xmlfilterdetect/filterdetect.cxx @@ -106,7 +106,6 @@ Reference< com::sun::star::frame::XModel > xModel; com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInStream; ::rtl::OUString temp; - //OSL_ENSURE( sal_False, " starting Detect" ); const PropertyValue * pValue = aArguments.getConstArray(); sal_Int32 nLength; ::rtl::OString resultString; @@ -115,20 +114,13 @@ Reference< com::sun::star::frame::XModel > xModel; sal_Int32 location=nLength; for ( sal_Int32 i = 0 ; i < nLength; i++) { - //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(pValue[i].Name,RTL_TEXTENCODING_ASCII_US).getStr() ); if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) ) { - //pValue[i].Value >>= originalTypeName; - location=i; - // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() ); - + location=i; } else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) ) { - pValue[i].Value >>= sUrl; - //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sUrl,RTL_TEXTENCODING_ASCII_US).getStr() ); - } else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) ) { @@ -163,18 +155,18 @@ Reference< com::sun::star::frame::XModel > xModel; sal_Int32 new_nlength=0; sal_Int32 i = 0 ; - while( (i < nLength) && (sTypeName.equalsAscii(""))) + while( (i < nLength) && (sTypeName.getLength() == 0)) { Any elem = xTypeCont->getByName(myTypes[i]); elem >>=lProps; new_nlength = lProps.getLength(); sal_Int32 j =0; - while( j < new_nlength && sTypeName.equalsAscii("")) + while( j < new_nlength && (sTypeName.getLength() == 0)) { ::rtl::OUString tmpStr; lProps[j].Value >>=tmpStr; - if((lProps[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClipboardFormat"))) && (!tmpStr.equalsAscii("")) ) + if((lProps[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ClipboardFormat"))) && tmpStr.getLength() ) { sTypeName = supportedByType(tmpStr,resultString, myTypes[i]); } @@ -189,11 +181,7 @@ Reference< com::sun::star::frame::XModel > xModel; { OSL_ENSURE( sal_False, "An Exception occurred while opening File stream" ); } - if(sTypeName.equalsAscii("")) - { - //sTypeName=::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("writer_Flat_XML_File")); - } - else + if (sTypeName.getLength()) { if ( location == aArguments.getLength() ) { @@ -202,8 +190,6 @@ Reference< com::sun::star::frame::XModel > xModel; } aArguments[location].Value <<=sTypeName; } - // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() ); - return sTypeName; } @@ -217,7 +203,6 @@ Reference< com::sun::star::frame::XModel > xModel; if((clipBoardFormat.match(OUString( RTL_CONSTASCII_USTRINGPARAM( "doctype:" ))))) { ::rtl::OString tryStr = ::rtl::OUStringToOString(clipBoardFormat.copy(8),RTL_TEXTENCODING_ASCII_US).getStr(); - // OSL_ENSURE( sal_False, tryStr); if (resultString.indexOf(tryStr) >= 0) { sTypeName = checkType; diff --git a/filter/source/xsltdialog/makefile.mk b/filter/source/xsltdialog/makefile.mk index 728a94bf0d36..d4ee83a497cf 100644 --- a/filter/source/xsltdialog/makefile.mk +++ b/filter/source/xsltdialog/makefile.mk @@ -31,7 +31,6 @@ TARGET=xsltdlg ENABLE_EXCEPTIONS=TRUE USE_DEFFILE=TRUE -#GEN_HID=TRUE GEN_HID_OTHER=TRUE # --- Settings ---------------------------------- diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx index a8a0704ff898..fb925b2c39a8 100644 --- a/filter/source/xsltdialog/typedetectionexport.cxx +++ b/filter/source/xsltdialog/typedetectionexport.cxx @@ -39,13 +39,14 @@ #include <comphelper/attributelist.hxx> -using namespace rtl; using namespace com::sun::star::beans; using namespace com::sun::star::uno; using namespace com::sun::star::io; using namespace com::sun::star::lang; using namespace com::sun::star::xml::sax; +using ::rtl::OUString; + TypeDetectionExporter::TypeDetectionExporter( Reference< XMultiServiceFactory >& xMSF ) : mxMSF( xMSF ) { @@ -228,7 +229,7 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML } catch( Exception& ) { - DBG_ERROR( "TypeDetectionExporter::doExport exception catched!" ); + OSL_FAIL( "TypeDetectionExporter::doExport exception catched!" ); } } @@ -258,7 +259,7 @@ void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler, } catch( Exception& ) { - DBG_ERROR( "TypeDetectionExporter::addProperty exception catched!" ); + OSL_FAIL( "TypeDetectionExporter::addProperty exception catched!" ); } } @@ -289,7 +290,7 @@ void TypeDetectionExporter::addLocaleProperty( Reference< XDocumentHandler > xHa } catch( Exception& ) { - DBG_ERROR( "TypeDetectionExporter::addLocaleProperty exception catched!" ); + OSL_FAIL( "TypeDetectionExporter::addLocaleProperty exception catched!" ); } } diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx index d2ec25e7a222..9133f9bd495c 100644 --- a/filter/source/xsltdialog/typedetectionimport.cxx +++ b/filter/source/xsltdialog/typedetectionimport.cxx @@ -43,9 +43,10 @@ using namespace com::sun::star::io; using namespace com::sun::star::beans; using namespace com::sun::star::xml::sax; using namespace com::sun::star; -using namespace rtl; using namespace std; +using ::rtl::OUString; + TypeDetectionImporter::TypeDetectionImporter( Reference< XMultiServiceFactory >& xMSF ) : mxMSF(xMSF), sRootNode( RTL_CONSTASCII_USTRINGPARAM( "oor:component-data" ) ), @@ -90,7 +91,7 @@ void TypeDetectionImporter::doImport( Reference< XMultiServiceFactory >& xMSF, R } catch( Exception& /* e */ ) { - DBG_ERROR( "TypeDetectionImporter::doImport exception catched!" ); + OSL_FAIL( "TypeDetectionImporter::doImport exception catched!" ); } } diff --git a/filter/source/xsltdialog/xmlfileview.cxx b/filter/source/xsltdialog/xmlfileview.cxx index f431357cdb27..4ee451e3869f 100644 --- a/filter/source/xsltdialog/xmlfileview.cxx +++ b/filter/source/xsltdialog/xmlfileview.cxx @@ -54,7 +54,6 @@ #include "xmlfileview.hrc" #include "xmlfilterhelpids.hrc" -using namespace rtl; using namespace osl; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -63,6 +62,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::xml; using namespace com::sun::star::xml::sax; +using ::rtl::OUString; + #define MAX_SYNTAX_HIGHLIGHT 20 #define MAX_HIGHLIGHTTIME 200 @@ -767,7 +768,7 @@ void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) { //was war das denn? #ifdef DEBUG - DBG_ERROR("Token nicht erkannt!") + OSL_FAIL("Token nicht erkannt!") DBG_ERROR(ByteString(sToken, gsl_getSystemTextEncoding()).GetBuffer()) #endif } diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index 4b6c633ee663..dc22a7ddbee8 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -57,7 +57,6 @@ #include "typedetectionexport.hxx" #include "typedetectionimport.hxx" -using namespace rtl; using namespace osl; using namespace comphelper; using namespace com::sun::star; @@ -69,6 +68,9 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::io; +using ::rtl::OUString; +using ::rtl::Uri; + XMLFilterJarHelper::XMLFilterJarHelper( Reference< XMultiServiceFactory >& xMSF ) : mxMSF( xMSF ), sVndSunStarPackage( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ), @@ -223,7 +225,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt { // in case of same named import / export XSLT the latter // is ignored - DBG_ERROR( "XMLFilterJarHelper::same named xslt filter exception!" ); + OSL_FAIL( "XMLFilterJarHelper::same named xslt filter exception!" ); } if( pFilter->maImportTemplate.getLength() ) @@ -260,7 +262,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt } catch( Exception& ) { - DBG_ERROR( "XMLFilterJarHelper::savePackage exception catched!" ); + OSL_FAIL( "XMLFilterJarHelper::savePackage exception catched!" ); } osl::File::remove( rPackageURL ); @@ -336,7 +338,7 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVect } catch( Exception& ) { - DBG_ERROR( "XMLFilterJarHelper::savePackage exception catched!" ); + OSL_FAIL( "XMLFilterJarHelper::savePackage exception catched!" ); } } @@ -398,7 +400,7 @@ bool XMLFilterJarHelper::copyFile( Reference< XHierarchicalNameAccess > xIfc, OU } catch( Exception& ) { - DBG_ERROR( "XMLFilterJarHelper::copyFile exception catched" ); + OSL_FAIL( "XMLFilterJarHelper::copyFile exception catched" ); } return false; } diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 5d39f4ef907b..ffd868a2c662 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -54,7 +54,6 @@ #include "xmlfilterjar.hxx" #include "xmlfilterhelpids.hrc" -using namespace rtl; using namespace osl; using namespace com::sun::star::lang; using namespace com::sun::star::uno; @@ -64,6 +63,9 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::util; +using ::rtl::OUString; +using ::rtl::Uri; + ResMgr* XMLFilterSettingsDialog::mpResMgr = NULL; XMLFilterSettingsDialog::XMLFilterSettingsDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : @@ -114,7 +116,7 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog( Window* pParent, ResMgr& rResM } catch(Exception&) { - DBG_ERROR( "XMLFilterSettingsDialog::XMLFilterSettingsDialog exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::XMLFilterSettingsDialog exception catched!" ); } } @@ -432,7 +434,7 @@ OUString XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rIn } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::createUniqueInterfaceName exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::createUniqueInterfaceName exception catched!" ); } OUString aInterfaceName( rInterfaceName ); @@ -477,7 +479,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } } @@ -599,7 +601,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } } @@ -662,7 +664,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } } @@ -677,7 +679,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } } @@ -691,7 +693,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } } @@ -707,7 +709,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); bOk = false; } @@ -720,7 +722,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception catched!" ); } } @@ -897,7 +899,7 @@ void XMLFilterSettingsDialog::onDelete() } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::onDelete exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::onDelete exception catched!" ); } } } @@ -1238,7 +1240,7 @@ void XMLFilterSettingsDialog::initFilterList() } catch( ::com::sun::star::container::NoSuchElementException& ) { - DBG_ERROR( "Type not found, user error?" ); // TODO: error? + OSL_FAIL( "Type not found, user error?" ); // TODO: error? } } @@ -1251,7 +1253,7 @@ void XMLFilterSettingsDialog::initFilterList() } catch( Exception& ) { - DBG_ERROR( "XMLFilterSettingsDialog::initFilterList exception catched!" ); + OSL_FAIL( "XMLFilterSettingsDialog::initFilterList exception catched!" ); } } @@ -1765,7 +1767,7 @@ bool copyStreams( Reference< XInputStream > xIS, Reference< XOutputStream > xOS } catch(Exception&) { - DBG_ERROR( "copyStreams() exception catched!" ); + OSL_FAIL( "copyStreams() exception catched!" ); } return false; diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 32167288c449..221ad42904bd 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -45,12 +45,13 @@ #include "xmlfiltersettingsdialog.hrc" #include "xmlfilterhelpids.hrc" -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::lang; +using ::rtl::OUString; + XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const Reference< XMultiServiceFactory >& rxMSF, const filter_info_impl* pInfo ) : TabDialog( pParent, ResId( DLG_XML_FILTER_TABDIALOG, rResMgr ) ), mxMSF( rxMSF ), @@ -161,7 +162,7 @@ bool XMLFilterTabDialog::onOk() } catch( Exception& ) { - DBG_ERROR( "XMLFilterTabDialog::onOk exception catched!" ); + OSL_FAIL( "XMLFilterTabDialog::onOk exception catched!" ); } } } @@ -219,7 +220,7 @@ bool XMLFilterTabDialog::onOk() } catch( Exception& ) { - DBG_ERROR( "XMLFilterTabDialog::onOk exception catched!" ); + OSL_FAIL( "XMLFilterTabDialog::onOk exception catched!" ); } } } diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index 024a683d5b64..c9c8e2731096 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -36,8 +36,7 @@ #include "xmlfiltersettingsdialog.hxx" #include "xmlfilterhelpids.hrc" -using namespace rtl; - +using ::rtl::OUString; XMLFilterTabPageBasic::XMLFilterTabPageBasic( Window* pParent, ResMgr& rResMgr ) : TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_BASIC, rResMgr ) ), maFTFilterName( this, ResId( FT_XML_FILTER_NAME, rResMgr ) ), diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index 48da5ae6eee5..c5ebd3b2591f 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -84,7 +84,7 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co } catch(Exception&) { - DBG_ERROR( "XMLFilterTabPageXSLT::XMLFilterTabPageXSLT exception catched!" ); + OSL_FAIL( "XMLFilterTabPageXSLT::XMLFilterTabPageXSLT exception catched!" ); } maPBDTDSchemaBrowse.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 63db8e717236..9cdb539c8154 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -60,7 +60,6 @@ #include "xmlfileview.hxx" -using namespace rtl; using namespace utl; using namespace osl; using namespace comphelper; @@ -75,6 +74,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::xml; using namespace com::sun::star::xml::sax; +using ::rtl::OUString; + class GlobalEventListenerImpl : public ::cppu::WeakImplHelper1< com::sun::star::document::XEventListener > { public: @@ -135,7 +136,7 @@ static bool checkComponent( Reference< XComponent >& rxComponent, const OUString } catch( Exception& ) { - DBG_ERROR( "checkComponent exception catched!" ); + OSL_FAIL( "checkComponent exception catched!" ); } return false; @@ -194,7 +195,7 @@ XMLFilterTestDialog::XMLFilterTestDialog( Window* pParent, ResMgr& rResMgr, cons } catch( Exception& ) { - DBG_ERROR( "XMLFilterTestDialog::XMLFilterTestDialog exception catched!" ); + OSL_FAIL( "XMLFilterTestDialog::XMLFilterTestDialog exception catched!" ); } } @@ -207,7 +208,7 @@ XMLFilterTestDialog::~XMLFilterTestDialog() } catch( Exception& ) { - DBG_ERROR( "XMLFilterTestDialog::~XMLFilterTestDialog exception catched!" ); + OSL_FAIL( "XMLFilterTestDialog::~XMLFilterTestDialog exception catched!" ); } delete mpSourceDLG; @@ -452,7 +453,7 @@ void XMLFilterTestDialog::onExportBrowse() } catch(Exception&) { - DBG_ERROR("XMLFilterTestDialog::onExportBrowse exception caught!"); + OSL_FAIL("XMLFilterTestDialog::onExportBrowse exception caught!"); } initDialog(); @@ -559,7 +560,7 @@ void XMLFilterTestDialog::doExport( Reference< XComponent > xComp ) } catch( Exception& ) { - DBG_ERROR( "XMLFilterTestDialog::doExport exception catched!" ); + OSL_FAIL( "XMLFilterTestDialog::doExport exception catched!" ); } } @@ -692,7 +693,7 @@ void XMLFilterTestDialog::import( const OUString& rURL ) } catch(Exception&) { - DBG_ERROR("XMLFilterTestDialog::import catched an exception" ); + OSL_FAIL("XMLFilterTestDialog::import catched an exception" ); } } @@ -772,7 +773,7 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin } catch( Exception& ) { - DBG_ERROR( "XMLFilterTestDialog::getFrontMostDocument exception catched!" ); + OSL_FAIL( "XMLFilterTestDialog::getFrontMostDocument exception catched!" ); } return xRet; diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx new file mode 100644 index 000000000000..190c20ebd8b4 --- /dev/null +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -0,0 +1,443 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * [ Peter Jentsch <pjotr@guineapics.de> ] + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Peter Jentsch <pjotr@guineapics.de> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <cstdio> +#include <cstring> +#include <list> +#include <map> +#include <vector> +#include <iostream> +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <libxml/xmlIO.h> +#include <libxslt/transform.h> +#include <libxslt/xsltutils.h> +#include <libxslt/variables.h> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase.hxx> +#include <osl/module.h> +#include <osl/file.hxx> +#include <osl/process.h> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XActiveDataSink.hpp> +#include <com/sun/star/io/XActiveDataControl.hpp> +#include <com/sun/star/io/XStreamListener.hpp> + +#include <LibXSLTTransformer.hxx> + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::osl; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using ::std::list; +using ::std::map; +using ::std::pair; + +#define _INPUT_BUFFER_SIZE 4096 +#define _OUTPUT_BUFFER_SIZE 4096 + +namespace XSLT +{ + const char* const LibXSLTTransformer::PARAM_SOURCE_URL = "sourceURL"; + const char* const LibXSLTTransformer::PARAM_SOURCE_BASE_URL = + "sourceBaseURL"; + const char* const LibXSLTTransformer::PARAM_TARGET_URL = "targetURL"; + const char* const LibXSLTTransformer::PARAM_TARGET_BASE_URL = + "targetBaseURL"; + const char* const LibXSLTTransformer::PARAM_DOCTYPE_SYSTEM = "sytemType"; + const char* const LibXSLTTransformer::PARAM_DOCTYPE_PUBLIC = "publicType"; + + const sal_Int32 Reader::OUTPUT_BUFFER_SIZE = _OUTPUT_BUFFER_SIZE; + + const sal_Int32 Reader::INPUT_BUFFER_SIZE = _INPUT_BUFFER_SIZE; + + struct ParserInputBufferCallback + { + static int + on_read(void * context, char * buffer, int len) + { + Reader * tmp = static_cast<Reader*> (context); + return tmp->read(buffer, len); + } + static int + on_close(void * context) + { + Reader * tmp = static_cast<Reader*> (context); + return tmp->closeInput(); + } + }; + struct ParserOutputBufferCallback + { + static int + on_write(void * context, const char * buffer, int len) + { + Reader * tmp = static_cast<Reader*> (context); + return tmp->write(buffer, len); + } + static int + on_close(void * context) + { + Reader * tmp = static_cast<Reader*> (context); + return tmp->closeOutput(); + } + }; + + Reader::Reader(LibXSLTTransformer* transformer) : + m_transformer(transformer), m_terminated(false), m_readBuf( + INPUT_BUFFER_SIZE), m_writeBuf(OUTPUT_BUFFER_SIZE) + { + LIBXML_TEST_VERSION; + } + ; + + int + Reader::read(char * buffer, int len) + { + // const char *ptr = (const char *) context; + if (buffer == NULL || len < 0) + return (-1); + sal_Int32 n; + Reference<XInputStream> xis = this->m_transformer->getInputStream(); + n = xis.get()->readBytes(m_readBuf, len); + if (n > 0) + { + memcpy(buffer, m_readBuf.getArray(), n); + } + return n; + } + + int + Reader::write(const char * buffer, int len) + { + if (buffer == NULL || len < 0) + return -1; + if (len > 0) + { + Reference<XOutputStream> xos = m_transformer->getOutputStream(); + sal_Int32 writeLen = len; + sal_Int32 bufLen = ::std::min(writeLen, + this->OUTPUT_BUFFER_SIZE); + const sal_uInt8* memPtr = + reinterpret_cast<const sal_uInt8*> (buffer); + while (writeLen > 0) + { + sal_Int32 n = ::std::min(writeLen, bufLen); + m_writeBuf.realloc(n); + memcpy(m_writeBuf.getArray(), memPtr, + static_cast<size_t> (n)); + xos.get()->writeBytes(m_writeBuf); + memPtr += n; + writeLen -= n; + } + } + return len; + } + + int + Reader::closeInput() + { + return 0; + } + + int + Reader::closeOutput() + { + Reference<XOutputStream> xos = m_transformer->getOutputStream(); + if (xos.is()) + { + xos.get()->flush(); + xos.get()->closeOutput(); + } + m_transformer->done(); + return 0; + } + + void + Reader::run() + { + OSL_ASSERT(m_transformer != NULL); + OSL_ASSERT(m_transformer->getInputStream().is()); + OSL_ASSERT(m_transformer->getOutputStream().is()); + OSL_ASSERT(m_transformer->getStyleSheetURL()); + ::std::map<const char*, OString>::iterator pit; + ::std::map<const char*, OString> pmap = m_transformer->getParameters(); + ::std::vector< const char* > params( pmap.size() * 2 + 1 ); // build parameters + int paramIndex = 0; + for (pit = pmap.begin(); pit != pmap.end(); pit++) + { + params[paramIndex++] = (*pit).first; + params[paramIndex++] = (*pit).second.getStr(); + } + params[paramIndex] = NULL; + xmlDocPtr doc = xmlReadIO(&ParserInputBufferCallback::on_read, + &ParserInputBufferCallback::on_close, + static_cast<void*> (this), NULL, NULL, 0); + xsltStylesheetPtr styleSheet = xsltParseStylesheetFile( + (const xmlChar *) m_transformer->getStyleSheetURL().getStr()); + xmlDocPtr result = NULL; + xsltTransformContextPtr tcontext = NULL; + if (styleSheet) + { + tcontext = xsltNewTransformContext(styleSheet, doc); + xsltQuoteUserParams(tcontext, ¶ms[0]); + result = xsltApplyStylesheetUser(styleSheet, doc, 0, 0, 0, + tcontext); + } + + if (result) + { + xmlCharEncodingHandlerPtr encoder = xmlGetCharEncodingHandler( + XML_CHAR_ENCODING_UTF8); + xmlOutputBufferPtr outBuf = xmlAllocOutputBuffer(encoder); + outBuf->context = static_cast<void *> (this); + outBuf->writecallback = &ParserOutputBufferCallback::on_write; + outBuf->closecallback = &ParserOutputBufferCallback::on_close; + xsltSaveResultTo(outBuf, result, styleSheet); + } + else + { + xmlErrorPtr lastErr = xmlGetLastError(); + OUString msg; + if (lastErr) + msg = OUString::createFromAscii(lastErr->message); + else + msg = OUString::createFromAscii( + "Unknown XSLT transformation error"); + + m_transformer->error(msg); + } + closeOutput(); + xsltFreeStylesheet(styleSheet); + xsltFreeTransformContext(tcontext); + xmlFreeDoc(doc); + xmlFreeDoc(result); + } + ; + + void + Reader::onTerminated() + { + m_terminated = true; + } + ; + + Reader::~Reader() + { + } + + LibXSLTTransformer::LibXSLTTransformer( + const Reference<XMultiServiceFactory> &r) : + m_rServiceFactory(r) + { + } + + void + LibXSLTTransformer::setInputStream( + const Reference<XInputStream>& inputStream) + throw (RuntimeException) + { + m_rInputStream = inputStream; + } + + Reference<XInputStream> + LibXSLTTransformer::getInputStream() throw (RuntimeException) + { + return m_rInputStream; + } + + void + LibXSLTTransformer::setOutputStream( + const Reference<XOutputStream>& outputStream) + throw (RuntimeException) + { + m_rOutputStream = outputStream; + } + + Reference<XOutputStream> + LibXSLTTransformer::getOutputStream() throw (RuntimeException) + { + return m_rOutputStream; + } + + void + LibXSLTTransformer::addListener(const Reference<XStreamListener>& listener) + throw (RuntimeException) + { + m_listeners.insert(m_listeners.begin(), listener); + } + + void + LibXSLTTransformer::removeListener( + const Reference<XStreamListener>& listener) + throw (RuntimeException) + { + m_listeners.remove(listener); + } + + void + LibXSLTTransformer::start() throw (RuntimeException) + { + ListenerList::iterator it; + ListenerList* l = &m_listeners; + for (it = l->begin(); it != l->end(); ++it) + { + Reference<XStreamListener> xl = *it; + xl.get()->started(); + } + Reader* r = new Reader(this); + r->create(); + } + + void + LibXSLTTransformer::error(const OUString& msg) + { + ListenerList* l = &m_listeners; + Any arg; + arg <<= Exception(msg, *this); + for (ListenerList::iterator it = l->begin(); it != l->end(); ++it) + { + Reference<XStreamListener> xl = *it; + if (xl.is()) + { + xl.get()->error(arg); + } + } + } + + void + LibXSLTTransformer::done() + { + ListenerList* l = &m_listeners; + for (ListenerList::iterator it = l->begin(); it != l->end(); ++it) + { + Reference<XStreamListener> xl = *it; + if (xl.is()) + { + xl.get()->closed(); + } + } + } + + void + LibXSLTTransformer::terminate() throw (RuntimeException) + { + m_parameters.clear(); + } + + void + LibXSLTTransformer::initialize(const Sequence<Any>& params) + throw (RuntimeException) + { + xmlSubstituteEntitiesDefault(0); + m_parameters.clear(); + for (int i = 0; i < params.getLength(); i++) + { + NamedValue nv; + params[i] >>= nv; + OString nameUTF8 = OUStringToOString(nv.Name, + RTL_TEXTENCODING_UTF8); + OUString value; + OString valueUTF8; + if (nv.Value >>= value) + { + valueUTF8 = OUStringToOString(value, + RTL_TEXTENCODING_UTF8); + } + else + { + // ignore non-string parameters + continue; + } + if (nameUTF8.equals("StylesheetURL")) + { + m_styleSheetURL = valueUTF8; + } + else if (nameUTF8.equals("SourceURL")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_SOURCE_URL, valueUTF8)); + } + else if (nameUTF8.equals("SourceBaseURL")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_SOURCE_BASE_URL, valueUTF8)); + } + else if (nameUTF8.equals("TargetURL")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_TARGET_URL, valueUTF8)); + } + else if (nameUTF8.equals("TargetBaseURL")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_TARGET_BASE_URL, valueUTF8)); + } + else if (nameUTF8.equals("DoctypeSystem")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_DOCTYPE_SYSTEM, valueUTF8)); + } + else if (nameUTF8.equals("DoctypePublic")) + { + m_parameters.insert(pair<const char*, OString> ( + PARAM_DOCTYPE_PUBLIC, valueUTF8)); + } + } + } + + const OString + LibXSLTTransformer::getStyleSheetURL() + { + return m_styleSheetURL; + } + + ::std::map<const char*, OString> + LibXSLTTransformer::getParameters() + { + return m_parameters; + } +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx b/filter/source/xsltfilter/LibXSLTTransformer.hxx new file mode 100644 index 000000000000..16396a389025 --- /dev/null +++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx @@ -0,0 +1,201 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * [ Peter Jentsch <pjotr@guineapics.de> ] + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Peter Jentsch <pjotr@guineapics.de> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#ifndef __LIBXSLTTRANSFORMER_HXX__ +#define __LIBXSLTTRANSFORMER_HXX__ +#include "precompiled_filter.hxx" + +#include <stdio.h> + +#include <list> +#include <map> + +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <libxml/xmlIO.h> +#include <libxslt/transform.h> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase.hxx> + +#include <osl/thread.hxx> + +#include <com/sun/star/uno/Any.hxx> + +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XActiveDataSink.hpp> +#include <com/sun/star/io/XActiveDataControl.hpp> +#include <com/sun/star/io/XStreamListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/beans/NamedValue.hpp> + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::osl; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + +using ::std::list; +using ::std::map; + +namespace XSLT +{ + + /* + * LibXSLTTransformer provides an transforming pipe service to XSLTFilter. + * + * It implements XActiveDataSource, XActiveDataSink and XActiveDataControl + * to consume data. It also notifies upstream of important events such as + * begin and end of the transformation and of any errors that occur during + * transformation. + * + * TODO: Error reporting leaves room for improvement, currently. + * + * The actual transformation is done by a worker thread. + * + * See Reader below. + */ + class LibXSLTTransformer : public WeakImplHelper4<XActiveDataSink, + XActiveDataSource, XActiveDataControl, XInitialization> + { + private: + static const char* const PARAM_SOURCE_URL; + static const char* const PARAM_SOURCE_BASE_URL; + static const char* const PARAM_TARGET_URL; + static const char* const PARAM_TARGET_BASE_URL; + static const char* const PARAM_DOCTYPE_SYSTEM; + static const char* const PARAM_DOCTYPE_PUBLIC; + + // the UNO ServiceFactory + Reference<XMultiServiceFactory> m_rServiceFactory; + + Reference<XInputStream> m_rInputStream; + + Reference<XOutputStream> m_rOutputStream; + + typedef ::std::list<Reference<XStreamListener> > ListenerList; + + ListenerList m_listeners; + + OString m_styleSheetURL; + + ::std::map<const char *, OString> m_parameters; + + public: + + // ctor... + LibXSLTTransformer(const Reference<XMultiServiceFactory> &r); + + // XActiveDataSink + virtual void SAL_CALL + setInputStream(const Reference<XInputStream>& inputStream) + throw (RuntimeException); + virtual Reference<XInputStream> SAL_CALL + getInputStream() throw (RuntimeException); + // XActiveDataSource + virtual void SAL_CALL + setOutputStream(const Reference<XOutputStream>& outputStream) + throw (RuntimeException); + virtual Reference<XOutputStream> SAL_CALL + getOutputStream() throw (RuntimeException); + // XActiveDataControl + virtual void SAL_CALL + addListener(const Reference<XStreamListener>& listener) + throw (RuntimeException); + virtual void SAL_CALL + removeListener(const Reference<XStreamListener>& listener) + throw (RuntimeException); + virtual void SAL_CALL + start() throw (RuntimeException); + virtual void SAL_CALL + terminate() throw (RuntimeException); + virtual void SAL_CALL + initialize(const Sequence<Any>& params) throw (RuntimeException); + + void SAL_CALL + done(); + + void SAL_CALL + error(const OUString& msg); + + const OString SAL_CALL + getStyleSheetURL(); + + ::std::map<const char*, OString> SAL_CALL + getParameters(); + + }; + + /* + * Reader provides a worker thread to perform the actual transformation. + * It pipes the streams provided by a LibXSLTTransformer + * instance through libxslt. + */ + class Reader : public osl::Thread + { + public: + Reader(LibXSLTTransformer* transformer); + int SAL_CALL + read(char * buffer, int len); + int SAL_CALL + write(const char * buffer, int len); + int SAL_CALL + closeInput(); + int SAL_CALL + closeOutput(); + + protected: + virtual + ~Reader(); + + private: + static const sal_Int32 OUTPUT_BUFFER_SIZE; + static const sal_Int32 INPUT_BUFFER_SIZE; + LibXSLTTransformer* m_transformer; + sal_Bool m_terminated; + Sequence<sal_Int8> m_readBuf; + Sequence<sal_Int8> m_writeBuf; + + virtual void SAL_CALL + run(); + virtual void SAL_CALL + onTerminated(); + }; + +} +; + +#endif // __LIBXSLTTRANSFORMER_HXX__ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index c49faf479579..b00ccdd91b80 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -39,6 +39,8 @@ #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase.hxx> +#include <sax/tools/documenthandleradapter.hxx> + #include <osl/time.h> #include <osl/conditn.h> #include <tools/urlobj.hxx> @@ -76,10 +78,12 @@ #include <xmloff/attrlist.hxx> #include <fla.hxx> +#include <LibXSLTTransformer.hxx> using namespace ::rtl; using namespace ::cppu; using namespace ::osl; +using namespace ::sax; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::io; using namespace ::com::sun::star::uno; @@ -89,587 +93,550 @@ using namespace ::com::sun::star::xml; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::util; -namespace XSLT { - - -class FLABridge : public WeakImplHelper1< XDocumentHandler> +namespace XSLT { -private: - const Reference<XDocumentHandler>& m_rDocumentHandler; - const sal_Unicode *eval(const sal_Unicode *expr, sal_Int32 exprLen); - FLA::Evaluator ev; - bool active; - -public: - FLABridge(const Reference<XDocumentHandler>& m_rDocumentHandler); - - // XDocumentHandler - virtual void SAL_CALL startDocument() - throw (SAXException,RuntimeException); - virtual void SAL_CALL endDocument() - throw (SAXException, RuntimeException); - virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist) - throw (SAXException,RuntimeException); - virtual void SAL_CALL endElement(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL characters(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL ignorableWhitespace(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2) - throw (com::sun::star::xml::sax::SAXException,RuntimeException); - virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException,RuntimeException); - -}; - -FLABridge::FLABridge(const Reference<XDocumentHandler>& _rDocumentHandler) : m_rDocumentHandler(_rDocumentHandler), active(false) -{ -} -void FLABridge::startDocument() throw (SAXException,RuntimeException){ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->startDocument(); -} + /* + * FLABridge provides some obscure attribute mangling to wordml2000 import/export filters. + * In the long run, you might want to replace this with an XSLT extension function. + */ + class FLABridge : public WeakImplHelper1< DocumentHandlerAdapter > + { + private: + const sal_Unicode * + eval(const sal_Unicode *expr, sal_Int32 exprLen); + FLA::Evaluator ev; + bool active; -void FLABridge::endDocument() throw (SAXException,RuntimeException){ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endDocument(); + public: + FLABridge(const Reference<XDocumentHandler>& m_rDocumentHandler); -} + virtual void SAL_CALL + startElement(const OUString& str, + const Reference<XAttributeList>& attriblist) + throw (SAXException, RuntimeException); + }; -void FLABridge::startElement(const OUString& str, const Reference<XAttributeList>& attriblist) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - if (active) + FLABridge::FLABridge(const Reference<XDocumentHandler>& _rDocumentHandler) : active(false) { -// SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist); - const int len=attriblist->getLength(); - SvXMLAttributeList *_newattriblist= new SvXMLAttributeList(); - for(int i=0;i<len;i++) - { - const OUString& name=attriblist->getNameByIndex( sal::static_int_cast<sal_Int16>( i ) ); - sal_Int32 pos; - static const OUString _value_(".value", 6, RTL_TEXTENCODING_ASCII_US); - if ((pos=name.lastIndexOf(L'.'))!=-1 && name.match(_value_, pos)) + DocumentHandlerAdapter::setDelegate(_rDocumentHandler); + } + + void + FLABridge::startElement(const OUString& str, + const Reference<XAttributeList>& attriblist) throw (SAXException, + RuntimeException) + { + if (active) { - const OUString newName(name, pos); - const OUString& value=attriblist->getValueByIndex( sal::static_int_cast<sal_Int16>( i ) ); - const OUString newValue(ev.eval(value.getStr(), value.getLength())); - if (newValue.getLength()>0) - { - _newattriblist->AddAttribute(newName, newValue); - } + // SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist); + const int len = attriblist->getLength(); + SvXMLAttributeList *_newattriblist = new SvXMLAttributeList(); + for (int i = 0; i < len; i++) + { + const OUString& name = attriblist->getNameByIndex( + sal::static_int_cast<sal_Int16>(i)); + sal_Int32 pos; + static const OUString _value_(".value", 6, + RTL_TEXTENCODING_ASCII_US); + if ((pos = name.lastIndexOf(L'.')) != -1 && name.match( + _value_, pos)) + { + const OUString newName(name, pos); + const OUString + & value = + attriblist->getValueByIndex( + sal::static_int_cast< + sal_Int16>(i)); + const OUString newValue(ev.eval(value.getStr(), + value.getLength())); + if (newValue.getLength() > 0) + { + _newattriblist->AddAttribute(newName, + newValue); + } + } + else + { + _newattriblist->AddAttribute( + name, + attriblist->getValueByIndex( + sal::static_int_cast<sal_Int16>( + i))); + } + }; + const Reference<XAttributeList> newattriblist(_newattriblist); + DocumentHandlerAdapter::startElement(str, newattriblist); } - else + else { - _newattriblist->AddAttribute(name, attriblist->getValueByIndex( sal::static_int_cast<sal_Int16>( i ))); + if (str.compareToAscii("fla:fla.activate") == 0) + { + active = 1; + } + DocumentHandlerAdapter::startElement(str, attriblist); } - }; - const Reference<XAttributeList> newattriblist(_newattriblist); - m_rDocumentHandler->startElement(str, newattriblist); } - else + + /* + * XSLTFilter reads flat xml streams from the XML filter framework and passes + * them to an XSLT transformation service. XSLT transformation errors are + * reported to XSLTFilter. + * + * Currently, two implemations for the XSLT transformation service exist: + * a java based service (see XSLTransformer.java) and a libxslt based + * service (LibXSLTTransformer.cxx). + * + * The libxslt implementation will be used, if the value of the 2nd "UserData" + * parameter of the filter configuration is "libxslt" + */ + class XSLTFilter : public WeakImplHelper4<XImportFilter, XExportFilter, + XStreamListener, ExtendedDocumentHandlerAdapter> { - if (str.compareToAscii("fla:fla.activate")==0) - { - active=1; - } - m_rDocumentHandler->startElement(str, attriblist); + private: + static const OUString LIBXSLT_HELPER_SERVICE_IMPL; + + // the UNO ServiceFactory + Reference<XMultiServiceFactory> m_rServiceFactory; + + // DocumentHandler interface of the css::xml::sax::Writer service + Reference<XOutputStream> m_rOutputStream; + + Reference<XActiveDataControl> m_tcontrol; + + oslCondition m_cTransformed; + sal_Bool m_bTerminated; + sal_Bool m_bError; + + OUString m_aExportBaseUrl; + + OUString + rel2abs(const OUString&); + OUString + expandUrl(const OUString&); + + public: + + // ctor... + XSLTFilter(const Reference<XMultiServiceFactory> &r); + + // XStreamListener + virtual void SAL_CALL + error(const Any& a) throw (RuntimeException); + virtual void SAL_CALL + closed() throw (RuntimeException); + virtual void SAL_CALL + terminated() throw (RuntimeException); + virtual void SAL_CALL + started() throw (RuntimeException); + virtual void SAL_CALL + disposing(const EventObject& e) throw (RuntimeException); + + // XImportFilter + virtual sal_Bool SAL_CALL + importer(const Sequence<PropertyValue>& aSourceData, const Reference< + XDocumentHandler>& xHandler, + const Sequence<OUString>& msUserData) throw (RuntimeException); + + // XExportFilter + virtual sal_Bool SAL_CALL + exporter(const Sequence<PropertyValue>& aSourceData, const Sequence< + OUString>& msUserData) throw (RuntimeException); + + // XDocumentHandler + virtual void SAL_CALL + startDocument() throw (SAXException, RuntimeException); + virtual void SAL_CALL + endDocument() throw (SAXException, RuntimeException); + }; + + XSLTFilter::XSLTFilter(const Reference<XMultiServiceFactory> &r): +m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) + { + m_cTransformed = osl_createCondition(); } -} - -void FLABridge::endElement(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endElement(str); -} - -void FLABridge::characters(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->characters(str); -} - -void FLABridge::ignorableWhitespace(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->ignorableWhitespace(str); -} -void FLABridge::processingInstruction(const OUString& str, const OUString& str2) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->processingInstruction(str, str2); -} - -void FLABridge::setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->setDocumentLocator(doclocator); -} - - - -class XSLTFilter : public WeakImplHelper4< XImportFilter, XExportFilter, XDocumentHandler, XStreamListener> -{ -private: - // the UNO ServiceFactory - Reference< XMultiServiceFactory > m_rServiceFactory; - - // DocumentHandler interface of the css::xml::sax::Writer service - Reference < XExtendedDocumentHandler > m_rDocumentHandler; - Reference < XOutputStream > m_rOutputStream; - - // controls pretty-printing - sal_Bool m_bPrettyPrint; - - Reference< XActiveDataControl > m_tcontrol; - oslCondition m_cTransformed; - sal_Bool m_bTerminated; - sal_Bool m_bError; - - OUString m_aExportBaseUrl; - OUString m_aOldBaseUrl; - - OUString rel2abs(const OUString&); - OUString expandUrl(const OUString&); - -public: - - // ctor... - XSLTFilter( const Reference< XMultiServiceFactory > &r ); - - // XStreamListener - virtual void SAL_CALL error(const Any& a) throw (RuntimeException); - virtual void SAL_CALL closed() throw (RuntimeException); - virtual void SAL_CALL terminated() throw (RuntimeException); - virtual void SAL_CALL started() throw (RuntimeException); - virtual void SAL_CALL disposing(const EventObject& e) throw (RuntimeException); - - - // XImportFilter - virtual sal_Bool SAL_CALL importer( - const Sequence<PropertyValue>& aSourceData, - const Reference<XDocumentHandler>& xHandler, - const Sequence<OUString>& msUserData) - throw(RuntimeException); - - // XExportFilter - virtual sal_Bool SAL_CALL exporter( - const Sequence<PropertyValue>& aSourceData, - const Sequence<OUString>& msUserData) - throw(RuntimeException); - - // XDocumentHandler - virtual void SAL_CALL startDocument() - throw (SAXException,RuntimeException); - virtual void SAL_CALL endDocument() - throw (SAXException, RuntimeException); - virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist) - throw (SAXException,RuntimeException); - virtual void SAL_CALL endElement(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL characters(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL ignorableWhitespace(const OUString& str) - throw (SAXException, RuntimeException); - virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2) - throw (com::sun::star::xml::sax::SAXException,RuntimeException); - virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException,RuntimeException); -}; - -XSLTFilter::XSLTFilter( const Reference< XMultiServiceFactory > &r ) - : m_rServiceFactory(r) - , m_bPrettyPrint(sal_True) - , m_bTerminated(sal_False) - , m_bError(sal_False) -{ - m_cTransformed = osl_createCondition(); -} - -void XSLTFilter::disposing(const EventObject& ) throw (RuntimeException) -{ -} - -::rtl::OUString XSLTFilter::expandUrl( const ::rtl::OUString& sUrl ) -{ - ::rtl::OUString sExpandedUrl; - try + void + XSLTFilter::disposing(const EventObject&) throw (RuntimeException) { - Reference< XComponentContext > xContext; - Reference< XPropertySet > xProps( m_rServiceFactory, UNO_QUERY_THROW ); - xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW ); - Reference< XMacroExpander > xMacroExpander( xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ), UNO_QUERY_THROW ); - sExpandedUrl = xMacroExpander->expandMacros(sUrl); - sal_Int32 nPos = sExpandedUrl.indexOf(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ))); - if ( nPos != -1 ) - sExpandedUrl = sExpandedUrl.copy(nPos+20); } - catch (Exception&) {} - return sExpandedUrl; -} -void XSLTFilter::started() throw (RuntimeException) -{ - osl_resetCondition(m_cTransformed); -} -void XSLTFilter::error(const Any& a) throw (RuntimeException) -{ - Exception e; - if ( a >>= e) + ::rtl::OUString + XSLTFilter::expandUrl(const ::rtl::OUString& sUrl) { - OString aMessage("XSLTFilter::error was called: "); - aMessage += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, aMessage); + ::rtl::OUString sExpandedUrl; + try + { + Reference<XComponentContext> xContext; + Reference<XPropertySet> xProps(m_rServiceFactory, + UNO_QUERY_THROW); + xContext.set(xProps->getPropertyValue(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), + UNO_QUERY_THROW); + Reference<XMacroExpander> + xMacroExpander( + xContext->getValueByName( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" ))), + UNO_QUERY_THROW); + sExpandedUrl = xMacroExpander->expandMacros(sUrl); + sal_Int32 nPos = sExpandedUrl.indexOf(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ))); + if (nPos != -1) + sExpandedUrl = sExpandedUrl.copy(nPos + 20); + } + catch (Exception&) + { + } + return sExpandedUrl; } - m_bError = sal_True; - osl_setCondition(m_cTransformed); -} -void XSLTFilter::closed() throw (RuntimeException) -{ - osl_setCondition(m_cTransformed); -} -void XSLTFilter::terminated() throw (RuntimeException) -{ - m_bTerminated = sal_True; - osl_setCondition(m_cTransformed); -} - -OUString XSLTFilter::rel2abs(const OUString& s) -{ - Reference< XStringSubstitution > subs(m_rServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ))), UNO_QUERY); - OUString aWorkingDir(subs->getSubstituteVariableValue(OUString(RTL_CONSTASCII_USTRINGPARAM("$(progurl)")))); - INetURLObject aObj( aWorkingDir ); - aObj.setFinalSlash(); - bool bWasAbsolute; - INetURLObject aURL = aObj.smartRel2Abs( - s, bWasAbsolute, false, INetURLObject::WAS_ENCODED, RTL_TEXTENCODING_UTF8, true ); - return aURL.GetMainURL(INetURLObject::NO_DECODE); -} - - - -sal_Bool XSLTFilter::importer( - const Sequence<PropertyValue>& aSourceData, - const Reference<XDocumentHandler>& xHandler, - const Sequence<OUString>& msUserData) - throw (RuntimeException) -{ - if ( msUserData.getLength() < 5 ) - return sal_False; - - OUString udImport = msUserData[2]; - OUString udStyleSheet = rel2abs(msUserData[4]); - - // get information from media descriptor - // the imput stream that represents the imported file - // is most important here since we need to supply it to - // the sax parser that drives the supplied document handler - sal_Int32 nLength = aSourceData.getLength(); - OUString aName, aFileName, aURL; - Reference< XInputStream > xInputStream; - for ( sal_Int32 i = 0 ; i < nLength; i++) + void + XSLTFilter::started() throw (RuntimeException) { - aName = aSourceData[i].Name; - if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InputStream"))) - aSourceData[i].Value >>= xInputStream; - else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName"))) - aSourceData[i].Value >>= aFileName; - else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL"))) - aSourceData[i].Value >>= aURL; + osl_resetCondition(m_cTransformed); } - OSL_ASSERT(xInputStream.is()); - if (!xInputStream.is()) return sal_False; - - // create SAX parser that will read the document file - // and provide events to xHandler passed to this call - Reference < XParser > xSaxParser( m_rServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ))), UNO_QUERY ); - OSL_ASSERT(xSaxParser.is()); - if(!xSaxParser.is())return sal_False; - - // create transformer - Sequence< Any > args(3); - NamedValue nv; - - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" )); - nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SourceURL" )); - nv.Value <<= aURL; args[1] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SourceBaseURL" )); - nv.Value <<= OUString(INetURLObject(aURL).getBase()); - args[2] <<= nv; - - m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )), args), UNO_QUERY); - - OSL_ASSERT(xHandler.is()); - OSL_ASSERT(xInputStream.is()); - OSL_ASSERT(m_tcontrol.is()); - if (xHandler.is() && xInputStream.is() && m_tcontrol.is()) + void + XSLTFilter::error(const Any& a) throw (RuntimeException) { - try - { - // we want to be notfied when the processing is done... - m_tcontrol->addListener(Reference< XStreamListener >(this)); - - // connect input to transformer - Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY); - tsink->setInputStream(xInputStream); - - // create pipe - Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), UNO_QUERY); - Reference< XInputStream > pipein(pipeout, UNO_QUERY); - - //connect transformer to pipe - Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY); - tsource->setOutputStream(pipeout); - - // connect pipe to sax parser - InputSource aInput; - aInput.sSystemId = aURL; - aInput.sPublicId = aURL; - aInput.aInputStream = pipein; - - // set doc handler - xSaxParser->setDocumentHandler(new FLABridge(xHandler)); - - // transform - m_tcontrol->start(); - // osl_waitCondition(m_cTransformed, 0); - if (!m_bError && !m_bTerminated) + Exception e; + if (a >>= e) { - // parse the transformed XML buffered in the pipe - xSaxParser->parseStream(aInput); - osl_waitCondition(m_cTransformed, 0); - return sal_True; - } else { - return sal_False; + OString aMessage("XSLTFilter::error was called: "); + aMessage += OUStringToOString(e.Message, + RTL_TEXTENCODING_ASCII_US); + OSL_ENSURE(sal_False, aMessage); } - } -#if OSL_DEBUG_LEVEL > 0 - catch( Exception& exc) -#else - catch( Exception& ) -#endif - { - // something went wrong - OSL_ENSURE(0, OUStringToOString(exc.Message, RTL_TEXTENCODING_ASCII_US).getStr()); - return sal_False; - } - } else - { - return sal_False; + m_bError = sal_True; + osl_setCondition(m_cTransformed); } -} - -sal_Bool XSLTFilter::exporter( - const Sequence<PropertyValue>& aSourceData, - const Sequence<OUString>& msUserData) - throw (RuntimeException) -{ - if ( msUserData.getLength() < 6 ) - return sal_False; - - // get interesting values from user data - OUString udImport = msUserData[2]; - OUString udStyleSheet = rel2abs(msUserData[5]); - - // read source data - // we are especialy interested in the output stream - // since that is where our xml-writer will push the data - // from it's data-source interface - OUString aName, sURL; - sal_Bool bIndent = sal_False; - OUString aDoctypePublic; - OUString aDoctypeSystem; - // Reference<XOutputStream> rOutputStream; - sal_Int32 nLength = aSourceData.getLength(); - for ( sal_Int32 i = 0 ; i < nLength; i++) + void + XSLTFilter::closed() throw (RuntimeException) { - aName = aSourceData[i].Name; - if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Indent"))) - aSourceData[i].Value >>= bIndent; - if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocType_Public"))) - aSourceData[i].Value >>= aDoctypePublic; - if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocType_System"))) - aSourceData[i].Value >>= aDoctypeSystem; - if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OutputStream"))) - aSourceData[i].Value >>= m_rOutputStream; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL" ) )) - aSourceData[i].Value >>= sURL; + osl_setCondition(m_cTransformed); } - - if (!m_rDocumentHandler.is()) { - // get the document writer - m_rDocumentHandler = Reference<XExtendedDocumentHandler>( - m_rServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ))), - UNO_QUERY); + void + XSLTFilter::terminated() throw (RuntimeException) + { + m_bTerminated = sal_True; + osl_setCondition(m_cTransformed); } - // create transformer - Sequence< Any > args(4); - NamedValue nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" )); - nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); - nv.Value <<= sURL; args[1] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DoctypeSystem" )); - nv.Value <<= aDoctypeSystem; args[2] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DoctypePublic" )); - nv.Value <<= aDoctypePublic; args[3] <<= nv; - nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetBaseURL" )); - INetURLObject ineturl(sURL); - ineturl.removeSegment(); - m_aExportBaseUrl = ineturl.GetMainURL(INetURLObject::NO_DECODE); - nv.Value <<= m_aExportBaseUrl; - args[3] <<= nv; - - m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )), args), UNO_QUERY); - - OSL_ASSERT(m_rDocumentHandler.is()); - OSL_ASSERT(m_rOutputStream.is()); - OSL_ASSERT(m_tcontrol.is()); - if (m_tcontrol.is() && m_rOutputStream.is() && m_rDocumentHandler.is()) + OUString + XSLTFilter::rel2abs(const OUString& s) { - // we want to be notfied when the processing is done... - m_tcontrol->addListener(Reference< XStreamListener >(this)); - - // create pipe - Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), UNO_QUERY); - Reference< XInputStream > pipein(pipeout, UNO_QUERY); - - // connect sax writer to pipe - Reference< XActiveDataSource > xmlsource(m_rDocumentHandler, UNO_QUERY); - xmlsource->setOutputStream(pipeout); - - // connect pipe to transformer - Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY); - tsink->setInputStream(pipein); - - // connect transformer to output - Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY); - tsource->setOutputStream(m_rOutputStream); - - // we will start receiving events after returning 'true'. - // we will start the transformation as soon as we receive the startDocument - // event. - return sal_True; + + Reference<XStringSubstitution> + subs( + m_rServiceFactory->createInstance( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ))), + UNO_QUERY); + OUString aWorkingDir(subs->getSubstituteVariableValue(OUString( + RTL_CONSTASCII_USTRINGPARAM("$(progurl)")))); + INetURLObject aObj(aWorkingDir); + aObj.setFinalSlash(); + bool bWasAbsolute; + INetURLObject aURL = aObj.smartRel2Abs(s, bWasAbsolute, false, + INetURLObject::WAS_ENCODED, RTL_TEXTENCODING_UTF8, true); + return aURL.GetMainURL(INetURLObject::NO_DECODE); } - else + + sal_Bool + XSLTFilter::importer(const Sequence<PropertyValue>& aSourceData, + const Reference<XDocumentHandler>& xHandler, const Sequence< + OUString>& msUserData) throw (RuntimeException) { - return sal_False; - } -} + if (msUserData.getLength() < 5) + return sal_False; -// for the DocumentHandler implementation, we just proxy the the -// events to the XML writer that we created upon the output stream -// that was provided by the XMLFilterAdapter -void XSLTFilter::startDocument() throw (SAXException,RuntimeException){ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->startDocument(); - m_tcontrol->start(); -} + OUString udImport = msUserData[2]; + OUString udStyleSheet = rel2abs(msUserData[4]); + + // get information from media descriptor + // the imput stream that represents the imported file + // is most important here since we need to supply it to + // the sax parser that drives the supplied document handler + sal_Int32 nLength = aSourceData.getLength(); + OUString aName, aFileName, aURL; + Reference<XInputStream> xInputStream; + for (sal_Int32 i = 0; i < nLength; i++) + { + aName = aSourceData[i].Name; + if (aName.equalsAscii("InputStream")) + aSourceData[i].Value >>= xInputStream; + else if (aName.equalsAscii("FileName")) + aSourceData[i].Value >>= aFileName; + else if (aName.equalsAscii("URL")) + aSourceData[i].Value >>= aURL; + } + OSL_ASSERT(xInputStream.is()); + if (!xInputStream.is()) + return sal_False; -void XSLTFilter::endDocument() throw (SAXException, RuntimeException){ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endDocument(); - // wait for the transformer to finish - osl_waitCondition(m_cTransformed, 0); - if (!m_bError && !m_bTerminated) - { - return; - } else { - throw RuntimeException(); + // create SAX parser that will read the document file + // and provide events to xHandler passed to this call + Reference<XParser> + xSaxParser( + m_rServiceFactory->createInstance( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ))), + UNO_QUERY); + OSL_ASSERT(xSaxParser.is()); + if (!xSaxParser.is()) + return sal_False; + + // create transformer + Sequence<Any> args(3); + NamedValue nv; + + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" )); + nv.Value <<= expandUrl(udStyleSheet); + args[0] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "SourceURL" )); + nv.Value <<= aURL; + args[1] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "SourceBaseURL" )); + nv.Value <<= OUString(INetURLObject(aURL).getBase()); + args[2] <<= nv; + + OUString serviceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.documentconversion.LibXSLTTransformer")); + if (msUserData[1].getLength() != 0) + serviceName = msUserData[1]; + + m_tcontrol = Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY); + + OSL_ASSERT(xHandler.is()); + OSL_ASSERT(xInputStream.is()); + OSL_ASSERT(m_tcontrol.is()); + if (xHandler.is() && xInputStream.is() && m_tcontrol.is()) + { + try + { + // we want to be notfied when the processing is done... + m_tcontrol->addListener(Reference<XStreamListener> ( + this)); + + // connect input to transformer + Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY); + tsink->setInputStream(xInputStream); + + // create pipe + Reference<XOutputStream> + pipeout( + m_rServiceFactory->createInstance( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), + UNO_QUERY); + Reference<XInputStream> pipein(pipeout, UNO_QUERY); + + //connect transformer to pipe + Reference<XActiveDataSource> tsource(m_tcontrol, + UNO_QUERY); + tsource->setOutputStream(pipeout); + + // connect pipe to sax parser + InputSource aInput; + aInput.sSystemId = aURL; + aInput.sPublicId = aURL; + aInput.aInputStream = pipein; + + // set doc handler + xSaxParser->setDocumentHandler(new FLABridge(xHandler)); + + // transform + m_tcontrol->start(); + // osl_waitCondition(m_cTransformed, 0); + if (!m_bError && !m_bTerminated) + { + // parse the transformed XML buffered in the pipe + xSaxParser->parseStream(aInput); + osl_waitCondition(m_cTransformed, 0); + return sal_True; + } + else + { + return sal_False; + } + } +#if OSL_DEBUG_LEVEL > 0 + catch( Exception& exc) +#else + catch (Exception&) +#endif + { + // something went wrong + OSL_ENSURE(0, OUStringToOString(exc.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + return sal_False; + } + } + else + { + return sal_False; + } } -} + sal_Bool + XSLTFilter::exporter(const Sequence<PropertyValue>& aSourceData, + const Sequence<OUString>& msUserData) throw (RuntimeException) + { + if (msUserData.getLength() < 6) + return sal_False; -void XSLTFilter::startElement(const OUString& str, const Reference<XAttributeList>& attriblist) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); -// SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist); - m_rDocumentHandler->startElement(str, attriblist); -} + // get interesting values from user data + OUString udImport = msUserData[2]; + OUString udStyleSheet = rel2abs(msUserData[5]); + + // read source data + // we are especialy interested in the output stream + // since that is where our xml-writer will push the data + // from it's data-source interface + OUString aName, sURL; + sal_Bool bIndent = sal_False; + OUString aDoctypePublic; + OUString aDoctypeSystem; + // Reference<XOutputStream> rOutputStream; + sal_Int32 nLength = aSourceData.getLength(); + for (sal_Int32 i = 0; i < nLength; i++) + { + aName = aSourceData[i].Name; + if (aName.equalsAscii("Indent")) + aSourceData[i].Value >>= bIndent; + if (aName.equalsAscii("DocType_Public")) + aSourceData[i].Value >>= aDoctypePublic; + if (aName.equalsAscii("DocType_System")) + aSourceData[i].Value >>= aDoctypeSystem; + if (aName.equalsAscii("OutputStream")) + aSourceData[i].Value >>= m_rOutputStream; + else if (aName.equalsAscii("URL")) + aSourceData[i].Value >>= sURL; + } -void XSLTFilter::endElement(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->endElement(str); -} + if (!getDelegate().is()) + { + // get the document writer + setDelegate(Reference<XExtendedDocumentHandler> ( + m_rServiceFactory->createInstance( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ))), + UNO_QUERY)); + } -void XSLTFilter::characters(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->characters(str); -} + // create transformer + Sequence<Any> args(4); + NamedValue nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" )); + nv.Value <<= expandUrl(udStyleSheet); + args[0] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); + nv.Value <<= sURL; + args[1] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "DoctypeSystem" )); + nv.Value <<= aDoctypeSystem; + args[2] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "DoctypePublic" )); + nv.Value <<= aDoctypePublic; + args[3] <<= nv; + nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "TargetBaseURL" )); + INetURLObject ineturl(sURL); + ineturl.removeSegment(); + m_aExportBaseUrl = ineturl.GetMainURL(INetURLObject::NO_DECODE); + nv.Value <<= m_aExportBaseUrl; + args[3] <<= nv; + + OUString serviceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.documentconversion.LibXSLTTransformer")); + if (msUserData[1].getLength() != 0) + serviceName = msUserData[1]; + + m_tcontrol = Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY); + + OSL_ASSERT(m_rOutputStream.is()); + OSL_ASSERT(m_tcontrol.is()); + if (m_tcontrol.is() && m_rOutputStream.is()) + { + // we want to be notfied when the processing is done... + m_tcontrol->addListener(Reference<XStreamListener> (this)); + + // create pipe + Reference<XOutputStream> + pipeout( + m_rServiceFactory->createInstance( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), + UNO_QUERY); + Reference<XInputStream> pipein(pipeout, UNO_QUERY); + + // connect sax writer to pipe + Reference<XActiveDataSource> xmlsource(getDelegate(), + UNO_QUERY); + xmlsource->setOutputStream(pipeout); + + // connect pipe to transformer + Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY); + tsink->setInputStream(pipein); + + // connect transformer to output + Reference<XActiveDataSource> tsource(m_tcontrol, UNO_QUERY); + tsource->setOutputStream(m_rOutputStream); + + // we will start receiving events after returning 'true'. + // we will start the transformation as soon as we receive the startDocument + // event. + return sal_True; + } + else + { + return sal_False; + } + } -void XSLTFilter::ignorableWhitespace(const OUString& str) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - if (!m_bPrettyPrint) return; - m_rDocumentHandler->ignorableWhitespace(str); -} + // for the DocumentHandler implementation, we just proxy the the + // events to the XML writer that we created upon the output stream + // that was provided by the XMLFilterAdapter + void + XSLTFilter::startDocument() throw (SAXException, RuntimeException) + { + ExtendedDocumentHandlerAdapter::startDocument(); + m_tcontrol->start(); + } -void XSLTFilter::processingInstruction(const OUString& str, const OUString& str2) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->processingInstruction(str, str2); -} + void + XSLTFilter::endDocument() throw (SAXException, RuntimeException) + { + ExtendedDocumentHandlerAdapter::endDocument(); + // wait for the transformer to finish + osl_waitCondition(m_cTransformed, 0); + if (!m_bError && !m_bTerminated) + { + return; + } + else + { + throw RuntimeException(); + } -void XSLTFilter::setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException, RuntimeException) -{ - OSL_ASSERT(m_rDocumentHandler.is()); - m_rDocumentHandler->setDocumentLocator(doclocator); -} + } -// -------------------------------------- -// Component management -// -------------------------------------- -#define SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter" -#define IMPLEMENTATION_NAME "com.sun.star.comp.documentconversion.XSLTFilter" + // -------------------------------------- + // Component management + // -------------------------------------- +#define FILTER_SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter" +#define FILTER_IMPL_NAME "com.sun.star.comp.documentconversion.XSLTFilter" +#define TRANSFORMER_SERVICE_NAME "com.sun.star.documentconversion.LibXSLTTransformer" +#define TRANSFORMER_IMPL_NAME "com.sun.star.comp.documentconversion.LibXSLTTransformer" -static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r) -{ - return Reference< XInterface >(( OWeakObject *)new XSLTFilter(r)); -} + static Reference<XInterface> SAL_CALL + CreateTransformerInstance(const Reference<XMultiServiceFactory> &r) + { + return Reference<XInterface> ((OWeakObject *) new LibXSLTTransformer(r)); + } -static Sequence< OUString > getSupportedServiceNames() -{ - static Sequence < OUString > *pNames = 0; - if( ! pNames ) + static Reference<XInterface> SAL_CALL + CreateFilterInstance(const Reference<XMultiServiceFactory> &r) { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); - pNames = &seqNames; - } + return Reference<XInterface> ((OWeakObject *) new XSLTFilter(r)); } - return *pNames; -} } @@ -677,57 +644,98 @@ using namespace XSLT; extern "C" { -void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -sal_Bool SAL_CALL component_writeInfo(void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) + void SAL_CALL + component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, + uno_Environment ** /* ppEnv */) { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" )) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - return sal_False; -} -void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) -{ - void * pRet = 0; + sal_Bool SAL_CALL + component_writeInfo(void * /* pServiceManager */, void * pRegistryKey) + { + sal_Bool bRetVal = sal_False; + if (pRegistryKey) + { + try + { + Reference<XRegistryKey> pXNewKey( + static_cast<XRegistryKey*> (pRegistryKey)); + pXNewKey->createKey( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "/" FILTER_IMPL_NAME "/UNO/SERVICES/" FILTER_SERVICE_NAME ))); + bRetVal = sal_True; + + pXNewKey = static_cast<XRegistryKey*> (pRegistryKey); + pXNewKey->createKey( + OUString( + RTL_CONSTASCII_USTRINGPARAM( "/" TRANSFORMER_IMPL_NAME "/UNO/SERVICES/" TRANSFORMER_SERVICE_NAME ))); + bRetVal = sal_True; + } + catch (InvalidRegistryException&) + { + OSL_ENSURE(sal_False, "InvalidRegistryException caught"); + bRetVal = sal_False; + } + } + return bRetVal; + } - if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) + void * + SAL_CALL component_getFactory(const sal_Char * pImplName, + void * pServiceManager, void * /* pRegistryKey */) { - Reference< XSingleServiceFactory > xFactory( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - CreateInstance, getSupportedServiceNames() ) ); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } + void * pRet = 0; + + if (pServiceManager) + { + if (rtl_str_compare(pImplName, FILTER_IMPL_NAME) == 0) + { + Sequence<OUString> serviceNames(1); + serviceNames.getArray()[0] + = OUString( + RTL_CONSTASCII_USTRINGPARAM( FILTER_SERVICE_NAME )); + + Reference<XSingleServiceFactory> + xFactory( + createSingleFactory( + reinterpret_cast<XMultiServiceFactory *> (pServiceManager), + OUString::createFromAscii( + pImplName), + CreateFilterInstance, + serviceNames)); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + else if (rtl_str_compare(pImplName, TRANSFORMER_IMPL_NAME) == 0) + { + Sequence<OUString> serviceNames(1); + serviceNames.getArray()[0] + = OUString( + RTL_CONSTASCII_USTRINGPARAM( TRANSFORMER_SERVICE_NAME )); + Reference<XSingleServiceFactory> + xFactory( + createSingleFactory( + reinterpret_cast<XMultiServiceFactory *> (pServiceManager), + OUString::createFromAscii( + pImplName), + CreateTransformerInstance, + serviceNames)); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + } + } + return pRet; } - return pRet; -} } // extern "C" diff --git a/filter/source/xsltfilter/makefile.mk b/filter/source/xsltfilter/makefile.mk index a5e27135e17a..58f3c9e9a71c 100644 --- a/filter/source/xsltfilter/makefile.mk +++ b/filter/source/xsltfilter/makefile.mk @@ -26,16 +26,23 @@ #************************************************************************* PRJ = ..$/.. PRJNAME = filter -#PACKAGE = com$/sun$/star$/documentconversion$/XSLTFilter TARGET =XSLTFilter ENABLE_EXCEPTIONS=TRUE LIBTARGET=NO # --- Settings ----------------------------------------------------- CLASSDIR!:=$(CLASSDIR)$/$(TARGET) + .INCLUDE: settings.mk -SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/fla.obj +.IF "$(SYSTEM_LIBXSLT)" == "YES" +CFLAGS+= $(LIBXSLT_CFLAGS) +.ELSE +LIBXSLTINCDIR=external$/libxslt +CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) +.ENDIF + +SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/LibXSLTTransformer.obj $(SLO)$/fla.obj LIBNAME=xsltfilter SHL1TARGETDEPN=makefile.mk SHL1OBJS=$(SLOFILES) @@ -50,12 +57,12 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(XMLOFFLIB) \ - $(SALLIB) + $(SALLIB) \ + $(LIBXML2LIB) \ + $(XSLTLIB) .IF "$(SOLAR_JAVA)"!="" -#USE_UDK_EXTENDED_MANIFESTFILE=TRUE -#USE_EXTENDED_MANIFESTFILE=TRUE JARFILES = ridl.jar unoil.jar jurt.jar juh.jar JAVAFILES = $(subst,$(CLASSDIR)$/, $(subst,.class,.java $(JAVACLASSFILES))) diff --git a/filter/source/xsltvalidate/makefile.mk b/filter/source/xsltvalidate/makefile.mk index 5337d31a4bd7..50742dca31fd 100644 --- a/filter/source/xsltvalidate/makefile.mk +++ b/filter/source/xsltvalidate/makefile.mk @@ -24,18 +24,18 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + PRJ = ..$/.. PRJNAME = filter -#PACKAGE = com$/sun$/star$/documentconversion$/XSLTValidate TARGET =XSLTValidate + # --- Settings ----------------------------------------------------- + .IF "$(XML_CLASSPATH)" != "" XCLASSPATH+=":$(XML_CLASSPATH)" .ENDIF .INCLUDE: settings.mk CLASSDIR!:=$(CLASSDIR)$/$(TARGET) -#USE_UDK_EXTENDED_MANIFESTFILE=TRUE -#USE_EXTENDED_MANIFESTFILE=TRUE JARFILES = ridl.jar unoil.jar jurt.jar juh.jar crimson.jar .IF "$(SYSTEM_XALAN)" == "YES" @@ -52,18 +52,17 @@ JARFILES += xml-apis.jar JAVAFILES = $(subst,$(CLASSDIR)$/, $(subst,.class,.java $(JAVACLASSFILES))) CUSTOMMANIFESTFILE = Manifest -#JARMANIFEST = Manifest JARCOMPRESS = TRUE JARCLASSDIRS = XSLTValidate*.class JARTARGET = $(TARGET).jar # --- Files -------------------------------------------------------- + JAVACLASSFILES=$(CLASSDIR)$/XSLTValidate.class -#---Manifest ------------------------------------------------------- -#$(OUT)$/class$/$(TARGET)$/META-INF: META-INF -# + $(COPY) $(COPYRECURSE) META-INF $(OUT)$/class$/META-INF + # --- Targets ------------------------------------------------------ + .IF "$(SOLAR_JAVA)"!="" .INCLUDE : target.mk $(JAVACLASSFILES) : $(CLASSDIR) |