diff options
Diffstat (limited to 'shell/inc/internal')
22 files changed, 1984 insertions, 0 deletions
diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx new file mode 100644 index 000000000000..fcdf1cdd7dff --- /dev/null +++ b/shell/inc/internal/basereader.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 BASEREADER_HXX_INCLUDED +#define BASEREADER_HXX_INCLUDED + +#include "internal/global.hxx" +#include "internal/types.hxx" +#include "internal/config.hxx" +#include "internal/utilities.hxx" +#include "internal/i_xml_parser_event_handler.hxx" + +#ifndef XML_PARSER_HXX_INCLUDED +#include "internal/xml_parser.hxx" +#endif +#include "internal/zipfile.hxx" + +class CBaseReader : public i_xml_parser_event_handler +{ +public: + virtual ~CBaseReader(); + +protected: // protected because its only an implementation relevant class + CBaseReader( const std::string& DocumentName ); + + CBaseReader( void* stream, zlib_filefunc_def* fa ); + + virtual void start_document(); + + virtual void end_document(); + + virtual void start_element( + const std::wstring& raw_name, + const std::wstring& local_name, + const XmlTagAttributes_t& attributes) = 0; + + virtual void end_element( + const std::wstring& raw_name, const std::wstring& local_name) = 0; + + virtual void characters(const std::wstring& character) = 0; + + virtual void ignore_whitespace(const std::wstring& /*whitespaces*/){}; + + virtual void processing_instruction( + const std::wstring& /*target*/, const std::wstring& /*data*/){}; + + virtual void comment(const std::wstring& /*comment*/){}; + + void Initialize( const std::string& /*ContentName*/); + +private: + ZipFile m_ZipFile; + ZipFile::ZipContentBuffer_t m_ZipContent; +}; + +#endif diff --git a/shell/inc/internal/columninfo.hxx b/shell/inc/internal/columninfo.hxx new file mode 100644 index 000000000000..4e392dd76f4d --- /dev/null +++ b/shell/inc/internal/columninfo.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 COLUMNINFO_HXX_INCLUDED +#define COLUMNINFO_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4917) +#endif +#include <shlobj.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif + + +class CColumnInfo : public IColumnProvider +{ +public: + CColumnInfo(long RefCnt = 1); + virtual ~CColumnInfo(); + + //----------------------------- + // IUnknown methods + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + + virtual ULONG STDMETHODCALLTYPE AddRef( void); + + virtual ULONG STDMETHODCALLTYPE Release( void); + + //----------------------------- + // IColumnProvider + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE Initialize(LPCSHCOLUMNINIT psci); + + virtual HRESULT STDMETHODCALLTYPE GetColumnInfo(DWORD dwIndex, SHCOLUMNINFO *psci); + + virtual HRESULT STDMETHODCALLTYPE GetItemData( + LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData); + +private: + bool IsOOFileExtension(wchar_t* Extension) const; + +private: + long m_RefCnt; +}; + +#endif diff --git a/shell/inc/internal/config.hxx b/shell/inc/internal/config.hxx new file mode 100644 index 000000000000..3c10e7db26a7 --- /dev/null +++ b/shell/inc/internal/config.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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 CONFIG_HXX_INCLUDED +#define CONFIG_HXX_INCLUDED + +#ifdef _MSC_VER +#pragma warning (disable : 4786 4503 4917) +#endif + +#ifndef OS2 +#include <tchar.h> +#endif + +#ifdef _AMD64_ +#define MODULE_NAME TEXT("shlxthdl_x64.dll") +#define MODULE_NAME_FILTER TEXT("ooofilt_x64.dll") +#else +#define MODULE_NAME TEXT("shlxthdl.dll") +#define MODULE_NAME_FILTER TEXT("ooofilt.dll") +#endif + +#define COLUMN_HANDLER_DESCRIPTIVE_NAME TEXT("OpenOffice.org Column Handler") +#define INFOTIP_HANDLER_DESCRIPTIVE_NAME TEXT("OpenOffice.org Infotip Handler") +#define PROPSHEET_HANDLER_DESCRIPTIVE_NAME TEXT("OpenOffice.org Property Sheet Handler") +#define THUMBVIEWER_HANDLER_DESCRIPTIVAE_NAME TEXT("OpenOffice.org Thumbnail Viewer") + +#define META_CONTENT_NAME "meta.xml" +#define DOC_CONTENT_NAME "content.xml" + +#define EMPTY_STRING L"" +#define SPACE L" " +#define LF L"\n" +#define META_INFO_TITLE L"title" +#define META_INFO_AUTHOR L"initial-creator" +#define META_INFO_SUBJECT L"subject" +#define META_INFO_KEYWORDS L"keywords" +#define META_INFO_KEYWORD L"keyword" +#define META_INFO_DESCRIPTION L"description" + +#define META_INFO_PAGES L"page-count" +#define META_INFO_TABLES L"table-count" +#define META_INFO_DRAWS L"image-count" +#define META_INFO_OBJECTS L"object-count" +#define META_INFO_OLE_OBJECTS L"object-count" +#define META_INFO_PARAGRAPHS L"paragraph-count" +#define META_INFO_WORDS L"word-count" +#define META_INFO_CHARACTERS L"character-count" +#define META_INFO_ROWS L"row-count" +#define META_INFO_CELLS L"cell-count" +#define META_INFO_DOCUMENT_STATISTIC L"document-statistic" +#define META_INFO_MODIFIED L"date" +#define META_INFO_DOCUMENT_NUMBER L"editing-cycles" +#define META_INFO_EDITING_TIME L"editing-duration" + +#define META_INFO_LANGUAGE L"language" +#define META_INFO_CREATOR L"creator" +#define META_INFO_CREATION L"creation-date" +#define META_INFO_GENERATOR L"generator" + + +#define CONTENT_TEXT_A L"a" +#define CONTENT_TEXT_P L"p" +#define CONTENT_TEXT_H L"h" +#define CONTENT_TEXT_SPAN L"span" +#define CONTENT_TEXT_SEQUENCE L"sequence" +#define CONTENT_TEXT_BOOKMARK_REF L"bookmark-ref" +#define CONTENT_TEXT_INDEX_TITLE_TEMPLATE L"index-title-template" +#define CONTENT_TEXT_STYLENAME L"style-name" + +#define CONTENT_STYLE_STYLE L"style" +#define CONTENT_STYLE_STYLE_NAME L"name" +#define CONTENT_STYLE_PROPERTIES L"properties" +#define CONTENT_TEXT_STYLE_PROPERTIES L"text-properties" // added for OASIS Open Office XML format. +#define CONTENT_STYLE_PROPERTIES_LANGUAGE L"language" +#define CONTENT_STYLE_PROPERTIES_COUNTRY L"country" +#define CONTENT_STYLE_PROPERTIES_LANGUAGEASIAN L"language-asian" +#define CONTENT_STYLE_PROPERTIES_COUNTRYASIAN L"country-asian" + +#endif diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx new file mode 100644 index 000000000000..63b0c550c534 --- /dev/null +++ b/shell/inc/internal/contentreader.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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 CONTENTREADER_HXX_INCLUDED +#define CONTENTREADER_HXX_INCLUDED + +#include "internal/basereader.hxx" + +class ITag; + +class CContentReader : public CBaseReader +{ +public: + virtual ~CContentReader(); + + //CContentReader( const std::string& DocumentName ); + CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ); + + CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ); + + + /** Get the chunkbuffer. + + @return + the chunkbuffer of the document. + */ + inline ChunkBuffer_t const & getChunkBuffer( ) const{ return m_ChunkBuffer; }; + +protected: // protected because its only an implementation relevant class + + /** start_element occurs when a tag is start. + + @param raw_name + raw name of the tag. + @param local_name + local name of the tag. + @param attributes + attribute structure. + */ + virtual void start_element( + const std::wstring& raw_name, + const std::wstring& local_name, + const XmlTagAttributes_t& attributes); + + /** end_element occurs when a tag is closed + + @param raw_name + raw name of the tag. + @param local_name + local name of the tag. + */ + virtual void end_element( + const std::wstring& raw_name, const std::wstring& local_name); + + /** characters occurs when receiving characters + + @param character + content of the information received. + */ + virtual void characters(const std::wstring& character); + +protected: + /** choose an appropriate tag reader to handle the tag. + + @param tag_name + the name of the tag. + @param XmlAttributes + attribute structure of the tag to save in. + */ + ITag* chooseTagReader( + const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes ); + + /** Get the list of style locale pair. + + @return + the Style-Locale map + */ + inline StyleLocaleMap_t const & getStyleMap( ) const{ return m_StyleMap; }; + + /** get style of the current content. + + @return style of the current content. + */ + ::std::wstring getCurrentContentStyle( void ); + + /** add chunk into Chunk Buffer. + */ + void addChunk( LocaleSet_t const & Locale, Content_t const & Content ); + + /** get a style's locale field. + */ + LocaleSet_t const & getLocale( const StyleName_t Style ); + +private: + std::stack<ITag*> m_TagBuilderStack; + + ChunkBuffer_t m_ChunkBuffer; + StyleLocaleMap_t m_StyleMap; + LocaleSet_t m_DefaultLocale; +}; + +#endif diff --git a/shell/inc/internal/dbgmacros.hxx b/shell/inc/internal/dbgmacros.hxx new file mode 100644 index 000000000000..fbab023664ac --- /dev/null +++ b/shell/inc/internal/dbgmacros.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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 DBGMACROS_HXX_INCLUDED +#define DBGMACROS_HXX_INCLUDED + +void DbgAssert(bool condition, const char* message); + +#if OSL_DEBUG_LEVEL > 0 + + #define PRE_CONDITION(x, msg) DbgAssert(x, msg) + + #define POST_CONDITION(x, msg) DbgAssert(x, msg) + + #define ENSURE(x ,msg) DbgAssert(x, msg) + +#else // OSL_DEBUG_LEVEL == 0 + + #define PRE_CONDITION(x, msg) ((void)0) + + #define POST_CONDITION(x, msg) ((void)0) + + #define ENSURE(x, msg) ((void)0) + +#endif + +#endif diff --git a/shell/inc/internal/fileextensions.hxx b/shell/inc/internal/fileextensions.hxx new file mode 100644 index 000000000000..48d6f283ea1d --- /dev/null +++ b/shell/inc/internal/fileextensions.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 FILEEXTENSIONS_HXX_INCLUDED +#define FILEEXTENSIONS_HXX_INCLUDED + +#include "internal/global.hxx" + +#include <string> + +// A simple table with information about the currently used OO file extensions +// for instance ".sxw" and information about windows registry keys which are +// necessary for properly registering of the shell extensions + +/** A FileExtensionEntry consists of the extension as ansi and as + unicode string and of the currently used registry forward key + for this extension +*/ +struct FileExtensionEntry +{ + char* ExtensionAnsi; // e.g. ".sxw" + wchar_t* ExtensionUnicode; // e.g. L".sxw" + char* RegistryForwardKey; // e.g. "soffice.StarWriterDocument.6" +}; + +extern FileExtensionEntry OOFileExtensionTable[]; + +extern size_t OOFileExtensionTableSize; + +//--------------------------------- +/** Return the extension of a file + name without the '.' +*/ +std::string get_file_name_extension(const std::string& file_name); + +//--------------------------------- +/** Return the type of a file +*/ + +enum File_Type_t { UNKNOWN, WRITER, CALC, DRAW, IMPRESS, MATH, WEB, DATABASE }; + +File_Type_t get_file_type(const std::string& file_name); + +#endif diff --git a/shell/inc/internal/global.hxx b/shell/inc/internal/global.hxx new file mode 100644 index 000000000000..ebf3305934bd --- /dev/null +++ b/shell/inc/internal/global.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 GLOBAL_HXX_INCLUDED +#define GLOBAL_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#ifndef OS2 +#include <windows.h> +#endif +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include "internal/dbgmacros.hxx" + +extern long g_DllRefCnt; + +#endif diff --git a/shell/inc/internal/i_xml_parser_event_handler.hxx b/shell/inc/internal/i_xml_parser_event_handler.hxx new file mode 100644 index 000000000000..5164f2236522 --- /dev/null +++ b/shell/inc/internal/i_xml_parser_event_handler.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 I_XML_PARSER_EVENT_HANDLER_HXX_INCLUDED +#define I_XML_PARSER_EVENT_HANDLER_HXX_INCLUDED + +#include <string> +#include <map> + +#if defined(XML_UNICODE) || defined(XML_UNICODE_WCHAR_T) + typedef std::wstring string_t; + typedef wchar_t char_t; +#else + typedef std::string string_t; + typedef char char_t; +#endif + +// name-value container +typedef std::map<string_t, string_t> xml_tag_attribute_container_t; + + +//######################################### +class i_xml_parser_event_handler +{ +public: + virtual ~i_xml_parser_event_handler() {}; + + virtual void start_document() = 0; + + virtual void end_document() = 0; + + virtual void start_element( + const string_t& raw_name, + const string_t& local_name, + const xml_tag_attribute_container_t& attributes) = 0; + + virtual void end_element( + const string_t& raw_name, + const string_t& local_name) = 0; + + virtual void characters( + const string_t& character) = 0; + + virtual void ignore_whitespace( + const string_t& whitespaces) = 0; + + virtual void processing_instruction( + const string_t& target, const string_t& data) = 0; + + virtual void comment(const string_t& comment) = 0; +}; + +#endif + diff --git a/shell/inc/internal/infotips.hxx b/shell/inc/internal/infotips.hxx new file mode 100644 index 000000000000..8193615a505f --- /dev/null +++ b/shell/inc/internal/infotips.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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 INFOTIPS_HXX_INCLUDED +#define INFOTIPS_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4917) +#endif +#include <objidl.h> +#include <shlobj.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include <string> + +class CInfoTip : public IQueryInfo, public IPersistFile +{ +public: + CInfoTip(long RefCnt = 1); + virtual ~CInfoTip(); + + //----------------------------- + // IUnknown methods + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + + virtual ULONG STDMETHODCALLTYPE AddRef( void); + + virtual ULONG STDMETHODCALLTYPE Release( void); + + //---------------------------- + // IQueryInfo methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE GetInfoTip(DWORD dwFlags, wchar_t** ppwszTip); + + virtual HRESULT STDMETHODCALLTYPE GetInfoFlags(DWORD *pdwFlags); + + //---------------------------- + // IPersist methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pClassID); + + //---------------------------- + // IPersistFile methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE IsDirty(void); + + virtual HRESULT STDMETHODCALLTYPE Load( + /* [in] */ LPCOLESTR pszFileName, + /* [in] */ DWORD dwMode); + + virtual HRESULT STDMETHODCALLTYPE Save( + /* [unique][in] */ LPCOLESTR pszFileName, + /* [in] */ BOOL fRemember); + + virtual HRESULT STDMETHODCALLTYPE SaveCompleted( + /* [unique][in] */ LPCOLESTR pszFileName); + + virtual HRESULT STDMETHODCALLTYPE GetCurFile( + /* [out] */ LPOLESTR __RPC_FAR *ppszFileName); + +private: + long m_RefCnt; + char m_szFileName[MAX_PATH]; + std::wstring m_FileNameOnly; +}; + +#endif diff --git a/shell/inc/internal/iso8601_converter.hxx b/shell/inc/internal/iso8601_converter.hxx new file mode 100644 index 000000000000..f7f00bbe1c53 --- /dev/null +++ b/shell/inc/internal/iso8601_converter.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 ISO8601_CONVERTER_HXX_INCLUDED +#define ISO8601_CONVERTER_HXX_INCLUDED + +#include <string> + +//----------------------------------- +/* Converts ISO 8601 conform date/time + represenation to the representation + conforming to the current locale +*/ +std::wstring iso8601_date_to_local_date(const std::wstring& iso8601date); + +//------------------------------------ +/* Converts ISO 8601 conform duration + representation to the representation + conforming to the current locale +*/ +std::wstring iso8601_duration_to_local_duration(const std::wstring& iso8601duration); + +#endif diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx new file mode 100755 index 000000000000..ea29dff07c80 --- /dev/null +++ b/shell/inc/internal/metainforeader.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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 METAINFOREADER_HXX_INCLUDED +#define METAINFOREADER_HXX_INCLUDED + +#include "internal/basereader.hxx" +#include "internal/types.hxx" + +class ITag; +class CKeywordsTag; +class CSimpleTag; +class CDummyTag; + +class CMetaInfoReader : public CBaseReader +{ +public: + virtual ~CMetaInfoReader(); + + CMetaInfoReader( const std::string& DocumentName ); + + CMetaInfoReader( void* stream, zlib_filefunc_def* fa); + + /** check if the Tag is in the target meta.xml file. + + @param TagName + the name of the tag that will be retrive. + */ + bool hasTag(std::wstring TagName) const; + + + /** 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 getTagData( const std::wstring& TagName); + + /** check if the a tag has the specific attribute. + + @param TagName + the name of the tag. + @param AttributeName + the name of the attribute. + */ + bool hasTagAttribute( const std::wstring TagName, std::wstring AttributeName); + + /** Get a specific attribute content. + + @param TagName + the name of the tag. + @param AttributeName + the name of the attribute. + */ + std::wstring getTagAttribute( const std::wstring TagName, std::wstring AttributeName); + + /** Get the default language of the whole document. + */ + LocaleSet_t getDefaultLocale( ); + +protected: // protected because its only an implementation relevant class + + /** start_element occurs when a tag is start. + + @param raw_name + raw name of the tag. + @param local_name + local name of the tag. + @param attributes + attribute structure. + */ + virtual void start_element( + const std::wstring& raw_name, + const std::wstring& local_name, + const XmlTagAttributes_t& attributes); + + /** end_element occurs when a tag is closed + + @param raw_name + raw name of the tag. + @param local_name + local name of the tag. + */ + virtual void end_element( + const std::wstring& raw_name, const std::wstring& local_name); + + /** characters occurs when receiving characters + + @param character + content of the information received. + */ + virtual void characters(const std::wstring& character); + +protected: + /** choose an appropriate tag reader to handle the tag. + + @param tag_name + the name of the tag. + @param XmlAttributes + attribute structure of the tag to save in. + */ + ITag* chooseTagReader( + const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes ); + + /** save the received content into structure. + + @param tag_name + the name of the tag. + */ + void saveTagContent( const std::wstring& tag_name ); + +private: + XmlTags_t m_AllMetaInfo; + +private: + std::stack<ITag*> m_TagBuilderStack; + +private: + CKeywordsTag* m_pKeywords_Builder; + CDummyTag* m_pDummy_Builder; + CSimpleTag* m_pSimple_Builder; +}; + +#endif diff --git a/shell/inc/internal/propertyhdl.hxx b/shell/inc/internal/propertyhdl.hxx new file mode 100755 index 000000000000..6379fdf0137b --- /dev/null +++ b/shell/inc/internal/propertyhdl.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PropertyHdl.hxx,v $ + * $Revision: 1.5 $ + * + * 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 PROPERTYHDL_HXX_INCLUDED +#define PROPERTYHDL_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4917) +#endif +#include <shlobj.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif + +// {AE424E85-F6DF-4910-A6A9-438797986431} +const CLSID CLSID_PROPERTY_HANDLER = +{ 0xae424e85, 0xf6df, 0x4910, { 0xa6, 0xa9, 0x43, 0x87, 0x97, 0x98, 0x64, 0x31 } }; + +class CMetaInfoReader; + +class CPropertyHdl : public IPropertyStore, + public IPropertyStoreCapabilities, + public IInitializeWithStream +{ +public: + CPropertyHdl(long RefCnt = 1); + virtual ~CPropertyHdl(); + + //----------------------------- + // IUnknown methods + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject ); + virtual ULONG STDMETHODCALLTYPE AddRef( void ); + virtual ULONG STDMETHODCALLTYPE Release( void ); + + //----------------------------- + // IPropertyStore + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE GetCount( DWORD *pcProps ); + virtual HRESULT STDMETHODCALLTYPE GetAt( DWORD iProp, PROPERTYKEY *pkey ); + virtual HRESULT STDMETHODCALLTYPE GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar ); + virtual HRESULT STDMETHODCALLTYPE SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar ); + virtual HRESULT STDMETHODCALLTYPE Commit(); + + //----------------------------- + // IPropertyStoreCapabilities + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( REFPROPERTYKEY key ); + + //----------------------------- + // IInitializeWithStream + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE Initialize(IStream *pStream, DWORD grfMode); + +private: + void LoadProperties( CMetaInfoReader *pMetaInfoReader ); + HRESULT GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData ); + +private: + long m_RefCnt; + IPropertyStoreCache* m_pCache; +}; + +class CClassFactory : public IClassFactory +{ +public: + CClassFactory( const CLSID& clsid ); + virtual ~CClassFactory(); + + //----------------------------- + // IUnknown methods + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef( void ); + virtual ULONG STDMETHODCALLTYPE Release( void ); + + //----------------------------- + // IClassFactory methods + //----------------------------- + virtual HRESULT STDMETHODCALLTYPE CreateInstance( + IUnknown __RPC_FAR *pUnkOuter, + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + + virtual HRESULT STDMETHODCALLTYPE LockServer( BOOL fLock ); + static bool IsLocked(); + +private: + long m_RefCnt; + CLSID m_Clsid; + static long s_ServerLocks; +}; + +#endif diff --git a/shell/inc/internal/propsheets.hxx b/shell/inc/internal/propsheets.hxx new file mode 100644 index 000000000000..0159379e3127 --- /dev/null +++ b/shell/inc/internal/propsheets.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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 PROPSHEETS_HXX_INCLUDED +#define PROPSHEETS_HXX_INCLUDED + +#include "internal/metainforeader.hxx" + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include <shlobj.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include <string> +#include <memory> + +class CPropertySheet : public IShellExtInit, public IShellPropSheetExt +{ +public: + CPropertySheet(long RefCnt = 1); + + virtual ~CPropertySheet(); + + //----------------------------- + // IUnknown methods + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + + virtual ULONG STDMETHODCALLTYPE AddRef( void); + + virtual ULONG STDMETHODCALLTYPE Release( void); + + //----------------------------- + // IShellExtInit + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE Initialize( + LPCITEMIDLIST pidlFolder, LPDATAOBJECT lpdobj, HKEY hkeyProgID); + + //----------------------------- + // IShellPropSheetExt + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam); + + virtual HRESULT STDMETHODCALLTYPE ReplacePage( + UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam); + +private: + // Windows callback functions + static UINT CALLBACK PropPageSummaryCallback(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp); + static BOOL CALLBACK PropPageSummaryProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam); + static BOOL CALLBACK PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam); + + + // Helper functions + void InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE lppsp); + void InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE lppsp); + +private: + long m_RefCnt; + char m_szFileName[MAX_PATH]; +}; + +#endif diff --git a/shell/inc/internal/registry.hxx b/shell/inc/internal/registry.hxx new file mode 100644 index 000000000000..25f1749a6a3c --- /dev/null +++ b/shell/inc/internal/registry.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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 REGISTRY_HXX_INCLUDED +#define REGISTRY_HXX_INCLUDED + +//----------------------------- +// registry helper functions +//----------------------------- + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include <objbase.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include <string> + +/** Sets a value of the specified registry key, an empty ValueName sets the default + value + Returns true on success +*/ +bool SetRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, const char* Value); + +/** Deletes the specified registry key and all of its subkeys + Returns true on success +*/ +bool DeleteRegistryKey(HKEY RootKey, const char* KeyName); + +/** May be used to determine if the specified registry key has subkeys + The function returns true on success else if an error occures false +*/ +bool HasSubkeysRegistryKey(HKEY RootKey, const char* KeyName, bool& bResult); + +/** Converts a GUID to its string representation +*/ +std::string ClsidToString(const CLSID& clsid); + +/** Get the content of a specific key. +*/ +bool QueryRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, char *pszData, DWORD dwBufLen); + + +#endif diff --git a/shell/inc/internal/resource.h b/shell/inc/internal/resource.h new file mode 100644 index 000000000000..3685ac5f66fc --- /dev/null +++ b/shell/inc/internal/resource.h @@ -0,0 +1,57 @@ +#ifndef RESOURCE_H_INCLUDED +#define RESOURCE_H_INCLUDED + +#define MANIFEST_RESOURCE_ID 2 +#define IDD_PROPPAGE_STATISTICS 101 +#define IDD_PROPPAGE_SUMMARY 102 +#define IDB_PROPERTY_IMAGES 103 +#define IDC_TITLE 1000 +#define IDC_SUBJECT 1001 +#define IDC_AUTHOR 1002 +#define IDC_CREATOR 1003 +#define IDC_LANGUAGE 1004 +#define IDC_COMMENTS 1005 +#define IDC_KEYWORDS 1006 +#define IDC_EXTENDED 1009 +#define IDC_DLGSIMPLE 1012 +#define IDC_STATISTICSLIST 1013 + +#define IDS_TITLE 1014 +#define IDS_SUBJECT 1015 +#define IDS_AUTHOR 1016 +#define IDS_KEYWORDS 1017 +#define IDS_COMMENTS 1018 +#define IDS_PAGES 1019 +#define IDS_TABLES 1020 +#define IDS_GRAPHICS 1021 +#define IDS_OLE_OBJECTS 1022 +#define IDS_PARAGRAPHS 1023 +#define IDS_WORDS 1024 +#define IDS_CHARACTERS 1025 +#define IDS_ROWS 1026 +#define IDS_ORIGIN 1027 +#define IDS_VERSION 1028 +#define IDS_SHEETS 1029 +#define IDS_CELLS 1030 +#define IDS_STATISTICS 1031 +#define IDS_PROPERTY 1032 +#define IDS_PROPERTY_VALUE 1033 +#define IDS_PROPPAGE_SUMMARY_TITLE 1034 +#define IDS_PROPPAGE_STATISTICS_TITLE 1035 +#define IDS_TITLE_COLON 1036 +#define IDS_SUBJECT_COLON 1037 +#define IDS_AUTHOR_COLON 1038 +#define IDS_OBJECTS 1039 +#define IDS_DOCUMENT_STATISTIC 1040 +#define IDS_MODIFIED 1041 +#define IDS_DOCUMENT_NUMBER 1042 +#define IDS_EDITING_TIME 1043 +#define IDS_DESCRIPTION 1044 +#define IDS_COMMENTS_COLON 1045 +#define IDS_MODIFIED_COLON 1046 +#define IDS_SIZE_COLON 1047 +#define IDS_TYPE_COLON 1048 + +#define IDP_SIGNET 2000 + +#endif diff --git a/shell/inc/internal/shlxthdl.hxx b/shell/inc/internal/shlxthdl.hxx new file mode 100755 index 000000000000..b13a142b6e2c --- /dev/null +++ b/shell/inc/internal/shlxthdl.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 SHLXTHDL_HXX_INCLUDED +#define SHLXTHDL_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include <objbase.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif + +// {087B3AE3-E237-4467-B8DB-5A38AB959AC9} +const CLSID CLSID_INFOTIP_HANDLER = +{0x87b3ae3, 0xe237, 0x4467, {0xb8, 0xdb, 0x5a, 0x38, 0xab, 0x95, 0x9a, 0xc9}}; + +// {C52AF81D-F7A0-4aab-8E87-F80A60CCD396} +const CLSID CLSID_COLUMN_HANDLER = +{ 0xc52af81d, 0xf7a0, 0x4aab, { 0x8e, 0x87, 0xf8, 0xa, 0x60, 0xcc, 0xd3, 0x96 } }; + +// {63542C48-9552-494a-84F7-73AA6A7C99C1} +const CLSID CLSID_PROPERTYSHEET_HANDLER = +{ 0x63542c48, 0x9552, 0x494a, { 0x84, 0xf7, 0x73, 0xaa, 0x6a, 0x7c, 0x99, 0xc1 } }; + +// {3B092F0C-7696-40e3-A80F-68D74DA84210} +const CLSID CLSID_THUMBVIEWER_HANDLER = +{ 0x3b092f0c, 0x7696, 0x40e3, { 0xa8, 0xf, 0x68, 0xd7, 0x4d, 0xa8, 0x42, 0x10 } }; + +#endif diff --git a/shell/inc/internal/stream_helper.hxx b/shell/inc/internal/stream_helper.hxx new file mode 100755 index 000000000000..2ef4529b54ce --- /dev/null +++ b/shell/inc/internal/stream_helper.hxx @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 by Sun Microsystems, Inc. + * + * 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 STREAM_HELPER_HXX_INCLUDED +#define STREAM_HELPER_HXX_INCLUDED + +#include "internal/types.hxx" + +IStream* PrepareIStream( IStream* pStream, zlib_filefunc_def &zFileFunc ); + +#endif diff --git a/shell/inc/internal/thumbviewer.hxx b/shell/inc/internal/thumbviewer.hxx new file mode 100644 index 000000000000..8c4a8979a181 --- /dev/null +++ b/shell/inc/internal/thumbviewer.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 THUMBVIEWER_HXX_INCLUDED +#define THUMBVIEWER_HXX_INCLUDED + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4917) +#endif +#include <objidl.h> +#include <shlobj.h> +#ifdef __MINGW32__ +#include <algorithm> +using std::min; +using std::max; +#endif +#include <gdiplus.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include <string> + +class CThumbviewer : public IPersistFile, public IExtractImage +{ +public: + CThumbviewer(long RefCnt = 1); + virtual ~CThumbviewer(); + + //----------------------------- + // IUnknown methods + //----------------------------- + + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void __RPC_FAR *__RPC_FAR *ppvObject); + + virtual ULONG STDMETHODCALLTYPE AddRef( void); + + virtual ULONG STDMETHODCALLTYPE Release( void); + + //---------------------------- + // IExtractImage methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE Extract(HBITMAP *phBmpImage); + + virtual HRESULT STDMETHODCALLTYPE GetLocation( + LPWSTR pszPathBuffer, + DWORD cchMax, + DWORD *pdwPriority, + const SIZE *prgSize, + DWORD dwRecClrDepth, + DWORD *pdwFlags); + + //---------------------------- + // IPersist methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pClassID); + + //---------------------------- + // IPersistFile methods + //---------------------------- + + virtual HRESULT STDMETHODCALLTYPE IsDirty(); + + virtual HRESULT STDMETHODCALLTYPE Load( + /* [in] */ LPCOLESTR pszFileName, + /* [in] */ DWORD dwMode); + + virtual HRESULT STDMETHODCALLTYPE Save( + /* [unique][in] */ LPCOLESTR pszFileName, + /* [in] */ BOOL fRemember); + + virtual HRESULT STDMETHODCALLTYPE SaveCompleted( + /* [unique][in] */ LPCOLESTR pszFileName); + + virtual HRESULT STDMETHODCALLTYPE GetCurFile( + /* [out] */ LPOLESTR __RPC_FAR *ppszFileName); + +private: + Gdiplus::Rect CalcScaledAspectRatio(Gdiplus::Rect src, Gdiplus::Rect dest); + +private: + long ref_count_; + std::wstring filename_; + SIZE thumbnail_size_; + DWORD color_depth_; + ULONG_PTR gdiplus_token_; + Gdiplus::Bitmap* signet_; +}; + +#endif diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx new file mode 100644 index 000000000000..c11692912aec --- /dev/null +++ b/shell/inc/internal/types.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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 TYPES_HXX_INCLUDED +#define TYPES_HXX_INCLUDED + +#include <string> +#include <map> +#include <utility> +#include <vector> +#include <stack> +#include <external/zlib/zlib.h> +#include <external/zlib/ioapi.h> + + +typedef std::vector<std::wstring> StringList_t; + +//+------------------------------------------------------------------------- +// +// Declare: XmlTagAttributes_t, xml tag attribute struct +// XmlTag_t, xml tag including content and attributes. +// XmlTags_t, tags defined with tag name and xml tag. +// +// Contents: Definitions of xml tag used in parser. +// +//-------------------------------------------------------------------------- +typedef std::wstring Name_t; +typedef std::wstring Value_t; +typedef std::wstring Characters_t; + +typedef std::map<Name_t, Value_t> XmlTagAttributes_t; +typedef std::pair<Characters_t, XmlTagAttributes_t> XmlTag_t; +typedef std::map<Name_t, XmlTag_t> XmlTags_t; + +const XmlTag_t EMPTY_XML_TAG = std::make_pair(std::wstring(), XmlTagAttributes_t()); + +//+------------------------------------------------------------------------- +// +// Declare: Language_t, language of the Locale pair +// Country_t, country of the Local pair +// LocaleSet_t, Local pair +// +// Contents: Definitions of Chunk properties. +// +//-------------------------------------------------------------------------- +typedef ::std::wstring Language_t; +typedef ::std::wstring Country_t; +typedef ::std::pair<Language_t, Country_t > LocaleSet_t; + +typedef ::std::wstring Content_t; +typedef ::std::pair<LocaleSet_t, Content_t > Chunk_t; +typedef ::std::vector< Chunk_t > ChunkBuffer_t; + +const LocaleSet_t EMPTY_LOCALE = ::std::make_pair(::std::wstring(), ::std::wstring()); +const Chunk_t EMPTY_CHUNK = ::std::make_pair( EMPTY_LOCALE, ::std::wstring()); + +//+------------------------------------------------------------------------- +// +// Declare: StyleName_t, style name of a style-locale pair. +// StyleLocaleMap, the map of Styple-Locale pair. +// +// Contents: Definitions of Style Names. +// +//-------------------------------------------------------------------------- +typedef ::std::wstring StyleName_t; +typedef ::std::pair <StyleName_t, LocaleSet_t> StyleLocalePair_t; +typedef ::std::map<StyleName_t, LocaleSet_t> StyleLocaleMap_t; + +const StyleLocalePair_t EMPTY_STYLELOCALE_PAIR = ::std::make_pair(::std::wstring(), EMPTY_LOCALE ); + +#endif diff --git a/shell/inc/internal/utilities.hxx b/shell/inc/internal/utilities.hxx new file mode 100755 index 000000000000..c67787c5cb9d --- /dev/null +++ b/shell/inc/internal/utilities.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 UTILITIES_HXX_INCLUDED +#define UTILITIES_HXX_INCLUDED + +#include <malloc.h> +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#ifndef OS2 +#include <windows.h> +#endif +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include <stdio.h> +#include <fcntl.h> +#include <io.h> +#include "internal/types.hxx" + +#include <string> +#define STRSAFE_NO_DEPRECATE +#include <strsafe.h> + +//--------------------------------- +/** Convert a string to a wstring + using CP_ACP +*/ +std::wstring StringToWString(const std::string& String); + +//--------------------------------- +/** Convert a wstring to a string + using CP_ACP +*/ +std::string WStringToString(const std::wstring& String); + +//--------------------------------- +/** Retrieve a string from the + resources of this module +*/ +std::wstring GetResString(int ResId); + +//--------------------------------- +/** Returns whether we are running + on Windows XP or not +*/ +bool is_windows_xp_or_above(); + +//--------------------------------- +/** helper function to judge if the string is only has spaces. + @returns + <TRUE>if the provided string contains only but at least one space + character else <FALSE/>. +*/ +bool HasOnlySpaces(const std::wstring& String); + +/** convert LocaleSet pair into Windows LCID identifier. + @returns + Windows Locale Identifier corresponding to input LocaleSet. +*/ + +//--------------------------------- +/** Convert a long path name using Windows api call GetShortPathName +*/ +std::wstring getShortPathName( const std::wstring& aLongName ); + + +#ifndef OS2 +LCID LocaleSetToLCID( const LocaleSet_t & Locale ); +#endif + +//---------------------------------------------------------- +#ifdef DEBUG +inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +{ + CHAR buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args ); + OutputDebugStringA( buffer ); +} +#else +static inline void OutputDebugStringFormat( LPCSTR, ... ) +{ +} +#endif +//---------------------------------------------------------- + + +#endif diff --git a/shell/inc/internal/xml_parser.hxx b/shell/inc/internal/xml_parser.hxx new file mode 100644 index 000000000000..57e8a4fd6d88 --- /dev/null +++ b/shell/inc/internal/xml_parser.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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 _XML_PARSER_HXX_ +#define _XML_PARSER_HXX_ + +#include <expat.h> +#include <stdexcept> + +//----------------------------------------------------- +class xml_parser_exception : public std::runtime_error +{ +public: + + xml_parser_exception( + const std::string& error_msg, + int error_code, + int line_number, + int column_number, + long byte_index) : + std::runtime_error(error_msg), + error_code_(error_code), + line_number_(line_number), + column_number_(column_number), + byte_index_(byte_index) + {} + + int error_code_; + int line_number_; + int column_number_; + long byte_index_; +}; + + +//----------------------------------------------------- +// Simple wrapper around expat, the xml parser library +// created by James Clark +//----------------------------------------------------- +class i_xml_parser_event_handler; + +class xml_parser +{ +public: + //######################################################## + xml_parser(const XML_Char* EncodingName = 0); + + //######################################################## + ~xml_parser(); + + //######################################################## + /** Parse a XML data stream + + @param pXmlData + Pointer to a buffer containing the xml data + + @param Length + Length of the buffer containing the xml data + + @param IsFinal + Indicates whether these are the last xml data + of an xml document to parse. For very large + xml documents it may be usefull to read and + parse the document partially. + + @precond XmlData must not be null + + @throws SaxException + If the used Sax parser returns an error. The SaxException + contains detailed information about the error. */ + void parse(const char* XmlData, size_t Length, bool IsFinal = true); + + //######################################################## + /** Set a document handler + + @descr A document handler implements the interface i_xml_parser_event_handler. + The document handler receive notifications of various events + from the sax parser for instance "start_document". + + The client is responsible for the life time management of + the given document handler, that means the document handler + instance must exist until a new one was set or until the parser + no longer exist. + + @param SaxDocumentHandler + The new document handler, may be null if not interessted in + sax parser events. + + @postcond currently used document handler == pSaxDocumentHandler */ + void set_document_handler(i_xml_parser_event_handler* event_handler); + + //######################################################## + /** Returns the currently used document handler or null if + no document handler was set before. */ + i_xml_parser_event_handler* get_document_handler() const; +private: + + void init(); + +private: + i_xml_parser_event_handler* document_handler_; + XML_Parser xml_parser_; + +// prevent copy and assignment +private: + xml_parser(const xml_parser&); + xml_parser& operator=(const xml_parser&); +}; + +#endif + diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx new file mode 100644 index 000000000000..a3e3575082c0 --- /dev/null +++ b/shell/inc/internal/zipfile.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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 ZIPFILE_HXX_INCLUDED +#define ZIPFILE_HXX_INCLUDED + +#ifndef _WINDOWS +#define _WINDOWS +#endif + + +#include <external/zlib/unzip.h> + + +#include <string> +#include <vector> +#include <memory> + +/** A simple zip content provider based on the zlib +*/ + +class ZipFile +{ +public: + + typedef std::vector<std::string> Directory_t; + typedef std::auto_ptr<Directory_t> DirectoryPtr_t; + typedef std::vector<char> ZipContentBuffer_t; + +public: + + /** 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 + */ + static bool IsZipFile(const std::string& FileName); + + static bool IsZipFile(void* stream); + + + /** 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 + */ + static bool IsValidZipFileVersionNumber(const std::string& FileName); + + static bool IsValidZipFileVersionNumber(void* stream); + +public: + + /** 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(const std::string& FileName); + + ZipFile(void* stream, zlib_filefunc_def* fa); + + + /** Destroys a zip file + */ + ~ZipFile(); + + /** Provides an interface to read the uncompressed data of a content of the zip file + + @param ContentName + The name of the content in the zip file + + @param ppstm + Pointer to pointer, will receive an interface pointer + to IUnknown on success + + @precond The specified content must exist in this file + ppstm must not be NULL + + @throws std::bad_alloc if the necessary buffer could not be + allocated + ZipException if an zip error occurs + ZipContentMissException if the specified zip content + does not exist in this zip file + */ + void GetUncompressedContent(const std::string& ContentName, /*inout*/ ZipContentBuffer_t& ContentBuffer); + + /** Returns a list with the content names contained within this file + + @throws ZipException if an error in the zlib happens + */ + DirectoryPtr_t GetDirectory() const; + + /** Convinience query function may even realized with + iterating over a ZipFileDirectory returned by + GetDirectory + */ + bool HasContent(const std::string& ContentName) const; + +private: + + /** Returns the length of the longest file name + in the current zip file + + @throws ZipException if an zip error occurs + */ + long GetFileLongestFileNameLength() const; + +private: + unzFile m_uzFile; +}; + +#endif + |