diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2011-08-22 22:03:26 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@novell.com> | 2011-08-22 22:38:31 +0300 |
commit | 2fbd5d475049576fca51ecb10941dd56ca87133a (patch) | |
tree | ed8752ef753640016b057e2bd131f53d11435e3e /shell/source/all | |
parent | 7b4825af2c345881c0a7d87b6e0a450fe74fd8ab (diff) |
Move Win32-only code under source/win32 for clarity
Diffstat (limited to 'shell/source/all')
-rw-r--r-- | shell/source/all/ooofilereader/autostyletag.cxx | 102 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/autostyletag.hxx | 75 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/basereader.cxx | 102 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/contentreader.cxx | 240 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/dummytag.hxx | 64 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/itag.hxx | 55 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/keywordstag.cxx | 66 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/keywordstag.hxx | 57 | ||||
-rwxr-xr-x | shell/source/all/ooofilereader/makefile.mk | 88 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/metainforeader.cxx | 307 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/simpletag.cxx | 68 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/simpletag.hxx | 61 | ||||
-rwxr-xr-x | shell/source/all/zipfile/makefile.mk | 58 | ||||
-rw-r--r-- | shell/source/all/zipfile/zipexcptn.cxx | 134 | ||||
-rw-r--r-- | shell/source/all/zipfile/zipexcptn.hxx | 79 | ||||
-rw-r--r-- | shell/source/all/zipfile/zipfile.cxx | 247 |
16 files changed, 0 insertions, 1803 deletions
diff --git a/shell/source/all/ooofilereader/autostyletag.cxx b/shell/source/all/ooofilereader/autostyletag.cxx deleted file mode 100644 index 3cf81a7bd5f9..000000000000 --- a/shell/source/all/ooofilereader/autostyletag.cxx +++ /dev/null @@ -1,102 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "autostyletag.hxx" - -/*********************** CAutoStyleTag ***********************/ - -CAutoStyleTag::CAutoStyleTag( const XmlTagAttributes_t& attributes ): - m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR ) -{ - addAttributes( attributes); -}; - -void CAutoStyleTag::startTag() -{ -} - -void CAutoStyleTag::endTag() -{ -} - -void CAutoStyleTag::addCharacters(const std::wstring&) -{ -} - -void CAutoStyleTag::addAttributes(const XmlTagAttributes_t& attributes) -{ - if ( EMPTY_STYLELOCALE_PAIR == m_CurrentStyleLocalePair ) - { - // the style-locale pair should be empty when entering STYLE_STYLE - // tag, and otherwise should be STYLE_PROPERTIES. - - XmlTagAttributes_t::const_iterator iter = attributes.find(CONTENT_STYLE_STYLE_NAME); - - if ( iter != attributes.end()) - setStyle( iter->second ); - } - else - { - // tag STYLE_PROPERTIES entered. - - XmlTagAttributes_t::const_iterator iter_lan = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGE); - XmlTagAttributes_t::const_iterator iter_con = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRY); - XmlTagAttributes_t::const_iterator iter_lan_asain = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGEASIAN); - XmlTagAttributes_t::const_iterator iter_con_asain = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRYASIAN); - - // if style:properties | fo:language or style:language-asian is exist, - // set the locale field, otherwise clear the style-locale pair; - if ( ( iter_lan!= attributes.end() ) && ( iter_con != attributes.end() ) ) - setLocale( ::std::make_pair( iter_lan->second,iter_con->second ) ); - else if ( ( iter_lan_asain!= attributes.end() ) && ( iter_con_asain != attributes.end() ) ) - setLocale( ::std::make_pair( iter_lan_asain->second,iter_con_asain->second ) ); - else - clearStyleLocalePair(); - } - -} - -void CAutoStyleTag::setStyle( ::std::wstring const & Style ) -{ - m_CurrentStyleLocalePair.first = Style; -} - -void CAutoStyleTag::setLocale( LocaleSet_t Locale ) -{ - m_CurrentStyleLocalePair.second = Locale; -} - -void CAutoStyleTag::clearStyleLocalePair( ) -{ - m_CurrentStyleLocalePair = EMPTY_STYLELOCALE_PAIR; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/autostyletag.hxx b/shell/source/all/ooofilereader/autostyletag.hxx deleted file mode 100644 index c392b53bb0cb..000000000000 --- a/shell/source/all/ooofilereader/autostyletag.hxx +++ /dev/null @@ -1,75 +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 AUTOSTYLETAG_HXX_INCLUDED -#define AUTOSTYLETAG_HXX_INCLUDED - -#include "itag.hxx" - -/*************************** CAutoStyleTag tag readers ***************************/ - -/** Implements the ITag interface for - building a Style-Locale list - - Usage sample: - - LocaleSet_t locale = meta_info_accessor.getDefaultLocale(); - CContentReader content( m_szFileName, locale ); - CStyleMap map = content.getStyleMap(); -*/ -class CAutoStyleTag : public ITag -{ - public: - CAutoStyleTag():m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR ){}; - CAutoStyleTag( const XmlTagAttributes_t& attributes ); - - virtual void startTag(); - virtual void endTag(); - virtual void addCharacters(const std::wstring& characters); - virtual void addAttributes(const XmlTagAttributes_t& attributes); - virtual std::wstring getTagContent(){ return EMPTY_STRING; }; - virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring() ; }; - - void setStyle( ::std::wstring const & Style ); - void setLocale( LocaleSet_t Locale ); - void clearStyleLocalePair( void ); - inline StyleLocalePair_t getStyleLocalePair() const{ return m_CurrentStyleLocalePair; }; - inline bool isFull() const - { - return (( m_CurrentStyleLocalePair.first != EMPTY_STRING )&& - ( m_CurrentStyleLocalePair.second != EMPTY_LOCALE)); - }; - - private: - StyleLocalePair_t m_CurrentStyleLocalePair; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx deleted file mode 100644 index 1b8c1391f8cc..000000000000 --- a/shell/source/all/ooofilereader/basereader.cxx +++ /dev/null @@ -1,102 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include <osl/diagnose.h> - -#include "internal/basereader.hxx" - -#include "internal/xml_parser.hxx" - -#include "assert.h" -#include <memory> - -/** constructor of CBaseReader. -*/ -CBaseReader::CBaseReader(const std::string& DocumentName): -m_ZipFile( DocumentName ) -{ -} - -//------------------------------ - -CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa): -m_ZipFile( sw , fa ) -{ -} - -//------------------------------ - -CBaseReader::~CBaseReader() -{ -} - -//------------------------------ - -void CBaseReader::start_document() -{ -} - -//------------------------------ - -void CBaseReader::end_document() -{ -} - -/** Read interested tag content into respective structure then start parsing process. - @param ContentName - the xml file name in the zipped document which we interest. -*/ -void CBaseReader::Initialize( const std::string& ContentName) -{ - try - { - if (m_ZipContent.empty()) - m_ZipFile.GetUncompressedContent( ContentName, m_ZipContent ); - - xml_parser parser; - parser.set_document_handler(this); // pass current reader as reader to the sax parser - parser.parse(&m_ZipContent[0], m_ZipContent.size()); - } - catch(std::exception& - #if OSL_DEBUG_LEVEL > 0 - ex - #endif - ) - { - OSL_ENSURE( false, ex.what() ); - } - catch(...) - { - OSL_ENSURE(false, "Unknown error"); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx deleted file mode 100644 index e0213839cc9d..000000000000 --- a/shell/source/all/ooofilereader/contentreader.cxx +++ /dev/null @@ -1,240 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include <osl/diagnose.h> - -#include "internal/contentreader.hxx" -#include "dummytag.hxx" -#include "simpletag.hxx" -#include "autostyletag.hxx" - -#include "assert.h" - -/** constructor. -*/ -CContentReader::CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ): -CBaseReader( DocumentName ) -{ - try - { - m_DefaultLocale = DocumentLocale; - Initialize( DOC_CONTENT_NAME ); - } - catch(xml_parser_exception& - #if OSL_DEBUG_LEVEL > 0 - ex - #endif - ) - { - OSL_ENSURE(false, ex.what()); - } - catch(...) - { - OSL_ENSURE(false, "Unknown error"); - } -} - -CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) : -CBaseReader( stream, fa ) -{ -try - { - m_DefaultLocale = DocumentLocale; - Initialize( DOC_CONTENT_NAME ); - } - catch(xml_parser_exception& - #if OSL_DEBUG_LEVEL > 0 - ex - #endif - ) - { - OSL_ENSURE(false, ex.what()); - } - catch(...) - { - OSL_ENSURE(false, "Unknown error"); - } -} - - -/** destructor. -*/ - -CContentReader::~CContentReader( void ) -{ -} - -/*********************** helper functions ***********************/ - -/** choose an appropriate tag reader -*/ - -ITag* CContentReader::chooseTagReader( const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes ) -{ - if (( tag_name == CONTENT_TEXT_A )||( tag_name == CONTENT_TEXT_P )|| - ( tag_name == CONTENT_TEXT_SPAN ) ||( tag_name == CONTENT_TEXT_H )|| - ( tag_name == CONTENT_TEXT_SEQUENCE ) ||( tag_name == CONTENT_TEXT_BOOKMARK_REF )|| - ( tag_name == CONTENT_TEXT_INDEX_TITLE_TEMPLATE ) ) - return new CSimpleTag(XmlAttributes); - else if ( tag_name == CONTENT_STYLE_STYLE ) - { - // if style:style | style:name is exist,, fill the style field, otherwise do nothing; - if ( XmlAttributes.find(CONTENT_STYLE_STYLE_NAME) != XmlAttributes.end()) - return new CAutoStyleTag(XmlAttributes); - else - return new CDummyTag(); - } - else if ( ( tag_name == CONTENT_STYLE_PROPERTIES ) || ( tag_name == CONTENT_TEXT_STYLE_PROPERTIES ) ) - { - assert( !m_TagBuilderStack.empty() ); - - //here we presume that if CONTENT_STYLE_PROPERTIES tag is present, it just follow CONTENT_STYLE_STYLE; - ITag* pTagBuilder = m_TagBuilderStack.top(); - pTagBuilder->addAttributes( XmlAttributes ); - - return new CDummyTag(); - } - else - return new CDummyTag(); -} - -/** get style of the current content. -*/ -::std::wstring CContentReader::getCurrentContentStyle( void ) -{ - assert( !m_TagBuilderStack.empty() ); - ITag* pTagBuilder = m_TagBuilderStack.top(); - - return ( pTagBuilder->getTagAttribute(CONTENT_TEXT_STYLENAME) ); -} - -/** add chunk into Chunk Buffer. -*/ -void CContentReader::addChunk( LocaleSet_t const & Locale, Content_t const & Content ) -{ - if ( Content == EMPTY_STRING ) - return; - - if ( ( ( m_ChunkBuffer.empty() ) || ( m_ChunkBuffer.back().first != Locale ) ) && - ( ( Content != SPACE ) && ( Content != LF ) ) ) - { - // if met a new locale, add a blank new chunk; - Chunk_t Chunk; - Chunk.first = Locale; - Chunk.second = EMPTY_STRING; - m_ChunkBuffer.push_back( Chunk ); - } - - if ( !m_ChunkBuffer.empty() ) - m_ChunkBuffer.back().second += Content; -} - -/** get a style's locale field. -*/ - -LocaleSet_t const & CContentReader::getLocale( const StyleName_t Style ) -{ - if ( m_StyleMap.empty() ) - return m_DefaultLocale; - - StyleLocaleMap_t :: const_iterator style_Iter; - - if ( ( style_Iter = m_StyleMap.find( Style ) ) == m_StyleMap.end( ) ) - return m_DefaultLocale; - else - return style_Iter->second; - -} - -/*********************** event handler functions ***********************/ - -//------------------------------ -// start_element occurs when a tag is start -//------------------------------ - -void CContentReader::start_element( - const std::wstring& /*raw_name*/, - const std::wstring& local_name, - const XmlTagAttributes_t& attributes) -{ - //get appropriate Xml Tag Builder using MetaInfoBuilderFactory; - ITag* pTagBuilder = chooseTagReader( local_name,attributes ); - assert( pTagBuilder != NULL ); - pTagBuilder->startTag( ); - m_TagBuilderStack.push( pTagBuilder ); - -} - -//------------------------------ -// end_element occurs when a tag is closed -//------------------------------ - -void CContentReader::end_element(const std::wstring& /*raw_name*/, const std::wstring& local_name) -{ - assert( !m_TagBuilderStack.empty() ); - ITag* pTagBuilder = m_TagBuilderStack.top(); - - if ( local_name == CONTENT_STYLE_STYLE ) - { - StyleLocalePair_t StyleLocalePair = static_cast<CAutoStyleTag * >( pTagBuilder)->getStyleLocalePair(); - if ( ( static_cast<CAutoStyleTag * >( pTagBuilder)->isFull() ) && ( StyleLocalePair.second != m_DefaultLocale ) ) - m_StyleMap.insert( StyleLocalePair ); - } - if (( local_name == CONTENT_TEXT_A )||( local_name == CONTENT_TEXT_SPAN ) || - ( local_name == CONTENT_TEXT_SEQUENCE )||( local_name == CONTENT_TEXT_BOOKMARK_REF )) - addChunk( getLocale( getCurrentContentStyle() ), ::std::wstring( SPACE ) ); - if ((( local_name == CONTENT_TEXT_P )||( local_name == CONTENT_TEXT_H ) || - ( local_name == CONTENT_TEXT_INDEX_TITLE_TEMPLATE ) )&& - ( EMPTY_STRING != pTagBuilder->getTagContent( ) ) ) - addChunk( getLocale( getCurrentContentStyle() ), ::std::wstring( LF ) ); - - m_TagBuilderStack.pop(); - pTagBuilder->endTag(); - delete pTagBuilder; - -} - -//------------------------------ -// characters occurs when receiving characters -//------------------------------ - -void CContentReader::characters( const std::wstring& character ) -{ - if ( character.length() > 0 && !HasOnlySpaces( character ) ) - { - addChunk( getLocale( getCurrentContentStyle() ), ::std::wstring( character ) ); - - ITag* pTagBuilder = m_TagBuilderStack.top(); - pTagBuilder->addCharacters( character ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/dummytag.hxx b/shell/source/all/ooofilereader/dummytag.hxx deleted file mode 100644 index b7007f5acf7c..000000000000 --- a/shell/source/all/ooofilereader/dummytag.hxx +++ /dev/null @@ -1,64 +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 DUMMYTAG_HXX_INCLUDED -#define DUMMYTAG_HXX_INCLUDED - -#include "itag.hxx" - -/*************************** dummy tag readers ***************************/ - -/** Implements the ITag interface but does - nothing (Null object pattern), may be used for - tags we are not interessted in to avoid if-else - branches. -*/ -class CDummyTag : public ITag -{ - public: - virtual void startTag(){}; - - virtual void endTag(){}; - - virtual void addCharacters(const std::wstring& /*characters*/){}; - - virtual void addAttributes(const XmlTagAttributes_t& /*attributes*/){}; - - virtual std::wstring getTagContent( void ) - { - return EMPTY_STRING; - }; - - virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring(EMPTY_STRING); }; -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/itag.hxx b/shell/source/all/ooofilereader/itag.hxx deleted file mode 100644 index c4a7eeacf8f5..000000000000 --- a/shell/source/all/ooofilereader/itag.hxx +++ /dev/null @@ -1,55 +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 ITAG_HXX_INCLUDED -#define ITAG_HXX_INCLUDED - -#include "internal/config.hxx" -#include "internal/types.hxx" - -/*************************** interface of tag readers ***************************/ - -/** Interface for a xml tag character builder -*/ -class ITag -{ - public: - virtual ~ITag() {}; - - virtual void startTag() = 0; - virtual void endTag() = 0; - virtual void addCharacters(const std::wstring& characters) = 0; - virtual void addAttributes(const XmlTagAttributes_t& attributes) = 0; - virtual ::std::wstring getTagContent( void ) = 0; - virtual ::std::wstring const getTagAttribute( ::std::wstring const & attrname ) = 0; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/keywordstag.cxx b/shell/source/all/ooofilereader/keywordstag.cxx deleted file mode 100644 index 695bfe8b5a60..000000000000 --- a/shell/source/all/ooofilereader/keywordstag.cxx +++ /dev/null @@ -1,66 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "keywordstag.hxx" - -/*********************** CKeywordsTag ***********************/ - -void CKeywordsTag::startTag() -{ - m_sCurrentKeyword.clear(); -} - -void CKeywordsTag::endTag() -{ - m_slKeywords.push_back(m_sCurrentKeyword); -} - -void CKeywordsTag::addCharacters(const std::wstring& characters) -{ - m_sCurrentKeyword += characters; -} - -void CKeywordsTag::addAttributes(const XmlTagAttributes_t& /*attributes*/) -{ - // there are no attributes for keywords -} - -std::wstring CKeywordsTag::getTagContent( ) -{ - StringList_t::const_iterator keywords_Iter= m_slKeywords.begin( ); - StringList_t::const_iterator keywords_Iter_end = m_slKeywords.end( ); - - std::wstring ret_KeyWord_String = ( keywords_Iter != keywords_Iter_end) ? *keywords_Iter++ : L""; - for ( ; keywords_Iter != keywords_Iter_end; ++keywords_Iter) - ret_KeyWord_String += L"," + *keywords_Iter; - return ret_KeyWord_String; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/keywordstag.hxx b/shell/source/all/ooofilereader/keywordstag.hxx deleted file mode 100644 index 9a761acf8072..000000000000 --- a/shell/source/all/ooofilereader/keywordstag.hxx +++ /dev/null @@ -1,57 +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 KEYWORDSTAG_HXX_INCLUDED -#define KEYWORDSTAG_HXX_INCLUDED - -#include "itag.hxx" - -/*************************** metainfo tag readers ***************************/ - -/** Implements the ITag interface for - building a keyword list -*/ -class CKeywordsTag : public ITag -{ - public: - virtual void startTag(); - virtual void endTag(); - virtual void addCharacters(const std::wstring& characters); - virtual void addAttributes(const XmlTagAttributes_t& attributes); - virtual std::wstring getTagContent(); - virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring(); }; - - private: - StringList_t m_slKeywords; - std::wstring m_sCurrentKeyword; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/makefile.mk b/shell/source/all/ooofilereader/makefile.mk deleted file mode 100755 index 90f0429132fc..000000000000 --- a/shell/source/all/ooofilereader/makefile.mk +++ /dev/null @@ -1,88 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=shell -TARGET=ooofilereader -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -.IF "$(COM)" == "MSC" -CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -.ENDIF -CDEFS+=-D_WIN32_IE=0x501 -CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -.IF "$(COM)" == "MSC" -CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -.ENDIF -CDEFS_X64+=-D_WIN32_IE=0x501 - -# --- Files -------------------------------------------------------- - - -SLOFILES=$(SLO)$/basereader.obj\ - $(SLO)$/metainforeader.obj\ - $(SLO)$/contentreader.obj\ - $(SLO)$/simpletag.obj\ - $(SLO)$/keywordstag.obj\ - $(SLO)$/autostyletag.obj - -LIB1TARGET=$(SLB)$/$(TARGET).lib -LIB1OBJFILES=$(SLOFILES) -LIB1FILES=$(SLB)$/zipfile.lib\ - $(SLB)$/xmlparser.lib - -.IF "$(BUILD_X64)"!="" -SLOFILES_X64=$(SLO_X64)$/basereader.obj\ - $(SLO_X64)$/metainforeader.obj\ - $(SLO_X64)$/contentreader.obj\ - $(SLO_X64)$/simpletag.obj\ - $(SLO_X64)$/keywordstag.obj\ - $(SLO_X64)$/autostyletag.obj - -LIB1TARGET_X64=$(SLB_X64)$/$(TARGET).lib -LIB1OBJFILES_X64=$(SLOFILES_X64) -LIB1FILES_X64=$(SLB_X64)$/zipfile.lib\ - $(SLB_X64)$/xmlparser.lib -.ENDIF # "$(BUILD_X64)"!="" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : set_wntx64.mk -.INCLUDE : target.mk -.IF "$(OS)" == "WNT" -INCLUDE!:=$(subst,/stl, $(INCLUDE)) - -.ENDIF -.INCLUDE : tg_wntx64.mk - diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx deleted file mode 100644 index 71be05505127..000000000000 --- a/shell/source/all/ooofilereader/metainforeader.cxx +++ /dev/null @@ -1,307 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" - -#include <osl/diagnose.h> - -#include "internal/metainforeader.hxx" -#include "dummytag.hxx" -#include "simpletag.hxx" -#include "keywordstag.hxx" - -#include "assert.h" - -/** constructor. -*/ -CMetaInfoReader::CMetaInfoReader( const std::string& DocumentName ): -CBaseReader( DocumentName ) -{ - try - { - m_pKeywords_Builder = new CKeywordsTag( ); - m_pSimple_Builder = new CSimpleTag( ); - m_pDummy_Builder = new CDummyTag( ); - - //retrieve all infomation that is useful - m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG; - - m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG; - - Initialize( META_CONTENT_NAME ); - } - catch(xml_parser_exception& - #if OSL_DEBUG_LEVEL > 0 - ex - #endif - ) - { - OSL_ENSURE(false, ex.what()); - } - catch(...) - { - OSL_ENSURE(false, "Unknown error"); - } -} - -CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) : -CBaseReader( stream, fa) -{ -try - { - m_pKeywords_Builder = new CKeywordsTag( ); - m_pSimple_Builder = new CSimpleTag( ); - m_pDummy_Builder = new CDummyTag( ); - - //retrieve all infomation that is useful - m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG; - - m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG; - m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG; - - Initialize( META_CONTENT_NAME ); - } - catch(xml_parser_exception& - #if OSL_DEBUG_LEVEL > 0 - ex - #endif - ) - { - OSL_ENSURE(false, ex.what()); - } - catch(...) - { - OSL_ENSURE(false, "Unknown error"); - } - -} - -/** destructor. -*/ - -CMetaInfoReader::~CMetaInfoReader( void ) -{ - delete m_pKeywords_Builder; - delete m_pSimple_Builder; - delete m_pDummy_Builder; -} - - -/*********************** export functions ***********************/ - -/** check if the Tag is in the target meta.xml file. - - @param TagName - the name of the tag that will be retrive. -*/ -bool CMetaInfoReader::hasTag( std::wstring TagName ) const -{ - return ( m_AllMetaInfo.find(TagName) != m_AllMetaInfo.end()); -} - -/** Get a specific tag content, compound tags will be returned as comma separated list. - - @param TagName - the name of the tag that will be retrive. -*/ -std::wstring CMetaInfoReader::getTagData( const std::wstring& TagName) -{ - if( hasTag( TagName ) ) - return m_AllMetaInfo[TagName].first; - else - return EMPTY_STRING; -} - -/** check if the a tag has the specific attribute. - - @param TagName - the name of the tag. - @param AttributeName - the name of the attribute. -*/ -bool CMetaInfoReader::hasTagAttribute( const std::wstring TagName, std::wstring AttributeName) -{ - return ( m_AllMetaInfo[TagName].second.find( AttributeName) != m_AllMetaInfo[TagName].second.end() ); -} - -/** Get a specific attribute content. - - @param TagName - the name of the tag. - @param AttributeName - the name of the attribute. -*/ -std::wstring CMetaInfoReader::getTagAttribute( const std::wstring TagName, std::wstring AttributeName) -{ - if ( hasTagAttribute( TagName, AttributeName ) ) - return m_AllMetaInfo[ TagName ].second[AttributeName]; - else - return EMPTY_STRING; -} - -/** helper function for getDefaultLocale(). -*/ -const LocaleSet_t EN_US_LOCALE( ::std::make_pair( ::std::wstring( L"en" ), ::std::wstring( L"US" ))); - -bool isValidLocale ( ::std::wstring Locale ) -{ - return ( Locale.length() == 5 ); -} - -/** Get the default language of the whole document, if no such field, en-US is returned. -*/ -LocaleSet_t CMetaInfoReader::getDefaultLocale() -{ - if (hasTag(META_INFO_LANGUAGE)) - { - ::std::wstring locale = m_AllMetaInfo[META_INFO_LANGUAGE].first; - return isValidLocale(locale) ? ::std::make_pair(locale.substr( 0,2), locale.substr( 3,2)) : EN_US_LOCALE; - } - else - return EN_US_LOCALE; -} - -/*********************** tag related functions ***********************/ - -/** choose an appropriate tag reader -*/ - -ITag* CMetaInfoReader::chooseTagReader( const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes ) -{ - if ( tag_name == META_INFO_KEYWORD ) - { - m_AllMetaInfo[META_INFO_KEYWORDS].second = XmlAttributes; - return m_pKeywords_Builder; - } - if (( tag_name == META_INFO_TITLE )||( tag_name == META_INFO_AUTHOR )||( tag_name == META_INFO_SUBJECT )||( tag_name == META_INFO_DESCRIPTION )|| - ( tag_name == META_INFO_DOCUMENT_STATISTIC )||( tag_name == META_INFO_GENERATOR )||( tag_name == META_INFO_CREATION )||( tag_name == META_INFO_CREATOR )|| - ( tag_name == META_INFO_MODIFIED )||( tag_name == META_INFO_LANGUAGE )||( tag_name == META_INFO_DOCUMENT_NUMBER )||( tag_name == META_INFO_EDITING_TIME ) ) - { - m_AllMetaInfo[tag_name].second = XmlAttributes; - return m_pSimple_Builder; - } - else - return m_pDummy_Builder; - -} - -//------------------------------ -// save the received content into structure. -//------------------------------ -void CMetaInfoReader::saveTagContent( const std::wstring& tag_name ) -{ - ITag* pTagBuilder; - if ( tag_name == META_INFO_KEYWORDS ) - pTagBuilder = m_pKeywords_Builder; - else if ( tag_name == META_INFO_KEYWORD ) - { - // added for support for OASIS xml file format. - m_AllMetaInfo[META_INFO_KEYWORDS].first =m_pKeywords_Builder->getTagContent( ); - return; - } - else if (( tag_name == META_INFO_TITLE )||( tag_name == META_INFO_AUTHOR )||( tag_name == META_INFO_SUBJECT )||( tag_name == META_INFO_DESCRIPTION )|| - ( tag_name == META_INFO_DOCUMENT_STATISTIC )||( tag_name == META_INFO_GENERATOR )||( tag_name == META_INFO_CREATION )||( tag_name == META_INFO_CREATOR )|| - ( tag_name == META_INFO_MODIFIED )||( tag_name == META_INFO_LANGUAGE )||( tag_name == META_INFO_DOCUMENT_NUMBER )||( tag_name == META_INFO_EDITING_TIME ) ) - pTagBuilder = m_pSimple_Builder; - else - pTagBuilder = m_pDummy_Builder; - - m_AllMetaInfo[tag_name].first =pTagBuilder->getTagContent( ); -} - - -/*********************** event handler functions ***********************/ - -//------------------------------ -// start_element occurs when a tag is start -//------------------------------ - -void CMetaInfoReader::start_element( - const std::wstring& /*raw_name*/, - const std::wstring& local_name, - const XmlTagAttributes_t& attributes) -{ - //get appropriate Xml Tag Builder using MetaInfoBuilderFactory; - ITag* pTagBuilder = chooseTagReader( local_name,attributes ); - assert( pTagBuilder!= NULL ); - pTagBuilder->startTag( ); - m_TagBuilderStack.push( pTagBuilder ); - -} - -//------------------------------ -// end_element occurs when a tag is closed -//------------------------------ - -void CMetaInfoReader::end_element(const std::wstring& /*raw_name*/, const std::wstring& local_name) -{ - assert( !m_TagBuilderStack.empty() ); - ITag* pTagBuilder = m_TagBuilderStack.top(); - m_TagBuilderStack.pop(); - pTagBuilder->endTag(); - - saveTagContent( local_name ); - -} - -//------------------------------ -// characters occurs when receiving characters -//------------------------------ - -void CMetaInfoReader::characters( const std::wstring& character ) -{ - if ( character.length() > 0 && !HasOnlySpaces( character ) ) - { - ITag* pTagBuilder = m_TagBuilderStack.top(); - pTagBuilder->addCharacters( character ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/simpletag.cxx b/shell/source/all/ooofilereader/simpletag.cxx deleted file mode 100644 index fa9f28796869..000000000000 --- a/shell/source/all/ooofilereader/simpletag.cxx +++ /dev/null @@ -1,68 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "simpletag.hxx" - -/*********************** CSimpleTag ***********************/ -void CSimpleTag::startTag() -{ - m_SimpleContent = L""; -} - - -void CSimpleTag::endTag() -{ - -} - -void CSimpleTag::addCharacters(const std::wstring& characters) -{ - m_SimpleContent += characters; -} - -void CSimpleTag::addAttributes(const XmlTagAttributes_t& attributes ) -{ - m_SimpleAttributes = attributes; -} - -std::wstring CSimpleTag::getTagContent( ) -{ - return m_SimpleContent; -} - -::std::wstring const CSimpleTag::getTagAttribute( ::std::wstring const & attrname ) -{ - if ( m_SimpleAttributes.find(attrname) != m_SimpleAttributes.end()) - return m_SimpleAttributes[attrname]; - else - return ( ::std::wstring( EMPTY_STRING ) ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/ooofilereader/simpletag.hxx b/shell/source/all/ooofilereader/simpletag.hxx deleted file mode 100644 index fb4b5d8399ce..000000000000 --- a/shell/source/all/ooofilereader/simpletag.hxx +++ /dev/null @@ -1,61 +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 SIMPLETAG_HXX_INCLUDED -#define SIMPLETAG_HXX_INCLUDED - -#include "itag.hxx" - -/*************************** simple tag readers ***************************/ - -/** Implements the ITag interface for - building a general info that is not a compound tag. -*/ -class CSimpleTag : public ITag -{ - public: - CSimpleTag(){}; - CSimpleTag( const XmlTagAttributes_t& attributes ):m_SimpleAttributes(attributes){}; - - virtual void startTag(); - virtual void endTag(); - virtual void addCharacters(const std::wstring& characters); - virtual void addAttributes(const XmlTagAttributes_t& attributes); - virtual std::wstring getTagContent(); - - virtual ::std::wstring const getTagAttribute( ::std::wstring const & attrname ); - - private: - std::wstring m_SimpleContent; - XmlTagAttributes_t m_SimpleAttributes; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk deleted file mode 100755 index 93fdf6602ae4..000000000000 --- a/shell/source/all/zipfile/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=shell -TARGET=zipfile -ENABLE_EXCEPTIONS=TRUE -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE - - - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - - -SLOFILES=$(SLO)$/zipfile.obj\ - $(SLO)$/zipexcptn.obj - -SLOFILES_X64=$(SLO_X64)$/zipfile.obj\ - $(SLO_X64)$/zipexcptn.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : set_wntx64.mk -.INCLUDE : target.mk -.IF "$(OS)" == "WNT" -INCLUDE!:=$(subst,/stl, $(INCLUDE)) - -.ENDIF -.INCLUDE : tg_wntx64.mk - diff --git a/shell/source/all/zipfile/zipexcptn.cxx b/shell/source/all/zipfile/zipexcptn.cxx deleted file mode 100644 index 5a5dcefc16ea..000000000000 --- a/shell/source/all/zipfile/zipexcptn.cxx +++ /dev/null @@ -1,134 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "internal/global.hxx" -#include "zipexcptn.hxx" - -//------------------------------------------ -/** -*/ -RuntimeException::RuntimeException(int Error) : - m_Error(Error) -{ -} - -//------------------------------------------ -/** -*/ -RuntimeException::~RuntimeException() throw() -{ -} - -//------------------------------------------ -/** -*/ -int RuntimeException::GetErrorCode() const -{ - return m_Error; -} - -//------------------------------------------ -/** -*/ -ZipException::ZipException(int Error) : - RuntimeException(Error) -{ -} - -//------------------------------------------ -/** -*/ -const char* ZipException::what() const throw() -{ - return 0; -} - -//------------------------------------------ -/** -*/ -Win32Exception::Win32Exception(int Error) : - RuntimeException(Error), - m_MsgBuff(0) -{ -} - -//------------------------------------------ -/** -*/ -Win32Exception::~Win32Exception() throw() -{ - if (m_MsgBuff) - LocalFree(m_MsgBuff); -} - -//------------------------------------------ -/** -*/ -const char* Win32Exception::what() const throw() -{ - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetErrorCode(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &m_MsgBuff, - 0, - NULL); - - return reinterpret_cast<char*>(m_MsgBuff); -} - -//------------------------------------------ -/** -*/ -ZipContentMissException::ZipContentMissException(int Error) : - ZipException(Error) -{ -} - -//------------------------------------------ -/** -*/ -AccessViolationException::AccessViolationException(int Error) : - Win32Exception(Error) -{ -} - -//------------------------------------------ -/** -*/ -IOException::IOException(int Error) : - Win32Exception(Error) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/zipfile/zipexcptn.hxx b/shell/source/all/zipfile/zipexcptn.hxx deleted file mode 100644 index 0b635448f482..000000000000 --- a/shell/source/all/zipfile/zipexcptn.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// ZipException.h: interface for the ZipException class. - -#ifndef ZIPEXCPTN_HXX_INCLUDED -#define ZIPEXCPTN_HXX_INCLUDED - -#include <stdexcept> - -//------------------------------------------ -/** -*/ -class RuntimeException : public std::exception -{ -public: - RuntimeException(int Error); - virtual ~RuntimeException() throw(); - - int GetErrorCode() const; - -private: - int m_Error; -}; - -//------------------------------------------ -/** -*/ -class ZipException : public RuntimeException -{ -public: - ZipException(int Error); - - virtual const char* what() const throw(); -}; - -//------------------------------------------ -/** -*/ -class Win32Exception : public RuntimeException -{ -public: - Win32Exception(int Error); - virtual ~Win32Exception() throw(); - - virtual const char* what() const throw(); - -private: - void* m_MsgBuff; -}; - -//------------------------------------------ -/** -*/ -class ZipContentMissException : public ZipException -{ -public: - ZipContentMissException(int Error); -}; - -//------------------------------------------ -/** -*/ -class AccessViolationException : public Win32Exception -{ -public: - AccessViolationException(int Error); -}; - -//------------------------------------------ -/** -*/ -class IOException : public Win32Exception -{ -public: - IOException(int Error); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx deleted file mode 100644 index c7ed65e5d177..000000000000 --- a/shell/source/all/zipfile/zipfile.cxx +++ /dev/null @@ -1,247 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_shell.hxx" -#include "zipexcptn.hxx" -#include "internal/zipfile.hxx" -#include "internal/global.hxx" - -#include <malloc.h> -#include <algorithm> -#include <functional> - -#include <string.h> - -namespace internal -{ - /* for case in-sensitive string comparison */ - struct stricmp : public std::unary_function<std::string, bool> - { - stricmp(const std::string& str) : str_(str) - {} - - bool operator() (const std::string& other) - { return (0 == _stricmp(str_.c_str(), other.c_str())); } - - std::string str_; - }; -} // namespace internal - -/** Checks whether a file is a zip file or not - - @precond The given parameter must be a string with length > 0 - The file must exist - The file must be readable for the current user - - @returns true if the file is a zip file - false if the file is not a zip file - - @throws ParameterException if the given file name is empty - IOException if the specified file doesn't exist - AccessViolationException if read access to the file is denied -*/ -bool ZipFile::IsZipFile(const std::string& /*FileName*/) -{ - return true; -} - -bool ZipFile::IsZipFile(void* /*stream*/) -{ - return true; -} - - -/** Returns wheter the version of the specified zip file may be uncompressed with the - currently used zlib version or not - - @precond The given parameter must be a string with length > 0 - The file must exist - The file must be readable for the current user - The file must be a valid zip file - - @returns true if the file may be uncompressed with the currently used zlib - false if the file may not be uncompressed with the currently used zlib - - @throws ParameterException if the given file name is empty - IOException if the specified file doesn't exist or is no zip file - AccessViolationException if read access to the file is denied -*/ -bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/) -{ - return true; -} - -bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/) -{ - return true; -} - - -/** Constructs a zip file from a zip file - - @precond The given parameter must be a string with length > 0 - The file must exist - The file must be readable for the current user - - @throws ParameterException if the given file name is empty - IOException if the specified file doesn't exist or is no valid zip file - AccessViolationException if read access to the file is denied - WrongZipVersionException if the zip file cannot be uncompressed - with the used zlib version -*/ -ZipFile::ZipFile(const std::string& FileName) -{ - m_uzFile = unzOpen(FileName.c_str()); - - if (0 == m_uzFile) - throw IOException(-1); -} - -ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa) -{ - fa->opaque = stream; - m_uzFile = unzOpen2((const char *)NULL, fa); - - if (0 == m_uzFile) - throw IOException(-1); -} - - -/** Destroys a zip file -*/ -ZipFile::~ZipFile() -{ - unzClose(m_uzFile); -} - -/** Provides an interface to read the uncompressed data of a content of the zip file - - @precond The specified content must exist in this file - ppstm must not be NULL -*/ -void ZipFile::GetUncompressedContent( - const std::string& ContentName, /*inout*/ ZipContentBuffer_t& ContentBuffer) -{ - int rc = unzLocateFile(m_uzFile, ContentName.c_str(), 0); - - if (UNZ_END_OF_LIST_OF_FILE == rc) - throw ZipContentMissException(rc); - - unz_file_info finfo; - unzGetCurrentFileInfo(m_uzFile, &finfo, 0, 0, 0, 0, 0, 0); - - ContentBuffer.resize(finfo.uncompressed_size); - - rc = unzOpenCurrentFile(m_uzFile); - - if (UNZ_OK != rc) - throw ZipException(rc); - - rc = unzReadCurrentFile(m_uzFile, &ContentBuffer[0], finfo.uncompressed_size); - - if (rc < 0) - throw ZipException(rc); - - rc = unzCloseCurrentFile(m_uzFile); - - if (rc < 0) - throw ZipException(rc); -} - -/** Returns a list with the content names contained within this file - -*/ -ZipFile::DirectoryPtr_t ZipFile::GetDirectory() const -{ - DirectoryPtr_t dir(new Directory_t()); - - long lmax = GetFileLongestFileNameLength() + 1; - char* szFileName = reinterpret_cast<char*>(_alloca(lmax)); - - if (!szFileName) - throw ZipException(ERROR_NOT_ENOUGH_MEMORY); - - int rc = unzGoToFirstFile(m_uzFile); - - while (UNZ_OK == rc && UNZ_END_OF_LIST_OF_FILE != rc) - { - unzGetCurrentFileInfo( - m_uzFile, 0, szFileName, lmax, 0, 0, 0, 0); - - dir->push_back(szFileName); - - rc = unzGoToNextFile(m_uzFile); - } - - if (UNZ_OK != rc && UNZ_END_OF_LIST_OF_FILE != rc) - throw ZipException(rc); - - return dir; -} - -/** Convinience query function may even realized with - iterating over a ZipFileDirectory returned by - GetDirectory */ -bool ZipFile::HasContent(const std::string& ContentName) const -{ - //#i34314# we need to compare package content names - //case in-sensitive as it is not defined that such - //names must be handled case sensitive - DirectoryPtr_t dir = GetDirectory(); - Directory_t::iterator iter = - std::find_if(dir->begin(), dir->end(), internal::stricmp(ContentName)); - - return (iter != dir->end()); -} - - -/** Returns the length of the longest file name - in the current zip file -*/ -long ZipFile::GetFileLongestFileNameLength() const -{ - long lmax = 0; - unz_file_info finfo; - - int rc = unzGoToFirstFile(m_uzFile); - - while (UNZ_OK == rc && UNZ_END_OF_LIST_OF_FILE != rc) - { - unzGetCurrentFileInfo(m_uzFile, &finfo, 0, 0, 0, 0, 0, 0); - lmax = std::max<long>(lmax, finfo.size_filename); - rc = unzGoToNextFile(m_uzFile); - } - - if (UNZ_OK != rc && UNZ_END_OF_LIST_OF_FILE != rc) - throw ZipException(rc); - - return lmax; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |